Merge branch 'repair'

This commit is contained in:
Vinjor 2025-01-09 18:07:36 +08:00
commit 3949466a11
16 changed files with 349 additions and 49 deletions

View File

@ -147,5 +147,14 @@ public class CarMain extends TenantBaseDO {
@ExcelProperty("最近业务时间") @ExcelProperty("最近业务时间")
private LocalDateTime recentlyHandleBusinessTime; private LocalDateTime recentlyHandleBusinessTime;
/** 保险公司名称 */
private String insuranceName;
/** 承保险种,多个英文逗号隔开 */
private String insuranceType;
/** 交强险保费 */
private BigDecimal jiaoqiang;
/** 商业险保费 */
private BigDecimal shangye;
/** 车龄 */
private Double carYear;
} }

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
@ -113,4 +114,10 @@ public class CustomerMain extends TenantBaseDO {
*/ */
private String isHangAccount; private String isHangAccount;
/**
* 客户来源text
*/
@TableField(exist = false)
private String dataFromText;
} }

View File

@ -180,4 +180,7 @@ public class Tickets extends TenantBaseDO {
/** 工单完成情况0:未完成1:已完成) */ /** 工单完成情况0:未完成1:已完成) */
private String isFinish; private String isFinish;
/** 是否交车0未交车|1已交车 */
private String isHandover;
} }

View File

@ -4,7 +4,6 @@ import cn.iocoder.yudao.module.tickets.entity.Tickets;
import cn.iocoder.yudao.module.tickets.mapper.TicketsMapper; import cn.iocoder.yudao.module.tickets.mapper.TicketsMapper;
import cn.iocoder.yudao.module.tickets.service.BaseRepairRecordsService; import cn.iocoder.yudao.module.tickets.service.BaseRepairRecordsService;
import cn.iocoder.yudao.module.tickets.service.TicketsService; import cn.iocoder.yudao.module.tickets.service.TicketsService;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -21,7 +20,7 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsMapper, Tickets> impl
private BaseRepairRecordsService baseRepairRecordsService; private BaseRepairRecordsService baseRepairRecordsService;
/** /**
* 更新工单状态为已结账 * 更新工单状态为已结账-----小程序结算工单
* 考虑可能有批量操作的情况采用批量更新的方式 * 考虑可能有批量操作的情况采用批量更新的方式
* *
* @author 小李 * @author 小李
@ -30,15 +29,17 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsMapper, Tickets> impl
**/ **/
@Override @Override
public void updateTickets(List<String> ticketIds){ public void updateTickets(List<String> ticketIds){
baseMapper.update(new LambdaUpdateWrapper<Tickets>() for (String id:ticketIds){
.in(Tickets::getId, ticketIds) Tickets tickets = this.getById(id);
.set(Tickets::getTicketsStatus, "02") if("1".equals(tickets.getIsHandover())){
// 不在这儿结束 //已交车已结算那么需要把工单状态置为已完成
// .set(Tickets::getIsFinish, "1") tickets.setTicketsStatus("08");
); tickets.setIsFinish("1");
// 记录日志 }else{
if(!ticketIds.isEmpty()){ tickets.setTicketsStatus("02");
baseRepairRecordsService.saveRepairRecord(ticketIds.get(0), null, "js", "线上支付结算", null); }
this.updateById(tickets);
baseRepairRecordsService.saveRepairRecord(id, null, "js", "线上支付结算", null);
} }
} }
} }

View File

