From ceac1b1e0c81545cf964b1c9741a2e1852e708d7 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Thu, 31 Oct 2024 19:23:16 +0800 Subject: [PATCH 01/51] 1 --- .../module/inspection/mapper/InspectionWorkNodeMapper.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java index 5209740e..088f2325 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.mapper; import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; /** *

@@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @author dianliang * @since 2024-10-31 */ +@Mapper public interface InspectionWorkNodeMapper extends BaseMapper { } From fcf2f050997372f62b12f7e9f3421ec4a3620323 Mon Sep 17 00:00:00 2001 From: 13405411873 <1994398261@qq.com> Date: Fri, 1 Nov 2024 13:43:04 +0800 Subject: [PATCH 02/51] =?UTF-8?q?Revert=20"try=20catch=20=E5=A4=84?= =?UTF-8?q?=E7=90=86"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e7bd033a7804fee7785a2bf40641c3923ed851ac. --- .../inspection/service/impl/InspectionInfoServiceImpl.java | 1 + .../partner/service/impl/PartnerCustomerInfoServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java index 604c05f0..f22ffd08 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java @@ -214,6 +214,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl Date: Fri, 1 Nov 2024 14:22:57 +0800 Subject: [PATCH 03/51] =?UTF-8?q?try=20catch=20=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/InspectionInfoController.java | 9 +- .../service/IInspectionInfoService.java | 5 - .../impl/InspectionInfoServiceImpl.java | 193 ++++++------------ .../impl/PartnerCustomerInfoServiceImpl.java | 1 - 4 files changed, 59 insertions(+), 149 deletions(-) diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java index 735d8c3c..5b7aee92 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java @@ -97,12 +97,5 @@ public class InspectionInfoController extends BaseController return toAjax(inspectionInfoService.deleteInspectionInfoByIds(id)); } - /** - * 根据当前登陆人获取可以选择的工单 - * @return - */ - @GetMapping("geStelectInspection") - public CommonResult geStelectInspection(){ - return success(inspectionInfoService.geStelectInspection()); - } + } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java index 5fc966d1..2f219ee3 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java @@ -75,9 +75,4 @@ public interface IInspectionInfoService extends IService Map workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime); - /** - * 根据当前登陆人获取可以选择的工单 - * @return - */ - List geStelectInspection(); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java index f22ffd08..b03566c8 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java @@ -2,13 +2,9 @@ package cn.iocoder.yudao.module.inspection.service.impl; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; - -import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.security.core.LoginUser; @@ -21,9 +17,7 @@ import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService; import cn.iocoder.yudao.module.payment.service.IOrderInfoDetailService; import cn.iocoder.yudao.module.payment.service.OrderInfoService; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; -import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; -import cn.iocoder.yudao.module.system.service.permission.RoleService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.util.SendSmsUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -55,7 +49,8 @@ import javax.annotation.Resource; * @date 2023-08-13 */ @Service -public class InspectionInfoServiceImpl extends ServiceImpl implements IInspectionInfoService { +public class InspectionInfoServiceImpl extends ServiceImpl implements IInspectionInfoService +{ @Autowired private AdminUserService userService; @Autowired @@ -77,15 +72,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl selectInspectionInfoList(Page page, InspectionInfo inspectionInfo) { - return baseMapper.selectInspectionInfoList(page, inspectionInfo); + public IPage selectInspectionInfoList(Page page, InspectionInfo inspectionInfo) + { + return baseMapper.selectInspectionInfoList(page,inspectionInfo); } /** @@ -119,23 +109,19 @@ public class InspectionInfoServiceImpl extends ServiceImpl workerQueryWrapper =new LambdaQueryWrapper<>(); -// workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId()); -// PartnerWorker worker = workerService.getOne(workerQueryWrapper); -// if (ObjectUtils.isNotEmpty(worker)){ -// inspectionInfo.setWorkId(worker.getId()); -// }else { -// throw new Exception("请先将接待员加入员工"); -// } - if (ObjectUtils.isEmpty(inspectionInfo.getInspectionWorkNodes())) { - throw new RuntimeException("请选择检测项目"); + LambdaQueryWrapper workerQueryWrapper =new LambdaQueryWrapper<>(); + workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId()); + PartnerWorker worker = workerService.getOne(workerQueryWrapper); + if (ObjectUtils.isNotEmpty(worker)){ + inspectionInfo.setWorkId(worker.getId()); + }else { + throw new Exception("请先将接待员加入员工"); } - //当前登陆人 就是检测人 - AdminUserDO workerUser = userService.getUser(loginUser.getId()); - String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户"; - String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone()) ? inspectionInfo.getBuyPhone() : StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "无"; + AdminUserDO workerUser =userService.getUser(worker.getUserId()); + String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"未知客户"; + String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone())?inspectionInfo.getBuyPhone():StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"无"; AdminUserDO user = userService.getUserByMobile(buyPhone); - if (ObjectUtils.isEmpty(user)) { + if (ObjectUtils.isEmpty(user)){ //新增用户 UserSaveReqVO userSaveReqVO = new UserSaveReqVO(); userSaveReqVO.setNickname(buyName); @@ -149,13 +135,13 @@ public class InspectionInfoServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(PartnerCustomerInfo::getPartnerId, inspectionInfo.getPartnerId()).eq(PartnerCustomerInfo::getUserId, orderInfo.getUserId()); + LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); + queryWrapper.eq(PartnerCustomerInfo::getPartnerId,inspectionInfo.getPartnerId()).eq(PartnerCustomerInfo::getUserId,orderInfo.getUserId()); PartnerCustomerInfo customerInfo = customerInfoService.getOne(queryWrapper); - if (ObjectUtil.isEmpty(customerInfo)) { - customerInfo = new PartnerCustomerInfo(); + if (ObjectUtil.isEmpty(customerInfo)){ + customerInfo =new PartnerCustomerInfo(); customerInfo.setPartnerId(inspectionInfo.getPartnerId()); customerInfo.setUserId(user.getId()); customerInfo.setCustomerPhone(user.getMobile()); customerInfo.setCustomerName(user.getNickname()); customerInfo.setSex("0"); customerInfo.setUserAge(user.getUserAge()); - // 设置客户来源 CustomerMain customerMain = new CustomerMain(); customerMain.setDataFrom("01"); customerMainService.saveOrUpdate(customerMain); try { customerInfoService.insertPartnerCustomerInfo(customerInfo); - } catch (Exception ignored) { + }catch (Exception ignored){ } } //追加订单明细记录 - orderInfoDetailService.save(new OrderInfoDetail(orderInfo.getId(), "线下订单创建", new Date(), 0L, "1")); - //默认当前流程的顺序为1 - inspectionInfo.setNowOrderNum(1); - //添加检测工单 - baseMapper.insert(inspectionInfo); - //补充检测流程 - List inspectionWorkNodes = inspectionInfo.getInspectionWorkNodes(); - //将检测工单流程补充检测工单id - inspectionWorkNodes.stream().forEach(inspectionWorkNode -> inspectionWorkNode.setInspectionInfoId(inspectionInfo.getId())); - workNodeService.saveBatch(inspectionWorkNodes); - - //检测步骤表插入检测开始 - InspectionStepInfo stepInfo = new InspectionStepInfo(); - stepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(inspectionInfo.getId()))); - stepInfo.setTitle("检测开始"); - stepInfo.setContent("检测开始"); - boolean save = inspectionStepInfoService.save(stepInfo); - return save ? 1 : 0; + orderInfoDetailService.save(new OrderInfoDetail(orderInfo.getId(),"线下订单创建",new Date(),0L,"1")); + return baseMapper.insert(inspectionInfo); } @Override @@ -274,19 +243,19 @@ public class InspectionInfoServiceImpl extends ServiceImpl workerQueryWrapper = new LambdaQueryWrapper<>(); - workerQueryWrapper.eq(PartnerWorker::getUserId, loginUser.getId()).eq(PartnerWorker::getPartnerId, partners.getPartnerId()); + LambdaQueryWrapper workerQueryWrapper =new LambdaQueryWrapper<>(); + workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId()); PartnerWorker worker = workerService.getOne(workerQueryWrapper); - AdminUserDO workerUser = userService.getUser(worker.getUserId()); - if (ObjectUtils.isNotEmpty(worker)) { + AdminUserDO workerUser =userService.getUser(worker.getUserId()); + if (ObjectUtils.isNotEmpty(worker)){ inspectionInfo.setWorkId(worker.getId()); - } else { + }else { throw new Exception("请先将接待员加入员工"); } - String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户"; - String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone()) ? inspectionInfo.getBuyPhone() : StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "无"; + String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"未知客户"; + String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone())?inspectionInfo.getBuyPhone():StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"无"; AdminUserDO user = userService.getUserByMobile(buyPhone); - if (ObjectUtils.isEmpty(user)) { + if (ObjectUtils.isEmpty(user)){ //新增用户 UserSaveReqVO userSaveReqVO = new UserSaveReqVO(); userSaveReqVO.setNickname(buyName); @@ -295,7 +264,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) { - return baseMapper.workOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime); + public List workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime){ + return baseMapper.workOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime); } @Override public IPage pageWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page page) { - return baseMapper.pageWorkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime, page); + return baseMapper.pageWorkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime,page); } @Override - public List delworkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) { - return baseMapper.delworkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime); + public List delworkOrder(Long partnerId, String carNum, String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime){ + return baseMapper.delworkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime); } @Override public IPage pageDelWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page page) { - return baseMapper.pageDelWorkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime, page); + return baseMapper.pageDelWorkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime,page); } @Override public Map workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) { - return baseMapper.workOrderData(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime); - } - - /** - * 根据当前登陆人获取可以选择的工单 - * - * @return - */ - @Override - public List geStelectInspection() { - //获取当前登录人 - LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - //获取当前登陆人的角色 - List byUserId = roleService.getByUserId(loginUser.getId()); - List roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList()); - //查询所有工单为进行中的 - List inspectionInfos = baseMapper.selectList(new LambdaQueryWrapper() - .eq(InspectionInfo::getStatus, 0)); - //根据工单id查询工单流程节点 - List infoIds = inspectionInfos.stream().map(inspectionInfo -> inspectionInfo.getId()).collect(Collectors.toList()); - if (ObjectUtils.isNotEmpty(infoIds)) { - List inspectionWorkNodes = workNodeService.list(new LambdaQueryWrapper() - .in(InspectionWorkNode::getInspectionInfoId, infoIds) - .eq(InspectionWorkNode::getDealUserId, null)); - - //工单集合 - List inspectionInfoList = new ArrayList<>(); - - //根据工单id查询工单流程节点 - Map> inspectionWorkNodeMap = inspectionWorkNodes.stream().collect(Collectors.groupingBy(InspectionWorkNode::getInspectionInfoId)); - for (InspectionInfo inspectionInfo : inspectionInfos) { - List inspectionWorkNodeList = inspectionWorkNodeMap.get(inspectionInfo.getId()); - //遍历工单流程节点 流程为key - if (CollectionUtil.isNotEmpty(inspectionWorkNodeList)) { - Map inspectionWorkMap = inspectionWorkNodeList.stream().collect(Collectors.toMap(InspectionWorkNode::getOrderNum, item -> item)); - InspectionWorkNode inspectionWorkNode = inspectionWorkMap.get(inspectionInfo.getNowOrderNum()); - if (inspectionWorkNode != null){ - //判断当前项目 当前登录人员 是否可以处理 - if (roleIds.contains(inspectionWorkNode.getRoleId())){ - inspectionInfo.setWorkNodeId(inspectionWorkNode.getId()); - inspectionInfoList.add(inspectionInfo); - } - } - } - } - return inspectionInfoList; - } - return null; + return baseMapper.workOrderData(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime); } } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java index 11155c96..834a7a1b 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java @@ -126,7 +126,6 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl Date: Sat, 2 Nov 2024 16:41:02 +0800 Subject: [PATCH 04/51] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 6b4ec9c046a8f703306f5d87569c44d5b8e27563) --- .../service/impl/DlRepairTicketsServiceImpl.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 247cae51..baab5102 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -1178,10 +1178,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList()); - List twItems = twItemService.list(new LambdaQueryWrapper().and(item -> { - item.in(DlTwItem::getTwId, ids) - .apply("wares_already_count < wares_count"); - })); + List twItems = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(ids)){ + twItems = twItemService.list(new LambdaQueryWrapper().and(item -> { + item.in(DlTwItem::getTwId, ids) + .apply("wares_already_count < wares_count"); + })); + } if (CollectionUtil.isNotEmpty(twItems)) { // 更新工单子表(主要是把已领料的字段同步给工单配件的数量字段) // 查询工单子表(三个查询条件,属于那个工单,属于配件类型,属于需要改变的(即申请表的已领取数量小于申请数量的)) @@ -1192,10 +1195,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl finalTwItems = twItems; List AllItems = items.stream().map(item -> { DlRepairTitem titem = new DlRepairTitem(); titem.setId(item.getId()); - List wares = twItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList()); + List wares = finalTwItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList()); int sum = wares.stream().mapToInt(DlTwItem::getWaresAlreadyCount).sum(); titem.setItemCount(sum); BigDecimal discount = item.getItemDiscount() == null ? BigDecimal.ONE : item.getItemDiscount(); From b463144cacc4d398f59ed564a388c5df15e0060a Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Fri, 1 Nov 2024 20:21:58 +0800 Subject: [PATCH 05/51] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=92=8C=E5=88=A0=E9=99=A4=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 4a90687814372a45f55626625c2fe10857e6d08c) --- .../admin/DlRepairTicketsController.java | 14 ++++++++++++++ .../service/DlRepairTicketsService.java | 9 +++++++++ .../impl/DlRepairTicketsServiceImpl.java | 18 ++++++++++++++++++ .../src/main/resources/application-local.yaml | 2 ++ 4 files changed, 43 insertions(+) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java index 93cc3124..41fe1162 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java @@ -348,5 +348,19 @@ public class DlRepairTicketsController { dlRepairTicketsService.updateTicket(respVO); return CommonResult.ok(); } + + /** + * 删除工单 + * + * @author 小李 + * @date 20:05 2024/11/1 + * @param id 工单ID + **/ + @DeleteMapping("/remove") + @Operation(summary = "删除工单") + public CommonResult removeTicketById(@RequestParam("id") String id) { + dlRepairTicketsService.removeTicketById(id); + return CommonResult.ok(); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java index a29750f8..97151564 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java @@ -226,4 +226,13 @@ public interface DlRepairTicketsService extends IService { * @param respVO 请求对象 **/ void updateTicket(DlRepairTicketsRespVO respVO); + + /** + * 删除工单 + * + * @author 小李 + * @date 20:05 2024/11/1 + * @param id 工单ID + **/ + void removeTicketById(String id); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index baab5102..50c32faa 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -1532,6 +1532,24 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(RepairOrderInfo::getGoodsId, id)); + // 删除工单 + baseMapper.deleteById(id); + // 删除工单子表 + titemService.remove(new LambdaQueryWrapper().eq(DlRepairTitem::getTicketId, id)); + } } diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 314f6e42..1b9cd8ce 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -56,6 +56,8 @@ spring: # url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例 username: lanan_dev password: lighting@2024 +# username: lanan +# password: 123456 # username: sa # SQL Server 连接的示例 # password: Yudao@2024 # SQL Server 连接的示例 # username: SYSDBA # DM 连接的示例 From d17b1129a0598fe7ef7cef5160f087b1e007fca5 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Sat, 2 Nov 2024 16:52:31 +0800 Subject: [PATCH 06/51] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 05696bff5e4a7599c39bad23429fc029ee1feec5) --- .../impl/DlRepairTicketsServiceImpl.java | 127 +++++++++--------- 1 file changed, 62 insertions(+), 65 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 50c32faa..e7720842 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -217,7 +217,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl list = customerService.list(new LambdaQueryWrapper().eq(CustomerMain::getPhoneNumber, customerAndCarVO.getUserInfo().getPhoneNumber())); - if (CollectionUtil.isNotEmpty(list)){ + if (CollectionUtil.isNotEmpty(list)) { throw exception0(500, "电话号码重复"); } customerService.save(customerAndCarVO.getUserInfo()); // 如果新增了数据,id没有回填 - if (ObjectUtil.isEmpty(customerAndCarVO.getUserInfo().getId())){ + if (ObjectUtil.isEmpty(customerAndCarVO.getUserInfo().getId())) { CustomerMain byPhoneNumber = customerService.getOne(new LambdaQueryWrapper().eq(CustomerMain::getPhoneNumber, customerAndCarVO.getUserInfo().getPhoneNumber())); customerAndCarVO.getUserInfo().setId(byPhoneNumber.getId()); } @@ -469,12 +468,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl list = carMainService.list(new LambdaQueryWrapper().eq(CarMain::getLicenseNumber, customerAndCarVO.getCarInfo().getLicenseNumber())); - if (CollectionUtil.isNotEmpty(list)){ + if (CollectionUtil.isNotEmpty(list)) { throw exception0(500, "车牌重复"); } carMainService.createCarMain(customerAndCarVO.getCarInfo()); // 如果新增了数据,id没有回填 - if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())){ + if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())) { CarMain byLicenseNumber = carMainService.getOne(new LambdaQueryWrapper().eq(CarMain::getLicenseNumber, customerAndCarVO.getCarInfo().getLicenseNumber())); customerAndCarVO.getCarInfo().setId(byLicenseNumber.getId()); } @@ -514,7 +513,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl userIds = new ArrayList<>(); - for (RepairWorker worker:list){ + for (RepairWorker worker : list) { userIds.add(worker.getUserId()); - if("".equals(userIdsStr)){ + if ("".equals(userIdsStr)) { userIdsStr = String.valueOf(worker.getUserId()); - }else{ - userIdsStr = ","+worker.getUserId(); + } else { + userIdsStr = "," + worker.getUserId(); } } repairTicketsReqVO.setUserIds(userIds); @@ -1176,56 +1175,54 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList()); - List twItems = new ArrayList<>(); - if (CollectionUtil.isNotEmpty(ids)){ - twItems = twItemService.list(new LambdaQueryWrapper().and(item -> { + if (CollectionUtil.isNotEmpty(list)) { + // 查配件申请表的所有已领取数量小于申请数量的子表信息 + List ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList()); + List twItems = twItemService.list(new LambdaQueryWrapper().and(item -> { item.in(DlTwItem::getTwId, ids) .apply("wares_already_count < wares_count"); })); - } - if (CollectionUtil.isNotEmpty(twItems)) { - // 更新工单子表(主要是把已领料的字段同步给工单配件的数量字段) - // 查询工单子表(三个查询条件,属于那个工单,属于配件类型,属于需要改变的(即申请表的已领取数量小于申请数量的)) - Set waresId = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toSet()); - List items = titemService.list(new LambdaQueryWrapper().and(item -> { - item.eq(DlRepairTitem::getTicketId, id) - .eq(DlRepairTitem::getItemType, "02") - .in(DlRepairTitem::getPartId, waresId); - })); - // 同一个配件可能申请过多次,属于是一个工单配件可能是对应多个申请表配件 - List finalTwItems = twItems; - List AllItems = items.stream().map(item -> { - DlRepairTitem titem = new DlRepairTitem(); - titem.setId(item.getId()); - List wares = finalTwItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList()); - int sum = wares.stream().mapToInt(DlTwItem::getWaresAlreadyCount).sum(); - titem.setItemCount(sum); - BigDecimal discount = item.getItemDiscount() == null ? BigDecimal.ONE : item.getItemDiscount(); - titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(sum)).multiply(discount)); - return titem; - }).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(twItems)) { + // 更新工单子表(主要是把已领料的字段同步给工单配件的数量字段) + // 查询工单子表(三个查询条件,属于那个工单,属于配件类型,属于需要改变的(即申请表的已领取数量小于申请数量的)) + Set waresId = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toSet()); + List items = titemService.list(new LambdaQueryWrapper().and(item -> { + item.eq(DlRepairTitem::getTicketId, id) + .eq(DlRepairTitem::getItemType, "02") + .in(DlRepairTitem::getPartId, waresId); + })); + // 同一个配件可能申请过多次,属于是一个工单配件可能是对应多个申请表配件 + List AllItems = items.stream().map(item -> { + DlRepairTitem titem = new DlRepairTitem(); + titem.setId(item.getId()); + List wares = twItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList()); + int sum = wares.stream().mapToInt(DlTwItem::getWaresAlreadyCount).sum(); + titem.setItemCount(sum); + BigDecimal discount = item.getItemDiscount() == null ? BigDecimal.ONE : item.getItemDiscount(); + titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(sum)).multiply(discount)); + return titem; + }).collect(Collectors.toList()); - // 可能出现配件申请单审核通过了没有任何领取或全部退了的情况,所以如果itemCount等于0,直接把这个数据删掉 - // 过滤出需要删除的数据 - List delItems = AllItems.stream().filter(item -> item.getItemCount() == 0).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(delItems)) { - // 删除需要删的 - titemService.removeBatchByIds(delItems); - Set delIds = delItems.stream().map(DlRepairTitem::getId).collect(Collectors.toSet()); - // 得到需要改的 - List updateItems = AllItems.stream().filter(item -> delIds.contains(item.getId())).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(updateItems)) { - titemService.updateBatchById(updateItems); + // 可能出现配件申请单审核通过了没有任何领取或全部退了的情况,所以如果itemCount等于0,直接把这个数据删掉 + // 过滤出需要删除的数据 + List delItems = AllItems.stream().filter(item -> item.getItemCount() == 0).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(delItems)) { + // 删除需要删的 + titemService.removeBatchByIds(delItems); + Set delIds = delItems.stream().map(DlRepairTitem::getId).collect(Collectors.toSet()); + // 得到需要改的 + List updateItems = AllItems.stream().filter(item -> delIds.contains(item.getId())).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(updateItems)) { + titemService.updateBatchById(updateItems); + } + } else { + // 没有需要删的就是全部都需要改 + titemService.updateBatchById(AllItems); } - } else { - // 没有需要删的就是全部都需要改 - titemService.updateBatchById(AllItems); - } - // 重新计算维修工单 - return computeTicket(id); + // 重新计算维修工单 + return computeTicket(id); + } } return true; } @@ -1335,7 +1332,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl list = titemService.list(new LambdaQueryWrapper().eq(DlRepairTitem::getTicketId, ticketId)); // 计算子表 - if (CollectionUtil.isEmpty(list)){ + if (CollectionUtil.isEmpty(list)) { throw exception0(500, "没有项目、配件或其他"); } List updateItems = list.stream().map(item -> { @@ -1516,19 +1513,19 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(RepairOrderInfo::getGoodsId, id)); // 删除工单 From fa5076bcabdcbcd45e1c38e79c81b4c96c464c47 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Mon, 4 Nov 2024 11:00:59 +0800 Subject: [PATCH 07/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E5=BA=9F?= =?UTF-8?q?=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/iocoder/yudao/common/RecordTypeEnum.java | 8 +++++++- .../tickets/service/impl/DlRepairTicketsServiceImpl.java | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java index 7e43c8a0..92b4373b 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java @@ -64,7 +64,13 @@ public enum RecordTypeEnum { /** * 接单 */ - jd("jd","接单"); + jd("jd","接单"), + + /** 作废工单 */ + ZFGG("zfgg", "作废工单"), + + /** 删除工单 */ + SCGG("scgg", "删除工单"); /** * code diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index e7720842..f9cca09c 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.common.*; import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; +import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; @@ -383,14 +384,21 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(RepairOrderInfo::getGoodsId, repairTicketsReqVO.getId())); + // 记录日志 + repairRecordsService.saveRepairRecord(repairTicketsReqVO.getId(), null, RecordTypeEnum.ZFGG.getCode(), repairTicketsReqVO.getRemark(), null); } /** From e4279f87c576ea79704298eabe73a4f56bc8d43a Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Mon, 4 Nov 2024 11:03:01 +0800 Subject: [PATCH 08/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/tickets/service/impl/DlRepairTicketsServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index f9cca09c..62e73c29 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -1554,6 +1554,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(DlRepairTitem::getTicketId, id)); + // 记录操作日志 + repairRecordsService.saveRepairRecord(id, null, RecordTypeEnum.SCGG.getCode(), null, null); } } From adba8c0dce801107e8749e545205d6cb094534a7 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Mon, 4 Nov 2024 14:18:29 +0800 Subject: [PATCH 09/51] =?UTF-8?q?=E4=BD=9C=E5=BA=9F=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tickets/service/impl/DlRepairTicketsServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 62e73c29..14ecff8a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -394,7 +394,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(RepairOrderInfo::getGoodsId, repairTicketsReqVO.getId())); // 记录日志 From 3c56602e18d038ea49783cd798f2b0ccf71a3d23 Mon Sep 17 00:00:00 2001 From: PQZ Date: Mon, 4 Nov 2024 14:53:43 +0800 Subject: [PATCH 10/51] 1 --- .../tickets/controller/admin/DlRepairTicketsController.java | 6 ++++-- .../module/tickets/service/DlRepairTicketsService.java | 2 +- .../tickets/service/impl/DlRepairTicketsServiceImpl.java | 6 ++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java index 41fe1162..b9999f3b 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java @@ -200,8 +200,10 @@ public class DlRepairTicketsController { **/ @GetMapping("/take") @Operation(summary = "接单") - public CommonResult updateTake(@RequestParam("id") String id) { - dlRepairTicketsService.updateTake(id); + public CommonResult updateTake(@RequestParam("id") String id, + @RequestParam(value="image",required = false) String image, + @RequestParam(value="remark",required = false) String remark) { + dlRepairTicketsService.updateTake(id,image); return CommonResult.ok(); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java index 97151564..1992f8c5 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java @@ -108,7 +108,7 @@ public interface DlRepairTicketsService extends IService { * @date 11:48 2024/10/14 * @param id 工单ID **/ - void updateTake(String id); + void updateTake(String id,String image); /** * 指派员工,通知施工 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index e7720842..34b9b288 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -6,8 +6,6 @@ import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.common.*; import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; -import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; -import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairWorkerService; @@ -910,7 +908,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl() .set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.RECEIVED.getCode()) @@ -922,7 +920,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl Date: Mon, 4 Nov 2024 15:21:54 +0800 Subject: [PATCH 11/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=98=E5=B7=A5?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E9=A2=86=E6=96=99=E3=80=81=E9=80=80=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/DlRepairSoController.java | 8 +- .../service/DlRepairSoService.java | 4 +- .../service/impl/DlRepairSoServiceImpl.java | 148 +++--------------- 3 files changed, 25 insertions(+), 135 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java index 8a8ba885..26cf5395 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java @@ -97,8 +97,8 @@ public class DlRepairSoController { **/ @GetMapping("/confirmGet") @Operation(summary = "员工确认领料") - public CommonResult confirmGet(@RequestParam("id") String id) { - dlRepairSoService.confirmGet(id); + public CommonResult confirmGet(@RequestParam("id") String id, @RequestParam(value = "image", required = false) String image) { + dlRepairSoService.confirmGet(id, image); return CommonResult.ok(); } @@ -111,8 +111,8 @@ public class DlRepairSoController { **/ @GetMapping("/confirmBack") @Operation(summary = "员工确认退料") - public CommonResult confirmBack(@RequestParam("id") String id) { - dlRepairSoService.confirmBack(id); + public CommonResult confirmBack(@RequestParam("id") String id, @RequestParam(value = "image", required = false) String image) { + dlRepairSoService.confirmBack(id, image); return CommonResult.ok(); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/DlRepairSoService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/DlRepairSoService.java index 8893fd34..09e8f8c1 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/DlRepairSoService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/DlRepairSoService.java @@ -58,7 +58,7 @@ public interface DlRepairSoService extends IService { * @author 小李 * @date 11:58 2024/10/21 **/ - void confirmGet(String id); + void confirmGet(String id, String image); /** * 员工确认退料 @@ -67,7 +67,7 @@ public interface DlRepairSoService extends IService { * @author 小李 * @date 19:41 2024/10/21 **/ - void confirmBack(String id); + void confirmBack(String id, String image); /** * 采购入库 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java index 06a68890..57df6332 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java @@ -3,9 +3,11 @@ package cn.iocoder.yudao.module.stockOperate.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; +import cn.iocoder.yudao.common.RecordTypeEnum; import cn.iocoder.yudao.common.RepairErrorCodeConstants; import cn.iocoder.yudao.common.SoStatusEnum; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairWorkerService; import cn.iocoder.yudao.module.company.entity.Company; import cn.iocoder.yudao.module.company.service.CompanyService; @@ -99,6 +101,10 @@ public class DlRepairSoServiceImpl extends ServiceImpl sois = repairSoiService - .list(new LambdaQueryWrapper() - .eq(DlRepairSoi::getSoId, id) - ); - // 查库存---生成领料单的时候更新了 -// List wares = waresService -// .list(new LambdaQueryWrapper() -// .in(RepairWares::getId, sois.stream() -// .map(DlRepairSoi::getGoodsId) -// .collect(Collectors.toList()) -// )); -// // 更新库存 -// List newWares = wares.stream().map(item -> { -// RepairWares ware = new RepairWares(); -// ware.setId(item.getId()); -// sois.stream().filter(i -> i.getGoodsId().equals(item.getId())).findFirst().ifPresent(i -> { -// ware.setStock(item.getStock().subtract(BigDecimal.valueOf(i.getGoodsCount()))); -// }); -// return ware; -// }).collect(Collectors.toList()); -// waresService.updateBatchById(newWares); + public void confirmGet(String id, String image) { // 更新主表状态 为已领料 DlRepairSo dlRepairSo = new DlRepairSo(); dlRepairSo.setId(id); dlRepairSo.setSoStatus(SoStatusEnum.PICKED.getCode()); baseMapper.updateById(dlRepairSo); - // 更新申请表的数据----生成领料单的时候更新了 -// // 查申请表的子表对应的配件信息 -// List twItems = twItemService.list(new LambdaQueryWrapper().and(item -> { -// item.eq(DlTwItem::getTwId, so.getTwId()) -// .in(DlTwItem::getWaresId, sois.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList())); -// })); -// // 更新子表 -// List newTwItems = twItems.stream().map(item -> { -// DlTwItem dlTwItem = new DlTwItem(); -// dlTwItem.setId(item.getId()); -// dlTwItem.setWaresAlreadyCount(ObjectUtil.isNotEmpty(item.getWaresAlreadyCount()) ? item.getWaresAlreadyCount() + item.getWaresCouldCount() : item.getWaresCouldCount()); -// dlTwItem.setWaresStatus(dlTwItem.getWaresAlreadyCount().equals(item.getWaresCount()) ? "01" : item.getWaresStatus()); -// return dlTwItem; -// }).collect(Collectors.toList()); -// twItemService.updateBatchById(newTwItems); - // 查最新的子表信息 DlRepairSo so = baseMapper.selectOne(new LambdaQueryWrapper().eq(DlRepairSo::getId, id)); List list = twItemService.list(new LambdaQueryWrapper().eq(DlTwItem::getTwId, so.getTwId())); @@ -369,6 +337,12 @@ public class DlRepairSoServiceImpl extends ServiceImpl() .set(DlRepairSo::getSoStatus, SoStatusEnum.RETURNED.getCode()) .eq(DlRepairSo::getId, id) ); - // 更新配件申请表----生成退料单的时候更新了 -// DlRepairSo so = baseMapper.selectOne(new LambdaQueryWrapper().eq(DlRepairSo::getId, id)); -// // 查配件退料表子表 -// List sois = repairSoiService.list(new LambdaQueryWrapper().eq(DlRepairSoi::getSoId, so.getId())); -// // 查申请表子表 -// List twItems = twItemService.list(new LambdaQueryWrapper().eq(DlTwItem::getTwId, so.getTwId())); -// // 得到需要更新的数据 -// List newTwItems = twItems.stream().map(item -> { -// DlTwItem dlTwItem = new DlTwItem(); -// dlTwItem.setId(item.getId()); -// sois.stream().filter(i -> i.getGoodsId().equals(item.getWaresId())).findFirst().ifPresent(i -> { -// dlTwItem.setWaresBackCount( -// ObjectUtil.isNotEmpty(item.getWaresBackCount()) -// ? item.getWaresCount() + item.getWaresBackCount() -// : i.getGoodsCount()); -// // 如果退料数就是领料申请数,那就是全退了 -// if (i.getGoodsCount().equals(dlTwItem.getWaresCount())) { -// dlTwItem.setWaresStatus("03"); -// } -// }); -// return dlTwItem; -// }).collect(Collectors.toList()); -// twItemService.updateBatchById(newTwItems); -// // 更新库存 -// // 查库存 -// List wares = waresService.list(new LambdaQueryWrapper().in(RepairWares::getId, sois.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()))); -// // 构建新数据 -// List newWares = wares.stream().map(item -> { -// RepairWares ware = new RepairWares(); -// ware.setId(item.getId()); -// sois.stream().filter(i -> i.getGoodsId().equals(item.getId())).findFirst().ifPresent(i -> { -// ware.setStock(item.getStock().add(BigDecimal.valueOf(i.getGoodsCount()))); -// }); -// return ware; -// }).collect(Collectors.toList()); -// waresService.updateBatchById(newWares); - - // 更新维修工单----最后完成工单的时候来更新 -// // 查配件退料表子表 -// List sois = repairSoiService.list(new LambdaQueryWrapper().eq(DlRepairSoi::getSoId, so.getId())); -// // 查申请表主表 -// DlTicketWares ticketWares = ticketWaresService.getOne(new LambdaQueryWrapper().eq(DlTicketWares::getId, so.getTwId())); -// // 查维修工单子表为配件的数据 -// List titems = titemService.list(new LambdaQueryWrapper().and(item -> { -// item.eq(DlRepairTitem::getTicketId, ticketWares.getTicketId()) -// .eq(DlRepairTitem::getItemType, "02") -// .in(DlRepairTitem::getPartId, sois.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList())); -// })); -// // 构建新数据,更新维修工单子表 -// List newTitems = titems.stream().map(item -> { -// DlRepairTitem titem = new DlRepairTitem(); -// titem.setId(item.getId()); -// sois.stream().filter(i -> i.getGoodsId().equals(item.getPartId())).findFirst().ifPresent(i -> { -// titem.setItemCount(item.getItemCount() - i.getGoodsCount()); -// BigDecimal itemDiscount = ObjectUtil.isNotEmpty(item.getItemDiscount()) ? item.getItemDiscount() : BigDecimal.ONE; -// titem.setItemMoney(new BigDecimal(titem.getItemCount()).multiply(item.getItemPrice()).multiply(itemDiscount)); -// }); -// return titem; -// }).collect(Collectors.toList()); -// // 分开全部退料了的和没有全部退料的数据 -// List delTitems = newTitems.stream().filter(item -> item.getItemCount() == 0).collect(Collectors.toList()); -// if (CollectionUtil.isEmpty(delTitems)) { -// titemService.updateBatchById(newTitems); -// } else { -// titemService.removeBatchByIds(delTitems); -// List updateTitems = newTitems.stream().filter(item -> !delTitems.contains(item)).collect(Collectors.toList()); -// if (CollectionUtil.isEmpty(updateTitems)) { -// titemService.updateBatchById(updateTitems); -// } -// -// } -// // 更新维修工单 -// DlRepairTickets tickets = ticketsService.getOne(new LambdaQueryWrapper().eq(DlRepairTickets::getId, ticketWares.getTicketId())); -// // 查最新的子表信息 -// List list = titemService.list(new LambdaQueryWrapper().in(DlRepairTitem::getTicketId, tickets.getId())); -// // 计算工单总子项、工单配件总价、工单总价 -// DlRepairTickets newTickets = new DlRepairTickets(); -// newTickets.setId(tickets.getId()); -// newTickets.setCount(list.stream().mapToInt(DlRepairTitem::getItemCount).sum()); -// newTickets.setPartPrice(list.stream() -// .filter(item -> item.getItemType().equals("02")) -// .map(DlRepairTitem::getItemMoney) -// .reduce(BigDecimal.ZERO, BigDecimal::add)); -// BigDecimal projectPrice = tickets.getProjectPrice() == null ? BigDecimal.ZERO : tickets.getProjectPrice(); -// BigDecimal otherPrice = tickets.getOtherPrice() != null ? tickets.getOtherPrice() : BigDecimal.ZERO; -// BigDecimal partPrice = newTickets.getPartPrice() == null ? BigDecimal.ZERO : newTickets.getPartPrice(); -// newTickets.setTotalPrice(projectPrice.add(partPrice).add(otherPrice)); -// ticketsService.updateById(newTickets); - // 查主表 DlRepairSo newSo = baseMapper.selectById(id); // 通知仓库 repairWorkerService.sentMessage(Long.valueOf(newSo.getCreator()), newSo.getUserName() + "已确认退料单:" + newSo.getSoNo()); + // 记录日志 + // 查申请表 + DlTicketWares byId = ticketWaresService.getById(newSo.getTwId()); + // 记录日志 + recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.TL.getCode(), null, image); } /** From ab35fd68c2075481d8e6635a788302a98134ad10 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Mon, 4 Nov 2024 16:16:41 +0800 Subject: [PATCH 12/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=8A=B6=E6=80=81=E7=9A=84=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DlRepairTicketsServiceImpl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 6e58714e..32f6246c 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -425,6 +425,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl() - .set(DlRepairTickets::getIsFinish, "1") + // 因为完成状态需要在交车之后,所以注掉这个 +// .set(DlRepairTickets::getIsFinish, "1") .setSql("now_repair_id = adviser_id") .setSql("now_repair_name = adviser_name") .eq(DlRepairTickets::getId, respVO.getId()) From 38395104a8778ebf9655bc447a191714f56b4b91 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Mon, 4 Nov 2024 17:19:40 +0800 Subject: [PATCH 13/51] =?UTF-8?q?=E5=91=98=E5=B7=A5=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E9=A2=86=E6=96=99=E3=80=81=E9=80=80=E6=96=99=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=90=8D=E7=A7=B0=E5=92=8C=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DlRepairSoServiceImpl.java | 28 +++++++++++++++---- .../admin/DlTicketWaresController.java | 4 +-- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java index 57df6332..a6f90303 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java @@ -323,7 +323,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl().eq(DlRepairSo::getId, id)); + DlRepairSo so = baseMapper.selectById(id); List list = twItemService.list(new LambdaQueryWrapper().eq(DlTwItem::getTwId, so.getTwId())); // 判断是部分完成还是全部完成 DlTicketWares dlTicketWares = new DlTicketWares(); @@ -333,16 +333,22 @@ public class DlRepairSoServiceImpl extends ServiceImpl nameAndCount = list.stream().map(item -> item.getWaresName() + "(" + item.getWaresCount() + ")").collect(Collectors.toList()); + remark += "确认领料" + String.join(",", nameAndCount); // 记录日志 - recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.LL.getCode(), null, image); + recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.LL.getCode(), remark, image); } /** @@ -365,10 +371,20 @@ public class DlRepairSoServiceImpl extends ServiceImpl list = twItemService.list(new LambdaQueryWrapper().eq(DlTwItem::getTwId, newSo.getTwId())); // 查申请表 DlTicketWares byId = ticketWaresService.getById(newSo.getTwId()); + // 取当前操作人的名称 + String remark = SecurityFrameworkUtils.getLoginUserNickname(); + // 构建备注 + /* + 谁,退了什么配件,退了多少个 + */ + List nameAndCount = list.stream().map(item -> item.getWaresName() + "(" + item.getWaresCount() + ")").collect(Collectors.toList()); + remark += "确认退料" + String.join(",", nameAndCount); // 记录日志 - recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.TL.getCode(), null, image); + recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.TL.getCode(), remark, image); } /** diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java index a00c74d7..4d598c98 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java @@ -131,7 +131,7 @@ public class DlTicketWaresController { /** * 员工确认领料 - * + * 弃用 * @author 小李 * @date 22:07 2024/10/16 * @param respVO 请求对象 @@ -145,7 +145,7 @@ public class DlTicketWaresController { /** * 仓库确认退料 - * + * 弃用 * @author 小李 * @date 22:03 2024/10/17 * @param respVO 请求对象 From b7163b6aead56db273b36cd0117070a6d8fbd8e7 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Mon, 4 Nov 2024 18:10:46 +0800 Subject: [PATCH 14/51] 1 --- .../iocoder/yudao/common/RecordTypeEnum.java | 4 +++ .../admin/DlRepairTitemController.java | 28 +++++++++++++++++++ .../yudao/module/tickets/vo/AddProjVO.java | 21 ++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/AddProjVO.java diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java index 7e43c8a0..32841686 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java @@ -61,6 +61,10 @@ public enum RecordTypeEnum { TZTL("tztl","通知退料"), /**审批配件申请单*/ SPPJSQD("sppjsqd","审批配件申请单"), + /** + * 添加维修项目 + */ + TJWXXM("tjwxxm", "添加维修项目"), /** * 接单 */ diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java index 7dcd45f3..3425bef1 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java @@ -1,17 +1,22 @@ package cn.iocoder.yudao.module.tickets.controller.admin; +import cn.iocoder.yudao.common.RecordTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService; +import cn.iocoder.yudao.module.tickets.vo.AddProjVO; import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO; import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; +import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; +import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.ok; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -30,6 +35,8 @@ public class DlRepairTitemController { */ @Resource private DlRepairTitemService dlRepairTitemService; + @Resource + private RepairRecordsService repairRecordsService; /** * 维修工单子表 分页 @@ -113,6 +120,26 @@ public class DlRepairTitemController { return CommonResult.ok(); } + /** + * 添加维修项目 + * @author vinjor-M + * @date 14:28 2024/11/4 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + @PostMapping("/addNewProj") + @Operation(summary = "添加维修项目") + public CommonResult addNewProj(@RequestBody AddProjVO addProjVO){ + dlRepairTitemService.saveBatch(addProjVO.getItemList()); + List projNameList = addProjVO.getItemList().stream().map(DlRepairTitem::getItemName).collect(Collectors.toList()); + //最后记录操作日志--创建工单 + String remark = "添加维修项目"+String.join(", ",projNameList )+"。"; + if(StringUtils.isNotEmpty(addProjVO.getRemark())){ + remark += "备注:"+addProjVO.getRemark(); + } + repairRecordsService.saveRepairRecord(addProjVO.getItemList().get(0).getTicketId(), null, RecordTypeEnum.TJWXXM.getCode(), remark, addProjVO.getImage()); + return CommonResult.success(addProjVO.getItemList().get(0).getTicketId()); + } + /** * 维修工单单个子项 * @@ -126,5 +153,6 @@ public class DlRepairTitemController { dlRepairTitemService.removeItemById(id); return CommonResult.ok(); } + } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/AddProjVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/AddProjVO.java new file mode 100644 index 00000000..8302167c --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/AddProjVO.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.module.tickets.vo; + +import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; +import lombok.Data; + +import java.util.List; + +/** + * 维修过程中添加维修项目vo + * @author vinjor-M + * @date 14:43 2024/11/4 +**/ +@Data +public class AddProjVO { + /** 添加的项目信息 */ + private List itemList; + /** 签字图片相对路径 */ + private String image; + /** 备注内容 */ + private String remark; +} From 2dde810dec7f70857c473062bcbeb473e671415d Mon Sep 17 00:00:00 2001 From: Vinjor Date: Mon, 4 Nov 2024 18:43:25 +0800 Subject: [PATCH 15/51] 1 --- .../service/impl/DlRepairSoServiceImpl.java | 4 ++-- .../service/impl/DlRepairTicketsServiceImpl.java | 9 +++++++-- .../service/impl/DlTicketWaresServiceImpl.java | 11 ++++++++++- .../yudao/module/tickets/vo/DlRepairTicketsReqVO.java | 3 +++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java index a6f90303..0b82966c 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java @@ -345,8 +345,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl nameAndCount = list.stream().map(item -> item.getWaresName() + "(" + item.getWaresCount() + ")").collect(Collectors.toList()); - remark += "确认领料" + String.join(",", nameAndCount); + List nameAndCount = list.stream().map(item -> item.getWaresName() + "x" + item.getWaresCount()).collect(Collectors.toList()); + remark += "确认领料" + String.join(";", nameAndCount); // 记录日志 recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.LL.getCode(), remark, image); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 32f6246c..c7a2d4e3 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -5,7 +5,6 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.common.*; import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; -import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.service.RepairRecordsService; @@ -963,7 +962,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl wares = repairWaresService.list(new LambdaQueryWrapper().in(RepairWares::getId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()))); + Map waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getName)); + String remarkStr=""; + for(DlRepairSoi item:respVO.getRepairSois()){ + //组装通知领取配件的文字 + if(!"".equals(remarkStr)){ + remarkStr +=";"; + } + remarkStr += waresNameMap.get(item.getGoodsId())+"x"+item.getGoodsCount(); + } if (type.equals("02")) { // 领料 // 构造新数据 List newData = oldData.stream().map(item -> { @@ -512,7 +521,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl Date: Mon, 4 Nov 2024 18:44:19 +0800 Subject: [PATCH 16/51] 1 --- .../base/mapper/RepairWorkerMapper.java | 9 +++ .../base/service/RepairWorkerService.java | 9 +++ .../impl/RepairRecordsServiceImpl.java | 4 ++ .../service/impl/RepairWorkerServiceImpl.java | 57 +++++++++++++++++++ .../module/base/vo/RepairRecordsRespVO.java | 2 + .../module/base/vo/RepairWorkerRespVO.java | 2 +- .../mapper/base/RepairWorkerMapper.xml | 11 ++++ 7 files changed, 93 insertions(+), 1 deletion(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java index 980d8c6b..a371e049 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java @@ -35,4 +35,13 @@ public interface RepairWorkerMapper extends BaseMapper { * @date 2024年10月10日 **/ List getAllWorkerIds(); + + /** + * 根据userId查询维修工信息 + * @author PQZ + * @date 17:28 2024/11/4 + * @param userId 用户id + * @return cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO + **/ + RepairWorkerRespVO getByUserId(Long userId); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java index c267c455..05a1946a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java @@ -27,6 +27,15 @@ public interface RepairWorkerService extends IService { * @param userList 选中用户集合 **/ void saveWorkers(List userList); + + /** + * 根据用户id查询对应维修的角色,维修工人则查询班组,非维修工人查询角色 + * @author PQZ + * @date 17:21 2024/11/4 + * @param userId 用户id + * @return java.lang.String + **/ + String getWorkerRoleName(Long userId); /** * 更新维修工人 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java index ceca1561..d3c8d0fb 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.base.entity.RepairRecordsItem; import cn.iocoder.yudao.module.base.mapper.RepairRecordsMapper; import cn.iocoder.yudao.module.base.service.RepairRecordsItemService; import cn.iocoder.yudao.module.base.service.RepairRecordsService; +import cn.iocoder.yudao.module.base.service.RepairWorkerService; import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO; import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; @@ -36,6 +37,8 @@ public class RepairRecordsServiceImpl extends ServiceImpl list = repairRecordsMapper.queryRepairRecords(pageReqVO); //为每一条维修记录设置查询附件 list.forEach(item -> { + item.setRoleName(workerService.getWorkerRoleName(item.getDealUserId())); List itemList = itemService.getByMainId(REPAIR_RECORD_TYPE_RECORD, item.getId(), pageReqVO.getIsOpen()); item.setItemList(itemList); //相对路径按照“,”分隔 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java index 3c96809e..62d1f243 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.base.service.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.iocoder.yudao.common.RepairRoleEnum; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; @@ -15,6 +16,9 @@ import cn.iocoder.yudao.module.system.api.dict.DictDataApi; import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi; import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO; +import cn.iocoder.yudao.module.system.api.permission.PermissionApi; +import cn.iocoder.yudao.module.system.api.permission.RoleApi; +import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO; import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService; @@ -57,6 +61,13 @@ public class RepairWorkerServiceImpl extends ServiceImpl roleIds = permissionApi.getRoleIdsByUserId(userId); + // 所有的角色信息 + List roleList = roleApi.getRoleList(); + // 过滤出登录用户有的角色信息 + List collect = roleList.stream().filter(item -> roleIds.contains(item.getId())).collect(Collectors.toList()); + // 取出角色code + List codes = collect.stream().map(RoleReqDTO::getCode).collect(Collectors.toList()); + //维修业务管理员 + if (codes.contains(RepairRoleEnum.ADMIN.getCode())) { + return RepairRoleEnum.ADMIN.getName(); + } + // 总检 + if (codes.contains(RepairRoleEnum.INSPECTION.getCode())) { + return RepairRoleEnum.INSPECTION.getName(); + } + // 服务顾问 + if (codes.contains(RepairRoleEnum.ADVISOR.getCode())) { + return RepairRoleEnum.ADVISOR.getName(); + } + // 维修仓库管理员 + if (codes.contains(RepairRoleEnum.WAREHOUSE.getCode())) { + return RepairRoleEnum.WAREHOUSE.getName(); + } + // 维修财务 + if (codes.contains(RepairRoleEnum.WXCW.getCode())) { + return RepairRoleEnum.WXCW.getName(); + } + } + return null; + } + @Override public void updateWorker(RepairWorkerSaveReqVO updateReqVO) { // 更新 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java index 76e0cb96..c6498082 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java @@ -16,5 +16,7 @@ public class RepairRecordsRespVO extends RepairRecords { private List itemList; /**维修记录关联附件信息*/ private String images; + /**角色、岗位名称*/ + private String roleName; } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairWorkerRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairWorkerRespVO.java index cf02492d..c0df46b2 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairWorkerRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairWorkerRespVO.java @@ -9,7 +9,7 @@ import lombok.Data; @Data @ExcelIgnoreUnannotated public class RepairWorkerRespVO extends RepairWorker { - + private String workerTypeStr; } diff --git a/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml b/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml index c51f3010..68b75801 100644 --- a/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml @@ -37,6 +37,17 @@ WHERE main.deleted = 0 + From 3f45d05344724773e55409db3e0d45d3cef6cc4c Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Tue, 5 Nov 2024 10:37:01 +0800 Subject: [PATCH 17/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=B4=BE=E5=B7=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/iocoder/yudao/common/RecordTypeEnum.java | 5 ++++- .../service/impl/DlRepairTicketsServiceImpl.java | 12 ++++++++++-- .../module/tickets/vo/DlRepairTicketsReqVO.java | 3 +++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java index 92b4373b..8e6f4698 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java @@ -70,7 +70,10 @@ public enum RecordTypeEnum { ZFGG("zfgg", "作废工单"), /** 删除工单 */ - SCGG("scgg", "删除工单"); + SCGG("scgg", "删除工单"), + + /** 内返派工 */ + NFPG("nfpg", "内返派工"); /** * code diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 32f6246c..17c795d2 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -962,8 +962,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl Date: Tue, 5 Nov 2024 10:44:40 +0800 Subject: [PATCH 18/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=B4=BE=E5=B7=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tickets/service/impl/DlRepairTicketsServiceImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 90a31cb4..49a1e5c9 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -961,15 +961,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl Date: Tue, 5 Nov 2024 10:52:49 +0800 Subject: [PATCH 19/51] 1 --- .../tickets/service/impl/DlRepairTicketsServiceImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index c7a2d4e3..c1569492 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -964,10 +964,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl Date: Tue, 5 Nov 2024 11:43:19 +0800 Subject: [PATCH 20/51] 1 --- .../admin/DlRepairTitemController.java | 11 +++++++++++ .../tickets/service/DlRepairTitemService.java | 9 +++++++++ .../service/impl/DlRepairTitemServiceImpl.java | 17 +++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java index 3425bef1..eadcf5ef 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java @@ -154,5 +154,16 @@ public class DlRepairTitemController { return CommonResult.ok(); } + /** + * 查某工单维修项目进度 + * @author vinjor-M + * @date 10:57 2024/11/5 + * @param ticketId 工单id + **/ + @GetMapping("/getProjList") + @Operation(summary = "查某工单维修项目进度") + public CommonResult getProjList(@RequestParam("ticketId") String ticketId){ + return success(dlRepairTitemService.getProjList(ticketId)); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTitemService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTitemService.java index 4f42d16b..a0c126b3 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTitemService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTitemService.java @@ -74,4 +74,13 @@ public interface DlRepairTitemService extends IService { * @date 16:11 2024/10/31 **/ void updateRepairItem(List itemList); + + /** + * 查某工单维修项目进度 + * @author vinjor-M + * @date 10:58 2024/11/5 + * @param ticketId 工单ID + * @return java.util.List + **/ + List getProjList(String ticketId); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTitemServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTitemServiceImpl.java index cafcc927..451b4a73 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTitemServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTitemServiceImpl.java @@ -141,6 +141,23 @@ public class DlRepairTitemServiceImpl extends ServiceImpl + * @author vinjor-M + * @date 10:58 2024/11/5 + **/ + @Override + public List getProjList(String ticketId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(DlRepairTitem::getTicketId,ticketId) + .eq(DlRepairTitem::getItemType,"01") + .orderByDesc(DlRepairTitem::getItemStatus); + return this.list(queryWrapper); + } } From 97edaf40466ba62b2653669edfddf725a04415e1 Mon Sep 17 00:00:00 2001 From: PQZ Date: Tue, 5 Nov 2024 14:12:20 +0800 Subject: [PATCH 21/51] 1 --- .../module/base/vo/RepairRecordsRespVO.java | 3 ++- .../mapper/base/RepairRecordsMapper.xml | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java index c6498082..9d62e221 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java @@ -18,5 +18,6 @@ public class RepairRecordsRespVO extends RepairRecords { private String images; /**角色、岗位名称*/ private String roleName; - + /**项目名称*/ + private String projectName; } diff --git a/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml b/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml index 639bcf69..83ecb10f 100644 --- a/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml @@ -10,24 +10,26 @@ --> + \ No newline at end of file From 07df7503bef3a67e3471548c6fba2a39cbd86880 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Wed, 6 Nov 2024 14:17:32 +0800 Subject: [PATCH 27/51] 1 --- .../module/system/dal/mysql/notify/NotifyMessageMapper.java | 1 + .../module/system/service/notify/NotifyMessageServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyMessageMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyMessageMapper.java index 7473abe8..014a1b10 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyMessageMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyMessageMapper.java @@ -40,6 +40,7 @@ public interface NotifyMessageMapper extends BaseMapperX { .eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus()) .betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime()) .eq(NotifyMessageDO::getUserId, userId) + .eq(NotifyMessageDO::getUserType, 1) .orderByDesc(NotifyMessageDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageServiceImpl.java index c54fc8b5..b2a7dc07 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageServiceImpl.java @@ -70,7 +70,7 @@ public class NotifyMessageServiceImpl implements NotifyMessageService { @Override @TenantIgnore public Long getWXUnreadNotifyMessageCount(Long userId) { - return notifyMessageMapper.selectUnreadCountByUserIdAndUserType(userId, null); + return notifyMessageMapper.selectUnreadCountByUserIdAndUserType(userId, 1); } @Override From 8bd53b225c4a144b89d4f2427ffd949e513c3d5d Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Wed, 6 Nov 2024 15:07:08 +0800 Subject: [PATCH 28/51] =?UTF-8?q?=E6=9A=82=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DlRepairBookingServiceImpl.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java index 8a265cca..a49b2503 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.booking.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.common.RepairRoleEnum; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; @@ -23,16 +24,19 @@ import cn.iocoder.yudao.module.system.api.service.dto.ServicePackageDto; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; +import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.catalina.User; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -71,7 +75,31 @@ public class DlRepairBookingServiceImpl extends ServiceImpl dataList = dictDataApi.getDictDataList("repair_type"); + DictDataRespDTO dictDataRespDTO = dataList.stream().filter(item -> item.getValue().equals(repairBookingRespVO.getRepairType())).findFirst().orElse(null); + String message = String.format( + "%s(%s)预约了%s的%s", + repairBookingRespVO.getUserName(), + repairBookingRespVO.getUserMobile(), + formatter.format(repairBookingRespVO.getBookingTime()), + dictDataRespDTO != null ? dictDataRespDTO.getLabel() : "维修保养" + ); + + // 选择了服务顾问 + if (ObjectUtil.isNotEmpty(repairBookingRespVO.getAdviserId())){ + // 站内信通知 + // websocket通知 + }else { + // 没选服务顾问 + // 获取所有的服务顾问 + // 站内信通知和websocket通知 + } + + // 正常的新增、修改 Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); Optional.ofNullable(loginUserId).ifPresent(repairBookingRespVO::setUserId); repairBookingRespVO.setBookingStatus("01"); From ffbf0130d65b9439444672f7d93b2a5438fa16fc Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Wed, 6 Nov 2024 16:01:49 +0800 Subject: [PATCH 29/51] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E6=97=B6=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=9C=8D=E5=8A=A1=E9=A1=BE=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/service/impl/RepairWorkerServiceImpl.java | 8 +++++--- .../service/impl/DlRepairBookingServiceImpl.java | 13 ++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java index 62d1f243..fc10bb08 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.common.RepairRoleEnum; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.module.app.controller.admin.NotifyMessageSocket; import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.mapper.RepairWorkerMapper; @@ -223,7 +224,7 @@ public class RepairWorkerServiceImpl extends ServiceImpl templateParams = new HashMap<>(); // 发送模版内容 @@ -232,8 +233,9 @@ public class RepairWorkerServiceImpl extends ServiceImpl allServicer = getAllServicer(TenantContextHolder.getRequiredTenantId()); + // 发送消息通知 + allServicer.forEach(item -> repairWorkerService.sentMessage(item.getId(), message)); } // 正常的新增、修改 From a9f2a8f967005dc73d080af3126532eb712e8c69 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Wed, 6 Nov 2024 18:23:52 +0800 Subject: [PATCH 30/51] 1 --- .../service/impl/CarMainServiceImpl.java | 24 ++++++++++------- .../admin/DlRepairBookingController.java | 26 +++++++++++++++++-- .../booking/vo/DlRepairBookingRespVO.java | 1 + 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarMainServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarMainServiceImpl.java index 2585ae24..e0b3901d 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarMainServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarMainServiceImpl.java @@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -107,17 +108,20 @@ public class CarMainServiceImpl extends ServiceImpl impl @Override public CommonResult updateCarMain(CarMainReqVO updateReqVO) { //车牌号license_number,车架号vin,发动机号码engine_number 重复校验 - int checkResult = isDataKeyValueRepeat(updateReqVO); - //如果查重失败 - if (checkResult != 0) { - switch (checkResult) { - case 1: - return CommonResult.error(4051, "该车牌号已在系统中登记"); - case 2: - return CommonResult.error(4052, "该车架号已在系统中登记"); - case 3: - return CommonResult.error(4053, "该发动机号码已在系统中登记"); + if(StringUtils.isEmpty(updateReqVO.getId())){ + //没有车辆id才需要查重 + int checkResult = isDataKeyValueRepeat(updateReqVO); + //如果查重失败 + if (checkResult != 0) { + switch (checkResult) { + case 1: + return CommonResult.error(4051, "该车牌号已在系统中登记"); + case 2: + return CommonResult.error(4052, "该车架号已在系统中登记"); + case 3: + return CommonResult.error(4053, "该发动机号码已在系统中登记"); + } } } //车俩品牌型号级联选择器返回值,第一位是品牌,第二位是型号 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java index bba5bfef..2d57cd29 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java @@ -1,17 +1,25 @@ package cn.iocoder.yudao.module.booking.controller.admin; +import cn.hutool.core.bean.BeanUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.booking.entity.DlRepairBooking; import cn.iocoder.yudao.module.booking.service.DlRepairBookingService; import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO; import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO; +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_TYPE; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; /** @@ -28,6 +36,9 @@ public class DlRepairBookingController { */ @Resource private DlRepairBookingService dlRepairBookingService; + @Resource + private DictDataApi dictDataApi; + /** * 维修预约表 新增、修改 @@ -92,9 +103,20 @@ public class DlRepairBookingController { @GetMapping("/list") @Operation(summary = "维修预约表 不分页") public CommonResult getBookingList(@RequestParam("userId")Integer userId){ - return success(dlRepairBookingService.list(new LambdaQueryWrapper() + //维修项目类型字典 + List repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE); + Map repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel)); + List respVOList = dlRepairBookingService.list(new LambdaQueryWrapper() .eq(DlRepairBooking::getUserId,userId) - .orderByDesc(DlRepairBooking::getBookingTime))); + .orderByDesc(DlRepairBooking::getBookingTime)); + List rtnList = new ArrayList<>(); + for(DlRepairBooking booking:respVOList){ + DlRepairBookingRespVO newEntity = new DlRepairBookingRespVO(); + BeanUtil.copyProperties(booking,newEntity); + newEntity.setRepairText(repairTypeMap.get(newEntity.getRepairType())); + rtnList.add(newEntity); + } + return success(rtnList); } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/vo/DlRepairBookingRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/vo/DlRepairBookingRespVO.java index 9390d110..e6edd45d 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/vo/DlRepairBookingRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/vo/DlRepairBookingRespVO.java @@ -11,4 +11,5 @@ import lombok.Data; **/ @Data public class DlRepairBookingRespVO extends DlRepairBooking { + private String repairText; } From 5de31ac2c47cc00668dcab92041fb20c47f4fedb Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Wed, 6 Nov 2024 18:42:30 +0800 Subject: [PATCH 31/51] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E6=AF=8F=E4=B8=80?= =?UTF-8?q?=E6=AD=A5=E7=BB=99=E5=AE=A2=E6=88=B7=E5=8F=91=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/service/RepairWorkerService.java | 11 +++ .../service/impl/RepairWorkerServiceImpl.java | 69 ++++++++++++++++--- .../impl/DlRepairTicketsServiceImpl.java | 37 ++++++++++ 3 files changed, 109 insertions(+), 8 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java index 05a1946a..a8e393cc 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java @@ -87,6 +87,17 @@ public interface RepairWorkerService extends IService { **/ void sentMessage(Long userId,String text); + /** + * 向指定用户发送消息(用户,非员工) + * + * @author 小李 + * @date 16:52 2024/11/6 + * @param ticketId 工单ID + * @param text 消息通知内容 + * @param isSMS 是否需要发短信 + **/ + void sentMessageToCus(String ticketId, String text, Boolean isSMS); + /** * 通过班组长的id查该班组的员工 * diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java index fc10bb08..5128a232 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.base.service.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.common.RepairRoleEnum; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.security.core.LoginUser; @@ -13,6 +14,8 @@ import cn.iocoder.yudao.module.base.service.RepairWorkerService; import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO; import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO; import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO; +import cn.iocoder.yudao.module.custom.entity.CustomerMain; +import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.system.api.dict.DictDataApi; import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi; @@ -20,9 +23,14 @@ import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDT import cn.iocoder.yudao.module.system.api.permission.PermissionApi; import cn.iocoder.yudao.module.system.api.permission.RoleApi; import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; +import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; +import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService; import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService; +import cn.iocoder.yudao.util.SendSmsUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -31,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import org.yaml.snakeyaml.events.Event; import javax.annotation.Resource; import java.io.IOException; @@ -69,6 +78,14 @@ public class RepairWorkerServiceImpl extends ServiceImpl roleIds = permissionApi.getRoleIdsByUserId(userId); @@ -173,12 +190,12 @@ public class RepairWorkerServiceImpl extends ServiceImpl queryListPage(RepairWorkerPageReqVO pageReqVO, Page page) { - IPage respVOIPage= workerMapper.queryListPage(pageReqVO, page); - if(!respVOIPage.getRecords().isEmpty()){ + IPage respVOIPage = workerMapper.queryListPage(pageReqVO, page); + if (!respVOIPage.getRecords().isEmpty()) { // 单位字典 List recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_WORK_TYPE); - Map typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel)); - respVOIPage.getRecords().stream().peek(item->item.setWorkTypeText(typeMap.get(item.getWorkType()))).collect(Collectors.toList()); + Map typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel)); + respVOIPage.getRecords().stream().peek(item -> item.setWorkTypeText(typeMap.get(item.getWorkType()))).collect(Collectors.toList()); } return respVOIPage; } @@ -201,11 +218,11 @@ public class RepairWorkerServiceImpl extends ServiceImpl ids = titems.stream().flatMap(item -> Arrays.stream(item.getRepairIds().split(","))).collect(Collectors.toSet()); List repairWorkerList = baseMapper.selectList(new LambdaQueryWrapper().in(RepairWorker::getUserId, ids)); - if(!repairWorkerList.isEmpty()){ + if (!repairWorkerList.isEmpty()) { // 单位字典 List recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_WORK_TYPE); - Map typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel)); - repairWorkerList.stream().peek(item->item.setWorkTypeText(typeMap.get(item.getWorkType()))).collect(Collectors.toList()); + Map typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel)); + repairWorkerList.stream().peek(item -> item.setWorkTypeText(typeMap.get(item.getWorkType()))).collect(Collectors.toList()); } //翻译工种 return repairWorkerList; @@ -241,6 +258,42 @@ public class RepairWorkerServiceImpl extends ServiceImpl templateParams = new HashMap<>(); + // 发送模版内容 + templateParams.put("text", text); + // 发送站内信 + sendApi.sendSingleMessageToMember(new NotifySendSingleToUserReqDTO() + .setUserId(customerMain.getUserId()) + .setTemplateCode(TICKET_EMPLOY).setTemplateParams(templateParams)); + //发送语音提醒 + notifyMessageSocket.sendMessage(text, TenantContextHolder.getRequiredTenantId().toString(), String.valueOf(customerMain.getUserId())); + + // 发送短信 + if (isSMS) { + SendSmsUtil.sendMsgCommon(new String[]{text}, customerMain.getPhoneNumber(), "1400852709", "蓝安汽车小程序", "2143603"); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + /** * 通过班组长的id查该班组的员工 * diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 5b63d2bc..cf02e416 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -301,6 +301,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl() @@ -944,6 +950,15 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()).last("limit 1")); + List dataList = dictDataApi.getDictDataList("repair_work_type"); + DictDataRespDTO dictDataRespDTO = dataList.stream().filter(item -> item.getValue().equals(worker.getWorkType())).findFirst().orElse(null); + String message = String.format("您的爱车%s已由%s %s接单了", tickets.getCarNo(), (dictDataRespDTO != null ? dictDataRespDTO.getLabel() : "维修工"), worker.getUserName()); + repairWorkerService.sentMessageToCus(id, message, false); } /** @@ -1078,6 +1093,22 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()).last("limit 1")); + List dataList = dictDataApi.getDictDataList("repair_work_type"); + DictDataRespDTO dictDataRespDTO = dataList.stream().filter(item -> item.getValue().equals(worker.getWorkType())).findFirst().orElse(null); + String newMessage = String.format( + "您的爱车%s已由%s %s%s", + tickets.getCarNo(), + (dictDataRespDTO != null ? dictDataRespDTO.getLabel() : "维修工"), + worker.getUserName(), + (respVO.getRecordType().equals(RecordTypeEnum.KSSG.getCode()) ? "开始施工" : "施工完成") + ); + repairWorkerService.sentMessageToCus(tickets.getId(), newMessage, false); + } } private String createMessage(String who, String no, String projectName, String type, String finishType, String nextName) { @@ -1191,6 +1222,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl Date: Wed, 6 Nov 2024 18:54:54 +0800 Subject: [PATCH 32/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=80=E6=9C=89?= =?UTF-8?q?=E7=94=A8=E5=88=B0=E5=B7=A5=E5=8D=95=E5=8F=B7to=E8=BD=A6?= =?UTF-8?q?=E7=89=8C=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DlRepairTicketsServiceImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index cf02e416..440ec04a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -1052,7 +1052,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl { - repairWorkerService.sentMessage(id, "待总检工单:" + item.getTicketNo() + "已经超时,但无法自动总检,请手动处理"); + repairWorkerService.sentMessage(id, "待总检车牌为:" + item.getCarNo() + "工单已经超时,但无法自动总检,请手动处理"); }); } return flag; @@ -1576,7 +1576,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl { repairWorkerService.sentMessage(Long.valueOf(item.getAdviserId()), "您有新的工单可以出厂检验"); ids.forEach(id -> { - repairWorkerService.sentMessage(id, "工单:" + item.getTicketNo() + "已由系统自动总检并移交服务顾问"); + repairWorkerService.sentMessage(id, "车牌为:" + item.getCarNo() + "工单已由系统自动总检并移交服务顾问"); }); // 记录日志 repairRecordsService.saveRepairRecord(item.getId(), null, RecordTypeEnum.ZJ.getCode(), "该工单由系统自动总检完成", null); From 6cf53afc9c31f58231968653a08de1676ef7b2d9 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Thu, 7 Nov 2024 10:41:30 +0800 Subject: [PATCH 33/51] =?UTF-8?q?=E8=A1=A5=E6=AD=A3=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tickets/service/impl/DlRepairTicketsServiceImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 440ec04a..4131ee8f 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -433,13 +433,18 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl Date: Thu, 7 Nov 2024 10:49:52 +0800 Subject: [PATCH 34/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=9A=84=E7=BB=B4=E4=BF=AE=E7=B1=BB=E5=88=AB=E4=B8=BA=E7=BB=B4?= =?UTF-8?q?=E4=BF=AE=E4=BF=9D=E5=85=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/tickets/service/impl/DlRepairTicketsServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 4131ee8f..1d3d0b31 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -270,7 +270,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl Date: Thu, 7 Nov 2024 10:53:08 +0800 Subject: [PATCH 35/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=9A=84=E7=BB=B4=E4=BF=AE=E7=B1=BB=E5=88=AB=E4=B8=BA=E7=BB=B4?= =?UTF-8?q?=E4=BF=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/tickets/service/impl/DlRepairTicketsServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 1d3d0b31..544e21db 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -270,7 +270,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl Date: Thu, 7 Nov 2024 11:07:10 +0800 Subject: [PATCH 36/51] =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E7=BB=B4=E4=BF=AE?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E5=AD=90=E9=A1=B9=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/tickets/service/impl/DlRepairTitemServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTitemServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTitemServiceImpl.java index 451b4a73..14e735d6 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTitemServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTitemServiceImpl.java @@ -98,6 +98,7 @@ public class DlRepairTitemServiceImpl extends ServiceImpl Date: Thu, 7 Nov 2024 11:53:08 +0800 Subject: [PATCH 37/51] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E4=BA=86=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=A1=BE=E9=97=AE=EF=BC=8C=E6=B6=88=E6=81=AF=E5=B8=A6?= =?UTF-8?q?=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/booking/service/impl/DlRepairBookingServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java index 1ea90272..3e035c72 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java @@ -97,7 +97,7 @@ public class DlRepairBookingServiceImpl extends ServiceImpl Date: Thu, 7 Nov 2024 14:18:42 +0800 Subject: [PATCH 38/51] 1 --- .../booking/controller/admin/DlRepairBookingController.java | 1 + .../module/tickets/service/impl/DlRepairTicketsServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java index 2d57cd29..c669f3ac 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java @@ -108,6 +108,7 @@ public class DlRepairBookingController { Map repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel)); List respVOList = dlRepairBookingService.list(new LambdaQueryWrapper() .eq(DlRepairBooking::getUserId,userId) + .isNull(DlRepairBooking::getTicketsId) .orderByDesc(DlRepairBooking::getBookingTime)); List rtnList = new ArrayList<>(); for(DlRepairBooking booking:respVOList){ diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 440ec04a..b03f8d97 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -1052,7 +1052,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl Date: Thu, 7 Nov 2024 15:15:49 +0800 Subject: [PATCH 39/51] 1 --- .../iocoder/yudao/common/BaseConstants.java | 2 + .../base/mapper/RepairWorkerMapper.java | 8 +++ .../base/service/RepairWorkerService.java | 10 ++-- .../impl/RepairRecordsServiceImpl.java | 55 ++++++++++++++++++- .../service/impl/RepairWorkerServiceImpl.java | 52 +++--------------- .../mapper/base/RepairWorkerMapper.xml | 10 ++++ .../system/api/permission/PermissionApi.java | 10 ++++ .../system/api/user/dto/UserRoleDTO.java | 9 +++ .../api/permission/PermissionApiImpl.java | 17 ++++++ .../dal/mysql/permission/UserRoleMapper.java | 11 +++- .../service/permission/PermissionService.java | 10 ++++ .../permission/PermissionServiceImpl.java | 15 ++++- .../main/resources/mapper/UserRoleMapper.xml | 13 +++++ 13 files changed, 168 insertions(+), 54 deletions(-) create mode 100644 yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/dto/UserRoleDTO.java diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/common/BaseConstants.java b/dl-module-base/src/main/java/cn/iocoder/yudao/common/BaseConstants.java index 00cbeaf8..35b8ed74 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/common/BaseConstants.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/common/BaseConstants.java @@ -129,4 +129,6 @@ public class BaseConstants { /** 字典:超时自动总检配置 */ public static final String AUTO_INSPECTION = "auto_inspection"; + public static final String MAP_NO_DATA = "map_no_data"; + } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java index a371e049..589ea9bf 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java @@ -44,4 +44,12 @@ public interface RepairWorkerMapper extends BaseMapper { * @return cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO **/ RepairWorkerRespVO getByUserId(Long userId); + + /** + * 查询所有维修工信息 + * @author PQZ + * @date 17:28 2024/11/4 + * @return cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO + **/ + List listAllWorker(); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java index a8e393cc..72ac833c 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java @@ -28,14 +28,14 @@ public interface RepairWorkerService extends IService { **/ void saveWorkers(List userList); + /** - * 根据用户id查询对应维修的角色,维修工人则查询班组,非维修工人查询角色 + * 查询所有维修工 * @author PQZ - * @date 17:21 2024/11/4 - * @param userId 用户id - * @return java.lang.String + * @date 14:07 2024/11/7 + * @return java.util.List **/ - String getWorkerRoleName(Long userId); + List listAllWorker(); /** * 更新维修工人 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java index d3c8d0fb..db3ad74a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java @@ -1,23 +1,29 @@ package cn.iocoder.yudao.module.base.service.impl; +import cn.iocoder.yudao.common.RepairRoleEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.base.entity.RepairRecords; import cn.iocoder.yudao.module.base.entity.RepairRecordsItem; +import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.mapper.RepairRecordsMapper; import cn.iocoder.yudao.module.base.service.RepairRecordsItemService; import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairWorkerService; import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO; import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO; +import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO; +import cn.iocoder.yudao.module.system.api.permission.PermissionApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import static cn.iocoder.yudao.common.BaseConstants.REPAIR_RECORD_TYPE_RECORD; @@ -39,7 +45,9 @@ public class RepairRecordsServiceImpl extends ServiceImpl queryList(RepairRecordsPageReqVO pageReqVO) { //根据条件查询维修记录 List list = repairRecordsMapper.queryRepairRecords(pageReqVO); + List userIds = list.stream().map(RepairRecords::getDealUserId).collect(Collectors.toList()); + //所有维修工 + List allWorker = workerService.listAllWorker(); + //转换成map + Map mapWorker = allWorker.stream().collect(Collectors.toMap(RepairWorker::getUserId,worker -> worker)); + //用户及角色 + Map> userRoleMap = permissionApi.roleCodesByUserIds(userIds); //为每一条维修记录设置查询附件 list.forEach(item -> { - item.setRoleName(workerService.getWorkerRoleName(item.getDealUserId())); + String workerName = mapWorker.getOrDefault(item.getDealUserId(),new RepairWorkerRespVO()).getWorkerTypeStr(); + if (null != workerName) { + item.setRoleName(workerName); + } else { + item.setRoleName(getRoleName(userRoleMap.get(item.getDealUserId()))); + } List itemList = itemService.getByMainId(REPAIR_RECORD_TYPE_RECORD, item.getId(), pageReqVO.getIsOpen()); item.setItemList(itemList); //相对路径按照“,”分隔 @@ -94,6 +114,37 @@ public class RepairRecordsServiceImpl extends ServiceImpl codes) { + //维修业务管理员 + if (codes.contains(RepairRoleEnum.ADMIN.getCode())) { + return RepairRoleEnum.ADMIN.getName(); + } + // 总检 + if (codes.contains(RepairRoleEnum.INSPECTION.getCode())) { + return RepairRoleEnum.INSPECTION.getName(); + } + // 服务顾问 + if (codes.contains(RepairRoleEnum.ADVISOR.getCode())) { + return RepairRoleEnum.ADVISOR.getName(); + } + // 维修仓库管理员 + if (codes.contains(RepairRoleEnum.WAREHOUSE.getCode())) { + return RepairRoleEnum.WAREHOUSE.getName(); + } + // 维修财务 + if (codes.contains(RepairRoleEnum.WXCW.getCode())) { + return RepairRoleEnum.WXCW.getName(); + } + return null; + } + /** * 根据当前用户和工单主表id查询当前在维修的项目信息 * diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java index 5128a232..52f29168 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java @@ -1,10 +1,8 @@ package cn.iocoder.yudao.module.base.service.impl; import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.common.RepairRoleEnum; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; -import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.module.app.controller.admin.NotifyMessageSocket; @@ -22,9 +20,6 @@ import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi; import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO; import cn.iocoder.yudao.module.system.api.permission.PermissionApi; import cn.iocoder.yudao.module.system.api.permission.RoleApi; -import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO; -import cn.iocoder.yudao.module.system.api.user.AdminUserApi; -import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; @@ -39,7 +34,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import org.yaml.snakeyaml.events.Event; import javax.annotation.Resource; import java.io.IOException; @@ -116,50 +110,18 @@ public class RepairWorkerServiceImpl extends ServiceImpl * @author PQZ - * @date 17:21 2024/11/4 + * @date 14:07 2024/11/7 **/ @Override - public String getWorkerRoleName(Long userId) { - RepairWorkerRespVO worker = workerMapper.getByUserId(userId); - //如果为空说明不是维修工,查询当前用户的角色 - if (null != worker) { - return worker.getWorkerTypeStr(); - } else { - List roleIds = permissionApi.getRoleIdsByUserId(userId); - // 所有的角色信息 - List roleList = roleApi.getRoleList(); - // 过滤出登录用户有的角色信息 - List collect = roleList.stream().filter(item -> roleIds.contains(item.getId())).collect(Collectors.toList()); - // 取出角色code - List codes = collect.stream().map(RoleReqDTO::getCode).collect(Collectors.toList()); - //维修业务管理员 - if (codes.contains(RepairRoleEnum.ADMIN.getCode())) { - return RepairRoleEnum.ADMIN.getName(); - } - // 总检 - if (codes.contains(RepairRoleEnum.INSPECTION.getCode())) { - return RepairRoleEnum.INSPECTION.getName(); - } - // 服务顾问 - if (codes.contains(RepairRoleEnum.ADVISOR.getCode())) { - return RepairRoleEnum.ADVISOR.getName(); - } - // 维修仓库管理员 - if (codes.contains(RepairRoleEnum.WAREHOUSE.getCode())) { - return RepairRoleEnum.WAREHOUSE.getName(); - } - // 维修财务 - if (codes.contains(RepairRoleEnum.WXCW.getCode())) { - return RepairRoleEnum.WXCW.getName(); - } - } - return null; + public List listAllWorker() { + return workerMapper.listAllWorker(); } @Override diff --git a/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml b/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml index 68b75801..bfd5afe6 100644 --- a/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml @@ -48,6 +48,16 @@ main.deleted = 0 AND main.user_id = #{userId} + diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApi.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApi.java index 914e1005..a4931512 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApi.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApi.java @@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespD import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Set; /** @@ -73,6 +74,15 @@ public interface PermissionApi { **/ List getRoleIdsByUserId(Long userId); + /** + * 通过用户id查询角色 + * @author PQZ + * @date 14:29 2024/11/7 + * @param userIds 用户id集合 + * @return key用户id,value角色codes + **/ + Map> roleCodesByUserIds(List userIds); + /** * 根据权限ID拿拥有该权限的所有人 * @author 小李 diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/dto/UserRoleDTO.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/dto/UserRoleDTO.java new file mode 100644 index 00000000..fb49c588 --- /dev/null +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/dto/UserRoleDTO.java @@ -0,0 +1,9 @@ +package cn.iocoder.yudao.module.system.api.user.dto; + +import lombok.Data; + +@Data +public class UserRoleDTO { + private Long userId; + private String roleCode; +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApiImpl.java index 01154e35..2df4b009 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApiImpl.java @@ -1,12 +1,14 @@ package cn.iocoder.yudao.module.system.api.permission; import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespDTO; +import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @@ -77,6 +79,21 @@ public class PermissionApiImpl implements PermissionApi { return roleIds.stream().collect(Collectors.toList()); } + /** + * 通过用户id查询角色 + * + * @param userIds 用户id集合 + * @return key用户id,value角色codes + * @author PQZ + * @date 14:29 2024/11/7 + **/ + @Override + public Map> roleCodesByUserIds(List userIds) { + List userRoleDTOList = permissionService.userRoleDTOList(userIds); + Map> resultMap = userRoleDTOList.stream().collect(Collectors.groupingBy(UserRoleDTO::getUserId,Collectors.mapping(UserRoleDTO::getRoleCode,Collectors.toList()))); + return resultMap; + } + /** * 根据权限ID拿拥有该权限的所有人 * @author 小李 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java index a1a489cc..1ee41bef 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java @@ -1,8 +1,8 @@ package cn.iocoder.yudao.module.system.dal.mysql.permission; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; +import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -42,4 +42,13 @@ public interface UserRoleMapper extends BaseMapperX { List selectByRoleCode(@Param("tenantId") Long tenantId, @Param("roleCode") String roleCode); IPage selectListByRoleId(@Param("page") Page page,@Param("role") RolePageReqVO role); + + /** + * 通过用户id查询用户关联角色code + * @author PQZ + * @date 14:39 2024/11/7 + * @param userIds 用户id集合 + * @return java.util.List + **/ + List userCodes(@Param("userIds") List userIds); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionService.java index 07dda53f..3dd7c59e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionService.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.system.service.permission; import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespDTO; +import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO; import java.util.Collection; import java.util.List; @@ -26,6 +27,15 @@ public interface PermissionService { */ boolean hasAnyPermissions(Long userId, String... permissions); + /** + * 查询用户及角色 + * @author PQZ + * @date 14:42 2024/11/7 + * @param userIds 用户id + * @return java.util.List + **/ + List userRoleDTOList(List userIds); + /** * 判断是否有角色,任一一个即可 * diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java index 51e1c8dd..f5bc4295 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java @@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespDTO; +import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleMenuDO; @@ -38,7 +39,6 @@ import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; -import static javafx.scene.input.KeyCode.H; /** * 权限 Service 实现类 @@ -87,6 +87,19 @@ public class PermissionServiceImpl implements PermissionService { return roleService.hasAnySuperAdmin(convertSet(roles, RoleDO::getId)); } + /** + * 查询用户及角色 + * + * @param userIds 用户id + * @return java.util.List + * @author PQZ + * @date 14:42 2024/11/7 + **/ + @Override + public List userRoleDTOList(List userIds) { + return userRoleMapper.userCodes(userIds); + } + /** * 判断指定角色,是否拥有该 permission 权限 * diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml index ced943c8..c9850c51 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml @@ -35,4 +35,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + From 29939dc277cd50adebd92698801e20ec0ec83d7c Mon Sep 17 00:00:00 2001 From: Vinjor Date: Mon, 11 Nov 2024 10:03:13 +0800 Subject: [PATCH 40/51] 1 --- .../custom/service/impl/CustomerMainServiceImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java index 93c60d2b..f21f34d3 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java @@ -41,9 +41,7 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; import static cn.iocoder.yudao.common.BaseConstants.*; import static cn.iocoder.yudao.common.DictBaseConstants.DICT_CUS_TYPE; @@ -120,7 +118,7 @@ public class CustomerMainServiceImpl extends ServiceImpl roleCodes = new HashSet<>(); - roleCodes.add(dict.getRemark()); - permissionApi.assignUserRole(userId, roleCodes); + //绑定角色----客户不设置角色 +// Set roleCodes = new HashSet<>(); +// roleCodes.add(dict.getRemark()); +// permissionApi.assignUserRole(userId, roleCodes); } /*3、保存客户主表信息*/ //暂时写死会员id TODO From abfcc953ea8c33acf651996f867eb0c16b9ea6dd Mon Sep 17 00:00:00 2001 From: Vinjor Date: Mon, 11 Nov 2024 10:03:13 +0800 Subject: [PATCH 41/51] 1 (cherry picked from commit 29939dc277cd50adebd92698801e20ec0ec83d7c) --- .../custom/service/impl/CustomerMainServiceImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java index 93c60d2b..f21f34d3 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java @@ -41,9 +41,7 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; import static cn.iocoder.yudao.common.BaseConstants.*; import static cn.iocoder.yudao.common.DictBaseConstants.DICT_CUS_TYPE; @@ -120,7 +118,7 @@ public class CustomerMainServiceImpl extends ServiceImpl roleCodes = new HashSet<>(); - roleCodes.add(dict.getRemark()); - permissionApi.assignUserRole(userId, roleCodes); + //绑定角色----客户不设置角色 +// Set roleCodes = new HashSet<>(); +// roleCodes.add(dict.getRemark()); +// permissionApi.assignUserRole(userId, roleCodes); } /*3、保存客户主表信息*/ //暂时写死会员id TODO From 25987034e126972944d5e22803664cc353d0aa5e Mon Sep 17 00:00:00 2001 From: 13405411873 <1994398261@qq.com> Date: Mon, 11 Nov 2024 10:22:03 +0800 Subject: [PATCH 42/51] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E5=B7=A5=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 0e6aa49c68a3127dda660a990de62816144d5f58) --- .../impl/PartnerCustomerInfoServiceImpl.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java index 834a7a1b..d46b8020 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java @@ -161,13 +161,13 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl ids = new HashSet<>(); - ids.add(sysRole.getId()); - permissionService.assignUserRole(user.getId(), ids); - } +// // 角色分配 +// if (!StringUtils.isEmpty(partnerCustomerInfo.getRoleCode())) { +// RoleDO sysRole = roleService.queryRole(partnerCustomerInfo.getRoleCode()); +// Set ids = new HashSet<>(); +// ids.add(sysRole.getId()); +// permissionService.assignUserRole(user.getId(), ids); +// } // 车辆信息处理 List userCarList = partnerCustomerInfo.getUserCarList(); @@ -270,6 +270,7 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl Date: Mon, 11 Nov 2024 18:25:54 +0800 Subject: [PATCH 43/51] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E5=B7=A5=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspection/service/impl/InspectionInfoServiceImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java index 461a7ba5..19b7dad8 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java @@ -400,8 +400,6 @@ public class InspectionInfoServiceImpl extends ServiceImpl Date: Tue, 12 Nov 2024 09:48:14 +0800 Subject: [PATCH 44/51] =?UTF-8?q?=E6=94=B9=E9=85=8D=E4=BB=B6=E7=94=B3?= =?UTF-8?q?=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DlRepairSoServiceImpl.java | 2 - .../controller/admin/DlTwItemController.java | 17 ---- .../module/tickets/entity/DlTicketWares.java | 47 +++++----- .../yudao/module/tickets/entity/DlTwItem.java | 46 ++++------ .../impl/DlTicketWaresServiceImpl.java | 92 ++++++++++++------- .../mapper/tickets/DlTicketWaresMapper.xml | 62 ++++++++----- .../mapper/tickets/DlTwItemMapper.xml | 34 ++++--- .../src/main/resources/application-local.yaml | 1 + 8 files changed, 160 insertions(+), 141 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java index 0b82966c..958c975f 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java @@ -242,11 +242,9 @@ public class DlRepairSoServiceImpl extends ServiceImpl i.getGoodsId().equals(item.getWaresId())).findFirst().ifPresent(repairSoiByTwItem -> { if (so.getSoType().equals("02")){ dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoiByTwItem.getGoodsCount()); - dlTwItem.setWaresCouldCount(item.getWaresCouldCount() + repairSoiByTwItem.getGoodsCount()); dlTwItem.setWaresStatus("02"); }else { dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() + repairSoiByTwItem.getGoodsCount()); - dlTwItem.setWaresCouldCount(item.getWaresCouldCount() - repairSoiByTwItem.getGoodsCount()); } }); newTwItems.add(dlTwItem); diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTwItemController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTwItemController.java index 20ad5e12..2880b57c 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTwItemController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTwItemController.java @@ -41,22 +41,5 @@ public class DlTwItemController { public CommonResult listTwItem(DlTwItemReqVO reqVO){ return success(dlTwItemService.listTwItem(reqVO)); } - - /** - * 配件客户是否可见 - * - * @author 小李 - * @date 17:55 2024/10/15 - * @param reqVO 请求对象 - **/ - @GetMapping("/isShow") - @Operation(summary = "配件客户是否可见") - public CommonResult updateIsShow(DlTwItemReqVO reqVO){ - DlTwItem dlTwItem = new DlTwItem(); - dlTwItem.setIsShow(reqVO.getIsShow()); - dlTwItem.setId(reqVO.getId()); - dlTwItemService.updateById(dlTwItem); - return CommonResult.ok(); - } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java index d7538e15..259efddf 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.Date; + /** * 工单配件申请/退回表 * @@ -17,34 +19,31 @@ import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode(callSuper = true) public class DlTicketWares extends TenantBaseDO { - /** - * 主键标识 - */ + + /** 主键标识 */ @TableId(type = IdType.ASSIGN_ID) private String id; - /** - * 单据号(自动生成) - */ + /** 单据号(自动生成) */ private String no; - /** - * 工单ID(dl_repair_tickets表的ID) - */ + /** 工单ID(dl_repair_tickets表的ID) */ private String ticketId; - /** - * 类型(01:领料,02:退料,ticket_wares_type) - */ - private String type; + /** 用户ID(dl_customer_main的userId) */ + private Long userId; - /** - * 状态(01:待审核,02已通过,03:全部完成,04:部分完成,05:已驳回,ticket_wares_status) - */ - private String status; + /** 用户名称(base_customer_main的cusName) */ + private String userName; - /** 备注 */ - private String remark; + /** 用户电话(base_customer_main的phoneNumber) */ + private String userMobile; + + /** 车辆ID(base_car_main的ID) */ + private String carId; + + /** 客户车辆的车牌号(dl_repair_tickets中的carNo) */ + private String licenseNumber; /** 发起人ID(dl_repair_worker的user_id) */ private Long repairId; @@ -52,12 +51,18 @@ public class DlTicketWares extends TenantBaseDO { /** 发起人name(dl_repair_worker的user_name) */ private String repairName; + /** 申请人岗位(dl_repair_worker的workType) */ + private String repairWork; + /** 维修顾问ID(system_users的ID) */ private Long adviserId; /** 维修顾问name(system_user的nickname) */ private String adviserName; - /** 客户车辆的车牌号(dl_repair_tickets中的carNo) */ - private String licenseNumber; + /** 状态:01待审批、02已审批、03已驳回,ticket_wares_status */ + private String status; + + /** 备注 */ + private String remark; } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTwItem.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTwItem.java index 6537f372..fb1b0351 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTwItem.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTwItem.java @@ -21,49 +21,35 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper = true) public class DlTwItem extends TenantBaseDO { - /** - * 主键标识 - */ + + /** 主键标识 */ @TableId(type = IdType.ASSIGN_ID) private String id; - /** - * 主表ID(dl_ticket_wares表的ID) - */ + /** 主表ID(dl_ticket_wares表的ID) */ private String twId; - /** - * 配件ID - */ + /** 配件ID */ private String waresId; - /** - * 配件名称 - */ + /** 配件名称 */ private String waresName; - /** - * 配件数量 - */ + /** 配件数量 */ private Integer waresCount; - /** - * 配件状态(01:已领料,02:未领料,03:已退料,04可确认领料,可确认退料 tw_item_status) - */ + /** 已领取数量 */ + private Integer waresAlreadyCount; + + /** 配件状态:使用字典yes_no,1通过,0没通过 */ private String waresStatus; + /** 审核人ID(system_users的ID) */ + private Long handleId; + + /** 审核人姓名(system_users的nickname) */ + private String handleName; + /** 备注 */ private String remark; - - /** 客户是否可见(字典yes_no);已存在于系统中(是:1,否:0) */ - private String isShow; - - /** 可领取数量 */ - private Integer waresCouldCount; - - /** 已领料数量 */ - private Integer waresAlreadyCount; - - /** 已退数量 */ - private Integer waresBackCount; } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java index 4c86ae7c..66e524db 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.tickets.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.common.RecordTypeEnum; @@ -11,6 +12,8 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairWorkerService; +import cn.iocoder.yudao.module.custom.entity.CustomerMain; +import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.project.entity.RepairWares; import cn.iocoder.yudao.module.project.service.RepairWaresService; import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi; @@ -99,6 +102,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId())); - respVO.setRepairId(one.getUserId()); - respVO.setRepairName(one.getUserName()); - baseMapper.insertOrUpdate(respVO); + DlTicketWares ticketWares = BeanUtil.toBean(respVO, DlTicketWares.class); + /* + 设置信息 + */ + // 用户信息 + DlRepairTickets tickets = repairTicketsService.getById(ticketWares.getTicketId()); + CustomerMain customerMain = customerMainService.getById(tickets.getUserId()); + ticketWares.setUserId(customerMain.getUserId()); + ticketWares.setUserName(customerMain.getCusName()); + ticketWares.setUserMobile(customerMain.getPhoneNumber()); + // 车辆信息 + ticketWares.setCarId(tickets.getCarId()); + ticketWares.setLicenseNumber(tickets.getCarNo()); + // 发起人信息 + RepairWorker worker = repairWorkerService.getOne(new LambdaQueryWrapper().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId())); + ticketWares.setRepairId(worker.getUserId()); + ticketWares.setRepairName(worker.getUserName()); + ticketWares.setRepairWork(worker.getWorkType()); + // 服务顾问信息 + ticketWares.setAdviserId(Long.valueOf(tickets.getAdviserId())); + ticketWares.setAdviserName(tickets.getAdviserName()); + + baseMapper.insertOrUpdate(ticketWares); + // 新增、修改子表 - List list = respVO.getItems().stream().map(item -> item.setTwId(respVO.getId())).collect(Collectors.toList()); + List list = respVO.getItems().stream() + .map(item -> { + DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class); + twItem.setTwId(ticketWares.getId()); + twItem.setWaresStatus("0"); + return twItem; + }).collect(Collectors.toList()); if (CollectionUtil.isEmpty(list)) { throw exception0(500, "配件列表为空"); } @@ -190,7 +222,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl(); @@ -443,10 +472,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl { // 取本来的已领取数量-本次要退料的数量 dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoi.getGoodsCount()); - // 可领取数量就是上次的可领取+退料数量 - // item是操作的可领取数量,repairSoi是取本次退料的数量 - dlTwItem.setWaresCouldCount(item.getWaresCouldCount() + repairSoi.getGoodsCount()); // dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus()); // 如果可领料数量等于申请数量,那这个配件就是退料完了,为03已退料,反之不变 - dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresCouldCount()) ? "03" : "02"); + dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "1" : "0"); }); return dlTwItem; }).collect(Collectors.toList()); @@ -537,21 +559,22 @@ public class DlTicketWaresServiceImpl extends ServiceImpl list = twItemService.list(new LambdaQueryWrapper().eq(DlTwItem::getTwId, respVO.getId())); - List list1 = list.stream().filter(item -> item.getWaresStatus().equals(respVO.getType().equals("01") ? "01" : "03")).collect(Collectors.toList()); - respVO.setStatus(list1.size() == list.size() ? "03" : "04"); - baseMapper.updateById(respVO); - // 操作库存 - list.forEach(item -> { - repairWaresService.update(new LambdaUpdateWrapper() - .setSql("stock = stock" + (respVO.getType().equals("01") ? "-" : "+") + item.getWaresCount()) - .eq(RepairWares::getId, item.getWaresId()) - ); - }); + // todo +// // 更新领料申请子表 +// twItemService.updateBatchById(respVO.getItems()); +// // 更新领料申请表 +// // 判断是全部完成完成部分完成 +// List list = twItemService.list(new LambdaQueryWrapper().eq(DlTwItem::getTwId, respVO.getId())); +// List list1 = list.stream().filter(item -> item.getWaresStatus().equals(respVO.getType().equals("01") ? "01" : "03")).collect(Collectors.toList()); +// respVO.setStatus(list1.size() == list.size() ? "03" : "04"); +// baseMapper.updateById(respVO); +// // 操作库存 +// list.forEach(item -> { +// repairWaresService.update(new LambdaUpdateWrapper() +// .setSql("stock = stock" + (respVO.getType().equals("01") ? "-" : "+") + item.getWaresCount()) +// .eq(RepairWares::getId, item.getWaresId()) +// ); +// }); } /** @@ -601,8 +624,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl getWorkerTodo() { LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(DlTicketWares::getRepairId, loginUser.getId()) - .eq(DlTicketWares::getType, "01"); + .eq(DlTicketWares::getRepairId, loginUser.getId()); List list = this.list(queryWrapper); Map rtnMap = new HashMap<>(); //所有提交的 diff --git a/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml b/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml index 3269b989..7d44fb5d 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml @@ -5,30 +5,42 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + select - dtw.id as id,no,ticket_id, - type,status,dtw.remark as remark, - dtw.repair_id as repair_id, - dtw.repair_name as repair_name, - dtw.adviser_id as adviser_id, - dtw.adviser_name as adviser_name, - dtw.license_number as license_number, - dtw.create_time as create_time + dtw.id, + dtw.no, + dtw.ticket_id, + dtw.user_id, + dtw.user_name, + dtw.user_mobile, + dtw.car_id, + dtw.license_number, + dtw.repair_id, + dtw.repair_name, + dtw.repair_work, + dtw.adviser_id, + dtw.adviser_name, + dtw.status, + dtw.remark, + dtw.create_time from dl_ticket_wares dtw left join dl_repair_tickets drt on dtw.ticket_id = drt.id @@ -46,8 +58,14 @@ dtw.license_number like concat('%', #{map.query}, '%') ) - - and (dtw.type = #{map.type}) + + and dtw.license_number like concat('%', #{map.licenseNumber}, '%') + + + and dtw.user_mobile like concat('%', #{map.userMobile}, '%') + + + and dtw.repair_name like concat('%', #{map.repairName}, '%') and (dtw.status = #{map.status}) diff --git a/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml b/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml index 39fbf92c..9200d38b 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml @@ -5,24 +5,30 @@ - - - - - - - - - - - + + + + + + + + + + select - id,tw_id,wares_id, - wares_name,wares_count,wares_status,remark, - is_show,wares_could_count, wares_already_count, wares_back_count + id, + tw_id, + wares_id, + wares_name, + wares_count, + wares_already_count, + wares_status, + handle_id, + handle_name, + remark from dl_tw_item dti where dti.deleted = '0' diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 1b9cd8ce..ae71216a 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -47,6 +47,7 @@ spring: datasource: master: url: jdbc:mysql://122.51.230.86:3306/lanan_platform_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 +# url: jdbc:mysql://122.51.230.86:3306/lanan_platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 From 26cc95e827cd6893cc23474690e2487bb282beff Mon Sep 17 00:00:00 2001 From: Vinjor Date: Tue, 12 Nov 2024 11:24:12 +0800 Subject: [PATCH 45/51] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E8=AF=A6=E6=83=85=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/custom/CarMainMapper.xml | 4 +- .../impl/RepairRecordsServiceImpl.java | 6 +-- .../impl/DlRepairTicketsServiceImpl.java | 2 +- .../mapper/base/RepairRecordsMapper.xml | 42 ++++++++++++++++--- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml b/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml index 11b4ffd0..6cffa5c4 100644 --- a/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml +++ b/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml @@ -85,12 +85,10 @@ SELECT , bcb.brand_name AS brandStr, - bcb.logo_img AS logoImg, - bcm.model_name AS modelStr + bcb.logo_img AS logoImg FROM `base_car_main` tbcm LEFT JOIN base_car_brand bcb ON bcb.deleted = 0 AND tbcm.car_brand = bcb.id - LEFT JOIN base_car_model bcm ON bcm.deleted = 0 AND tbcm.car_model = bcm.id WHERE tbcm.deleted = 0 AND diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java index db3ad74a..fde8d479 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java @@ -26,8 +26,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static cn.iocoder.yudao.common.BaseConstants.REPAIR_RECORD_TYPE_RECORD; - /** * 维修记录 Service 实现类 * @@ -106,10 +104,8 @@ public class RepairRecordsServiceImpl extends ServiceImpl itemList = itemService.getByMainId(REPAIR_RECORD_TYPE_RECORD, item.getId(), pageReqVO.getIsOpen()); - item.setItemList(itemList); //相对路径按照“,”分隔 - item.setImages(itemList.stream().map(RepairRecordsItem::getImage).collect(Collectors.joining(","))); + item.setImages(item.getItemList().stream().map(RepairRecordsItem::getImage).collect(Collectors.joining(","))); }); return list; } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 6f0b41ab..a4605b3e 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -342,7 +342,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl itemList = titemService.list(new LambdaQueryWrapper().eq(DlRepairTitem::getTicketId, id)); diff --git a/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml b/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml index 83ecb10f..6b9f4cee 100644 --- a/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml @@ -8,14 +8,43 @@ 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ --> - - SELECT main.*, - drt.item_name AS projectName + drt.item_name AS projectName, + drri.id AS item_id, + drri.record_id AS item_record_id, + drri.ticket_id AS item_ticket_id, + drri.repair_item_id AS item_repair_item_id, + drri.remark AS item_remark, + drri.image AS item_image, + drri.is_open AS item_is_open, + drri.create_time AS item_create_time FROM dl_repair_records main LEFT JOIN dl_repair_titem drt ON main.repair_item_id = drt.id AND drt.deleted = 0 + LEFT JOIN dl_repair_records_item drri ON main.id = drri.record_id - main.deleted = '0' + main.deleted = '0' AND drri.deleted = '0' AND main.ticket_id = #{entity.ticketId} @@ -28,8 +57,11 @@ AND main.type = #{entity.type} + + AND drri.is_open = #{entity.type} + - order by main.create_time desc + order by main.create_time desc,drri.create_time + From 3c3c173ff62118aeaa791ad10033a4e26577bd3e Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Tue, 12 Nov 2024 17:44:06 +0800 Subject: [PATCH 47/51] =?UTF-8?q?=E6=94=B9=E9=85=8D=E4=BB=B6=E7=94=B3?= =?UTF-8?q?=E8=AF=B7100%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DlRepairSoServiceImpl.java | 6 +- .../module/tickets/entity/DlTicketWares.java | 2 +- .../impl/DlRepairTicketsServiceImpl.java | 17 +- .../impl/DlTicketWaresServiceImpl.java | 226 ++++++++---------- .../module/tickets/vo/DlTicketWaresReqVO.java | 2 +- .../mapper/tickets/DlTicketWaresMapper.xml | 42 ++-- 6 files changed, 133 insertions(+), 162 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java index 958c975f..6e420e7f 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java @@ -256,9 +256,11 @@ public class DlRepairSoServiceImpl extends ServiceImpl i.getGoodsId().equals(wares.getId())).findFirst().ifPresent(repairSoiByWares -> { if (so.getSoType().equals("02")){ wares.setStock(item.getStock().add(BigDecimal.valueOf(repairSoiByWares.getGoodsCount()))); - }else { - wares.setStock(item.getStock().subtract(BigDecimal.valueOf(repairSoiByWares.getGoodsCount()))); } + // 采购改了入库逻辑,不能在这里扣库存 +// else { +// wares.setStock(item.getStock().subtract(BigDecimal.valueOf(repairSoiByWares.getGoodsCount()))); +// } }); newWares.add(wares); }); diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java index 259efddf..9c6f7e8c 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java @@ -60,7 +60,7 @@ public class DlTicketWares extends TenantBaseDO { /** 维修顾问name(system_user的nickname) */ private String adviserName; - /** 状态:01待审批、02已审批、03已驳回,ticket_wares_status */ + /** 状态:01待审批、02已审批,ticket_wares_status */ private String status; /** 备注 */ diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 6f0b41ab..1d78bf57 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -1244,20 +1244,21 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl status = new ArrayList<>(); - status.add("01"); // 待审核 - status.add("05"); // 已驳回 - // 查工单所有已通过的配件申请单 + // 先查满足条件的申请表---配件申请表现在只有待审批和已审批,并且其子表的数据也可能同时有两种情况 +// ArrayList status = new ArrayList<>(); +// status.add("01"); // 待审核 +// status.add("05"); // 已驳回 + // 查工单所有已通过的配件申请单----这里直接查全部 List list = ticketWaresService.list(new LambdaQueryWrapper().and(item -> { - item.eq(DlTicketWares::getTicketId, id) - .notIn(DlTicketWares::getStatus, status); + item.eq(DlTicketWares::getTicketId, id); +// .notIn(DlTicketWares::getStatus, status); })); if (CollectionUtil.isNotEmpty(list)) { - // 查配件申请表的所有已领取数量小于申请数量的子表信息 + // 查配件申请表的所有已领取数量小于申请数量的子表信息----这里需要加上一个条件,得是审核通过的才行 List ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList()); List twItems = twItemService.list(new LambdaQueryWrapper().and(item -> { item.in(DlTwItem::getTwId, ids) + .eq(DlTwItem::getWaresStatus, "1") .apply("wares_already_count < wares_count"); })); if (CollectionUtil.isNotEmpty(twItems)) { diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java index 66e524db..9cd3c50e 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java @@ -9,6 +9,7 @@ import cn.iocoder.yudao.common.SoStatusEnum; import cn.iocoder.yudao.common.TicketsItemStatusEnum; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairWorkerService; @@ -138,7 +139,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl { DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class); twItem.setTwId(ticketWares.getId()); - twItem.setWaresStatus("0"); + twItem.setWaresStatus(""); + twItem.setWaresAlreadyCount(0); return twItem; }).collect(Collectors.toList()); if (CollectionUtil.isEmpty(list)) { @@ -260,115 +261,87 @@ public class DlTicketWaresServiceImpl extends ServiceImpl repairItemList = respVO.getWares(); - DlTicketWares updateObj = this.getById(mainId); - String ticketMainId = updateObj.getTicketId(); - updateObj.setStatus(status); - this.updateById(updateObj); - // 如果是通过并且是领料就还需要把配件信息加入到工单中 - if (ObjectUtil.isNotEmpty(status) && status.equals("02")) { - // 更新维修工单 - if(null!=respVO.getRepairWaresList()){ - repairItemList= new ArrayList<>(); - //走的是更新配件库价格 - Map updateMap = respVO.getRepairWaresList().stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getPrice)); - //更新配件库的价格 - List updateWaresList = new ArrayList<>(); - //去库里面查需要的配件 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(DlTwItem::getTwId, mainId); - List applyList = twItemService.list(queryWrapper); - if (!applyList.isEmpty()) { - //查配件库 - List waresList = repairWaresService.listByIds(applyList.stream().map(DlTwItem::getWaresId).collect(Collectors.toList())); - Map waresMap = waresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity())); - //组装工单子表数据 - for (DlTwItem item : applyList) { - DlRepairTitem repairTitem = new DlRepairTitem(); - repairTitem.setTicketId(ticketMainId); - repairTitem.setItemCount(item.getWaresCount()); - repairTitem.setItemName(item.getWaresName()); - repairTitem.setItemUnit(waresMap.get(item.getWaresId()).getUnit()); - //取前端传过来的销售价格 - repairTitem.setItemPrice(updateMap.get(item.getId())); - //默认不打折为1 - repairTitem.setItemDiscount(new BigDecimal(1)); - repairTitem.setItemMoney(new BigDecimal(repairTitem.getItemCount()).multiply(repairTitem.getItemPrice())); - //类型是配件 - repairTitem.setItemType("02"); - repairTitem.setPartId(item.getWaresId()); - repairTitem.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode()); - repairItemList.add(repairTitem); - //组装配件库更新价格 - RepairWares update = new RepairWares(); - update.setId(item.getWaresId()); - update.setPrice(updateMap.get(item.getId())); - updateWaresList.add(update); + // 取出前端操作的配件申请表的子项id + List twItemIds = respVO.getItems().stream().map(DlTwItem::getId).collect(Collectors.toList()); + // 查所有的子项 + List twItems = twItemService.listByIds(twItemIds); + // 取所有的配件信息 + List wareIds = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList()); + List repairWares = repairWaresService.listByIds(wareIds); + // 更新配件申请表子表 + List newTwitems = twItemIds.stream().map(item -> { + DlTwItem twItem = new DlTwItem(); + twItem.setId(item); + twItem.setWaresStatus(status.equals("01") ? "1" : "0"); + twItem.setHandleId(SecurityFrameworkUtils.getLoginUserId()); + twItem.setHandleName(SecurityFrameworkUtils.getLoginUserNickname()); + return twItem; + }).collect(Collectors.toList()); + twItemService.updateBatchById(newTwitems); + // 更新配件申请主表 + List allTwitems = twItemService.list(new LambdaQueryWrapper().in(DlTwItem::getTwId, respVO.getId())); + List passTwitems = allTwitems.stream().filter(item -> item.getWaresStatus().equals("1") || item.getWaresStatus().equals("0")).collect(Collectors.toList()); + boolean isStatus = CollectionUtil.isNotEmpty(passTwitems) && passTwitems.size() == allTwitems.size(); + if (isStatus) { + baseMapper.update(new LambdaUpdateWrapper().set(DlTicketWares::getStatus, "02").eq(DlTicketWares::getId, respVO.getId())); + } + // 更新维修工单子表 + if (status.equals("01")) { + DlTicketWares ticketWares = baseMapper.selectById(respVO.getId()); + List titems = repairTitemService.list(new LambdaQueryWrapper().and(i -> { + i.in(DlRepairTitem::getTicketId, ticketWares.getTicketId()) + .eq(DlRepairTitem::getItemType, "02"); + })); + // 要修改的 + List updateTitems = titems.stream().filter(item -> wareIds.contains(item.getPartId())).collect(Collectors.toList()); + // 修改 + if (CollectionUtil.isNotEmpty(updateTitems)) { + List newTitems = updateTitems.stream().map(item -> { + DlRepairTitem titem = new DlRepairTitem(); + titem.setId(item.getId()); + DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).findFirst().orElse(null); + if (twItem != null) { + titem.setItemCount(item.getItemCount() + twItem.getWaresCount()); + titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(item.getItemDiscount())); } - } - if(!updateWaresList.isEmpty()){ - repairWaresService.updateBatchById(updateWaresList); - } - } - // 更新维修工单子表----需要合并相同的配件,故修改 - // 先查维修工单的子表中的配件相关的信息 - List oldTitem = repairTitemService.list(new LambdaQueryWrapper().and(i -> i.eq(DlRepairTitem::getTicketId, ticketMainId).eq(DlRepairTitem::getItemType, "02"))); - // 过滤出新申请的配件里面有没有已经存在于工单子表的 - List waresIds = oldTitem.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList()); - List already = repairItemList.stream().filter(item -> waresIds.contains(item.getPartId())).collect(Collectors.toList()); - // 更新已经存在的配件 - if (CollectionUtil.isNotEmpty(already)) { - List updateItems = new ArrayList<>(); - already.forEach(item -> { - DlRepairTitem titem = oldTitem.stream().filter(i -> i.getPartId().equals(item.getPartId())).findFirst().orElse(null); - if (titem != null) { - DlRepairTitem newItem = new DlRepairTitem(); - newItem.setId(titem.getId()); - newItem.setItemCount(titem.getItemCount() + item.getItemCount()); - // 如果设置了折扣就用,没有就是1 - BigDecimal itemDiscount = titem.getItemDiscount() == null ? new BigDecimal(1) : titem.getItemDiscount(); - // titem取价格、newItem取数量 - newItem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(newItem.getItemCount())).multiply(itemDiscount)); - updateItems.add(newItem); - } - }); - if (CollectionUtil.isNotEmpty(updateItems)) { - repairTitemService.updateBatchById(updateItems); - } - } - // 新增维修工单中没有的配件 - List newItems = repairItemList.stream().filter(item -> !waresIds.contains(item.getPartId())).collect(Collectors.toList()); - newItems.forEach(item -> { - // 主表id - item.setTicketId(ticketMainId); - // 类型为配件 - item.setItemType("02"); - // 状态为未领料 - item.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode()); - }); - repairTitemService.saveBatch(newItems); - - // 重新计算工单 - boolean flag = repairTicketsService.computeTicket(ticketMainId); - if (!flag) { - throw exception0(500, "系统异常"); - } - - // 更新仓库 - if (CollectionUtil.isNotEmpty(repairItemList)){ - List updateWares = repairItemList.stream().map(item -> { - RepairWares wares = new RepairWares(); - wares.setId(item.getPartId()); - wares.setPrice(item.getItemPrice()); - return wares; + return titem; }).collect(Collectors.toList()); - repairWaresService.updateBatchById(updateWares); + repairTitemService.updateBatchById(newTitems); + } + // 要新增的 + if (updateTitems.size() < wareIds.size()) { + List titemIds = updateTitems.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList()); + List newWares = repairWares.stream().filter(item -> !titemIds.contains(item.getId())).collect(Collectors.toList()); + // 新增 + List newTitems = newWares.stream().map(item -> { + DlRepairTitem titem = new DlRepairTitem(); + titem.setTicketId(ticketWares.getTicketId()); + titem.setItemType("02"); + titem.setItemName(item.getName()); + DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getId())).findFirst().orElse(null); + titem.setItemCount(twItem != null ? twItem.getWaresCount() : 0); + titem.setItemUnit(item.getUnit()); + titem.setItemPrice(item.getPrice() != null ? item.getPrice() : BigDecimal.ZERO); + titem.setItemDiscount(BigDecimal.ONE); + titem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount())); + titem.setRepairIds(String.valueOf(ticketWares.getRepairId())); + titem.setRepairNames(ticketWares.getRepairName()); + titem.setSaleId(ticketWares.getAdviserId()); + titem.setSaleName(ticketWares.getAdviserName()); + titem.setPartId(item.getId()); + titem.setItemStatus("04"); + titem.setRemark(twItem != null ? twItem.getRemark() : null); + return titem; + }).collect(Collectors.toList()); + repairTitemService.saveBatch(newTitems); + } + + // 更新维修工单主表 + boolean flag = repairTicketsService.computeTicket(ticketWares.getTicketId()); + if (!flag) { + throw exception0(500, "重新计算工单错误"); } // 发送通过的消息给仓库 @@ -378,14 +351,12 @@ public class DlTicketWaresServiceImpl extends ServiceImpl repairWorkerService.sentMessage(id, "您有新的配件申请单需要处理")); } } - // 如果是驳回,通知维修工 - if (status.equals("05")) { - // 发送没有通过的消息给员工 - DlTicketWares ticketWares = baseMapper.selectById(respVO.getId()); - repairWorkerService.sentMessage(ticketWares.getRepairId(), "您的配件申请单被驳回了"); - } + // 通知维修工 + DlTicketWares ticketWares = baseMapper.selectById(respVO.getId()); + repairWorkerService.sentMessage(ticketWares.getRepairId(), "您有新的配件申请单" + (status.equals("01") ? "审批通过了" : "被驳回了")); + //插入记录 - repairRecordsService.saveRepairRecord(respVO.getTicketId(),null,RecordTypeEnum.SPPJSQD.getCode(),"审批配件申请单",null); + repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, RecordTypeEnum.SPPJSQD.getCode(), "审批配件申请单", null); } /** @@ -450,14 +421,14 @@ public class DlTicketWaresServiceImpl extends ServiceImpl wares = repairWaresService.list(new LambdaQueryWrapper().in(RepairWares::getId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()))); - Map waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getName)); - String remarkStr=""; - for(DlRepairSoi item:respVO.getRepairSois()){ + Map waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId, RepairWares::getName)); + String remarkStr = ""; + for (DlRepairSoi item : respVO.getRepairSois()) { //组装通知领取配件的文字 - if(!"".equals(remarkStr)){ - remarkStr +=";"; + if (!"".equals(remarkStr)) { + remarkStr += ";"; } - remarkStr += waresNameMap.get(item.getGoodsId())+"x"+item.getGoodsCount(); + remarkStr += waresNameMap.get(item.getGoodsId()) + "x" + item.getGoodsCount(); } if (type.equals("02")) { // 领料 // 构造新数据 @@ -472,8 +443,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl From bb70fcb97fb7e4601420aee2b72fca345d64fb11 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Wed, 13 Nov 2024 09:49:33 +0800 Subject: [PATCH 50/51] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=A1=BE=E9=97=AE?= =?UTF-8?q?=E4=B8=8D=E5=81=9A=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=EF=BC=8C=E4=BB=96=E4=BB=AC=E4=B9=8B=E9=97=B4=E7=9A=84?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E8=83=BD=E5=A4=9F=E4=BA=92=E7=9B=B8=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E5=B9=B6=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tickets/service/impl/DlRepairTicketsServiceImpl.java | 4 ++-- .../tickets/service/impl/DlTicketWaresServiceImpl.java | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 1a4c1845..83451994 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -856,8 +856,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl Date: Wed, 13 Nov 2024 09:49:34 +0800 Subject: [PATCH 51/51] =?UTF-8?q?=E6=95=91=E6=8F=B4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/CustomerMainController.java | 21 ++--- .../custom/service/CustomerCarService.java | 12 +++ .../service/impl/CustomerCarServiceImpl.java | 88 ++++++++++++++++++- .../custom/vo/CustomerMainSaveReqVO.java | 8 +- 4 files changed, 112 insertions(+), 17 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java index 3bba72f7..252a7cd8 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java @@ -1,12 +1,8 @@ package cn.iocoder.yudao.module.custom.controller.admin; -import cn.hutool.http.HttpRequest; -import cn.hutool.http.HttpResponse; -import cn.hutool.http.HttpUtil; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.custom.entity.CustomerMain; +import cn.iocoder.yudao.module.custom.service.CustomerCarService; import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO; import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO; @@ -23,11 +19,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import javax.net.ssl.HttpsURLConnection; import javax.validation.Valid; - -import java.net.HttpURLConnection; -import java.net.URL; import java.util.List; import static cn.iocoder.yudao.common.BaseConstants.*; @@ -48,7 +40,8 @@ public class CustomerMainController { private CustomerMainService customerMainService; @Resource private BusiLabelService busiLabelService; - + @Resource + private CustomerCarService customerCarService; /** * 客户管理分页列表查询 * @@ -85,6 +78,14 @@ public class CustomerMainController { return success(true); } + + @PostMapping("/saveCustomerAndCar") + @Operation(summary = "保存客户及车辆信息") + public CommonResult saveCustomerAndCar(@RequestBody CustomerMainSaveReqVO saveReqVO) throws Exception { + customerCarService.saveCustomerAndCar(saveReqVO); + return success(true); + } + /** * 编辑客户 * diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerCarService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerCarService.java index 218231f8..75b63847 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerCarService.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerCarService.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.custom.service; import cn.iocoder.yudao.module.custom.entity.CustomerCar; +import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; @@ -23,4 +24,15 @@ public interface CustomerCarService extends IService { * @date 18:45 2024/8/3 **/ void bindCustomerCar(String mainId, String mainTable, List customerCars); + + + + /** + * 保存客户及车辆信息 + * @author PQZ + * @date 15:51 2024/11/12 + * @param saveReqVO CustomerMainSaveReqVO + * @return void + **/ + void saveCustomerAndCar(CustomerMainSaveReqVO saveReqVO) throws Exception; } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerCarServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerCarServiceImpl.java index 015b7c9b..5484f799 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerCarServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerCarServiceImpl.java @@ -1,19 +1,32 @@ package cn.iocoder.yudao.module.custom.service.impl; import cn.hutool.core.util.ObjectUtil; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.custom.entity.CarMain; import cn.iocoder.yudao.module.custom.entity.CustomerCar; +import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper; +import cn.iocoder.yudao.module.custom.service.CarMainService; import cn.iocoder.yudao.module.custom.service.CustomerCarService; +import cn.iocoder.yudao.module.custom.service.CustomerMainService; +import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; +import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import javax.annotation.Resource; import java.util.List; -import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CAR; -import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CUSTOMER; +import static cn.iocoder.yudao.common.BaseConstants.*; +import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS; /** * 客户车辆管理关联 @@ -24,6 +37,15 @@ import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CUSTOMER; @Validated public class CustomerCarServiceImpl extends ServiceImpl implements CustomerCarService { + @Resource + @Lazy + private CustomerMainService customerMainService; + @Resource + @Lazy + private CarMainService carMainService; + @Resource + @Lazy + private AdminUserApi adminUserApi; /** * 保存客户与车辆的关联关系 @@ -60,4 +82,66 @@ public class CustomerCarServiceImpl extends ServiceImpl carList; /**标签信息*/ List labelList; - - /** - * 微信openId - */ - private String openId; + /**客户车辆信息*/ + private CarMain car; } \ No newline at end of file