Browse Source

项目验收文件添加到材料袋修改

chenjun 8 months ago
parent
commit
2869076d9c

+ 2 - 0
zjugis-business/src/main/java/com/zjugis/business/bean/response/FileResponse.java

@@ -26,4 +26,6 @@ public class FileResponse {
     private String projectId;
 
     private String materialId;
+
+    private String flowMaterialsId;
 }

+ 1 - 1
zjugis-business/src/main/java/com/zjugis/business/flow/project/controller/FlowProjectController.java

@@ -61,7 +61,7 @@ public class FlowProjectController extends BaseController {
     public String page(@ParamModel ProjectDto project, long page, long rows) {
         project.setIsRelContract(0);
         project.setXmztList(IntStream.of(1,4).boxed().collect(Collectors.toSet()));
-        Page<Project> p = projectService.page(new Page<>(page, rows), project);
+        Page<Project> p = projectService.page2(new Page<>(page, rows), project);
         Grid<Project> grid = new Grid(
                 p.getCurrent(),
                 p.getSize(),

+ 6 - 0
zjugis-business/src/main/java/com/zjugis/business/mapper/ContractMapper.java

@@ -7,11 +7,13 @@ import com.zjugis.business.bean.entity.ProjectAmount;
 import com.zjugis.business.bean.response.ContractExcelResponse;
 import com.zjugis.business.bean.response.ContractMessageCountResp;
 import com.zjugis.framework.mybatis.core.mapper.BaseMapperX;
+import com.zjugis.framework.mybatis.core.query.LambdaQueryWrapperX;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author  ljy
@@ -70,4 +72,8 @@ public interface ContractMapper extends BaseMapperX<Contract> {
     BigDecimal getSumContractById(String projectId);
 
     BigDecimal getSumChildById(String parentId);
+
+    default List<Contract> selectByProjectIds(Set<String> ids){
+        return selectList(new LambdaQueryWrapperX<Contract>().eq(Contract::getFlowStatus,90).in(Contract::getProjectId,ids));
+    }
 }

+ 2 - 0
zjugis-business/src/main/java/com/zjugis/business/service/ProjectService.java

@@ -27,6 +27,8 @@ public interface ProjectService {
 
     Page<Project> page(Page<Project> page, ProjectDto projectDto);
 
+    Page<Project> page2(Page<Project> page, ProjectDto projectDto);
+
     Page<Project> deptPage(Page<Project> page, ProjectDto projectDto);
 
     List<ProjectExcelResponse> excelList(ProjectDto projectDto);

+ 1 - 4
zjugis-business/src/main/java/com/zjugis/business/service/impl/ContractServiceImpl.java

@@ -551,10 +551,7 @@ public class ContractServiceImpl implements ContractService{
 
     @Override
     public List<Contract> selectByProjectIds(Set<String> ids) {
-        QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
-        queryWrapper.in("PROJECT_ID",ids)
-                .eq("FLOW_STATUS",90);
-        return contractMapper.selectList(queryWrapper);
+        return contractMapper.selectByProjectIds(ids);
     }
 
     @Override

+ 21 - 16
zjugis-business/src/main/java/com/zjugis/business/service/impl/ProjectServiceImpl.java

@@ -169,6 +169,18 @@ public class ProjectServiceImpl implements ProjectService {
 
     }
 
+    @Override
+    public Page<Project> page2(Page<Project> page, ProjectDto projectDto) {
+        if(StringUtils.isNotBlank(projectDto.getDeptId())) {
+            Set<String> deptIds = commonService.getDeptCondition(projectDto.getDeptId());
+            projectDto.setDeptId(null);
+            projectDto.setDeptIds(deptIds);
+        }
+        Page<Project> result = projectMapper.page(page, projectDto);
+        return result;
+
+    }
+
     @Override
     public Page<Project> deptPage(Page<Project> page, ProjectDto projectDto) {
         DeptDataPermissionRespDTO respDTO = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()).getCheckedData();
@@ -709,28 +721,21 @@ public class ProjectServiceImpl implements ProjectService {
 
     @Override
     public void materialUploadToFlow(String flowInstanceId,String projectId) throws Exception {
-        FileRequest fileRequest = new FileRequest();
         List<FileResponse> listFile = projectMapper.getProjectFile(projectId);
+        List<IFlowMaterialsFile> materialsFileList = workflowClient.getListByInstanceId(flowInstanceId).getCheckedData();
+        Map<String, List<IFlowMaterialsFile>> map = materialsFileList.stream().collect(Collectors.groupingBy(IFlowMaterialsFile::getFlowMaterialsId));
         for(FileResponse entity:listFile){
-            MultipartFile file = UrlToFile.urlToMultipartFile(entity.getUrl(),"test");
-            fileRequest.setFile(file);
-            fileRequest.setProjectId(projectId);
-            fileRequest.setClientId(Long.valueOf(fileClientId));
-            String path =entity.getPath().split("_")[0];
-            fileRequest.setPath(path);
-            CommonResult<FileResponse> res = fileClient.uploadFile(fileRequest);
-            FileResponse fileResponse = res.getCheckedData();
             IFlowMaterialsFile item = new IFlowMaterialsFile();
-            item.setFileId(String.valueOf(fileResponse.getId()));
-            item.setFlowMaterialsId(path);
-            int dotIndex = fileResponse.getName().lastIndexOf(".");
+            item.setFileId(String.valueOf(entity.getId()));
+            item.setFlowMaterialsId(map.get(entity.getFlowMaterialsId()).get(0).getId());
+            int dotIndex = entity.getName().lastIndexOf(".");
             if(dotIndex == -1){
-                item.setName(fileResponse.getName());
+                item.setName(entity.getName());
             } else {
-                item.setName(fileResponse.getName().substring(0,dotIndex));
-                item.setSuffix(fileResponse.getName().substring((dotIndex)));
+                item.setName(entity.getName().substring(0,dotIndex));
+                item.setSuffix(entity.getName().substring((dotIndex)));
             }
-            item.setFileUrl(fileResponse.getUrl());
+            item.setFileUrl(entity.getUrl());
             workflowClient.addList(item).getCheckedData();
         }
     }

+ 2 - 1
zjugis-business/src/main/resources/mapper/oracle/ProjectMapper.xml

@@ -503,8 +503,9 @@
         </where>
     </select>
     <select id="getProjectFile" resultType="com.zjugis.business.bean.response.FileResponse">
-        SELECT A.*,B.ID AS materialId FROM ZJUGIS_OA.INFRA_FILE A
+        SELECT A.*,B.ID AS materialId,NVL(C.FLOW_MATERIALS_ID,B.FLOW_MATERIALS_ID) AS FLOW_MATERIALS_ID FROM ZJUGIS_OA.INFRA_FILE A
         left join ZJUGIS_WORKFLOW.I_FLOW_MATERIALS_FILE B ON A.ID=B.FILE_ID
+        LEFT JOIN ZJUGIS_WORKFLOW.I_FLOW_MATERIALS C ON B.FLOW_MATERIALS_ID = C.ID
         WHERE PROJECT_ID = #{projectId,jdbcType=VARCHAR} and A.deleted=0
     </select>
 </mapper>

+ 3 - 0
zjugis-framework/zjugis-spring-boot-starter-workflow/src/main/java/com/zjugis/framework/workflow/rpc/remote/WorkflowClient.java

@@ -65,6 +65,9 @@ public interface WorkflowClient {
     @PostMapping("/IFlowMaterialsApi/addList")
     CommonResult<IFlowMaterialsFile> addList(@RequestBody IFlowMaterialsFile file);
 
+    @GetMapping("/IFlowMaterialsApi/getListByInstanceId")
+    CommonResult<List<IFlowMaterialsFile>> getListByInstanceId(@RequestParam("flowInstanceId")String flowInstanceId);
+
     @PostMapping("/IFlowMaterialsApi/delById")
     CommonResult delById(@RequestParam("id") String id);
 

+ 2 - 0
zjugis-module-infra/zjugis-module-infra-biz/src/main/java/com/zjugis/module/infra/controller/admin/file/FileController.java

@@ -59,6 +59,7 @@ public class FileController {
 
     @PostMapping("/upload-and-get-id")
     @Operation(summary = "上传文件")
+    @PermitAll
     @OperateLog(logArgs = false) // 上传文件,没有记录操作日志的必要
     public CommonResult<FileRespVO> uploadAndGetId(FileUploadReqVO uploadReqVO) throws Exception {
         MultipartFile file = uploadReqVO.getFile();
@@ -76,6 +77,7 @@ public class FileController {
 
     @DeleteMapping("/delete")
     @Operation(summary = "删除文件")
+    @PermitAll
     @Parameter(name = "id", description = "编号", required = true)
     public CommonResult<Boolean> deleteFile(@RequestParam("id") Long id) throws Exception {
         fileService.deleteFile(id);

+ 5 - 1
zjugis-workflow/src/main/java/com/zjugis/z_workflow/serviceApi/IFlowMaterialsApiController.java

@@ -16,7 +16,6 @@ import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * 流程附件材料实例接口服务
@@ -409,6 +408,11 @@ public class IFlowMaterialsApiController extends BaseController {
         return CommonResult.success(uEntity);
     }
 
+    @GetMapping
+    public CommonResult<List<IFlowMaterials>> getListByInstanceId(@RequestParam("flowInstanceId") String flowInstanceId) {
+        List<IFlowMaterials> list = IFlowMaterialsService.listByFlowInstanceId(flowInstanceId);
+        return CommonResult.success(list);
+    }
 
 
 }