|
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.jeeplus.common.TokenProvider;
|
|
|
import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
@@ -88,6 +89,9 @@ public class CwReimbursementInfoService {
|
|
|
@Resource
|
|
|
private CwReimbursementInfoUpHiMapper cwReimbursementInfoUpHiMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private CwReimbursementFileSupplementMapper cwReimbursementFileSupplementMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 报告号查询
|
|
|
*/
|
|
@@ -271,7 +275,14 @@ public class CwReimbursementInfoService {
|
|
|
item.setDeptName(office);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ //文件补充
|
|
|
+ CwReimbursementFileSupplement reimbursementFileSupplement = cwReimbursementFileSupplementMapper.getByReimId(item.getId());
|
|
|
+ if (ObjectUtils.isNotEmpty(reimbursementFileSupplement)){
|
|
|
+ item.setFileStatus(reimbursementFileSupplement.getStatus());
|
|
|
+ item.setFileSuppleId(reimbursementFileSupplement.getId());
|
|
|
+ item.setProcInsIdFile(reimbursementFileSupplement.getProcInsId());
|
|
|
+ item.setTaskIdFile(reimbursementFileSupplement.getTaskIdFile());
|
|
|
+ }
|
|
|
});
|
|
|
return list;
|
|
|
}
|
|
@@ -1295,4 +1306,234 @@ public class CwReimbursementInfoService {
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id查询文件补充信息
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public SaveInfoDto findFileById(String id) {
|
|
|
+ SaveInfoDto dto = new SaveInfoDto();
|
|
|
+ String reimId = "";
|
|
|
+ //查询文件补充信息
|
|
|
+ CwReimbursementFileSupplement supplement = cwReimbursementFileSupplementMapper.selectById(id);
|
|
|
+ //获取报销id
|
|
|
+ if (ObjectUtils.isNotEmpty(supplement)){
|
|
|
+ dto.setFileSuppleId(supplement.getId());
|
|
|
+ dto.setFileStatus(supplement.getStatus());
|
|
|
+ dto.setProcInsIdFile(supplement.getProcInsId());
|
|
|
+ reimId = supplement.getReimbursementId();
|
|
|
+ }else {
|
|
|
+ dto.setFileSuppleId("");
|
|
|
+ dto.setFileStatus("0");
|
|
|
+ dto.setProcInsIdFile("");
|
|
|
+ reimId = id;
|
|
|
+ }
|
|
|
+ // 查询基础信息表
|
|
|
+ CwReimbursementInfo info = infoMapper.selectById(reimId);
|
|
|
+ if (ObjectUtil.isNotEmpty(info)){
|
|
|
+ BeanUtils.copyProperties(info, dto);
|
|
|
+ if(StringUtils.isNotBlank(info.getDepartment())) {
|
|
|
+ OfficeDTO byId = SpringUtil.getBean ( IOfficeApi.class ).getOfficeById(info.getDepartment());
|
|
|
+ if (ObjectUtil.isNotEmpty(byId)) {
|
|
|
+ dto.setDepartmentName(byId.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 查询详情列表
|
|
|
+// LambdaQueryWrapper<CwReimbursementDetailInfo> detailInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+// detailInfoLambdaQueryWrapper.eq(CwReimbursementDetailInfo::getInfoId, id);
|
|
|
+// detailInfoLambdaQueryWrapper.orderByAsc(CwReimbursementDetailInfo::getNumber);
|
|
|
+// List<CwReimbursementDetailInfo> detailInfos = detailInfoMapper.selectList(detailInfoLambdaQueryWrapper);
|
|
|
+ // 项目报销详情
|
|
|
+ List<CwReimbursementDetailInfo> detailList = infoMapper.getDetailList(reimId);
|
|
|
+ detailList.stream().forEach(projectDetail -> {
|
|
|
+ if (StringUtils.isNotBlank(projectDetail.getProjectId())) {
|
|
|
+ String proName = selectProjectByIds(projectDetail.getProjectId());
|
|
|
+ projectDetail.setProjectName(proName);
|
|
|
+ } else {
|
|
|
+ projectDetail.setProjectName("");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(projectDetail.getUserName())){
|
|
|
+ String name = infoMapper.findUserById(projectDetail.getUserId());
|
|
|
+ projectDetail.setUserName(name);
|
|
|
+ String office = infoMapper.findOfficeById(projectDetail.getDeptId());
|
|
|
+ projectDetail.setDeptName(office);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ dto.setDetailInfos(detailList);
|
|
|
+ // 合同报销详情
|
|
|
+ dto.setDetailInfoContracts(infoMapper.getContractDetailList(reimId));
|
|
|
+ // 报告报销详情
|
|
|
+ List<CwReimbursementDetailInfoReport> detailInfoReports=infoMapper.getReportDetailList(reimId);
|
|
|
+ detailInfoReports.stream().forEach(detailInfoReport->{
|
|
|
+ if (StringUtils.isBlank(detailInfoReport.getUserName())){
|
|
|
+ String name = infoMapper.findUserById(detailInfoReport.getUserId());
|
|
|
+ detailInfoReport.setUserName(name);
|
|
|
+ String office = infoMapper.findOfficeById(detailInfoReport.getDeptId());
|
|
|
+ detailInfoReport.setDeptName(office);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ dto.setDetailInfoReports(detailInfoReports);
|
|
|
+ // 其他报销
|
|
|
+ List<CwReimbursementDetailInfoOther> otherDetailList=infoMapper.getOtherDetailList(reimId);
|
|
|
+ otherDetailList.stream().forEach(other->{
|
|
|
+ if (StringUtils.isBlank(other.getUserName())){
|
|
|
+ String name = infoMapper.findUserById(other.getUserId());
|
|
|
+ other.setUserName(name);
|
|
|
+ String office = infoMapper.findOfficeById(other.getDeptId());
|
|
|
+ other.setDeptName(office);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ dto.setDetailInfoOthers(otherDetailList);
|
|
|
+ // 采购报销
|
|
|
+ dto.setDetailInfoProcured(infoMapper.getProcuredDetailList(reimId));
|
|
|
+ dto.setHumanInfoProcured(infoMapper.getHumanProcuredDetailList(reimId));
|
|
|
+ // 查询专用发票信息列表
|
|
|
+ // 查询专用发票信息列表
|
|
|
+ LambdaQueryWrapper<CwReimbursementAmountInfo> amountInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ amountInfoLambdaQueryWrapper.eq(CwReimbursementAmountInfo::getInfoId, reimId);
|
|
|
+ amountInfoLambdaQueryWrapper.eq(CwReimbursementAmountInfo::getReimbursementType, "0");
|
|
|
+ List<CwReimbursementAmountInfo> amountInfos = amountInfoMapper.selectList(amountInfoLambdaQueryWrapper);
|
|
|
+ dto.setAmountInfos(amountInfos);
|
|
|
+ LambdaQueryWrapper<CwReimbursementAmountInfo> invoiceReimbursementsLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ invoiceReimbursementsLambdaQueryWrapper.eq(CwReimbursementAmountInfo::getInfoId, reimId);
|
|
|
+ invoiceReimbursementsLambdaQueryWrapper.eq(CwReimbursementAmountInfo::getReimbursementType, "1");
|
|
|
+ List<CwReimbursementAmountInfo> invoiceReimbursements = amountInfoMapper.selectList(invoiceReimbursementsLambdaQueryWrapper);
|
|
|
+ dto.setInvoiceReimbursements(invoiceReimbursements);
|
|
|
+ // 查询附件信息
|
|
|
+ List<WorkAttachmentInfo> fileList = infoMapper.findFiles(reimId);
|
|
|
+ List<WorkAttachmentInfo> files = com.google.common.collect.Lists.newArrayList();
|
|
|
+ List<WorkAttachmentInfo> invoiceReimbursementFiles = com.google.common.collect.Lists.newArrayList();
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(fileList)) {
|
|
|
+ for (WorkAttachmentInfo i : fileList) {
|
|
|
+ i.setCreateBy(SpringUtil.getBean ( IUserApi.class ).getById(i.getBy()));
|
|
|
+ if("invoiceReimbursement".equals(i.getAttachmentFlag())){
|
|
|
+ invoiceReimbursementFiles.add(i);
|
|
|
+ }else{
|
|
|
+ files.add(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dto.setFiles(files);
|
|
|
+ dto.setInvoiceReimbursementFiles(invoiceReimbursementFiles);
|
|
|
+ }
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增/修改 文件补充
|
|
|
+ * @param dto
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public CwReimbursementFileSupplement saveFile(SaveInfoDto dto) throws Exception{
|
|
|
+ // 获取当前登录人信息
|
|
|
+ UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(TokenProvider.getCurrentToken());
|
|
|
+ CwReimbursementInfo info = infoMapper.getById(dto.getId());
|
|
|
+ if (StringUtils.isNotEmpty(dto.getFileSuppleId())) {
|
|
|
+ // 修改专用发票信息列表
|
|
|
+ // 删除原有数据
|
|
|
+ LambdaQueryWrapper<CwReimbursementAmountInfo> amountWrapper = new LambdaQueryWrapper<>();
|
|
|
+ amountWrapper.eq(CwReimbursementAmountInfo::getInfoId, dto.getId());
|
|
|
+ amountInfoMapper.delete(amountWrapper);
|
|
|
+ if(StringUtils.isNotBlank(dto.getReimbursementType())){
|
|
|
+ if("0".equals(dto.getReimbursementType())){
|
|
|
+ // 保存专用发票列表信息
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getAmountInfos())) {
|
|
|
+ for (CwReimbursementAmountInfo amountInfo : dto.getAmountInfos()) {
|
|
|
+ //普通报销 发票信息
|
|
|
+ amountInfo.setReimbursementType("0");
|
|
|
+ // 生成id
|
|
|
+ String amountId = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ amountInfo.setId(amountId);
|
|
|
+ amountInfo.setCreateById(userDTO.getId());
|
|
|
+ amountInfo.setCreateTime(new Date());
|
|
|
+ amountInfo.setUpdateById(userDTO.getId());
|
|
|
+ amountInfo.setUpdateTime(new Date());
|
|
|
+ amountInfo.setDelFlag(0);
|
|
|
+ // 保存基础表信息主键值
|
|
|
+ amountInfo.setInfoId(dto.getId());
|
|
|
+ amountInfoMapper.insert(amountInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //清除电子发票信息
|
|
|
+ // 删除合同列表
|
|
|
+ LambdaQueryWrapper<CwReimbursementAmountInfo> deleteInfo = new LambdaQueryWrapper<>();
|
|
|
+ deleteInfo.eq(CwReimbursementAmountInfo::getInfoId, dto.getId());
|
|
|
+ deleteInfo.ne(CwReimbursementAmountInfo::getReimbursementType, "0");
|
|
|
+ amountInfoMapper.delete(deleteInfo);
|
|
|
+ }else if("1".equals(dto.getReimbursementType())){
|
|
|
+ // 保存电子发票列表信息
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getInvoiceReimbursements())) {
|
|
|
+ for (CwReimbursementAmountInfo amountInfo : dto.getInvoiceReimbursements()) {
|
|
|
+ //电子发票报销 发票信息
|
|
|
+ amountInfo.setReimbursementType("1");
|
|
|
+ // 生成id
|
|
|
+ String amountId = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ amountInfo.setId(amountId);
|
|
|
+ amountInfo.setCreateById(userDTO.getId());
|
|
|
+ amountInfo.setCreateTime(new Date());
|
|
|
+ amountInfo.setUpdateById(userDTO.getId());
|
|
|
+ amountInfo.setUpdateTime(new Date());
|
|
|
+ amountInfo.setDelFlag(0);
|
|
|
+ // 保存基础表信息主键值
|
|
|
+ amountInfo.setInfoId(dto.getId());
|
|
|
+ amountInfoMapper.insert(amountInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //清除专用发票信息
|
|
|
+ LambdaQueryWrapper<CwReimbursementAmountInfo> deleteInfo = new LambdaQueryWrapper<>();
|
|
|
+ deleteInfo.eq(CwReimbursementAmountInfo::getInfoId, dto.getId());
|
|
|
+ deleteInfo.ne(CwReimbursementAmountInfo::getReimbursementType, "1");
|
|
|
+ amountInfoMapper.delete(deleteInfo);
|
|
|
+
|
|
|
+ // 保存电子发票附件列表信息
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getInvoiceReimbursementFiles())) {
|
|
|
+ infoService.updateFiles(dto.getInvoiceReimbursementFiles(), userDTO, dto.getId(),"invoiceReimbursement");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 修改附件信息列表
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getFiles())) {
|
|
|
+ infoService.updateFiles(dto.getFiles(), userDTO, dto.getId(),"reimbursement");
|
|
|
+ }
|
|
|
+ //修改文件补充信息
|
|
|
+ CwReimbursementFileSupplement fileSupplement = new CwReimbursementFileSupplement();
|
|
|
+ fileSupplement.setId(dto.getFileSuppleId());
|
|
|
+ fileSupplement.setUpdateById(userDTO.getId());
|
|
|
+ fileSupplement.setUpdateTime(new Date());
|
|
|
+ fileSupplement.setStatus(dto.getFileStatus());
|
|
|
+ cwReimbursementFileSupplementMapper.updateById(fileSupplement);
|
|
|
+
|
|
|
+ fileSupplement.setNo(info.getNo());
|
|
|
+ return fileSupplement;
|
|
|
+ } else {
|
|
|
+ // 生成id
|
|
|
+ String id = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ CwReimbursementFileSupplement fileSupplement = new CwReimbursementFileSupplement();
|
|
|
+ fileSupplement.setId(id);
|
|
|
+ fileSupplement.setCreateById(userDTO.getId());
|
|
|
+ fileSupplement.setCreateTime(new Date());
|
|
|
+ fileSupplement.setUpdateById(userDTO.getId());
|
|
|
+ fileSupplement.setUpdateTime(new Date());
|
|
|
+ fileSupplement.setDelFlag(0);
|
|
|
+ fileSupplement.setStatus(dto.getFileStatus());
|
|
|
+ fileSupplement.setReimbursementId(dto.getId());
|
|
|
+ cwReimbursementFileSupplementMapper.insert(fileSupplement);
|
|
|
+ fileSupplement.setNo(info.getNo());
|
|
|
+ return fileSupplement;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改文件补充状态
|
|
|
+ * @param dto
|
|
|
+ */
|
|
|
+ public void updateFileStatusById(RetureListDto dto) {
|
|
|
+ cwReimbursementFileSupplementMapper.updateFileStatusById(dto.getFileSuppleId(),dto.getFileStatus());
|
|
|
+ }
|
|
|
+
|
|
|
}
|