Authored by tanling

[禁用]改[可用]暂停

@@ -189,7 +189,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ @@ -189,7 +189,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
189 if (!couponTypeEnum.isPresent()){ 189 if (!couponTypeEnum.isPresent()){
190 throw new ServiceException(400, "错误:不合法的优惠券类型"); 190 throw new ServiceException(400, "错误:不合法的优惠券类型");
191 } 191 }
192 - parseSkupAllowType(req); 192 + parseSkupForbidType(req);
193 193
194 int productLimitType = req.getProductLimitType().intValue(); 194 int productLimitType = req.getProductLimitType().intValue();
195 List<Integer> productIds = getProductIdsAndCheckProductLimitParam(productLimitType,req.getProductLimitValue()); 195 List<Integer> productIds = getProductIdsAndCheckProductLimitParam(productLimitType,req.getProductLimitValue());
@@ -257,36 +257,36 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ @@ -257,36 +257,36 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
257 } 257 }
258 258
259 259
260 - private void parseSkupAllowType(CouponSaveUpdateReq req) {  
261 - if (StringUtils.isBlank(req.getSkupAllowType())) {  
262 - throw new ServiceException(403, "可使用该优惠券的商品属性不能为空");  
263 - }  
264 - List<String> allowAttributeTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupAllowType());  
265 - req.setSkupAllowType(Joiner.on(",").join(allowAttributeTypes));  
266 - }  
267 -  
268 -  
269 -// private void parseSkupForbidType(CouponSaveUpdateReq req) {  
270 -// if (StringUtils.isBlank(req.getSkupForbidType())) {  
271 -// req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);  
272 -// return; 260 +// private void parseSkupAllowType(CouponSaveUpdateReq req) {
  261 +// if (StringUtils.isBlank(req.getSkupAllowType())) {
  262 +// throw new ServiceException(403, "可使用该优惠券的商品属性不能为空");
273 // } 263 // }
274 -// List<String> limitTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupForbidType());  
275 -// if (CollectionUtils.isEmpty(limitTypes)) {  
276 -// req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);  
277 -// return;  
278 -// }  
279 -// for (String limitType : limitTypes) {  
280 -// if (!limitType.matches("\\d+")) {  
281 -// throw new ServiceException(400, "错误:不合法的限制类型");  
282 -// }  
283 -// if (!SkupType.of(Integer.parseInt(limitType)).isPresent() && !SKUP_FORBID_TYPE_NONE.equals(limitType)) {  
284 -// throw new ServiceException(401, "错误:不合法的限制类型");  
285 -// }  
286 -// }  
287 -// req.setSkupForbidType(Joiner.on(",").join(limitTypes)); 264 +// List<String> allowAttributeTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupAllowType());
  265 +// req.setSkupAllowType(Joiner.on(",").join(allowAttributeTypes));
288 // } 266 // }
289 267
  268 +
  269 + private void parseSkupForbidType(CouponSaveUpdateReq req) {
  270 + if (StringUtils.isBlank(req.getSkupForbidType())) {
  271 + req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
  272 + return;
  273 + }
  274 + List<String> limitTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupForbidType());
  275 + if (CollectionUtils.isEmpty(limitTypes)) {
  276 + req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
  277 + return;
  278 + }
  279 + for (String limitType : limitTypes) {
  280 + if (!limitType.matches("\\d+")) {
  281 + throw new ServiceException(400, "错误:不合法的限制类型");
  282 + }
  283 + if (!SkupType.of(Integer.parseInt(limitType)).isPresent() && !SKUP_FORBID_TYPE_NONE.equals(limitType)) {
  284 + throw new ServiceException(401, "错误:不合法的限制类型");
  285 + }
  286 + }
  287 + req.setSkupForbidType(Joiner.on(",").join(limitTypes));
  288 + }
  289 +
290 private void saveProductLimitItems(CouponSaveUpdateReq req, int productLimitType, List<Integer> productIds) { 290 private void saveProductLimitItems(CouponSaveUpdateReq req, int productLimitType, List<Integer> productIds) {
291 if(req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_SPECIALPRODUCT || req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_EXCLUDE){ 291 if(req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_SPECIALPRODUCT || req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_EXCLUDE){
292 // 清理之前的记录 292 // 清理之前的记录
@@ -21,13 +21,13 @@ @@ -21,13 +21,13 @@
21 <result column="pid" property="pid" jdbcType="INTEGER" /> 21 <result column="pid" property="pid" jdbcType="INTEGER" />
22 <result column="remark" property="remark" jdbcType="VARCHAR" /> 22 <result column="remark" property="remark" jdbcType="VARCHAR" />
23 <result column="skup_forbid_type" property="skupForbidType" jdbcType="VARCHAR" /> 23 <result column="skup_forbid_type" property="skupForbidType" jdbcType="VARCHAR" />
24 - <result column="skup_allow_type" property="skupAllowType" jdbcType="VARCHAR" /> 24 + <!--<result column="skup_allow_type" property="skupAllowType" jdbcType="VARCHAR" />-->
25 </resultMap> 25 </resultMap>
26 26
27 <sql id="Base_Column_List"> 27 <sql id="Base_Column_List">
28 id,coupon_token,coupon_name,coupon_amount,coupon_type,coupon_num,use_num,send_num, 28 id,coupon_token,coupon_name,coupon_amount,coupon_type,coupon_num,use_num,send_num,
29 use_limit_type,use_limit_value,product_limit_type,product_limit_value,start_time, 29 use_limit_type,use_limit_value,product_limit_type,product_limit_value,start_time,
30 - end_time,status,create_time,pid,remark,skup_forbid_type,skup_forbid_type 30 + end_time,status,create_time,pid,remark,skup_forbid_type
31 </sql> 31 </sql>
32 <insert id="insertOrUpdate" useGeneratedKeys="true" keyProperty="param.id"> 32 <insert id="insertOrUpdate" useGeneratedKeys="true" keyProperty="param.id">
33 insert into coupon(id,coupon_token,coupon_name,coupon_amount,coupon_type,coupon_num,use_num,send_num, 33 insert into coupon(id,coupon_token,coupon_name,coupon_amount,coupon_type,coupon_num,use_num,send_num,
@@ -130,9 +130,6 @@ @@ -130,9 +130,6 @@
130 <if test="param.remark != null"> 130 <if test="param.remark != null">
131 remark=#{param.remark}, 131 remark=#{param.remark},
132 </if> 132 </if>
133 - <if test="param.skupAllowType != null">  
134 - skup_allow_type=#{param.skupAllowType},  
135 - </if>  
136 </set> 133 </set>
137 where id = #{param.id} 134 where id = #{param.id}
138 </update> 135 </update>