袁野 1 month ago
commit cd6afe3404
  1. BIN
      bweb/lib/pop-sdk-1.18.23-all.jar
  2. BIN
      bweb/lib/taobao-sdk-java-elm.jar
  3. BIN
      bweb/lib/taobao-sdk.jar
  4. 29
      bweb/pom.xml
  5. 1
      bweb/src/main/java/com/hfkj/config/AuthConfig.java
  6. 80
      bweb/src/main/java/com/hfkj/controller/BsUserAuthController.java
  7. 138
      bweb/src/main/java/com/hfkj/controller/BsUserController.java
  8. BIN
      cweb/lib/taobao-sdk.jar
  9. 22
      cweb/src/main/java/com/hfkj/controller/ClientController.java
  10. 23
      cweb/src/main/java/com/hfkj/controller/ElmController.java
  11. 103
      cweb/src/main/java/com/hfkj/controller/GoodsController.java
  12. 2
      cweb/src/main/java/com/hfkj/controller/SmsController.java
  13. 48
      cweb/src/main/java/com/hfkj/controller/TakeOutController.java
  14. 37
      cweb/src/main/java/com/hfkj/controller/TestController.java
  15. 118
      cweb/src/main/java/com/hfkj/controller/UserAuthController.java
  16. 76
      cweb/src/main/java/com/hfkj/controller/UserController.java
  17. 69
      cweb/src/main/java/com/hfkj/controller/order/BsOrderController.java
  18. 1
      cweb/src/main/java/com/hfkj/controller/promotion/PromotionController.java
  19. BIN
      schedule/lib/pop-sdk-1.18.23-all.jar
  20. BIN
      schedule/lib/taobao-sdk-java-elm.jar
  21. BIN
      schedule/lib/taobao-sdk.jar
  22. 28
      schedule/pom.xml
  23. 43
      schedule/src/main/java/com/hfkj/schedule/LotterySchedule.java
  24. 86
      schedule/src/main/java/com/hfkj/schedule/OrderSchedule.java
  25. BIN
      service/lib/taobao-sdk.jar
  26. 6
      service/pom.xml
  27. 2
      service/src/main/java/com/hfkj/common/QRCodeGenerator.java
  28. 16
      service/src/main/java/com/hfkj/common/alipay/AlipayUtils.java
  29. 141
      service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeMapper.java
  30. 7
      service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeMapperExt.java
  31. 388
      service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeSqlProvider.java
  32. 2
      service/src/main/java/com/hfkj/entity/BsCornucopiaConfig.java
  33. 2
      service/src/main/java/com/hfkj/entity/BsOrder.java
  34. 296
      service/src/main/java/com/hfkj/entity/BsUserPlatformAuthorize.java
  35. 1273
      service/src/main/java/com/hfkj/entity/BsUserPlatformAuthorizeExample.java
  36. 4
      service/src/main/java/com/hfkj/model/GoodsModel.java
  37. 2
      service/src/main/java/com/hfkj/model/PublishInfoModel.java
  38. 49
      service/src/main/java/com/hfkj/platform/alipay/AlipayUtils.java
  39. 26
      service/src/main/java/com/hfkj/platform/aliyun/config/AliyunConfig.java
  40. 44
      service/src/main/java/com/hfkj/service/cornucopia/Impl/BsCornucopiaPoolServiceImpl.java
  41. 58
      service/src/main/java/com/hfkj/service/elm/ElmService.java
  42. 2
      service/src/main/java/com/hfkj/service/goods/impl/GoodsDataServiceImpl.java
  43. 13
      service/src/main/java/com/hfkj/service/meituan/MeiTuanService.java
  44. 8
      service/src/main/java/com/hfkj/service/order/BsOrderService.java
  45. 551
      service/src/main/java/com/hfkj/service/order/Impl/BsOrderServiceImpl.java
  46. 4
      service/src/main/java/com/hfkj/service/pdd/PddService.java
  47. 2
      service/src/main/java/com/hfkj/service/promotion/PromotionBusinessService.java
  48. 131
      service/src/main/java/com/hfkj/service/taobao/TaoBaoService.java
  49. 35
      service/src/main/java/com/hfkj/service/user/BsUserPlatformAuthorizeService.java
  50. 162
      service/src/main/java/com/hfkj/service/user/impl/BsUserContributeServiceImpl.java
  51. 56
      service/src/main/java/com/hfkj/service/user/impl/BsUserGradeServiceImpl.java
  52. 2
      service/src/main/java/com/hfkj/service/user/impl/BsUserInviteCodeServiceImpl.java
  53. 54
      service/src/main/java/com/hfkj/service/user/impl/BsUserPlatformAuthorizeServiceImpl.java
  54. 41
      service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java
  55. 44
      service/src/main/java/com/hfkj/sysenum/user/UserAuthorizePlatformEnum.java

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -18,6 +18,27 @@
<artifactId>service</artifactId>
<version>PACKT-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>taobao.skd</groupId>
<artifactId>taobao-open-sdk</artifactId>
<scope>system</scope>
<version>1.0.1</version>
<systemPath>${basedir}/lib/taobao-sdk.jar</systemPath>
</dependency>
<dependency>
<groupId>taobao-elm.skd</groupId>
<artifactId>taobao-open-elm-sdk</artifactId>
<scope>system</scope>
<version>1.0.1</version>
<systemPath>${basedir}/lib/taobao-sdk-java-elm.jar</systemPath>
</dependency>
<dependency>
<groupId>pop.skd</groupId>
<artifactId>pop-open-sdk</artifactId>
<scope>system</scope>
<version>1.0.1</version>
<systemPath>${basedir}/lib/pop-sdk-1.18.23-all.jar</systemPath>
</dependency>
</dependencies>
<build>
@ -26,7 +47,15 @@
<directory>src/main/resources/${env}</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>${basedir}/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

@ -91,6 +91,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/cornucopia/*")
.excludePathPatterns("/partner/*")
.excludePathPatterns("/userCount/*")
.excludePathPatterns("/userAuth/*")
;
}

@ -0,0 +1,80 @@
package com.hfkj.controller;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
import com.alipay.api.request.AlipayUserInfoShareRequest;
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
import com.alipay.api.response.AlipayUserInfoShareResponse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.alipay.AlipayUtils;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsUser;
import com.hfkj.entity.BsUserParentRel;
import com.hfkj.model.ResponseData;
import com.hfkj.service.user.BsUserGradeService;
import com.hfkj.service.user.BsUserParentRelService;
import com.hfkj.service.user.BsUserPlatformAuthorizeService;
import com.hfkj.service.user.BsUserService;
import com.hfkj.sysenum.user.UserGradeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*;
/**
* @className: CmsController
* @author: HuRui
* @date: 2024/9/24
**/
@Controller
@RequestMapping(value = "/userAuth")
@Api(value = "用户管理")
public class BsUserAuthController {
private static Logger log = LoggerFactory.getLogger(BsUserAuthController.class);
@Resource
private BsUserService userService;
@Resource
private BsUserGradeService userGradeService;
@Resource
private BsUserParentRelService userParentRelService;
@Resource
private BsUserPlatformAuthorizeService userPlatformAuthorizeService;
@RequestMapping(value="/alipay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "支付宝授权")
public ResponseData alipay(@RequestBody JSONObject body) {
try {
if (body == null || StringUtils.isBlank(body.getString("code"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest();
request.setGrantType("authorization_code");
request.setCode(body.getString("code"));
AlipaySystemOauthTokenResponse response = AlipayUtils.initClient().execute(request);
if(response.isSuccess()) {
AlipayUserInfoShareRequest alipayUserInfoShareRequest = new AlipayUserInfoShareRequest();
AlipayUserInfoShareResponse alipayUserInfoShareResponse = AlipayUtils.initClient().execute(alipayUserInfoShareRequest,response.getAccessToken());
if(alipayUserInfoShareResponse.isSuccess()){
return ResponseMsgUtil.success(alipayUserInfoShareResponse);
}
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取失败");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}

@ -10,21 +10,20 @@ import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsUser;
import com.hfkj.entity.BsUserParentRel;
import com.hfkj.model.ResponseData;
import com.hfkj.service.user.BsUserGradeService;
import com.hfkj.service.user.BsUserParentRelService;
import com.hfkj.service.user.BsUserService;
import com.hfkj.service.user.*;
import com.hfkj.sysenum.user.UserAccountRecordSourceTypeEnum;
import com.hfkj.sysenum.user.UserGradeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.math.BigDecimal;
import java.util.*;
/**
* @className: CmsController
@ -42,6 +41,10 @@ public class BsUserController {
private BsUserGradeService userGradeService;
@Resource
private BsUserParentRelService userParentRelService;
@Resource
private BsUserAccountService userAccountService;
@Resource
private BsUserPlatformAuthorizeService userPlatformAuthorizeService;
@RequestMapping(value="/gradeAdjust",method = RequestMethod.POST)
@ResponseBody
@ -110,17 +113,132 @@ public class BsUserController {
Map<String,Object> param = new HashMap<>();
param.put("user", user);
// 授权
param.put("platform_authorize", new ArrayList<>());
param.put("platformAuthorize", userPlatformAuthorizeService.getUserAuth(userId));
// 邀请人
param.put("inviteUser", user.getInviteUserId()!=null?userService.getUser(user.getInviteUserId()):null);
// 账户
param.put("account", userAccountService.getAccount(userId));
// 贡献关系
Map<String,Object> contribute = new HashMap<>();
param.put("contribute", contribute);
List<BsUser> contribute = new LinkedList<>();
if (user.getInviteUserId() != null) {
// 查询用户上级
BsUserParentRel parent = userParentRelService.getDetailByUserId(userId);
BsUserParentRel parentRel = userParentRelService.getDetailByUserId(userId);
if (parentRel != null && parentRel.getParentUserId() != null) {
if (UserGradeEnum.grade4.getCode().equals(parentRel.getParentUserGrade())) {
contribute.add(userService.getUser(parentRel.getParentUserId()));
if (!UserGradeEnum.grade4.getCode().equals(user.getGrade())) {
// 递归判断找到渠道
BsUserParentRel channel = userParentRelService.getParent(Arrays.asList(UserGradeEnum.grade4), parentRel.getParentUserId());
if (channel != null) {
contribute.add(userService.getUser(channel.getParentUserId()));
}
}
} else if (UserGradeEnum.grade3.getCode().equals(parentRel.getParentUserGrade())) {
contribute.add(userService.getUser(parentRel.getParentUserId()));
if (UserGradeEnum.grade1.getCode().equals(user.getGrade()) || UserGradeEnum.grade2.getCode().equals(user.getGrade())) {
// 递归判断找到团长或渠道
BsUserParentRel userParentRel = userParentRelService.getParent(
Arrays.asList(UserGradeEnum.grade4, UserGradeEnum.grade3),
parentRel.getParentUserId()
);
// 团长或渠道
if (userParentRel != null) {
if (UserGradeEnum.grade3.getCode().equals(userParentRel.getParentUserGrade())) {
contribute.add(userService.getUser(userParentRel.getUserId()));
// 递归判断找到渠道
userParentRel = userParentRelService.getParent(Arrays.asList(UserGradeEnum.grade4), parentRel.getParentUserId());
if (userParentRel != null) {
contribute.add(userService.getUser(userParentRel.getParentUserId()));
}
} else if (UserGradeEnum.grade4.getCode().equals(userParentRel.getParentUserGrade())) {
contribute.add(userService.getUser(userParentRel.getParentUserId()));
// 递归判断找到渠道
BsUserParentRel channel = userParentRelService.getParent(Arrays.asList(UserGradeEnum.grade4), userParentRel.getParentUserId());
if (channel != null) {
contribute.add(userService.getUser(channel.getParentUserId()));
}
}
}
} else if (UserGradeEnum.grade3.getCode().equals(user.getGrade())) {
// 递归判断找到渠道
BsUserParentRel userParentRel = userParentRelService.getParent(Arrays.asList(UserGradeEnum.grade4),parentRel.getParentUserId());
if (userParentRel != null) {
contribute.add(userService.getUser(userParentRel.getUserId()));
// 递归判断找到渠道
BsUserParentRel channel = userParentRelService.getParent(Arrays.asList(UserGradeEnum.grade4), userParentRel.getParentUserId());
if (channel != null) {
contribute.add(userService.getUser(channel.getParentUserId()));
}
}
}
} else if (UserGradeEnum.grade2.getCode().equals(parentRel.getParentUserGrade())) {
contribute.add(userService.getUser(parentRel.getParentUserId()));
// 递归判断找到团长或渠道
BsUserParentRel userParentRel = userParentRelService.getParent(
Arrays.asList(UserGradeEnum.grade4, UserGradeEnum.grade3),
parentRel.getParentUserId()
);
// 团长或渠道
if (userParentRel != null) {
// 团长
if (UserGradeEnum.grade3.getCode().equals(userParentRel.getParentUserGrade())) {
contribute.add(userService.getUser(userParentRel.getUserId()));
// 递归判断找到渠道
BsUserParentRel channel = userParentRelService.getParent(Arrays.asList(UserGradeEnum.grade4), userParentRel.getParentUserId());
if (channel != null) {
contribute.add(userService.getUser(channel.getParentUserId()));
}
// 渠道
} else if (UserGradeEnum.grade4.getCode().equals(userParentRel.getParentUserGrade())) {
contribute.add(userService.getUser(userParentRel.getUserId()));
// 递归判断渠道
BsUserParentRel channel = userParentRelService.getParent(Arrays.asList(UserGradeEnum.grade4), parentRel.getParentUserId());
if (channel != null) {
contribute.add(userService.getUser(channel.getParentUserId()));
}
}
}
} else if (UserGradeEnum.grade1.getCode().equals(parentRel.getParentUserGrade())) {
// 见习会员
contribute.add(userService.getUser(parentRel.getParentUserId()));
// 递归判断找到团长或渠道
BsUserParentRel userParentRel = userParentRelService.getParent(
Arrays.asList(UserGradeEnum.grade4, UserGradeEnum.grade3),
parentRel.getParentUserId());
// 团长或渠道
if (userParentRel != null) {
// 团长
if (UserGradeEnum.grade3.getCode().equals(userParentRel.getParentUserGrade())) {
contribute.add(userService.getUser(userParentRel.getUserId()));
// 递归判断找到渠道
BsUserParentRel channel = userParentRelService.getParent(Arrays.asList(UserGradeEnum.grade4), userParentRel.getParentUserId());
if (channel != null) {
contribute.add(userService.getUser(channel.getParentUserId()));
}
// 渠道
} else if (UserGradeEnum.grade4.getCode().equals(userParentRel.getParentUserGrade())) {
contribute.add(userService.getUser(userParentRel.getUserId()));
// 递归判断找到渠道
BsUserParentRel channel = userParentRelService.getParent(Arrays.asList(UserGradeEnum.grade4), userParentRel.getParentUserId());
if (channel != null) {
contribute.add(userService.getUser(channel.getParentUserId()));
}
}
}
}
}
}
param.put("contribute", contribute);
return ResponseMsgUtil.success(param);

Binary file not shown.

@ -121,6 +121,28 @@ public class ClientController {
}
}
@RequestMapping(value = "/smsLogin", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "登录并注册")
public ResponseData smsLogin(@RequestParam(value = "phone" , required = true) String phone) {
try {
// 校验手机号格式
if (!MemberValidateUtil.validatePhone(phone)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号");
}
return ResponseMsgUtil.success(userService.login(phone, UserLoginType.SMS, new HashMap<>(), null));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/loginOut",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "退出登录")

@ -2,9 +2,12 @@ package com.hfkj.controller;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsUser;
import com.hfkj.model.ResponseData;
import com.hfkj.model.UserSessionObject;
import com.hfkj.service.elm.ElmService;
import com.hfkj.service.user.BsUserService;
import com.taobao.api.response.AlibabaAlscUnionMediaZoneAddResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -15,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
@Controller
@RequestMapping(value="/elm")
@Api(value="饿了么")
@ -25,6 +30,9 @@ public class ElmController {
@Autowired
private UserCenter userCenter;
@Resource
private BsUserService bsUserService;
@RequestMapping(value="/officialactivity",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "本地联盟饿了么推广官方活动查询")
@ -34,7 +42,20 @@ public class ElmController {
// 用户session
UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class);
return ResponseMsgUtil.success(ElmService.officialactivity(session.getUser().getId() , "10144"));
BsUser user = bsUserService.getUser(session.getUser().getId());
String pid = "alsc_28560886_9016007_22442020";
if(user != null){
if (user.getElmPid() == null) {
AlibabaAlscUnionMediaZoneAddResponse mediaZone = ElmService.mediaZone(user.getPhone());
pid = mediaZone.getResult().getPid();
user.setElmPid(pid);
bsUserService.editData(user);
} else {
pid = user.getElmPid();
}
}
return ResponseMsgUtil.success(ElmService.officialactivity(session.getUser().getId() , "10144" , pid));
} catch (Exception e) {
log.error("error!",e);

@ -5,15 +5,18 @@ import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrder;
import com.hfkj.entity.BsUser;
import com.hfkj.model.*;
import com.hfkj.service.elm.ElmService;
import com.hfkj.service.goods.GoodsDataService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.pdd.PddService;
import com.hfkj.service.taobao.TaoBaoService;
import com.hfkj.service.user.BsUserService;
import com.taobao.api.response.AlibabaAlscUnionMediaZoneAddResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -23,10 +26,8 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.time.format.DateTimeFormatter;
import java.util.*;
@Controller
@RequestMapping(value="/goods")
@ -43,6 +44,8 @@ public class GoodsController {
private BsUserService bsUserService;
@Resource
private BsOrderService orderService;
@RequestMapping(value="/goodsList",method = RequestMethod.GET)
@ResponseBody
@ -56,9 +59,11 @@ public class GoodsController {
List<GoodsModel> goodsList;
// 1:淘宝 2:拼多多
if (type == 1) {
JSONObject jsonObject = TaoBaoService.material(title , pageNo , pageSize);
JSONObject jsonObject = TaoBaoService.material(title , pageNo , pageSize );
if (!jsonObject.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
@ -139,12 +144,19 @@ public class GoodsController {
JSONObject tokenResult = JSONObject.parseObject(token);
JSONObject jsonObject = TaoBaoService.publisher(tokenResult.getString("access_token"));
// 用户备案
JSONObject jsonObject = TaoBaoService.publisher(tokenResult.getString("access_token") , "5FM9A9");
String body = jsonObject.getString("body");
JSONObject result = JSONObject.parseObject(body);
// 渠道备案
JSONObject relationObject = TaoBaoService.publisher(tokenResult.getString("access_token") , "JIIIVF");
String relation = relationObject.getString("body");
JSONObject relationBody = JSONObject.parseObject(relation);
BsUser user = bsUserService.getUser(userSession.getUser().getId());
user.setSpecialId(result.getJSONObject("data").getString("relation_id"));
user.setSpecialId(result.getJSONObject("data").getString("special_id"));
user.setRelationId(relationBody.getJSONObject("data").getString("relation_id"));
bsUserService.updateInfo(user);
return ResponseMsgUtil.success("绑定成功");
@ -155,17 +167,82 @@ public class GoodsController {
}
}
@RequestMapping(value="/getToken",method = RequestMethod.GET)
@RequestMapping(value="/mediaZone",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "饿了么创建推广位")
public ResponseData mediaZone() {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
AlibabaAlscUnionMediaZoneAddResponse object = ElmService.mediaZone( userSession.getUser().getPhone());
return ResponseMsgUtil.success(object.getResult().getPid());
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getPublisherInfo",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取Access Token")
public ResponseData getToken(@RequestParam(value = "code" , required = false) String code
@ApiOperation(value = "淘宝客-公用-私域用户备案信息查询")
public ResponseData getPublisherInfo(@RequestParam(value = "code" , required = false) String code
) {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
JSONObject jsonObject = TaoBaoService.getToken(code);
String token = jsonObject.getString("token_result");
JSONObject tokenJson = TaoBaoService.getToken(code);
String token = tokenJson.getString("token_result");
JSONObject tokenResult = JSONObject.parseObject(token);
return ResponseMsgUtil.success(tokenResult);
BsUser user = bsUserService.getUser(userSession.getUser().getId());
// 用户备案
JSONObject jsonObject = TaoBaoService.getPublisherInfo(tokenResult.getString("access_token") , Long.valueOf(user.getRelationId()), user.getSpecialId());
return ResponseMsgUtil.success(jsonObject);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getOrderList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询订单")
public ResponseData getOrderList() {
try {
orderService.getOrderElmList("2024-10-20 09:34:00" , "2024-11-08 12:34:00");
return ResponseMsgUtil.success("nu");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/generalLink",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "淘宝客-公用-私域用户备案信息查询")
public ResponseData generalLink(
@RequestParam(value = "itemId" , required = false) String itemId,
@RequestParam(value = "url" , required = false) String url
) {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
// 用户备案
JSONObject jsonObject = TaoBaoService.generalLink(itemId, url, userSession.getUser().getRelationId());
return ResponseMsgUtil.success(jsonObject);
} catch (Exception e) {
log.error("error!",e);

File diff suppressed because one or more lines are too long

@ -2,10 +2,12 @@ package com.hfkj.controller;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData;
import com.hfkj.model.UserSessionObject;
import com.hfkj.service.meituan.MeiTuanService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.user.BsUserAccountRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -18,6 +20,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.time.format.DateTimeFormatter;
import java.util.Date;
@Controller
@RequestMapping(value="/takeOut")
@Api(value="外卖")
@ -28,6 +34,9 @@ public class TakeOutController {
@Autowired
private UserCenter userCenter;
@Resource
private BsOrderService orderService;
@RequestMapping(value="/generateLink",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "自助取链接口 ")
@ -40,7 +49,7 @@ public class TakeOutController {
JSONObject jsonObject = new JSONObject();
jsonObject.put("actId" , actId);
jsonObject.put("sid" , session.getUser().getId());
jsonObject.put("sid" , String.valueOf(session.getUser().getId()));
jsonObject.put("linkType" , linkType);
JSONObject object = MeiTuanService.generateLink(jsonObject);
@ -53,24 +62,43 @@ public class TakeOutController {
}
}
@RequestMapping(value="/miniCode",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "小程序生成二维码 ")
public ResponseData miniCode() {
try {
// 用户session
UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class);
JSONObject jsonObject = new JSONObject();
jsonObject.put("actId" , 33);
jsonObject.put("sid" , String.valueOf(session.getUser().getId()));
jsonObject.put("linkType" , 4);
JSONObject object = MeiTuanService.miniCode(jsonObject);
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/orderList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "订单列表查询接口")
public ResponseData orderList(
@RequestParam(value = "actId" , required = false) Long actId,
@RequestParam(value = "startTime" , required = false) Long startTime,
@RequestParam(value = "endTime" , required = false) Integer endTime
@RequestParam(value = "actId" , required = false) Long actId
) {
try {
JSONObject jsonObject = new JSONObject();
jsonObject.put("startTime" , startTime);
jsonObject.put("endTime" , endTime);
jsonObject.put("actId" , actId);
JSONObject object = MeiTuanService.orderList(jsonObject);
orderService.getOrderMeiTuanList(String.valueOf(new Date().getTime()/1000 - 86000) , String.valueOf(new Date().getTime()/1000));
return ResponseMsgUtil.success(object);
return ResponseMsgUtil.success("object");
} catch (Exception e) {
log.error("error!",e);

@ -5,10 +5,13 @@ import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsUser;
import com.hfkj.model.ResponseData;
import com.hfkj.model.UserSessionObject;
import com.hfkj.service.elm.ElmService;
import com.hfkj.service.meituan.MeiTuanService;
import com.hfkj.service.pdd.PddService;
@ -16,11 +19,13 @@ import com.hfkj.service.taobao.TaoBaoService;
import com.hfkj.service.user.BsUserContributeService;
import com.hfkj.service.user.BsUserGradeService;
import com.hfkj.service.user.BsUserParentRelService;
import com.hfkj.service.user.BsUserService;
import com.hfkj.sysenum.user.UserGradeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -41,22 +46,31 @@ import java.util.Map;
public class TestController {
private static Logger log = LoggerFactory.getLogger(TestController.class);
@RequestMapping(value="/material",method = RequestMethod.GET)
@Autowired
private UserCenter userCenter;
@Resource
private BsUserService bsUserService;
@RequestMapping(value="/getPublisherInfo",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "淘宝客-推广者-物料id列表查询 ")
public ResponseData material(@RequestParam(value = "title" , required = false) String title,
@RequestParam(value = "pageNo" , required = false) Long pageNo,
@RequestParam(value = "pageSize" , required = false) Long pageSize
@ApiOperation(value = "淘宝客-公用-私域用户备案")
public ResponseData getPublisherInfo(@RequestParam(value = "code" , required = false) String code
) {
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.material(title , pageNo , pageSize);
if (jsonObject.getBoolean("success")) {
return ResponseMsgUtil.success(jsonObject.getJSONArray("result_list"));
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
}
BsUser user = bsUserService.getUser(userSession.getUser().getId());
// 用户备案
JSONObject jsonObject = TaoBaoService.getPublisherInfo(tokenResult.getString("access_token") , Long.valueOf(user.getRelationId()), user.getSpecialId());
return ResponseMsgUtil.success(jsonObject);
} catch (Exception e) {
log.error("error!",e);
@ -67,5 +81,4 @@ public class TestController {
}

@ -0,0 +1,118 @@
package com.hfkj.controller;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
import com.alipay.api.request.AlipayUserInfoShareRequest;
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
import com.alipay.api.response.AlipayUserInfoShareResponse;
import com.hfkj.common.alipay.AlipayUtils;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsUserPlatformAuthorize;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.UserSessionObject;
import com.hfkj.service.user.BsUserGradeService;
import com.hfkj.service.user.BsUserParentRelService;
import com.hfkj.service.user.BsUserPlatformAuthorizeService;
import com.hfkj.service.user.BsUserService;
import com.hfkj.sysenum.user.UserAuthorizePlatformEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @className: CmsController
* @author: HuRui
* @date: 2024/9/24
**/
@Controller
@RequestMapping(value = "/userAuth")
@Api(value = "用户授权管理")
public class UserAuthController {
private static Logger log = LoggerFactory.getLogger(UserAuthController.class);
@Resource
private BsUserPlatformAuthorizeService userPlatformAuthorizeService;
@Resource
private UserCenter userCenter;
@RequestMapping(value="/alipay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "支付宝授权")
public ResponseData alipay(@RequestBody JSONObject body) {
try {
UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class);
if (body == null || StringUtils.isBlank(body.getString("code"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest();
request.setGrantType("authorization_code");
request.setCode(body.getString("code"));
AlipaySystemOauthTokenResponse response = AlipayUtils.initClient().execute(request);
if(response.isSuccess()) {
AlipayUserInfoShareRequest alipayUserInfoShareRequest = new AlipayUserInfoShareRequest();
AlipayUserInfoShareResponse alipayUserInfoShareResponse = AlipayUtils.initClient().execute(alipayUserInfoShareRequest,response.getAccessToken());
if(alipayUserInfoShareResponse.isSuccess()) {
// 授权信息
BsUserPlatformAuthorize userPlatformAuthorize = userPlatformAuthorizeService.getUserAuth(session.getUser().getId(), UserAuthorizePlatformEnum.type1);
if (userPlatformAuthorize == null) {
userPlatformAuthorize = new BsUserPlatformAuthorize();
}
userPlatformAuthorize.setUserId(session.getUser().getId());
userPlatformAuthorize.setPlatformCode(UserAuthorizePlatformEnum.type1.getType());
userPlatformAuthorize.setPlatformName(UserAuthorizePlatformEnum.type1.getName());
userPlatformAuthorize.setOpenId(alipayUserInfoShareResponse.getOpenId());
userPlatformAuthorize.setAvatar(alipayUserInfoShareResponse.getAvatar());
userPlatformAuthorize.setNickName(alipayUserInfoShareResponse.getNickName());
userPlatformAuthorizeService.edit(userPlatformAuthorize);
return ResponseMsgUtil.success(userPlatformAuthorize);
}
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "授权失败");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getUserAuthDetail",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "支付宝授权详情")
public ResponseData getUserAuthDetail(@RequestParam(value = "platform" , required = true) Integer platform) {
try {
UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class);
UserAuthorizePlatformEnum platformEnum = UserAuthorizePlatformEnum.getDataByType(platform);
if (platformEnum == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知平台");
}
return ResponseMsgUtil.success( userPlatformAuthorizeService.getUserAuth(session.getUser().getId(), platformEnum));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getUserAuthList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "用户授权列表")
public ResponseData getUserAuthList() {
try {
UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class);
return ResponseMsgUtil.success( userPlatformAuthorizeService.getUserAuth(session.getUser().getId()));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}

@ -10,10 +10,14 @@ import com.hfkj.common.utils.*;
import com.hfkj.config.CommonSysConst;
import com.hfkj.config.SysConfig;
import com.hfkj.entity.BsUser;
import com.hfkj.entity.BsUserPlatformAuthorize;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.UserSessionObject;
import com.hfkj.service.pdd.PddService;
import com.hfkj.service.user.BsUserPlatformAuthorizeService;
import com.hfkj.service.user.BsUserService;
import com.hfkj.sysenum.user.UserAuthorizePlatformEnum;
import com.hfkj.sysenum.user.UserLoginType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -47,6 +51,8 @@ public class UserController {
@Resource
private BsUserService userService;
@Resource
private BsUserPlatformAuthorizeService userPlatformAuthorizeService;
@Resource
private RedisUtil redisUtil;
@Autowired
private UserCenter userCenter;
@ -69,6 +75,21 @@ public class UserController {
}
}
@RequestMapping(value = "/getInviteUser", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询邀请人信息")
public ResponseData getInviteUser() {
try {
UserSessionObject userSessionObject = userCenter.getSessionModel(UserSessionObject.class);
if (userSessionObject.getUser().getInviteUserId() != null) {
return ResponseMsgUtil.success(userService.getUser(userSessionObject.getUser().getInviteUserId()));
}
return ResponseMsgUtil.success(null);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="uploadHead",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "头像上传")
@ -180,6 +201,51 @@ public class UserController {
}
}
@RequestMapping(value = "/userAccreditList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "用户授权列表")
public ResponseData userAccreditList() {
try {
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
JSONObject object = new JSONObject();
object.put("taobao", userSession.getUser().getRelationId() != null);
Map<String , Object> mapUser = new JSONObject();
mapUser.put("uid", userSession.getUser().getId());
// 判断是否需要授权
JSONObject jsonObject = PddService.authority(mapUser.toString());
boolean generateAuthorityUrl = jsonObject.getJSONObject("authorityQueryResponse").getInteger("bind") == 1;
object.put("pdd", generateAuthorityUrl);
return ResponseMsgUtil.success(object);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/taoBaoAccreditDelete", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "淘宝授权取消")
public ResponseData taoBaoAccreditDelete() {
try {
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
BsUser user = userService.getUser(userSession.getUser().getId());
user.setRelationId(null);
userService.editData(user);
return ResponseMsgUtil.success("取消成功");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/bindPhone", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "绑定手机号")
@ -366,6 +432,16 @@ public class UserController {
user.setWechatUnionid(userinfo.getString("unionid"));
userService.updateInfo(user);
// 授权信息
BsUserPlatformAuthorize authorize = new BsUserPlatformAuthorize();
authorize.setUserId(user.getId());
authorize.setPlatformCode(UserAuthorizePlatformEnum.type2.getType());
authorize.setPlatformName(UserAuthorizePlatformEnum.type2.getName());
authorize.setAvatar(userinfo.getString("headimgurl"));
authorize.setNickName(userinfo.getString("nickname"));
authorize.setOpenId(user.getWechatOpenId());
userPlatformAuthorizeService.edit(authorize);
return ResponseMsgUtil.success(userCenter.getSessionModel(UserSessionObject.class));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);

@ -93,20 +93,6 @@ public class BsOrderController {
}
}
@RequestMapping(value="/getPddOrderList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "用时间段查询推广订单接口")
public ResponseData getPddOrderList() {
try {
return ResponseMsgUtil.success(orderService.getOrderList("2024-10-01 00:00:00"));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/statisticsOrder",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "统计订单")
@ -134,8 +120,11 @@ public class BsOrderController {
List<BsOrder> list = orderService.getOrderList(new HashMap<>());
list = list.stream().filter(s->s.getUserId() != null).collect(Collectors.toList());
// 查询个人订单
List<BsOrder> orderUserList = list.stream().filter(s->s.getUserId().equals(session.getUser().getId())).collect(Collectors.toList());
List<BsOrder> orderUserList = list.stream().filter(s-> s.getUserId() != null).filter(s->s.getUserId().equals(session.getUser().getId())).collect(Collectors.toList());
//查询团队
// 查询团队用户
Map<String,Object> param = new HashMap<>();
@ -157,15 +146,15 @@ public class BsOrderController {
BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue());
map.put("cumulative" , userAccountRecordService.getUserTotalProfit(session.getUser().getId() , null , null));
map.put("unliquidated" , allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
map.put("unliquidated" , allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) ).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
// 今日收益报表
Map<String , Object> todayReport = new HashMap<>();
JSONObject object;
// 获取今天新增订单
object = new JSONObject();
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) ).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
todayReport.put("todayAddOrder", object);
// 获取今天我的订单
object = new JSONObject();
@ -175,13 +164,13 @@ public class BsOrderController {
// 团队订单
object = new JSONObject();
object.put("orderTeamNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).count());
object.put("orderTeamMoney", teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderTeamNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).count());
object.put("orderTeamMoney", teamOrderList.stream().filter(s->s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
todayReport.put("teamOrderList", object);
// 获取今天失效订单
object = new JSONObject();
object.put("orderFailureNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).count());
object.put("orderFailureMoney", allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderFailureNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(4)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).count());
object.put("orderFailureMoney", allOrderList.stream().filter(s -> s.getStatus().equals(4)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
todayReport.put("todayFailureOrder", object);
map.put("todayReport" ,todayReport);
@ -189,8 +178,8 @@ public class BsOrderController {
Map<String , Object> yesterdayReport = new HashMap<>();
// 获取昨天新增订单
object = new JSONObject();
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
yesterdayReport.put("yesterdayAddOrder", object);
// 获取昨天我的订单
object = new JSONObject();
@ -200,13 +189,13 @@ public class BsOrderController {
// 团队订单
object = new JSONObject();
object.put("orderNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).count());
object.put("orderMoney", teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).count());
object.put("orderMoney", teamOrderList.stream().filter(s->s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
yesterdayReport.put("yesterdayOrderList", object);
// 获取昨天失效订单
object = new JSONObject();
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(4)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(4)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
yesterdayReport.put("yesterdayFailureOrder", object);
map.put("yesterdayReport" ,yesterdayReport);
@ -214,8 +203,8 @@ public class BsOrderController {
Map<String , Object> thisMonthReport = new HashMap<>();
// 获取本月新增订单
object = new JSONObject();
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
thisMonthReport.put("thisMonthAddOrder", object);
// 获取本月我的订单
object = new JSONObject();
@ -225,13 +214,13 @@ public class BsOrderController {
// 团队订单
object = new JSONObject();
object.put("orderNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", teamOrderList.stream().filter(s->s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
thisMonthReport.put("thisMonthOrderList", object);
// 获取本月失效订单
object = new JSONObject();
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(4)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(4)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
thisMonthReport.put("thisMonthFailureOrder", object);
map.put("thisMonthReport" ,thisMonthReport);
@ -240,8 +229,8 @@ public class BsOrderController {
Map<String , Object> lastMonthReport = new HashMap<>();
// 获取本月新增订单
object = new JSONObject();
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
lastMonthReport.put("lastMonthAddOrder", object);
// 获取本月我的订单
object = new JSONObject();
@ -251,13 +240,13 @@ public class BsOrderController {
// 团队订单
object = new JSONObject();
object.put("orderNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", teamOrderList.stream().filter(s->s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
lastMonthReport.put("lastMonthOrderList", object);
// 获取本月失效订单
object = new JSONObject();
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(4)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).count());
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(4)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate));
lastMonthReport.put("lastMonthFailureOrder", object);
map.put("lastMonthReport" ,lastMonthReport);
return ResponseMsgUtil.success(map);

@ -48,6 +48,7 @@ public class PromotionController {
}
jsonObject.put("userId", userSession.getUser().getId());
jsonObject.put("relationId", userSession.getUser().getRelationId());
return ResponseMsgUtil.success(promotionService.createUrl(jsonObject));

Binary file not shown.

@ -20,6 +20,27 @@
<artifactId>service</artifactId>
<version>PACKT-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>taobao.skd</groupId>
<artifactId>taobao-open-sdk</artifactId>
<scope>system</scope>
<version>1.0.1</version>
<systemPath>${basedir}/lib/taobao-sdk.jar</systemPath>
</dependency>
<dependency>
<groupId>taobao-elm.skd</groupId>
<artifactId>taobao-open-elm-sdk</artifactId>
<scope>system</scope>
<version>1.0.1</version>
<systemPath>${basedir}/lib/taobao-sdk-java-elm.jar</systemPath>
</dependency>
<dependency>
<groupId>pop.skd</groupId>
<artifactId>pop-open-sdk</artifactId>
<scope>system</scope>
<version>1.0.1</version>
<systemPath>${basedir}/lib/pop-sdk-1.18.23-all.jar</systemPath>
</dependency>
</dependencies>
<build>
@ -28,6 +49,13 @@
<directory>src/main/resources/${env}</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>${basedir}/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>

@ -0,0 +1,43 @@
package com.hfkj.schedule;
import com.hfkj.service.cornucopia.BsCornucopiaPoolService;
import com.hfkj.service.partner.PartnerService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @ClassName LotterySchedule
* @Author Sum1Dream
* @Description 开奖定时任务
* @Date 2024/11/4 下午2:48
**/
@Component
public class LotterySchedule {
@Resource
private PartnerService partnerService;
@Resource
private BsCornucopiaPoolService cornucopiaPoolService;
@Scheduled(cron = "0 30 23 * * ?") // 每日23:30:00 执行一次
public void startCampaign() {
try {
partnerService.startCampaign();
} catch (Exception e) {
System.out.println("统计失败!!!");
}
}
@Scheduled(cron = "0 0 20 * * ?") // 每日20:00:00 执行一次
public void cornucopiaLottery() {
try {
cornucopiaPoolService.cornucopiaLottery();
} catch (Exception e) {
System.out.println("统计失败!!!");
}
}
}

@ -0,0 +1,86 @@
package com.hfkj.schedule;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.service.order.BsOrderService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
/**
* @ClassName OrderSchedule
* @Author Sum1Dream
* @Description 订单定时任务
* @Date 2024/11/4 下午2:48
**/
@Component
public class OrderSchedule {
@Resource
private BsOrderService orderService;
@Scheduled(cron = "0 0/15 * * * ?") // 每日凌晨05:30:00 执行一次
public void pddOrder() {
try {
// create domain
LocalDateTime now = LocalDateTime.now();
LocalDateTime twentyMinutesBefore = now.minus(Duration.ofMinutes(59));
// 昨日时间
orderService.getOrderPddList(twentyMinutesBefore.format(DateTimeFormatter.ofPattern(DateUtil.Y_M_D_HMS)) , DateUtil.format(new Date(),DateUtil.Y_M_D_HMS));
} catch (Exception e) {
System.out.println("查询失败!!!");
}
}
@Scheduled(cron = "0 0/15 * * * ?") // 每十五分钟 执行一次
public void getOrderTaoBaoList() {
try {
// create domain
LocalDateTime now = LocalDateTime.now();
LocalDateTime twentyMinutesBefore = now.minus(Duration.ofMinutes(19));
// 昨日时间
orderService.getOrderTaoBaoList(twentyMinutesBefore.format(DateTimeFormatter.ofPattern(DateUtil.Y_M_D_HMS)) , DateUtil.format(new Date(),DateUtil.Y_M_D_HMS));
} catch (Exception e) {
System.out.println("查询失败!!!");
}
}
@Scheduled(cron = "0 0/15 * * * ?") // 每十五分钟 执行一次
public void getOrderMeiTuanList() {
try {
// 昨日时间
orderService.getOrderMeiTuanList(String.valueOf(new Date().getTime()/1000 - 86000) , String.valueOf(new Date().getTime()/1000));
} catch (Exception e) {
System.out.println("查询失败!!!");
}
}
@Scheduled(cron = "0 0/15 * * * ?") // 每十五分钟 执行一次
public void getOrderElmList() {
try {
// 昨日时间
// create domain
LocalDateTime now = LocalDateTime.now();
LocalDateTime twentyMinutesBefore = now.minus(Duration.ofMinutes(19));
// 昨日时间
orderService.getOrderElmList(twentyMinutesBefore.format(DateTimeFormatter.ofPattern(DateUtil.Y_M_D_HMS)) , DateUtil.format(new Date(),DateUtil.Y_M_D_HMS));
} catch (Exception e) {
System.out.println("查询失败!!!");
}
}
}

Binary file not shown.

@ -290,6 +290,12 @@
<version>1.0.1</version>
<systemPath>${basedir}/lib/pop-sdk-1.18.23-all.jar</systemPath>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>dysmsapi20170525</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
<build>
<resources>

@ -63,7 +63,7 @@ public class QRCodeGenerator {
public static String overlapImage(String path ,String number) {
try {
// 创建BufferedImage对象
int width = 100;
int width = 130;
int height = 45;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

@ -12,11 +12,11 @@ import com.alipay.api.DefaultAlipayClient;
**/
public class AlipayUtils {
private final static String serverUrl = "https://openapi.alipay.com/gateway.do";
private final static String appId = "2021004149636316";
private final static String APP_PRIVATE_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCBObA50oioZEmUGTsSPJghAUf/lRT+TC+9HNyu0To3bSkLZSlEide2kszQnJk32+60QM26OudBaUnUCHkzv0++232hKPzSXHVVUykvu74itAtH66YxO2RqLt/OuTRBnFpiYPs0lXEoNeAsUQ92I6TOCrS8db/76Tvuye0nSH5lAJ6mwq8Hgo/+RQNRvIq3RFvWQOMD5lTp2lWsZ7x4FONtSmPCXd4fdYbKd1QrBHMZCQjBAn12YA+X+lmSNlnFo/xOu5rvKwMGJgvFLYxFdNHXgZUZfrjzOKA+sqq8lRfyVo4YHqRDi5bH1Ln2VUqZL9HidIHZx0YSKlfvdeuzR8abAgMBAAECggEAOOpwrLcGy6wIIDuQofKgSoEm9fHyoiJqMFAC/thWXM0uc79lkrNnmBlGLmeasFik5S1Zrzl8W3oFM2dcAqezdutzhMTpvblNUHxlOonlL6G/CjlHJI31JzNoDcPSuUclJAl0+u8LPNul1b8KIU2Hq9xZSFxQZ6KNbBnx4whx6wfZBvV06oy7hu7vfnWvobidooiGAxJuffRKuWQS8w6BPC7h2vz8AbiADHMA1YgCwIwroPbhU8QFY07PGeirAyJnrphZOIKSKwY9m8RK/AyBKL0iDopX/7nhdJ1LEiVbBlw50ej2VMAqfb0bA7z7zhhxwYCi6LN9DZfLQW9/Z3W8mQKBgQDyHdT/tex+s07zg4TUgAmTTqSyqp64j9Qbgdde2tTHUPjmOXXOpL5PvvT6xOu6dTwq5TwwqdsyVLh5T/cnYzqqXaZZzv6iWi1qajbLElf1r7bPquF2KCa0n2ZdxcYBH78bvIIuD7kGfmJDSA5a+1cgHJYZVer7MvYFf2id6H617wKBgQCIoqlgvYzTVDdXevI5LcOr1CfsBsuXoUdc8aUyFa1D6rj41wHXonqtmr/3tlo03HbUAQT0u/CjMf8raoW/2D1Sv7EnL3udb51qzYYj082x0DNUAs9CQq+AO8qhs8h4sXJGki7rjtJUtOfs1VFg84I5Z7IT9xKQMvsp2gmErpTGFQKBgQDIQYBxWEmZqjl9FKUDFjvVSVDULmdFhEEN12EJpbokeYbE9XXJS13Vm74IxGOtP1ZarGwSXAtfH8/NFyT3wQ0+6GK1GY5nPmsd/2f+otd58LImJdKB5kfNUaJboT9aoqVxDYQnEP4aruIbgDfPbN/tQXes0PGgf9AZT/55zVkwpQKBgFD9kkbctKADuHYrU28fOHAe5rcaZA3yNHncZt5kSPsMJC6kS9xE3FERfJ7ZwWi6Edmi7QwgZwhlN2rFzpgkFl15cQnYNH7izT2kq9GK18+BqRswOyh8nMj3KCpnhfo8vI8mUZehZf196kfRPlaooNVkKQN6nc9J2OU68A9s6JTtAoGBAOTabPjBoxWeNQwF2pR4E5SfXaMBKC7a6/+AMn9oUb9lvTPZtxXkIZkvn5iRz2UmrygLw4UCWKC3T7ujFIO0lHWktzVv2qPbINbfW10p0S/ioFvNxzP+ZDfSFrN03Zoh05H+0NXj1e4REMtIrbx5R+sJn6CVftpYfFcQd/lXy8MR";
private final static String APP_CERT_PATH = "/home/project/oil/cert/alipay/appCertPublicKey_2021004149636316.crt";
private final static String ALIPAY_CERT_PATH = "/home/project/oil/cert/alipay/alipayCertPublicKey_RSA2.crt";
private final static String ALIPAY_ROOT_CERT_PATH = "/home/project/oil/cert/alipay/alipayRootCert.crt";
private final static String appId = "2021004176645906";
private final static String APP_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCWaLQdwl6E5QVo2RUWquJ1Et4oLRsbfLULQyYT3o6Fs+2ZWOHjjMf6Jg5yVuM3rPa1GNB4+6cBU84gaLQ8WZl9tdQAOhQlnvjOsJA0twb+Lq1Luaa+cOOgp3t3+PuD0nRP9vuPAW3aqrFyjTeDx0vOAzulrWWwS+zLWkUmv96Db5MjlR8gK/pLOszQsk+K3uu06KoyLrCn0K/AIrhJClcEvy/umDfC/P8PnYEgTppNgZ/IBkKp5P9JZzyYEgR7rgD/Z8aWKQ5a8bO0VxC/7FDpCcWNRPdwcHEN8A0ltoO5MNuleZz2q9hrW627qiQNEoaDyqbh/PNFXXLCK5nBWzWPAgMBAAECggEAHC9ouT7oKW0lU12CpynEn/22Jb82GjOHVaHyq7yD5qgt+RN/2P1TqBujj2ea0p8V6B/LSTCXPhdvRAF67Og5bCY7oQNBLT+aDlll3IsDw3QJw2v5xCwxa7SW3YeJ0k0IwMdeopC4/kYIVJgD9CzPlr5iWgyhRqUjrYOv+6/uyaA+XLJjF/eUG0UEnkyuCPW6ClX+ulpI6Tk7ycB9HJFGpLNoYBUSs7mgiUOOKI9AA9S5aDG2QYBxkUK8WF4gtYt6SLKAWw5GSMCeK5zjhRZw0GqIIouIUDSigdK5VzKth/OXiA9B6uXh21fS1GQPhcfo4ZbKml6p8JB9pvQRPIXpiQKBgQD3u4ph5RMv4lvUvk/q6f1fyATcRlaCGiiPrUj8IFq4vjxIHfB+nb0YTHkEHClWsGbc4I/l2UQE+wzR89ZcFE2h+v4c7dswMW/QPX9TyFZQIRs2nvAbPKMdg40zdLDiUj3dknSrWx9OqnTXghhK8O2Ah1qNLdCVPD9eFehfTADsIwKBgQCbbbI8G7X2RWkiJtPItrtWWhOJ4BEQG9bBendeirvZmfQilpzeC7UWdVintGzK+xSGDwYqDWtyIWeT/wu2VdIl2yTJ/2HfRDD4E0jnbed32g9bcRReOCjnwuSGZUp845nZKilxuBHD0tXS0pi/6VCje2myaZVmXnLlOE57FkuhpQKBgGJl9GZD5eYcI9uRqA6n2EMmIIAZ1ByjJT9EVfwHIeHFdg4zDiZMoyI2pc6zHNxY/tJ2w9FJBhJwYTw3fQpf6iIPnsWA2JIA4Oe2tY9iwJ3dOIDuinJXGHcNnJU2oVeT0QzkMkEp1XqajARZoSqLHdryaE4xR2svXgAR9ZV8i9U/AoGBAI67tios6HU4WMvcDDEOXgt2vOqosgKxDg6vgF951/iEwQXiejwPVEVDjh60OhRNbxONSIPlvv4YXx4x4XeYaFwLW0WFGUQHQ1ENpK2i6CXQQroepi3ANRBgkaw56KW3/djINzcPaoECZQouC8hxYnQ/KVmGTIStx6Voh+nRF7NhAoGAa2KOWIWkElc3q8E7DP7bJ19fEkn1XUJZ2wjgX3DuFTXAgSkRws2dwM+3PryyqUKdrHMZR5xCU+0636SWb7vBLAp8W5nSc8eghgMYyRVd6ssaBcA6FyPzCloBOeZ6NgJaWF+UoafBIhSsFu9KMt0LEHUm3/rjnj82DV43M0fL7hs=";
private final static String APP_CERT = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlmi0HcJehOUFaNkVFqridRLeKC0bG3y1C0MmE96OhbPtmVjh44zH+iYOclbjN6z2tRjQePunAVPOIGi0PFmZfbXUADoUJZ74zrCQNLcG/i6tS7mmvnDjoKd7d/j7g9J0T/b7jwFt2qqxco03g8dLzgM7pa1lsEvsy1pFJr/eg2+TI5UfICv6SzrM0LJPit7rtOiqMi6wp9CvwCK4SQpXBL8v7pg3wvz/D52BIE6aTYGfyAZCqeT/SWc8mBIEe64A/2fGlikOWvGztFcQv+xQ6QnFjUT3cHBxDfANJbaDuTDbpXmc9qvYa1utu6okDRKGg8qm4fzzRV1ywiuZwVs1jwIDAQAB";
private final static String ALIPAY_CERT = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxHvgDmHdKEU9BOiQ6ZYTyW1tn0xzuZ/PnT9/yhyDnhpaWdKJWr4+4oelRU028FMKPffXQ4yWX7XF5wcdpKqBH9vQSvI4GSz3CjTBGV3aadfMPzc/Inb2Fq4BgBYwyGeTVaMblIyl7wE37oRRMwlBjTgafZGUL078Ll8eZgn2ziRfvtBwzHMTEvhy/jNiC6raW3oFhy2ltnhFCob7z2HEecMMX9RGRdS8aHi+LaYNBktj4JSSElIbz7S+L1AYwyNuxP5i6xjc9kBrOdIWcNg/IGMWWL7bHW/RngSR6D2pzTLZ+sShQoX2M6DIYQsIPzdhkYymWQTQMBMgSTx5lfs4GwIDAQAB";
private final static String ALIPAY_ROOT_CERT = "/home/project/youtao/cert/alipay/alipayRootCert.crt";
/**
* 初始化客户端请求
@ -31,11 +31,11 @@ public class AlipayUtils {
// 设置应用私钥
alipayConfig.setPrivateKey(APP_PRIVATE_KEY);
// 设置应用公钥证书路径
alipayConfig.setAppCertPath(APP_CERT_PATH);
alipayConfig.setAppCertContent(APP_CERT);
// 设置支付宝公钥证书路径
alipayConfig.setAlipayPublicCertPath(ALIPAY_CERT_PATH);
// alipayConfig.setAlipayPublicCertContent(ALIPAY_CERT);
// 设置支付宝根证书路径
alipayConfig.setRootCertPath(ALIPAY_ROOT_CERT_PATH);
alipayConfig.setRootCertPath(ALIPAY_ROOT_CERT);
// 设置请求格式,固定值json
alipayConfig.setFormat("json");
// 设置字符集

@ -0,0 +1,141 @@
package com.hfkj.dao;
import com.hfkj.entity.BsUserPlatformAuthorize;
import com.hfkj.entity.BsUserPlatformAuthorizeExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface BsUserPlatformAuthorizeMapper extends BsUserPlatformAuthorizeMapperExt {
@SelectProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="countByExample")
long countByExample(BsUserPlatformAuthorizeExample example);
@DeleteProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="deleteByExample")
int deleteByExample(BsUserPlatformAuthorizeExample example);
@Delete({
"delete from bs_user_platform_authorize",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into bs_user_platform_authorize (user_id, platform_code, ",
"platform_name, open_id, ",
"avatar, nick_name, ",
"gender, province, city, ",
"`status`, create_time, ",
"update_time, ext_1, ",
"ext_2, ext_3)",
"values (#{userId,jdbcType=BIGINT}, #{platformCode,jdbcType=INTEGER}, ",
"#{platformName,jdbcType=VARCHAR}, #{openId,jdbcType=VARCHAR}, ",
"#{avatar,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, ",
"#{gender,jdbcType=BIT}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsUserPlatformAuthorize record);
@InsertProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(BsUserPlatformAuthorize record);
@SelectProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="platform_code", property="platformCode", jdbcType=JdbcType.INTEGER),
@Result(column="platform_name", property="platformName", jdbcType=JdbcType.VARCHAR),
@Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR),
@Result(column="avatar", property="avatar", jdbcType=JdbcType.VARCHAR),
@Result(column="nick_name", property="nickName", jdbcType=JdbcType.VARCHAR),
@Result(column="gender", property="gender", jdbcType=JdbcType.BIT),
@Result(column="province", property="province", jdbcType=JdbcType.VARCHAR),
@Result(column="city", property="city", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<BsUserPlatformAuthorize> selectByExample(BsUserPlatformAuthorizeExample example);
@Select({
"select",
"id, user_id, platform_code, platform_name, open_id, avatar, nick_name, gender, ",
"province, city, `status`, create_time, update_time, ext_1, ext_2, ext_3",
"from bs_user_platform_authorize",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="platform_code", property="platformCode", jdbcType=JdbcType.INTEGER),
@Result(column="platform_name", property="platformName", jdbcType=JdbcType.VARCHAR),
@Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR),
@Result(column="avatar", property="avatar", jdbcType=JdbcType.VARCHAR),
@Result(column="nick_name", property="nickName", jdbcType=JdbcType.VARCHAR),
@Result(column="gender", property="gender", jdbcType=JdbcType.BIT),
@Result(column="province", property="province", jdbcType=JdbcType.VARCHAR),
@Result(column="city", property="city", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
BsUserPlatformAuthorize selectByPrimaryKey(Long id);
@UpdateProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") BsUserPlatformAuthorize record, @Param("example") BsUserPlatformAuthorizeExample example);
@UpdateProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") BsUserPlatformAuthorize record, @Param("example") BsUserPlatformAuthorizeExample example);
@UpdateProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(BsUserPlatformAuthorize record);
@Update({
"update bs_user_platform_authorize",
"set user_id = #{userId,jdbcType=BIGINT},",
"platform_code = #{platformCode,jdbcType=INTEGER},",
"platform_name = #{platformName,jdbcType=VARCHAR},",
"open_id = #{openId,jdbcType=VARCHAR},",
"avatar = #{avatar,jdbcType=VARCHAR},",
"nick_name = #{nickName,jdbcType=VARCHAR},",
"gender = #{gender,jdbcType=BIT},",
"province = #{province,jdbcType=VARCHAR},",
"city = #{city,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(BsUserPlatformAuthorize record);
}

@ -0,0 +1,7 @@
package com.hfkj.dao;
/**
* mapper扩展类
*/
public interface BsUserPlatformAuthorizeMapperExt {
}

@ -0,0 +1,388 @@
package com.hfkj.dao;
import com.hfkj.entity.BsUserPlatformAuthorize;
import com.hfkj.entity.BsUserPlatformAuthorizeExample.Criteria;
import com.hfkj.entity.BsUserPlatformAuthorizeExample.Criterion;
import com.hfkj.entity.BsUserPlatformAuthorizeExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class BsUserPlatformAuthorizeSqlProvider {
public String countByExample(BsUserPlatformAuthorizeExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("bs_user_platform_authorize");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(BsUserPlatformAuthorizeExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("bs_user_platform_authorize");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(BsUserPlatformAuthorize record) {
SQL sql = new SQL();
sql.INSERT_INTO("bs_user_platform_authorize");
if (record.getUserId() != null) {
sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}");
}
if (record.getPlatformCode() != null) {
sql.VALUES("platform_code", "#{platformCode,jdbcType=INTEGER}");
}
if (record.getPlatformName() != null) {
sql.VALUES("platform_name", "#{platformName,jdbcType=VARCHAR}");
}
if (record.getOpenId() != null) {
sql.VALUES("open_id", "#{openId,jdbcType=VARCHAR}");
}
if (record.getAvatar() != null) {
sql.VALUES("avatar", "#{avatar,jdbcType=VARCHAR}");
}
if (record.getNickName() != null) {
sql.VALUES("nick_name", "#{nickName,jdbcType=VARCHAR}");
}
if (record.getGender() != null) {
sql.VALUES("gender", "#{gender,jdbcType=BIT}");
}
if (record.getProvince() != null) {
sql.VALUES("province", "#{province,jdbcType=VARCHAR}");
}
if (record.getCity() != null) {
sql.VALUES("city", "#{city,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(BsUserPlatformAuthorizeExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("user_id");
sql.SELECT("platform_code");
sql.SELECT("platform_name");
sql.SELECT("open_id");
sql.SELECT("avatar");
sql.SELECT("nick_name");
sql.SELECT("gender");
sql.SELECT("province");
sql.SELECT("city");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("bs_user_platform_authorize");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
BsUserPlatformAuthorize record = (BsUserPlatformAuthorize) parameter.get("record");
BsUserPlatformAuthorizeExample example = (BsUserPlatformAuthorizeExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("bs_user_platform_authorize");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getUserId() != null) {
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
}
if (record.getPlatformCode() != null) {
sql.SET("platform_code = #{record.platformCode,jdbcType=INTEGER}");
}
if (record.getPlatformName() != null) {
sql.SET("platform_name = #{record.platformName,jdbcType=VARCHAR}");
}
if (record.getOpenId() != null) {
sql.SET("open_id = #{record.openId,jdbcType=VARCHAR}");
}
if (record.getAvatar() != null) {
sql.SET("avatar = #{record.avatar,jdbcType=VARCHAR}");
}
if (record.getNickName() != null) {
sql.SET("nick_name = #{record.nickName,jdbcType=VARCHAR}");
}
if (record.getGender() != null) {
sql.SET("gender = #{record.gender,jdbcType=BIT}");
}
if (record.getProvince() != null) {
sql.SET("province = #{record.province,jdbcType=VARCHAR}");
}
if (record.getCity() != null) {
sql.SET("city = #{record.city,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("bs_user_platform_authorize");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
sql.SET("platform_code = #{record.platformCode,jdbcType=INTEGER}");
sql.SET("platform_name = #{record.platformName,jdbcType=VARCHAR}");
sql.SET("open_id = #{record.openId,jdbcType=VARCHAR}");
sql.SET("avatar = #{record.avatar,jdbcType=VARCHAR}");
sql.SET("nick_name = #{record.nickName,jdbcType=VARCHAR}");
sql.SET("gender = #{record.gender,jdbcType=BIT}");
sql.SET("province = #{record.province,jdbcType=VARCHAR}");
sql.SET("city = #{record.city,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
BsUserPlatformAuthorizeExample example = (BsUserPlatformAuthorizeExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(BsUserPlatformAuthorize record) {
SQL sql = new SQL();
sql.UPDATE("bs_user_platform_authorize");
if (record.getUserId() != null) {
sql.SET("user_id = #{userId,jdbcType=BIGINT}");
}
if (record.getPlatformCode() != null) {
sql.SET("platform_code = #{platformCode,jdbcType=INTEGER}");
}
if (record.getPlatformName() != null) {
sql.SET("platform_name = #{platformName,jdbcType=VARCHAR}");
}
if (record.getOpenId() != null) {
sql.SET("open_id = #{openId,jdbcType=VARCHAR}");
}
if (record.getAvatar() != null) {
sql.SET("avatar = #{avatar,jdbcType=VARCHAR}");
}
if (record.getNickName() != null) {
sql.SET("nick_name = #{nickName,jdbcType=VARCHAR}");
}
if (record.getGender() != null) {
sql.SET("gender = #{gender,jdbcType=BIT}");
}
if (record.getProvince() != null) {
sql.SET("province = #{province,jdbcType=VARCHAR}");
}
if (record.getCity() != null) {
sql.SET("city = #{city,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, BsUserPlatformAuthorizeExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -20,7 +20,7 @@ public class BsCornucopiaConfig implements Serializable {
private Long id;
/**
* 类型1:金聚宝盆增值回报 2玉聚宝盆增值回报
* 类型1:高值回报 2增值回报
*/
private Integer type;

@ -75,7 +75,7 @@ public class BsOrder implements Serializable {
private BigDecimal gold;
/**
* 状态 0-已支付1-已成团2-确认收货3-审核成功4-审核失败不可提现5-已经结算 6-已失效 ;10-已处罚
* 状态 1 已下单 2 已收货 3 已结算 4 已失效
*/
private Integer status;

@ -0,0 +1,296 @@
package com.hfkj.entity;
import java.io.Serializable;
import java.util.Date;
/**
* bs_user_platform_authorize
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class BsUserPlatformAuthorize implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 平台代码
*/
private Integer platformCode;
/**
* 平台名称
*/
private String platformName;
/**
* 平台open_id
*/
private String openId;
/**
* 头像
*/
private String avatar;
/**
* 昵称
*/
private String nickName;
/**
* 性别 0 1
*/
private Boolean gender;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
* 状态 0删除 1正常
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
private String ext1;
private String ext2;
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Integer getPlatformCode() {
return platformCode;
}
public void setPlatformCode(Integer platformCode) {
this.platformCode = platformCode;
}
public String getPlatformName() {
return platformName;
}
public void setPlatformName(String platformName) {
this.platformName = platformName;
}
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public Boolean getGender() {
return gender;
}
public void setGender(Boolean gender) {
this.gender = gender;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
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;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
BsUserPlatformAuthorize other = (BsUserPlatformAuthorize) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getPlatformCode() == null ? other.getPlatformCode() == null : this.getPlatformCode().equals(other.getPlatformCode()))
&& (this.getPlatformName() == null ? other.getPlatformName() == null : this.getPlatformName().equals(other.getPlatformName()))
&& (this.getOpenId() == null ? other.getOpenId() == null : this.getOpenId().equals(other.getOpenId()))
&& (this.getAvatar() == null ? other.getAvatar() == null : this.getAvatar().equals(other.getAvatar()))
&& (this.getNickName() == null ? other.getNickName() == null : this.getNickName().equals(other.getNickName()))
&& (this.getGender() == null ? other.getGender() == null : this.getGender().equals(other.getGender()))
&& (this.getProvince() == null ? other.getProvince() == null : this.getProvince().equals(other.getProvince()))
&& (this.getCity() == null ? other.getCity() == null : this.getCity().equals(other.getCity()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getPlatformCode() == null) ? 0 : getPlatformCode().hashCode());
result = prime * result + ((getPlatformName() == null) ? 0 : getPlatformName().hashCode());
result = prime * result + ((getOpenId() == null) ? 0 : getOpenId().hashCode());
result = prime * result + ((getAvatar() == null) ? 0 : getAvatar().hashCode());
result = prime * result + ((getNickName() == null) ? 0 : getNickName().hashCode());
result = prime * result + ((getGender() == null) ? 0 : getGender().hashCode());
result = prime * result + ((getProvince() == null) ? 0 : getProvince().hashCode());
result = prime * result + ((getCity() == null) ? 0 : getCity().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", platformCode=").append(platformCode);
sb.append(", platformName=").append(platformName);
sb.append(", openId=").append(openId);
sb.append(", avatar=").append(avatar);
sb.append(", nickName=").append(nickName);
sb.append(", gender=").append(gender);
sb.append(", province=").append(province);
sb.append(", city=").append(city);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -24,4 +24,8 @@ public class GoodsModel {
*/
JSONObject pddUrl;
/**
* 淘宝商品ID
*/
String itemId;
}

@ -18,6 +18,8 @@ public class PublishInfoModel {
*/
String couponShareUrl;
/**
* 搜索id建议生成推广链接时候填写提高收
*/

@ -0,0 +1,49 @@
package com.hfkj.platform.alipay;
import com.alipay.api.AlipayClient;
import com.alipay.api.AlipayConfig;
import com.alipay.api.DefaultAlipayClient;
/**
* 支付宝配置
* @className: AlipayConfig
* @author: HuRui
* @date: 2023/2/13
**/
public class AlipayUtils {
private final static String serverUrl = "https://openapi.alipay.com/gateway.do";
private final static String appId = "2021004149636316";
private final static String APP_PRIVATE_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCBObA50oioZEmUGTsSPJghAUf/lRT+TC+9HNyu0To3bSkLZSlEide2kszQnJk32+60QM26OudBaUnUCHkzv0++232hKPzSXHVVUykvu74itAtH66YxO2RqLt/OuTRBnFpiYPs0lXEoNeAsUQ92I6TOCrS8db/76Tvuye0nSH5lAJ6mwq8Hgo/+RQNRvIq3RFvWQOMD5lTp2lWsZ7x4FONtSmPCXd4fdYbKd1QrBHMZCQjBAn12YA+X+lmSNlnFo/xOu5rvKwMGJgvFLYxFdNHXgZUZfrjzOKA+sqq8lRfyVo4YHqRDi5bH1Ln2VUqZL9HidIHZx0YSKlfvdeuzR8abAgMBAAECggEAOOpwrLcGy6wIIDuQofKgSoEm9fHyoiJqMFAC/thWXM0uc79lkrNnmBlGLmeasFik5S1Zrzl8W3oFM2dcAqezdutzhMTpvblNUHxlOonlL6G/CjlHJI31JzNoDcPSuUclJAl0+u8LPNul1b8KIU2Hq9xZSFxQZ6KNbBnx4whx6wfZBvV06oy7hu7vfnWvobidooiGAxJuffRKuWQS8w6BPC7h2vz8AbiADHMA1YgCwIwroPbhU8QFY07PGeirAyJnrphZOIKSKwY9m8RK/AyBKL0iDopX/7nhdJ1LEiVbBlw50ej2VMAqfb0bA7z7zhhxwYCi6LN9DZfLQW9/Z3W8mQKBgQDyHdT/tex+s07zg4TUgAmTTqSyqp64j9Qbgdde2tTHUPjmOXXOpL5PvvT6xOu6dTwq5TwwqdsyVLh5T/cnYzqqXaZZzv6iWi1qajbLElf1r7bPquF2KCa0n2ZdxcYBH78bvIIuD7kGfmJDSA5a+1cgHJYZVer7MvYFf2id6H617wKBgQCIoqlgvYzTVDdXevI5LcOr1CfsBsuXoUdc8aUyFa1D6rj41wHXonqtmr/3tlo03HbUAQT0u/CjMf8raoW/2D1Sv7EnL3udb51qzYYj082x0DNUAs9CQq+AO8qhs8h4sXJGki7rjtJUtOfs1VFg84I5Z7IT9xKQMvsp2gmErpTGFQKBgQDIQYBxWEmZqjl9FKUDFjvVSVDULmdFhEEN12EJpbokeYbE9XXJS13Vm74IxGOtP1ZarGwSXAtfH8/NFyT3wQ0+6GK1GY5nPmsd/2f+otd58LImJdKB5kfNUaJboT9aoqVxDYQnEP4aruIbgDfPbN/tQXes0PGgf9AZT/55zVkwpQKBgFD9kkbctKADuHYrU28fOHAe5rcaZA3yNHncZt5kSPsMJC6kS9xE3FERfJ7ZwWi6Edmi7QwgZwhlN2rFzpgkFl15cQnYNH7izT2kq9GK18+BqRswOyh8nMj3KCpnhfo8vI8mUZehZf196kfRPlaooNVkKQN6nc9J2OU68A9s6JTtAoGBAOTabPjBoxWeNQwF2pR4E5SfXaMBKC7a6/+AMn9oUb9lvTPZtxXkIZkvn5iRz2UmrygLw4UCWKC3T7ujFIO0lHWktzVv2qPbINbfW10p0S/ioFvNxzP+ZDfSFrN03Zoh05H+0NXj1e4REMtIrbx5R+sJn6CVftpYfFcQd/lXy8MR";
private final static String APP_CERT_PATH = "/home/project/oil/cert/alipay/appCertPublicKey_2021004149636316.crt";
private final static String ALIPAY_CERT_PATH = "/home/project/oil/cert/alipay/alipayCertPublicKey_RSA2.crt";
private final static String ALIPAY_ROOT_CERT_PATH = "/home/project/oil/cert/alipay/alipayRootCert.crt";
/**
* 初始化客户端请求
* @return
*/
public static AlipayClient initClient() throws Exception {
AlipayConfig alipayConfig = new AlipayConfig();
// 设置网关地址
alipayConfig.setServerUrl(serverUrl);
// 设置应用APPID
alipayConfig.setAppId(appId);
// 设置应用私钥
alipayConfig.setPrivateKey(APP_PRIVATE_KEY);
// 设置应用公钥证书路径
alipayConfig.setAppCertPath(APP_CERT_PATH);
// 设置支付宝公钥证书路径
alipayConfig.setAlipayPublicCertPath(ALIPAY_CERT_PATH);
// 设置支付宝根证书路径
alipayConfig.setRootCertPath(ALIPAY_ROOT_CERT_PATH);
// 设置请求格式,固定值json
alipayConfig.setFormat("json");
// 设置字符集
alipayConfig.setCharset("utf-8");
// 设置签名类型
alipayConfig.setSignType("RSA2");
return new DefaultAlipayClient(alipayConfig);
}
}

@ -0,0 +1,26 @@
package com.hfkj.platform.aliyun.config;
import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.teaopenapi.models.Config;
/**
* @className: AliyunConfig
* @author: HuRui
* @date: 2024/11/1
**/
public class AliyunConfig {
/**
* 构建客户端
* @return
* @throws Exception
*/
public static Client createClient() throws Exception {
Config config = new Config()
.setAccessKeyId("LTAI5tHpe3pnXx6CKLaHkq16")
.setAccessKeySecret("rPN29MiECptHl3IhHVWl4fR8KJYhXj");
// 配置 Endpoint
config.endpoint = "dysmsapi.aliyuncs.com";
return new Client(config);
}
}

@ -18,6 +18,7 @@ import com.hfkj.sysenum.user.UserAccountRecordSourceTypeEnum;
import com.hfkj.sysenum.user.UserAccountRecordTypeEnum;
import com.hfkj.sysenum.user.UserGradeEnum;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@ -302,8 +303,49 @@ public class BsCornucopiaPoolServiceImpl implements BsCornucopiaPoolService {
@Override
public void cornucopiaLottery() throws Exception {
// 创建Random对象
Random random = new Random();
// 生成1或2之间的随机整数
int randomNumber = random.nextInt(2) + 1;
// 查询聚宝盆配置参数
List<BsCornucopiaConfig> cornucopiaConfigList = cornucopiaConfigService.queryAllList(new HashMap<>());
List<BsCornucopiaConfig> cornucopiaConfigS = cornucopiaConfigService.queryAllList(new HashMap<>());
// 高收益
BsCornucopiaConfig configHigh = cornucopiaConfigS.stream().filter(s->s.getType().equals(1)).findFirst().orElse(null);
// 低收益
BsCornucopiaConfig configLow = cornucopiaConfigS.stream().filter(s->s.getType().equals(2)).findFirst().orElse(null);
// 初始化金玉聚宝盆
List<BsCornucopiaConfig> cornucopiaConfigList = new ArrayList<>();
// 1:金聚宝盆 2:玉聚宝盆
for (BsCornucopiaConfig cornucopiaConfig : cornucopiaConfigS) {
BsCornucopiaConfig config = new BsCornucopiaConfig();
BeanUtils.copyProperties(cornucopiaConfig , config);
cornucopiaConfigList.add(config);
}
// 开出金
if (randomNumber == 1) {
if (configHigh != null && configLow != null) {
cornucopiaConfigList.get(0).setProportion(configHigh.getProportion());
cornucopiaConfigList.get(1).setProportion(configLow.getProportion());
cornucopiaConfigList.get(0).setName("金聚宝盆");
cornucopiaConfigList.get(1).setName("玉聚宝盆");
}
}
// 开出玉
if (randomNumber == 2) {
if (configHigh != null && configLow != null) {
cornucopiaConfigList.get(1).setProportion(configHigh.getProportion());
cornucopiaConfigList.get(0).setProportion(configLow.getProportion());
cornucopiaConfigList.get(1).setName("玉聚宝盆");
cornucopiaConfigList.get(0).setName("金聚宝盆");
}
}
if (cornucopiaConfigList.isEmpty()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "啊偶~没有配置参数!");
}

@ -2,28 +2,20 @@ package com.hfkj.service.elm;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.TaoBaoUtil;
import com.hfkj.service.taobao.TaoBaoService;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.AlibabaAlscUnionElemePromotionOfficialactivityGetRequest;
import com.taobao.api.request.AlibabaAlscUnionKbcpxPositiveOrderGetRequest;
import com.taobao.api.request.AlibabaAlscUnionMediaZoneAddRequest;
import com.taobao.api.response.AlibabaAlscUnionElemePromotionOfficialactivityGetResponse;
import com.taobao.api.response.AlibabaAlscUnionKbcpxPositiveOrderGetResponse;
import com.taobao.api.response.AlibabaAlscUnionMediaZoneAddResponse;
import com.taobao.top.DefaultTopApiClient;
import com.taobao.top.TopApiClient;
import com.taobao.top.ability375.Ability375;
import com.taobao.top.ability375.request.TaobaoTbkTpwdCreateRequest;
import com.taobao.top.ability375.response.TaobaoTbkTpwdCreateResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class ElmService {
@ -33,10 +25,9 @@ public class ElmService {
private static String appKey = "34818013";
private static String appsecret = "822a2df4166dbab7e0acfc42ba0aab75";
private static String url = "https://gw.api.taobao.com/router/rest";
private static String pid = "alsc_28560886_9016007_22442020";
// 本地联盟饿了么推广官方活动查询
public static JSONObject officialactivity(Long userId , String activityId) throws Exception {
public static JSONObject officialactivity(Long userId , String activityId , String pid) throws Exception {
// 打印日志,开始本地联盟饿了么推广官方活动查询
log.info("============ 本地联盟饿了么推广官方活动查询-START =============");
@ -72,7 +63,37 @@ public class ElmService {
}
public static JSONObject mediaZoneAdd(String sessionKey) throws Exception {
public static AlibabaAlscUnionKbcpxPositiveOrderGetResponse elmOrderList(String startTime , String endTime) throws Exception {
// 打印日志, 本地生活媒体推广位创建
log.info("============ 本地生活媒体推广位创建-START =============");
// 创建淘宝客户端
TaobaoClient client = new DefaultTaobaoClient(url, appKey, appsecret);
AlibabaAlscUnionKbcpxPositiveOrderGetRequest req = new AlibabaAlscUnionKbcpxPositiveOrderGetRequest();
req.setDateType(1L);
req.setEndDate(endTime);
req.setBizUnit(2L);
req.setPageSize(50L);
req.setPageNumber(1L);
req.setStartDate(startTime);
req.setIncludeUsedStoreId(false);
AlibabaAlscUnionKbcpxPositiveOrderGetResponse rsp = client.execute(req);
// 打印日志,请求接口
log.info("请求接口:" + "officialactivity");
// 打印日志,请求参数
log.info("请求参数:" + JSONObject.toJSONString(req));
// 打印日志,响应参数
log.info("响应参数:" + rsp);
// 打印日志, 本地生活媒体推广位创建
log.info("============ 本地生活媒体推广位创建--END ==============");
// 返回响应参数
return rsp;
}
public static AlibabaAlscUnionMediaZoneAddResponse mediaZone(String phone) throws Exception {
// 打印日志, 本地生活媒体推广位创建
log.info("============ 本地生活媒体推广位创建-START =============");
@ -80,9 +101,8 @@ public class ElmService {
// 创建淘宝客户端
TaobaoClient client = new DefaultTaobaoClient(url, appKey, appsecret);
AlibabaAlscUnionMediaZoneAddRequest req = new AlibabaAlscUnionMediaZoneAddRequest();
req.setZoneName("推广位");
req.setMediaId("1");
AlibabaAlscUnionMediaZoneAddResponse rsp = client.execute(req, sessionKey);
req.setZoneName(phone);
AlibabaAlscUnionMediaZoneAddResponse rsp = client.execute(req);
// 打印日志,请求接口
log.info("请求接口:" + "officialactivity");
@ -93,7 +113,7 @@ public class ElmService {
// 打印日志, 本地生活媒体推广位创建
log.info("============ 本地生活媒体推广位创建--END ==============");
// 返回响应参数
return JSONObject.parseObject(JSON.toJSONString(rsp));
return rsp;
}
}

@ -54,6 +54,8 @@ public class GoodsDataServiceImpl implements GoodsDataService {
JSONObject income_info = publish_info.getJSONObject("income_info");
JSONArray final_promotion_path_list = price_promotion_info.getJSONArray("final_promotion_path_list");
goodsModel.setItemId(object.getString("item_id"));
// 淘客推广信息
// 商品佣金信息
incomeInfoModel = new IncomeInfoModel();

@ -10,6 +10,8 @@ import com.hfkj.config.CommonSysConst;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
public class MeiTuanService {
private static Logger log = LoggerFactory.getLogger(MeiTuanService.class);
@ -42,7 +44,16 @@ public class MeiTuanService {
* @Date: 2024/10/23 上午10:42
*/
public static JSONObject orderList(JSONObject param)throws Exception {
JSONObject object = request("order" , param);
param.put("actId" , 33);
param.put("page" , "1");
param.put("limit" , "100");
param.put("ts" , String.valueOf( new Date().getTime()/1000));
return request("orderList" , param);
}
public static JSONObject miniCode(JSONObject param)throws Exception {
JSONObject object = request("miniCode" , param);
if (object.getInteger("status").equals(0)) {
return object;

@ -67,8 +67,14 @@ public interface BsOrderService {
* @Author: Sum1Dream
* @Date: 2024/10/23 上午10:27
*/
JSONObject getOrderList(String startTime) throws Exception;
void getOrderPddList(String startTime , String endTime);
void getOrderTaoBaoList(String startTime , String endTime);
void getOrderMeiTuanList(String startTime , String endTime);
void getOrderElmList(String startTime , String endTime);
/**
* @MethodName getOrderListParent
* @Description: 获取订单

@ -1,6 +1,7 @@
package com.hfkj.service.order.Impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
@ -15,17 +16,25 @@ import com.hfkj.entity.BsOrderExample;
import com.hfkj.entity.BsUser;
import com.hfkj.model.BsOrderModel;
import com.hfkj.model.UserTeamModel;
import com.hfkj.service.elm.ElmService;
import com.hfkj.service.meituan.MeiTuanService;
import com.hfkj.service.message.BsMessageService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.OrderBusinessService;
import com.hfkj.service.pdd.PddService;
import com.hfkj.service.promotion.PromotionBusinessService;
import com.hfkj.service.sec.SecDictionaryService;
import com.hfkj.service.taobao.TaoBaoService;
import com.hfkj.service.user.BsUserContributeService;
import com.hfkj.service.user.BsUserParentRelService;
import com.hfkj.service.user.BsUserService;
import com.hfkj.sysenum.message.MessageTypeEnum;
import com.hfkj.sysenum.partner.PartnerEnum;
import com.hfkj.sysenum.user.UserAccountRecordSourceTypeEnum;
import com.pdd.pop.sdk.http.api.pop.response.PddDdkOrderListRangeGetResponse;
import com.taobao.api.response.AlibabaAlscUnionKbcpxPositiveOrderGetResponse;
import com.taobao.top.ability414.domain.TaobaoTbkOrderDetailsGetPublisherOrderDto;
import com.taobao.top.ability414.response.TaobaoTbkOrderDetailsGetResponse;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
@ -35,6 +44,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -62,14 +73,28 @@ public class BsOrderServiceImpl implements BsOrderService {
@Resource
private BsUserService userService;
@Resource
private BsMessageService bsMessageService;
@Override
public void create(BsOrder order) {
// 推送订单消息
bsMessageService.createUserMsg(MessageTypeEnum.type2 ,order.getUserId() , "创建订单" , "创建订单" + order.getGoodsName() + "成功");
bsOrderMapper.insert(order);
}
@Override
public BsOrder editData(BsOrder order) {
if (order.getStatus() == 1) {
// 推送订单消息
bsMessageService.createUserMsg(MessageTypeEnum.type2 ,order.getUserId() , "购买订单" , "下单" + order.getGoodsName() + "成功");
}
if (order.getStatus() == 2) {
// 推送订单消息
bsMessageService.createUserMsg(MessageTypeEnum.type2 ,order.getUserId() , "商品收货" , order.getGoodsName() + "收货成功");
}
bsOrderMapper.updateByPrimaryKey(order);
// 删除缓存
cacheDelete(order.getOrderNo());
@ -145,12 +170,43 @@ public class BsOrderServiceImpl implements BsOrderService {
}
@Override
public JSONObject getOrderList(String startTime) throws Exception{
public void getOrderPddList(String startTime , String endTime) {
try {
pddOrder(startTime , endTime);
} catch (Exception e) {
System.out.println(e.getMessage());
}
pddOrder(startTime);
return null;
}
@Override
public void getOrderTaoBaoList(String startTime , String endTime) {
try {
taoBaoOrder(startTime , endTime);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
@Override
public void getOrderMeiTuanList(String startTime, String endTime) {
try {
meiTuanOrder(startTime , endTime);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
@Override
public void getOrderElmList(String startTime, String endTime) {
try {
elmOrder(startTime , endTime);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
@Override
public List<BsOrderModel> getOrderListParent(Map<String, Object> map) {
@ -176,6 +232,18 @@ public class BsOrderServiceImpl implements BsOrderService {
orderModel.setGold(order.getPromotionAmount().multiply(goldCoinExchangeRate));
// 将订单模型添加到订单模型列表中
orderModels.add(orderModel);
if (order.getType() == 1) {
// 根据订单查询淘宝订单
getOrderTaoBaoList(DateUtil.format( new Date(new Date().getTime() - 300000) , DateUtil.Y_M_D_HMS) , DateUtil.format( new Date(new Date().getTime() + 300000) , DateUtil.Y_M_D_HMS));
}
if (order.getType() == 2) {
// 根据订单查询拼多多订单
getOrderPddList(DateUtil.format( new Date(new Date().getTime() - 300000) , DateUtil.Y_M_D_HMS) , DateUtil.format( new Date(new Date().getTime() + 300000) , DateUtil.Y_M_D_HMS));
}
if (order.getType() == 3) {
getOrderMeiTuanList( String.valueOf(new Date().getTime()/1000 - 300) , String.valueOf(new Date().getTime()/1000 + 300));
}
}
return orderModels;
}
@ -203,38 +271,37 @@ public class BsOrderServiceImpl implements BsOrderService {
}
return orderModels;
}
return null;
}
@Override
public void orderRebate(BsOrder bsOrder) throws Exception {
// 判断订单状态是否为4或5
if (bsOrder.getStatus().equals(4) || bsOrder.getStatus().equals(5)) {
// 如果是,则抛出异常,提示订单状态不可返利
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态不可返利");
public void orderRebate(BsOrder bsOrder){
try {
Map<String,Object> otherParam = new HashMap<>();
otherParam.put("sourceId", bsOrder.getId());
otherParam.put("sourceOrderNo", bsOrder.getOrderNo());
userContributeService.purchase(bsOrder.getPromotionAmount(), bsOrder.getUserId(), otherParam);
// 推送订单消息
bsMessageService.createUserMsg(MessageTypeEnum.type2 ,bsOrder.getUserId() , "订单返利" , "购买商品" + bsOrder.getGoodsName() + "返利成功");
bsOrder.setStatus(3);
bsOrder.setUpdateTime(new Date());
bsOrder.setFinishTime(new Date());
editData(bsOrder);
} catch (Exception e) {
System.out.println(e);
}
Map<String,Object> otherParam = new HashMap<>();
otherParam.put("sourceId", bsOrder.getId());
otherParam.put("sourceOrderNo", bsOrder.getOrderNo());
userContributeService.purchase(bsOrder.getPromotionAmount(), bsOrder.getUserId(), otherParam);
bsOrder.setStatus(8);
bsOrder.setUpdateTime(new Date());
bsOrder.setFinishTime(new Date());
editData(bsOrder);
}
}
// 根据开始时间获取拼多多订单列表
private void pddOrder(String startTime) throws Exception{
private void pddOrder(String startTime , String endTime) throws Exception{
// 调用PddService的getOrderList方法获取订单列表
PddDdkOrderListRangeGetResponse rangeGetResponse = PddService.getOrderList(startTime);
PddDdkOrderListRangeGetResponse rangeGetResponse = PddService.getOrderList(startTime , endTime);
// 调用getOrderList方法获取本地订单列表
List<BsOrder> list = getOrderList(new HashMap<>());
List<BsUser> userList = userService.getList(new HashMap<>());
// 判断rangeGetResponse是否为空
if (rangeGetResponse != null) {
// 获取订单列表
@ -264,49 +331,377 @@ public class BsOrderServiceImpl implements BsOrderService {
// 根据订单号获取BsOrder对象
BsOrder bsOrder = list.stream().filter(s->s.getOrderNo().equals(orderListItem.getOrderSn())).findFirst().orElse(null);
// 根据uid获取BsUser对象
BsUser user = userService.getUser(uid);
BsUser user = userList.stream().filter(s->s.getId().equals(Long.valueOf(uid))).findFirst().orElse(null);
if (bsOrder == null) {
// 如果BsOrder对象为空,则创建新的BsOrder对象
bsOrder = new BsOrder();
bsOrder.setOrderNo(orderListItem.getOrderSn());
bsOrder.setUserId(Long.valueOf(uid));
bsOrder.setUserPhone(user.getPhone());
if (user != null) {
bsOrder.setUserPhone(user.getPhone() == null ? "" : user.getPhone());
}
bsOrder.setCreateTime(new Date());
bsOrder.setUpdateTime(new Date());
bsOrder.setStatus(orderListItem.getOrderStatus());
bsOrder.setStatus(pddStatus(Long.valueOf(orderListItem.getOrderStatus())));
bsOrder.setImg(orderListItem.getGoodsThumbnailUrl());
bsOrder.setType(2);
bsOrder.setGoodsName(orderListItem.getGoodsName());
bsOrder.setGoodsCount(Math.toIntExact(orderListItem.getGoodsQuantity()));
bsOrder.setCustomparameters(orderListItem.getCustomParameters());
bsOrder.setTotalPrice(BigDecimal.valueOf(orderListItem.getOrderAmount()));
bsOrder.setPromotionAmount(BigDecimal.valueOf(orderListItem.getPromotionAmount()));
bsOrder.setPayTime(DateUtil.long2Date(orderListItem.getOrderPayTime()));
bsOrder.setCreateTime(DateUtil.long2Date(orderListItem.getOrderCreateTime()));
bsOrder.setFinishTime(DateUtil.long2Date(orderListItem.getOrderSettleTime()));
bsOrder.setRefundTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()));
bsOrder.setCancelTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()));
bsOrder.setTotalPrice(BigDecimal.valueOf(orderListItem.getOrderAmount()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP));
bsOrder.setPromotionAmount(BigDecimal.valueOf(orderListItem.getPromotionAmount()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP));
if (orderListItem.getOrderPayTime() != null) {
bsOrder.setPayTime(DateUtil.long2Date(orderListItem.getOrderPayTime()*1000));
}
if (orderListItem.getOrderCreateTime() != null) {
bsOrder.setCreateTime(DateUtil.long2Date(orderListItem.getOrderCreateTime()*1000));
}
if (orderListItem.getOrderSettleTime() != null) {
bsOrder.setFinishTime(DateUtil.long2Date(orderListItem.getOrderSettleTime()*1000));
}
if (bsOrder.getStatus().equals(4)) {
if (orderListItem.getOrderModifyAt() != null) {
bsOrder.setCancelTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000));
}
}
create(bsOrder);
}else {
// 如果BsOrder对象不为空,则更新BsOrder对象
if (bsOrder.getStatus() == 2) {
// 如果BsOrder对象不为空,则更新BsOrder对象
bsOrder.setUpdateTime(new Date());
bsOrder.setStatus(orderListItem.getOrderStatus());
bsOrder.setImg(orderListItem.getGoodsThumbnailUrl());
bsOrder.setType(2);
bsOrder.setGoodsName(orderListItem.getGoodsName());
bsOrder.setGoodsCount(Math.toIntExact(orderListItem.getGoodsQuantity()));
bsOrder.setCustomparameters(orderListItem.getCustomParameters());
bsOrder.setTotalPrice(BigDecimal.valueOf(orderListItem.getOrderAmount()).divide(new BigDecimal(100), 6, RoundingMode.HALF_UP));
bsOrder.setPromotionAmount(BigDecimal.valueOf(orderListItem.getPromotionAmount()).divide(new BigDecimal(100), 6, RoundingMode.HALF_UP));
if (orderListItem.getOrderPayTime() != null) {
bsOrder.setPayTime(DateUtil.long2Date(orderListItem.getOrderPayTime()*1000));
}
if (orderListItem.getOrderCreateTime() != null) {
bsOrder.setCreateTime(DateUtil.long2Date(orderListItem.getOrderCreateTime()*1000));
}
if (orderListItem.getOrderSettleTime() != null) {
bsOrder.setFinishTime(DateUtil.long2Date(orderListItem.getOrderSettleTime()*1000));
}
if (orderListItem.getOrderModifyAt() != null) {
bsOrder.setRefundTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000));
}
if (orderListItem.getOrderModifyAt() != null) {
bsOrder.setCancelTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000));
}
// 如果订单状态为5,则调用orderRebate方法
if (bsOrder.getStatus() == 2 && orderListItem.getOrderStatus().equals(5)){
orderRebate(bsOrder);
} else {
editData(bsOrder);
}
}
}
}
}
}
}
// 淘宝
private void taoBaoOrder(String startTime , String endTime) throws Exception {
// 调用TaoBaoService的getOrderList方法,获取淘宝订单列表
TaobaoTbkOrderDetailsGetResponse response = TaoBaoService.getOrderList(startTime , endTime);
// 调用getOrderList方法,获取本地订单列表
List<BsOrder> list = getOrderList(new HashMap<>());
// 创建一个Map,用于存储relationId
Map<String , Object> reMap = new HashMap<>();
reMap.put("relationId" , 1);
// 调用userService的getList方法,获取用户列表
List<BsUser> userList = userService.getList(reMap);
// 获取淘宝订单列表中的订单信息
List<TaobaoTbkOrderDetailsGetPublisherOrderDto> results = response.getData().getResults();
if (results != null && !results.isEmpty()) {
for (TaobaoTbkOrderDetailsGetPublisherOrderDto orderListItem : results) {
// 根据订单号,从本地订单列表中查找订单
BsOrder bsOrder = list.stream().filter(s->s.getOrderNo().equals(orderListItem.getTradeParentId())).findFirst().orElse(null);
// 根据relationId,从用户列表中查找用户
BsUser bsUser = userList.stream().filter(s->s.getRelationId().equals(orderListItem.getRelationId().toString())).findFirst().orElse(null);
// 如果本地订单列表中没有该订单,则创建一个新的订单
if (bsOrder == null) {
bsOrder = new BsOrder();
bsOrder.setOrderNo(orderListItem.getTradeParentId());
if (bsUser != null) {
bsOrder.setUserId(bsUser.getId());
bsOrder.setUserPhone(bsUser.getPhone() == null ? "" : bsUser.getPhone());
}
bsOrder.setCreateTime(new Date());
bsOrder.setUpdateTime(new Date());
bsOrder.setStatus(taoBaoStatus(orderListItem.getTkStatus()));
bsOrder.setImg("https://" + orderListItem.getItemImg());
bsOrder.setType(1);
bsOrder.setGoodsName(orderListItem.getItemTitle());
bsOrder.setGoodsCount(Math.toIntExact(orderListItem.getItemNum()));
bsOrder.setTotalPrice(new BigDecimal(orderListItem.getAlipayTotalPrice()));
if (bsOrder.getStatus().equals(5)) {
bsOrder.setPromotionAmount(new BigDecimal(orderListItem.getPubShareFeeForCommission()));
} else {
bsOrder.setPromotionAmount(new BigDecimal(orderListItem.getPubSharePreFeeForCommission()));
}
if (orderListItem.getTkPaidTime() != null) {
bsOrder.setPayTime(DateUtil.format(orderListItem.getTkPaidTime() , "yyyy-MM-dd HH:mm:ss"));
}
if (orderListItem.getTkCreateTime() != null) {
bsOrder.setCreateTime(DateUtil.format(orderListItem.getTkCreateTime() , "yyyy-MM-dd HH:mm:ss"));
}
if (orderListItem.getTkEarningTime() != null) {
bsOrder.setFinishTime(DateUtil.format(orderListItem.getTkEarningTime() , "yyyy-MM-dd HH:mm:ss"));
}
if (orderListItem.getModifiedTime() != null) {
bsOrder.setCancelTime(DateUtil.format(orderListItem.getModifiedTime() , "yyyy-MM-dd HH:mm:ss"));
}
// 调用create方法,将新订单保存到本地订单列表中
create(bsOrder);
} else {
// 如果本地订单列表中已有该订单,则更新订单信息
if (bsOrder.getStatus() == 2) {
bsOrder.setOrderNo(orderListItem.getTradeParentId());
bsOrder.setUpdateTime(new Date());
bsOrder.setStatus(orderListItem.getOrderStatus());
bsOrder.setImg(orderListItem.getGoodsThumbnailUrl());
bsOrder.setType(2);
bsOrder.setGoodsName(orderListItem.getGoodsName());
bsOrder.setGoodsCount(Math.toIntExact(orderListItem.getGoodsQuantity()));
bsOrder.setCustomparameters(orderListItem.getCustomParameters());
bsOrder.setTotalPrice(BigDecimal.valueOf(orderListItem.getOrderAmount()));
bsOrder.setPromotionAmount(BigDecimal.valueOf(orderListItem.getPromotionAmount()));
bsOrder.setPayTime(DateUtil.long2Date(orderListItem.getOrderPayTime()));
bsOrder.setCreateTime(DateUtil.long2Date(orderListItem.getOrderCreateTime()));
bsOrder.setFinishTime(DateUtil.long2Date(orderListItem.getOrderSettleTime()));
bsOrder.setRefundTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()));
bsOrder.setCancelTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()));
bsOrder.setStatus(taoBaoStatus(orderListItem.getTkStatus()));
bsOrder.setImg("https://" + orderListItem.getItemImg());
bsOrder.setType(1);
bsOrder.setGoodsName(orderListItem.getItemTitle());
bsOrder.setGoodsCount(Math.toIntExact(orderListItem.getItemNum()));
bsOrder.setTotalPrice(new BigDecimal(orderListItem.getAlipayTotalPrice()));
if (bsOrder.getStatus().equals(5)) {
bsOrder.setPromotionAmount(new BigDecimal(orderListItem.getPubShareFeeForCommission()));
} else {
bsOrder.setPromotionAmount(new BigDecimal(orderListItem.getPubSharePreFeeForCommission()));
}
if (orderListItem.getTkPaidTime() != null) {
bsOrder.setPayTime(DateUtil.format(orderListItem.getTkPaidTime() , "yyyy-MM-dd HH:mm:ss"));
}
if (orderListItem.getTkCreateTime() != null) {
bsOrder.setCreateTime(DateUtil.format(orderListItem.getTkCreateTime() , "yyyy-MM-dd HH:mm:ss"));
}
if (orderListItem.getTkEarningTime() != null) {
bsOrder.setFinishTime(DateUtil.format(orderListItem.getTkEarningTime() , "yyyy-MM-dd HH:mm:ss"));
}
if (orderListItem.getModifiedTime() != null) {
bsOrder.setCancelTime(DateUtil.format(orderListItem.getModifiedTime() , "yyyy-MM-dd HH:mm:ss"));
}
// 如果订单状态为5,则调用orderRebate方法
if (bsOrder.getStatus() == 2 && orderListItem.getTkStatus() == 3){
orderRebate(bsOrder);
} else {
// 否则,调用editData方法,更新订单信息
editData(bsOrder);
}
}
}
}
}
}
private void meiTuanOrder(String startTime , String endTime) throws Exception {
JSONObject jsonObject = new JSONObject();
jsonObject.put("startTime" , startTime);
jsonObject.put("endTime" , endTime);
JSONObject object = MeiTuanService.orderList(jsonObject);
JSONArray meiTuanOrder = object.getJSONArray("dataList");
List<BsOrder> list = getOrderList(new HashMap<>());
List<BsUser> userList = userService.getList(new HashMap<>());
if (meiTuanOrder != null && !meiTuanOrder.isEmpty()) {
for (int i = 0; i < meiTuanOrder.size(); i++) {
JSONObject meiTuan = meiTuanOrder.getJSONObject(i);
// 根据订单号,从本地订单列表中查找订单
BsOrder bsOrder = list.stream().filter(s->s.getOrderNo().equals(meiTuan.getString("orderid"))).findFirst().orElse(null);
// 根据relationId,从用户列表中查找用户
BsUser bsUser = userList.stream().filter(s->s.getId().equals(meiTuan.getLong("sid"))).findFirst().orElse(null);
// 如果本地订单列表中没有该订单,则创建一个新的订单
if (bsOrder == null) {
bsOrder = new BsOrder();
bsOrder.setOrderNo(meiTuan.getString("orderid"));
if (bsUser != null) {
bsOrder.setUserId(bsUser.getId());
bsOrder.setUserPhone(bsUser.getPhone() == null ? "" : bsUser.getPhone());
}
bsOrder.setCreateTime(new Date());
bsOrder.setUpdateTime(new Date());
bsOrder.setStatus(meiTuanStatus(meiTuan.getLong("status")));
bsOrder.setType(3);
bsOrder.setGoodsName(meiTuan.getString("smstitle"));
bsOrder.setGoodsCount(1);
bsOrder.setTotalPrice(meiTuan.getBigDecimal("payprice"));
bsOrder.setPromotionAmount(meiTuan.getBigDecimal("profit"));
if (meiTuan.getLong("paytime") != null) {
bsOrder.setPayTime(DateUtil.long2Date(meiTuan.getLong("paytime")*1000));
bsOrder.setCreateTime(DateUtil.long2Date(meiTuan.getLong("paytime")*1000));
}
if (meiTuan.getLong("modTime") != null) {
bsOrder.setFinishTime(DateUtil.long2Date(meiTuan.getLong("modTime")*1000));
}
if (meiTuan.getLong("refundtime") != null) {
bsOrder.setRefundTime(DateUtil.long2Date(meiTuan.getLong("refundtime")*1000));
bsOrder.setCancelTime(DateUtil.long2Date(meiTuan.getLong("refundtime")*1000));
}
// 调用create方法,将新订单保存到本地订单列表中
create(bsOrder);
} else {
// 如果本地订单列表中已有该订单,则更新订单信息
if (bsOrder.getStatus() == 2) {
bsOrder.setOrderNo(meiTuan.getString("orderid"));
if (bsUser != null) {
bsOrder.setUserId(bsUser.getId());
bsOrder.setUserPhone(bsUser.getPhone() == null ? "" : bsUser.getPhone());
}
bsOrder.setCreateTime(new Date());
bsOrder.setUpdateTime(new Date());
bsOrder.setStatus(meiTuanStatus(meiTuan.getLong("status")));
bsOrder.setType(3);
bsOrder.setGoodsName(meiTuan.getString("smstitle"));
bsOrder.setGoodsCount(1);
bsOrder.setTotalPrice(meiTuan.getBigDecimal("payprice"));
bsOrder.setPromotionAmount(meiTuan.getBigDecimal("profit"));
if (meiTuan.getLong("paytime") != null) {
bsOrder.setPayTime(DateUtil.long2Date(meiTuan.getLong("paytime")*1000));
bsOrder.setCreateTime(DateUtil.long2Date(meiTuan.getLong("paytime")*1000));
}
if (meiTuan.getLong("modTime") != null) {
bsOrder.setFinishTime(DateUtil.long2Date(meiTuan.getLong("modTime")*1000));
}
if (meiTuan.getLong("refundtime") != null) {
bsOrder.setRefundTime(DateUtil.long2Date(meiTuan.getLong("refundtime")*1000));
bsOrder.setCancelTime(DateUtil.long2Date(meiTuan.getLong("refundtime")*1000));
}
// 如果订单状态为5,则调用orderRebate方法
if (bsOrder.getStatus() == 2 && meiTuan.getInteger("status") == 8){
orderRebate(bsOrder);
} else {
// 否则,调用editData方法,更新订单信息
editData(bsOrder);
}
}
}
}
}
}
private void elmOrder(String startTime , String endTime) throws Exception {
AlibabaAlscUnionKbcpxPositiveOrderGetResponse elmOrderList = ElmService.elmOrderList(startTime ,endTime);
List<AlibabaAlscUnionKbcpxPositiveOrderGetResponse.OrderDetailReportDTO> elmOrderListResult = elmOrderList.getResult();
List<BsOrder> list = getOrderList(new HashMap<>());
List<BsUser> userList = userService.getList(new HashMap<>());
userList = userList.stream().filter(s->s.getElmPid() != null).collect(Collectors.toList());
if (elmOrderListResult != null && !elmOrderListResult.isEmpty()) {
for (AlibabaAlscUnionKbcpxPositiveOrderGetResponse.OrderDetailReportDTO elmOrder : elmOrderListResult) {
// 根据订单号,从本地订单列表中查找订单
BsOrder bsOrder = list.stream().filter(s->s.getOrderNo().equals(elmOrder.getBizOrderId().toString())).findFirst().orElse(null);
// 根据relationId,从用户列表中查找用户
BsUser bsUser = userList.stream().filter(s->s.getElmPid().equals(elmOrder.getPid())).findFirst().orElse(null);
// 如果本地订单列表中没有该订单,则创建一个新的订单
if (bsOrder == null) {
bsOrder = new BsOrder();
bsOrder.setOrderNo(elmOrder.getBizOrderId().toString());
if (bsUser != null) {
bsOrder.setUserId(bsUser.getId());
bsOrder.setUserPhone(bsUser.getPhone() == null ? "" : bsUser.getPhone());
}
bsOrder.setCreateTime(new Date());
bsOrder.setUpdateTime(new Date());
bsOrder.setStatus(elmStatus(elmOrder.getOrderState()));
bsOrder.setType(4);
bsOrder.setGoodsName(elmOrder.getTitle());
bsOrder.setGoodsCount(1);
bsOrder.setTotalPrice(new BigDecimal(elmOrder.getPayAmount()));
bsOrder.setPromotionAmount(new BigDecimal(elmOrder.getSettleAmount()));
if (elmOrder.getTkCreateTime() != null) {
bsOrder.setCreateTime(DateUtil.format(elmOrder.getTkCreateTime() , DateUtil.Y_M_D_HMS));
}
if (elmOrder.getPayTime() != null) {
bsOrder.setPayTime(DateUtil.format(elmOrder.getPayTime() , DateUtil.Y_M_D_HMS));
}
if (elmOrder.getSettleTime() != null) {
bsOrder.setFinishTime(DateUtil.format(elmOrder.getSettleTime() , DateUtil.Y_M_D_HMS));
}
// 调用create方法,将新订单保存到本地订单列表中
create(bsOrder);
} else {
// 如果本地订单列表中已有该订单,则更新订单信息
if (bsOrder.getStatus() == 2) {
bsOrder.setOrderNo(elmOrder.getBizOrderId().toString());
if (bsUser != null) {
bsOrder.setUserId(bsUser.getId());
bsOrder.setUserPhone(bsUser.getPhone() == null ? "" : bsUser.getPhone());
}
bsOrder.setCreateTime(new Date());
bsOrder.setUpdateTime(new Date());
bsOrder.setStatus(elmStatus(elmOrder.getOrderState()));
bsOrder.setType(4);
bsOrder.setGoodsName(elmOrder.getTitle());
bsOrder.setGoodsCount(1);
bsOrder.setTotalPrice(new BigDecimal(elmOrder.getPayAmount()));
bsOrder.setPromotionAmount(new BigDecimal(elmOrder.getSettleAmount()));
if (elmOrder.getTkCreateTime() != null) {
bsOrder.setCreateTime(DateUtil.format(elmOrder.getTkCreateTime() , DateUtil.Y_M_D_HMS));
}
if (elmOrder.getPayTime() != null) {
bsOrder.setPayTime(DateUtil.format(elmOrder.getPayTime() , DateUtil.Y_M_D_HMS));
}
if (elmOrder.getSettleTime() != null) {
bsOrder.setFinishTime(DateUtil.format(elmOrder.getSettleTime() , DateUtil.Y_M_D_HMS));
}
// 如果订单状态为5,则调用orderRebate方法
if (bsOrder.getStatus() == 5){
if (bsOrder.getStatus() == 2 && elmOrder.getOrderState() == 4){
orderRebate(bsOrder);
} else {
// 否则,调用editData方法,更新订单信息
editData(bsOrder);
}
@ -314,9 +709,69 @@ public class BsOrderServiceImpl implements BsOrderService {
}
}
}
}
private Integer pddStatus(Long status) {
int result = 4;
if (status == 0) {
result = 1;
} else if (status == 1) {
result = 1;
} else if (status == 2) {
result = 2;
} else if (status == 3) {
result = 2;
} else if (status == 4) {
result = 4;
} else if (status == 5) {
result = 2;
}
return result;
}
// 1 已下单 2 已收货 3 已结算 4 已失效
private Integer taoBaoStatus(Long status) {
int result = 4;
if (status == 3) {
result = 2;
} else if (status == 12) {
result = 1;
} else if (status == 13) {
result = 4;
} else if (status == 14) {
result = 2;
}
return result;
}
private Integer meiTuanStatus(Long status) {
int result = 4;
if (status == 1) {
result = 1;
} else if (status == 8) {
result = 2;
} else if (status == 9) {
result = 4;
}
return result;
}
private Integer elmStatus(Long status) {
int result = 4;
if (status == 1) {
result = 1;
} else if (status == 0) {
result = 4;
} else if (status == 2) {
result = 2;
} else if (status == 4) {
result = 2;
}
return result;
}
}

@ -168,7 +168,7 @@ public class PddService {
* @Author: Sum1Dream
* @Date: 2024/10/23 上午10:27
*/
public static PddDdkOrderListRangeGetResponse getOrderList(String startTime) throws Exception {
public static PddDdkOrderListRangeGetResponse getOrderList(String startTime , String endTime) throws Exception {
log.info("============ 拼多多请求-START =============");
String clientId = "71a050c5d93d4169a237539af44c7c33";
@ -179,7 +179,7 @@ public class PddService {
request.setStartTime(startTime);
request.setPageSize(300);
request.setQueryOrderType(1);
request.setEndTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
request.setEndTime(endTime);
PddDdkOrderListRangeGetResponse response = client.syncInvoke(request);
log.info("请求接口:" + "authority");

@ -27,7 +27,7 @@ public class PromotionBusinessService {
// 淘口令生成业务
public JSONObject taobaoUrl(JSONObject jsonObject) throws Exception{
JSONObject object = TaoBaoService.createCommand(jsonObject.getString("url"));
JSONObject object = TaoBaoService.generalLink(jsonObject.getString("itemId"), jsonObject.getString("url"), jsonObject.getString("relationId"));
if (!object.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
}

@ -5,6 +5,9 @@ import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.entity.BsUser;
import com.hfkj.service.user.BsUserService;
import com.taobao.top.DefaultTopApiClient;
import com.taobao.top.TopApiClient;
import com.taobao.top.ability304.Ability304;
@ -13,19 +16,33 @@ import com.taobao.top.ability304.response.TaobaoTopAuthTokenCreateResponse;
import com.taobao.top.ability375.Ability375;
import com.taobao.top.ability375.request.TaobaoTbkTpwdCreateRequest;
import com.taobao.top.ability375.response.TaobaoTbkTpwdCreateResponse;
import com.taobao.top.ability414.Ability414;
import com.taobao.top.ability414.request.TaobaoTbkOrderDetailsGetRequest;
import com.taobao.top.ability414.response.TaobaoTbkOrderDetailsGetResponse;
import com.taobao.top.ability425.Ability425;
import com.taobao.top.ability425.request.TaobaoTbkScPublisherInfoGetRequest;
import com.taobao.top.ability425.request.TaobaoTbkScPublisherInfoSaveRequest;
import com.taobao.top.ability425.response.TaobaoTbkScPublisherInfoGetResponse;
import com.taobao.top.ability425.response.TaobaoTbkScPublisherInfoSaveResponse;
import com.taobao.top.defaultability.Defaultability;
import com.taobao.top.defaultability.domain.TaobaoTbkOptimusTouMaterialIdsGetMaterialQuery;
import com.taobao.top.defaultability.domain.*;
import com.taobao.top.defaultability.request.TaobaoTbkDgGeneralLinkConvertRequest;
import com.taobao.top.defaultability.request.TaobaoTbkDgMaterialOptionalUpgradeRequest;
import com.taobao.top.defaultability.response.TaobaoTbkDgGeneralLinkConvertResponse;
import com.taobao.top.defaultability.response.TaobaoTbkDgMaterialOptionalUpgradeResponse;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import javax.xml.crypto.Data;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class TaoBaoService {
@ -37,6 +54,9 @@ public class TaoBaoService {
private static String appsecret = "f04baedca9cd794665dfa04a2fcbfd86";
private static String url = "https://eco.taobao.com/router/rest";
@Resource
private BsUserService userService;
/**
* @MethodName material
* @Description:淘宝客-推广者-物料id列表查询
@ -47,10 +67,11 @@ public class TaoBaoService {
* @Author: Sum1Dream
* @Date: 2024/9/10 下午1:52
*/
public static JSONObject material(String title , Long pageNo , Long pageSize) throws Exception {
public static JSONObject material(String title , Long pageNo , Long pageSize ) throws Exception {
if (StringUtils.isBlank(title)) {
title = "百货";
}
log.info("============ 淘宝客-推广者-物料id列表查询-START =============");
TopApiClient client = new DefaultTopApiClient(appKey,appsecret,url);
Defaultability apiPackage = new Defaultability(client);
@ -120,7 +141,7 @@ public class TaoBaoService {
* @Author: Sum1Dream
* @Date: 2024/9/23 上午11:40
*/
public static JSONObject publisher(String token) throws Exception {
public static JSONObject publisher(String token , String code) throws Exception {
log.info("============ 淘宝客-公用-私域用户备案-START =============");
TopApiClient client = new DefaultTopApiClient(appKey,appsecret,url);
@ -129,7 +150,7 @@ public class TaoBaoService {
// create request
TaobaoTbkScPublisherInfoSaveRequest request = new TaobaoTbkScPublisherInfoSaveRequest();
request.setInviterCode("JIIIVF");
request.setInviterCode(code);
request.setInfoType(1L);
request.setNote("元气");
@ -145,6 +166,7 @@ public class TaoBaoService {
return JSONObject.parseObject(JSON.toJSONString(response));
}
/**
* @MethodName getToken
* @Description:获取Access Token
@ -177,5 +199,106 @@ public class TaoBaoService {
}
public static JSONObject getPublisherInfo(String token , Long relationId , String specialId) throws Exception {
log.info("============ 淘宝客-公用-私域用户备案-START =============");
TopApiClient client = new DefaultTopApiClient(appKey,appsecret,url);
Ability425 apiPackage = new Ability425(client);
// create domain
// create request
TaobaoTbkScPublisherInfoGetRequest request = new TaobaoTbkScPublisherInfoGetRequest();
request.setInfoType(1L);
request.setRelationApp("common");
request.setRelationId(relationId);
request.setSpecialId(specialId);
request.setPageNo(0L);
request.setPageSize(10L);
TaobaoTbkScPublisherInfoGetResponse response = apiPackage.taobaoTbkScPublisherInfoGet(request,token);
log.info("请求接口:" + "taobaoTbkScPublisherInfoSave");
log.info("请求参数:" + JSONObject.toJSONString(request));
log.info("响应参数:" + response);
log.info("============ 淘宝客-公用-私域用户备案--END ==============");
if(!response.isSuccess()){
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getSubMsg());
}
return JSONObject.parseObject(JSON.toJSONString(response));
}
public static TaobaoTbkOrderDetailsGetResponse getOrderList(String startTime , String endTime) throws Exception {
log.info("============ 淘宝客-公用-私域用户备案-START =============");
TopApiClient client = new DefaultTopApiClient(appKey,appsecret,url);
Ability414 apiPackage = new Ability414(client);
// create request
TaobaoTbkOrderDetailsGetRequest request = new TaobaoTbkOrderDetailsGetRequest();
request.setQueryType(1L);
request.setPageSize(20L);
request.setStartTime(startTime);
request.setEndTime(endTime);
request.setJumpType(1L);
request.setPageNo(1L);
request.setOrderScene(2L);
TaobaoTbkOrderDetailsGetResponse response = apiPackage.taobaoTbkOrderDetailsGet(request);
log.info("请求接口:" + "taobaoTbkScPublisherInfoSave");
log.info("请求参数:" + JSONObject.toJSONString(request));
log.info("响应参数:" + response);
log.info("============ 淘宝客-公用-私域用户备案--END ==============");
if(!response.isSuccess()){
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getSubMsg());
}
return response;
}
public static JSONObject generalLink(String itemId , String clickUrl , String relationId) throws Exception {
log.info("============ 淘宝客-公用-私域用户备案-START =============");
TopApiClient client = new DefaultTopApiClient(appKey,appsecret,url);
Defaultability apiPackage = new Defaultability(client);
// create domain
TaobaoTbkDgGeneralLinkConvertTargetItemDTO taobaoTbkDgGeneralLinkConvertTargetItemDTO = new TaobaoTbkDgGeneralLinkConvertTargetItemDTO();
TaobaoTbkDgGeneralLinkConvertLkItemDTO taobaoTbkDgGeneralLinkConvertLkItemDTO = new TaobaoTbkDgGeneralLinkConvertLkItemDTO();
taobaoTbkDgGeneralLinkConvertLkItemDTO.setItemId(itemId);
TaobaoTbkDgGeneralLinkConvertLkMaterialDTO taobaoTbkDgGeneralLinkConvertLkMaterialDTO = new TaobaoTbkDgGeneralLinkConvertLkMaterialDTO();
taobaoTbkDgGeneralLinkConvertLkMaterialDTO.setMaterialUrl(clickUrl);
// create request
TaobaoTbkDgGeneralLinkConvertRequest request = new TaobaoTbkDgGeneralLinkConvertRequest();
request.setBizSceneId("1");
request.setPromotionType("2");
List<String> materialList = new ArrayList<>();
materialList.add(clickUrl);
request.setMaterialList(materialList);
request.setAdzoneId(115764450446L);
List<String> itemIdList = new ArrayList<>();
itemIdList.add(itemId);
request.setItemIdList(itemIdList);
taobaoTbkDgGeneralLinkConvertTargetItemDTO.setItemIdList(itemIdList); // xxx
request.setTargetItem(taobaoTbkDgGeneralLinkConvertTargetItemDTO);
List<TaobaoTbkDgGeneralLinkConvertLkMaterialDTO> materialDto = new ArrayList<>();
materialDto.add(taobaoTbkDgGeneralLinkConvertLkMaterialDTO);
request.setMaterialDto(materialDto);
request.setRelationId(relationId);
TaobaoTbkDgGeneralLinkConvertResponse response = apiPackage.taobaoTbkDgGeneralLinkConvert(request);
log.info("请求接口:" + "taobaoTbkScPublisherInfoSave");
log.info("请求参数:" + JSONObject.toJSONString(request));
log.info("响应参数:" + response);
log.info("============ 淘宝客-公用-私域用户备案--END ==============");
if(!response.isSuccess()){
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getSubMsg());
}
return JSONObject.parseObject(JSON.toJSONString(response));
}
}

@ -0,0 +1,35 @@
package com.hfkj.service.user;
import com.hfkj.entity.BsUserPlatformAuthorize;
import com.hfkj.sysenum.user.UserAuthorizePlatformEnum;
import java.util.List;
/**
* @className: BsUserPlatformAuthorizeService
* @author: HuRui
* @date: 2024/11/6
**/
public interface BsUserPlatformAuthorizeService {
/**
* 编辑数据
* @param data
*/
void edit(BsUserPlatformAuthorize data);
/**
* 查询用户授权
* @param userId
* @return
*/
List<BsUserPlatformAuthorize> getUserAuth(Long userId);
/**
* 查询用户授权
* @param userId
* @param platform
* @return
*/
BsUserPlatformAuthorize getUserAuth(Long userId, UserAuthorizePlatformEnum platform);
}

@ -53,8 +53,12 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
BigDecimal selfPurchaseReward = new BigDecimal(secDictionaryService.getDictionary("SELF_PURCHASE_REWARD", user.getGrade()+"").getCodeName());
// 元宝汇率
BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue());
// 合伙人权益加成
BigDecimal partnerIncomePer = user.getPartnerIncomePer()!=null?user.getPartnerIncomePer():new BigDecimal("0");
// 获得元宝数量 (返利金额 * 元宝汇率) * 等级自购奖励比例
BigDecimal goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)).multiply(selfPurchaseReward.divide(new BigDecimal("100"))).setScale(6, BigDecimal.ROUND_HALF_DOWN);
BigDecimal goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply((selfPurchaseReward.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
Map<String, Object> userRechargeParam = new HashMap<>();
userRechargeParam.put("sourceId", MapUtils.getLong(otherParam, "sourceId"));
@ -103,6 +107,12 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue());
// 直属贡献比例
BigDecimal directlyContributeRate = new BigDecimal("0");
// 合伙人权益加成
BigDecimal partnerIncomePer = new BigDecimal("0");
BsUser parentUserId = userService.getUser(parentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
if (UserGradeEnum.grade1.getCode().equals(userGrade.getCode())
|| UserGradeEnum.grade2.getCode().equals(userGrade.getCode())) {
@ -124,7 +134,7 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
}
// 直属贡献 = (返利金额 * 元宝汇率) * 直属贡献
BigDecimal goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
if (parentRel != null) {
// 上级账户
@ -138,9 +148,16 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
if (channel != null) {
// 贡献比例 9%
directlyContributeRate = new BigDecimal("9");
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
BsUser channelUserId = userService.getUser(parentRel.getParentUserId());
if (channelUserId != null) {
partnerIncomePer = channelUserId.getPartnerIncomePer()!=null?channelUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 渠道贡献
parentUserParam.clear();
@ -165,6 +182,12 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue());
// 直属贡献比例
BigDecimal directlyContributeRate = new BigDecimal("0");
// 合伙人权益加成
BigDecimal partnerIncomePer = new BigDecimal("0");
BsUser parentUserId = userService.getUser(parentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
if (UserGradeEnum.grade1.getCode().equals(userGrade.getCode())
|| UserGradeEnum.grade2.getCode().equals(userGrade.getCode())) {
@ -177,7 +200,7 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
}
// 直属贡献 = (返利金额 * 元宝汇率) * 直属贡献
BigDecimal goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 上级账户
@ -196,9 +219,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
if (UserGradeEnum.grade3.getCode().equals(userParentRel.getParentUserGrade())) {
// 贡献比例 10%
directlyContributeRate = new BigDecimal("10");
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(userParentRel.getUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 渠道贡献
parentUserParam.clear();
@ -213,9 +242,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
if (userParentRel != null) {
// 贡献比例 13%
directlyContributeRate = new BigDecimal("13");
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(userParentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 渠道贡献
parentUserParam.clear();
@ -229,9 +264,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
} else if (UserGradeEnum.grade4.getCode().equals(userParentRel.getParentUserGrade())) {
// 贡献比例 23%
directlyContributeRate = new BigDecimal("23");
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(userParentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 渠道贡献
parentUserParam.clear();
@ -246,9 +287,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
if (channel != null) {
// 贡献比例 9%
directlyContributeRate = new BigDecimal("9");
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(userParentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 渠道贡献
parentUserParam.clear();
@ -296,11 +343,17 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
// 递归判断找到渠道
BsUserParentRel userParentRel = userParentRelService.getParent(Arrays.asList(UserGradeEnum.grade4),parentRel.getParentUserId());
if (userParentRel != null) {
// 贡献比例 10%
// 贡献比例 13%
directlyContributeRate = new BigDecimal("13");
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(userParentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 渠道贡献
parentUserParam.clear();
@ -315,9 +368,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
if (channel != null) {
// 贡献比例 9%
directlyContributeRate = new BigDecimal("9");
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(userParentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 渠道贡献
parentUserParam.clear();
@ -339,6 +398,12 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue());
// 直属贡献比例
BigDecimal directlyContributeRate = new BigDecimal("0");
// 合伙人权益加成
BigDecimal partnerIncomePer = new BigDecimal("0");
BsUser parentUserId = userService.getUser(parentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献元宝
BigDecimal goldCoin = new BigDecimal("0");
@ -352,7 +417,7 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
// 直属贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 上级账户
@ -382,9 +447,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
directlyContributeRate = new BigDecimal("21.6");
parentUserParam.put("sourceContent", "非直属会员贡献");
}
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(userParentRel.getUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 团长账户
userAccountService.recharge(userParentRel.getUserId(), goldCoin, UserAccountRecordSourceTypeEnum.type1, parentUserParam);
@ -414,9 +485,16 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
parentUserParam.put("sourceContent", "非直属团长团队贡献");
}
}
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(channel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 渠道账户
@ -439,9 +517,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
directlyContributeRate = new BigDecimal("55");
parentUserParam.put("sourceContent", "非直属会员贡献");
}
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(userParentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 渠道账户
userAccountService.recharge(userParentRel.getParentUserId(), goldCoin, UserAccountRecordSourceTypeEnum.type1, parentUserParam);
@ -451,9 +535,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
if (channel != null) {
// 贡献比例 9%
directlyContributeRate = new BigDecimal("9");
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(channel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 贡献
parentUserParam.clear();
@ -476,6 +566,12 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue());
// 直属贡献比例
BigDecimal directlyContributeRate = new BigDecimal("0");
// 合伙人权益加成
BigDecimal partnerIncomePer = new BigDecimal("0");
BsUser parentUserId = userService.getUser(parentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献元宝
BigDecimal goldCoin = new BigDecimal("0");
@ -489,7 +585,7 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
// 直属贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 上级账户
@ -519,9 +615,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
directlyContributeRate = new BigDecimal("21.6");
parentUserParam.put("sourceContent", "非直属会员贡献");
}
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(parentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 团长账户
userAccountService.recharge(userParentRel.getUserId(), goldCoin, UserAccountRecordSourceTypeEnum.type1, parentUserParam);
@ -551,9 +653,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
parentUserParam.put("sourceContent", "非直属团长团队贡献");
}
}
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(channel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 渠道账户
@ -576,9 +684,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
directlyContributeRate = new BigDecimal("55");
parentUserParam.put("sourceContent", "非直属会员贡献");
}
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(userParentRel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 渠道账户
userAccountService.recharge(userParentRel.getParentUserId(), goldCoin, UserAccountRecordSourceTypeEnum.type1, parentUserParam);
@ -588,9 +702,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService {
if (channel != null) {
// 贡献比例 9%
directlyContributeRate = new BigDecimal("9");
// 合伙人权益加成
partnerIncomePer = new BigDecimal("0");
parentUserId = userService.getUser(channel.getParentUserId());
if (parentUserId != null) {
partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0");
}
// 贡献 = (返利金额 * 元宝汇率) * 直属贡献
goldCoin = (rebateAmount.multiply(goldCoinExchangeRate))
.multiply(directlyContributeRate.divide(new BigDecimal("100")))
.multiply((directlyContributeRate).add(partnerIncomePer).divide(new BigDecimal("100")))
.setScale(6, BigDecimal.ROUND_HALF_DOWN);
// 贡献
parentUserParam.clear();

@ -4,6 +4,7 @@ import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.entity.BsUser;
import com.hfkj.entity.BsUserGradeConfig;
import com.hfkj.model.UserTeamModel;
import com.hfkj.service.user.*;
import com.hfkj.sysenum.user.UserAccountRecordSourceTypeEnum;
@ -16,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -34,6 +36,8 @@ public class BsUserGradeServiceImpl implements BsUserGradeService {
private BsUserAccountRecordService userAccountRecordService;
@Resource
private BsUserParentRelService userParentRelService;
@Resource
private BsUserGradeConfigService userGradeConfigService;
@Override
@Transactional(propagation= Propagation.REQUIRED,rollbackFor= {RuntimeException.class})
@ -96,17 +100,24 @@ public class BsUserGradeServiceImpl implements BsUserGradeService {
if (!UserGradeEnum.grade1.getCode().equals(user.getGrade())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "只有“见习会员”才能进行购买");
}
// 获取晋升配置
BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade1);
Map<String,Object> otherParam = new HashMap<>();
otherParam.put("sourceContent", "升级优淘会员");
// 支付3元宝
userAccountService.consume(user.getId(),new BigDecimal("3"), UserAccountRecordSourceTypeEnum.type2, otherParam);
// 支付元宝
userAccountService.consume(user.getId(),config.getPromotionConditions1(), UserAccountRecordSourceTypeEnum.type2, otherParam);
}
@Override
public Map<String, Object> promoteGrade2Progress(Long userId) {
Map<String,Object> map = new HashMap<>();
map.put("condition1", false);
// 获取配置
BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade1);
Map<String,Object> map = new LinkedHashMap<>();
map.put("conditionTarget1", config.getPromotionConditions1());
map.put("conditionTarget2", config.getPromotionConditions2());
map.put("condition1", false);
// 条件一(支付3元宝)
Map<String,Object> accountRecordParam = new HashMap<>();
accountRecordParam.put("userId", userId);
@ -124,7 +135,12 @@ public class BsUserGradeServiceImpl implements BsUserGradeService {
@Override
public Map<String, Object> promoteGrade3Progress(Long userId) {
Map<String,Object> map = new HashMap<>();
// 获取配置
BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade2);
Map<String,Object> map = new LinkedHashMap<>();
map.put("conditionTarget1", config.getPromotionConditions1());
map.put("conditionTarget2", config.getPromotionConditions2());
map.put("conditionTarget3", config.getPromotionConditions3());
Map<String,Object> param = new HashMap<>();
param.put("parentUserId", userId);
@ -145,7 +161,12 @@ public class BsUserGradeServiceImpl implements BsUserGradeService {
@Override
public Map<String, Object> promoteGrade4Progress(Long userId) {
Map<String,Object> map = new HashMap<>();
// 获取配置
BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade3);
Map<String,Object> map = new LinkedHashMap<>();
map.put("conditionTarget1", config.getPromotionConditions1());
map.put("conditionTarget2", config.getPromotionConditions2());
map.put("conditionTarget3", config.getPromotionConditions3());
Map<String,Object> param = new HashMap<>();
param.put("parentUserId", userId);
@ -175,6 +196,9 @@ public class BsUserGradeServiceImpl implements BsUserGradeService {
boolean payCondition = false;
boolean profitCondition = false;
// 获取等级晋升配置
BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade1);
// 完成进度
Map<String, Object> map = promoteGrade2Progress(user.getId());
@ -184,7 +208,7 @@ public class BsUserGradeServiceImpl implements BsUserGradeService {
}
// 条件二(元宝收益达到5元宝)
if (new BigDecimal(MapUtils.getString(map, "condition2")).compareTo(new BigDecimal("5")) >= 1) {
if (new BigDecimal(MapUtils.getString(map, "condition2")).compareTo(config.getPromotionConditions2()) >= 1) {
profitCondition = true;
}
// 满足其中条件一项
@ -202,19 +226,22 @@ public class BsUserGradeServiceImpl implements BsUserGradeService {
boolean nonDirect = false; // 非直属
boolean profitCondition = false; // 元宝收益
// 获取等级晋升配置
BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade2);
// 完成进度
Map<String, Object> map = promoteGrade3Progress(user.getId());
// 条件一(直属正式会员达到30人)
if (MapUtils.getInteger(map, "condition1") >= 30) {
if (MapUtils.getInteger(map, "condition1") >= config.getPromotionConditions1().intValue()) {
directlyUnder = true;
}
// 条件二(非直属正式会员达到100人)
if (MapUtils.getInteger(map, "condition2") >= 100) {
if (MapUtils.getInteger(map, "condition2") >= config.getPromotionConditions2().intValue()) {
nonDirect = true;
}
// 条件三(累计元宝收益达到100元宝)
if (new BigDecimal(MapUtils.getString(map, "condition3")).compareTo(new BigDecimal("100")) >= 1) {
if (new BigDecimal(MapUtils.getString(map, "condition3")).compareTo(config.getPromotionConditions3()) >= 1) {
profitCondition = true;
}
// 满足全部条件
@ -232,19 +259,22 @@ public class BsUserGradeServiceImpl implements BsUserGradeService {
boolean nonDirect = false; // 非直属
boolean profitCondition = false; // 元宝收益
// 获取等级晋升配置
BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade3);
// 完成进度
Map<String, Object> map = promoteGrade3Progress(user.getId());
// 条件一(直属团长达到100人)
if (MapUtils.getInteger(map, "condition1") >= 100) {
if (MapUtils.getInteger(map, "condition1") >= config.getPromotionConditions1().intValue()) {
directlyUnder = true;
}
// 条件二(非直属团长达到300人)
if (MapUtils.getInteger(map, "condition2") >= 300) {
if (MapUtils.getInteger(map, "condition2") >= config.getPromotionConditions2().intValue()) {
nonDirect = true;
}
// 条件三(累计元宝收益达到10000元宝)
if (new BigDecimal(MapUtils.getString(map, "condition3")).compareTo(new BigDecimal("10000")) >= 1) {
if (new BigDecimal(MapUtils.getString(map, "condition3")).compareTo(config.getPromotionConditions3()) >= 1) {
profitCondition = true;
}
return (directlyUnder && nonDirect && profitCondition);

@ -61,7 +61,7 @@ public class BsUserInviteCodeServiceImpl implements BsUserInviteCodeService {
// 生成二维码
String fileUrl = "/userInviteCode/"+data.getUserId()+"_"+System.currentTimeMillis()+".png";
QRCodeGenerator.generateQRCodeImage(
""+data.getUserId(),
CommonSysConst.getSysConfig().getDomain()+"/"+data.getUserId(),
180,
180,
commonSysConfig.getFilesystem() + fileUrl

@ -0,0 +1,54 @@
package com.hfkj.service.user.impl;
import com.hfkj.dao.BsUserPlatformAuthorizeMapper;
import com.hfkj.entity.BsUserPlatformAuthorize;
import com.hfkj.entity.BsUserPlatformAuthorizeExample;
import com.hfkj.service.user.BsUserPlatformAuthorizeService;
import com.hfkj.sysenum.user.UserAuthorizePlatformEnum;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* @className: BsUserPlatformAuthorizeServiceImpl
* @author: HuRui
* @date: 2024/11/6
**/
@Service("userPlatformAuthorizeService")
public class BsUserPlatformAuthorizeServiceImpl implements BsUserPlatformAuthorizeService {
@Resource
private BsUserPlatformAuthorizeMapper userPlatformAuthorizeMapper;
@Override
public void edit(BsUserPlatformAuthorize data) {
data.setUpdateTime(new Date());
if (data.getId() == null) {
data.setStatus(1);
data.setCreateTime(new Date());
userPlatformAuthorizeMapper.insert(data);
} else {
userPlatformAuthorizeMapper.updateByPrimaryKey(data);
}
}
@Override
public List<BsUserPlatformAuthorize> getUserAuth(Long userId) {
BsUserPlatformAuthorizeExample example = new BsUserPlatformAuthorizeExample();
example.createCriteria().andUserIdEqualTo(userId).andStatusNotEqualTo(0);
return userPlatformAuthorizeMapper.selectByExample(example);
}
@Override
public BsUserPlatformAuthorize getUserAuth(Long userId, UserAuthorizePlatformEnum platform) {
BsUserPlatformAuthorizeExample example = new BsUserPlatformAuthorizeExample();
example.createCriteria().andUserIdEqualTo(userId).andPlatformCodeEqualTo(platform.getType()).andStatusNotEqualTo(0);
List<BsUserPlatformAuthorize> list = userPlatformAuthorizeMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
} else {
return null;
}
}
}

@ -11,10 +11,7 @@ import com.hfkj.dao.BsUserMapper;
import com.hfkj.entity.*;
import com.hfkj.model.UserSessionObject;
import com.hfkj.service.user.*;
import com.hfkj.sysenum.user.UserAccountStatusEnum;
import com.hfkj.sysenum.user.UserGradeEnum;
import com.hfkj.sysenum.user.UserLoginType;
import com.hfkj.sysenum.user.UserStatusEnum;
import com.hfkj.sysenum.user.*;
import org.apache.catalina.User;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -54,6 +51,8 @@ public class BsUserServiceImpl implements BsUserService {
private BsUserParentRelService userParentRelService;
@Resource
private BsUserGradeService userGradeService;
@Resource
private BsUserPlatformAuthorizeService userPlatformAuthorizeService;
private final static String CACHE_KEY = "USER";
/**
@ -131,12 +130,13 @@ public class BsUserServiceImpl implements BsUserService {
if (user.getInviteUserId() != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已绑定过邀请人");
}
if (getUser(inviteUseId) == null) {
BsUser inviteUser = getUser(inviteUseId);
if (inviteUser == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的邀请人Id");
}
BsUserParentRel userParentRel = new BsUserParentRel();
userParentRel.setParentUserId(userParentRel.getParentUserId());
userParentRel.setParentUserGrade(userParentRel.getParentUserGrade());
userParentRel.setParentUserId(inviteUser.getId());
userParentRel.setParentUserGrade(inviteUser.getGrade());
userParentRel.setUserId(userId);
userParentRelService.editData(userParentRel);
@ -265,6 +265,9 @@ public class BsUserServiceImpl implements BsUserService {
criteria.andGradeEqualTo(MapUtils.getInteger(param, "grade"));
}
if (MapUtils.getInteger(param, "relationId") != null) {
criteria.andRelationIdIsNotNull();
}
if (MapUtils.getInteger(param, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status"));
}
@ -298,6 +301,16 @@ public class BsUserServiceImpl implements BsUserService {
editData(bsUser);
// 创建账户余额
userAccountService.create(bsUser.getId());
// 授权信息
BsUserPlatformAuthorize authorize = new BsUserPlatformAuthorize();
authorize.setUserId(user.getId());
authorize.setPlatformCode(UserAuthorizePlatformEnum.type2.getType());
authorize.setPlatformName(UserAuthorizePlatformEnum.type2.getName());
authorize.setAvatar(user.getHeadImg());
authorize.setNickName(user.getName());
authorize.setOpenId(user.getWechatOpenId());
userPlatformAuthorizeService.edit(authorize);
} else {
bsUser.setHeadImg(user.getHeadImg());
bsUser.setName(user.getName());
@ -328,7 +341,7 @@ public class BsUserServiceImpl implements BsUserService {
// 校验邀请码
BsUserInviteCode userInviteCode = userInviteCodeService.getDetail(inviteUseId);
if (userInviteCode == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无效的邀请");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无效的邀请人Id");
}
user.setInviteUserId(userInviteCode.getUserId());
}
@ -344,6 +357,18 @@ public class BsUserServiceImpl implements BsUserService {
user.setStatus(UserStatusEnum.status1.getCode());
editData(user);
if (user.getInviteUserId() != null) {
BsUser inviteUser = getUser(inviteUseId);
if (inviteUser == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的邀请人Id");
}
BsUserParentRel userParentRel = new BsUserParentRel();
userParentRel.setParentUserId(inviteUser.getId());
userParentRel.setParentUserGrade(inviteUser.getGrade());
userParentRel.setUserId(user.getId());
userParentRelService.editData(userParentRel);
}
// 创建账户
userAccountService.create(user.getId());
return user;

@ -0,0 +1,44 @@
package com.hfkj.sysenum.user;
import lombok.Getter;
import java.util.Objects;
/**
* 用户账户记录来源
* @author hurui
*/
@Getter
public enum UserAuthorizePlatformEnum {
/**
* 支付宝
*/
type1(1 , "支付宝"),
/**
* 微信
*/
type2(2 , "微信"),
;
private Integer type;
private String name;
UserAuthorizePlatformEnum(int type , String name) {
this.type = type;
this.name = name;
}
/**
* 查询数据
* @param code
* @return
*/
public static UserAuthorizePlatformEnum getDataByType(Integer code) {
for (UserAuthorizePlatformEnum ele : values()) {
if (Objects.equals(code,ele.getType())) return ele;
}
return null;
}
}
Loading…
Cancel
Save