Authored by htoooth

fix

... ... @@ -3,6 +3,7 @@ package com.yoho.ufo.coupon.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.error.exception.ServiceException;
import com.yoho.ufo.coupon.service.ICouponService;
import com.yoho.ufo.dal.CouponMapper;
import com.yoho.ufo.dal.CouponProductLimitMapper;
... ... @@ -225,11 +226,11 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
Coupon coupon = couponMapper.selectById(req.getId());
if(coupon == null){
LOGGER.info("checkUpdateCouponParam failed! coupon is null.id is {}",req.getId());
return false;
throw new ServiceException(500,"修改失败,优惠券不存在");
}
if(coupon.getSendNum()>0){
LOGGER.info("checkUpdateCouponParam failed! coupon is using! sendNum is {}",coupon.getSendNum());
return false;
throw new ServiceException(500,"修改失败,优惠券已发放");
}
return true;
}
... ...
... ... @@ -273,7 +273,7 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
bo.setHighRate(csc.getHighRate());
BigDecimal channelLowPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).subtract(csc.getLowRate()));
BigDecimal channelHighPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).add(csc.getHighRate()));
bo.setChannelPriceRange(getFormatPrice(channelLowPrice) + "~" + getFormatPrice(channelHighPrice));
bo.setChannelPriceRange(getIntFormatPrice(channelLowPrice) + "~" + getIntFormatPrice(channelHighPrice));
bo.setUfoCurrentPrice(getFormatPrice(storageMinPriceMap.get(csc.getSku())));
BigDecimal ufoMinPrice = null == productMap.get(csc.getProductId()) ? null : productMap.get(csc.getProductId()).getMinPrice();
bo.setUfoMinPrice(getFormatPrice(ufoMinPrice));
... ... @@ -281,7 +281,7 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
BigDecimal suggestLowPrice = null == storageMap.get(csc.getSku()) ? null : storageMap.get(csc.getSku()).getSuggestLowPrice();
BigDecimal suggestHighPrice = null == storageMap.get(csc.getSku()) ? null : storageMap.get(csc.getSku()).getSuggestHighPrice();
if(null != suggestLowPrice && null != suggestHighPrice) {
bo.setSuggestPriceRange(getFormatPrice(suggestLowPrice) + "~" + getFormatPrice(suggestHighPrice));
bo.setSuggestPriceRange(getIntFormatPrice(suggestLowPrice) + "~" + getIntFormatPrice(suggestHighPrice));
}
bo.setStatus(csc.getStatus());
bo.setStatusStr(bo.getStatus().intValue()==CHANNEL_SKU_COMPARE_NORMAL ? "正常" : "异常");
... ... @@ -303,6 +303,13 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
return String.format("%.2f", price.doubleValue());
}
private static String getIntFormatPrice(BigDecimal price) {
if(null == price) {
return "-";
}
return String.format("%d", price.intValue());
}
private boolean checkAndBuildParam(ChannelSkuCompareReq req) {
if(StringUtils.isNotEmpty(req.getProductName())) {
List<Product> productList = productMapper.selectByProductName(req.getProductName());
... ...
... ... @@ -19,7 +19,7 @@ import com.yoho.ufo.service.IChannelSkuCompareService;
*
*/
@Service(value="scheduledUpdateSuggestPrice")
@YhJobDef(desc = "定时变参考价", jobName = "scheduledUpdateSuggestPrice", cron = "00 00 5 * * ?", misfiredPolicy = MisfiredPolicy.CRON_DO_NOTHING,
@YhJobDef(desc = "定时变参考价", jobName = "scheduledUpdateSuggestPrice", cron = "*/30 * * * * ?", misfiredPolicy = MisfiredPolicy.CRON_DO_NOTHING,
jobType = JobType.CRON, jobGroup = "ufoPlatform")
public class ScheduledUpdateSuggestPrice implements YhJob{
private static final Logger LOGGER = LoggerFactory.getLogger("scheduledLog");
... ...