diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java index 81830573..73d7589a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java @@ -19,7 +19,7 @@ public interface RepairRecordsService extends IService { * 保存维修记录 * * @param ticketId 工单id - * @param repairItemId 工单子表id +// * @param repairItemId 工单子表id * @param type 工作类型(数据字典:repair_records_type;后端对应 RecordTypeEnum 枚举) * @param remark 备注 * @param images 图片(相对路径按照“,”分隔) 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 755571c0..04bddcbf 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 @@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService; import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO; import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO; import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; +import cn.iocoder.yudao.module.tickets.vo.NoticeCusVO; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; import org.apache.commons.lang3.StringUtils; @@ -293,5 +294,19 @@ public class DlRepairTicketsController { dlRepairTicketsService.confirm(respVO); return CommonResult.ok(); } + + /** + * 服务顾问通知客户取车 + * + * @author 小李 + * @date 22:40 2024/10/23 + * @param noticeCusVO 请求对象 + **/ + @PostMapping("/noticeCus") + @Operation(summary = "服务顾问通知客户取车") + public CommonResult noticeCus(@RequestBody NoticeCusVO noticeCusVO) { + dlRepairTicketsService.noticeCus(noticeCusVO); + 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 5815be2f..10cf9d58 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 @@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO; import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO; import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; +import cn.iocoder.yudao.module.tickets.vo.NoticeCusVO; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; @@ -163,4 +164,13 @@ public interface DlRepairTicketsService extends IService { * @param respVO 请求对象 **/ void confirm(DlRepairTicketsRespVO respVO); + + /** + * 服务顾问通知客户取车 + * + * @author 小李 + * @date 22:40 2024/10/23 + * @param noticeCusVO 请求对象 + **/ + void noticeCus(NoticeCusVO noticeCusVO); } 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 7d337d5c..b50e2f29 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 @@ -43,10 +43,7 @@ import cn.iocoder.yudao.module.tickets.mapper.DlRepairTicketsMapper; import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService; import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService; import cn.iocoder.yudao.module.tickets.tools.WordUtil; -import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO; -import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO; -import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; -import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO; +import cn.iocoder.yudao.module.tickets.vo.*; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -55,6 +52,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.deepoove.poi.XWPFTemplate; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.Na; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -64,6 +62,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.FileOutputStream; import java.io.InputStream; import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -719,13 +718,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl() .set(DlRepairTickets::getTicketsWorkStatus, "03") @@ -758,6 +757,52 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl repairType = dictDataApi.getDictDataList("repair_type"); + // 默认是维修 + String type = "维修"; + DictDataRespDTO dictDataRespDTO = repairType.stream() + .filter(item -> item.getValue().equals(tickets.getRepairType())) + .findFirst() + .orElse(null); + if (dictDataRespDTO != null){ + type = dictDataRespDTO.getLabel(); + } + // 构建消息 + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + String start = format.format(noticeCusVO.getTime()[0]); + String end = format.format(noticeCusVO.getTime()[1]); + String message = String.format( + "尊敬的客户您好:您的爱车%s已%s完毕,请您于%s至%s之内前来取车。若有问题可以联系%s,联系电话:%s" + , tickets.getCarNo(), type, start, end, noticeCusVO.getName(), noticeCusVO.getMobile() + ); + // todo 小程序通知客户 + // todo 短信通知客户 + // 记录日志 + String recordStr = noticeCusVO.getName() + + "通知客户:" + + cus.getCusName() + + "于" + + start + + "至" + + end + + "前来取车"; + repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.JSGD.getCode(), recordStr, null); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/NoticeCusVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/NoticeCusVO.java new file mode 100644 index 00000000..c1ad5192 --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/NoticeCusVO.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.tickets.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Data +public class NoticeCusVO { + + /** 维修工单ID */ + private String id; + + /** 取车时间 */ + @Schema(pattern = "时间区间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date[] time; + + /** 联系人 */ + private String name; + + /** 联系电话 */ + private String mobile; + + /** 备注 */ + private String remark; +}