|
@@ -599,7 +599,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 单个废除
|
|
|
+ * 单个废除 撤回
|
|
|
*/
|
|
|
@PostMapping("/abolishOne")
|
|
|
@ApiOperationSupport(order = 24)
|
|
@@ -611,13 +611,13 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
primaryKeyId = primaryKeyId + "*";
|
|
|
if (businessData != null) {
|
|
|
//使用批量废除接口
|
|
|
- return this.batchAbolish(businessData.getId().toString(), primaryKeyId, projectId, contractId);
|
|
|
+ return this.batchAbolish(businessData.getId().toString(), primaryKeyId, projectId, contractId, "撤回成功");
|
|
|
} else {
|
|
|
//试验
|
|
|
InformationQuery businessDataTrial = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 2));
|
|
|
if (businessDataTrial != null) {
|
|
|
//使用批量废除接口
|
|
|
- return this.batchAbolish(businessDataTrial.getId().toString(), primaryKeyId, projectId, contractId);
|
|
|
+ return this.batchAbolish(businessDataTrial.getId().toString(), primaryKeyId, projectId, contractId, "撤回成功");
|
|
|
}
|
|
|
}
|
|
|
return R.data(300, false, "废除失败,未找到业务数据");
|
|
@@ -636,7 +636,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
.eq(InformationQuery::getId, id));
|
|
|
if (businessData != null) {
|
|
|
//使用批量废除接口
|
|
|
- return this.batchAbolish(businessData.getId().toString(), primaryKeyId, projectId, contractId);
|
|
|
+ return this.batchAbolish(businessData.getId().toString(), primaryKeyId, projectId, contractId, "撤回成功");
|
|
|
}
|
|
|
return R.data(300, false, "废除失败,未找到业务数据");
|
|
|
}
|
|
@@ -1130,211 +1130,218 @@ public R<String> batchDownloadFileToZip(String ids, HttpServletResponse response
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * 批量废除
|
|
|
- */
|
|
|
-@PostMapping("/batchAbolish")
|
|
|
-@ApiOperationSupport(order = 18)
|
|
|
-@ApiOperation(value = "批量废除", notes = "质检的ids,试验的记录ids")
|
|
|
+ /**
|
|
|
+ * 批量废除
|
|
|
+ */
|
|
|
+ @PostMapping("/batchAbolish")
|
|
|
+ @ApiOperationSupport(order = 18)
|
|
|
+ @ApiOperation(value = "批量废除", notes = "质检的ids,试验的记录ids")
|
|
|
// @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
|
|
|
-public R<Object> batchAbolish(@RequestParam String ids, String primaryKeyId, @RequestParam String projectId, @RequestParam String contractId) {
|
|
|
- Set<String> aopParamsSet = new HashSet<>();
|
|
|
- aopParamsSet.add(SecureUtil.getUserId() + "," + projectId + "," + contractId);
|
|
|
-
|
|
|
- //获取所有相关任务记录
|
|
|
- List<Task> taskList = this.taskClient.queryTaskListByFormDataId(ids);
|
|
|
-
|
|
|
- if (taskList.size() == 0) {
|
|
|
- //试验
|
|
|
- List<InformationQuery> dataList = this.informationQueryService.getBaseMapper().selectList(Wrappers.<InformationQuery>lambdaQuery()
|
|
|
- .select(InformationQuery::getId)
|
|
|
- .eq(InformationQuery::getType, 2)
|
|
|
- .in(InformationQuery::getWbsId, Func.toStrList(ids)));
|
|
|
- if (dataList.size() > 0) {
|
|
|
- List<Long> dataIds = dataList.stream().map(InformationQuery::getId).collect(Collectors.toList());
|
|
|
- taskList = this.taskClient.queryTaskListByFormDataId(StringUtils.join(dataIds, ","));
|
|
|
+ public R<Object> batchAbolish(@RequestParam String ids, String primaryKeyId, @RequestParam String projectId, @RequestParam String contractId, @RequestParam(required = false, defaultValue = "") String context) {
|
|
|
+ Set<String> aopParamsSet = new HashSet<>();
|
|
|
+ aopParamsSet.add(SecureUtil.getUserId() + "," + projectId + "," + contractId);
|
|
|
+
|
|
|
+ //获取所有相关任务记录
|
|
|
+ List<Task> taskList = this.taskClient.queryTaskListByFormDataId(ids);
|
|
|
+
|
|
|
+ if (taskList.size() == 0) {
|
|
|
+ //试验
|
|
|
+ List<InformationQuery> dataList = this.informationQueryService.getBaseMapper().selectList(Wrappers.<InformationQuery>lambdaQuery()
|
|
|
+ .select(InformationQuery::getId)
|
|
|
+ .eq(InformationQuery::getType, 2)
|
|
|
+ .in(InformationQuery::getWbsId, Func.toStrList(ids)));
|
|
|
+ if (dataList.size() > 0) {
|
|
|
+ List<Long> dataIds = dataList.stream().map(InformationQuery::getId).collect(Collectors.toList());
|
|
|
+ taskList = this.taskClient.queryTaskListByFormDataId(StringUtils.join(dataIds, ","));
|
|
|
+ context = "撤回成功";
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (taskList != null && taskList.size() > 0) {
|
|
|
- try {
|
|
|
- //执行废除
|
|
|
- for (Task task : taskList) {
|
|
|
- if (new Integer("1").equals(task.getStatus())) {
|
|
|
- //正在审批,调用废除
|
|
|
- this.taskClient.abolishTask(task);
|
|
|
- } else if (new Integer("2").equals(task.getStatus()) || new Integer("3").equals(task.getStatus())) {
|
|
|
- //已审批、已撤销的任务,修改业务数据的审批状态为未上报并撤签即可
|
|
|
- LambdaUpdateWrapper<InformationQuery> wrapper = Wrappers.lambdaUpdate();
|
|
|
- //更改状态为未上报
|
|
|
- wrapper.set(InformationQuery::getStatus, 0);
|
|
|
- //将电签的pdf路径置空
|
|
|
- wrapper.set(InformationQuery::getEVisaPdfUrl, null);
|
|
|
- //将上报批次置空
|
|
|
- wrapper.set(InformationQuery::getReportNumber, null);
|
|
|
- //置空审批人
|
|
|
- wrapper.set(InformationQuery::getAuditUserIdAndName, null);
|
|
|
-
|
|
|
- this.informationQueryService.update(wrapper.in(InformationQuery::getId, Arrays.asList(task.getFormDataId().split(","))));
|
|
|
- }
|
|
|
+ if (taskList != null && taskList.size() > 0) {
|
|
|
+ try {
|
|
|
+ //执行废除
|
|
|
+ for (Task task : taskList) {
|
|
|
+ if (new Integer("1").equals(task.getStatus())) {
|
|
|
+ //正在审批,调用废除
|
|
|
+ this.taskClient.abolishTask(task);
|
|
|
+ } else if (new Integer("2").equals(task.getStatus()) || new Integer("3").equals(task.getStatus())) {
|
|
|
+ //已审批、已撤销的任务,修改业务数据的审批状态为未上报并撤签即可
|
|
|
+ LambdaUpdateWrapper<InformationQuery> wrapper = Wrappers.lambdaUpdate();
|
|
|
+ //更改状态为未上报
|
|
|
+ wrapper.set(InformationQuery::getStatus, 0);
|
|
|
+ //将电签的pdf路径置空
|
|
|
+ wrapper.set(InformationQuery::getEVisaPdfUrl, null);
|
|
|
+ //将上报批次置空
|
|
|
+ wrapper.set(InformationQuery::getReportNumber, null);
|
|
|
+ //置空审批人
|
|
|
+ wrapper.set(InformationQuery::getAuditUserIdAndName, null);
|
|
|
+
|
|
|
+ this.informationQueryService.update(wrapper.in(InformationQuery::getId, Arrays.asList(task.getFormDataId().split(","))));
|
|
|
+ }
|
|
|
|
|
|
- List<InformationQuery> queries = this.informationQueryService.getBaseMapper().selectBatchIds(Arrays.asList(task.getFormDataId().split(",")));
|
|
|
- String title = "批量废除";
|
|
|
- if (queries != null && queries.size() > 0) {
|
|
|
- title = queries.stream().map(InformationQuery::getName).distinct().collect(Collectors.joining());
|
|
|
+ List<InformationQuery> queries = this.informationQueryService.getBaseMapper().selectBatchIds(Arrays.asList(task.getFormDataId().split(",")));
|
|
|
+ String title = "批量废除";
|
|
|
+ if (queries != null && queries.size() > 0) {
|
|
|
+ title = queries.stream().map(InformationQuery::getName).distinct().collect(Collectors.joining());
|
|
|
|
|
|
- List<Long> projectIds = queries.stream().map(InformationQuery::getProjectId).distinct().collect(Collectors.toList());
|
|
|
- List<Long> contractIds = queries.stream().map(InformationQuery::getContractId).distinct().collect(Collectors.toList());
|
|
|
+ List<Long> projectIds = queries.stream().map(InformationQuery::getProjectId).distinct().collect(Collectors.toList());
|
|
|
+ List<Long> contractIds = queries.stream().map(InformationQuery::getContractId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
- List<ProjectInfo> projects = this.projectClient.queryProjectList(JSONArray.parseArray(JSONObject.toJSONString(projectIds), String.class));
|
|
|
- List<ContractInfo> contracts = this.contractClient.getContractByIds(contractIds);
|
|
|
+ List<ProjectInfo> projects = this.projectClient.queryProjectList(JSONArray.parseArray(JSONObject.toJSONString(projectIds), String.class));
|
|
|
+ List<ContractInfo> contracts = this.contractClient.getContractByIds(contractIds);
|
|
|
|
|
|
- Map<String, ProjectInfo> projectMap = new HashMap<>();
|
|
|
- Map<String, ContractInfo> contractMap = new HashMap<>();
|
|
|
- projects.forEach(project -> projectMap.put(project.getId().toString(), project));
|
|
|
- contracts.forEach(contract -> contractMap.put(contract.getId().toString(), contract));
|
|
|
+ Map<String, ProjectInfo> projectMap = new HashMap<>();
|
|
|
+ Map<String, ContractInfo> contractMap = new HashMap<>();
|
|
|
+ projects.forEach(project -> projectMap.put(project.getId().toString(), project));
|
|
|
+ contracts.forEach(contract -> contractMap.put(contract.getId().toString(), contract));
|
|
|
|
|
|
- //获取当前任务的环节审批人
|
|
|
- List<TaskParallel> linkList = this.taskClient.queryApprovalUserByTaskId(task.getProcessInstanceId());
|
|
|
+ //获取当前任务的环节审批人
|
|
|
+ List<TaskParallel> linkList = this.taskClient.queryApprovalUserByTaskId(task.getProcessInstanceId());
|
|
|
|
|
|
- /*修改任务副表u_task_parallel全部废除*/
|
|
|
- List<Long> collect = linkList.stream().map(TaskParallel::getId).collect(Collectors.toList());
|
|
|
- if (collect.size() > 0) {
|
|
|
- jdbcTemplate.execute("UPDATE u_task_parallel SET status = 3,e_visa_content = '废除成功' WHERE id in(" + StringUtils.join(collect, ",") + ")");
|
|
|
- }
|
|
|
+ /*修改任务副表u_task_parallel全部废除*/
|
|
|
+ List<Long> collect = linkList.stream().map(TaskParallel::getId).collect(Collectors.toList());
|
|
|
+ if (collect.size() > 0) {
|
|
|
+ context = "撤回成功".equals(context) ? context : "废除成功";
|
|
|
+ jdbcTemplate.execute("UPDATE u_task_parallel SET status = 3,e_visa_content = '" + context + "' WHERE id in(" + StringUtils.join(collect, ",") + ")");
|
|
|
+ }
|
|
|
|
|
|
- for (InformationQuery query : queries) {
|
|
|
- if (StringUtils.isNotEmpty(query.getFileUserIdAndName())) {
|
|
|
- String[] userArray = query.getFileUserIdAndName().split(",");
|
|
|
- for (String str : userArray) {
|
|
|
- String[] strs = str.split("-");
|
|
|
- try {
|
|
|
- String projectName = "", contractName = "";
|
|
|
- if (projectMap.containsKey(query.getProjectId().toString())) {
|
|
|
- ProjectInfo project = projectMap.get(query.getProjectId().toString());
|
|
|
- projectName = StringUtils.isNotEmpty(project.getProjectAlias()) ? project.getProjectAlias() : project.getProjectName();
|
|
|
- }
|
|
|
- if (contractMap.containsKey(query.getContractId().toString())) {
|
|
|
- ContractInfo contract = contractMap.get(query.getContractId().toString());
|
|
|
- contractName = contract.getContractName();
|
|
|
- }
|
|
|
+ for (InformationQuery query : queries) {
|
|
|
+ if (StringUtils.isNotEmpty(query.getFileUserIdAndName())) {
|
|
|
+ String[] userArray = query.getFileUserIdAndName().split(",");
|
|
|
+ for (String str : userArray) {
|
|
|
+ String[] strs = str.split("-");
|
|
|
+ try {
|
|
|
+ String projectName = "", contractName = "";
|
|
|
+ if (projectMap.containsKey(query.getProjectId().toString())) {
|
|
|
+ ProjectInfo project = projectMap.get(query.getProjectId().toString());
|
|
|
+ projectName = StringUtils.isNotEmpty(project.getProjectAlias()) ? project.getProjectAlias() : project.getProjectName();
|
|
|
+ }
|
|
|
+ if (contractMap.containsKey(query.getContractId().toString())) {
|
|
|
+ ContractInfo contract = contractMap.get(query.getContractId().toString());
|
|
|
+ contractName = contract.getContractName();
|
|
|
+ }
|
|
|
|
|
|
- //保存通知记录
|
|
|
- this.messageWarningClient.savePushUserMessageWarning(
|
|
|
- new MessageWarningVO(
|
|
|
- query.getProjectId(),
|
|
|
- query.getContractId(),
|
|
|
- //废除通知
|
|
|
- 3,
|
|
|
- //内容
|
|
|
- projectName + contractName + "的用户【" + AuthUtil.getNickName() + "】废除了【" + query.getName() + "】",
|
|
|
- //推送的目标人
|
|
|
- Long.parseLong(strs[0]),
|
|
|
- //默认未读
|
|
|
- 0
|
|
|
- ));
|
|
|
-
|
|
|
- if (ObjectUtil.isNotEmpty(query.getProjectId()) && ObjectUtil.isNotEmpty(query.getContractId()) && ObjectUtil.isNotEmpty(strs[0])) {
|
|
|
- String param = strs[0] + "," + query.getProjectId() + "," + query.getContractId();
|
|
|
- aopParamsSet.add(param);
|
|
|
- }
|
|
|
+ //保存通知记录
|
|
|
+ this.messageWarningClient.savePushUserMessageWarning(
|
|
|
+ new MessageWarningVO(
|
|
|
+ query.getProjectId(),
|
|
|
+ query.getContractId(),
|
|
|
+ //废除通知
|
|
|
+ 3,
|
|
|
+ //内容
|
|
|
+ projectName + contractName + "的用户【" + AuthUtil.getNickName() + "】废除了【" + query.getName() + "】",
|
|
|
+ //推送的目标人
|
|
|
+ Long.parseLong(strs[0]),
|
|
|
+ //默认未读
|
|
|
+ 0
|
|
|
+ ));
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(query.getProjectId()) && ObjectUtil.isNotEmpty(query.getContractId()) && ObjectUtil.isNotEmpty(strs[0])) {
|
|
|
+ String param = strs[0] + "," + query.getProjectId() + "," + query.getContractId();
|
|
|
+ aopParamsSet.add(param);
|
|
|
+ }
|
|
|
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (linkList.size() > 0) {
|
|
|
- ProjectInfo projectInfo = this.projectClient.queryProjectList(Func.toStrList(task.getProjectId())).get(0);
|
|
|
- ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(task.getContractId()));
|
|
|
-
|
|
|
- List<MessageWarningVO> messageList = new ArrayList<>();
|
|
|
- for (TaskParallel taskParallel : linkList) {
|
|
|
- messageList.add(new MessageWarningVO(
|
|
|
- Long.parseLong(task.getProjectId()),
|
|
|
- Long.parseLong(task.getContractId()),
|
|
|
- //废除通知
|
|
|
- 3,
|
|
|
- //内容
|
|
|
- (StringUtils.isNotEmpty(projectInfo.getProjectAlias()) ? projectInfo.getProjectAlias() : projectInfo.getProjectName()) + contractInfo.getContractName() + "的用户" + AuthUtil.getNickName() + "废除了【" + query.getName() + "】流程,请及时查看",
|
|
|
- //推送的目标人
|
|
|
- Long.parseLong(taskParallel.getTaskUser()),
|
|
|
- //默认未读
|
|
|
- 0
|
|
|
- ));
|
|
|
- }
|
|
|
- if (messageList.size() > 0) {
|
|
|
- this.messageWarningClient.savePushUserMessageWarning(messageList);
|
|
|
+ if (linkList.size() > 0) {
|
|
|
+ ProjectInfo projectInfo = this.projectClient.queryProjectList(Func.toStrList(task.getProjectId())).get(0);
|
|
|
+ ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(task.getContractId()));
|
|
|
+
|
|
|
+ List<MessageWarningVO> messageList = new ArrayList<>();
|
|
|
+ for (TaskParallel taskParallel : linkList) {
|
|
|
+ messageList.add(new MessageWarningVO(
|
|
|
+ Long.parseLong(task.getProjectId()),
|
|
|
+ Long.parseLong(task.getContractId()),
|
|
|
+ //废除通知
|
|
|
+ 3,
|
|
|
+ //内容
|
|
|
+ (StringUtils.isNotEmpty(projectInfo.getProjectAlias()) ? projectInfo.getProjectAlias() : projectInfo.getProjectName()) + contractInfo.getContractName() + "的用户" + AuthUtil.getNickName() + "废除了【" + query.getName() + "】流程,请及时查看",
|
|
|
+ //推送的目标人
|
|
|
+ Long.parseLong(taskParallel.getTaskUser()),
|
|
|
+ //默认未读
|
|
|
+ 0
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ if (messageList.size() > 0) {
|
|
|
+ this.messageWarningClient.savePushUserMessageWarning(messageList);
|
|
|
|
|
|
- for (MessageWarning messageWarning : messageList) {
|
|
|
- if (ObjectUtil.isNotEmpty(messageWarning.getProjectId()) && ObjectUtil.isNotEmpty(messageWarning.getContractId()) && ObjectUtil.isNotEmpty(messageWarning.getPushUser())) {
|
|
|
- String param = messageWarning.getPushUser() + "," + messageWarning.getProjectId() + "," + messageWarning.getContractId();
|
|
|
- aopParamsSet.add(param);
|
|
|
+ for (MessageWarning messageWarning : messageList) {
|
|
|
+ if (ObjectUtil.isNotEmpty(messageWarning.getProjectId()) && ObjectUtil.isNotEmpty(messageWarning.getContractId()) && ObjectUtil.isNotEmpty(messageWarning.getPushUser())) {
|
|
|
+ String param = messageWarning.getPushUser() + "," + messageWarning.getProjectId() + "," + messageWarning.getContractId();
|
|
|
+ aopParamsSet.add(param);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ iTaskService.delArchiveFileBusinessData(query.getProjectId(), query.getWbsId());
|
|
|
}
|
|
|
|
|
|
- iTaskService.delArchiveFileBusinessData(query.getProjectId(), query.getWbsId());
|
|
|
+ //更新Redis缓存
|
|
|
+ for (Long contractId1 : contractIds) {
|
|
|
+ informationQueryService.delAsyncWbsTree(contractId1 + "");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- //更新Redis缓存
|
|
|
- for (Long contractId1 : contractIds) {
|
|
|
- informationQueryService.delAsyncWbsTree(contractId1 + "");
|
|
|
+ try {
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("operationObjIds", Func.toStrList(task.getFormDataId()));
|
|
|
+ json.put("operationObjName", title);
|
|
|
+ json.put("projectId", projectId);
|
|
|
+ json.put("contractId", contractId);
|
|
|
+ if ("废除成功".equals(context)) {
|
|
|
+ //保存操作记录
|
|
|
+ this.operationLogClient.saveUserOperationLog(6, "填报资料", "工序资料", json);
|
|
|
+ } else {
|
|
|
+ //保存操作记录
|
|
|
+ this.operationLogClient.saveUserOperationLog(62, "资料撤回废除", "工序资料", json);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- try {
|
|
|
- JSONObject json = new JSONObject();
|
|
|
- json.put("operationObjIds", Func.toStrList(task.getFormDataId()));
|
|
|
- json.put("operationObjName", title);
|
|
|
- json.put("projectId", projectId);
|
|
|
- json.put("contractId", contractId);
|
|
|
-
|
|
|
- //保存操作记录
|
|
|
- this.operationLogClient.saveUserOperationLog(6, "资料填报", "工序资料", json);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ /*修改主表u_task(全部废除)*/
|
|
|
+ List<Long> collect = taskList.stream().map(Task::getId).collect(Collectors.toList());
|
|
|
+ if (collect.size() > 0) {
|
|
|
+ jdbcTemplate.execute("UPDATE u_task SET status = 3 WHERE id in(" + StringUtils.join(collect, ",") + ")");
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- /*修改主表u_task(全部废除)*/
|
|
|
- List<Long> collect = taskList.stream().map(Task::getId).collect(Collectors.toList());
|
|
|
- if (collect.size() > 0) {
|
|
|
- jdbcTemplate.execute("UPDATE u_task SET status = 3 WHERE id in(" + StringUtils.join(collect, ",") + ")");
|
|
|
- }
|
|
|
|
|
|
- //修改试验任务状态为未上报
|
|
|
+ //修改试验任务状态为未上报
|
|
|
|
|
|
- //批量废除直接调的该接口,primaryKeyId为null,ids=当前试验记录的ids
|
|
|
- String sql = "";
|
|
|
- String sql1 = "";
|
|
|
- if (primaryKeyId!=null&&primaryKeyId.indexOf("*") > 0) {
|
|
|
- primaryKeyId = primaryKeyId.substring(0, primaryKeyId.length() - 1);
|
|
|
- sql = "update u_trial_self_inspection_record set task_status = '未上报' where id=" + primaryKeyId;
|
|
|
- sql1 = "SELECT e.* from u_entrust_info e left join u_trial_self_inspection_record t on t.entrust_id=e.id where t.id=" + primaryKeyId;
|
|
|
- } else {
|
|
|
- sql = "update u_trial_self_inspection_record set task_status = '未上报' where id in(" + ids + ")";
|
|
|
- sql1 = "SELECT e.* from u_entrust_info e left join u_trial_self_inspection_record t on t.entrust_id=e.id where t.id in(" + ids + ")";
|
|
|
- }
|
|
|
- jdbcTemplate.execute(sql);
|
|
|
- List<EntrustInfo> query = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(EntrustInfo.class));
|
|
|
- if (!query.isEmpty()) {
|
|
|
- String[] idss = query.stream()
|
|
|
- .map(item -> String.valueOf(item.getId()))
|
|
|
- .toArray(String[]::new);
|
|
|
- String update = "update u_entrust_info set status=3 where id in(" + String.join(",", idss) + ")";
|
|
|
- jdbcTemplate.execute(update);
|
|
|
+ //批量废除直接调的该接口,primaryKeyId为null,ids=当前试验记录的ids
|
|
|
+ String sql = "";
|
|
|
+ String sql1 = "";
|
|
|
+ if (primaryKeyId != null && primaryKeyId.indexOf("*") > 0) {
|
|
|
+ primaryKeyId = primaryKeyId.substring(0, primaryKeyId.length() - 1);
|
|
|
+ sql = "update u_trial_self_inspection_record set task_status = '未上报' where id=" + primaryKeyId;
|
|
|
+ sql1 = "SELECT e.* from u_entrust_info e left join u_trial_self_inspection_record t on t.entrust_id=e.id where t.id=" + primaryKeyId;
|
|
|
+ } else {
|
|
|
+ sql = "update u_trial_self_inspection_record set task_status = '未上报' where id in(" + ids + ")";
|
|
|
+ sql1 = "SELECT e.* from u_entrust_info e left join u_trial_self_inspection_record t on t.entrust_id=e.id where t.id in(" + ids + ")";
|
|
|
+ }
|
|
|
+ jdbcTemplate.execute(sql);
|
|
|
+ List<EntrustInfo> query = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(EntrustInfo.class));
|
|
|
+ if (!query.isEmpty()) {
|
|
|
+ String[] idss = query.stream()
|
|
|
+ .map(item -> String.valueOf(item.getId()))
|
|
|
+ .toArray(String[]::new);
|
|
|
+ String update = "update u_entrust_info set status=3 where id in(" + String.join(",", idss) + ")";
|
|
|
+ jdbcTemplate.execute(update);
|
|
|
+ }
|
|
|
+ return R.success("操作成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return R.data(300, false, "废除失败");
|
|
|
}
|
|
|
- return R.success("操作成功");
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return R.data(300, false, "废除失败");
|
|
|
}
|
|
|
+ return R.data(300, false, "未获取到任务信息,废除失败");
|
|
|
}
|
|
|
- return R.data(300, false, "未获取到任务信息,废除失败");
|
|
|
-}
|
|
|
|
|
|
/**
|
|
|
* 批量上报
|