Commit 10a49d1a authored by tianyiming's avatar tianyiming

更新96333码

parent 5c4b04c2
......@@ -29,6 +29,19 @@ public class EquInfoDto {
*/
private String record;
/**
* 电梯96333识别码
*/
private String code;
/**
* 监管码
*/
private String supervisor;
/**
* 设备认领状态
*/
private String status;
}
......@@ -58,7 +58,7 @@ public class CategoryOtherInfo{
@TableField("SUPERVISORY_CODE")
private String supervisoryCode;
@ApiModelProperty(value = "认领状态:1代表已认领,0代表待认领,2代表拒领")
@ApiModelProperty(value = "认领状态:6035代表已认领,6036代表待认领,6037代表拒领")
@TableField("CLAIM_STATUS")
private String claimStatus;
}
......@@ -13,7 +13,7 @@ import org.apache.ibatis.annotations.Param;
*/
public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> {
int updateSupervisorCode(String supervisorCode, String code, String sequenceNbr);
int updateSupervisorCode(String supervisorCode, String code, String record);
CategoryOtherInfo selectSupervisorCode(@Param("supervisorCode") String supervisorCode);
......
......@@ -17,12 +17,16 @@
<update id="updateSupervisorCode">
UPDATE idx_biz_jg_other_info
SET "SUPERVISORY_CODE" = #{supervisorCode}
SET
"RECORE" = #{record}
<if test="supervisorCode != null and supervisorCode != ''">
, "SUPERVISORY_CODE" = #{supervisorCode}
</if>
<if test="code != null and code != ''">
, "CODE96333" = #{code}
</if>
WHERE
"SEQUENCE_NBR" = #{sequenceNbr}
"REOCRD" = #{reocrd}
</update>
<select id="selectElevatorCode" resultType="com.yeejoin.amos.boot.module.tzs.api.entity.CategoryOtherInfo">
......@@ -43,6 +47,8 @@
"COUNTY",
"EQU_LIST" equipList,
"EQU_CATEGORY" equipCategory,
ibjoi."CODE96333" code,
ibjoi."CLAIM_STATUS" STATUS,
ibjoi."RECORD"
FROM
idx_biz_jg_other_info ibjoi
......
......@@ -140,19 +140,26 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
equipList = map.get("EQU_LIST").toString();
} else {
EquInfoDto equInfoDto = categoryOtherInfoMapper.selectEquipInfo(record);
city = equInfoDto.getCity();
county = equInfoDto.getCounty();
equipCategory = equInfoDto.getEquipCategory();
equipList = equInfoDto.getEquipList();
//判断这条数据是否已经有电梯96333码和监管码
//如果都有则直接返回
if (ObjectUtils.isEmpty(equInfoDto.getSupervisor()) || ObjectUtils.isEmpty(equInfoDto.getCode())) {
city = equInfoDto.getCity();
county = equInfoDto.getCounty();
equipCategory = equInfoDto.getEquipCategory();
equipList = equInfoDto.getEquipList();
} else {
return 0;
}
}
//生成码
Map<String, String> codeMap = new HashMap<>();
synchronized (EquipmentCategoryServiceImpl.class) {
codeMap = creatCode(city, county, equipCategory, equipList, record);
}
//查询最后一条数据并进行修改
CategoryOtherInfo otherInfo = categoryOtherInfoMapper.selectOne(new QueryWrapper<CategoryOtherInfo>().orderByDesc("REC_DATE").last("limit 1"));
return categoryOtherInfoMapper.updateSupervisorCode(codeMap.get("supervisorCode"), codeMap.get("elevatorCode"), otherInfo.getSequenceNbr());
if (ObjectUtils.isEmpty(codeMap)) {
return 0;
}
return categoryOtherInfoMapper.updateSupervisorCode(codeMap.get("supervisorCode"), codeMap.get("elevatorCode"), record);
}
@Override
......@@ -226,33 +233,35 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
supervisorCode.append(division).append(equipCategory);
//获取行政区划区县、市是否存在历史监管码
CategoryOtherInfo supervisor = categoryOtherInfoMapper.selectSupervisorCode(supervisorCode.toString());
//生成对应监管码
if (!ObjectUtils.isEmpty(supervisor)) {
if (supervisor.getSupervisoryCode() != null) {
//获取补零位长度
String supervisoryCode = supervisor.getSupervisoryCode().substring(4);
long num = Long.valueOf(supervisoryCode) + 1;
int numLength = String.valueOf(num).length();
int a = 7 - numLength;
StringBuilder zero = new StringBuilder();
for (int i = 0; i < a; i++) {
zero.append(EquipmentCategoryEnum.BLW.getCode());
//查询对应record对应数据
CategoryOtherInfo otherInfo = categoryOtherInfoMapper.selectOne(new QueryWrapper<CategoryOtherInfo>().eq("RECORD", record));
if (!ObjectUtils.isEmpty(otherInfo) && ObjectUtils.isEmpty(otherInfo.getSupervisoryCode())) {
//生成对应监管码
if (!ObjectUtils.isEmpty(supervisor)) {
if (supervisor.getSupervisoryCode() != null) {
//获取补零位长度
String supervisoryCode = supervisor.getSupervisoryCode().substring(4);
long num = Long.valueOf(supervisoryCode) + 1;
int numLength = String.valueOf(num).length();
int a = 7 - numLength;
StringBuilder zero = new StringBuilder();
for (int i = 0; i < a; i++) {
zero.append(EquipmentCategoryEnum.BLW.getCode());
}
zero.append(num);
supervisorCode.append(zero);
} else {
supervisorCode.append(EquipmentCategoryEnum.JGM.getCode());
}
zero.append(num);
supervisorCode.append(zero);
} else {
supervisorCode.append(EquipmentCategoryEnum.JGM.getCode());
}
} else {
supervisorCode.append(EquipmentCategoryEnum.JGM.getCode());
}
StringBuilder elevatorCode = new StringBuilder();
//判断是否是否需要生成96333电梯码
if (EquipmentClassifityEnum.DT.getCode().equals(equipList)) {
//查询最后一条数据并进行修改
CategoryOtherInfo otherInfo = categoryOtherInfoMapper.selectOne(new QueryWrapper<CategoryOtherInfo>().eq("RECORD", record));
if (!ObjectUtils.isEmpty(otherInfo)) {
if (!ObjectUtils.isEmpty(otherInfo) && ObjectUtils.isEmpty(otherInfo.getCode())) {
List<CategoryOtherInfo> codeList = categoryOtherInfoMapper.selectList(new QueryWrapper<CategoryOtherInfo>().eq("CODE96333", otherInfo.getCode()));
if (ObjectUtils.isEmpty(codeList)) {
//生成生成96333电梯码前缀
......@@ -284,8 +293,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
}
}
resultMap.put("supervisorCode", ObjectUtils.isEmpty(supervisorCode.toString()) ? null : supervisorCode.toString());
resultMap.put("elevatorCode", ObjectUtils.isEmpty(elevatorCode.toString()) ? null : elevatorCode.toString());
if (ObjectUtils.isEmpty(supervisorCode) && ObjectUtils.isEmpty(elevatorCode)) {
return null;
}
resultMap.put("supervisorCode", ObjectUtils.isEmpty(supervisorCode) ? null : supervisorCode.toString());
resultMap.put("elevatorCode", ObjectUtils.isEmpty(elevatorCode) ? null : elevatorCode.toString());
return resultMap;
}
......
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