浏览代码

保存首件把新增变为修改

qianxb 2 年之前
父节点
当前提交
71bd2395d1

+ 5 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/InformationQueryClient.java

@@ -1,6 +1,7 @@
 package org.springblade.business.feign;
 
 import com.alibaba.fastjson.JSONObject;
+import org.springblade.business.entity.InformationQuery;
 import org.springblade.common.constant.BusinessConstant;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -71,4 +72,8 @@ public interface InformationQueryClient {
     @PostMapping(API_PREFIX + "/delAsyncWbsTree")
     void delAsyncWbsTree(@RequestParam String contractId);
 
+    // 根据wbsId获取首件填报信息
+    @PostMapping(API_PREFIX + "/getFirstInfoByWbsId")
+    InformationQuery getFirstInfoByWbsId(@RequestParam String WbsId);
+
 }

+ 5 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/InformationQueryClientImpl.java

@@ -85,4 +85,9 @@ public class InformationQueryClientImpl implements InformationQueryClient {
         iInformationQueryService.delAsyncWbsTree(contractId);
     }
 
+    @Override
+    public InformationQuery getFirstInfoByWbsId(String WbsId) {
+        return iInformationQueryService.getFirstInfoByWbsId(WbsId);
+    }
+
 }

+ 3 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java

@@ -141,4 +141,7 @@ public interface IInformationQueryService extends BaseService<InformationQuery>
     //根据节点获取数据
     InformationQuery getInfoByWbsId(String wbsId);
 
+    //根据节点获取首件数据
+    InformationQuery getFirstInfoByWbsId(String wbsId);
+
 }

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

@@ -286,6 +286,7 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
             }
 
             //修改数据
+            oldData.setPdfUrl(null);
             this.baseMapper.updateById(oldData);
 
         } else {
@@ -741,7 +742,12 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 
     @Override
     public InformationQuery getInfoByWbsId(String wbsId) {
-        return this.getOne(new LambdaQueryWrapper<InformationQuery>().eq(InformationQuery::getWbsId,wbsId).eq(InformationQuery::getStatus,0).last("limit 1"));
+        return this.getOne(new LambdaQueryWrapper<InformationQuery>().eq(InformationQuery::getWbsId,wbsId).eq(InformationQuery::getStatus,0).eq(InformationQuery::getType,1).last("limit 1"));
+    }
+
+    @Override
+    public InformationQuery getFirstInfoByWbsId(String wbsId) {
+        return this.getOne(new LambdaQueryWrapper<InformationQuery>().eq(InformationQuery::getWbsId,wbsId).eq(InformationQuery::getStatus,0).eq(InformationQuery::getType,3).last("limit 1"));
     }
 
 }

+ 7 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -673,7 +673,12 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     org.springblade.manager.entity.TableInfo table = tableInfoService.getBaseMapper().selectById(wbsTreePrivate.getInitTableId());
                     if (ObjectUtil.isNotEmpty(table)) {
                         //获取首件记录ID
-                        String firstId = tableInfoList.get(0).getFirstId();
+//                        String firstId = tableInfoList.get(0).getFirstId();
+                        String firstId = "";
+                        InformationQuery firstInfoByWbsId = informationQueryClient.getFirstInfoByWbsId(firstNodeId);
+                        if (firstInfoByWbsId != null){
+                            firstId = firstInfoByWbsId.getId() + "";
+                        }
                         if (StringUtils.isNotEmpty(firstId)) {
                             //删除掉旧数据
                             this.jdbcTemplate.execute("DELETE FROM " + table.getTabEnName() + " WHERE group_id = " + firstId);
@@ -682,7 +687,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                         }
 
                         //获取上传的文件相关
-                        String sourceUrl = tableInfoList.get(0).getSourceUrl(),
+                            String sourceUrl = tableInfoList.get(0).getSourceUrl(),
                                 pdfUrl = tableInfoList.get(0).getPdfUrl(),
                                 firstFileName = tableInfoList.get(0).getFirstFileName();