admin
2019-08-01 292937c16f7ad0021b8cd2dfb8fcc0cdf26f59de
Merge remote-tracking branch 'origin/div' into div

Conflicts:
fanli/src/main/java/com/yeshi/fanli/entity/jd/JDGoods.java
7个文件已修改
1个文件已添加
219 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/h5/H5RecommendController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/pdd/PDDPromotionUrl.java 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/jd/JDGoods.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/wx/WXLoginUtil.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -716,7 +716,7 @@
        GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, fanLiRate, shareRate);
        CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
        if (couponInfo != null) {
            String url = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null);
            String url = PinDuoDuoApiUtil.getPromotionUrl(id, PinDuoDuoApiUtil.PID_COUPON + "", null);
            couponInfo.setLink(url);
        }
@@ -1060,7 +1060,7 @@
            return;
        }
        String jumpLink = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_FANLI + "", uid + "");
        String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(id, PinDuoDuoApiUtil.PID_FANLI + "", uid + "");
        JSONObject data = new JSONObject();
        data.put("native", true);
        data.put("jumpLink", jumpLink);
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
@@ -657,7 +657,7 @@
//                Constant.systemCommonConfig.getShareGoodsPagePathPDD(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
//                goodsId + "");
        String jumpLink = PinDuoDuoApiUtil.convert(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", uid + "");
        String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", uid + "");
        
        ShareInfoVO shareInfo = new ShareInfoVO();
        shareInfo.setClickUrl(jumpLink);
@@ -1004,7 +1004,7 @@
//                goodsId + "");
//        String shortLink = HttpUtil.getShortLink(url);
        
        String shortLink = PinDuoDuoApiUtil.convert(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", uid + "");
        String shortLink = PinDuoDuoApiUtil.getPromotionUrl(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", uid + "");
        // 创建口令
        String token = PinDuoDuoApiUtil.createGenerate(goodsId);
fanli/src/main/java/com/yeshi/fanli/controller/h5/H5RecommendController.java
@@ -549,7 +549,7 @@
            hasCoupon = false;
        }
        
        String jumpLink = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_SHARE + "", uid);
        String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(id, PinDuoDuoApiUtil.PID_SHARE + "", uid);
        
        JSONObject data = new JSONObject();
        data.put("imgs", imageList);
fanli/src/main/java/com/yeshi/fanli/dto/pdd/PDDPromotionUrl.java
New file
@@ -0,0 +1,106 @@
package com.yeshi.fanli.dto.pdd;
import java.io.Serializable;
import com.google.gson.annotations.SerializedName;
/**
 * 推广链接
 *
 * @author Administrator
 *
 */
public class PDDPromotionUrl implements Serializable {
    private static final long serialVersionUID = 1L;
    // 唤起微信app推广短链接
    @SerializedName("we_app_web_view_short_url")
    private String shortUrlWinXin;
    // 唤起微信app推广链接
    @SerializedName("we_app_web_view_url")
    private String urlWinXin;
    // 唤醒拼多多app的推广短链接
    @SerializedName("mobile_short_url")
    private String shortUrlAPP;
    // 唤醒拼多多app的推广长链接
    @SerializedName("mobile_url")
    private String urlAPP;
    // 推广短链接
    @SerializedName("short_url")
    private String shortUrl;
    // 推广长链接
    @SerializedName("url")
    private String url;
    // 微博推广短链接
    @SerializedName("weibo_app_web_view_short_url")
    private String shortUrlWeiBo;
    // 微博推广链接
    @SerializedName("weibo_app_web_view_url")
    private String urlWeiBo;
    public String getShortUrlWinXin() {
        return shortUrlWinXin;
    }
    public void setShortUrlWinXin(String shortUrlWinXin) {
        this.shortUrlWinXin = shortUrlWinXin;
    }
    public String getUrlWinXin() {
        return urlWinXin;
    }
    public void setUrlWinXin(String urlWinXin) {
        this.urlWinXin = urlWinXin;
    }
    public String getShortUrlAPP() {
        return shortUrlAPP;
    }
    public void setShortUrlAPP(String shortUrlAPP) {
        this.shortUrlAPP = shortUrlAPP;
    }
    public String getUrlAPP() {
        return urlAPP;
    }
    public void setUrlAPP(String urlAPP) {
        this.urlAPP = urlAPP;
    }
    public String getShortUrl() {
        return shortUrl;
    }
    public void setShortUrl(String shortUrl) {
        this.shortUrl = shortUrl;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getShortUrlWeiBo() {
        return shortUrlWeiBo;
    }
    public void setShortUrlWeiBo(String shortUrlWeiBo) {
        this.shortUrlWeiBo = shortUrlWeiBo;
    }
    public String getUrlWeiBo() {
        return urlWeiBo;
    }
    public void setUrlWeiBo(String urlWeiBo) {
        this.urlWeiBo = urlWeiBo;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/jd/JDGoods.java
@@ -20,7 +20,7 @@
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private static final long serialVersionUID = 1L;
    private JDCategoryInfo categoryInfo;// 类目信息
    private Long comments;// 评论数
    private JDCommissionInfo commissionInfo;// 佣金信息
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -99,6 +99,7 @@
        <result column="hb_id" property="hongbaoId" jdbcType="BIGINT" />
        <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" />
        <association property="userInfo" column="co_uid"
            resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" />
@@ -106,6 +107,52 @@
            resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap" />
    </resultMap>
    <resultMap id="ThreeResultMap" type="com.yeshi.fanli.vo.order.CommonOrderVO">
        <id column="co_id" property="id" jdbcType="BIGINT" />
        <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" />
        <result column="co_source_type" property="sourceType" jdbcType="INTEGER" />
        <result column="co_source_position" property="sourcePosition"
            jdbcType="VARCHAR" />
        <result column="co_count" property="count" jdbcType="INTEGER" />
        <result column="co_state" property="state" jdbcType="INTEGER" />
        <result column="co_state_whole_order" property="stateWholeOrder"
            jdbcType="INTEGER" />
        <result column="co_estimate" property="estimate" jdbcType="DECIMAL" />
        <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL" />
        <result column="co_payment" property="payment" jdbcType="DECIMAL" />
        <result column="co_settlement" property="settlement" jdbcType="DECIMAL" />
        <result column="co_third_create_time" property="thirdCreateTime"
            jdbcType="TIMESTAMP" />
        <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP" />
        <result column="co_order_by" property="orderBy" jdbcType="INTEGER" />
        <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="totalMoney" property="hongBao" jdbcType="DECIMAL" />
        <result column="couponMoney" property="couponMoney" jdbcType="DECIMAL" />
        <result column="hongBaoState" property="hongBaoState" jdbcType="INTEGER" />
        <result column="hongBaoType" property="hongBaoType" jdbcType="INTEGER" />
        <result column="accountTime" property="accountTime" jdbcType="TIMESTAMP" />
        <result column="preAccountTime" property="preAccountTime"
            jdbcType="TIMESTAMP" />
        <result column="totalCount" property="totalCount" jdbcType="INTEGER" />
        <result column="totalSettlement" property="totalSettlement"
            jdbcType="DECIMAL" />
        <result column="totalPayment" property="totalPayment" jdbcType="DECIMAL" />
        <result column="userId" property="userId" jdbcType="VARCHAR" />
        <result column="userName" property="userName" jdbcType="VARCHAR" />
        <result column="userPortrait" property="userPortrait" jdbcType="VARCHAR" />
        <result column="hb_id" property="hongbaoId" jdbcType="BIGINT" />
        <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" />
         <association property="userInfo" column="co_uid"
           select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPKey"/>
         <association property="commonOrderGoods" column="co_order_goods_id"
           select="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.selectByPrimaryKey"/>
    </resultMap>
    <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
@@ -688,21 +735,20 @@
        #{orderNo} AND co.co_state<![CDATA[<>]]>
        4 AND v2.hb_uid = #{uid} ORDER BY co.`co_state` DESC LIMIT 1
    </select>
    <select id="listQuery" resultMap="ResultMap">
    <select id="listQuery" resultMap="ThreeResultMap">
        SELECT A.*,u.id AS userId,u.`nick_name` AS userName,u.`portrait` AS
        userPortrait FROM (SELECT hb.hb_id,hb.hb_uid,hb.`hb_money` AS
        totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType,
        hb.`hb_get_time` AS accountTime, hb.`hb_pre_get_time` AS
        preAccountTime, co.*,cog.* FROM yeshi_ec_hongbao_order ho LEFT JOIN
        preAccountTime, co.*  FROM yeshi_ec_hongbao_order ho LEFT JOIN
        (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1
        <include refid="SELECT_PARAM_HONGBAO_TYPE" />
        <!-- 红包类型 -->
        <include refid="SELECT_HONGBAO_STATE" />
        <!-- 红包状态 -->
        )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` LEFT
        JOIN yeshi_ec_common_order_goods cog ON cog.`cog_id`=
        co.`co_order_goods_id` WHERE hb.hb_id IS NOT NULL
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
        WHERE hb.hb_id IS NOT NULL
        <include refid="SELECT_PARAM_ORDER_STATE" />
        <!-- 订单状态 -->
        <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]>
@@ -726,9 +772,8 @@
        <include refid="SELECT_HONGBAO_STATE" />
        <!-- 红包状态 -->
        )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` LEFT
        JOIN yeshi_ec_common_order_goods cog ON cog.`cog_id`=
        co.`co_order_goods_id` WHERE hb.hb_id IS NOT NULL
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
         WHERE hb.hb_id IS NOT NULL
        <include refid="SELECT_PARAM_ORDER_STATE" />
        <!-- 订单状态 -->
        <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]>
fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java
@@ -19,6 +19,7 @@
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
import com.yeshi.fanli.dto.pdd.PDDOrderResult;
import com.yeshi.fanli.dto.pdd.PDDPromotionUrl;
import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
import com.yeshi.fanli.entity.pdd.PDDOrder;
import com.yeshi.fanli.util.Constant;
@@ -257,7 +258,7 @@
     * @param customParams
     * @return
     */
    public static String convert(Long goodsId, String pid, String customParams) {
    public static PDDPromotionUrl convert(Long goodsId, String pid, String customParams) {
        Map<String, String> map = new HashMap<>();
        map.put("type", "pdd.ddk.goods.promotion.url.generate");
        map.put("p_id", pid);
@@ -278,11 +279,31 @@
            return null;
        }
        JSONArray resultArray = json.optJSONArray("goods_promotion_url_list");
        if (resultArray != null && resultArray.size() > 0)
            return resultArray.optJSONObject(0).optString("short_url");
        if (resultArray != null && resultArray.size() > 0) {
            Type type = new TypeToken<PDDPromotionUrl>() {}.getType();
            Gson gson = new GsonBuilder().disableHtmlEscaping().create();
            return gson.fromJson(resultArray.optJSONObject(0).toString(), type);
        }
        return null;
    }
    /**
     * 商品转链
     *
     * @param goodsId
     * @param pid
     * @param customParams
     * @return
     */
    public static String getPromotionUrl(Long goodsId, String pid, String customParams) {
        PDDPromotionUrl promotion = convert(goodsId, pid, customParams);
        if (promotion != null) {
            return promotion.getUrl();
        }
        return null;
    }
    public static void createPid() {
        Map<String, String> map = new HashMap<>();
        map.put("type", "pdd.ddk.goods.pid.generate");
fanli/src/main/java/com/yeshi/fanli/util/wx/WXLoginUtil.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.util.wx;
import java.io.InputStream;
import org.json.JSONException;
import org.json.JSONObject;
import org.yeshi.utils.HttpUtil;
@@ -98,8 +100,13 @@
        if (user != null) {
            if (!StringUtil.isNullOrEmpty(user.getHeadimgurl())) {
                FileUploadResult result = COSManager.getInstance().uploadFile(
                        HttpUtil.getAsInputStream(user.getHeadimgurl()),
                InputStream asInputStream = HttpUtil.getAsInputStream(user.getHeadimgurl());
                if (asInputStream == null) {
                    LogHelper.test("微信头像下载失败: " +user.getUnionid()+ " " + user.getHeadimgurl());
                    return user;
                }
                FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream,
                        String.format("/portrait/wx/%s_%s.jpg", user.getUnionid(), System.currentTimeMillis() + ""));
                if (result != null && !StringUtil.isNullOrEmpty(result.getUrl())) {
                    user.setHeadimgurl(result.getUrl());
@@ -115,6 +122,8 @@
                    // COSManager.getInstance().deleteFile(object.getKey());
                    // }
                    // }
                } else {
                    LogHelper.test("微信头像上传失败: " +user.getUnionid()+ " " + user.getHeadimgurl());
                }
            }
        }