admin
2019-03-26 906d360e44681d27c1a39cabe8755648981c4989
增加淘口令存储
4个文件已修改
6个文件已添加
351 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/RecommendController.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoTokenMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoToken.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/taobao/TaoBaoTokenException.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoTokenMapper.xml 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoTokenServiceImpl.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoTokenService.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/IOSPushFactory.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/RecommendController.java
@@ -404,12 +404,13 @@
            jumpDetail = jumpDetailService.getlastJumpDetailCache();
        }
        List<RecommendSpecial> recommendSpecialList = null;
        List<SuperRecommendSpecial> superRecommendSpecialList = superRecommendSpecialService.getSuperRecommendSpecialBySystemId(system.getId());
        List<SuperRecommendSpecial> superRecommendSpecialList = superRecommendSpecialService
                .getSuperRecommendSpecialBySystemId(system.getId());
        if (superRecommendSpecialList != null && superRecommendSpecialList.size() > 0) {
            recommendSpecialList = new ArrayList<RecommendSpecial>();
            for (SuperRecommendSpecial superRecommendSpecial : superRecommendSpecialList) {
                RecommendSpecial recommendSpecial = superRecommendSpecial.getRecommendSpecial();
                if (jumpDetail != null) {
@@ -418,12 +419,12 @@
                recommendSpecialList.add(recommendSpecial);
            }
        }
        if (recommendSpecialList == null || recommendSpecialList.size() == 0) {
            out.print(JsonUtil.loadFalseResult(1, "暂无数据"));
            return;
        }
        JSONObject data = new JSONObject();
        data.put("count", recommendSpecialList.size());
        Gson gson = new Gson();
@@ -1308,7 +1309,7 @@
                    for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) {
                        if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
                                && goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0
                                && goods.getBiz30day() > 1000)
                                && goods.getBiz30day() > 1000 && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite()))
                            goodsList.add(goods);
                    }
                    try {
@@ -1369,8 +1370,8 @@
        }
        // 首页Banner
        List<RecommendBannerV2> listBanner = superRecommendBannerV2Service.getSuperRecommendBannerV2sBySystem(system.getId());
        List<RecommendBannerV2> listBanner = superRecommendBannerV2Service
                .getSuperRecommendBannerV2sBySystem(system.getId());
        JSONObject root = new JSONObject();
        root.put("banner", listBanner);
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoTokenMapper.java
New file
@@ -0,0 +1,18 @@
package com.yeshi.fanli.dao.mybatis.taobao;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.taobao.TaoBaoToken;
public interface TaoBaoTokenMapper extends BaseMapper<TaoBaoToken> {
    /**
     * 根据商品ID查询淘口令
     *
     * @param auctionId
     * @return
     */
    TaoBaoToken selectByAuctionId(@Param("auctionId") Long auctionId,@Param("pid") String pid);
}
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoToken.java
New file
@@ -0,0 +1,76 @@
package com.yeshi.fanli.entity.taobao;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 淘口令
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_taobao_token")
public class TaoBaoToken {
    @Column(name = "tt_id")
    private Long id;
    @Column(name = "tt_pid")
    private String pid;
    @Column(name = "tt_token")
    private String token;// 口令
    @Column(name = "tt_auction_id")
    private Long auctionId;// 商品Id
    @Column(name = "tt_create_time")
    private Date createTime;// 创建时间
    @Column(name = "tt_expire_time")
    private Date expireTime;// 到期时间
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getPid() {
        return pid;
    }
    public void setPid(String pid) {
        this.pid = pid;
    }
    public String getToken() {
        return token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    public Long getAuctionId() {
        return auctionId;
    }
    public void setAuctionId(Long auctionId) {
        this.auctionId = auctionId;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getExpireTime() {
        return expireTime;
    }
    public void setExpireTime(Date expireTime) {
        this.expireTime = expireTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/taobao/TaoBaoTokenException.java
New file
@@ -0,0 +1,61 @@
package com.yeshi.fanli.exception.taobao;
import java.util.Map;
/**
 * 淘客API异常
 *
 * @author Administrator
 *
 */
public class TaoBaoTokenException extends Exception {
    private int code;
    private String msg;
    private Map<String, String> params;
    public Map<String, String> getParams() {
        return params;
    }
    public void setParams(Map<String, String> params) {
        this.params = params;
    }
    public int getCode() {
        return code;
    }
    public void setCode(int code) {
        this.code = code;
    }
    public String getMsg() {
        return msg;
    }
    public void setMsg(String msg) {
        this.msg = msg;
    }
    public TaoBaoTokenException() {
    }
    public TaoBaoTokenException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public TaoBaoTokenException(int code, String msg, Map<String, String> params) {
        this.code = code;
        this.msg = msg;
        this.params = params;
    }
    @Override
    public String getMessage() {
        return String.format("错误码为:%s  错误信息为:%s", code + "", msg);
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoTokenMapper.xml
New file
@@ -0,0 +1,79 @@
<?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.taobao.TaoBaoTokenMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.taobao.TaoBaoToken">
        <id column="tt_id" property="id" jdbcType="BIGINT" />
        <result column="tt_pid" property="pid" jdbcType="VARCHAR" />
        <result column="tt_token" property="token" jdbcType="VARCHAR" />
        <result column="tt_auction_id" property="auctionId" jdbcType="BIGINT" />
        <result column="tt_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="tt_expire_time" property="expireTime" jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">tt_id,tt_pid,tt_token,tt_auction_id,tt_create_time,tt_expire_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_taobao_token where tt_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByAuctionId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_taobao_token where tt_auction_id = #{auctionId} and
        tt_pid=#{pid}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_taobao_token where tt_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoToken"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_token
        (tt_id,tt_pid,tt_token,tt_auction_id,tt_create_time,tt_expire_time)
        values
        (#{id,jdbcType=BIGINT},#{pid,jdbcType=VARCHAR},#{token,jdbcType=VARCHAR},#{auctionId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{expireTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoToken"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_taobao_token
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">tt_id,</if>
            <if test="pid != null">tt_pid,</if>
            <if test="token != null">tt_token,</if>
            <if test="auctionId != null">tt_auction_id,</if>
            <if test="createTime != null">tt_create_time,</if>
            <if test="expireTime != null">tt_expire_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="pid != null">#{pid,jdbcType=VARCHAR},</if>
            <if test="token != null">#{token,jdbcType=VARCHAR},</if>
            <if test="auctionId != null">#{auctionId,jdbcType=BIGINT},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="expireTime != null">#{expireTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoToken">update
        yeshi_ec_taobao_token set tt_pid = #{pid,jdbcType=VARCHAR},tt_token =
        #{token,jdbcType=VARCHAR},tt_auction_id =
        #{auctionId,jdbcType=BIGINT},tt_create_time =
        #{createTime,jdbcType=TIMESTAMP},tt_expire_time =
        #{expireTime,jdbcType=TIMESTAMP} where tt_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoToken">
        update yeshi_ec_taobao_token
        <set>
            <if test="pid != null">tt_pid=#{pid,jdbcType=VARCHAR},</if>
            <if test="token != null">tt_token=#{token,jdbcType=VARCHAR},</if>
            <if test="auctionId != null">tt_auction_id=#{auctionId,jdbcType=BIGINT},</if>
            <if test="createTime != null">tt_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="expireTime != null">tt_expire_time=#{expireTime,jdbcType=TIMESTAMP},</if>
        </set>
        where tt_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -703,7 +703,7 @@
            // 新版通知
            userMoneyMsgNotificationService.inviteOrderReceived(uid, inviteOrders.size(), inviteGoodsCount, invitemoney,
                    userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
                    userInfoMapper.selectByPKey(uid).getMyHongBao());
            for (String orderId : drawBackOrders)
                taoBaoWeiQuanDrawBackService.doWeiQuanInvite(orderId);
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoTokenServiceImpl.java
New file
@@ -0,0 +1,52 @@
package com.yeshi.fanli.service.impl.taobao;
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoTokenMapper;
import com.yeshi.fanli.entity.taobao.TaoBaoToken;
import com.yeshi.fanli.exception.taobao.TaoBaoTokenException;
import com.yeshi.fanli.service.inter.taobao.TaoBaoTokenService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class TaoBaoTokenServiceImpl implements TaoBaoTokenService {
    @Resource
    private TaoBaoTokenMapper taoBaoTokenMapper;
    @Override
    public void addTaoBaoToken(TaoBaoToken token) throws TaoBaoTokenException {
        if (token == null || token.getAuctionId() == null || StringUtil.isNullOrEmpty(token.getPid())
                || StringUtil.isNullOrEmpty(token.getToken()))
            throw new TaoBaoTokenException(1, "数据不完整");
        token.setCreateTime(new Date());
        // 淘口令设置29天有效
        token.setExpireTime(new Date(token.getCreateTime().getTime() + 1000 * 60 * 60 * 24 * 29L));
        TaoBaoToken old = taoBaoTokenMapper.selectByAuctionId(token.getAuctionId(), token.getPid());
        if (old != null) {
            TaoBaoToken update = new TaoBaoToken();
            update.setId(old.getId());
            update.setToken(token.getToken());
            update.setExpireTime(token.getExpireTime());
            taoBaoTokenMapper.updateByPrimaryKeySelective(update);
        } else {
            taoBaoTokenMapper.insertSelective(token);
        }
    }
    @Override
    public TaoBaoToken getTaoBaoToken(Long auctionId, String pid) {
        TaoBaoToken token = taoBaoTokenMapper.selectByAuctionId(auctionId, pid);
        if (token != null && token.getExpireTime().getTime() >= System.currentTimeMillis())
            return token;
        else
            return null;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoTokenService.java
New file
@@ -0,0 +1,30 @@
package com.yeshi.fanli.service.inter.taobao;
import com.yeshi.fanli.entity.taobao.TaoBaoToken;
import com.yeshi.fanli.exception.taobao.TaoBaoTokenException;
/**
 * 淘口令服务
 *
 * @author Administrator
 *
 */
public interface TaoBaoTokenService {
    /**
     * 添加淘口令
     *
     * @param token
     * @throws TaoBaoTokenException
     */
    public void addTaoBaoToken(TaoBaoToken token) throws TaoBaoTokenException;
    /**
     * 获取淘口令
     *
     * @param auctionId
     * @return
     */
    public TaoBaoToken getTaoBaoToken(Long auctionId,String pid);
}
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -255,7 +255,7 @@
                                    }
                                } catch (Exception e) {
                                    try {
                                        LogHelper.errorDetailInfo(e);
                                        LogHelper.errorDetailInfo(e, map.get(handler).toString(), "");
                                    } catch (Exception e1) {
                                        e1.printStackTrace();
                                    }
fanli/src/main/java/com/yeshi/fanli/util/factory/IOSPushFactory.java
@@ -63,7 +63,7 @@
        JSONObject aps = new JSONObject();
        aps.put("alert", alert);
        aps.put("badge", 1);
        //aps.put("badge", 1);
        JSONObject json = new JSONObject();
        json.put("aps", aps);
        return filterPushContent(json);
@@ -85,7 +85,7 @@
        alert.put("type", PushController.ZNX);
        JSONObject aps = new JSONObject();
        aps.put("alert", alert);
        aps.put("badge", 1);
        //aps.put("badge", 1);
        JSONObject json = new JSONObject();
        json.put("aps", aps);
        return filterPushContent(json);
@@ -111,7 +111,7 @@
        JSONObject aps = new JSONObject();
        aps.put("alert", alert);
        aps.put("badge", 1);
        //aps.put("badge", 1);
        JSONObject json = new JSONObject();
        json.put("aps", aps);
        return filterPushContent(json);
@@ -136,7 +136,7 @@
        JSONObject aps = new JSONObject();
        aps.put("alert", alert);
        aps.put("badge", 1);
        //aps.put("badge", 1);
        JSONObject json = new JSONObject();
        json.put("aps", aps);
        return filterPushContent(json);
@@ -161,7 +161,7 @@
        JSONObject aps = new JSONObject();
        aps.put("alert", alert);
        aps.put("badge", 1);
        //aps.put("badge", 1);
        JSONObject json = new JSONObject();
        json.put("aps", aps);
        return filterPushContent(json);
@@ -183,7 +183,7 @@
        JSONObject aps = new JSONObject();
        aps.put("alert", alert);
        aps.put("badge", 1);
        //aps.put("badge", 1);
        JSONObject json = new JSONObject();
        json.put("aps", aps);
        return filterPushContent(json);