Authored by csgyoho

Merge branch 'dev-resources-20181116' into test6.8.2

@@ -133,7 +133,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ @@ -133,7 +133,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
133 if(null == req.getId()){ 133 if(null == req.getId()){
134 req.setCouponToken(UUID.randomUUID().toString()); 134 req.setCouponToken(UUID.randomUUID().toString());
135 req.setCreateTime(DateUtil.getCurrentTimeSecond()); 135 req.setCreateTime(DateUtil.getCurrentTimeSecond());
136 - req.setStatus(Coupon.CouponStatusEnum.WAITE_CHECK.getValue()); 136 + req.setStatus(Coupon.CouponStatusEnum.IN_EFFECT.getValue());
137 couponMapper.insertByCouponSaveUpdateReq(req); 137 couponMapper.insertByCouponSaveUpdateReq(req);
138 }else{ 138 }else{
139 couponMapper.updateByCouponSaveUpdateReq(req); 139 couponMapper.updateByCouponSaveUpdateReq(req);
@@ -243,9 +243,24 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ @@ -243,9 +243,24 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
243 String useTime = com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getStartTime(),"yyyy-MM-dd HH:mm:ss")+"至"+ 243 String useTime = com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getStartTime(),"yyyy-MM-dd HH:mm:ss")+"至"+
244 com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getEndTime(),"yyyy-MM-dd HH:mm:ss"); 244 com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getEndTime(),"yyyy-MM-dd HH:mm:ss");
245 CouponQueryResp resp = new CouponQueryResp(coupon.getId(),coupon.getCouponName(),coupon.getCouponNum(), 245 CouponQueryResp resp = new CouponQueryResp(coupon.getId(),coupon.getCouponName(),coupon.getCouponNum(),
246 - useTime,coupon.getRemark(), Coupon.CouponStatusEnum.getKey(coupon.getStatus()),coupon.getStatus()); 246 + useTime,coupon.getRemark(), getStatusDesc(coupon),coupon.getStatus());
247 resps.add(resp); 247 resps.add(resp);
248 } 248 }
249 return resps; 249 return resps;
250 } 250 }
  251 +
  252 + private String getStatusDesc(Coupon coupon){
  253 + if(Coupon.CouponStatusEnum.INVALID.getValue()!=coupon.getStatus()){
  254 + return Coupon.CouponStatusEnum.INVALID.getKey();
  255 + }
  256 + //0:未生效,1:生效中,2:已过期
  257 + int curTime = DateUtil.getCurrentTimeSecond();
  258 + if(coupon.getStartTime()>curTime){
  259 + return "未生效";
  260 + }
  261 + if(coupon.getEndTime()>=curTime){
  262 + return "生效中";
  263 + }
  264 + return "已过期";
  265 + }
251 } 266 }
@@ -28,8 +28,8 @@ public class Coupon implements Serializable { @@ -28,8 +28,8 @@ public class Coupon implements Serializable {
28 /**商品限制条件-特定商品*/ 28 /**商品限制条件-特定商品*/
29 public static final int PRODUCTLIMITTYPE_SPECIALPRODUCT = 1; 29 public static final int PRODUCTLIMITTYPE_SPECIALPRODUCT = 1;
30 public enum CouponStatusEnum { 30 public enum CouponStatusEnum {
31 - //0:未生效,1:生效中,2:已过期,3:已作废  
32 - WAITE_CHECK(0,"未生效"),IN_EFFECT(1,"生效中"),REVIEW_REJECTION(2,"已过期"),INVALID(3,"已作废"); 31 + //0:待审核,1:有效,2:审核驳回,3:作废
  32 + WAITE_CHECK(0,"待审核"),IN_EFFECT(1,"有效"),REVIEW_REJECTION(2,"审核驳回"),INVALID(3,"已作废");
33 private int value; 33 private int value;
34 private String key; 34 private String key;
35 35