@ -15,6 +15,10 @@ public enum RecordTypeEnum {
* 创建工单 * 创建工单
*/ */
CJGD("cjgd","创建工单"), CJGD("cjgd","创建工单"),
/**
* 修改工单
*/
XGGD("xggd","修改工单"),
/** /**
* 指派施工 * 指派施工
*/ */

View File

@ -16,6 +16,10 @@ public class RepairCons {
public static final String DICT_REPAIR_RECORDS_TYPE = "repair_records_type"; public static final String DICT_REPAIR_RECORDS_TYPE = "repair_records_type";
/**数据字典常量-repair_type-*/ /**数据字典常量-repair_type-*/
public static final String DICT_REPAIR_TYPE = "repair_type"; public static final String DICT_REPAIR_TYPE = "repair_type";
/**数据字典常量-cus_data_from-*/
public static final String DICT_CUS_DATA_FROM = "cus_data_from";
/**数据字典常量-insurance_type-*/
public static final String DICT_INSURANCE_TYPE = "insurance_type";
/**数据字典常量-repair_unit-*/ /**数据字典常量-repair_unit-*/
public static final String DICT_REPAIR_UNIT = "repair_unit"; public static final String DICT_REPAIR_UNIT = "repair_unit";
/**数据字典常量-repair_unit-*/ /**数据字典常量-repair_unit-*/

View File

@ -36,9 +36,9 @@ public enum TicketsStatusEnum {
*/ */
CHECK_OUT("02","已结账"), CHECK_OUT("02","已结账"),
/** /**
* 交车 * 完成
*/ */
OVER("08","交车"), OVER("08","完成"),
/** /**
* 已作废 * 已作废
*/ */

View File

@ -3,10 +3,16 @@ package cn.iocoder.yudao.module.tickets.controller.admin;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.common.RecordTypeEnum;
import cn.iocoder.yudao.common.RepairCons; import cn.iocoder.yudao.common.RepairCons;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CarMainService;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService; import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
import cn.iocoder.yudao.module.tickets.vo.*; import cn.iocoder.yudao.module.tickets.vo.*;
@ -19,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -39,6 +46,12 @@ public class DlRepairTicketsController {
*/ */
@Resource @Resource
private DlRepairTicketsService dlRepairTicketsService; private DlRepairTicketsService dlRepairTicketsService;
@Resource
private CustomerMainService customerMainService;
@Resource
private CarMainService carMainService;
@Resource
private RepairRecordsService repairRecordsService;
/** /**
@ -86,6 +99,80 @@ public class DlRepairTicketsController {
return success(dlRepairTicketsService.getTicketsById(id,ifApp)); return success(dlRepairTicketsService.getTicketsById(id,ifApp));
} }
/**
* 查工单主表信息
* @author vinjor-M
* @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);
CustomerMain customerMain = customerMainService.getById(repairTickets.getUserId());
respVO.setCustomerInfo(customerMain);
return success(respVO);
}
/**
* 维修工单表 更新
* @author vinjor-M
* @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) {
//更新客户表
CustomerMain customerMain = new CustomerMain();
customerMain.setId(repairTickets.getUserId());
customerMain.setCusName(repairTickets.getUserName());
customerMain.setDataFrom(repairTickets.getCusFrom());
customerMain.setPhoneNumber(repairTickets.getUserMobile());
customerMainService.updateById(customerMain);
//更新车辆表
CarMain carMain = new CarMain();
carMain.setId(repairTickets.getCarId());
//保养日期
if(null!=repairTickets.getMaintenanceDate()){
carMain.setMaintenanceDate(repairTickets.getMaintenanceDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
//保养里程
if(null!=repairTickets.getMaintenanceMileage()) {
carMain.setMaintenanceMileage(repairTickets.getMaintenanceMileage());
}
//下次年检日期
if(null!=repairTickets.getNextInspectionDate()) {
carMain.setNextInspectionDate(repairTickets.getNextInspectionDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
//保险到期日期
if(null!=repairTickets.getInsuranceExpiryDate()) {
carMain.setInsuranceExpiryDate(repairTickets.getInsuranceExpiryDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
//保险公司名称
if(null!=repairTickets.getInsuranceName()) {
carMain.setInsuranceName(repairTickets.getInsuranceName());
}
//承保险种,多个英文逗号隔开
if(null!=repairTickets.getInsuranceType()) {
carMain.setInsuranceType(repairTickets.getInsuranceType());
}
if(null!=repairTickets.getJiaoqiang()) {
carMain.setJiaoqiang(repairTickets.getJiaoqiang());
}
if(null!=repairTickets.getShangye()) {
carMain.setShangye(repairTickets.getShangye());
}
carMainService.updateById(carMain);
//最后记录操作日志--创建工单
repairRecordsService.saveRepairRecord(repairTickets.getId(), null, RecordTypeEnum.XGGD.getCode(), "修改工单", repairTickets.getImage());
return CommonResult.success(dlRepairTicketsService.updateById(repairTickets));
}
/** /**
* 维修工单表 作废 * 维修工单表 作废
* *

View File

@ -23,6 +23,7 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.ok;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/** /**
@ -221,6 +222,22 @@ public class DlTicketWaresController {
return success(dlTicketWaresService.getByIds(ids)); return success(dlTicketWaresService.getByIds(ids));
} }
/**
* 确认申领完成配件申请单
* @author vinjor-M
* @date 11:26 2025/1/3
* @param id 配件申请单Id
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@GetMapping("/confirmOver")
@Operation(summary = "确认申领完成")
public CommonResult<?> confirmOver(@RequestParam("id") String id){
DlTicketWares ticketWares = dlTicketWaresService.getById(id);
ticketWares.setIsEnd("1");
dlTicketWaresService.updateById(ticketWares);
return ok();
}
/** /**
* 导出数据 * 导出数据
* *

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.tickets.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -88,6 +89,10 @@ public class DlRepairTickets extends TenantBaseDO {
* 车辆品牌类型(base_car_brand表的brand_type) * 车辆品牌类型(base_car_brand表的brand_type)
*/ */
private String carBrandType; private String carBrandType;
/**
* 业务来源(字典repair_busi_from)
*/
private String busiFrom;
/** /**
* 最近保养日期 * 最近保养日期
*/ */
@ -195,6 +200,8 @@ public class DlRepairTickets extends TenantBaseDO {
/** 工单完成情况0:未完成1:已完成) */ /** 工单完成情况0:未完成1:已完成) */
private String isFinish; private String isFinish;
/** 是否交车0未交车|1已交车 */
private String isHandover;
/** 工单当前施工人id */ /** 工单当前施工人id */
private Long nowRepairId; private Long nowRepairId;
@ -228,4 +235,25 @@ public class DlRepairTickets extends TenantBaseDO {
/** 结算备注 */ /** 结算备注 */
private String billingRemark; private String billingRemark;
/** 年检到期时间 */
private Date nextInspectionDate;
/** 保险到期时间 */
private Date insuranceExpiryDate;
/** 承保险种,多个英文逗号隔开 */
private String insuranceType;
/** 交强险保费 */
private BigDecimal jiaoqiang;
/** 商业险保费 */
private BigDecimal shangye;
/** 更新时上传的图片 */
@TableField(exist = false)
private String image;
/** 维修类型文本 */
@TableField(exist = false)
private String repairTypeText;
/** 支付方式文本 */
@TableField(exist = false)
private String payTypeText;
} }

View File

@ -7,8 +7,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date;
/** /**
* 工单配件申请/退回表 * 工单配件申请/退回表
* *
@ -80,4 +78,6 @@ public class DlTicketWares extends TenantBaseDO {
/** 保险公司联系电话 */ /** 保险公司联系电话 */
private String safeMobile; private String safeMobile;
/** 是否已完成申领0未完成|1已完成 */
private String isEnd;
} }

View File

@ -60,6 +60,7 @@ import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService; import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService;
import cn.iocoder.yudao.module.tickets.service.DlTwItemService; import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
import cn.iocoder.yudao.module.tickets.tools.WordUtil; import cn.iocoder.yudao.module.tickets.tools.WordUtil;
import cn.iocoder.yudao.module.tickets.utils.TicketsOperateUtil;
import cn.iocoder.yudao.module.tickets.vo.*; import cn.iocoder.yudao.module.tickets.vo.*;
import cn.iocoder.yudao.util.CreateQRCodeUtil; import cn.iocoder.yudao.util.CreateQRCodeUtil;
import cn.iocoder.yudao.util.SendSmsUtil; import cn.iocoder.yudao.util.SendSmsUtil;
@ -195,6 +196,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
private CompanyService companyService; private CompanyService companyService;
@Resource @Resource
private AdminUserService userService; private AdminUserService userService;
@Resource
private TicketsOperateUtil operateUtil;
/** /**
* 维修工单表 新增 * 维修工单表 新增
@ -239,20 +242,53 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
ticketsRespVO.setCorpId(dept.getCorpId()); ticketsRespVO.setCorpId(dept.getCorpId());
} }
/* 更新车辆的最近保养日期、最近保养公里数 start */ /* 更新车辆的字段最近保养日期、最近保养公里数等等 start */
if(null!=ticketsRespVO.getMaintenanceDate() || null!= ticketsRespVO.getMaintenanceMileage()){ if(null!=ticketsRespVO.getMaintenanceDate() || null!= ticketsRespVO.getMaintenanceMileage()){
CarMain carMain = new CarMain(); CarMain carMain = carMainService.getById(ticketsRespVO.getCarId());
carMain.setId(ticketsRespVO.getCarId()); if(null!=carMain.getCarRegisterDate()){
carMain.setCarYear(operateUtil.computeCarYear(Date.from(carMain.getCarRegisterDate().atZone(ZoneId.systemDefault()).toInstant())));
}
//保养日期
if(null!=ticketsRespVO.getMaintenanceDate()){ if(null!=ticketsRespVO.getMaintenanceDate()){
carMain.setMaintenanceDate(ticketsRespVO.getMaintenanceDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); carMain.setMaintenanceDate(ticketsRespVO.getMaintenanceDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
} }
//保养里程
if(null!=ticketsRespVO.getMaintenanceMileage()) { if(null!=ticketsRespVO.getMaintenanceMileage()) {
carMain.setMaintenanceMileage(ticketsRespVO.getMaintenanceMileage()); carMain.setMaintenanceMileage(ticketsRespVO.getMaintenanceMileage());
} }
//下次年检日期
if(null!=ticketsRespVO.getNextInspectionDate()) {
carMain.setNextInspectionDate(ticketsRespVO.getNextInspectionDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
//保险到期日期
if(null!=ticketsRespVO.getInsuranceExpiryDate()) {
carMain.setInsuranceExpiryDate(ticketsRespVO.getInsuranceExpiryDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
//保险公司名称
if(null!=ticketsRespVO.getInsuranceName()) {
carMain.setInsuranceName(ticketsRespVO.getInsuranceName());
}
//承保险种,多个英文逗号隔开
if(null!=ticketsRespVO.getInsuranceType()) {
carMain.setInsuranceType(ticketsRespVO.getInsuranceType());
}
if(null!=ticketsRespVO.getJiaoqiang()) {
carMain.setJiaoqiang(ticketsRespVO.getJiaoqiang());
}
if(null!=ticketsRespVO.getShangye()) {
carMain.setShangye(ticketsRespVO.getShangye());
}
carMainService.updateById(carMain); carMainService.updateById(carMain);
} }
/* 更新车辆的最近保养日期、最近保养公里数 end */ /* 更新车辆的最近保养日期、最近保养公里数 end */
/* 更新客户来源 */
if(StringUtils.isNotEmpty(ticketsRespVO.getCusFrom())){
CustomerMain customerMain = customerMainService.getById(ticketsRespVO.getUserId());
customerMain.setDataFrom(ticketsRespVO.getCusFrom());
customerMainService.updateById(customerMain);
}
// 计算参考成本参考毛利领料状态工单进行状态 // 计算参考成本参考毛利领料状态工单进行状态
// TODO 参考成本 暂时为0 // TODO 参考成本 暂时为0
ticketsRespVO.setCost(new BigDecimal("0")); ticketsRespVO.setCost(new BigDecimal("0"));
@ -372,7 +408,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
Map<String,String> repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel)); Map<String,String> repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class); DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
result.setRepairTypeText(repairTypeMap.getOrDefault(dlRepairTickets.getRepairType(),"")); result.setRepairTypeText(repairTypeMap.getOrDefault(dlRepairTickets.getRepairType(),""));
//查是否存在总检完成的记录取出他的时间 //查是否存在总检完成的记录取出他的时间
LambdaQueryWrapper<RepairRecords> queryWrapper = new LambdaQueryWrapper<RepairRecords>() LambdaQueryWrapper<RepairRecords> queryWrapper = new LambdaQueryWrapper<RepairRecords>()
.eq(RepairRecords::getTicketId,id) .eq(RepairRecords::getTicketId,id)
@ -390,11 +425,29 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
//查车辆 //查车辆
if (ObjectUtil.isNotEmpty(dlRepairTickets.getCarId())) { if (ObjectUtil.isNotEmpty(dlRepairTickets.getCarId())) {
CarMainRespVO carInfo = carMainService.queryCarById(dlRepairTickets.getCarId()); CarMainRespVO carInfo = carMainService.queryCarById(dlRepairTickets.getCarId());
//计算车龄
if(null!=carInfo.getCarRegisterDate()){
Double carYear = operateUtil.computeCarYear(Date.from(carInfo.getCarRegisterDate().atZone(ZoneId.systemDefault()).toInstant()));
//更新回去
CarMain carMain = new CarMain();
carMain.setId(dlRepairTickets.getCarId());
carMain.setCarYear(carYear);
if(null==carInfo.getCarYear() ||!carInfo.getCarYear().equals(carYear)){
carMainService.updateById(carMain);
}
carInfo.setCarYear(carYear);
}
result.setCarInfo(carInfo); result.setCarInfo(carInfo);
} }
//查用户信息 //查用户信息
CustomerMain customerInfo = customerService.getById(dlRepairTickets.getUserId()); CustomerMain customerInfo = customerService.getById(dlRepairTickets.getUserId());
if(StringUtils.isNotEmpty(customerInfo.getDataFrom())){
//翻译客户来源
List<DictDataRespDTO> dataFromList = dictDataApi.getDictDataList(DICT_CUS_DATA_FROM);
Map<String,String> dataFromMap = dataFromList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
customerInfo.setDataFromText(dataFromMap.get(customerInfo.getDataFrom()));
}
result.setCustomerInfo(customerInfo); result.setCustomerInfo(customerInfo);
// 查工单子表 // 查工单子表
List<DlRepairTitem> itemList = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id)); List<DlRepairTitem> itemList = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id));
@ -570,6 +623,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
}else { }else {
// 线下支付和签单挂账才是直接结束工单和订单 // 线下支付和签单挂账才是直接结束工单和订单
DlRepairTickets repairTickets = this.getById(repairTicketsRespVO.getId());
if("1".equals(repairTickets.getIsHandover())){
//已交车已结算那么工单状态改为 已完成
repairTicketsRespVO.setTicketsStatus(TicketsStatusEnum.OVER.getCode());
//工单结束
repairTicketsRespVO.setIsFinish("1");
}
// 更新工单 // 更新工单
baseMapper.updateById(repairTicketsRespVO); baseMapper.updateById(repairTicketsRespVO);
// 更新订单 // 更新订单
@ -968,6 +1028,39 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
} }
} }
/**
* 翻译字典
* @author vinjor-M
* @date 16:25 2025/1/9
* @param dlRepairTicketsIPage TODO
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.tickets.entity.DlRepairTickets>
**/
private IPage<DlRepairTickets> dealDictText(IPage<DlRepairTickets> dlRepairTicketsIPage){
//维修类型
List<DictDataRespDTO> repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE);
Map<String,String> repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
//支付方式
List<DictDataRespDTO> payTypeList = dictDataApi.getDictDataList(DICT_REPAIR_PAY_TYPE);
dlRepairTicketsIPage.getRecords().forEach(item->{
if(StringUtils.isNotEmpty(item.getRepairType())){
item.setRepairTypeText(repairTypeMap.get(item.getRepairType()));
}
if(StringUtils.isNotEmpty(item.getPayType())){
payTypeList.forEach(payType->{
if(item.getPayType().contains(payType.getValue())){
if(StringUtils.isEmpty(item.getPayTypeText())){
item.setPayTypeText(payType.getLabel());
}else{
item.setPayTypeText(item.getPayTypeText()+","+payType.getLabel());
}
}
});
}
});
return dlRepairTicketsIPage;
}
/** /**
* 分类查询工单分页 * 分类查询工单分页
* *
@ -982,7 +1075,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
//根据id集和查询 //根据id集和查询
DlRepairTicketsReqVO queryObj = new DlRepairTicketsReqVO(); DlRepairTicketsReqVO queryObj = new DlRepairTicketsReqVO();
queryObj.setIdList(repairTicketsReqVO.getIdList()); queryObj.setIdList(repairTicketsReqVO.getIdList());
return baseMapper.getPageTypeAll(queryObj, page); return dealDictText(baseMapper.getPageTypeAll(queryObj, page));
} }
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) { if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) {
//维修管理员看所有数据 //维修管理员看所有数据
@ -1028,7 +1121,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
} }
if (RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) { if (RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) {
//查待处理 //查待处理
return baseMapper.getPageType(repairTicketsReqVO, page); return dealDictText(baseMapper.getPageType(repairTicketsReqVO, page));
} else { } else {
//查所有, //查所有,
if(("jinchang".equals(repairTicketsReqVO.getTicketsStatus()) || if(("jinchang".equals(repairTicketsReqVO.getTicketsStatus()) ||
@ -1065,23 +1158,25 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
//未结算 //未结算
statusList = Arrays.asList("04","05","07","01"); statusList = Arrays.asList("04","05","07","01");
}else if("zaichang".equals(repairTicketsReqVO.getTicketsStatus())){ }else if("zaichang".equals(repairTicketsReqVO.getTicketsStatus())){
//在厂 //在厂就是没交车的
statusList = Arrays.asList("04","05","07","01","06","02"); repairTicketsReqVO.setIsHandover("0");
// statusList = Arrays.asList("04","05","07","01","06","02");
}else if("jinchang".equals(repairTicketsReqVO.getTicketsStatus())){ }else if("jinchang".equals(repairTicketsReqVO.getTicketsStatus())){
//进厂 //进厂
statusList.add(TicketsStatusEnum.NO_WORK.getCode()); statusList.add(TicketsStatusEnum.NO_WORK.getCode());
}else if("yijungong".equals(repairTicketsReqVO.getTicketsStatus())){ }else if("yijungong".equals(repairTicketsReqVO.getTicketsStatus())){
//已竣工 //已竣工
statusList.add(TicketsStatusEnum.WAITING_NOTICE.getCode()); statusList = Arrays.asList("07","01","06","02","08");
}else if("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())){ }else if("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())){
//已交车 //已交车
statusList.add(TicketsStatusEnum.OVER.getCode()); repairTicketsReqVO.setIsHandover("1");
// statusList.add(TicketsStatusEnum.OVER.getCode());
} }
if(!statusList.isEmpty()){ if(!statusList.isEmpty()){
repairTicketsReqVO.setStatusList(statusList); repairTicketsReqVO.setStatusList(statusList);
} }
} }
return baseMapper.getPageTypeAll(repairTicketsReqVO, page); return dealDictText(baseMapper.getPageTypeAll(repairTicketsReqVO, page));
} }
} }
@ -1628,11 +1723,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
List<String> noPayIdList = new ArrayList<>(); List<String> noPayIdList = new ArrayList<>();
List<DlRepairTickets> repairTickets = this.list(); List<DlRepairTickets> repairTickets = this.list();
if (!repairTickets.isEmpty()) { if (!repairTickets.isEmpty()) {
//维修中
workingIdList = repairTickets.stream().filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList()); workingIdList = repairTickets.stream().filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList());
workingNum = workingIdList.size(); workingNum = workingIdList.size();
//只要没交车都算在厂 //只要没交车都算在厂
List<String> inCompanyCodeList = Arrays.asList("04","05","07","01","06","02"); inCompanyIdList = repairTickets.stream().filter(item -> "0".equals(item.getIsHandover())).map(DlRepairTickets::getId).collect(Collectors.toList());
inCompanyIdList = repairTickets.stream().filter(item -> inCompanyCodeList.contains(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList());
inCompanyNum = inCompanyIdList.size(); inCompanyNum = inCompanyIdList.size();
//只要没结算都是未结算 //只要没结算都是未结算
List<String> noPayCodeList = Arrays.asList("04","05","07","01"); List<String> noPayCodeList = Arrays.asList("04","05","07","01");
@ -1655,10 +1750,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
newOrderIdList = repairTickets.stream().map(DlRepairTickets::getId).collect(Collectors.toList()); newOrderIdList = repairTickets.stream().map(DlRepairTickets::getId).collect(Collectors.toList());
newOrderNum = repairTickets.size(); newOrderNum = repairTickets.size();
//查累计已完成的总检完成的 //查累计已完成的总检完成的
overIdList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.ZJ.getCode(),null,null); List<String> overCodeList = Arrays.asList("07","01","06","02","08");
overIdList = repairTickets.stream().filter(item -> overCodeList.contains(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList());
overNum = overIdList.size(); overNum = overIdList.size();
//查累计已交车的已结算的 //查累计已交车的
giveCusIdList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.JC.getCode(),null,null); giveCusIdList = repairTickets.stream().filter(item -> "1".equals(item.getIsHandover())).map(DlRepairTickets::getId).collect(Collectors.toList());
giveCusNum = giveCusIdList.size(); giveCusNum = giveCusIdList.size();
}else { }else {
//查某个时间范围内进厂数已完成已交车 //查某个时间范围内进厂数已完成已交车
@ -2018,18 +2114,21 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
**/ **/
@Override @Override
public void overOrder(DlRepairTicketsRespVO respVO) { public void overOrder(DlRepairTicketsRespVO respVO) {
DlRepairTickets repairTickets = this.getById(respVO.getId());
if(TicketsStatusEnum.NO_PAY.getCode().equals(repairTickets.getTicketsStatus())){
//没结账呢还
repairTickets.setIsHandover("1");
}else{
//结完账了
repairTickets.setIsHandover("1");
repairTickets.setTicketsStatus(TicketsStatusEnum.OVER.getCode());
repairTickets.setTicketsWorkStatus(TicketsWorkStatusEnum.END.getCode());
repairTickets.setIsFinish("1");
}
// 更新工单状态 // 更新工单状态
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>() this.updateById(repairTickets);
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.END.getCode())
.set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.OVER.getCode())
//交车时才能把工单置为完成
.set(DlRepairTickets::getIsFinish, "1")
.eq(DlRepairTickets::getId, respVO.getId())
);
// 记录日志 // 记录日志
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JC.getCode(), respVO.getRemark(), respVO.getImage()); repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JC.getCode(), respVO.getRemark(), respVO.getImage());
refreshUpdateTime(respVO.getId()); refreshUpdateTime(respVO.getId());
} }

