胡锐 6 days ago
commit beb98e38b8
  1. 27
      cweb/src/main/java/com/hfkj/controller/GoodsController.java
  2. 21
      cweb/src/main/java/com/hfkj/controller/TestController.java
  3. 35
      cweb/src/main/java/com/hfkj/controller/notify/TaoBaoNotify.java
  4. 22
      service/src/main/java/com/hfkj/dao/BsUserMapper.java
  5. 14
      service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java
  6. 18
      service/src/main/java/com/hfkj/entity/BsUser.java
  7. 70
      service/src/main/java/com/hfkj/entity/BsUserExample.java

@ -7,11 +7,13 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter; import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrder; import com.hfkj.entity.BsOrder;
import com.hfkj.entity.BsUser;
import com.hfkj.model.*; import com.hfkj.model.*;
import com.hfkj.service.goods.GoodsDataService; import com.hfkj.service.goods.GoodsDataService;
import com.hfkj.service.order.BsOrderService; import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.pdd.PddService; import com.hfkj.service.pdd.PddService;
import com.hfkj.service.taobao.TaoBaoService; import com.hfkj.service.taobao.TaoBaoService;
import com.hfkj.service.user.BsUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -37,6 +39,8 @@ public class GoodsController {
private GoodsDataService goodsDataService; private GoodsDataService goodsDataService;
@Autowired @Autowired
private UserCenter userCenter; private UserCenter userCenter;
@Resource
private BsUserService bsUserService;
@ -147,12 +151,25 @@ public class GoodsController {
@RequestMapping(value="/publisher",method = RequestMethod.GET) @RequestMapping(value="/publisher",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "淘宝客-公用-私域用户备案") @ApiOperation(value = "淘宝客-公用-私域用户备案")
public ResponseData publisher(@RequestParam(value = "token" , required = false) String token public ResponseData publisher(@RequestParam(value = "code" , required = false) String code
) { ) {
try { try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
JSONObject tokenJson = TaoBaoService.getToken(code);
String token = tokenJson.getString("token_result");
JSONObject tokenResult = JSONObject.parseObject(token);
JSONObject jsonObject = TaoBaoService.publisher(tokenResult.getString("access_token"));
String body = jsonObject.getString("body");
JSONObject result = JSONObject.parseObject(body);
BsUser user = bsUserService.getUser(userSession.getUser().getId());
user.setSpecialId(result.getJSONObject("data").getString("relation_id"));
bsUserService.updateInfo(user);
JSONObject jsonObject = TaoBaoService.publisher(token); return ResponseMsgUtil.success("绑定成功");
return ResponseMsgUtil.success(jsonObject);
} catch (Exception e) { } catch (Exception e) {
log.error("error!",e); log.error("error!",e);
@ -168,7 +185,9 @@ public class GoodsController {
try { try {
JSONObject jsonObject = TaoBaoService.getToken(code); JSONObject jsonObject = TaoBaoService.getToken(code);
return ResponseMsgUtil.success(jsonObject); String token = jsonObject.getString("token_result");
JSONObject tokenResult = JSONObject.parseObject(token);
return ResponseMsgUtil.success(tokenResult);
} catch (Exception e) { } catch (Exception e) {
log.error("error!",e); log.error("error!",e);

@ -5,6 +5,7 @@ import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
@ -157,6 +158,7 @@ public class TestController {
otherParam.put("sourceOrderNo", System.currentTimeMillis()); otherParam.put("sourceOrderNo", System.currentTimeMillis());
userContributeService.purchase(rebate, userId, otherParam); userContributeService.purchase(rebate, userId, otherParam);
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");
} catch (Exception e) { } catch (Exception e) {
@ -165,6 +167,25 @@ public class TestController {
} }
} }
@RequestMapping(value="/authorize",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取淘宝code")
public ResponseData authorize() {
try {
JSONObject object = HttpsUtils.doGet("https://oauth.taobao.com/authorize?response_type=code&client_id=34807616&redirect_uri=https://yuanqiyoutao.com/crest/taoBaoNotify/notify&state=1212&view=wap");
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -1,16 +1,15 @@
package com.hfkj.controller.notify; package com.hfkj.controller.notify;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.config.CommonSysConst;
import com.hfkj.service.taobao.TaoBaoService; import com.hfkj.service.taobao.TaoBaoService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -20,29 +19,29 @@ import java.io.PrintWriter;
@Api(value = "淘宝业务通知") @Api(value = "淘宝业务通知")
public class TaoBaoNotify { public class TaoBaoNotify {
private static Logger log = LoggerFactory.getLogger(TaoBaoService.class); private static Logger log = LoggerFactory.getLogger(TaoBaoNotify.class);
@RequestMapping(value = "/notify", method = RequestMethod.POST) @RequestMapping(value = "/notify", method = RequestMethod.GET)
@ApiOperation(value = "回调") @ApiOperation(value = "回调")
@ResponseBody @ResponseBody
public void notify(@RequestBody String reqBodyStr, HttpServletResponse response) { public void notify(@RequestParam("code") String code) {
try { try {
JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class); System.out.println("============token回调任务Start=============");
System.out.println("============token回调任务code=============" + code);
JSONObject object = new JSONObject();
object.put("code", code);
// JSONObject jsonObject = TaoBaoService.getToken(code);
// if (jsonObject.getBoolean("success")) {
// String token = jsonObject.getString("token_result");
// JSONObject tokenResult = JSONObject.parseObject(token);
// System.out.println("============token回调任务jsonObject=============" + tokenResult);
// }
log.info("============淘宝回调任务Start=============");
log.info("淘宝-回调参数: " + dataObject);
log.info("============淘宝回调任务End=============");
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter writer= response.getWriter();
writer.write("SUCCESS");
} catch (Exception e) { } catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e); log.error("TaoBaoNotify --> notify() error!", e);
} }
} }
} }

@ -41,6 +41,22 @@ public interface BsUserMapper extends BsUserMapperExt {
@Insert({ @Insert({
"insert into bs_user (head_img, `name`, ", "insert into bs_user (head_img, `name`, ",
"phone, grade, wechat_num, ", "phone, grade, wechat_num, ",
"special_id, wechat_open_id, ",
"wechat_unionid, elm_pid, ",
"invite_user_id, invite_time, ",
"partner_level, partner_income_per, ",
"`status`, create_time, ",
"update_time, ext_1, ",
"ext_2, ext_3)",
"values (#{headImg,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ",
"#{phone,jdbcType=VARCHAR}, #{grade,jdbcType=INTEGER}, #{wechatNum,jdbcType=VARCHAR}, ",
"#{specialId,jdbcType=VARCHAR}, #{wechatOpenId,jdbcType=VARCHAR}, ",
"#{wechatUnionid,jdbcType=VARCHAR}, #{elmPid,jdbcType=VARCHAR}, ",
"#{inviteUserId,jdbcType=BIGINT}, #{inviteTime,jdbcType=TIMESTAMP}, ",
"#{partnerLevel,jdbcType=INTEGER}, #{partnerIncomePer,jdbcType=DECIMAL}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})",
"wechat_open_id, wechat_unionid, ", "wechat_open_id, wechat_unionid, ",
"elm_pid, invite_user_id, ", "elm_pid, invite_user_id, ",
"invite_time, partner_level, ", "invite_time, partner_level, ",
@ -71,6 +87,7 @@ public interface BsUserMapper extends BsUserMapperExt {
@Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR),
@Result(column="grade", property="grade", jdbcType=JdbcType.INTEGER), @Result(column="grade", property="grade", jdbcType=JdbcType.INTEGER),
@Result(column="wechat_num", property="wechatNum", jdbcType=JdbcType.VARCHAR), @Result(column="wechat_num", property="wechatNum", jdbcType=JdbcType.VARCHAR),
@Result(column="special_id", property="specialId", jdbcType=JdbcType.VARCHAR),
@Result(column="wechat_open_id", property="wechatOpenId", jdbcType=JdbcType.VARCHAR), @Result(column="wechat_open_id", property="wechatOpenId", jdbcType=JdbcType.VARCHAR),
@Result(column="wechat_unionid", property="wechatUnionid", jdbcType=JdbcType.VARCHAR), @Result(column="wechat_unionid", property="wechatUnionid", jdbcType=JdbcType.VARCHAR),
@Result(column="elm_pid", property="elmPid", jdbcType=JdbcType.VARCHAR), @Result(column="elm_pid", property="elmPid", jdbcType=JdbcType.VARCHAR),
@ -89,6 +106,9 @@ public interface BsUserMapper extends BsUserMapperExt {
@Select({ @Select({
"select", "select",
"id, head_img, `name`, phone, grade, wechat_num, special_id, wechat_open_id, ",
"wechat_unionid, elm_pid, invite_user_id, invite_time, partner_level, partner_income_per, ",
"`status`, create_time, update_time, ext_1, ext_2, ext_3",
"id, head_img, `name`, phone, grade, wechat_num, wechat_open_id, wechat_unionid, ", "id, head_img, `name`, phone, grade, wechat_num, wechat_open_id, wechat_unionid, ",
"elm_pid, invite_user_id, invite_time, partner_level, partner_income_per, `status`, ", "elm_pid, invite_user_id, invite_time, partner_level, partner_income_per, `status`, ",
"create_time, update_time, ext_1, ext_2, ext_3", "create_time, update_time, ext_1, ext_2, ext_3",
@ -102,6 +122,7 @@ public interface BsUserMapper extends BsUserMapperExt {
@Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR),
@Result(column="grade", property="grade", jdbcType=JdbcType.INTEGER), @Result(column="grade", property="grade", jdbcType=JdbcType.INTEGER),
@Result(column="wechat_num", property="wechatNum", jdbcType=JdbcType.VARCHAR), @Result(column="wechat_num", property="wechatNum", jdbcType=JdbcType.VARCHAR),
@Result(column="special_id", property="specialId", jdbcType=JdbcType.VARCHAR),
@Result(column="wechat_open_id", property="wechatOpenId", jdbcType=JdbcType.VARCHAR), @Result(column="wechat_open_id", property="wechatOpenId", jdbcType=JdbcType.VARCHAR),
@Result(column="wechat_unionid", property="wechatUnionid", jdbcType=JdbcType.VARCHAR), @Result(column="wechat_unionid", property="wechatUnionid", jdbcType=JdbcType.VARCHAR),
@Result(column="elm_pid", property="elmPid", jdbcType=JdbcType.VARCHAR), @Result(column="elm_pid", property="elmPid", jdbcType=JdbcType.VARCHAR),
@ -134,6 +155,7 @@ public interface BsUserMapper extends BsUserMapperExt {
"phone = #{phone,jdbcType=VARCHAR},", "phone = #{phone,jdbcType=VARCHAR},",
"grade = #{grade,jdbcType=INTEGER},", "grade = #{grade,jdbcType=INTEGER},",
"wechat_num = #{wechatNum,jdbcType=VARCHAR},", "wechat_num = #{wechatNum,jdbcType=VARCHAR},",
"special_id = #{specialId,jdbcType=VARCHAR},",
"wechat_open_id = #{wechatOpenId,jdbcType=VARCHAR},", "wechat_open_id = #{wechatOpenId,jdbcType=VARCHAR},",
"wechat_unionid = #{wechatUnionid,jdbcType=VARCHAR},", "wechat_unionid = #{wechatUnionid,jdbcType=VARCHAR},",
"elm_pid = #{elmPid,jdbcType=VARCHAR},", "elm_pid = #{elmPid,jdbcType=VARCHAR},",

@ -48,6 +48,10 @@ public class BsUserSqlProvider {
sql.VALUES("wechat_num", "#{wechatNum,jdbcType=VARCHAR}"); sql.VALUES("wechat_num", "#{wechatNum,jdbcType=VARCHAR}");
} }
if (record.getSpecialId() != null) {
sql.VALUES("special_id", "#{specialId,jdbcType=VARCHAR}");
}
if (record.getWechatOpenId() != null) { if (record.getWechatOpenId() != null) {
sql.VALUES("wechat_open_id", "#{wechatOpenId,jdbcType=VARCHAR}"); sql.VALUES("wechat_open_id", "#{wechatOpenId,jdbcType=VARCHAR}");
} }
@ -115,6 +119,7 @@ public class BsUserSqlProvider {
sql.SELECT("phone"); sql.SELECT("phone");
sql.SELECT("grade"); sql.SELECT("grade");
sql.SELECT("wechat_num"); sql.SELECT("wechat_num");
sql.SELECT("special_id");
sql.SELECT("wechat_open_id"); sql.SELECT("wechat_open_id");
sql.SELECT("wechat_unionid"); sql.SELECT("wechat_unionid");
sql.SELECT("elm_pid"); sql.SELECT("elm_pid");
@ -168,7 +173,9 @@ public class BsUserSqlProvider {
if (record.getWechatNum() != null) { if (record.getWechatNum() != null) {
sql.SET("wechat_num = #{record.wechatNum,jdbcType=VARCHAR}"); sql.SET("wechat_num = #{record.wechatNum,jdbcType=VARCHAR}");
} }
if (record.getSpecialId() != null) {
sql.SET("special_id = #{record.specialId,jdbcType=VARCHAR}");
}
if (record.getWechatOpenId() != null) { if (record.getWechatOpenId() != null) {
sql.SET("wechat_open_id = #{record.wechatOpenId,jdbcType=VARCHAR}"); sql.SET("wechat_open_id = #{record.wechatOpenId,jdbcType=VARCHAR}");
} }
@ -235,6 +242,7 @@ public class BsUserSqlProvider {
sql.SET("phone = #{record.phone,jdbcType=VARCHAR}"); sql.SET("phone = #{record.phone,jdbcType=VARCHAR}");
sql.SET("grade = #{record.grade,jdbcType=INTEGER}"); sql.SET("grade = #{record.grade,jdbcType=INTEGER}");
sql.SET("wechat_num = #{record.wechatNum,jdbcType=VARCHAR}"); sql.SET("wechat_num = #{record.wechatNum,jdbcType=VARCHAR}");
sql.SET("special_id = #{record.specialId,jdbcType=VARCHAR}");
sql.SET("wechat_open_id = #{record.wechatOpenId,jdbcType=VARCHAR}"); sql.SET("wechat_open_id = #{record.wechatOpenId,jdbcType=VARCHAR}");
sql.SET("wechat_unionid = #{record.wechatUnionid,jdbcType=VARCHAR}"); sql.SET("wechat_unionid = #{record.wechatUnionid,jdbcType=VARCHAR}");
sql.SET("elm_pid = #{record.elmPid,jdbcType=VARCHAR}"); sql.SET("elm_pid = #{record.elmPid,jdbcType=VARCHAR}");
@ -278,6 +286,10 @@ public class BsUserSqlProvider {
sql.SET("wechat_num = #{wechatNum,jdbcType=VARCHAR}"); sql.SET("wechat_num = #{wechatNum,jdbcType=VARCHAR}");
} }
if (record.getSpecialId() != null) {
sql.SET("special_id = #{specialId,jdbcType=VARCHAR}");
}
if (record.getWechatOpenId() != null) { if (record.getWechatOpenId() != null) {
sql.SET("wechat_open_id = #{wechatOpenId,jdbcType=VARCHAR}"); sql.SET("wechat_open_id = #{wechatOpenId,jdbcType=VARCHAR}");
} }

@ -45,6 +45,14 @@ public class BsUser implements Serializable {
private String wechatNum; private String wechatNum;
/** /**
<<<<<<< HEAD
* 淘宝会员独有
*/
private String specialId;
/**
=======
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
* 微信openid * 微信openid
*/ */
private String wechatOpenId; private String wechatOpenId;
@ -150,6 +158,14 @@ public class BsUser implements Serializable {
this.wechatNum = wechatNum; this.wechatNum = wechatNum;
} }
public String getSpecialId() {
return specialId;
}
public void setSpecialId(String specialId) {
this.specialId = specialId;
}
public String getWechatOpenId() { public String getWechatOpenId() {
return wechatOpenId; return wechatOpenId;
} }
@ -254,6 +270,7 @@ public class BsUser implements Serializable {
this.ext3 = ext3; this.ext3 = ext3;
} }
@Override @Override
public boolean equals(Object that) { public boolean equals(Object that) {
if (this == that) { if (this == that) {
@ -342,4 +359,5 @@ public class BsUser implements Serializable {
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
} }

@ -526,6 +526,76 @@ public class BsUserExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andSpecialIdIsNull() {
addCriterion("special_id is null");
return (Criteria) this;
}
public Criteria andSpecialIdIsNotNull() {
addCriterion("special_id is not null");
return (Criteria) this;
}
public Criteria andSpecialIdEqualTo(String value) {
addCriterion("special_id =", value, "specialId");
return (Criteria) this;
}
public Criteria andSpecialIdNotEqualTo(String value) {
addCriterion("special_id <>", value, "specialId");
return (Criteria) this;
}
public Criteria andSpecialIdGreaterThan(String value) {
addCriterion("special_id >", value, "specialId");
return (Criteria) this;
}
public Criteria andSpecialIdGreaterThanOrEqualTo(String value) {
addCriterion("special_id >=", value, "specialId");
return (Criteria) this;
}
public Criteria andSpecialIdLessThan(String value) {
addCriterion("special_id <", value, "specialId");
return (Criteria) this;
}
public Criteria andSpecialIdLessThanOrEqualTo(String value) {
addCriterion("special_id <=", value, "specialId");
return (Criteria) this;
}
public Criteria andSpecialIdLike(String value) {
addCriterion("special_id like", value, "specialId");
return (Criteria) this;
}
public Criteria andSpecialIdNotLike(String value) {
addCriterion("special_id not like", value, "specialId");
return (Criteria) this;
}
public Criteria andSpecialIdIn(List<String> values) {
addCriterion("special_id in", values, "specialId");
return (Criteria) this;
}
public Criteria andSpecialIdNotIn(List<String> values) {
addCriterion("special_id not in", values, "specialId");
return (Criteria) this;
}
public Criteria andSpecialIdBetween(String value1, String value2) {
addCriterion("special_id between", value1, value2, "specialId");
return (Criteria) this;
}
public Criteria andSpecialIdNotBetween(String value1, String value2) {
addCriterion("special_id not between", value1, value2, "specialId");
return (Criteria) this;
}
public Criteria andWechatOpenIdIsNull() { public Criteria andWechatOpenIdIsNull() {
addCriterion("wechat_open_id is null"); addCriterion("wechat_open_id is null");
return (Criteria) this; return (Criteria) this;

Loading…
Cancel
Save