袁野 6 days ago
parent 73c2e669ce
commit d800fb2288
  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. 17
      service/src/main/java/com/hfkj/dao/BsUserMapper.java
  5. 17
      service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java
  6. 8
      service/src/main/java/com/hfkj/entity/BsUser.java
  7. 3
      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,7 +41,6 @@ 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, ",
<<<<<<< HEAD
"special_id, wechat_open_id, ", "special_id, wechat_open_id, ",
"wechat_unionid, elm_pid, ", "wechat_unionid, elm_pid, ",
"invite_user_id, invite_time, ", "invite_user_id, invite_time, ",
@ -57,8 +56,7 @@ public interface BsUserMapper extends BsUserMapperExt {
"#{partnerLevel,jdbcType=INTEGER}, #{partnerIncomePer,jdbcType=DECIMAL}, ", "#{partnerLevel,jdbcType=INTEGER}, #{partnerIncomePer,jdbcType=DECIMAL}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,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, ",
@ -73,7 +71,6 @@ public interface BsUserMapper extends BsUserMapperExt {
"#{partnerIncomePer,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}, ", "#{partnerIncomePer,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsUser record); int insert(BsUser record);
@ -90,10 +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),
<<<<<<< HEAD
@Result(column="special_id", property="specialId", jdbcType=JdbcType.VARCHAR), @Result(column="special_id", property="specialId", jdbcType=JdbcType.VARCHAR),
=======
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
@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),
@ -112,15 +106,12 @@ public interface BsUserMapper extends BsUserMapperExt {
@Select({ @Select({
"select", "select",
<<<<<<< HEAD
"id, head_img, `name`, phone, grade, wechat_num, special_id, wechat_open_id, ", "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, ", "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", "`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",
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
"from bs_user", "from bs_user",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@ -131,10 +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),
<<<<<<< HEAD
@Result(column="special_id", property="specialId", jdbcType=JdbcType.VARCHAR), @Result(column="special_id", property="specialId", jdbcType=JdbcType.VARCHAR),
=======
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
@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),
@ -167,10 +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},",
<<<<<<< HEAD
"special_id = #{specialId,jdbcType=VARCHAR},", "special_id = #{specialId,jdbcType=VARCHAR},",
=======
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
"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,13 +48,10 @@ public class BsUserSqlProvider {
sql.VALUES("wechat_num", "#{wechatNum,jdbcType=VARCHAR}"); sql.VALUES("wechat_num", "#{wechatNum,jdbcType=VARCHAR}");
} }
<<<<<<< HEAD
if (record.getSpecialId() != null) { if (record.getSpecialId() != null) {
sql.VALUES("special_id", "#{specialId,jdbcType=VARCHAR}"); sql.VALUES("special_id", "#{specialId,jdbcType=VARCHAR}");
} }
=======
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
if (record.getWechatOpenId() != null) { if (record.getWechatOpenId() != null) {
sql.VALUES("wechat_open_id", "#{wechatOpenId,jdbcType=VARCHAR}"); sql.VALUES("wechat_open_id", "#{wechatOpenId,jdbcType=VARCHAR}");
} }
@ -122,10 +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");
<<<<<<< HEAD
sql.SELECT("special_id"); sql.SELECT("special_id");
=======
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
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");
@ -179,14 +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}");
} }
<<<<<<< HEAD
if (record.getSpecialId() != null) { if (record.getSpecialId() != null) {
sql.SET("special_id = #{record.specialId,jdbcType=VARCHAR}"); sql.SET("special_id = #{record.specialId,jdbcType=VARCHAR}");
} }
=======
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
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}");
} }
@ -253,10 +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}");
<<<<<<< HEAD
sql.SET("special_id = #{record.specialId,jdbcType=VARCHAR}"); sql.SET("special_id = #{record.specialId,jdbcType=VARCHAR}");
=======
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
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}");
@ -300,13 +286,10 @@ public class BsUserSqlProvider {
sql.SET("wechat_num = #{wechatNum,jdbcType=VARCHAR}"); sql.SET("wechat_num = #{wechatNum,jdbcType=VARCHAR}");
} }
<<<<<<< HEAD
if (record.getSpecialId() != null) { if (record.getSpecialId() != null) {
sql.SET("special_id = #{specialId,jdbcType=VARCHAR}"); sql.SET("special_id = #{specialId,jdbcType=VARCHAR}");
} }
=======
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
if (record.getWechatOpenId() != null) { if (record.getWechatOpenId() != null) {
sql.SET("wechat_open_id = #{wechatOpenId,jdbcType=VARCHAR}"); sql.SET("wechat_open_id = #{wechatOpenId,jdbcType=VARCHAR}");
} }

@ -158,7 +158,6 @@ public class BsUser implements Serializable {
this.wechatNum = wechatNum; this.wechatNum = wechatNum;
} }
<<<<<<< HEAD
public String getSpecialId() { public String getSpecialId() {
return specialId; return specialId;
} }
@ -167,8 +166,6 @@ public class BsUser implements Serializable {
this.specialId = specialId; this.specialId = specialId;
} }
=======
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
public String getWechatOpenId() { public String getWechatOpenId() {
return wechatOpenId; return wechatOpenId;
} }
@ -272,8 +269,7 @@ public class BsUser implements Serializable {
public void setExt3(String ext3) { public void setExt3(String ext3) {
this.ext3 = ext3; this.ext3 = ext3;
} }
<<<<<<< HEAD
=======
@Override @Override
public boolean equals(Object that) { public boolean equals(Object that) {
@ -363,5 +359,5 @@ public class BsUser implements Serializable {
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
} }

@ -526,7 +526,6 @@ public class BsUserExample {
return (Criteria) this; return (Criteria) this;
} }
<<<<<<< HEAD
public Criteria andSpecialIdIsNull() { public Criteria andSpecialIdIsNull() {
addCriterion("special_id is null"); addCriterion("special_id is null");
return (Criteria) this; return (Criteria) this;
@ -597,8 +596,6 @@ public class BsUserExample {
return (Criteria) this; return (Criteria) this;
} }
=======
>>>>>>> 9fd569d446b9f1a74c4b28147a3572ee8a076825
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