Commit 540cd54a authored by tianyiming's avatar tianyiming

添加西咸新区生成96333码和监管码规则

parent 285586bc
......@@ -214,4 +214,11 @@ public class IdxBizJgUseInfo extends TzsBaseEntity {
@TableField("\"DATA_SOURCE\"")
private String dataSource;
/**
* 是否西咸
*/
@TableField("\"IS_NOT_XIXIAN\"")
private String isNotXiXian;
}
......@@ -451,6 +451,7 @@
USE_STATE_CHANGE_DATE,
USE_UNIT_CREDIT_CODE,
USE_UNIT_NAME,
IS_NOT_XIXIAN,
RECORD as id,
SEQUENCE_NBR as sequenceNbr
from idx_biz_jg_use_info
......
......@@ -239,6 +239,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private static final String STREET_LEVEL = "4";
//西安行政区划code
private static final String XIAN = "610100";
//咸阳行政区划code
private static final String XIAN_YANG = "610400";
//判断行政区划查询市还是区
private static final String END_CODE = "0000";
//判断行政区划查询街道
......@@ -452,7 +454,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
//生成码
EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy();
Map<String, String> codeMap = categoryService.creatCode(city, county, equipCategory, null, null);
Map<String, String> codeMap = categoryService.creatCode(null,city, county, equipCategory, null, null);
if (ObjectUtils.isEmpty(codeMap)) {
return new HashMap<>();
}
......@@ -686,7 +688,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* 具体生成监管码和电梯96333识别码逻辑
*/
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public synchronized Map<String, String> creatCode(String city, String county, String equipCategory, String code96333, String supervisionCode) {
public synchronized Map<String, String> creatCode(String isNotXiXian,String city, String county, String equipCategory, String code96333, String supervisionCode) {
RLock lock = redissonClient.getLock(LOCK_KEY);
Map<String, String> resultMap = null;
try {
......@@ -698,11 +700,15 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
CategoryOtherInfo categoryOtherInfo = new CategoryOtherInfo();
String prefix;
//判断是否需要生成96333电梯码
if (equipCategory.startsWith("3") && !XIAN.equals(city)) {
if (equipCategory.startsWith("3") && (((XIAN.equals(city) || XIAN_YANG.equals(city)) && "1".equals(isNotXiXian)) || !XIAN.equals(city))) {
//判断数据是否携带96333电梯码,携带则使用,不携带则生成
if ("null".equals(code96333)) {
Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), county);
prefix = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), city).get("code").toString() : elevatorMap.get("code").toString();
if (((XIAN.equals(city) || XIAN_YANG.equals(city)) && "1".equals(isNotXiXian))) {
prefix = EquipmentCategoryEnum.XXCSM.getValue();
} else {
Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), county);
prefix = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), city).get("code").toString() : elevatorMap.get("code").toString();
}
//查询未使用的电梯码
categoryOtherInfo = categoryOtherInfoMapper.selectElevatorCode(prefix, EquipmentCategoryEnum.WSY.getCode());
//如果存在未使用的电梯码则启用未使用的否则创建
......@@ -719,7 +725,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
//判断原数据是否存在监管码,存在则用原监管码即可,不存在则生成
if ("null".equals(supervisionCode)) {
String supervisor = createSupervisorCode(city, county, equipCategory);
String supervisor = createSupervisorCode(isNotXiXian, city, county, equipCategory);
supervisorCode.append(supervisor);
} else {
supervisorCode = new StringBuilder(supervisionCode);
......@@ -768,11 +774,16 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* @param county 行政区划区
* @return 监管码
*/
public String createSupervisorCode(String city, String county, String equipCategory) {
public String createSupervisorCode(String isNotXiXian, String city, String county, String equipCategory) {
StringBuilder supervisorCode = new StringBuilder();
//生成监管码前缀
Map<String, Object> divisionMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), county);
String division = ObjectUtils.isEmpty(divisionMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), city).get("code").toString() : divisionMap.get("code").toString();
String division = null;
if (((XIAN.equals(city) || XIAN_YANG.equals(city)) && "1".equals(isNotXiXian))) {
division = "X";
} else {
//生成监管码前缀
Map<String, Object> divisionMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), county);
division = ObjectUtils.isEmpty(divisionMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), city).get("code").toString() : divisionMap.get("code").toString();
}
supervisorCode.append(division).append(equipCategory).append("-");
//获取行政区划区县、市是否存在历史监管码
CategoryOtherInfo supervisor = categoryOtherInfoMapper.selectSupervisorCode(supervisorCode.toString());
......@@ -920,6 +931,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
result.put(equipmentMessage.getDesInfo(), desInfo);
// 监督管理信息
Map<String, Object> supInfo = getSupInfo(map);
if ("1".equals(useInfo.get("IS_NOT_XIXIAN"))) {
supInfo.put("CITY", "咸阳");
} else {
supInfo.put("CITY", useInfo.get("CITY_NAME"));
}
result.put(equipmentMessage.getSupInfo(), supInfo);
// 施工信息
Map<String, Object> comInfo = getComInfo(map);
......@@ -1450,6 +1466,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
useInfoFrom.put("REC_DATE", dateFormat.format(calendar.getTime()));
String unitCode = String.valueOf(useInfoFrom.get("USE_UNIT_CREDIT_CODE"));
String isNotXiXian = "null".equals(String.valueOf(useInfoFrom.get("IS_NOT_XIXIAN"))) ? "0" : String.valueOf(useInfoFrom.get("IS_NOT_XIXIAN"));
LinkedHashMap supervisionMap = (LinkedHashMap) map.get(supervision_form_id);
String record = null;
LinkedHashMap superviseMap = (LinkedHashMap) map.get("data");
......@@ -1494,7 +1511,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String supervisionCode = String.valueOf(superviseMap.get("supervisionCode"));
EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy();
//生成码
codeMap = categoryService.creatCode(city, county, equCategory, code96333, supervisionCode);
codeMap = categoryService.creatCode(isNotXiXian,city, county, equCategory, code96333, supervisionCode);
//删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
map.remove("data");
supervisionMap.put("CODE96333", codeMap.get("code96333"));
......@@ -1663,7 +1680,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//八大类技术参数实体填充
List<IdxBizJgMainParts> mainPartsList = new ArrayList<>();
List<IdxBizJgProtectionDevices> protectionDevicesList = new ArrayList<>();
String equList = idxBizJgOtherInfo.getAlias().toString();
if (EquipmentTypeEnum.DT.getCode().equals(alias)) {
//维保备案信息
LinkedHashMap maintenanceForm = (LinkedHashMap) map.get(maintenance_form_id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment