package cn.huge.module.mediate.utils;
|
|
import cn.huge.base.common.constant.GzRegionBaseEnum;
|
import cn.huge.base.common.utils.DateUtils;
|
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
|
/**
|
* @title: 纠纷调解案号生成工具
|
* @description: 纠纷调解案号生成工具
|
* @company: hugeinfo
|
* @author: liyj
|
* @time: 2021-11-05 16:51:48
|
* @version: 1.0.0
|
*/
|
public class CaseNoUtils {
|
|
/**
|
* 常量前缀
|
*/
|
public static String CASE_NO_SIGN_TH = "天河调";
|
public static String CASE_NO_SIGN_HZ = "海珠调";
|
public static String CASE_NO_SIGN_LW = "荔湾调";
|
public static String CASE_NO_SIGN_YX = "越秀调";
|
public static String CASE_NO_SIGN_PY = "番禺调";
|
public static String CASE_NO_SIGN_HD = "花都调";
|
public static String CASE_NO_SIGN_BY = "粤云调";
|
public static String CASE_NO_SIGN_NS = "南沙调";
|
public static String CASE_NO_SIGN_HP = "黄埔调";
|
public static String CASE_NO_SIGN_ZC = "增城调";
|
public static String CASE_NO_SIGN_CH = "从化调";
|
public static String CASE_NO_SIGN_GZ = "粤调";
|
|
/**
|
* 序号
|
*/
|
public static int CASE_NO_COUNT_TH = 0;
|
public static int CASE_NO_COUNT_HZ = 0;
|
public static int CASE_NO_COUNT_LW = 0;
|
public static int CASE_NO_COUNT_YX = 0;
|
public static int CASE_NO_COUNT_PY = 0;
|
public static int CASE_NO_COUNT_HD = 0;
|
public static int CASE_NO_COUNT_BY = 0;
|
public static int CASE_NO_COUNT_NS = 0;
|
public static int CASE_NO_COUNT_HP = 0;
|
public static int CASE_NO_COUNT_ZC = 0;
|
public static int CASE_NO_COUNT_CH = 0;
|
public static int CASE_NO_COUNT_GZ = 0;
|
|
/**
|
* 是否要重新查询,true是
|
*/
|
public static boolean CASE_NO_FLAG_TH = true;
|
public static boolean CASE_NO_FLAG_HZ = true;
|
public static boolean CASE_NO_FLAG_LW = true;
|
public static boolean CASE_NO_FLAG_YX = true;
|
public static boolean CASE_NO_FLAG_PY = true;
|
public static boolean CASE_NO_FLAG_HD = true;
|
public static boolean CASE_NO_FLAG_BY = true;
|
public static boolean CASE_NO_FLAG_NS = true;
|
public static boolean CASE_NO_FLAG_HP = true;
|
public static boolean CASE_NO_FLAG_ZC = true;
|
public static boolean CASE_NO_FLAG_CH = true;
|
public static boolean CASE_NO_FLAG_GZ = true;
|
|
/**
|
* 判断是否要重新查询
|
* @return
|
*/
|
public synchronized static Boolean getFlag(String area){
|
if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)){
|
return CASE_NO_FLAG_TH;
|
}else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)){
|
return CASE_NO_FLAG_HZ;
|
}else if (GzRegionBaseEnum.AREA_3.getIndex().equals(area)){
|
return CASE_NO_FLAG_LW;
|
}else if (GzRegionBaseEnum.AREA_4.getIndex().equals(area)){
|
return CASE_NO_FLAG_YX;
|
}else if (GzRegionBaseEnum.AREA_5.getIndex().equals(area)){
|
return CASE_NO_FLAG_PY;
|
}else if (GzRegionBaseEnum.AREA_6.getIndex().equals(area)){
|
return CASE_NO_FLAG_HD;
|
}else if (GzRegionBaseEnum.AREA_7.getIndex().equals(area)){
|
return CASE_NO_FLAG_BY;
|
}else if (GzRegionBaseEnum.AREA_8.getIndex().equals(area)){
|
return CASE_NO_FLAG_NS;
|
}else if (GzRegionBaseEnum.AREA_9.getIndex().equals(area)){
|
return CASE_NO_FLAG_HP;
|
}else if (GzRegionBaseEnum.AREA_10.getIndex().equals(area)){
|
return CASE_NO_FLAG_ZC;
|
}else if (GzRegionBaseEnum.AREA_11.getIndex().equals(area)){
|
return CASE_NO_FLAG_CH;
|
}else {
|
return CASE_NO_FLAG_GZ;
|
}
|
}
|
|
/**
|
* 设置是否要重新查询
|
* @return
|
*/
|
public synchronized static void setFlag(String area, boolean flag){
|
if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)){
|
CASE_NO_FLAG_TH = flag;
|
}else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)){
|
CASE_NO_FLAG_HZ = flag;
|
}else if (GzRegionBaseEnum.AREA_3.getIndex().equals(area)){
|
CASE_NO_FLAG_LW = flag;
|
}else if (GzRegionBaseEnum.AREA_4.getIndex().equals(area)){
|
CASE_NO_FLAG_YX = flag;
|
}else if (GzRegionBaseEnum.AREA_5.getIndex().equals(area)){
|
CASE_NO_FLAG_PY = flag;
|
}else if (GzRegionBaseEnum.AREA_6.getIndex().equals(area)){
|
CASE_NO_FLAG_HD = flag;
|
}else if (GzRegionBaseEnum.AREA_7.getIndex().equals(area)){
|
CASE_NO_FLAG_BY = flag;
|
}else if (GzRegionBaseEnum.AREA_8.getIndex().equals(area)){
|
CASE_NO_FLAG_NS = flag;
|
}else if (GzRegionBaseEnum.AREA_9.getIndex().equals(area)){
|
CASE_NO_FLAG_HP = flag;
|
}else if (GzRegionBaseEnum.AREA_10.getIndex().equals(area)){
|
CASE_NO_FLAG_ZC = flag;
|
}else if (GzRegionBaseEnum.AREA_11.getIndex().equals(area)){
|
CASE_NO_FLAG_CH = flag;
|
}else {
|
CASE_NO_FLAG_GZ = flag;
|
}
|
}
|
|
/**
|
* 获取前缀
|
* @return
|
*/
|
public synchronized static String getSign(String area){
|
StringBuffer caseNoSign = new StringBuffer();
|
// 设置年号
|
int year = DateUtils.getYear(DateUtils.getNowDate());
|
caseNoSign.append("(").append(year).append(")");
|
if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)){
|
caseNoSign.append(CASE_NO_SIGN_TH);
|
}else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)){
|
caseNoSign.append(CASE_NO_SIGN_HZ);
|
}else if (GzRegionBaseEnum.AREA_3.getIndex().equals(area)){
|
caseNoSign.append(CASE_NO_SIGN_LW);
|
}else if (GzRegionBaseEnum.AREA_4.getIndex().equals(area)){
|
caseNoSign.append(CASE_NO_SIGN_YX);
|
}else if (GzRegionBaseEnum.AREA_5.getIndex().equals(area)){
|
caseNoSign.append(CASE_NO_SIGN_PY);
|
}else if (GzRegionBaseEnum.AREA_6.getIndex().equals(area)){
|
caseNoSign.append(CASE_NO_SIGN_HD);
|
}else if (GzRegionBaseEnum.AREA_7.getIndex().equals(area)){
|
caseNoSign.append(CASE_NO_SIGN_BY);
|
}else if (GzRegionBaseEnum.AREA_8.getIndex().equals(area)){
|
caseNoSign.append(CASE_NO_SIGN_NS);
|
}else if (GzRegionBaseEnum.AREA_9.getIndex().equals(area)){
|
caseNoSign.append(CASE_NO_SIGN_HP);
|
}else if (GzRegionBaseEnum.AREA_10.getIndex().equals(area)){
|
caseNoSign.append(CASE_NO_SIGN_ZC);
|
}else if (GzRegionBaseEnum.AREA_11.getIndex().equals(area)){
|
caseNoSign.append(CASE_NO_SIGN_CH);
|
}else {
|
caseNoSign.append(CASE_NO_SIGN_GZ);
|
}
|
return caseNoSign.toString();
|
}
|
|
/**
|
* 设置常量数
|
* @return
|
*/
|
public synchronized static void setCount(String area, int num){
|
if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)){
|
CASE_NO_COUNT_TH = num;
|
}else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)){
|
CASE_NO_COUNT_HZ = num;
|
}else if (GzRegionBaseEnum.AREA_3.getIndex().equals(area)){
|
CASE_NO_COUNT_LW = num;
|
}else if (GzRegionBaseEnum.AREA_4.getIndex().equals(area)){
|
CASE_NO_COUNT_YX = num;
|
}else if (GzRegionBaseEnum.AREA_5.getIndex().equals(area)){
|
CASE_NO_COUNT_PY = num;
|
}else if (GzRegionBaseEnum.AREA_6.getIndex().equals(area)){
|
CASE_NO_COUNT_HD = num;
|
}else if (GzRegionBaseEnum.AREA_7.getIndex().equals(area)){
|
CASE_NO_COUNT_BY = num;
|
}else if (GzRegionBaseEnum.AREA_8.getIndex().equals(area)){
|
CASE_NO_COUNT_NS = num;
|
}else if (GzRegionBaseEnum.AREA_9.getIndex().equals(area)){
|
CASE_NO_COUNT_HP = num;
|
}else if (GzRegionBaseEnum.AREA_10.getIndex().equals(area)){
|
CASE_NO_COUNT_ZC = num;
|
}else if (GzRegionBaseEnum.AREA_11.getIndex().equals(area)){
|
CASE_NO_COUNT_CH = num;
|
}else {
|
CASE_NO_COUNT_GZ = num;
|
}
|
}
|
|
/**
|
* 获取案号
|
* @return
|
*/
|
public synchronized static String getCaseNo(String area){
|
StringBuffer caseNo = new StringBuffer();
|
// 设置前缀
|
caseNo.append(getSign(area));
|
if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)){
|
// 当前序号+1
|
CASE_NO_COUNT_TH += 1;
|
caseNo.append(CASE_NO_COUNT_TH).append("号");
|
}else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)){
|
// 当前序号+1
|
CASE_NO_COUNT_HZ += 1;
|
caseNo.append(CASE_NO_COUNT_HZ).append("号");
|
}else if (GzRegionBaseEnum.AREA_3.getIndex().equals(area)){
|
// 当前序号+1
|
CASE_NO_COUNT_LW += 1;
|
caseNo.append(CASE_NO_COUNT_LW).append("号");
|
}else if (GzRegionBaseEnum.AREA_4.getIndex().equals(area)){
|
// 当前序号+1
|
CASE_NO_COUNT_YX += 1;
|
caseNo.append(CASE_NO_COUNT_YX).append("号");
|
}else if (GzRegionBaseEnum.AREA_5.getIndex().equals(area)){
|
// 当前序号+1
|
CASE_NO_COUNT_PY += 1;
|
caseNo.append(CASE_NO_COUNT_PY).append("号");
|
}else if (GzRegionBaseEnum.AREA_6.getIndex().equals(area)){
|
// 当前序号+1
|
CASE_NO_COUNT_HD += 1;
|
caseNo.append(CASE_NO_COUNT_HD).append("号");
|
}else if (GzRegionBaseEnum.AREA_7.getIndex().equals(area)){
|
// 当前序号+1
|
CASE_NO_COUNT_BY += 1;
|
caseNo.append(CASE_NO_COUNT_BY).append("号");
|
}else if (GzRegionBaseEnum.AREA_8.getIndex().equals(area)){
|
// 当前序号+1
|
CASE_NO_COUNT_NS += 1;
|
caseNo.append(CASE_NO_COUNT_NS).append("号");
|
}else if (GzRegionBaseEnum.AREA_9.getIndex().equals(area)){
|
// 当前序号+1
|
CASE_NO_COUNT_HP += 1;
|
caseNo.append(CASE_NO_COUNT_HP).append("号");
|
}else if (GzRegionBaseEnum.AREA_10.getIndex().equals(area)){
|
// 当前序号+1
|
CASE_NO_COUNT_ZC += 1;
|
caseNo.append(CASE_NO_COUNT_ZC).append("号");
|
}else if (GzRegionBaseEnum.AREA_11.getIndex().equals(area)){
|
// 当前序号+1
|
CASE_NO_COUNT_CH += 1;
|
caseNo.append(CASE_NO_COUNT_CH).append("号");
|
}else {
|
// 当前序号+1
|
CASE_NO_COUNT_GZ += 1;
|
caseNo.append(CASE_NO_COUNT_GZ).append("号");
|
}
|
System.out.println(caseNo.toString());
|
return caseNo.toString();
|
}
|
}
|
/**
|
* -------------------_ooOoo_-------------------
|
* ------------------o8888888o------------------
|
* ------------------88" . "88------------------
|
* ------------------(| -_- |)------------------
|
* ------------------O\ = /O------------------
|
* ---------------____/`---'\____---------------
|
* -------------.' \\| |// `.-------------
|
* ------------/ \\||| : |||// \------------
|
* -----------/ _||||| -:- |||||- \-----------
|
* -----------| | \\\ - /// | |-----------
|
* -----------| \_| ''\---/'' | |-----------
|
* -----------\ .-\__ `-` ___/-. /-----------
|
* ---------___`. .' /--.--\ `. . __----------
|
* ------."" '< `.___\_<|>_/___.' >'"".-------
|
* -----| | : `- \`.;`\ _ /`;.`/ - ` : | |-----
|
* -----\ \ `-. \_ __\ /__ _/ .-` / /-----
|
* ======`-.____`-.___\_____/___.-`____.-'======
|
* -------------------`=---='
|
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
* ---------佛祖保佑---hugeinfo---永无BUG----------
|
*/
|