Commit 01678ca0 authored by tianbo's avatar tianbo

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

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