瀏覽代碼

Merge branch 'lvy' of http://219.151.181.73:3000/zhuwei/bladex into test-merge-02

# Conflicts:
#	blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java
#	blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/TextdictInfoServiceImpl.java
lvy 3 月之前
父節點
當前提交
e66a60b7bf

+ 15 - 5
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -35,6 +35,7 @@ import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.core.tool.utils.ResourceUtil;
 import org.springblade.evisa.feign.EVisaClient;
+import org.springblade.evisa.redissionUtil.DistributedRedisLock;
 import org.springblade.evisa.vo.EVisaTaskApprovalVO;
 import org.springblade.flow.core.constant.ProcessConstant;
 import org.springblade.flow.core.feign.IFlowClient;
@@ -1558,11 +1559,20 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             //这里发起的默认为普通流程
             task.setType(1);
             task.setStatus(1);
-            //保存附表信息
-            this.taskParallelService.saveBatch(taskParallelArray);
-
-            //保存主表数据
-            this.save(task);
+            try {
+                if (DistributedRedisLock.acquire("TaskService_StartApproval_" + task.getFormDataId(), 5)) {
+                    long count = this.count(Wrappers.<Task>lambdaQuery().eq(Task::getFormDataId, task.getFormDataId()).ne(Task::getStatus, 3));
+                    if (count > 0) {
+                        return false;
+                    }
+                    //保存附表信息
+                    this.taskParallelService.saveBatch(taskParallelArray);
+                    //保存主表数据
+                    this.save(task);
+                }
+            } finally {
+                DistributedRedisLock.release("TaskService_StartApproval_" + task.getFormDataId());
+            }
         }
         return true;
     }

+ 38 - 24
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java

@@ -152,36 +152,50 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
 
         IPage<TrialMaterialMobilizationVO> trialMaterialMobilizationVOIPage = TrialMaterialMobilizationWarpper.build().pageVO(pages);
         List<TrialMaterialMobilizationVO> records = trialMaterialMobilizationVOIPage.getRecords();
