yujian
2019-11-20 0f9a0a76b170bceac867dd5cd009e518ac6646e4
Merge remote-tracking branch 'origin/div' into div
26个文件已修改
10个文件已添加
1010 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/aspect/ActiveUserAspect.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/aspect/RequestSerializableAspect.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/aspect/RequestSerializableServiceAspect.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/aspect/integral/IntegralGetFrequencyLimitAspect.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/integral/UserGetIntegralFromOrderRecordMapper.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/integral/UserGetIntegralFromOrderRecord.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/integral/UserGetIntegralFromOrderRecordException.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/order/elme/UpdateElmeOrderJob.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/manager/util/AtomMethodCallInterface.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/manager/util/AtomMethodCallManager.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/integral/UserGetIntegralFromOrderRecordMapper.xml 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/MsgOrderDetailServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/UserOrderMsgNotificationServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralGetServiceImpl.java 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/UserGetIntegralFromOrderRecordServiceImpl.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/HongBaoV2Service.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/integral/IntegralGetService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/integral/UserGetIntegralFromOrderRecordService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/RedisManager.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/integral/UserGetIntegralFromOrderRecordFactory.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java 83 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/redis.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-by/redis.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-job/redis.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro/redis.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/spring.xml 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/aspect/ActiveUserAspect.java
@@ -28,6 +28,7 @@
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.params.SetParams;
/**
 * 活跃用户处理
@@ -86,8 +87,7 @@
                            String key = "useractive-" + uidStr;
                            Jedis jedis = jedisPool.getResource();
                            try {
                                if (jedis.setnx(key, "1") > 0) {
                                    jedis.expire(key, 60 * 5);// 5分钟内不处理
                                if (!StringUtil.isNullOrEmpty(jedis.set(key, "1", new SetParams().nx().ex(300)))) {
                                    try {
                                        // TODO 用户活跃处理
                                        Long uid = Long.parseLong(uidStr);
@@ -99,7 +99,7 @@
                                    }
                                }
                            } finally {
                                jedisPool.returnResource(jedis);
                                jedis.close();
                            }
                        }
                    });
fanli/src/main/java/com/yeshi/fanli/aspect/RequestSerializableAspect.java
@@ -30,6 +30,7 @@
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.params.SetParams;
@Component
@Aspect
@@ -100,14 +101,15 @@
                        LogHelper.test("进入拦截:"+cacheKey+"-"+threadId);
                        try {
                            Constant.waitingThreadSet.add(threadId);
                            long result = 0;
                            String result = null;
                            long startTime = System.currentTimeMillis();
                            // 等待响应
                            while (result <= 0) {
                                result = jedis.setnx(cacheKey, "1");
                            while (StringUtil.isNullOrEmpty(result)) {
                                result = jedis.set(cacheKey, "1", new SetParams().nx().ex(30));
                                LogHelper.error("触发并发锁:" + cacheAlias);
                                LogHelper.error("redis键:" + cacheKey);
                                if (result <= 0) {
                                if (StringUtil.isNullOrEmpty(result)) {
                                    LogHelper.test("等待:"+threadId);
                                    try {
                                        Thread.sleep(50);
@@ -120,14 +122,12 @@
                                        return null;
                                    }
                                } else {
                                    // 设置30秒处理时间
                                    jedis.expire(cacheKey, 30);
                                    LogHelper.test("获取到锁:"+threadId);
                                    break;
                                }
                            }
                            if (result > 0) {
                            if (!StringUtil.isNullOrEmpty(result)) {
                                try {
                                    return joinPoint.proceed();
                                } catch (Throwable e) {
@@ -141,7 +141,7 @@
                                }
                            }
                        } finally {
                            jedisPool.returnResource(jedis);
                            jedis.close();
                        }
                    }
                } catch (Exception e) {// 原子性保护出错
fanli/src/main/java/com/yeshi/fanli/aspect/RequestSerializableServiceAspect.java
@@ -24,6 +24,7 @@
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.params.SetParams;
@Component
@Aspect
@@ -70,12 +71,12 @@
                        Jedis jedis = jedisPool.getResource();
                        try {
                            Constant.waitingThreadSet.add(Thread.currentThread().getId());
                            long result = 0;
                            String result = null;
                            long startTime = System.currentTimeMillis();
                            // 等待响应
                            while (result <= 0) {
                                result = jedis.setnx(cacheKey, "1");
                                if (result <= 0) {
                            while (StringUtil.isNullOrEmpty(result)) {
                                result = jedis.set(cacheKey, "1", new SetParams().nx().ex(30));
                                if (StringUtil.isNullOrEmpty(result)) {
                                    try {
                                        Thread.sleep(50);
                                    } catch (InterruptedException e) {
@@ -85,13 +86,10 @@
                                        Constant.waitingThreadSet.remove(Thread.currentThread().getId());
                                        return null;
                                    }
                                } else {
                                    // 设置30秒处理时间
                                    jedis.expire(cacheKey, 30);
                                }
                            }
                            if (result > 0) {
                            if (!StringUtil.isNullOrEmpty(result)) {
                                try {
                                    return joinPoint.proceed();
                                } catch (Throwable e) {
@@ -103,7 +101,7 @@
                                }
                            }
                        } finally {
                            jedisPool.returnResource(jedis);
                            jedis.close();
                        }
                    }
                } catch (Exception e) {// 原子性保护出错
fanli/src/main/java/com/yeshi/fanli/aspect/integral/IntegralGetFrequencyLimitAspect.java
@@ -79,7 +79,7 @@
                    } finally {
                    }
                } finally {
                    jedisPool.returnResource(jedis);
                    jedis.close();
                }
            }
        } catch (NoSuchMethodException e) {
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -1073,7 +1073,7 @@
            return;
        }
        List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 6);
        List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(id, 6);
        if (goodsList == null)
            goodsList = new ArrayList<>();
@@ -2467,7 +2467,7 @@
        try {
            List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
            List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(id, 10);
            // 初始化
            if (goodsList == null) {
                goodsList = new ArrayList<TaoBaoGoodsBrief>();
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -1018,7 +1018,8 @@
                            BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
                            BigDecimal shareRate = hongBaoManageService.getShareRate();
                            ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
                            ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate,
                                    Constant.MAX_REWARD_RATE);
                            for (PDDGoodsDetail goods : goodsList) {
                                listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO));
                            }
@@ -1036,7 +1037,7 @@
                return;
            }
            List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
            List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(id, 10);
            // 初始化
            if (goodsList == null) {
                goodsList = new ArrayList<TaoBaoGoodsBrief>();
@@ -1064,7 +1065,7 @@
                BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
                BigDecimal shareRate = hongBaoManageService.getShareRate();
                ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
                goodsList.parallelStream().forEach(goods -> {
                    if (goods != null) {
                        // 获取详情
@@ -1084,8 +1085,7 @@
                        }
                        if (taoBaoGoodsBrief != null) {
                            listExtra.add(
                                    GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO));
                            listExtra.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO));
                        }
                    }
                });
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/integral/UserGetIntegralFromOrderRecordMapper.java
New file
@@ -0,0 +1,21 @@
package com.yeshi.fanli.dao.mybatis.integral;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord;
public interface UserGetIntegralFromOrderRecordMapper extends BaseMapper<UserGetIntegralFromOrderRecord> {
    /**
     * 根据用户,事件类型,订单信息计数
     *
     * @param eventType
     * @param uid
     * @param orderNo
     * @param orderSourceType
     * @return
     */
    long countByRecordInfo(@Param("record") UserGetIntegralFromOrderRecord record);
}
fanli/src/main/java/com/yeshi/fanli/entity/integral/UserGetIntegralFromOrderRecord.java
New file
@@ -0,0 +1,99 @@
package com.yeshi.fanli.entity.integral;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 用户因为订单获取到金币
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_integral_get_from_order")
public class UserGetIntegralFromOrderRecord {
    public static int TYPE_PLACE_ORDER = 1;// 下单
    public static int TYPE_RECIEVE_MONEY = 2;// 到账
    @Column(name = "fo_id")
    private Long id;
    @Column(name = "fo_event_type")
    private Integer eventType;// 事件类型
    @Column(name = "fo_uid")
    private Long uid;// 用户ID
    @Column(name = "fo_order_no")
    private String orderNo;// 订单号
    @Column(name = "fo_order_source_type")
    private Integer orderSourceType;// 订单来源类型
    @Column(name = "fo_integral_count")
    private Integer integralCount;// 金币数量
    @Column(name = "fo_create_time")
    private Date createTime;// 创建时间
    @Column(name = "fo_update_time")
    private Date updateTime;// 更新时间
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Integer getEventType() {
        return eventType;
    }
    public void setEventType(Integer eventType) {
        this.eventType = eventType;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
    public Integer getOrderSourceType() {
        return orderSourceType;
    }
    public void setOrderSourceType(Integer orderSourceType) {
        this.orderSourceType = orderSourceType;
    }
    public Integer getIntegralCount() {
        return integralCount;
    }
    public void setIntegralCount(Integer integralCount) {
        this.integralCount = integralCount;
    }
    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;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/integral/UserGetIntegralFromOrderRecordException.java
New file
@@ -0,0 +1,16 @@
package com.yeshi.fanli.exception.integral;
import com.yeshi.fanli.exception.BaseException;
public class UserGetIntegralFromOrderRecordException extends BaseException {
    private static final long serialVersionUID = 1L;
    public UserGetIntegralFromOrderRecordException(int code, String msg) {
        super(code, msg);
    }
    public UserGetIntegralFromOrderRecordException() {
        super();
    }
}
fanli/src/main/java/com/yeshi/fanli/job/order/elme/UpdateElmeOrderJob.java
New file
@@ -0,0 +1,58 @@
package com.yeshi.fanli.job.order.elme;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.elme.ElmeOrder;
import com.yeshi.fanli.exception.elme.ElmeOrderException;
import com.yeshi.fanli.service.inter.elme.ElmeOrderProcessService;
import com.yeshi.fanli.service.inter.order.OrderProcessService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.elme.ElmeOrderUtil;
//饿了么爬单,到账
@Component
public class UpdateElmeOrderJob {
    @Resource
    private ElmeOrderProcessService elmeOrderProcessService;
    @Resource
    private OrderProcessService orderProcessService;
    /**
     * 更新订单(每天早上凌晨0点,下午4点)
     */
    @Scheduled(cron = "0 0 0,16 * * ? ")
    public void updateOrder() {
        if (!Constant.IS_TASK)
            return;
        try {
            List<ElmeOrder> orderList = ElmeOrderUtil.pullLatest5DayOrder();
            try {
                for (ElmeOrder order : orderList)
                    elmeOrderProcessService.processOrder(order);
            } catch (ElmeOrderException e) {
                e.printStackTrace();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    // 每天凌晨过2分到账
    @Scheduled(cron = "0 2 0 * * ? ")
    public void fanli() {
        if (!Constant.IS_TASK)
            return;
        List<HongBaoV2> hongBaoList = orderProcessService.getCanBalanceElmeFanliHongBao();
        for (HongBaoV2 v2 : hongBaoList)
            orderProcessService.elmeFanli(v2.getId());
    }
}
fanli/src/main/java/com/yeshi/fanli/manager/util/AtomMethodCallInterface.java
New file
@@ -0,0 +1,5 @@
package com.yeshi.fanli.manager.util;
public interface AtomMethodCallInterface {
    public void excute();
}
fanli/src/main/java/com/yeshi/fanli/manager/util/AtomMethodCallManager.java
New file
@@ -0,0 +1,41 @@
package com.yeshi.fanli.manager.util;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import com.yeshi.fanli.util.StringUtil;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.params.SetParams;
@Component
public class AtomMethodCallManager {
    @Resource
    private JedisPool jedisPool;
    /**
     * 事件执行
     *
     * @param key
     *            事件唯一标识,要与具体的业务逻辑相结合
     * @param call
     */
    public void excute(String key, AtomMethodCallInterface call) {
        String redisKey = "atom-" + StringUtil.Md5(key);
        Jedis jedis = jedisPool.getResource();
        try {
            if (StringUtil.isNullOrEmpty(jedis.set(redisKey, "1", new SetParams().nx().ex(60)))) {
                System.out.println("请稍后再试");
                return;
            }
            call.excute();
        } finally {
            jedis.del(redisKey);
            jedis.close();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/integral/UserGetIntegralFromOrderRecordMapper.xml
New file
@@ -0,0 +1,116 @@
<?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.integral.UserGetIntegralFromOrderRecordMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord">
        <id column="fo_id" property="id" jdbcType="BIGINT" />
        <result column="fo_event_type" property="eventType" jdbcType="INTEGER" />
        <result column="fo_uid" property="uid" jdbcType="BIGINT" />
        <result column="fo_order_no" property="orderNo" jdbcType="VARCHAR" />
        <result column="fo_order_source_type" property="orderSourceType"
            jdbcType="INTEGER" />
        <result column="fo_integral_count" property="integralCount"
            jdbcType="INTEGER" />
        <result column="fo_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="fo_update_time" property="updateTime" jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">fo_id,fo_event_type,fo_uid,fo_order_no,fo_order_source_type,fo_integral_count,fo_create_time,fo_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_integral_get_from_order where fo_id =
        #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_integral_get_from_order where fo_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert"
        parameterType="com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_integral_get_from_order
        (fo_id,fo_event_type,fo_uid,fo_order_no,fo_order_source_type,fo_integral_count,fo_create_time,fo_update_time)
        values
        (#{id,jdbcType=BIGINT},#{eventType,jdbcType=INTEGER},#{uid,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{orderSourceType,jdbcType=INTEGER},#{integralCount,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective"
        parameterType="com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_integral_get_from_order
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">fo_id,</if>
            <if test="eventType != null">fo_event_type,</if>
            <if test="uid != null">fo_uid,</if>
            <if test="orderNo != null">fo_order_no,</if>
            <if test="orderSourceType != null">fo_order_source_type,</if>
            <if test="integralCount != null">fo_integral_count,</if>
            <if test="createTime != null">fo_create_time,</if>
            <if test="updateTime != null">fo_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="eventType != null">#{eventType,jdbcType=INTEGER},</if>
            <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
            <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if>
            <if test="orderSourceType != null">#{orderSourceType,jdbcType=INTEGER},</if>
            <if test="integralCount != null">#{integralCount,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.integral.UserGetIntegralFromOrderRecord">update yeshi_ec_integral_get_from_order set
        fo_event_type = #{eventType,jdbcType=INTEGER},fo_uid =
        #{uid,jdbcType=BIGINT},fo_order_no =
        #{orderNo,jdbcType=VARCHAR},fo_order_source_type =
        #{orderSourceType,jdbcType=INTEGER},fo_integral_count =
        #{integralCount,jdbcType=INTEGER},fo_create_time =
        #{createTime,jdbcType=TIMESTAMP},fo_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where fo_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord">
        update yeshi_ec_integral_get_from_order
        <set>
            <if test="eventType != null">fo_event_type=#{eventType,jdbcType=INTEGER},</if>
            <if test="uid != null">fo_uid=#{uid,jdbcType=BIGINT},</if>
            <if test="orderNo != null">fo_order_no=#{orderNo,jdbcType=VARCHAR},</if>
            <if test="orderSourceType != null">fo_order_source_type=#{orderSourceType,jdbcType=INTEGER},
            </if>
            <if test="integralCount != null">fo_integral_count=#{integralCount,jdbcType=INTEGER},</if>
            <if test="createTime != null">fo_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">fo_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where fo_id = #{id,jdbcType=BIGINT}
    </update>
    <select id="countByRecordInfo" resultType="java.lang.Long" useCache="false" flushCache="true">
        select
        count(*)
        from yeshi_ec_integral_get_from_order where 1=1
        <if test="record!=null">
            <if test="record.eventType!=null">
                and fo_event_type=#{record.eventType}
            </if>
            <if test="record.uid!=null">
                and fo_uid=#{record.uid}
            </if>
            <if test="record.orderNo!=null">
                and fo_order_no=#{record.orderNo}
            </if>
            <if test="record.orderSourceType!=null">
                and fo_order_source_type=#{record.orderSourceType}
            </if>
        </if>
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java
@@ -38,6 +38,7 @@
import com.yeshi.fanli.exception.order.HongBaoException;
import com.yeshi.fanli.exception.order.ShareGoodsActivityOrderException;
import com.yeshi.fanli.exception.share.UserShareGoodsRecordException;
import com.yeshi.fanli.exception.user.UserAccountException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
@@ -145,10 +146,9 @@
        return hongBaoV2Mapper.selectByPrimaryKey(id);
    }
    @Transactional
    @Override
    public int addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException {
    public int addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException, UserAccountException {
        Set<Integer> stateSet = new HashSet<>();// 订单状态Set
        if (commonOrderList != null && commonOrderList.size() > 0) {
            int orderType = commonOrderList.get(0).getSourceType();
@@ -172,7 +172,7 @@
                        hasUpdate = true;
                }
            }
            /**
             * 通知用户的返利情况
             */
@@ -278,14 +278,14 @@
    @Transactional
    private boolean updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type,
            Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException {
            Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException, UserAccountException {
        System.out.println(commonOrder.getOrderNo());
        // 锁行
        HongBaoV2 oldHongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBaoOrder.getHongBaoV2().getId());
        if (oldHongBao == null)
            throw new HongBaoException(10, "红包对象不存在");
        // 已经失效,已经领取,新老状态一致的红包不做处理
        if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO || oldHongBao.getState() == HongBaoV2.STATE_YILINGQU)
        if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO||oldHongBao.getState() == HongBaoV2.STATE_YILINGQU)
            return false;
        if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
@@ -314,7 +314,8 @@
                        MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), fanliRate.divide(new BigDecimal(100))));
                if (mianDan)
                    hongBao.setMoney(commonOrder.getPayment());
            } else if (commonOrder.getState() == CommonOrder.STATE_JS||commonOrder.getState() == CommonOrder.STATE_WQ) {
            } else if (commonOrder.getState() == CommonOrder.STATE_JS
                    || commonOrder.getState() == CommonOrder.STATE_WQ) {
                hongBao.setState(HongBaoV2.STATE_KELINGQU);
                hongBao.setMoney(
                        MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
@@ -450,27 +451,31 @@
                        } else if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU) {
                            firstHongbao.setMoney(
                                    MoneyBigDecimalUtil.mul(hongBao.getMoney(), firstRate.divide(new BigDecimal(100))));
                        }else if(hongBao.getState() == HongBaoV2.STATE_SHIXIAO)
                        {
                        } else if (hongBao.getState() == HongBaoV2.STATE_SHIXIAO) {
                            firstHongbao.setMoney(new BigDecimal(0));
                        }
                        hongBaoV2Mapper.insertSelective(firstHongbao);
                        // 用户通知
                        if (notificationMap.get(HongBaoV2.TYPE_YIJI) == null) {
                            HongBaoV2 tempHongBao = new HongBaoV2(firstHongbao.getId());
                            tempHongBao.setUserInfo(firstHongbao.getUserInfo());
                            tempHongBao.setMoney(firstHongbao.getMoney());
                            CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                            tempCommonOrder.setPayment(commonOrder.getPayment());
                            notificationMap.put(HongBaoV2.TYPE_YIJI, new HongBaoOrder(tempCommonOrder, tempHongBao));
                        } else {
                            // 增加付款金额与资金
                            HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_YIJI);
                            tempHongBaoOrder.getCommonOrder().setPayment(
                                    tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                            tempHongBaoOrder.getHongBaoV2()
                                    .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(firstHongbao.getMoney()));
                            notificationMap.put(HongBaoV2.TYPE_YIJI, tempHongBaoOrder);
                        if (firstHongbao.getMoney() != null
                                && firstHongbao.getMoney().compareTo(new BigDecimal(0)) > 0) {
                            hongBaoV2Mapper.insertSelective(firstHongbao);
                            // 用户通知
                            if (notificationMap.get(HongBaoV2.TYPE_YIJI) == null) {
                                HongBaoV2 tempHongBao = new HongBaoV2(firstHongbao.getId());
                                tempHongBao.setUserInfo(firstHongbao.getUserInfo());
                                tempHongBao.setMoney(firstHongbao.getMoney());
                                CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                                tempCommonOrder.setPayment(commonOrder.getPayment());
                                notificationMap.put(HongBaoV2.TYPE_YIJI,
                                        new HongBaoOrder(tempCommonOrder, tempHongBao));
                            } else {
                                // 增加付款金额与资金
                                HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_YIJI);
                                tempHongBaoOrder.getCommonOrder().setPayment(
                                        tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                                tempHongBaoOrder.getHongBaoV2().setMoney(
                                        tempHongBaoOrder.getHongBaoV2().getMoney().add(firstHongbao.getMoney()));
                                notificationMap.put(HongBaoV2.TYPE_YIJI, tempHongBaoOrder);
                            }
                        }
                        // 插入二级子红包
@@ -501,26 +506,29 @@
                            } else if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU) {
                                secondHongbao.setMoney(MoneyBigDecimalUtil.mul(hongBao.getMoney(),
                                        secondRate.divide(new BigDecimal(100))));
                            }
                            hongBaoV2Mapper.insertSelective(secondHongbao);
                            // 用户通知
                            if (notificationMap.get(HongBaoV2.TYPE_ERJI) == null) {
                                HongBaoV2 tempHongBao = new HongBaoV2(secondHongbao.getId());
                                tempHongBao.setUserInfo(secondHongbao.getUserInfo());
                                tempHongBao.setMoney(secondHongbao.getMoney());
                                CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                                tempCommonOrder.setPayment(commonOrder.getPayment());
                                notificationMap.put(HongBaoV2.TYPE_ERJI,
                                        new HongBaoOrder(tempCommonOrder, tempHongBao));
                            } else {
                                // 增加付款金额与资金
                                HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_ERJI);
                                tempHongBaoOrder.getCommonOrder().setPayment(
                                        tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                                tempHongBaoOrder.getHongBaoV2().setMoney(
                                        tempHongBaoOrder.getHongBaoV2().getMoney().add(secondHongbao.getMoney()));
                                notificationMap.put(HongBaoV2.TYPE_ERJI, tempHongBaoOrder);
                            } else if (hongBao.getState() == HongBaoV2.STATE_SHIXIAO)
                                secondHongbao.setMoney(new BigDecimal(0));
                            if (secondHongbao.getMoney() != null
                                    && secondHongbao.getMoney().compareTo(new BigDecimal(0)) > 0) {
                                hongBaoV2Mapper.insertSelective(secondHongbao);
                                // 用户通知
                                if (notificationMap.get(HongBaoV2.TYPE_ERJI) == null) {
                                    HongBaoV2 tempHongBao = new HongBaoV2(secondHongbao.getId());
                                    tempHongBao.setUserInfo(secondHongbao.getUserInfo());
                                    tempHongBao.setMoney(secondHongbao.getMoney());
                                    CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                                    tempCommonOrder.setPayment(commonOrder.getPayment());
                                    notificationMap.put(HongBaoV2.TYPE_ERJI,
                                            new HongBaoOrder(tempCommonOrder, tempHongBao));
                                } else {
                                    // 增加付款金额与资金
                                    HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_ERJI);
                                    tempHongBaoOrder.getCommonOrder().setPayment(tempHongBaoOrder.getCommonOrder()
                                            .getPayment().add(commonOrder.getPayment()));
                                    tempHongBaoOrder.getHongBaoV2().setMoney(
                                            tempHongBaoOrder.getHongBaoV2().getMoney().add(secondHongbao.getMoney()));
                                    notificationMap.put(HongBaoV2.TYPE_ERJI, tempHongBaoOrder);
                                }
                            }
                        }
                    }
