admin
2020-06-09 6ec3af1c45a0cc46e666d56e0ccc9a2c178015ae
新增苏宁订单
7个文件已添加
6个文件已修改
739 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/suning/SuningOrderInfoMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/order/SourceTypeEnum.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/suning/SuningOrderInfo.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/suning/SuningOrderException.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/order/suning/UpdateSuningOrderJob.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/suning/SuningOrderInfoMapper.xml 240 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/suning/SuningOrderServiceImpl.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/suning/SuningOrderService.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/RedisKeyEnum.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/cmq/order/SuningOrderCMQManager.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/suning/SuningApiUtil.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/suning/SuningOrderInfoMapper.java
New file
@@ -0,0 +1,14 @@
package com.yeshi.fanli.dao.mybatis.suning;
import java.util.List;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.suning.SuningOrderInfo;
public interface SuningOrderInfoMapper extends BaseMapper<SuningOrderInfo> {
    SuningOrderInfo selectByOrderLineNum(String orderLineNum);
    List<SuningOrderInfo> listByOrderCode(String orderCode);
}
fanli/src/main/java/com/yeshi/fanli/entity/order/SourceTypeEnum.java
@@ -11,7 +11,7 @@
    jingDong("京东","京东","#E42219","#E42219", "http://img.flqapp.com/resource/icon/source_type_jd.png"),
    pinDuoDuo("拼多多", "拼多多","#F51E25","#F51E25","http://img.flqapp.com/resource/icon/source_type_pdd.png"),
    vip("唯品会","唯品会","#E30085", "#E30085", "http://img.flqapp.com/resource/icon/source_type_vip.png"),
    suNing("苏宁易购","苏宁易购","#010101","#FFA600", "http://img.flqapp.com/resource/icon/source_type_suning.png");
    suNing("苏宁","苏宁易购","#010101","#FFA600", "http://img.flqapp.com/resource/icon/source_type_suning.png");
    private final String desc; // 数据存在名称
    private final String descShow; // 显示名称
