维修工单新增客户处更新
This commit is contained in:
parent
e8b1e7a655
commit
8f548f45be
@ -156,7 +156,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
private DlTwItemService twItemService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 维修工单表 新增
|
||||
*
|
||||
@ -168,16 +167,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
@DSTransactional
|
||||
public DlRepairTicketsRespVO createTickets(DlRepairTicketsRespVO ticketsRespVO) {
|
||||
// 验证
|
||||
if (ObjectUtil.isEmpty(ticketsRespVO.getCarId())){
|
||||
if (ObjectUtil.isEmpty(ticketsRespVO.getCarId())) {
|
||||
throw exception0(500, "车辆信息为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(ticketsRespVO.getAdviserId())){
|
||||
if (ObjectUtil.isEmpty(ticketsRespVO.getAdviserId())) {
|
||||
throw exception0(500, "服务顾问为空");
|
||||
}
|
||||
ticketsRespVO.getItemList().forEach(item -> {
|
||||
if (ObjectUtil.isEmpty(item.getRepairIds()) || ObjectUtil.isEmpty(item.getSaleId())){
|
||||
if (ObjectUtil.isEmpty(item.getRepairIds()) || ObjectUtil.isEmpty(item.getSaleId())) {
|
||||
String message = "";
|
||||
switch (item.getItemType()){
|
||||
switch (item.getItemType()) {
|
||||
case "01":
|
||||
message += "项目:";
|
||||
break;
|
||||
@ -327,7 +326,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
if (CollectionUtil.isNotEmpty(wares)) {
|
||||
// 单位字典
|
||||
List<DictDataRespDTO> recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_UNIT);
|
||||
Map<String,String> unitMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
|
||||
Map<String, String> unitMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
|
||||
|
||||
Set<String> ids = wares.stream().map(DlRepairTitemReqVO::getPartId).collect(Collectors.toSet());
|
||||
List<RepairWares> repairWares = waresService.listByIds(ids);
|
||||
@ -351,8 +350,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
List<RepairRecordsRespVO> records = repairRecordsService.queryList(entity);
|
||||
// 操作记录类型
|
||||
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()));
|
||||
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;
|
||||
}
|
||||
|
||||
@ -380,7 +379,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
public void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO) {
|
||||
// 更新订单状态
|
||||
RepairOrderInfo one = repairOrderInfoService.getOne(new LambdaQueryWrapper<RepairOrderInfo>().eq(RepairOrderInfo::getGoodsId, repairTicketsRespVO.getId()));
|
||||
if (ObjectUtil.isEmpty(one)){
|
||||
if (ObjectUtil.isEmpty(one)) {
|
||||
throw exception0(500, "系统异常");
|
||||
}
|
||||
RepairOrderInfo repairOrderInfo = new RepairOrderInfo();
|
||||
@ -425,6 +424,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 新增车辆信息
|
||||
if (ObjectUtil.isNotEmpty(customerAndCarVO.getCarInfo())) {
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())) {
|
||||
customerAndCarVO.getCarInfo().setUserId(Long.valueOf(customerAndCarVO.getUserInfo().getId()));
|
||||
carMainService.createCarMain(customerAndCarVO.getCarInfo());
|
||||
} else {
|
||||
carMainService.updateCarMain(customerAndCarVO.getCarInfo());
|
||||
@ -685,7 +685,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
|
||||
// 因为目前的配件申请表在申请的时候就把配件加到工单中了,但后续的领取并没有同步到工单,所以如果这里是员工直接完成移交给服务顾问,就需要同步一下
|
||||
boolean flag = syncTicketWaresToTicket(respVO.getId());
|
||||
if (!flag){
|
||||
if (!flag) {
|
||||
throw exception0(500, "系统异常");
|
||||
}
|
||||
} else {
|
||||
@ -816,7 +816,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
);
|
||||
|
||||
boolean flag = syncTicketWaresToTicket(respVO.getId());
|
||||
if (!flag){
|
||||
if (!flag) {
|
||||
throw exception0(500, "系统异常");
|
||||
}
|
||||
|
||||
@ -828,12 +828,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
/**
|
||||
* 用于同步一个工单的所有配件申请表的数据到维修工单,主要针对已领取数量小于申请数量的情况
|
||||
*
|
||||
* @param id 维修工单ID
|
||||
* @author 小李
|
||||
* @date 9:52 2024/10/26
|
||||
* @param id 维修工单ID
|
||||
**/
|
||||
**/
|
||||
@Override
|
||||
public boolean syncTicketWaresToTicket(String id){
|
||||
public boolean syncTicketWaresToTicket(String id) {
|
||||
// 先查满足条件的申请表
|
||||
ArrayList<String> status = new ArrayList<>();
|
||||
status.add("01"); // 待审核
|
||||
@ -873,16 +873,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 可能出现配件申请单审核通过了没有任何领取或全部退了的情况,所以如果itemCount等于0,直接把这个数据删掉
|
||||
// 过滤出需要删除的数据
|
||||
List<DlRepairTitem> delItems = AllItems.stream().filter(item -> item.getItemCount() == 0).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(delItems)){
|
||||
if (CollectionUtil.isNotEmpty(delItems)) {
|
||||
// 删除需要删的
|
||||
titemService.removeBatchByIds(delItems);
|
||||
Set<String> delIds = delItems.stream().map(DlRepairTitem::getId).collect(Collectors.toSet());
|
||||
// 得到需要改的
|
||||
List<DlRepairTitem> updateItems = AllItems.stream().filter(item -> delIds.contains(item.getId())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(updateItems)){
|
||||
if (CollectionUtil.isNotEmpty(updateItems)) {
|
||||
titemService.updateBatchById(updateItems);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
// 没有需要删的就是全部都需要改
|
||||
titemService.updateBatchById(AllItems);
|
||||
}
|
||||
@ -922,21 +922,21 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
**/
|
||||
@Override
|
||||
public Map<String, Integer> getBossNum() {
|
||||
Map<String,Integer> rtnMap = new HashMap<>();
|
||||
Map<String, Integer> rtnMap = new HashMap<>();
|
||||
int workingNum = 0;
|
||||
int doneNum = 0;
|
||||
List<DlRepairTickets> repairTickets = this.list();
|
||||
if(!repairTickets.isEmpty()){
|
||||
Map<String,List<DlRepairTickets>> ifFinishMap = repairTickets.stream().collect(Collectors.groupingBy(DlRepairTickets::getIsFinish));
|
||||
if(ifFinishMap.containsKey("0")){
|
||||
if (!repairTickets.isEmpty()) {
|
||||
Map<String, List<DlRepairTickets>> ifFinishMap = repairTickets.stream().collect(Collectors.groupingBy(DlRepairTickets::getIsFinish));
|
||||
if (ifFinishMap.containsKey("0")) {
|
||||
workingNum = ifFinishMap.get("0").size();
|
||||
}
|
||||
if(ifFinishMap.containsKey("1")){
|
||||
if (ifFinishMap.containsKey("1")) {
|
||||
doneNum = ifFinishMap.get("1").size();
|
||||
}
|
||||
}
|
||||
rtnMap.put("workingNum",workingNum);
|
||||
rtnMap.put("doneNum",doneNum);
|
||||
rtnMap.put("workingNum", workingNum);
|
||||
rtnMap.put("doneNum", doneNum);
|
||||
return rtnMap;
|
||||
}
|
||||
|
||||
@ -975,13 +975,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
, tickets.getCarNo(), type, noticeCusVO.getName(), noticeCusVO.getMobile()
|
||||
);
|
||||
// todo 小程序通知客户
|
||||
if(null!=cus && StringUtils.isNotEmpty(cus.getPhoneNumber())){
|
||||
if (null != cus && StringUtils.isNotEmpty(cus.getPhoneNumber())) {
|
||||
// 短信通知客户
|
||||
SendSmsUtil.sendMsgCommon(new String[]{message}, cus.getPhoneNumber(), "1400852709", "蓝安汽车小程序", "2143603");
|
||||
}
|
||||
// 记录日志
|
||||
String recordStr = noticeCusVO.getName()
|
||||
+ "通知客户取车:"+message;
|
||||
+ "通知客户取车:" + message;
|
||||
repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.TZQC.getCode(), recordStr, null);
|
||||
}
|
||||
|
||||
@ -1023,19 +1023,19 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
/**
|
||||
* 新增工单子项
|
||||
*
|
||||
* @param respVO 主要有两个参数,主表ID,itemList(这个需要前端处理成子表的对象能接收的数据)
|
||||
* @author 小李
|
||||
* @date 19:59 2024/10/24
|
||||
* @param respVO 主要有两个参数,主表ID,itemList(这个需要前端处理成子表的对象能接收的数据)
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void addItems(DlRepairTicketsRespVO respVO){
|
||||
public void addItems(DlRepairTicketsRespVO respVO) {
|
||||
// 先判断是否施工人员和销售人员是否都设置了
|
||||
respVO.getItemList().forEach(item -> {
|
||||
if (ObjectUtil.isEmpty(item.getRepairIds())){
|
||||
if (ObjectUtil.isEmpty(item.getRepairIds())) {
|
||||
throw exception0(500, "施工人员尚未设置");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(item.getSaleId())){
|
||||
if (ObjectUtil.isEmpty(item.getSaleId())) {
|
||||
throw exception0(500, "销售人员尚未设置");
|
||||
}
|
||||
});
|
||||
@ -1046,7 +1046,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
|
||||
// 更新主表
|
||||
boolean flag = computeTicket(respVO.getId());
|
||||
if (!flag){
|
||||
if (!flag) {
|
||||
throw exception0(500, "系统错误");
|
||||
}
|
||||
}
|
||||
@ -1059,18 +1059,18 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void autoInspection(){
|
||||
public void autoInspection() {
|
||||
// 查所有需要总检但还没总检的工单
|
||||
List<DlRepairTickets> tickets = baseMapper.selectList(new LambdaQueryWrapper<DlRepairTickets>().eq(DlRepairTickets::getTicketsWorkStatus, "05"));
|
||||
// 如果没有,直接退出
|
||||
if (CollectionUtil.isEmpty(tickets)){
|
||||
if (CollectionUtil.isEmpty(tickets)) {
|
||||
return;
|
||||
}
|
||||
// 获取超时自动总检配置的时间
|
||||
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(BaseConstants.AUTO_INSPECTION);
|
||||
// 理论上是只有一个的,但防止被删了或者别的什么原因,直接报错
|
||||
DictDataRespDTO dictDataRespDTO = dataList.stream().findFirst().orElse(null);
|
||||
if (ObjectUtil.isEmpty(dictDataRespDTO)){
|
||||
if (ObjectUtil.isEmpty(dictDataRespDTO)) {
|
||||
log.error("超时自动总检时间没有配置");
|
||||
return;
|
||||
}
|
||||
@ -1085,7 +1085,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 同步工单的配件申请表到工单,如果都没超时,退出
|
||||
if (CollectionUtil.isEmpty(list)){
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
// 先取总检们
|
||||
@ -1094,7 +1094,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 通过角色信息查有这个角色的人
|
||||
List<Long> ids = permissionApi.getUserIdByRoleId(roleInfo.getId());
|
||||
// 如果没有总检,直接报错退出
|
||||
if (CollectionUtil.isEmpty(ids)){
|
||||
if (CollectionUtil.isEmpty(ids)) {
|
||||
log.error("系统中没有总检");
|
||||
return;
|
||||
}
|
||||
@ -1111,7 +1111,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
// 如果没有记录同步成功,报错并退出
|
||||
if (CollectionUtil.isEmpty(result)){
|
||||
if (CollectionUtil.isEmpty(result)) {
|
||||
log.error("自动总检失败,原因可能是无法同步申请表到工单");
|
||||
}
|
||||
// 移交服务顾问
|
||||
|
Loading…
Reference in New Issue
Block a user