Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
| | |
| | | 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);
|
| | |
|
| | |
| | | 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("店铺/商品无异常"));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | /**
|
| | | * 下载提现红包Openid
|
| | | * |
| | | * @param callback
|
| | | * @param response
|
| | | * @param out
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 上传提现红包Excel
|
| | | * |
| | | * @param file
|
| | | * @param out
|
| | | */
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 预览红包发生人
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param out
|
| | |
| | | @Resource
|
| | | private JDGoodsClassService jdGoodsClassService;
|
| | |
|
| | |
|
| | | /**
|
| | | * 淘宝商品详情
|
| | | *
|
| | |
| | | taoBaoGoodsUpdateService.offlineTaoBaoGoods(id);
|
| | | }
|
| | | });
|
| | |
|
| | | }
|
| | |
|
| | | } else {
|
| | |
| | | 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());
|
| | |
| | | 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);
|
| | |
| | | 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) {
|
| | |
| | | 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))
|
| | | + ")";
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | 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);
|
| | |
| | | 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);
|
| | |
| | | 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();
|
| | |
| | | // 已补贴成功
|
| | | public static final int STATE_SUBSIDIZED = 3;
|
| | |
|
| | | public OrderSubsidy(Long id) {
|
| | | super();
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public OrderSubsidy() {
|
| | | }
|
| | |
|
| | | @Column(name = "os_id")
|
| | | private Long id;
|
New file |
| | |
| | | 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();
|
| | | }
|
| | | }
|
| | |
| | | public void updateSoonOrder() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | |
|
| | | LogHelper.job("开始爬取京东订单");
|
| | | long now = System.currentTimeMillis();
|
| | |
|
| | |
| | | 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 {
|
| | |
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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
|
| | |
| | | */
|
| | | public OrderSubsidy getByOrderNoAndType(Long uid, String orderNo, Integer type);
|
| | |
|
| | | /**
|
| | | * 添加订单补贴
|
| | | * |
| | | * @param orderSubsidy
|
| | | * @throws OrderSubsidyException
|
| | | */
|
| | | public void addOrderSubsidy(OrderSubsidy orderSubsidy) throws OrderSubsidyException;
|
| | |
|
| | | }
|
| | |
| | | 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;
|
| | | }
|
| | |
| | | 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;
|
| | |
| | | */
|
| | | 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(
|
| | |
| | |
|
| | | /**
|
| | | * 提取自有格式的淘口令
|
| | | * |
| | | * @param str
|
| | | * @return
|
| | | */
|