Joburgess пре 3 година
родитељ
комит
6cf4b91dcd

+ 18 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysCouponServiceImpl.java

@@ -69,6 +69,24 @@ public class SysCouponServiceImpl extends BaseServiceImpl<Integer, SysCoupon>  i
 			}
 			sysCouponDao.update(oldCoupon);
 		}else{
+			switch (sysCoupon.getType()){
+				case DISCOUNT:
+					if(Objects.isNull(sysCoupon.getFaceValue())){
+						throw new BizException("请指定折扣比例");
+					}
+					sysCoupon.setFaceValue(null);
+					break;
+				case FULL_REDUCTION:
+					if(Objects.isNull(sysCoupon.getFaceValue())){
+						throw new BizException("请指定优惠金额");
+					}
+					if(Objects.isNull(sysCoupon.getFullAmount())){
+						throw new BizException("请指定达标金额");
+					}
+					break;
+				default:
+					throw new BizException("请指定优惠券类型");
+			}
 			switch (sysCoupon.getEffectiveType()){
 				case DAYS:
 					if(Objects.isNull(sysCoupon.getDeadline())){

+ 0 - 2
mec-biz/src/main/resources/config/mybatis/SysCouponMapper.xml

@@ -66,9 +66,7 @@
 			<if test="name != null">
 				name_ = #{name},
 			</if>
-			<if test="fullAmount != null">
 				full_amount_ = #{fullAmount},
-			</if>
 			<if test="effectiveType != null">
 				effective_type_ = #{effectiveType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 			</if>