Authored by 马力

券标签

... ... @@ -106,5 +106,11 @@ public class BigDecimalHelper {
System.out.println(isDigitalNumber("1111.0"));
System.out.println(isDigitalNumber("1111.01"));
System.out.println(isDigitalNumber("1111.1"));
System.out.println(getStripTrailingZeros(new BigDecimal(111123.80)));
}
public static String getStripTrailingZeros(BigDecimal value) {
return null == value ? "" : value.stripTrailingZeros().toPlainString();
}
}
... ...
... ... @@ -8,6 +8,7 @@ import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.common.annotation.InnerApi;
import com.yohoufo.common.cache.Cachable;
import com.yohoufo.promotion.service.impl.CollectiveCouponService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -64,13 +65,12 @@ public class CouponCenterController {
* @return
*/
@IgnoreSession
@IgnoreSignature
@InnerApi
@RequestMapping("/couponTopListOfPrdDetail")
@RequestMapping(params = "method=ufo.couponTopListOfPrdDetail.list")
@Cachable(expire = 120)
public ApiResponse couponTopListOfPrdDetail(
@RequestParam(value = "productId") Integer productId,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "2") int limit,
@RequestParam(value = "limit", required = false, defaultValue = "50") int limit,
@RequestParam(value = "business_client", required = false,defaultValue = "ufo") String businessClient) {
CouponListReq req = CouponListReq.builder()
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.promotion.service.impl;
import com.yohobuy.ufo.model.promotion.CouponSimpleBo;
import com.yohobuy.ufo.model.promotion.constant.CouponTypeEnum;
import com.yohobuy.ufo.model.promotion.constant.CouponUseLimitTypeEnum;
import com.yohoufo.common.utils.BigDecimalHelper;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
... ... @@ -50,15 +51,15 @@ public class CouponHelperService {
}
if (null != maxDirectInfo) {
maxDirectInfo.setCouponDesc("直降" + maxDirectInfo.getCouponAmount());
maxDirectInfo.setCouponDesc("直降" + BigDecimalHelper.getStripTrailingZeros(maxDirectInfo.getCouponAmount()));
result.add(maxDirectInfo);
}
if (null != maxReductionInfo) {
maxReductionInfo.setCouponDesc("满" + maxReductionInfo.getUseLimitValue() + "减" + maxReductionInfo.getCouponAmount());
maxReductionInfo.setCouponDesc("满" + maxReductionInfo.getUseLimitValue() + "减" + BigDecimalHelper.getStripTrailingZeros(maxDirectInfo.getCouponAmount()));
result.add(maxReductionInfo);
}
if (null != maxFareInfo) {
maxFareInfo.setCouponDesc("包邮" + maxFareInfo.getCouponAmount());
maxFareInfo.setCouponDesc("包邮" + BigDecimalHelper.getStripTrailingZeros(maxDirectInfo.getCouponAmount()));
result.add(maxFareInfo);
}
... ...