浏览代码

项目报销选择项目时调整为多选模式

lizhenhao 2 年之前
父节点
当前提交
bbef0dc134

+ 8 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reimbursementApproval/approvalInfo/controller/CwReimbursementInfoController.java

@@ -10,6 +10,7 @@ import com.jeeplus.core.excel.utils.EasyPoiUtil;
 import com.jeeplus.flowable.service.FlowTaskService;
 import com.jeeplus.sys.constant.enums.LogTypeEnum;
 import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.cw.projectRecords.domain.CwProjectRecords;
 import com.jeeplus.test.cw.reimbursementApproval.approvalInfo.domain.CwReimbursementInfo;
 import com.jeeplus.test.cw.reimbursementApproval.approvalInfo.service.CwReimbursementInfoService;
 import com.jeeplus.test.cw.reimbursementApproval.approvalInfo.service.dto.*;
@@ -179,4 +180,11 @@ public class CwReimbursementInfoController {
         return ResponseEntity.ok(listDtoIPage);
     }
 
+    @ApiOperation(value = "列表查询")
+    @GetMapping("/queryByProIds")
+    public ResponseEntity<List<CwProjectRecords>> queryByProIds(String ids){
+        List<CwProjectRecords> cwProjectRecords = service.queryByProIds(ids);
+        return ResponseEntity.ok(cwProjectRecords);
+    }
+
 }

+ 52 - 3
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reimbursementApproval/approvalInfo/service/CwReimbursementInfoService.java

@@ -1,5 +1,6 @@
 package com.jeeplus.test.cw.reimbursementApproval.approvalInfo.service;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -15,6 +16,9 @@ import com.jeeplus.sys.utils.StringUtils;
 import com.jeeplus.sys.utils.UserUtils;
 import com.jeeplus.test.cw.common.CommonUtils;
 import com.jeeplus.test.cw.contractRegistration.service.ContractInfoService;
+import com.jeeplus.test.cw.projectRecords.domain.CwProjectRecords;
+import com.jeeplus.test.cw.projectRecords.service.CwProjectRecordsService;
+import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectRecordsDTO;
 import com.jeeplus.test.cw.reimbursementApproval.approvalInfo.domain.*;
 import com.jeeplus.test.cw.reimbursementApproval.approvalInfo.mapper.*;
 import com.jeeplus.test.cw.reimbursementApproval.approvalInfo.service.dto.*;
