From 37199ffff42307c32945015f52002203992c03ed Mon Sep 17 00:00:00 2001 From: Chujinwang <17638147107@163.com> Date: Thu, 18 Jul 2024 16:45:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E6=92=A4=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../work/controller/WrkInfoController.java | 14 +++++++++++++ .../work/service/WrkInfoService.java | 2 ++ .../work/service/impl/WrkInfoServiceImpl.java | 20 ++++++++++++++++++- .../main/resources/mapper/TerminalMapper.xml | 19 ++++++++++++++++-- 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java index 55dfb09..ab111c3 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java @@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil; import com.chushang.common.core.web.AjaxResult; import com.chushang.common.log.annotation.SysLog; import com.chushang.common.log.enums.BusinessType; +import com.chushang.inspection.project.dto.Delete; import com.chushang.inspection.utils.TaskConfigUtils; import com.chushang.inspection.work.dto.WrkInfoDTO; import com.chushang.inspection.work.query.DispatchQuery; @@ -234,4 +235,17 @@ public class WrkInfoController { return AjaxResult.success(); } + + /** + * 撤回 + */ + @PostMapping("/withdraw") + @RequiresPermissions("wrk:withdraw") + @SysLog(value = "工单撤回", businessType = BusinessType.DELETE) + public AjaxResult withdraw(@RequestBody @Validated Delete delete) { + wrkInfoService.withdraw(delete.getIds()); + return AjaxResult.success(); + } + + } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java index 27adaa6..2212357 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java @@ -34,5 +34,7 @@ public interface WrkInfoService extends IService { void submit(WrkInfoDTO info); + void withdraw(List ids); + void audit(AuditDTO audit); } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java index 0c2d6e0..f9cb472 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java @@ -8,6 +8,7 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.spring.SpringUtil; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; @@ -28,6 +29,7 @@ import com.chushang.common.mybatis.utils.PageResult; import com.chushang.common.mybatis.utils.WrapperUtils; import com.chushang.inspection.ins.GeneratedInsFactory; import com.chushang.inspection.project.dto.AuditDTO; +import com.chushang.inspection.project.po.InspectionData; import com.chushang.inspection.project.service.InspectionDataService; import com.chushang.inspection.terminal.po.FiveStore; import com.chushang.inspection.terminal.po.Store; @@ -341,6 +343,22 @@ public class WrkInfoServiceImpl extends ServiceImpl impl } } + @Override + @Transactional(rollbackFor = Exception.class) + public void withdraw(List ids) { + List status = ListUtil.toList(1, 2, 5, 6, 7); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(WrkInfo::getWrkId, ids); + queryWrapper.in(WrkInfo::getWrkStatus, status); + List list = list(queryWrapper); + Assert.notEmpty(list, "请确认此工单是否存在或已经审核成功了"); + List wrkIds = list.stream().map(WrkInfo::getWrkId).collect(Collectors.toList()); + removeBatchByIds(wrkIds); + wrkImgService.remove(new LambdaQueryWrapper().in(WrkImg::getWrkId, wrkIds)); + inspectionDataService.remove(new LambdaQueryWrapper().in(InspectionData::getInsId, wrkIds)); + // todo 终端占用状态和江西内蒙古 + } + /** * 工单审核 * @@ -561,7 +579,7 @@ public class WrkInfoServiceImpl extends ServiceImpl impl if (result.isSuccess()) { Map userIds = result.getData(); for (DispatchDTO dispatchDTO : dispatch) { - Long userId = 1L;// 先固定 userIds.get(dispatchDTO.getAccountManager()); + Long userId = userIds.get(dispatchDTO.getAccountManager()); Assert.notNull(userId, "【{}】未设置商户", dispatchDTO.getAccountManager()); // 组装wrkinfo实体 WrkInfo wrkInfo = makeWrkInfoEntity(dispatchDTO, query, userId, dispatchDTO.getAccountManager(), 0); diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml index 7c811cc..e238851 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml @@ -210,10 +210,25 @@ from st_terminal t1 left join st_store t2 on t1.store_id = t2.store_id left join st_terminal_ins t3 on t3.terminal_id = t1.terminal_id - where t1.del_state = 0 + + t1.del_state = 0 AND t1.task_id = #{query.taskId} - ORDER BY t1.create_time DESC limit 10 + + + AND t1.terminal_no in + + #{no} + + + + + AND t1.terminal_id in + + #{id} + + +