|
@@ -1,24 +1,39 @@
|
|
|
package com.jeeplus.test.cw.projectReport.controller;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.TypeReference;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import com.jeeplus.aop.logging.annotation.ApiLog;
|
|
|
import com.jeeplus.common.redis.RedisUtils;
|
|
|
import com.jeeplus.common.utils.ResponseUtil;
|
|
|
+import com.jeeplus.flowable.model.Flow;
|
|
|
+import com.jeeplus.flowable.service.FlowTaskService;
|
|
|
import com.jeeplus.sys.constant.enums.LogTypeEnum;
|
|
|
import com.jeeplus.sys.utils.UserUtils;
|
|
|
+import com.jeeplus.test.cw.common.flowable.dto.CommitParamDTO;
|
|
|
import com.jeeplus.test.cw.projectRecords.domain.CwProjectRecords;
|
|
|
import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectRecordsDTO;
|
|
|
import com.jeeplus.test.cw.projectReport.domain.CwProjectReport;
|
|
|
import com.jeeplus.test.cw.projectReport.domain.CwProjectReportData;
|
|
|
import com.jeeplus.test.cw.projectReport.domain.CwProjectReportSignature;
|
|
|
+import com.jeeplus.test.cw.projectReport.mapper.CwProjectReportSignatureMapper;
|
|
|
+import com.jeeplus.test.cw.projectReport.mapper.ProjectReportWorkAttachmentMapper;
|
|
|
import com.jeeplus.test.cw.projectReport.service.CwProjectReportService;
|
|
|
import com.jeeplus.test.cw.projectReport.service.dto.CwProjectReportDTO;
|
|
|
import com.jeeplus.test.cw.projectReport.service.dto.CwProjectReportSignatureDTO;
|
|
|
import com.jeeplus.test.cw.workClientInfo.service.dto.CwWorkClientBaseDTO;
|
|
|
+import com.jeeplus.test.oss.domain.WorkAttachment;
|
|
|
import com.jeeplus.test.signature.utils.SignaturePostUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.flowable.engine.TaskService;
|
|
|
+import org.flowable.task.api.Task;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -26,6 +41,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
@@ -42,6 +58,12 @@ public class CwProjectReportController {
|
|
|
private CwProjectReportService projectReportService;
|
|
|
@Autowired
|
|
|
private RedisUtils redisUtils;
|
|
|
+ @Resource
|
|
|
+ private ProjectReportWorkAttachmentMapper attachmentMapper;
|
|
|
+ @Autowired
|
|
|
+ private FlowTaskService flowTaskService;
|
|
|
+ @Autowired
|
|
|
+ private TaskService taskService;
|
|
|
|
|
|
/**
|
|
|
* 保存财务报告信息-流程
|
|
@@ -132,15 +154,25 @@ public class CwProjectReportController {
|
|
|
@ApiLog(value = "签章流程审核通过", type = LogTypeEnum.SAVE)
|
|
|
@PostMapping("saveFlowableParam")
|
|
|
public ResponseEntity<String> saveFlowableParam(@Valid @RequestBody CwProjectReportData cwProjectReportData) {
|
|
|
- CwProjectReportData cwProjectReportDto = projectReportService.queryById(cwProjectReportData.getId());
|
|
|
- // 获取签章页面url
|
|
|
- String mobile = UserUtils.getCurrentUserDTO().getMobile();
|
|
|
- String signatureContractUrl = SignaturePostUtil.getSignatureContractUrl(cwProjectReportDto.getSignatureContractId(), mobile);
|
|
|
- // 将数据存储到redis中,key为contractId
|
|
|
- cwProjectReportData.getCommitParamDTO().setVars(cwProjectReportDto);
|
|
|
- redisUtils.set("cw_report_signature_" + cwProjectReportDto.getSignatureContractId(),cwProjectReportData.getCommitParamDTO());
|
|
|
- redisUtils.expire("cw_report_signature_" + cwProjectReportDto.getSignatureContractId(),24, TimeUnit.HOURS);
|
|
|
- return ResponseEntity.ok(signatureContractUrl);
|
|
|
+ //查询报告文件信息(电子章)
|
|
|
+ List<WorkAttachment> fileList = attachmentMapper.selectWorkAttachmentByReportId(cwProjectReportData.getId());
|
|
|
+ // 有电子章的附件时,走签章流程
|
|
|
+ if (CollectionUtil.isNotEmpty(fileList)) {
|
|
|
+ CwProjectReportData cwProjectReportDto = projectReportService.queryById(cwProjectReportData.getId());
|
|
|
+ // 获取签章页面url
|
|
|
+ String mobile = UserUtils.getCurrentUserDTO().getMobile();
|
|
|
+ String signatureContractUrl = SignaturePostUtil.getSignatureContractUrl(cwProjectReportDto.getSignatureContractId(), mobile);
|
|
|
+ // 将数据存储到redis中,key为contractId
|
|
|
+ cwProjectReportData.getCommitParamDTO().setVars(cwProjectReportDto);
|
|
|
+ redisUtils.set("cw_report_signature_" + cwProjectReportDto.getSignatureContractId(),cwProjectReportData.getCommitParamDTO());
|
|
|
+ redisUtils.expire("cw_report_signature_" + cwProjectReportDto.getSignatureContractId(),24, TimeUnit.HOURS);
|
|
|
+ return ResponseEntity.ok(signatureContractUrl);
|
|
|
+ } else {
|
|
|
+ // 没有电子章的附件时,走正常审核流程
|
|
|
+ // 流程审核通过
|
|
|
+ projectReportService.commitFlowable(cwProjectReportData);
|
|
|
+ return ResponseEntity.ok("操作成功");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -151,13 +183,22 @@ public class CwProjectReportController {
|
|
|
@ApiLog(value = "签章流程送审", type = LogTypeEnum.SAVE)
|
|
|
@PostMapping("saveData")
|
|
|
public ResponseEntity<String> saveData(@Valid @RequestBody CwProjectReportData cwProjectReportData) {
|
|
|
- Map<String, Object> signatureContractId = projectReportService.createSignatureContractId(cwProjectReportData);
|
|
|
- boolean bool = (boolean)signatureContractId.get("success");
|
|
|
- if (bool) {
|
|
|
+ //查询报告文件信息(电子章)
|
|
|
+ List<WorkAttachment> fileList = attachmentMapper.selectWorkAttachmentByReportId(cwProjectReportData.getId());
|
|
|
+ if (CollectionUtil.isNotEmpty(fileList)) {
|
|
|
+ // 有电子章的附件时,走签章流程
|
|
|
+ Map<String, Object> signatureContractId = projectReportService.createSignatureContractId(cwProjectReportData);
|
|
|
+ boolean bool = (boolean)signatureContractId.get("success");
|
|
|
+ if (bool) {
|
|
|
+ String signatureId = projectReportService.getSignature(cwProjectReportData.getId());
|
|
|
+ return ResponseUtil.newInstance().add("businessTable", "cw_project_report_signature").add("businessId", signatureId).ok ("操作成功");
|
|
|
+ }
|
|
|
+ return ResponseEntity.badRequest().body((String) signatureContractId.get("message"));
|
|
|
+ } else {
|
|
|
+ // 没有电子章的附件时,走正常审核流程
|
|
|
String signatureId = projectReportService.getSignature(cwProjectReportData.getId());
|
|
|
return ResponseUtil.newInstance().add("businessTable", "cw_project_report_signature").add("businessId", signatureId).ok ("操作成功");
|
|
|
}
|
|
|
- return ResponseEntity.badRequest().body("操作失败");
|
|
|
}
|
|
|
|
|
|
/**
|