@@ -30,6 +34,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author: 王强
@@ -74,6 +79,9 @@ public class CwReimbursementInfoService {
     @Resource
     private OfficeService officeService;
 
+    @Resource
+    private CwProjectRecordsService cwProjectRecordsService;
+
     /**
      * 报告号查询
      */
@@ -102,7 +110,7 @@ public class CwReimbursementInfoService {
         queryWrapper.eq("a.del_flag", 0);
         // 报销项目
         if (StringUtils.isNotEmpty(dto.getProject())) {
-            queryWrapper.apply("(b.project_id = {0} OR p.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
+            queryWrapper.apply("(b.project_id Like {0} OR p.project_name LIKE {1})", "%" + dto.getProject() + "%", "%" + dto.getProject() + "%");
             queryWrapper.or().apply("(b3.project_id = {0} OR p3.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
             queryWrapper.or().apply("(b4.project_id = {0} OR b4.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
             queryWrapper.or().apply("(b5.project_id = {0} OR b5.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
@@ -201,7 +209,16 @@ public class CwReimbursementInfoService {
                 }
             }
         }*/
-        return infoMapper.findList(page, queryWrapper, officeIds.toString());
+        IPage<RetureListDto> list = infoMapper.findList(page, queryWrapper, officeIds.toString());
+        list.getRecords().stream().forEach(item -> {
+            if (StringUtils.isNotBlank(item.getSourceType()) && "1".equals(item.getSourceType())) { //项目报销
+                if (StringUtils.isNotBlank(item.getProjectId())) {
+                    String proName = selectProjectByIds(item.getProjectId());
+                    item.setProjectName(proName);
+                }
+            }
+        });
+        return list;
     }
 
     public IPage<ProgramProjectListInfo> projectList(Page<ProgramProjectListInfo> page, ProgramProjectListInfo info, String tabType) throws Exception{
@@ -467,7 +484,16 @@ public class CwReimbursementInfoService {
 //        detailInfoLambdaQueryWrapper.orderByAsc(CwReimbursementDetailInfo::getNumber);
 //        List<CwReimbursementDetailInfo> detailInfos = detailInfoMapper.selectList(detailInfoLambdaQueryWrapper);
             // 项目报销详情
-            dto.setDetailInfos(infoMapper.getDetailList(id));
+            List<CwReimbursementDetailInfo> detailList = infoMapper.getDetailList(id);
+            detailList.stream().forEach(projectDetail -> {
+                if (StringUtils.isNotBlank(projectDetail.getProjectId())) {
+                    String proName = selectProjectByIds(projectDetail.getProjectId());
+                    projectDetail.setProjectName(proName);
+                } else {
+                    projectDetail.setProjectName("");
+                }
+            });
+            dto.setDetailInfos(detailList);
             // 合同报销详情
             dto.setDetailInfoContracts(infoMapper.getContractDetailList(id));
             // 报告报销详情
@@ -493,6 +519,22 @@ public class CwReimbursementInfoService {
         return dto;
     }
 
+    /**
+     * 根据项目id查询项目名称
+     * @param ids 以逗号分隔的多个项目id字符串
+     * @return
+     */
+    public String selectProjectByIds(String ids) {
+        String projectName = "";
+        String[] split = ids.split(",");
+        List<String> idList = Arrays.asList(split);
+        List<CwProjectRecords> list = cwProjectRecordsService.list(new LambdaQueryWrapper<CwProjectRecords>().in(CwProjectRecords::getId, idList));
+        if (CollectionUtil.isNotEmpty(list)) {
+            projectName = list.stream().map(CwProjectRecords::getProjectName).collect(Collectors.joining(","));
+        }
+        return projectName;
+    }
+
     public Boolean checkNumber(String number) {
         LambdaQueryWrapper<CwReimbursementAmountInfo> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(CwReimbursementAmountInfo::getNumber, number);
@@ -652,4 +694,11 @@ public class CwReimbursementInfoService {
         return iPage;
     }
 
+    public List<CwProjectRecords> queryByProIds(String ids) {
+        String[] split = ids.split(",");
+        List<String> idList = Arrays.asList(split);
+        List<CwProjectRecords> list = cwProjectRecordsService.list(new LambdaQueryWrapper<CwProjectRecords>().in(CwProjectRecords::getId, idList));
+        return list;
+    }
+
 }

+ 3 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/service/ProjectListService.java

@@ -500,7 +500,9 @@ public class ProjectListService {
             members.stream().forEach(member -> {
                 if (StringUtils.isNotBlank(member.getUserId())) {
                     User byId = userService.getById(member.getUserId());
-                    member.setName(byId.getName());
+                    if (ObjectUtil.isNotEmpty(byId)) {
+                        member.setName(byId.getName());
+                    }
                 }
             });
             dto.setMembers(members);

+ 8 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementInfo/controller/ReimbursementInfoController.java

@@ -8,6 +8,7 @@ import com.jeeplus.core.excel.ExcelOptions;
 import com.jeeplus.core.excel.ExportMode;
 import com.jeeplus.core.excel.utils.EasyPoiUtil;
 import com.jeeplus.sys.constant.enums.LogTypeEnum;
+import com.jeeplus.test.cw.projectRecords.domain.CwProjectRecords;
 import com.jeeplus.test.program.configuration.projectList.domain.ProgramProjectListInfo;
 import com.jeeplus.test.program.configuration.projectList.service.dto.ExportFileDto;
 import com.jeeplus.test.reimbursement.reimbursementInfo.domain.ReimbursementInfo;
@@ -146,4 +147,11 @@ public class ReimbursementInfoController {
         Map<String, Object> res = service.auditFunc(saveInfoDto);
         return res;
     }
+
+    @ApiOperation(value = "列表查询")
+    @GetMapping("/queryByProIds")
+    public ResponseEntity<List<ProgramProjectListInfo>> queryByProIds(String ids){
+        List<ProgramProjectListInfo> cwProjectRecords = service.queryByProIds(ids);
+        return ResponseEntity.ok(cwProjectRecords);
+    }
 }

+ 97 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementInfo/service/ReimbursementInfoService.java

@@ -1,5 +1,6 @@
 package com.jeeplus.test.reimbursement.reimbursementInfo.service;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
@@ -20,11 +21,20 @@ import com.jeeplus.sys.utils.DictUtils;
 import com.jeeplus.sys.utils.StringUtils;
 import com.jeeplus.sys.utils.UserUtils;
 import com.jeeplus.test.cw.common.CommonApi;
+import com.jeeplus.test.cw.projectRecords.domain.CwProjectRecords;
+import com.jeeplus.test.cw.projectRecords.service.CwProjectRecordsService;
 import com.jeeplus.test.cw.reimbursementApproval.approvalInfo.domain.*;
 import com.jeeplus.test.manytomany.domain.Student;
 import com.jeeplus.test.mould.service.SerialnumTplService;
 import com.jeeplus.test.oss.domain.WorkAttachment;
 import com.jeeplus.test.oss.mapper.OssServiceMapper;
+import com.jeeplus.test.program.configuration.projectList.domain.ProgramProjectListInfo;
+import com.jeeplus.test.program.configuration.projectList.domain.ProgramReportNo;
+import com.jeeplus.test.program.configuration.projectList.mapper.ProgramReportNoMapper;
+import com.jeeplus.test.program.configuration.projectList.mapper.ProjectListMapper;
+import com.jeeplus.test.program.configuration.projectList.service.ProjectListService;
+import com.jeeplus.test.projectRecords.domain.Project;
+import com.jeeplus.test.projectRecords.service.ProjectService;
 import com.jeeplus.test.reimbursement.reimbursementInfo.domain.*;
 import com.jeeplus.test.reimbursement.reimbursementInfo.mapper.*;
 import com.jeeplus.test.reimbursement.reimbursementInfo.service.dto.QueryListDto;
@@ -88,6 +98,11 @@ public class ReimbursementInfoService {
     @Autowired
     private TaskService taskService;
 
+    @Resource
+    private ProjectListMapper projectListMapper;
+
+    @Resource
+    private ProgramReportNoMapper programReportNoMapper;
     /**
      * 列表查询
      */
@@ -180,10 +195,61 @@ public class ReimbursementInfoService {
                     item.setAuditUserIds(flowTaskService.getTaskAuditUsers(item.getTaskId()));  // 获取数据审核人
                 }
             }
+            if (StringUtils.isNotBlank(item.getSourceType()) && "1".equals(item.getSourceType())) { //项目报销
+                if (StringUtils.isNotBlank(item.getProjectId())) {
+                    String proName = selectProjectByIds(item.getProjectId());
+                    item.setProjectName(proName);
+                    String reportNo = selectReportNoByIds(item.getProjectId());
+                    item.setReportNumber(reportNo);
+                }
+            }
         });
         return pageList;
     }
 
+    /**
+     * 根据项目id查询项目名称
+     * @param ids 以逗号分隔的多个项目id字符串
+     * @return
+     */
+    public String selectProjectByIds(String ids) {
+        String projectName = "";
+        String[] split = ids.split(",");
+        List<String> idList = Arrays.asList(split);
+        List<ProgramProjectListInfo> list = projectListMapper.selectList(new LambdaQueryWrapper<ProgramProjectListInfo>().in(ProgramProjectListInfo::getId, idList));
+        if (CollectionUtil.isNotEmpty(list)) {
+            projectName = list.stream().map(ProgramProjectListInfo::getName).collect(Collectors.joining(","));
+        }
+        return projectName;
+    }
+
+    /**
+     * 根据项目id查询报告号
+     * @param ids 以逗号分隔的多个项目id字符串
+     * @return
+     */
+    public String selectReportNoByIds(String ids) {
+        List<String> reportNoList = new ArrayList<>();
+        String reportNo = "";
+        String[] split = ids.split(",");
+        List<String> idList = Arrays.asList(split);
+        List<ProgramProjectListInfo> list = projectListMapper.selectList(new LambdaQueryWrapper<ProgramProjectListInfo>().in(ProgramProjectListInfo::getId, idList));
+        if (CollectionUtil.isNotEmpty(list)) {
+            list.stream().forEach(item -> {
+                ProgramReportNo programReportNo = programReportNoMapper.selectOne(new LambdaQueryWrapper<ProgramReportNo>().eq(ProgramReportNo::getProgramId, item.getId()));
+                if (ObjectUtil.isNotEmpty(programReportNo) && StringUtils.isNotBlank(programReportNo.getReportNo())) {
+                    reportNoList.add(programReportNo.getReportNo());
+                } else {
+                    reportNoList.add("无");
+                }
+            });
+            if (CollectionUtil.isNotEmpty(reportNoList)) {
+                reportNo = reportNoList.stream().collect(Collectors.joining(","));
+            }
+        }
+        return reportNo;
+    }
+
     public ReimbursementInfo save(SaveInfoDto dto) throws Exception{
         // 获取当前登录人信息
         UserDTO userDTO = UserUtils.getCurrentUserDTO();
@@ -408,7 +474,19 @@ public class ReimbursementInfoService {
                 }
             }
             // 项目报销详情
-            dto.setDetailInfos(infoMapper.getDetailList(id));
+            List<ReimbursementDetailInfo> detailList = infoMapper.getDetailList(id);
+            detailList.stream().forEach(projectDetail -> {
+                if (StringUtils.isNotBlank(projectDetail.getProjectId())) {
+                    String proName = selectProjectByIds(projectDetail.getProjectId());
+                    projectDetail.setProjectName(proName);
+                    String reportNo = selectReportNoByIds(projectDetail.getProjectId());
+                    projectDetail.setReportNumber(reportNo);
+                } else {
+                    projectDetail.setProjectName("");
+                    projectDetail.setReportNumber("");
+                }
+            });
+            dto.setDetailInfos(detailList);
             // 合同报销详情
             dto.setDetailInfoContracts(infoMapper.getContractDetailList(id));
             // 其他报销
@@ -762,4 +840,22 @@ public class ReimbursementInfoService {
         }
         return result;
     }
+
+    public List<ProgramProjectListInfo> queryByProIds(String ids) {
+        String[] split = ids.split(",");
+        List<String> idList = Arrays.asList(split);
+        List<ProgramProjectListInfo> list = projectListMapper.selectList(new LambdaQueryWrapper<ProgramProjectListInfo>().in(ProgramProjectListInfo::getId, idList));
+        if (CollectionUtil.isNotEmpty(list)) {
+            list.stream().forEach(item -> {
+                ProgramReportNo programReportNo = programReportNoMapper.selectOne(new LambdaQueryWrapper<ProgramReportNo>().eq(ProgramReportNo::getProgramId, item.getId()));
+                if (ObjectUtil.isNotEmpty(programReportNo) && StringUtils.isNotBlank(programReportNo.getReportNo())) {
+                    item.setReportNo(programReportNo.getReportNo());
+                } else {
+                    item.setReportNo("无");
+                }
+            });
+        }
+
+        return list;
+    }
 }