View File

@ -1,9 +1,10 @@
package cn.iocoder.yudao.module.tickets.utils; package cn.iocoder.yudao.module.tickets.utils;
import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.hutool.core.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date;
/** /**
* 工单操作常用util * 工单操作常用util
* @author vinjor-M * @author vinjor-M
@ -11,8 +12,17 @@ import org.springframework.stereotype.Component;
**/ **/
@Component @Component
public class TicketsOperateUtil { public class TicketsOperateUtil {
@Autowired
private RepairRecordsService repairRecordsService;
/**
* 计算车龄
* @author vinjor-M
* @date 14:47 2025/1/9
* @param registerDate 车辆注册日期
* @return java.lang.Double
**/
public Double computeCarYear(Date registerDate){
long betweenMonth = DateUtil.betweenMonth(registerDate, new Date(), true);
String carYear = String.format("%.2f", (double) betweenMonth / 12);
return Double.parseDouble(carYear);
}
} }

View File

@ -72,4 +72,7 @@ public class DlRepairTicketsRespVO extends DlRepairTickets {
private String repairTypeText; private String repairTypeText;
/** 车辆实际竣工(总检完成)时间 */ /** 车辆实际竣工(总检完成)时间 */
private String realOverDate; private String realOverDate;
/** 客户来源 */
private String cusFrom;
} }