@@ -547,7 +555,8 @@
                hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
                hongBao.setMoney(
                        MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), fanliRate.divide(new BigDecimal(100))));
            } else if (commonOrder.getState() == CommonOrder.STATE_JS||commonOrder.getState() == CommonOrder.STATE_WQ) {
            } else if (commonOrder.getState() == CommonOrder.STATE_JS
                    || commonOrder.getState() == CommonOrder.STATE_WQ) {
                hongBao.setState(HongBaoV2.STATE_KELINGQU);
                hongBao.setMoney(
                        MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
@@ -595,7 +604,8 @@
                    }
                    // 以实际收入为准计算预估收益
                    if (CommonOrder.STATE_JS == commonOrder.getState()||CommonOrder.STATE_WQ == commonOrder.getState()) {
                    if (CommonOrder.STATE_JS == commonOrder.getState()
                            || CommonOrder.STATE_WQ == commonOrder.getState()) {
                        childUpdate.setMoney(
                                MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
                        if (commonOrder.getThirdCreateTime().getTime() > TimeUtil.convertToTimeTemp("2019-04-16",
@@ -649,7 +659,7 @@
    @Transactional
    private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap)
            throws HongBaoException {
            throws HongBaoException, UserAccountException {
        if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
            BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime());
            // 查询是否有免单计划
@@ -695,7 +705,8 @@
                hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
                hongBao.setMoney(
                        MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), fanliRate.divide(new BigDecimal(100))));
            } else if (commonOrder.getState() == CommonOrder.STATE_JS||CommonOrder.STATE_WQ == commonOrder.getState()) {
            } else if (commonOrder.getState() == CommonOrder.STATE_JS
                    || CommonOrder.STATE_WQ == commonOrder.getState()) {
                hongBao.setState(HongBaoV2.STATE_KELINGQU);
                hongBao.setMoney(
                        MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
@@ -715,6 +726,8 @@
                hongBao.setMoney(mianDanMoney);
            UserInfo user = userInfoService.getUserById(commonOrder.getUserInfo().getId());
            if (user == null)
                throw new UserAccountException(1001, "用户不存在/被封禁");
            hongBao.setUrank(user.getRank());
            hongBao.setOrderType(commonOrder.getSourceType());
            hongBaoV2Mapper.insertSelective(hongBao);
@@ -902,7 +915,8 @@
                hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
                hongBao.setMoney(
                        MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), shareRate.divide(new BigDecimal(100))));
            } else if (commonOrder.getState() == CommonOrder.STATE_JS||commonOrder.getState() == CommonOrder.STATE_WQ) {
            } else if (commonOrder.getState() == CommonOrder.STATE_JS
                    || commonOrder.getState() == CommonOrder.STATE_WQ) {
                hongBao.setState(HongBaoV2.STATE_KELINGQU);
                hongBao.setMoney(
                        MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), shareRate.divide(new BigDecimal(100))));
@@ -913,6 +927,8 @@
                        calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25", "yyyy-M-dd")));
            }
            UserInfo user = userInfoService.getUserById(commonOrder.getUserInfo().getId());
            if (user == null)
                throw new UserAccountException(1001, "用户不存在/被封禁");
            hongBao.setUrank(user.getRank());
            hongBao.setUserInfo(user);
            hongBao.setOrderType(commonOrder.getSourceType());
