New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.jd; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.jd.JDOrderItem; |
| | | |
| | | public interface JDOrderItemMapper extends BaseMapper<JDOrderItem> { |
| | | |
| | | /** |
| | | * 根据交易ID查询 |
| | | * |
| | | * @param tradeId |
| | | * @return |
| | | */ |
| | | JDOrderItem selectByTradeId(String tradeId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.jd; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.jd.JDOrder; |
| | | |
| | | public interface JDOrderMapper extends BaseMapper<JDOrder> { |
| | | |
| | | /** |
| | | * 根据订单号检索 |
| | | * |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | JDOrder selectByOrderId(Long orderId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dto.jd;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | |
|
| | | public class JDOrderResult {
|
| | | private boolean hasMore;
|
| | | private List<JDOrder> orderList;
|
| | |
|
| | | public JDOrderResult(boolean hasMore, List<JDOrder> orderList) {
|
| | | this.hasMore = hasMore;
|
| | | this.orderList = orderList;
|
| | | }
|
| | | |
| | | public JDOrderResult() {
|
| | | |
| | | }
|
| | |
|
| | | public boolean isHasMore() {
|
| | | return hasMore;
|
| | | }
|
| | |
|
| | | public void setHasMore(boolean hasMore) {
|
| | | this.hasMore = hasMore;
|
| | | }
|
| | |
|
| | | public List<JDOrder> getOrderList() {
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | public void setOrderList(List<JDOrder> orderList) {
|
| | | this.orderList = orderList;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.jd;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.SerializedName;
|
| | |
|
| | | @Table("yeshi_ec_jd_order")
|
| | | public class JDOrder {
|
| | | @Column(name = "jo_id")
|
| | | private Long id;// 主键ID
|
| | | // 主订单维度
|
| | | @Column(name = "jo_finish_time")
|
| | | private Long finishTime;// 订单完成时间(时间戳,毫秒)
|
| | | @Column(name = "jo_order_emt")
|
| | | private Integer orderEmt;// 下单设备(1:PC,2:无线)
|
| | | @Column(name = "jo_order_id")
|
| | | private Long orderId;// 订单ID
|
| | | @Column(name = "jo_order_time")
|
| | | private Long orderTime;// 下单时间(时间戳,毫秒)
|
| | | @Column(name = "jo_parent_id")
|
| | | private Long parentId;// 父单的订单ID,仅当发生订单拆分时返回, 0:未拆分,有值则表示此订单为子订单
|
| | | @Column(name = "jo_pay_month")
|
| | | private String payMonth;// 订单维度预估结算时间(格式:yyyyMMdd),0:未结算,订单的预估结算时间仅供参考。账号未通过资质审核或订单发生售后,会影响订单实际结算时间。
|
| | | @Column(name = "jo_plus")
|
| | | private Integer plus;// 下单用户是否为PLUS会员 0:否,1:是
|
| | | @Column(name = "jo_pop_id")
|
| | | private Long popId;// 商家ID
|
| | | @Column(name = "jo_union_id")
|
| | | private Long unionId;// 推客的联盟ID
|
| | | @Column(name = "jo_ext1")
|
| | | private String ext1;// 推客生成推广链接时传入的扩展字段,订单维度(需要联系运营开放白名单才能拿到数据)
|
| | | @Column(name = "jo_valid_code")
|
| | | private Integer validCode;// 订单维度的有效码
|
| | | @Column(name = "jo_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "jo_update_time")
|
| | | private Date updateTime;
|
| | | @SerializedName("skuList")
|
| | | private List<JDOrderItem> orderItemList;
|
| | |
|
| | | public List<JDOrderItem> getOrderItemList() {
|
| | | return orderItemList;
|
| | | }
|
| | |
|
| | | public void setOrderItemList(List<JDOrderItem> orderItemList) {
|
| | | this.orderItemList = orderItemList;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getFinishTime() {
|
| | | return finishTime;
|
| | | }
|
| | |
|
| | | public void setFinishTime(Long finishTime) {
|
| | | this.finishTime = finishTime;
|
| | | }
|
| | |
|
| | | public Integer getOrderEmt() {
|
| | | return orderEmt;
|
| | | }
|
| | |
|
| | | public void setOrderEmt(Integer orderEmt) {
|
| | | this.orderEmt = orderEmt;
|
| | | }
|
| | |
|
| | | public Long getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(Long orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public Long getOrderTime() {
|
| | | return orderTime;
|
| | | }
|
| | |
|
| | | public void setOrderTime(Long orderTime) {
|
| | | this.orderTime = orderTime;
|
| | | }
|
| | |
|
| | | public Long getParentId() {
|
| | | return parentId;
|
| | | }
|
| | |
|
| | | public void setParentId(Long parentId) {
|
| | | this.parentId = parentId;
|
| | | }
|
| | |
|
| | | public String getPayMonth() {
|
| | | return payMonth;
|
| | | }
|
| | |
|
| | | public void setPayMonth(String payMonth) {
|
| | | this.payMonth = payMonth;
|
| | | }
|
| | |
|
| | | public Integer getPlus() {
|
| | | return plus;
|
| | | }
|
| | |
|
| | | public void setPlus(Integer plus) {
|
| | | this.plus = plus;
|
| | | }
|
| | |
|
| | | public Long getPopId() {
|
| | | return popId;
|
| | | }
|
| | |
|
| | | public void setPopId(Long popId) {
|
| | | this.popId = popId;
|
| | | }
|
| | |
|
| | | public Long getUnionId() {
|
| | | return unionId;
|
| | | }
|
| | |
|
| | | public void setUnionId(Long unionId) {
|
| | | this.unionId = unionId;
|
| | | }
|
| | |
|
| | | public String getExt1() {
|
| | | return ext1;
|
| | | }
|
| | |
|
| | | public void setExt1(String ext1) {
|
| | | this.ext1 = ext1;
|
| | | }
|
| | |
|
| | | public Integer getValidCode() {
|
| | | return validCode;
|
| | | }
|
| | |
|
| | | public void setValidCode(Integer validCode) {
|
| | | this.validCode = validCode;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.jd;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | @Table("yeshi_ec_jd_order_item")
|
| | | public class JDOrderItem {
|
| | | // 子订单维度
|
| | | @Column(name = "joi_id")
|
| | | private Long id;
|
| | |
|
| | | @Column(name = "joi_order_id")
|
| | | private Long orderId;
|
| | |
|
| | | @Column(name = "joi_actual_cos_price")
|
| | | private BigDecimal actualCosPrice;// 实际计算佣金的金额。订单完成后,会将误扣除的运费券金额更正。如订单完成后发生退款,此金额会更新。
|
| | |
|
| | | @Column(name = "joi_actual_fee")
|
| | | private BigDecimal actualFee;// 推客获得的实际佣金(实际计佣金额*佣金比例*最终比例)。如订单完成后发生退款,此金额会更新。
|
| | |
|
| | | @Column(name = "joi_commission_rate")
|
| | | private BigDecimal commissionRate;// 佣金比例
|
| | |
|
| | | @Column(name = "joi_estimate_cos_price")
|
| | | private BigDecimal estimateCosPrice;// 预估计佣金额
|
| | |
|
| | | @Column(name = "joi_estimate_fee")
|
| | | private BigDecimal estimateFee;// 推客的预估佣金(预估计佣金额*佣金比例*最终比例),如订单完成前发生退款,此金额不会更新。
|
| | |
|
| | | @Column(name = "joi_final_rate")
|
| | | private BigDecimal finalRate;// 最终比例(分成比例+补贴比例)
|
| | |
|
| | | @Column(name = "joi_cid1")
|
| | | private Long cid1;// 一级类目ID
|
| | |
|
| | | @Column(name = "joi_frozen_sku_num")
|
| | | private Long frozenSkuNum;// 商品售后中数量
|
| | |
|
| | | @Column(name = "joi_pid")
|
| | | private String pid;// 联盟子站长身份标识,格式:子站长ID_子站长网站ID_子站长推广位ID
|
| | |
|
| | | @Column(name = "joi_position_id")
|
| | | private Long positionId;// 推广位ID,0代表无推广位
|
| | |
|
| | | @Column(name = "joi_price")
|
| | | private BigDecimal price;// 商品单价
|
| | |
|
| | | @Column(name = "joi_cid2")
|
| | | private Long cid2;// 二级类目ID
|
| | |
|
| | | @Column(name = "joi_site_id")
|
| | | private Long siteId;// 网站ID,0:无网站
|
| | |
|
| | | @Column(name = "joi_sku_id")
|
| | | private Long skuId;// 商品ID
|
| | |
|
| | | @Column(name = "joi_sku_name")
|
| | | private String skuName;// 商品名称
|
| | |
|
| | | @Column(name = "joi_sku_num")
|
| | | private Long skuNum;// 商品数量
|
| | |
|
| | | @Column(name = "joi_sku_return_num")
|
| | | private Long skuReturnNum;// 商品已退货数量
|
| | |
|
| | | @Column(name = "joi_sub_side_rate")
|
| | | private BigDecimal subSideRate;// 分成比例
|
| | |
|
| | | @Column(name = "joi_sub_sidy_rate")
|
| | | private BigDecimal subsidyRate;// 补贴比例
|
| | |
|
| | | @Column(name = "joi_cid3")
|
| | | private Long cid3;// 三级类目ID
|
| | |
|
| | | @Column(name = "joi_union_alias")
|
| | | private String unionAlias;// PID所属母账号平台名称(原第三方服务商来源)
|
| | |
|
| | | @Column(name = "joi_union_tag")
|
| | | private String unionTag;// 联盟标签数据(整型的二进制字符串(32位),目前只返回8位:00000001。数据从右向左进行,每一位为1表示符合联盟的标签特征,第1位:京喜红包,第2位:组合推广订单,第3位:拼购订单,第5位:有效首次购订单(00011XXX表示有效首购,最终奖励活动结算金额会结合订单状态判断,以联盟后台对应活动效果数据报表https://union.jd.com/active为准)。例如:00000001:京喜红包订单,00000010:组合推广订单,00000100:拼购订单,00011000:有效首购,00000111:京喜红包+组合推广+拼购等)
|
| | |
|
| | | @Column(name = "joi_union_traffic_group")
|
| | | private Integer unionTrafficGroup;// 渠道组 1:1号店,其他:京东
|
| | |
|
| | | @Column(name = "joi_valid_code")
|
| | | private Integer validCode;// sku维度的有效码(-1:未知,2.无效-拆单,3.无效-取消,4.无效-京东帮帮主订单,5.无效-账号异常,6.无效-赠品类目不返佣,7.无效-校园订单,8.无效-企业订单,9.无效-团购订单,10.无效-开增值税专用发票订单,11.无效-乡村推广员下单,12.无效-自己推广自己下单,13.无效-违规订单,14.无效-来源与备案网址不符,15.待付款,16.已付款,17.已完成,18.已结算(5.9号不再支持结算状态回写展示))注:自2018/7/13起,自己推广自己下单已经允许返佣,故12无效码仅针对历史数据有效
|
| | |
|
| | | @Column(name = "joi_sub_union_id")
|
| | | private String subUnionId;// 子联盟ID(需要联系运营开放白名单才能拿到数据)
|
| | |
|
| | | @Column(name = "joi_trace_type")
|
| | | private Integer traceType;// 2:同店;3:跨店
|
| | |
|
| | | @Column(name = "joi_pay_month")
|
| | | private Integer payMonth;// 订单行维度预估结算时间(格式:yyyyMMdd)
|
| | | // ,0:未结算。订单的预估结算时间仅供参考。账号未通过资质审核或订单发生售后,会影响订单实际结算时间。
|
| | | @Column(name = "joi_pop_id")
|
| | | private Long popId;// 商家ID,订单行维度
|
| | |
|
| | | @Column(name = "joi_ext1")
|
| | | private String ext1;// 推客生成推广链接时传入的扩展字段(需要联系运营开放白名单才能拿到数据)。<订单行维度>
|
| | |
|
| | | @Column(name = "joi_trade_id")
|
| | | private String tradeId;// 交易ID=orderId+商品ID
|
| | |
|
| | | @Column(name = "joi_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | @Column(name = "joi_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | @Column(name = "joi_order_by")
|
| | | private Integer orderBy;
|
| | |
|
| | | private JDOrder order;// 父订单
|
| | |
|
| | | public JDOrder getOrder() {
|
| | | return order;
|
| | | }
|
| | |
|
| | | public void setOrder(JDOrder order) {
|
| | | this.order = order;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(Long orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public BigDecimal getActualCosPrice() {
|
| | | return actualCosPrice;
|
| | | }
|
| | |
|
| | | public void setActualCosPrice(BigDecimal actualCosPrice) {
|
| | | this.actualCosPrice = actualCosPrice;
|
| | | }
|
| | |
|
| | | public BigDecimal getActualFee() {
|
| | | return actualFee;
|
| | | }
|
| | |
|
| | | public void setActualFee(BigDecimal actualFee) {
|
| | | this.actualFee = actualFee;
|
| | | }
|
| | |
|
| | | public BigDecimal getCommissionRate() {
|
| | | return commissionRate;
|
| | | }
|
| | |
|
| | | public void setCommissionRate(BigDecimal commissionRate) {
|
| | | this.commissionRate = commissionRate;
|
| | | }
|
| | |
|
| | | public BigDecimal getEstimateCosPrice() {
|
| | | return estimateCosPrice;
|
| | | }
|
| | |
|
| | | public void setEstimateCosPrice(BigDecimal estimateCosPrice) {
|
| | | this.estimateCosPrice = estimateCosPrice;
|
| | | }
|
| | |
|
| | | public BigDecimal getEstimateFee() {
|
| | | return estimateFee;
|
| | | }
|
| | |
|
| | | public void setEstimateFee(BigDecimal estimateFee) {
|
| | | this.estimateFee = estimateFee;
|
| | | }
|
| | |
|
| | | public BigDecimal getFinalRate() {
|
| | | return finalRate;
|
| | | }
|
| | |
|
| | | public void setFinalRate(BigDecimal finalRate) {
|
| | | this.finalRate = finalRate;
|
| | | }
|
| | |
|
| | | public Long getCid1() {
|
| | | return cid1;
|
| | | }
|
| | |
|
| | | public void setCid1(Long cid1) {
|
| | | this.cid1 = cid1;
|
| | | }
|
| | |
|
| | | public Long getFrozenSkuNum() {
|
| | | return frozenSkuNum;
|
| | | }
|
| | |
|
| | | public void setFrozenSkuNum(Long frozenSkuNum) {
|
| | | this.frozenSkuNum = frozenSkuNum;
|
| | | }
|
| | |
|
| | | public String getPid() {
|
| | | return pid;
|
| | | }
|
| | |
|
| | | public void setPid(String pid) {
|
| | | this.pid = pid;
|
| | | }
|
| | |
|
| | | public Long getPositionId() {
|
| | | return positionId;
|
| | | }
|
| | |
|
| | | public void setPositionId(Long positionId) {
|
| | | this.positionId = positionId;
|
| | | }
|
| | |
|
| | | public BigDecimal getPrice() {
|
| | | return price;
|
| | | }
|
| | |
|
| | | public void setPrice(BigDecimal price) {
|
| | | this.price = price;
|
| | | }
|
| | |
|
| | | public Long getCid2() {
|
| | | return cid2;
|
| | | }
|
| | |
|
| | | public void setCid2(Long cid2) {
|
| | | this.cid2 = cid2;
|
| | | }
|
| | |
|
| | | public Long getSiteId() {
|
| | | return siteId;
|
| | | }
|
| | |
|
| | | public void setSiteId(Long siteId) {
|
| | | this.siteId = siteId;
|
| | | }
|
| | |
|
| | | public Long getSkuId() {
|
| | | return skuId;
|
| | | }
|
| | |
|
| | | public void setSkuId(Long skuId) {
|
| | | this.skuId = skuId;
|
| | | }
|
| | |
|
| | | public String getSkuName() {
|
| | | return skuName;
|
| | | }
|
| | |
|
| | | public void setSkuName(String skuName) {
|
| | | this.skuName = skuName;
|
| | | }
|
| | |
|
| | | public Long getSkuNum() {
|
| | | return skuNum;
|
| | | }
|
| | |
|
| | | public void setSkuNum(Long skuNum) {
|
| | | this.skuNum = skuNum;
|
| | | }
|
| | |
|
| | | public Long getSkuReturnNum() {
|
| | | return skuReturnNum;
|
| | | }
|
| | |
|
| | | public void setSkuReturnNum(Long skuReturnNum) {
|
| | | this.skuReturnNum = skuReturnNum;
|
| | | }
|
| | |
|
| | | public BigDecimal getSubSideRate() {
|
| | | return subSideRate;
|
| | | }
|
| | |
|
| | | public void setSubSideRate(BigDecimal subSideRate) {
|
| | | this.subSideRate = subSideRate;
|
| | | }
|
| | |
|
| | | public BigDecimal getSubsidyRate() {
|
| | | return subsidyRate;
|
| | | }
|
| | |
|
| | | public void setSubsidyRate(BigDecimal subsidyRate) {
|
| | | this.subsidyRate = subsidyRate;
|
| | | }
|
| | |
|
| | | public Long getCid3() {
|
| | | return cid3;
|
| | | }
|
| | |
|
| | | public void setCid3(Long cid3) {
|
| | | this.cid3 = cid3;
|
| | | }
|
| | |
|
| | | public String getUnionAlias() {
|
| | | return unionAlias;
|
| | | }
|
| | |
|
| | | public void setUnionAlias(String unionAlias) {
|
| | | this.unionAlias = unionAlias;
|
| | | }
|
| | |
|
| | | public String getUnionTag() {
|
| | | return unionTag;
|
| | | }
|
| | |
|
| | | public void setUnionTag(String unionTag) {
|
| | | this.unionTag = unionTag;
|
| | | }
|
| | |
|
| | | public Integer getUnionTrafficGroup() {
|
| | | return unionTrafficGroup;
|
| | | }
|
| | |
|
| | | public void setUnionTrafficGroup(Integer unionTrafficGroup) {
|
| | | this.unionTrafficGroup = unionTrafficGroup;
|
| | | }
|
| | |
|
| | | public Integer getValidCode() {
|
| | | return validCode;
|
| | | }
|
| | |
|
| | | public void setValidCode(Integer validCode) {
|
| | | this.validCode = validCode;
|
| | | }
|
| | |
|
| | | public String getSubUnionId() {
|
| | | return subUnionId;
|
| | | }
|
| | |
|
| | | public void setSubUnionId(String subUnionId) {
|
| | | this.subUnionId = subUnionId;
|
| | | }
|
| | |
|
| | | public Integer getTraceType() {
|
| | | return traceType;
|
| | | }
|
| | |
|
| | | public void setTraceType(Integer traceType) {
|
| | | this.traceType = traceType;
|
| | | }
|
| | |
|
| | | public Integer getPayMonth() {
|
| | | return payMonth;
|
| | | }
|
| | |
|
| | | public void setPayMonth(Integer payMonth) {
|
| | | this.payMonth = payMonth;
|
| | | }
|
| | |
|
| | | public Long getPopId() {
|
| | | return popId;
|
| | | }
|
| | |
|
| | | public void setPopId(Long popId) {
|
| | | this.popId = popId;
|
| | | }
|
| | |
|
| | | public String getExt1() {
|
| | | return ext1;
|
| | | }
|
| | |
|
| | | public void setExt1(String ext1) {
|
| | | this.ext1 = ext1;
|
| | | }
|
| | |
|
| | | public String getTradeId() {
|
| | | return tradeId;
|
| | | }
|
| | |
|
| | | public void setTradeId(String tradeId) {
|
| | | this.tradeId = tradeId;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public Integer getOrderBy() {
|
| | | return orderBy;
|
| | | }
|
| | |
|
| | | public void setOrderBy(Integer orderBy) {
|
| | | this.orderBy = orderBy;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.jd; |
| | | |
| | | public class JDOrderException extends Exception { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | private int code; |
| | | private String msg; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public JDOrderException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public JDOrderException() { |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return this.msg; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!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.jd.JDOrderItemMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.jd.JDOrderItem"> |
| | | <id column="joi_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="joi_order_id" property="orderId" jdbcType="BIGINT" /> |
| | | <result column="joi_actual_cos_price" property="actualCosPrice" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_actual_fee" property="actualFee" jdbcType="DECIMAL" /> |
| | | <result column="joi_commission_rate" property="commissionRate" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_estimate_cos_price" property="estimateCosPrice" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_estimate_fee" property="estimateFee" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_final_rate" property="finalRate" jdbcType="DECIMAL" /> |
| | | <result column="joi_cid1" property="cid1" jdbcType="BIGINT" /> |
| | | <result column="joi_frozen_sku_num" property="frozenSkuNum" |
| | | jdbcType="BIGINT" /> |
| | | <result column="joi_pid" property="pid" jdbcType="VARCHAR" /> |
| | | <result column="joi_position_id" property="positionId" |
| | | jdbcType="BIGINT" /> |
| | | <result column="joi_price" property="price" jdbcType="DECIMAL" /> |
| | | <result column="joi_cid2" property="cid2" jdbcType="BIGINT" /> |
| | | <result column="joi_site_id" property="siteId" jdbcType="BIGINT" /> |
| | | <result column="joi_sku_id" property="skuId" jdbcType="BIGINT" /> |
| | | <result column="joi_sku_name" property="skuName" jdbcType="VARCHAR" /> |
| | | <result column="joi_sku_num" property="skuNum" jdbcType="BIGINT" /> |
| | | <result column="joi_sku_return_num" property="skuReturnNum" |
| | | jdbcType="BIGINT" /> |
| | | <result column="joi_sub_side_rate" property="subSideRate" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_sub_sidy_rate" property="subsidyRate" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_cid3" property="cid3" jdbcType="BIGINT" /> |
| | | <result column="joi_union_alias" property="unionAlias" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="joi_union_tag" property="unionTag" jdbcType="VARCHAR" /> |
| | | <result column="joi_union_traffic_group" property="unionTrafficGroup" |
| | | jdbcType="INTEGER" /> |
| | | <result column="joi_valid_code" property="validCode" jdbcType="INTEGER" /> |
| | | <result column="joi_sub_union_id" property="subUnionId" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="joi_trace_type" property="traceType" jdbcType="INTEGER" /> |
| | | <result column="joi_pay_month" property="payMonth" jdbcType="INTEGER" /> |
| | | <result column="joi_pop_id" property="popId" jdbcType="BIGINT" /> |
| | | <result column="joi_ext1" property="ext1" jdbcType="VARCHAR" /> |
| | | <result column="joi_trade_id" property="tradeId" jdbcType="VARCHAR" /> |
| | | <result column="joi_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="joi_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="joi_order_by" property="orderBy" jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">joi_id,joi_order_id,joi_actual_cos_price,joi_actual_fee,joi_commission_rate,joi_estimate_cos_price,joi_estimate_fee,joi_final_rate,joi_cid1,joi_frozen_sku_num,joi_pid,joi_position_id,joi_price,joi_cid2,joi_site_id,joi_sku_id,joi_sku_name,joi_sku_num,joi_sku_return_num,joi_sub_side_rate,joi_sub_sidy_rate,joi_cid3,joi_union_alias,joi_union_tag,joi_union_traffic_group,joi_valid_code,joi_sub_union_id,joi_trace_type,joi_pay_month,joi_pop_id,joi_ext1,joi_trade_id,joi_create_time,joi_update_time,joi_order_by |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_jd_order_item where joi_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectByTradeId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_jd_order_item where joi_trade_id = #{0} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_jd_order_item where joi_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.jd.JDOrderItem" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_jd_order_item |
| | | (joi_id,joi_order_id,joi_actual_cos_price,joi_actual_fee,joi_commission_rate,joi_estimate_cos_price,joi_estimate_fee,joi_final_rate,joi_cid1,joi_frozen_sku_num,joi_pid,joi_position_id,joi_price,joi_cid2,joi_site_id,joi_sku_id,joi_sku_name,joi_sku_num,joi_sku_return_num,joi_sub_side_rate,joi_sub_sidy_rate,joi_cid3,joi_union_alias,joi_union_tag,joi_union_traffic_group,joi_valid_code,joi_sub_union_id,joi_trace_type,joi_pay_month,joi_pop_id,joi_ext1,joi_trade_id,joi_create_time,joi_update_time,joi_order_by) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{orderId,jdbcType=BIGINT},#{actualCosPrice,jdbcType=DECIMAL},#{actualFee,jdbcType=DECIMAL},#{commissionRate,jdbcType=DECIMAL},#{estimateCosPrice,jdbcType=DECIMAL},#{estimateFee,jdbcType=DECIMAL},#{finalRate,jdbcType=DECIMAL},#{cid1,jdbcType=BIGINT},#{frozenSkuNum,jdbcType=BIGINT},#{pid,jdbcType=VARCHAR},#{positionId,jdbcType=BIGINT},#{price,jdbcType=DECIMAL},#{cid2,jdbcType=BIGINT},#{siteId,jdbcType=BIGINT},#{skuId,jdbcType=BIGINT},#{skuName,jdbcType=VARCHAR},#{skuNum,jdbcType=BIGINT},#{skuReturnNum,jdbcType=BIGINT},#{subSideRate,jdbcType=DECIMAL},#{subsidyRate,jdbcType=DECIMAL},#{cid3,jdbcType=BIGINT},#{unionAlias,jdbcType=VARCHAR},#{unionTag,jdbcType=VARCHAR},#{unionTrafficGroup,jdbcType=INTEGER},#{validCode,jdbcType=INTEGER},#{subUnionId,jdbcType=VARCHAR},#{traceType,jdbcType=INTEGER},#{payMonth,jdbcType=INTEGER},#{popId,jdbcType=BIGINT},#{ext1,jdbcType=VARCHAR},#{tradeId,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{orderBy,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.jd.JDOrderItem" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_jd_order_item |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">joi_id,</if> |
| | | <if test="orderId != null">joi_order_id,</if> |
| | | <if test="actualCosPrice != null">joi_actual_cos_price,</if> |
| | | <if test="actualFee != null">joi_actual_fee,</if> |
| | | <if test="commissionRate != null">joi_commission_rate,</if> |
| | | <if test="estimateCosPrice != null">joi_estimate_cos_price,</if> |
| | | <if test="estimateFee != null">joi_estimate_fee,</if> |
| | | <if test="finalRate != null">joi_final_rate,</if> |
| | | <if test="cid1 != null">joi_cid1,</if> |
| | | <if test="frozenSkuNum != null">joi_frozen_sku_num,</if> |
| | | <if test="pid != null">joi_pid,</if> |
| | | <if test="positionId != null">joi_position_id,</if> |
| | | <if test="price != null">joi_price,</if> |
| | | <if test="cid2 != null">joi_cid2,</if> |
| | | <if test="siteId != null">joi_site_id,</if> |
| | | <if test="skuId != null">joi_sku_id,</if> |
| | | <if test="skuName != null">joi_sku_name,</if> |
| | | <if test="skuNum != null">joi_sku_num,</if> |
| | | <if test="skuReturnNum != null">joi_sku_return_num,</if> |
| | | <if test="subSideRate != null">joi_sub_side_rate,</if> |
| | | <if test="subsidyRate != null">joi_sub_sidy_rate,</if> |
| | | <if test="cid3 != null">joi_cid3,</if> |
| | | <if test="unionAlias != null">joi_union_alias,</if> |
| | | <if test="unionTag != null">joi_union_tag,</if> |
| | | <if test="unionTrafficGroup != null">joi_union_traffic_group,</if> |
| | | <if test="validCode != null">joi_valid_code,</if> |
| | | <if test="subUnionId != null">joi_sub_union_id,</if> |
| | | <if test="traceType != null">joi_trace_type,</if> |
| | | <if test="payMonth != null">joi_pay_month,</if> |
| | | <if test="popId != null">joi_pop_id,</if> |
| | | <if test="ext1 != null">joi_ext1,</if> |
| | | <if test="tradeId != null">joi_trade_id,</if> |
| | | <if test="createTime != null">joi_create_time,</if> |
| | | <if test="updateTime != null">joi_update_time,</if> |
| | | <if test="orderBy != null">joi_order_by,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="orderId != null">#{orderId,jdbcType=BIGINT},</if> |
| | | <if test="actualCosPrice != null">#{actualCosPrice,jdbcType=DECIMAL},</if> |
| | | <if test="actualFee != null">#{actualFee,jdbcType=DECIMAL},</if> |
| | | <if test="commissionRate != null">#{commissionRate,jdbcType=DECIMAL},</if> |
| | | <if test="estimateCosPrice != null">#{estimateCosPrice,jdbcType=DECIMAL},</if> |
| | | <if test="estimateFee != null">#{estimateFee,jdbcType=DECIMAL},</if> |
| | | <if test="finalRate != null">#{finalRate,jdbcType=DECIMAL},</if> |
| | | <if test="cid1 != null">#{cid1,jdbcType=BIGINT},</if> |
| | | <if test="frozenSkuNum != null">#{frozenSkuNum,jdbcType=BIGINT},</if> |
| | | <if test="pid != null">#{pid,jdbcType=VARCHAR},</if> |
| | | <if test="positionId != null">#{positionId,jdbcType=BIGINT},</if> |
| | | <if test="price != null">#{price,jdbcType=DECIMAL},</if> |
| | | <if test="cid2 != null">#{cid2,jdbcType=BIGINT},</if> |
| | | <if test="siteId != null">#{siteId,jdbcType=BIGINT},</if> |
| | | <if test="skuId != null">#{skuId,jdbcType=BIGINT},</if> |
| | | <if test="skuName != null">#{skuName,jdbcType=VARCHAR},</if> |
| | | <if test="skuNum != null">#{skuNum,jdbcType=BIGINT},</if> |
| | | <if test="skuReturnNum != null">#{skuReturnNum,jdbcType=BIGINT},</if> |
| | | <if test="subSideRate != null">#{subSideRate,jdbcType=DECIMAL},</if> |
| | | <if test="subsidyRate != null">#{subsidyRate,jdbcType=DECIMAL},</if> |
| | | <if test="cid3 != null">#{cid3,jdbcType=BIGINT},</if> |
| | | <if test="unionAlias != null">#{unionAlias,jdbcType=VARCHAR},</if> |
| | | <if test="unionTag != null">#{unionTag,jdbcType=VARCHAR},</if> |
| | | <if test="unionTrafficGroup != null">#{unionTrafficGroup,jdbcType=INTEGER},</if> |
| | | <if test="validCode != null">#{validCode,jdbcType=INTEGER},</if> |
| | | <if test="subUnionId != null">#{subUnionId,jdbcType=VARCHAR},</if> |
| | | <if test="traceType != null">#{traceType,jdbcType=INTEGER},</if> |
| | | <if test="payMonth != null">#{payMonth,jdbcType=INTEGER},</if> |
| | | <if test="popId != null">#{popId,jdbcType=BIGINT},</if> |
| | | <if test="ext1 != null">#{ext1,jdbcType=VARCHAR},</if> |
| | | <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.jd.JDOrderItem">update |
| | | yeshi_ec_jd_order_item set joi_order_id = |
| | | #{orderId,jdbcType=BIGINT},joi_actual_cos_price = |
| | | #{actualCosPrice,jdbcType=DECIMAL},joi_actual_fee = |
| | | #{actualFee,jdbcType=DECIMAL},joi_commission_rate = |
| | | #{commissionRate,jdbcType=DECIMAL},joi_estimate_cos_price = |
| | | #{estimateCosPrice,jdbcType=DECIMAL},joi_estimate_fee = |
| | | #{estimateFee,jdbcType=DECIMAL},joi_final_rate = |
| | | #{finalRate,jdbcType=DECIMAL},joi_cid1 = |
| | | #{cid1,jdbcType=BIGINT},joi_frozen_sku_num = |
| | | #{frozenSkuNum,jdbcType=BIGINT},joi_pid = |
| | | #{pid,jdbcType=VARCHAR},joi_position_id = |
| | | #{positionId,jdbcType=BIGINT},joi_price = |
| | | #{price,jdbcType=DECIMAL},joi_cid2 = |
| | | #{cid2,jdbcType=BIGINT},joi_site_id = |
| | | #{siteId,jdbcType=BIGINT},joi_sku_id = |
| | | #{skuId,jdbcType=BIGINT},joi_sku_name = |
| | | #{skuName,jdbcType=VARCHAR},joi_sku_num = |
| | | #{skuNum,jdbcType=BIGINT},joi_sku_return_num = |
| | | #{skuReturnNum,jdbcType=BIGINT},joi_sub_side_rate = |
| | | #{subSideRate,jdbcType=DECIMAL},joi_sub_sidy_rate = |
| | | #{subsidyRate,jdbcType=DECIMAL},joi_cid3 = |
| | | #{cid3,jdbcType=BIGINT},joi_union_alias = |
| | | #{unionAlias,jdbcType=VARCHAR},joi_union_tag = |
| | | #{unionTag,jdbcType=VARCHAR},joi_union_traffic_group = |
| | | #{unionTrafficGroup,jdbcType=INTEGER},joi_valid_code = |
| | | #{validCode,jdbcType=INTEGER},joi_sub_union_id = |
| | | #{subUnionId,jdbcType=VARCHAR},joi_trace_type = |
| | | #{traceType,jdbcType=INTEGER},joi_pay_month = |
| | | #{payMonth,jdbcType=INTEGER},joi_pop_id = |
| | | #{popId,jdbcType=BIGINT},joi_ext1 = |
| | | #{ext1,jdbcType=VARCHAR},joi_trade_id = |
| | | #{tradeId,jdbcType=VARCHAR},joi_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},joi_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP},joi_order_by = |
| | | #{orderBy,jdbcType=INTEGER} where joi_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.jd.JDOrderItem"> |
| | | update yeshi_ec_jd_order_item |
| | | <set> |
| | | <if test="orderId != null">joi_order_id=#{orderId,jdbcType=BIGINT},</if> |
| | | <if test="actualCosPrice != null">joi_actual_cos_price=#{actualCosPrice,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="actualFee != null">joi_actual_fee=#{actualFee,jdbcType=DECIMAL},</if> |
| | | <if test="commissionRate != null">joi_commission_rate=#{commissionRate,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="estimateCosPrice != null">joi_estimate_cos_price=#{estimateCosPrice,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="estimateFee != null">joi_estimate_fee=#{estimateFee,jdbcType=DECIMAL},</if> |
| | | <if test="finalRate != null">joi_final_rate=#{finalRate,jdbcType=DECIMAL},</if> |
| | | <if test="cid1 != null">joi_cid1=#{cid1,jdbcType=BIGINT},</if> |
| | | <if test="frozenSkuNum != null">joi_frozen_sku_num=#{frozenSkuNum,jdbcType=BIGINT},</if> |
| | | <if test="pid != null">joi_pid=#{pid,jdbcType=VARCHAR},</if> |
| | | <if test="positionId != null">joi_position_id=#{positionId,jdbcType=BIGINT},</if> |
| | | <if test="price != null">joi_price=#{price,jdbcType=DECIMAL},</if> |
| | | <if test="cid2 != null">joi_cid2=#{cid2,jdbcType=BIGINT},</if> |
| | | <if test="siteId != null">joi_site_id=#{siteId,jdbcType=BIGINT},</if> |
| | | <if test="skuId != null">joi_sku_id=#{skuId,jdbcType=BIGINT},</if> |
| | | <if test="skuName != null">joi_sku_name=#{skuName,jdbcType=VARCHAR},</if> |
| | | <if test="skuNum != null">joi_sku_num=#{skuNum,jdbcType=BIGINT},</if> |
| | | <if test="skuReturnNum != null">joi_sku_return_num=#{skuReturnNum,jdbcType=BIGINT},</if> |
| | | <if test="subSideRate != null">joi_sub_side_rate=#{subSideRate,jdbcType=DECIMAL},</if> |
| | | <if test="subsidyRate != null">joi_sub_sidy_rate=#{subsidyRate,jdbcType=DECIMAL},</if> |
| | | <if test="cid3 != null">joi_cid3=#{cid3,jdbcType=BIGINT},</if> |
| | | <if test="unionAlias != null">joi_union_alias=#{unionAlias,jdbcType=VARCHAR},</if> |
| | | <if test="unionTag != null">joi_union_tag=#{unionTag,jdbcType=VARCHAR},</if> |
| | | <if test="unionTrafficGroup != null">joi_union_traffic_group=#{unionTrafficGroup,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="validCode != null">joi_valid_code=#{validCode,jdbcType=INTEGER},</if> |
| | | <if test="subUnionId != null">joi_sub_union_id=#{subUnionId,jdbcType=VARCHAR},</if> |
| | | <if test="traceType != null">joi_trace_type=#{traceType,jdbcType=INTEGER},</if> |
| | | <if test="payMonth != null">joi_pay_month=#{payMonth,jdbcType=INTEGER},</if> |
| | | <if test="popId != null">joi_pop_id=#{popId,jdbcType=BIGINT},</if> |
| | | <if test="ext1 != null">joi_ext1=#{ext1,jdbcType=VARCHAR},</if> |
| | | <if test="tradeId != null">joi_trade_id=#{tradeId,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">joi_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">joi_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderBy != null">joi_order_by=#{orderBy,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where joi_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!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.jd.JDOrderMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.jd.JDOrder"> |
| | | <id column="jo_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="jo_finish_time" property="finishTime" jdbcType="BIGINT" /> |
| | | <result column="jo_order_emt" property="orderEmt" jdbcType="INTEGER" /> |
| | | <result column="jo_order_id" property="orderId" jdbcType="BIGINT" /> |
| | | <result column="jo_order_time" property="orderTime" jdbcType="BIGINT" /> |
| | | <result column="jo_parent_id" property="parentId" jdbcType="BIGINT" /> |
| | | <result column="jo_pay_month" property="payMonth" jdbcType="VARCHAR" /> |
| | | <result column="jo_plus" property="plus" jdbcType="INTEGER" /> |
| | | <result column="jo_pop_id" property="popId" jdbcType="BIGINT" /> |
| | | <result column="jo_union_id" property="unionId" jdbcType="BIGINT" /> |
| | | <result column="jo_ext1" property="ext1" jdbcType="VARCHAR" /> |
| | | <result column="jo_valid_code" property="validCode" jdbcType="INTEGER" /> |
| | | <result column="jo_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="jo_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">jo_id,jo_finish_time,jo_order_emt,jo_order_id,jo_order_time,jo_parent_id,jo_pay_month,jo_plus,jo_pop_id,jo_union_id,jo_ext1,jo_valid_code,jo_create_time,jo_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_jd_order where jo_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectByOrderId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_jd_order where jo_order_id = #{0} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_jd_order where jo_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.jd.JDOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_jd_order |
| | | (jo_id,jo_finish_time,jo_order_emt,jo_order_id,jo_order_time,jo_parent_id,jo_pay_month,jo_plus,jo_pop_id,jo_union_id,jo_ext1,jo_valid_code,jo_create_time,jo_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{finishTime,jdbcType=BIGINT},#{orderEmt,jdbcType=INTEGER},#{orderId,jdbcType=BIGINT},#{orderTime,jdbcType=BIGINT},#{parentId,jdbcType=BIGINT},#{payMonth,jdbcType=VARCHAR},#{plus,jdbcType=INTEGER},#{popId,jdbcType=BIGINT},#{unionId,jdbcType=BIGINT},#{ext1,jdbcType=VARCHAR},#{validCode,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.jd.JDOrder" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_jd_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">jo_id,</if> |
| | | <if test="finishTime != null">jo_finish_time,</if> |
| | | <if test="orderEmt != null">jo_order_emt,</if> |
| | | <if test="orderId != null">jo_order_id,</if> |
| | | <if test="orderTime != null">jo_order_time,</if> |
| | | <if test="parentId != null">jo_parent_id,</if> |
| | | <if test="payMonth != null">jo_pay_month,</if> |
| | | <if test="plus != null">jo_plus,</if> |
| | | <if test="popId != null">jo_pop_id,</if> |
| | | <if test="unionId != null">jo_union_id,</if> |
| | | <if test="ext1 != null">jo_ext1,</if> |
| | | <if test="validCode != null">jo_valid_code,</if> |
| | | <if test="createTime != null">jo_create_time,</if> |
| | | <if test="updateTime != null">jo_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="finishTime != null">#{finishTime,jdbcType=BIGINT},</if> |
| | | <if test="orderEmt != null">#{orderEmt,jdbcType=INTEGER},</if> |
| | | <if test="orderId != null">#{orderId,jdbcType=BIGINT},</if> |
| | | <if test="orderTime != null">#{orderTime,jdbcType=BIGINT},</if> |
| | | <if test="parentId != null">#{parentId,jdbcType=BIGINT},</if> |
| | | <if test="payMonth != null">#{payMonth,jdbcType=VARCHAR},</if> |
| | | <if test="plus != null">#{plus,jdbcType=INTEGER},</if> |
| | | <if test="popId != null">#{popId,jdbcType=BIGINT},</if> |
| | | <if test="unionId != null">#{unionId,jdbcType=BIGINT},</if> |
| | | <if test="ext1 != null">#{ext1,jdbcType=VARCHAR},</if> |
| | | <if test="validCode != null">#{validCode,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.jd.JDOrder">update |
| | | yeshi_ec_jd_order set jo_finish_time = |
| | | #{finishTime,jdbcType=BIGINT},jo_order_emt = |
| | | #{orderEmt,jdbcType=INTEGER},jo_order_id = |
| | | #{orderId,jdbcType=BIGINT},jo_order_time = |
| | | #{orderTime,jdbcType=BIGINT},jo_parent_id = |
| | | #{parentId,jdbcType=BIGINT},jo_pay_month = |
| | | #{payMonth,jdbcType=VARCHAR},jo_plus = |
| | | #{plus,jdbcType=INTEGER},jo_pop_id = |
| | | #{popId,jdbcType=BIGINT},jo_union_id = |
| | | #{unionId,jdbcType=BIGINT},jo_ext1 = |
| | | #{ext1,jdbcType=VARCHAR},jo_valid_code = |
| | | #{validCode,jdbcType=INTEGER},jo_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},jo_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where jo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.jd.JDOrder"> |
| | | update yeshi_ec_jd_order |
| | | <set> |
| | | <if test="finishTime != null">jo_finish_time=#{finishTime,jdbcType=BIGINT},</if> |
| | | <if test="orderEmt != null">jo_order_emt=#{orderEmt,jdbcType=INTEGER},</if> |
| | | <if test="orderId != null">jo_order_id=#{orderId,jdbcType=BIGINT},</if> |
| | | <if test="orderTime != null">jo_order_time=#{orderTime,jdbcType=BIGINT},</if> |
| | | <if test="parentId != null">jo_parent_id=#{parentId,jdbcType=BIGINT},</if> |
| | | <if test="payMonth != null">jo_pay_month=#{payMonth,jdbcType=VARCHAR},</if> |
| | | <if test="plus != null">jo_plus=#{plus,jdbcType=INTEGER},</if> |
| | | <if test="popId != null">jo_pop_id=#{popId,jdbcType=BIGINT},</if> |
| | | <if test="unionId != null">jo_union_id=#{unionId,jdbcType=BIGINT},</if> |
| | | <if test="ext1 != null">jo_ext1=#{ext1,jdbcType=VARCHAR},</if> |
| | | <if test="validCode != null">jo_valid_code=#{validCode,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">jo_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">jo_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where jo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.jd;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.pdd.PDDOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.entity.jd.JDOrderItem;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.exception.HongBaoException;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.exception.pdd.PDDOrderException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.jd.JDOrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | |
|
| | | @Service
|
| | | public class JDOrderProcessServiceImpl implements JDOrderProcessService {
|
| | |
|
| | | @Resource
|
| | | private PDDOrderMapper pddOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Resource
|
| | | private OrderService orderService;
|
| | |
|
| | | @Resource
|
| | | private OrderMapper orderMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Override
|
| | | public void handleOrder(JDOrder jdOrder) throws PDDOrderException {
|
| | | // 区分分享与返利
|
| | | if (jdOrder.getOrderItemList() != null && jdOrder.getOrderItemList().size() > 0) {
|
| | | long positionId = jdOrder.getOrderItemList().get(0).getPositionId();
|
| | | if (positionId == JDApiUtil.POSITION_FANLI) {
|
| | | handleFanLiOrder(jdOrder);
|
| | | } else if (positionId == JDApiUtil.POSITION_SHARE) {
|
| | | handleShareOrder(jdOrder);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void handleFanLiOrder(JDOrder jdOrder) {
|
| | | if (jdOrder != null) {
|
| | | Order oldOrder = orderService.findOrderByOrderIdAndType(jdOrder.getOrderId() + "", Constant.SOURCE_TYPE_JD);
|
| | | // 原来不存在订单
|
| | | Long uid = null;
|
| | | if (oldOrder == null) {
|
| | | // 计算订单状态
|
| | | int state = Order.STATE_SHIXIAO;
|
| | | for (JDOrderItem item : jdOrder.getOrderItemList()) {
|
| | | if (item.getValidCode() >= 16) {
|
| | | state = Order.STATE_YIZHIFU;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(jdOrder.getExt1())) {
|
| | | uid = Long.parseLong(jdOrder.getExt1());
|
| | | Order order = new Order();
|
| | | order.setBeizhu("PID返利订单");
|
| | | order.setCreatetime(System.currentTimeMillis());
|
| | | order.setOrderId(jdOrder.getOrderId() + "");
|
| | | order.setOrderType(Order.ORDER_TYPE_JINGDONG);
|
| | | order.setState(state);
|
| | | order.setUserInfo(new UserInfo(uid));
|
| | | order.setVersion(2);
|
| | | // 加入到订单表
|
| | | orderMapper.insertSelective(order);
|
| | | oldOrder = order;
|
| | | }
|
| | | } else {
|
| | | uid = oldOrder.getUserInfo().getId();
|
| | | }
|
| | | // 尚未找到和PID对应的用户
|
| | | if (uid == null)
|
| | | return;
|
| | |
|
| | | // 计算订单总额度
|
| | | Order updateOrder = new Order();
|
| | | updateOrder.setId(oldOrder.getId());
|
| | | BigDecimal money = new BigDecimal(0);
|
| | | for (JDOrderItem itemOrder : jdOrder.getOrderItemList()) {
|
| | | money = money.add(itemOrder.getEstimateCosPrice());
|
| | | }
|
| | | updateOrder.setMoney(money);
|
| | | String thirdState = jdOrder.getValidCode() + "";
|
| | | updateOrder.setThirdState(thirdState);
|
| | | updateOrder.setThirdCreateTime(new Date(jdOrder.getOrderTime()));
|
| | | orderMapper.updateByPrimaryKeySelective(updateOrder);
|
| | |
|
| | | // 用第一个子订单锁定用户
|
| | | List<CommonOrder> commonOrderList = null;
|
| | | try {
|
| | | commonOrderList = commonOrderService.addJDOrder(jdOrder, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_ZIGOU);
|
| | | } catch (CommonOrderException e) {
|
| | | LogHelper.errorDetailInfo(e, "addJDOrder出错", "订单号:" + jdOrder.getOrderId());
|
| | | } catch (HongBaoException e) {
|
| | | LogHelper.errorDetailInfo(e, "addHongBao出错", "订单号:" + jdOrder.getOrderId());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void handleShareOrder(JDOrder jdOrder) {
|
| | | if (jdOrder != null) {
|
| | | // 原来不存在订单
|
| | | Long uid = null;
|
| | | if (!StringUtil.isNullOrEmpty(jdOrder.getExt1()))
|
| | | uid = Long.parseLong(jdOrder.getExt1());
|
| | |
|
| | | // 尚未找到和PID对应的用户
|
| | | if (uid == null)
|
| | | return;
|
| | |
|
| | | // 用第一个子订单锁定用户
|
| | | List<CommonOrder> commonOrderList = null;
|
| | | try {
|
| | | commonOrderList = commonOrderService.addJDOrder(jdOrder, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_SHARE_GOODS);
|
| | | } catch (CommonOrderException e) {
|
| | | LogHelper.errorDetailInfo(e, "addJDOrder出错", "订单号:" + jdOrder.getOrderId());
|
| | | } catch (HongBaoException e) {
|
| | | LogHelper.errorDetailInfo(e, "addHongBao出错", "订单号:" + jdOrder.getOrderId());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.jd;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.jd.JDOrderItemMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.jd.JDOrderMapper;
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.entity.jd.JDOrderItem;
|
| | | import com.yeshi.fanli.exception.jd.JDOrderException;
|
| | | import com.yeshi.fanli.service.inter.jd.JDOrderService;
|
| | |
|
| | | @Service
|
| | | public class JDOrderServiceImpl implements JDOrderService {
|
| | | @Resource
|
| | | private JDOrderItemMapper jdOrderItemMapper;
|
| | | @Resource
|
| | | private JDOrderMapper jdOrderMapper;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addJDOrder(JDOrder order) throws JDOrderException {
|
| | | if (order == null)
|
| | | throw new JDOrderException(1, "订单为空");
|
| | | JDOrder oldOrder = jdOrderMapper.selectByOrderId(order.getOrderId());
|
| | | if (oldOrder != null)// 更新
|
| | | {
|
| | | order.setId(oldOrder.getId());
|
| | | order.setUpdateTime(new Date());
|
| | | jdOrderMapper.updateByPrimaryKeySelective(order);
|
| | | for (JDOrderItem item : order.getOrderItemList()) {// 新增
|
| | | JDOrderItem oldItem = jdOrderItemMapper.selectByTradeId(item.getTradeId());
|
| | | if (oldItem != null)// 更新
|
| | | {
|
| | | item.setId(oldItem.getId());
|
| | | item.setUpdateTime(new Date());
|
| | | jdOrderItemMapper.updateByPrimaryKeySelective(item);
|
| | | } else {// 新增
|
| | | item.setCreateTime(new Date());
|
| | | jdOrderItemMapper.insertSelective(item);
|
| | | }
|
| | | }
|
| | | } else {// 新增
|
| | | if (order.getOrderItemList() == null || order.getOrderItemList().size() == 0)
|
| | | throw new JDOrderException(2, "子订单为空");
|
| | |
|
| | | if (order.getCreateTime() == null)
|
| | | order.setCreateTime(new Date());
|
| | | jdOrderMapper.insertSelective(order);
|
| | |
|
| | | for (JDOrderItem item : order.getOrderItemList()) {// 新增
|
| | | if (item.getCreateTime() == null)
|
| | | item.setCreateTime(new Date());
|
| | | jdOrderItemMapper.insertSelective(item);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.pdd;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.pdd.PDDOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.exception.HongBaoException;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.exception.pdd.PDDOrderException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.pdd.PDDOrderProcessService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | |
|
| | | @Service
|
| | | public class PDDOrderProcessServiceImpl implements PDDOrderProcessService {
|
| | |
|
| | | @Resource
|
| | | private PDDOrderMapper pddOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Resource
|
| | | private OrderService orderService;
|
| | |
|
| | | @Resource
|
| | | private OrderMapper orderMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Override
|
| | | public void handleOrder(PDDOrder pddOrder) throws PDDOrderException {
|
| | | // 区分分享与返利
|
| | | if (pddOrder.getpId().equalsIgnoreCase(PinDuoDuoApiUtil.PID_FANLI)) {
|
| | | handleFanLiOrder(pddOrder);
|
| | | } else if (pddOrder.getpId().equalsIgnoreCase(PinDuoDuoApiUtil.PID_SHARE)) {
|
| | | handleShareOrder(pddOrder);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void handleFanLiOrder(PDDOrder pddOrder) {
|
| | | if (pddOrder != null) {
|
| | | Order oldOrder = orderService.findOrderByOrderIdAndType(pddOrder.getOrderSn(), Constant.SOURCE_TYPE_PDD);
|
| | | // 原来不存在订单
|
| | | Long uid = null;
|
| | | if (oldOrder == null) {
|
| | | if (!StringUtil.isNullOrEmpty(pddOrder.getCustomParameters())) {
|
| | | uid = Long.parseLong(pddOrder.getCustomParameters());
|
| | | Order order = new Order();
|
| | | order.setBeizhu("PID返利订单");
|
| | | order.setCreatetime(System.currentTimeMillis());
|
| | | order.setOrderId(pddOrder.getOrderSn());
|
| | | order.setOrderType(Order.ORDER_TYPE_PDD);
|
| | | 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;
|
| | |
|
| | | // 计算订单总额度
|
| | | Order updateOrder = new Order();
|
| | | updateOrder.setId(oldOrder.getId());
|
| | | BigDecimal money = new BigDecimal(0);
|
| | | money = money.add(MoneyBigDecimalUtil.div(new BigDecimal(pddOrder.getOrderAmount()), new BigDecimal(100)));
|
| | | updateOrder.setMoney(money);
|
| | | String thirdState = pddOrder.getOrderStatus() + "";
|
| | | updateOrder.setThirdState(thirdState);
|
| | | updateOrder.setThirdCreateTime(new Date(pddOrder.getOrderCreateTime() * 1000));
|
| | | orderMapper.updateByPrimaryKeySelective(updateOrder);
|
| | |
|
| | | // 用第一个子订单锁定用户
|
| | | List<CommonOrder> commonOrderList = null;
|
| | | try {
|
| | | List<PDDOrder> pddOrderList = new ArrayList<>();
|
| | | pddOrderList.add(pddOrder);
|
| | | commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_ZIGOU);
|
| | | } catch (CommonOrderException e) {
|
| | | LogHelper.errorDetailInfo(e, "addTaoBaoOrder或addHongBao出错", "订单号:" + pddOrder.getOrderSn());
|
| | | } catch (HongBaoException e) {
|
| | | LogHelper.errorDetailInfo(e, "addTaoBaoOrder或addHongBao出错", "订单号:" + pddOrder.getOrderSn());
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void handleShareOrder(PDDOrder pddOrder) {
|
| | | if (pddOrder != null) {
|
| | | // 原来不存在订单
|
| | | Long uid = null;
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(pddOrder.getCustomParameters()))
|
| | | uid = Long.parseLong(pddOrder.getCustomParameters());
|
| | |
|
| | | // 尚未找到和PID对应的用户
|
| | | if (uid == null)
|
| | | return;
|
| | |
|
| | | // 用第一个子订单锁定用户
|
| | | List<CommonOrder> commonOrderList = null;
|
| | | try {
|
| | | List<PDDOrder> pddOrderList = new ArrayList<>();
|
| | | pddOrderList.add(pddOrder);
|
| | | commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_SHARE_GOODS);
|
| | | } catch (CommonOrderException e) {
|
| | | LogHelper.errorDetailInfo(e, "addTaoBaoOrder或addHongBao出错", "订单号:" + pddOrder.getOrderSn());
|
| | | } catch (HongBaoException e) {
|
| | | LogHelper.errorDetailInfo(e, "addTaoBaoOrder或addHongBao出错", "订单号:" + pddOrder.getOrderSn());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.jd;
|
| | |
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.exception.pdd.PDDOrderException;
|
| | |
|
| | | public interface JDOrderProcessService {
|
| | | /**
|
| | | * 处理拼多多订单
|
| | | * |
| | | * @param pddOrder
|
| | | * @throws PDDOrderException
|
| | | */
|
| | | public void handleOrder(JDOrder jdOrder) throws PDDOrderException;
|
| | |
|
| | | /**
|
| | | * 处理返利订单
|
| | | * |
| | | * @param pddOrder
|
| | | */
|
| | | public void handleFanLiOrder(JDOrder jdOrder);
|
| | |
|
| | | /**
|
| | | * 处理分享订单
|
| | | * |
| | | * @param pddOrderO
|
| | | */
|
| | | public void handleShareOrder(JDOrder jdOrder);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.jd;
|
| | |
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.exception.jd.JDOrderException;
|
| | |
|
| | | public interface JDOrderService {
|
| | |
|
| | | public void addJDOrder(JDOrder order) throws JDOrderException;
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.pdd;
|
| | |
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.exception.pdd.PDDOrderException;
|
| | |
|
| | | public interface PDDOrderProcessService {
|
| | | /**
|
| | | * 处理拼多多订单
|
| | | * |
| | | * @param pddOrder
|
| | | * @throws PDDOrderException
|
| | | */
|
| | | public void handleOrder(PDDOrder pddOrder) throws PDDOrderException;
|
| | |
|
| | | /**
|
| | | * 处理返利订单
|
| | | * |
| | | * @param pddOrder
|
| | | */
|
| | | public void handleFanLiOrder(PDDOrder pddOrder);
|
| | |
|
| | | /**
|
| | | * 处理分享订单
|
| | | * |
| | | * @param pddOrder
|
| | | */
|
| | | public void handleShareOrder(PDDOrder pddOrder);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.jd;
|
| | |
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.lang.reflect.Type;
|
| | | import java.math.BigDecimal;
|
| | | import java.net.URLEncoder;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.apache.commons.httpclient.HttpClient;
|
| | | import org.apache.commons.httpclient.methods.PostMethod;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.dto.jd.JDCategoryInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDCommissionInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDOrderResult;
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | public class JDApiUtil {
|
| | | public static String APP_ID = "1774659094";
|
| | | public static String APP_KEY = "7ba8e06b7d6fde3d6bd5db4b0026ecd7";
|
| | | public static String SECRET_KEY = "fb49bc6ecac5458ba5394fc2969d7c56";
|
| | | private static String SERVER_URL = "https://router.jd.com/api";
|
| | |
|
| | | public static Long POSITION_FANLI = 1834339426L;
|
| | | public static Long POSITION_SHARE = 1834289924L;
|
| | |
|
| | | // 订单查询类型
|
| | | public static int ORDER_TYPE_CREATETIME = 1;// 下单时间
|
| | | public static int ORDER_TYPE_FINISHTIME = 2;// 完成时间
|
| | | public static int ORDER_TYPE_UPDATETIME = 3;// 更新时间
|
| | |
|
| | | private static String post(String url, Map<String, String> params) {
|
| | | String baseUrl = url;
|
| | | List<String> paramsList = new ArrayList<>();
|
| | | if (params != null)
|
| | | for (Iterator<String> its = params.keySet().iterator(); its.hasNext();) {
|
| | | String key = its.next();
|
| | | try {
|
| | | paramsList.add(key + "=" + URLEncoder.encode(params.get(key), "UTF-8"));
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | baseUrl += "?" + StringUtil.concat(paramsList, "&");
|
| | | HttpClient client = new HttpClient();
|
| | | PostMethod pm = new PostMethod(baseUrl);
|
| | | try {
|
| | | client.executeMethod(pm);
|
| | | String result = pm.getResponseBodyAsString();
|
| | | return new String(result.getBytes("ISO-8859-1"), "UTF-8");
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | private static String getSign(Map<String, String> params) {
|
| | | List<String> list = new ArrayList<>();
|
| | | Iterator<String> its = params.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | list.add(key + params.get(key));
|
| | | }
|
| | | String str = "";
|
| | | Collections.sort(list);
|
| | | for (String st : list) {
|
| | | str += st;
|
| | | }
|
| | | return StringUtil.Md5(SECRET_KEY + str + SECRET_KEY).toUpperCase();
|
| | | }
|
| | |
|
| | | private static String baseRequest(String method, String accessToken, JSONObject params) {
|
| | | Map<String, String> baseMap = new HashMap<String, String>();
|
| | | baseMap.put("param_json", params.toString());
|
| | | baseMap.put("app_key", APP_KEY);
|
| | | baseMap.put("method", method);
|
| | | if (accessToken != null)
|
| | | baseMap.put("access_token", accessToken);
|
| | | baseMap.put("timestamp", TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
|
| | | baseMap.put("format", "json");
|
| | | baseMap.put("v", "1.0");
|
| | | baseMap.put("sign_method", "md5");
|
| | | baseMap.put("sign", getSign(baseMap));
|
| | | String result = post(SERVER_URL, baseMap);
|
| | | return result;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 转链
|
| | | * |
| | | * @return
|
| | | */
|
| | | public static String convertLink(String materialId, String couponUrl, String pid) {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("materialId", materialId);
|
| | | json.put("siteId", APP_ID);
|
| | | if (couponUrl != null)
|
| | | json.put("couponUrl", couponUrl);
|
| | | // json.put("ext1", "437032_12");
|
| | | json.put("pid", pid);
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("promotionCodeReq", json);
|
| | |
|
| | | String result = baseRequest("jd.union.open.promotion.common.get", null, json);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | result = resultJson.optJSONObject("jd_union_open_promotion_common_get_response").optString("result");
|
| | | resultJson = JSONObject.fromObject(result);
|
| | | return resultJson.optJSONObject("data").optString("clickURL");
|
| | | }
|
| | |
|
| | | public static List<JDGoods> getGoodsDetail(List<Long> skuIdList) {
|
| | | List<JDGoods> list = new ArrayList<>();
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("skuIds", StringUtil.concat(skuIdList, ","));
|
| | | String result = baseRequest("jd.union.open.goods.promotiongoodsinfo.query", null, json);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | resultJson = resultJson.optJSONObject("jd_union_open_goods_promotiongoodsinfo_query_response");
|
| | | if (resultJson.optInt("code") == 0) {
|
| | | result = resultJson.optString("result");
|
| | | resultJson = JSONObject.fromObject(result);
|
| | | System.out.println(resultJson);
|
| | | JSONArray array = resultJson.optJSONArray("data");
|
| | | if (array != null)
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JDGoods goods = parseSimpleJDGoods(array.optJSONObject(i));
|
| | | if (goods != null)
|
| | | list.add(goods);
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | private static JDGoods parseSimpleJDGoods(JSONObject json) {
|
| | | JDGoods goods = new JDGoods();
|
| | |
|
| | | JDCategoryInfo categoryInfo = new JDCategoryInfo();
|
| | | categoryInfo.setCid1(json.optLong("cid1"));
|
| | | categoryInfo.setCid1Name(json.optString("cid1Name"));
|
| | | categoryInfo.setCid2(json.optLong("cid2"));
|
| | | categoryInfo.setCid2Name(json.optString("cid2Name"));
|
| | | categoryInfo.setCid3(json.optLong("cid3"));
|
| | | categoryInfo.setCid3Name(json.optString("cid3Name"));
|
| | |
|
| | | goods.setCategoryInfo(categoryInfo);
|
| | | goods.setComments(null);
|
| | | goods.setPrice(StringUtil.isNullOrEmpty(json.optString("wlUnitPrice"))
|
| | | ? new BigDecimal(json.optString("unitPrice")) : new BigDecimal(json.optString("wlUnitPrice")));
|
| | |
|
| | | JDCommissionInfo commissionInfo = new JDCommissionInfo();
|
| | | commissionInfo.setCommissionShare(new BigDecimal(json.optString("commisionRatioWl")));
|
| | | commissionInfo.setCommission(MoneyBigDecimalUtil
|
| | | .div(goods.getPrice().multiply(commissionInfo.getCommissionShare()), new BigDecimal(100)));
|
| | |
|
| | | goods.setCommissionInfo(commissionInfo);
|
| | | goods.setCouponInfo(null);
|
| | | goods.setGoodCommentsShare(null);
|
| | | List<String> imageList = new ArrayList<>();
|
| | | imageList.add(json.optString("imgUrl"));
|
| | | goods.setImageList(imageList);
|
| | | goods.setInOrderCount30Days(0L);
|
| | | goods.setIsHot(null);
|
| | | goods.setMaterialUrl(json.optString("materialUrl"));
|
| | | goods.setOwner(null);
|
| | | goods.setPinGouInfo(null);
|
| | |
|
| | | JDShopInfo shopInfo = new JDShopInfo();
|
| | | shopInfo.setShopId(json.optInt("shopId"));
|
| | | shopInfo.setShopName(null);
|
| | | goods.setShopInfo(shopInfo);
|
| | | goods.setSkuId(json.optLong("skuId"));
|
| | | goods.setSkuName(json.optString("goodsName"));
|
| | | goods.setTotalCount(null);
|
| | |
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public static JDGoods getGoodsDetail(Long skuId) {
|
| | | List<Long> skuIdList = new ArrayList<>();
|
| | | skuIdList.add(skuId);
|
| | | List<JDGoods> list = getGoodsDetail(skuIdList);
|
| | | if (list != null && list.size() > 0)
|
| | | return list.get(0);
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static JDOrderResult getOrder(int page, int pageSize, String time, int type) {
|
| | | JSONObject json = new JSONObject();
|
| | | JSONObject orderReq = new JSONObject();
|
| | | orderReq.put("pageNo", page);
|
| | | orderReq.put("pageSize", pageSize);
|
| | | orderReq.put("type", type);
|
| | | orderReq.put("time", time);
|
| | |
|
| | | json.put("orderReq", orderReq);
|
| | | String result = baseRequest("jd.union.open.order.query", null, json);
|
| | | JSONObject root = JSONObject.fromObject(result).optJSONObject("jd_union_open_order_query_response");
|
| | | if (root.optInt("code") == 0) {
|
| | | boolean hasMore = root.optBoolean("hasMore");
|
| | | root = JSONObject.fromObject(root.optString("result"));
|
| | | if (root.optInt("code") == 200) {
|
| | | String date = root.optJSONArray("data").toString();
|
| | | Type typeToken = new TypeToken<List<JDOrder>>() {
|
| | | }.getType();
|
| | | List<JDOrder> orderList = new Gson().fromJson(date, typeToken);
|
| | | if (orderList != null)
|
| | | for (JDOrder order : orderList) {
|
| | | for (int i = 0; i < order.getOrderItemList().size(); i++) {
|
| | | order.getOrderItemList().get(i)
|
| | | .setTradeId(order.getOrderId() + "-" + order.getOrderItemList().get(i).getSkuId());
|
| | | order.getOrderItemList().get(i).setOrderId(order.getOrderId());
|
| | | order.getOrderItemList().get(i).setOrderBy(i + 1);
|
| | | }
|
| | | }
|
| | | return new JDOrderResult(hasMore, orderList);
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|