浏览代码

同步工序已上报或已审批的提示失败

chenr 3 周之前
父节点
当前提交
619a59dc49

+ 0 - 1
blade-service/blade-business/src/main/java/org/springblade/business/utils/FileUtils.java

@@ -150,7 +150,6 @@ public class FileUtils {
                 imageData = baos.toByteArray();
             }
         }
-
         // 缩放图像
         String formatName = "JPEG";
         ByteArrayInputStream bais = new ByteArrayInputStream(imageData);

+ 16 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -1990,8 +1990,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         return null;
     }
 
-    public Boolean isWorkNode(Long pKeyId){
-        String sql="SELECT * from m_wbs_tree_contract WHERE id=(SELECT parent_id from m_wbs_tree_contract WHERE is_deleted=0 and p_key_id="+pKeyId+")";
+    public Boolean isWorkNode(Long pKeyId,String projectId,String contractId){
+        String sql="SELECT * from m_wbs_tree_contract WHERE id=(SELECT parent_id from m_wbs_tree_contract WHERE is_deleted=0 and p_key_id="+pKeyId+")"+" and project_id="+projectId+" and contract_id="+contractId+" and is_deleted=0";
         WbsTreeContract wbsTreeContract= jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
         if(ObjectUtil.isNotEmpty(wbsTreeContract.getNodeType())){
             if (wbsTreeContract.getNodeType().equals(6)) {
@@ -2012,6 +2012,16 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
        //先查找当前节点的表格,有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 sqll="SELECT status FROM u_information_query WHERE wbs_id="+wbsTreeContract2.getPKeyId();
+      try {
+          Integer i = jdbcTemplate.queryForObject(sqll,Integer.class);
+          if(ObjectUtil.isNotEmpty(i)&&i>0){
+              return R.fail("当前节点已上报,请撤回上报后操作");
+          }
+      }catch (Exception e){
+            e.printStackTrace();
+      }
         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表
@@ -2034,13 +2044,16 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             for (WbsTreeContract treeContract : list2) {
                 if(treeContract.getNodeName().indexOf("JS107")>=0){
                     if(!Objects.equals(treeContract.getParentId(), wbsTreeContract2.getId())){
-                        if(isWorkNode(treeContract.getPKeyId())){
+                        if(isWorkNode(treeContract.getPKeyId(),treeContract.getProjectId(),treeContract.getContractId())){
                         source.add(treeContract);
                     }
                   }
                 }
             }
         }
+        if(ObjectUtil.isEmpty(source)||source.size()==0){
+            return R.fail("没有可同步的JS107表");
+        }
         List<WbsTreeContract>updateList=new ArrayList<>();
         for (WbsTreeContract wbsTreeContract : source) {
             Map<String,Object>maps=new HashMap<>();