Commit 01678ca0 authored by tianbo's avatar tianbo

refactor(ymt): 修改手动获取96333码接口

--接口修改为调用业务生成96333码方法:createElevatorCode(prefix)。 --没有获取到空余码则重新生成一个
parent a3c685c8
......@@ -79,7 +79,6 @@ import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static com.alibaba.fastjson.JSON.toJSONString;
......@@ -766,34 +765,35 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* @return 96333电梯识别码
*/
public String selectExceedElevatorCode(String prefix) {
StringBuilder elevatorCode = new StringBuilder();
// 生成生成96333电梯码前缀
elevatorCode.append(prefix);
String initCode = elevatorCode + EquipmentCategoryEnum.getValue.get(elevatorCode.toString());
CategoryOtherInfo initSupervisoryCode = categoryOtherInfoMapper.queryInitCode(initCode); // 查询是否已经生成过初始值
if (ValidationUtil.isEmpty(initSupervisoryCode)) {
elevatorCode.append(EquipmentCategoryEnum.getValue.get(prefix));
} else {
// 获取行政区划区县、市是否存在历史96333电梯码
CategoryOtherInfo elevatorOtherInfo = categoryOtherInfoMapper.selectElevatorCode(elevatorCode.toString(), null);
if (!ObjectUtils.isEmpty(elevatorOtherInfo) && elevatorOtherInfo.getCode() != null) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
Integer start = Integer.valueOf(prefix + EquipmentCategoryEnum.getCode.get(prefix));
Integer end = Integer.valueOf(elevatorOtherInfo.getCode());
List<Integer> allCodeList = IntStream.rangeClosed(start, end)
.boxed()
.collect(Collectors.toList());
List<Integer> codeList = categoryOtherInfoMapper.selectExceedElevatorCodeList(start, prefix);
List<Integer> resultList = getDiffrent(allCodeList, codeList);
if (!ObjectUtils.isEmpty(resultList)) {
elevatorCode.setLength(0);
elevatorCode.append(resultList.get(0));
}
stopWatch.stop();
}
}
return elevatorCode.toString();
return createElevatorCode(prefix);
// StringBuilder elevatorCode = new StringBuilder();
// // 生成生成96333电梯码前缀
// elevatorCode.append(prefix);
// String initCode = elevatorCode + EquipmentCategoryEnum.getValue.get(elevatorCode.toString());
// CategoryOtherInfo initSupervisoryCode = categoryOtherInfoMapper.queryInitCode(initCode); // 查询是否已经生成过初始值
// if (ValidationUtil.isEmpty(initSupervisoryCode)) {
// elevatorCode.append(EquipmentCategoryEnum.getValue.get(prefix));
// } else {
// // 获取行政区划区县、市是否存在历史96333电梯码
// CategoryOtherInfo elevatorOtherInfo = categoryOtherInfoMapper.selectElevatorCode(elevatorCode.toString(), null);
// if (!ObjectUtils.isEmpty(elevatorOtherInfo) && elevatorOtherInfo.getCode() != null) {
// StopWatch stopWatch = new StopWatch();
// stopWatch.start();
// Integer start = Integer.valueOf(prefix + EquipmentCategoryEnum.getCode.get(prefix));
// Integer end = Integer.valueOf(elevatorOtherInfo.getCode());
// List<Integer> allCodeList = IntStream.rangeClosed(start, end)
// .boxed()
// .collect(Collectors.toList());
// List<Integer> codeList = categoryOtherInfoMapper.selectExceedElevatorCodeList(start, prefix);
// List<Integer> resultList = getDiffrent(allCodeList, codeList);
// if (!ObjectUtils.isEmpty(resultList)) {
// elevatorCode.setLength(0);
// elevatorCode.append(resultList.get(0));
// }
// stopWatch.stop();
// }
// }
// return elevatorCode.toString();
}
@Override
......
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