打印工单
This commit is contained in:
parent
0548422b4b
commit
db87951161
@ -334,5 +334,19 @@ public class DlRepairTicketsController {
|
|||||||
dlRepairTicketsService.addItems(respVO);
|
dlRepairTicketsService.addItems(respVO);
|
||||||
return CommonResult.ok();
|
return CommonResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改工单主表,只是主表
|
||||||
|
*
|
||||||
|
* @author 小李
|
||||||
|
* @date 10:25 2024/10/30
|
||||||
|
* @param respVO 请求对象
|
||||||
|
**/
|
||||||
|
@PostMapping("/updateTicket")
|
||||||
|
@Operation(summary = "修改工单主表,只是主表")
|
||||||
|
public CommonResult<?> updateTicket(@RequestBody DlRepairTicketsRespVO respVO) {
|
||||||
|
dlRepairTicketsService.updateTicket(respVO);
|
||||||
|
return CommonResult.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -217,4 +217,13 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
|||||||
* @date 16:35 2024/10/26
|
* @date 16:35 2024/10/26
|
||||||
**/
|
**/
|
||||||
void autoInspection();
|
void autoInspection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改工单主表,只是主表
|
||||||
|
*
|
||||||
|
* @author 小李
|
||||||
|
* @date 10:25 2024/10/30
|
||||||
|
* @param respVO 请求对象
|
||||||
|
**/
|
||||||
|
void updateTicket(DlRepairTicketsRespVO respVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.iocoder.yudao.common.*;
|
import cn.iocoder.yudao.common.*;
|
||||||
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
||||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||||
@ -13,6 +15,8 @@ import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
|
|||||||
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
|
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
|
||||||
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
|
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
|
||||||
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
|
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
|
||||||
|
import cn.iocoder.yudao.module.company.entity.Company;
|
||||||
|
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||||
import cn.iocoder.yudao.module.conf.entity.BaseType;
|
import cn.iocoder.yudao.module.conf.entity.BaseType;
|
||||||
import cn.iocoder.yudao.module.conf.service.BaseTypeService;
|
import cn.iocoder.yudao.module.conf.service.BaseTypeService;
|
||||||
import cn.iocoder.yudao.module.custom.entity.*;
|
import cn.iocoder.yudao.module.custom.entity.*;
|
||||||
@ -170,6 +174,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
@Lazy
|
@Lazy
|
||||||
private BaseTypeService baseTypeService;
|
private BaseTypeService baseTypeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修工单表 新增
|
* 维修工单表 新增
|
||||||
*
|
*
|
||||||
@ -513,9 +521,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
params.put("plate", tickets.getCarNo());
|
params.put("plate", tickets.getCarNo());
|
||||||
params.put("frameNumber", tickets.getCarVin());
|
params.put("frameNumber", tickets.getCarVin());
|
||||||
params.put("billingTime", time.format(tickets.getCreateTime()));
|
params.put("billingTime", time.format(tickets.getCreateTime()));
|
||||||
// todo 已行里程
|
// 已行里程
|
||||||
// 取不到先给未知
|
params.put("mileage", tickets.getMileageTraveled());
|
||||||
params.put("mileage", "未知");
|
|
||||||
// 旧件处理
|
// 旧件处理
|
||||||
// 获取字典数据
|
// 获取字典数据
|
||||||
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(DICT_REPAIR_PART_DISPOSAL);
|
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(DICT_REPAIR_PART_DISPOSAL);
|
||||||
@ -526,10 +533,9 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
// 车辆其他信息(发动机号码、三包单位、保险名称、车型)
|
// 车辆其他信息(发动机号码、三包单位、保险名称、车型)
|
||||||
CarMain carMain = carMainService.getById(tickets.getCarId());
|
CarMain carMain = carMainService.getById(tickets.getCarId());
|
||||||
params.put("engineNumber", carMain.getEngineNumber());
|
params.put("engineNumber", carMain.getEngineNumber());
|
||||||
// todo 三包单位、保险名称
|
// 三包单位、保险名称
|
||||||
// 取不到先给未知
|
params.put("tripleUnit", tickets.getThreePackUnits());
|
||||||
params.put("tripleUnit", "未知");
|
params.put("insuranceName", tickets.getInsuranceName());
|
||||||
params.put("insuranceName", "未知");
|
|
||||||
// 先查车辆对应的品牌
|
// 先查车辆对应的品牌
|
||||||
String brandAndModel = "";
|
String brandAndModel = "";
|
||||||
if (ObjectUtil.isNotEmpty(carMain.getCarBrand())) {
|
if (ObjectUtil.isNotEmpty(carMain.getCarBrand())) {
|
||||||
@ -642,6 +648,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
params.put("matFavorable", matFavorable);
|
params.put("matFavorable", matFavorable);
|
||||||
// 计算没打折的工单总价
|
// 计算没打折的工单总价
|
||||||
BigDecimal matTotalCost = titems.stream().map(item -> item.getItemPrice().multiply(BigDecimal.valueOf(item.getItemCount()))).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal matTotalCost = titems.stream().map(item -> item.getItemPrice().multiply(BigDecimal.valueOf(item.getItemCount()))).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
// 加上特殊费用
|
||||||
|
// 管理费
|
||||||
|
BigDecimal managerMoney = ObjectUtil.isNotEmpty(tickets.getManagerMoney()) ? tickets.getManagerMoney() : new BigDecimal("0");
|
||||||
|
// 救援费
|
||||||
|
BigDecimal rescueMoney = ObjectUtil.isNotEmpty(tickets.getRescueMoney()) ? tickets.getRescueMoney() : new BigDecimal("0");
|
||||||
|
// 三包费
|
||||||
|
BigDecimal threePackMoney = ObjectUtil.isNotEmpty(tickets.getThreePackMoney()) ? tickets.getThreePackMoney() : new BigDecimal("0");
|
||||||
|
// 定损费
|
||||||
|
BigDecimal confirmFaultMoney = ObjectUtil.isNotEmpty(tickets.getConfirmFaultMoney()) ? tickets.getConfirmFaultMoney() : new BigDecimal("0");
|
||||||
|
matTotalCost = matTotalCost.add(managerMoney).add(rescueMoney).add(threePackMoney).add(confirmFaultMoney);
|
||||||
params.put("matTotalCost", matTotalCost);
|
params.put("matTotalCost", matTotalCost);
|
||||||
// 应收费目前是工单的打折后的总价
|
// 应收费目前是工单的打折后的总价
|
||||||
params.put("allCost", tickets.getTotalPrice());
|
params.put("allCost", tickets.getTotalPrice());
|
||||||
@ -661,14 +677,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
// 材料工时优惠 材料优惠+工时优惠
|
// 材料工时优惠 材料优惠+工时优惠
|
||||||
params.put("matlabourFavorable", "0.00");
|
params.put("matlabourFavorable", "0.00");
|
||||||
|
|
||||||
// todo 目前取不到:管理费、救援费、三包费、定损费、结算备注(这个是因为和工单备注用的同一个)、客户签字
|
// 管理费、救援费、三包费、定损费、结算备注(这个是因为和工单备注用的同一个)、todo 客户签字
|
||||||
// 取不到的先默认为0或未知
|
params.put("manageCost", ObjectUtil.isNotEmpty(tickets.getManagerMoney()) ? tickets.getManagerMoney() : "0.00") ;
|
||||||
params.put("manageCost", 0.00);
|
params.put("rescueCost", ObjectUtil.isNotEmpty(tickets.getRescueMoney()) ? tickets.getRescueMoney() : "0.00");
|
||||||
params.put("rescueCost", 0.00);
|
params.put("tripleCost", ObjectUtil.isNotEmpty(tickets.getThreePackMoney()) ? tickets.getThreePackMoney() : "0.00");
|
||||||
params.put("tripleCost", 0.00);
|
params.put("lossCost", ObjectUtil.isNotEmpty(tickets.getConfirmFaultMoney()) ? tickets.getConfirmFaultMoney() : "0.00");
|
||||||
params.put("lossCost", 0.00);
|
params.put("costRemark", tickets.getBillingRemark());
|
||||||
params.put("costCondition", "未知");
|
|
||||||
params.put("costRemark", "未知");
|
|
||||||
/*
|
/*
|
||||||
5、最后结尾
|
5、最后结尾
|
||||||
*/
|
*/
|
||||||
@ -696,12 +710,35 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
params.put("costCondition", costCondition);
|
params.put("costCondition", costCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo 目前取不到:单位、开户行、地址、账号
|
// 单位、开户行、地址、账号
|
||||||
|
// 取当前租户的公司们
|
||||||
|
Long tenantId = tickets.getTenantId();
|
||||||
|
List<Company> companies = companyService.list(new LambdaQueryWrapper<Company>().in(Company::getTenantId, tenantId));
|
||||||
|
// 得到属于当前业务的公司
|
||||||
|
Company company = companies.stream().filter(item -> {
|
||||||
|
String[] service = item.getServiceCodes().split(",");
|
||||||
|
for (String s : service) {
|
||||||
|
if (s.equals("weixiu")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}).findFirst().orElse(null);
|
||||||
|
String corporation = "";
|
||||||
|
String bank = "";
|
||||||
|
String bankAddress = "";
|
||||||
|
String account = "";
|
||||||
|
if (company != null){
|
||||||
|
corporation = company.getCorpName();
|
||||||
|
bankAddress = company.getAddress();
|
||||||
|
}
|
||||||
// 取不到的先给未知
|
// 取不到的先给未知
|
||||||
params.put("corporation", "未知");
|
params.put("corporation", corporation);
|
||||||
params.put("bank", "未知");
|
// todo
|
||||||
params.put("bankAddress", "未知");
|
params.put("bank", bank);
|
||||||
params.put("account", "未知");
|
params.put("bankAddress", bankAddress);
|
||||||
|
// todo
|
||||||
|
params.put("account", account);
|
||||||
|
|
||||||
Configure config = configureBuilder.build();
|
Configure config = configureBuilder.build();
|
||||||
try {
|
try {
|
||||||
@ -1276,6 +1313,20 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
tickets.setOtherPrice(reduce);
|
tickets.setOtherPrice(reduce);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 工单总价还需要变,把其他新加的费用也需要算上
|
||||||
|
// 查主表
|
||||||
|
DlRepairTickets oldTicket = baseMapper.selectById(ticketId);
|
||||||
|
// 管理费
|
||||||
|
BigDecimal managerMoney = ObjectUtil.isNotEmpty(oldTicket.getManagerMoney()) ? oldTicket.getManagerMoney() : new BigDecimal("0");
|
||||||
|
// 救援费
|
||||||
|
BigDecimal rescueMoney = ObjectUtil.isNotEmpty(oldTicket.getRescueMoney()) ? oldTicket.getRescueMoney() : new BigDecimal("0");
|
||||||
|
// 三包费
|
||||||
|
BigDecimal threePackMoney = ObjectUtil.isNotEmpty(oldTicket.getThreePackMoney()) ? oldTicket.getThreePackMoney() : new BigDecimal("0");
|
||||||
|
// 定损费
|
||||||
|
BigDecimal confirmFaultMoney = ObjectUtil.isNotEmpty(oldTicket.getConfirmFaultMoney()) ? oldTicket.getConfirmFaultMoney() : new BigDecimal("0");
|
||||||
|
|
||||||
|
tickets.setTotalPrice(tickets.getTotalPrice().add(managerMoney).add(rescueMoney).add(threePackMoney).add(confirmFaultMoney));
|
||||||
return baseMapper.updateById(tickets) > 0;
|
return baseMapper.updateById(tickets) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1392,6 +1443,26 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
repairRecordsService.saveRepairRecord(item.getId(), null, RecordTypeEnum.ZJ.getCode(), "该工单由系统自动总检完成", null);
|
repairRecordsService.saveRepairRecord(item.getId(), null, RecordTypeEnum.ZJ.getCode(), "该工单由系统自动总检完成", null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改工单主表,只是主表
|
||||||
|
*
|
||||||
|
* @author 小李
|
||||||
|
* @date 10:25 2024/10/30
|
||||||
|
* @param respVO 请求对象
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
@DSTransactional
|
||||||
|
public void updateTicket(DlRepairTicketsRespVO respVO){
|
||||||
|
// 更新主表
|
||||||
|
baseMapper.updateById(respVO);
|
||||||
|
|
||||||
|
// 重新计算
|
||||||
|
boolean flag = computeTicket(respVO.getId());
|
||||||
|
if (!flag){
|
||||||
|
throw exception0(500, "系统异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user