更新代码暂提

This commit is contained in:
xiaofajia 2024-10-23 21:20:58 +08:00
parent cca9847107
commit 5c8d940ea5
5 changed files with 147 additions and 44 deletions

View File

@ -34,7 +34,6 @@ public class DlRepairTicketsController {
private DlRepairTicketsService dlRepairTicketsService; private DlRepairTicketsService dlRepairTicketsService;
/** /**
* 维修工单表 新增 * 维修工单表 新增
* *
@ -140,7 +139,7 @@ public class DlRepairTicketsController {
@GetMapping("/print/{id}") @GetMapping("/print/{id}")
@Operation(summary = "维修工单打印") @Operation(summary = "维修工单打印")
public void printDocument(HttpServletResponse response, @PathVariable String id) { public void printDocument(HttpServletResponse response, @PathVariable String id) {
dlRepairTicketsService.print(response,id); dlRepairTicketsService.print(response, id);
} }
/** /**
@ -160,19 +159,19 @@ public class DlRepairTicketsController {
/** /**
* 分类查询工单分页 * 分类查询工单分页
* *
* @param repairTicketsReqVO 查询对象
* @param pageNo 页码
* @param pageSize 条数
* @author 小李 * @author 小李
* @date 16:26 2024/10/12 * @date 16:26 2024/10/12
* @param repairTicketsReqVO 查询对象 **/
* @param pageNo 页码
* @param pageSize 条数
**/
@GetMapping("/pageType") @GetMapping("/pageType")
@Operation(summary = "分类查询工单分页") @Operation(summary = "分类查询工单分页")
public CommonResult<?> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, public CommonResult<?> getPageType(DlRepairTicketsReqVO repairTicketsReqVO,
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize); Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
if(StringUtils.isEmpty(repairTicketsReqVO.getSelectType())){ if (StringUtils.isEmpty(repairTicketsReqVO.getSelectType())) {
//查询类型为空默认查待处理的 //查询类型为空默认查待处理的
repairTicketsReqVO.setSelectType(RepairCons.TICKETS_WAITING); repairTicketsReqVO.setSelectType(RepairCons.TICKETS_WAITING);
} }
@ -187,20 +186,20 @@ public class DlRepairTicketsController {
**/ **/
@GetMapping("/userRole") @GetMapping("/userRole")
@Operation(summary = "判断登录用户的角色,针对维修工单中的四个角色") @Operation(summary = "判断登录用户的角色,针对维修工单中的四个角色")
public CommonResult<?> getUserRole(){ public CommonResult<?> getUserRole() {
return success(dlRepairTicketsService.getUserRole()); return success(dlRepairTicketsService.getUserRole());
} }
/** /**
* 接单 * 接单
* *
* @param id 工单ID
* @author 小李 * @author 小李
* @date 11:48 2024/10/14 * @date 11:48 2024/10/14
* @param id 工单ID **/
**/
@GetMapping("/take") @GetMapping("/take")
@Operation(summary = "接单") @Operation(summary = "接单")
public CommonResult<?> updateTake(@RequestParam("id") String id){ public CommonResult<?> updateTake(@RequestParam("id") String id) {
dlRepairTicketsService.updateTake(id); dlRepairTicketsService.updateTake(id);
return CommonResult.ok(); return CommonResult.ok();
} }
@ -208,13 +207,13 @@ public class DlRepairTicketsController {
/** /**
* 指派员工通知施工 * 指派员工通知施工
* *
* @param reqVO 请求对象
* @author 小李 * @author 小李
* @date 15:34 2024/10/14 * @date 15:34 2024/10/14
* @param reqVO 请求对象 **/
**/
@PostMapping("/notify") @PostMapping("/notify")
@Operation(summary = "指派员工,通知施工") @Operation(summary = "指派员工,通知施工")
public CommonResult<?> updateRepair(@RequestBody DlRepairTicketsReqVO reqVO){ public CommonResult<?> updateRepair(@RequestBody DlRepairTicketsReqVO reqVO) {
dlRepairTicketsService.updateRepair(reqVO); dlRepairTicketsService.updateRepair(reqVO);
return CommonResult.ok(); return CommonResult.ok();
} }
@ -222,13 +221,13 @@ public class DlRepairTicketsController {
/** /**
* 更新工单状态 * 更新工单状态
* *
* @param respVO 请求对象
* @author 小李 * @author 小李
* @date 15:46 2024/10/18 * @date 15:46 2024/10/18
* @param respVO 请求对象 **/
**/
@PostMapping("/updateStatus") @PostMapping("/updateStatus")
@Operation(summary = "更新工单状态") @Operation(summary = "更新工单状态")
public CommonResult<?> updateStatus(@RequestBody DlRepairTicketsRespVO respVO){ public CommonResult<?> updateStatus(@RequestBody DlRepairTicketsRespVO respVO) {
dlRepairTicketsService.updateStatus(respVO); dlRepairTicketsService.updateStatus(respVO);
return CommonResult.ok(); return CommonResult.ok();
} }
@ -236,14 +235,14 @@ public class DlRepairTicketsController {
/** /**
* 配件客户是否可见 * 配件客户是否可见
* *
* @param id 工单ID
* @param show 是否可见
* @author 小李 * @author 小李
* @date 21:52 2024/10/18 * @date 21:52 2024/10/18
* @param id 工单ID **/
* @param show 是否可见
**/
@GetMapping("/show") @GetMapping("/show")
@Operation(summary = "配件客户是否可见") @Operation(summary = "配件客户是否可见")
public CommonResult<?> updateShow(@RequestParam("id") String id, @RequestParam("show") String show){ public CommonResult<?> updateShow(@RequestParam("id") String id, @RequestParam("show") String show) {
dlRepairTicketsService.updateShow(id, show); dlRepairTicketsService.updateShow(id, show);
return CommonResult.ok(); return CommonResult.ok();
} }
@ -252,19 +251,47 @@ public class DlRepairTicketsController {
* 查待总检或待出厂检验的工单 * 查待总检或待出厂检验的工单
* 维修服务顾问和总检用的 * 维修服务顾问和总检用的
* *
* @param repairTicketsReqVO 请求对象
* @param pageNo 页码
* @param pageSize 条数
* @author 小李 * @author 小李
* @date 11:40 2024/10/23 * @date 11:40 2024/10/23
* @param repairTicketsReqVO 请求对象 **/
* @param pageNo 页码
* @param pageSize 条数
**/
@GetMapping("/pageByRole") @GetMapping("/pageByRole")
@Operation(summary = "查待总检或待出厂检验的工单") @Operation(summary = "查待总检或待出厂检验的工单")
public CommonResult<?> getPageByRole(DlRepairTicketsReqVO repairTicketsReqVO, public CommonResult<?> getPageByRole(DlRepairTicketsReqVO repairTicketsReqVO,
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize); Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
return success(dlRepairTicketsService.getPageByRole(repairTicketsReqVO, page)); return success(dlRepairTicketsService.getPageByRole(repairTicketsReqVO, page));
} }
/**
* 维修总检完成总检
*
* @author 小李
* @date 16:48 2024/10/23
* @param respVO 请求对象
**/
@PostMapping("/inspection")
@Operation(summary = "维修总检完成总检")
public CommonResult<?> inspection(@RequestBody DlRepairTicketsRespVO respVO) {
dlRepairTicketsService.inspection(respVO);
return CommonResult.ok();
}
/**
* 服务顾问上传出厂检验日志
*
* @author 小李
* @date 17:47 2024/10/23
* @param respVO 请求对象
**/
@PostMapping("/confirm")
@Operation(summary = "服务顾问上传出厂检验日志")
public CommonResult<?> confirm(@RequestBody DlRepairTicketsRespVO respVO) {
dlRepairTicketsService.confirm(respVO);
return CommonResult.ok();
}
} }

View File

@ -145,4 +145,22 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
* @param repairTicketsReqVO 请求对象 * @param repairTicketsReqVO 请求对象
**/ **/
IPage<DlRepairTickets> getPageByRole(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page); IPage<DlRepairTickets> getPageByRole(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
/**
* 维修总检完成总检
*
* @author 小李
* @date 16:48 2024/10/23
* @param respVO 请求对象
**/
void inspection(DlRepairTicketsRespVO respVO);
/**
* 服务顾问上传出厂检验日志
*
* @author 小李
* @date 17:47 2024/10/23
* @param respVO 请求对象
**/
void confirm(DlRepairTicketsRespVO respVO);
} }

View File

@ -550,7 +550,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
} }
/** /**
* 更新工单状态 * 更新工单状态(针对开始施工施工中记录施工完成)
* *
* @param respVO 请求对象 * @param respVO 请求对象
* @author 小李 * @author 小李
@ -560,9 +560,9 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
@DSTransactional @DSTransactional
public void updateStatus(DlRepairTicketsRespVO respVO) { public void updateStatus(DlRepairTicketsRespVO respVO) {
// 如果是开始施工但项目还在施工中就不能施工 // 如果是开始施工但项目还在施工中就不能施工
if (respVO.getRecordType().equals("kssg")){ if (respVO.getRecordType().equals("kssg")) {
DlRepairTitem titem = titemService.getById(respVO.getItem().getId()); DlRepairTitem titem = titemService.getById(respVO.getItem().getId());
if (titem.getItemStatus().equals("02")){ if (titem.getItemStatus().equals("02")) {
throw exception0(500, "选择的项目在施工中,不能重新开始施工"); throw exception0(500, "选择的项目在施工中,不能重新开始施工");
} }
} }
@ -571,7 +571,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 更新工单主表 // 更新工单主表
LambdaUpdateWrapper<DlRepairTickets> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<DlRepairTickets> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(DlRepairTickets::getId, respVO.getId()); wrapper.eq(DlRepairTickets::getId, respVO.getId());
wrapper.set(DlRepairTickets::getTicketsWorkStatus, respVO.getTicketsWorkStatus()); // 这里注掉不能让员工更新工单的状态为完成后面还有总检服务顾问
// wrapper.set(DlRepairTickets::getTicketsWorkStatus, respVO.getTicketsWorkStatus());
if (ObjectUtil.isNotEmpty(respVO.getIsFinish())) { if (ObjectUtil.isNotEmpty(respVO.getIsFinish())) {
wrapper.set(DlRepairTickets::getIsFinish, respVO.getIsFinish()); wrapper.set(DlRepairTickets::getIsFinish, respVO.getIsFinish());
} }
@ -604,7 +605,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 通知服务顾问 // 通知服务顾问
// 如果员工完成了订单 // 如果员工完成了订单
if (respVO.getRecordType().equals("sgwczj") && respVO.getFinishType().equals("03")) { if (respVO.getRecordType().equals("sgwczj") && respVO.getFinishType().equals("03")) {
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的工单可以交车"); repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的工单可以出厂检验");
// 需要把工单的当前操作人移交服务顾问
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
.setSql("now_repair_id = adviser_id")
.setSql("now_repair_name = adviser_name")
.eq(DlRepairTickets::getId, respVO.getId()));
} else { } else {
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), message); repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), message);
} }
@ -622,6 +628,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>() baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
.set(DlRepairTickets::getNowRepairId, user.getId()) .set(DlRepairTickets::getNowRepairId, user.getId())
.set(DlRepairTickets::getNowRepairName, user.getNickname()) .set(DlRepairTickets::getNowRepairName, user.getNickname())
.set(DlRepairTickets::getTicketsWorkStatus, "05")
.eq(DlRepairTickets::getId, respVO.getId())); .eq(DlRepairTickets::getId, respVO.getId()));
repairWorkerService.sentMessage(user.getId(), "您有新的工单需要总检"); repairWorkerService.sentMessage(user.getId(), "您有新的工单需要总检");
} else { } else {
@ -642,7 +649,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
return result + "上传了工单:" + no + "" + projectName + "项目的维修记录"; return result + "上传了工单:" + no + "" + projectName + "项目的维修记录";
// 施工完成 // 施工完成
case "sgwczj": case "sgwczj":
if (ObjectUtil.isNotEmpty(finishType)){ if (ObjectUtil.isNotEmpty(finishType)) {
result = result + "完成了工单:" + no + "" + projectName + "项目"; result = result + "完成了工单:" + no + "" + projectName + "项目";
switch (finishType) { switch (finishType) {
// 完成并移交下一班组 // 完成并移交下一班组
@ -657,7 +664,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
default: default:
return "异常消息"; return "异常消息";
} }
}else { } else {
return result + "部分完成了工单:" + no + "" + projectName + "项目"; return result + "部分完成了工单:" + no + "" + projectName + "项目";
} }
default: default:
@ -685,24 +692,72 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
* 查待总检或待出厂检验的工单 * 查待总检或待出厂检验的工单
* 维修服务顾问和总检用的 * 维修服务顾问和总检用的
* *
* @param repairTicketsReqVO 请求对象
* @author 小李 * @author 小李
* @date 11:40 2024/10/23 * @date 11:40 2024/10/23
* @param repairTicketsReqVO 请求对象
**/ **/
@Override @Override
public IPage<DlRepairTickets> getPageByRole(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page){ public IPage<DlRepairTickets> getPageByRole(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page) {
String userRoleCode = getUserRole(); String userRoleCode = getUserRole();
// 当前操作人的id
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
// 维修服务顾问 // 维修服务顾问
if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())){ if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
repairTicketsReqVO.setNowRepairId(loginUserId);
}else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())){ repairTicketsReqVO.setIsFinish("1");
} else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
// 总检 // 总检
}else { repairTicketsReqVO.setNowRepairId(loginUserId);
repairTicketsReqVO.setIsFinish("0");
} else {
return null; return null;
} }
// 还是用分类查询不过需要重新构造查询条件 todo // 还是用分类查询不过需要重新构造查询条件
return baseMapper.getPageType(repairTicketsReqVO, page); return baseMapper.getPageType(repairTicketsReqVO, page);
} }
/**
* 维修总检完成总检
*
* @author 小李
* @date 16:48 2024/10/23
* @param respVO 请求对象
**/
@Override
@DSTransactional
public void inspection(DlRepairTicketsRespVO respVO){
// 新增日志
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())
);
// 通知服务顾问
DlRepairTickets tickets = baseMapper.selectById(respVO.getId());
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的工单可以出厂检验");
}
/**
* 服务顾问上传出厂检验日志
*
* @author 小李
* @date 17:47 2024/10/23
* @param respVO 请求对象
**/
@Override
public void confirm(DlRepairTicketsRespVO respVO){
// 更新工单状态
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
.set(DlRepairTickets::getTicketsWorkStatus, "03")
.eq(DlRepairTickets::getId, respVO.getId())
);
// 记录日志
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JSGD.getCode(), respVO.getRemark(), respVO.getImage());
}
} }

View File

@ -256,7 +256,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
// 类型为配件 // 类型为配件
item.setItemType("02"); item.setItemType("02");
// 状态为未领料 // 状态为未领料
item.setItemStatus("08"); item.setItemStatus("03");
}); });
repairTitemService.saveBatch(respVO.getWares()); repairTitemService.saveBatch(respVO.getWares());

View File

@ -226,6 +226,9 @@
</when> </when>
</choose> </choose>
</if> </if>
<if test="map.nowRepairId != null and map.nowRepairId != ''">
and drt.now_repair_id = #{map.nowRepairId}
</if>
order by drt.create_time desc order by drt.create_time desc
</select> </select>