@@ -954,7 +970,8 @@
                        child.setState(HongBaoV2.STATE_BUKELINGQU);
                        child.setMoney(MoneyBigDecimalUtil.mul(commonOrder.getEstimate(),
                                firstLevelRate.divide(new BigDecimal(100))));
                    } else if (commonOrder.getState() == CommonOrder.STATE_JS||commonOrder.getState() == CommonOrder.STATE_WQ) {
                    } else if (commonOrder.getState() == CommonOrder.STATE_JS
                            || commonOrder.getState() == CommonOrder.STATE_WQ) {
                        child.setState(HongBaoV2.STATE_KELINGQU);
                        child.setMoney(MoneyBigDecimalUtil.mul(commonOrder.geteIncome(),
                                firstLevelRate.divide(new BigDecimal(100))));
@@ -970,7 +987,7 @@
                    child.setVersion(2);
                    child.setCreateTime(new Date());
                    child.setOrderType(commonOrder.getSourceType());
                    if (child.getMoney().compareTo(new BigDecimal(0)) > 0) {
                    if (child.getMoney() != null && child.getMoney().compareTo(new BigDecimal(0)) > 0) {
                        hongBaoV2Mapper.insertSelective(child);
                        // 添加通知
                        if (notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI) == null) {
@@ -1015,7 +1032,6 @@
                    e1.printStackTrace();
                }
            }
        } else
            throw new HongBaoException(2, "type错误");
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -58,6 +58,7 @@
import com.yeshi.fanli.exception.order.HongBaoException;
import com.yeshi.fanli.exception.order.OrderItemException;
import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
import com.yeshi.fanli.exception.user.UserAccountException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.elme.ElmeHongBaoOrderMapService;
import com.yeshi.fanli.service.inter.elme.ElmeOrderService;
@@ -1213,6 +1214,8 @@
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        } catch (UserAccountException e) {
        }
        if (resultCode == 1) {// 只发送新增消息
            OrderMQMsg mqMsg = new OrderMQMsg(orderId, sourceType, uid, OrderMQMsg.HANDLE_TYPE_ADD,
fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/MsgOrderDetailServiceImpl.java
@@ -67,7 +67,7 @@
            }
        } finally {
            jedisPool.returnResource(jedis);
            jedis.close();
        }
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/UserOrderMsgNotificationServiceImpl.java
@@ -164,7 +164,6 @@
        } catch (PushException e) {
            e.printStackTrace();
        }
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -1069,7 +1069,7 @@
        } finally {
            jedis.del(watchKey);
            jedis.unwatch();
            jedisPool.returnResource(jedis);
            jedis.close();
        }
        throw new UserAccountException(10, "请稍后再试");
    }
