Browse Source

Merge branch 'master' of http://47.110.251.215:3000/java_org/bladex

huangtf 2 năm trước cách đây
mục cha
commit
9a5a8428f6
14 tập tin đã thay đổi với 208 bổ sung157 xóa
  1. 2 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractTreeAllVO.java
  2. 1 0
      blade-service/blade-business/pom.xml
  3. 9 5
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java
  4. 0 23
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  5. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java
  6. 60 35
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDetectionDataServiceImpl.java
  7. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceUseServiceImpl.java
  8. 5 4
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java
  9. 11 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/WeatherInfoServiceImpl.java
  10. 2 5
      blade-service/blade-business/src/main/java/org/springblade/business/utils/FileUtils.java
  11. 30 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeContractController.java
  12. 2 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml
  13. 58 68
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  14. 26 12
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

+ 2 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractTreeAllVO.java

@@ -29,6 +29,8 @@ public class WbsTreeContractTreeAllVO implements INode<WbsTreeContractTreeAllVO>
 
     private Long submitCounts;
 
+    private String contractIdRelation;
+
     @ApiModelProperty("未填报1 、已填报-未上报2 、已填报-待审批3 、已审批4")
     private Integer colorStatus;
 

+ 1 - 0
blade-service/blade-business/pom.xml

@@ -153,6 +153,7 @@
         <dependency>
             <groupId>org.jsoup</groupId>
             <artifactId>jsoup</artifactId>
+            <version>1.10.2</version>
         </dependency>
 
     </dependencies>

+ 9 - 5
blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java

@@ -10,13 +10,16 @@ import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
 
+import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
-import org.apache.poi.openxml4j.opc.PackagePart;
-import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.POIXMLDocumentPart;
+import org.apache.poi.hssf.usermodel.HSSFPicture;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.util.IOUtils;
+import org.apache.poi.xssf.usermodel.*;
+import org.apache.poi.xwpf.usermodel.XWPFRelation;
 import org.springblade.business.entity.ImageClassificationShow;
 import org.springblade.business.feign.OperationLogClient;
 import org.springblade.business.feign.RecycleBinClient;
@@ -59,12 +62,15 @@ import org.springblade.business.service.IImageClassificationFileService;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.awt.*;
+import java.awt.geom.AffineTransform;
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.net.URL;
 import java.net.URLConnection;
 import java.text.DecimalFormat;
 import java.util.*;
+import java.util.List;
 import java.util.stream.Collectors;
 
 /**
@@ -166,7 +172,7 @@ public class ImageClassificationFileController extends BladeController {
                     //需要删除的本地文件集合
                     List<String> removeList = new ArrayList<>();
 
-                    //压缩到小于指定文件大小100kb
+                    //压缩到小于指定文件大小
                     double targetSize = 200 * 1024;
 
                     for (ImageClassificationFile file : fileResult) {
@@ -195,7 +201,6 @@ public class ImageClassificationFileController extends BladeController {
                                             Sheet sheet = workbook.getSheetAt(0);
                                             Drawing<?> drawing = sheet.createDrawingPatriarch();
                                             ClientAnchor anchor = helper.createClientAnchor();
-                                            anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
 
                                             if (i == 0) {
                                                 anchor.setRow1(0);
@@ -246,7 +251,6 @@ public class ImageClassificationFileController extends BladeController {
                                     outputStream = new FileOutputStream(locationFile);
                                     //记录文件删除
                                     removeList.add(locationFile);
-
                                     //生成一份新的excel
                                     workbook.write(outputStream);
                                     //将excel转PDF

+ 0 - 23
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -1548,18 +1548,6 @@ public class InformationWriteQueryController extends BladeController {
                     newData.setPdfUrl(null);
                     newData.setCreateUser(AuthUtil.getUserId());
 
-                    //获取当前所有复制的节点的最大sort
-                    /*String sql = "select sort from m_wbs_tree_contract where contract_id = '" + node.getContractId() + "' and (id = '" + node.getId() + "' or old_id = '" + node.getId() + "')";
-                    List<WbsTreeContract> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
-                    List<Integer> collect = query.stream().filter(f -> ObjectUtils.isNotEmpty(f.getSort())).collect(Collectors.toList()).stream().map(WbsTreeContract::getSort).collect(Collectors.toList());
-                    Integer max = 1;
-                    if (collect.size() > 0) {
-                        max = collect.stream().reduce(collect.get(0), Integer::max);
-                    } else {
-                        max = 1;
-                    }
-                    //设置sort
-                    newData.setSort(max);*/
                     newData.setSort(ObjectUtils.isNotEmpty(node.getSort()) ? node.getSort() : 0);
 
                     //重塑父节点关联关系
