From 36d499dbd5089a7c50c1082bafeb0a056d1bad8d Mon Sep 17 00:00:00 2001 From: Vinjor Date: Thu, 9 Jan 2025 18:06:24 +0800 Subject: [PATCH] 1 --- .../module/custom/entity/CustomerMain.java | 7 ++ .../iocoder/yudao/common/RecordTypeEnum.java | 4 ++ .../cn/iocoder/yudao/common/RepairCons.java | 2 + .../admin/DlRepairTicketsController.java | 16 ++++- .../tickets/entity/DlRepairTickets.java | 15 ++++ .../impl/DlRepairTicketsServiceImpl.java | 70 ++++++++++++++++--- .../tickets/utils/TicketsOperateUtil.java | 20 ++++-- .../tickets/vo/DlRepairTicketsRespVO.java | 3 + .../mapper/tickets/DlRepairTicketsMapper.xml | 11 ++- 9 files changed, 130 insertions(+), 18 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CustomerMain.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CustomerMain.java index 00e583fd..6bea5c33 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CustomerMain.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CustomerMain.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.custom.entity; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -113,4 +114,10 @@ public class CustomerMain extends TenantBaseDO { */ private String isHangAccount; + /** + * 客户来源text + */ + @TableField(exist = false) + private String dataFromText; + } 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 cfaff6de..e5babda7 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 @@ -15,6 +15,10 @@ public enum RecordTypeEnum { * 创建工单 */ CJGD("cjgd","创建工单"), + /** + * 修改工单 + */ + XGGD("xggd","修改工单"), /** * 指派施工 */ diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairCons.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairCons.java index af9d8a3d..c7ad482c 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairCons.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairCons.java @@ -16,6 +16,8 @@ public class RepairCons { public static final String DICT_REPAIR_RECORDS_TYPE = "repair_records_type"; /**数据字典常量-repair_type-*/ public static final String DICT_REPAIR_TYPE = "repair_type"; + /**数据字典常量-cus_data_from-*/ + public static final String DICT_CUS_DATA_FROM = "cus_data_from"; /**数据字典常量-insurance_type-*/ public static final String DICT_INSURANCE_TYPE = "insurance_type"; /**数据字典常量-repair_unit-*/ 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 00729930..dcf83fc4 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 @@ -3,10 +3,12 @@ package cn.iocoder.yudao.module.tickets.controller.admin; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; +import cn.iocoder.yudao.common.RecordTypeEnum; import cn.iocoder.yudao.common.RepairCons; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.custom.entity.CarMain; import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.service.CarMainService; @@ -48,6 +50,8 @@ public class DlRepairTicketsController { private CustomerMainService customerMainService; @Resource private CarMainService carMainService; + @Resource + private RepairRecordsService repairRecordsService; /** @@ -105,7 +109,12 @@ public class DlRepairTicketsController { @GetMapping("/getById") @Operation(summary = "查工单主表信息") public CommonResult getById(@RequestParam("id") String id) { - return success(dlRepairTicketsService.getById(id)); + DlRepairTickets repairTickets = dlRepairTicketsService.getById(id); + DlRepairTicketsRespVO respVO = new DlRepairTicketsRespVO(); + org.springframework.beans.BeanUtils.copyProperties(repairTickets,respVO); + CustomerMain customerMain = customerMainService.getById(repairTickets.getUserId()); + respVO.setCustomerInfo(customerMain); + return success(respVO); } /** @@ -117,11 +126,12 @@ public class DlRepairTicketsController { **/ @PostMapping("/updateById") @Operation(summary = "维修工单表 更新") - public CommonResult createTicket(@RequestBody DlRepairTickets repairTickets) { + public CommonResult updateById(@RequestBody DlRepairTicketsRespVO repairTickets) { //更新客户表 CustomerMain customerMain = new CustomerMain(); customerMain.setId(repairTickets.getUserId()); customerMain.setCusName(repairTickets.getUserName()); + customerMain.setDataFrom(repairTickets.getCusFrom()); customerMain.setPhoneNumber(repairTickets.getUserMobile()); customerMainService.updateById(customerMain); //更新车辆表 @@ -158,6 +168,8 @@ public class DlRepairTicketsController { carMain.setShangye(repairTickets.getShangye()); } carMainService.updateById(carMain); + //最后记录操作日志--创建工单 + repairRecordsService.saveRepairRecord(repairTickets.getId(), null, RecordTypeEnum.XGGD.getCode(), "修改工单", repairTickets.getImage()); return CommonResult.success(dlRepairTicketsService.updateById(repairTickets)); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java index b681cc7d..1ae5ef98 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.tickets.entity; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -88,6 +89,10 @@ public class DlRepairTickets extends TenantBaseDO { * 车辆品牌类型(base_car_brand表的brand_type) */ private String carBrandType; + /** + * 业务来源(字典:repair_busi_from) + */ + private String busiFrom; /** * 最近保养日期 */ @@ -241,4 +246,14 @@ public class DlRepairTickets extends TenantBaseDO { private BigDecimal jiaoqiang; /** 商业险保费 */ private BigDecimal shangye; + + /** 更新时上传的图片 */ + @TableField(exist = false) + private String image; + /** 维修类型文本 */ + @TableField(exist = false) + private String repairTypeText; + /** 支付方式文本 */ + @TableField(exist = false) + private String payTypeText; } 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 1874a1b0..f041ce63 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 @@ -60,6 +60,7 @@ import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService; import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService; import cn.iocoder.yudao.module.tickets.service.DlTwItemService; import cn.iocoder.yudao.module.tickets.tools.WordUtil; +import cn.iocoder.yudao.module.tickets.utils.TicketsOperateUtil; import cn.iocoder.yudao.module.tickets.vo.*; import cn.iocoder.yudao.util.CreateQRCodeUtil; import cn.iocoder.yudao.util.SendSmsUtil; @@ -195,6 +196,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl dataFromList = dictDataApi.getDictDataList(DICT_CUS_DATA_FROM); + Map dataFromMap = dataFromList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel)); + customerInfo.setDataFromText(dataFromMap.get(customerInfo.getDataFrom())); + } result.setCustomerInfo(customerInfo); // 查工单子表 List itemList = titemService.list(new LambdaQueryWrapper().eq(DlRepairTitem::getTicketId, id)); @@ -1011,6 +1028,39 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl + **/ + private IPage dealDictText(IPage dlRepairTicketsIPage){ + //维修类型 + List repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE); + Map repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel)); + //支付方式 + List payTypeList = dictDataApi.getDictDataList(DICT_REPAIR_PAY_TYPE); + + dlRepairTicketsIPage.getRecords().forEach(item->{ + if(StringUtils.isNotEmpty(item.getRepairType())){ + item.setRepairTypeText(repairTypeMap.get(item.getRepairType())); + } + if(StringUtils.isNotEmpty(item.getPayType())){ + payTypeList.forEach(payType->{ + if(item.getPayType().contains(payType.getValue())){ + if(StringUtils.isEmpty(item.getPayTypeText())){ + item.setPayTypeText(payType.getLabel()); + }else{ + item.setPayTypeText(item.getPayTypeText()+","+payType.getLabel()); + } + } + }); + } + }); + return dlRepairTicketsIPage; + } + /** * 分类查询工单分页 * @@ -1025,7 +1075,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl + @@ -74,6 +75,7 @@ + @@ -136,6 +138,7 @@ car_brand_id, car_brand_name, car_brand_type, + busi_from, adviser_id, adviser_name, pay_type, @@ -368,7 +371,7 @@ left join base_customer_main bcm ON drt.user_id = bcm.id left join dl_repair_titem drti - on drt.id = drti.ticket_id AND drti.deleted = '0' + on drt.id = drti.ticket_id AND drti.deleted = '0' AND drti.item_type='01' where drt.deleted = '0' and ( @@ -381,6 +384,12 @@ drt.user_mobile like concat('%', #{map.ticketNo}, '%') or drt.remark like concat('%', #{map.ticketNo}, '%') + or + drt.car_brand_name like concat('%', #{map.ticketNo}, '%') + or + drt.handle_name like concat('%', #{map.ticketNo}, '%') + or + drti.item_name like concat('%', #{map.ticketNo}, '%') )