@@ -1174,7 +1174,7 @@
        } finally {
            jedis.del(watchKey);
            jedis.unwatch();
            jedisPool.returnResource(jedis);
            jedis.close();
        }
        throw new UserAccountException(10, "请稍后再试");
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralGetServiceImpl.java
@@ -7,6 +7,7 @@
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.ThreeSaleMapper;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -17,6 +18,7 @@
import com.yeshi.fanli.entity.integral.IntegralTask.TaskUniqueKeyEnum;
import com.yeshi.fanli.entity.integral.IntegralTaskRank;
import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
import com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord;
import com.yeshi.fanli.exception.integral.IntegralGetException;
import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
@@ -24,11 +26,12 @@
import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRankService;
import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRecordService;
import com.yeshi.fanli.service.inter.user.integral.IntegralTaskService;
import com.yeshi.fanli.service.inter.user.integral.UserGetIntegralFromOrderRecordService;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
import com.yeshi.fanli.util.annotation.integral.IntegralGetFrequencyLimit;
import com.yeshi.fanli.util.annotation.integral.IntegralGetVersionLimit;
import com.yeshi.fanli.util.factory.integral.UserGetIntegralFromOrderRecordFactory;
@Lazy
@Service
@@ -51,6 +54,9 @@
    @Resource
    private IntegralTaskRankService integralTaskRankService;
    @Resource
    private UserGetIntegralFromOrderRecordService userGetIntegralFromOrderRecordService;
    private UserInfo getBossByUid(Long uid) {
        return threeSaleMapper.selectBoss(uid);
@@ -143,7 +149,7 @@
        return null;
    }
    @IntegralGetFrequencyLimit(key = "'addShareInvite-'+#uid", time = 30)
    @Override
    public IntegralTaskRecord addShareInvite(Long uid) {
@@ -176,7 +182,7 @@
            addEventStatistic(uid, TaskUniqueKeyEnum.inShopLevelOne.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -186,7 +192,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.inShopLevelTwo.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -254,7 +260,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.taoLiJinBuy.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -270,7 +276,7 @@
            addEventStatistic(uid, TaskUniqueKeyEnum.inviteLevelOne.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -286,7 +292,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.inviteLevelTwo.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -298,7 +304,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.shareSingleGoods.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -310,7 +316,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.shareMultipleGoods.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -322,7 +328,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.shareTLJGoods.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -334,7 +340,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.giveRebateCoupon.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -346,7 +352,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.giveFreeCoupon.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -358,7 +364,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.giveTaoLiJin.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -370,7 +376,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.closeRecommendGoods.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -386,7 +392,7 @@
            addEventStatistic(uid, TaskUniqueKeyEnum.couponRebate.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -406,7 +412,7 @@
            addEventStatistic(uid, TaskUniqueKeyEnum.couponRebateLevelOne.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -422,19 +428,25 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.couponRebateLevelTwo.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
    @IntegralGetVersionLimit(uid = "#uid")
    @RequestSerializableByKeyService(key = "#uid")
    @Async()
    @Transactional
    @Override
    public void addRebateOrder(Long uid) {
    public void addRebateOrder(Long uid, String orderNo, int sourceType) {
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.rebateOrder.name());
            IntegralTaskRecord record = addEventStatistic(uid, TaskUniqueKeyEnum.rebateOrder.name());
            if (record != null) {
                userGetIntegralFromOrderRecordService.addRecord(
                        UserGetIntegralFromOrderRecordFactory.create(UserGetIntegralFromOrderRecord.TYPE_RECIEVE_MONEY,
                                uid, orderNo, sourceType, record.getGoldCoin()));
            }
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -446,12 +458,19 @@
    @IntegralGetVersionLimit(uid = "#uid")
    @RequestSerializableByKeyService(key = "#uid")
    @Async()
    @Transactional
    @Override
    public void addInviteOrderLevelOne(Long uid) {
    public void addInviteOrderLevelOne(Long uid, String orderNo, int sourceType) {
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelOne.name());
            IntegralTaskRecord record = addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelOne.name());
            if (record != null) {
                userGetIntegralFromOrderRecordService.addRecord(
                        UserGetIntegralFromOrderRecordFactory.create(UserGetIntegralFromOrderRecord.TYPE_RECIEVE_MONEY,
                                uid, orderNo, sourceType, record.getGoldCoin()));
            }
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -463,24 +482,37 @@
    @IntegralGetVersionLimit(uid = "#uid")
    @RequestSerializableByKeyService(key = "#uid")
    @Async()
    @Transactional
    @Override
    public void addInviteOrderLevelTwo(Long uid) {
    public void addInviteOrderLevelTwo(Long uid, String orderNo, int sourceType) {
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelTwo.name());
            IntegralTaskRecord record = addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelTwo.name());
            if (record != null) {
                userGetIntegralFromOrderRecordService.addRecord(
                        UserGetIntegralFromOrderRecordFactory.create(UserGetIntegralFromOrderRecord.TYPE_RECIEVE_MONEY,
                                uid, orderNo, sourceType, record.getGoldCoin()));
            }
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
    @IntegralGetVersionLimit(uid = "#uid")
    @RequestSerializableByKeyService(key = "#uid")
    @Async()
    @Transactional
    @Override
    public void addShareOrder(Long uid) {
    public void addShareOrder(Long uid, String orderNo, int sourceType) {
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.shareOrder.name());
            IntegralTaskRecord record = addEventStatistic(uid, TaskUniqueKeyEnum.shareOrder.name());
            if (record != null) {
                userGetIntegralFromOrderRecordService.addRecord(
                        UserGetIntegralFromOrderRecordFactory.create(UserGetIntegralFromOrderRecord.TYPE_RECIEVE_MONEY,
                                uid, orderNo, sourceType, record.getGoldCoin()));
            }
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -492,7 +524,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.bindWeiXin.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -504,7 +536,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.bindPhone.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -516,7 +548,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.bindTaoBao.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -528,7 +560,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.setWeiXinNum.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -540,7 +572,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.setGender.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -552,7 +584,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.setPortrait.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -564,7 +596,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.setNickName.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -576,7 +608,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.bindAlipay.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
@@ -588,7 +620,7 @@
        try {
            addEventStatistic(uid, TaskUniqueKeyEnum.inviteActivate.name());
        } catch (Exception e) {
            //LogHelper.errorDetailInfo(e);
            // LogHelper.errorDetailInfo(e);
        }
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/UserGetIntegralFromOrderRecordServiceImpl.java
New file
@@ -0,0 +1,66 @@
package com.yeshi.fanli.service.impl.user.invite;
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.integral.UserGetIntegralFromOrderRecordMapper;
import com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord;
import com.yeshi.fanli.exception.integral.UserGetIntegralFromOrderRecordException;
import com.yeshi.fanli.manager.util.AtomMethodCallInterface;
import com.yeshi.fanli.manager.util.AtomMethodCallManager;
import com.yeshi.fanli.service.inter.user.integral.UserGetIntegralFromOrderRecordService;
import com.yeshi.fanli.util.StringUtil;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
@Service
public class UserGetIntegralFromOrderRecordServiceImpl implements UserGetIntegralFromOrderRecordService {
    @Resource
    private UserGetIntegralFromOrderRecordMapper userGetIntegralFromOrderRecordMapper;
    @Resource
    private AtomMethodCallManager atomMethodCallManager;
    @Override
    public long countByEventTypeAndUidAndOrderInfo(int eventType, Long uid, String orderNo, int orderSourceType) {
        UserGetIntegralFromOrderRecord record = new UserGetIntegralFromOrderRecord();
        record.setEventType(eventType);
        record.setOrderNo(orderNo);
        record.setOrderSourceType(orderSourceType);
        record.setUid(uid);
        return userGetIntegralFromOrderRecordMapper.countByRecordInfo(record);
    }
    @Transactional
    @Override
    public void addRecord(UserGetIntegralFromOrderRecord record) throws UserGetIntegralFromOrderRecordException {
        if (record == null || record.getUid() == null || record.getEventType() == null
                || StringUtil.isNullOrEmpty(record.getOrderNo()) || record.getOrderSourceType() == null)
            throw new UserGetIntegralFromOrderRecordException(1, "信息不完整");
        String key = String.format("rs-%s",
                StringUtil.Md5(String.format("UserGetIntegralFromOrderRecord-addRecord-%s-%s-%s-%s", record.getUid(),
                        record.getEventType(), record.getOrderNo(), record.getOrderSourceType())));
        atomMethodCallManager.excute(key, new AtomMethodCallInterface() {
            @Override
            public void excute() {
                long count = countByEventTypeAndUidAndOrderInfo(record.getEventType(), record.getUid(),
                        record.getOrderNo(), record.getOrderSourceType());
                if (count > 0)
                    return;
                if (record.getCreateTime() == null)
                    record.setCreateTime(new Date());
                userGetIntegralFromOrderRecordMapper.insertSelective(record);
            }
        });
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/HongBaoV2Service.java
@@ -8,6 +8,7 @@
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.exception.order.HongBaoException;
import com.yeshi.fanli.exception.user.UserAccountException;
public interface HongBaoV2Service {
@@ -33,7 +34,7 @@
     * @return 0-未添加也未更新 1-只添加 2-只更新 12-有添加也有更新
     * @throws HongBaoException
     */
    public int addHongBao(List<CommonOrder> commonOrder, int type) throws HongBaoException;
    public int addHongBao(List<CommonOrder> commonOrder, int type) throws HongBaoException,UserAccountException ;
    /**
     * 奖金列表(1.4.9之前的版本)
fanli/src/main/java/com/yeshi/fanli/service/inter/user/integral/IntegralGetService.java
@@ -159,26 +159,26 @@
     *  返利订单
     * @param uid
     */
    public void addRebateOrder(Long uid);
    public void addRebateOrder(Long uid,String orderNo,int sourceType);
    /**
     * 一级邀请订单
     * @param uid
     */
    public void addInviteOrderLevelOne(Long uid);
    public void addInviteOrderLevelOne(Long uid,String orderNo,int sourceType);
    /**
     * 二级邀请订单
     * @param uid
     */
    public void addInviteOrderLevelTwo(Long uid);
    public void addInviteOrderLevelTwo(Long uid,String orderNo,int sourceType);
    
    /**
     * 分享订单
     * @param uid
     */
    public void addShareOrder(Long uid);
    public void addShareOrder(Long uid,String orderNo,int sourceType);
    /**
     * 微信授权
fanli/src/main/java/com/yeshi/fanli/service/inter/user/integral/UserGetIntegralFromOrderRecordService.java
New file
@@ -0,0 +1,24 @@
package com.yeshi.fanli.service.inter.user.integral;
import com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord;
import com.yeshi.fanli.exception.integral.UserGetIntegralFromOrderRecordException;
public interface UserGetIntegralFromOrderRecordService {
    /**
     * 根据事件类型,用户,订单信息检索
     * @param eventType
     * @param uid
     * @param orderNo
     * @param orderSourceType
     * @return
     */
    public long countByEventTypeAndUidAndOrderInfo(int eventType, Long uid, String orderNo, int orderSourceType);
    /**
     *
     * @param record
     */
    public void addRecord(UserGetIntegralFromOrderRecord record) throws UserGetIntegralFromOrderRecordException;
}
fanli/src/main/java/com/yeshi/fanli/util/RedisManager.java
@@ -31,6 +31,7 @@
import net.sf.json.JSONArray;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.params.SetParams;
//抢红包采用的redis
@Component
@@ -56,10 +57,12 @@
     */
    private void setString(String key, String value) {
        Jedis jedis = jedisPool.getResource();
        SetParams params=new SetParams().nx().ex(60);
        jedis.set(key, value, params);
        try {
            jedis.set(key, value);
        } finally {
            jedisPool.returnResource(jedis);
            jedis.close();
        }
    }
@@ -75,7 +78,7 @@
        try {
            jedis.del(key);
        } finally {
            jedisPool.returnResource(jedis);
            jedis.close();
        }
    }
@@ -93,7 +96,7 @@
        try {
            jedis.setex(key, seconds, value);
        } finally {
            jedisPool.returnResource(jedis);
            jedis.close();
        }
    }
@@ -102,7 +105,7 @@
        try {
            return jedis.get(key);
        } finally {
            jedisPool.returnResource(jedis);
            jedis.close();
        }
    }
@@ -111,7 +114,7 @@
        try {
            jedis.incr(key);
        } finally {
            jedisPool.returnResource(jedis);
            jedis.close();
        }
    }
@@ -120,7 +123,7 @@
        try {
            jedis.expire(key, seconds);
        } finally {
            jedisPool.returnResource(jedis);
            jedis.close();
        }
    }
@@ -262,7 +265,7 @@
            else
                return false;
        } finally {
            jedisPool.returnResource(jedis);
            jedis.close();
        }
    }
@@ -278,7 +281,7 @@
            else
                return false;
        } finally {
            jedisPool.returnResource(jedis);
            jedis.close();
        }
    }
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -840,14 +840,28 @@
    private void fanliGetIntegral(HongBaoV2 hongBaoV2) {
        if (hongBaoV2 != null && hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU
                && hongBaoV2.getMoney().compareTo(new BigDecimal(0)) > 0) {
            // 查询对应的订单号
            Long mainHongBaoId = hongBaoV2.getId();
            if (hongBaoV2.getParent() != null && hongBaoV2.getParent().getId() != null)
                mainHongBaoId = hongBaoV2.getParent().getId();
            HongBaoOrder hongbaoOrder = hongBaoOrderService.selectDetailByHongBaoId(mainHongBaoId);
            if (hongbaoOrder == null || hongbaoOrder.getCommonOrder() == null)
                return;
            CommonOrder commonOrder = hongbaoOrder.getCommonOrder();
            if (hongBaoV2.getType() == HongBaoV2.TYPE_ZIGOU) {// 自购订单
                integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId());
                integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
                        commonOrder.getSourceType());
            } else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 分享订单
                integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId());
                integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
                        commonOrder.getSourceType());
            } else if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) {// 一级邀请
                integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId());
                integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
                        commonOrder.getSourceType());
            } else if (hongBaoV2.getType() == HongBaoV2.TYPE_ERJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 二级邀请
                integralGetService.addInviteOrderLevelTwo(hongBaoV2.getUserInfo().getId());
                integralGetService.addInviteOrderLevelTwo(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
                        commonOrder.getSourceType());
            }
        }
    }
fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java
@@ -81,7 +81,7 @@
    
    public static boolean greaterThan_2_1(String platform, String versionCode) {
        if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 52))
                || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 71)))
                || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 75)))
            return true;
        else
            return false;
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java
@@ -358,6 +358,24 @@
        }
        return null;
    }
    public static DaTaoKeDetailV2 getGoodsDetailByGoodsId(Long goodsId) {
        TaoKeAppInfo app = getRandomApp();
        Map<String, String> params = new TreeMap<>();
        params.put("version", "v1.1.1");
        params.put("appKey", app.getAppKey());
        params.put("goodsId", goodsId + "");
        params.put("sign", getSign(params, app.getAppSecret()));
        String result = HttpUtil.get("https://openapi.dataoke.com/api/goods/get-goods-details", params,
                new HashMap<>());
        System.out.println(result);
        JSONObject json = JSONObject.fromObject(result);
        JSONObject dataJson = json.optJSONObject("data");
        if (dataJson != null) {
            return parseDaTaoKeDetailV2(dataJson);
        }
        return null;
    }
    public static DaTaoKeGoodsResult search(String key, List<Integer> cidList, BigDecimal priceLowerLimit,
            BigDecimal priceUpperLimit, int page, int pageSize, Integer sort) {
fanli/src/main/java/com/yeshi/fanli/util/factory/integral/UserGetIntegralFromOrderRecordFactory.java
New file
@@ -0,0 +1,17 @@
package com.yeshi.fanli.util.factory.integral;
import com.yeshi.fanli.entity.integral.UserGetIntegralFromOrderRecord;
public class UserGetIntegralFromOrderRecordFactory {
    public static UserGetIntegralFromOrderRecord create(int eventType, Long uid, String orderNo, int sourceType,int integralCount) {
        UserGetIntegralFromOrderRecord record=new UserGetIntegralFromOrderRecord();
        record.setEventType(eventType);
        record.setIntegralCount(integralCount);
        record.setUid(uid);
        record.setOrderSourceType(sourceType);
        record.setOrderNo(orderNo);
        return record;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java
@@ -1844,6 +1844,12 @@
        return url;
    }
    /**
     * 获取淘宝的商品详情
     *
     * @param actionId
     * @return
     */
    public static TaoBaoGoodsBrief getSimpleGoodsBrief(Long actionId) {
        JSONObject data = new JSONObject();
        data.put("itemNumId", actionId + "");
@@ -1855,6 +1861,7 @@
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        HttpClient client = new HttpClient();
        GetMethod gm = new GetMethod(url);
        String result = null;
@@ -1879,25 +1886,30 @@
        JSONObject resultOBJ = JSONObject.fromObject(result);
        if (resultOBJ.optJSONObject("data") != null) {
            data = resultOBJ.optJSONObject("data");
            JSONObject item = data.optJSONObject("item");
            JSONObject seller = data.optJSONObject("seller");
            TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
            goods.setTitle(item.optString("title"));
            goods.setAuctionId(item.optLong("itemId"));
            goods.setTitle(item.optString("title"));
            if (item.optJSONArray("images") != null && item.optJSONArray("images").size() > 0) {
                String picture = item.optJSONArray("images").optString(0);
                goods.setPictUrl(picture.startsWith("http") ? picture : "https:" + picture);
            if (data != null) {
                JSONObject item = data.optJSONObject("item");
                if (item != null) {
                    JSONObject seller = data.optJSONObject("seller");
                    TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
                    goods.setTitle(item.optString("title"));
                    goods.setAuctionId(item.optLong("itemId"));
                    goods.setTitle(item.optString("title"));
                    if (item.optJSONArray("images") != null && item.optJSONArray("images").size() > 0) {
                        String picture = item.optJSONArray("images").optString(0);
                        goods.setPictUrl(picture.startsWith("http") ? picture : "https:" + picture);
                    }
                    if (seller != null) {
                        goods.setSellerId(seller.optLong("shopId"));
                        String shopType = seller.optString("shopType");
                        if ("B".equalsIgnoreCase(shopType)) {
                            goods.setUserType(1);
                        } else
                            goods.setUserType(0);
                        goods.setShopTitle(seller.optString("shopName"));
                    }
                    return goods;
                }
            }
            goods.setSellerId(seller.optLong("shopId"));
            String shopType = seller.optString("shopType");
            if ("B".equalsIgnoreCase(shopType)) {
                goods.setUserType(1);
            } else
                goods.setUserType(0);
            goods.setShopTitle(seller.optString("shopName"));
            return goods;
        }
        return null;
    }
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -9,11 +9,9 @@
import org.yeshi.utils.taobao.TbImgUtil;
import com.taobao.api.ApiException;
import com.yeshi.fanli.dto.taobao.TaoBaoShopInfoDTO;
import com.yeshi.fanli.dto.taobao.TaoLiJinDTO;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport;
import com.yeshi.fanli.entity.taobao.RelateGoods;
import com.yeshi.fanli.entity.taobao.SearchFilter;
import com.yeshi.fanli.entity.taobao.SearchShopFilter;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
@@ -950,23 +948,6 @@
        return null;
    }
    public static List<RelateGoods> getRelateGoodsList(long auctionId) throws ApiException {
        List<RelateGoods> resultList = new ArrayList<>();
        List<TaoBaoGoodsBrief> list = getRelationGoodsRecommend(auctionId, 9);
        for (TaoBaoGoodsBrief goods : list) {
            if (goods != null) {
                RelateGoods rg = new RelateGoods();
                rg.setId(goods.getAuctionId() + "");
                rg.setPicUrl(goods.getPictUrl());
                rg.setTitle(goods.getTitle());
                rg.setZkPrice(goods.getZkPrice().toString());
                rg.setUrl(goods.getAuctionUrl());
                resultList.add(rg);
            }
        }
        return resultList;
    }
    /**
     * 获取券详细信息
     * 
@@ -993,45 +974,6 @@
        } else
            return null;
        return info;
    }
    /**
     * 获取关联商品推荐
     *
     * @param auctionId
     * @return
     */
    public static List<TaoBaoGoodsBrief> getRelationGoodsRecommend(long auctionId, int count) {
        List<TaoBaoGoodsBrief> list = new ArrayList<>();
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.item.recommend.get");
        map.put("num_iid", auctionId + "");
        map.put("count", count + "");
        map.put("platform", 2 + "");
        map.put("fields",
                "num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url");
        String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true);
        JSONObject data = JSONObject.fromObject(resultStr);
        if (data.optJSONObject("tbk_item_recommend_get_response") != null) {
            if (data.optJSONObject("tbk_item_recommend_get_response").optJSONObject("results") == null)
                return list;
            JSONArray array = data.optJSONObject("tbk_item_recommend_get_response").optJSONObject("results")
                    .optJSONArray("n_tbk_item");
            if (array != null)
                for (int i = 0; i < array.size(); i++) {
                    JSONObject item = array.optJSONObject(i);
                    TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
                    goods.setAuctionId(item.optLong("num_iid"));
                    goods.setTitle(item.optString("title"));
                    goods.setZkPrice(new BigDecimal(item.optString("zk_final_price")));
                    goods.setAuctionUrl(item.optString("item_url"));
                    goods.setPictUrl(item.optString("pict_url"));
                    goods.setSalesCount(item.optString("volume"));
                    goods.setUserType(item.optInt("user_type"));
                    list.add(goods);
                }
        }
        return list;
    }
    public static void taoQiangGou() {
@@ -1334,14 +1276,12 @@
        if (response != null && response.optJSONObject("result_list") != null) {
            JSONArray array = response.optJSONObject("result_list").optJSONArray("map_data");
            if (array != null) {
                for (int i = 0; i < array.size(); i++) {
                    JSONObject item = array.optJSONObject(i);
                    TaoBaoGoodsBrief goods = parseWuLiaoItemFromMaterialId(item);
                    if (goods != null)
                        goodsList.add(goods);
                }
                pageSize = array.size();
            }
        }
@@ -2110,22 +2050,37 @@
        return null;
    }
    public static void guessLikeByAuctionId(Long auctionId) {
    public static List<TaoBaoGoodsBrief> guessLikeByAuctionId(Long auctionId,int count) {
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.dg.optimus.material");
        map.put("item_id", auctionId + "");
        map.put("page_size", 20 + "");
        map.put("page_size", count + "");
        map.put("page_no", 1 + "");
        map.put("material_id", 13256 + "");
        List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
        JSONObject resultJSON = null;
        try {
            resultJSON = TaoKeBaseUtil.baseRequest(map, true);
            System.out.println(resultJSON);
            JSONObject response = resultJSON.optJSONObject("tbk_dg_optimus_material_response");
            if (response != null && response.optJSONObject("result_list") != null) {
                JSONArray array = response.optJSONObject("result_list").optJSONArray("map_data");
                if (array != null) {
                    for (int i = 0; i < array.size(); i++) {
                        JSONObject item = array.optJSONObject(i);
                        TaoBaoGoodsBrief goods = parseWuLiaoItemFromMaterialId(item);
                        if (goods != null)
                            goodsList.add(goods);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return goodsList;
    }
}
fanli/src/main/resource/env-dev/redis.properties
@@ -1,7 +1,7 @@
redis.addr=192.168.1.253
redis.port=6379
redis.auth=123456
redis.max_active=1024
redis.max_total=1024
redis.max_idle=200
redis.max_wait=10000
redis.timeout=5000
fanli/src/main/resource/env-pro-by/redis.properties
@@ -1,7 +1,7 @@
redis.addr=127.0.0.1
redis.port=6379
redis.auth=Yeshi2016@
redis.max_active=1024
redis.max_total=1024
redis.max_idle=200
redis.max_wait=10000
redis.timeout=5000
fanli/src/main/resource/env-pro-job/redis.properties
@@ -1,7 +1,7 @@
redis.addr=172.16.16.15
redis.port=6379
redis.auth=crs-43yhgz0i:Yeshi2016@
redis.max_active=1024
redis.max_total=1024
redis.max_idle=200
redis.max_wait=10000
redis.timeout=5000
fanli/src/main/resource/env-pro/redis.properties
@@ -1,7 +1,7 @@
redis.addr=172.16.16.15
redis.port=6379
redis.auth=crs-43yhgz0i:Yeshi2016@
redis.max_active=1024
redis.max_total=1024
redis.max_idle=200
redis.max_wait=10000
redis.timeout=5000
fanli/src/main/resource/spring.xml
@@ -226,41 +226,18 @@
    <!-- redis连接池 -->
    <bean id="jedisConfig" class="redis.clients.jedis.JedisPoolConfig">
        <property name="maxActive" value="${redis.max_active}"></property>
    <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
        <property name="maxTotal" value="${redis.max_total}"></property>
        <property name="maxIdle" value="${redis.max_idle}"></property>
        <property name="maxWait" value="${redis.max_wait}"></property>
        <property name="testOnBorrow" value="${redis.test_on_borrow}"></property>
    </bean>
    <bean id="jedisPool" class="redis.clients.jedis.JedisPool">
        <constructor-arg name="poolConfig" ref="jedisConfig"></constructor-arg>
        <constructor-arg name="poolConfig" ref="jedisPoolConfig"></constructor-arg>
        <constructor-arg name="host" value="${redis.addr}"></constructor-arg>
        <constructor-arg name="port" value="${redis.port}"></constructor-arg>
        <constructor-arg name="timeout" value="${redis.timeout}"></constructor-arg>
        <constructor-arg name="password" value="${redis.auth}"></constructor-arg>
    </bean>
    <!-- redis连接工厂 -->
    <bean id="connectionFactory"
        class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
        <property name="hostName" value="${redis.addr}"></property>
        <property name="port" value="${redis.port}"></property>
        <property name="password" value="${redis.auth}"></property>
        <property name="poolConfig" ref="jedisConfig"></property>
    </bean>
    <!-- redis操作模板,这里采用尽量面向对象的模板 -->
    <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
        <property name="connectionFactory" ref="connectionFactory" />
        <property name="keySerializer">
            <bean
                class="org.springframework.data.redis.serializer.StringRedisSerializer" />
        </property>
        <property name="valueSerializer">
            <bean
                class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />
        </property>
    </bean>
pom.xml
@@ -432,7 +432,7 @@
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.1.0</version>
            <version>3.1.0</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
@@ -538,17 +538,6 @@
            <groupId>com.aliyun.openservices</groupId>
            <artifactId>ons-client</artifactId>
            <version>1.8.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.apache.rocketmq</groupId>
            <artifactId>rocketmq-client</artifactId>
            <version>4.5.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.rocketmq</groupId>
            <artifactId>rocketmq-acl</artifactId>
            <version>4.5.1</version>
        </dependency>
        <!-- 分步式任务 -->