Authored by LUOXC

Merge branch 'test6.9.21' into gray

@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`) 54 AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`)
55 and receive_start_time <![CDATA[ <= ]]> #{currentTime} 55 and receive_start_time <![CDATA[ <= ]]> #{currentTime}
56 AND `business_client` LIKE CONCAT('%',#{businessClient},'%') 56 AND `business_client` LIKE CONCAT('%',#{businessClient},'%')
57 - ORDER BY coupon_type,use_limit_type,`use_limit_value` DESC 57 + ORDER BY coupon_type,use_limit_type,`coupon_amount` DESC
58 limit #{offset},#{limit} 58 limit #{offset},#{limit}
59 </select> 59 </select>
60 60
@@ -90,7 +90,7 @@ @@ -90,7 +90,7 @@
90 AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`) 90 AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`)
91 and receive_start_time <![CDATA[ <= ]]> #{currentTime} 91 and receive_start_time <![CDATA[ <= ]]> #{currentTime}
92 AND `business_client` LIKE CONCAT('%',#{businessClient},'%') 92 AND `business_client` LIKE CONCAT('%',#{businessClient},'%')
93 - ORDER BY `use_limit_value` DESC 93 + ORDER BY `coupon_amount` DESC
94 limit #{offset},#{limit} 94 limit #{offset},#{limit}
95 </select> 95 </select>
96 96
@@ -98,7 +98,9 @@ @@ -98,7 +98,9 @@
98 SELECT DISTINCT cpn.id FROM coupon cpn 98 SELECT DISTINCT cpn.id FROM coupon cpn
99 LEFT JOIN `coupon_product_limit` cpl ON cpl.`coupon_id` = cpn.id 99 LEFT JOIN `coupon_product_limit` cpl ON cpl.`coupon_id` = cpn.id
100 WHERE coupon_type = #{couponType} 100 WHERE coupon_type = #{couponType}
101 - and use_limit_type = #{useLimitType} 101 + <if test="useLimitType != null">
  102 + and use_limit_type = #{useLimitType}
  103 + </if>
102 and ((cpn.`product_limit_type` = 1 AND cpl.`product_id` = #{productId}) OR (cpn.`product_limit_type` = 3 AND cpl.`product_id` != #{productId}) OR cpn.`product_limit_type` =2) 104 and ((cpn.`product_limit_type` = 1 AND cpl.`product_id` = #{productId}) OR (cpn.`product_limit_type` = 3 AND cpl.`product_id` != #{productId}) OR cpn.`product_limit_type` =2)
103 </sql> 105 </sql>
104 106
@@ -167,11 +167,17 @@ public class CouponConvert { @@ -167,11 +167,17 @@ public class CouponConvert {
167 && DateUtil.between(userCoupon.getEndTime() - DateUtil.getCurrentTimeSecond(), 0, THREE_DAY_SECOND); 167 && DateUtil.between(userCoupon.getEndTime() - DateUtil.getCurrentTimeSecond(), 0, THREE_DAY_SECOND);
168 } 168 }
169 169
170 - 170 + /**
  171 + * 展示原有的券名
  172 + * @param coupon
  173 + * @param userCoupon
  174 + * @return
  175 + */
171 public static CouponSimpleBo do2CouponSimpleBo(Coupon coupon, UserCoupon userCoupon){ 176 public static CouponSimpleBo do2CouponSimpleBo(Coupon coupon, UserCoupon userCoupon){
172 CouponSimpleBo couponSimpleBo = new CouponSimpleBo(); 177 CouponSimpleBo couponSimpleBo = new CouponSimpleBo();
173 couponSimpleBo.setCouponId(coupon.getId()); 178 couponSimpleBo.setCouponId(coupon.getId());
174 - couponSimpleBo.setCouponName(coupon.getCouponName()); 179 + String couponName = coupon.getCouponName();
  180 + couponSimpleBo.setCouponName(couponName);
175 couponSimpleBo.setCouponAmount(coupon.getCouponAmount()); 181 couponSimpleBo.setCouponAmount(coupon.getCouponAmount());
176 couponSimpleBo.setUseLimitType(coupon.getUseLimitType().intValue()); 182 couponSimpleBo.setUseLimitType(coupon.getUseLimitType().intValue());
177 couponSimpleBo.setUseLimitValue(String.valueOf(coupon.getUseLimitValue())); 183 couponSimpleBo.setUseLimitValue(String.valueOf(coupon.getUseLimitValue()));
@@ -188,7 +194,7 @@ public class CouponConvert { @@ -188,7 +194,7 @@ public class CouponConvert {
188 if (Objects.nonNull(receiveEndTime=coupon.getReceiveEndTime())){ 194 if (Objects.nonNull(receiveEndTime=coupon.getReceiveEndTime())){
189 couponSimpleBo.setReceiveEndTime(DateUtil.formatDate(receiveEndTime, DateUtil.YYYY_MM_DD_DOT)); 195 couponSimpleBo.setReceiveEndTime(DateUtil.formatDate(receiveEndTime, DateUtil.YYYY_MM_DD_DOT));
190 } 196 }
191 - // 197 + //是否可以领取
192 if (Objects.nonNull(userCoupon)){ 198 if (Objects.nonNull(userCoupon)){
193 couponSimpleBo.setReceive("N"); 199 couponSimpleBo.setReceive("N");
194 }else{ 200 }else{
@@ -197,10 +203,16 @@ public class CouponConvert { @@ -197,10 +203,16 @@ public class CouponConvert {
197 return couponSimpleBo; 203 return couponSimpleBo;
198 } 204 }
199 205
  206 + /**
  207 + * 重命名券名
  208 + * @param coupon
  209 + * @return
  210 + */
200 public static CouponSimpleBo do2CouponSimpleBo(Coupon coupon){ 211 public static CouponSimpleBo do2CouponSimpleBo(Coupon coupon){
201 CouponSimpleBo couponSimpleBo = new CouponSimpleBo(); 212 CouponSimpleBo couponSimpleBo = new CouponSimpleBo();
202 couponSimpleBo.setCouponId(coupon.getId()); 213 couponSimpleBo.setCouponId(coupon.getId());
203 - couponSimpleBo.setCouponName(coupon.getCouponName()); 214 + String newName = buildCouponNameByType(coupon);
  215 + couponSimpleBo.setCouponName(newName);
204 couponSimpleBo.setCouponAmount(coupon.getCouponAmount()); 216 couponSimpleBo.setCouponAmount(coupon.getCouponAmount());
205 couponSimpleBo.setUseLimitType(coupon.getUseLimitType().intValue()); 217 couponSimpleBo.setUseLimitType(coupon.getUseLimitType().intValue());
206 String useLimitValueStr; 218 String useLimitValueStr;
@@ -209,9 +221,18 @@ public class CouponConvert { @@ -209,9 +221,18 @@ public class CouponConvert {
209 couponSimpleBo.setCouponToken(coupon.getCouponToken()); 221 couponSimpleBo.setCouponToken(coupon.getCouponToken());
210 Integer couponType; 222 Integer couponType;
211 couponSimpleBo.setCouponType(couponType=coupon.getCouponType()); 223 couponSimpleBo.setCouponType(couponType=coupon.getCouponType());
212 - String couponDesc = null;  
213 224
  225 + couponSimpleBo.setStartTime(DateUtil.formatDate(coupon.getStartTime(), DateUtil.YYYY_MM_DD_DOT));
  226 + couponSimpleBo.setEndTime(DateUtil.formatDate(coupon.getEndTime(), DateUtil.YYYY_MM_DD_DOT));
  227 + return couponSimpleBo;
  228 + }
  229 +
  230 +
  231 + static String buildCouponNameByType(Coupon coupon){
214 String couponAmountSkipDecimal = BigDecimalHelper.getStripTrailingZeros(coupon.getCouponAmount()); 232 String couponAmountSkipDecimal = BigDecimalHelper.getStripTrailingZeros(coupon.getCouponAmount());
  233 + Integer couponType = coupon.getCouponType();
  234 + String useLimitValueStr=String.valueOf(coupon.getUseLimitValue());
  235 + String couponDesc = coupon.getCouponName();
215 if (Integer.valueOf(CouponTypeEnum.ACTIVITY_COUPON.getCode()).equals(couponType)) { 236 if (Integer.valueOf(CouponTypeEnum.ACTIVITY_COUPON.getCode()).equals(couponType)) {
216 String useLimitTypeStr = coupon.getUseLimitType().toString(); 237 String useLimitTypeStr = coupon.getUseLimitType().toString();
217 if (CouponUseLimitTypeEnum.NON_LIMIT.getLimitType().equals(useLimitTypeStr)) { 238 if (CouponUseLimitTypeEnum.NON_LIMIT.getLimitType().equals(useLimitTypeStr)) {
@@ -222,11 +243,8 @@ public class CouponConvert { @@ -222,11 +243,8 @@ public class CouponConvert {
222 } 243 }
223 } 244 }
224 if (Integer.valueOf(CouponTypeEnum.SHIPPING_COUPON.getCode()).equals(couponType)){ 245 if (Integer.valueOf(CouponTypeEnum.SHIPPING_COUPON.getCode()).equals(couponType)){
225 - couponDesc = "包邮" + couponAmountSkipDecimal; 246 + couponDesc = "包邮";
226 } 247 }
227 - couponSimpleBo.setCouponDesc(couponDesc);  
228 - couponSimpleBo.setStartTime(DateUtil.formatDate(coupon.getStartTime(), DateUtil.YYYY_MM_DD_DOT));  
229 - couponSimpleBo.setEndTime(DateUtil.formatDate(coupon.getEndTime(), DateUtil.YYYY_MM_DD_DOT));  
230 - return couponSimpleBo; 248 + return couponDesc;
231 } 249 }
232 } 250 }