fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -923,7 +923,7 @@ return; } PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id); PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id,PinDuoDuoApiUtil.PID_FANLI,uid+""); if (pddGoods == null) { out.print(JsonUtil.loadFalseResult(2, "商品不存在")); return; @@ -935,7 +935,7 @@ GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO); if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); goodsDetail.getMoneyInfo().setShareMoney("¥" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, goodsDetail.getMoneyInfo().setShareMoney("¥" + PinDuoDuoUtil.getGoodsShareMoney(pddGoods, hongBaoManageService.getShareRate(UserLevelEnum.superVIP, acceptData.getSystem()))); goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo()); goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo()); @@ -1787,6 +1787,7 @@ data.put("native", true); data.put("jumpLink", convertUrl.getUrl()); data.put("nativeJumpLink", PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); LogHelper.test(String.format("拼多多转链:uid:%s data:%s",uid+"",data.toString())); out.print(JsonUtil.loadTrueResult(data)); // 获得金币 fanli/src/main/java/com/yeshi/fanli/dao/mybatis/pdd/PDDOrderMapper.java
@@ -10,65 +10,72 @@ public interface PDDOrderMapper extends BaseMapper<PDDOrder> { /** * 根据订单SN查询订单 * * @param orderSn * @return */ PDDOrder selectByOrderSN(String orderSn); /** * 数量统计 * * @param dateType * @param year * @param startTime * @param endTime * @return */ List<ChartTDO> countOrderNumber(@Param("dateType") Integer dateType, @Param("year") String year, @Param("startTime") String startTime, @Param("endTime") String endTime); /** * 根据订单SN查询订单 * * @param orderSn * @return */ PDDOrder selectByOrderSN(String orderSn); /** * 根据订单号查询 * @param orderSnList * @return */ List<PDDOrder> listByOrderSn(@Param("orderSnList") List<String> orderSnList); /** * 数量统计 * * @param dateType * @param year * @param startTime * @param endTime * @return */ List<ChartTDO> countOrderNumber(@Param("dateType") Integer dateType, @Param("year") String year, @Param("startTime") String startTime, @Param("endTime") String endTime); /** * 数量统计 * * @param dateType * @param year * @param startTime * @param endTime * @return */ Long countOrderByDay(@Param("preDay") String preDay); /** * 根据状态查询数据 * * @param status * @param page * @param pageSize * @return */ List<PDDOrder> listByStatus(@Param("status") Integer status, @Param("start") long start, @Param("count") int count); /** * 数量统计 * * @param dateType * @param year * @param startTime * @param endTime * @return */ Long countOrderByDay(@Param("preDay") String preDay); /** * 根据状态查询数量 * * @param status * @return */ Long countByStatus(@Param("status") Integer status); /** * 查询所有订单 * * @param channel * @return */ List<PDDOrder> listQuery(@Param("start") long start, @Param("count")int count, @Param("key")String key); /** * 根据状态查询数据 * * @param status * @param page * @param pageSize * @return */ List<PDDOrder> listByStatus(@Param("status") Integer status, @Param("start") long start, @Param("count") int count); Long countQuery(@Param("key")String key); /** * 根据状态查询数量 * * @param status * @return */ Long countByStatus(@Param("status") Integer status); /** * 查询所有订单 * * @param channel * @return */ List<PDDOrder> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key); Long countQuery(@Param("key") String key); } fanli/src/main/java/com/yeshi/fanli/entity/bus/user/Order.java
@@ -7,104 +7,107 @@ /** * 订单 * * @author Administrator * * @author Administrator */ @org.yeshi.utils.mybatis.Table("yeshi_ec_order") public class Order { // 订单状状态 -1:失效 0-未支付 1-已支付 public final static int STATE_SHIXIAO = -1; public final static int STATE_WEIZHIFU = 0; public final static int STATE_YIZHIFU = 1; // 订单状状态 -1:失效 0-未支付 1-已支付 public final static int STATE_SHIXIAO = -1; public final static int STATE_WEIZHIFU = 0; public final static int STATE_YIZHIFU = 1; public final static int ORDER_TYPE_TAOBAO = 1;// 淘宝 public final static int ORDER_TYPE_JINGDONG = 2;// 京东 public final static int ORDER_TYPE_PDD = 3;// 拼多多 public final static int ORDER_TYPE_TAOBAO = 1;// 淘宝 public final static int ORDER_TYPE_JINGDONG = 2;// 京东 public final static int ORDER_TYPE_PDD = 3;// 拼多多 @org.yeshi.utils.mybatis.Column(name = "id") @Expose private Long id; @org.yeshi.utils.mybatis.Column(name = "id") @Expose private Long id; @org.yeshi.utils.mybatis.Column(name = "orderid") @Expose private String orderId;// 订单编号 @org.yeshi.utils.mybatis.Column(name = "orderid") @Expose private String orderId;// 订单编号 @org.yeshi.utils.mybatis.Column(name = "order_type") @Expose private Integer orderType;// 订单类型 1-淘宝 2-京东 @org.yeshi.utils.mybatis.Column(name = "order_type") @Expose private Integer orderType;// 订单类型 1-淘宝 2-京东 @org.yeshi.utils.mybatis.Column(name = "state") @Expose private Integer state;// 订单状�? -1:失效0-未支付?1-已支负 @org.yeshi.utils.mybatis.Column(name = "state") @Expose private Integer state;// 订单状态 -1:失效0-未支付?1-已支负 @org.yeshi.utils.mybatis.Column(name = "drawback_time") @Expose private Long drawbackTime;// 退款时间 @org.yeshi.utils.mybatis.Column(name = "state_desc") @Expose private String stateDesc;//订单描述 @org.yeshi.utils.mybatis.Column(name = "createtime") @Expose private Long createtime;// 创建时间 付款时间 @org.yeshi.utils.mybatis.Column(name = "drawback_time") @Expose private Long drawbackTime;// 退款时间 @org.yeshi.utils.mybatis.Column(name = "uid") @Expose private UserInfo userInfo; @org.yeshi.utils.mybatis.Column(name = "createtime") @Expose private Long createtime;// 创建时间 付款时间 @org.yeshi.utils.mybatis.Column(name = "beizhu") @Expose private String beizhu; @org.yeshi.utils.mybatis.Column(name = "uid") @Expose private UserInfo userInfo; @org.yeshi.utils.mybatis.Column(name = "money") @Expose private BigDecimal money; @org.yeshi.utils.mybatis.Column(name = "beizhu") @Expose private String beizhu; // 第三方订单创建时间 @org.yeshi.utils.mybatis.Column(name = "third_createtime") @Expose private Date thirdCreateTime; @org.yeshi.utils.mybatis.Column(name = "money") @Expose private BigDecimal money; // 第三方订单状态 @org.yeshi.utils.mybatis.Column(name = "third_state") @Expose private String thirdState; // 第三方订单创建时间 @org.yeshi.utils.mybatis.Column(name = "third_createtime") @Expose private Date thirdCreateTime; public Date getThirdCreateTime() { return thirdCreateTime; } // 第三方订单状态 @org.yeshi.utils.mybatis.Column(name = "third_state") @Expose private String thirdState; public void setThirdCreateTime(Date thirdCreateTime) { this.thirdCreateTime = thirdCreateTime; } public Date getThirdCreateTime() { return thirdCreateTime; } public String getThirdState() { return thirdState; } public void setThirdCreateTime(Date thirdCreateTime) { this.thirdCreateTime = thirdCreateTime; } public void setThirdState(String thirdState) { this.thirdState = thirdState; } public String getThirdState() { return thirdState; } /** * 版本: 1(1.2.3v之前)2:之后 */ @org.yeshi.utils.mybatis.Column(name = "version") private Integer version; public void setThirdState(String thirdState) { this.thirdState = thirdState; } public Order() { money = BigDecimal.valueOf(0); } /** * 版本: 1(1.2.3v之前)2:之后 */ @org.yeshi.utils.mybatis.Column(name = "version") private Integer version; public BigDecimal getMoney() { return money; } public Order() { money = BigDecimal.valueOf(0); } public void setMoney(BigDecimal money) { this.money = money; } public BigDecimal getMoney() { return money; } public Long getId() { return id; } public void setMoney(BigDecimal money) { this.money = money; } public Long getId() { return id; } // public List<OrderItem> getOrderItemList() { // return orderItemList; @@ -114,72 +117,80 @@ // this.orderItemList = orderItemList; //} public void setId(Long id) { this.id = id; } public String getStateDesc() { return stateDesc; } public String getOrderId() { return orderId; } public void setStateDesc(String stateDesc) { this.stateDesc = stateDesc; } public void setOrderId(String orderId) { this.orderId = orderId; } public void setId(Long id) { this.id = id; } public Integer getOrderType() { return orderType; } public String getOrderId() { return orderId; } public void setOrderType(Integer orderType) { this.orderType = orderType; } public void setOrderId(String orderId) { this.orderId = orderId; } public Integer getState() { return state; } public Integer getOrderType() { return orderType; } public void setState(Integer state) { this.state = state; } public void setOrderType(Integer orderType) { this.orderType = orderType; } public Long getDrawbackTime() { return drawbackTime; } public Integer getState() { return state; } public void setDrawbackTime(Long drawbackTime) { this.drawbackTime = drawbackTime; } public void setState(Integer state) { this.state = state; } public Long getCreatetime() { return createtime; } public Long getDrawbackTime() { return drawbackTime; } public void setCreatetime(Long createtime) { this.createtime = createtime; } public void setDrawbackTime(Long drawbackTime) { this.drawbackTime = drawbackTime; } public UserInfo getUserInfo() { return userInfo; } public Long getCreatetime() { return createtime; } public void setUserInfo(UserInfo userInfo) { this.userInfo = userInfo; } public void setCreatetime(Long createtime) { this.createtime = createtime; } public String getBeizhu() { return beizhu; } public UserInfo getUserInfo() { return userInfo; } public void setBeizhu(String beizhu) { this.beizhu = beizhu; } public void setUserInfo(UserInfo userInfo) { this.userInfo = userInfo; } public Integer getVersion() { return version; } public String getBeizhu() { return beizhu; } public void setVersion(Integer version) { this.version = version; } public void setBeizhu(String beizhu) { this.beizhu = beizhu; } public Integer getVersion() { return version; } public void setVersion(Integer version) { this.version = version; } } fanli/src/main/java/com/yeshi/fanli/entity/pdd/PDDOrder.java
@@ -9,284 +9,295 @@ /** * 拼多多订单 * * @author Administrator * * @author Administrator */ @Table("yeshi_ec_pdd_order") public class PDDOrder { @Column(name = "po_id") private Long id; @SerializedName("order_sn") @Column(name = "po_order_sn") private String orderSn;// 推广订单编号 @SerializedName("goods_id") @Column(name = "po_goods_id") private Long goodsId;// 商品ID @SerializedName("group_id") @Column(name = "po_group_id") private Long groupId;// 成团ID @SerializedName("goods_name") @Column(name = "po_goods_name") private String goodsName;// 商品标题 @SerializedName("goods_thumbnail_url") @Column(name = "po_goods_thumbnail_url") private String goodsThumbnailUrl;// 商品缩略图 @SerializedName("goods_quantity") @Column(name = "po_goods_quantity") private Integer goodsQuantity;// 购买商品的数量 @SerializedName("goods_price") @Column(name = "po_goods_price") private Long goodsPrice;// 订单中sku的单件价格,单位为分 @SerializedName("order_amount") @Column(name = "po_order_amount") private Long orderAmount;// 实际支付金额,单位为分 @SerializedName("p_id") @Column(name = "po_p_id") private String pId;// 推广位ID @SerializedName("promotion_rate") @Column(name = "po_promotion_rate") private Long promotionRate;// 佣金比例,千分比 @SerializedName("promotion_amount") @Column(name = "po_promotion_amount") private Long promotionAmount;// 佣金金额,单位为分 @SerializedName("order_status") @Column(name = "po_order_status") private Integer orderStatus;// 订单状态: -1 未支付; // 0-已支付;1-已成团;2-确认收货;3-审核成功;4-审核失败(不可提现);5-已经结算;8-非多多进宝商品(无佣金订单) @SerializedName("order_status_desc") @Column(name = "po_order_status_desc") private String orderStatusDesc;// 订单状态描述 @SerializedName("order_create_time") @Column(name = "po_order_create_time") private Long orderCreateTime;// 订单生成时间,UNIX时间戳 @SerializedName("order_pay_time") @Column(name = "po_order_pay_time") private Long orderPayTime;// 支付时间 @SerializedName("order_group_success_time") @Column(name = "po_order_group_success_time") private Long orderGroupSuccessTime;// 成团时间 @SerializedName("order_verify_time") @Column(name = "po_order_verify_time") private Long orderVerifyTime;// 审核时间 @SerializedName("order_modify_at") @Column(name = "po_order_modify_at") private Long orderModifyAt;// 最后更新时间 @SerializedName("order_receive_time") @Column(name = "po_order_receive_time") private Long orderReceiveTime;//收货时间 @SerializedName("custom_parameters") @Column(name = "po_custom_parameters") private String customParameters;// 自定义参数 @SerializedName("order_settle_time") @Column(name = "po_order_settle_time") private Long orderSettleTime;// 订单结算时间 @SerializedName("order_id") @Column(name = "po_order_id") private String orderId;// 订单编号 @Column(name = "po_create_time") private Date createTime;// 创建时间 @Column(name = "po_update_time") private Date updateTime;// 更新时间 @Column(name = "po_id") private Long id; @SerializedName("order_sn") @Column(name = "po_order_sn") private String orderSn;// 推广订单编号 @SerializedName("goods_id") @Column(name = "po_goods_id") private Long goodsId;// 商品ID @SerializedName("group_id") @Column(name = "po_group_id") private Long groupId;// 成团ID @SerializedName("goods_name") @Column(name = "po_goods_name") private String goodsName;// 商品标题 @SerializedName("goods_thumbnail_url") @Column(name = "po_goods_thumbnail_url") private String goodsThumbnailUrl;// 商品缩略图 @SerializedName("goods_quantity") @Column(name = "po_goods_quantity") private Integer goodsQuantity;// 购买商品的数量 @SerializedName("goods_price") @Column(name = "po_goods_price") private Long goodsPrice;// 订单中sku的单件价格,单位为分 @SerializedName("order_amount") @Column(name = "po_order_amount") private Long orderAmount;// 实际支付金额,单位为分 @SerializedName("p_id") @Column(name = "po_p_id") private String pId;// 推广位ID @SerializedName("promotion_rate") @Column(name = "po_promotion_rate") private Long promotionRate;// 佣金比例,千分比 @SerializedName("promotion_amount") @Column(name = "po_promotion_amount") private Long promotionAmount;// 佣金金额,单位为分 @SerializedName("order_status") @Column(name = "po_order_status") private Integer orderStatus;// 订单状态: -1 未支付; // 0-已支付;1-已成团;2-确认收货;3-审核成功;4-审核失败(不可提现);5-已经结算;8-非多多进宝商品(无佣金订单) @SerializedName("order_status_desc") @Column(name = "po_order_status_desc") private String orderStatusDesc;// 订单状态描述 @SerializedName("fail_reason") @Column(name = "po_fail_reason") private String failReason;//订单失败原因 @SerializedName("order_create_time") @Column(name = "po_order_create_time") private Long orderCreateTime;// 订单生成时间,UNIX时间戳 @SerializedName("order_pay_time") @Column(name = "po_order_pay_time") private Long orderPayTime;// 支付时间 @SerializedName("order_group_success_time") @Column(name = "po_order_group_success_time") private Long orderGroupSuccessTime;// 成团时间 @SerializedName("order_verify_time") @Column(name = "po_order_verify_time") private Long orderVerifyTime;// 审核时间 @SerializedName("order_modify_at") @Column(name = "po_order_modify_at") private Long orderModifyAt;// 最后更新时间 @SerializedName("order_receive_time") @Column(name = "po_order_receive_time") private Long orderReceiveTime;//收货时间 @SerializedName("custom_parameters") @Column(name = "po_custom_parameters") private String customParameters;// 自定义参数 @SerializedName("order_settle_time") @Column(name = "po_order_settle_time") private Long orderSettleTime;// 订单结算时间 @SerializedName("order_id") @Column(name = "po_order_id") private String orderId;// 订单编号 @Column(name = "po_create_time") private Date createTime;// 创建时间 @Column(name = "po_update_time") private Date updateTime;// 更新时间 public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getFailReason() { return failReason; } public Date getUpdateTime() { return updateTime; } public void setFailReason(String failReason) { this.failReason = failReason; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public Date getCreateTime() { return createTime; } public Long getId() { return id; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public void setId(Long id) { this.id = id; } public Date getUpdateTime() { return updateTime; } public String getOrderSn() { return orderSn; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public void setOrderSn(String orderSn) { this.orderSn = orderSn; } public Long getId() { return id; } public Long getGoodsId() { return goodsId; } public void setId(Long id) { this.id = id; } public void setGoodsId(Long goodsId) { this.goodsId = goodsId; } public String getOrderSn() { return orderSn; } public Long getGroupId() { return groupId; } public void setOrderSn(String orderSn) { this.orderSn = orderSn; } public void setGroupId(Long groupId) { this.groupId = groupId; } public Long getGoodsId() { return goodsId; } public String getGoodsName() { return goodsName; } public void setGoodsId(Long goodsId) { this.goodsId = goodsId; } public void setGoodsName(String goodsName) { this.goodsName = goodsName; } public Long getGroupId() { return groupId; } public String getGoodsThumbnailUrl() { return goodsThumbnailUrl; } public void setGroupId(Long groupId) { this.groupId = groupId; } public void setGoodsThumbnailUrl(String goodsThumbnailUrl) { this.goodsThumbnailUrl = goodsThumbnailUrl; } public String getGoodsName() { return goodsName; } public Integer getGoodsQuantity() { return goodsQuantity; } public void setGoodsName(String goodsName) { this.goodsName = goodsName; } public void setGoodsQuantity(Integer goodsQuantity) { this.goodsQuantity = goodsQuantity; } public String getGoodsThumbnailUrl() { return goodsThumbnailUrl; } public Long getGoodsPrice() { return goodsPrice; } public void setGoodsThumbnailUrl(String goodsThumbnailUrl) { this.goodsThumbnailUrl = goodsThumbnailUrl; } public void setGoodsPrice(Long goodsPrice) { this.goodsPrice = goodsPrice; } public Integer getGoodsQuantity() { return goodsQuantity; } public Long getOrderAmount() { return orderAmount; } public void setGoodsQuantity(Integer goodsQuantity) { this.goodsQuantity = goodsQuantity; } public void setOrderAmount(Long orderAmount) { this.orderAmount = orderAmount; } public Long getGoodsPrice() { return goodsPrice; } public String getpId() { return pId; } public void setGoodsPrice(Long goodsPrice) { this.goodsPrice = goodsPrice; } public void setpId(String pId) { this.pId = pId; } public Long getOrderAmount() { return orderAmount; } public Long getPromotionRate() { return promotionRate; } public void setOrderAmount(Long orderAmount) { this.orderAmount = orderAmount; } public void setPromotionRate(Long promotionRate) { this.promotionRate = promotionRate; } public String getpId() { return pId; } public Long getPromotionAmount() { return promotionAmount; } public void setpId(String pId) { this.pId = pId; } public void setPromotionAmount(Long promotionAmount) { this.promotionAmount = promotionAmount; } public Long getPromotionRate() { return promotionRate; } public Integer getOrderStatus() { return orderStatus; } public void setPromotionRate(Long promotionRate) { this.promotionRate = promotionRate; } public void setOrderStatus(Integer orderStatus) { this.orderStatus = orderStatus; } public Long getPromotionAmount() { return promotionAmount; } public String getOrderStatusDesc() { return orderStatusDesc; } public void setPromotionAmount(Long promotionAmount) { this.promotionAmount = promotionAmount; } public void setOrderStatusDesc(String orderStatusDesc) { this.orderStatusDesc = orderStatusDesc; } public Integer getOrderStatus() { return orderStatus; } public Long getOrderCreateTime() { return orderCreateTime; } public void setOrderStatus(Integer orderStatus) { this.orderStatus = orderStatus; } public void setOrderCreateTime(Long orderCreateTime) { this.orderCreateTime = orderCreateTime; } public String getOrderStatusDesc() { return orderStatusDesc; } public Long getOrderPayTime() { return orderPayTime; } public void setOrderStatusDesc(String orderStatusDesc) { this.orderStatusDesc = orderStatusDesc; } public void setOrderPayTime(Long orderPayTime) { this.orderPayTime = orderPayTime; } public Long getOrderCreateTime() { return orderCreateTime; } public Long getOrderGroupSuccessTime() { return orderGroupSuccessTime; } public void setOrderCreateTime(Long orderCreateTime) { this.orderCreateTime = orderCreateTime; } public void setOrderGroupSuccessTime(Long orderGroupSuccessTime) { this.orderGroupSuccessTime = orderGroupSuccessTime; } public Long getOrderPayTime() { return orderPayTime; } public Long getOrderVerifyTime() { return orderVerifyTime; } public void setOrderPayTime(Long orderPayTime) { this.orderPayTime = orderPayTime; } public void setOrderVerifyTime(Long orderVerifyTime) { this.orderVerifyTime = orderVerifyTime; } public Long getOrderGroupSuccessTime() { return orderGroupSuccessTime; } public Long getOrderModifyAt() { return orderModifyAt; } public void setOrderGroupSuccessTime(Long orderGroupSuccessTime) { this.orderGroupSuccessTime = orderGroupSuccessTime; } public void setOrderModifyAt(Long orderModifyAt) { this.orderModifyAt = orderModifyAt; } public Long getOrderVerifyTime() { return orderVerifyTime; } public String getCustomParameters() { return customParameters; } public void setOrderVerifyTime(Long orderVerifyTime) { this.orderVerifyTime = orderVerifyTime; } public void setCustomParameters(String customParameters) { this.customParameters = customParameters; } public Long getOrderModifyAt() { return orderModifyAt; } public Long getOrderSettleTime() { return orderSettleTime; } public void setOrderModifyAt(Long orderModifyAt) { this.orderModifyAt = orderModifyAt; } public void setOrderSettleTime(Long orderSettleTime) { this.orderSettleTime = orderSettleTime; } public String getCustomParameters() { return customParameters; } public String getOrderId() { return orderId; } public void setCustomParameters(String customParameters) { this.customParameters = customParameters; } public void setOrderId(String orderId) { this.orderId = orderId; } public Long getOrderSettleTime() { return orderSettleTime; } public Long getOrderReceiveTime() { return orderReceiveTime; } public void setOrderSettleTime(Long orderSettleTime) { this.orderSettleTime = orderSettleTime; } public void setOrderReceiveTime(Long orderReceiveTime) { this.orderReceiveTime = orderReceiveTime; } public String getOrderId() { return orderId; } public void setOrderId(String orderId) { this.orderId = orderId; } public Long getOrderReceiveTime() { return orderReceiveTime; } public void setOrderReceiveTime(Long orderReceiveTime) { this.orderReceiveTime = orderReceiveTime; } } fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -2,16 +2,14 @@ import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.*; import javax.annotation.Resource; import com.yeshi.fanli.entity.SystemEnum; import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService; import org.apache.commons.beanutils.PropertyUtils; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.yeshi.utils.DateUtil; @@ -161,6 +159,10 @@ @Resource private RocketMQManager rocketMQManager; @Lazy @Resource private PDDOrderService pddOrderService; // 奖励订单图片 public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png"; @@ -277,6 +279,25 @@ listPDD.add(commonOrderVO.getOrderNo()); } } //查询拼多多的订单详情 List<String> pddOrderSnList = new ArrayList<>(); if (listPDD != null && listPDD.size() > 0) { for (String orderSn : listPDD) pddOrderSnList.add(orderSn); } List<PDDOrder> pddOrderList = pddOrderService.listByOrderSns(listPDD); Set<String> bjOrders = new HashSet<>(); if (pddOrderList != null) { for (PDDOrder pdd : pddOrderList) if (pdd.getFailReason() != null && pdd.getFailReason().contains("比价")) bjOrders.add(pdd.getOrderSn()); } for (CommonOrderVO commonOrderVO : listOrder) { if (commonOrderVO.getSourceType() == Constant.SOURCE_TYPE_PDD && bjOrders.contains(commonOrderVO.getOrderNo())) { commonOrderVO.setOrderStateDesc("比价订单"); } } List<UserSystemCouponRecord> listRecordTB = null; if (listTB.size() > 0) { @@ -437,38 +458,43 @@ hongBao = new BigDecimal(0); } if (CommonOrder.STATE_FK == orderState) { orderStateContent = "已付款"; } else if (CommonOrder.STATE_JS == orderState) { orderStateContent = "已收货"; } else if (CommonOrder.STATE_SX == orderState) { orderStateContent = "未付款/已退款"; } else if (CommonOrder.STATE_WQ == orderState) { orderStateContent = "已售后"; if (sourceType != null && sourceType == Constant.SOURCE_TYPE_TAOBAO) { /* 订单维权 判断是否全部维权 */ List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper .selectListByOrderIdAndState(order.getOrderNo(), "维权成功"); //判断状态是否预设了的 if (!StringUtil.isNullOrEmpty(order.getOrderStateDesc())) { orderStateContent = order.getOrderStateDesc(); } else { if (CommonOrder.STATE_FK == orderState) { orderStateContent = "已付款"; } else if (CommonOrder.STATE_JS == orderState) { orderStateContent = "已收货"; } else if (CommonOrder.STATE_SX == orderState) { orderStateContent = "未付款/已退款"; } else if (CommonOrder.STATE_WQ == orderState) { orderStateContent = "已售后"; if (sourceType != null && sourceType == Constant.SOURCE_TYPE_TAOBAO) { /* 订单维权 判断是否全部维权 */ List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper .selectListByOrderIdAndState(order.getOrderNo(), "维权成功"); boolean isPart = false;// 默认失效 BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid); boolean isPart = false;// 默认失效 BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid); if (!VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) { if (isPart) { hongBaoState = HongBaoV2.STATE_BUFENSHIXIAO; // 部分失效 if (!VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) { if (isPart) { hongBaoState = HongBaoV2.STATE_BUFENSHIXIAO; // 部分失效 } else { hongBaoState = HongBaoV2.STATE_SHIXIAO; // 全部失效 } } else { hongBaoState = HongBaoV2.STATE_SHIXIAO; // 全部失效 } } else { // 2019.8.1 返回维权信息 if (settleTime != null && august != null && settleTime.getTime() > august.getTime()) { orderStateContent = "售后成功"; WeiQuanInfo weiQuanInfo = new WeiQuanInfo(); weiQuanInfo.setOldHongBao("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); weiQuanInfo .setWqHongBao("售后:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString()); hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney); order.setWeiQuanInfo(weiQuanInfo); // 2019.8.1 返回维权信息 if (settleTime != null && august != null && settleTime.getTime() > august.getTime()) { orderStateContent = "售后成功"; WeiQuanInfo weiQuanInfo = new WeiQuanInfo(); weiQuanInfo.setOldHongBao("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); weiQuanInfo .setWqHongBao("售后:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString()); hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney); order.setWeiQuanInfo(weiQuanInfo); } } } } @@ -2023,6 +2049,19 @@ listSuNing.add(order.getOrderNo()); } } //查询拼多多的订单详情 List<PDDOrder> pddOrderList = pddOrderService.listByOrderSns(listPDD); Set<String> bjOrders = new HashSet<>(); if (pddOrderList != null) { for (PDDOrder pdd : pddOrderList) if (pdd.getFailReason() != null && pdd.getFailReason().contains("比价")) bjOrders.add(pdd.getOrderSn()); } for (CommonOrderVO commonOrderVO : listOrder) { if (commonOrderVO.getSourceType() == Constant.SOURCE_TYPE_PDD && bjOrders.contains(commonOrderVO.getOrderNo())) { commonOrderVO.setOrderStateDesc("比价订单"); } } List<UserSystemCouponRecord> listRecordTB = null; if (listTB.size() > 0) { @@ -2189,28 +2228,32 @@ /* 订单状态 转换处理 */ String orderStateContent = ""; if (CommonOrder.STATE_FK == orderState) { orderStateContent = "已付款"; } else if (CommonOrder.STATE_JS == orderState) { orderStateContent = "已收货"; } else if (CommonOrder.STATE_SX == orderState) { orderStateContent = "未付款/已退款"; } else if (CommonOrder.STATE_WQ == orderState) { orderStateContent = "已售后"; if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { /* 订单维权 判断是否全部维权 */ List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper .selectListByOrderIdAndState(order.getOrderNo(), "维权成功"); BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid); if(!StringUtil.isNullOrEmpty(order.getOrderStateDesc())) orderStateContent=order.getOrderStateDesc(); else { if (CommonOrder.STATE_FK == orderState) { orderStateContent = "已付款"; } else if (CommonOrder.STATE_JS == orderState) { orderStateContent = "已收货"; } else if (CommonOrder.STATE_SX == orderState) { orderStateContent = "未付款/已退款"; } else if (CommonOrder.STATE_WQ == orderState) { orderStateContent = "已售后"; if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { /* 订单维权 判断是否全部维权 */ List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper .selectListByOrderIdAndState(order.getOrderNo(), "维权成功"); BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid); if (settleTime != null) { orderStateContent = "售后成功"; WeiQuanInfo weiQuanInfo = new WeiQuanInfo(); weiQuanInfo.setOldHongBao("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); weiQuanInfo.setWqHongBao("售后:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString()); order.setWeiQuanInfo(weiQuanInfo); if (settleTime != null) { orderStateContent = "售后成功"; WeiQuanInfo weiQuanInfo = new WeiQuanInfo(); weiQuanInfo.setOldHongBao("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); weiQuanInfo.setWqHongBao("售后:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString()); order.setWeiQuanInfo(weiQuanInfo); } hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney); } hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney); } } orderStateMap.put("content", orderStateContent); fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -102,1612 +102,1624 @@ @Service public class OrderProcessServiceImpl implements OrderProcessService { @Resource private OrderMapper orderMapper; @Resource private OrderMapper orderMapper; @Resource private UserInfoMapper userInfoMapper; @Resource private UserInfoMapper userInfoMapper; @Resource private TaoBaoUnionConfigService taoBaoUnionConfigService; @Resource private TaoBaoUnionConfigService taoBaoUnionConfigService; @Resource private TaoBaoWeiQuanDrawBackService taoBaoWeiQuanDrawBackService; @Resource private TaoBaoWeiQuanDrawBackService taoBaoWeiQuanDrawBackService; @Resource private TaoBaoOrderService taoBaoOrderService; @Resource private TaoBaoOrderService taoBaoOrderService; @Resource private LostOrderService lostOrderService; @Resource private LostOrderService lostOrderService; @Resource private TaoBaoWeiQuanOrderMapper taoBaoWeiQuanOrderMapper; @Resource private TaoBaoWeiQuanOrderMapper taoBaoWeiQuanOrderMapper; @Resource private HongBaoV2Mapper hongBaoV2Mapper; @Resource private HongBaoV2Mapper hongBaoV2Mapper; @Resource private UserOrderMsgNotificationService userOrderMsgNotificationService; @Resource private UserOrderMsgNotificationService userOrderMsgNotificationService; @Resource private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; @Resource private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; @Resource private UserMoneyService userMoneyService; @Resource private UserMoneyService userMoneyService; @Resource private TaoBaoBuyRelationMapService taoBaoBuyRelationMapService; @Resource private TaoBaoBuyRelationMapService taoBaoBuyRelationMapService; @Resource private CommonOrderService commonOrderService; @Resource private CommonOrderService commonOrderService; @Resource private HongBaoV2Service hongBaoV2Service; @Resource private HongBaoV2Service hongBaoV2Service; @Resource private JDOrderService jdOrderService; @Resource private JDOrderService jdOrderService; @Resource private PDDOrderService pddOrderService; @Resource private PDDOrderService pddOrderService; @Resource(name = "orderTransactionProducer") private TransactionProducer orderTransactionProducer; @Resource(name = "orderTransactionProducer") private TransactionProducer orderTransactionProducer; @Resource private RocketMQManager rocketMQManager; @Resource private RocketMQManager rocketMQManager; @Resource private OrderMoneySettleService orderMoneySettleService; @Resource private OrderMoneySettleService orderMoneySettleService; @Resource private HongBaoV2AddManager hongBaoV2AddManager; @Resource private HongBaoV2AddManager hongBaoV2AddManager; /** * 是否是分享订单 * * @param order * @return */ private boolean isShareOrder(TaoBaoOrder order) { List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID); String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(), order.getSourceMediaId(), order.getAdPositionId()); if (!StringUtil.isNullOrEmpty(order.getSpecialId()) || pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID)) {// 设置渠道ID当做会员运营ID的位置ID return false; } else if (!StringUtil.isNullOrEmpty(order.getRelationId())) { return true; } else { // 通过红包查询 CommonOrder commonOrder = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, order.getTradeId()); /** * 是否是分享订单 * * @param order * @return */ private boolean isShareOrder(TaoBaoOrder order) { List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID); String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(), order.getSourceMediaId(), order.getAdPositionId()); if (!StringUtil.isNullOrEmpty(order.getSpecialId()) || pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID)) {// 设置渠道ID当做会员运营ID的位置ID return false; } else if (!StringUtil.isNullOrEmpty(order.getRelationId())) { return true; } else { // 通过红包查询 CommonOrder commonOrder = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, order.getTradeId()); if (commonOrder != null) { HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null && hongBaoOrder.getHongBaoV2().getType() == HongBaoV2.TYPE_SHARE_GOODS) { return true; } } return false; } } if (commonOrder != null) { HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null && hongBaoOrder.getHongBaoV2().getType() == HongBaoV2.TYPE_SHARE_GOODS) { return true; } } return false; } } @Override public synchronized void processOrder(Map<String, List<TaoBaoOrder>> orders) { List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID); @Override public synchronized void processOrder(Map<String, List<TaoBaoOrder>> orders) { List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID); // 分离出返利订单与分享赚订单 Iterator<String> its = orders.keySet().iterator(); Map<String, List<TaoBaoOrder>> fanliOrderMap = new HashMap<>(); Map<String, List<TaoBaoOrder>> shareOrderMap = new HashMap<>(); Map<String, List<TaoBaoOrder>> elmeOrderMap = new HashMap<>(); while (its.hasNext()) { String orderId = its.next(); // 分离出返利订单与分享赚订单 Iterator<String> its = orders.keySet().iterator(); Map<String, List<TaoBaoOrder>> fanliOrderMap = new HashMap<>(); Map<String, List<TaoBaoOrder>> shareOrderMap = new HashMap<>(); Map<String, List<TaoBaoOrder>> elmeOrderMap = new HashMap<>(); while (its.hasNext()) { String orderId = its.next(); if (orders.get(orderId) != null && orders.get(orderId).size() > 0) { List<TaoBaoOrder> list = orders.get(orderId); String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(), list.get(0).getSourceMediaId(), list.get(0).getAdPositionId()); if ("饿了么".equalsIgnoreCase(list.get(0).getOrderType()) && !pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT)) { // 饿了么订单开始归入到淘宝订单 if (TimeUtil.convertToTimeTemp(list.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") >= Constant.NEW_ORDER_FANLI_RULE_TIME) { fanliOrderMap.put(orderId, list); } else { elmeOrderMap.put(orderId, list); } } else if ("口碑".equalsIgnoreCase(list.get(0).getOrderType()) && pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_KOUBEI_PID)) {// 口碑自购 fanliOrderMap.put(orderId, list); } else { if (!StringUtil.isNullOrEmpty(list.get(0).getSpecialId()) || pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID)) {// 设置渠道ID当做会员运营ID的位置ID fanliOrderMap.put(orderId, list); } else if (!StringUtil.isNullOrEmpty(list.get(0).getRelationId())) { shareOrderMap.put(orderId, list); } else { // 通过红包查询 CommonOrder commonOrder = commonOrderService .selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, list.get(0).getTradeId()); if (orders.get(orderId) != null && orders.get(orderId).size() > 0) { List<TaoBaoOrder> list = orders.get(orderId); String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(), list.get(0).getSourceMediaId(), list.get(0).getAdPositionId()); if ("饿了么".equalsIgnoreCase(list.get(0).getOrderType()) && !pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT)) { // 饿了么订单开始归入到淘宝订单 if (TimeUtil.convertToTimeTemp(list.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") >= Constant.NEW_ORDER_FANLI_RULE_TIME) { fanliOrderMap.put(orderId, list); } else { elmeOrderMap.put(orderId, list); } } else if ("口碑".equalsIgnoreCase(list.get(0).getOrderType()) && pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_KOUBEI_PID)) {// 口碑自购 fanliOrderMap.put(orderId, list); } else { if (!StringUtil.isNullOrEmpty(list.get(0).getSpecialId()) || pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID)) {// 设置渠道ID当做会员运营ID的位置ID fanliOrderMap.put(orderId, list); } else if (!StringUtil.isNullOrEmpty(list.get(0).getRelationId())) { shareOrderMap.put(orderId, list); } else { // 通过红包查询 CommonOrder commonOrder = commonOrderService .selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, list.get(0).getTradeId()); if (commonOrder != null) { HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null && hongBaoOrder.getHongBaoV2().getType() == HongBaoV2.TYPE_SHARE_GOODS) { shareOrderMap.put(orderId, list); continue; } } fanliOrderMap.put(orderId, list); } } } } if (commonOrder != null) { HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null && hongBaoOrder.getHongBaoV2().getType() == HongBaoV2.TYPE_SHARE_GOODS) { shareOrderMap.put(orderId, list); continue; } } fanliOrderMap.put(orderId, list); } } } } // 处理返利订单 processShopingFanliOrder(fanliOrderMap); // 处理分享赚订单 processShareGoodsOrder(shareOrderMap); // 处理饿了么订单 processElemeOrder(elmeOrderMap); } // 处理返利订单 processShopingFanliOrder(fanliOrderMap); // 处理分享赚订单 processShareGoodsOrder(shareOrderMap); // 处理饿了么订单 processElemeOrder(elmeOrderMap); } private ElmeOrder createElmeOrder(TaoBaoOrder taoBaoOrder) { ElmeOrder elmeOrder = new ElmeOrder(); elmeOrder.setChannelId(""); elmeOrder.setCreateTime(new Date()); elmeOrder .setOrderDate(new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss"))); elmeOrder.setOrderId(taoBaoOrder.getOrderId()); elmeOrder.setPayMoney(taoBaoOrder.getPayment()); elmeOrder.setRid(taoBaoOrder.getRelationId()); if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算")) elmeOrder.setIsSettle(true); else elmeOrder.setIsSettle(false); private ElmeOrder createElmeOrder(TaoBaoOrder taoBaoOrder) { ElmeOrder elmeOrder = new ElmeOrder(); elmeOrder.setChannelId(""); elmeOrder.setCreateTime(new Date()); elmeOrder .setOrderDate(new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss"))); elmeOrder.setOrderId(taoBaoOrder.getOrderId()); elmeOrder.setPayMoney(taoBaoOrder.getPayment()); elmeOrder.setRid(taoBaoOrder.getRelationId()); if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算")) elmeOrder.setIsSettle(true); else elmeOrder.setIsSettle(false); if (!taoBaoOrder.getOrderState().equalsIgnoreCase("订单失效")) elmeOrder.setState(1); else { elmeOrder.setState(0); elmeOrder.setPayMoney(new BigDecimal(0)); } elmeOrder.setTrackPid( String.format("mm_124933865_%s_%s", taoBaoOrder.getSourceMediaId(), taoBaoOrder.getAdPositionId())); if (!StringUtil.isNullOrEmpty(taoBaoOrder.getRelationId())) { UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService.getByRelationId(taoBaoOrder.getRelationId(),null); if (extraInfo != null) elmeOrder.setUid(extraInfo.getUser().getId()); } return elmeOrder; } if (!taoBaoOrder.getOrderState().equalsIgnoreCase("订单失效")) elmeOrder.setState(1); else { elmeOrder.setState(0); elmeOrder.setPayMoney(new BigDecimal(0)); } elmeOrder.setTrackPid( String.format("mm_124933865_%s_%s", taoBaoOrder.getSourceMediaId(), taoBaoOrder.getAdPositionId())); if (!StringUtil.isNullOrEmpty(taoBaoOrder.getRelationId())) { UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService.getByRelationId(taoBaoOrder.getRelationId(), null); if (extraInfo != null) elmeOrder.setUid(extraInfo.getUser().getId()); } return elmeOrder; } private void processElemeOrder(Map<String, List<TaoBaoOrder>> orders) { for (Iterator<String> its = orders.keySet().iterator(); its.hasNext();) { String orderId = its.next(); List<TaoBaoOrder> orderList = orders.get(orderId); for (TaoBaoOrder taoBaoOrder : orderList) { ElmeOrder elmeOrder = createElmeOrder(taoBaoOrder); try { elmeOrderProcessService.processOrder(elmeOrder); } catch (ElmeOrderException e) { e.printStackTrace(); } private void processElemeOrder(Map<String, List<TaoBaoOrder>> orders) { for (Iterator<String> its = orders.keySet().iterator(); its.hasNext(); ) { String orderId = its.next(); List<TaoBaoOrder> orderList = orders.get(orderId); for (TaoBaoOrder taoBaoOrder : orderList) { ElmeOrder elmeOrder = createElmeOrder(taoBaoOrder); try { elmeOrderProcessService.processOrder(elmeOrder); } catch (ElmeOrderException e) { e.printStackTrace(); } } } } } } } @Override public void processShopingFanliOrder(Map<String, List<TaoBaoOrder>> orders) { // 查询在Order中是否存在该订单号 Iterator<String> its = orders.keySet().iterator(); String tempOrderId = ""; while (its.hasNext()) { try { String orderId = its.next(); tempOrderId = orderId; // 处理红包与子红包 // if (isRedisLockOrder(orderId)) // continue; // redisLockOrder(orderId); processShopingFanliOrderNew(orderId, orders.get(orderId)); // redisUnlockOrder(orderId); // 出错了就不处理该订单了,需要定期检查 @Override public void processShopingFanliOrder(Map<String, List<TaoBaoOrder>> orders) { // 查询在Order中是否存在该订单号 Iterator<String> its = orders.keySet().iterator(); String tempOrderId = ""; while (its.hasNext()) { try { String orderId = its.next(); tempOrderId = orderId; // 处理红包与子红包 // if (isRedisLockOrder(orderId)) // continue; // redisLockOrder(orderId); processShopingFanliOrderNew(orderId, orders.get(orderId)); // redisUnlockOrder(orderId); // 出错了就不处理该订单了,需要定期检查 // 更改丢失订单的状态 lostOrderService.processSuceess(orderId, Constant.SOURCE_TYPE_TAOBAO); // 更改丢失订单的状态 lostOrderService.processSuceess(orderId, Constant.SOURCE_TYPE_TAOBAO); } catch (HongBaoException e1) { e1.printStackTrace(); } catch (OrderItemException e2) { e2.printStackTrace(); } catch (Exception e) { e.printStackTrace(); try { LogHelper.errorDetailInfo(e, null, tempOrderId); } catch (Exception e1) { e1.printStackTrace(); } } } } } catch (HongBaoException e1) { e1.printStackTrace(); } catch (OrderItemException e2) { e2.printStackTrace(); } catch (Exception e) { e.printStackTrace(); try { LogHelper.errorDetailInfo(e, null, tempOrderId); } catch (Exception e1) { e1.printStackTrace(); } } } } @Transactional @Override public void processShareGoodsOrder(Map<String, List<TaoBaoOrder>> orders) { // pidOrderService.addPidOrderFromTaoBao(orders); if (orders != null) { Iterator<String> its = orders.keySet().iterator(); while (its.hasNext()) { String orderId = its.next(); try { processShareGoodsOrderNew(orderId, orders.get(orderId)); } catch (Exception e) { try { LogHelper.errorDetailInfo(e, "processShareGoodsOrderNew出错", "订单号:" + orderId); } catch (Exception e1) { e1.printStackTrace(); } } @Transactional @Override public void processShareGoodsOrder(Map<String, List<TaoBaoOrder>> orders) { // pidOrderService.addPidOrderFromTaoBao(orders); if (orders != null) { Iterator<String> its = orders.keySet().iterator(); while (its.hasNext()) { String orderId = its.next(); try { processShareGoodsOrderNew(orderId, orders.get(orderId)); } catch (Exception e) { try { LogHelper.errorDetailInfo(e, "processShareGoodsOrderNew出错", "订单号:" + orderId); } catch (Exception e1) { e1.printStackTrace(); } } } } } } } } @Override public void fanli() { LogHelper.test("处理返利到账"); // 获取主红包 List<HongBaoV2> hongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByType(HongBaoV2.TYPE_ZIGOU, 1000); // // /** // * 需要实时更新待返利的订单 // */ // // // 计算最大的创建时间与最小的创建时间 // Map<String, Long> map = getMaxAndMinCreateTime(hongBaoList); // if (map != null) { // long max = map.get("max"); // long min = map.get("min"); // // 最小时间提前10分钟 // min = min - 1000 * 60 * 10L; // // 更新该段时间的订单 // List<TaoBaoOrder> orderList = new ArrayList<>(); // try { // orderList = TaoBaoOrderUtil.getOrderList(min, max); // } catch (TaoBaoOrderException e) { // e.printStackTrace(); // } // // try { // if (orderList != null) // processOrder(TaoBaoOrderUtil.classifyTaoBaoOrderByOrderId(orderList)); // // } catch (Exception e) { // // e.printStackTrace(); // // try { // // LogHelper.errorDetailInfo(e); // // } catch (Exception e1) { // // e1.printStackTrace(); // // } // // } // } @Override public void fanli() { LogHelper.test("处理返利到账"); // 获取主红包 List<HongBaoV2> hongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByType(HongBaoV2.TYPE_ZIGOU, 1000); // // /** // * 需要实时更新待返利的订单 // */ // // // 计算最大的创建时间与最小的创建时间 // Map<String, Long> map = getMaxAndMinCreateTime(hongBaoList); // if (map != null) { // long max = map.get("max"); // long min = map.get("min"); // // 最小时间提前10分钟 // min = min - 1000 * 60 * 10L; // // 更新该段时间的订单 // List<TaoBaoOrder> orderList = new ArrayList<>(); // try { // orderList = TaoBaoOrderUtil.getOrderList(min, max); // } catch (TaoBaoOrderException e) { // e.printStackTrace(); // } // // try { // if (orderList != null) // processOrder(TaoBaoOrderUtil.classifyTaoBaoOrderByOrderId(orderList)); // // } catch (Exception e) { // // e.printStackTrace(); // // try { // // LogHelper.errorDetailInfo(e); // // } catch (Exception e1) { // // e1.printStackTrace(); // // } // // } // } /** * 开始返利 */ for (HongBaoV2 hb : hongBaoList) { // if (hb.getState() == HongBaoV2.STATE_SHIXIAO || hb.getState() == HongBaoV2.STATE_YILINGQU) continue; /** * 开始返利 */ for (HongBaoV2 hb : hongBaoList) { // if (hb.getState() == HongBaoV2.STATE_SHIXIAO || hb.getState() == HongBaoV2.STATE_YILINGQU) continue; if (hb.getPreGetTime() == null || hb.getPreGetTime().getTime() == 0 || hb.getPreGetTime().getTime() > System.currentTimeMillis()) continue; try { if (Constant.ENABLE_MQ) CMQManager.getInstance().addFanLiMsgNew(hb); } catch (Exception e) { try { LogHelper.errorDetailInfo(e); } catch (Exception e1) { e1.printStackTrace(); } } } } if (hb.getPreGetTime() == null || hb.getPreGetTime().getTime() == 0 || hb.getPreGetTime().getTime() > System.currentTimeMillis()) continue; try { if (Constant.ENABLE_MQ) CMQManager.getInstance().addFanLiMsgNew(hb); } catch (Exception e) { try { LogHelper.errorDetailInfo(e); } catch (Exception e1) { e1.printStackTrace(); } } } } @Resource private HongBaoOrderMapper hongBaoOrderMapper; @Resource private HongBaoOrderMapper hongBaoOrderMapper; @Override @Transactional(rollbackFor = Exception.class) public void fanli(HongBaoV2 hb1) throws TaoBaoWeiQuanException { // 查询最新的红包数据 hb1 = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hb1.getId()); @Override @Transactional(rollbackFor = Exception.class) public void fanli(HongBaoV2 hb1) throws TaoBaoWeiQuanException { // 查询最新的红包数据 hb1 = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hb1.getId()); if (hb1 == null || hb1.getState() != HongBaoV2.STATE_KELINGQU || hb1.getPreGetTime() == null || hb1.getPreGetTime().getTime() > System.currentTimeMillis()) return; if (hb1 == null || hb1.getState() != HongBaoV2.STATE_KELINGQU || hb1.getPreGetTime() == null || hb1.getPreGetTime().getTime() > System.currentTimeMillis()) return; // 正常用户才能到账 UserInfo mainUser = userInfoMapper.selectAvailableByPrimaryKey(hb1.getUserInfo().getId()); if (mainUser == null || mainUser.getState() != UserInfo.STATE_NORMAL) { return; } // 查询红包相关联的订单 HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hb1.getId()); if (hongBaoOrder == null) { LogHelper.error("返利失败:" + hb1.getId()); return; } // 正常用户才能到账 UserInfo mainUser = userInfoMapper.selectAvailableByPrimaryKey(hb1.getUserInfo().getId()); if (mainUser == null || mainUser.getState() != UserInfo.STATE_NORMAL) { return; } // 查询红包相关联的订单 HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hb1.getId()); if (hongBaoOrder == null) { LogHelper.error("返利失败:" + hb1.getId()); return; } if (hongBaoOrder.getCommonOrder() == null) { return; } if (hongBaoOrder.getCommonOrder() == null) { return; } // 如果是拼多多/京东维权则返回,不需要返利 if ((hongBaoOrder.getCommonOrder().getSourceType() == Constant.SOURCE_TYPE_PDD || hongBaoOrder.getCommonOrder().getSourceType() == Constant.SOURCE_TYPE_JD) && hongBaoOrder.getCommonOrder().getState() == CommonOrder.STATE_WQ) return; // 如果是拼多多/京东维权则返回,不需要返利 if ((hongBaoOrder.getCommonOrder().getSourceType() == Constant.SOURCE_TYPE_PDD || hongBaoOrder.getCommonOrder().getSourceType() == Constant.SOURCE_TYPE_JD) && hongBaoOrder.getCommonOrder().getState() == CommonOrder.STATE_WQ) return; if (hongBaoOrder.getCommonOrder() != null && hongBaoOrder.getCommonOrder().getSourceType() == Constant.SOURCE_TYPE_TAOBAO) { // 维权中的不返利 List<TaoBaoWeiQuanOrder> taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper .selectListByOrderIdAndState(hongBaoOrder.getCommonOrder().getOrderNo(), "维权创建"); if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0) return; if (hongBaoOrder.getCommonOrder() != null && hongBaoOrder.getCommonOrder().getSourceType() == Constant.SOURCE_TYPE_TAOBAO) { // 维权中的不返利 List<TaoBaoWeiQuanOrder> taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper .selectListByOrderIdAndState(hongBaoOrder.getCommonOrder().getOrderNo(), "维权创建"); if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0) return; taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper .selectListByOrderIdAndState(hongBaoOrder.getCommonOrder().getOrderNo(), "等待处理"); if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0) return; } taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper .selectListByOrderIdAndState(hongBaoOrder.getCommonOrder().getOrderNo(), "等待处理"); if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0) return; } // 查询该订单之前是否有到账 List<HongBaoOrder> list = hongBaoOrderMapper.listByOrderIdAndSourceType( hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType()); List<Long> hongBaoIdList = new ArrayList<>(); if (list != null) { for (HongBaoOrder ho : list) { hongBaoIdList.add(ho.getHongBaoV2().getId()); } } // 查询该订单之前是否有到账 List<HongBaoOrder> list = hongBaoOrderMapper.listByOrderIdAndSourceType( hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType()); List<Long> hongBaoIdList = new ArrayList<>(); if (list != null) { for (HongBaoOrder ho : list) { hongBaoIdList.add(ho.getHongBaoV2().getId()); } } List<HongBaoV2> allHongBaoList = hongBaoV2Mapper.listByIds(hongBaoIdList); boolean first = true; for (HongBaoV2 v2 : allHongBaoList) if (v2.getState() == HongBaoV2.STATE_YILINGQU) { first = false; break; } List<HongBaoV2> allHongBaoList = hongBaoV2Mapper.listByIds(hongBaoIdList); boolean first = true; for (HongBaoV2 v2 : allHongBaoList) if (v2.getState() == HongBaoV2.STATE_YILINGQU) { first = false; break; } // 自购到账事务消息 OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_ZIGOU, mainUser.getId(), hongBaoOrder.getCommonOrder().getSourceType(), hongBaoOrder.getCommonOrder().getOrderNo(), null, new Date(), 0); mqMsg.setOrderFirst(first); Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg); String key = mainUser.getId() + "-" + UUID.randomUUID().toString(); msg.setKey(key); try { if (!Constant.IS_TEST) orderTransactionProducer.send(msg, new LocalTransactionExecuter() { @Override public TransactionStatus execute(Message arg0, Object arg1) { try { orderMoneySettleService.ziGouSettle(hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType(), key); return TransactionStatus.CommitTransaction; } catch (Exception e) { e.printStackTrace(); return TransactionStatus.RollbackTransaction; } } }, null); else { try { orderMoneySettleService.ziGouSettle(hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType(), key); } catch (Exception e) { } } } catch (Exception e) { LogHelper.mqError(e.getMessage(), msg.getTopic(), msg.getTag(), new Gson().toJson(mqMsg)); } } // 自购到账事务消息 OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_ZIGOU, mainUser.getId(), hongBaoOrder.getCommonOrder().getSourceType(), hongBaoOrder.getCommonOrder().getOrderNo(), null, new Date(), 0); mqMsg.setOrderFirst(first); Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg); String key = mainUser.getId() + "-" + UUID.randomUUID().toString(); msg.setKey(key); try { if (!Constant.IS_TEST) orderTransactionProducer.send(msg, new LocalTransactionExecuter() { @Override public TransactionStatus execute(Message arg0, Object arg1) { try { orderMoneySettleService.ziGouSettle(hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType(), key); return TransactionStatus.CommitTransaction; } catch (Exception e) { e.printStackTrace(); return TransactionStatus.RollbackTransaction; } } }, null); else { try { orderMoneySettleService.ziGouSettle(hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType(), key); } catch (Exception e) { } } } catch (Exception e) { LogHelper.mqError(e.getMessage(), msg.getTopic(), msg.getTag(), new Gson().toJson(mqMsg)); } } @Override public void weiQuanOrder(List<TaoBaoWeiQuanOrder> orderList) { if (orderList != null) for (TaoBaoWeiQuanOrder order : orderList) { try { if (order.getState().contains("维权成功")) { if (Constant.ENABLE_MQ) CMQManager.getInstance().addWeiQuanOrderMsg(order); } } catch (Exception e) { LogHelper.error("维权订单加入到队列出错:" + order != null ? new Gson().toJson(order) : null); } } } @Override public void weiQuanOrder(List<TaoBaoWeiQuanOrder> orderList) { if (orderList != null) for (TaoBaoWeiQuanOrder order : orderList) { try { if (order.getState().contains("维权成功")) { if (Constant.ENABLE_MQ) CMQManager.getInstance().addWeiQuanOrderMsg(order); } } catch (Exception e) { LogHelper.error("维权订单加入到队列出错:" + order != null ? new Gson().toJson(order) : null); } } } @Transactional @Override public void weiQuanOrder(TaoBaoWeiQuanOrder order) { // 订单结算时间在2018-08-05后就不处理维权了 @Transactional @Override public void weiQuanOrder(TaoBaoWeiQuanOrder order) { // 订单结算时间在2018-08-05后就不处理维权了 List<TaoBaoOrder> orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(order.getOrderId()); if (orderList != null && orderList.size() > 0 & !StringUtil.isNullOrEmpty(orderList.get(0).getSettlementTime())) order.setJieSuanTime( new Date(TimeUtil.convertToTimeTemp(orderList.get(0).getSettlementTime(), "yyyy-MM-dd HH:mm:ss"))); List<TaoBaoOrder> orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(order.getOrderId()); if (orderList != null && orderList.size() > 0 & !StringUtil.isNullOrEmpty(orderList.get(0).getSettlementTime())) order.setJieSuanTime( new Date(TimeUtil.convertToTimeTemp(orderList.get(0).getSettlementTime(), "yyyy-MM-dd HH:mm:ss"))); // 处理维权成功但是已到账的订单 if (order.getJieSuanTime().getTime() > TimeUtil.convertToTimeTemp("2019-01-01", "yyyy-MM-dd")) {// 结算时间在2月1号的开始处理已到账但是维权的 CommonOrder commonOrder = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, order.getOrderItemId()); if (commonOrder != null && !StringUtil.isNullOrEmpty(commonOrder.getTradeId())) { HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null && hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_YILINGQU) {// 已经到账的看是否需要扣款 TaoBaoWeiQuanDrawBack drawBack = taoBaoWeiQuanDrawBackService .selectByOrderItemId(order.getOrderItemId()); if (drawBack == null) {// 还未扣款 OrderLogHelper.taoBaoWeiQuan("已到账未扣款处理:子订单号:" + order.getOrderItemId()); try { taoBaoWeiQuanDrawBackService.doWeiQuanFanli(order.getOrderId(), true); taoBaoWeiQuanDrawBackService.doWeiQuanShare(order.getOrderId()); taoBaoWeiQuanDrawBackService.doWeiQuanInvite(order.getOrderId()); } catch (TaoBaoWeiQuanException e) { try { LogHelper.errorDetailInfo(e, "到账后处理维权扣款出错", "订单号:" + order.getOrderId()); } catch (Exception e1) { e1.printStackTrace(); } } } else { // 查询子红包是否已到账 List<HongBaoV2> children = hongBaoV2Service .listChildrenById(hongBaoOrder.getHongBaoV2().getId()); for (HongBaoV2 hongBaoV2 : children) { if (hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU) { try { taoBaoWeiQuanDrawBackService.doWeiQuanInvite(order.getOrderId()); } catch (TaoBaoWeiQuanException e) { try { LogHelper.errorDetailInfo(e, "到账后处理维权扣款出错", "订单号:" + order.getOrderId()); } catch (Exception e1) { e1.printStackTrace(); } } break; } } } } } } } // 处理维权成功但是已到账的订单 if (order.getJieSuanTime().getTime() > TimeUtil.convertToTimeTemp("2019-01-01", "yyyy-MM-dd")) {// 结算时间在2月1号的开始处理已到账但是维权的 CommonOrder commonOrder = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, order.getOrderItemId()); if (commonOrder != null && !StringUtil.isNullOrEmpty(commonOrder.getTradeId())) { HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null && hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_YILINGQU) {// 已经到账的看是否需要扣款 TaoBaoWeiQuanDrawBack drawBack = taoBaoWeiQuanDrawBackService .selectByOrderItemId(order.getOrderItemId()); if (drawBack == null) {// 还未扣款 OrderLogHelper.taoBaoWeiQuan("已到账未扣款处理:子订单号:" + order.getOrderItemId()); try { taoBaoWeiQuanDrawBackService.doWeiQuanFanli(order.getOrderId(), true); taoBaoWeiQuanDrawBackService.doWeiQuanShare(order.getOrderId()); taoBaoWeiQuanDrawBackService.doWeiQuanInvite(order.getOrderId()); } catch (TaoBaoWeiQuanException e) { try { LogHelper.errorDetailInfo(e, "到账后处理维权扣款出错", "订单号:" + order.getOrderId()); } catch (Exception e1) { e1.printStackTrace(); } } } else { // 查询子红包是否已到账 List<HongBaoV2> children = hongBaoV2Service .listChildrenById(hongBaoOrder.getHongBaoV2().getId()); for (HongBaoV2 hongBaoV2 : children) { if (hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU) { try { taoBaoWeiQuanDrawBackService.doWeiQuanInvite(order.getOrderId()); } catch (TaoBaoWeiQuanException e) { try { LogHelper.errorDetailInfo(e, "到账后处理维权扣款出错", "订单号:" + order.getOrderId()); } catch (Exception e1) { e1.printStackTrace(); } } break; } } } } } } } @Override public void fanliPreInvaite(Date maxTime) { // 查出邀请赚的用户ID List<Integer> typeList = new ArrayList<>(); typeList.add(HongBaoV2.TYPE_YIJI); typeList.add(HongBaoV2.TYPE_ERJI); typeList.add(HongBaoV2.TYPE_SHARE_YIJI); typeList.add(HongBaoV2.TYPE_SHARE_ERJI); @Override public void fanliPreInvaite(Date maxTime) { // 查出邀请赚的用户ID List<Integer> typeList = new ArrayList<>(); typeList.add(HongBaoV2.TYPE_YIJI); typeList.add(HongBaoV2.TYPE_ERJI); typeList.add(HongBaoV2.TYPE_SHARE_YIJI); typeList.add(HongBaoV2.TYPE_SHARE_ERJI); long count = hongBaoV2Mapper.countUidCanBanlanceByTypeAndMaxTime(typeList, maxTime); int pageSize = 1000; int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); Set<Long> uidSets = new HashSet<>(); for (int i = 0; i < page; i++) { List<Long> inviteAndShareUids = hongBaoV2Mapper.listUidCanBanlanceByTypeAndMaxTime(typeList, maxTime, i * pageSize, pageSize); if (inviteAndShareUids != null) for (Long uid : inviteAndShareUids) { if (userInfoMapper.selectAvailableByPrimaryKey(uid) != null) uidSets.add(uid); } } // 根据用户ID Iterator<Long> its = uidSets.iterator(); while (its.hasNext()) { Long uid = its.next(); try { if (Constant.ENABLE_MQ) TeamOrderCMQManager.getInstance().addFanLiTeamIncomePreMsg(new UidDateDTO(uid, maxTime)); } catch (Exception e) { e.printStackTrace(); LogHelper.error(e); } } long count = hongBaoV2Mapper.countUidCanBanlanceByTypeAndMaxTime(typeList, maxTime); int pageSize = 1000; int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); Set<Long> uidSets = new HashSet<>(); for (int i = 0; i < page; i++) { List<Long> inviteAndShareUids = hongBaoV2Mapper.listUidCanBanlanceByTypeAndMaxTime(typeList, maxTime, i * pageSize, pageSize); if (inviteAndShareUids != null) for (Long uid : inviteAndShareUids) { if (userInfoMapper.selectAvailableByPrimaryKey(uid) != null) uidSets.add(uid); } } // 根据用户ID Iterator<Long> its = uidSets.iterator(); while (its.hasNext()) { Long uid = its.next(); try { if (Constant.ENABLE_MQ) TeamOrderCMQManager.getInstance().addFanLiTeamIncomePreMsg(new UidDateDTO(uid, maxTime)); } catch (Exception e) { e.printStackTrace(); LogHelper.error(e); } } } } @Override public void fanliShare(Date maxTime) { // 查出邀请赚的用户ID List<Integer> typeList = new ArrayList<>(); typeList.add(HongBaoV2.TYPE_SHARE_GOODS); @Override public void fanliShare(Date maxTime) { // 查出邀请赚的用户ID List<Integer> typeList = new ArrayList<>(); typeList.add(HongBaoV2.TYPE_SHARE_GOODS); long count = hongBaoV2Mapper.countUidCanBanlanceByTypeAndMaxTime(typeList, maxTime); int pageSize = 1000; int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); Set<Long> uidSets = new HashSet<>(); for (int i = 0; i < page; i++) { List<Long> inviteAndShareUids = hongBaoV2Mapper.listUidCanBanlanceByTypeAndMaxTime(typeList, maxTime, i * pageSize, pageSize); if (inviteAndShareUids != null) for (Long uid : inviteAndShareUids) { if (userInfoMapper.selectAvailableByPrimaryKey(uid) != null) uidSets.add(uid); } } // 根据用户ID Iterator<Long> its = uidSets.iterator(); while (its.hasNext()) { Long uid = its.next(); try { if (Constant.ENABLE_MQ) CMQManager.getInstance().addFanLiShareMsg(new UidDateDTO(uid, maxTime)); } catch (Exception e) { e.printStackTrace(); LogHelper.error(e); } } long count = hongBaoV2Mapper.countUidCanBanlanceByTypeAndMaxTime(typeList, maxTime); int pageSize = 1000; int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); Set<Long> uidSets = new HashSet<>(); for (int i = 0; i < page; i++) { List<Long> inviteAndShareUids = hongBaoV2Mapper.listUidCanBanlanceByTypeAndMaxTime(typeList, maxTime, i * pageSize, pageSize); if (inviteAndShareUids != null) for (Long uid : inviteAndShareUids) { if (userInfoMapper.selectAvailableByPrimaryKey(uid) != null) uidSets.add(uid); } } // 根据用户ID Iterator<Long> its = uidSets.iterator(); while (its.hasNext()) { Long uid = its.next(); try { if (Constant.ENABLE_MQ) CMQManager.getInstance().addFanLiShareMsg(new UidDateDTO(uid, maxTime)); } catch (Exception e) { e.printStackTrace(); LogHelper.error(e); } } } } @Override // @Transactional(rollbackFor = Exception.class) public void fanliPreInvaite(Long uid, Date maxPreGetTime) { // 邀请赚到账 try { orderMoneySettleService.inviteSettleTB(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } @Override // @Transactional(rollbackFor = Exception.class) public void fanliPreInvaite(Long uid, Date maxPreGetTime) { // 邀请赚到账 try { orderMoneySettleService.inviteSettleTB(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.inviteSettleJD(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.inviteSettleJD(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.inviteSettlePDD(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.inviteSettlePDD(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.inviteSettleVipShop(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.inviteSettleVipShop(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.inviteSettleSuning(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } } try { orderMoneySettleService.inviteSettleSuning(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } } @Override @Transactional(rollbackFor = Exception.class) public void fanliShare(Long uid, Date maxPreGetTime) { // 邀请赚到账 try { orderMoneySettleService.shareSettleTB(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } @Override @Transactional(rollbackFor = Exception.class) public void fanliShare(Long uid, Date maxPreGetTime) { // 邀请赚到账 try { orderMoneySettleService.shareSettleTB(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.shareSettleJD(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.shareSettleJD(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.shareSettlePDD(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.shareSettlePDD(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.shareSettleVipShop(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.shareSettleVipShop(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } try { orderMoneySettleService.shareSettleSuning(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } } try { orderMoneySettleService.shareSettleSuning(uid, maxPreGetTime); } catch (OrderMoneySettleException e) { e.printStackTrace(); } } @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) @Override public void processShopingFanliOrderNew(String orderId, List<TaoBaoOrder> orderList) throws HongBaoException, OrderItemException { @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) @Override public void processShopingFanliOrderNew(String orderId, List<TaoBaoOrder> orderList) throws HongBaoException, OrderItemException { LogHelper.test(String.format("订单处理:订单号-%s 订单数量-%s", orderId, orderList.size() + "")); if (orderList.size() == 1) LogHelper.test("订单排序值:" + orderList.get(0).getOrderBy()); LogHelper.test(String.format("订单处理:订单号-%s 订单数量-%s", orderId, orderList.size() + "")); if (orderList.size() == 1) LogHelper.test("订单排序值:" + orderList.get(0).getOrderBy()); List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID); List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID); if (orderList != null && orderList.size() > 0) { String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(), orderList.get(0).getSourceMediaId(), orderList.get(0).getAdPositionId()); if (orderList != null && orderList.size() > 0) { String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(), orderList.get(0).getSourceMediaId(), orderList.get(0).getAdPositionId()); Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(orderId, Constant.SOURCE_TYPE_TAOBAO); // 原来不存在订单 Long uid = null; if (oldOrder == null) { Long targetUid = null; if (pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID) && !StringUtil.isNullOrEmpty(orderList.get(0).getRelationId())) {// 处理非返利商品库的商品 targetUid = taoBaoBuyRelationMapService.selectUidByRelationId(orderList.get(0).getRelationId()); Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(orderId, Constant.SOURCE_TYPE_TAOBAO); // 原来不存在订单 Long uid = null; if (oldOrder == null) { Long targetUid = null; if (pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID) && !StringUtil.isNullOrEmpty(orderList.get(0).getRelationId())) {// 处理非返利商品库的商品 targetUid = taoBaoBuyRelationMapService.selectUidByRelationId(orderList.get(0).getRelationId()); } else if ((pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_ELEME_PID) || pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_KOUBEI_PID)) && !StringUtil.isNullOrEmpty(orderList.get(0).getRelationId())) {// 处理饿了么,口碑的订单 UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService .getByRelationId(orderList.get(0).getRelationId(),null); if (extraInfo != null) { targetUid = extraInfo.getUser().getId(); } } else if (!StringUtil.isNullOrEmpty(orderList.get(0).getSpecialId())) { UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService .getBySpecialId(orderList.get(0).getSpecialId(),null); if (info != null && info.getUser() != null) targetUid = info.getUser().getId(); } } else if ((pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_ELEME_PID) || pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_KOUBEI_PID)) && !StringUtil.isNullOrEmpty(orderList.get(0).getRelationId())) {// 处理饿了么,口碑的订单 UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService .getByRelationId(orderList.get(0).getRelationId(), null); if (extraInfo != null) { targetUid = extraInfo.getUser().getId(); } } else if (!StringUtil.isNullOrEmpty(orderList.get(0).getSpecialId())) { UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService .getBySpecialId(orderList.get(0).getSpecialId(), null); if (info != null && info.getUser() != null) targetUid = info.getUser().getId(); } if (targetUid != null) { uid = targetUid; // 插入到Order中 // 添加到订单中去 Order order = new Order(); order.setBeizhu("PID返利订单"); order.setCreatetime(System.currentTimeMillis()); order.setOrderId(orderId); order.setOrderType(1); order.setState(Order.STATE_YIZHIFU); order.setUserInfo(new UserInfo(uid)); order.setVersion(2); // 加入到订单表 orderMapper.insertSelective(order); oldOrder = order; } if (targetUid != null) { uid = targetUid; // 插入到Order中 // 添加到订单中去 Order order = new Order(); order.setBeizhu("PID返利订单"); order.setCreatetime(System.currentTimeMillis()); order.setOrderId(orderId); order.setOrderType(1); order.setState(Order.STATE_YIZHIFU); order.setUserInfo(new UserInfo(uid)); order.setVersion(2); // 加入到订单表 orderMapper.insertSelective(order); oldOrder = order; } } else { uid = oldOrder.getUserInfo().getId(); } // 尚未找到和PID对应的用户 if (uid == null) return; } else { uid = oldOrder.getUserInfo().getId(); } // 尚未找到和PID对应的用户 if (uid == null) return; // 计算订单总额度 Order updateOrder = new Order(); updateOrder.setId(oldOrder.getId()); BigDecimal money = new BigDecimal(0); for (TaoBaoOrder o : orderList) { if (o.getOrderState().equalsIgnoreCase("订单结算")) money = money.add(o.getSettlement()); else { money = money.add(o.getPayment()); } } updateOrder.setMoney(money); String thirdState = null; for (TaoBaoOrder o : orderList) if (!o.getOrderState().equalsIgnoreCase("订单失效")) { thirdState = o.getOrderState(); break; } // 计算订单总额度 Order updateOrder = new Order(); updateOrder.setId(oldOrder.getId()); BigDecimal money = new BigDecimal(0); for (TaoBaoOrder o : orderList) { if (o.getOrderState().equalsIgnoreCase("订单结算")) money = money.add(o.getSettlement()); else { money = money.add(o.getPayment()); } } updateOrder.setMoney(money); String thirdState = null; for (TaoBaoOrder o : orderList) if (!o.getOrderState().equalsIgnoreCase("订单失效")) { thirdState = o.getOrderState(); break; } if (StringUtil.isNullOrEmpty(thirdState)) thirdState = "订单失效"; updateOrder.setThirdState(thirdState); updateOrder.setThirdCreateTime( new Date(TimeUtil.convertToTimeTemp(orderList.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss"))); orderMapper.updateByPrimaryKeySelective(updateOrder); if (StringUtil.isNullOrEmpty(thirdState)) thirdState = "订单失效"; updateOrder.setThirdState(thirdState); updateOrder.setThirdCreateTime( new Date(TimeUtil.convertToTimeTemp(orderList.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss"))); orderMapper.updateByPrimaryKeySelective(updateOrder); // 用第一个子订单锁定用户 List<CommonOrderAddResultDTO> commonOrderList = null; try { commonOrderList = commonOrderService.addTaoBaoOrder(orderList, uid); addHongBaoWithMQ(commonOrderList, orderId, uid, Constant.SOURCE_TYPE_TAOBAO, HongBaoV2.TYPE_ZIGOU); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(orderId); order.setOrderType(Constant.SOURCE_TYPE_TAOBAO); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addTaoBaoOrder或addHongBao出错", "订单号:" + orderId); } catch (Exception e1) { e1.printStackTrace(); } } } } // 用第一个子订单锁定用户 List<CommonOrderAddResultDTO> commonOrderList = null; try { commonOrderList = commonOrderService.addTaoBaoOrder(orderList, uid); addHongBaoWithMQ(commonOrderList, orderId, uid, Constant.SOURCE_TYPE_TAOBAO, HongBaoV2.TYPE_ZIGOU); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(orderId); order.setOrderType(Constant.SOURCE_TYPE_TAOBAO); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addTaoBaoOrder或addHongBao出错", "订单号:" + orderId); } catch (Exception e1) { e1.printStackTrace(); } } } } @Override public void processShareGoodsOrderNew(String orderId, List<TaoBaoOrder> orderList) { if (orderList != null && orderList.size() > 0) { // 原来不存在订单 Long uid = null; UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByRelationId(orderList.get(0).getRelationId(),null); if (info != null && info.getUser() != null) uid = info.getUser().getId(); // 尚未找到和PID对应的用户 if (uid == null) { // 通过红包查询 CommonOrder commonOrder = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, orderList.get(0).getTradeId()); @Override public void processShareGoodsOrderNew(String orderId, List<TaoBaoOrder> orderList) { if (orderList != null && orderList.size() > 0) { // 原来不存在订单 Long uid = null; UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByRelationId(orderList.get(0).getRelationId(), null); if (info != null && info.getUser() != null) uid = info.getUser().getId(); // 尚未找到和PID对应的用户 if (uid == null) { // 通过红包查询 CommonOrder commonOrder = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, orderList.get(0).getTradeId()); if (commonOrder != null) { HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null && hongBaoOrder.getHongBaoV2().getType() == HongBaoV2.TYPE_SHARE_GOODS) { uid = hongBaoOrder.getHongBaoV2().getUserInfo().getId(); } } } if (commonOrder != null) { HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null && hongBaoOrder.getHongBaoV2().getType() == HongBaoV2.TYPE_SHARE_GOODS) { uid = hongBaoOrder.getHongBaoV2().getUserInfo().getId(); } } } if (uid == null) return; if (uid == null) return; // 用第一个子订单锁定用户 try { List<CommonOrderAddResultDTO> commonOrders = commonOrderService.addTaoBaoOrder(orderList, uid); addHongBaoWithMQ(commonOrders, orderId, uid, Constant.SOURCE_TYPE_TAOBAO, HongBaoV2.TYPE_SHARE_GOODS); if (isCommonOrderAllAdd(commonOrders)) { Order order = new Order(); order.setOrderId(orderId); order.setOrderType(Constant.SOURCE_TYPE_TAOBAO); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { e.printStackTrace(); } } } // 用第一个子订单锁定用户 try { List<CommonOrderAddResultDTO> commonOrders = commonOrderService.addTaoBaoOrder(orderList, uid); addHongBaoWithMQ(commonOrders, orderId, uid, Constant.SOURCE_TYPE_TAOBAO, HongBaoV2.TYPE_SHARE_GOODS); if (isCommonOrderAllAdd(commonOrders)) { Order order = new Order(); order.setOrderId(orderId); order.setOrderType(Constant.SOURCE_TYPE_TAOBAO); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { e.printStackTrace(); } } } /** * 是否为分享订单 * * @param order * @return */ private boolean isShareOrder(JDOrder order) { if (order == null || order.getOrderItemList() == null || order.getOrderItemList().size() == 0) return false; Long positionId = order.getOrderItemList().get(0).getPositionId(); if (positionId == JDApiUtil.POSITION_SHARE) {// 分享订单 return true; } return false; } /** * 是否为分享订单 * * @param order * @return */ private boolean isShareOrder(JDOrder order) { if (order == null || order.getOrderItemList() == null || order.getOrderItemList().size() == 0) return false; Long positionId = order.getOrderItemList().get(0).getPositionId(); if (positionId == JDApiUtil.POSITION_SHARE) {// 分享订单 return true; } return false; } @Override public void processJDOrder(JDOrder order) { if (order == null || order.getOrderItemList() == null || order.getOrderItemList().size() == 0) return; // 拆单的不做处理 if (order.getValidCode() == 2) return; @Override public void processJDOrder(JDOrder order) { if (order == null || order.getOrderItemList() == null || order.getOrderItemList().size() == 0) return; // 拆单的不做处理 if (order.getValidCode() == 2) return; // 根据ext1与subUnionId跟单 String uidStr = order.getExt1(); if (StringUtil.isNullOrEmpty(uidStr)) uidStr = order.getOrderItemList().get(0).getSubUnionId(); Long uid = null; if (!StringUtil.isNullOrEmpty(uidStr) && NumberUtil.isNumeric(uidStr)) uid = Long.parseLong(uidStr); Long positionId = order.getOrderItemList().get(0).getPositionId(); if (positionId == JDApiUtil.POSITION_FANLI)// 返利订单 { processFanLiJDOrder(order, uid); lostOrderService.processSuceess(order.getOrderId() + "", Constant.SOURCE_TYPE_JD); } else if (positionId == JDApiUtil.POSITION_SHARE) {// 分享订单 if (uid == null)// 分享订单不允许找回 return; processShareJDOrder(order, uid); } else {// 处理是否有订单找回的状态 processFanLiJDOrder(order, null); } } // 根据ext1与subUnionId跟单 String uidStr = order.getExt1(); if (StringUtil.isNullOrEmpty(uidStr)) uidStr = order.getOrderItemList().get(0).getSubUnionId(); /** * 处理京东返利订单 * * @param jdOrder * @param uid */ private void processFanLiJDOrder(JDOrder jdOrder, Long uid) { int invalidCount = 0; BigDecimal totalMoney = new BigDecimal(0); // 订单状态判断 for (JDOrderItem item : jdOrder.getOrderItemList()) { if (item.getEstimateCosPrice() != null) totalMoney = totalMoney.add(item.getEstimateCosPrice()); Long uid = null; if (!StringUtil.isNullOrEmpty(uidStr) && NumberUtil.isNumeric(uidStr)) uid = Long.parseLong(uidStr); Long positionId = order.getOrderItemList().get(0).getPositionId(); if (positionId == JDApiUtil.POSITION_FANLI)// 返利订单 { processFanLiJDOrder(order, uid); lostOrderService.processSuceess(order.getOrderId() + "", Constant.SOURCE_TYPE_JD); } else if (positionId == JDApiUtil.POSITION_SHARE) {// 分享订单 if (uid == null)// 分享订单不允许找回 return; processShareJDOrder(order, uid); } else {// 处理是否有订单找回的状态 processFanLiJDOrder(order, null); } } if (item.getValidCode() == 16 || item.getValidCode() == 17 || item.getValidCode() == 18) {// 已付款 /** * 处理京东返利订单 * * @param jdOrder * @param uid */ private void processFanLiJDOrder(JDOrder jdOrder, Long uid) { int invalidCount = 0; BigDecimal totalMoney = new BigDecimal(0); // 订单状态判断 for (JDOrderItem item : jdOrder.getOrderItemList()) { if (item.getEstimateCosPrice() != null) totalMoney = totalMoney.add(item.getEstimateCosPrice()); } else if (item.getValidCode() == 15) {// 未支付 if (item.getValidCode() == 16 || item.getValidCode() == 17 || item.getValidCode() == 18) {// 已付款 } else { invalidCount++; } } } else if (item.getValidCode() == 15) {// 未支付 // 加入订单 Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(jdOrder.getOrderId() + "", Constant.SOURCE_TYPE_JD); if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("补单")) uid = oldOrder.getUserInfo().getId(); } else { invalidCount++; } } if (uid == null) return; // 加入订单 Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(jdOrder.getOrderId() + "", Constant.SOURCE_TYPE_JD); if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("补单")) uid = oldOrder.getUserInfo().getId(); if (oldOrder == null)// 新增 { Order order = new Order(); order.setBeizhu("京东返利订单"); order.setCreatetime(System.currentTimeMillis()); order.setOrderId(jdOrder.getOrderId() + ""); order.setOrderType(Constant.SOURCE_TYPE_JD); order.setState( invalidCount == jdOrder.getOrderItemList().size() ? Order.STATE_SHIXIAO : Order.STATE_YIZHIFU); order.setUserInfo(new UserInfo(uid)); order.setVersion(2); order.setThirdCreateTime(new Date(jdOrder.getOrderTime())); order.setMoney(totalMoney); // 加入到订单表 orderMapper.insertSelective(order); } else { Order updateOrder = new Order(); updateOrder.setId(oldOrder.getId()); updateOrder.setMoney(totalMoney); orderMapper.updateByPrimaryKeySelective(updateOrder); } if (uid == null) return; try { List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addJDOrder(jdOrder, uid); addHongBaoWithMQ(commonOrderList, jdOrder.getOrderId() + "", uid, Constant.SOURCE_TYPE_JD, HongBaoV2.TYPE_ZIGOU); if (oldOrder == null)// 新增 { Order order = new Order(); order.setBeizhu("京东返利订单"); order.setCreatetime(System.currentTimeMillis()); order.setOrderId(jdOrder.getOrderId() + ""); order.setOrderType(Constant.SOURCE_TYPE_JD); order.setState( invalidCount == jdOrder.getOrderItemList().size() ? Order.STATE_SHIXIAO : Order.STATE_YIZHIFU); order.setUserInfo(new UserInfo(uid)); order.setVersion(2); order.setThirdCreateTime(new Date(jdOrder.getOrderTime())); order.setMoney(totalMoney); // 加入到订单表 orderMapper.insertSelective(order); } else { Order updateOrder = new Order(); updateOrder.setId(oldOrder.getId()); updateOrder.setMoney(totalMoney); orderMapper.updateByPrimaryKeySelective(updateOrder); } if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(jdOrder.getOrderId() + ""); order.setOrderType(Constant.SOURCE_TYPE_JD); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + jdOrder.getOrderId()); } catch (Exception e1) { e1.printStackTrace(); } } } try { List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addJDOrder(jdOrder, uid); addHongBaoWithMQ(commonOrderList, jdOrder.getOrderId() + "", uid, Constant.SOURCE_TYPE_JD, HongBaoV2.TYPE_ZIGOU); /** * 处理京东分享订单 * * @param jdOrder * @param uid */ private void processShareJDOrder(JDOrder jdOrder, Long uid) { try { List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addJDOrder(jdOrder, uid); addHongBaoWithMQ(commonOrderList, jdOrder.getOrderId() + "", uid, Constant.SOURCE_TYPE_JD, HongBaoV2.TYPE_SHARE_GOODS); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(jdOrder.getOrderId() + ""); order.setOrderType(Constant.SOURCE_TYPE_JD); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + jdOrder.getOrderId()); } catch (Exception e1) { e1.printStackTrace(); } } } if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(jdOrder.getOrderId() + ""); order.setOrderType(Constant.SOURCE_TYPE_JD); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + jdOrder.getOrderId()); } catch (Exception e1) { e1.printStackTrace(); } } } /** * 是否是分享赚订单 * * @param pddOrder * @return */ private boolean isShareOrder(PDDOrder pddOrder) { String positionId = pddOrder.getpId(); if (PinDuoDuoApiUtil.PID_SHARE.equalsIgnoreCase(positionId)) return true; else return false; } /** * 处理京东分享订单 * @param jdOrder * @param uid */ private void processShareJDOrder(JDOrder jdOrder, Long uid) { try { List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addJDOrder(jdOrder, uid); addHongBaoWithMQ(commonOrderList, jdOrder.getOrderId() + "", uid, Constant.SOURCE_TYPE_JD, HongBaoV2.TYPE_SHARE_GOODS); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(jdOrder.getOrderId() + ""); order.setOrderType(Constant.SOURCE_TYPE_JD); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + jdOrder.getOrderId()); } catch (Exception e1) { e1.printStackTrace(); } } } /** * 处理拼多多订单 */ @Override public void processPDDOrder(PDDOrder pddOrder) { if (pddOrder == null) return; String uidStr = pddOrder.getCustomParameters(); Long uid = null; if (!StringUtil.isNullOrEmpty(uidStr)) uid = Long.parseLong(uidStr); String positionId = pddOrder.getpId(); if (PinDuoDuoApiUtil.PID_FANLI.equalsIgnoreCase(positionId))// 返利订单 { processFanLiPDDOrder(pddOrder, uid); lostOrderService.processSuceess(pddOrder.getOrderSn(), Constant.SOURCE_TYPE_PDD); } else if (PinDuoDuoApiUtil.PID_SHARE.equalsIgnoreCase(positionId)) {// 分享订单 if (uid == null)// 分享订单不允许找回 return; processSharePDDOrder(pddOrder, uid); } else {// 处理是否有订单找回的状态 processFanLiPDDOrder(pddOrder, null); } } /** * 是否是分享赚订单 * @param pddOrder * @return */ private boolean isShareOrder(PDDOrder pddOrder) { String positionId = pddOrder.getpId(); if (PinDuoDuoApiUtil.PID_SHARE.equalsIgnoreCase(positionId)) return true; else return false; } /** * 处理拼多多自购返利订单 * * @param pddOrder * @param uid */ private void processFanLiPDDOrder(PDDOrder pddOrder, Long uid) { int orderState = 0; if (pddOrder.getOrderStatus() == -1 || pddOrder.getOrderStatus() == 8) orderState = Order.STATE_SHIXIAO; else orderState = Order.STATE_YIZHIFU; /** * 处理拼多多订单 */ @Override public void processPDDOrder(PDDOrder pddOrder) { if (pddOrder == null) return; String uidStr = pddOrder.getCustomParameters(); Long uid = null; if (!StringUtil.isNullOrEmpty(uidStr)) uid = Long.parseLong(uidStr); String positionId = pddOrder.getpId(); if (PinDuoDuoApiUtil.PID_FANLI.equalsIgnoreCase(positionId))// 返利订单 { processFanLiPDDOrder(pddOrder, uid); lostOrderService.processSuceess(pddOrder.getOrderSn(), Constant.SOURCE_TYPE_PDD); } else if (PinDuoDuoApiUtil.PID_SHARE.equalsIgnoreCase(positionId)) {// 分享订单 if (uid == null)// 分享订单不允许找回 return; processSharePDDOrder(pddOrder, uid); } else {// 处理是否有订单找回的状态 processFanLiPDDOrder(pddOrder, null); } } BigDecimal totalMoney = MoneyBigDecimalUtil.div(new BigDecimal(pddOrder.getOrderAmount()), new BigDecimal(100)); /** * 处理拼多多自购返利订单 * @param pddOrder * @param uid */ private void processFanLiPDDOrder(PDDOrder pddOrder, Long uid) { int orderState = 0; if (pddOrder.getOrderStatus() == -1 || pddOrder.getOrderStatus() == 8) orderState = Order.STATE_SHIXIAO; else orderState = Order.STATE_YIZHIFU; // 加入订单 Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(pddOrder.getOrderSn(), Constant.SOURCE_TYPE_PDD); if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("补单")) uid = oldOrder.getUserInfo().getId(); BigDecimal totalMoney = MoneyBigDecimalUtil.div(new BigDecimal(pddOrder.getOrderAmount()), new BigDecimal(100)); if (uid == null) return; // 加入订单 Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(pddOrder.getOrderSn(), Constant.SOURCE_TYPE_PDD); if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("补单")) uid = oldOrder.getUserInfo().getId(); if (oldOrder == null)// 新增 { Order order = new Order(); order.setBeizhu("拼多多返利订单"); order.setCreatetime(System.currentTimeMillis()); order.setOrderId(pddOrder.getOrderSn()); order.setOrderType(Constant.SOURCE_TYPE_PDD); order.setState(orderState); order.setUserInfo(new UserInfo(uid)); order.setVersion(2); if (pddOrder.getFailReason() != null && pddOrder.getFailReason().contains("比价")) order.setStateDesc("比价订单"); order.setThirdCreateTime(new Date(pddOrder.getOrderCreateTime() * 1000)); order.setMoney(totalMoney); // 加入到订单表 orderMapper.insertSelective(order); } else { Order updateOrder = new Order(); updateOrder.setId(oldOrder.getId()); updateOrder.setMoney(totalMoney); if (pddOrder.getFailReason() != null && pddOrder.getFailReason().contains("比价")) updateOrder.setStateDesc("比价订单"); orderMapper.updateByPrimaryKeySelective(updateOrder); } if (uid == null) return; try { List<PDDOrder> pddOrderList = new ArrayList<>(); pddOrderList.add(pddOrder); List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid); addHongBaoWithMQ(commonOrderList, pddOrder.getOrderSn(), uid, Constant.SOURCE_TYPE_PDD, HongBaoV2.TYPE_ZIGOU); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(pddOrder.getOrderSn()); order.setOrderType(Constant.SOURCE_TYPE_PDD); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addPDDOrder或addHongBao出错", "订单号:" + pddOrder.getOrderSn()); } catch (Exception e1) { e1.printStackTrace(); } } } if (oldOrder == null)// 新增 { Order order = new Order(); order.setBeizhu("拼多多返利订单"); order.setCreatetime(System.currentTimeMillis()); order.setOrderId(pddOrder.getOrderSn()); order.setOrderType(Constant.SOURCE_TYPE_PDD); order.setState(orderState); order.setUserInfo(new UserInfo(uid)); order.setVersion(2); order.setThirdCreateTime(new Date(pddOrder.getOrderCreateTime() * 1000)); order.setMoney(totalMoney); // 加入到订单表 orderMapper.insertSelective(order); } else { Order updateOrder = new Order(); updateOrder.setId(oldOrder.getId()); updateOrder.setMoney(totalMoney); orderMapper.updateByPrimaryKeySelective(updateOrder); } /** * 处理拼多多分享订单 * * @param pddOrder * @param uid */ private void processSharePDDOrder(PDDOrder pddOrder, Long uid) { try { List<PDDOrder> pddOrderList = new ArrayList<>(); pddOrderList.add(pddOrder); List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid); addHongBaoWithMQ(commonOrderList, pddOrder.getOrderSn(), uid, Constant.SOURCE_TYPE_PDD, HongBaoV2.TYPE_SHARE_GOODS); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(pddOrder.getOrderSn()); order.setOrderType(Constant.SOURCE_TYPE_PDD); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + pddOrder.getOrderId()); } catch (Exception e1) { e1.printStackTrace(); } } } try { List<PDDOrder> pddOrderList = new ArrayList<>(); pddOrderList.add(pddOrder); List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid); addHongBaoWithMQ(commonOrderList, pddOrder.getOrderSn(), uid, Constant.SOURCE_TYPE_PDD, HongBaoV2.TYPE_ZIGOU); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(pddOrder.getOrderSn()); order.setOrderType(Constant.SOURCE_TYPE_PDD); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addPDDOrder或addHongBao出错", "订单号:" + pddOrder.getOrderSn()); } catch (Exception e1) { e1.printStackTrace(); } } } @Override public void processVipShopOrder(VipShopOrder order) { /** * 处理拼多多分享订单 * @param pddOrder * @param uid */ private void processSharePDDOrder(PDDOrder pddOrder, Long uid) { try { List<PDDOrder> pddOrderList = new ArrayList<>(); pddOrderList.add(pddOrder); List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid); addHongBaoWithMQ(commonOrderList, pddOrder.getOrderSn(), uid, Constant.SOURCE_TYPE_PDD, HongBaoV2.TYPE_SHARE_GOODS); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(pddOrder.getOrderSn()); order.setOrderType(Constant.SOURCE_TYPE_PDD); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + pddOrder.getOrderId()); } catch (Exception e1) { e1.printStackTrace(); } } } if (order == null || order.getDetailList() == null || order.getDetailList().size() == 0) return; @Override public void processVipShopOrder(VipShopOrder order) { if (order == null || order.getDetailList() == null || order.getDetailList().size() == 0) return; // 根据ext1与subUnionId跟单 String channelTag = order.getChannelTag(); // 根据ext1与subUnionId跟单 String channelTag = order.getChannelTag(); String uidStr = VipShopUtil.getUidFromChanTag(channelTag); String uidStr = VipShopUtil.getUidFromChanTag(channelTag); Long uid = null; if (!StringUtil.isNullOrEmpty(uidStr) && NumberUtil.isNumeric(uidStr)) uid = Long.parseLong(uidStr); String type = VipShopUtil.getTypeFromChanTag(channelTag); if ("buy".equalsIgnoreCase(type))// 返利订单 { processFanLiVipShopOrder(order, uid); lostOrderService.processSuceess(order.getOrderSn() + "", Constant.SOURCE_TYPE_VIP); } else if ("share".equalsIgnoreCase(type)) {// 分享订单 if (uid == null)// 分享订单不允许找回 return; processShareVipShopOrder(order, uid); } else {// 处理是否有订单找回的状态 processFanLiVipShopOrder(order, null); } } Long uid = null; if (!StringUtil.isNullOrEmpty(uidStr) && NumberUtil.isNumeric(uidStr)) uid = Long.parseLong(uidStr); String type = VipShopUtil.getTypeFromChanTag(channelTag); if ("buy".equalsIgnoreCase(type))// 返利订单 { processFanLiVipShopOrder(order, uid); lostOrderService.processSuceess(order.getOrderSn() + "", Constant.SOURCE_TYPE_VIP); } else if ("share".equalsIgnoreCase(type)) {// 分享订单 if (uid == null)// 分享订单不允许找回 return; processShareVipShopOrder(order, uid); } else {// 处理是否有订单找回的状态 processFanLiVipShopOrder(order, null); } } /** * 处理京东返利订单 * @param vipShopOrder * @param uid */ private void processFanLiVipShopOrder(VipShopOrder vipShopOrder, Long uid) { int invalidCount = 0; BigDecimal totalMoney = new BigDecimal(0); // 订单状态判断 for (VipShopOrderDetail item : vipShopOrder.getDetailList()) { if (item.getCommissionTotalCost() != null) totalMoney = totalMoney.add(item.getCommissionTotalCost()); if (item.getStatus() == VipShopOrderDetail.STATUS_INVALID) { invalidCount++; } } /** * 处理京东返利订单 * * @param vipShopOrder * @param uid */ private void processFanLiVipShopOrder(VipShopOrder vipShopOrder, Long uid) { int invalidCount = 0; BigDecimal totalMoney = new BigDecimal(0); // 订单状态判断 for (VipShopOrderDetail item : vipShopOrder.getDetailList()) { if (item.getCommissionTotalCost() != null) totalMoney = totalMoney.add(item.getCommissionTotalCost()); if (item.getStatus() == VipShopOrderDetail.STATUS_INVALID) { invalidCount++; } } // 加入订单 Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(vipShopOrder.getOrderSn() + "", Constant.SOURCE_TYPE_VIP); if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("补单")) uid = oldOrder.getUserInfo().getId(); // 加入订单 Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(vipShopOrder.getOrderSn() + "", Constant.SOURCE_TYPE_VIP); if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("补单")) uid = oldOrder.getUserInfo().getId(); if (uid == null) return; if (uid == null) return; if (oldOrder == null)// 新增 { Order order = new Order(); order.setBeizhu("唯品会返利订单"); order.setCreatetime(System.currentTimeMillis()); order.setOrderId(vipShopOrder.getOrderSn() + ""); order.setOrderType(Constant.SOURCE_TYPE_VIP); order.setState( invalidCount == vipShopOrder.getDetailList().size() ? Order.STATE_SHIXIAO : Order.STATE_YIZHIFU); order.setUserInfo(new UserInfo(uid)); order.setVersion(2); order.setThirdCreateTime(new Date(vipShopOrder.getOrderTime())); order.setMoney(totalMoney); // 加入到订单表 orderMapper.insertSelective(order); } else { Order updateOrder = new Order(); updateOrder.setId(oldOrder.getId()); updateOrder.setMoney(totalMoney); orderMapper.updateByPrimaryKeySelective(updateOrder); } if (oldOrder == null)// 新增 { Order order = new Order(); order.setBeizhu("唯品会返利订单"); order.setCreatetime(System.currentTimeMillis()); order.setOrderId(vipShopOrder.getOrderSn() + ""); order.setOrderType(Constant.SOURCE_TYPE_VIP); order.setState( invalidCount == vipShopOrder.getDetailList().size() ? Order.STATE_SHIXIAO : Order.STATE_YIZHIFU); order.setUserInfo(new UserInfo(uid)); order.setVersion(2); order.setThirdCreateTime(new Date(vipShopOrder.getOrderTime())); order.setMoney(totalMoney); // 加入到订单表 orderMapper.insertSelective(order); } else { Order updateOrder = new Order(); updateOrder.setId(oldOrder.getId()); updateOrder.setMoney(totalMoney); orderMapper.updateByPrimaryKeySelective(updateOrder); } try { List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addVipShopOrder(vipShopOrder, uid); addHongBaoWithMQ(commonOrderList, vipShopOrder.getOrderSn() + "", uid, Constant.SOURCE_TYPE_VIP, HongBaoV2.TYPE_ZIGOU); try { List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addVipShopOrder(vipShopOrder, uid); addHongBaoWithMQ(commonOrderList, vipShopOrder.getOrderSn() + "", uid, Constant.SOURCE_TYPE_VIP, HongBaoV2.TYPE_ZIGOU); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(vipShopOrder.getOrderSn() + ""); order.setOrderType(Constant.SOURCE_TYPE_VIP); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addVipShopOrder或addHongBao出错", "订单号:" + vipShopOrder.getOrderSn()); } catch (Exception e1) { e1.printStackTrace(); } } } if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(vipShopOrder.getOrderSn() + ""); order.setOrderType(Constant.SOURCE_TYPE_VIP); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addVipShopOrder或addHongBao出错", "订单号:" + vipShopOrder.getOrderSn()); } catch (Exception e1) { e1.printStackTrace(); } } } /** * 处理京东分享订单 * @param jdOrder * @param uid */ private void processShareVipShopOrder(VipShopOrder jdOrder, Long uid) { try { List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addVipShopOrder(jdOrder, uid); addHongBaoWithMQ(commonOrderList, jdOrder.getOrderSn() + "", uid, Constant.SOURCE_TYPE_VIP, HongBaoV2.TYPE_SHARE_GOODS); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(jdOrder.getOrderSn() + ""); order.setOrderType(Constant.SOURCE_TYPE_VIP); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + jdOrder.getOrderSn()); } catch (Exception e1) { e1.printStackTrace(); } } } /** * 处理京东分享订单 * * @param jdOrder * @param uid */ private void processShareVipShopOrder(VipShopOrder jdOrder, Long uid) { try { List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addVipShopOrder(jdOrder, uid); addHongBaoWithMQ(commonOrderList, jdOrder.getOrderSn() + "", uid, Constant.SOURCE_TYPE_VIP, HongBaoV2.TYPE_SHARE_GOODS); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(jdOrder.getOrderSn() + ""); order.setOrderType(Constant.SOURCE_TYPE_VIP); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + jdOrder.getOrderSn()); } catch (Exception e1) { e1.printStackTrace(); } } } /** * 处理苏宁订单 */ @Override public void processSuningOrder(SuningOrderInfo suningOrder) { if (suningOrder == null) return; String uidStr = suningOrder.getChildAccountId(); Long uid = null; if (!StringUtil.isNullOrEmpty(uidStr)) uid = Long.parseLong(uidStr); String positionId = suningOrder.getPositionId(); if (SuningApiUtil.PID_BUY.equalsIgnoreCase(positionId))// 返利订单 { processFanLiSuningOrder(suningOrder, uid); lostOrderService.processSuceess(suningOrder.getOrderCode(), Constant.SOURCE_TYPE_SUNING); } else if (PinDuoDuoApiUtil.PID_SHARE.equalsIgnoreCase(positionId)) {// 分享订单 if (uid == null)// 分享订单不允许找回 return; processShareSuningOrder(suningOrder, uid); } else {// 处理是否有订单找回的状态 processFanLiSuningOrder(suningOrder, null); } } /** * 处理苏宁订单 */ @Override public void processSuningOrder(SuningOrderInfo suningOrder) { if (suningOrder == null) return; String uidStr = suningOrder.getChildAccountId(); Long uid = null; if (!StringUtil.isNullOrEmpty(uidStr)) uid = Long.parseLong(uidStr); String positionId = suningOrder.getPositionId(); if (SuningApiUtil.PID_BUY.equalsIgnoreCase(positionId))// 返利订单 { processFanLiSuningOrder(suningOrder, uid); lostOrderService.processSuceess(suningOrder.getOrderCode(), Constant.SOURCE_TYPE_SUNING); } else if (PinDuoDuoApiUtil.PID_SHARE.equalsIgnoreCase(positionId)) {// 分享订单 if (uid == null)// 分享订单不允许找回 return; processShareSuningOrder(suningOrder, uid); } else {// 处理是否有订单找回的状态 processFanLiSuningOrder(suningOrder, null); } } /** * 处理拼多多自购返利订单 * @param suningOrder * @param uid */ private void processFanLiSuningOrder(SuningOrderInfo suningOrder, Long uid) { int orderState = 0; /** * 处理拼多多自购返利订单 * * @param suningOrder * @param uid */ private void processFanLiSuningOrder(SuningOrderInfo suningOrder, Long uid) { int orderState = 0; // 等待付款;支付完成;退款;订单已取消;确认收货 // 等待付款;支付完成;退款;订单已取消;确认收货 if ("订单已取消".equalsIgnoreCase(suningOrder.getOrderLineStatusDesc()) || "退款".equalsIgnoreCase(suningOrder.getOrderLineStatusDesc())) orderState = Order.STATE_SHIXIAO; else orderState = Order.STATE_YIZHIFU; if ("订单已取消".equalsIgnoreCase(suningOrder.getOrderLineStatusDesc()) || "退款".equalsIgnoreCase(suningOrder.getOrderLineStatusDesc())) orderState = Order.STATE_SHIXIAO; else orderState = Order.STATE_YIZHIFU; BigDecimal totalMoney = new BigDecimal(suningOrder.getPayAmount()); BigDecimal totalMoney = new BigDecimal(suningOrder.getPayAmount()); // 加入订单 Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(suningOrder.getOrderCode(), Constant.SOURCE_TYPE_SUNING); if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("补单")) uid = oldOrder.getUserInfo().getId(); // 加入订单 Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(suningOrder.getOrderCode(), Constant.SOURCE_TYPE_SUNING); if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("补单")) uid = oldOrder.getUserInfo().getId(); if (uid == null) return; if (uid == null) return; if (oldOrder == null)// 新增 { Order order = new Order(); order.setBeizhu("苏宁返利订单"); order.setCreatetime(System.currentTimeMillis()); order.setOrderId(suningOrder.getOrderCode()); order.setOrderType(Constant.SOURCE_TYPE_SUNING); order.setState(orderState); order.setUserInfo(new UserInfo(uid)); order.setVersion(2); order.setThirdCreateTime( new Date(TimeUtil.convertToTimeTemp(suningOrder.getOrderSubmitTime(), "yyyy-MM-dd HH:mm:ss"))); order.setMoney(totalMoney); // 加入到订单表 orderMapper.insertSelective(order); } else { Order updateOrder = new Order(); updateOrder.setId(oldOrder.getId()); updateOrder.setMoney(totalMoney); orderMapper.updateByPrimaryKeySelective(updateOrder); } if (oldOrder == null)// 新增 { Order order = new Order(); order.setBeizhu("苏宁返利订单"); order.setCreatetime(System.currentTimeMillis()); order.setOrderId(suningOrder.getOrderCode()); order.setOrderType(Constant.SOURCE_TYPE_SUNING); order.setState(orderState); order.setUserInfo(new UserInfo(uid)); order.setVersion(2); order.setThirdCreateTime( new Date(TimeUtil.convertToTimeTemp(suningOrder.getOrderSubmitTime(), "yyyy-MM-dd HH:mm:ss"))); order.setMoney(totalMoney); // 加入到订单表 orderMapper.insertSelective(order); } else { Order updateOrder = new Order(); updateOrder.setId(oldOrder.getId()); updateOrder.setMoney(totalMoney); orderMapper.updateByPrimaryKeySelective(updateOrder); } try { List<SuningOrderInfo> pddOrderList = new ArrayList<>(); pddOrderList.add(suningOrder); List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addSuningOrder(pddOrderList, uid); addHongBaoWithMQ(commonOrderList, suningOrder.getOrderCode(), uid, Constant.SOURCE_TYPE_SUNING, HongBaoV2.TYPE_ZIGOU); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(suningOrder.getOrderCode()); order.setOrderType(Constant.SOURCE_TYPE_SUNING); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addPDDOrder或addHongBao出错", "订单号:" + suningOrder.getOrderCode()); } catch (Exception e1) { e1.printStackTrace(); } } } try { List<SuningOrderInfo> pddOrderList = new ArrayList<>(); pddOrderList.add(suningOrder); List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addSuningOrder(pddOrderList, uid); addHongBaoWithMQ(commonOrderList, suningOrder.getOrderCode(), uid, Constant.SOURCE_TYPE_SUNING, HongBaoV2.TYPE_ZIGOU); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(suningOrder.getOrderCode()); order.setOrderType(Constant.SOURCE_TYPE_SUNING); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addPDDOrder或addHongBao出错", "订单号:" + suningOrder.getOrderCode()); } catch (Exception e1) { e1.printStackTrace(); } } } /** * 处理拼多多分享订单 * @param suningOrder * @param uid */ private void processShareSuningOrder(SuningOrderInfo suningOrder, Long uid) { try { List<SuningOrderInfo> suningOrderList = new ArrayList<>(); suningOrderList.add(suningOrder); List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addSuningOrder(suningOrderList, uid); addHongBaoWithMQ(commonOrderList, suningOrder.getOrderCode(), uid, Constant.SOURCE_TYPE_SUNING, HongBaoV2.TYPE_SHARE_GOODS); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(suningOrder.getOrderCode()); order.setOrderType(Constant.SOURCE_TYPE_SUNING); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + suningOrder.getOrderCode()); } catch (Exception e1) { e1.printStackTrace(); } } } /** * 处理拼多多分享订单 * * @param suningOrder * @param uid */ private void processShareSuningOrder(SuningOrderInfo suningOrder, Long uid) { try { List<SuningOrderInfo> suningOrderList = new ArrayList<>(); suningOrderList.add(suningOrder); List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addSuningOrder(suningOrderList, uid); addHongBaoWithMQ(commonOrderList, suningOrder.getOrderCode(), uid, Constant.SOURCE_TYPE_SUNING, HongBaoV2.TYPE_SHARE_GOODS); if (isCommonOrderAllAdd(commonOrderList)) { Order order = new Order(); order.setOrderId(suningOrder.getOrderCode()); order.setOrderType(Constant.SOURCE_TYPE_SUNING); order.setUserInfo(new UserInfo(uid)); try { if (Constant.ENABLE_MQ) PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order); } catch (Exception e) { } } } catch (CommonOrderException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + suningOrder.getOrderCode()); } catch (Exception e1) { e1.printStackTrace(); } } } @Override public void repairCommonOrderByByTaoBaoOrder(String orderId) { // 根据订单号查询淘宝订单 List<TaoBaoOrder> orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId); if (orderList != null) for (TaoBaoOrder order : orderList) { // 根据交易ID查询常规订单 CommonOrder commonOrder = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, order.getTradeId()); // 修复orderby if (commonOrder != null) { CommonOrder update = new CommonOrder(commonOrder.getId()); update.setOrderBy(order.getOrderBy()); update.setUpdateTime(new Date()); commonOrderService.updateByPrimaryKeySelective(update); } } @Override public void repairCommonOrderByByTaoBaoOrder(String orderId) { // 根据订单号查询淘宝订单 List<TaoBaoOrder> orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId); if (orderList != null) for (TaoBaoOrder order : orderList) { // 根据交易ID查询常规订单 CommonOrder commonOrder = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, order.getTradeId()); // 修复orderby if (commonOrder != null) { CommonOrder update = new CommonOrder(commonOrder.getId()); update.setOrderBy(order.getOrderBy()); update.setUpdateTime(new Date()); commonOrderService.updateByPrimaryKeySelective(update); } } } } @Override public boolean isShareOrder(CommonOrder commonOrder) { switch (commonOrder.getSourceType()) { case Constant.SOURCE_TYPE_TAOBAO: return isShareOrder(taoBaoOrderService.selectByTradeId(commonOrder.getTradeId())); case Constant.SOURCE_TYPE_JD: return isShareOrder(jdOrderService.selectDetailByOrderId(Long.parseLong(commonOrder.getOrderNo()))); case Constant.SOURCE_TYPE_PDD: return isShareOrder(pddOrderService.selectByOrderSn(commonOrder.getOrderNo()).get(0)); } return false; } @Override public boolean isShareOrder(CommonOrder commonOrder) { switch (commonOrder.getSourceType()) { case Constant.SOURCE_TYPE_TAOBAO: return isShareOrder(taoBaoOrderService.selectByTradeId(commonOrder.getTradeId())); case Constant.SOURCE_TYPE_JD: return isShareOrder(jdOrderService.selectDetailByOrderId(Long.parseLong(commonOrder.getOrderNo()))); case Constant.SOURCE_TYPE_PDD: return isShareOrder(pddOrderService.selectByOrderSn(commonOrder.getOrderNo()).get(0)); } return false; } /** * 转为普通订单 * * @param dtoList * @return */ private List<CommonOrder> convertCommonOrder(List<CommonOrderAddResultDTO> dtoList) { List<CommonOrder> commonOrderList = new ArrayList<>(); if (dtoList != null) for (CommonOrderAddResultDTO dto : dtoList) commonOrderList.add(dto.getCommonOrder()); return commonOrderList; } /** * 转为普通订单 * * @param dtoList * @return */ private List<CommonOrder> convertCommonOrder(List<CommonOrderAddResultDTO> dtoList) { List<CommonOrder> commonOrderList = new ArrayList<>(); if (dtoList != null) for (CommonOrderAddResultDTO dto : dtoList) commonOrderList.add(dto.getCommonOrder()); return commonOrderList; } /** * 是否全是增加 * * @param list * @return */ private boolean isCommonOrderAllAdd(List<CommonOrderAddResultDTO> list) { if (list == null || list.size() == 0) return false; int addCount = 0; if (list != null) for (CommonOrderAddResultDTO dto : list) { if (dto.getType() == CommonOrderAddResultDTO.TYPE_ADD) addCount++; } if (addCount == list.size()) return true; else return false; } /** * 是否全是增加 * * @param list * @return */ private boolean isCommonOrderAllAdd(List<CommonOrderAddResultDTO> list) { if (list == null || list.size() == 0) return false; int addCount = 0; if (list != null) for (CommonOrderAddResultDTO dto : list) { if (dto.getType() == CommonOrderAddResultDTO.TYPE_ADD) addCount++; } if (addCount == list.size()) return true; else return false; } @Transactional(rollbackFor = Exception.class) public void invalidHongBaoV2AndGiveGodenCorn(Long hongBaoId, Long uid, String orderId, int sourceType, String beiZhu) throws Exception { HongBaoOrder hongbaoOrder = hongBaoOrderMapper.selectByHongBaoId(hongBaoId); if (hongbaoOrder != null) { CommonOrder commonOrder = commonOrderService.selectByPrimaryKey(hongbaoOrder.getCommonOrder().getId()); if (commonOrder != null) { if (commonOrder.getState() == CommonOrder.STATE_FK) { CommonOrder updateOrder = new CommonOrder(commonOrder.getId()); updateOrder.setState(CommonOrder.STATE_SX); updateOrder.setUpdateTime(new Date()); commonOrderService.updateByPrimaryKeySelective(updateOrder); } } } @Transactional(rollbackFor = Exception.class) public void invalidHongBaoV2AndGiveGodenCorn(Long hongBaoId, Long uid, String orderId, int sourceType, String beiZhu) throws Exception { HongBaoOrder hongbaoOrder = hongBaoOrderMapper.selectByHongBaoId(hongBaoId); if (hongbaoOrder != null) { CommonOrder commonOrder = commonOrderService.selectByPrimaryKey(hongbaoOrder.getCommonOrder().getId()); if (commonOrder != null) { if (commonOrder.getState() == CommonOrder.STATE_FK) { CommonOrder updateOrder = new CommonOrder(commonOrder.getId()); updateOrder.setState(CommonOrder.STATE_SX); updateOrder.setUpdateTime(new Date()); commonOrderService.updateByPrimaryKeySelective(updateOrder); } } } HongBaoV2 hongBao = hongBaoV2Service.selectByPrimaryKey(hongBaoId); if (hongBao == null || hongBao.getState() == HongBaoV2.STATE_SHIXIAO) return; HongBaoV2 hongBao = hongBaoV2Service.selectByPrimaryKey(hongBaoId); if (hongBao == null || hongBao.getState() == HongBaoV2.STATE_SHIXIAO) return; HongBaoV2 v2 = new HongBaoV2(hongBaoId); v2.setState(HongBaoV2.STATE_SHIXIAO); v2.setBeizhu(beiZhu); v2.setUpdateTime(new Date()); hongBaoV2Service.updateByPrimaryKeySelective(v2); List<HongBaoV2> children = hongBaoV2Service.listChildrenById(hongBaoId); if (children != null) for (HongBaoV2 child : children) { HongBaoV2 update = new HongBaoV2(child.getId()); update.setState(HongBaoV2.STATE_SHIXIAO); update.setBeizhu(beiZhu); update.setUpdateTime(new Date()); hongBaoV2Service.updateByPrimaryKeySelective(update); } HongBaoV2 v2 = new HongBaoV2(hongBaoId); v2.setState(HongBaoV2.STATE_SHIXIAO); v2.setBeizhu(beiZhu); v2.setUpdateTime(new Date()); hongBaoV2Service.updateByPrimaryKeySelective(v2); List<HongBaoV2> children = hongBaoV2Service.listChildrenById(hongBaoId); if (children != null) for (HongBaoV2 child : children) { HongBaoV2 update = new HongBaoV2(child.getId()); update.setState(HongBaoV2.STATE_SHIXIAO); update.setBeizhu(beiZhu); update.setUpdateTime(new Date()); hongBaoV2Service.updateByPrimaryKeySelective(update); } if (hongBao.getType() == HongBaoV2.TYPE_ZIGOU || hongBao.getType() == HongBaoV2.TYPE_SHARE_GOODS) { userOrderMsgNotificationService.orderInvalidToBusinessRunning(uid, orderId, sourceType, hongBao.getType()); } } if (hongBao.getType() == HongBaoV2.TYPE_ZIGOU || hongBao.getType() == HongBaoV2.TYPE_SHARE_GOODS) { userOrderMsgNotificationService.orderInvalidToBusinessRunning(uid, orderId, sourceType, hongBao.getType()); } } @Transactional @Override public void doTaoBaoSellerNotPaid(TaoBaoOrder order) { @Transactional @Override public void doTaoBaoSellerNotPaid(TaoBaoOrder order) { // 根据交易ID查询 if (!StringUtil.isNullOrEmpty(order.getTradeId())) { List<CommonOrder> commonOrderList = commonOrderService .listBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, order.getTradeId()); if (commonOrderList != null) // 查询主订单 for (CommonOrder commonOrder : commonOrderList) { // 查询主红包 HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) { if (hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_BUKELINGQU || hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_SHIXIAO) { // 订单失效,赠送金币 try { invalidHongBaoV2AndGiveGodenCorn(hongBaoOrder.getHongBaoV2().getId(), hongBaoOrder.getHongBaoV2().getUserInfo().getId(), commonOrder.getOrderNo(), commonOrder.getSourceType(), "订单成功,商家未打款"); } catch (Exception e) { e.printStackTrace(); } } // 根据交易ID查询 if (!StringUtil.isNullOrEmpty(order.getTradeId())) { List<CommonOrder> commonOrderList = commonOrderService .listBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, order.getTradeId()); if (commonOrderList != null) // 查询主订单 for (CommonOrder commonOrder : commonOrderList) { // 查询主红包 HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) { if (hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_BUKELINGQU || hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_SHIXIAO) { // 订单失效,赠送金币 try { invalidHongBaoV2AndGiveGodenCorn(hongBaoOrder.getHongBaoV2().getId(), hongBaoOrder.getHongBaoV2().getUserInfo().getId(), commonOrder.getOrderNo(), commonOrder.getSourceType(), "订单成功,商家未打款"); } catch (Exception e) { e.printStackTrace(); } } } } } } } } } } public void elmeFanli() { public void elmeFanli() { } } // 饿了么订单 @Resource private ElmeHongBaoOrderMapService elmeHongBaoOrderMapService; // 饿了么订单 @Resource private ElmeHongBaoOrderMapService elmeHongBaoOrderMapService; @Resource private ElmeOrderService elmeOrderService; @Resource private ElmeOrderService elmeOrderService; @Resource private ElmeOrderProcessService elmeOrderProcessService; @Resource private ElmeOrderProcessService elmeOrderProcessService; /** * 获取饿了么可以返利的红包 * * @return */ @Override public List<HongBaoV2> getCanBalanceElmeFanliHongBao() { List<Integer> list = new ArrayList<>(); list.add(HongBaoV2.TYPE_ELME); return hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(list, null, null, new Date(), 0, 1000); } /** * 获取饿了么可以返利的红包 * * @return */ @Override public List<HongBaoV2> getCanBalanceElmeFanliHongBao() { List<Integer> list = new ArrayList<>(); list.add(HongBaoV2.TYPE_ELME); return hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(list, null, null, new Date(), 0, 1000); } @Override @Transactional public void elmeFanli(Long hongBaoId) { // 查询详情 HongBaoV2 hongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBaoId); if (hongBao.getType() == HongBaoV2.TYPE_ELME && hongBao.getState() == HongBaoV2.STATE_KELINGQU && hongBao.getPreGetTime() != null && System.currentTimeMillis() > hongBao.getPreGetTime().getTime()) {// 可以到账了 // 判断用户状态 UserInfo user = userInfoMapper.selectByPrimaryKey(hongBao.getUserInfo().getId()); if (user == null || user.getState() != UserInfo.STATE_NORMAL) return; ElmeHongBaoOrderMap map = elmeHongBaoOrderMapService.selectByHongBaoId(hongBaoId); if (map == null) return; ElmeOrder order = elmeOrderService.selectByPrimaryKey(map.getElmeOrder().getId()); if (order == null) return; @Override @Transactional public void elmeFanli(Long hongBaoId) { // 查询详情 HongBaoV2 hongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBaoId); if (hongBao.getType() == HongBaoV2.TYPE_ELME && hongBao.getState() == HongBaoV2.STATE_KELINGQU && hongBao.getPreGetTime() != null && System.currentTimeMillis() > hongBao.getPreGetTime().getTime()) {// 可以到账了 // 判断用户状态 UserInfo user = userInfoMapper.selectByPrimaryKey(hongBao.getUserInfo().getId()); if (user == null || user.getState() != UserInfo.STATE_NORMAL) return; ElmeHongBaoOrderMap map = elmeHongBaoOrderMapService.selectByHongBaoId(hongBaoId); if (map == null) return; ElmeOrder order = elmeOrderService.selectByPrimaryKey(map.getElmeOrder().getId()); if (order == null) return; // 到账,加数据 HongBaoV2 update = new HongBaoV2(hongBao.getId()); update.setUpdateTime(new Date()); update.setGetTime(new Date()); update.setState(HongBaoV2.STATE_YILINGQU); hongBaoV2Mapper.updateByPrimaryKeySelective(update); // 增加资金 UserMoneyDetail detail = null; try { detail = UserMoneyDetailFactory.createElmeFanLi(hongBao.getUserInfo().getId(), order.getOrderId(), hongBao.getId(), hongBao.getMoney()); } catch (UserMoneyDetailException e) { e.printStackTrace(); } userMoneyService.addUserMoney(hongBao.getUserInfo().getId(), hongBao.getMoney(), detail); BigDecimal balance = userInfoMapper.selectByPrimaryKey(hongBao.getUserInfo().getId()).getMyHongBao(); } // 返利到账 } // 到账,加数据 HongBaoV2 update = new HongBaoV2(hongBao.getId()); update.setUpdateTime(new Date()); update.setGetTime(new Date()); update.setState(HongBaoV2.STATE_YILINGQU); hongBaoV2Mapper.updateByPrimaryKeySelective(update); // 增加资金 UserMoneyDetail detail = null; try { detail = UserMoneyDetailFactory.createElmeFanLi(hongBao.getUserInfo().getId(), order.getOrderId(), hongBao.getId(), hongBao.getMoney()); } catch (UserMoneyDetailException e) { e.printStackTrace(); } userMoneyService.addUserMoney(hongBao.getUserInfo().getId(), hongBao.getMoney(), detail); BigDecimal balance = userInfoMapper.selectByPrimaryKey(hongBao.getUserInfo().getId()).getMyHongBao(); } // 返利到账 } /** * 添加红包与事务消息 * * @param commonOrderList * @param orderId * @param uid * @param sourceType * @param hongBaoType */ private void addHongBaoWithMQ(List<CommonOrderAddResultDTO> commonOrderList, String orderId, Long uid, int sourceType, int hongBaoType) { final List<CommonOrder> coList = convertCommonOrder(commonOrderList); HongBaoAddResult result = null; try { long time = TimeUtil.convertToTimeTemp("2019-12-06", "yyyy-MM-dd"); if (!Constant.IS_TEST) time = TimeUtil.convertToTimeTemp("2019-12-20", "yyyy-MM-dd"); /** * 添加红包与事务消息 * * @param commonOrderList * @param orderId * @param uid * @param sourceType * @param hongBaoType */ private void addHongBaoWithMQ(List<CommonOrderAddResultDTO> commonOrderList, String orderId, Long uid, int sourceType, int hongBaoType) { final List<CommonOrder> coList = convertCommonOrder(commonOrderList); HongBaoAddResult result = null; try { long time = TimeUtil.convertToTimeTemp("2019-12-06", "yyyy-MM-dd"); if (!Constant.IS_TEST) time = TimeUtil.convertToTimeTemp("2019-12-20", "yyyy-MM-dd"); if (coList.get(0).getThirdCreateTime().getTime() < time) result = hongBaoV2Service.addHongBao(coList, hongBaoType); else result = hongBaoV2AddManager.addHongBao(coList, hongBaoType); } catch (HongBaoException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + orderId); } catch (Exception e1) { e1.printStackTrace(); } } catch (UserAccountException e) { if (coList.get(0).getThirdCreateTime().getTime() < time) result = hongBaoV2Service.addHongBao(coList, hongBaoType); else result = hongBaoV2AddManager.addHongBao(coList, hongBaoType); } catch (HongBaoException e) { try { LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + orderId); } catch (Exception e1) { e1.printStackTrace(); } } catch (UserAccountException e) { } if (!Constant.IS_TEST) if (result.getResultCode() == HongBaoAddResult.CODE_ADD) {// 只发送新增消息 OrderMQMsg mqMsg = new OrderMQMsg(orderId, sourceType, uid, OrderMQMsg.HANDLE_TYPE_ADD, isCommonOrderValid(coList), 0, new Date(), result.isMiandan(),coList.get(0).getThirdCreateTime()); Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderStatistic, mqMsg); rocketMQManager.sendNormalMsg(msg, null); } } } if (!Constant.IS_TEST) if (result.getResultCode() == HongBaoAddResult.CODE_ADD) {// 只发送新增消息 OrderMQMsg mqMsg = new OrderMQMsg(orderId, sourceType, uid, OrderMQMsg.HANDLE_TYPE_ADD, isCommonOrderValid(coList), 0, new Date(), result.isMiandan(), coList.get(0).getThirdCreateTime()); Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderStatistic, mqMsg); rocketMQManager.sendNormalMsg(msg, null); } } /** * 订单是否有效 * * @param coList * @return */ private boolean isCommonOrderValid(List<CommonOrder> coList) { for (CommonOrder commonOrder : coList) { if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_FK || commonOrder.getState() == CommonOrder.STATE_WQ) { return true; } } return false; } /** * 订单是否有效 * * @param coList * @return */ private boolean isCommonOrderValid(List<CommonOrder> coList) { for (CommonOrder commonOrder : coList) { if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_FK || commonOrder.getState() == CommonOrder.STATE_WQ) { return true; } } return false; } } fanli/src/main/java/com/yeshi/fanli/service/impl/order/pdd/PDDOrderServiceImpl.java
@@ -17,80 +17,88 @@ @Service public class PDDOrderServiceImpl implements PDDOrderService { @Resource private PDDOrderMapper pddOrderMapper; @Resource private PDDOrderMapper pddOrderMapper; @Override public PDDOrder addOrder(PDDOrder order) throws PDDOrderException { if (order == null || StringUtil.isNullOrEmpty(order.getOrderSn())) throw new PDDOrderException(1, "订单信息不完整"); @Override public PDDOrder addOrder(PDDOrder order) throws PDDOrderException { if (order == null || StringUtil.isNullOrEmpty(order.getOrderSn())) throw new PDDOrderException(1, "订单信息不完整"); PDDOrder old = pddOrderMapper.selectByOrderSN(order.getOrderSn()); if (old != null) { // 更新订单信息 if ((order.getOrderStatus().intValue() != old.getOrderStatus())||(old.getOrderStatus()==2 && old.getOrderReceiveTime()==null)) {// 状态改变了才更改订单信息 PDDOrder update = new PDDOrder(); update.setId(old.getId()); update.setOrderStatus(order.getOrderStatus()); update.setOrderAmount(order.getOrderAmount()); update.setOrderStatusDesc(order.getOrderStatusDesc()); update.setOrderVerifyTime(order.getOrderVerifyTime()); update.setOrderGroupSuccessTime(order.getOrderGroupSuccessTime()); update.setOrderModifyAt(order.getOrderModifyAt()); update.setOrderPayTime(order.getOrderPayTime()); update.setOrderSettleTime(order.getOrderSettleTime()); update.setGoodsName(order.getGoodsName()); update.setGoodsPrice(order.getGoodsPrice()); update.setUpdateTime(new Date()); update.setOrderReceiveTime(order.getOrderReceiveTime()); pddOrderMapper.updateByPrimaryKeySelective(update); return pddOrderMapper.selectByPrimaryKey(old.getId()); } } else { if (order.getUpdateTime() == null) order.setUpdateTime(new Date()); if (order.getCreateTime() == null) order.setCreateTime(new Date()); pddOrderMapper.insertSelective(order); } PDDOrder old = pddOrderMapper.selectByOrderSN(order.getOrderSn()); if (old != null) { // 更新订单信息 if ((order.getOrderStatus().intValue() != old.getOrderStatus()) || (old.getOrderStatus() == 2 && old.getOrderReceiveTime() == null) || !StringUtil.isNullOrEmpty(order.getFailReason())) {// 状态改变了才更改订单信息 PDDOrder update = new PDDOrder(); update.setId(old.getId()); update.setOrderStatus(order.getOrderStatus()); update.setOrderAmount(order.getOrderAmount()); update.setOrderStatusDesc(order.getOrderStatusDesc()); update.setFailReason(order.getFailReason()); update.setOrderVerifyTime(order.getOrderVerifyTime()); update.setOrderGroupSuccessTime(order.getOrderGroupSuccessTime()); update.setOrderModifyAt(order.getOrderModifyAt()); update.setOrderPayTime(order.getOrderPayTime()); update.setOrderSettleTime(order.getOrderSettleTime()); update.setGoodsName(order.getGoodsName()); update.setGoodsPrice(order.getGoodsPrice()); update.setUpdateTime(new Date()); update.setOrderReceiveTime(order.getOrderReceiveTime()); pddOrderMapper.updateByPrimaryKeySelective(update); return pddOrderMapper.selectByPrimaryKey(old.getId()); } } else { if (order.getUpdateTime() == null) order.setUpdateTime(new Date()); if (order.getCreateTime() == null) order.setCreateTime(new Date()); pddOrderMapper.insertSelective(order); } return order; } return order; } @Override public List<PDDOrder> selectByOrderSn(String orderSn) { List<PDDOrder> pddList = new ArrayList<>(); PDDOrder pddOrder = pddOrderMapper.selectByOrderSN(orderSn); if (pddOrder != null) pddList.add(pddOrder); return pddList; } @Override public List<PDDOrder> selectByOrderSn(String orderSn) { List<PDDOrder> pddList = new ArrayList<>(); PDDOrder pddOrder = pddOrderMapper.selectByOrderSN(orderSn); if (pddOrder != null) pddList.add(pddOrder); return pddList; } @Override public List<PDDOrder> listByStatus(Integer status, int page, int pageSize) { return pddOrderMapper.listByStatus(status, (page - 1) * pageSize, pageSize); } @Override public List<PDDOrder> listByOrderSns(List<String> orderSnList) { if (orderSnList == null || orderSnList.size() == 0) return new ArrayList<>(); return pddOrderMapper.listByOrderSn(orderSnList); } @Override public Long countOrderByDay(String preDay) { return pddOrderMapper.countOrderByDay(preDay); } @Override public List<PDDOrder> listQuery(long start, int count, String key) { return pddOrderMapper.listQuery(start, count, key); } @Override public long countQuery(String key) { Long count = pddOrderMapper.countQuery(key); if (count == null) { count = 0L; } return count; } @Override public List<PDDOrder> listByStatus(Integer status, int page, int pageSize) { return pddOrderMapper.listByStatus(status, (page - 1) * pageSize, pageSize); } @Override public Long countOrderByDay(String preDay) { return pddOrderMapper.countOrderByDay(preDay); } @Override public List<PDDOrder> listQuery(long start, int count, String key) { return pddOrderMapper.listQuery(start, count, key); } @Override public long countQuery(String key) { Long count = pddOrderMapper.countQuery(key); if (count == null) { count = 0L; } return count; } } fanli/src/main/java/com/yeshi/fanli/service/inter/order/pdd/PDDOrderService.java
@@ -24,6 +24,14 @@ */ public List<PDDOrder> selectByOrderSn(String orderSn); /** * 根据订单查询 * @param orderSnList * @return */ public List<PDDOrder> listByOrderSns(List<String> orderSnList); /** * 根据状态查询 * @param status fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java
@@ -47,1053 +47,1047 @@ /** * 商品加工 * * @author Administrator * * @author Administrator */ public class GoodsDetailVOFactory { /** * 淘宝商品组织 * * @param goods * 淘宝商品 * @param pid * @param fanLiRate * 返利比例 * @return */ public static GoodsDetailVO convertCommonGoods(CommonGoods goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setGoodsId(goods.getGoodsId() + ""); goodsInfo.setTitle(goods.getTitle()); /** * 淘宝商品组织 * * @param goods 淘宝商品 * @param pid * @param fanLiRate 返利比例 * @return */ public static GoodsDetailVO convertCommonGoods(CommonGoods goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setGoodsId(goods.getGoodsId() + ""); goodsInfo.setTitle(goods.getTitle()); Integer shopType = goods.getShopType(); if (shopType == null) { goodsInfo.setShopType(10); // 淘宝 goodsInfo.setPriceName("淘宝价"); } else if (shopType == 1) { goodsInfo.setShopType(10); // 淘宝 goodsInfo.setPriceName("淘宝价"); } else if (shopType == 2) { goodsInfo.setShopType(11); // 天猫 goodsInfo.setPriceName("天猫价"); } else { goodsInfo.setShopType(goods.getShopType()); } Integer shopType = goods.getShopType(); if (shopType == null) { goodsInfo.setShopType(10); // 淘宝 goodsInfo.setPriceName("淘宝价"); } else if (shopType == 1) { goodsInfo.setShopType(10); // 淘宝 goodsInfo.setPriceName("淘宝价"); } else if (shopType == 2) { goodsInfo.setShopType(11); // 天猫 goodsInfo.setPriceName("天猫价"); } else { goodsInfo.setShopType(goods.getShopType()); } Integer goodsType = goods.getGoodsType(); if (goodsType == null) { goodsType = Constant.SOURCE_TYPE_TAOBAO; } Integer goodsType = goods.getGoodsType(); if (goodsType == null) { goodsType = Constant.SOURCE_TYPE_TAOBAO; } GoodsOtherInfoDTO otherDTO = null; String otherInfo = goods.getOtherInfo(); if (!StringUtil.isNullOrEmpty(otherInfo)) { JSONObject json = JSONObject.fromObject(otherInfo); otherDTO = (GoodsOtherInfoDTO) JSONObject.toBean(json, GoodsOtherInfoDTO.class); } GoodsOtherInfoDTO otherDTO = null; String otherInfo = goods.getOtherInfo(); if (!StringUtil.isNullOrEmpty(otherInfo)) { JSONObject json = JSONObject.fromObject(otherInfo); otherDTO = (GoodsOtherInfoDTO) JSONObject.toBean(json, GoodsOtherInfoDTO.class); } if (goodsType == Constant.SOURCE_TYPE_JD) { // 月销量 goodsInfo.setSalesType(1); if (goodsType == Constant.SOURCE_TYPE_JD) { // 月销量 goodsInfo.setSalesType(1); Integer isFreeShipping = otherDTO.getIsFreeShipping(); if (isFreeShipping != null && isFreeShipping == 1) { goodsInfo.setBaoyou(true); } Integer isFreeShipping = otherDTO.getIsFreeShipping(); if (isFreeShipping != null && isFreeShipping == 1) { goodsInfo.setBaoyou(true); } List<ClientTextStyleVO> labels = goodsInfo.getLabels(); // 自营 String owner = otherDTO.getOwner(); if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) { if (labels == null) { labels = new ArrayList<ClientTextStyleVO>(); } ClientTextStyleVO textStyleVO = new ClientTextStyleVO(); textStyleVO.setContent("京东自营"); textStyleVO.setColor("#E42219"); labels.add(textStyleVO); } // 拼团价 JDPingouInfo pinGouInfo = otherDTO.getPinGouInfo(); if (pinGouInfo != null) { goods.setPrice(pinGouInfo.getPingouPrice()); goodsInfo.setPriceName("拼购价"); List<ClientTextStyleVO> labels = goodsInfo.getLabels(); // 自营 String owner = otherDTO.getOwner(); if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) { if (labels == null) { labels = new ArrayList<ClientTextStyleVO>(); } ClientTextStyleVO textStyleVO = new ClientTextStyleVO(); textStyleVO.setContent("京东自营"); textStyleVO.setColor("#E42219"); labels.add(textStyleVO); } // 拼团价 JDPingouInfo pinGouInfo = otherDTO.getPinGouInfo(); if (pinGouInfo != null) { goods.setPrice(pinGouInfo.getPingouPrice()); goodsInfo.setPriceName("拼购价"); if (labels == null) { labels = new ArrayList<ClientTextStyleVO>(); } ClientTextStyleVO textStyleVO = new ClientTextStyleVO(); textStyleVO.setContent("拼购"); textStyleVO.setColor("#E42219"); labels.add(textStyleVO); } else { goodsInfo.setPriceName("京东价"); } goodsInfo.setLabels(labels); } else if (goodsType == Constant.SOURCE_TYPE_PDD) { goodsInfo.setSalesType(4); // 总销量 goodsInfo.setPriceName("拼团价"); goodsInfo.setBaoyou(true); } else if (goodsType == Constant.SOURCE_TYPE_SUNING) { goodsInfo.setSalesType(1); goodsInfo.setGoodsId(SuningUtil.getConcatGoodsIId(SuningUtil.getFullSupplierCode(goods.getSellerId() + ""), goods.getGoodsId() + "")); } else { goodsInfo.setSalesType(1); // 月销量 goodsInfo.setBaoyou(true); } if (labels == null) { labels = new ArrayList<ClientTextStyleVO>(); } ClientTextStyleVO textStyleVO = new ClientTextStyleVO(); textStyleVO.setContent("拼购"); textStyleVO.setColor("#E42219"); labels.add(textStyleVO); } else { goodsInfo.setPriceName("京东价"); } goodsInfo.setLabels(labels); } else if (goodsType == Constant.SOURCE_TYPE_PDD) { goodsInfo.setSalesType(4); // 总销量 goodsInfo.setPriceName("拼团价"); goodsInfo.setBaoyou(true); } else if (goodsType == Constant.SOURCE_TYPE_SUNING) { goodsInfo.setSalesType(1); goodsInfo.setGoodsId(SuningUtil.getConcatGoodsIId(SuningUtil.getFullSupplierCode(goods.getSellerId() + ""), goods.getGoodsId() + "")); } else { goodsInfo.setSalesType(1); // 月销量 goodsInfo.setBaoyou(true); } if (goodsType == Constant.SOURCE_TYPE_VIP) { goodsInfo.setDiscount(goods.getCouponInfo()); goodsInfo.setPriceName("折后价"); goodsInfo.setCouponPrice(goods.getCouponStartPrice()); } if (goodsType == Constant.SOURCE_TYPE_VIP) { goodsInfo.setDiscount(goods.getCouponInfo()); goodsInfo.setPriceName("折后价"); goodsInfo.setCouponPrice(goods.getCouponStartPrice()); } goodsInfo.setGoodsType(goodsType); goodsInfo.setZkPrice(goods.getPrice()); Integer state = goods.getState(); if (state == null) { goodsInfo.setState(0); } else { goodsInfo.setState(goods.getState()); } goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getSales())); goodsInfo.setGoodsType(goodsType); goodsInfo.setZkPrice(goods.getPrice()); Integer state = goods.getState(); if (state == null) { goodsInfo.setState(0); } else { goodsInfo.setState(goods.getState()); } goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getSales())); if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { // 使用白底图 if (!StringUtil.isNullOrEmpty(goods.getPictureWhite())) { goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictureWhite())); } else { goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPicture())); } } else { goodsInfo.setPicUrl(goods.getPicture()); } if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { // 使用白底图 if (!StringUtil.isNullOrEmpty(goods.getPictureWhite())) { goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictureWhite())); } else { goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPicture())); } } else { goodsInfo.setPicUrl(goods.getPicture()); } // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 BigDecimal commission = CommonGoodsUtil.getCommission(goods, params.getFanLiRate()); moneyInfoVO.setFanliMoney("¥" + commission); BigDecimal commission = CommonGoodsUtil.getCommission(goods, params.getFanLiRate()); moneyInfoVO.setFanliMoney("¥" + commission); BigDecimal maxCommission = CommonGoodsUtil.getCommission(goods, params.getVipFanLiRate()); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else moneyInfoVO.setMaxMoney("¥" + maxCommission); BigDecimal maxCommission = CommonGoodsUtil.getCommission(goods, params.getVipFanLiRate()); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else moneyInfoVO.setMaxMoney("¥" + maxCommission); moneyInfoVO.setShareMoney(CommonGoodsUtil.getCommissionInfo(goods, params.getShareRate())); moneyInfoVO.setShareMoney(CommonGoodsUtil.getCommissionInfo(goods, params.getShareRate())); moneyInfoVO.setRateInfo("返利比 " + MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), CommonGoodsUtil.getAfterUseCouplePrice(goods)) + "%"); moneyInfoVO.setRateInfo("返利比 " + MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), CommonGoodsUtil.getAfterUseCouplePrice(goods)) + "%"); moneyInfoVO.setMaxRateInfo("返利比 " + MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), CommonGoodsUtil.getAfterUseCouplePrice(goods)) + "%"); moneyInfoVO.setMaxRateInfo("返利比 " + MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), CommonGoodsUtil.getAfterUseCouplePrice(goods)) + "%"); goodsInfo.setMoneyInfo(moneyInfoVO); goodsInfo.setMoneyInfo(moneyInfoVO); // 券信息 if (goods.getCouponAmount() != null && goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) { // 计算券后价 BigDecimal sub = goods.getPrice().subtract(goods.getCouponStartPrice()); if (sub.compareTo(BigDecimal.valueOf(0)) >= 0) { BigDecimal quanPrice = MoneyBigDecimalUtil.sub(goods.getPrice(), goods.getCouponAmount()); goodsInfo.setCouponPrice(quanPrice); } else { goodsInfo.setCouponPrice(goods.getPrice()); } // 券信息 if (goods.getCouponAmount() != null && goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) { // 计算券后价 BigDecimal sub = goods.getPrice().subtract(goods.getCouponStartPrice()); if (sub.compareTo(BigDecimal.valueOf(0)) >= 0) { BigDecimal quanPrice = MoneyBigDecimalUtil.sub(goods.getPrice(), goods.getCouponAmount()); goodsInfo.setCouponPrice(quanPrice); } else { goodsInfo.setCouponPrice(goods.getPrice()); } CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(goods.getCouponAmount()); coupon.setLeftCount(goods.getCouponLeftCount()); coupon.setTotalCount(goods.getCouponTotalCount()); coupon.setStartFee(goods.getCouponStartPrice()); goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); } CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(goods.getCouponAmount()); coupon.setLeftCount(goods.getCouponLeftCount()); coupon.setTotalCount(goods.getCouponTotalCount()); coupon.setStartFee(goods.getCouponStartPrice()); goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); } // 店铺信息 if (!StringUtil.isNullOrEmpty(goods.getSellerName())) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(goods.getSellerName()); // 店铺信息 if (!StringUtil.isNullOrEmpty(goods.getSellerName())) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(goods.getSellerName()); if (goods.getSellerId() != null) shop.setId(goods.getSellerId().toString()); if (goods.getSellerId() != null) shop.setId(goods.getSellerId().toString()); if (shopType == null || shopType == 0) { shop.setUserType(10); } else if (shopType == 1) { shop.setUserType(11); } else { shop.setUserType(goods.getShopType()); } if (shopType == null || shopType == 0) { shop.setUserType(10); } else if (shopType == 1) { shop.setUserType(11); } else { shop.setUserType(goods.getShopType()); } goodsInfo.setShopInfo(shop); } goodsInfo.setShopInfo(shop); } if (goodsType == Constant.SOURCE_TYPE_VIP) { goodsInfo.setShopInfo(null); } if (goodsType == Constant.SOURCE_TYPE_VIP) { goodsInfo.setShopInfo(null); } // if (Constant.IS_TEST) { // // 添加标签 // List<ClientTextStyleVO> labels = goodsInfo.getLabels(); // if (labels == null) // labels = new ArrayList<>(); // // labels.add(new ClientTextStyleVO("预售", "#FF2B4E")); // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E")); // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E")); // goodsInfo.setLabels(labels); // } // if (Constant.IS_TEST) { // // 添加标签 // List<ClientTextStyleVO> labels = goodsInfo.getLabels(); // if (labels == null) // labels = new ArrayList<>(); // // labels.add(new ClientTextStyleVO("预售", "#FF2B4E")); // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E")); // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E")); // goodsInfo.setLabels(labels); // } return goodsInfo; } return goodsInfo; } /** * 淘宝商品组织 * * @param goods * 淘宝商品 * @param pid * @param fanLiRate * 返利比例 * @return */ public static GoodsDetailVO convertTaoBaoGoodsBriefExtra(TaoBaoGoodsBriefExtra goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setBaoyou(true); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_TAOBAO); goodsInfo.setGoodsId(goods.getAuctionId() + ""); goodsInfo.setTitle(goods.getTitle()); goodsInfo.setSalesType(1); // 默认月销量 goodsInfo.setZkPrice(goods.getZkPrice()); goodsInfo.setImgList(goods.getImgList()); goodsInfo.setState(goods.getState() == null ? 0 : goods.getState()); goodsInfo.setSalesCount(goods.getSalesCount()); goodsInfo.setPicUrl(goods.getPictUrl()); goodsInfo.setDescription(goods.getDescription()); /** * 淘宝商品组织 * * @param goods 淘宝商品 * @param pid * @param fanLiRate 返利比例 * @return */ public static GoodsDetailVO convertTaoBaoGoodsBriefExtra(TaoBaoGoodsBriefExtra goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setBaoyou(true); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_TAOBAO); goodsInfo.setGoodsId(goods.getAuctionId() + ""); goodsInfo.setTitle(goods.getTitle()); goodsInfo.setSalesType(1); // 默认月销量 goodsInfo.setZkPrice(goods.getZkPrice()); goodsInfo.setImgList(goods.getImgList()); goodsInfo.setState(goods.getState() == null ? 0 : goods.getState()); goodsInfo.setSalesCount(goods.getSalesCount()); goodsInfo.setPicUrl(goods.getPictUrl()); goodsInfo.setDescription(goods.getDescription()); Integer shopType = goods.getUserType(); if (shopType != null && shopType == 1) { goodsInfo.setShopType(11); // 天猫 goodsInfo.setPriceName("天猫价"); } else { goodsInfo.setShopType(10); // 淘宝 goodsInfo.setPriceName("淘宝价"); } Integer shopType = goods.getUserType(); if (shopType != null && shopType == 1) { goodsInfo.setShopType(11); // 天猫 goodsInfo.setPriceName("天猫价"); } else { goodsInfo.setShopType(10); // 淘宝 goodsInfo.setPriceName("淘宝价"); } // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 if (goods.getTkRate() == null) { TaoBaoHongBaoInfo taoBaoHongBaoInfo = goods.getTaoBaoHongBaoInfo(); moneyInfoVO.setFanliMoney("¥" + taoBaoHongBaoInfo.getHongbao()); moneyInfoVO.setShareMoney("¥" + taoBaoHongBaoInfo.getHongbao()); if (params.getMaxRewardRate() != null) moneyInfoVO.setMaxMoney("¥" + taoBaoHongBaoInfo.getHongbao() .add(MoneyBigDecimalUtil.mul(taoBaoHongBaoInfo.getHongbao(), params.getMaxRewardRate()))); else moneyInfoVO.setMaxMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false)); } else { BigDecimal commission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getFanLiRate(), false); moneyInfoVO.setFanliMoney("¥" + commission); if (params.getMaxRewardRate() != null) moneyInfoVO.setMaxMoney( "¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else moneyInfoVO.setMaxMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false)); moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, params.getShareRate(), true)); } goodsInfo.setMoneyInfo(moneyInfoVO); if (goods.getTkRate() == null) { TaoBaoHongBaoInfo taoBaoHongBaoInfo = goods.getTaoBaoHongBaoInfo(); moneyInfoVO.setFanliMoney("¥" + taoBaoHongBaoInfo.getHongbao()); moneyInfoVO.setShareMoney("¥" + taoBaoHongBaoInfo.getHongbao()); if (params.getMaxRewardRate() != null) moneyInfoVO.setMaxMoney("¥" + taoBaoHongBaoInfo.getHongbao() .add(MoneyBigDecimalUtil.mul(taoBaoHongBaoInfo.getHongbao(), params.getMaxRewardRate()))); else moneyInfoVO.setMaxMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false)); } else { BigDecimal commission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getFanLiRate(), false); moneyInfoVO.setFanliMoney("¥" + commission); if (params.getMaxRewardRate() != null) moneyInfoVO.setMaxMoney( "¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else moneyInfoVO.setMaxMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false)); moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, params.getShareRate(), true)); } goodsInfo.setMoneyInfo(moneyInfoVO); TaoBaoQuanInfo taoBaoQuanInfo = goods.getTaoBaoQuanInfo(); if (taoBaoQuanInfo != null) { goodsInfo.setCouponPrice(taoBaoQuanInfo.getCouponPrice()); CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(taoBaoQuanInfo.getCouponAmount()); coupon.setLeftCount(taoBaoQuanInfo.getCouponLeftCount()); coupon.setTotalCount(taoBaoQuanInfo.getCouponTotalCount()); TaoBaoQuanInfo taoBaoQuanInfo = goods.getTaoBaoQuanInfo(); if (taoBaoQuanInfo != null) { goodsInfo.setCouponPrice(taoBaoQuanInfo.getCouponPrice()); CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(taoBaoQuanInfo.getCouponAmount()); coupon.setLeftCount(taoBaoQuanInfo.getCouponLeftCount()); coupon.setTotalCount(taoBaoQuanInfo.getCouponTotalCount()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); String couponEffectiveEndTime = taoBaoQuanInfo.getCouponEffectiveEndTime(); String couponEffectiveStartTime = taoBaoQuanInfo.getCouponEffectiveStartTime(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); String couponEffectiveEndTime = taoBaoQuanInfo.getCouponEffectiveEndTime(); String couponEffectiveStartTime = taoBaoQuanInfo.getCouponEffectiveStartTime(); coupon.setEndTime(sdf.format(new Date(Long.parseLong(couponEffectiveEndTime)))); coupon.setStartTime(sdf.format(new Date(Long.parseLong(couponEffectiveStartTime)))); coupon.setLink(taoBaoQuanInfo.getCouponLink()); coupon.setStartFee(taoBaoQuanInfo.getCouponStartFee()); coupon.setShopCoupon(goods.isShopCoupon()); goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); } coupon.setEndTime(sdf.format(new Date(Long.parseLong(couponEffectiveEndTime)))); coupon.setStartTime(sdf.format(new Date(Long.parseLong(couponEffectiveStartTime)))); coupon.setLink(taoBaoQuanInfo.getCouponLink()); coupon.setStartFee(taoBaoQuanInfo.getCouponStartFee()); coupon.setShopCoupon(goods.isShopCoupon()); goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); } // 店铺信息 String shopTitle = goods.getShopTitle(); // 店铺信息 String shopTitle = goods.getShopTitle(); if (!StringUtil.isNullOrEmpty(shopTitle)) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(shopTitle); if (!StringUtil.isNullOrEmpty(shopTitle)) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(shopTitle); Long sellerId = goods.getSellerId(); if (sellerId != null) shop.setId(goods.getSellerId().toString()); Long sellerId = goods.getSellerId(); if (sellerId != null) shop.setId(goods.getSellerId().toString()); if (shopType != null && shopType == 1) { shop.setUserType(11); } else { shop.setUserType(10); } goodsInfo.setShopInfo(shop); } if (shopType != null && shopType == 1) { shop.setUserType(11); } else { shop.setUserType(10); } goodsInfo.setShopInfo(shop); } // if (Constant.IS_TEST) { // // 添加标签 // List<ClientTextStyleVO> labels = goodsInfo.getLabels(); // if (labels == null) // labels = new ArrayList<>(); // // labels.add(new ClientTextStyleVO("预售", "#FF2B4E")); // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E")); // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E")); // goodsInfo.setLabels(labels); // } // if (Constant.IS_TEST) { // // 添加标签 // List<ClientTextStyleVO> labels = goodsInfo.getLabels(); // if (labels == null) // labels = new ArrayList<>(); // // labels.add(new ClientTextStyleVO("预售", "#FF2B4E")); // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E")); // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E")); // goodsInfo.setLabels(labels); // } return goodsInfo; } return goodsInfo; } /** * 淘宝商品组织 * * @param goods * 淘宝商品 * @param pid * @param fanLiRate * 返利比例 * @return */ public static GoodsDetailVO convertTaoBao(TaoBaoGoodsBrief goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setBaoyou(true); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_TAOBAO); goodsInfo.setGoodsId(goods.getAuctionId() + ""); goodsInfo.setTitle(goods.getTitle()); goodsInfo.setSalesType(1); // 默认月销量 goodsInfo.setZkPrice(goods.getZkPrice()); goodsInfo.setDescription(goods.getDescription()); /** * 淘宝商品组织 * * @param goods 淘宝商品 * @param pid * @param fanLiRate 返利比例 * @return */ public static GoodsDetailVO convertTaoBao(TaoBaoGoodsBrief goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setBaoyou(true); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_TAOBAO); goodsInfo.setGoodsId(goods.getAuctionId() + ""); goodsInfo.setTitle(goods.getTitle()); goodsInfo.setSalesType(1); // 默认月销量 goodsInfo.setZkPrice(goods.getZkPrice()); goodsInfo.setDescription(goods.getDescription()); String provcity = goods.getProvcity(); if (!StringUtil.isNullOrEmpty(provcity)) { String[] arr = provcity.split("\\s+"); goodsInfo.setProvcity(arr[arr.length - 1]); } String provcity = goods.getProvcity(); if (!StringUtil.isNullOrEmpty(provcity)) { String[] arr = provcity.split("\\s+"); goodsInfo.setProvcity(arr[arr.length - 1]); } List<String> imgList = goods.getImgList(); if (imgList != null) { goodsInfo.setImgList(imgList); } else { imgList = new ArrayList<String>(); imgList.add(goods.getPictUrl()); goodsInfo.setImgList(imgList); } List<String> imgList = goods.getImgList(); if (imgList != null) { goodsInfo.setImgList(imgList); } else { imgList = new ArrayList<String>(); imgList.add(goods.getPictUrl()); goodsInfo.setImgList(imgList); } Integer state = goods.getState(); if (state == null) { goodsInfo.setState(0); } else { goodsInfo.setState(state); } Integer state = goods.getState(); if (state == null) { goodsInfo.setState(0); } else { goodsInfo.setState(state); } goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getBiz30day())); goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getBiz30day())); // 白底图可能有错误 // https://img.alicdn.com/bao/uploaded/TB1LVqmVZbpK1RjSZFyXXX_qFXa.png if (!StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) { goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictUrlWhite())); } else { goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictUrl())); } // 白底图可能有错误 // https://img.alicdn.com/bao/uploaded/TB1LVqmVZbpK1RjSZFyXXX_qFXa.png if (!StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) { goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictUrlWhite())); } else { goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictUrl())); } Integer shopType = goods.getUserType(); if (shopType != null && shopType == 1) { goodsInfo.setShopType(11); // 天猫 goodsInfo.setPriceName("天猫价"); } else { goodsInfo.setShopType(10); // 淘宝 goodsInfo.setPriceName("淘宝价"); } Integer shopType = goods.getUserType(); if (shopType != null && shopType == 1) { goodsInfo.setShopType(11); // 天猫 goodsInfo.setPriceName("天猫价"); } else { goodsInfo.setShopType(10); // 淘宝 goodsInfo.setPriceName("淘宝价"); } // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 BigDecimal buyCommission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getFanLiRate(), false); BigDecimal buyCommission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getFanLiRate(), false); BigDecimal baseCommisstion = null; if (params.getBaseFanliRate() != null) baseCommisstion = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getBaseFanliRate(), false); moneyInfoVO.setFanliMoney("¥" + buyCommission); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + buyCommission.add(MoneyBigDecimalUtil.mul(buyCommission, params.getMaxRewardRate()))); else {// 只有有VIP后的版本才会显示返利比 BigDecimal baseCommisstion = null; if (params.getBaseFanliRate() != null) baseCommisstion = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getBaseFanliRate(), false); moneyInfoVO.setFanliMoney("¥" + buyCommission); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + buyCommission.add(MoneyBigDecimalUtil.mul(buyCommission, params.getMaxRewardRate()))); else {// 只有有VIP后的版本才会显示返利比 BigDecimal price = TaoBaoUtil.getAfterUseCouplePrice(goods); BigDecimal rate = MoneyBigDecimalUtil.div(buyCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setRateInfo("返利比 " + rate + "%"); BigDecimal price = TaoBaoUtil.getAfterUseCouplePrice(goods); BigDecimal rate = MoneyBigDecimalUtil.div(buyCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setRateInfo("返利比 " + rate + "%"); BigDecimal maxCommission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false); BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); moneyInfoVO.setMaxMoney("¥" + maxCommission); if (baseCommisstion != null) { String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), buyCommission.subtract(baseCommisstion).setScale(2).toString()); String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), maxCommission.subtract(baseCommisstion).setScale(2).toString()); moneyInfoVO.setCompositionInfo(desc); moneyInfoVO.setMaxCompositionInfo(maxDesc); } } BigDecimal maxCommission = TaoBaoUtil.getGoodsHongBaoMoney(goods, params.getVipFanLiRate(), false); BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); moneyInfoVO.setMaxMoney("¥" + maxCommission); if (baseCommisstion != null) { String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), buyCommission.subtract(baseCommisstion).setScale(2).toString()); String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), maxCommission.subtract(baseCommisstion).setScale(2).toString()); moneyInfoVO.setCompositionInfo(desc); moneyInfoVO.setMaxCompositionInfo(maxDesc); } } moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, params.getShareRate(), true)); moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, params.getShareRate(), true)); goodsInfo.setMoneyInfo(moneyInfoVO); goodsInfo.setMoneyInfo(moneyInfoVO); // 券信息 if (goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) { // 计算券后价 BigDecimal sub = goods.getZkPrice().subtract(goods.getCouponStartFee()); if (sub.compareTo(BigDecimal.valueOf(0)) >= 0) { BigDecimal quanPrice = MoneyBigDecimalUtil.sub(goods.getZkPrice(), goods.getCouponAmount()); goodsInfo.setCouponPrice(quanPrice); } else { goodsInfo.setCouponPrice(goods.getZkPrice()); } // 券信息 if (goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) { // 计算券后价 BigDecimal sub = goods.getZkPrice().subtract(goods.getCouponStartFee()); if (sub.compareTo(BigDecimal.valueOf(0)) >= 0) { BigDecimal quanPrice = MoneyBigDecimalUtil.sub(goods.getZkPrice(), goods.getCouponAmount()); goodsInfo.setCouponPrice(quanPrice); } else { goodsInfo.setCouponPrice(goods.getZkPrice()); } CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(goods.getCouponAmount()); coupon.setLeftCount(goods.getCouponLeftCount()); coupon.setTotalCount(goods.getCouponTotalCount()); if (goods.getCouponEffectiveEndTime() != null) { coupon.setEndTime(goods.getCouponEffectiveEndTime().replace("-", ".")); } CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(goods.getCouponAmount()); coupon.setLeftCount(goods.getCouponLeftCount()); coupon.setTotalCount(goods.getCouponTotalCount()); if (goods.getCouponEffectiveEndTime() != null) { coupon.setEndTime(goods.getCouponEffectiveEndTime().replace("-", ".")); } if (goods.getCouponEffectiveStartTime() != null) { coupon.setStartTime(goods.getCouponEffectiveStartTime().replace("-", ".")); } if (goods.getCouponEffectiveStartTime() != null) { coupon.setStartTime(goods.getCouponEffectiveStartTime().replace("-", ".")); } if (!StringUtil.isNullOrEmpty(goods.getCouponLink())) coupon.setLink(goods.getCouponLink()); else coupon.setLink( TaoBaoCouponUtil.getCoupleUrl(goods.getCouponActivityId(), null, goods.getAuctionId() + "")); coupon.setStartFee(goods.getCouponStartFee()); coupon.setShopCoupon(goods.isShopCoupon()); goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); } if (!StringUtil.isNullOrEmpty(goods.getCouponLink())) coupon.setLink(goods.getCouponLink()); else coupon.setLink( TaoBaoCouponUtil.getCoupleUrl(goods.getCouponActivityId(), null, goods.getAuctionId() + "")); coupon.setStartFee(goods.getCouponStartFee()); coupon.setShopCoupon(goods.isShopCoupon()); goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); } // 店铺信息 if (!StringUtil.isNullOrEmpty(goods.getShopTitle())) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(goods.getShopTitle()); // 店铺信息 if (!StringUtil.isNullOrEmpty(goods.getShopTitle())) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(goods.getShopTitle()); if (goods.getSellerId() != null) shop.setId(goods.getSellerId().toString()); if (goods.getSellerId() != null) shop.setId(goods.getSellerId().toString()); if (shopType != null && shopType == 1) { shop.setUserType(11); } else { shop.setUserType(10); } if (shopType != null && shopType == 1) { shop.setUserType(11); } else { shop.setUserType(10); } goodsInfo.setShopInfo(shop); } goodsInfo.setShopInfo(shop); } if (TaoBaoUtil.isYUShou(goods)) {// 预售商品 goodsInfo = loadYuShouInfo(goodsInfo, goods, null, params.getFanLiRate(), params.getShareRate()); } if (TaoBaoUtil.isYUShou(goods)) {// 预售商品 goodsInfo = loadYuShouInfo(goodsInfo, goods, null, params.getFanLiRate(), params.getShareRate()); } if (Constant.IS_TEST) { // 添加标签 List<ClientTextStyleVO> labels = goodsInfo.getLabels(); if (labels == null) labels = new ArrayList<>(); if (Constant.IS_TEST) { // 添加标签 List<ClientTextStyleVO> labels = goodsInfo.getLabels(); if (labels == null) labels = new ArrayList<>(); labels.add(new ClientTextStyleVO("预售", "#FF2B4E")); labels.add(new ClientTextStyleVO("爆款", "#FF2B4E")); labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E")); goodsInfo.setLabels(labels); } labels.add(new ClientTextStyleVO("预售", "#FF2B4E")); labels.add(new ClientTextStyleVO("爆款", "#FF2B4E")); labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E")); goodsInfo.setLabels(labels); } return goodsInfo; } return goodsInfo; } private static GoodsDetailVO loadYuShouInfo(GoodsDetailVO goodsInfo, TaoBaoGoodsBrief goods, String pid, BigDecimal fanLiRate, BigDecimal shareRate) { private static GoodsDetailVO loadYuShouInfo(GoodsDetailVO goodsInfo, TaoBaoGoodsBrief goods, String pid, BigDecimal fanLiRate, BigDecimal shareRate) { if (goodsInfo != null && goods != null) { // 添加标签 if (goodsInfo.getLabels() == null) goodsInfo.setLabels(new ArrayList<>()); goodsInfo.getLabels().add(new ClientTextStyleVO("预售", "#FF2B4E")); } return goodsInfo; } if (goodsInfo != null && goods != null) { // 添加标签 if (goodsInfo.getLabels() == null) goodsInfo.setLabels(new ArrayList<>()); goodsInfo.getLabels().add(new ClientTextStyleVO("预售", "#FF2B4E")); } return goodsInfo; } private static CouponInfoVO convertJDCouponInfo(JDCouponInfo couponInfo) { CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(couponInfo.getDiscount()); coupon.setLink(couponInfo.getLink()); coupon.setStartFee(couponInfo.getQuota()); private static CouponInfoVO convertJDCouponInfo(JDCouponInfo couponInfo) { CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(couponInfo.getDiscount()); coupon.setLink(couponInfo.getLink()); coupon.setStartFee(couponInfo.getQuota()); if (couponInfo.getGetStartTime() != null) { coupon.setStartTime(TimeUtil.getGernalTime(couponInfo.getGetStartTime(), "yyyy.MM.dd")); } if (couponInfo.getGetStartTime() != null) { coupon.setStartTime(TimeUtil.getGernalTime(couponInfo.getGetStartTime(), "yyyy.MM.dd")); } if (couponInfo.getGetEndTime() != null) { coupon.setEndTime(TimeUtil.getGernalTime(couponInfo.getGetEndTime(), "yyyy.MM.dd")); } if (couponInfo.getGetEndTime() != null) { coupon.setEndTime(TimeUtil.getGernalTime(couponInfo.getGetEndTime(), "yyyy.MM.dd")); } return coupon; } return coupon; } private static List<CouponInfoVO> filterCouponInfo(List<CouponInfoVO> couponList) { if (couponList == null) return null; long currentTime = System.currentTimeMillis(); Set<String> sets = new HashSet<>(); // 过滤掉过期券 for (int i = 0; i < couponList.size(); i++) { if (couponList.get(i).getStartTime() != null && couponList.get(i).getEndTime() != null) { long startTime = TimeUtil.convertToTimeTemp(couponList.get(i).getStartTime(), "yyyy.MM.dd"); long endTime = TimeUtil.convertToTimeTemp(couponList.get(i).getEndTime(), "yyyy.MM.dd") + 1000 * 60 * 60 * 24L; if (currentTime < startTime || currentTime >= endTime) { couponList.remove(i--); continue; } } // 过滤掉面值相同与起始金额相同的 String key = couponList.get(i).getStartFee() + "-" + couponList.get(i).getAmount(); if (!sets.contains(key)) sets.add(key); else { couponList.remove(i--); continue; } } return couponList; } private static List<CouponInfoVO> filterCouponInfo(List<CouponInfoVO> couponList) { if (couponList == null) return null; long currentTime = System.currentTimeMillis(); Set<String> sets = new HashSet<>(); // 过滤掉过期券 for (int i = 0; i < couponList.size(); i++) { if (couponList.get(i).getStartTime() != null && couponList.get(i).getEndTime() != null) { long startTime = TimeUtil.convertToTimeTemp(couponList.get(i).getStartTime(), "yyyy.MM.dd"); long endTime = TimeUtil.convertToTimeTemp(couponList.get(i).getEndTime(), "yyyy.MM.dd") + 1000 * 60 * 60 * 24L; if (currentTime < startTime || currentTime >= endTime) { couponList.remove(i--); continue; } } // 过滤掉面值相同与起始金额相同的 String key = couponList.get(i).getStartFee() + "-" + couponList.get(i).getAmount(); if (!sets.contains(key)) sets.add(key); else { couponList.remove(i--); continue; } } return couponList; } /** * 淘宝商品组织 * * @param goods 淘宝商品 * @param pid * @param fanLiRate 返利比例 * @return */ public static GoodsDetailVO convertJDGoods(JDGoods goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_JD); goodsInfo.setGoodsId(goods.getSkuId() + ""); goodsInfo.setTitle(goods.getSkuName()); goodsInfo.setSalesType(1); // 默认月销量 goodsInfo.setPicUrl(goods.getPicUrl()); goodsInfo.setImgList(goods.getImageList()); goodsInfo.setState(0); /** * 淘宝商品组织 * * @param goods * 淘宝商品 * @param pid * @param fanLiRate * 返利比例 * @return */ public static GoodsDetailVO convertJDGoods(JDGoods goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_JD); goodsInfo.setGoodsId(goods.getSkuId() + ""); goodsInfo.setTitle(goods.getSkuName()); goodsInfo.setSalesType(1); // 默认月销量 goodsInfo.setPicUrl(goods.getPicUrl()); goodsInfo.setImgList(goods.getImageList()); goodsInfo.setState(0); String salesCountMidea = null; Long count = goods.getInOrderCount30Days(); if (count < 10000) { salesCountMidea = count + ""; } else { double sales = count; salesCountMidea = String.format("%.1f", sales / 10000); salesCountMidea = salesCountMidea + "万"; } goodsInfo.setSalesCount(salesCountMidea); String salesCountMidea = null; Long count = goods.getInOrderCount30Days(); if (count < 10000) { salesCountMidea = count + ""; } else { double sales = count; salesCountMidea = String.format("%.1f", sales / 10000); salesCountMidea = salesCountMidea + "万"; } goodsInfo.setSalesCount(salesCountMidea); // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 BigDecimal commission = JDUtil.getGoodsFanLiMoney(goods, params.getFanLiRate()); moneyInfoVO.setFanliMoney("¥" + commission); BigDecimal baseCommisstion = null; if (params.getBaseFanliRate() != null) baseCommisstion = JDUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate()); // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 BigDecimal commission = JDUtil.getGoodsFanLiMoney(goods, params.getFanLiRate()); moneyInfoVO.setFanliMoney("¥" + commission); BigDecimal baseCommisstion = null; if (params.getBaseFanliRate() != null) baseCommisstion = JDUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate()); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else { BigDecimal price = JDUtil.getQuanPrice(goods); BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price); moneyInfoVO.setRateInfo("返利比 " + rate + "%"); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else { BigDecimal price = JDUtil.getQuanPrice(goods); BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price); moneyInfoVO.setRateInfo("返利比 " + rate + "%"); BigDecimal maxCommission = JDUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate()); BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); moneyInfoVO.setMaxMoney("¥" + maxCommission); BigDecimal maxCommission = JDUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate()); BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); moneyInfoVO.setMaxMoney("¥" + maxCommission); if (baseCommisstion != null) { String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), commission.subtract(baseCommisstion).setScale(2).toString()); String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), maxCommission.subtract(baseCommisstion).setScale(2).toString()); moneyInfoVO.setCompositionInfo(desc); moneyInfoVO.setMaxCompositionInfo(maxDesc); } } moneyInfoVO.setShareMoney("¥" + JDUtil.getGoodsFanLiMoney(goods, params.getShareRate())); goodsInfo.setMoneyInfo(moneyInfoVO); if (baseCommisstion != null) { String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), commission.subtract(baseCommisstion).setScale(2).toString()); String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), maxCommission.subtract(baseCommisstion).setScale(2).toString()); moneyInfoVO.setCompositionInfo(desc); moneyInfoVO.setMaxCompositionInfo(maxDesc); } } moneyInfoVO.setShareMoney("¥" + JDUtil.getGoodsFanLiMoney(goods, params.getShareRate())); goodsInfo.setMoneyInfo(moneyInfoVO); JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods); if (couponInfo != null) { BigDecimal discount = couponInfo.getDiscount(); // 计算券后价 goodsInfo.setCouponPrice(JDUtil.getQuanPrice(goods)); JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods); if (couponInfo != null) { BigDecimal discount = couponInfo.getDiscount(); // 计算券后价 goodsInfo.setCouponPrice(JDUtil.getQuanPrice(goods)); SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(discount); coupon.setLink(couponInfo.getLink()); coupon.setStartFee(couponInfo.getQuota()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(discount); coupon.setLink(couponInfo.getLink()); coupon.setStartFee(couponInfo.getQuota()); if (couponInfo.getGetStartTime() != null) { coupon.setStartTime(sdf.format(new Date(couponInfo.getGetStartTime()))); } if (couponInfo.getGetStartTime() != null) { coupon.setStartTime(sdf.format(new Date(couponInfo.getGetStartTime()))); } if (couponInfo.getGetEndTime() != null) { coupon.setEndTime(sdf.format(new Date(couponInfo.getGetEndTime()))); } if (couponInfo.getGetEndTime() != null) { coupon.setEndTime(sdf.format(new Date(couponInfo.getGetEndTime()))); } goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); } goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); } if (goods.getCouponInfoList() != null && goods.getCouponInfoList().size() > 0) { List<CouponInfoVO> couponList = new ArrayList<>(); for (JDCouponInfo jdCoupon : goods.getCouponInfoList()) { couponList.add(convertJDCouponInfo(jdCoupon)); } goodsInfo.setCouponInfoList(filterCouponInfo(couponList)); } if (goods.getCouponInfoList() != null && goods.getCouponInfoList().size() > 0) { List<CouponInfoVO> couponList = new ArrayList<>(); for (JDCouponInfo jdCoupon : goods.getCouponInfoList()) { couponList.add(convertJDCouponInfo(jdCoupon)); } goodsInfo.setCouponInfoList(filterCouponInfo(couponList)); } List<ClientTextStyleVO> labels = goodsInfo.getLabels(); // 京东自营标签 String owner = goods.getOwner(); if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) { goodsInfo.setShopType(21); // 京东自营 if (labels == null) { labels = new ArrayList<ClientTextStyleVO>(); } ClientTextStyleVO textStyleVO = new ClientTextStyleVO(); textStyleVO.setContent("京东自营"); textStyleVO.setColor("#E42219"); labels.add(textStyleVO); } else { goodsInfo.setShopType(20); // 京东 } List<ClientTextStyleVO> labels = goodsInfo.getLabels(); // 京东自营标签 String owner = goods.getOwner(); if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) { goodsInfo.setShopType(21); // 京东自营 if (labels == null) { labels = new ArrayList<ClientTextStyleVO>(); } ClientTextStyleVO textStyleVO = new ClientTextStyleVO(); textStyleVO.setContent("京东自营"); textStyleVO.setColor("#E42219"); labels.add(textStyleVO); } else { goodsInfo.setShopType(20); // 京东 } JDPingouInfo pinGouInfo = goods.getPinGouInfo(); if (pinGouInfo != null) { goodsInfo.setZkPrice(pinGouInfo.getPingouPrice()); goodsInfo.setPriceName("拼购价"); JDPingouInfo pinGouInfo = goods.getPinGouInfo(); if (pinGouInfo != null) { goodsInfo.setZkPrice(pinGouInfo.getPingouPrice()); goodsInfo.setPriceName("拼购价"); if (labels == null) { labels = new ArrayList<ClientTextStyleVO>(); } ClientTextStyleVO textStyleVO = new ClientTextStyleVO(); textStyleVO.setContent("拼购"); textStyleVO.setColor("#E42219"); labels.add(textStyleVO); } else { goodsInfo.setZkPrice(goods.getPrice()); goodsInfo.setPriceName("京东价"); } goodsInfo.setLabels(labels); if (labels == null) { labels = new ArrayList<ClientTextStyleVO>(); } ClientTextStyleVO textStyleVO = new ClientTextStyleVO(); textStyleVO.setContent("拼购"); textStyleVO.setColor("#E42219"); labels.add(textStyleVO); } else { goodsInfo.setZkPrice(goods.getPrice()); goodsInfo.setPriceName("京东价"); } goodsInfo.setLabels(labels); // 店铺信息 JDShopInfo shopInfo = goods.getShopInfo(); if (shopInfo != null && !StringUtil.isNullOrEmpty(shopInfo.getShopName())) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(shopInfo.getShopName()); shop.setId(shopInfo.getShopId().toString()); // 店铺信息 JDShopInfo shopInfo = goods.getShopInfo(); if (shopInfo != null && !StringUtil.isNullOrEmpty(shopInfo.getShopName())) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(shopInfo.getShopName()); shop.setId(shopInfo.getShopId().toString()); if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) { shop.setUserType(20); } else { shop.setUserType(21); } goodsInfo.setShopInfo(shop); } if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) { shop.setUserType(20); } else { shop.setUserType(21); } goodsInfo.setShopInfo(shop); } // 是否包邮 Integer isFreeShipping = goods.getIsFreeShipping(); if (isFreeShipping != null && isFreeShipping == 1) { goodsInfo.setBaoyou(true); } // 是否包邮 Integer isFreeShipping = goods.getIsFreeShipping(); if (isFreeShipping != null && isFreeShipping == 1) { goodsInfo.setBaoyou(true); } return goodsInfo; } return goodsInfo; } /** * 拼多多商品 * * @param goods 拼多多商品 * @param pid * @param fanLiRate 返利比例 * @return */ public static GoodsDetailVO convertPDDGoods(PDDGoodsDetail goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setBaoyou(true); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_PDD); goodsInfo.setGoodsId(goods.getGoodsId() + ""); goodsInfo.setTitle(goods.getGoodsName()); goodsInfo.setSalesType(4); // 总销量 goodsInfo.setPriceName("拼团价"); goodsInfo.setPicUrl(goods.getGoodsThumbnailUrl()); // 缩略图 goodsInfo.setZkPrice( MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), new BigDecimal(100)).setScale(2)); goodsInfo.setShopType(30); // 拼多多 /** * 拼多多商品 * * @param goods * 拼多多商品 * @param pid * @param fanLiRate * 返利比例 * @return */ public static GoodsDetailVO convertPDDGoods(PDDGoodsDetail goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setBaoyou(true); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_PDD); goodsInfo.setGoodsId(goods.getGoodsId() + ""); goodsInfo.setTitle(goods.getGoodsName()); goodsInfo.setSalesType(4); // 总销量 goodsInfo.setPriceName("拼团价"); goodsInfo.setPicUrl(goods.getGoodsThumbnailUrl()); // 缩略图 goodsInfo.setZkPrice( MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), new BigDecimal(100)).setScale(2)); goodsInfo.setShopType(30); // 拼多多 String[] goodsGalleryUrls = goods.getGoodsGalleryUrls(); if (goodsGalleryUrls != null) { goodsInfo.setImgList(Arrays.asList(goodsGalleryUrls)); } String[] goodsGalleryUrls = goods.getGoodsGalleryUrls(); if (goodsGalleryUrls != null) { goodsInfo.setImgList(Arrays.asList(goodsGalleryUrls)); } Integer state = goods.getState(); if (state == null) { goodsInfo.setState(0); } else { goodsInfo.setState(goods.getState()); } Integer state = goods.getState(); if (state == null) { goodsInfo.setState(0); } else { goodsInfo.setState(goods.getState()); } // 总销量 String salesTip = goods.getSalesTip(); if (StringUtil.isNullOrEmpty(salesTip)) { salesTip = "0"; } goodsInfo.setSalesCount(salesTip); // 总销量 String salesTip = goods.getSalesTip(); if (StringUtil.isNullOrEmpty(salesTip)) { salesTip = "0"; } goodsInfo.setSalesCount(salesTip); // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 BigDecimal commission = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getFanLiRate()); BigDecimal shareCommission = PinDuoDuoUtil.getGoodsShareMoney(goods, params.getFanLiRate()); moneyInfoVO.setFanliMoney("¥" + commission); moneyInfoVO.setShareMoney("¥" + shareCommission); // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 BigDecimal commission = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getFanLiRate()); moneyInfoVO.setFanliMoney("¥" + commission); moneyInfoVO.setShareMoney("¥" + commission); Boolean hasCoupon = goods.getHasCoupon(); if (hasCoupon != null && hasCoupon) { BigDecimal hundred = new BigDecimal(100); BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred).setScale(2); BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred).setScale(2); BigDecimal startFree = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponMinOrderAmount()), hundred) .setScale(2); Boolean hasCoupon = goods.getHasCoupon(); if (hasCoupon != null && hasCoupon) { BigDecimal hundred = new BigDecimal(100); BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred).setScale(2); BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred).setScale(2); BigDecimal startFree = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponMinOrderAmount()), hundred) .setScale(2); // 计算券后价 if (startFree.compareTo(price) <= 0) { BigDecimal quanPrice = MoneyBigDecimalUtil.sub(price, amount); goodsInfo.setCouponPrice(quanPrice); } else { goodsInfo.setCouponPrice(price); } // 计算券后价 if (startFree.compareTo(price) <= 0) { BigDecimal quanPrice = MoneyBigDecimalUtil.sub(price, amount); goodsInfo.setCouponPrice(quanPrice); } else { goodsInfo.setCouponPrice(price); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(amount); coupon.setStartFee(startFree); SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(amount); coupon.setStartFee(startFree); if (goods.getCouponStartTime() != null) { coupon.setStartTime(sdf.format(new Date(goods.getCouponStartTime() * 1000))); } if (goods.getCouponStartTime() != null) { coupon.setStartTime(sdf.format(new Date(goods.getCouponStartTime() * 1000))); } if (goods.getCouponEndTime() != null) { coupon.setEndTime(sdf.format(new Date(goods.getCouponEndTime() * 1000))); } if (goods.getCouponEndTime() != null) { coupon.setEndTime(sdf.format(new Date(goods.getCouponEndTime() * 1000))); } if (goods.getCouponTotalQuantity() != null) coupon.setTotalCount(Integer.parseInt(goods.getCouponTotalQuantity().toString())); if (goods.getCouponTotalQuantity() != null) coupon.setTotalCount(Integer.parseInt(goods.getCouponTotalQuantity().toString())); if (goods.getCouponRemainQuantity() != null) coupon.setLeftCount(Integer.parseInt(goods.getCouponRemainQuantity().toString())); if (goods.getCouponRemainQuantity() != null) coupon.setLeftCount(Integer.parseInt(goods.getCouponRemainQuantity().toString())); goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); } goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); } BigDecimal baseCommisstion = null; if (params.getBaseFanliRate() != null) baseCommisstion = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate()); BigDecimal baseCommisstion = null; if (params.getBaseFanliRate() != null) baseCommisstion = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate()); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else { BigDecimal price = goodsInfo.getCouponPrice() != null ? goodsInfo.getCouponPrice() : goodsInfo.getZkPrice(); BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price); moneyInfoVO.setRateInfo("返利比 " + rate + "%"); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else { BigDecimal price = goodsInfo.getCouponPrice() != null ? goodsInfo.getCouponPrice() : goodsInfo.getZkPrice(); BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price); moneyInfoVO.setRateInfo("返利比 " + rate + "%"); BigDecimal maxCommission = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate()); BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); BigDecimal maxCommission = PinDuoDuoUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate()); BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); moneyInfoVO.setMaxMoney("¥" + maxCommission); moneyInfoVO.setMaxMoney("¥" + maxCommission); if (baseCommisstion != null) { String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), commission.subtract(baseCommisstion).setScale(2).toString()); String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), maxCommission.subtract(baseCommisstion).setScale(2).toString()); if (goods.getPromotionRate() > 0 && (goods.getPredictPromotionRate() != null && goods.getPredictPromotionRate().compareTo(new BigDecimal(0)) == 0)) { desc = "比价商品无返利"; maxDesc = "比价商品无返利"; } if (baseCommisstion != null) { String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), commission.subtract(baseCommisstion).setScale(2).toString()); String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), maxCommission.subtract(baseCommisstion).setScale(2).toString()); moneyInfoVO.setCompositionInfo(desc); moneyInfoVO.setMaxCompositionInfo(maxDesc); } } goodsInfo.setMoneyInfo(moneyInfoVO); moneyInfoVO.setCompositionInfo(desc); moneyInfoVO.setMaxCompositionInfo(maxDesc); } } goodsInfo.setMoneyInfo(moneyInfoVO); // 店铺信息 String mallName = goods.getMallName(); if (!StringUtil.isMobile(mallName)) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(mallName); if (goods.getMallId() != null) { shop.setId(goods.getMallId().toString()); } shop.setUserType(30); goodsInfo.setShopInfo(shop); } // 店铺信息 String mallName = goods.getMallName(); if (!StringUtil.isMobile(mallName)) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(mallName); if (goods.getMallId() != null) { shop.setId(goods.getMallId().toString()); } shop.setUserType(30); goodsInfo.setShopInfo(shop); } // if (Constant.IS_TEST) { // // 添加标签 // List<ClientTextStyleVO> labels = goodsInfo.getLabels(); // if (labels == null) // labels = new ArrayList<>(); // // labels.add(new ClientTextStyleVO("预售", "#FF2B4E")); // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E")); // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E")); // goodsInfo.setLabels(labels); // } return goodsInfo; } // if (Constant.IS_TEST) { // // 添加标签 // List<ClientTextStyleVO> labels = goodsInfo.getLabels(); // if (labels == null) // labels = new ArrayList<>(); // // labels.add(new ClientTextStyleVO("预售", "#FF2B4E")); // labels.add(new ClientTextStyleVO("爆款", "#FF2B4E")); // labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E")); // goodsInfo.setLabels(labels); // } return goodsInfo; } public static GoodsDetailVO convertVIPGoods(VIPGoodsInfo goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setBaoyou(true); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_VIP); goodsInfo.setGoodsId(Long.parseLong(goods.getGoodsId()) + ""); goodsInfo.setTitle(goods.getGoodsName()); goodsInfo.setSalesType(5); // 无销量 goodsInfo.setPriceName("原价"); goodsInfo.setPicUrl(goods.getGoodsThumbUrl()); // 缩略图 goodsInfo.setZkPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(goods.getMarketPrice()))); goodsInfo.setCouponPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(goods.getVipPrice()))); goodsInfo.setShopType(CommonGoods.SHOP_TYPE_VIP); public static GoodsDetailVO convertVIPGoods(VIPGoodsInfo goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setBaoyou(true); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_VIP); goodsInfo.setGoodsId(Long.parseLong(goods.getGoodsId()) + ""); goodsInfo.setTitle(goods.getGoodsName()); goodsInfo.setSalesType(5); // 无销量 goodsInfo.setPriceName("原价"); goodsInfo.setPicUrl(goods.getGoodsThumbUrl()); // 缩略图 goodsInfo.setZkPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(goods.getMarketPrice()))); goodsInfo.setCouponPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(goods.getVipPrice()))); goodsInfo.setShopType(CommonGoods.SHOP_TYPE_VIP); goodsInfo.setImgList(goods.getGoodsDetailPictures()); goodsInfo.setImgList(goods.getGoodsDetailPictures()); Integer state = goods.getStatus(); if (state == null) { goodsInfo.setState(0); } else { goodsInfo.setState(goods.getStatus() == 1 ? CommonGoods.STATE_OFFLINE : CommonGoods.STATE_NORMAL); } Integer state = goods.getStatus(); if (state == null) { goodsInfo.setState(0); } else { goodsInfo.setState(goods.getStatus() == 1 ? CommonGoods.STATE_OFFLINE : CommonGoods.STATE_NORMAL); } goodsInfo.setSalesCount(""); goodsInfo.setSalesCount(""); // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 BigDecimal commission = VipShopUtil.getGoodsFanLiMoney(goods, params.getFanLiRate()); moneyInfoVO.setFanliMoney("¥" + commission); moneyInfoVO.setShareMoney("¥" + commission); // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 BigDecimal commission = VipShopUtil.getGoodsFanLiMoney(goods, params.getFanLiRate()); moneyInfoVO.setFanliMoney("¥" + commission); moneyInfoVO.setShareMoney("¥" + commission); BigDecimal baseCommisstion = null; if (params.getBaseFanliRate() != null) baseCommisstion = VipShopUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate()); BigDecimal baseCommisstion = null; if (params.getBaseFanliRate() != null) baseCommisstion = VipShopUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate()); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else { BigDecimal price = new BigDecimal(goods.getVipPrice()); BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price); moneyInfoVO.setRateInfo("返利比 " + rate + "%"); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else { BigDecimal price = new BigDecimal(goods.getVipPrice()); BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price); moneyInfoVO.setRateInfo("返利比 " + rate + "%"); BigDecimal maxCommission = VipShopUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate()); BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); BigDecimal maxCommission = VipShopUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate()); BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); moneyInfoVO.setMaxMoney("¥" + maxCommission); moneyInfoVO.setMaxMoney("¥" + maxCommission); if (baseCommisstion != null) { String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), commission.subtract(baseCommisstion).setScale(2).toString()); String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), maxCommission.subtract(baseCommisstion).setScale(2).toString()); moneyInfoVO.setCompositionInfo(desc); moneyInfoVO.setMaxCompositionInfo(maxDesc); } } goodsInfo.setMoneyInfo(moneyInfoVO); if (baseCommisstion != null) { String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), commission.subtract(baseCommisstion).setScale(2).toString()); String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), maxCommission.subtract(baseCommisstion).setScale(2).toString()); moneyInfoVO.setCompositionInfo(desc); moneyInfoVO.setMaxCompositionInfo(maxDesc); } } goodsInfo.setMoneyInfo(moneyInfoVO); // 店铺信息 String mallName = goods.getBrandName(); if (!StringUtil.isNullOrEmpty(mallName)) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(mallName); if (goods.getBrandId() != null) { shop.setId(goods.getBrandId().toString()); } shop.setUserType(30); goodsInfo.setShopInfo(shop); } // 店铺信息 String mallName = goods.getBrandName(); if (!StringUtil.isNullOrEmpty(mallName)) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(mallName); if (goods.getBrandId() != null) { shop.setId(goods.getBrandId().toString()); } shop.setUserType(30); goodsInfo.setShopInfo(shop); } // 折扣信息 goodsInfo.setDiscount(MoneyBigDecimalUtil .getWithNoZera(MoneyBigDecimalUtil.mul(new BigDecimal(goods.getDiscount()), new BigDecimal(10))) + "折"); goodsInfo.setShopInfo(null); return goodsInfo; } // 折扣信息 goodsInfo.setDiscount(MoneyBigDecimalUtil .getWithNoZera(MoneyBigDecimalUtil.mul(new BigDecimal(goods.getDiscount()), new BigDecimal(10))) + "折"); goodsInfo.setShopInfo(null); return goodsInfo; } public static GoodsDetailVO convertSuningGoods(SuningGoodsInfo goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setBaoyou(true); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_SUNING); goodsInfo.setGoodsId(SuningUtil.getConcatGoodsIId(goods.getCommodityInfo().getSupplierCode(), goods.getCommodityInfo().getCommodityCode())); goodsInfo.setTitle(goods.getCommodityInfo().getCommodityName()); goodsInfo.setSalesType(1); // 月销 goodsInfo.setPriceName("原价"); if (goods.getCommodityInfo().getPictureUrl().size() > 0) goodsInfo.setPicUrl(goods.getCommodityInfo().getPictureUrl().get(0).getPicUrl()); // 缩略图 public static GoodsDetailVO convertSuningGoods(SuningGoodsInfo goods, ConfigParamsDTO params) { GoodsDetailVO goodsInfo = new GoodsDetailVO(); goodsInfo.setBaoyou(true); goodsInfo.setGoodsType(Constant.SOURCE_TYPE_SUNING); goodsInfo.setGoodsId(SuningUtil.getConcatGoodsIId(goods.getCommodityInfo().getSupplierCode(), goods.getCommodityInfo().getCommodityCode())); goodsInfo.setTitle(goods.getCommodityInfo().getCommodityName()); goodsInfo.setSalesType(1); // 月销 goodsInfo.setPriceName("原价"); if (goods.getCommodityInfo().getPictureUrl().size() > 0) goodsInfo.setPicUrl(goods.getCommodityInfo().getPictureUrl().get(0).getPicUrl()); // 缩略图 String commodityPrice = goods.getCommodityInfo().getCommodityPrice(); if (StringUtil.isNullOrEmpty(commodityPrice)) { commodityPrice = goods.getCommodityInfo().getSnPrice(); } goodsInfo.setZkPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(commodityPrice))); goodsInfo.setShopType(CommonGoods.SHOP_TYPE_SUNING); String commodityPrice = goods.getCommodityInfo().getCommodityPrice(); if (StringUtil.isNullOrEmpty(commodityPrice)) { commodityPrice = goods.getCommodityInfo().getSnPrice(); } goodsInfo.setZkPrice(MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(commodityPrice))); goodsInfo.setShopType(CommonGoods.SHOP_TYPE_SUNING); List<String> imgList = new ArrayList<>(); for (SuningGoodsImg img : goods.getCommodityInfo().getPictureUrl()) { imgList.add(img.getPicUrl()); } List<String> imgList = new ArrayList<>(); for (SuningGoodsImg img : goods.getCommodityInfo().getPictureUrl()) { imgList.add(img.getPicUrl()); } goodsInfo.setImgList(imgList); goodsInfo.setState(0); goodsInfo.setImgList(imgList); goodsInfo.setState(0); String salesCountMidea = ""; Integer count = Integer.parseInt(goods.getCommodityInfo().getMonthSales()); if (count < 10000) { salesCountMidea = count + ""; } else { double sales = count; salesCountMidea = String.format("%.1f", sales / 10000); salesCountMidea = salesCountMidea + "万"; } goodsInfo.setSalesCount(salesCountMidea); String salesCountMidea = ""; Integer count = Integer.parseInt(goods.getCommodityInfo().getMonthSales()); if (count < 10000) { salesCountMidea = count + ""; } else { double sales = count; salesCountMidea = String.format("%.1f", sales / 10000); salesCountMidea = salesCountMidea + "万"; } goodsInfo.setSalesCount(salesCountMidea); // 券信息 if (goods.getCouponInfo() != null && !StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) {// 有券 CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(new BigDecimal(goods.getCouponInfo().getCouponValue())); if (StringUtil.isNullOrEmpty(goods.getCouponInfo().getBounsLimit())) { coupon.setStartFee(new BigDecimal(goods.getCouponInfo().getCouponValue())); } else coupon.setStartFee(new BigDecimal(goods.getCouponInfo().getBounsLimit())); // 券信息 if (goods.getCouponInfo() != null && !StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) {// 有券 CouponInfoVO coupon = new CouponInfoVO(); coupon.setAmount(new BigDecimal(goods.getCouponInfo().getCouponValue())); if (StringUtil.isNullOrEmpty(goods.getCouponInfo().getBounsLimit())) { coupon.setStartFee(new BigDecimal(goods.getCouponInfo().getCouponValue())); } else coupon.setStartFee(new BigDecimal(goods.getCouponInfo().getBounsLimit())); if (goods.getCouponInfo().getCouponStartTime() != null) { coupon.setStartTime(goods.getCouponInfo().getCouponStartTime()); } if (goods.getCouponInfo().getCouponStartTime() != null) { coupon.setStartTime(goods.getCouponInfo().getCouponStartTime()); } if (goods.getCouponInfo().getCouponEndTime() != null) { coupon.setEndTime(goods.getCouponInfo().getCouponEndTime()); } if (goods.getCouponInfo().getCouponEndTime() != null) { coupon.setEndTime(goods.getCouponInfo().getCouponEndTime()); } if (goods.getCouponInfo().getCouponCount() != null) coupon.setTotalCount(Integer.parseInt(goods.getCouponInfo().getCouponCount())); if (goods.getCouponInfo().getCouponCount() != null) coupon.setTotalCount(Integer.parseInt(goods.getCouponInfo().getCouponCount())); if (goods.getCouponInfo().getCouponCount() != null) coupon.setLeftCount(Integer.parseInt(goods.getCouponInfo().getCouponCount())); if (goods.getCouponInfo().getCouponCount() != null) coupon.setLeftCount(Integer.parseInt(goods.getCouponInfo().getCouponCount())); goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); goodsInfo.setHasCoupon(true); goodsInfo.setCouponInfo(coupon); if (goodsInfo.getZkPrice().compareTo(coupon.getStartFee()) >= 0) { goodsInfo.setCouponPrice(goodsInfo.getZkPrice().subtract(coupon.getAmount())); } else { goodsInfo.setCouponPrice(goodsInfo.getZkPrice()); } if (goodsInfo.getZkPrice().compareTo(coupon.getStartFee()) >= 0) { goodsInfo.setCouponPrice(goodsInfo.getZkPrice().subtract(coupon.getAmount())); } else { goodsInfo.setCouponPrice(goodsInfo.getZkPrice()); } } else { goodsInfo.setHasCoupon(false); } } else { goodsInfo.setHasCoupon(false); } // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 BigDecimal commission = SuningUtil.getGoodsFanLiMoney(goods, params.getFanLiRate()); moneyInfoVO.setFanliMoney("¥" + commission); moneyInfoVO.setShareMoney("¥" + commission); // 资金信息 MoneyInfoVO moneyInfoVO = new MoneyInfoVO(); moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6 BigDecimal commission = SuningUtil.getGoodsFanLiMoney(goods, params.getFanLiRate()); moneyInfoVO.setFanliMoney("¥" + commission); moneyInfoVO.setShareMoney("¥" + commission); BigDecimal baseCommisstion = null; if (params.getBaseFanliRate() != null) baseCommisstion = SuningUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate()); BigDecimal baseCommisstion = null; if (params.getBaseFanliRate() != null) baseCommisstion = SuningUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate()); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else { BigDecimal price = new BigDecimal(commodityPrice); BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price); moneyInfoVO.setRateInfo("返利比 " + rate + "%"); if (params.getMaxRewardRate() != null) moneyInfoVO .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate()))); else { BigDecimal price = new BigDecimal(commodityPrice); BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price); moneyInfoVO.setRateInfo("返利比 " + rate + "%"); BigDecimal maxCommission = SuningUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate()); BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); BigDecimal maxCommission = SuningUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate()); BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price); moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%"); moneyInfoVO.setMaxMoney("¥" + maxCommission); moneyInfoVO.setMaxMoney("¥" + maxCommission); if (baseCommisstion != null) { String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), commission.subtract(baseCommisstion).setScale(2).toString()); String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), maxCommission.subtract(baseCommisstion).setScale(2).toString()); moneyInfoVO.setCompositionInfo(desc); moneyInfoVO.setMaxCompositionInfo(maxDesc); } } goodsInfo.setMoneyInfo(moneyInfoVO); if (baseCommisstion != null) { String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), commission.subtract(baseCommisstion).setScale(2).toString()); String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(), maxCommission.subtract(baseCommisstion).setScale(2).toString()); moneyInfoVO.setCompositionInfo(desc); moneyInfoVO.setMaxCompositionInfo(maxDesc); } } goodsInfo.setMoneyInfo(moneyInfoVO); // 店铺信息 String mallName = goods.getCommodityInfo().getSupplierName(); if (!StringUtil.isMobile(mallName)) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(mallName); if (goods.getCommodityInfo().getSupplierCode() != null) { shop.setId(goods.getCommodityInfo().getSupplierCode()); } shop.setUserType(30); goodsInfo.setShopInfo(shop); } // 店铺信息 String mallName = goods.getCommodityInfo().getSupplierName(); if (!StringUtil.isMobile(mallName)) { ShopInfoVO shop = new ShopInfoVO(); shop.setShopName(mallName); if (goods.getCommodityInfo().getSupplierCode() != null) { shop.setId(goods.getCommodityInfo().getSupplierCode()); } shop.setUserType(30); goodsInfo.setShopInfo(shop); } return goodsInfo; } return goodsInfo; } } fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java
@@ -386,6 +386,7 @@ map.put("page", page + ""); map.put("page_size", pageSize + ""); String result = baseRequest(map); System.out.println(result); JSONObject json = JSONObject.fromObject(result); JSONObject root = json.optJSONObject("order_list_get_response"); if (root != null) { fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoUtil.java
@@ -74,6 +74,30 @@ return BigDecimalUtil.getWithNoZera(money).setScale(2); } public static BigDecimal getGoodsShareMoney(PDDGoodsDetail goods, BigDecimal rate) { BigDecimal money = null; BigDecimal hundred = new BigDecimal(100); rate = MoneyBigDecimalUtil.div(rate, hundred); BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred).setScale(2); BigDecimal promotionRate = MoneyBigDecimalUtil.div3(new BigDecimal(goods.getPromotionRate()), new BigDecimal(1000)); Boolean hasCoupon = goods.getHasCoupon(); if (hasCoupon == null || !hasCoupon) { money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price, promotionRate), rate); } else { BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred); BigDecimal startFree = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponMinOrderAmount()), hundred); if (startFree.compareTo(price) <= 0 && price.compareTo(amount) > 0) { BigDecimal finalPrice = price.subtract(amount); money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(finalPrice, promotionRate), rate); } else {// 不能用券 money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price, promotionRate), rate); } } return BigDecimalUtil.getWithNoZera(money).setScale(2); } /** * 计算商品券后价,没有券则返回原价 * fanli/src/main/java/com/yeshi/fanli/vo/order/CommonOrderVO.java
@@ -13,460 +13,470 @@ /** * 订单-简版 * * @author yj * * @author yj * @date 2018年12月23日 */ public class CommonOrderVO extends CommonOrder implements Serializable { private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L; // 到账时间 private Date accountTime; // 预计到账时间 private Date preAccountTime; // 实际总数量 private Integer totalCount; // 实际总付款 private BigDecimal totalPayment; // 实际总结算 private BigDecimal totalSettlement; // 红包类型: private Integer hongBaoType; // 订单总预估奖金 private BigDecimal hongBao; // 到账时间 private Date accountTime; // 预计到账时间 private Date preAccountTime; // 实际总数量 private Integer totalCount; // 实际总付款 private BigDecimal totalPayment; // 实际总结算 private BigDecimal totalSettlement; // 红包类型: private Integer hongBaoType; // 订单总预估奖金 private BigDecimal hongBao; // 券红包金额 @Expose private BigDecimal couponMoney; // 1 淘宝 2 天猫 @Expose private Integer orderType; // 红包状态 @Expose private Integer hongBaoState; // 到账时间 @Expose private String hongBaoDate; // 红包类型图片链接 @Expose private String hongBaoTypePic; // 订单产生的方式: 自购 分享 邀请 @Expose private String orderOrigin; // 订单状态 @Expose private Map<String, String> orderState; // 红包金额 @Expose private Map<String, String> hongBaoInfo; // 到账状态 @Expose private Map<String, String> accountState; // 创建时间 数字格式 @Expose private Long obtainTime; // 下单时间 @Expose private String downTime; // 收货时间 @Expose private String receiveTime; // 订单下的商品 @Expose private List<CommonOrderGoodsVO> listOrderGoods = new ArrayList<CommonOrderGoodsVO>(); //订单状态描述 private String orderStateDesc; // 订单状态列表 @Expose private List<String> signList; // 收货时间 @Expose private Map<String, Object> rewardDetail; // 维权信息 @Expose private WeiQuanInfo weiQuanInfo; // 券红包金额 @Expose private BigDecimal couponMoney; // 1 淘宝 2 天猫 @Expose private Integer orderType; // 红包状态 @Expose private Integer hongBaoState; // 到账时间 @Expose private String hongBaoDate; // 红包类型图片链接 @Expose private String hongBaoTypePic; // 订单产生的方式: 自购 分享 邀请 @Expose private String orderOrigin; // 订单状态 @Expose private Map<String, String> orderState; // 红包金额 @Expose private Map<String, String> hongBaoInfo; // 到账状态 @Expose private Map<String, String> accountState; // 创建时间 数字格式 @Expose private Long obtainTime; // 下单时间 @Expose private String downTime; // 收货时间 @Expose private String receiveTime; // 订单下的商品 @Expose private List<CommonOrderGoodsVO> listOrderGoods = new ArrayList<CommonOrderGoodsVO>(); // 补贴信息 @Expose private ClientTextStyleVO subsidy; // 补贴解释信息 @Expose private List<String> subsidyList; // 订单状态列表 @Expose private List<String> signList; // 收货时间 @Expose private Map<String, Object> rewardDetail; // 直接收益人-ID private String userId; // 直接收益人-昵称 private String userName; // 直接收益人-头像 private String userPortrait; // 头像 // 维权信息 @Expose private WeiQuanInfo weiQuanInfo; // 红包ID private Long hongbaoId; // 补贴信息 @Expose private ClientTextStyleVO subsidy; // 补贴解释信息 @Expose private List<String> subsidyList; // 一级收益人-ID private String levelOneId; // 一级收益人-金额 private String levelOneMoney; // 直接收益人-ID private String userId; // 直接收益人-昵称 private String userName; // 直接收益人-头像 private String userPortrait; // 头像 // 二级收益人-ID private String levelTwoId; // 二级收益人-金额 private String levelTwoMoney; // 红包ID private Long hongbaoId; private String weiQuanState;// 维权状态 // 一级收益人-ID private String levelOneId; // 一级收益人-金额 private String levelOneMoney; private String weiQuanBackMoney;// 维权资金 // 二级收益人-ID private String levelTwoId; // 二级收益人-金额 private String levelTwoMoney; private Integer otherState; // 1免单 private String weiQuanState;// 维权状态 @Expose private boolean vipOrder;// 是否为超级用户订单(2.1之后废弃) @Expose private String vipOrderDesc;// 超级订单描述(2.1之后废弃) @Expose private String rebateLink;// 返利说明链接 @Expose private String orderDesc;// 订单描述 private String weiQuanBackMoney;// 维权资金 // 店铺类型 2.1.2新增 @Expose private ClientTextStyleVO shopType; private Integer otherState; // 1免单 @Expose private boolean vipOrder;// 是否为超级用户订单(2.1之后废弃) public String getVipOrderDesc() { return vipOrderDesc; } @Expose private String vipOrderDesc;// 超级订单描述(2.1之后废弃) public void setVipOrderDesc(String vipOrderDesc) { this.vipOrderDesc = vipOrderDesc; } @Expose private String rebateLink;// 返利说明链接 public boolean isVipOrder() { return vipOrder; } @Expose private String orderDesc;// 订单描述 public void setVipOrder(boolean vipOrder) { this.vipOrder = vipOrder; } public String getWeiQuanState() { return weiQuanState; } // 店铺类型 2.1.2新增 @Expose private ClientTextStyleVO shopType; public void setWeiQuanState(String weiQuanState) { this.weiQuanState = weiQuanState; } public String getWeiQuanBackMoney() { return weiQuanBackMoney; } public String getVipOrderDesc() { return vipOrderDesc; } public void setWeiQuanBackMoney(String weiQuanBackMoney) { this.weiQuanBackMoney = weiQuanBackMoney; } public void setVipOrderDesc(String vipOrderDesc) { this.vipOrderDesc = vipOrderDesc; } public Date getAccountTime() { return accountTime; } public boolean isVipOrder() { return vipOrder; } public void setAccountTime(Date accountTime) { this.accountTime = accountTime; } public void setVipOrder(boolean vipOrder) { this.vipOrder = vipOrder; } public Date getPreAccountTime() { return preAccountTime; } public String getWeiQuanState() { return weiQuanState; } public void setPreAccountTime(Date preAccountTime) { this.preAccountTime = preAccountTime; } public void setWeiQuanState(String weiQuanState) { this.weiQuanState = weiQuanState; } public BigDecimal getHongBao() { return hongBao; } public String getWeiQuanBackMoney() { return weiQuanBackMoney; } public void setHongBao(BigDecimal hongBao) { this.hongBao = hongBao; } public void setWeiQuanBackMoney(String weiQuanBackMoney) { this.weiQuanBackMoney = weiQuanBackMoney; } public Integer getHongBaoState() { return hongBaoState; } public Date getAccountTime() { return accountTime; } public void setHongBaoState(Integer hongBaoState) { this.hongBaoState = hongBaoState; } public void setAccountTime(Date accountTime) { this.accountTime = accountTime; } public Long getObtainTime() { return obtainTime; } public Date getPreAccountTime() { return preAccountTime; } public void setObtainTime(Long obtainTime) { this.obtainTime = obtainTime; } public void setPreAccountTime(Date preAccountTime) { this.preAccountTime = preAccountTime; } public String getDownTime() { return downTime; } public BigDecimal getHongBao() { return hongBao; } public void setDownTime(String downTime) { this.downTime = downTime; } public void setHongBao(BigDecimal hongBao) { this.hongBao = hongBao; } public String getReceiveTime() { return receiveTime; } public Integer getHongBaoState() { return hongBaoState; } public void setReceiveTime(String receiveTime) { this.receiveTime = receiveTime; } public void setHongBaoState(Integer hongBaoState) { this.hongBaoState = hongBaoState; } public List<CommonOrderGoodsVO> getListOrderGoods() { return listOrderGoods; } public Long getObtainTime() { return obtainTime; } public void setObtainTime(Long obtainTime) { this.obtainTime = obtainTime; } public String getDownTime() { return downTime; } public void setDownTime(String downTime) { this.downTime = downTime; } public String getReceiveTime() { return receiveTime; } public void setReceiveTime(String receiveTime) { this.receiveTime = receiveTime; } public List<CommonOrderGoodsVO> getListOrderGoods() { return listOrderGoods; } public void setListOrderGoods(List<CommonOrderGoodsVO> listOrderGoods) { this.listOrderGoods = listOrderGoods; } public Integer getTotalCount() { return totalCount; } public void setTotalCount(Integer totalCount) { this.totalCount = totalCount; } public void setListOrderGoods(List<CommonOrderGoodsVO> listOrderGoods) { this.listOrderGoods = listOrderGoods; } public BigDecimal getTotalSettlement() { return totalSettlement; } public Integer getTotalCount() { return totalCount; } public void setTotalSettlement(BigDecimal totalSettlement) { this.totalSettlement = totalSettlement; } public void setTotalCount(Integer totalCount) { this.totalCount = totalCount; } public Integer getHongBaoType() { return hongBaoType; } public BigDecimal getTotalSettlement() { return totalSettlement; } public void setHongBaoType(Integer hongBaoType) { this.hongBaoType = hongBaoType; } public void setTotalSettlement(BigDecimal totalSettlement) { this.totalSettlement = totalSettlement; } public String getHongBaoTypePic() { return hongBaoTypePic; } public Integer getHongBaoType() { return hongBaoType; } public void setHongBaoTypePic(String hongBaoTypePic) { this.hongBaoTypePic = hongBaoTypePic; } public void setHongBaoType(Integer hongBaoType) { this.hongBaoType = hongBaoType; } public Map<String, String> getHongBaoInfo() { return hongBaoInfo; } public String getHongBaoTypePic() { return hongBaoTypePic; } public void setHongBaoInfo(Map<String, String> hongBaoInfo) { this.hongBaoInfo = hongBaoInfo; } public void setHongBaoTypePic(String hongBaoTypePic) { this.hongBaoTypePic = hongBaoTypePic; } public Map<String, String> getOrderState() { return orderState; } public Map<String, String> getHongBaoInfo() { return hongBaoInfo; } public void setOrderState(Map<String, String> orderState) { this.orderState = orderState; } public void setHongBaoInfo(Map<String, String> hongBaoInfo) { this.hongBaoInfo = hongBaoInfo; } public String getHongBaoDate() { return hongBaoDate; } public Map<String, String> getOrderState() { return orderState; } public void setHongBaoDate(String hongBaoDate) { this.hongBaoDate = hongBaoDate; } public void setOrderState(Map<String, String> orderState) { this.orderState = orderState; } public Integer getOrderType() { return orderType; } public String getHongBaoDate() { return hongBaoDate; } public void setOrderType(Integer orderType) { this.orderType = orderType; } public void setHongBaoDate(String hongBaoDate) { this.hongBaoDate = hongBaoDate; } public Map<String, String> getAccountState() { return accountState; } public Integer getOrderType() { return orderType; } public void setAccountState(Map<String, String> accountState) { this.accountState = accountState; } public void setOrderType(Integer orderType) { this.orderType = orderType; } public String getOrderOrigin() { return orderOrigin; } public Map<String, String> getAccountState() { return accountState; } public void setOrderOrigin(String orderOrigin) { this.orderOrigin = orderOrigin; } public void setAccountState(Map<String, String> accountState) { this.accountState = accountState; } public BigDecimal getTotalPayment() { return totalPayment; } public String getOrderOrigin() { return orderOrigin; } public void setTotalPayment(BigDecimal totalPayment) { this.totalPayment = totalPayment; } public void setOrderOrigin(String orderOrigin) { this.orderOrigin = orderOrigin; } public String getLevelOneId() { return levelOneId; } public BigDecimal getTotalPayment() { return totalPayment; } public void setLevelOneId(String levelOneId) { this.levelOneId = levelOneId; } public void setTotalPayment(BigDecimal totalPayment) { this.totalPayment = totalPayment; } public String getLevelOneMoney() { return levelOneMoney; } public String getLevelOneId() { return levelOneId; } public void setLevelOneMoney(String levelOneMoney) { this.levelOneMoney = levelOneMoney; } public void setLevelOneId(String levelOneId) { this.levelOneId = levelOneId; } public String getLevelTwoId() { return levelTwoId; } public String getLevelOneMoney() { return levelOneMoney; } public void setLevelTwoId(String levelTwoId) { this.levelTwoId = levelTwoId; } public void setLevelOneMoney(String levelOneMoney) { this.levelOneMoney = levelOneMoney; } public String getLevelTwoMoney() { return levelTwoMoney; } public String getLevelTwoId() { return levelTwoId; } public void setLevelTwoMoney(String levelTwoMoney) { this.levelTwoMoney = levelTwoMoney; } public void setLevelTwoId(String levelTwoId) { this.levelTwoId = levelTwoId; } public String getUserId() { return userId; } public String getLevelTwoMoney() { return levelTwoMoney; } public void setUserId(String userId) { this.userId = userId; } public void setLevelTwoMoney(String levelTwoMoney) { this.levelTwoMoney = levelTwoMoney; } public String getUserName() { return userName; } public String getUserId() { return userId; } public void setUserName(String userName) { this.userName = userName; } public void setUserId(String userId) { this.userId = userId; } public String getUserPortrait() { return userPortrait; } public String getUserName() { return userName; } public void setUserPortrait(String userPortrait) { this.userPortrait = userPortrait; } public void setUserName(String userName) { this.userName = userName; } public Map<String, Object> getRewardDetail() { return rewardDetail; } public String getUserPortrait() { return userPortrait; } public void setRewardDetail(Map<String, Object> rewardDetail) { this.rewardDetail = rewardDetail; } public void setUserPortrait(String userPortrait) { this.userPortrait = userPortrait; } public List<String> getSignList() { return signList; } public Map<String, Object> getRewardDetail() { return rewardDetail; } public void setSignList(List<String> signList) { this.signList = signList; } public void setRewardDetail(Map<String, Object> rewardDetail) { this.rewardDetail = rewardDetail; } public BigDecimal getCouponMoney() { return couponMoney; } public List<String> getSignList() { return signList; } public void setCouponMoney(BigDecimal couponMoney) { this.couponMoney = couponMoney; } public void setSignList(List<String> signList) { this.signList = signList; } public Long getHongbaoId() { return hongbaoId; } public BigDecimal getCouponMoney() { return couponMoney; } public void setHongbaoId(Long hongbaoId) { this.hongbaoId = hongbaoId; } public void setCouponMoney(BigDecimal couponMoney) { this.couponMoney = couponMoney; } public Integer getOtherState() { return otherState; } public Long getHongbaoId() { return hongbaoId; } public void setOtherState(Integer otherState) { this.otherState = otherState; } public void setHongbaoId(Long hongbaoId) { this.hongbaoId = hongbaoId; } public WeiQuanInfo getWeiQuanInfo() { return weiQuanInfo; } public Integer getOtherState() { return otherState; } public void setWeiQuanInfo(WeiQuanInfo weiQuanInfo) { this.weiQuanInfo = weiQuanInfo; } public void setOtherState(Integer otherState) { this.otherState = otherState; } public ClientTextStyleVO getSubsidy() { return subsidy; } public WeiQuanInfo getWeiQuanInfo() { return weiQuanInfo; } public void setSubsidy(ClientTextStyleVO subsidy) { this.subsidy = subsidy; } public void setWeiQuanInfo(WeiQuanInfo weiQuanInfo) { this.weiQuanInfo = weiQuanInfo; } public List<String> getSubsidyList() { return subsidyList; } public ClientTextStyleVO getSubsidy() { return subsidy; } public void setSubsidyList(List<String> subsidyList) { this.subsidyList = subsidyList; } public void setSubsidy(ClientTextStyleVO subsidy) { this.subsidy = subsidy; } public String getOrderDesc() { return orderDesc; } public List<String> getSubsidyList() { return subsidyList; } public void setOrderDesc(String orderDesc) { this.orderDesc = orderDesc; } public void setSubsidyList(List<String> subsidyList) { this.subsidyList = subsidyList; } public String getRebateLink() { return rebateLink; } public String getOrderDesc() { return orderDesc; } public void setRebateLink(String rebateLink) { this.rebateLink = rebateLink; } public void setOrderDesc(String orderDesc) { this.orderDesc = orderDesc; } public ClientTextStyleVO getShopType() { return shopType; } public String getRebateLink() { return rebateLink; } public void setShopType(ClientTextStyleVO shopType) { this.shopType = shopType; } public void setRebateLink(String rebateLink) { this.rebateLink = rebateLink; } public String getOrderStateDesc() { return orderStateDesc; } public ClientTextStyleVO getShopType() { return shopType; } public void setOrderStateDesc(String orderStateDesc) { this.orderStateDesc = orderStateDesc; } public void setShopType(ClientTextStyleVO shopType) { this.shopType = shopType; } } fanli/src/main/resource/mapping/order/OrderMapper.xml
@@ -2,129 +2,97 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.yeshi.fanli.dao.mybatis.order.OrderMapper"> <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.Order"> <id column="id" property="id" jdbcType="BIGINT" /> <result column="orderid" property="orderId" jdbcType="VARCHAR" /> <result column="order_type" property="orderType" jdbcType="INTEGER" /> <result column="state" property="state" jdbcType="INTEGER" /> <result column="drawback_time" property="drawbackTime" jdbcType="BIGINT" /> <result column="createtime" property="createtime" jdbcType="BIGINT" /> <result column="beizhu" property="beizhu" jdbcType="VARCHAR" /> <result column="money" property="money" jdbcType="DECIMAL" /> <result column="version" property="version" jdbcType="INTEGER" /> <result column="third_createtime" property="thirdCreateTime" /> <result column="third_state" property="thirdState" jdbcType="VARCHAR" /> <association property="userInfo" column="uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> <id column="uid" property="id" jdbcType="BIGINT" /> </association> </resultMap> <sql id="Base_Column_List">id,orderid,order_type,state,drawback_time,createtime,uid,beizhu,money,version,third_createtime,third_state </sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> select <include refid="Base_Column_List" /> from yeshi_ec_order where id = #{id,jdbcType=BIGINT} </select> <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.Order"> <id column="id" property="id" jdbcType="BIGINT"/> <result column="orderid" property="orderId" jdbcType="VARCHAR"/> <result column="order_type" property="orderType" jdbcType="INTEGER"/> <result column="state" property="state" jdbcType="INTEGER"/> <result column="drawback_time" property="drawbackTime" jdbcType="BIGINT"/> <result column="createtime" property="createtime" jdbcType="BIGINT"/> <result column="beizhu" property="beizhu" jdbcType="VARCHAR"/> <result column="money" property="money" jdbcType="DECIMAL"/> <result column="version" property="version" jdbcType="INTEGER"/> <result column="third_createtime" property="thirdCreateTime"/> <result column="third_state" property="thirdState" jdbcType="VARCHAR"/> <result column="state_desc" property="stateDesc" jdbcType="VARCHAR"/> <association property="userInfo" column="uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> <id column="uid" property="id" jdbcType="BIGINT"/> </association> <select id="selectOrderByOrderIdAndOrderType" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from yeshi_ec_order where orderid = #{orderId} and order_type=#{orderType} </select> <select id="listByUidAndOrderTypeAndBeiZhu" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from yeshi_ec_order where uid = #{uid} and order_type=#{orderType} <if test="beiZhu!=null"> and beizhu=#{beiZhu} </if> </select> <select id="selectByUid" resultMap="BaseResultMap" parameterType="java.lang.Long"> select <include refid="Base_Column_List" /> from yeshi_ec_order where uid = #{0} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_order where id = #{id,jdbcType=BIGINT} </delete> <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.Order" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_order (id,orderid,order_type,state,drawback_time,createtime,uid,beizhu,money,version,third_createtime,third_state) values (#{id,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR},#{orderType,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{drawbackTime,jdbcType=BIGINT},#{createtime,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{beizhu,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{version,jdbcType=INTEGER},#{thirdCreateTime,jdbcType=TIMESTAMP},#{thirdState,jdbcType=VARCHAR}) </insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.Order" useGeneratedKeys="true" keyProperty="id"> insert into yeshi_ec_order <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">id,</if> <if test="orderId != null">orderid,</if> <if test="orderType != null">order_type,</if> <if test="state != null">state,</if> <if test="drawbackTime != null">drawback_time,</if> <if test="createtime != null">createtime,</if> <if test="userInfo != null">uid,</if> <if test="beizhu != null">beizhu,</if> <if test="money != null">money,</if> <if test="version != null">version,</if> <if test="thirdCreateTime != null">third_createtime,</if> <if test="thirdState != null">third_state,</if> </trim> values <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">#{id,jdbcType=BIGINT},</if> <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if> <if test="orderType != null">#{orderType,jdbcType=INTEGER},</if> <if test="state != null">#{state,jdbcType=INTEGER},</if> <if test="drawbackTime != null">#{drawbackTime,jdbcType=BIGINT},</if> <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if> <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if> <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if> <if test="money != null">#{money,jdbcType=DECIMAL},</if> <if test="version != null">#{version,jdbcType=INTEGER},</if> <if test="thirdCreateTime != null">#{thirdCreateTime,jdbcType=TIMESTAMP}</if> <if test="thirdState != null">#{thirdState,jdbcType=VARCHAR}</if> </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.Order">update yeshi_ec_order set orderid = #{orderId,jdbcType=VARCHAR},order_type = #{orderType,jdbcType=INTEGER},state = #{state,jdbcType=INTEGER},drawback_time = #{drawbackTime,jdbcType=BIGINT},createtime = #{createtime,jdbcType=BIGINT},uid = #{userInfo.id,jdbcType=BIGINT},beizhu = #{beizhu,jdbcType=VARCHAR},money = #{money,jdbcType=DECIMAL},version = #{version,jdbcType=INTEGER} ,third_createtime =#{thirdCreateTime,jdbcType=TIMESTAMP} ,third_state =#{thirdState,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.Order"> update yeshi_ec_order <set> <if test="orderId != null">orderid=#{orderId,jdbcType=VARCHAR},</if> <if test="orderType != null">order_type=#{orderType,jdbcType=INTEGER},</if> <if test="state != null">state=#{state,jdbcType=INTEGER},</if> <if test="drawbackTime != null">drawback_time=#{drawbackTime,jdbcType=BIGINT},</if> <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if> <if test="userInfo != null">uid=#{userInfo.id,jdbcType=BIGINT},</if> <if test="beizhu != null">beizhu=#{beizhu,jdbcType=VARCHAR},</if> <if test="money != null">money=#{money,jdbcType=DECIMAL},</if> <if test="version != null">version=#{version,jdbcType=INTEGER},</if> <if test="thirdCreateTime !=null">third_createtime =#{thirdCreateTime,jdbcType=TIMESTAMP}, </if> <if test="thirdState !=null">third_state =#{thirdState,jdbcType=VARCHAR},</if> </set> where id = #{id,jdbcType=BIGINT} </update> </resultMap> <sql id="Base_Column_List">id,orderid,order_type,state,drawback_time,createtime,uid,beizhu,money,version,third_createtime,third_state,state_desc</sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select <include refid="Base_Column_List"/> from yeshi_ec_order where id = #{id,jdbcType=BIGINT} </select> <select id="selectOrderByOrderIdAndOrderType" resultMap="BaseResultMap">select <include refid="Base_Column_List"/> from yeshi_ec_order where orderid = #{orderId} and order_type=#{orderType} </select> <select id="listByUidAndOrderTypeAndBeiZhu" resultMap="BaseResultMap">select <include refid="Base_Column_List"/> from yeshi_ec_order where uid = #{uid} and order_type=#{orderType} <if test="beiZhu!=null">and beizhu=#{beiZhu}</if> </select> <select id="selectByUid" resultMap="BaseResultMap" parameterType="java.lang.Long">select <include refid="Base_Column_List"/> from yeshi_ec_order where uid = #{0} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_order where id = #{id,jdbcType=BIGINT}</delete> <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.Order" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_order (id,orderid,order_type,state,drawback_time,createtime,uid,beizhu,money,version,third_createtime,third_state,state_desc) values (#{id,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR},#{orderType,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{drawbackTime,jdbcType=BIGINT},#{createtime,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{beizhu,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{version,jdbcType=INTEGER},#{thirdCreateTime,jdbcType=TIMESTAMP},#{thirdState,jdbcType=VARCHAR},#{stateDesc,jdbcType=VARCHAR})</insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.Order" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_order <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">id,</if> <if test="orderId != null">orderid,</if> <if test="orderType != null">order_type,</if> <if test="state != null">state,</if> <if test="drawbackTime != null">drawback_time,</if> <if test="createtime != null">createtime,</if> <if test="userInfo != null">uid,</if> <if test="beizhu != null">beizhu,</if> <if test="money != null">money,</if> <if test="version != null">version,</if> <if test="thirdCreateTime != null">third_createtime,</if> <if test="thirdState != null">third_state,</if> <if test="stateDesc != null">state_desc,</if> </trim> values <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">#{id,jdbcType=BIGINT},</if> <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if> <if test="orderType != null">#{orderType,jdbcType=INTEGER},</if> <if test="state != null">#{state,jdbcType=INTEGER},</if> <if test="drawbackTime != null">#{drawbackTime,jdbcType=BIGINT},</if> <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if> <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if> <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if> <if test="money != null">#{money,jdbcType=DECIMAL},</if> <if test="version != null">#{version,jdbcType=INTEGER},</if> <if test="thirdCreateTime != null">#{thirdCreateTime,jdbcType=TIMESTAMP},</if> <if test="thirdState != null">#{thirdState,jdbcType=VARCHAR},</if> <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR},</if> </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.Order">update yeshi_ec_order set orderid = #{orderId,jdbcType=VARCHAR},order_type = #{orderType,jdbcType=INTEGER},state = #{state,jdbcType=INTEGER},drawback_time = #{drawbackTime,jdbcType=BIGINT},createtime = #{createtime,jdbcType=BIGINT},uid = #{userInfo.id,jdbcType=BIGINT},beizhu = #{beizhu,jdbcType=VARCHAR},money = #{money,jdbcType=DECIMAL},version = #{version,jdbcType=INTEGER} ,third_createtime =#{thirdCreateTime,jdbcType=TIMESTAMP} ,third_state =#{thirdState,jdbcType=VARCHAR} ,state_desc =#{stateDesc,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT}</update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.Order">update yeshi_ec_order <set> <if test="orderId != null">orderid=#{orderId,jdbcType=VARCHAR},</if> <if test="orderType != null">order_type=#{orderType,jdbcType=INTEGER},</if> <if test="state != null">state=#{state,jdbcType=INTEGER},</if> <if test="drawbackTime != null">drawback_time=#{drawbackTime,jdbcType=BIGINT},</if> <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if> <if test="userInfo != null">uid=#{userInfo.id,jdbcType=BIGINT},</if> <if test="beizhu != null">beizhu=#{beizhu,jdbcType=VARCHAR},</if> <if test="money != null">money=#{money,jdbcType=DECIMAL},</if> <if test="version != null">version=#{version,jdbcType=INTEGER},</if> <if test="thirdCreateTime !=null">third_createtime =#{thirdCreateTime,jdbcType=TIMESTAMP},</if> <if test="thirdState !=null">third_state =#{thirdState,jdbcType=VARCHAR},</if> <if test="stateDesc !=null">state_desc =#{stateDesc,jdbcType=VARCHAR},</if> </set> where id = #{id,jdbcType=BIGINT} </update> </mapper> fanli/src/main/resource/mapping/pdd/PDDOrderMapper.xml
@@ -2,288 +2,199 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.yeshi.fanli.dao.mybatis.pdd.PDDOrderMapper"> <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.pdd.PDDOrder"> <id column="po_id" property="id" jdbcType="BIGINT" /> <result column="po_order_sn" property="orderSn" jdbcType="VARCHAR" /> <result column="po_goods_id" property="goodsId" jdbcType="BIGINT" /> <result column="po_group_id" property="groupId" jdbcType="BIGINT" /> <result column="po_goods_name" property="goodsName" jdbcType="VARCHAR" /> <result column="po_goods_thumbnail_url" property="goodsThumbnailUrl" jdbcType="VARCHAR" /> <result column="po_goods_quantity" property="goodsQuantity" jdbcType="INTEGER" /> <result column="po_goods_price" property="goodsPrice" jdbcType="BIGINT" /> <result column="po_order_amount" property="orderAmount" jdbcType="BIGINT" /> <result column="po_p_id" property="pId" jdbcType="VARCHAR" /> <result column="po_promotion_rate" property="promotionRate" jdbcType="BIGINT" /> <result column="po_promotion_amount" property="promotionAmount" jdbcType="BIGINT" /> <result column="po_order_status" property="orderStatus" jdbcType="INTEGER" /> <result column="po_order_status_desc" property="orderStatusDesc" jdbcType="VARCHAR" /> <result column="po_order_create_time" property="orderCreateTime" jdbcType="BIGINT" /> <result column="po_order_pay_time" property="orderPayTime" jdbcType="BIGINT" /> <result column="po_order_group_success_time" property="orderGroupSuccessTime" jdbcType="BIGINT" /> <result column="po_order_verify_time" property="orderVerifyTime" jdbcType="BIGINT" /> <result column="po_order_modify_at" property="orderModifyAt" jdbcType="BIGINT" /> <result column="po_order_receive_time" property="orderReceiveTime" jdbcType="BIGINT" /> <result column="po_custom_parameters" property="customParameters" jdbcType="VARCHAR" /> <result column="po_order_settle_time" property="orderSettleTime" jdbcType="BIGINT" /> <result column="po_order_id" property="orderId" jdbcType="VARCHAR" /> <result column="po_create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="po_update_time" property="updateTime" jdbcType="TIMESTAMP" /> </resultMap> <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.pdd.PDDOrder"> <id column="po_id" property="id" jdbcType="BIGINT"/> <result column="po_order_sn" property="orderSn" jdbcType="VARCHAR"/> <result column="po_goods_id" property="goodsId" jdbcType="BIGINT"/> <result column="po_group_id" property="groupId" jdbcType="BIGINT"/> <result column="po_goods_name" property="goodsName" jdbcType="VARCHAR"/> <result column="po_goods_thumbnail_url" property="goodsThumbnailUrl" jdbcType="VARCHAR"/> <result column="po_goods_quantity" property="goodsQuantity" jdbcType="INTEGER"/> <result column="po_goods_price" property="goodsPrice" jdbcType="BIGINT"/> <result column="po_order_amount" property="orderAmount" jdbcType="BIGINT"/> <result column="po_p_id" property="pId" jdbcType="VARCHAR"/> <result column="po_promotion_rate" property="promotionRate" jdbcType="BIGINT"/> <result column="po_promotion_amount" property="promotionAmount" jdbcType="BIGINT"/> <result column="po_order_status" property="orderStatus" jdbcType="INTEGER"/> <result column="po_order_status_desc" property="orderStatusDesc" jdbcType="VARCHAR"/> <result column="po_order_create_time" property="orderCreateTime" jdbcType="BIGINT"/> <result column="po_order_pay_time" property="orderPayTime" jdbcType="BIGINT"/> <result column="po_order_group_success_time" property="orderGroupSuccessTime" jdbcType="BIGINT"/> <result column="po_order_verify_time" property="orderVerifyTime" jdbcType="BIGINT"/> <result column="po_order_modify_at" property="orderModifyAt" jdbcType="BIGINT"/> <result column="po_order_receive_time" property="orderReceiveTime" jdbcType="BIGINT"/> <result column="po_custom_parameters" property="customParameters" jdbcType="VARCHAR"/> <result column="po_order_settle_time" property="orderSettleTime" jdbcType="BIGINT"/> <result column="po_order_id" property="orderId" jdbcType="VARCHAR"/> <result column="po_create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="po_update_time" property="updateTime" jdbcType="TIMESTAMP"/> <result column="po_fail_reason" property="failReason" jdbcType="VARCHAR"/> </resultMap> <resultMap id="ChartMap" type="com.yeshi.fanli.dto.ChartTDO"> <result column="showDate" property="showDate" jdbcType="VARCHAR" /> <result column="showValue" property="showValue" jdbcType="VARCHAR" /> </resultMap> <sql id="Base_Column_List">po_id,po_order_sn,po_goods_id,po_group_id,po_goods_name,po_goods_thumbnail_url,po_goods_quantity,po_goods_price,po_order_amount,po_p_id,po_promotion_rate,po_promotion_amount,po_order_status,po_order_status_desc,po_order_create_time,po_order_pay_time,po_order_group_success_time,po_order_verify_time,po_order_modify_at,po_custom_parameters,po_order_settle_time,po_order_id,po_create_time,po_update_time,po_order_receive_time </sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> select <include refid="Base_Column_List" /> from yeshi_ec_pdd_order where po_id = #{id,jdbcType=BIGINT} </select> <select id="selectByOrderSN" resultMap="BaseResultMap" parameterType="java.lang.String"> select <include refid="Base_Column_List" /> from yeshi_ec_pdd_order where po_order_sn = #{0} </select> <result column="showDate" property="showDate" jdbcType="VARCHAR"/> <result column="showValue" property="showValue" jdbcType="VARCHAR"/> </resultMap> <sql id="Base_Column_List">po_id,po_order_sn,po_goods_id,po_group_id,po_goods_name,po_goods_thumbnail_url,po_goods_quantity,po_goods_price,po_order_amount,po_p_id,po_promotion_rate,po_promotion_amount,po_order_status,po_order_status_desc,po_order_create_time,po_order_pay_time,po_order_group_success_time,po_order_verify_time,po_order_modify_at,po_custom_parameters,po_order_settle_time,po_order_id,po_create_time,po_update_time,po_order_receive_time,po_fail_reason</sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select <include refid="Base_Column_List"/> from yeshi_ec_pdd_order where po_id = #{id,jdbcType=BIGINT} </select> <select id="selectByOrderSN" resultMap="BaseResultMap" parameterType="java.lang.String">select <include refid="Base_Column_List"/> from yeshi_ec_pdd_order where po_order_sn = #{0} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_pdd_order where po_id = #{id,jdbcType=BIGINT} </delete> <insert id="insert" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_pdd_order (po_id,po_order_sn,po_goods_id,po_group_id,po_goods_name,po_goods_thumbnail_url,po_goods_quantity,po_goods_price,po_order_amount,po_p_id,po_promotion_rate,po_promotion_amount,po_order_status,po_order_status_desc,po_order_create_time,po_order_pay_time,po_order_group_success_time,po_order_verify_time,po_order_modify_at,po_custom_parameters,po_order_settle_time,po_order_id,po_create_time,po_update_time,po_order_receive_time) values (#{id,jdbcType=BIGINT},#{orderSn,jdbcType=VARCHAR},#{goodsId,jdbcType=BIGINT},#{groupId,jdbcType=BIGINT},#{goodsName,jdbcType=VARCHAR},#{goodsThumbnailUrl,jdbcType=VARCHAR},#{goodsQuantity,jdbcType=INTEGER},#{goodsPrice,jdbcType=BIGINT},#{orderAmount,jdbcType=BIGINT},#{pId,jdbcType=VARCHAR},#{promotionRate,jdbcType=BIGINT},#{promotionAmount,jdbcType=BIGINT},#{orderStatus,jdbcType=INTEGER},#{orderStatusDesc,jdbcType=VARCHAR},#{orderCreateTime,jdbcType=BIGINT},#{orderPayTime,jdbcType=BIGINT},#{orderGroupSuccessTime,jdbcType=BIGINT},#{orderVerifyTime,jdbcType=BIGINT},#{orderModifyAt,jdbcType=BIGINT},#{customParameters,jdbcType=VARCHAR},#{orderSettleTime,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{orderReceiveTime,jdbcType=BIGINT}) </insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder" useGeneratedKeys="true" keyProperty="id"> insert into yeshi_ec_pdd_order <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">po_id,</if> <if test="orderSn != null">po_order_sn,</if> <if test="goodsId != null">po_goods_id,</if> <if test="groupId != null">po_group_id,</if> <if test="goodsName != null">po_goods_name,</if> <if test="goodsThumbnailUrl != null">po_goods_thumbnail_url,</if> <if test="goodsQuantity != null">po_goods_quantity,</if> <if test="goodsPrice != null">po_goods_price,</if> <if test="orderAmount != null">po_order_amount,</if> <if test="pId != null">po_p_id,</if> <if test="promotionRate != null">po_promotion_rate,</if> <if test="promotionAmount != null">po_promotion_amount,</if> <if test="orderStatus != null">po_order_status,</if> <if test="orderStatusDesc != null">po_order_status_desc,</if> <if test="orderCreateTime != null">po_order_create_time,</if> <if test="orderPayTime != null">po_order_pay_time,</if> <if test="orderGroupSuccessTime != null">po_order_group_success_time,</if> <if test="orderVerifyTime != null">po_order_verify_time,</if> <if test="orderModifyAt != null">po_order_modify_at,</if> <if test="customParameters != null">po_custom_parameters,</if> <if test="orderSettleTime != null">po_order_settle_time,</if> <if test="orderId != null">po_order_id,</if> <if test="createTime != null">po_create_time,</if> <if test="updateTime != null">po_update_time,</if> <if test="orderReceiveTime != null">po_order_receive_time,</if> </trim> values <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">#{id,jdbcType=BIGINT},</if> <if test="orderSn != null">#{orderSn,jdbcType=VARCHAR},</if> <if test="goodsId != null">#{goodsId,jdbcType=BIGINT},</if> <if test="groupId != null">#{groupId,jdbcType=BIGINT},</if> <if test="goodsName != null">#{goodsName,jdbcType=VARCHAR},</if> <if test="goodsThumbnailUrl != null">#{goodsThumbnailUrl,jdbcType=VARCHAR},</if> <if test="goodsQuantity != null">#{goodsQuantity,jdbcType=INTEGER},</if> <if test="goodsPrice != null">#{goodsPrice,jdbcType=BIGINT},</if> <if test="orderAmount != null">#{orderAmount,jdbcType=BIGINT},</if> <if test="pId != null">#{pId,jdbcType=VARCHAR},</if> <if test="promotionRate != null">#{promotionRate,jdbcType=BIGINT},</if> <if test="promotionAmount != null">#{promotionAmount,jdbcType=BIGINT},</if> <if test="orderStatus != null">#{orderStatus,jdbcType=INTEGER},</if> <if test="orderStatusDesc != null">#{orderStatusDesc,jdbcType=VARCHAR},</if> <if test="orderCreateTime != null">#{orderCreateTime,jdbcType=BIGINT},</if> <if test="orderPayTime != null">#{orderPayTime,jdbcType=BIGINT},</if> <if test="orderGroupSuccessTime != null">#{orderGroupSuccessTime,jdbcType=BIGINT},</if> <if test="orderVerifyTime != null">#{orderVerifyTime,jdbcType=BIGINT},</if> <if test="orderModifyAt != null">#{orderModifyAt,jdbcType=BIGINT},</if> <if test="customParameters != null">#{customParameters,jdbcType=VARCHAR},</if> <if test="orderSettleTime != null">#{orderSettleTime,jdbcType=BIGINT},</if> <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if> <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> <if test="orderReceiveTime != null">#{orderReceiveTime,jdbcType=BIGINT},</if> </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder">update yeshi_ec_pdd_order set po_order_sn = #{orderSn,jdbcType=VARCHAR},po_goods_id = #{goodsId,jdbcType=BIGINT},po_group_id = #{groupId,jdbcType=BIGINT},po_goods_name = #{goodsName,jdbcType=VARCHAR},po_goods_thumbnail_url = #{goodsThumbnailUrl,jdbcType=VARCHAR},po_goods_quantity = #{goodsQuantity,jdbcType=INTEGER},po_goods_price = #{goodsPrice,jdbcType=BIGINT},po_order_amount = #{orderAmount,jdbcType=BIGINT},po_p_id = #{pId,jdbcType=VARCHAR},po_promotion_rate = #{promotionRate,jdbcType=BIGINT},po_promotion_amount = #{promotionAmount,jdbcType=BIGINT},po_order_status = #{orderStatus,jdbcType=INTEGER},po_order_status_desc = #{orderStatusDesc,jdbcType=VARCHAR},po_order_create_time = #{orderCreateTime,jdbcType=BIGINT},po_order_pay_time = #{orderPayTime,jdbcType=BIGINT},po_order_group_success_time = #{orderGroupSuccessTime,jdbcType=BIGINT},po_order_verify_time = #{orderVerifyTime,jdbcType=BIGINT},po_order_modify_at = #{orderModifyAt,jdbcType=BIGINT},po_custom_parameters = #{customParameters,jdbcType=VARCHAR},po_order_settle_time = #{orderSettleTime,jdbcType=BIGINT},po_order_id = #{orderId,jdbcType=VARCHAR},po_create_time = #{createTime,jdbcType=TIMESTAMP},po_update_time = #{updateTime,jdbcType=TIMESTAMP},po_order_receive_time = #{orderReceiveTime,jdbcType=BIGINT} where po_id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder"> update yeshi_ec_pdd_order <set> <if test="orderSn != null">po_order_sn=#{orderSn,jdbcType=VARCHAR},</if> <if test="goodsId != null">po_goods_id=#{goodsId,jdbcType=BIGINT},</if> <if test="groupId != null">po_group_id=#{groupId,jdbcType=BIGINT},</if> <if test="goodsName != null">po_goods_name=#{goodsName,jdbcType=VARCHAR},</if> <if test="goodsThumbnailUrl != null">po_goods_thumbnail_url=#{goodsThumbnailUrl,jdbcType=VARCHAR}, </if> <if test="goodsQuantity != null">po_goods_quantity=#{goodsQuantity,jdbcType=INTEGER},</if> <if test="goodsPrice != null">po_goods_price=#{goodsPrice,jdbcType=BIGINT},</if> <if test="orderAmount != null">po_order_amount=#{orderAmount,jdbcType=BIGINT},</if> <if test="pId != null">po_p_id=#{pId,jdbcType=VARCHAR},</if> <if test="promotionRate != null">po_promotion_rate=#{promotionRate,jdbcType=BIGINT},</if> <if test="promotionAmount != null">po_promotion_amount=#{promotionAmount,jdbcType=BIGINT}, </if> <if test="orderStatus != null">po_order_status=#{orderStatus,jdbcType=INTEGER},</if> <if test="orderStatusDesc != null">po_order_status_desc=#{orderStatusDesc,jdbcType=VARCHAR}, </if> <if test="orderCreateTime != null">po_order_create_time=#{orderCreateTime,jdbcType=BIGINT}, </if> <if test="orderPayTime != null">po_order_pay_time=#{orderPayTime,jdbcType=BIGINT},</if> <if test="orderGroupSuccessTime != null">po_order_group_success_time=#{orderGroupSuccessTime,jdbcType=BIGINT}, </if> <if test="orderVerifyTime != null">po_order_verify_time=#{orderVerifyTime,jdbcType=BIGINT}, </if> <if test="orderModifyAt != null">po_order_modify_at=#{orderModifyAt,jdbcType=BIGINT},</if> <if test="customParameters != null">po_custom_parameters=#{customParameters,jdbcType=VARCHAR}, </if> <if test="orderSettleTime != null">po_order_settle_time=#{orderSettleTime,jdbcType=BIGINT}, </if> <if test="orderId != null">po_order_id=#{orderId,jdbcType=VARCHAR},</if> <if test="createTime != null">po_create_time=#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">po_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> <if test="orderReceiveTime != null">po_order_receive_time=#{orderReceiveTime,jdbcType=BIGINT}, </if> </set> where po_id = #{id,jdbcType=BIGINT} </update> <!-- 统计 --> <sql id="Column_DateType"> <if test="dateType == 1">FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') AS 'showDate' </if> <if test="dateType == 2">FROM_UNIXTIME(po_order_create_time,'%m') AS 'showDate' </if> <if test="dateType == 3">FROM_UNIXTIME(po_order_create_time,'%Y') AS 'showDate' </if> </sql> <sql id="Count_Select_DateType"> <if test="startTime != null and startTime != '' "> AND FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' </if> <if test="endTime != null and endTime != '' "> AND FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}' </if> <if test="year != null and year != '' ">AND FROM_UNIXTIME(po_order_create_time,'%Y') = '${year}' </if> </sql> <sql id="Count_Group_DateType"> <if test="dateType == 1">GROUP BY FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') </if> <if test="dateType == 2">GROUP BY FROM_UNIXTIME(po_order_create_time,'%Y-%m')</if> <if test="dateType == 3">GROUP BY FROM_UNIXTIME(po_order_create_time,'%Y')</if> </sql> <select id="listByOrderSn" resultMap="BaseResultMap">select <include refid="Base_Column_List"/> from yeshi_ec_pdd_order where <foreach collection="orderSnList" item="orderSn" separator=" or " open="(" close=")"> po_order_sn=#{orderSn} </foreach> </select> <select id="countOrderByDay" resultType="Long"> SELECT COUNT(`po_id`) FROM `yeshi_ec_pdd_order` WHERE FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') = #{preDay} </select> <select id="countOrderNumber" resultMap="ChartMap"> SELECT IFNULL(COUNT(`po_id`),0) AS showValue, <include refid="Column_DateType" /> FROM `yeshi_ec_pdd_order` t WHERE po_order_create_time IS NOT NULL <include refid="Count_Select_DateType" /> <include refid="Count_Group_DateType" /> ORDER BY po_order_create_time </select> <select id="listByStatus" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from yeshi_ec_pdd_order <if test="status!=null"> where po_order_status=#{status} </if> limit #{start},#{count} </select> <select id="countByStatus" resultType="java.lang.Long"> select count(po_id) from yeshi_ec_pdd_order <if test="status!=null"> where po_order_status=#{status} </if> </select> <select id="listQuery" resultMap="BaseResultMap"> SELECT * FROM yeshi_ec_pdd_order f <if test="key != null and key !='' "> WHERE f.`po_order_id` LIKE '${key}%' </if> ORDER BY f.`po_id` DESC LIMIT #{start},#{count} </select> <select id="countQuery" resultType="Long"> SELECT COUNT(f.`po_id`) FROM yeshi_ec_pdd_order f <if test="key != null and key !='' "> WHERE f.`po_order_id` LIKE '${key}%' </if> </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_pdd_order where po_id = #{id,jdbcType=BIGINT}</delete> <insert id="insert" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_pdd_order (po_id,po_order_sn,po_goods_id,po_group_id,po_goods_name,po_goods_thumbnail_url,po_goods_quantity,po_goods_price,po_order_amount,po_p_id,po_promotion_rate,po_promotion_amount,po_order_status,po_order_status_desc,po_order_create_time,po_order_pay_time,po_order_group_success_time,po_order_verify_time,po_order_modify_at,po_custom_parameters,po_order_settle_time,po_order_id,po_create_time,po_update_time,po_order_receive_time,po_fail_reason) values (#{id,jdbcType=BIGINT},#{orderSn,jdbcType=VARCHAR},#{goodsId,jdbcType=BIGINT},#{groupId,jdbcType=BIGINT},#{goodsName,jdbcType=VARCHAR},#{goodsThumbnailUrl,jdbcType=VARCHAR},#{goodsQuantity,jdbcType=INTEGER},#{goodsPrice,jdbcType=BIGINT},#{orderAmount,jdbcType=BIGINT},#{pId,jdbcType=VARCHAR},#{promotionRate,jdbcType=BIGINT},#{promotionAmount,jdbcType=BIGINT},#{orderStatus,jdbcType=INTEGER},#{orderStatusDesc,jdbcType=VARCHAR},#{orderCreateTime,jdbcType=BIGINT},#{orderPayTime,jdbcType=BIGINT},#{orderGroupSuccessTime,jdbcType=BIGINT},#{orderVerifyTime,jdbcType=BIGINT},#{orderModifyAt,jdbcType=BIGINT},#{customParameters,jdbcType=VARCHAR},#{orderSettleTime,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{orderReceiveTime,jdbcType=BIGINT},#{failReason,jdbcType=VARCHAR})</insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_pdd_order <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">po_id,</if> <if test="orderSn != null">po_order_sn,</if> <if test="goodsId != null">po_goods_id,</if> <if test="groupId != null">po_group_id,</if> <if test="goodsName != null">po_goods_name,</if> <if test="goodsThumbnailUrl != null">po_goods_thumbnail_url,</if> <if test="goodsQuantity != null">po_goods_quantity,</if> <if test="goodsPrice != null">po_goods_price,</if> <if test="orderAmount != null">po_order_amount,</if> <if test="pId != null">po_p_id,</if> <if test="promotionRate != null">po_promotion_rate,</if> <if test="promotionAmount != null">po_promotion_amount,</if> <if test="orderStatus != null">po_order_status,</if> <if test="orderStatusDesc != null">po_order_status_desc,</if> <if test="orderCreateTime != null">po_order_create_time,</if> <if test="orderPayTime != null">po_order_pay_time,</if> <if test="orderGroupSuccessTime != null">po_order_group_success_time,</if> <if test="orderVerifyTime != null">po_order_verify_time,</if> <if test="orderModifyAt != null">po_order_modify_at,</if> <if test="customParameters != null">po_custom_parameters,</if> <if test="orderSettleTime != null">po_order_settle_time,</if> <if test="orderId != null">po_order_id,</if> <if test="createTime != null">po_create_time,</if> <if test="updateTime != null">po_update_time,</if> <if test="orderReceiveTime != null">po_order_receive_time,</if> <if test="failReason != null">po_fail_reason,</if> </trim> values <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">#{id,jdbcType=BIGINT},</if> <if test="orderSn != null">#{orderSn,jdbcType=VARCHAR},</if> <if test="goodsId != null">#{goodsId,jdbcType=BIGINT},</if> <if test="groupId != null">#{groupId,jdbcType=BIGINT},</if> <if test="goodsName != null">#{goodsName,jdbcType=VARCHAR},</if> <if test="goodsThumbnailUrl != null">#{goodsThumbnailUrl,jdbcType=VARCHAR},</if> <if test="goodsQuantity != null">#{goodsQuantity,jdbcType=INTEGER},</if> <if test="goodsPrice != null">#{goodsPrice,jdbcType=BIGINT},</if> <if test="orderAmount != null">#{orderAmount,jdbcType=BIGINT},</if> <if test="pId != null">#{pId,jdbcType=VARCHAR},</if> <if test="promotionRate != null">#{promotionRate,jdbcType=BIGINT},</if> <if test="promotionAmount != null">#{promotionAmount,jdbcType=BIGINT},</if> <if test="orderStatus != null">#{orderStatus,jdbcType=INTEGER},</if> <if test="orderStatusDesc != null">#{orderStatusDesc,jdbcType=VARCHAR},</if> <if test="orderCreateTime != null">#{orderCreateTime,jdbcType=BIGINT},</if> <if test="orderPayTime != null">#{orderPayTime,jdbcType=BIGINT},</if> <if test="orderGroupSuccessTime != null">#{orderGroupSuccessTime,jdbcType=BIGINT},</if> <if test="orderVerifyTime != null">#{orderVerifyTime,jdbcType=BIGINT},</if> <if test="orderModifyAt != null">#{orderModifyAt,jdbcType=BIGINT},</if> <if test="customParameters != null">#{customParameters,jdbcType=VARCHAR},</if> <if test="orderSettleTime != null">#{orderSettleTime,jdbcType=BIGINT},</if> <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if> <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> <if test="orderReceiveTime != null">#{orderReceiveTime,jdbcType=BIGINT},</if> <if test="failReason != null">#{failReason,jdbcType=VARCHAR}</if> </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder">update yeshi_ec_pdd_order set po_order_sn = #{orderSn,jdbcType=VARCHAR},po_goods_id = #{goodsId,jdbcType=BIGINT},po_group_id = #{groupId,jdbcType=BIGINT},po_goods_name = #{goodsName,jdbcType=VARCHAR},po_goods_thumbnail_url = #{goodsThumbnailUrl,jdbcType=VARCHAR},po_goods_quantity = #{goodsQuantity,jdbcType=INTEGER},po_goods_price = #{goodsPrice,jdbcType=BIGINT},po_order_amount = #{orderAmount,jdbcType=BIGINT},po_p_id = #{pId,jdbcType=VARCHAR},po_promotion_rate = #{promotionRate,jdbcType=BIGINT},po_promotion_amount = #{promotionAmount,jdbcType=BIGINT},po_order_status = #{orderStatus,jdbcType=INTEGER},po_order_status_desc = #{orderStatusDesc,jdbcType=VARCHAR},po_order_create_time = #{orderCreateTime,jdbcType=BIGINT},po_order_pay_time = #{orderPayTime,jdbcType=BIGINT},po_order_group_success_time = #{orderGroupSuccessTime,jdbcType=BIGINT},po_order_verify_time = #{orderVerifyTime,jdbcType=BIGINT},po_order_modify_at = #{orderModifyAt,jdbcType=BIGINT},po_custom_parameters = #{customParameters,jdbcType=VARCHAR},po_order_settle_time = #{orderSettleTime,jdbcType=BIGINT},po_order_id = #{orderId,jdbcType=VARCHAR},po_create_time = #{createTime,jdbcType=TIMESTAMP},po_update_time = #{updateTime,jdbcType=TIMESTAMP},po_order_receive_time = #{orderReceiveTime,jdbcType=BIGINT} ,po_fail_reason =#{failReason,jdbcType=VARCHAR} where po_id = #{id,jdbcType=BIGINT}</update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.pdd.PDDOrder">update yeshi_ec_pdd_order <set> <if test="orderSn != null">po_order_sn=#{orderSn,jdbcType=VARCHAR},</if> <if test="goodsId != null">po_goods_id=#{goodsId,jdbcType=BIGINT},</if> <if test="groupId != null">po_group_id=#{groupId,jdbcType=BIGINT},</if> <if test="goodsName != null">po_goods_name=#{goodsName,jdbcType=VARCHAR},</if> <if test="goodsThumbnailUrl != null">po_goods_thumbnail_url=#{goodsThumbnailUrl,jdbcType=VARCHAR},</if> <if test="goodsQuantity != null">po_goods_quantity=#{goodsQuantity,jdbcType=INTEGER},</if> <if test="goodsPrice != null">po_goods_price=#{goodsPrice,jdbcType=BIGINT},</if> <if test="orderAmount != null">po_order_amount=#{orderAmount,jdbcType=BIGINT},</if> <if test="pId != null">po_p_id=#{pId,jdbcType=VARCHAR},</if> <if test="promotionRate != null">po_promotion_rate=#{promotionRate,jdbcType=BIGINT},</if> <if test="promotionAmount != null">po_promotion_amount=#{promotionAmount,jdbcType=BIGINT},</if> <if test="orderStatus != null">po_order_status=#{orderStatus,jdbcType=INTEGER},</if> <if test="orderStatusDesc != null">po_order_status_desc=#{orderStatusDesc,jdbcType=VARCHAR},</if> <if test="orderCreateTime != null">po_order_create_time=#{orderCreateTime,jdbcType=BIGINT},</if> <if test="orderPayTime != null">po_order_pay_time=#{orderPayTime,jdbcType=BIGINT},</if> <if test="orderGroupSuccessTime != null"> po_order_group_success_time=#{orderGroupSuccessTime,jdbcType=BIGINT}, </if> <if test="orderVerifyTime != null">po_order_verify_time=#{orderVerifyTime,jdbcType=BIGINT},</if> <if test="orderModifyAt != null">po_order_modify_at=#{orderModifyAt,jdbcType=BIGINT},</if> <if test="customParameters != null">po_custom_parameters=#{customParameters,jdbcType=VARCHAR},</if> <if test="orderSettleTime != null">po_order_settle_time=#{orderSettleTime,jdbcType=BIGINT},</if> <if test="orderId != null">po_order_id=#{orderId,jdbcType=VARCHAR},</if> <if test="createTime != null">po_create_time=#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">po_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> <if test="orderReceiveTime != null">po_order_receive_time=#{orderReceiveTime,jdbcType=BIGINT},</if> <if test="failReason !=null">po_fail_reason =#{failReason,jdbcType=VARCHAR},</if> </set> where po_id = #{id,jdbcType=BIGINT} </update> <!-- 统计 --> <sql id="Column_DateType"> <if test="dateType == 1">FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') AS 'showDate'</if> <if test="dateType == 2">FROM_UNIXTIME(po_order_create_time,'%m') AS 'showDate'</if> <if test="dateType == 3">FROM_UNIXTIME(po_order_create_time,'%Y') AS 'showDate'</if> </sql> <sql id="Count_Select_DateType"> <if test="startTime != null and startTime != '' ">AND FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') <![CDATA[ >= ]]>'${startTime}' </if> <if test="endTime != null and endTime != '' ">AND FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}' </if> <if test="year != null and year != '' ">AND FROM_UNIXTIME(po_order_create_time,'%Y') = '${year}'</if> </sql> <sql id="Count_Group_DateType"> <if test="dateType == 1">GROUP BY FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d')</if> <if test="dateType == 2">GROUP BY FROM_UNIXTIME(po_order_create_time,'%Y-%m')</if> <if test="dateType == 3">GROUP BY FROM_UNIXTIME(po_order_create_time,'%Y')</if> </sql> <select id="countOrderByDay" resultType="Long">SELECT COUNT(`po_id`) FROM `yeshi_ec_pdd_order` WHERE FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') = #{preDay}</select> <select id="countOrderNumber" resultMap="ChartMap">SELECT IFNULL(COUNT(`po_id`),0) AS showValue, <include refid="Column_DateType"/> FROM `yeshi_ec_pdd_order` t WHERE po_order_create_time IS NOT NULL <include refid="Count_Select_DateType"/> <include refid="Count_Group_DateType"/> ORDER BY po_order_create_time </select> <select id="listByStatus" resultMap="BaseResultMap">select <include refid="Base_Column_List"/> from yeshi_ec_pdd_order <if test="status!=null">where po_order_status=#{status}</if> limit #{start},#{count} </select> <select id="countByStatus" resultType="java.lang.Long">select count(po_id) from yeshi_ec_pdd_order <if test="status!=null">where po_order_status=#{status}</if> </select> <select id="listQuery" resultMap="BaseResultMap">SELECT * FROM yeshi_ec_pdd_order f <if test="key != null and key !='' ">WHERE f.`po_order_id` LIKE '${key}%'</if> ORDER BY f.`po_id` DESC LIMIT #{start},#{count} </select> <select id="countQuery" resultType="Long">SELECT COUNT(f.`po_id`) FROM yeshi_ec_pdd_order f <if test="key != null and key !='' ">WHERE f.`po_order_id` LIKE '${key}%'</if> </select> </mapper>