|
@@ -3,16 +3,15 @@ package com.jeeplus.test.cw.projectReport.service;
|
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import com.jeeplus.sys.utils.StringUtils;
|
|
|
import com.jeeplus.sys.utils.UserUtils;
|
|
|
-import com.jeeplus.test.cw.projectReport.domain.CwProjectReport;
|
|
|
-import com.jeeplus.test.cw.projectReport.domain.CwProjectReportData;
|
|
|
-import com.jeeplus.test.cw.projectReport.domain.CwProjectReview;
|
|
|
-import com.jeeplus.test.cw.projectReport.domain.CwProofreadDetail;
|
|
|
+import com.jeeplus.test.cw.projectReport.domain.*;
|
|
|
+import com.jeeplus.test.cw.projectReport.mapper.CwProjectInfoMapper;
|
|
|
import com.jeeplus.test.cw.projectReport.mapper.CwProjectReportReviewMapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jeeplus.test.cw.projectReport.mapper.CwProofreadDetailMapper;
|
|
|
import com.jeeplus.flowable.service.FlowTaskService;
|
|
|
import com.jeeplus.test.cw.projectReportArchive.domain.CwProjectReportArchive;
|
|
|
import com.jeeplus.test.cw.projectReportArchive.mapper.CwProjectReportArchiveMapper;
|
|
|
+import com.jeeplus.test.mould.service.SerialnumTplService;
|
|
|
import org.flowable.bpmn.model.FlowNode;
|
|
|
import org.flowable.engine.TaskService;
|
|
|
import org.apache.commons.beanutils.PropertyUtils;
|
|
@@ -46,12 +45,18 @@ public class CwProjectReportReviewService extends ServiceImpl<CwProjectReportRev
|
|
|
private CwProofreadDetailMapper detailMapper;
|
|
|
|
|
|
@Resource
|
|
|
+ private SerialnumTplService serialnumTplService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
private FlowTaskService flowTaskService;
|
|
|
|
|
|
@Resource
|
|
|
private CwProjectReportArchiveMapper cwProjectReportArchiveMapper;
|
|
|
|
|
|
@Resource
|
|
|
+ private CwProjectInfoMapper infoMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
private TaskService taskService;
|
|
|
|
|
|
public CwProjectReportData queryByReportId(String id) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
|
@@ -83,13 +88,13 @@ public class CwProjectReportReviewService extends ServiceImpl<CwProjectReportRev
|
|
|
CwProjectReview detail = mapper.selectById(reportData.getId());
|
|
|
if (detail != null){
|
|
|
reportData.setCreateBy(reportData.getCreateBy());
|
|
|
- return update(reportData,detail.getId(),detail.getProcInsId());
|
|
|
+ return update(reportData,detail);
|
|
|
} else {
|
|
|
//传过来的是报告表id
|
|
|
detail = mapper.selectByReportId(reportData.getId());
|
|
|
if (detail != null){
|
|
|
reportData.setCreateBy(reportData.getCreateBy());
|
|
|
- return update(reportData,detail.getId(),detail.getProcInsId());
|
|
|
+ return update(reportData,detail);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -100,19 +105,56 @@ public class CwProjectReportReviewService extends ServiceImpl<CwProjectReportRev
|
|
|
* 合同登记修改
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public String update(CwProjectReportData reportData,String id,String procInsId) throws Exception{
|
|
|
+ public String update(CwProjectReportData reportData,CwProjectReview detail) throws Exception{
|
|
|
//获取当前登录人信息
|
|
|
UserDTO userDTO = UserUtils.getCurrentUserDTO();
|
|
|
CwProjectReview review = new CwProjectReview();
|
|
|
BeanUtils.copyProperties(reportData, review);
|
|
|
+ review.setCreateBy(detail.getCreateBy());
|
|
|
+ review.setCreateDate(detail.getCreateDate());
|
|
|
review.setUpdateBy(userDTO.getId());
|
|
|
review.setUpdateDate(new Date());
|
|
|
- review.setId(id);
|
|
|
- if (StringUtils.isNotEmpty(procInsId)) {
|
|
|
- FlowNode currentTask = flowTaskService.getCurrentTask(procInsId);
|
|
|
+ review.setId(detail.getId());
|
|
|
+ if (StringUtils.isNotEmpty(detail.getProcInsId())) {
|
|
|
+ FlowNode currentTask = flowTaskService.getCurrentTask(detail.getProcInsId());
|
|
|
if(null != currentTask && StringUtils.isNotBlank(currentTask.getName())) {
|
|
|
if ("三级复核".equals(currentTask.getName())) {
|
|
|
review.setReviewStatus("5");
|
|
|
+ //设置报告文号、报告流水号
|
|
|
+ CwProjectInfoData infoData = new CwProjectInfoData();
|
|
|
+ //报告文号生成
|
|
|
+ String documentNo = "";
|
|
|
+ try {
|
|
|
+ documentNo = serialnumTplService.genSerialNum(userDTO.getCompanyDTO().getId(), CwProjectInfoData.BIZ_CODE);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ infoData.setReportId(review.getReportId());
|
|
|
+ infoData.setReportNo(documentNo);
|
|
|
+ //报告流水号生成 根据项目编号去new_line表查询
|
|
|
+ String reportNumber = infoMapper.selectReportNumberByProjectNo(reportData.getProjectNumber());
|
|
|
+ int stress = 0;
|
|
|
+ if (null != reportNumber){
|
|
|
+ if (reportNumber.contains(reportData.getProjectNumber() + "-0")){
|
|
|
+ stress = reportNumber.indexOf("-0");//分隔符位置
|
|
|
+ }else {
|
|
|
+ stress = reportNumber.indexOf("-");//分隔符位置
|
|
|
+ }
|
|
|
+ String substring = reportNumber.substring(stress + 1, reportNumber.length());
|
|
|
+ int integer = Integer.parseInt(substring);
|
|
|
+
|
|
|
+ String newReportNumber = "";
|
|
|
+ if (integer>=9){
|
|
|
+ newReportNumber = reportData.getProjectNumber() + "-" + (integer + 1);
|
|
|
+ }else {
|
|
|
+ newReportNumber = reportData.getProjectNumber() + "-0" + (integer + 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ infoData.setReportNumber(newReportNumber);
|
|
|
+ }else {
|
|
|
+ infoData.setReportNumber(reportData.getProjectNumber() + "-0" + "1");
|
|
|
+ }
|
|
|
+ infoMapper.updateByReportId(infoData.getReportId(),infoData.getReportNumber(),infoData.getReportNo());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -129,13 +171,26 @@ public class CwProjectReportReviewService extends ServiceImpl<CwProjectReportRev
|
|
|
mapper.updateById(review);
|
|
|
//对复核数据进行持久化操作
|
|
|
if (CollectionUtils.isNotEmpty(reportData.getDetails())) {
|
|
|
- for (CwProofreadDetail detail:reportData.getDetails()) {
|
|
|
- CwProofreadDetail detail1 = detailMapper.getByTypeIdAndInfoId(detail.getTypeId(),review.getId());
|
|
|
- detail.setId(detail1.getId());
|
|
|
- detail.setInfoId(review.getId());
|
|
|
- detail.setUpdateBy(userDTO.getId());
|
|
|
- detail.setUpdateDate(new Date());
|
|
|
- detailMapper.updateById(detail);
|
|
|
+ for (CwProofreadDetail detail1:reportData.getDetails()) {
|
|
|
+ CwProofreadDetail detail2 = detailMapper.getByTypeIdAndInfoId(detail1.getTypeId(),review.getId());
|
|
|
+ if (null == detail2) {
|
|
|
+ String detailId = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ detail1.setId(detailId);
|
|
|
+ detail1.setInfoId(detail.getId());
|
|
|
+ detail1.setCreateBy(userDTO.getId());
|
|
|
+ detail1.setCreateDate(new Date());
|
|
|
+ detail1.setUpdateBy(userDTO.getId());
|
|
|
+ detail1.setUpdateDate(new Date());
|
|
|
+ detailMapper.insert(detail1);
|
|
|
+ } else {
|
|
|
+ detail1.setCreateDate(detail2.getCreateDate());
|
|
|
+ detail1.setCreateBy(detail2.getCreateBy());
|
|
|
+ detail1.setId(detail2.getId());
|
|
|
+ detail1.setInfoId(review.getId());
|
|
|
+ detail1.setUpdateBy(userDTO.getId());
|
|
|
+ detail1.setUpdateDate(new Date());
|
|
|
+ detailMapper.updateById(detail1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return review.getId();
|
|
@@ -150,7 +205,20 @@ public class CwProjectReportReviewService extends ServiceImpl<CwProjectReportRev
|
|
|
CwProjectReview info = new CwProjectReview();
|
|
|
BeanUtils.copyProperties(dto, info);
|
|
|
//报告编号生成
|
|
|
+ String documentNo = "";
|
|
|
+ if (info.getReportType().equals("1")){
|
|
|
+ documentNo = serialnumTplService.genSerialReviewNum(userDTO.getCompanyDTO().getId(), CwProjectReview.BIZ_CODE1);
|
|
|
+ } else if (info.getReportType().equals("2")){
|
|
|
+ documentNo = serialnumTplService.genSerialReviewNum(userDTO.getCompanyDTO().getId(), CwProjectReview.BIZ_CODE2);
|
|
|
+ } else if (info.getReportType().equals("3")){
|
|
|
+ documentNo = serialnumTplService.genSerialReviewNum(userDTO.getCompanyDTO().getId(), CwProjectReview.BIZ_CODE3);
|
|
|
+ } else if (info.getReportType().equals("4")){
|
|
|
+ documentNo = serialnumTplService.genSerialReviewNum(userDTO.getCompanyDTO().getId(), CwProjectReview.BIZ_CODE4);
|
|
|
+ } else if (info.getReportType().equals("5")){
|
|
|
+ documentNo = serialnumTplService.genSerialReviewNum(userDTO.getCompanyDTO().getId(), CwProjectReview.BIZ_CODE5);
|
|
|
+ }
|
|
|
info.setId(id);
|
|
|
+ info.setReportReviewNo(documentNo);
|
|
|
info.setCreateBy(userDTO.getId());
|
|
|
info.setCreateDate(new Date());
|
|
|
info.setUpdateBy(userDTO.getId());
|