This commit is contained in:
xuyuncong 2025-11-27 10:58:41 +08:00
parent b160d368d1
commit 030f465c2a
4 changed files with 76 additions and 65 deletions

View File

@ -150,7 +150,7 @@ public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, Custo
customerMainService.save(customerMain);
}
//根据客户信息+车牌号查这个客户是否已有这个车
CarMain carMain = carMainService.selectByCusIdAndCarNumber(saveReqVO.getId(),saveReqVO.getCar().getLicenseNumber());
CarMain carMain = carMainService.selectByCusIdAndCarNumber(customerMain.getId(),saveReqVO.getCar().getLicenseNumber());
if(null==carMain){
//这个客户不存在这个车辆信息新增
carMain = saveReqVO.getCar();
@ -158,7 +158,7 @@ public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, Custo
carMainService.save(carMain);
//客户和车的关联关系
CustomerCar customerCar = new CustomerCar();
customerCar.setCusId(saveReqVO.getId());
customerCar.setCusId(customerMain.getId());
customerCar.setCarId(carMain.getId());
//默认车主
customerCar.setIsOwner("1");

View File

@ -62,7 +62,7 @@
<select id="selectCarListByCusId" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
SELECT
<include refid="baseCarMainColumn"></include>,
main.is_owner AS isOwner,bcb.brand_name AS brandStr,bcm.model_name AS modelStr
main.is_owner AS isOwner,bcb.brand_name AS brandStr,bcm.model_name AS modelStr,bcb.logo_img
FROM
base_customer_car main
LEFT JOIN

View File

@ -116,8 +116,8 @@ public class DlRepairTicketsController {
**/
@GetMapping("/get")
@Operation(summary = "查看一个工单的详细信息")
public CommonResult<?> getTicketsById(@RequestParam("id") String id,@RequestParam(required = false, value = "ifApp", defaultValue = "false")Boolean ifApp) {
return success(dlRepairTicketsService.getTicketsById(id,ifApp));
public CommonResult<?> getTicketsById(@RequestParam("id") String id, @RequestParam(required = false, value = "ifApp", defaultValue = "false") Boolean ifApp) {
return success(dlRepairTicketsService.getTicketsById(id, ifApp));
}
/**
@ -126,13 +126,13 @@ public class DlRepairTicketsController {
* @date 14:12 2025/1/8
* @param id 工单ID
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
**/
@GetMapping("/getById")
@Operation(summary = "查工单主表信息")
public CommonResult<?> getById(@RequestParam("id") String id) {
DlRepairTickets repairTickets = dlRepairTicketsService.getById(id);
DlRepairTicketsRespVO respVO = new DlRepairTicketsRespVO();
org.springframework.beans.BeanUtils.copyProperties(repairTickets,respVO);
org.springframework.beans.BeanUtils.copyProperties(repairTickets, respVO);
CustomerMain customerMain = customerMainService.getById(repairTickets.getUserId());
respVO.setCustomerInfo(customerMain);
return success(respVO);
@ -144,7 +144,7 @@ public class DlRepairTicketsController {
* @date 14:42 2025/1/8
* @param repairTickets 工单ID
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
**/
@PostMapping("/updateById")
@Operation(summary = "维修工单表 更新")
public CommonResult<?> updateById(@RequestBody DlRepairTicketsRespVO repairTickets) {
@ -159,33 +159,33 @@ public class DlRepairTicketsController {
CarMain carMain = new CarMain();
carMain.setId(repairTickets.getCarId());
//保养日期
if(null!=repairTickets.getMaintenanceDate()){
if (null != repairTickets.getMaintenanceDate()) {
carMain.setMaintenanceDate(repairTickets.getMaintenanceDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
//保养里程
if(null!=repairTickets.getMaintenanceMileage()) {
if (null != repairTickets.getMaintenanceMileage()) {
carMain.setMaintenanceMileage(repairTickets.getMaintenanceMileage());
}
//下次年检日期
if(null!=repairTickets.getNextInspectionDate()) {
if (null != repairTickets.getNextInspectionDate()) {
carMain.setNextInspectionDate(repairTickets.getNextInspectionDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
//保险到期日期
if(null!=repairTickets.getInsuranceExpiryDate()) {
if (null != repairTickets.getInsuranceExpiryDate()) {
carMain.setInsuranceExpiryDate(repairTickets.getInsuranceExpiryDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
//保险公司名称
if(null!=repairTickets.getInsuranceName()) {
if (null != repairTickets.getInsuranceName()) {
carMain.setInsuranceName(repairTickets.getInsuranceName());
}
//承保险种,多个英文逗号隔开
if(null!=repairTickets.getInsuranceType()) {
if (null != repairTickets.getInsuranceType()) {
carMain.setInsuranceType(repairTickets.getInsuranceType());
}
if(null!=repairTickets.getJiaoqiang()) {
if (null != repairTickets.getJiaoqiang()) {
carMain.setJiaoqiang(repairTickets.getJiaoqiang());
}
if(null!=repairTickets.getShangye()) {
if (null != repairTickets.getShangye()) {
carMain.setShangye(repairTickets.getShangye());
}
carMainService.updateById(carMain);
@ -349,10 +349,12 @@ public class DlRepairTicketsController {
}
/**
* @description : 根据工单id集合获取子项目
* @author xyc
* @date 9:50 2025/11/11
* @param [ticketIds, selectType]
* 根据工单id集合获取子项目
*
* @author
* @date 14:00 2025/11/26
* @param ticketIds 工单id集合
* @param selectType 查询类型
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@GetMapping("/getProjectByTicketIds")
@ -382,9 +384,9 @@ public class DlRepairTicketsController {
@GetMapping("/take")
@Operation(summary = "接单")
public CommonResult<?> updateTake(@RequestParam("id") String id,
@RequestParam(value="image",required = false) String image,
@RequestParam(value="remark",required = false) String remark) {
dlRepairTicketsService.updateTake(id,image);
@RequestParam(value = "image", required = false) String image,
@RequestParam(value = "remark", required = false) String remark) {
dlRepairTicketsService.updateTake(id, image);
return CommonResult.ok();
}
@ -456,7 +458,7 @@ public class DlRepairTicketsController {
* @author 小李
* @date 16:48 2024/10/23
* @param respVO 请求对象
**/
**/
@PostMapping("/inspection")
@Operation(summary = "维修总检完成总检")
public CommonResult<?> inspection(@RequestBody DlRepairTicketsRespVO respVO) {
@ -470,7 +472,7 @@ public class DlRepairTicketsController {
* @author 小李
* @date 17:47 2024/10/23
* @param respVO 请求对象
**/
**/
@PostMapping("/confirm")
@Operation(summary = "服务顾问上传出厂检验日志")
public CommonResult<?> confirm(@RequestBody DlRepairTicketsRespVO respVO) {
@ -484,28 +486,29 @@ public class DlRepairTicketsController {
* @date 16:51 2024/11/13
* @param respVO
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
**/
@PostMapping("/overOrder")
@Operation(summary = "服务顾问交车")
public CommonResult<?> overOrder(@RequestBody DlRepairTicketsRespVO respVO) {
dlRepairTicketsService.overOrder(respVO);
return CommonResult.ok();
}
/**
* 从总检的角度查进场数维修中已完成已交车在厂的工单数量
* @author vinjor-M
* @date 11:29 2024/10/24
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
**/
@GetMapping("/getBossNum")
@Operation(summary = "从总检的角度查进场数、维修中、已完成、已交车、在厂的工单数量")
public CommonResult<?> getBossNum(String selectType,String startDate,String endDate) {
public CommonResult<?> getBossNum(String selectType, String startDate, String endDate) {
return success(dlRepairTicketsService.getBossNum(selectType, startDate, endDate));
}
/**
* @Author
* @Description 数据统计-新版
* @Description 数据统计-新版
* @Date 10:53 2025/9/1
* @Param [startDate, endDate]
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
@ -519,15 +522,15 @@ public class DlRepairTicketsController {
/**
* @Author
* @Description 统计详情-细分工单类型
* @Description 统计详情-细分工单类型
* @Date 14:14 2025/9/3
* @Param [startDate, endDate]
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@GetMapping("/getBossNumStatistics")
public CommonResult<?> getBossNumStatistics(@RequestParam(value = "dateRange[0]", required = false) String startDate,
@RequestParam(value = "dateRange[1]", required = false) String endDate) {
return success(dlRepairTicketsService.getBossNumStatistics(startDate, endDate,null,null, true));
@RequestParam(value = "dateRange[1]", required = false) String endDate) {
return success(dlRepairTicketsService.getBossNumStatistics(startDate, endDate, null, null, true));
}
/**
@ -539,23 +542,23 @@ public class DlRepairTicketsController {
@GetMapping("/getDateRange")
@Operation(summary = "获取日期范围")
public CommonResult<?> getDateRange(String selectType) {
Map<String,String> rtnMap = new HashMap<>();
Map<String, String> rtnMap = new HashMap<>();
// 获取当前日期
Date currentDate = new Date();
String nowDay = DateUtil.formatDate(new Date());
rtnMap.put("endDate",nowDay);
if("threeMonth".equals(selectType)){
rtnMap.put("endDate", nowDay);
if ("threeMonth".equals(selectType)) {
//近3个月
// 使用Hutool的DateUtil推移3个月
Date threeMonthsAgo = DateUtil.offsetMonth(currentDate, -3);
String startDay = DateUtil.formatDate(threeMonthsAgo);
rtnMap.put("startDate",startDay);
}else {
rtnMap.put("startDate", startDay);
} else {
//近6个月
// 使用Hutool的DateUtil推移6个月
Date threeMonthsAgo = DateUtil.offsetMonth(currentDate, -6);
String startDay = DateUtil.formatDate(threeMonthsAgo);
rtnMap.put("startDate",startDay);
rtnMap.put("startDate", startDay);
}
return success(rtnMap);
}
@ -566,7 +569,7 @@ public class DlRepairTicketsController {
* @author 小李
* @date 22:40 2024/10/23
* @param noticeCusVO 请求对象
**/
**/
@PostMapping("/noticeCus")
@Operation(summary = "服务顾问通知客户取车")
public CommonResult<?> noticeCus(@RequestBody NoticeCusVO noticeCusVO) {
@ -583,7 +586,7 @@ public class DlRepairTicketsController {
**/
@GetMapping("/hasPrice")
@Operation(summary = "判断是否工单子表的任何一个类目没有价格或价格为0")
public CommonResult<?> hasPrice(@RequestParam("id")String id){
public CommonResult<?> hasPrice(@RequestParam("id") String id) {
return success(dlRepairTicketsService.hasPrice(id));
}
@ -593,7 +596,7 @@ public class DlRepairTicketsController {
* @author 小李
* @date 19:59 2024/10/24
* @param respVO 主要有两个参数主表ID,itemList(这个需要前端处理成子表的对象能接收的数据)
**/
**/
@PostMapping("/addItems")
@Operation(summary = "新增工单子项")
public CommonResult<?> addItems(@RequestBody DlRepairTicketsRespVO respVO) {
@ -607,7 +610,7 @@ public class DlRepairTicketsController {
* @author 小李
* @date 10:25 2024/10/30
* @param respVO 请求对象
**/
**/
@PostMapping("/updateTicket")
@Operation(summary = "修改工单主表,只是主表")
public CommonResult<?> updateTicket(@RequestBody DlRepairTicketsRespVO respVO) {
@ -621,7 +624,7 @@ public class DlRepairTicketsController {
* @author 小李
* @date 20:05 2024/11/1
* @param id 工单ID
**/
**/
@DeleteMapping("/remove")
@Operation(summary = "删除工单")
public CommonResult<?> removeTicketById(@RequestParam("id") String id) {
@ -635,7 +638,7 @@ public class DlRepairTicketsController {
* @author 小李
* @date 19:07 2024/11/18
* @param id id
**/
**/
@GetMapping("/getCusAndCarById")
@Operation(summary = "根据工单ID查客户和车辆信息")
public CommonResult<?> getCusAndCarById(@RequestParam("id") String id) {
@ -644,7 +647,7 @@ public class DlRepairTicketsController {
/**
* @Author
* @Description 工单统计
* @Description 工单统计
* @Date 15:53 2025/8/19
* @Param [repairTicketsReqVO]
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
@ -660,10 +663,10 @@ public class DlRepairTicketsController {
* @author 小李
* @date 14:51 2024/12/3
* @param repairTicketsReqVO 请求对象
**/
**/
@GetMapping("/export")
@Operation(summary = "导出数据")
public void exportData(DlRepairTicketsReqVO repairTicketsReqVO, HttpServletResponse response)throws IOException {
public void exportData(DlRepairTicketsReqVO repairTicketsReqVO, HttpServletResponse response) throws IOException {
int pageNo = 1, pageSize = 1000;
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
if (StringUtils.isEmpty(repairTicketsReqVO.getSelectType())) {
@ -674,15 +677,15 @@ public class DlRepairTicketsController {
do {
IPage<DlRepairTickets> pageType = dlRepairTicketsService.getPageType(repairTicketsReqVO, page);
List<DlRepairTickets> records = pageType.getRecords();
if (CollUtil.isEmpty(records)){
if (CollUtil.isEmpty(records)) {
break;
}
List<DlRepairTickets> convertedRecords = records;
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
} while (true);
if (CollUtil.isEmpty(list)) {
throw exception0(500, "没有数据可以导出");
}
@ -713,11 +716,11 @@ public class DlRepairTicketsController {
"毛利:", totalProfit,
"含工时毛利率:", profitRateWithLabor,
"不含工时毛利率:", profitRateWithoutLabor,
"","","",""));
"", "", "", ""));
}
// 第二行写表头
rows.add(CollUtil.newArrayList("订单编号","维修类别", "客户名称", "车牌号", "车系", "手机号", "经办人姓名", "经办人电话", "维修费用", "参考成本", "进场时间", "工作状态"));
rows.add(CollUtil.newArrayList("订单编号", "维修类别", "客户名称", "车牌号", "车系", "手机号", "经办人姓名", "经办人电话", "维修费用", "参考成本", "进场时间", "工作状态"));
// 后面循环写数据
for (DlRepairTickets item : list) {
@ -747,29 +750,29 @@ public class DlRepairTicketsController {
* @author 小李
* @date 15:19 2024/12/3
* @param repairTicketsReqVO 请求对象
**/
**/
@GetMapping("/exportByStatus")
@Operation(summary = "导出数据 根据工单状态")
public void exportByStatus(DlRepairTicketsReqVO repairTicketsReqVO, HttpServletResponse response)throws IOException{
public void exportByStatus(DlRepairTicketsReqVO repairTicketsReqVO, HttpServletResponse response) throws IOException {
int pageNo = 1, pageSize = 1000;
List<TicketExportByStatusVO> list = new ArrayList<>();
Page<DlRepairTicketsRespVO> page = new Page<>(pageNo, pageSize);
do {
IPage<DlRepairTicketsRespVO> ticketsPage = dlRepairTicketsService.getTicketsPage(repairTicketsReqVO, page);
List<DlRepairTicketsRespVO> records = ticketsPage.getRecords();
if (CollUtil.isEmpty(records)){
if (CollUtil.isEmpty(records)) {
break;
}
List<TicketExportByStatusVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, TicketExportByStatusVO.class)).collect(Collectors.toList());
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
}while (true);
if (CollUtil.isEmpty(list)){
} while (true);
if (CollUtil.isEmpty(list)) {
throw exception0(500, "没有数据可以导出");
}
String name = "";
switch (repairTicketsReqVO.getPayStatus()){
switch (repairTicketsReqVO.getPayStatus()) {
case "01":
name = "待结算工单数据.xls";
break;
@ -792,15 +795,15 @@ public class DlRepairTicketsController {
**/
@GetMapping("/pickCar")
public CommonResult<?> pickCar(@RequestParam("id") String id,
@RequestParam(value="image",required = false) String image,
@RequestParam(value="remark",required = false) String remark){
dlRepairTicketsService.pickCar(id,image,remark);
@RequestParam(value = "image", required = false) String image,
@RequestParam(value = "remark", required = false) String remark) {
dlRepairTicketsService.pickCar(id, image, remark);
return CommonResult.ok();
}
/**
* @Author
* @Description 确认收款
* @Description 确认收款
* @Date 11:12 2025/9/18
* @Param [repairTicketsRespVO]
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
@ -817,7 +820,7 @@ public class DlRepairTicketsController {
* @author Lingma
* @date 2025/10/23
* @param repairTicketsReqVO 请求对象
**/
**/
@GetMapping("/exportMerged")
@Operation(summary = "导出数据(合并单元格格式)")
public void exportMergedData(DlRepairTicketsReqVO repairTicketsReqVO, HttpServletResponse response) throws IOException {
@ -832,7 +835,7 @@ public class DlRepairTicketsController {
do {
IPage<DlRepairTicketsRespVO> pageType = dlRepairTicketsService.getTicketsPage(repairTicketsReqVO, page);
List<DlRepairTicketsRespVO> records = pageType.getRecords();
if (CollUtil.isEmpty(records)){
if (CollUtil.isEmpty(records)) {
break;
}
List<DlRepairTicketsRespVO> convertedRecords = records;

View File

@ -2632,12 +2632,20 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
@Override
@DSTransactional
public void updateStatus(DlRepairTicketsRespVO respVO) {
DlRepairTickets tickets = baseMapper.selectById(respVO.getId());
// 如果是开始施工但项目还在施工中就不能施工
if (RecordTypeEnum.KSSG.getCode().equals(respVO.getRecordType())) {
DlRepairTitem titem = titemService.getById(respVO.getItem().getId());
if (TicketsItemStatusEnum.WORKING.getCode().equals(titem.getItemStatus())) {
throw exception0(500, "选择的项目在施工中,不能重新开始施工");
}
// 如果工单状态为代派工 则修改为施工中 //工单状态设置为---施工中
// .set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.WORKING.getCode())
if (TicketsStatusEnum.NO_WORK.getCode().equals(tickets.getTicketsStatus())) {
tickets.setTicketsStatus(TicketsStatusEnum.WORKING.getCode());
}
baseMapper.updateById(tickets);
}
if (StringUtils.isNotEmpty(respVO.getTicketsWorkStatus())) {
@ -2662,7 +2670,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
repairRecordsService.saveRepairRecord(respVO.getId(), respVO.getItem().getId(), respVO.getRecordType(), respVO.getRemark(), respVO.getImage());
// 通知服务顾问和维修总检
DlRepairTickets tickets = baseMapper.selectById(respVO.getId());
DlRepairTitem titem = titemService.getById(respVO.getItem().getId());
/*
消息组成对那个工单那个项目干了什么