chenr 1 kuukausi sitten
vanhempi
commit
14722c1317

+ 0 - 1
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/vo/InformationQueryVO1.java

@@ -15,5 +15,4 @@ public class InformationQueryVO1 {
     @TableField("e_visa_pdf_url")
     @JsonProperty("eVisaPdfUrl")
     private String eVisaPdfUrl;
-
 }

+ 20 - 0
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/vo/InformationQueryVO2.java

@@ -0,0 +1,20 @@
+package org.springblade.system.user.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+@Data
+@TableName("u_information_query")
+public class InformationQueryVO2 {
+    @TableField("id")
+    private String id;
+    @TableField("name")
+    private String name;
+    @TableField("e_visa_pdf_url")
+    @JsonProperty("eVisaPdfUrl")
+    private String eVisaPdfUrl;
+    @TableField("node_pdf_url")
+    private String nodePdfUrl;
+}

+ 36 - 32
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.jfireel.expression.Expression;
 import com.mixsmart.utils.*;
+import com.sun.org.apache.bcel.internal.generic.NEW;
 import lombok.RequiredArgsConstructor;
 import org.apache.poi.ss.usermodel.*;
 import org.jsoup.Jsoup;
@@ -1994,55 +1995,58 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     @Transactional(rollbackFor = Exception.class)
     public R<Object> syncWorkDate(Long nodeId) {
        Boolean b=false;
-       //先查找当前节点的表格,有JS107就删除
+       //先查找当前节点的表格,有JS107筛选出所有JS107的表
         String nodeSql="SELECT * from m_wbs_tree_contract WHERE is_deleted=0 and p_key_id="+nodeId;
         WbsTreeContract wbsTreeContract2 = jdbcTemplate.queryForObject(nodeSql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
         String sql="SELECT * from m_wbs_tree_contract WHERE is_deleted=0 and parent_id="+wbsTreeContract2.getId()+" AND contract_id="+wbsTreeContract2.getContractId()+" AND project_id="+wbsTreeContract2.getProjectId();
         List<WbsTreeContract> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        //所有需要同步的JS107表
+        List<WbsTreeContract>target=new ArrayList<>();
         if(list.size()>0){
             for (WbsTreeContract wbsTreeContract1 : list) {
                 if(wbsTreeContract1.getNodeName().indexOf("JS107")>=0){
-                    //逻辑删除
-                    String delete="Update m_wbs_tree_contract SET is_deleted=1 where p_key_id="+wbsTreeContract1.getPKeyId();
-                    jdbcTemplate.update(delete);
+                    target.add(wbsTreeContract1);
                 }
             }
         }
+        //所有被需要同步的JS107
+        List<WbsTreeContract>source=new ArrayList<>();
         //查找父节点下所有的表单,如果有JS107及复制表,就复制到当前节点下
         String fatherNodeSql="SELECT * FROM m_wbs_tree_contract WHERE id="+wbsTreeContract2.getParentId()+" AND is_deleted=0"+" AND contract_id="+wbsTreeContract2.getContractId()+" AND project_id="+wbsTreeContract2.getProjectId();
         WbsTreeContract fatherNode = jdbcTemplate.queryForObject(fatherNodeSql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
-        List <WbsTreeContract>list1=new ArrayList<>();
-        getAllChildNodes(fatherNode, list1);
-        if(list1.size()>0){
-            for (WbsTreeContract treeContract : list1) {
+        List <WbsTreeContract>list2=new ArrayList<>();
+        getAllChildNodes(fatherNode, list2);
+        if(list2.size()>0){
+            for (WbsTreeContract treeContract : list2) {
                 if(treeContract.getNodeName().indexOf("JS107")>=0){
-                    long tabGroupId = SnowFlakeUtil.getId();
-                    long newPkId = SnowFlakeUtil.getId();
-                    WbsTreeContract wbsTreeContract = new WbsTreeContract();
-                    BeanUtil.copy(treeContract, wbsTreeContract);
-                    wbsTreeContract.setNodeName(treeContract.getNodeName());
-                    wbsTreeContract.setPKeyId(newPkId);
-                    wbsTreeContract.setCreateTime(new Date());
-                    wbsTreeContract.setTabGroupId(tabGroupId);
-                    wbsTreeContract.setParentId(wbsTreeContract2.getId());
-                    wbsTreeContract.setIsCopeTab(2);
-                    wbsTreeContract.setIsTabPdf(1); // pdf 不能预览
-                    wbsTreeContract.setIsBussShow(1); // 是否隐藏表
-                    wbsTreeContract.setTabFileType(1);//没有上传附件
-                    wbsTreeContract.setPdfUrl("");
-                    String tabName = wbsTreeContract.getInitTableName();
-                    // 字段查询 并去掉公式字段
-                    String colkeys = "SELECT GROUP_CONCAT(COLUMN_NAME) as colkeys from information_schema.COLUMNS c where c.table_name='" + tabName + "' and COLUMN_NAME not in('id','p_key_id')";
-                    Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(colkeys);
-                    colkeys = stringObjectMap.get("colkeys") + "";
-                    // 复制表数据
-                    String querySql = "insert into " + tabName + " (id,p_key_id," + colkeys + ") select '" + newPkId + "','" + newPkId + "'," + colkeys + " from " + tabName + " where p_key_id=" + treeContract.getPKeyId();
-                    jdbcTemplate.execute(querySql);
-                    wbsTreeContractService.save(wbsTreeContract);
-                    b=true;
+                    if(!Objects.equals(treeContract.getParentId(), wbsTreeContract2.getId())){
+                        source.add(treeContract);
+                    }
                 }
             }
         }
+        List<WbsTreeContract>updateList=new ArrayList<>();
+
+        for (WbsTreeContract wbsTreeContract : source) {
+            Map<String,Object>maps=new HashMap<>();
+            for (WbsTreeContract treeContract : target) {
+                //名称相同就复制
+                if(wbsTreeContract.getNodeName().equals(treeContract.getNodeName())){
+                List<Map<String, Object>> mapsList = jdbcTemplate.queryForList("select * from " + treeContract.getInitTableName() + " where p_key_id = " + wbsTreeContract.getPKeyId());
+                if(mapsList.size()>0){
+                    for (Map<String, Object> stringObjectMap : mapsList) {
+                        for (String s : stringObjectMap.keySet()) {
+                            if(ObjectUtil.isNotEmpty(stringObjectMap.get(s))&&!s.equals("id")&&!s.equals("p_key_id")){
+                                maps.put(s,stringObjectMap.get(s));
+                            }
+                        }
+                    }
+                }
+
+                }
+            }
+        }
+
         if(!b){
             return R.data("请检查工序节点中是否包含JS107表");
         }else {

+ 2 - 1
blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.java

@@ -26,6 +26,7 @@ import org.springblade.manager.vo.PrivateTreeVO2;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.excel.UserExcel;
 import org.springblade.system.user.vo.InformationQueryVO1;
+import org.springblade.system.user.vo.InformationQueryVO2;
 import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springblade.system.user.vo.UserVO;
 
@@ -78,5 +79,5 @@ public interface UserMapper extends BaseMapper<User> {
 
     List<PrivateTreeVO2> getAllNode(@Param("projectId") String projectId);
 
-    List<InformationQueryVO1> queryInformationByContractIdAndName(@Param("contractId")String contractId, @Param("name")String name);
+    List<InformationQueryVO2> queryInformationByContractIdAndName(@Param("contractId")String contractId, @Param("name")String name);
 }

+ 2 - 2
blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml

@@ -232,8 +232,8 @@
     </select>
 
     <select id="queryInformationByContractIdAndName"
-            resultType="org.springblade.system.user.vo.InformationQueryVO1">
-    SELECT id,name,e_visa_pdf_url FROM u_information_query where contract_id=#{contractId} AND status=2
+            resultType="org.springblade.system.user.vo.InformationQueryVO2">
+    SELECT id,name,e_visa_pdf_url,node_pdf_url FROM u_information_query where contract_id=#{contractId} AND status=2
         <if test="name!=null and name!=''">
         AND name  LIKE CONCAT('%', #{name}, '%')
         </if>

+ 18 - 2
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@@ -64,6 +64,7 @@ import org.springblade.system.user.service.IUserService;
 import org.springblade.system.user.util.FileUtils;
 import org.springblade.system.user.util.ForestNodeMerger;
 import org.springblade.system.user.vo.InformationQueryVO1;
+import org.springblade.system.user.vo.InformationQueryVO2;
 import org.springblade.system.user.vo.UserVO;
 import org.springblade.system.user.wrapper.UserWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -1193,8 +1194,23 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
         if(!contract.getPId().equals("1792760669353865218")){
             throw new ServiceException("请输入正确的合同段id");
         }
-
-        return baseMapper.queryInformationByContractIdAndName(contractId,name);
+        List<InformationQueryVO2> informationQueryVO2s = baseMapper.queryInformationByContractIdAndName(contractId, name);
+         List<InformationQueryVO1> list= new ArrayList<>();
+         if(informationQueryVO2s.size()>0){
+             for (InformationQueryVO2 informationQueryVO2 : informationQueryVO2s) {
+                 InformationQueryVO1 i=new InformationQueryVO1();
+                 i.setId(informationQueryVO2.getId());
+                 i.setName(informationQueryVO2.getName());
+                 if(ObjectUtil.isNotEmpty(informationQueryVO2.getEVisaPdfUrl())){
+                     i.setEVisaPdfUrl(informationQueryVO2.getEVisaPdfUrl());
+                 }
+                 if(ObjectUtil.isNotEmpty(informationQueryVO2.getNodePdfUrl())){
+                     i.setEVisaPdfUrl(informationQueryVO2.getNodePdfUrl());
+                 }
+                 list.add(i);
+             }
+         }
+        return list;
     }