服务顾问通知客户取车前,判断项目价格、配件价格是否已填写
This commit is contained in:
parent
01c781478e
commit
5da4a45e7d
@ -336,6 +336,19 @@ public class DlRepairTicketsController {
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否工单子表的任何一个类目没有价格或价格为0
|
||||
*
|
||||
* @param id 工单ID
|
||||
* @author 小李
|
||||
* @date 15:00 2024/11/16
|
||||
**/
|
||||
@GetMapping("/hasPrice")
|
||||
@Operation(summary = "判断是否工单子表的任何一个类目没有价格或价格为0")
|
||||
public CommonResult<?> hasPrice(@RequestParam("id")String id){
|
||||
return success(dlRepairTicketsService.hasPrice(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工单子项
|
||||
*
|
||||
|
@ -243,4 +243,13 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @param respVO
|
||||
**/
|
||||
void overOrder(DlRepairTicketsRespVO respVO);
|
||||
|
||||
/**
|
||||
* 判断是否工单子表的任何一个类目没有价格或价格为0
|
||||
*
|
||||
* @param id 工单ID
|
||||
* @author 小李
|
||||
* @date 15:00 2024/11/16
|
||||
**/
|
||||
Boolean hasPrice(String id);
|
||||
}
|
||||
|
@ -222,7 +222,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// });
|
||||
|
||||
|
||||
|
||||
// 门店信息
|
||||
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
||||
DeptRespDTO dept = deptApi.getDept(deptId);
|
||||
@ -256,7 +255,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 新增子表
|
||||
itemList.forEach(item -> {
|
||||
item.setTicketId(ticketsRespVO.getId());
|
||||
if(null==item.getSaleId()){
|
||||
if (null == item.getSaleId()) {
|
||||
//默认销售人员是当前用户
|
||||
item.setSaleId(loginUser.getId());
|
||||
item.setSaleName(loginUser.getInfo().get("nickname"));
|
||||
@ -415,7 +414,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 作废维修工单
|
||||
DlRepairTickets tickets = new DlRepairTickets();
|
||||
tickets.setId(repairTicketsReqVO.getId());
|
||||
if (ObjectUtil.isNotEmpty(repairTicketsReqVO.getRemark())){
|
||||
if (ObjectUtil.isNotEmpty(repairTicketsReqVO.getRemark())) {
|
||||
tickets.setRemark(repairTicketsReqVO.getRemark());
|
||||
}
|
||||
tickets.setTicketsStatus("03");
|
||||
@ -447,10 +446,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
|
||||
// 更新工单
|
||||
// 在这里把工单的状态更新为已完成---需要判断,如果是线上支付,需要在支付回调更新
|
||||
if (!repairTicketsRespVO.getPayType().equals("01")){
|
||||
if (!repairTicketsRespVO.getPayType().equals("01")) {
|
||||
repairTicketsRespVO.setIsFinish("1");
|
||||
baseMapper.updateById(repairTicketsRespVO);
|
||||
}else {
|
||||
} else {
|
||||
// 线下结账和签单挂账,直接算已支付
|
||||
repairOrderInfo.setPayTime(LocalDateTime.now());
|
||||
repairOrderInfo.setOrderStatus("1");
|
||||
@ -852,7 +851,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
String userRoleCode = getUserRole();
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) {
|
||||
//维修管理员看所有数据
|
||||
}else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) {
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) {
|
||||
//仓管看到所有数据
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||
//总检
|
||||
@ -955,7 +954,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void updateTake(String id,String image) {
|
||||
public void updateTake(String id, String image) {
|
||||
// 改变时看看是否已经被接了
|
||||
int update = baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.RECEIVED.getCode())
|
||||
@ -1007,16 +1006,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
String userRole = getUserRole();
|
||||
if (userRole.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
|
||||
//指派施工,施工项目中不包含选中人员处理
|
||||
setTicketItem(reqVO.getId(),reqVO.getNowRepairId(),reqVO.getNowRepairName());
|
||||
setTicketItem(reqVO.getId(), reqVO.getNowRepairId(), reqVO.getNowRepairName());
|
||||
}
|
||||
//最后记录操作日志--指派施工--pull下来的逻辑
|
||||
String code = RecordTypeEnum.ZPSG.getCode();
|
||||
String remark ="指派施工";
|
||||
String remark = "指派施工";
|
||||
|
||||
// 总检
|
||||
if (userRole.equals(RepairRoleEnum.INSPECTION.getCode())){
|
||||
if (userRole.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||
repairRecordsService.saveRepairRecord(reqVO.getId(), null, RecordTypeEnum.NFPG.getCode(), reqVO.getRemark(), reqVO.getImage());
|
||||
}else {
|
||||
} else {
|
||||
// 其他
|
||||
//最后记录操作日志--指派施工
|
||||
repairRecordsService.saveRepairRecord(reqVO.getId(), null, code, remark, null);
|
||||
@ -1025,29 +1024,30 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
|
||||
/**
|
||||
* 指派施工,施工项目中不包含选中人员处理
|
||||
*
|
||||
* @param ticketId 工单id
|
||||
* @param nowRepairId 当前处理人id
|
||||
* @param nowRepairName 当前处理人名称
|
||||
* @author PQZ
|
||||
* @date 16:30 2024/11/13
|
||||
* @param ticketId 工单id
|
||||
* @param nowRepairId 当前处理人id
|
||||
* @param nowRepairName 当前处理人名称
|
||||
**/
|
||||
private void setTicketItem(String ticketId,Long nowRepairId,String nowRepairName){
|
||||
**/
|
||||
private void setTicketItem(String ticketId, Long nowRepairId, String nowRepairName) {
|
||||
//查询所有维修工
|
||||
List<RepairWorker> list = repairWorkerService.list();
|
||||
//查询当前工单下所有项目
|
||||
LambdaQueryWrapper<DlRepairTitem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(DlRepairTitem::getTicketId,ticketId);
|
||||
lambdaQueryWrapper.eq(DlRepairTitem::getTicketId, ticketId);
|
||||
List<DlRepairTitem> itemList = titemService.list(lambdaQueryWrapper);
|
||||
//过滤出不包括当前指派人的值
|
||||
List<DlRepairTitem> filterList = itemList.stream().filter(item -> !item.getRepairNames().contains(nowRepairName)).collect(Collectors.toList());
|
||||
List<DlRepairTitem> saveList = new ArrayList<>();
|
||||
//当前处理人工作组
|
||||
Map<Long,RepairWorker> workerMap = list.stream().collect(Collectors.toMap(RepairWorker::getUserId,worker -> worker));
|
||||
Map<Long, RepairWorker> workerMap = list.stream().collect(Collectors.toMap(RepairWorker::getUserId, worker -> worker));
|
||||
String workType = workerMap.get(nowRepairId).getWorkType();
|
||||
filterList.forEach(item -> {
|
||||
//深拷贝
|
||||
DlRepairTitem saveItem = BeanUtils.toBean(item,DlRepairTitem.class);
|
||||
if (StringUtils.isNotEmpty(saveItem.getRepairIds())){
|
||||
DlRepairTitem saveItem = BeanUtils.toBean(item, DlRepairTitem.class);
|
||||
if (StringUtils.isNotEmpty(saveItem.getRepairIds())) {
|
||||
//取出用户id
|
||||
List<Long> repairIds = Arrays.stream(saveItem.getRepairIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
repairIds.forEach(idItem -> {
|
||||
@ -1062,7 +1062,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}
|
||||
});
|
||||
saveList.forEach(item -> {
|
||||
String newRepairId = item.getRepairIds()+","+nowRepairId;
|
||||
String newRepairId = item.getRepairIds() + "," + nowRepairId;
|
||||
String newRepairName = item.getRepairNames() + "," + nowRepairName;
|
||||
item.setRepairIds(newRepairId);
|
||||
item.setRepairNames(newRepairName);
|
||||
@ -1123,7 +1123,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
施工完成又分四种情况:阶段完成、完成并移交下一班组、完成并移交总检、完成工单,其中部分完成同开始施工、施工中的记录上传一致,只上传,不改变
|
||||
*/
|
||||
// 消息生成
|
||||
String message = createMessage(tickets.getNowRepairName(), tickets.getCarNo(),null==titem?"":titem.getItemName(), respVO.getRecordType(), respVO.getFinishType(), respVO.getNextName());
|
||||
String message = createMessage(tickets.getNowRepairName(), tickets.getCarNo(), null == titem ? "" : titem.getItemName(), respVO.getRecordType(), respVO.getFinishType(), respVO.getNextName());
|
||||
// 通知服务顾问
|
||||
// 如果员工完成了订单
|
||||
if (RecordTypeEnum.SGWCZJ.getCode().equals(respVO.getRecordType()) && "03".equals(respVO.getFinishType())) {
|
||||
@ -1166,7 +1166,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}
|
||||
|
||||
//通知客户(开始施工、施工完成)
|
||||
if (respVO.getRecordType().equals(RecordTypeEnum.KSSG.getCode()) || respVO.getRecordType().equals(RecordTypeEnum.SGWCZJ.getCode())){
|
||||
if (respVO.getRecordType().equals(RecordTypeEnum.KSSG.getCode()) || respVO.getRecordType().equals(RecordTypeEnum.SGWCZJ.getCode())) {
|
||||
// 构建消息
|
||||
RepairWorker worker = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()).last("limit 1"));
|
||||
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList("repair_work_type");
|
||||
@ -1282,11 +1282,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.ZJ.getCode(), respVO.getRemark(), respVO.getImage());
|
||||
// 更新工单
|
||||
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
// 因为完成状态需要在交车之后,所以注掉这个
|
||||
// 因为完成状态需要在交车之后,所以注掉这个
|
||||
// .set(DlRepairTickets::getIsFinish, "1")
|
||||
.setSql("now_repair_id = adviser_id")
|
||||
.setSql("now_repair_name = adviser_name")
|
||||
.eq(DlRepairTickets::getId, respVO.getId())
|
||||
.setSql("now_repair_id = adviser_id")
|
||||
.setSql("now_repair_name = adviser_name")
|
||||
.eq(DlRepairTickets::getId, respVO.getId())
|
||||
);
|
||||
|
||||
boolean flag = syncTicketWaresToTicket(respVO.getId());
|
||||
@ -1468,6 +1468,29 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.TZQC.getCode(), recordStr, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否工单子表的任何一个类目没有价格或价格为0
|
||||
*
|
||||
* @param id 工单ID
|
||||
* @author 小李
|
||||
* @date 15:00 2024/11/16
|
||||
**/
|
||||
@Override
|
||||
public Boolean hasPrice(String id) {
|
||||
List<DlRepairTitem> titems = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().in(DlRepairTitem::getTicketId, id));
|
||||
for (DlRepairTitem item : titems) {
|
||||
// 如果有为空的,直接报错
|
||||
if (ObjectUtil.isEmpty(item.getItemPrice())) {
|
||||
throw exception0(500, "工单中有项目或配件没有设置价格,请服务顾问填写项目价格,仓库填写配件价格");
|
||||
}
|
||||
// 如果有为0的,那就提示,让操作人选择
|
||||
if (item.getItemPrice().equals(new BigDecimal("0.00"))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新计算工单的一些数值,子表也要重新计算
|
||||
*
|
||||
@ -1714,7 +1737,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.END.getCode())
|
||||
.set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.OVER.getCode())
|
||||
//交车时才能把工单置为完成
|
||||
.set(DlRepairTickets::getIsFinish,"1")
|
||||
.set(DlRepairTickets::getIsFinish, "1")
|
||||
.eq(DlRepairTickets::getId, respVO.getId())
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user