-        if(!records.isEmpty()){
-            Map<String, String> fileMaps = jdbcTemplate.query("select link,original_name from blade_attach", new BeanPropertyRowMapper<>(Attach.class)).stream().collect(Collectors.toMap(Attach::getLink, Attach::getOriginalName, (key1, key2) -> key2));
-            for (TrialMaterialMobilizationVO record : records) {
-                for (User user : userList) {
-                    if (user.getId().equals(record.getUserId())) {
-                        record.setUserName(user.getName());
-                        break;
-                    }
+        StringBuilder links = new StringBuilder();
+        records.forEach(record -> {
+            if (StringUtil.hasText(record.getOtherAccessories())) {
+                links.append("'").append(record.getOtherAccessories()).append("',");
+            }
+            if (StringUtil.hasText(record.getProductionCertificate())) {
+                links.append("'").append(record.getProductionCertificate()).append("',");
+            }
+            if (StringUtil.hasText(record.getQualityInspectionReport())) {
+                links.append("'").append(record.getQualityInspectionReport()).append("',");
+            }
+        });
+        Map<String, String> fileMaps = new HashMap<>();
+        if (links.length() > 1) {
+            links.deleteCharAt(links.length() - 1);
+            fileMaps = jdbcTemplate.query("select link,original_name from blade_attach where link in (" + links + ")", new BeanPropertyRowMapper<>(Attach.class))
+                    .stream().collect(Collectors.toMap(Attach::getLink, Attach::getOriginalName, (key1, key2) -> key2));
+        }
+        for (TrialMaterialMobilizationVO record : records) {
+            for (User user : userList) {
+                if (user.getId().equals(record.getUserId())) {
+                    record.setUserName(user.getName());
+                    break;
                 }
-                if (StringUtils.isNotEmpty(record.getOtherAccessories())) {
-                    String attach = fileMaps.get(record.getOtherAccessories());
-                    if (attach != null) {
-                        record.setOtherAccessoriesName(attach);
-                    }
+            }
+            if (StringUtils.isNotEmpty(record.getOtherAccessories())) {
+                String attach = fileMaps.get(record.getOtherAccessories());
+                if (attach != null) {
+                    record.setOtherAccessoriesName(attach);
                 }
-                if (StringUtils.isNotEmpty(record.getProductionCertificate())) {
-                    String attach = fileMaps.get(record.getProductionCertificate());
-                    if (attach != null) {
-                        record.setProductionCertificateName(attach);
-                    }
+            }
+            if (StringUtils.isNotEmpty(record.getProductionCertificate())) {
+                String attach = fileMaps.get(record.getProductionCertificate());
+                if (attach != null) {
+                    record.setProductionCertificateName(attach);
                 }
-                if (StringUtils.isNotEmpty(record.getQualityInspectionReport())) {
-                    String attach = fileMaps.get(record.getQualityInspectionReport());
-                    if (attach != null) {
-                        record.setQualityInspectionReportName(attach);
-                    }
+            }
+            if (StringUtils.isNotEmpty(record.getQualityInspectionReport())) {
+                String attach = fileMaps.get(record.getQualityInspectionReport());
+                if (attach != null) {
+                    record.setQualityInspectionReportName(attach);
                 }
             }
         }
-
         return trialMaterialMobilizationVOIPage.setRecords(records);
     }
 

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/TextdictInfoMapper.java

@@ -17,6 +17,7 @@
 package org.springblade.manager.mapper;
 
 import org.springblade.manager.entity.TextdictInfo;
+import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.injector.EasyBaseMapper;
 import org.springblade.manager.vo.TextdictInfoVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -50,4 +51,5 @@ public interface TextdictInfoMapper extends EasyBaseMapper<TextdictInfo> {
 
     TextdictInfo selectTextdictInfoOne(@Param("id") String id,@Param("sigRoleId") String sigRoleId,@Param("projectId") String projectId);
 
+    void updateHtmlUrl(@Param("htmlUrl") String htmlUrl,@Param("projectId") String projectId, @Param("excelId") Long pKeyId);
 }

+ 3 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/TextdictInfoMapper.xml

@@ -65,4 +65,7 @@
             and sig_role_id = #{sigRoleId}
             and project_id= #{projectId}
     </select>
+    <update id="updateHtmlUrl">
+        update m_wbs_tree_contract set html_url = #{htmlUrl} where type = 2 and project_id = #{projectId} and is_type_private_pid = #{pKeyId};
+    </update>
 </mapper>

+ 65 - 12
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/TextdictInfoServiceImpl.java

@@ -17,6 +17,7 @@
 package org.springblade.manager.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jsoup.Jsoup;
@@ -25,10 +26,8 @@ import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.CommonUtil;
-import org.springblade.core.tool.utils.FileUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.IoUtil;
-import org.springblade.core.tool.utils.ResourceUtil;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.tool.utils.*;
 import org.springblade.manager.entity.TextdictInfo;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.mapper.TextdictInfoMapper;
@@ -39,19 +38,14 @@ import org.springblade.manager.utils.FileUtils;
 import org.springblade.manager.vo.TextdictBy345VO;
 import org.springblade.manager.vo.TextdictInfoVO;
 import org.springblade.system.cache.ParamCache;
-import org.springblade.system.cache.ParamCache;
-import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
+import java.io.*;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.Collectors;
-import java.util.*;
 
 /**
  * 参数信息表 服务实现类
@@ -84,7 +78,7 @@ public class TextdictInfoServiceImpl extends ServiceImpl<TextdictInfoMapper, Tex
                     Elements keyNames = ek.getElementsByAttribute("keyname");
                     if(Func.isNotEmpty(keyNames)){
                         for(Element keyName:keyNames){
-                            keys.addAll(Func.toStrList("\\|\\|",keyName.attr("keyname")));
+                            keys.add(keyName.attr("keyname"));
                         }
                     }
                 }
@@ -100,6 +94,7 @@ public class TextdictInfoServiceImpl extends ServiceImpl<TextdictInfoMapper, Tex
                         if (textdict != null) {
                             textdict.forEach(textdictInfoVO -> textdictInfoVO.setIsSystem(2));
                         }
+                        addSign(textdict, doc, privateInfo, dqid);
                     } else if (textdictList != null && !textdictList.isEmpty()) {
                         Map<String, Map<String, TextdictInfoVO>> map = textdict.stream().collect(Collectors.groupingBy(TextdictInfoVO::getColKey, Collectors.toMap(TextdictInfoVO::getSigRoleId, v -> v, (v1, v2) -> v1)));
                         List<TextdictInfoVO> collect = textdictList.stream().filter(textdictInfoVO -> {
@@ -111,6 +106,7 @@ public class TextdictInfoServiceImpl extends ServiceImpl<TextdictInfoMapper, Tex
                             return true;
                         }).collect(Collectors.toList());
                         textdict.addAll(collect);
+                        addSign(collect, doc, privateInfo, dqid);
                     }
                     if (!keys.isEmpty()) {
                         TextdictInfoVO temp = null;
@@ -151,6 +147,63 @@ public class TextdictInfoServiceImpl extends ServiceImpl<TextdictInfoMapper, Tex
         }
         return page.setRecords(textdict);
     }
+    private void addSign(List<TextdictInfoVO> collect, Document doc, WbsTreePrivate privateInfo, List<String> dqid) {
+        if (collect == null || collect.isEmpty()) {
+            return;
+        }
+        List<TextdictInfoVO> textdict = collect;
+        if (dqid != null && !dqid.isEmpty()) {
+            textdict = collect.stream().filter(textdictInfoVO -> !dqid.contains(textdictInfoVO.getId() + "")).collect(Collectors.toList());
+            if (textdict.isEmpty()) {
+                return;
+            }
+        }
+        //解析
+        Element table = doc.select("table").first();
+        Elements trs = table.select("tr");
+        AtomicBoolean isUpdate = new AtomicBoolean(false);
+        textdict.forEach(textdictInfoVO -> {
+            if (StringUtil.hasText(textdictInfoVO.getColKey())) {
+                String keky = textdictInfoVO.getColKey();
+                String[] trtd = keky.split("__")[1].split("_");
+                Element element = trs.get(Integer.parseInt(trtd[0])).select("td").get(Integer.parseInt(trtd[1]));
+                String ids = element.attr("dqId");
+                if (StringUtil.hasText(ids) && ids.contains(textdictInfoVO.getId() + "")) {
+                    return;
+                }
+                ids = StringUtil.hasText(ids) ? ids + "||" + textdictInfoVO.getId() : textdictInfoVO.getId() +  "";
+                element.removeAttr("dqId");
+                element.attr("dqId", ids);
+                if (textdictInfoVO.getType() == 2) { //个人签字 不能用户输入
+                    if (element.html().contains("el-tooltip")) {
+                        element.children().get(0).children().get(0).attr(":readonly", "true");
+                    } else {
+                        element.children().get(0).attr(":readonly", "true");
+                    }
+                }
+                isUpdate.set(true);
+            }
+        });
+        if (!isUpdate.get()) {
+            return;
+        }
+        String file_path = FileUtils.getSysLocalFileUrl();
+        String filecode = SnowFlakeUtil.getId() + "";
+        String thmlUrl = file_path + "privateUrlCopy/" + privateInfo.getProjectId()+"/"+filecode + ".html";
+        try {
+            File file_out = ResourceUtil.getFile(thmlUrl);
+            if(!file_out.exists()){
+                FileUtils.ensureFileExists(thmlUrl);
+            }
+            File writefile = new File(thmlUrl);
+            FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
+            wbsTreePrivateMapper.update(null,Wrappers.<WbsTreePrivate>lambdaUpdate().eq(WbsTreePrivate::getPKeyId, privateInfo.getPKeyId()).set(WbsTreePrivate::getHtmlUrl, thmlUrl));
+            privateInfo.setHtmlUrl(thmlUrl);
+            baseMapper.updateHtmlUrl(thmlUrl, privateInfo.getProjectId(), privateInfo.getPKeyId());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 
     @Override
     public TextdictInfoVO selectTextdictInfoById(TextdictInfo textdictInfo) {

+ 10 - 12
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@@ -806,7 +806,6 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
                                         Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
                                         ArrayList::new
                                 ));
-
                         /*获取当前合同段节点对应的资料填报QueryInfo本地缓存信息*/
                         List<WbsTreeContractLazyQueryInfoVO> queryInfoList = this.getQueryInfoList(contractId, tableOwner);
                         Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> Func.isNotEmpty(f.getWbsId())&&Func.isNotEmpty(f.getStatus()))
@@ -814,7 +813,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
                         List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
 
                         /* ================ 处理数量 ================ */
-                        List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.parallelStream().filter(f -> pKeyIdList.contains(f.getPKeyId())).collect(Collectors.toList());
+                        List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.parallelStream().filter(f -> queryInfoMaps.containsKey(f.getPKeyId())).collect(Collectors.toList());
                         List<Long> lowestNodeParentIdsTB = lowestNodesTB.parallelStream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
                         List<WbsTreeContractLazyVO> resultParentNodesTB = this.getCachedParentCountNodes(contractId, lowestNodeParentIdsTB, nodesAll, tableOwner);
                         Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
@@ -842,7 +841,6 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
                         long endTime = System.currentTimeMillis();
                         long executionTime = endTime - startTime;
                         _logger.info("合同段 " + contractId + " 处理颜色 执行时间:" + executionTime + " ms");
-
                         /* ================ 处理最终结果集 ================ */
                         if (lazyNodes.size() > 0) {
                             Map<Long, Integer> countMap = new HashMap<>();
@@ -1407,7 +1405,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
                     }
                 }
                 //更新本地缓存
-                localCacheNodes.put(contractId, nodesAll);
+//                localCacheNodes.put(contractId, nodesAll);
             }
         }
         return nodesAll;
@@ -1457,7 +1455,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
 
         if (queryInfoList.size() > 0) {
             //更新本地缓存
-            localCacheQueryInfos.put(cacheKey, queryInfoList);
+//            localCacheQueryInfos.put(cacheKey, queryInfoList);
         }
         return queryInfoList;
     }
@@ -1482,17 +1480,17 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
             long startTime = System.currentTimeMillis();
 
             /*重新计算,进行递归获取父节点计数统计*/
-            this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
-//            Map<Long, List<WbsTreeContractLazyVO>> map = nodesAll.stream().collect(Collectors.groupingBy(WbsTreeContractLazyVO::getId));
-//            recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, map);
+//            this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
+            Map<Long, List<WbsTreeContractLazyVO>> map = nodesAll.stream().collect(Collectors.groupingBy(WbsTreeContractLazyVO::getId));
+            recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, map);
             long endTime = System.currentTimeMillis();
             long executionTime = endTime - startTime;
             _logger.info("合同段 " + contractId + " wbs节点树 数量计算 执行时间:" + executionTime + " ms");
 
-            if (resultParentNodesTB.size() > 0) {
-                //更新本地缓存
-                localCacheParentCountNodes.put(cacheKey, resultParentNodesTB);
-            }
+//            if (resultParentNodesTB.size() > 0) {
+//                //更新本地缓存
+//                localCacheParentCountNodes.put(cacheKey, resultParentNodesTB);
+//            }
         }
         return resultParentNodesTB;
     }