广州市综治平台后端
xusd
2025-06-07 36306491396230522fa20585c2621a7fc899849a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
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 CaseRefUtils {
 
    /**
     * 常量前缀
     */
    public static String CASE_REF_SIGN_TH = "GZTH";
    public static String CASE_REF_SIGN_HZ = "GZHZ";
    public static String CASE_REF_SIGN_LW = "GZLW";
    public static String CASE_REF_SIGN_YX = "GZYX";
    public static String CASE_REF_SIGN_PY = "GZPY";
    public static String CASE_REF_SIGN_HD = "GZHD";
    public static String CASE_REF_SIGN_BY = "GZBY";
    public static String CASE_REF_SIGN_NS = "GZNS";
    public static String CASE_REF_SIGN_HP = "GZHP";
    public static String CASE_REF_SIGN_ZC = "GZZC";
    public static String CASE_REF_SIGN_CH = "GZCH";
    public static String CASE_REF_SIGN_GZ = "GZ";
 
    public static String NEW_CASE_REF_SIGN_TH = "06";
    public static String NEW_CASE_REF_SIGN_HZ = "05";
    public static String NEW_CASE_REF_SIGN_LW = "03";
    public static String NEW_CASE_REF_SIGN_YX = "04";
    public static String NEW_CASE_REF_SIGN_PY = "13";
    public static String NEW_CASE_REF_SIGN_HD = "14";
    public static String NEW_CASE_REF_SIGN_BY = "11";
    public static String NEW_CASE_REF_SIGN_NS = "15";
    public static String NEW_CASE_REF_SIGN_HP = "12";
    public static String NEW_CASE_REF_SIGN_ZC = "18";
    public static String NEW_CASE_REF_SIGN_CH = "17";
 
    /**
     * 序号
     */
    public static int CASE_REF_COUNT_CITY = 0;
    public static int CASE_REF_COUNT_TH = 0;
    public static int CASE_REF_COUNT_HZ = 0;
    public static int CASE_REF_COUNT_LW = 0;
    public static int CASE_REF_COUNT_YX = 0;
    public static int CASE_REF_COUNT_PY = 0;
    public static int CASE_REF_COUNT_HD = 0;
    public static int CASE_REF_COUNT_BY = 0;
    public static int CASE_REF_COUNT_NS = 0;
    public static int CASE_REF_COUNT_HP = 0;
    public static int CASE_REF_COUNT_ZC = 0;
    public static int CASE_REF_COUNT_CH = 0;
    public static int CASE_REF_COUNT_GZ = 0;
 
    /**
     * 是否要重新查询,true是
     */
    public static boolean CASE_REF_FLAG_TH = true;
    public static boolean CASE_REF_FLAG_HZ = true;
    public static boolean CASE_REF_FLAG_LW = true;
    public static boolean CASE_REF_FLAG_YX = true;
    public static boolean CASE_REF_FLAG_PY = true;
    public static boolean CASE_REF_FLAG_HD = true;
    public static boolean CASE_REF_FLAG_BY = true;
    public static boolean CASE_REF_FLAG_NS = true;
    public static boolean CASE_REF_FLAG_HP = true;
    public static boolean CASE_REF_FLAG_ZC = true;
    public static boolean CASE_REF_FLAG_CH = true;
    public static boolean CASE_REF_FLAG_GZ = true;
 
    /**
     * 判断是否要重新查询
     *
     * @return
     */
    public synchronized static Boolean getFlag(String area) {
        if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)) {
            return CASE_REF_FLAG_TH;
        } else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)) {
            return CASE_REF_FLAG_HZ;
        } else if (GzRegionBaseEnum.AREA_3.getIndex().equals(area)) {
            return CASE_REF_FLAG_LW;
        } else if (GzRegionBaseEnum.AREA_4.getIndex().equals(area)) {
            return CASE_REF_FLAG_YX;
        } else if (GzRegionBaseEnum.AREA_5.getIndex().equals(area)) {
            return CASE_REF_FLAG_PY;
        } else if (GzRegionBaseEnum.AREA_6.getIndex().equals(area)) {
            return CASE_REF_FLAG_HD;
        } else if (GzRegionBaseEnum.AREA_7.getIndex().equals(area)) {
            return CASE_REF_FLAG_BY;
        } else if (GzRegionBaseEnum.AREA_8.getIndex().equals(area)) {
            return CASE_REF_FLAG_NS;
        } else if (GzRegionBaseEnum.AREA_9.getIndex().equals(area)) {
            return CASE_REF_FLAG_HP;
        } else if (GzRegionBaseEnum.AREA_10.getIndex().equals(area)) {
            return CASE_REF_FLAG_ZC;
        } else if (GzRegionBaseEnum.AREA_11.getIndex().equals(area)) {
            return CASE_REF_FLAG_CH;
        } else {
            return CASE_REF_FLAG_GZ;
        }
    }
 
    /**
     * 设置是否要重新查询
     *
     * @return
     */
    public synchronized static void setFlag(String area, boolean flag) {
        if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)) {
            CASE_REF_FLAG_TH = flag;
        } else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)) {
            CASE_REF_FLAG_HZ = flag;
        } else if (GzRegionBaseEnum.AREA_3.getIndex().equals(area)) {
            CASE_REF_FLAG_LW = flag;
        } else if (GzRegionBaseEnum.AREA_4.getIndex().equals(area)) {
            CASE_REF_FLAG_YX = flag;
        } else if (GzRegionBaseEnum.AREA_5.getIndex().equals(area)) {
            CASE_REF_FLAG_PY = flag;
        } else if (GzRegionBaseEnum.AREA_6.getIndex().equals(area)) {
            CASE_REF_FLAG_HD = flag;
        } else if (GzRegionBaseEnum.AREA_7.getIndex().equals(area)) {
            CASE_REF_FLAG_BY = flag;
        } else if (GzRegionBaseEnum.AREA_8.getIndex().equals(area)) {
            CASE_REF_FLAG_NS = flag;
        } else if (GzRegionBaseEnum.AREA_9.getIndex().equals(area)) {
            CASE_REF_FLAG_HP = flag;
        } else if (GzRegionBaseEnum.AREA_10.getIndex().equals(area)) {
            CASE_REF_FLAG_ZC = flag;
        } else if (GzRegionBaseEnum.AREA_11.getIndex().equals(area)) {
            CASE_REF_FLAG_CH = flag;
        } else {
            CASE_REF_FLAG_GZ = flag;
        }
    }
 
    /**
     * 获取前缀
     *
     * @return
     */
    public synchronized static String getSign(String area) {
        SimpleDateFormat sdf = new SimpleDateFormat("yy");
        String nowYear = sdf.format(new Date());
        if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)) {
            return CASE_REF_SIGN_TH + "-" + nowYear;
        } else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)) {
            return CASE_REF_SIGN_HZ + "-" + nowYear;
        } else if (GzRegionBaseEnum.AREA_3.getIndex().equals(area)) {
            return CASE_REF_SIGN_LW + "-" + nowYear;
        } else if (GzRegionBaseEnum.AREA_4.getIndex().equals(area)) {
            return CASE_REF_SIGN_YX + "-" + nowYear;
        } else if (GzRegionBaseEnum.AREA_5.getIndex().equals(area)) {
            return CASE_REF_SIGN_PY + "-" + nowYear;
        } else if (GzRegionBaseEnum.AREA_6.getIndex().equals(area)) {
            return CASE_REF_SIGN_HD + "-" + nowYear;
        } else if (GzRegionBaseEnum.AREA_7.getIndex().equals(area)) {
            return CASE_REF_SIGN_BY + "-" + nowYear;
        } else if (GzRegionBaseEnum.AREA_8.getIndex().equals(area)) {
            return CASE_REF_SIGN_NS + "-" + nowYear;
        } else if (GzRegionBaseEnum.AREA_9.getIndex().equals(area)) {
            return CASE_REF_SIGN_HP + "-" + nowYear;
        } else if (GzRegionBaseEnum.AREA_10.getIndex().equals(area)) {
            return CASE_REF_SIGN_ZC + "-" + nowYear;
        } else if (GzRegionBaseEnum.AREA_11.getIndex().equals(area)) {
            return CASE_REF_SIGN_CH + "-" + nowYear;
        } else {
            return CASE_REF_SIGN_GZ + "-" + nowYear;
        }
    }
 
    /**
     * 设置常量数
     *
     * @return
     */
    public synchronized static void setCount(String area, int num) {
        if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)) {
            CASE_REF_COUNT_TH = num;
        } else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)) {
            CASE_REF_COUNT_HZ = num;
        } else if (GzRegionBaseEnum.AREA_3.getIndex().equals(area)) {
            CASE_REF_COUNT_LW = num;
        } else if (GzRegionBaseEnum.AREA_4.getIndex().equals(area)) {
            CASE_REF_COUNT_YX = num;
        } else if (GzRegionBaseEnum.AREA_5.getIndex().equals(area)) {
            CASE_REF_COUNT_PY = num;
        } else if (GzRegionBaseEnum.AREA_6.getIndex().equals(area)) {
            CASE_REF_COUNT_HD = num;
        } else if (GzRegionBaseEnum.AREA_7.getIndex().equals(area)) {
            CASE_REF_COUNT_BY = num;
        } else if (GzRegionBaseEnum.AREA_8.getIndex().equals(area)) {
            CASE_REF_COUNT_NS = num;
        } else if (GzRegionBaseEnum.AREA_9.getIndex().equals(area)) {
            CASE_REF_COUNT_HP = num;
        } else if (GzRegionBaseEnum.AREA_10.getIndex().equals(area)) {
            CASE_REF_COUNT_ZC = num;
        } else if (GzRegionBaseEnum.AREA_11.getIndex().equals(area)) {
            CASE_REF_COUNT_CH = num;
        } else {
            CASE_REF_COUNT_GZ = num;
        }
    }
 
    /**
     * 获取事项编号
     *
     * @return
     */
    public synchronized static String getCaseRsf(String area) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
        String nowDay = sdf.format(new Date());
        StringBuffer caseRef = new StringBuffer();
        // 获取对应区的编码
        if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)) {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_TH += 1;
            if (CASE_REF_COUNT_TH > 99999) {
                CASE_REF_COUNT_TH = 1;
            }
            // 设置前缀
            caseRef.append(CASE_REF_SIGN_TH);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_TH));
        } else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)) {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_HZ += 1;
            if (CASE_REF_COUNT_HZ > 99999) {
                CASE_REF_COUNT_HZ = 1;
            }
            caseRef.append(CASE_REF_SIGN_HZ);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_HZ));
        } else if (GzRegionBaseEnum.AREA_3.getIndex().equals(area)) {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_LW += 1;
            if (CASE_REF_COUNT_LW > 99999) {
                CASE_REF_COUNT_LW = 1;
            }
            caseRef.append(CASE_REF_SIGN_LW);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_LW));
        } else if (GzRegionBaseEnum.AREA_4.getIndex().equals(area)) {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_YX += 1;
            if (CASE_REF_COUNT_YX > 99999) {
                CASE_REF_COUNT_YX = 1;
            }
            caseRef.append(CASE_REF_SIGN_YX);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_YX));
        } else if (GzRegionBaseEnum.AREA_5.getIndex().equals(area)) {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_PY += 1;
            if (CASE_REF_COUNT_PY > 99999) {
                CASE_REF_COUNT_PY = 1;
            }
            caseRef.append(CASE_REF_SIGN_PY);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_PY));
        } else if (GzRegionBaseEnum.AREA_6.getIndex().equals(area)) {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_HD += 1;
            if (CASE_REF_COUNT_HD > 99999) {
                CASE_REF_COUNT_HD = 1;
            }
            caseRef.append(CASE_REF_SIGN_HD);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_HD));
        } else if (GzRegionBaseEnum.AREA_7.getIndex().equals(area)) {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_BY += 1;
            if (CASE_REF_COUNT_BY > 99999) {
                CASE_REF_COUNT_BY = 1;
            }
            caseRef.append(CASE_REF_SIGN_BY);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_BY));
        } else if (GzRegionBaseEnum.AREA_8.getIndex().equals(area)) {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_NS += 1;
            if (CASE_REF_COUNT_NS > 99999) {
                CASE_REF_COUNT_NS = 1;
            }
            caseRef.append(CASE_REF_SIGN_NS);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_NS));
        } else if (GzRegionBaseEnum.AREA_9.getIndex().equals(area)) {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_HP += 1;
            if (CASE_REF_COUNT_HP > 99999) {
                CASE_REF_COUNT_HP = 1;
            }
            caseRef.append(CASE_REF_SIGN_HP);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_HP));
        } else if (GzRegionBaseEnum.AREA_10.getIndex().equals(area)) {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_ZC += 1;
            if (CASE_REF_COUNT_ZC > 99999) {
                CASE_REF_COUNT_ZC = 1;
            }
            caseRef.append(CASE_REF_SIGN_ZC);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_ZC));
        } else if (GzRegionBaseEnum.AREA_11.getIndex().equals(area)) {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_CH += 1;
            if (CASE_REF_COUNT_CH > 99999) {
                CASE_REF_COUNT_CH = 1;
            }
            caseRef.append(CASE_REF_SIGN_CH);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_CH));
        } else {
            // 当前事项序号+1,大于99999就重置0
            CASE_REF_COUNT_GZ += 1;
            if (CASE_REF_COUNT_GZ > 99999) {
                CASE_REF_COUNT_GZ = 1;
            }
            caseRef.append(CASE_REF_SIGN_GZ);
            // 设置当天日期
            caseRef.append("-").append(nowDay);
            // 设置事项序号
            caseRef.append("-").append(String.format("%05d", CASE_REF_COUNT_GZ));
        }
        System.out.println(caseRef.toString());
        return caseRef.toString();
    }
 
    public synchronized static String getCaseRsfNew(String area, String source, String business) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
        String nowDay = sdf.format(new Date());
        StringBuffer caseRef = new StringBuffer();
        CASE_REF_COUNT_CITY += 1;
        if (CASE_REF_COUNT_CITY > 99999) {
            CASE_REF_COUNT_CITY = 1;
        }
        // 设置当天日期
        caseRef.append(nowDay);
        // 获取对应区的编码
        if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)) {
            // 设置区域
            caseRef.append(NEW_CASE_REF_SIGN_TH);
 
        } else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)) {
 
            // 设置区域
            caseRef.append(NEW_CASE_REF_SIGN_HZ);
 
        } else if (GzRegionBaseEnum.AREA_3.getIndex().equals(area)) {
 
            // 设置区域
            caseRef.append(NEW_CASE_REF_SIGN_LW);
 
 
        } else if (GzRegionBaseEnum.AREA_4.getIndex().equals(area)) {
 
            // 设置区域
            caseRef.append(NEW_CASE_REF_SIGN_YX);
 
 
        } else if (GzRegionBaseEnum.AREA_5.getIndex().equals(area)) {
 
            // 设置区域
            caseRef.append(NEW_CASE_REF_SIGN_PY);
 
 
        } else if (GzRegionBaseEnum.AREA_6.getIndex().equals(area)) {
 
            // 设置区域
            caseRef.append(NEW_CASE_REF_SIGN_HD);
 
 
        } else if (GzRegionBaseEnum.AREA_7.getIndex().equals(area)) {
 
            caseRef.append(NEW_CASE_REF_SIGN_BY);
 
        } else if (GzRegionBaseEnum.AREA_8.getIndex().equals(area)) {
 
            caseRef.append(NEW_CASE_REF_SIGN_NS);
 
        } else if (GzRegionBaseEnum.AREA_9.getIndex().equals(area)) {
 
            caseRef.append(NEW_CASE_REF_SIGN_HP);
 
        } else if (GzRegionBaseEnum.AREA_10.getIndex().equals(area)) {
 
            caseRef.append(NEW_CASE_REF_SIGN_ZC);
 
        } else if (GzRegionBaseEnum.AREA_11.getIndex().equals(area)) {
 
            caseRef.append(NEW_CASE_REF_SIGN_CH);
 
        } else {
            caseRef.append(CASE_REF_SIGN_GZ);
 
        }
        // 设置业务
        caseRef.append(business);
        // 设置来源
        caseRef.append(source);
        // 设置事项序号
        caseRef.append(String.format("%07d", CASE_REF_COUNT_CITY));
        System.out.println(caseRef.toString());
        return caseRef.toString();
    }
}
/**
 * -------------------_ooOoo_-------------------
 * ------------------o8888888o------------------
 * ------------------88" . "88------------------
 * ------------------(| -_- |)------------------
 * ------------------O\  =  /O------------------
 * ---------------____/`---'\____---------------
 * -------------.'  \\|     |//  `.-------------
 * ------------/  \\|||  :  |||//  \------------
 * -----------/  _||||| -:- |||||-  \-----------
 * -----------|   | \\\  -  /// |   |-----------
 * -----------| \_|  ''\---/''  |   |-----------
 * -----------\  .-\__  `-`  ___/-. /-----------
 * ---------___`. .'  /--.--\  `. . __----------
 * ------."" '<  `.___\_<|>_/___.'  >'"".-------
 * -----| | :  `- \`.;`\ _ /`;.`/ - ` : | |-----
 * -----\  \ `-.   \_ __\ /__ _/   .-` /  /-----
 * ======`-.____`-.___\_____/___.-`____.-'======
 * -------------------`=---='
 * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 * ---------佛祖保佑---hugeinfo---永无BUG----------
 */