Merge branch 'dev-msg'
Conflicts:
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
New file |
| | |
| | | package com.yeshi.fanli.controller;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.net.URLDecoder;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionAuthRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | | * 授权回调
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Controller
|
| | | @RequestMapping("client/v1/auth/callback")
|
| | | public class AuthCallBackController {
|
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionAuthRecordService taoBaoUnionAuthRecordService;
|
| | |
|
| | | @RequestMapping(value = "tb")
|
| | | public void tb(String code, String state, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(code) || StringUtil.isNullOrEmpty(state))
|
| | | return;
|
| | | String stateStr = AESUtil.decrypt(state, Constant.UIDAESKEY);
|
| | | int errCode = 0;
|
| | | if (StringUtil.isNullOrEmpty(stateStr)) {
|
| | | // 解密错误
|
| | | errCode = 1;
|
| | | }
|
| | | JSONObject json = JSONObject.fromObject(stateStr);
|
| | | Long time = json.optLong("t");
|
| | | Long uid = json.optLong("u");
|
| | | if (System.currentTimeMillis() - time > 1000 * 60 * 10L) {
|
| | | // 过时
|
| | | errCode = 2;
|
| | | }
|
| | | if (uid == null || uid.longValue() == 0L)
|
| | | errCode = 3;
|
| | |
|
| | | // 计入记录
|
| | |
|
| | | try {
|
| | | String result = TaoKeApiUtil.getAccessToken(code, Constant.TAOBAO_AUTH_APPKEY,
|
| | | Constant.TAOBAO_AUTH_APPSECRET);
|
| | | JSONObject data = JSONObject.fromObject(result);
|
| | | data = data.optJSONObject("top_auth_token_create_response").optJSONObject("token_result");
|
| | | String accessToken = data.optString("access_token");
|
| | | String openUid = data.optString("taobao_open_uid");
|
| | | String taoBaoUid = data.optString("taobao_user_id");
|
| | | String nickName = data.optString("taobao_user_nick");
|
| | | if (!StringUtil.isNullOrEmpty(nickName))
|
| | | try {
|
| | | nickName = URLDecoder.decode(nickName, "UTF-8");
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // userExtraTaoBaoInfoService.addRelationId(uid, relationId);
|
| | | TaoBaoUnionAuthRecord record = new TaoBaoUnionAuthRecord();
|
| | | record.setUser(new UserInfo(uid));
|
| | | record.setTaoBaoOpenUid(openUid);
|
| | | record.setTaoBaoUserId(taoBaoUid);
|
| | | record.setTaoBaoUserNick(nickName);
|
| | | record.setCreateTime(new Date());
|
| | | taoBaoUnionAuthRecordService.addAuthRecord(record);
|
| | | } catch (Exception e) {
|
| | | errCode = 4;
|
| | | }
|
| | |
|
| | | out.print("<html><body>绑定错误:错误码(" + errCode + ")</body></html>");
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.taobao; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord; |
| | | |
| | | public interface TaoBaoUnionAuthRecordMapper extends BaseMapper<TaoBaoUnionAuthRecord>{ |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; |
| | | |
| | | public interface UserExtraTaoBaoInfoMapper extends BaseMapper<UserExtraTaoBaoInfo> { |
| | | |
| | | /** |
| | | * 根据用户ID查询对象 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | UserExtraTaoBaoInfo selectByUid(Long uid); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | @Table("yeshi_ec_user_info_extra_taobao")
|
| | | public class UserExtraTaoBaoInfo {
|
| | | @Column(name = "uiet_id")
|
| | | private Long id;
|
| | | @Column(name = "uiet_uid")
|
| | | private UserInfo user;
|
| | | @Column(name = "uiet_relation_id")
|
| | | private String relationId;
|
| | | @Column(name = "uiet_relation_update_time")
|
| | | private Date relationUpdateTime;
|
| | | @Column(name = "uiet_special_id")
|
| | | private String specialId;
|
| | | @Column(name = "uiet_special_update_time")
|
| | | private Date specialUpdateTime;
|
| | | @Column(name = "uiet_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "uiet_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public UserInfo getUser() {
|
| | | return user;
|
| | | }
|
| | |
|
| | | public void setUser(UserInfo user) {
|
| | | this.user = user;
|
| | | }
|
| | |
|
| | | public String getRelationId() {
|
| | | return relationId;
|
| | | }
|
| | |
|
| | | public void setRelationId(String relationId) {
|
| | | this.relationId = relationId;
|
| | | }
|
| | |
|
| | | public Date getRelationUpdateTime() {
|
| | | return relationUpdateTime;
|
| | | }
|
| | |
|
| | | public void setRelationUpdateTime(Date relationUpdateTime) {
|
| | | this.relationUpdateTime = relationUpdateTime;
|
| | | }
|
| | |
|
| | | public String getSpecialId() {
|
| | | return specialId;
|
| | | }
|
| | |
|
| | | public void setSpecialId(String specialId) {
|
| | | this.specialId = specialId;
|
| | | }
|
| | |
|
| | | public Date getSpecialUpdateTime() {
|
| | | return specialUpdateTime;
|
| | | }
|
| | |
|
| | | public void setSpecialUpdateTime(Date specialUpdateTime) {
|
| | | this.specialUpdateTime = specialUpdateTime;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.taobao;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
|
| | | /**
|
| | | * 淘宝联盟授权记录
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_taobao_union_auth_record")
|
| | | public class TaoBaoUnionAuthRecord {
|
| | | @Column(name = "tuar_id")
|
| | | private Long id;
|
| | | @Column(name = "tuar_uid")
|
| | | private UserInfo user;
|
| | | @Column(name = "tuar_taobao_user_nick")
|
| | | private String taoBaoUserNick;
|
| | | @Column(name = "tuar_taobao_open_uid")
|
| | | private String taoBaoOpenUid;
|
| | | @Column(name = "tuar_taobao_user_id")
|
| | | private String taoBaoUserId;
|
| | | @Column(name = "tuar_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "tuar_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public UserInfo getUser() {
|
| | | return user;
|
| | | }
|
| | |
|
| | | public void setUser(UserInfo user) {
|
| | | this.user = user;
|
| | | }
|
| | |
|
| | | public String getTaoBaoUserNick() {
|
| | | return taoBaoUserNick;
|
| | | }
|
| | |
|
| | | public void setTaoBaoUserNick(String taoBaoUserNick) {
|
| | | this.taoBaoUserNick = taoBaoUserNick;
|
| | | }
|
| | |
|
| | | public String getTaoBaoOpenUid() {
|
| | | return taoBaoOpenUid;
|
| | | }
|
| | |
|
| | | public void setTaoBaoOpenUid(String taoBaoOpenUid) {
|
| | | this.taoBaoOpenUid = taoBaoOpenUid;
|
| | | }
|
| | |
|
| | | public String getTaoBaoUserId() {
|
| | | return taoBaoUserId;
|
| | | }
|
| | |
|
| | | public void setTaoBaoUserId(String taoBaoUserId) {
|
| | | this.taoBaoUserId = taoBaoUserId;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | <?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.TaoBaoUnionAuthRecordMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord"> |
| | | <id column="tuar_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="tuar_taobao_user_nick" property="taoBaoUserNick" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="tuar_taobao_open_uid" property="taoBaoOpenUid" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="tuar_taobao_user_id" property="taoBaoUserId" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="tuar_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tuar_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | |
| | | <association property="user" column="tuar_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="tuar_uid" property="id" /> |
| | | </association> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">tuar_id,tuar_uid,tuar_taobao_user_nick,tuar_taobao_open_uid,tuar_taobao_user_id,tuar_create_time,tuar_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_union_auth_record where tuar_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_taobao_union_auth_record where tuar_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_taobao_union_auth_record |
| | | (tuar_id,tuar_uid,tuar_taobao_user_nick,tuar_taobao_open_uid,tuar_taobao_user_id,tuar_create_time,tuar_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{taoBaoUserNick,jdbcType=VARCHAR},#{taoBaoOpenUid,jdbcType=VARCHAR},#{taoBaoUserId,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_taobao_union_auth_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">tuar_id,</if> |
| | | <if test="user != null">tuar_uid,</if> |
| | | <if test="taoBaoUserNick != null">tuar_taobao_user_nick,</if> |
| | | <if test="taoBaoOpenUid != null">tuar_taobao_open_uid,</if> |
| | | <if test="taoBaoUserId != null">tuar_taobao_user_id,</if> |
| | | <if test="createTime != null">tuar_create_time,</if> |
| | | <if test="updateTime != null">tuar_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="user != null">#{user.id,jdbcType=BIGINT},</if> |
| | | <if test="taoBaoUserNick != null">#{taoBaoUserNick,jdbcType=VARCHAR},</if> |
| | | <if test="taoBaoOpenUid != null">#{taoBaoOpenUid,jdbcType=VARCHAR},</if> |
| | | <if test="taoBaoUserId != null">#{taoBaoUserId,jdbcType=VARCHAR},</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.taobao.TaoBaoUnionAuthRecord">update |
| | | yeshi_ec_taobao_union_auth_record set tuar_uid = |
| | | #{user.id,jdbcType=BIGINT},tuar_taobao_user_nick = |
| | | #{taoBaoUserNick,jdbcType=VARCHAR},tuar_taobao_open_uid = |
| | | #{taoBaoOpenUid,jdbcType=VARCHAR},tuar_taobao_user_id = |
| | | #{taoBaoUserId,jdbcType=VARCHAR},tuar_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},tuar_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where tuar_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord"> |
| | | update yeshi_ec_taobao_union_auth_record |
| | | <set> |
| | | <if test="user != null">tuar_uid=#{user.id,jdbcType=BIGINT},</if> |
| | | <if test="taoBaoUserNick != null">tuar_taobao_user_nick=#{taoBaoUserNick,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="taoBaoOpenUid != null">tuar_taobao_open_uid=#{taoBaoOpenUid,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="taoBaoUserId != null">tuar_taobao_user_id=#{taoBaoUserId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null">tuar_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">tuar_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where tuar_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.user.UserExtraTaoBaoInfoMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo"> |
| | | <id column="uiet_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="uiet_relation_id" property="relationId" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="uiet_relation_update_time" property="relationUpdateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="uiet_special_id" property="specialId" jdbcType="VARCHAR" /> |
| | | <result column="uiet_special_update_time" property="specialUpdateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="uiet_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="uiet_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <association property="user" column="uiet_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="uiet_uid" property="id" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">uiet_id,uiet_uid,uiet_relation_id,uiet_relation_update_time,uiet_special_id,uiet_special_update_time,uiet_create_time,uiet_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_info_extra_taobao where uiet_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_user_info_extra_taobao where uiet_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_user_info_extra_taobao |
| | | (uiet_id,uiet_uid,uiet_relation_id,uiet_relation_update_time,uiet_special_id,uiet_special_update_time,uiet_create_time,uiet_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{relationId,jdbcType=VARCHAR},#{relationUpdateTime,jdbcType=TIMESTAMP},#{specialId,jdbcType=VARCHAR},#{specialUpdateTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_user_info_extra_taobao |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">uiet_id,</if> |
| | | <if test="user != null">uiet_uid,</if> |
| | | <if test="relationId != null">uiet_relation_id,</if> |
| | | <if test="relationUpdateTime != null">uiet_relation_update_time,</if> |
| | | <if test="specialId != null">uiet_special_id,</if> |
| | | <if test="specialUpdateTime != null">uiet_special_update_time,</if> |
| | | <if test="createTime != null">uiet_create_time,</if> |
| | | <if test="updateTime != null">uiet_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="user != null">#{user.id,jdbcType=BIGINT},</if> |
| | | <if test="relationId != null">#{relationId,jdbcType=VARCHAR},</if> |
| | | <if test="relationUpdateTime != null">#{relationUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="specialId != null">#{specialId,jdbcType=VARCHAR},</if> |
| | | <if test="specialUpdateTime != null">#{specialUpdateTime,jdbcType=TIMESTAMP},</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.bus.user.UserExtraTaoBaoInfo">update |
| | | yeshi_ec_user_info_extra_taobao set uiet_uid = |
| | | #{user.id,jdbcType=BIGINT},uiet_relation_id = |
| | | #{relationId,jdbcType=VARCHAR},uiet_relation_update_time = |
| | | #{relationUpdateTime,jdbcType=TIMESTAMP},uiet_special_id = |
| | | #{specialId,jdbcType=VARCHAR},uiet_special_update_time = |
| | | #{specialUpdateTime,jdbcType=TIMESTAMP},uiet_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},uiet_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where uiet_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo"> |
| | | update yeshi_ec_user_info_extra_taobao |
| | | <set> |
| | | <if test="user != null">uiet_uid=#{user.id,jdbcType=BIGINT},</if> |
| | | <if test="relationId != null">uiet_relation_id=#{relationId,jdbcType=VARCHAR},</if> |
| | | <if test="relationUpdateTime != null">uiet_relation_update_time=#{relationUpdateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="specialId != null">uiet_special_id=#{specialId,jdbcType=VARCHAR},</if> |
| | | <if test="specialUpdateTime != null">uiet_special_update_time=#{specialUpdateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="createTime != null">uiet_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">uiet_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where uiet_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | 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.TaoBaoUnionAuthRecordMapper;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionAuthRecordService;
|
| | |
|
| | | @Service
|
| | | public class TaoBaoUnionAuthRecordServiceImpl implements TaoBaoUnionAuthRecordService {
|
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionAuthRecordMapper taoBaoUnionAuthRecordMapper;
|
| | |
|
| | | @Override
|
| | | public void addAuthRecord(TaoBaoUnionAuthRecord record) {
|
| | | record.setCreateTime(new Date());
|
| | | taoBaoUnionAuthRecordMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserExtraTaoBaoInfoMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
|
| | |
|
| | | @Service
|
| | | public class UserExtraTaoBaoInfoServiceImpl implements UserExtraTaoBaoInfoService {
|
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoMapper userExtraTaoBaoInfoMapper;
|
| | |
|
| | | @Override
|
| | | public void addRelationId(Long uid, String relationId) {
|
| | | if (uid == null || relationId == null)
|
| | | return;
|
| | | UserExtraTaoBaoInfo info = getByUid(uid);
|
| | | if (info == null) {
|
| | | info = new UserExtraTaoBaoInfo();
|
| | | info.setCreateTime(new Date());
|
| | | info.setRelationId(relationId);
|
| | | info.setRelationUpdateTime(new Date());
|
| | | userExtraTaoBaoInfoMapper.insertSelective(info);
|
| | | } else {
|
| | | UserExtraTaoBaoInfo update = new UserExtraTaoBaoInfo();
|
| | | update.setId(info.getId());
|
| | | update.setRelationId(relationId);
|
| | | update.setRelationUpdateTime(new Date());
|
| | | userExtraTaoBaoInfoMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addSpecialId(Long uid, String specialId) {
|
| | | if (uid == null || specialId == null)
|
| | | return;
|
| | | UserExtraTaoBaoInfo info = getByUid(uid);
|
| | | if (info == null) {
|
| | | info = new UserExtraTaoBaoInfo();
|
| | | info.setCreateTime(new Date());
|
| | | info.setSpecialId(specialId);
|
| | | info.setSpecialUpdateTime(new Date());
|
| | | userExtraTaoBaoInfoMapper.insertSelective(info);
|
| | | } else {
|
| | | UserExtraTaoBaoInfo update = new UserExtraTaoBaoInfo();
|
| | | update.setId(info.getId());
|
| | | update.setSpecialId(specialId);
|
| | | update.setSpecialUpdateTime(new Date());
|
| | | userExtraTaoBaoInfoMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserExtraTaoBaoInfo getByUid(Long uid) {
|
| | | return userExtraTaoBaoInfoMapper.selectByUid(uid);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.taobao;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord;
|
| | |
|
| | | public interface TaoBaoUnionAuthRecordService {
|
| | |
|
| | | /**
|
| | | * 添加授权记录
|
| | | * |
| | | * @param record
|
| | | */
|
| | | public void addAuthRecord(TaoBaoUnionAuthRecord record);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | |
|
| | | /**
|
| | | * 用户淘宝联盟服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface UserExtraTaoBaoInfoService {
|
| | |
|
| | | /**
|
| | | * 添加渠道ID
|
| | | * |
| | | * @param uid
|
| | | * @param relationId
|
| | | */
|
| | | public void addRelationId(Long uid, String relationId);
|
| | |
|
| | | /**
|
| | | * 添加会员ID
|
| | | * |
| | | * @param uid
|
| | | * @param specialId
|
| | | */
|
| | | public void addSpecialId(Long uid, String specialId);
|
| | |
|
| | | /**
|
| | | * 通过UID获取淘宝联盟渠道信息
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public UserExtraTaoBaoInfo getByUid(Long uid);
|
| | |
|
| | | }
|
| | |
| | | public static final String EXTRACT_MIN_MONEY = "extract_min_money";
|
| | | public static final String MYLIKE = "mylike";
|
| | | public static final String MYDYNAMIC = "mydynamic";
|
| | | |
| | | public static final String TAOBAO_AUTH_APPKEY="24980167";
|
| | | public static final String TAOBAO_AUTH_APPSECRET="e0a2e05deabf5ce039b52e5b492d5382";
|
| | | |
| | |
|
| | |
|
| | | // 来源-淘宝
|
| | |
| | |
|
| | | // result = get("http://118.178.179.189/taoke/", params, false);
|
| | | // if (StringUtil.isNullOrEmpty(result))
|
| | | String result = get("http://gw.api.taobao.com/router/rest", params, false);
|
| | | //https://eco.taobao.com/router/rest |
| | | //http://gw.api.taobao.com/router/rest
|
| | | String result = get("https://eco.taobao.com/router/rest", params, false);
|
| | | return result;
|
| | | }
|
| | |
|
| | |
| | | List<CommonMsgItemVO> items = new ArrayList<>();
|
| | |
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getOrderId(), "#000000"));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单号", "#888888"), contentList));
|
| | | contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单号", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("共", "#000000"));
|
| | | contentList.add(new ClientTextStyleVO(msg.getGoodsCount() + "", "#E5005C"));
|
| | | contentList.add(new ClientTextStyleVO("件商品", "#000000"));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("商品数量", "#888888"), contentList));
|
| | | contentList.add(new ClientTextStyleVO("共", COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(msg.getGoodsCount() + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("件商品", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("商品数量", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getType().getDesc(), "#000000"));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单类型", "#888888"), contentList));
|
| | | contentList.add(new ClientTextStyleVO(msg.getType().getDesc(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单类型", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | if (msg.getState() == MsgOrderDetail.STATE_FK)
|
| | | contentList.add(new ClientTextStyleVO("已付款", "#E5005C"));
|
| | | contentList.add(new ClientTextStyleVO("已付款", COLOR_HIGHLIGHT_CONTENT));
|
| | | else if (msg.getState() == MsgOrderDetail.STATE_JS)
|
| | | contentList.add(new ClientTextStyleVO("已收货", "#E5005C"));
|
| | | contentList.add(new ClientTextStyleVO("已收货", COLOR_HIGHLIGHT_CONTENT));
|
| | | else if (msg.getState() == MsgOrderDetail.STATE_SX)
|
| | | contentList.add(new ClientTextStyleVO("未付款/已退款", "#E5005C"));
|
| | | contentList.add(new ClientTextStyleVO("未付款/已退款", COLOR_HIGHLIGHT_CONTENT));
|
| | | else if (msg.getState() == MsgOrderDetail.STATE_WQ)
|
| | | contentList.add(new ClientTextStyleVO("已维权", "#E5005C"));
|
| | | contentList.add(new ClientTextStyleVO("已维权", COLOR_HIGHLIGHT_CONTENT));
|
| | |
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单状态", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单状态", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getPayMoney()), "#E5005C"));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("付款金额", "#888888"), contentList));
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getPayMoney()),
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("付款金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList
|
| | | .add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getHongBaoMoney()), "#E5005C"));
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getHongBaoMoney()),
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | |
|
| | | if (msg.getType() == MsgTypeOrderTypeEnum.fanli)
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利金额", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利金额", COLOR_TITLE), contentList));
|
| | | else if (msg.getType() == MsgTypeOrderTypeEnum.share)
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("分享奖金", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("分享奖金", COLOR_TITLE), contentList));
|
| | | else if (msg.getType() == MsgTypeOrderTypeEnum.invite)
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请奖金", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请奖金", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(
|
| | | new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(), "#000000"));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", "#888888"), contentList));
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_order.png", "订单消息",
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | }
|
| | |
| | | ba = UserUtil.filterBindingAccount(ba);
|
| | |
|
| | | contentList.add(new ClientTextStyleVO("支付宝:" + ba.getName() + " " + ba.getAccount(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现账号", COLOR_CONTENT), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现账号", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getExtract().getMoney()),
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现金额", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | if (msg.getExtract().getState() == Extract.STATE_NOT_PROCESS
|
| | |
| | | contentList.add(new ClientTextStyleVO("已通过", COLOR_HIGHLIGHT_CONTENT));
|
| | | else if (msg.getExtract().getState() == Extract.STATE_REJECT)
|
| | | contentList.add(new ClientTextStyleVO("提现被拒绝", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现状态", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现状态", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | if (msg.getExtract().getState() == Extract.STATE_NOT_PROCESS
|
| | |
| | | contentList.add(new ClientTextStyleVO("无", COLOR_CONTENT));
|
| | | else if (msg.getExtract().getState() == Extract.STATE_REJECT)
|
| | | contentList.add(new ClientTextStyleVO(msg.getExtract().getReason(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态说明", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态说明", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(
|
| | | TimeUtil.getGernalTime(msg.getExtract().getExtractTime()+1000*60*60*24L, "yyyy-MM-dd HH:mm"), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("预计到账", "#888888"), contentList));
|
| | | contentList.add(new ClientTextStyleVO(TimeUtil.getGernalTime(
|
| | | msg.getExtract().getExtractTime() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd HH:mm"), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("预计到账", COLOR_TITLE), contentList));
|
| | |
|
| | | if (msg.getExtract().getState() == Extract.STATE_PASS) {//
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(
|
| | | TimeUtil.getGernalTime(msg.getExtract().getReceiveTime().getTime(), "yyyy-MM-dd HH:mm"),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("实际到账", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("实际到账", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_extract.png", "提现",
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.extractValid) {
|
| | |
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getMoney()),
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现金额", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥验证成功", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("验证状态", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("验证状态", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getStateDesc(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态说明", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态说明", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", "#888888"), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_extract.png", "提现账号验证",
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | |
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getBalance()) + "",
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | date + msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | else
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png.png",
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite_money.png.png",
|
| | | date + msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | |
|
| | |
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_share_money.png", msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_share_money.png",
|
| | | msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
|
| | | items);
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.inviteWeiQuan) {
|
| | | contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请订单", COLOR_TITLE), contentList));
|
| | |
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png", msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite_money.png",
|
| | | msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
|
| | | items);
|
| | | }
|
| | |
|
| | | return null;
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoLinkService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoHttpUtil;
|
| | |
| | | }
|
| | | return parsePhoneTmAndTb(id);
|
| | | } catch (Exception e) {
|
| | | LogHelper.error("无法解析到淘宝商品ID:"+burl);
|
| | | LogHelper.error("无法解析到淘宝商品ID:" + burl);
|
| | | return null;
|
| | | }
|
| | |
|
| | |
| | | return taoBaoGoods;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取淘宝联盟的授权链接
|
| | | * |
| | | * @param appKey
|
| | | * -应用Key
|
| | | * @param callBackUrl
|
| | | * -回调链接
|
| | | * @param uid-用户ID
|
| | | * @return
|
| | | */
|
| | | public static String getTaoBaoUnionAuthUrl(String appKey, String callBackUrl, Long uid) {
|
| | | if (uid == null)
|
| | | return null;
|
| | | long timestamp = System.currentTimeMillis();
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("u", uid);
|
| | | json.put("t", timestamp);
|
| | | String url = null;
|
| | | try {
|
| | | url = String.format(
|
| | | "https://oauth.taobao.com/authorize?response_type=code&client_id=%s&redirect_uri=%s&state=%s&view=wap",
|
| | | appKey, callBackUrl,
|
| | | URLEncoder.encode(AESUtil.encrypt(json.toString(), Constant.UIDAESKEY), "UTF-8"));
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return url;
|
| | | }
|
| | |
|
| | | public static void main(String[] args) {
|
| | | String s = channelMap.get("3");
|
| | | System.out.println(s);
|
| | |
| | |
|
| | | }
|
| | |
|
| | | public static String getAccessToken(String code, String appKey, String appSecret) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.top.auth.token.create");
|
| | | map.put("code", code);
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(appKey);
|
| | | app.setAppSecret(appSecret);
|
| | | try {
|
| | | JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
|
| | | if (json != null)
|
| | | return json.toString();
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 渠道邀请码
|
| | | *
|
| | | * @param relationId
|
| | | * @return
|
| | | */
|
| | | public static String getInviteCode(Long relationId, String accessToken) {
|
| | | public static String getInviteCode(Long relationId, String accessToken, String appKey, String appSecret) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.sc.invitecode.get");
|
| | | map.put("session", accessToken);
|
| | | map.put("relation_id", relationId + "");
|
| | | map.put("code_type", "2");
|
| | | map.put("relation_app", "返利券");
|
| | | map.put("code_type", "1");
|
| | | map.put("relation_app", "common");
|
| | | JSONObject resultJSON = null;
|
| | | try {
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey("24567001");
|
| | | app.setAppSecret("e26a8d0f8726883d44bf04742829b533");
|
| | | app.setAdzoneId("123123");
|
| | | TaoKeAppInfo app = new TaoKeAppInfo(); |
| | | app.setAppKey(appKey);
|
| | | app.setAppSecret(appSecret); |
| | | resultJSON = TaoKeBaseUtil.baseRequest(map, app);
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | |
| | | return null;
|
| | |
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static String beiAnQuDao(Long relationId, String accessToken, String appKey, String appSecret) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.sc.publisher.info.save");
|
| | | map.put("session", accessToken);
|
| | | map.put("inviter_code", "A2QnGL");
|
| | | map.put("info_type", "1");
|
| | | JSONObject resultJSON = null;
|
| | | try {
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(appKey);
|
| | | app.setAppSecret(appSecret);
|
| | | resultJSON = TaoKeBaseUtil.baseRequest(map, app);
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (resultJSON == null)
|
| | | return null;
|
| | |
|
| | | return null;
|
| | | }
|
| | |
|
| | | private static TaoBaoGoodsBrief parseWuLiaoItemFromMaterialId(JSONObject item) {
|
| | |
| | | params.put("v", "2.0");
|
| | | params.put("timestamp", TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
|
| | | params.put("format", "json");
|
| | | params.put("adzone_id", app.getAdzoneId());
|
| | | if (!StringUtil.isNullOrEmpty(app.getAdzoneId()))
|
| | | params.put("adzone_id", app.getAdzoneId());
|
| | | params.put("sign", getSign(params, "md5", app).toUpperCase());
|
| | | String result = TaoBaoHttpUtil.taoKeGet(params);
|
| | | JSONObject data = JSONObject.fromObject(result);
|
| | |
| | |
|
| | |
|
| | | #外网正式
|
| | | druid.url=jdbc:mysql://172.16.16.17:3306/ec_quan
|
| | | druid.username=root
|
| | | druid.password=Yeshi2016@
|
| | |
|
| | | #外网本地测试
|
| | | #druid.url=jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ec_quan
|
| | | #druid.url=jdbc:mysql://172.16.16.17:3306/ec_quan
|
| | | #druid.username=root
|
| | | #druid.password=Yeshi2016@
|
| | |
|
| | | #外网本地测试
|
| | | druid.url=jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ec_quan_test
|
| | | druid.username=root
|
| | | druid.password=Yeshi2016@
|
| | |
|
| | | druid.initialSize=10
|
| | | druid.minIdle=6
|
| | | druid.maxActive=100
|
| | |
| | | import org.junit.Test;
|
| | | import org.yeshi.utils.mybatis.MyBatisMapperUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord;
|
| | |
|
| | | public class MyBatisProduce {
|
| | |
|
| | | @Test
|
| | | public void test3() {
|
| | | MyBatisMapperUtil.createMapper(UserShareGoodsRecord.class);
|
| | | MyBatisMapperUtil.createMapper(UserExtraTaoBaoInfo.class);
|
| | | MyBatisMapperUtil.createMapper(TaoBaoUnionAuthRecord.class);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import org.junit.Ignore;
|
| | | import org.junit.Test;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | |
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | //@Ignore
|
| | | @Ignore
|
| | | public class TaoKeTest {
|
| | |
|
| | | public static int count=0;
|
New file |
| | |
| | | package org.yeshi.utils.taobao;
|
| | |
|
| | | public class TaoBaoAuthUtil {
|
| | | |
| | | public static String getAcessToken(String code,String appKey,String appSecret)
|
| | | {
|
| | | //wCa9so9Yz7Ogh9es8zydEUPz4990482
|
| | | |
| | | return null;
|
| | | }
|
| | | |
| | |
|
| | | }
|