|
@@ -176,7 +176,7 @@ public class EmergencyRepairController {
|
|
|
Validate.notTrue(repairing > 0, ValuePool.EMERGENCY_HAVE_REPAIRING);
|
|
|
PlatformCompanyLiftRelevance relevance = platformCompanyLiftRelevanceService.findByMtCompanyAndLift(entity.getMtCompanyId(), entity.getLiftId());
|
|
|
if (Objects.nonNull(relevance)) {
|
|
|
- Validate.notTrue(relevance.getLiftCompanyStatus().equals(CommonEnum.LiftStatus.ANNUAL_INSPECTION.getCode()), ValuePool.EMERGENCY_LIFT_IS_IN_INSPECTION);
|
|
|
+ Validate.notTrue(CommonEnum.LiftStatus.ANNUAL_INSPECTION.getCode().equals(relevance.getLiftCompanyStatus()), ValuePool.EMERGENCY_LIFT_IS_IN_INSPECTION);
|
|
|
}
|
|
|
|
|
|
//派单时间 急修单创建时间
|
|
@@ -185,6 +185,7 @@ public class EmergencyRepairController {
|
|
|
entity.setStatus(0);
|
|
|
boolean result = emergencyRepairService.save(entity);
|
|
|
if (result) {
|
|
|
+ //消息推送
|
|
|
Long id = entity.getId();
|
|
|
Region region = pushUserService.findRegionByEmergencyRepair(id, mtCompanyId);
|
|
|
List<Long> userIds = new ArrayList<>();
|
|
@@ -251,6 +252,11 @@ public class EmergencyRepairController {
|
|
|
return pageByCondition(request);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 急修收款中急修列表,不检查status
|
|
|
+ * @param request RepairRequest
|
|
|
+ * @return RestResponse
|
|
|
+ */
|
|
|
@PostMapping("pageCost")
|
|
|
@Validation(fields = {"mtCompanyId"})
|
|
|
public RestResponse pageCost(@Val @RequestBody RepairRequest request) {
|
|
@@ -290,6 +296,7 @@ public class EmergencyRepairController {
|
|
|
|
|
|
boolean result = emergencyRepairService.saveOrUpdate(entity);
|
|
|
if (result) {
|
|
|
+ //消息推送
|
|
|
Long id = entity.getId();
|
|
|
Long mtCompanyId = entity.getMtCompanyId();
|
|
|
Region region = pushUserService.findRegionByEmergencyRepair(id, mtCompanyId);
|
|
@@ -460,15 +467,17 @@ public class EmergencyRepairController {
|
|
|
EmergencyRepair repair = emergencyRepairService.getById(request.getId());
|
|
|
Validate.notNull(repair, ValuePool.EMERGENCY_NOT_EXIST);
|
|
|
|
|
|
+ List<ErRecordCost> costs = erRecordCostService.listByErRecordId(repair.getId());
|
|
|
List<ErRecordCost> erRecordCosts = request.getErRecordCosts();
|
|
|
-
|
|
|
- BigDecimal costTotal = erRecordCosts.stream().filter(cost -> Objects.nonNull(cost.getCostMoney())).map(ErRecordCost::getCostMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if(Objects.isNull(costs)){
|
|
|
+ costs = new ArrayList<>();
|
|
|
+ }
|
|
|
+ costs.addAll(erRecordCosts);
|
|
|
+ BigDecimal costTotal = costs.stream().filter(cost -> Objects.nonNull(cost.getCostMoney())).map(ErRecordCost::getCostMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
repair.setCostTotal(costTotal);
|
|
|
-
|
|
|
- BigDecimal payTotal = erRecordCosts.stream().filter(cost -> Objects.nonNull(cost.getPayMoney())).map(ErRecordCost::getPayMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal payTotal = costs.stream().filter(cost -> Objects.nonNull(cost.getPayMoney())).map(ErRecordCost::getPayMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
repair.setPayTotal(payTotal);
|
|
|
-
|
|
|
- BigDecimal invoiceTotal = erRecordCosts.stream().filter(cost -> Objects.nonNull(cost.getInvoiceMoney())).map(ErRecordCost::getInvoiceMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal invoiceTotal = costs.stream().filter(cost -> Objects.nonNull(cost.getInvoiceMoney())).map(ErRecordCost::getInvoiceMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
repair.setInvoiceTotal(invoiceTotal);
|
|
|
|
|
|
return emergencyRepairService.addCost(repair, erRecordCosts);
|
|
@@ -526,21 +535,19 @@ public class EmergencyRepairController {
|
|
|
@PostMapping("modifyCost")
|
|
|
@Validation(fields = {"id", "erRecordCosts"})
|
|
|
public RestResponse modifyCost(@Val @RequestBody RepairRequest request) {
|
|
|
- EmergencyRepair repair = emergencyRepairService.getById(request.getId());
|
|
|
+ Long recordId = request.getId();
|
|
|
+ EmergencyRepair repair = emergencyRepairService.getById(recordId);
|
|
|
Validate.notNull(repair, ValuePool.EMERGENCY_NOT_EXIST);
|
|
|
|
|
|
List<ErRecordCost> erRecordCosts = request.getErRecordCosts();
|
|
|
-
|
|
|
BigDecimal costTotal = erRecordCosts.stream().filter(cost -> Objects.nonNull(cost.getCostMoney())).map(ErRecordCost::getCostMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
repair.setCostTotal(costTotal);
|
|
|
-
|
|
|
BigDecimal payTotal = erRecordCosts.stream().filter(cost -> Objects.nonNull(cost.getPayMoney())).map(ErRecordCost::getPayMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
repair.setPayTotal(payTotal);
|
|
|
-
|
|
|
BigDecimal invoiceTotal = erRecordCosts.stream().filter(cost -> Objects.nonNull(cost.getInvoiceMoney())).map(ErRecordCost::getInvoiceMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
repair.setInvoiceTotal(invoiceTotal);
|
|
|
|
|
|
- List<ErRecordCost> oldRecordCosts = erRecordCostService.listByErRecordId(request.getId());
|
|
|
+ List<ErRecordCost> oldRecordCosts = erRecordCostService.listByErRecordId(recordId);
|
|
|
|
|
|
return emergencyRepairService.modifyCost(repair, oldRecordCosts, erRecordCosts);
|
|
|
}
|