This commit is contained in:
Vinjor 2024-10-24 16:45:04 +08:00
parent 8ed75b1daf
commit 300067ae1f
4 changed files with 37 additions and 21 deletions

View File

@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 工单操作记录-工作类型枚举
* 工单操作记录-工作类型枚举(repair_records_type)
*
* @author vinjor-m
*/
@ -39,6 +39,10 @@ public enum RecordTypeEnum {
* 结束工单
*/
JSGD("jsgd","结束工单"),
/**
* 通知客户取车
*/
TZQC("tzqc","通知客户取车"),
/**
* 开始施工
*/

View File

@ -11,4 +11,9 @@ public class RepairCons {
public static final String TICKETS_WAITING = "waiting";
/**工单-所有*/
public static final String TICKETS_ALL = "all";
/**数据字典常量-repair_records_type-*/
public static final String DICT_REPAIR_RECORDS_TYPE = "repair_records_type";
/**数据字典常量-repair_type-*/
public static final String DICT_REPAIR_TYPE = "repair_type";
}

View File

@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 维修工单状态枚举
* 维修工单状态枚举(repair_tickets_status)
*
* @author vinjor-m
*/
@ -23,6 +23,10 @@ public enum TicketsStatusEnum {
* 未结账
*/
NO_PAY("01","未结账"),
/**
* 待通知客户取车
*/
WAITING_NOTICE("07","待通知客户取车"),
/**
* 挂单/记账
*/

View File

@ -44,6 +44,7 @@ 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.*;
import cn.iocoder.yudao.util.SendSmsUtil;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -52,8 +53,6 @@ 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;
@ -62,11 +61,12 @@ 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;
import static cn.iocoder.yudao.common.BaseConstants.ORDER_TENANT_NAME;
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_RECORDS_TYPE;
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_TYPE;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
@ -306,7 +306,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
RepairRecordsPageReqVO entity = new RepairRecordsPageReqVO();
entity.setTicketId(id);
List<RepairRecordsRespVO> records = repairRecordsService.queryList(entity);
result.setRecords(records);
// 操作记录类型
List<DictDataRespDTO> recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_RECORDS_TYPE);
Map<String,String> typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
result.setRecords(records.stream().peek(item->item.setType(typeMap.get(item.getType()))).collect(Collectors.toList()));
return result;
}
@ -768,6 +771,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 更新工单状态
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.END.getCode())
.set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.WAITING_NOTICE.getCode())
.eq(DlRepairTickets::getId, respVO.getId())
);
@ -814,9 +818,14 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
public void noticeCus(NoticeCusVO noticeCusVO) {
// 获取客户信息
DlRepairTickets tickets = baseMapper.selectById(noticeCusVO.getId());
// 更新工单状态为待结算待取车
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
.set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.NO_PAY.getCode())
.eq(DlRepairTickets::getId, noticeCusVO.getId())
);
CustomerMain cus = customerService.getById(tickets.getUserId());
// 维修项目
List<DictDataRespDTO> repairType = dictDataApi.getDictDataList("repair_type");
List<DictDataRespDTO> repairType = dictDataApi.getDictDataList(DICT_REPAIR_TYPE);
// 默认是维修
String type = "维修";
DictDataRespDTO dictDataRespDTO = repairType.stream()
@ -827,25 +836,19 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
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()
"尊敬的客户您好:您的爱车%s已%s完毕请您前来取车。若有问题可以联系%s联系电话%s"
, tickets.getCarNo(), type, noticeCusVO.getName(), noticeCusVO.getMobile()
);
// todo 小程序通知客户
// todo 短信通知客户
if(null!=cus && StringUtils.isNotEmpty(cus.getPhoneNumber())){
// 短信通知客户
SendSmsUtil.sendMsgCommon(new String[]{message}, cus.getPhoneNumber(), "1400852709", "蓝安汽车小程序", "2143603");
}
// 记录日志
String recordStr = noticeCusVO.getName()
+ "通知客户:"
+ cus.getCusName()
+ ""
+ start
+ ""
+ end
+ "前来取车";
repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.JSGD.getCode(), recordStr, null);
+ "通知客户取车:"+message;
repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.TZQC.getCode(), recordStr, null);
}
}