Browse Source

Merge remote-tracking branch 'origin/test' into test

Joburgess 4 years ago
parent
commit
4f41e0ccce

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RepairGoodsDto.java

@@ -18,6 +18,15 @@ public class RepairGoodsDto {
     @ApiModelProperty(value = "商品编号", required = true)
     private Integer id;
 
+    @ApiModelProperty(value = "品牌", required = true)
+    private String brand;
+
+    @ApiModelProperty(value = "原价", required = true)
+    private BigDecimal marketPrice;
+
+    @ApiModelProperty(value = "型号", required = true)
+    private String specification;
+
     public BigDecimal getGroupPurchasePrice() {
         return groupPurchasePrice;
     }
@@ -49,4 +58,28 @@ public class RepairGoodsDto {
     public void setId(Integer id) {
         this.id = id;
     }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public BigDecimal getMarketPrice() {
+        return marketPrice;
+    }
+
+    public void setMarketPrice(BigDecimal marketPrice) {
+        this.marketPrice = marketPrice;
+    }
+
+    public String getSpecification() {
+        return specification;
+    }
+
+    public void setSpecification(String specification) {
+        this.specification = specification;
+    }
 }

+ 12 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -421,12 +421,6 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             });
             repairInfo.setGoodsJson(JSONObject.toJSONString(repairGoodsDtos));
         }
-        studentRepairDao.insert(repairInfo);
-        if (repairInfo.getType() == 1) {
-            Map<String, Object> repairInfoMap = new HashMap<>();
-            MapUtil.populateMap(repairInfoMap, repairInfo);
-            return repairInfoMap;
-        }
 
         if (StringUtils.isNoneBlank(repairInfo.getGoodsJson())) {
             JSONArray goods = JSON.parseArray(repairInfo.getGoodsJson());
@@ -439,6 +433,16 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             }
         }
         amount = amount.subtract(repairInfo.getExemptionAmount());
+        if (amount.compareTo(BigDecimal.ZERO) < 0) {
+            throw new BizException("特权减免金额不能大于总金额");
+        }
+
+        studentRepairDao.insert(repairInfo);
+        if (repairInfo.getType() == 1) {
+            Map<String, Object> repairInfoMap = new HashMap<>();
+            MapUtil.populateMap(repairInfoMap, repairInfo);
+            return repairInfoMap;
+        }
 
         repairInfo.setPayStatus(1);
         String channelType = "";
@@ -583,6 +587,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             BigDecimal reduce = repairGoodsDtos.stream().map(e -> e.getGroupPurchasePrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
             amount = amount.add(reduce);
         }
+        amount = amount.subtract(repairInfo.getExemptionAmount());
+
         String orderNo = idGeneratorService.generatorId("payment") + "";
         studentRepair.setIsUseBalancePayment(repairInfo.getIsUseBalancePayment());
         studentRepair.setTransNo(orderNo);