From 3c576812cb2c8b7cb1781c06a0f65786dd583fef Mon Sep 17 00:00:00 2001 From: wanggeng <450292408@qq.com> Date: Fri, 23 Jul 2021 21:24:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=88=A0=E9=99=A4=E6=97=B6=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=BE=85=E5=8A=9E=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runnable/DeleteServiceRunnable.java | 60 +++++++++++++++++++ .../runnable/check2/Check2MsgRequest.java | 2 +- .../DischargePermitNoticeRequest.java | 2 +- .../eiareport/EiaReportNoticeRequest.java | 2 +- .../taskcheck/v1/TaskCheckNoticeRequest.java | 2 +- .../taskcheck/v2/TaskCheckNoticeRequest.java | 2 +- .../impl/PublicAreaReportServiceImpl.java | 8 +-- .../v1/impl/TaskCheckServiceImpl.java | 14 +++++ .../v2/impl/TaskCheckServiceImpl.java | 15 +++++ .../taskcheck/v1/taskcheck-v1-mapper.xml | 14 +++++ 10 files changed, 112 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/cm/inspection/runnable/DeleteServiceRunnable.java diff --git a/src/main/java/com/cm/inspection/runnable/DeleteServiceRunnable.java b/src/main/java/com/cm/inspection/runnable/DeleteServiceRunnable.java new file mode 100644 index 0000000..9481a43 --- /dev/null +++ b/src/main/java/com/cm/inspection/runnable/DeleteServiceRunnable.java @@ -0,0 +1,60 @@ +package com.cm.inspection.runnable; + +import com.alibaba.fastjson.JSONObject; +import com.cm.common.plugin.oauth.token.ClientTokenManager; +import com.cm.common.utils.http.AbstractRestTemplate; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.client.HttpClientErrorException; + +import java.util.Set; + +/** + * @ClassName: Check2DeleteServiceRunnable + * @Description: 删除业务 + * @Author: wanggeng + * @Date: 2021/7/23 2:36 下午 + * @Version: 1.0 + */ +@Slf4j +public class DeleteServiceRunnable extends AbstractRestTemplate implements Runnable { + + private String noticeUrl; + private Set serviceIds; + + public DeleteServiceRunnable(String noticeUrl, Set serviceIds) { + this.noticeUrl = noticeUrl; + this.serviceIds = serviceIds; + } + + @Override + public void run() { + this.postJson(getNoticeUrl()); + } + + public String getNoticeUrl() { + return String.format("%s/resource/message/delete?access_token=%s", noticeUrl, ClientTokenManager.getInstance().getClientToken().getAccessToken()); + } + + @Override + public JSONObject body() { + JSONObject bodyJSONObject = new JSONObject(); + bodyJSONObject.put("serviceIds", serviceIds); + return bodyJSONObject; + } + + @Override + public Class successResultType() { + return String.class; + } + + @Override + public void success200(String result) { + log.debug("请求成功,result: {}", result); + } + + @Override + public void error400(HttpClientErrorException error) { + log.error(error.getMessage(), error); + } + +} diff --git a/src/main/java/com/cm/inspection/runnable/check2/Check2MsgRequest.java b/src/main/java/com/cm/inspection/runnable/check2/Check2MsgRequest.java index e3a64f8..e2542e7 100644 --- a/src/main/java/com/cm/inspection/runnable/check2/Check2MsgRequest.java +++ b/src/main/java/com/cm/inspection/runnable/check2/Check2MsgRequest.java @@ -29,7 +29,7 @@ public class Check2MsgRequest extends AbstractRestTemplate { private String checkId; @Override - public JSONObject postBody() { + public JSONObject body() { JSONObject noticeJSONObject = new JSONObject(); JSONArray noticeJSONArray = new JSONArray(); JSONObject notice = new JSONObject(); diff --git a/src/main/java/com/cm/inspection/runnable/dischargepermit/DischargePermitNoticeRequest.java b/src/main/java/com/cm/inspection/runnable/dischargepermit/DischargePermitNoticeRequest.java index 472b1b1..0968c8c 100644 --- a/src/main/java/com/cm/inspection/runnable/dischargepermit/DischargePermitNoticeRequest.java +++ b/src/main/java/com/cm/inspection/runnable/dischargepermit/DischargePermitNoticeRequest.java @@ -34,7 +34,7 @@ public class DischargePermitNoticeRequest extends AbstractRestTemplate { diff --git a/src/main/java/com/cm/inspection/runnable/eiareport/EiaReportNoticeRequest.java b/src/main/java/com/cm/inspection/runnable/eiareport/EiaReportNoticeRequest.java index b5197c2..0182771 100644 --- a/src/main/java/com/cm/inspection/runnable/eiareport/EiaReportNoticeRequest.java +++ b/src/main/java/com/cm/inspection/runnable/eiareport/EiaReportNoticeRequest.java @@ -34,7 +34,7 @@ public class EiaReportNoticeRequest extends AbstractRestTemplate { diff --git a/src/main/java/com/cm/inspection/runnable/taskcheck/v1/TaskCheckNoticeRequest.java b/src/main/java/com/cm/inspection/runnable/taskcheck/v1/TaskCheckNoticeRequest.java index 3f61f49..25a53b8 100644 --- a/src/main/java/com/cm/inspection/runnable/taskcheck/v1/TaskCheckNoticeRequest.java +++ b/src/main/java/com/cm/inspection/runnable/taskcheck/v1/TaskCheckNoticeRequest.java @@ -36,7 +36,7 @@ public class TaskCheckNoticeRequest extends AbstractRestTemplate { diff --git a/src/main/java/com/cm/inspection/runnable/taskcheck/v2/TaskCheckNoticeRequest.java b/src/main/java/com/cm/inspection/runnable/taskcheck/v2/TaskCheckNoticeRequest.java index ae886df..eb19557 100644 --- a/src/main/java/com/cm/inspection/runnable/taskcheck/v2/TaskCheckNoticeRequest.java +++ b/src/main/java/com/cm/inspection/runnable/taskcheck/v2/TaskCheckNoticeRequest.java @@ -36,7 +36,7 @@ public class TaskCheckNoticeRequest extends AbstractRestTemplate { diff --git a/src/main/java/com/cm/inspection/service/publicareareport/impl/PublicAreaReportServiceImpl.java b/src/main/java/com/cm/inspection/service/publicareareport/impl/PublicAreaReportServiceImpl.java index 3dfd812..af25720 100644 --- a/src/main/java/com/cm/inspection/service/publicareareport/impl/PublicAreaReportServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/publicareareport/impl/PublicAreaReportServiceImpl.java @@ -97,13 +97,13 @@ public class PublicAreaReportServiceImpl extends BaseService implements IPublicA if (StringUtils.isBlank(leaderUserId)) { throw new SaveException("无上级领导,上报失败"); } - String[] leaderUserIdArray = leaderUserId.split("\\|"); + String leaderUserName = gridPersonnelDTO.getLeaderUserName(); PublicLeaderHandleVO publicLeaderHandleVO = new PublicLeaderHandleVO(); publicLeaderHandleVO.setPublicAreaReportId(publicAreaReportId); - publicLeaderHandleVO.setHandleUserId(leaderUserIdArray[0]); - publicLeaderHandleVO.setHandleUserName(leaderUserIdArray[2]); + publicLeaderHandleVO.setHandleUserId(leaderUserId); + publicLeaderHandleVO.setHandleUserName(leaderUserName); String publicLeaderHandleId = publicLeaderHandleService.savePublicLeaderHandleByTokenReturnId(token, publicLeaderHandleVO); - publicLogService.savePublicLogSimple(token, publicAreaReportId, publicLeaderHandleId, "等待领导处理", leaderUserIdArray[2]); + publicLogService.savePublicLogSimple(token, publicAreaReportId, publicLeaderHandleId, "等待领导处理", leaderUserName); } } diff --git a/src/main/java/com/cm/inspection/service/taskcheck/v1/impl/TaskCheckServiceImpl.java b/src/main/java/com/cm/inspection/service/taskcheck/v1/impl/TaskCheckServiceImpl.java index b0949c7..b92e78a 100644 --- a/src/main/java/com/cm/inspection/service/taskcheck/v1/impl/TaskCheckServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/taskcheck/v1/impl/TaskCheckServiceImpl.java @@ -26,6 +26,7 @@ import com.cm.inspection.pojo.dtos.taskcheck.v1.TaskCheckReportDTO; import com.cm.inspection.pojo.vos.taskcheck.v1.TaskCheckReportVO; import com.cm.inspection.pojo.vos.taskcheck.v1.TaskCheckVO; import com.cm.inspection.runnable.RunnableExecutor; +import com.cm.inspection.runnable.DeleteServiceRunnable; import com.cm.inspection.runnable.taskcheck.v1.TaskCheckSaveRunnable; import com.cm.inspection.service.BaseService; import com.cm.inspection.service.enterprise.checkitemoption.v1.ICheckItemOptionService; @@ -111,6 +112,12 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi public SuccessResult delete(String ids) throws RemoveException { Map params = getHashMap(3); params.put("taskIds", Arrays.asList(ids.split("_"))); + + // 查询任务关联企业 + List taskCheckEnterpriseDTOs = taskCheckDao.listTaskEnterprise(params); + if (taskCheckEnterpriseDTOs.isEmpty()) { + return new SuccessResult(); + } setUpdateInfo(params); // 删除任务 taskCheckDao.deleteTask(params); @@ -118,6 +125,13 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi taskCheckDao.deleteTaskEnterprise(params); // 删除任务企业检查项 taskCheckDao.deleteTaskEnterpriseCheckItem(params); + + // 更新消息 + Set taskEnterpriseIdSet = new HashSet<>(); + taskCheckEnterpriseDTOs.forEach(taskCheckEnterprise -> { + taskEnterpriseIdSet.add(taskCheckEnterprise.getTaskId() + ":" + taskCheckEnterprise.getEnterpriseId()); + }); + RunnableExecutor.execute(new DeleteServiceRunnable(noticeUrl, taskEnterpriseIdSet)); return new SuccessResult(); } diff --git a/src/main/java/com/cm/inspection/service/taskcheck/v2/impl/TaskCheckServiceImpl.java b/src/main/java/com/cm/inspection/service/taskcheck/v2/impl/TaskCheckServiceImpl.java index 5dee7c0..50e7477 100644 --- a/src/main/java/com/cm/inspection/service/taskcheck/v2/impl/TaskCheckServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/taskcheck/v2/impl/TaskCheckServiceImpl.java @@ -25,6 +25,7 @@ import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckReportCheckItemDTO; import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckReportDTO; import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckReportVO; import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckVO; +import com.cm.inspection.runnable.DeleteServiceRunnable; import com.cm.inspection.runnable.RunnableExecutor; import com.cm.inspection.runnable.taskcheck.v2.TaskCheckSaveRunnable; import com.cm.inspection.service.BaseService; @@ -111,6 +112,13 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi public SuccessResult delete(String ids) throws RemoveException { Map params = getHashMap(3); params.put("taskIds", Arrays.asList(ids.split("_"))); + + // 查询任务关联企业 + List taskCheckEnterpriseDTOs = taskCheckDao.listTaskEnterprise(params); + if (taskCheckEnterpriseDTOs.isEmpty()) { + return new SuccessResult(); + } + setUpdateInfo(params); // 删除任务 taskCheckDao.deleteTask(params); @@ -118,6 +126,13 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi taskCheckDao.deleteTaskEnterprise(params); // 删除任务企业检查项 taskCheckDao.deleteTaskEnterpriseCheckItem(params); + + // 更新消息 + Set taskEnterpriseIdSet = new HashSet<>(); + taskCheckEnterpriseDTOs.forEach(taskCheckEnterprise -> { + taskEnterpriseIdSet.add(taskCheckEnterprise.getTaskId() + ":" + taskCheckEnterprise.getEnterpriseId()); + }); + RunnableExecutor.execute(new DeleteServiceRunnable(noticeUrl, taskEnterpriseIdSet)); return new SuccessResult(); } diff --git a/src/main/resources/mybatis/mapper/taskcheck/v1/taskcheck-v1-mapper.xml b/src/main/resources/mybatis/mapper/taskcheck/v1/taskcheck-v1-mapper.xml index 8200d0e..b18effc 100644 --- a/src/main/resources/mybatis/mapper/taskcheck/v1/taskcheck-v1-mapper.xml +++ b/src/main/resources/mybatis/mapper/taskcheck/v1/taskcheck-v1-mapper.xml @@ -176,6 +176,13 @@ gen_task_v1 t1 WHERE t1.is_delete = 0 + + AND + t1.task_id IN + + #{taskIds[${index}]} + + AND t1.task_id IN ( @@ -370,6 +377,13 @@ AND t1.task_id = #{taskId} + + AND + t1.task_id IN + + #{taskIds[${index}]} + + AND t1.is_completed = #{isCompleted}