|
@@ -1,6 +1,8 @@
|
|
|
package org.springblade.business.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
@@ -13,16 +15,23 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import org.springblade.business.entity.ContractLog;
|
|
|
import org.springblade.business.entity.ContractLogWbs;
|
|
|
import org.springblade.business.entity.Task;
|
|
|
+import org.springblade.business.entity.TaskParallel;
|
|
|
import org.springblade.business.feign.MessageWarningClient;
|
|
|
import org.springblade.business.feign.OperationLogClient;
|
|
|
import org.springblade.business.feign.TaskClient;
|
|
|
import org.springblade.business.service.IContractLogWbsService;
|
|
|
+import org.springblade.business.utils.FileUtils;
|
|
|
import org.springblade.business.vo.*;
|
|
|
+import org.springblade.common.constant.CommonConstant;
|
|
|
+import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
+import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.manager.feign.WbsTreeContractClient;
|
|
|
import org.springblade.manager.vo.WbsTreeContractTreeVOS;
|
|
|
+import org.springblade.resource.feign.NewIOSSClient;
|
|
|
+import org.springblade.system.cache.ParamCache;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springblade.business.service.IContractLogService;
|
|
@@ -30,6 +39,7 @@ import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -57,6 +67,68 @@ public class ContractLogController extends BladeController {
|
|
|
|
|
|
private final MessageWarningClient messageWarningClient;
|
|
|
|
|
|
+ private final NewIOSSClient newIOSSClient;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 日志上报(填报页)
|
|
|
+ */
|
|
|
+ @PostMapping("/startTaskTheLog")
|
|
|
+ @ApiOperationSupport(order = 9)
|
|
|
+ @ApiOperation(value = "日志上报(填报页)")
|
|
|
+ public R<Boolean> startTaskTheLog(@RequestBody StartTaskVO startTaskVO, @RequestParam String nodePrimaryKeyId, @RequestParam String recordTime){
|
|
|
+ if(StringUtils.isEmpty(startTaskVO.getIds())){
|
|
|
+ if(StringUtils.isEmpty(nodePrimaryKeyId) && StringUtils.isEmpty(recordTime)){
|
|
|
+ return R.fail("未找到业务数据");
|
|
|
+ }
|
|
|
+ //如果ids为空,说明是填报页上报,那么需要根据 nodePrimaryKeyId 和 recordTime 获取当前用户的填写记录
|
|
|
+ ContractLog log = this.contractLogService.getOne(Wrappers.<ContractLog>lambdaQuery().eq(ContractLog::getWbsNodeId, nodePrimaryKeyId).eq(ContractLog::getRecordTime, recordTime).eq(ContractLog::getCreateUser, AuthUtil.getUserId()));
|
|
|
+ if(log == null){
|
|
|
+ return R.fail("未找到业务数据");
|
|
|
+ }
|
|
|
+ startTaskVO.setIds(String.valueOf(log.getId()));
|
|
|
+ }
|
|
|
+ return this.batchTask(startTaskVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预览、打印
|
|
|
+ */
|
|
|
+ @PostMapping("/theLogPreviewAndPrint")
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "预览、打印")
|
|
|
+ @ApiImplicitParam(name = "json", value = "key为 ids数组,ids的数据为勾选的列表数据id集合")
|
|
|
+ public R<String> theLogPreviewAndPrint(@RequestBody JSONObject json){
|
|
|
+ //获取配置的路径
|
|
|
+ String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+
|
|
|
+ if(json.containsKey("ids")){
|
|
|
+ //id集合
|
|
|
+ List<String> ids = JSONArray.parseArray(JSONObject.toJSONString(json.getJSONArray("ids")), String.class);
|
|
|
+ //查询具体数据
|
|
|
+ List<ContractLog> logList = this.contractLogService.list(Wrappers.<ContractLog>lambdaQuery().in(ContractLog::getId, ids));
|
|
|
+ //获取pdf路径
|
|
|
+ List<String> pdfUrls = logList.stream().map(log -> StringUtils.isNotEmpty(log.getEVisaPdfUrl()) ? log.getEVisaPdfUrl() : log.getPdfUrl()).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ //删除空数据
|
|
|
+ pdfUrls.removeIf(StringUtils::isEmpty);
|
|
|
+
|
|
|
+ if(pdfUrls.size() > 0){
|
|
|
+ //合并的pdf路径
|
|
|
+ String fileName = SnowFlakeUtil.getId() + "-" + new Date().getTime() + ".pdf";
|
|
|
+ String mergePdfPath = file_path + "/pdf//" + fileName;
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfUrls, mergePdfPath);
|
|
|
+
|
|
|
+ //上传
|
|
|
+ BladeFile file = this.newIOSSClient.uploadFile(fileName, mergePdfPath);
|
|
|
+ if(file != null){
|
|
|
+ return R.data(file.getLink());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return R.fail("未找到数据");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取当前日志资料关联的工序节点信息
|
|
|
*/
|
|
@@ -78,7 +150,7 @@ public class ContractLogController extends BladeController {
|
|
|
.eq(ContractLog::getWbsNodeId, nodePrimaryKeyId)
|
|
|
.eq(ContractLog::getRecordTime, recordTime).eq(ContractLog::getCreateUser, AuthUtil.getUserId()));
|
|
|
if(log == null){
|
|
|
- return R.fail("未找到数据");
|
|
|
+ return R.data(300, null, "未找到数据");
|
|
|
}
|
|
|
|
|
|
theLogId = String.valueOf(log.getId());
|
|
@@ -104,8 +176,8 @@ public class ContractLogController extends BladeController {
|
|
|
@PostMapping("/getSubmitLogDateList")
|
|
|
@ApiOperationSupport(order = 6)
|
|
|
@ApiOperation(value = "获取合同段当前日志节点下的填报日期记录")
|
|
|
- public R<List<String>> getSubmitLogDateList(@RequestParam String contractId, @RequestParam String primaryKeyId){
|
|
|
- return R.data(this.contractLogService.getSubmitLogDateList(contractId, primaryKeyId));
|
|
|
+ public R<List<String>> getSubmitLogDateList(@RequestParam String contractId, @RequestParam String primaryKeyId, @RequestParam String year){
|
|
|
+ return R.data(this.contractLogService.getSubmitLogDateList(contractId, primaryKeyId, year));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -125,9 +197,7 @@ public class ContractLogController extends BladeController {
|
|
|
this.taskClient.abolishTask(task);
|
|
|
} else if(new Integer("2").equals(task.getStatus())) {
|
|
|
//已审批的任务,修改业务数据的审批状态为未上报并撤签即可
|
|
|
- this.contractLogService.update(Wrappers.<ContractLog>lambdaUpdate().set(ContractLog::getStatus, 3).in(ContractLog::getId, Arrays.asList(task.getFormDataId().split(","))));
|
|
|
- // todo ================== 调用撤签
|
|
|
- // todo ================== 调用撤签
|
|
|
+ this.contractLogService.update(Wrappers.<ContractLog>lambdaUpdate().set(ContractLog::getEVisaPdfUrl, null).set(ContractLog::getStatus, 3).in(ContractLog::getId, Arrays.asList(task.getFormDataId().split(","))));
|
|
|
}
|
|
|
|
|
|
List<ContractLog> contractLogs = this.contractLogService.getBaseMapper().selectBatchIds(Arrays.asList(task.getFormDataId().split(",")));
|
|
@@ -186,8 +256,22 @@ public class ContractLogController extends BladeController {
|
|
|
taskVO.setApprovalType(3);
|
|
|
//上报
|
|
|
if(this.taskClient.startTask(taskVO).getData()){
|
|
|
+ LambdaUpdateWrapper<ContractLog> wrappers = Wrappers.lambdaUpdate();
|
|
|
+ wrappers.set(ContractLog::getBatch, taskVO.getBatch()).set(ContractLog::getStatus, 1);
|
|
|
+
|
|
|
+ //查询审批人
|
|
|
+ List<TaskParallel> taskUsers = this.taskClient.queryApprovalUser(id);
|
|
|
+ if(taskUsers.size() > 0){
|
|
|
+ //生成审批人信息
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ taskUsers.forEach(users -> stringBuilder.append(",").append(users.getTaskUser()).append("-").append(users.getTaskUserName()));
|
|
|
+ //设置审批人
|
|
|
+ wrappers.set(ContractLog::getAuditUserIdAndName, stringBuilder.substring(1));
|
|
|
+ }
|
|
|
+ wrappers.eq(ContractLog::getId, id);
|
|
|
+
|
|
|
//修改记录
|
|
|
- this.contractLogService.update(Wrappers.<ContractLog>lambdaUpdate().set(ContractLog::getStatus, 1).eq(ContractLog::getId, id));
|
|
|
+ this.contractLogService.update(wrappers);
|
|
|
}
|
|
|
}
|
|
|
|