Compare commits
2 Commits
baf972df52
...
33b2b79663
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33b2b79663 | ||
|
|
4c35c69ad7 |
@ -21,5 +21,7 @@ public class RepairCons {
|
||||
/**数据字典常量-repair_unit-*/
|
||||
public static final String DICT_REPAIR_WORK_TYPE = "repair_work_type";
|
||||
/** 数据字典常量-repair_part_disposal */
|
||||
public static final String REPAIR_PART_DISPOSAL = "repair_part_disposal";
|
||||
public static final String DICT_REPAIR_PART_DISPOSAL = "repair_part_disposal";
|
||||
/** 数据字典常量-repair_pay_type */
|
||||
public static final String DICT_REPAIR_PAY_TYPE = "repair_pay_type";
|
||||
}
|
||||
|
||||
@ -205,6 +205,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
|
||||
// 门店信息
|
||||
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
||||
DeptRespDTO dept = deptApi.getDept(deptId);
|
||||
@ -510,7 +512,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
params.put("mileage", "未知");
|
||||
// 旧件处理
|
||||
// 获取字典数据
|
||||
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(REPAIR_PART_DISPOSAL);
|
||||
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(DICT_REPAIR_PART_DISPOSAL);
|
||||
// 找到对应的处理方式
|
||||
DictDataRespDTO dictDataRespDTO = dataList.stream().filter(item -> item.getValue().equals(tickets.getPartDisposal())).findFirst().orElse(null);
|
||||
params.put("oldhandle", Objects.requireNonNull(dictDataRespDTO).getLabel());
|
||||
@ -548,10 +550,14 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
project.put("repItem", item.getItemName());
|
||||
project.put("repPrice", item.getItemPrice());
|
||||
project.put("repCount", item.getItemCount());
|
||||
project.put("repDiscount", item.getItemDiscount() == null ? "无折扣" : item.getItemDiscount());
|
||||
// todo 工时费
|
||||
BigDecimal itemDiscount = item.getItemDiscount();
|
||||
if (ObjectUtil.isEmpty(item.getItemDiscount())) {
|
||||
itemDiscount = new BigDecimal("1.00");
|
||||
}
|
||||
project.put("repDiscount", itemDiscount.equals(new BigDecimal("1.00")) ? "无折扣" : item.getItemDiscount());
|
||||
// 工时费 项目打折后的费用
|
||||
// 取不到先给0
|
||||
project.put("labourAmount", 0.00);
|
||||
project.put("labourAmount", item.getItemMoney());
|
||||
project.put("major", item.getRepairNames());
|
||||
project.put("repRemark", item.getRemark());
|
||||
if (ObjectUtil.isNotEmpty(item.getItemTypeId())) {
|
||||
@ -562,7 +568,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
});
|
||||
}
|
||||
configureBuilder.bind("projects", new HackLoopTableRenderPolicy());
|
||||
// todo 有问题,不渲染
|
||||
params.put("projects", projects);
|
||||
|
||||
/*
|
||||
@ -571,18 +576,38 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 取出维修工单子表的配件
|
||||
List<DlRepairTitem> waresList = titems.stream().filter(item -> item.getItemType().equals("02")).collect(Collectors.toList());
|
||||
List<Map<String, Object>> wares = new ArrayList<>();
|
||||
// 取出对应需要的其他表的数据备用
|
||||
List<DictDataRespDTO> unitDataList = dictDataApi.getDictDataList(DICT_REPAIR_UNIT);
|
||||
if (CollectionUtil.isNotEmpty(waresList)) {
|
||||
waresList.forEach(item -> {
|
||||
Map<String, Object> ware = new HashMap<>();
|
||||
ware.put("matRort", wares.size() + 1);
|
||||
// todo 配件号
|
||||
ware.put("matNum", "");
|
||||
// 配件号
|
||||
// 先取配件
|
||||
RepairWares wareById = waresService.getOne(new LambdaQueryWrapper<RepairWares>().eq(RepairWares::getId, item.getPartId()));
|
||||
String matNum = "";
|
||||
if (ObjectUtil.isNotEmpty(wareById)) {
|
||||
matNum = wareById.getCode();
|
||||
}
|
||||
ware.put("matNum", matNum);
|
||||
ware.put("matName", item.getItemName());
|
||||
// todo 单位
|
||||
ware.put("matUnit", item.getItemUnit());
|
||||
// 单位
|
||||
// 先取单位字典
|
||||
String matUnit = "";
|
||||
if (CollectionUtil.isNotEmpty(unitDataList) && ObjectUtil.isNotEmpty(item.getItemUnit())) {
|
||||
DictDataRespDTO unit = unitDataList.stream().filter(i -> i.getValue().equals(item.getItemUnit())).findFirst().orElse(null);
|
||||
if (unit != null) {
|
||||
matUnit = unit.getLabel();
|
||||
}
|
||||
}
|
||||
ware.put("matUnit", matUnit);
|
||||
ware.put("matPrice", item.getItemPrice());
|
||||
ware.put("matCount", item.getItemCount());
|
||||
ware.put("matDiscount", item.getItemDiscount() == null ? "无折扣" : item.getItemDiscount());
|
||||
BigDecimal itemDiscount = item.getItemDiscount();
|
||||
if (ObjectUtil.isEmpty(item.getItemDiscount())) {
|
||||
itemDiscount = new BigDecimal("1.00");
|
||||
}
|
||||
ware.put("matDiscount", itemDiscount.equals(new BigDecimal("1.00")) ? "无折扣" : item.getItemDiscount());
|
||||
ware.put("matAmount", item.getItemMoney());
|
||||
ware.put("matRemark", item.getRemark());
|
||||
if (ObjectUtil.isNotEmpty(item.getItemTypeId())) {
|
||||
@ -593,7 +618,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
});
|
||||
}
|
||||
configureBuilder.bind("wares", new HackLoopTableRenderPolicy());
|
||||
// todo 同样是不渲染
|
||||
params.put("wares", wares);
|
||||
// 小计
|
||||
params.put("matTotalAmount", tickets.getPartPrice());
|
||||
@ -601,14 +625,15 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
/*
|
||||
4、其他信息
|
||||
*/
|
||||
// 目前能取到:材料费、材料费优惠、总费用、应收费、大写、工单备注
|
||||
// 目前能取到:材料费、材料费优惠、总费用、应收费、大写、工单备注、工时费、工时费优惠、其他费、材料工时优惠
|
||||
// 计算配件没打折的总金额
|
||||
BigDecimal matCost = waresList.stream()
|
||||
.map(item -> item.getItemPrice().multiply(BigDecimal.valueOf(item.getItemCount())))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
params.put("matCost", matCost);
|
||||
// 没打折的金额减去打折后的总金额得到优惠了多少钱
|
||||
params.put("matFavorable", matCost.subtract(tickets.getPartPrice()));
|
||||
BigDecimal matFavorable = matCost.subtract(ObjectUtil.isNotEmpty(tickets.getPartPrice()) ? tickets.getPartPrice() : BigDecimal.ZERO);
|
||||
params.put("matFavorable", matFavorable);
|
||||
// 计算没打折的工单总价
|
||||
BigDecimal matTotalCost = titems.stream().map(item -> item.getItemPrice().multiply(BigDecimal.valueOf(item.getItemCount()))).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
params.put("matTotalCost", matTotalCost);
|
||||
@ -619,13 +644,20 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
params.put("bigAllCost", bigAllCost);
|
||||
// 这个备注现在是工单备注
|
||||
params.put("paperRemark", tickets.getRemark());
|
||||
// todo 目前取不到:管理费、工时费、工时费优惠、其他费、材料工时优惠、救援费、三包费、定损费、付款情况、结算备注(这个是因为和工单备注用的同一个)、客户签字
|
||||
// 项目没打折的总价
|
||||
BigDecimal labourCost = projectList.stream().map(item -> item.getItemPrice().multiply(BigDecimal.valueOf(item.getItemCount()))).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
params.put("labourCost", labourCost);
|
||||
// 项目没打折的总价减打折后的总价就是优惠
|
||||
BigDecimal labourFavorable = labourCost.subtract(ObjectUtil.isNotEmpty(tickets.getProjectPrice()) ? tickets.getProjectPrice() : BigDecimal.ZERO);
|
||||
params.put("labourFavorable", labourFavorable);
|
||||
// 其他费用 维修工单的其他子项的费用
|
||||
params.put("otherCost", ObjectUtil.isNotEmpty(tickets.getOtherPrice()) ? tickets.getOtherPrice() : 0.00);
|
||||
// 材料工时优惠 材料优惠+工时优惠
|
||||
params.put("matlabourFavorable", matFavorable.add(labourFavorable));
|
||||
|
||||
// todo 目前取不到:管理费、救援费、三包费、定损费、结算备注(这个是因为和工单备注用的同一个)、客户签字
|
||||
// 取不到的先默认为0或未知
|
||||
params.put("manageCost", 0.00);
|
||||
params.put("labourCost", 0.00);
|
||||
params.put("labourFavorable", 0.00);
|
||||
params.put("otherCost", 0.00);
|
||||
params.put("matlabourFavorable", 0.00);
|
||||
params.put("rescueCost", 0.00);
|
||||
params.put("tripleCost", 0.00);
|
||||
params.put("lossCost", 0.00);
|
||||
@ -634,16 +666,30 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
/*
|
||||
5、最后结尾
|
||||
*/
|
||||
// 目前能取到:服务顾问、联系电话、结算日期
|
||||
// 目前能取到:服务顾问、联系电话、结算日期、付款情况
|
||||
params.put("serviceConsultant", tickets.getAdviserName());
|
||||
AdminUserRespDTO adviser = adminUserApi.getUser(Long.valueOf(tickets.getAdviserId()));
|
||||
if (ObjectUtil.isNotEmpty(adviser) && ObjectUtil.isNotEmpty(adviser.getMobile())) {
|
||||
params.put("serviceTelephone", adviser.getMobile());
|
||||
}
|
||||
RepairOrderInfo orderInfo = repairOrderInfoService.getOne(new LambdaQueryWrapper<RepairOrderInfo>().eq(RepairOrderInfo::getGoodsId, tickets.getId()));
|
||||
if (ObjectUtil.isNotEmpty(orderInfo) && ObjectUtil.isNotEmpty(orderInfo.getPayTime())) {
|
||||
params.put("settleDate", date.format(orderInfo.getPayTime()));
|
||||
if (ObjectUtil.isNotEmpty(orderInfo)) {
|
||||
if (ObjectUtil.isNotEmpty(orderInfo.getPayTime())) {
|
||||
params.put("settleDate", date.format(orderInfo.getPayTime()));
|
||||
}
|
||||
// 付款情况
|
||||
// 先取支付字典
|
||||
List<DictDataRespDTO> payTypes = dictDataApi.getDictDataList(DICT_REPAIR_PAY_TYPE);
|
||||
String costCondition = "未支付";
|
||||
if (ObjectUtil.isNotEmpty(payTypes) && ObjectUtil.isNotEmpty(orderInfo.getPayType())) {
|
||||
DictDataRespDTO payType = payTypes.stream().filter(item -> item.getValue().equals(orderInfo.getPayType())).findFirst().orElse(null);
|
||||
if (payType != null) {
|
||||
costCondition = payType.getLabel();
|
||||
}
|
||||
}
|
||||
params.put("costCondition", costCondition);
|
||||
}
|
||||
|
||||
// todo 目前取不到:单位、开户行、地址、账号
|
||||
// 取不到的先给未知
|
||||
params.put("corporation", "未知");
|
||||
@ -653,7 +699,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
|
||||
Configure config = configureBuilder.build();
|
||||
try {
|
||||
InputStream inputStream = XWPFTemplate.class.getResourceAsStream("/templates/gdmb.docx");
|
||||
InputStream inputStream = XWPFTemplate.class.getResourceAsStream("/templates/ticketTemplate.docx");
|
||||
XWPFTemplate template = XWPFTemplate.compile(inputStream, config);
|
||||
template.render(params);
|
||||
FileOutputStream fos = new FileOutputStream(tmpPath);
|
||||
|
||||
@ -35,7 +35,8 @@
|
||||
主修人
|
||||
备注
|
||||
性质
|
||||
[report]
|
||||
[repPort
|
||||
]
|
||||
[repItem]
|
||||
[repPrice]
|
||||
[repCount]
|
||||
|
||||
@ -0,0 +1,97 @@
|
||||
泸州市蓝安汽车销售有限公司
|
||||
车辆维修结算单
|
||||
工号:{{jobNumber}}
|
||||
客户名称:
|
||||
{{customerName}}
|
||||
送修人:
|
||||
{{repairer}}
|
||||
送修人电话:
|
||||
{{repairerTelephone}}
|
||||
车牌:
|
||||
{{plate}}
|
||||
车型:
|
||||
{{carType}}
|
||||
发动机号码:
|
||||
{{engineNumber}}
|
||||
车架号:
|
||||
{{frameNumber}}
|
||||
开单时间:
|
||||
{{billingTime}}
|
||||
已行里程:
|
||||
{{mileage}}
|
||||
三包单位:
|
||||
{{tripleUnit}}
|
||||
保险名称:
|
||||
{{insuranceName}}
|
||||
旧件处理:
|
||||
{{oldhandle}}
|
||||
维修内容
|
||||
{{projects}}序号
|
||||
维修项目
|
||||
单价
|
||||
数量
|
||||
折扣率
|
||||
工时费
|
||||
主修人
|
||||
备注
|
||||
性质
|
||||
[repRort]
|
||||
[repItem]
|
||||
[repPrice]
|
||||
[repCount]
|
||||
[repDiscount]
|
||||
[labourAmount]
|
||||
[major]
|
||||
[repRemark]
|
||||
[repNature]
|
||||
材料清单
|
||||
{{wares}}序号
|
||||
配件件号
|
||||
名称
|
||||
单位
|
||||
单价
|
||||
数量
|
||||
折扣率
|
||||
金额
|
||||
备注
|
||||
性质
|
||||
[matRort]
|
||||
[matNum]
|
||||
[matName]
|
||||
[matUnit]
|
||||
[matPrice]
|
||||
[matCount]
|
||||
[matDiscount]
|
||||
[matAmount]
|
||||
[matRemark]
|
||||
[matNature]
|
||||
小计
|
||||
|
||||
|
||||
|
||||
|
||||
{{matTotalAmount}}
|
||||
|
||||
|
||||
材料费:{{matCost}}
|
||||
材料费优惠:{{matFavorable}}
|
||||
管理费:{{manageCost}}
|
||||
总费用:{{matTotalCost}}
|
||||
工时费:{{labourCost}}
|
||||
工时费优惠:{{labourFavorable}}
|
||||
其他费:{{otherCost}}
|
||||
材料工时优惠:{{matlabourFavorable}}
|
||||
救援费:{{rescueCost}}
|
||||
三包费:{{tripleCost}}
|
||||
定损费:{{lossCost}}
|
||||
应收费:{{allCost}}
|
||||
大写:{{bigAllCost}}
|
||||
付款情况:
|
||||
{{costCondition}}
|
||||
工单备注:{{paperRemark}}
|
||||
客户签字:
|
||||
结算备注:{{costRemark}}
|
||||
|
||||
单位:{{corporation}} 服务顾问:{{serviceConsultant}} 联系电话:{{serviceTelephone}}
|
||||
开户行:{{bank}} 地址:{{bankAddress}}
|
||||
账号:{{account}} 结算日期:{{settleDate}}
|
||||
Loading…
Reference in New Issue
Block a user