fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java
@@ -445,22 +445,25 @@ record.setExtraInfoStr(desc.toString()); } if (warnLevel == 0) { // 查询同店铺商品,同商品订单超过一定数量的 List<Integer> typeList = new ArrayList<>(); typeList.add(HongBaoV2.TYPE_ZIGOU); long sameGoodsOrderCount = commonOrderCountService.countSameGoodsOrderByUidAndHongBaoType(typeList, record.getExtract().getUserInfo().getId(), Integer.parseInt(configService.get("admin_min_same_goods_order_count"))); long sameShopOrderCount = commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList, record.getExtract().getUserInfo().getId(), Integer.parseInt(configService.get("admin_min_same_shop_order_count"))); if (sameGoodsOrderCount > 0 || sameShopOrderCount > 0) { warnLevel = 3; record.setExtraInfoStr( String.format("同店铺:%s 同商品:%s", sameShopOrderCount, sameGoodsOrderCount)); } } // if (warnLevel == 0) { // // 查询同店铺商品,同商品订单超过一定数量的 // List<Integer> typeList = new ArrayList<>(); // typeList.add(HongBaoV2.TYPE_ZIGOU); // long sameGoodsOrderCount = // commonOrderCountService.countSameGoodsOrderByUidAndHongBaoType(typeList, // record.getExtract().getUserInfo().getId(), // Integer.parseInt(configService.get("admin_min_same_goods_order_count"))); // long sameShopOrderCount = // commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList, // record.getExtract().getUserInfo().getId(), // Integer.parseInt(configService.get("admin_min_same_shop_order_count"))); // if (sameGoodsOrderCount > 0 || sameShopOrderCount > 0) { // warnLevel = 3; // record.setExtraInfoStr( // String.format("同店铺:%s 同商品:%s", sameShopOrderCount, // sameGoodsOrderCount)); // } // } record.setWarnLevel(warnLevel); @@ -486,6 +489,27 @@ e.printStackTrace(); out.print(JsonUtil.loadFalseResult(e.getMessage())); } } @RequestMapping(value = "getMyAuditedDanger") public void getMyAuditedDanger(String callback, Long uid, PrintWriter out) { if (uid == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请登录")); return; } // 查询同店铺商品,同商品订单超过一定数量的 List<Integer> typeList = new ArrayList<>(); typeList.add(HongBaoV2.TYPE_ZIGOU); long sameGoodsOrderCount = commonOrderCountService.countSameGoodsOrderByUidAndHongBaoType(typeList, uid, Integer.parseInt(configService.get("admin_min_same_goods_order_count"))); long sameShopOrderCount = commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList, uid, Integer.parseInt(configService.get("admin_min_same_shop_order_count"))); if (sameGoodsOrderCount > 0 || sameShopOrderCount > 0) { String text = (String.format("同店铺:%s 同商品:%s", sameShopOrderCount, sameGoodsOrderCount)); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(text)); return; } JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("店铺/商品无异常")); } /** @@ -1082,9 +1106,10 @@ e.printStackTrace(); } } /** * 下载提现红包Openid * * @param callback * @param response * @param out @@ -1125,10 +1150,10 @@ e.printStackTrace(); } } /** * 上传提现红包Excel * * @param file * @param out */ @@ -1150,10 +1175,10 @@ out.print(JsonUtil.loadFalseResult("上传失败")); } } /** * 预览红包发生人 * * @param callback * @param pageIndex * @param out fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -182,10 +182,9 @@ @Resource private JumpDetailV2Service jumpDetailV2Service; @Resource private JDGoodsClassService jdGoodsClassService; /** * 淘宝商品详情 @@ -266,7 +265,6 @@ taoBaoGoodsUpdateService.offlineTaoBaoGoods(id); } }); } } else { @@ -351,6 +349,15 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate); if (TaoBaoUtil.isYUShou(goods)) { if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) { if (goodsDetail.getLabels() == null) goodsDetail.setLabels(new ArrayList<>()); goodsDetail.getLabels().add(new ClientTextStyleVO(goods.getPresaleDiscountFeeText(), "#FF2B4E")); } } // 在标题添加优惠信息 // 店铺信息 TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(id, goods.getSellerId()); @@ -546,11 +553,11 @@ OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); JSONObject params1=new JSONObject(); JSONObject params1 = new JSONObject(); params1.put("url", configService.get("special_guide_reward_coupon_link")); rewardCoupon.setParams(params1.toString()); rewardCoupon.setMaxMoney("¥" +TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate).add( MoneyBigDecimalUtil.mul(TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate), Constant.MAX_REWARD_RATE))); rewardCoupon.setMaxMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate).add(MoneyBigDecimalUtil .mul(TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate), Constant.MAX_REWARD_RATE))); rewardCoupon.setDesc("用返利奖励券最高返"); otherInfo.setRewardCoupon(rewardCoupon); goodsDetail.setOtherInfo(otherInfo); @@ -636,14 +643,15 @@ // 附加信息 OtherInfo otherInfo = new OtherInfo(); // 京东plus返利 String maxMoneyPlus = null; JDCategoryInfo categoryInfo = jdGoods.getCategoryInfo(); if (categoryInfo != null && categoryInfo.getCid3() != null && jdGoods.getCommissionInfo() != null) { Long cid3 = categoryInfo.getCid3(); JDGoodsClass threeClass = jdGoodsClassService.getThreeClassByCid(Integer.parseInt(cid3.toString())); if (threeClass != null && threeClass.getSelfComm() != null && threeClass.getSelfComm().compareTo(new BigDecimal(0)) > 0) { if (threeClass != null && threeClass.getSelfComm() != null && threeClass.getSelfComm().compareTo(new BigDecimal(0)) > 0) { BigDecimal commissionShare = jdGoods.getCommissionInfo().getCommissionShare(); // plus比例 小于正常比例 if (commissionShare != null && commissionShare.compareTo(threeClass.getSelfComm()) > 0) { @@ -652,20 +660,22 @@ BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, fanLiRate); otherInfo.setFanliMoneyPlus("京东plus会员返¥" + fanliMoneyPlus); // 使用奖励券最高返 maxMoneyPlus = "(京东plus会员最高返¥"+ fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))+")"; maxMoneyPlus = "(京东plus会员最高返¥" + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE)) + ")"; } } } // 奖励券返利 RewardCouponVO rewardCoupon = new RewardCouponVO(); rewardCoupon.setMaxMoneyPlus(maxMoneyPlus); rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); JSONObject params1=new JSONObject(); JSONObject params1 = new JSONObject(); params1.put("url", configService.get("special_guide_reward_coupon_link")); rewardCoupon.setParams(params1.toString()); rewardCoupon.setMaxMoney( "¥" +JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate).add( MoneyBigDecimalUtil.mul(JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate), Constant.MAX_REWARD_RATE))); rewardCoupon.setMaxMoney("¥" + JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate) .add(MoneyBigDecimalUtil.mul(JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate), Constant.MAX_REWARD_RATE))); rewardCoupon.setDesc("用返利奖励券最高返"); otherInfo.setRewardCoupon(rewardCoupon); goodsDetail.setOtherInfo(otherInfo); @@ -809,11 +819,11 @@ OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); JSONObject params1=new JSONObject(); JSONObject params1 = new JSONObject(); params1.put("url", configService.get("special_guide_reward_coupon_link")); rewardCoupon.setParams(params1.toString()); rewardCoupon.setMaxMoney("¥" +PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate).add(MoneyBigDecimalUtil.mul(PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate), Constant.MAX_REWARD_RATE))); rewardCoupon.setMaxMoney("¥" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate).add(MoneyBigDecimalUtil .mul(PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate), Constant.MAX_REWARD_RATE))); rewardCoupon.setDesc("用返利奖励券最高返"); otherInfo.setRewardCoupon(rewardCoupon); goodsDetail.setOtherInfo(otherInfo); fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -182,9 +182,10 @@ if (analysisTaoToken(acceptData, text, out)) { return; } if (!StringUtil.isNullOrEmpty(TaoBaoUtil.parseSystemTaoToken(text))) if (!StringUtil.isNullOrEmpty(TaoBaoUtil.parseSystemTaoToken(text))) { out.print(JsonUtil.loadFalseResult("不支持推荐")); return; } JSONObject root = new JSONObject(); root.put("type", 2); JSONObject data = new JSONObject(); fanli/src/main/java/com/yeshi/fanli/entity/order/OrderSubsidy.java
@@ -14,7 +14,7 @@ */ @Table("yeshi_ec_order_subsidy") public class OrderSubsidy { //未知 // 未知 public static final int STATE_UNKNOWN = 0; // 可补贴 public static final int STATE_VALID = 1; @@ -22,8 +22,15 @@ public static final int STATE_INVALID = 2; // 已补贴成功 public static final int STATE_SUBSIDIZED = 3; public OrderSubsidy(Long id) { super(); this.id = id; } public OrderSubsidy() { } @Column(name = "os_id") private Long id; @Column(name = "os_uid") fanli/src/main/java/com/yeshi/fanli/exception/order/OrderSubsidyException.java
New file @@ -0,0 +1,16 @@ package com.yeshi.fanli.exception.order; import com.yeshi.fanli.exception.BaseException; public class OrderSubsidyException extends BaseException { private static final long serialVersionUID = 1L; public OrderSubsidyException(int code, String msg) { super(code, msg); } public OrderSubsidyException() { super(); } } fanli/src/main/java/com/yeshi/fanli/job/order/jd/UpdateJDOrderJob.java
@@ -63,8 +63,7 @@ public void updateSoonOrder() { if (!Constant.IS_TASK) return; LogHelper.job("开始爬取京东订单"); LogHelper.job("开始爬取京东订单"); long now = System.currentTimeMillis(); JDOrderResult result = JDApiUtil.getOrderList(1, 200, new Date(now), JDApiUtil.ORDER_TYPE_CREATETIME); fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderSubsidyServiceImpl.java
@@ -1,12 +1,17 @@ package com.yeshi.fanli.service.impl.order; import java.util.Date; import javax.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.yeshi.fanli.dao.mybatis.order.OrderSubsidyMapper; import com.yeshi.fanli.entity.order.OrderSubsidy; import com.yeshi.fanli.exception.order.OrderSubsidyException; import com.yeshi.fanli.service.inter.order.OrderSubsidyService; import com.yeshi.fanli.util.StringUtil; @Service public class OrderSubsidyServiceImpl implements OrderSubsidyService { @@ -19,4 +24,26 @@ return orderSubsidyMapper.getByOrderNoAndType(uid, orderNo, type); } @Transactional @Override public void addOrderSubsidy(OrderSubsidy orderSubsidy) throws OrderSubsidyException { if (orderSubsidy.getMoney() == null || StringUtil.isNullOrEmpty(orderSubsidy.getOrderNo()) || orderSubsidy.getSourceType() == null || orderSubsidy.getUid() == null) throw new OrderSubsidyException(1, "数据不完整"); OrderSubsidy old = getByOrderNoAndType(orderSubsidy.getUid(), orderSubsidy.getOrderNo(), orderSubsidy.getSourceType()); if (old != null) {// 修改 // 修改状态 OrderSubsidy update = new OrderSubsidy(old.getId()); update.setMoney(orderSubsidy.getMoney()); update.setState(orderSubsidy.getState()); update.setUpdateTime(new Date()); orderSubsidyMapper.updateByPrimaryKeySelective(update); } else {// 添加 if (orderSubsidy.getCreateTime() == null) orderSubsidy.setCreateTime(new Date()); orderSubsidyMapper.insertSelective(orderSubsidy); } } } fanli/src/main/java/com/yeshi/fanli/service/inter/order/OrderSubsidyService.java
@@ -1,16 +1,26 @@ package com.yeshi.fanli.service.inter.order; import com.yeshi.fanli.entity.order.OrderSubsidy; import com.yeshi.fanli.exception.order.OrderSubsidyException; public interface OrderSubsidyService { /** * 查询补贴 * * @param uid * @param orderNo * @param type * @return */ public OrderSubsidy getByOrderNoAndType(Long uid, String orderNo, Integer type); /** * 添加订单补贴 * * @param orderSubsidy * @throws OrderSubsidyException */ public void addOrderSubsidy(OrderSubsidy orderSubsidy) throws OrderSubsidyException; } fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java
@@ -391,26 +391,11 @@ BigDecimal fanLiRate, BigDecimal shareRate) { if (goodsInfo != null && goods != null) { // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 moneyInfoVO.setFanliMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, fanLiRate)); moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, shareRate)); goodsInfo.setMoneyInfo(moneyInfoVO); // 设置券后价为定金价格 if (goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) { goodsInfo.setCouponPrice(new BigDecimal(goods.getPresaleDeposit())); } goodsInfo.setZkPrice(new BigDecimal(goods.getPresaleDeposit())); // 添加标签 if (goodsInfo.getLabels() == null) goodsInfo.setLabels(new ArrayList<>()); goodsInfo.getLabels().add(new ClientTextStyleVO("预售", "#FF2B4E")); // 在标题添加优惠信息 if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) { goodsInfo.setTitle(String.format("【%s】", goods.getPresaleDiscountFeeText()) + goodsInfo.getTitle()); } } return goodsInfo; } fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java
@@ -789,14 +789,11 @@ private static TaoBaoGoodsBriefExtra loadYuShouInfo(TaoBaoGoodsBriefExtra extra, TaoBaoGoodsBrief goods) { if (goods != null && extra != null) { if (isYUShou(goods)) {// 预售商品 extra.setZkPrice(new BigDecimal(goods.getPresaleDeposit())); // extra.setZkPrice(new BigDecimal(goods.getPresaleDeposit())); // 预售 if (extra.getLabels() == null) extra.setLabels(new ArrayList<>()); extra.getLabels().add(new ClientTextStyleVO("预售", "#FF2B4E")); if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) {// 在标题添加优惠信息 extra.setTitle(String.format("【%s】", goods.getPresaleDiscountFeeText()) + extra.getTitle()); } } } return extra; @@ -1436,22 +1433,6 @@ */ public static BigDecimal getGoodsHongBaoMoney(TaoBaoGoodsBrief goodsBrief, BigDecimal rate) { BigDecimal money = null; // 预售商品 if (isYUShou(goodsBrief)) { if (goodsBrief.getYsylCommissionRate() != null) money = MoneyBigDecimalUtil.mul( MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(new BigDecimal(goodsBrief.getPresaleDeposit()), goodsBrief.getYsylCommissionRate()), new BigDecimal("0.0001")), MoneyBigDecimalUtil.div(rate, new BigDecimal(100))); else money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul( MoneyBigDecimalUtil.mul(goodsBrief.getZkPrice(), goodsBrief.getTkRate()), new BigDecimal("0.01")), MoneyBigDecimalUtil.div(rate, new BigDecimal(100))); return money; } if (StringUtil.isNullOrEmpty(goodsBrief.getCouponInfo()) || goodsBrief.getCouponInfo().trim().equalsIgnoreCase("无")) { money = MoneyBigDecimalUtil.mul( @@ -2120,6 +2101,7 @@ /** * 提取自有格式的淘口令 * * @param str * @return */