Commit 19b297aa authored by 刘林's avatar 刘林

fix(jg):96333重复问题修复,安装告知作废功能修改,处理错误数据接口开发

parent 67bb138e
package com.yeejoin.amos.boot.biz.common;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Test {
public static void main(String[] args) {
System.out.println("ddddrrdddd");
// 找出重复数据
//findDuplicateIds(idList, idsToRemove);
//剔除重复数据
notInIdList(idList, idsToRemove);
}
// 要剔除的ID集合
static List<String> idsToRemove = Arrays.asList(
"fdd757d9-c28a-4b7b-8567-882ffe0874be",
"86a7c5cb-cef6-442c-acde-408052ea92d2"
);
// 初始的 ID 列表
static List<String> idList = new ArrayList<>(Arrays.asList(
"a73a47e0-e5bd-4d82-b4fa-db56ff5e1aec",
"71cd3623-a5ab-4e29-9c6d-6962af6ec7ae",
"56eda391-6b63-4512-9ca3-a2e91cd0bd1c",
"4b73d406-ef36-4249-8bb9-7a0f9fc0bc83"
));
private static void removeDuplicateIds(List<String> idList, List<String> idsToRemove) {
// 剔除多个 ID
System.out.println("初始集合总数: " + idList.size());
System.out.println("对比集合总数: " + idsToRemove.size());
idList.removeAll(idsToRemove);
System.out.println("剔除重复的ID总数: " + idList.size());
System.out.println("剩余 ID:");
idList.forEach(id -> System.out.println("'" + id + "',"));
}
private static void findDuplicateIds(List<String> idList, List<String> idsToRemove) {
// 找出重复的 ID
System.out.println("初始集合总数: " + idList.size());
System.out.println("对比集合总数: " + idsToRemove.size());
List<String> duplicateIds = new ArrayList<>(idList);
duplicateIds.retainAll(idsToRemove);
System.out.println("重复ID 总数: " + duplicateIds.size());
System.out.println("重复的 ID:");
duplicateIds.forEach(id -> System.out.println("\"" + id + "\","));
}
private static void notInIdList(List<String> idList, List<String> idsToRemove) {
// 复制 idsToRemove 并移除所有在 idList 中存在的元素
List<String> notInIdList = new ArrayList<>(idList);
notInIdList.removeAll(idsToRemove);
// 输出结果
System.out.println("idsToRemove 中不在 idList 中的 ID 总数: " + notInIdList.size());
System.out.println("不在 idList 中的 ID:");
notInIdList.forEach(id -> System.out.println("\"" + id + "\","));
}
}
......@@ -1604,17 +1604,17 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
jgInstallationNoticeEqs.forEach(jgRelationEquip -> {
// 1.use_info 回退
this.rollBackUseInfo(jgRelationEquip);
// 2.other_info 回退
// 2.释放96333码为 未使用状态
this.release96333Code(jgRelationEquip);
// 3.other_info 回退
this.rollBackOtherInfo(jgRelationEquip);
// 3.supervise_info回退
// 4.supervise_info回退
this.rollBackSuperviseInfo(jgRelationEquip);
// 4.设备代码 回退
// 5.设备代码 回退
IdxBizJgRegisterInfo idxBizJgRegisterInfo = getIdxBizJgRegisterInfo2(jgRelationEquip);
this.rollBackRegisterInfo(jgRelationEquip, idxBizJgRegisterInfo);
// 5.es 回退
// 6.es 回退
this.rollBackEsInfo(jgRelationEquip, idxBizJgRegisterInfo);
//6.释放96333码为 未使用状态
this.release96333Code(jgRelationEquip);
});
}
......
......@@ -47,4 +47,6 @@ public interface IEquipmentCategoryService {
Map<String, Object> commonUpdateEsDataByIds(Map<String, Map<String, Object>> paramMap);
String selectExceedElevatorCode(String prefix);
String handleErrorElevatorCode(String supervisorCode, String elevatorCode);
}
......@@ -644,4 +644,17 @@ public class EquipmentCategoryController extends BaseController {
public ResponseModel<String> selectExceedElevatorCode(@RequestParam("prefix") String prefix) {
return ResponseHelper.buildResponse(equipmentCategoryService.selectExceedElevatorCode(prefix));
}
/**
* 根据前缀查询96333空余序列码
*
* @return s
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/handleErrorElevatorCode", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "处理错误96333码", notes = "处理错误96333码")
public ResponseModel<String> handleErrorElevatorCode(@RequestParam("supervisorCode") String supervisorCode,
@RequestParam("elevatorCode") String elevatorCode) {
return ResponseHelper.buildResponse(equipmentCategoryService.handleErrorElevatorCode(supervisorCode, elevatorCode));
}
}
......@@ -682,7 +682,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
// 判断是否需要生成96333电梯码
if (equipCategory.startsWith("3") && (((XIAN.equals(city) || XIAN_YANG.equals(city)) && "1".equals(isNotXiXian)) || !XIAN.equals(city))) {
// 判断数据是否携带96333电梯码,携带则使用,不携带则生成
if ("null".equals(code96333)) {
if ("null".equals(code96333) || code96333.isEmpty()) {
if (((XIAN.equals(city) || XIAN_YANG.equals(city)) && "1".equals(isNotXiXian))) {
prefix = EquipmentCategoryEnum.XXCSM.getValue();
} else {
......@@ -785,6 +785,39 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return elevatorCode.toString();
}
@Override
public String handleErrorElevatorCode(String supervisorCode, String elevatorCode) {
Map<String, Map<String, Object>> objMap = new HashMap<>();
// 查询目标记录
IdxBizJgOtherInfo otherInfo = idxBizJgOtherInfoMapper.selectOne(
new LambdaQueryWrapper<IdxBizJgOtherInfo>()
.eq(IdxBizJgOtherInfo::getSupervisoryCode, supervisorCode)
);
if (otherInfo != null) {
// 更新其他信息表
otherInfo.setCode96333(elevatorCode);
idxBizJgOtherInfoService.update(otherInfo,
new LambdaQueryWrapper<IdxBizJgOtherInfo>().eq(IdxBizJgOtherInfo::getSupervisoryCode, supervisorCode)
);
// 更新码表信息
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo().setCode96333(elevatorCode);
supervisoryCodeInfoMapper.update(supervisoryCodeInfo,
new QueryWrapper<SupervisoryCodeInfo>()
.eq("supervisory_code", supervisorCode)
);
// 更新 ES 数据
Map<String, Object> param = new HashMap<>();
param.put("CODE96333", elevatorCode);
objMap.put(otherInfo.getRecord(), param);
this.commonUpdateEsDataByIds(objMap);
}
return "96333码修复成功!";
}
/**
* 生成监管码
*
......
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