|
@@ -1,5 +1,6 @@
|
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.rongwei.bscommon.sys.feign.LuckySheetService;
|
|
|
import com.rongwei.bscommon.sys.service.ZhcxProjectManageService;
|
|
@@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -49,7 +51,56 @@ public class ZhcxProjectManageRectifyBatchServiceImpl extends ServiceImpl<ZhcxPr
|
|
|
ProjectSummaryParamExcelDto paramExcelDto = projectManageService.assembleProjectSummaryParam(batchDo.getProjectid());
|
|
|
|
|
|
String[] mochineNos = batchDo.getMachineno().split(",");
|
|
|
- paramExcelDto.setDeviceNumberList(Arrays.asList(mochineNos));
|
|
|
+ List<String> dnList = Arrays.asList(mochineNos);
|
|
|
+ dnList.sort((sort1, sort2) -> {
|
|
|
+
|
|
|
+ String projectCode1 = null;
|
|
|
+ String projectCode2 = null;
|
|
|
+ String sort1Temp;
|
|
|
+ String sort2Temp;
|
|
|
+ if(sort1.contains("-")) {
|
|
|
+ final String[] split = sort1.split("-");
|
|
|
+ projectCode1 = split[0];
|
|
|
+ sort1Temp = split[1];
|
|
|
+ } else {
|
|
|
+ sort1Temp = sort1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(sort2.contains("-")) {
|
|
|
+ final String[] split = sort2.split("-");
|
|
|
+ projectCode2 = split[0];
|
|
|
+ sort2Temp = split[1];
|
|
|
+ } else {
|
|
|
+ sort2Temp = sort2;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 提取数字部分并转换为整数进行比较
|
|
|
+ Integer sort1Int = Integer.parseInt(sort1Temp.replace("#", ""));
|
|
|
+ Integer sort2Int = Integer.parseInt(sort2Temp.replace("#", ""));
|
|
|
+
|
|
|
+ if(ObjectUtil.isEmpty(projectCode1) && ObjectUtil.isEmpty(projectCode2)) {
|
|
|
+ return sort1Int.compareTo(sort2Int);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtil.isEmpty(projectCode1) && ObjectUtil.isNotEmpty(projectCode2)) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtil.isNotEmpty(projectCode1) && ObjectUtil.isEmpty(projectCode2)) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtil.isNotEmpty(projectCode1) && ObjectUtil.isNotEmpty(projectCode2)) {
|
|
|
+ if(projectCode1.equals(projectCode2)) {
|
|
|
+ return sort1Int.compareTo(sort2Int);
|
|
|
+ } else {
|
|
|
+ return projectCode1.compareTo(projectCode2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return sort1Int.compareTo(sort2Int);
|
|
|
+ });
|
|
|
+
|
|
|
+ paramExcelDto.setDeviceNumberList(dnList);
|
|
|
|
|
|
JSONObject lssResult = luckySheetService.genLuckysheetExcel(paramExcelDto);
|
|
|
String listId = lssResult.getString("data");
|