fanli/src/main/java/com/yeshi/fanli/entity/suning/SuningOrderInfo.java
@@ -2,40 +2,72 @@
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
@Table("yeshi_ec_suning_order")
public class SuningOrderInfo {
    @Column(name="so_id")
    private Long id;// 主键ID
    @Column(name="so_order_code")
    private String orderCode;// 订单号
    @Column(name="so_pay_time")
    private String payTime;// 支付时间,格式:yyyy-MM-dd HH:mm:ss
    @Column(name="so_order_submit_time")
    private String orderSubmitTime;// 下单时间,格式:yyyy-MM-dd HH:mm:ss
    @Column(name="so_order_line_number")
    private String orderLineNumber;// 订单行项目号
    @Column(name="so_order_line_status_desc")
    private String orderLineStatusDesc;// 订单行项目状态 :等待付款;支付完成;退款;订单已取消;确认收货
    @Column(name="so_line_status_change_time")
    private String orderLineStatusChangeTime;// 行项目状态更新时间,格式:yyyy-MM-dd HH:mm:ss
    @Column(name="so_order_line_origin")
    private String orderLineOrigin;// 订单行来源(PC端、无线端)
    @Column(name="so_product_name")
    private String productName;// 商品名称
    @Column(name="so_sale_num")
    private String saleNum;// 商品数量
    @Column(name="so_pay_amount")
    private String payAmount;// 实付金额
    @Column(name="so_order_line_flag")
    private String orderLineFlag;// 订单行标记
    @Column(name="so_child_account_id")
    private String childAccountId;// 子推广账号ID(对应sub_user)
    @Column(name="so_sell_name")
    private String sellName;// 商户名称
    @Column(name="so_seller_code")
    private String sellerCode;// 商户编码
    @Column(name="so_goods_num")
    private String goodsNum;// 商品编码
    @Column(name="so_commission_ratio")
    private String commissionRatio;// 佣金比例
    @Column(name="so_pre_pay_commission")
    private String prePayCommission;// 预估佣金
    @Column(name="so_product_first_catalog")
    private String productFirstCatalog;// 一级目录
    @Column(name="so_product_second_catalog")
    private String productSecondCatalog;// 二级目录
    @Column(name="so_product_third_catalog")
    private String productThirdCatalog;// 三级目录
    @Column(name="so_order_type")
    private String orderType;// 商品归属
    @Column(name="so_position_id")
    private String positionId;// 推广位ID
    @Column(name="so_goods_group_catalog")
    private String goodsGroupCatalog;// 商品组目录编码
    @Column(name="so_sale_type")
    private String saleType;// 推广类型
    @Column(name="so_picture_url")
    private String pictureUrl;// 商品主图
    @Column(name="so_promotion")
    private Integer promotion;// 1.风控订单
    @Column(name="so_violation")
    private Integer violation;// 是否违规,0:否;1:是
    @Column(name="so_return_commission")
    private Integer returnCommission;// 是否返佣,0:否;1:是
    @Column(name="so_create_time")
    private Date createTime;// 创建时间
    @Column(name="so_update_time")
    private Date updateTime;// 更新时间
    public Long getId() {
fanli/src/main/java/com/yeshi/fanli/exception/suning/SuningOrderException.java
New file
@@ -0,0 +1,16 @@
package com.yeshi.fanli.exception.suning;
import com.yeshi.fanli.exception.BaseException;
public class SuningOrderException extends BaseException {
    private static final long serialVersionUID = 1L;
    public SuningOrderException(int code, String msg) {
        super(code, msg);
    }
    public SuningOrderException() {
        super();
    }
}
fanli/src/main/java/com/yeshi/fanli/job/order/suning/UpdateSuningOrderJob.java
New file
@@ -0,0 +1,102 @@
package com.yeshi.fanli.job.order.suning;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.yeshi.fanli.dto.suning.SuningOrderQueryResultDTO;
import com.yeshi.fanli.entity.suning.SuningOrderInfo;
import com.yeshi.fanli.exception.suning.SuningOrderException;
import com.yeshi.fanli.service.inter.order.suning.SuningOrderService;
import com.yeshi.fanli.util.RedisKeyEnum;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.cmq.order.SuningOrderCMQManager;
import com.yeshi.fanli.util.suning.SuningApiUtil;
//从淘宝爬去订单更新
@Component
public class UpdateSuningOrderJob {
    @Resource
    private SuningOrderService suningOrderService;
    @Resource
    private RedisManager redisManager;
    /**
     * 保存订单
     *
     * @param SuningOrderList
     */
    public void saveSuningOrders(List<SuningOrderInfo> suningOrderList) {
        for (SuningOrderInfo order : suningOrderList) {
            try {
                suningOrderService.addOrder(order);
                /**
                 * 做频率限制
                 */
                String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SuningOrder, order.getOrderCode() + "");
                String result = redisManager.getCommonString(key);
                // 判断
                if (StringUtil.isNullOrEmpty(result)) {
                    SuningOrderCMQManager.getInstance().addSuningOrder(order.getOrderCode() + "");
                    redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 2小时内不再更新
                }
            } catch (SuningOrderException e) {
                e.printStackTrace();
            }
        }
    }
    /**
     * 快速订单更新(爬取本小时内的单,每分钟一次)
     */
    @XxlJob("updateSuningOrderHandler")
    public ReturnT<String> updateSuningSoonOrder(String param) throws Exception {
        long endTime = System.currentTimeMillis();
        if ("1hour".equalsIgnoreCase(param)) {// 更新1小时内的订单
            updateByOrderTime(endTime - 1000 * 60 * 60 * 1L, endTime,2);
            updateByOrderTime(endTime - 1000 * 60 * 60 * 1L, endTime,3);
            updateByOrderTime(endTime - 1000 * 60 * 60 * 1L, endTime,4);
            updateByOrderTime(endTime - 1000 * 60 * 60 * 1L, endTime,5);
        } else if ("1day".equalsIgnoreCase(param)) {// 更新最近1天更新的数据
            updateByOrderTime(endTime - 1000 * 60 * 60 * 24L, endTime,2);
            updateByOrderTime(endTime - 1000 * 60 * 60 * 24L, endTime,3);
            updateByOrderTime(endTime - 1000 * 60 * 60 * 24L, endTime,4);
            updateByOrderTime(endTime - 1000 * 60 * 60 * 24L, endTime,5);
        }
        return ReturnT.SUCCESS;
    }
    /**
     * 按下单时间更新
     * @Title: updateByOrderTime
     * @Description:
     * @param startTime
     * @param endTime
     * void 返回类型
     * @throws
     */
    public void updateByOrderTime(long startTime, long endTime,int status) {
        List<SuningOrderInfo> suningOrderList = new ArrayList<>();
        int page = 1;
        SuningOrderQueryResultDTO result = SuningApiUtil.getOrderList(new Date(startTime), new Date(endTime), page, status);
        while (result != null && result.getOrderList().size() > 0) {
            page++;
            suningOrderList.addAll(result.getOrderList());
            result = SuningApiUtil.getOrderList(new Date(startTime), new Date(endTime), page, status);
        }
        saveSuningOrders(suningOrderList);
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/suning/SuningOrderInfoMapper.xml
New file
@@ -0,0 +1,240 @@
<?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.suning.SuningOrderInfoMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.suning.SuningOrderInfo">
        <id column="so_id" property="id" jdbcType="BIGINT" />
        <result column="so_order_code" property="orderCode" jdbcType="VARCHAR" />
        <result column="so_pay_time" property="payTime" jdbcType="VARCHAR" />
        <result column="so_order_submit_time" property="orderSubmitTime"
            jdbcType="VARCHAR" />
        <result column="so_order_line_number" property="orderLineNumber"
            jdbcType="VARCHAR" />
        <result column="so_order_line_status_desc" property="orderLineStatusDesc"
            jdbcType="VARCHAR" />
        <result column="so_line_status_change_time" property="orderLineStatusChangeTime"
            jdbcType="VARCHAR" />
        <result column="so_order_line_origin" property="orderLineOrigin"
            jdbcType="VARCHAR" />
        <result column="so_product_name" property="productName"
            jdbcType="VARCHAR" />
        <result column="so_sale_num" property="saleNum" jdbcType="VARCHAR" />
        <result column="so_pay_amount" property="payAmount" jdbcType="VARCHAR" />
        <result column="so_order_line_flag" property="orderLineFlag"
            jdbcType="VARCHAR" />
        <result column="so_child_account_id" property="childAccountId"
            jdbcType="VARCHAR" />
        <result column="so_sell_name" property="sellName" jdbcType="VARCHAR" />
        <result column="so_seller_code" property="sellerCode" jdbcType="VARCHAR" />
        <result column="so_goods_num" property="goodsNum" jdbcType="VARCHAR" />
        <result column="so_commission_ratio" property="commissionRatio"
            jdbcType="VARCHAR" />
        <result column="so_pre_pay_commission" property="prePayCommission"
            jdbcType="VARCHAR" />
        <result column="so_product_first_catalog" property="productFirstCatalog"
            jdbcType="VARCHAR" />
        <result column="so_product_second_catalog" property="productSecondCatalog"
            jdbcType="VARCHAR" />
        <result column="so_product_third_catalog" property="productThirdCatalog"
            jdbcType="VARCHAR" />
        <result column="so_order_type" property="orderType" jdbcType="VARCHAR" />
        <result column="so_position_id" property="positionId" jdbcType="VARCHAR" />
        <result column="so_goods_group_catalog" property="goodsGroupCatalog"
            jdbcType="VARCHAR" />
        <result column="so_sale_type" property="saleType" jdbcType="VARCHAR" />
        <result column="so_picture_url" property="pictureUrl" jdbcType="VARCHAR" />
        <result column="so_promotion" property="promotion" jdbcType="INTEGER" />
        <result column="so_violation" property="violation" jdbcType="INTEGER" />
        <result column="so_return_commission" property="returnCommission"
            jdbcType="INTEGER" />
        <result column="so_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="so_update_time" property="updateTime" jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">so_id,so_order_code,so_pay_time,so_order_submit_time,so_order_line_number,so_order_line_status_desc,so_line_status_change_time,so_order_line_origin,so_product_name,so_sale_num,so_pay_amount,so_order_line_flag,so_child_account_id,so_sell_name,so_seller_code,so_goods_num,so_commission_ratio,so_pre_pay_commission,so_product_first_catalog,so_product_second_catalog,so_product_third_catalog,so_order_type,so_position_id,so_goods_group_catalog,so_sale_type,so_picture_url,so_promotion,so_violation,so_return_commission,so_create_time,so_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_suning_order where so_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByOrderLineNum" resultMap="BaseResultMap"
        parameterType="java.lang.String">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_suning_order where so_order_line_number = #{0}
    </select>
    <select id="listByOrderCode" resultMap="BaseResultMap"
        parameterType="java.lang.String">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_suning_order where so_order_code = #{0}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_suning_order where so_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.suning.SuningOrderInfo"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_suning_order
        (so_id,so_order_code,so_pay_time,so_order_submit_time,so_order_line_number,so_order_line_status_desc,so_line_status_change_time,so_order_line_origin,so_product_name,so_sale_num,so_pay_amount,so_order_line_flag,so_child_account_id,so_sell_name,so_seller_code,so_goods_num,so_commission_ratio,so_pre_pay_commission,so_product_first_catalog,so_product_second_catalog,so_product_third_catalog,so_order_type,so_position_id,so_goods_group_catalog,so_sale_type,so_picture_url,so_promotion,so_violation,so_return_commission,so_create_time,so_update_time)
        values
        (#{id,jdbcType=BIGINT},#{orderCode,jdbcType=VARCHAR},#{payTime,jdbcType=VARCHAR},#{orderSubmitTime,jdbcType=VARCHAR},#{orderLineNumber,jdbcType=VARCHAR},#{orderLineStatusDesc,jdbcType=VARCHAR},#{orderLineStatusChangeTime,jdbcType=VARCHAR},#{orderLineOrigin,jdbcType=VARCHAR},#{productName,jdbcType=VARCHAR},#{saleNum,jdbcType=VARCHAR},#{payAmount,jdbcType=VARCHAR},#{orderLineFlag,jdbcType=VARCHAR},#{childAccountId,jdbcType=VARCHAR},#{sellName,jdbcType=VARCHAR},#{sellerCode,jdbcType=VARCHAR},#{goodsNum,jdbcType=VARCHAR},#{commissionRatio,jdbcType=VARCHAR},#{prePayCommission,jdbcType=VARCHAR},#{productFirstCatalog,jdbcType=VARCHAR},#{productSecondCatalog,jdbcType=VARCHAR},#{productThirdCatalog,jdbcType=VARCHAR},#{orderType,jdbcType=VARCHAR},#{positionId,jdbcType=VARCHAR},#{goodsGroupCatalog,jdbcType=VARCHAR},#{saleType,jdbcType=VARCHAR},#{pictureUrl,jdbcType=VARCHAR},#{promotion,jdbcType=INTEGER},#{violation,jdbcType=INTEGER},#{returnCommission,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.suning.SuningOrderInfo"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_suning_order
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">so_id,</if>
            <if test="orderCode != null">so_order_code,</if>
            <if test="payTime != null">so_pay_time,</if>
            <if test="orderSubmitTime != null">so_order_submit_time,</if>
            <if test="orderLineNumber != null">so_order_line_number,</if>
            <if test="orderLineStatusDesc != null">so_order_line_status_desc,</if>
            <if test="orderLineStatusChangeTime != null">so_line_status_change_time,</if>
            <if test="orderLineOrigin != null">so_order_line_origin,</if>
            <if test="productName != null">so_product_name,</if>
            <if test="saleNum != null">so_sale_num,</if>
            <if test="payAmount != null">so_pay_amount,</if>
            <if test="orderLineFlag != null">so_order_line_flag,</if>
            <if test="childAccountId != null">so_child_account_id,</if>
            <if test="sellName != null">so_sell_name,</if>
            <if test="sellerCode != null">so_seller_code,</if>
            <if test="goodsNum != null">so_goods_num,</if>
            <if test="commissionRatio != null">so_commission_ratio,</if>
            <if test="prePayCommission != null">so_pre_pay_commission,</if>
            <if test="productFirstCatalog != null">so_product_first_catalog,</if>
            <if test="productSecondCatalog != null">so_product_second_catalog,</if>
            <if test="productThirdCatalog != null">so_product_third_catalog,</if>
            <if test="orderType != null">so_order_type,</if>
            <if test="positionId != null">so_position_id,</if>
            <if test="goodsGroupCatalog != null">so_goods_group_catalog,</if>
            <if test="saleType != null">so_sale_type,</if>
            <if test="pictureUrl != null">so_picture_url,</if>
            <if test="promotion != null">so_promotion,</if>
            <if test="violation != null">so_violation,</if>
            <if test="returnCommission != null">so_return_commission,</if>
            <if test="createTime != null">so_create_time,</if>
            <if test="updateTime != null">so_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="orderCode != null">#{orderCode,jdbcType=VARCHAR},</if>
            <if test="payTime != null">#{payTime,jdbcType=VARCHAR},</if>
            <if test="orderSubmitTime != null">#{orderSubmitTime,jdbcType=VARCHAR},</if>
            <if test="orderLineNumber != null">#{orderLineNumber,jdbcType=VARCHAR},</if>
            <if test="orderLineStatusDesc != null">#{orderLineStatusDesc,jdbcType=VARCHAR},</if>
            <if test="orderLineStatusChangeTime != null">#{orderLineStatusChangeTime,jdbcType=VARCHAR},</if>
            <if test="orderLineOrigin != null">#{orderLineOrigin,jdbcType=VARCHAR},</if>
            <if test="productName != null">#{productName,jdbcType=VARCHAR},</if>
            <if test="saleNum != null">#{saleNum,jdbcType=VARCHAR},</if>
            <if test="payAmount != null">#{payAmount,jdbcType=VARCHAR},</if>
            <if test="orderLineFlag != null">#{orderLineFlag,jdbcType=VARCHAR},</if>
            <if test="childAccountId != null">#{childAccountId,jdbcType=VARCHAR},</if>
            <if test="sellName != null">#{sellName,jdbcType=VARCHAR},</if>
            <if test="sellerCode != null">#{sellerCode,jdbcType=VARCHAR},</if>
            <if test="goodsNum != null">#{goodsNum,jdbcType=VARCHAR},</if>
            <if test="commissionRatio != null">#{commissionRatio,jdbcType=VARCHAR},</if>
            <if test="prePayCommission != null">#{prePayCommission,jdbcType=VARCHAR},</if>
            <if test="productFirstCatalog != null">#{productFirstCatalog,jdbcType=VARCHAR},</if>
            <if test="productSecondCatalog != null">#{productSecondCatalog,jdbcType=VARCHAR},</if>
            <if test="productThirdCatalog != null">#{productThirdCatalog,jdbcType=VARCHAR},</if>
            <if test="orderType != null">#{orderType,jdbcType=VARCHAR},</if>
            <if test="positionId != null">#{positionId,jdbcType=VARCHAR},</if>
            <if test="goodsGroupCatalog != null">#{goodsGroupCatalog,jdbcType=VARCHAR},</if>
            <if test="saleType != null">#{saleType,jdbcType=VARCHAR},</if>
            <if test="pictureUrl != null">#{pictureUrl,jdbcType=VARCHAR},</if>
            <if test="promotion != null">#{promotion,jdbcType=INTEGER},</if>
            <if test="violation != null">#{violation,jdbcType=INTEGER},</if>
            <if test="returnCommission != null">#{returnCommission,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.suning.SuningOrderInfo">update
        yeshi_ec_suning_order set so_order_code =
        #{orderCode,jdbcType=VARCHAR},so_pay_time =
        #{payTime,jdbcType=VARCHAR},so_order_submit_time =
        #{orderSubmitTime,jdbcType=VARCHAR},so_order_line_number =
        #{orderLineNumber,jdbcType=VARCHAR},so_order_line_status_desc =
        #{orderLineStatusDesc,jdbcType=VARCHAR},so_line_status_change_time =
        #{orderLineStatusChangeTime,jdbcType=VARCHAR},so_order_line_origin =
        #{orderLineOrigin,jdbcType=VARCHAR},so_product_name =
        #{productName,jdbcType=VARCHAR},so_sale_num =
        #{saleNum,jdbcType=VARCHAR},so_pay_amount =
        #{payAmount,jdbcType=VARCHAR},so_order_line_flag =
        #{orderLineFlag,jdbcType=VARCHAR},so_child_account_id =
        #{childAccountId,jdbcType=VARCHAR},so_sell_name =
        #{sellName,jdbcType=VARCHAR},so_seller_code =
        #{sellerCode,jdbcType=VARCHAR},so_goods_num =
        #{goodsNum,jdbcType=VARCHAR},so_commission_ratio =
        #{commissionRatio,jdbcType=VARCHAR},so_pre_pay_commission =
        #{prePayCommission,jdbcType=VARCHAR},so_product_first_catalog =
        #{productFirstCatalog,jdbcType=VARCHAR},so_product_second_catalog =
        #{productSecondCatalog,jdbcType=VARCHAR},so_product_third_catalog =
        #{productThirdCatalog,jdbcType=VARCHAR},so_order_type =
        #{orderType,jdbcType=VARCHAR},so_position_id =
        #{positionId,jdbcType=VARCHAR},so_goods_group_catalog =
        #{goodsGroupCatalog,jdbcType=VARCHAR},so_sale_type =
        #{saleType,jdbcType=VARCHAR},so_picture_url =
        #{pictureUrl,jdbcType=VARCHAR},so_promotion =
        #{promotion,jdbcType=INTEGER},so_violation =
        #{violation,jdbcType=INTEGER},so_return_commission =
        #{returnCommission,jdbcType=INTEGER},so_create_time =
        #{createTime,jdbcType=TIMESTAMP},so_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where so_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.suning.SuningOrderInfo">
        update yeshi_ec_suning_order
        <set>
            <if test="orderCode != null">so_order_code=#{orderCode,jdbcType=VARCHAR},</if>
            <if test="payTime != null">so_pay_time=#{payTime,jdbcType=VARCHAR},</if>
            <if test="orderSubmitTime != null">so_order_submit_time=#{orderSubmitTime,jdbcType=VARCHAR},
            </if>
            <if test="orderLineNumber != null">so_order_line_number=#{orderLineNumber,jdbcType=VARCHAR},
            </if>
            <if test="orderLineStatusDesc != null">so_order_line_status_desc=#{orderLineStatusDesc,jdbcType=VARCHAR},
            </if>
            <if test="orderLineStatusChangeTime != null">so_line_status_change_time=#{orderLineStatusChangeTime,jdbcType=VARCHAR},
            </if>
            <if test="orderLineOrigin != null">so_order_line_origin=#{orderLineOrigin,jdbcType=VARCHAR},
            </if>
            <if test="productName != null">so_product_name=#{productName,jdbcType=VARCHAR},</if>
            <if test="saleNum != null">so_sale_num=#{saleNum,jdbcType=VARCHAR},</if>
            <if test="payAmount != null">so_pay_amount=#{payAmount,jdbcType=VARCHAR},</if>
            <if test="orderLineFlag != null">so_order_line_flag=#{orderLineFlag,jdbcType=VARCHAR},
            </if>
            <if test="childAccountId != null">so_child_account_id=#{childAccountId,jdbcType=VARCHAR},
            </if>
            <if test="sellName != null">so_sell_name=#{sellName,jdbcType=VARCHAR},</if>
            <if test="sellerCode != null">so_seller_code=#{sellerCode,jdbcType=VARCHAR},</if>
            <if test="goodsNum != null">so_goods_num=#{goodsNum,jdbcType=VARCHAR},</if>
            <if test="commissionRatio != null">so_commission_ratio=#{commissionRatio,jdbcType=VARCHAR},
            </if>
            <if test="prePayCommission != null">so_pre_pay_commission=#{prePayCommission,jdbcType=VARCHAR},
            </if>
            <if test="productFirstCatalog != null">so_product_first_catalog=#{productFirstCatalog,jdbcType=VARCHAR},
            </if>
            <if test="productSecondCatalog != null">so_product_second_catalog=#{productSecondCatalog,jdbcType=VARCHAR},
            </if>
            <if test="productThirdCatalog != null">so_product_third_catalog=#{productThirdCatalog,jdbcType=VARCHAR},
            </if>
            <if test="orderType != null">so_order_type=#{orderType,jdbcType=VARCHAR},</if>
            <if test="positionId != null">so_position_id=#{positionId,jdbcType=VARCHAR},</if>
            <if test="goodsGroupCatalog != null">so_goods_group_catalog=#{goodsGroupCatalog,jdbcType=VARCHAR},
            </if>
            <if test="saleType != null">so_sale_type=#{saleType,jdbcType=VARCHAR},</if>
            <if test="pictureUrl != null">so_picture_url=#{pictureUrl,jdbcType=VARCHAR},</if>
            <if test="promotion != null">so_promotion=#{promotion,jdbcType=INTEGER},</if>
            <if test="violation != null">so_violation=#{violation,jdbcType=INTEGER},</if>
            <if test="returnCommission != null">so_return_commission=#{returnCommission,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">so_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">so_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where so_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -1269,7 +1269,7 @@
            {
                SuningGoodsInfo pddGoods = null;
                // TODO 需要获取
                pddGoods = SuningApiUtil.getGoodsDetail(suningOrderInfo.getGoodsNum(), "00000000");
                pddGoods = SuningApiUtil.getGoodsDetail(suningOrderInfo.getGoodsNum(), suningOrderInfo.getSellerCode());
                if (pddGoods != null) {
                    cog = CommonOrderGoodsFactory.create(pddGoods);
                }
fanli/src/main/java/com/yeshi/fanli/service/impl/order/suning/SuningOrderServiceImpl.java
New file
@@ -0,0 +1,60 @@
package com.yeshi.fanli.service.impl.order.suning;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.suning.SuningOrderInfoMapper;
import com.yeshi.fanli.entity.suning.SuningOrderInfo;
import com.yeshi.fanli.exception.suning.SuningOrderException;
import com.yeshi.fanli.service.inter.order.suning.SuningOrderService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class SuningOrderServiceImpl implements SuningOrderService {
    @Resource
    private SuningOrderInfoMapper suningOrderMapper;
    @Override
    public void addOrder(SuningOrderInfo order) throws SuningOrderException {
        if (order == null || StringUtil.isNullOrEmpty(order.getOrderLineNumber())) {
            throw new SuningOrderException(1, "数据不完整");
        }
        // 查询是否添加过
        SuningOrderInfo old = suningOrderMapper.selectByOrderLineNum(order.getOrderLineNumber());
        if (old == null) {// 新增
            // 添加信息
            if (order.getCreateTime() == null)
                order.setCreateTime(new Date());
            suningOrderMapper.insertSelective(order);
        } else {// 更新
            order.setId(old.getId());
            order.setUpdateTime(new Date());
            suningOrderMapper.updateByPrimaryKeySelective(order);
        }
    }
    @Override
    public SuningOrderInfo selectByPrimaryKey(Long orderId) {
        return suningOrderMapper.selectByPrimaryKey(orderId);
    }
    @Override
    public List<SuningOrderInfo> listByOrderCode(String orderCode) {
        return suningOrderMapper.listByOrderCode(orderCode);
    }
    @Override
    public SuningOrderInfo selectByOrderLineNumber(String orderLineNo) {
        return suningOrderMapper.selectByOrderLineNum(orderLineNo);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/suning/SuningOrderService.java
New file
@@ -0,0 +1,45 @@
package com.yeshi.fanli.service.inter.order.suning;
import java.util.List;
import com.yeshi.fanli.entity.suning.SuningOrderInfo;
import com.yeshi.fanli.exception.suning.SuningOrderException;
public interface SuningOrderService {
    /**
     * 添加订单
     *
     * @param order
     * @throws SuningOrderInfoException
     */
    public void addOrder(SuningOrderInfo order) throws SuningOrderException;
    /**
     * 根据主键ID查询
     *
     * @param orderId
     * @return
     */
    public SuningOrderInfo selectByPrimaryKey(Long orderId);
    /**
     * 根据订单号查询
     *
     * @param orderId
     * @return
     */
    public List<SuningOrderInfo> listByOrderCode(String orderCode);
    /**
     * 根据订单行号查询
     * @Title: selectByOrderLineNumber
     * @Description:
     * @param orderLineNo
     * @return
     * SuningOrderInfo 返回类型
     * @throws
     */
    public SuningOrderInfo selectByOrderLineNumber(String orderLineNo);
}
fanli/src/main/java/com/yeshi/fanli/util/RedisKeyEnum.java
@@ -56,6 +56,7 @@
    JDOrder("jd-order-", "京东订单"),
    PDDOrder("pdd-order-", "拼多多订单"),
    VIPShopOrder("vipshop-order-", "唯品会订单"),
    SuningOrder("suning-order-", "苏宁订单"),
    hongBaoFanLi("hongbao-fanli-", "红包返利"),
    deviceSex("device_sex-", "设备性别版本"),
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -34,9 +34,11 @@
import com.yeshi.fanli.entity.pdd.PDDOrder;
import com.yeshi.fanli.entity.push.DeviceActive;
import com.yeshi.fanli.entity.push.PushQueueRecord;
import com.yeshi.fanli.entity.suning.SuningOrderInfo;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
import com.yeshi.fanli.entity.vipshop.VipShopOrder;
import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
import com.yeshi.fanli.exception.order.dividents.TeamDividentsRecordException;
import com.yeshi.fanli.log.LogHelper;
@@ -51,7 +53,9 @@
import com.yeshi.fanli.service.inter.order.OrderProcessService;
import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService;
import com.yeshi.fanli.service.inter.order.suning.SuningOrderService;
import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
import com.yeshi.fanli.service.inter.order.vipshop.VipShopOrderService;
import com.yeshi.fanli.service.inter.push.DeviceActiveService;
import com.yeshi.fanli.service.inter.push.IOSPushService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
@@ -69,7 +73,9 @@
import com.yeshi.fanli.util.cmq.order.JDOrderCMQManager;
import com.yeshi.fanli.util.cmq.order.PDDOrderCMQManager;
import com.yeshi.fanli.util.cmq.order.PlaceOrderCMQManager;
import com.yeshi.fanli.util.cmq.order.SuningOrderCMQManager;
import com.yeshi.fanli.util.cmq.order.TeamOrderCMQManager;
import com.yeshi.fanli.util.cmq.order.VipShopOrderCMQManager;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
/**
@@ -150,8 +156,11 @@
    @Resource
    private TeamEincomeManager teamEincomeManager;
//    @Resource
//    private VipShopOrderService vipShopOrderService;
    @Resource
    private VipShopOrderService vipShopOrderService;
    @Resource
    private SuningOrderService suningOrderService;
    private static boolean isInited = false;
@@ -185,7 +194,8 @@
            doUpdateGoodsJob(); // 更新商品队列
            doJDOrderJob();// 京东订单处理
            doPDDOrderJob();// 拼多多订单处理
//            doVipShopOrderJob();// 唯品会订单处理
            doVipShopOrderJob();// 唯品会订单处理
            doSuningOrderJob();// 苏宁订单处理
            doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新
            doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
            // doPlaceOrderIntegralJob();// 下单赠送金币任务
@@ -712,39 +722,74 @@
    }
//    public void doVipShopOrderJob() {
//        executor.execute(new Runnable() {
//            @Override
//            public void run() {
//                while (true) {
//                    try {
//                        Map<String, String> map = VipShopOrderCMQManager.getInstance().consumeVipShopOrder(16);
//                        if (map != null) {
//                            Iterator<String> its = map.keySet().iterator();
//                            while (its.hasNext()) {
//                                String key = its.next();
//                                try {
//                                    String orderId = map.get(key);
//                                    if (!StringUtil.isNullOrEmpty(orderId)) {
//                                        List<VipShopOrder> orderList = vipShopOrderService.listByOrderSn(orderId);
//                                        if (orderList != null)
//                                            for (VipShopOrder order : orderList)
//                                                orderProcessService.processVipShopOrder(order);
//                                    }
//                                    VipShopOrderCMQManager.getInstance().deleteVipShopOrder(key);
//                                } catch (Exception e) {
//                                    LogHelper.errorDetailInfo(e);
//                                }
//                            }
//                        }
//                    } catch (Exception e) {
//                        LogHelper.error("拼多多订单:" + e.getMessage());
//                    }
//                }
//            }
//        });
//
//    }
    public void doVipShopOrderJob() {
        executor.execute(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    try {
                        Map<String, String> map = VipShopOrderCMQManager.getInstance().consumeVipShopOrder(16);
                        if (map != null) {
                            Iterator<String> its = map.keySet().iterator();
                            while (its.hasNext()) {
                                String key = its.next();
                                try {
                                    String orderId = map.get(key);
                                    if (!StringUtil.isNullOrEmpty(orderId)) {
                                        List<VipShopOrder> orderList = vipShopOrderService.listByOrderSn(orderId);
                                        if (orderList != null)
                                            for (VipShopOrder order : orderList)
                                                orderProcessService.processVipShopOrder(order);
                                    }
                                    VipShopOrderCMQManager.getInstance().deleteVipShopOrder(key);
                                } catch (Exception e) {
                                    LogHelper.errorDetailInfo(e);
                                }
                            }
                        }
                    } catch (Exception e) {
                        LogHelper.error("唯品会订单:" + e.getMessage());
                    }
                }
            }
        });
    }
    public void doSuningOrderJob() {
        executor.execute(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    try {
                        Map<String, String> map = SuningOrderCMQManager.getInstance().consumeSuningOrder(16);
                        if (map != null) {
                            Iterator<String> its = map.keySet().iterator();
                            while (its.hasNext()) {
                                String key = its.next();
                                try {
                                    String orderId = map.get(key);
                                    if (!StringUtil.isNullOrEmpty(orderId)) {
                                        List<SuningOrderInfo> orderList = suningOrderService.listByOrderCode(orderId);
                                        if (orderList != null)
                                            for (SuningOrderInfo order : orderList)
                                                orderProcessService.processSuningOrder(order);
                                    }
                                    SuningOrderCMQManager.getInstance().deleteSuningOrder(key);
                                } catch (Exception e) {
                                    LogHelper.errorDetailInfo(e);
                                }
                            }
                        }
                    } catch (Exception e) {
                        LogHelper.error("苏宁订单:" + e.getMessage());
                    }
                }
            }
        });
    }
    /**
     * 重要的淘宝商品信息更新
fanli/src/main/java/com/yeshi/fanli/util/cmq/order/SuningOrderCMQManager.java
New file
@@ -0,0 +1,71 @@
package com.yeshi.fanli.util.cmq.order;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.yeshi.utils.CMQUtil;
import com.qcloud.cmq.Message;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
public class SuningOrderCMQManager {
    private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25";
    private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo";
    private static SuningOrderCMQManager suningOrderCMQManager;
    private static CMQUtil cmqUtil;
    public static String SUNING_ORDER = "order-suning";
    static {
        cmqUtil = CMQUtil.getInstance(secretId, secretKey);
        SUNING_ORDER += "-" + Constant.systemCommonConfig.getProjectName();
        cmqUtil.createQueue(SUNING_ORDER);
    }
    public static SuningOrderCMQManager getInstance() {
        if (suningOrderCMQManager == null)
            suningOrderCMQManager = new SuningOrderCMQManager();
        return suningOrderCMQManager;
    }
    /**
     * 添加唯品会订单到队列
     *
     * @param orderId
     */
    public void addSuningOrder(String orderId) {
        if (StringUtil.isNullOrEmpty(orderId))
            return;
        cmqUtil.sendMsg(SUNING_ORDER, orderId);
    }
    /**
     * 消费队列消息
     *
     * @param count
     * @return
     */
    public Map<String, String> consumeSuningOrder(int count) {
        List<Message> list = cmqUtil.recieveMsg(count, SUNING_ORDER);
        Map<String, String> map = new HashMap<>();
        if (list != null)
            for (Message msg : list) {
                String result = msg.msgBody;
                map.put(msg.receiptHandle, result);
            }
        return map;
    }
    /**
     * 删除唯品会队列
     *
     * @param receiptHandle
     */
    public void deleteSuningOrder(String receiptHandle) {
        cmqUtil.deleteMsg(SUNING_ORDER, receiptHandle);
    }
}
fanli/src/main/java/com/yeshi/fanli/util/suning/SuningApiUtil.java
@@ -122,7 +122,9 @@
        model.setPicHeight(320);
        String key = "querySearchcommoditynew";
        String json = new Gson().toJson(model);
        //String result = baseRequest("suning.netalliance.searchcommoditynew.query", key, JSONObject.fromObject(json));
        // String result =
        // baseRequest("suning.netalliance.searchcommoditynew.query", key,
        // JSONObject.fromObject(json));
        String result = baseRequest("suning.netalliance.searchcommoditynew.query", key, JSONObject.fromObject(json));
        JSONObject resultJSON = JSONObject.fromObject(result);
        JSONArray array = resultJSON.optJSONObject("sn_responseContent").optJSONObject("sn_body").optJSONObject(key)
@@ -137,7 +139,6 @@
        return null;
    }
    /**
     * 查询商品
     * @Title: searchGoods
@@ -156,23 +157,23 @@
        JSONObject resultJSON = JSONObject.fromObject(result);
        JSONObject responseContent = resultJSON.optJSONObject("sn_responseContent");
        if (responseContent != null) {
             JSONObject snBody = responseContent.optJSONObject("sn_body");
             if (snBody != null) {
                 JSONArray array = snBody.optJSONArray(key);
                 if (array != null) {
            JSONObject snBody = responseContent.optJSONObject("sn_body");
            if (snBody != null) {
                JSONArray array = snBody.optJSONArray(key);
                if (array != null) {
                    Type type = new TypeToken<ArrayList<SuningGoodsInfo>>() {
                    }.getType();
                    List<SuningGoodsInfo> goodsList = new Gson().fromJson(array.toString(), type);
                    return goodsList;
                }
             }
            }
        }
        return null;
    }
    public static SuningGoodsInfo getGoodsDetail(String goodsCode, String supplierCode) {
        JSONObject model = new JSONObject();
        model.put("commodityStr", goodsCode + "-" + supplierCode);
        model.put("commodityStr", goodsCode + "-" +SuningUtil.getFullSupplierCode( supplierCode));
        model.put("picWidth", 600);
        model.put("picHeight", 600);
        model.put("couponMark", 1);
@@ -187,8 +188,7 @@
        }
        return null;
    }
    /**
     * 查询关联商品
     * @Title: searchGoods
@@ -204,7 +204,7 @@
        model.put("supplierCode", supplierCode);
        model.put("picWidth", 320);
        model.put("picHeight", 320);
        String key = "getMorerecommend";
        String json = new Gson().toJson(model);
        String result = baseRequest("suning.netalliance.morerecommend.get", key, JSONObject.fromObject(json));
@@ -219,7 +219,6 @@
        }
        return null;
    }
    public static List<SuningGoodsInfo> getGoodsDetailList(List<String> list) {
        String sts = "";
@@ -280,7 +279,7 @@
     * @param startTime
     * @param endTime
     * @param page
     * @param orderLineStatus
     * @param orderLineStatus  (0:全部状态;1:等待付款;2:支付完成;3:退款;4:订单已取消;5:确认收货)
     * @return 
     * SuningOrderQueryResultDTO 返回类型
     * @throws
@@ -297,7 +296,15 @@
        String result = baseRequest("suning.netalliance.order.query", key, model);
        JSONObject resultJSON = JSONObject.fromObject(result);
        resultJSON = resultJSON.optJSONObject("sn_responseContent");
        JSONArray array = resultJSON.optJSONObject("sn_body").optJSONArray(key);
        JSONObject snBody = resultJSON.optJSONObject("sn_body");
        if (snBody == null)
            return null;
        JSONArray array = snBody.optJSONArray(key);
        if (array == null)
            return null;
        Gson gson = new Gson();
        Type type = new TypeToken<ArrayList<SuningOrderInfo>>() {