Authored by csgyoho

优惠券查询优化

@@ -227,8 +227,8 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ @@ -227,8 +227,8 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
227 LOGGER.info("checkUpdateCouponParam failed! coupon is null.id is {}",req.getId()); 227 LOGGER.info("checkUpdateCouponParam failed! coupon is null.id is {}",req.getId());
228 return false; 228 return false;
229 } 229 }
230 - if(coupon.getStatus() != Coupon.CouponStatusEnum.WAITE_CHECK.getValue()){  
231 - LOGGER.info("checkUpdateCouponParam failed! coupon is using! status is {}",coupon.getStatus()); 230 + if(coupon.getSendNum()>0){
  231 + LOGGER.info("checkUpdateCouponParam failed! coupon is using! sendNum is {}",coupon.getSendNum());
232 return false; 232 return false;
233 } 233 }
234 return true; 234 return true;
@@ -243,7 +243,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ @@ -243,7 +243,7 @@ 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(), getStatusDesc(coupon),coupon.getStatus()); 246 + useTime,coupon.getRemark(), getStatusDesc(coupon),coupon.getStatus(),coupon.getCouponToken());
247 resps.add(resp); 247 resps.add(resp);
248 } 248 }
249 return resps; 249 return resps;
@@ -19,6 +19,10 @@ public class CouponQueryResp { @@ -19,6 +19,10 @@ public class CouponQueryResp {
19 ) 19 )
20 private String name; 20 private String name;
21 @BatchExportField( 21 @BatchExportField(
  22 + name = "TOKEN"
  23 + )
  24 + private String token;
  25 + @BatchExportField(
22 name = "数量" 26 name = "数量"
23 ) 27 )
24 private Integer couponNum; 28 private Integer couponNum;
@@ -35,7 +39,7 @@ public class CouponQueryResp { @@ -35,7 +39,7 @@ public class CouponQueryResp {
35 ) 39 )
36 private String status; 40 private String status;
37 private Integer statusValue; 41 private Integer statusValue;
38 - public CouponQueryResp(Integer id, String name, Integer couponNum, String useTime, String remark, String status, Integer statusValue) { 42 + public CouponQueryResp(Integer id, String name, Integer couponNum, String useTime, String remark, String status, Integer statusValue,String token) {
39 this.id = id; 43 this.id = id;
40 this.name = name; 44 this.name = name;
41 this.couponNum = couponNum; 45 this.couponNum = couponNum;
@@ -43,6 +47,7 @@ public class CouponQueryResp { @@ -43,6 +47,7 @@ public class CouponQueryResp {
43 this.remark = remark; 47 this.remark = remark;
44 this.status = status; 48 this.status = status;
45 this.statusValue = statusValue; 49 this.statusValue = statusValue;
  50 + this.token = token;
46 } 51 }
47 52
48 public CouponQueryResp() { 53 public CouponQueryResp() {
@@ -148,15 +148,35 @@ @@ -148,15 +148,35 @@
148 <if test="param.name != null"> 148 <if test="param.name != null">
149 and coupon_name=#{param.name} 149 and coupon_name=#{param.name}
150 </if> 150 </if>
151 - <if test="param.status != null">  
152 - and status=#{param.status}  
153 - </if> 151 +
154 <if test="param.startTime != null"> 152 <if test="param.startTime != null">
155 and start_time>=#{param.startTime} 153 and start_time>=#{param.startTime}
156 </if> 154 </if>
157 <if test="param.endTime != null"> 155 <if test="param.endTime != null">
158 and end_time <![CDATA[<= ]]> #{param.endTime} 156 and end_time <![CDATA[<= ]]> #{param.endTime}
159 </if> 157 </if>
  158 + <if test="param.status != null">
  159 + <if test="param.status == 3">
  160 + <!--已作废-->
  161 + and status=#{param.status}
  162 + </if>
  163 + <if test="param.status == 2">
  164 + <!--已过期-->
  165 + and end_time <![CDATA[< ]]> #{param.curTime}
  166 + and status != 3
  167 + </if>
  168 + <if test="param.status == 1">
  169 + <!--生效中-->
  170 + and start_time <![CDATA[<= ]]> #{param.curTime}
  171 + and end_time >= #{param.curTime}
  172 + and status != 3
  173 + </if>
  174 + <if test="param.status == 0">
  175 + <!--未生效-->
  176 + and start_time > #{param.curTime}
  177 + and status != 3
  178 + </if>
  179 + </if>
160 </select> 180 </select>
161 <select id="selectByCondition" resultType="com.yoho.ufo.model.coupon.Coupon"> 181 <select id="selectByCondition" resultType="com.yoho.ufo.model.coupon.Coupon">
162 select <include refid="Base_Column_List" /> from coupon where 1=1 182 select <include refid="Base_Column_List" /> from coupon where 1=1
@@ -166,15 +186,34 @@ @@ -166,15 +186,34 @@
166 <if test="param.name != null"> 186 <if test="param.name != null">
167 and coupon_name=#{param.name} 187 and coupon_name=#{param.name}
168 </if> 188 </if>
169 - <if test="param.status != null">  
170 - and status=#{param.status}  
171 - </if>  
172 <if test="param.startTime != null"> 189 <if test="param.startTime != null">
173 and start_time>=#{param.startTime} 190 and start_time>=#{param.startTime}
174 </if> 191 </if>
175 <if test="param.endTime != null"> 192 <if test="param.endTime != null">
176 and end_time <![CDATA[<= ]]> #{param.endTime} 193 and end_time <![CDATA[<= ]]> #{param.endTime}
177 </if> 194 </if>
  195 + <if test="param.status != null">
  196 + <if test="param.status == 3">
  197 + <!--已作废-->
  198 + and status=#{param.status}
  199 + </if>
  200 + <if test="param.status == 2">
  201 + <!--已过期-->
  202 + and end_time <![CDATA[< ]]> #{param.curTime}
  203 + and status != 3
  204 + </if>
  205 + <if test="param.status == 1">
  206 + <!--生效中-->
  207 + and start_time <![CDATA[<= ]]> #{param.curTime}
  208 + and end_time >= #{param.curTime}
  209 + and status != 3
  210 + </if>
  211 + <if test="param.status == 0">
  212 + <!--未生效-->
  213 + and start_time > #{param.curTime}
  214 + and status != 3
  215 + </if>
  216 + </if>
178 order by id desc 217 order by id desc
179 <if test="param.size > 0"> 218 <if test="param.size > 0">
180 limit #{param.start},#{param.size} 219 limit #{param.start},#{param.size}