@@ -2085,17 +2073,6 @@ public class InformationWriteQueryController extends BladeController {
                 }
 
                 //获取当前所有复制的节点的最大sort
-                /*String sql = "select sort from m_wbs_tree_contract where contract_id = '" + treeContract.getContractId() + "' and (id = '" + half.getId() + "' or old_id = '" + half.getId() + "')";
-                List<WbsTreeContract> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
-                List<Integer> collect = query.stream().filter(f -> ObjectUtils.isNotEmpty(f.getSort())).collect(Collectors.toList()).stream().map(WbsTreeContract::getSort).collect(Collectors.toList());
-                Integer max = 1;
-                if (collect.size() > 0) {
-                    max = collect.stream().reduce(collect.get(0), Integer::max);
-                } else {
-                    max = 1;
-                }
-                //设置sort
-                newData.setSort(max);*/
                 newData.setSort(ObjectUtils.isNotEmpty(half.getSort()) ? half.getSort() : 0);
 
                 //设置节点名称

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java

@@ -207,7 +207,7 @@ public class TrialDetectionController extends BladeController {
 
     @GetMapping("/self/copy-buss-tab")
     @ApiOperationSupport(order = 15)
-    @ApiOperation(value = "自检表单复制", notes = "传入节点pKeyId,当前记录id,合同段id")
+    @ApiOperation(value = "试验自检表单复制", notes = "传入节点pKeyId,当前记录id,合同段id")
     public R<Object> copyBussTab(@RequestParam Long pKeyId, @RequestParam Long id, @RequestParam Long contractId) {
         if (ObjectUtils.isEmpty(id)) {
             //新增复制 复制空表

+ 60 - 35
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDetectionDataServiceImpl.java

@@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -209,12 +210,17 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
             return null;
         }
         //获取关联的样品信息
-        List<TrialSampleInfo> trialSampleInfoList = jdbcTemplate.query("select material_name,specification_number,sample_description,material_count from u_trial_sample_info where id in(" + sampleIds + ")", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
+        List<TrialSampleInfo> trialSampleInfoList = jdbcTemplate.query("select material_name,specification_number,sample_description,material_count,sampling_date from u_trial_sample_info where id in(" + sampleIds + ")", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
         List<String> names = trialSampleInfoList.stream().map(TrialSampleInfo::getMaterialName).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
         List<String> numbers = trialSampleInfoList.stream().map(TrialSampleInfo::getSpecificationNumber).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
         List<String> descriptions = trialSampleInfoList.stream().map(TrialSampleInfo::getSampleDescription).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
         List<Integer> counts = trialSampleInfoList.stream().map(TrialSampleInfo::getMaterialCount).filter(ObjectUtil::isNotEmpty).map(Integer::valueOf).collect(Collectors.toList());
         List<Date> samplingDate = trialSampleInfoList.stream().map(TrialSampleInfo::getSamplingDate).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
+        String dateStr = "";
+        if (samplingDate.size() > 0) {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            dateStr = samplingDate.stream().map(sdf::format).collect(Collectors.joining("、"));
+        }
 
         List<Map<String, String>> resultMapList = new ArrayList<>();
         //获取当前合同段下的试验节点下的表
@@ -232,51 +238,41 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
                     Elements ypNumber = doc.select("el-input[placeholder~=样品编号.*]");
                     Elements ypCount = doc.select("el-input[placeholder~=样品数量.*]");
                     Elements ypMs = doc.select("el-input[placeholder~=样品描述.*]");
-                    Elements qyTime = doc.select("el-input[placeholder~=取样时间.*]");
+                    Elements qyTime = doc.select("el-input[placeholder~=来样.*]");
 
                     //样品名称
                     if (ypName.size() >= 1) {
                         for (Element element : ypName) {
-                            int trIndex = Integer.parseInt(element.attr("trindex"));
-                            if (trIndex <= 6) {
-                                map.put(element.attr("keyName"), ObjectUtils.isNotEmpty(names) ? StringUtils.join(names, "、") : "");
-                            }
+                            map.put(element.attr("keyname"), ObjectUtils.isNotEmpty(names) ? StringUtils.join(names, "、") : "");
+                            break;
                         }
                     }
                     //样品编号
                     if (ypNumber.size() >= 1) {
                         for (Element element : ypNumber) {
-                            int trIndex = Integer.parseInt(element.attr("trindex"));
-                            if (trIndex <= 6) {
-                                map.put(element.attr("keyName"), ObjectUtils.isNotEmpty(numbers) ? StringUtils.join(numbers, "、") : "");
-                            }
+                            map.put(element.attr("keyname"), ObjectUtils.isNotEmpty(numbers) ? StringUtils.join(numbers, "、") : "");
+                            break;
                         }
                     }
                     //样品数量
                     if (ypCount.size() >= 1) {
                         for (Element element : ypCount) {
-                            int trIndex = Integer.parseInt(element.attr("trindex"));
-                            if (trIndex <= 6) {
-                                map.put(element.attr("keyName"), ObjectUtils.isNotEmpty(counts) ? counts.stream().reduce(Integer::sum).orElse(0).toString() : "");
-                            }
+                            map.put(element.attr("keyname"), ObjectUtils.isNotEmpty(counts) ? counts.stream().reduce(Integer::sum).orElse(0).toString() : "");
+                            break;
                         }
                     }
                     //样品描述
                     if (ypMs.size() >= 1) {
                         for (Element element : ypMs) {
-                            int trIndex = Integer.parseInt(element.attr("trindex"));
-                            if (trIndex <= 6) {
-                                map.put(element.attr("keyName"), ObjectUtils.isNotEmpty(descriptions) ? StringUtils.join(descriptions, "、") : "");
-                            }
+                            map.put(element.attr("keyname"), ObjectUtils.isNotEmpty(descriptions) ? StringUtils.join(descriptions, "、") : "");
+                            break;
                         }
                     }
-                    //样品描述
+                    //取样时间
                     if (qyTime.size() >= 1) {
                         for (Element element : qyTime) {
-                            int trIndex = Integer.parseInt(element.attr("trindex"));
-                            if (trIndex <= 6) {
-                                map.put(element.attr("keyName"), ObjectUtils.isNotEmpty(samplingDate) ? StringUtils.join(samplingDate, "、") : "");
-                            }
+                            map.put(element.attr("keyname"), dateStr);
+                            break;
                         }
                     }
 
@@ -303,17 +299,48 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
         List<WbsTreeContract> fb = query.stream().filter(f -> f.getNodeType().equals(2)).collect(Collectors.toList());
         List<WbsTreeContract> fx = query.stream().filter(f -> f.getNodeType().equals(4)).collect(Collectors.toList());
         Set<String> set = new HashSet<>();
-        for (WbsTreeContract fxNode : fx) {
-            for (WbsTreeContract fbNode : fb) {
-                if (fxNode.getAncestors().contains(fbNode.getId().toString())) {
-                    for (WbsTreeContract dwNode : dw) {
-                        if (fbNode.getAncestors().contains(dwNode.getId().toString())) {
-                            set.add(dwNode.getNodeName() + "/" + fbNode.getNodeName() + "/" + fxNode.getNodeName());
+        if (dw.size() > 0 && fb.size() > 0 && fx.size() > 0) {
+            for (WbsTreeContract fxNode : fx) {
+                for (WbsTreeContract fbNode : fb) {
+                    if (fxNode.getAncestors().contains(fbNode.getId().toString())) {
+                        for (WbsTreeContract dwNode : dw) {
+                            if (fbNode.getAncestors().contains(dwNode.getId().toString())) {
+                                set.add(dwNode.getNodeName() + "/" + fbNode.getNodeName() + "/" + fxNode.getNodeName());
+                            }
                         }
                     }
                 }
             }
+        } else if (dw.size() > 0 && fb.size() > 0) {
+            for (WbsTreeContract fbNode : fb) {
+                for (WbsTreeContract dwNode : dw) {
+                    if (fbNode.getAncestors().contains(dwNode.getId().toString())) {
+                        set.add(dwNode.getNodeName() + "/" + fbNode.getNodeName() + "/");
+                    }
+                }
+            }
+        } else if (dw.size() > 0 && fx.size() > 0) {
+            for (WbsTreeContract fxNode : fx) {
+                for (WbsTreeContract dwNode : dw) {
+                    if (fxNode.getAncestors().contains(dwNode.getId().toString())) {
+                        set.add(dwNode.getNodeName() + "/" + fxNode.getNodeName() + "/");
+                    }
+                }
+            }
+        } else if (fb.size() > 0 && fx.size() > 0) {
+            for (WbsTreeContract fxNode : fx) {
+                for (WbsTreeContract fbNode : fb) {
+                    if (fxNode.getAncestors().contains(fbNode.getId().toString())) {
+                        set.add(fbNode.getNodeName() + "/" + fxNode.getNodeName());
+                    }
+                }
+            }
+        } else if (dw.size() > 0) {
+            for (WbsTreeContract dwNode : dw) {
+                set.add(dwNode.getNodeName());
+            }
         }
+
         if (set.size() > 0) {
             List<Map<String, String>> resultMapList = new ArrayList<>();
             //获取当前合同段下的试验节点下的表
@@ -331,12 +358,10 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
                         //工程部位
                         if (ppName.size() >= 1) {
                             for (Element element : ppName) {
-                                int trIndex = Integer.parseInt(element.attr("trindex"));
-                                if (trIndex <= 6) {
-                                    map.put("tabPKeyId", trialNodeTab.getPKeyId().toString());
-                                    map.put(element.attr("keyName"), StringUtils.join(set, "、"));
-                                    resultMapList.add(map);
-                                }
+                                map.put("tabPKeyId", trialNodeTab.getPKeyId().toString());
+                                map.put(element.attr("keyname"), StringUtils.join(set, "、"));
+                                resultMapList.add(map);
+                                break;
                             }
                         }
                     } catch (Exception e) {

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceUseServiceImpl.java

@@ -376,7 +376,7 @@ public class TrialDeviceUseServiceImpl extends BaseServiceImpl<TrialDeviceUseMap
     public void addDeviceUseInfo(TrialSelfInspectionRecordDTO dto) {
         if (StringUtils.isNotEmpty(dto.getDeviceUseIds())) {
             //获取进场记录
-            List<TrialDeviceInfo> deviceInfos = trialDeviceInfoMapper.selectList(Wrappers.<TrialDeviceInfo>lambdaQuery().in(TrialDeviceInfo::getId, dto.getDeviceUseIds()));
+            List<TrialDeviceInfo> deviceInfos = trialDeviceInfoMapper.selectList(Wrappers.<TrialDeviceInfo>lambdaQuery().in(TrialDeviceInfo::getId, Func.toLongList(dto.getDeviceUseIds())));
 
             //获取样品编号、名称
             String sampleNames = "";

+ 5 - 4
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.spire.xls.*;
+import feign.FeignException;
 import io.swagger.models.auth.In;
 import jdk.nashorn.internal.scripts.JD;
 import lombok.AllArgsConstructor;
@@ -419,12 +420,10 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 .and(obj -> obj.like(TrialSelfInspectionRecord::getReportNo, "BG-").or().like(TrialSelfInspectionRecord::getRecordNo, "JL-"))
                 .eq(TrialSelfInspectionRecord::getContractId, trialSelfInspectionRecord.getContractId())
                 .eq(TrialSelfInspectionRecord::getNodeId, trialSelfInspectionRecord.getNodeId())
-                .isNotNull(TrialSelfInspectionRecord::getRecordNo)
-                .isNotNull(TrialSelfInspectionRecord::getReportNo)
         );
 
-        List<TrialSelfInspectionRecord> bg = recordList.stream().filter(f -> f.getReportNo().contains("BG-")).collect(Collectors.toList());
-        List<TrialSelfInspectionRecord> jl = recordList.stream().filter(f -> f.getRecordNo().contains("JL-")).collect(Collectors.toList());
+        List<TrialSelfInspectionRecord> bg = recordList.stream().filter(f -> ObjectUtils.isNotEmpty(f.getReportNo()) && f.getReportNo().contains("BG-")).collect(Collectors.toList());
+        List<TrialSelfInspectionRecord> jl = recordList.stream().filter(f -> ObjectUtils.isNotEmpty(f.getRecordNo()) && f.getRecordNo().contains("JL-")).collect(Collectors.toList());
 
         if (jl.size() > 0) {
             List<String> numberRecordNos = new ArrayList<>();
@@ -835,6 +834,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public String selfSubmit(TrialSelfInspectionRecordDTO dto) throws FileNotFoundException {
         //------初始当前填报的表pKeyIds------
         this.initTrialTabIds(dto);
@@ -857,6 +857,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 this.submitTrialData(obj, dto);
             } catch (Exception e) {
                 e.printStackTrace();
+                throw new RuntimeException("保存试验记录信息失败,请联系管理员 " + e.getMessage());
             }
 
             //------关联原材料检测报告------

+ 11 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/WeatherInfoServiceImpl.java

@@ -8,6 +8,7 @@ import com.hankcs.hanlp.dictionary.py.Pinyin;
 import com.hankcs.hanlp.dictionary.py.PinyinDictionary;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.jsoup.Connection;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
@@ -209,11 +210,17 @@ public class WeatherInfoServiceImpl extends ServiceImpl<WeatherInfoMapper, Weath
                 if (duration.toDays() > 0){
                     List<WeatherInfo> list = new ArrayList<>();
                     Map<String, Map<String, String>> weatherMap = null;
+                    if (projectContractArea.getCounty().length() <= 1){
+                        continue;
+                    }
                     List<Pinyin> py = PinyinDictionary.convertToPinyin(projectContractArea.getCounty().substring(0, projectContractArea.getCounty().length() - 1));
                     StringBuilder county = new StringBuilder();
                     for (int i = 0; i < py.size(); i++) {
                         county.append(py.get(i).getPinyinWithoutTone());
                     }
+                    if (projectContractArea.getCity().length() <= 1){
+                        continue;
+                    }
                     List<Pinyin> py2 = PinyinDictionary.convertToPinyin(projectContractArea.getCity().substring(0, projectContractArea.getCity().length() - 1));
                     StringBuilder city = new StringBuilder();
                     for (int i = 0; i < py2.size(); i++) {
@@ -252,7 +259,10 @@ public class WeatherInfoServiceImpl extends ServiceImpl<WeatherInfoMapper, Weath
         Map<String,Map<String,String>> map = new HashMap<>();
         Document document = null;
         try {
-            document = Jsoup.connect(html).get();
+            System.out.println(html);
+            Connection connect = Jsoup.connect(html);
+            connect.timeout(20000);
+            document = connect.get();
             Element body = document.body();
             Elements table = body.getElementsByTag("table");
             Elements trs = table.select("tr");

+ 2 - 5
blade-service/blade-business/src/main/java/org/springblade/business/utils/FileUtils.java

@@ -4,12 +4,9 @@ import com.itextpdf.text.Document;
 import com.itextpdf.text.pdf.PdfCopy;
 import com.itextpdf.text.pdf.PdfReader;
 import org.apache.commons.lang.StringUtils;
-import org.apache.poi.ss.usermodel.ClientAnchor;
-import org.apache.poi.ss.usermodel.Picture;
-import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.util.Units;
-import org.apache.poi.xssf.usermodel.XSSFPicture;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.vo.DataVO;
 import org.springblade.core.tool.utils.IoUtil;
@@ -17,6 +14,7 @@ import org.springblade.core.tool.utils.IoUtil;
 import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletResponse;
 import java.awt.*;
+import java.awt.Color;
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.net.URLEncoder;
@@ -228,5 +226,4 @@ public class FileUtils {
             doc.close();
         }
     }
-
 }

+ 30 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeContractController.java

@@ -20,7 +20,9 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @RestController
 @AllArgsConstructor
@@ -36,6 +38,33 @@ public class WbsTreeContractController extends BladeController {
     @ApiOperation(value = "查询当前节点下所有元素表信息", notes = "传入节点primaryKeyId、type、合同段id、项目id")
     public R searchNodeAllTable(String primaryKeyId, String type, String contractId, String projectId) {
         List<AppWbsTreeContractVO> list = iWbsTreeContractService.searchNodeAllTable(primaryKeyId, type, contractId, projectId);
+        boolean flag = false;
+        Set<Long> l1 = new HashSet<>();
+        for (AppWbsTreeContractVO vo : list) {
+            if (vo.getNodeName().contains("_PL_")){
+                l1.add(vo.getId());
+                flag = true;
+            }
+        }
+        if (flag){
+            for (Long aLong : l1) {
+                List<AppWbsTreeContractVO> vos = new ArrayList<>();
+                for (AppWbsTreeContractVO vo : list) {
+                    if (aLong.equals(vo.getId())){
+                        vos.add(vo);
+                    }
+                }
+                list = list.stream().filter(l -> {
+                    if (l.getId().equals(aLong)){
+                        return false;
+                    }else {
+                        return true;
+                    }
+                }).collect(Collectors.toList());
+                vos = vos.stream().sorted(Comparator.comparing(AppWbsTreeContractVO::getPKeyId)).collect(Collectors.toList());
+                list.addAll(vos);
+            }
+        }
         if (list.size() > 0) {
             list.stream().forEach(l->{
                 if (StringUtils.isNotBlank(l.getHtmlUrl())){

+ 2 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml

@@ -429,7 +429,8 @@
         IFNULL(if(length(trim(full_name)) > 0, full_name, node_name),node_name) AS title,
         partition_code,
         node_type,
-        sort
+        sort,
+        d.contract_id AS contractIdRelation
         FROM m_wbs_tree_contract d
         WHERE
          contract_id = #{contractId}

+ 58 - 68
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -386,7 +386,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             currentNode.setPkId(wtc.getPKeyId());
             currentNode.setParentId(wtc.getParentId());
             currentNode.setWbsId(Long.parseLong(wtc.getWbsId()));
-            currentNode.setId(StringUtils.isNotEmpty(wtc.getOldId())? Long.valueOf(wtc.getOldId()) :wtc.getId());
+            currentNode.setId(StringUtils.isNotEmpty(wtc.getOldId()) ? Long.valueOf(wtc.getOldId()) : wtc.getId());
             currentNode.setRelateId(wtc.getId());
             List<Long> privateIds = this.jdbcTemplate.queryForList("select p_key_id from m_wbs_tree_private where id=" + currentNode.getRelateId() + " and  project_id=" + wtc.getProjectId() + " and wbs_id=" + wtc.getWbsId(), Long.class);
             if (Func.isNotEmpty(privateIds)) {
@@ -570,39 +570,39 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 .eq(WbsTreeContract::getIsDeleted, 0));
 
         // 数据维数据
-        Map<String , List<WbsTreeContract> > Data = new HashMap<>();
-        if(wbsTreeContractList!=null && wbsTreeContractList.size()>=1){
-            for(WbsTreeContract dataInfo : wbsTreeContractList){
-                String dataId = dataInfo.getId()+"";
-                String parentId = dataInfo.getParentId()+"";
+        Map<String, List<WbsTreeContract>> Data = new HashMap<>();
+        if (wbsTreeContractList != null && wbsTreeContractList.size() >= 1) {
+            for (WbsTreeContract dataInfo : wbsTreeContractList) {
+                String dataId = dataInfo.getId() + "";
+                String parentId = dataInfo.getParentId() + "";
 
-                if(!Data.containsKey(dataId)){
+                if (!Data.containsKey(dataId)) {
                     List<WbsTreeContract> newData = new ArrayList<>();
-                    Data.put(dataId,newData);
+                    Data.put(dataId, newData);
                 }
                 // 添加数据
-                if(Data.containsKey(parentId)){
+                if (Data.containsKey(parentId)) {
                     List<WbsTreeContract> newData = Data.get(parentId);
                     newData.add(dataInfo);
-                    Data.put(parentId,newData);
+                    Data.put(parentId, newData);
                 }
             }
         }
 
         //
-        Map<Long,String> lastList = new HashMap<>();
+        Map<Long, String> lastList = new HashMap<>();
         List<WbsTreeContract> collect = wbsTreeContractList.stream().filter(wbsTreeContract -> "0".equals(wbsTreeContract.getParentId().toString())).collect(Collectors.toList());
 
-        this.dataInfo(collect,lastList,Data);
+        this.dataInfo(collect, lastList, Data);
 
-        if(lastList!=null && lastList.size()>=1){
+        if (lastList != null && lastList.size() >= 1) {
             int index = 0;
-            StringBuffer sb =new StringBuffer();
-            for(Long data : lastList.keySet()){
-                sb.append(" update m_wbs_tree_contract set ancestors='"+lastList.get(data)+"' where p_key_id="+data+";");
-                index = index+1;
+            StringBuffer sb = new StringBuffer();
+            for (Long data : lastList.keySet()) {
+                sb.append(" update m_wbs_tree_contract set ancestors='" + lastList.get(data) + "' where p_key_id=" + data + ";");
+                index = index + 1;
                 System.out.println(index);
-                if(index>=1000){
+                if (index >= 1000) {
                     jdbcTemplate.execute(sb.toString());
                     sb = new StringBuffer();
                 }
@@ -612,25 +612,25 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     }
 
 
-    public void dataInfo(List<WbsTreeContract> collect,Map<Long ,String > lastList,Map<String , List<WbsTreeContract> > Data){
+    public void dataInfo(List<WbsTreeContract> collect, Map<Long, String> lastList, Map<String, List<WbsTreeContract>> Data) {
 
         Queue<WbsTreeContract> queue = new LinkedList<>();
         //将第一层级的目录全部入列
         collect.forEach(queue::offer);
         while (!queue.isEmpty()) {
             //每次循环出列一个对象 一直到队列为空
-            WbsTreeContract tree= queue.poll();
-            String dataId = tree.getId()+"";
+            WbsTreeContract tree = queue.poll();
+            String dataId = tree.getId() + "";
             List<WbsTreeContract> er = Data.get(dataId);
-            if(er!=null && er.size()>=1){
-                for(WbsTreeContract erData : er){
-                    String Ancestors="";
-                    if(lastList.containsKey(tree.getPKeyId())){
+            if (er != null && er.size() >= 1) {
+                for (WbsTreeContract erData : er) {
+                    String Ancestors = "";
+                    if (lastList.containsKey(tree.getPKeyId())) {
                         Ancestors = lastList.get(tree.getPKeyId());
-                    }else{
+                    } else {
                         Ancestors = tree.getAncestors();
                     }
-                    lastList.put(erData.getPKeyId(),Ancestors+","+erData.getParentId());
+                    lastList.put(erData.getPKeyId(), Ancestors + "," + erData.getParentId());
                 }
             }
 
@@ -642,7 +642,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     }
 
 
-
     /**
      * 保存首件
      */
@@ -1165,7 +1164,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
     @Override
     public R getBussPdfInfo(Long pkeyId) throws Exception {
-        //String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+       // String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         String file_path = "/Users/hongchuangyanfa/Desktop/";
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
@@ -1649,62 +1648,50 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 //施工单位
                 if (sgName.size() >= 1) {
                     for (Element element : sgName) {
-                        int trIndex = Integer.parseInt(element.attr("trindex"));
-                        if (trIndex <= 6) {
-                            reData.put(element.attr("keyName"), ObjectUtils.isNotEmpty(contractInfo.getConstructionUnitName()) ? contractInfo.getConstructionUnitName() : "");
-                        }
+                        reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getConstructionUnitName()) ? contractInfo.getConstructionUnitName() : "");
+                        break;
                     }
                 }
                 //委托单位
                 if (wtName.size() >= 1) {
                     for (Element element : wtName) {
-                        int trIndex = Integer.parseInt(element.attr("trindex"));
-                        if (trIndex <= 6) {
-                            reData.put(element.attr("keyName"), ObjectUtils.isNotEmpty(contractInfo.getSupervisionUnitName()) ? contractInfo.getSupervisionUnitName() : "");
-                        }
+                        reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getSupervisionUnitName()) ? contractInfo.getSupervisionUnitName() : "");
+                        break;
                     }
                 }
                 //合同段/工区
                 if (htdName.size() >= 1) {
                     for (Element element : htdName) {
-                        int trIndex = Integer.parseInt(element.attr("trindex"));
-                        if (trIndex <= 6) {
-                            reData.put(element.attr("keyName"), ObjectUtils.isNotEmpty(contractInfo.getContractName()) ? contractInfo.getContractName() : "");
-                        }
+                        reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getContractName()) ? contractInfo.getContractName() : "");
+                        break;
                     }
                 }
-            }
 
-            ProjectInfo projectInfo = jdbcTemplate.query("select project_name from m_project_info where id = " + wbsTreePrivate.getProjectId(), new BeanPropertyRowMapper<>(ProjectInfo.class)).stream().findAny().orElse(null);
-            if (projectInfo != null) {
-                //工程名称
-                if (gcName.size() >= 1) {
-                    for (Element element : gcName) {
-                        int trIndex = Integer.parseInt(element.attr("trindex"));
-                        if (trIndex <= 6) {
-                            reData.put(element.attr("keyName"), ObjectUtils.isNotEmpty(projectInfo.getProjectName()) ? projectInfo.getProjectName() : "");
+                ProjectInfo projectInfo = jdbcTemplate.query("select project_name from m_project_info where id = " + wbsTreePrivate.getProjectId(), new BeanPropertyRowMapper<>(ProjectInfo.class)).stream().findAny().orElse(null);
+                if (projectInfo != null) {
+                    //工程名称
+                    if (gcName.size() >= 1) {
+                        for (Element element : gcName) {
+                            reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(projectInfo.getProjectName()) ? projectInfo.getProjectName() : "");
+                            break;
                         }
                     }
                 }
-            }
 
-            TrialSelfInspectionRecord record = jdbcTemplate.query("select record_no,report_no from u_trial_self_inspection_record where id = " + groupId, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
-            if (record != null) {
-                //报告编号
-                if (bgHB.size() >= 1) {
-                    for (Element element : bgHB) {
-                        int trIndex = Integer.parseInt(element.attr("trindex"));
-                        if (trIndex <= 6) {
-                            reData.put(element.attr("keyName"), ObjectUtils.isNotEmpty(record.getReportNo()) ? record.getReportNo() : "");
+                TrialSelfInspectionRecord record = jdbcTemplate.query("select record_no,report_no from u_trial_self_inspection_record where id = " + groupId, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
+                if (record != null) {
+                    //报告编号
+                    if (bgHB.size() >= 1) {
+                        for (Element element : bgHB) {
+                            reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(record.getReportNo()) ? record.getReportNo() : "");
+                            break;
                         }
                     }
-                }
-                //记录编号
-                if (jlBH.size() >= 1) {
-                    for (Element element : jlBH) {
-                        int trIndex = Integer.parseInt(element.attr("trindex"));
-                        if (trIndex <= 6) {
-                            reData.put(element.attr("keyName"), ObjectUtils.isNotEmpty(record.getRecordNo()) ? record.getRecordNo() : "");
+                    //记录编号
+                    if (jlBH.size() >= 1) {
+                        for (Element element : jlBH) {
+                            reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(record.getRecordNo()) ? record.getRecordNo() : "");
+                            break;
                         }
                     }
                 }
@@ -1802,6 +1789,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         return list;
     }
 
+
     /**
      * 试验 获取填报信息 - 施工关联试验数据
      */
@@ -1958,7 +1946,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
      * 试验 单pdf
      */
     @Override
-    public String getBussPDFTrial(Long pkeyId, String contractId, Long id, int pageNumber, int pageNumberCount) throws Exception {
+    public String getBussPDFTrial(Long pkeyId, String contractId, Long id, int pageNumber, int pageNumberCount) throws
+            Exception {
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
                 .eq(WbsTreePrivate::getPKeyId, pkeyId));
@@ -2268,7 +2257,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
      * 试验 多pdf
      */
     @Override
-    public String getBussPDFSTrial(String nodeId, String tableType, String classify, String contractId, String projectId, Long id, String tabIds) throws Exception {
+    public String getBussPDFSTrial(String nodeId, String tableType, String classify, String contractId, String
+            projectId, Long id, String tabIds) throws Exception {
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         //获取有权限的表的信息
         String sql = "select p_key_id,html_url,table_type,sort,node_name,create_time from m_wbs_tree_private where is_deleted = 0 and p_key_id in (" + tabIds + ") order by sort,node_name,create_time";

+ 26 - 12
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -247,12 +247,22 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
                 parentId = objPrivate.getParentId() + "";
                 String wbsId = objPrivate.getWbsId();
                 Long id = objPrivate.getId();
-                LambdaUpdateWrapper<WbsTreeContract> updateWrapper = new LambdaUpdateWrapper<>();
-                updateWrapper.eq(WbsTreeContract::getWbsId, wbsId);
-                updateWrapper.eq(WbsTreeContract::getProjectId, projectId);
-                updateWrapper.eq(WbsTreeContract::getId, id);
-                updateWrapper.set(WbsTreeContract::getSort, number);
-                wbsTreeContractMapper.update(null, updateWrapper);
+
+                //修改项目中对应合同段节点
+                wbsTreeContractService.update(Wrappers.<WbsTreeContract>lambdaUpdate()
+                        .set(WbsTreeContract::getSort, number)
+                        .eq(WbsTreeContract::getWbsId, wbsId)
+                        .eq(WbsTreeContract::getProjectId, projectId)
+                        .eq(WbsTreeContract::getId, id)
+                );
+
+                //修改该节点的复制节点
+                wbsTreeContractService.update(Wrappers.<WbsTreeContract>lambdaUpdate()
+                        .set(WbsTreeContract::getSort, number)
+                        .eq(WbsTreeContract::getWbsId, wbsId)
+                        .eq(WbsTreeContract::getProjectId, projectId)
+                        .eq(WbsTreeContract::getOldId, id)
+                );
             }
             number++;
         }
@@ -1497,10 +1507,10 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
                 String[] split = tree.getHtmlUrl().split("/");
                 File file_in = ResourceUtil.getFile(tree.getHtmlUrl());
 //                File file_in = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\"+split[split.length-1]);
-                if (!file_in.exists() || file_in==null || file_in.length()==0){
+                if (!file_in.exists() || file_in == null || file_in.length() == 0) {
                     continue;
                 }
-                String htmlUrl = file_path + "/privateUrlCopy/" + split[split.length-1];
+                String htmlUrl = file_path + "/privateUrlCopy/" + split[split.length - 1];
 //                String htmlUrl = "C:\\Users\\泓创研发01\\Desktop\\privateUrlCopy\\" + split[split.length-1];
                 File file_out = ResourceUtil.getFile(htmlUrl);
                 FileUtil.copy(file_in, file_out);
@@ -1620,7 +1630,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
             //如果存在则复制最新表的配置,调整表单的值
             if (wbsTreePrivate != null) {
 
-                if (wbsPrivate.getExcelId() != null) {
+                if (wbsTreePrivate.getExcelId() != null) {
                     if (StringUtils.isNotEmpty(wbsTreePrivate.getExcelId() + "")) {
                         wbsPrivate.setExcelId(wbsTreePrivate.getExcelId());
                     }
@@ -1864,19 +1874,23 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
 
         //标题解决
         ProjectInfo projectInfo = projectInfoMapper.selectById(wbsTreePrivate.getProjectId());
-        //添加标题显示
         Elements trs = table.select("tr");
+        boolean eq = true;
         for (int i = 1; i < 6; i++) {
+            if (!eq) {
+                break;
+            }
             Element tr = trs.get(i);
             Elements tds = tr.select("td");
-            for (int j = 0; j < tds.size(); j++) {
-                Element data = tds.get(j);
+            for (Element data : tds) {
                 //int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
                 String style = data.attr("style");
                 if (style.contains("font-size")) {
                     int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:") + 10, style.indexOf(".0pt")));
                     if (org.apache.commons.lang.StringUtils.isNotEmpty(data.text()) && fontsize >= 12) {
                         trs.get(i - 1).select("td").get(0).text(projectInfo.getProjectName());
+                        eq = false;
+                        break;
                     }
                 }
             }