工单的编辑

This commit is contained in:
Vinjor 2025-01-08 17:19:54 +08:00
parent 87eb50c282
commit c7eb922c72
12 changed files with 226 additions and 38 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -7,6 +7,10 @@ import cn.iocoder.yudao.common.RepairCons;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
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.service.DlRepairTicketsService;
import cn.iocoder.yudao.module.tickets.vo.*;
@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
@ -39,6 +44,10 @@ public class DlRepairTicketsController {
*/
@Resource
private DlRepairTicketsService dlRepairTicketsService;
@Resource
private CustomerMainService customerMainService;
@Resource
private CarMainService carMainService;
/**
@ -86,6 +95,72 @@ public class DlRepairTicketsController {
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) {
return success(dlRepairTicketsService.getById(id));
}
/**
* 维修工单表 更新
* @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<?> createTicket(@RequestBody DlRepairTickets repairTickets) {
//更新客户表
CustomerMain customerMain = new CustomerMain();
customerMain.setId(repairTickets.getUserId());
customerMain.setCusName(repairTickets.getUserName());
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);
return CommonResult.success(dlRepairTicketsService.updateById(repairTickets));
}
/**
* 维修工单表 作废
*

View File

@ -23,6 +23,7 @@ import java.util.List;
import java.util.stream.Collectors;
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;
/**
@ -221,6 +222,22 @@ public class DlTicketWaresController {
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

@ -195,6 +195,8 @@ public class DlRepairTickets extends TenantBaseDO {
/** 工单完成情况0:未完成1:已完成) */
private String isFinish;
/** 是否交车0未交车|1已交车 */
private String isHandover;
/** 工单当前施工人id */
private Long nowRepairId;
@ -228,4 +230,15 @@ public class DlRepairTickets extends TenantBaseDO {
/** 结算备注 */
private String billingRemark;
/** 年检到期时间 */
private Date nextInspectionDate;
/** 保险到期时间 */
private Date insuranceExpiryDate;
/** 承保险种,多个英文逗号隔开 */
private String insuranceType;
/** 交强险保费 */
private BigDecimal jiaoqiang;
/** 商业险保费 */
private BigDecimal shangye;
}

View File

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

View File

@ -239,16 +239,40 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
ticketsRespVO.setCorpId(dept.getCorpId());
}
/* 更新车辆的最近保养日期、最近保养公里数 start */
/* 更新车辆的字段最近保养日期、最近保养公里数等等 start */
if(null!=ticketsRespVO.getMaintenanceDate() || null!= ticketsRespVO.getMaintenanceMileage()){
CarMain carMain = new CarMain();
carMain.setId(ticketsRespVO.getCarId());
//保养日期
if(null!=ticketsRespVO.getMaintenanceDate()){
carMain.setMaintenanceDate(ticketsRespVO.getMaintenanceDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
//保养里程
if(null!=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);
}
/* 更新车辆的最近保养日期、最近保养公里数 end */
@ -372,7 +396,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
Map<String,String> repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
result.setRepairTypeText(repairTypeMap.getOrDefault(dlRepairTickets.getRepairType(),""));
//查是否存在总检完成的记录取出他的时间
LambdaQueryWrapper<RepairRecords> queryWrapper = new LambdaQueryWrapper<RepairRecords>()
.eq(RepairRecords::getTicketId,id)
@ -390,6 +413,19 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
//查车辆
if (ObjectUtil.isNotEmpty(dlRepairTickets.getCarId())) {
CarMainRespVO carInfo = carMainService.queryCarById(dlRepairTickets.getCarId());
//计算车龄
if(null!=carInfo.getCarRegisterDate()){
Long betweenMonth = DateUtil.betweenMonth(Date.from(carInfo.getCarRegisterDate().atZone(ZoneId.systemDefault()).toInstant()), new Date(), true);
String carYear = String.format("%.2f",betweenMonth.doubleValue() / 12);
//更新回去
CarMain carMain = new CarMain();
carMain.setId(dlRepairTickets.getCarId());
carMain.setCarYear(Double.parseDouble(carYear));
if(null==carInfo.getCarYear() ||!carInfo.getCarYear().equals(Double.parseDouble(carYear))){
carMainService.updateById(carMain);
}
carInfo.setCarYear(Double.parseDouble(carYear));
}
result.setCarInfo(carInfo);
}
@ -570,6 +606,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
}else {
// 线下支付和签单挂账才是直接结束工单和订单
DlRepairTickets repairTickets = this.getById(repairTicketsRespVO.getId());
if("1".equals(repairTickets.getIsHandover())){
//已交车已结算那么工单状态改为 已完成
repairTicketsRespVO.setTicketsStatus(TicketsStatusEnum.OVER.getCode());
//工单结束
repairTicketsRespVO.setIsFinish("1");
}
// 更新工单
baseMapper.updateById(repairTicketsRespVO);
// 更新订单
@ -1065,17 +1108,19 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
//未结算
statusList = Arrays.asList("04","05","07","01");
}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())){
//进厂
statusList.add(TicketsStatusEnum.NO_WORK.getCode());
}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())){
//已交车
statusList.add(TicketsStatusEnum.OVER.getCode());
repairTicketsReqVO.setIsHandover("1");
// statusList.add(TicketsStatusEnum.OVER.getCode());
}
if(!statusList.isEmpty()){
repairTicketsReqVO.setStatusList(statusList);
@ -1628,11 +1673,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
List<String> noPayIdList = new ArrayList<>();
List<DlRepairTickets> repairTickets = this.list();
if (!repairTickets.isEmpty()) {
//维修中
workingIdList = repairTickets.stream().filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList());
workingNum = workingIdList.size();
//只要没交车都算在厂
List<String> inCompanyCodeList = Arrays.asList("04","05","07","01","06","02");
inCompanyIdList = repairTickets.stream().filter(item -> inCompanyCodeList.contains(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList());
inCompanyIdList = repairTickets.stream().filter(item -> "0".equals(item.getIsHandover())).map(DlRepairTickets::getId).collect(Collectors.toList());
inCompanyNum = inCompanyIdList.size();
//只要没结算都是未结算
List<String> noPayCodeList = Arrays.asList("04","05","07","01");
@ -1655,10 +1700,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
newOrderIdList = repairTickets.stream().map(DlRepairTickets::getId).collect(Collectors.toList());
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();
//查累计已交车的已结算的
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();
}else {
//查某个时间范围内进厂数已完成已交车
@ -2018,18 +2064,21 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
**/
@Override
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>()
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.END.getCode())
.set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.OVER.getCode())
//交车时才能把工单置为完成
.set(DlRepairTickets::getIsFinish, "1")
.eq(DlRepairTickets::getId, respVO.getId())
);
this.updateById(repairTickets);
// 记录日志
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JC.getCode(), respVO.getRemark(), respVO.getImage());
refreshUpdateTime(respVO.getId());
}

View File

@ -54,6 +54,11 @@
<result property="threePackMoney" column="three_pack_money" />
<result property="confirmFaultMoney" column="confirm_fault_money" />
<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 id="APPBaseResultMap" type="cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO">
@ -106,6 +111,11 @@
<result property="threePackMoney" column="three_pack_money" />
<result property="confirmFaultMoney" column="confirm_fault_money" />
<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="handleName" column="handle_name" />
<result property="handleMobile" column="handle_mobile" />
@ -164,7 +174,12 @@
confirm_fault_money,
billing_remark,
handle_name,
handle_mobile
handle_mobile,
nextInspection_date,
insuranceExpiry_date,
insurance_type,
jiaoqiang,
shangye
from dl_repair_tickets drt
where drt.deleted = '0'
</sql>
@ -411,6 +426,10 @@
-- 服务顾问查所有的就是服务顾问是自己的 --
and drt.adviser_id = #{map.adviserId}
</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">
-- 维修工或维修厂长查所有的就是维修人是自己的或者是自己班组内的 --
and (

View File

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