From 66f0597bf6a1e79540c6bc51dedf561c22f3bdb5 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期二, 13 五月 2025 17:49:26 +0800
Subject: [PATCH] 修改
---
src/main/java/com/example/server/progressTrack/service/DjJdgzNetworkLevel3Service.java | 448 +++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 360 insertions(+), 88 deletions(-)
diff --git a/src/main/java/com/example/server/progressTrack/service/DjJdgzNetworkLevel3Service.java b/src/main/java/com/example/server/progressTrack/service/DjJdgzNetworkLevel3Service.java
index 557a72c..c9748b3 100644
--- a/src/main/java/com/example/server/progressTrack/service/DjJdgzNetworkLevel3Service.java
+++ b/src/main/java/com/example/server/progressTrack/service/DjJdgzNetworkLevel3Service.java
@@ -2,16 +2,26 @@
import com.example.client.dto.JComboBoxItem;
import com.example.client.service.BaseService;
+import com.example.client.utils.TranslateToPlainStrUtils;
+import com.example.server.ExportExcel.dto.ExcelColumnDto;
+import com.example.server.ExportExcel.dto.ExprotExcelDto;
+import com.example.server.ExportExcel.method.ExcelExport;
+import com.example.server.cabin.service.CabinService;
+import com.example.server.progressTrack.Dto.Level3ExportCloum;
import com.example.server.progressTrack.Dto.NetworkNodeStatusDto;
+import com.example.server.progressTrack.Dto.StatistProductDto;
+import com.example.server.progressTrack.Dto.TableNodeDto;
import com.example.server.progressTrack.dao.DjJdgzNetworkLevel3Dao;
import com.example.server.progressTrack.model.DjJdgzNetworkLevel3;
import com.example.server.progressTrack.model.DjJdgzNetworkLevel3List;
+import com.example.server.progressTrack.model.DjJdgzTrackRecord;
import com.example.server.teamGroup.service.SysTeamGroupClassService;
import com.example.server.utils.FileUtils;
import com.example.server.utils.ImportUtil;
import com.example.server.utils.UUIDUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
@@ -22,6 +32,8 @@
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.util.*;
@@ -39,13 +51,87 @@
DjJdgzNetworkLevel3ListService DjJdgzNetworkLevel3ListService;
@Autowired
SysTeamGroupClassService sysTeamGroupClassService;
+ @Autowired
+ CabinService cabinService;
@Value("${zt.oss.local-path}")
private String path;
- public List<DjJdgzNetworkLevel3> getList(Long shipId) {
- List<DjJdgzNetworkLevel3> list = baseDao.getList(shipId);
+ public List<StatistProductDto> getStatist(Long level1Id,String type) {
+ return baseDao.getStatist(level1Id,type);
+ }
+
+ public void exportExcel(String path, Long level1NetworkId, Long deptId, Long teamGroupId, String status) {
+ List<ExprotExcelDto> dtos = new ArrayList<>();
+ ExprotExcelDto dto = new ExprotExcelDto();
+ dto.setSheetName("璁惧鑺傜偣鐘舵�佽褰�");
+
+ List<Level3ExportCloum> list = baseDao.getdata(level1NetworkId, deptId, teamGroupId, status);
+ Date today = new Date();
+ for (Level3ExportCloum data :list){
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ Date requiredCompletionDate = null;
+ Date actualCompletionDate = null;
+ try {
+ if (StringUtils.isNotBlank(data.getRequiredCompletionTime())) {
+ requiredCompletionDate = sdf.parse(data.getRequiredCompletionTime());
+ }
+ if (StringUtils.isNotBlank(data.getActualCompletion())) {
+ actualCompletionDate = sdf.parse(data.getActualCompletion());
+ }
+
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ if (data.getCurrentStatus() == null || data.getCurrentStatus() == 0) {
+ if (today.after(requiredCompletionDate)) {
+ int days = (int) ((today.getTime() - requiredCompletionDate.getTime()) / (1000 * 60 * 60 * 24));
+ data.setStatus("宸查�炬湡" + days + "澶�");
+ } else if ((requiredCompletionDate.getTime() - today.getTime()) / (1000 * 60 * 60 * 24) < 7) {
+ int days = (int) ((requiredCompletionDate.getTime() - today.getTime()) / (1000 * 60 * 60 * 24));
+ data.setStatus("杩樻湁" + days + "澶╀复鏈�");
+ } else {
+ data.setStatus("杩涜涓�");
+ }
+ } else if (data.getCurrentStatus() == 1) {
+ // 宸插畬鎴�
+ if (data.getActualCompletion() != null && actualCompletionDate.after(requiredCompletionDate)) {
+ int days = (int) ((actualCompletionDate.getTime() - requiredCompletionDate.getTime()) / (1000 * 60 * 60 * 24));
+ data.setStatus("瓒呮湡" + days + "澶╁畬鎴�");
+ } else {
+ data.setStatus("姝e父瀹屾垚");
+ }
+ }
+
+ data.setDeptName(sysTeamGroupClassService.get(data.getDeptId()).getName());
+ data.setTeamName(sysTeamGroupClassService.get(data.getTeamgroupId()).getName());
+ }
+ dto.setDataList(list);
+ List<ExcelColumnDto> columnDto2 = new ArrayList<>();
+ columnDto2.add(new ExcelColumnDto("閮ㄩ棬", "deptName", 25, HorizontalAlignment.CENTER));
+ columnDto2.add(new ExcelColumnDto("涓撲笟", "teamName", 25, HorizontalAlignment.CENTER));
+ columnDto2.add(new ExcelColumnDto("璁惧鍚嶇О", "name", 50, HorizontalAlignment.CENTER));
+ columnDto2.add(new ExcelColumnDto("鑺傜偣鍚嶇О", "processName", 25, HorizontalAlignment.CENTER));
+ columnDto2.add(new ExcelColumnDto("瑕佹眰瀹屾垚鏃堕棿", "requiredCompletionTime", 25, HorizontalAlignment.CENTER));
+ columnDto2.add(new ExcelColumnDto("鐘舵��", "status", 25, HorizontalAlignment.LEFT));
+ dto.setColumnDto(columnDto2);
+ dtos.add(dto);
+ try {
+ ExcelExport.getHSSFWorkbook(path, dtos);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ enum StatusEnum {zy, jxz, lq, yq, zcwc, cqwc}
+
+ String[] fillColorArr = {"#e5e5e5", "#3498DB", "#F1C40F", "#E74C3C", "#2ECC71", "#006400"};
+ String[] fontColorArr = {"#e5e5e5", "#3498DB", "#F1C40F", "#E74C3C", "#2ECC71", "#006400"};
+
+ public List<DjJdgzNetworkLevel3> getList(Long shipId, Long deptId, Long teamId, Long cabinId, String type, Integer isealCabin,Integer isLt, String name) {
+ List<DjJdgzNetworkLevel3> list = baseDao.getList(shipId, deptId, teamId, cabinId, type, isealCabin,isLt, name);
return list;
}
@@ -119,16 +205,27 @@
sheetName = sheet.getSheetName(); //鑾峰彇褰撳墠sheet鍚嶇О
sum = sum + num;
- Map<Integer, String> mapProcessName = new HashMap<>();
- mapProcessName.put(1,"璁惧鎷嗗嵏鍑鸿埍");
- mapProcessName.put(2,"璁惧鍒嗕氦");
- mapProcessName.put(3,"鎷嗘閴村畾");
- mapProcessName.put(4,"璁惧杩斿巶");
- mapProcessName.put(5,"鍥炶");
-
Map<String, String> mapTeamGroup = sysTeamGroupClassService.getMapGroup(false, "hld");
+ JComboBoxItem[] cabinList = cabinService.getList();
+ JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList();
+ JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null);
- for (int j = 1; j <= num; j++) {
+ Map<String, Long> cabinMap = new HashMap<>();
+ Map<String, Long> deptMap = new HashMap<>();
+ Map<String, Long> teamMap = new HashMap<>();
+
+ for (JComboBoxItem item : cabinList) {
+ cabinMap.put(item.getName(), item.getId());
+ }
+ for (JComboBoxItem item : deptList) {
+ deptMap.put(item.getName(), item.getId());
+ }
+ for (JComboBoxItem item : teamList) {
+ teamMap.put(item.getName(), item.getId());
+ }
+
+ for (int j = 2; j <= num; j++) {
+ int sort = 0;
DjJdgzNetworkLevel3 data = new DjJdgzNetworkLevel3();
DjJdgzNetworkLevel3List node = new DjJdgzNetworkLevel3List();
@@ -138,206 +235,290 @@
Row row = sheet.getRow(j);
String name = ImportUtil.getCellValue(row, 0, pattern);
- String teamGroup = ImportUtil.getCellValue(row, 1, pattern);
- String time1 = ImportUtil.getCellValue(row, 2, pattern);
- String time2 = ImportUtil.getCellValue(row, 3, pattern);
- String time3 = ImportUtil.getCellValue(row, 4, pattern);
- String time4 = ImportUtil.getCellValue(row, 5, pattern);
- String time5 = ImportUtil.getCellValue(row, 6, pattern);
- String repairUnit = ImportUtil.getCellValue(row, 7, pattern);
- String repairUnitDirector = ImportUtil.getCellValue(row, 8, pattern);
- String repairUnitContact = ImportUtil.getCellValue(row, 9, pattern);
- String generalRepairUnit = ImportUtil.getCellValue(row, 10, pattern);
- String generalRepairUnitDirector = ImportUtil.getCellValue(row, 11, pattern);
- String generalRepairUnitContact = ImportUtil.getCellValue(row, 12, pattern);
+ String isealCabinStr = ImportUtil.getCellValue(row, 1, pattern);
+ String isltStr = ImportUtil.getCellValue(row, 2, pattern);
+ String deptStr = ImportUtil.getCellValue(row, 3, pattern);
+ String teamGroupStr = ImportUtil.getCellValue(row, 4, pattern);
+ String cabinStr = ImportUtil.getCellValue(row, 5, pattern);
+ String typeStr = ImportUtil.getCellValue(row, 6, pattern);
+ String time1 = ImportUtil.getCellValue(row, 7, pattern);
+ String time2 = ImportUtil.getCellValue(row, 8, pattern);
+ String time3 = ImportUtil.getCellValue(row, 9, pattern);
+ String time4 = ImportUtil.getCellValue(row, 10, pattern);
+ String time5 = ImportUtil.getCellValue(row, 11, pattern);
+ String repairUnit = ImportUtil.getCellValue(row, 12, pattern);
+ String repairUnitDirector = ImportUtil.getCellValue(row, 13, pattern);
+ String repairUnitContact = ImportUtil.getCellValue(row, 14, pattern);
+ String generalRepairUnit = ImportUtil.getCellValue(row, 15, pattern);
+ String generalRepairUnitDirector = ImportUtil.getCellValue(row, 16, pattern);
+ String generalRepairUnitContact = ImportUtil.getCellValue(row, 17, pattern);
+
+ Integer isealCabin = 0;
+ Integer islt = 0;
+ if (isealCabinStr.equals("鏄�")) {
+ isealCabin = 1;
+ }
+ if (isltStr.equals("鏄�")) {
+ islt = 1;
+ }
Long id = UUIDUtil.generateId();
if (StringUtils.isEmpty(name)) {
- result = "绗�"+j+"琛�"+"璁惧鍚嶇О涓嶈兘涓虹┖";
+ result = "绗�" + j + "琛�" + "璁惧鍚嶇О涓嶈兘涓虹┖";
isErr = true;
+ continue;
} else {
data.setId(id);
+ node.setNetworkId(id);
data.setName(name);
data.setLevel1NetworkId(level1NetworkId);
data.setLevel2NetworkId(level2NetworkId);
data.setLevel2NodeId(level2NodeId);
+ data.setIsealCabin(isealCabin);
+ data.setIslt(islt);
}
- if (StringUtils.isEmpty(teamGroup)) {
- result = "绗�"+j+"琛�"+"涓撲笟涓嶈兘涓虹┖";
+ if (StringUtils.isEmpty(deptStr)) {
+ result = "绗�" + j + "琛�" + "閮ㄩ棬涓嶈兘涓虹┖";
isErr = true;
+ continue;
} else {
- Long teamGroupId = Long.valueOf(mapTeamGroup.get(teamGroup));
- //鍒犻櫎鏁版嵁搴撲腑鐩稿悓涓撲笟鍙婄浉鍚屼笁绾х綉缁滃浘鏁版嵁
- baseDao.deleteByTeamGroup(teamGroupId, name);
-
- node.setTeamgroupId(teamGroupId);
- node.setTeamgroupName(teamGroup);
- node.setNetworkId(id);
+ if (deptMap.get(deptStr) == null) {
+ result = "绗�" + j + "琛�" + "閮ㄩ棬涓嶅瓨鍦�";
+ isErr = true;
+ continue;
+ } else {
+ Long deptId = deptMap.get(deptStr);
+ data.setDeptId(deptId);
+ }
}
- if (StringUtils.isEmpty(time1)) {
- result = "绗�"+j+"琛�"+"绗�"+1+"涓�"+"鑺傜偣鏃堕棿涓嶈兘涓虹┖";
+ if (StringUtils.isEmpty(teamGroupStr)) {
+ result = "绗�" + j + "琛�" + "涓撲笟涓嶈兘涓虹┖";
isErr = true;
+ continue;
} else {
+ if (teamMap.get(teamGroupStr) == null) {
+ result = "绗�" + j + "琛�" + "涓撲笟涓嶅瓨鍦�";
+ isErr = true;
+ continue;
+ } else {
+ Long teamId = teamMap.get(teamGroupStr);
+ data.setTeamgroupId(teamId);
+ data.setTeamgroupName(teamGroupStr);
+ }
+ }
+
+ if (StringUtils.isEmpty(cabinStr)) {
+ result = "绗�" + j + "琛�" + "鑸卞涓嶈兘涓虹┖";
+ isErr = true;
+ continue;
+ } else {
+ String[] cabins = cabinStr.split(",");
+
+ // 鐢ㄤ簬瀛樺偍鎷兼帴鍚庣殑 id
+ StringBuilder idBuilder = new StringBuilder();
+
+ // 閬嶅巻姣忎釜閿�
+ for (String key : cabins) {
+ key = key.trim(); // 鍘婚櫎鍙兘鐨勭┖鏍�
+ Long cabinId = cabinMap.get(key);
+ // 濡傛灉閿湪 Map 涓瓨鍦�
+ if (cabinId != null) {
+ if (idBuilder.length() > 0) {
+ idBuilder.append(","); // 娣诲姞鍒嗛殧绗�
+ }
+ idBuilder.append(cabinId); // 娣诲姞 id
+ } else {
+ result = "绗�" + j + "琛�" + "鑸卞涓嶅瓨鍦�";
+ isErr = true;
+ continue;
+ }
+ }
+ data.setCabinId(idBuilder.toString());
+ }
+
+ if (StringUtils.isNotBlank(time1)) {
+ String Pname = "";
+ if (typeStr.equals("鏀规崲瑁�")||typeStr.equals("鏀硅繘鎬т慨鐞�")){
+ Pname = "璁惧鍒板巶";
+ }else if(typeStr.equals("淇悊")){
+ Pname = "璁惧鎷嗗嵏鍑鸿埍";
+ }else if(typeStr.equals("涓嶅瑁呰澶�")){
+ Pname = "鎷嗗嵏鍑鸿埍";
+ }
if (time1.matches("[0-9/]+")) {
time1 = time1.replace("/", "-");
node.setRequiredCompletionTime(time1);
- node.setProcessName(mapProcessName.get(1));
+ node.setProcessName(Pname);
node.setSort(1);
DjJdgzNetworkLevel3ListService.insert(node);
} else if (time1.matches("[0-9.]+")) {
time1 = time1.replace(".", "-");
node.setRequiredCompletionTime(time1);
- node.setProcessName(mapProcessName.get(1));
+ node.setProcessName(Pname);
node.setSort(1);
DjJdgzNetworkLevel3ListService.insert(node);
} else if (time1.matches("[0-9-]+")) {
node.setRequiredCompletionTime(time1);
- node.setProcessName(mapProcessName.get(1));
+ node.setProcessName(Pname);
node.setSort(1);
DjJdgzNetworkLevel3ListService.insert(node);
} else {
- result = "绗�"+j+"琛�"+"绗�"+1+"涓�"+"鑺傜偣鏃堕棿鏃ユ湡鏍煎紡涓嶈鑼�";
+ result = "绗�" + j + "琛�" + "绗�" + 1 + "涓�" + "鑺傜偣鏃堕棿鏃ユ湡鏍煎紡涓嶈鑼�";
isErr = true;
}
}
- if (StringUtils.isEmpty(time2)) {
- result = "绗�"+j+"琛�"+"绗�"+2+"涓�"+"鑺傜偣鏃堕棿涓嶈兘涓虹┖";
- isErr = true;
- } else {
- if (node.getId()!=null){
+ if (StringUtils.isNotBlank(time2)) {
+ if (node.getId() != null) {
node.setId(null);
+ }
+ String Pname = "";
+ if (typeStr.equals("鏀规崲瑁�")||typeStr.equals("鏀硅繘鎬т慨鐞�")){
+ Pname = "璁惧瀹夎";
+ }else if(typeStr.equals("淇悊")){
+ Pname = "璁惧鍒嗕氦";
+ }else if(typeStr.equals("涓嶅瑁呰澶�")){
+ Pname = "鍏ュ簱";
}
if (time2.matches("[0-9/]+")) {
node.setRequiredCompletionTime(time2);
- node.setProcessName(mapProcessName.get(2));
+ node.setProcessName(Pname);
node.setSort(2);
DjJdgzNetworkLevel3ListService.insert(node);
} else if (time2.matches("[0-9.]+")) {
time2 = time2.replace(".", "-");
node.setRequiredCompletionTime(time2);
- node.setProcessName(mapProcessName.get(2));
+ node.setProcessName(Pname);
node.setSort(2);
DjJdgzNetworkLevel3ListService.insert(node);
} else if (time2.matches("[0-9-]+")) {
node.setRequiredCompletionTime(time2);
- node.setProcessName(mapProcessName.get(2));
+ node.setProcessName(Pname);
node.setSort(2);
DjJdgzNetworkLevel3ListService.insert(node);
} else {
- result = "绗�"+j+"琛�"+"绗�"+2+"涓�"+"鑺傜偣鏃堕棿鐨勬棩鏈熸牸寮忎笉瑙勮寖";
+ result = "绗�" + j + "琛�" + "绗�" + 2 + "涓�" + "鑺傜偣鏃堕棿鐨勬棩鏈熸牸寮忎笉瑙勮寖";
isErr = true;
}
}
- if (StringUtils.isEmpty(time3)) {
- result = "绗�"+j+"琛�"+"绗�"+3+"涓�"+"鑺傜偣鏃堕棿涓嶈兘涓虹┖";
- isErr = true;
- } else {
- if (node.getId()!=null){
+ if (StringUtils.isNotBlank(time3)) {
+ if (node.getId() != null) {
node.setId(null);
+ }
+ String Pname = "";
+ if(typeStr.equals("淇悊")){
+ Pname = "鎷嗘閴村畾";
+ }else if(typeStr.equals("涓嶅瑁呰澶�")){
+ Pname = "瀛樻斁浣嶇疆";
}
if (time3.matches("[0-9/]+")) {
time3 = time3.replace("/", "-");
node.setRequiredCompletionTime(time3);
- node.setProcessName(mapProcessName.get(3));
+ node.setProcessName(Pname);
node.setSort(3);
DjJdgzNetworkLevel3ListService.insert(node);
} else if (time3.matches("[0-9.]+")) {
time3 = time3.replace(".", "-");
node.setRequiredCompletionTime(time3);
- node.setProcessName(mapProcessName.get(3));
+ node.setProcessName(Pname);
node.setSort(3);
DjJdgzNetworkLevel3ListService.insert(node);
} else if (time3.matches("[0-9-]+")) {
node.setRequiredCompletionTime(time3);
- node.setProcessName(mapProcessName.get(3));
+ node.setProcessName(Pname);
node.setSort(3);
DjJdgzNetworkLevel3ListService.insert(node);
} else {
- result = "绗�"+j+"琛�"+"绗�"+3+"涓�"+"鑺傜偣鏃堕棿鐨勬棩鏈熸牸寮忎笉瑙勮寖";
+ result = "绗�" + j + "琛�" + "绗�" + 3 + "涓�" + "鑺傜偣鏃堕棿鐨勬棩鏈熸牸寮忎笉瑙勮寖";
isErr = true;
}
}
- if (StringUtils.isEmpty(time4)) {
- result = "绗�"+j+"琛�"+"绗�"+4+"涓�"+"鑺傜偣鏃堕棿涓嶈兘涓虹┖";
- isErr = true;
- } else {
- if (node.getId()!=null){
+ if (StringUtils.isNotBlank(time4)) {
+ if (node.getId() != null) {
node.setId(null);
+ }
+ String Pname = "";
+ if(typeStr.equals("淇悊")){
+ Pname = "璁惧杩斿巶";
+ }else if(typeStr.equals("涓嶅瑁呰澶�")){
+ Pname = "绉讳氦T闃�";
}
if (time4.matches("[0-9/]+")) {
time4 = time4.replace("/", "-");
node.setRequiredCompletionTime(time4);
- node.setProcessName(mapProcessName.get(4));
+ node.setProcessName(Pname);
node.setSort(4);
DjJdgzNetworkLevel3ListService.insert(node);
} else if (time4.matches("[0-9.]+")) {
time4 = time4.replace(".", "-");
node.setRequiredCompletionTime(time4);
- node.setProcessName(mapProcessName.get(4));
+ node.setProcessName(Pname);
node.setSort(4);
DjJdgzNetworkLevel3ListService.insert(node);
} else if (time4.matches("[0-9-]+")) {
node.setRequiredCompletionTime(time4);
- node.setProcessName(mapProcessName.get(4));
+ node.setProcessName(Pname);
node.setSort(4);
DjJdgzNetworkLevel3ListService.insert(node);
} else {
- result = "绗�"+j+"琛�"+"绗�"+4+"涓�"+"鑺傜偣鏃堕棿鐨勬棩鏈熸牸寮忎笉瑙勮寖";
+ result = "绗�" + j + "琛�" + "绗�" + 4 + "涓�" + "鑺傜偣鏃堕棿鐨勬棩鏈熸牸寮忎笉瑙勮寖";
isErr = true;
}
}
- if (StringUtils.isEmpty(time5)) {
- result = "绗�"+j+"琛�"+"绗�"+5+"涓�"+"鑺傜偣鏃堕棿涓嶈兘涓虹┖";
- isErr = true;
- } else {
- if (node.getId()!=null){
+ if (StringUtils.isNotBlank(time5)) {
+ if (node.getId() != null) {
node.setId(null);
}
if (time5.matches("[0-9/]+")) {
time5 = time5.replace("/", "-");
node.setRequiredCompletionTime(time5);
- node.setProcessName(mapProcessName.get(5));
+ node.setProcessName("鍥炶");
node.setSort(5);
DjJdgzNetworkLevel3ListService.insert(node);
} else if (time5.matches("[0-9.]+")) {
time5 = time5.replace(".", "-");
node.setRequiredCompletionTime(time5);
- node.setProcessName(mapProcessName.get(5));
+ node.setProcessName("鍥炶");
node.setSort(5);
DjJdgzNetworkLevel3ListService.insert(node);
} else if (time5.matches("[0-9-]+")) {
node.setRequiredCompletionTime(time5);
- node.setProcessName(mapProcessName.get(5));
+ node.setProcessName("鍥炶");
node.setSort(5);
DjJdgzNetworkLevel3ListService.insert(node);
} else {
- result = "绗�"+j+"琛�"+"绗�"+5+"涓�"+"瑕佹眰瀹屾垚鏃堕棿鐨勬棩鏈熸牸寮忎笉瑙勮寖";
+ result = "绗�" + j + "琛�" + "绗�" + 5 + "涓�" + "瑕佹眰瀹屾垚鏃堕棿鐨勬棩鏈熸牸寮忎笉瑙勮寖";
isErr = true;
}
}
- if(StringUtils.isNotBlank(generalRepairUnit)){
+
+ if (StringUtils.isNotBlank(typeStr)) {
+ data.setType(typeStr);
+ }
+ if (StringUtils.isNotBlank(generalRepairUnit)) {
data.setGeneralRepairUnit(generalRepairUnit);
}
- if(StringUtils.isNotBlank(generalRepairUnitContact)){
+ if (StringUtils.isNotBlank(generalRepairUnitContact)) {
+ generalRepairUnitContact = TranslateToPlainStrUtils.translateToPlainStr(generalRepairUnitContact);
data.setGeneralRepairUnitContact(generalRepairUnitContact);
}
- if(StringUtils.isNotBlank(generalRepairUnitDirector)){
+ if (StringUtils.isNotBlank(generalRepairUnitDirector)) {
data.setGeneralRepairUnitDirector(generalRepairUnitDirector);
}
- if(StringUtils.isNotBlank(generalRepairUnit)){
+ if (StringUtils.isNotBlank(repairUnit)) {
data.setRepairUnit(repairUnit);
}
- if(StringUtils.isNotBlank(generalRepairUnit)){
+ if (StringUtils.isNotBlank(repairUnitContact)) {
+ repairUnitContact = TranslateToPlainStrUtils.translateToPlainStr(repairUnitContact);
data.setRepairUnitContact(repairUnitContact);
}
- if(StringUtils.isNotBlank(generalRepairUnit)){
+ if (StringUtils.isNotBlank(repairUnitDirector)) {
data.setRepairUnitDirector(repairUnitDirector);
}
@@ -354,18 +535,109 @@
}
} catch (Exception e) {
e.printStackTrace();
- result = "瀵煎叆"+row1+"琛屾暟鎹椂妫�娴嬪埌寮傚父锛屼腑鏂鍏ユ搷浣溿��";
+ result = "瀵煎叆" + row1 + "琛屾暟鎹椂妫�娴嬪埌寮傚父锛屼腑鏂鍏ユ搷浣溿��";
}
suc = sum - err;
return result;
}
- /* public void exportExcelTemplate(HttpServletResponse response, HttpServletRequest request) throws IOException {
- String excelName="涓夌骇缃戠粶鍥炬壒閲忔ā鐗�";
- String excelPath = path + "template/jx-model/" + excelName + ".xlsx"; //妯℃澘璺緞
- File file = new File(excelPath);
- excelName = excelName + "_" + DateUtil.now() + ".xlsx";
- DownloadService.exportModelPath(excelPath, excelName, file, response, request);
- }*/
+
+ public JComboBoxItem[] getListByExport(Long projectId, Long deptId, Long teamId) {
+ JComboBoxItem[] list = baseDao.getListByExport(projectId, deptId, teamId);
+ return list;
+ }
+
+ public List<TableNodeDto> getNodeList(Long shipId, Long deptId, Long teamId, Long cabinId, String type,Integer isCabin,Integer islt, String name) {
+ List<TableNodeDto> list = baseDao.getNodeList(shipId, deptId, teamId, cabinId, type,isCabin,islt, name);
+
+ Map<Long, StatusEnum> statusMap = new HashMap<>();
+ Date today = new Date();
+ for (TableNodeDto node : list) {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ Date requiredCompletionDate = null;
+ Date actualCompletionDate = null;
+ try {
+ if (StringUtils.isNotBlank(node.getRequiredCompletionTime())) {
+ requiredCompletionDate = sdf.parse(node.getRequiredCompletionTime());
+ }
+ if (StringUtils.isNotBlank(node.getActualCompletion())) {
+ actualCompletionDate = sdf.parse(node.getActualCompletion());
+ }
+
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ if (node.getCurrentStatus() == null || node.getCurrentStatus() == 0) {
+ if (today.after(requiredCompletionDate)) {
+ statusMap.put(node.getId(), StatusEnum.yq);
+ int days = (int) ((today.getTime() - requiredCompletionDate.getTime()) / (1000 * 60 * 60 * 24));
+ node.setYqText("瑕佹眰鏃堕棿涓�" + sdf.format(requiredCompletionDate) + "宸查�炬湡" + days + "澶�");
+ } else if ((requiredCompletionDate.getTime() - today.getTime()) / (1000 * 60 * 60 * 24) < 7) {
+ statusMap.put(node.getId(), StatusEnum.lq);
+ int days = (int) ((requiredCompletionDate.getTime() - today.getTime()) / (1000 * 60 * 60 * 24));
+ node.setLqText("瑕佹眰鏃堕棿涓�" + sdf.format(requiredCompletionDate) + "杩樻湁" + days + "澶╀复鏈�");
+ } else {
+ statusMap.put(node.getId(), StatusEnum.jxz);
+ }
+ } else if (node.getCurrentStatus() == 1) {
+ // 宸插畬鎴�
+ if (node.getActualCompletion() != null && actualCompletionDate.after(requiredCompletionDate)) {
+ statusMap.put(node.getId(), StatusEnum.cqwc);
+ int days = (int) ((actualCompletionDate.getTime() - requiredCompletionDate.getTime()) / (1000 * 60 * 60 * 24));
+ node.setCqText("瑕佹眰鏃堕棿涓�" + sdf.format(requiredCompletionDate) + "瓒呮湡" + days + "澶╁畬鎴�");
+ } else {
+ statusMap.put(node.getId(), StatusEnum.zcwc);
+ }
+ }
+ }
+ StatusEnum status = StatusEnum.jxz;
+ List<TableNodeDto> dataList = new ArrayList<>();
+ Long oldId = 0L;
+ TableNodeDto data = null;
+ for (TableNodeDto node : list) {
+ if (oldId.equals(node.getNetworkId())) {
+
+ } else {
+ data = new TableNodeDto();
+ String remark = baseDao.getRemark(node.getNetworkId(),type);
+ if (StringUtils.isNotBlank(remark)){
+ data.setRemark(remark);
+ }
+ data.setName(node.getName());
+ data.setNetworkId(node.getNetworkId());
+ data.setIsealCabin(node.getIsealCabin());
+ data.setIslt(node.getIslt());
+ dataList.add(data);
+ oldId = node.getNetworkId();
+ }
+
+
+ status = statusMap.get(node.getId());
+ if (StringUtils.isNotBlank(node.getLqText())) {
+ data.setLqText(node.getLqText());
+ }
+ if (StringUtils.isNotBlank(node.getYqText())) {
+ data.setYqText(node.getYqText());
+ }
+ if (StringUtils.isNotBlank(node.getCqText())) {
+ data.setCqText(node.getCqText());
+ }
+
+ if (node.getProcessName().equals("璁惧鎷嗗嵏鍑鸿埍")||node.getProcessName().equals("璁惧鍒板巶")||node.getProcessName().equals("鎷嗗嵏鍑鸿埍")) {
+ data.setTime1Color(fillColorArr[status.ordinal()]);
+ } else if (node.getProcessName().equals("璁惧鍒嗕氦")||node.getProcessName().equals("璁惧瀹夎")||node.getProcessName().equals("鍏ュ簱")) {
+ data.setTime2Color(fillColorArr[status.ordinal()]);
+ } else if (node.getProcessName().equals("鎷嗘閴村畾")||node.getProcessName().equals("瀛樻斁浣嶇疆")) {
+ data.setTime3Color(fillColorArr[status.ordinal()]);
+ } else if (node.getProcessName().equals("璁惧杩斿巶")||node.getProcessName().equals("绉讳氦T闃�")) {
+ data.setTime4Color(fillColorArr[status.ordinal()]);
+ } else if (node.getProcessName().equals("鍥炶")) {
+ data.setTime5Color(fillColorArr[status.ordinal()]);
+ }
+ }
+
+
+ return dataList;
+ }
}
--
Gitblit v1.9.1