|
@@ -50,24 +50,38 @@ public class WechatPayService {
|
|
|
if(repair == null){
|
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
- if(repair.getStatus() != 9){
|
|
|
+ if(repair.getStatus() != 9 || repair.getStatus() != 4){
|
|
|
throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
|
|
|
}
|
|
|
RepairPay repairPay = repairPayService.getByRepairId(param.getRepairId(),1);
|
|
|
if(repairPay != null ){
|
|
|
throw new BusinessException(ResultCode.ORDER_PAY_ERROR);
|
|
|
}
|
|
|
- String orderSn = "sale_"+DateUtil.getDate();
|
|
|
- BigDecimal amount = priceListService.getAmountByRepairId(param.getRepairId());
|
|
|
+ String orderSn = null;
|
|
|
+ BigDecimal amount = BigDecimal.ZERO;
|
|
|
+ String subject = null;
|
|
|
+ Integer orderType = null;
|
|
|
+ if(repair.getStatus() == 9){
|
|
|
+ amount = priceListService.getAmountByRepairId(param.getRepairId());
|
|
|
+ orderSn = "sale_"+DateUtil.getDate();
|
|
|
+ subject = "维修订单";
|
|
|
+ orderType = 0;
|
|
|
+ }
|
|
|
+ if(repair.getStatus() == 3){
|
|
|
+ amount = priceListService.getRobAmountByRepairId(param.getRepairId());
|
|
|
+ orderSn = "sale_cancel_"+DateUtil.getDate();
|
|
|
+ subject = "取消维修订单";
|
|
|
+ orderType = 1;
|
|
|
+ }
|
|
|
|
|
|
repairPay = new RepairPay();
|
|
|
repairPay.setRepairId(param.getRepairId());
|
|
|
repairPay.setPayType(1);
|
|
|
repairPay.setOrderSn(orderSn);
|
|
|
repairPay.setPayAmount(amount);
|
|
|
+ repairPay.setOrderType(orderType);
|
|
|
repairPayService.save(repairPay);
|
|
|
|
|
|
- String subject = "维修订单";
|
|
|
BigDecimal totalFee = amount.multiply(new BigDecimal(100));
|
|
|
String body = subject;
|
|
|
return this.wechatH5Pay(param.getRepairId(),orderSn, subject, body, totalFee, ip);
|