Browse Source

update 维修修改

周箭河 4 years ago
parent
commit
d0087dcbd3

+ 42 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRepair.java

@@ -15,6 +15,24 @@ public class StudentRepair {
     private String transNo;
 
     /**
+     * 学员乐器id
+     */
+    @ApiModelProperty(value = "学员乐器id", required = false)
+    private Long studentInstrumentId;
+
+    /**
+     * 维修单名称
+     */
+    @ApiModelProperty(value = "维修单名称", required = false)
+    private String repairName;
+
+    /**
+     * 特权减免金额
+     */
+    @ApiModelProperty(value = "特权减免金额", required = false)
+    private BigDecimal exemptionAmount = BigDecimal.ZERO;
+
+    /**
     * 分部id
     */
     @ApiModelProperty(value = "分部id", required = false)
@@ -427,4 +445,28 @@ public class StudentRepair {
     public void setMusicGroupId(String musicGroupId) {
         this.musicGroupId = musicGroupId;
     }
+
+    public Long getStudentInstrumentId() {
+        return studentInstrumentId;
+    }
+
+    public void setStudentInstrumentId(Long studentInstrumentId) {
+        this.studentInstrumentId = studentInstrumentId;
+    }
+
+    public String getRepairName() {
+        return repairName;
+    }
+
+    public void setRepairName(String repairName) {
+        this.repairName = repairName;
+    }
+
+    public BigDecimal getExemptionAmount() {
+        return exemptionAmount;
+    }
+
+    public void setExemptionAmount(BigDecimal exemptionAmount) {
+        this.exemptionAmount = exemptionAmount;
+    }
 }

+ 13 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -71,6 +71,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     private ContractService contractService;
     @Autowired
     private GoodsService goodsService;
+    @Autowired
+    private StudentInstrumentService studentInstrumentService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -376,10 +378,19 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         ) {
             throw new BizException("邮寄信息必填");
         }
+        Date date = new Date();
+        if (repairInfo.getExemptionAmount().compareTo(BigDecimal.ZERO) > 0) {
+            if (repairInfo.getStudentInstrumentId() != null) {
+                throw new BizException("学生乐器id不存在,请核查");
+            }
+            StudentInstrument studentInstrument = studentInstrumentService.get(repairInfo.getStudentInstrumentId());
+            if (studentInstrument == null || studentInstrument.getEndTime() == null || studentInstrument.getEndTime().compareTo(date) <=0) {
+                throw new BizException("乐保不存在,请核查");
+            }
+        }
         SysUser student = sysUserFeignService.queryUserById(repairInfo.getStudentId());
         repairInfo.setOrganId(student.getOrganId());
 
-        Date date = new Date();
         BigDecimal amount = repairInfo.getAmount();
         String orderNo = idGeneratorService.generatorId("payment") + "";
         repairInfo.setTransNo(orderNo);
@@ -414,6 +425,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 }
             }
         }
+        amount = amount.subtract(repairInfo.getExemptionAmount());
 
         repairInfo.setPayStatus(1);
         String channelType = "";