View File

@ -17,6 +17,7 @@
<result property="carBrandId" column="car_brand_id" jdbcType="VARCHAR"/> <result property="carBrandId" column="car_brand_id" jdbcType="VARCHAR"/>
<result property="carBrandName" column="car_brand_name" jdbcType="VARCHAR"/> <result property="carBrandName" column="car_brand_name" jdbcType="VARCHAR"/>
<result property="carBrandType" column="car_brand_type" jdbcType="VARCHAR"/> <result property="carBrandType" column="car_brand_type" jdbcType="VARCHAR"/>
<result property="busiFrom" column="busi_from" jdbcType="VARCHAR"/>
<result property="adviserId" column="adviser_id" jdbcType="VARCHAR"/> <result property="adviserId" column="adviser_id" jdbcType="VARCHAR"/>
<result property="adviserName" column="adviser_name" jdbcType="VARCHAR"/> <result property="adviserName" column="adviser_name" jdbcType="VARCHAR"/>
<result property="payType" column="pay_type" jdbcType="VARCHAR"/> <result property="payType" column="pay_type" jdbcType="VARCHAR"/>
@ -54,6 +55,11 @@
<result property="threePackMoney" column="three_pack_money" /> <result property="threePackMoney" column="three_pack_money" />
<result property="confirmFaultMoney" column="confirm_fault_money" /> <result property="confirmFaultMoney" column="confirm_fault_money" />
<result property="billingRemark" column="billing_remark" /> <result property="billingRemark" column="billing_remark" />
<result property="nextInspectionDate" column="next_inspection_date" />
<result property="insuranceExpiryDate" column="insurance_expiry_date" />
<result property="insuranceType" column="insurance_type" />
<result property="jiaoqiang" column="jiaoqiang" />
<result property="shangye" column="shangye" />
</resultMap> </resultMap>
<resultMap id="APPBaseResultMap" type="cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO"> <resultMap id="APPBaseResultMap" type="cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO">
@ -69,6 +75,7 @@
<result property="carBrandId" column="car_brand_id" jdbcType="VARCHAR"/> <result property="carBrandId" column="car_brand_id" jdbcType="VARCHAR"/>
<result property="carBrandName" column="car_brand_name" jdbcType="VARCHAR"/> <result property="carBrandName" column="car_brand_name" jdbcType="VARCHAR"/>
<result property="carBrandType" column="car_brand_type" jdbcType="VARCHAR"/> <result property="carBrandType" column="car_brand_type" jdbcType="VARCHAR"/>
<result property="busiFrom" column="busi_from" jdbcType="VARCHAR"/>
<result property="adviserId" column="adviser_id" jdbcType="VARCHAR"/> <result property="adviserId" column="adviser_id" jdbcType="VARCHAR"/>
<result property="adviserName" column="adviser_name" jdbcType="VARCHAR"/> <result property="adviserName" column="adviser_name" jdbcType="VARCHAR"/>
<result property="payType" column="pay_type" jdbcType="VARCHAR"/> <result property="payType" column="pay_type" jdbcType="VARCHAR"/>
@ -106,6 +113,11 @@
<result property="threePackMoney" column="three_pack_money" /> <result property="threePackMoney" column="three_pack_money" />
<result property="confirmFaultMoney" column="confirm_fault_money" /> <result property="confirmFaultMoney" column="confirm_fault_money" />
<result property="billingRemark" column="billing_remark" /> <result property="billingRemark" column="billing_remark" />
<result property="nextInspectionDate" column="next_inspection_date" />
<result property="insuranceExpiryDate" column="insurance_expiry_date" />
<result property="insuranceType" column="insurance_type" />
<result property="jiaoqiang" column="jiaoqiang" />
<result property="shangye" column="shangye" />
<result property="canOperate" column="can_operate" /> <result property="canOperate" column="can_operate" />
<result property="handleName" column="handle_name" /> <result property="handleName" column="handle_name" />
<result property="handleMobile" column="handle_mobile" /> <result property="handleMobile" column="handle_mobile" />
@ -126,6 +138,7 @@
car_brand_id, car_brand_id,
car_brand_name, car_brand_name,
car_brand_type, car_brand_type,
busi_from,
adviser_id, adviser_id,
adviser_name, adviser_name,
pay_type, pay_type,
@ -164,7 +177,12 @@
confirm_fault_money, confirm_fault_money,
billing_remark, billing_remark,
handle_name, handle_name,
handle_mobile handle_mobile,
nextInspection_date,
insuranceExpiry_date,
insurance_type,
jiaoqiang,
shangye
from dl_repair_tickets drt from dl_repair_tickets drt
where drt.deleted = '0' where drt.deleted = '0'
</sql> </sql>
@ -353,7 +371,7 @@
left join base_customer_main bcm ON drt.user_id = bcm.id left join base_customer_main bcm ON drt.user_id = bcm.id
</if> </if>
left join dl_repair_titem drti left join dl_repair_titem drti
on drt.id = drti.ticket_id AND drti.deleted = '0' on drt.id = drti.ticket_id AND drti.deleted = '0' AND drti.item_type='01'
where drt.deleted = '0' where drt.deleted = '0'
<if test="map.ticketNo != null and map.ticketNo != ''"> <if test="map.ticketNo != null and map.ticketNo != ''">
and ( and (
@ -366,6 +384,12 @@
drt.user_mobile like concat('%', #{map.ticketNo}, '%') drt.user_mobile like concat('%', #{map.ticketNo}, '%')
or or
drt.remark like concat('%', #{map.ticketNo}, '%') drt.remark like concat('%', #{map.ticketNo}, '%')
or
drt.car_brand_name like concat('%', #{map.ticketNo}, '%')
or
drt.handle_name like concat('%', #{map.ticketNo}, '%')
or
drti.item_name like concat('%', #{map.ticketNo}, '%')
) )
</if> </if>
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0"> <if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
@ -411,6 +435,10 @@
-- 服务顾问查所有的就是服务顾问是自己的 -- -- 服务顾问查所有的就是服务顾问是自己的 --
and drt.adviser_id = #{map.adviserId} and drt.adviser_id = #{map.adviserId}
</if> </if>
<if test="map.isHandover != null and map.isHandover != ''">
-- 是否交车 --
and drt.is_handover = #{map.isHandover}
</if>
<if test="map.userIds != null and map.userIds.size > 0"> <if test="map.userIds != null and map.userIds.size > 0">
-- 维修工或维修厂长查所有的就是维修人是自己的或者是自己班组内的 -- -- 维修工或维修厂长查所有的就是维修人是自己的或者是自己班组内的 --
and ( and (

View File

@ -54,7 +54,7 @@
from dl_ticket_wares dtw from dl_ticket_wares dtw
left join dl_repair_tickets drt left join dl_repair_tickets drt
on dtw.ticket_id = drt.id on dtw.ticket_id = drt.id
where dtw.deleted = '0' where dtw.deleted = '0' AND dtw.is_end='0'
</sql> </sql>
<select id="getPage" resultMap="BaseResultMap"> <select id="getPage" resultMap="BaseResultMap">