diff --git a/bweb/src/main/java/com/hfkj/config/AuthConfig.java b/bweb/src/main/java/com/hfkj/config/AuthConfig.java index 0f20dd3..d32876b 100644 --- a/bweb/src/main/java/com/hfkj/config/AuthConfig.java +++ b/bweb/src/main/java/com/hfkj/config/AuthConfig.java @@ -90,6 +90,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/secUser/*") .excludePathPatterns("/cornucopia/*") .excludePathPatterns("/partner/*") + .excludePathPatterns("/userCount/*") ; } diff --git a/bweb/src/main/java/com/hfkj/controller/BsUserCountController.java b/bweb/src/main/java/com/hfkj/controller/BsUserCountController.java new file mode 100644 index 0000000..95d4019 --- /dev/null +++ b/bweb/src/main/java/com/hfkj/controller/BsUserCountController.java @@ -0,0 +1,272 @@ +package com.hfkj.controller; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +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.common.utils.ResponseMsgUtil; +import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserParentRel; +import com.hfkj.model.ResponseData; +import com.hfkj.service.user.BsUserCountService; +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.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @className: CmsController + * @author: HuRui + * @date: 2024/9/24 + **/ +@Controller +@RequestMapping(value = "/userCount") +@Api(value = "用户统计") +public class BsUserCountController { + private static Logger log = LoggerFactory.getLogger(BsUserCountController.class); + @Resource + private BsUserCountService userCountService; + + @RequestMapping(value="/countUserNumber",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "统计用户数量") + public ResponseData countUserNumber() { + try { + // 今日时间 + Map todayTime = DateUtil.getTodayTimeObj(); + // 昨日时间 + Map yesterdayTime = DateUtil.getYesterdayTimeObj(); + // 本月时间 + Map thisMonthTime = DateUtil.getThisMonthTimeObj(); + // 上月时间 + Map lastMonthTime = DateUtil.getLastMonthTimeObj(); + + Map map = new HashMap<>(); + + // 平台注册用户数 + Map platformRegister = new HashMap<>(); + Calendar timeS = new GregorianCalendar(); + timeS.set(Calendar.YEAR, 2024); + timeS.set(Calendar.MONTH, 1); + timeS.set(Calendar.DAY_OF_MONTH, 0); + timeS.set(Calendar.HOUR_OF_DAY, 23); + timeS.set(Calendar.MINUTE, 59); + timeS.set(Calendar.SECOND, 59); + // 今日 + platformRegister.put("today", userCountService.countPlatformRegister(timeS.getTime(), todayTime.get("timeE"))); + // 昨日 + platformRegister.put("yesterday", userCountService.countPlatformRegister(timeS.getTime(), yesterdayTime.get("timeE"))); + // 本月 + platformRegister.put("thisMonth", userCountService.countPlatformRegister(timeS.getTime(), thisMonthTime.get("timeE"))); + // 上月 + platformRegister.put("lastMonth", userCountService.countPlatformRegister(timeS.getTime(), lastMonthTime.get("timeE"))); + map.put("platformRegister", platformRegister); + + + // 新增用户数 + Map addNumber = new HashMap<>(); + // 今日 + addNumber.put("today", userCountService.countAdd(todayTime.get("timeS"), todayTime.get("timeE"))); + // 昨日 + addNumber.put("yesterday", userCountService.countAdd(yesterdayTime.get("timeS"), yesterdayTime.get("timeE"))); + // 本月 + addNumber.put("thisMonth", userCountService.countAdd(thisMonthTime.get("timeS"), thisMonthTime.get("timeE"))); + // 上月 + addNumber.put("lastMonth", userCountService.countAdd(lastMonthTime.get("timeS"), lastMonthTime.get("timeE"))); + map.put("addNumber", addNumber); + + + // 登录用户数 + Map loginNumber = new HashMap<>(); + // 今日 + loginNumber.put("today", userCountService.countLogin(todayTime.get("timeS"), todayTime.get("timeE"))); + // 昨日 + loginNumber.put("yesterday", userCountService.countLogin(yesterdayTime.get("timeS"), yesterdayTime.get("timeE"))); + // 本月 + loginNumber.put("thisMonth", userCountService.countLogin(thisMonthTime.get("timeS"), thisMonthTime.get("timeE"))); + // 上月 + loginNumber.put("lastMonth", userCountService.countLogin(lastMonthTime.get("timeS"), lastMonthTime.get("timeE"))); + map.put("loginNumber", loginNumber); + + + // 下单用户数 + Map placeOrder = new HashMap<>(); + // 今日 + placeOrder.put("today", userCountService.countPlaceOrder(todayTime.get("timeS"), todayTime.get("timeE"))); + // 昨日 + placeOrder.put("yesterday", userCountService.countPlaceOrder(yesterdayTime.get("timeS"), yesterdayTime.get("timeE"))); + // 本月 + placeOrder.put("thisMonth", userCountService.countPlaceOrder(thisMonthTime.get("timeS"), thisMonthTime.get("timeE"))); + // 上月 + placeOrder.put("lastMonth", userCountService.countPlaceOrder(lastMonthTime.get("timeS"), lastMonthTime.get("timeE"))); + map.put("placeOrder", placeOrder); + + return ResponseMsgUtil.success(map); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/queryUserNumber",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询用户数量") + public ResponseData queryUserNumber(@RequestParam(value = "timeS" , required = true) Long timeS, + @RequestParam(value = "timeE" , required = true) Long timeE) { + try { + + Map map = new HashMap<>(); + + Calendar defaultTimeS = new GregorianCalendar(); + defaultTimeS.set(Calendar.YEAR, 2024); + defaultTimeS.set(Calendar.MONTH, 1); + defaultTimeS.set(Calendar.DAY_OF_MONTH, 0); + defaultTimeS.set(Calendar.HOUR_OF_DAY, 23); + defaultTimeS.set(Calendar.MINUTE, 59); + defaultTimeS.set(Calendar.SECOND, 59); + + // 平台注册用户数 + map.put("platformRegister", userCountService.countPlatformRegister(defaultTimeS.getTime(), new Date(timeE))); + + // 新增用户数 + map.put("addNumber", userCountService.countAdd(new Date(timeS), new Date(timeE))); + + // 登录用户数 + map.put("loginNumber", userCountService.countLogin(new Date(timeS), new Date(timeE))); + + // 下单用户数 + map.put("placeOrder", userCountService.countPlaceOrder(new Date(timeS), new Date(timeE))); + + return ResponseMsgUtil.success(map); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value="/countUserGrade",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "统计用户等级") + public ResponseData countUserGrade() { + try { + // 固定初始化开始时间 + Calendar timeS = new GregorianCalendar(); + timeS.set(Calendar.YEAR, 2024); + timeS.set(Calendar.MONTH, 1); + timeS.set(Calendar.DAY_OF_MONTH, 0); + timeS.set(Calendar.HOUR_OF_DAY, 23); + timeS.set(Calendar.MINUTE, 59); + timeS.set(Calendar.SECOND, 59); + + // 今日 + Map todayTime = DateUtil.getTodayTimeObj(); + List> todayData = userCountService.countUserGrade(timeS.getTime(), todayTime.get("timeE")); + + // 昨日时间 + Map yesterdayTime = DateUtil.getYesterdayTimeObj(); + List> yesterdayData = userCountService.countUserGrade(timeS.getTime(), yesterdayTime.get("timeE")); + + // 本月时间 + Map thisMonthTime = DateUtil.getThisMonthTimeObj(); + List> thisMonthData = userCountService.countUserGrade(timeS.getTime(), thisMonthTime.get("timeE")); + + // 上月时间 + Map lastMonthTime = DateUtil.getLastMonthTimeObj(); + List> lastMonthData = userCountService.countUserGrade(timeS.getTime(), lastMonthTime.get("timeE")); + + List list = new ArrayList<>(); + + // 等级 + Map grade1 = new LinkedHashMap<>(); + grade1.put("gradeCode", UserGradeEnum.grade1.getCode()); + grade1.put("gradeName", UserGradeEnum.grade1.getName()); + // 今日 + List> todayGrade1 = todayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade1.getCode())).collect(Collectors.toList()); + grade1.put("today", todayGrade1.isEmpty()?0:todayGrade1.get(0).get("count")); + // 昨日 + List> yesterdayGrade1 = yesterdayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade1.getCode())).collect(Collectors.toList()); + grade1.put("yesterday", yesterdayGrade1.isEmpty()?0:yesterdayGrade1.get(0).get("count")); + // 本月 + List> thisMonthGrade1 = thisMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade1.getCode())).collect(Collectors.toList()); + grade1.put("thisMonth", thisMonthGrade1.isEmpty()?0:thisMonthGrade1.get(0).get("count")); + // 上月 + List> lastMonthGrade1 = lastMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade1.getCode())).collect(Collectors.toList()); + grade1.put("lastMonth", lastMonthGrade1.isEmpty()?0:lastMonthGrade1.get(0).get("count")); + list.add(grade1); + + + Map grade2 = new LinkedHashMap<>(); + grade2.put("gradeCode", UserGradeEnum.grade2.getCode()); + grade2.put("gradeName", UserGradeEnum.grade2.getName()); + // 今日 + List> todayGrade2 = todayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade2.getCode())).collect(Collectors.toList()); + grade2.put("today", todayGrade2.isEmpty()?0:todayGrade2.get(0).get("count")); + // 昨日 + List> yesterdayGrade2 = yesterdayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade2.getCode())).collect(Collectors.toList()); + grade2.put("yesterday", yesterdayGrade2.isEmpty()?0:yesterdayGrade2.get(0).get("count")); + // 本月 + List> thisMonthGrade2 = thisMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade2.getCode())).collect(Collectors.toList()); + grade2.put("thisMonth", thisMonthGrade2.isEmpty()?0:thisMonthGrade2.get(0).get("count")); + // 上月 + List> lastMonthGrade2 = lastMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade2.getCode())).collect(Collectors.toList()); + grade2.put("lastMonth", lastMonthGrade2.isEmpty()?0:lastMonthGrade2.get(0).get("count")); + list.add(grade2); + + + Map grade3 = new LinkedHashMap<>(); + grade3.put("gradeCode", UserGradeEnum.grade3.getCode()); + grade3.put("gradeName", UserGradeEnum.grade3.getName()); + // 今日 + List> todayGrade3 = todayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade3.getCode())).collect(Collectors.toList()); + grade3.put("today", todayGrade3.isEmpty()?0:todayGrade3.get(0).get("count")); + // 昨日 + List> yesterdayGrade3 = yesterdayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade3.getCode())).collect(Collectors.toList()); + grade3.put("yesterday", yesterdayGrade3.isEmpty()?0:yesterdayGrade3.get(0).get("count")); + // 本月 + List> thisMonthGrade3 = thisMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade3.getCode())).collect(Collectors.toList()); + grade3.put("thisMonth", thisMonthGrade3.isEmpty()?0:thisMonthGrade3.get(0).get("count")); + // 上月 + List> lastMonthGrade3 = lastMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade3.getCode())).collect(Collectors.toList()); + grade3.put("lastMonth", lastMonthGrade3.isEmpty()?0:lastMonthGrade3.get(0).get("count")); + list.add(grade3); + + + Map grade4 = new LinkedHashMap<>(); + grade4.put("gradeCode", UserGradeEnum.grade4.getCode()); + grade4.put("gradeName", UserGradeEnum.grade4.getName()); + // 今日 + List> todayGrade4 = todayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade4.getCode())).collect(Collectors.toList()); + grade4.put("today", todayGrade4.isEmpty()?0:todayGrade4.get(0).get("count")); + // 昨日 + List> yesterdayGrade4 = yesterdayData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade4.getCode())).collect(Collectors.toList()); + grade4.put("yesterday", yesterdayGrade4.isEmpty()?0:yesterdayGrade4.get(0).get("count")); + // 本月 + List> thisMonthGrade4 = thisMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade4.getCode())).collect(Collectors.toList()); + grade4.put("thisMonth", thisMonthGrade4.isEmpty()?0:thisMonthGrade4.get(0).get("count")); + // 上月 + List> lastMonthGrade4 = lastMonthData.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade4.getCode())).collect(Collectors.toList()); + grade4.put("lastMonth", lastMonthGrade4.isEmpty()?0:lastMonthGrade4.get(0).get("count")); + list.add(grade4); + + return ResponseMsgUtil.success(list); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/bweb/src/main/java/com/hfkj/controller/BsUserGradeConfigController.java b/bweb/src/main/java/com/hfkj/controller/BsUserGradeConfigController.java new file mode 100644 index 0000000..139ed23 --- /dev/null +++ b/bweb/src/main/java/com/hfkj/controller/BsUserGradeConfigController.java @@ -0,0 +1,90 @@ +package com.hfkj.controller; + +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.BsUserGradeConfig; +import com.hfkj.model.ResponseData; +import com.hfkj.service.user.BsUserGradeConfigService; +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.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.HashMap; + +/** + * @className: BsUserGradeConfigController + * @author: HuRui + * @date: 2024/10/23 + **/ +@Controller +@RequestMapping(value = "/userGradeConfig") +@Api(value = "用户等级配置") +public class BsUserGradeConfigController { + private static Logger log = LoggerFactory.getLogger(BsUserCountController.class); + @Resource + private BsUserGradeConfigService userGradeConfigService; + + @RequestMapping(value="/update",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "修改") + public ResponseData update(@RequestBody BsUserGradeConfig body) { + try { + if (body.getGrade() == null + || body.getGradeIncomeRatio() == null + || body.getOrderIncomeRatio() == null + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + // 查询配置 + BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.getDataByType(body.getGrade())); + if (config == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + config.setGradeIncomeRatio(body.getGradeIncomeRatio()); + config.setOrderIncomeRatio(body.getOrderIncomeRatio()); + config.setPromotionConditions1(body.getPromotionConditions1()); + config.setPromotionConditions2(body.getPromotionConditions2()); + config.setPromotionConditions3(body.getPromotionConditions3()); + userGradeConfigService.updateData(config); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getConfig",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询配置") + public ResponseData getConfig(@RequestParam(value = "grade" , required = true) Integer grade) { + try { + + return ResponseMsgUtil.success(userGradeConfigService.getConfig(UserGradeEnum.getDataByType(grade))); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询列表") + public ResponseData getList() { + try { + + return ResponseMsgUtil.success(userGradeConfigService.getList(new HashMap<>())); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/bweb/src/main/java/com/hfkj/controller/partner/PartnerController.java b/bweb/src/main/java/com/hfkj/controller/partner/PartnerController.java index e179473..9dace49 100644 --- a/bweb/src/main/java/com/hfkj/controller/partner/PartnerController.java +++ b/bweb/src/main/java/com/hfkj/controller/partner/PartnerController.java @@ -1,6 +1,8 @@ package com.hfkj.controller.partner; import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; @@ -42,18 +44,21 @@ public class PartnerController { @Resource private PartnerService partnerService; + @Resource + private BsPartnerPoolPreService bsPartnerPoolPreService; + @RequestMapping(value="/partnerData",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "合伙人统计") public ResponseData partnerData( - @RequestParam(value = "startTime" , required = false) Long startTime, - @RequestParam(value = "endTime" , required = false) Long endTime + @RequestParam(value = "createTimeS" , required = false) Long createTimeS, + @RequestParam(value = "createTimeE" , required = false) Long createTimeE ) { try { - return ResponseMsgUtil.success(partnerService.partnerData(startTime , endTime)); + return ResponseMsgUtil.success(partnerService.partnerData(createTimeS , createTimeE)); } catch (Exception e) { log.error("error!",e); @@ -65,12 +70,43 @@ public class PartnerController { @ResponseBody @ApiOperation(value = "分红统计") public ResponseData dividendData( - @RequestParam(value = "startTime" , required = false) Long startTime, - @RequestParam(value = "endTime" , required = false) Long endTime + @RequestParam(value = "createTimeS" , required = false) Long createTimeS, + @RequestParam(value = "createTimeE" , required = false) Long createTimeE + ) { + try { + + return ResponseMsgUtil.success(partnerService.dividendData(createTimeS , createTimeE)); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getPartnerList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "合伙人列表") + public ResponseData getPartnerList( + @RequestParam(value = "createTimeS" , required = false) Long createTimeS, + @RequestParam(value = "createTimeE" , required = false) Long createTimeE, + @RequestParam(value = "lotteryNo" , required = false) String lotteryNo, + @RequestParam(value = "userId" , required = false) Long userId, + @RequestParam(value = "level" , required = false) Long level, + @RequestParam(value = "status" , required = false) Long status, + @RequestParam(value = "pageNum" , required = true) Integer pageNum, + @RequestParam(value = "pageSize" , required = true) Integer pageSize ) { try { - return ResponseMsgUtil.success(partnerService.dividendData(startTime , endTime)); + Map map = new HashMap<>(); + map.put("lotteryNo", lotteryNo); + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); + map.put("userId", userId); + map.put("level", level); + map.put("status", status); + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(bsPartnerPoolPreService.queryAllList(map))); } catch (Exception e) { log.error("error!",e); diff --git a/cweb/lib/taobao-sdk-java-elm.jar b/cweb/lib/taobao-sdk-java-elm.jar new file mode 100644 index 0000000..15bf43d Binary files /dev/null and b/cweb/lib/taobao-sdk-java-elm.jar differ diff --git a/cweb/pom.xml b/cweb/pom.xml index 882d490..2eef013 100644 --- a/cweb/pom.xml +++ b/cweb/pom.xml @@ -25,6 +25,13 @@ 1.0.1 ${basedir}/lib/taobao-sdk.jar + + taobao-elm.skd + taobao-open-elm-sdk + system + 1.0.1 + ${basedir}/lib/taobao-sdk-java-elm.jar + pop.skd pop-open-sdk diff --git a/cweb/src/main/java/com/hfkj/config/AuthConfig.java b/cweb/src/main/java/com/hfkj/config/AuthConfig.java index 63229f3..c825d4a 100644 --- a/cweb/src/main/java/com/hfkj/config/AuthConfig.java +++ b/cweb/src/main/java/com/hfkj/config/AuthConfig.java @@ -97,6 +97,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/goods/*") .excludePathPatterns("/taoBaoNotify/*") .excludePathPatterns("/cms/*") + .excludePathPatterns("/order/*") ; } diff --git a/cweb/src/main/java/com/hfkj/controller/ElmController.java b/cweb/src/main/java/com/hfkj/controller/ElmController.java new file mode 100644 index 0000000..5c5ba7c --- /dev/null +++ b/cweb/src/main/java/com/hfkj/controller/ElmController.java @@ -0,0 +1,44 @@ +package com.hfkj.controller; + +import com.hfkj.common.security.UserCenter; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.model.ResponseData; +import com.hfkj.model.UserSessionObject; +import com.hfkj.service.elm.ElmService; +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; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +@RequestMapping(value="/elm") +@Api(value="饿了么") +public class ElmController { + + private static Logger log = LoggerFactory.getLogger(ElmController.class); + + @Autowired + private UserCenter userCenter; + + @RequestMapping(value="/officialactivity",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "本地联盟饿了么推广官方活动查询") + public ResponseData officialactivity() { + try { + + // 用户session + UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class); + + return ResponseMsgUtil.success(ElmService.officialactivity(session.getUser().getId() , "10144")); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/cweb/src/main/java/com/hfkj/controller/TakeOutController.java b/cweb/src/main/java/com/hfkj/controller/TakeOutController.java index 85409ce..28b7425 100644 --- a/cweb/src/main/java/com/hfkj/controller/TakeOutController.java +++ b/cweb/src/main/java/com/hfkj/controller/TakeOutController.java @@ -52,4 +52,29 @@ public class TakeOutController { 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 + ) { + try { + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("startTime" , startTime); + jsonObject.put("endTime" , endTime); + jsonObject.put("actId" , actId); + + JSONObject object = MeiTuanService.orderList(jsonObject); + + return ResponseMsgUtil.success(object); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } } diff --git a/cweb/src/main/java/com/hfkj/controller/TestController.java b/cweb/src/main/java/com/hfkj/controller/TestController.java index 8644eca..81dd1f3 100644 --- a/cweb/src/main/java/com/hfkj/controller/TestController.java +++ b/cweb/src/main/java/com/hfkj/controller/TestController.java @@ -8,6 +8,7 @@ import com.hfkj.common.exception.SysCode; import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.model.ResponseData; +import com.hfkj.service.elm.ElmService; import com.hfkj.service.meituan.MeiTuanService; import com.hfkj.service.pdd.PddService; import com.hfkj.service.taobao.TaoBaoService; diff --git a/cweb/src/main/java/com/hfkj/controller/order/BsOrderController.java b/cweb/src/main/java/com/hfkj/controller/order/BsOrderController.java index 51f2427..fe13c3e 100644 --- a/cweb/src/main/java/com/hfkj/controller/order/BsOrderController.java +++ b/cweb/src/main/java/com/hfkj/controller/order/BsOrderController.java @@ -13,6 +13,8 @@ import com.hfkj.model.ResponseData; import com.hfkj.model.SecUserSessionObject; import com.hfkj.model.UserSessionObject; import com.hfkj.service.order.BsOrderService; +import com.hfkj.service.promotion.PromotionBusinessService; +import com.hfkj.service.promotion.PromotionService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; @@ -38,14 +40,13 @@ public class BsOrderController { @Resource private UserCenter userCenter; - @Resource - private BsOrderService bsOrderService; @RequestMapping(value="/getOrderList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询列表") public ResponseData getOrderList(@RequestParam(value = "orderNo" , required = false) String orderNo, @RequestParam(value = "type" , required = false) Integer type, + @RequestParam(value = "orderType" , required = true) Integer orderType, @RequestParam(value = "status" , required = false) Integer status, @RequestParam(value = "userPhone" , required = false) String userPhone, @RequestParam(value = "goodsName" , required = false) String goodsName, @@ -55,24 +56,23 @@ public class BsOrderController { @RequestParam(value = "pageSize" , required = true) Integer pageSize, HttpServletRequest request) { try { - SessionObject sessionObject = userCenter.getSessionObject(request); - SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); + // 用户session + UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class); Map map = new HashMap<>(); - - map.put("orderNo", orderNo); map.put("userPhone", userPhone); map.put("type", type); - map.put("userId", userModel.getAccount().getId()); + map.put("orderType", orderType); + map.put("userId", session.getUser().getId()); map.put("status", status); map.put("goodsName", goodsName); map.put("createTimeS", createTimeS); map.put("createTimeE", createTimeE); PageHelper.startPage(pageNum, pageSize); - return ResponseMsgUtil.success(new PageInfo<>(orderService.getOrderList(map))); + return ResponseMsgUtil.success(new PageInfo<>(orderService.getOrderListParent(map))); } catch (Exception e) { log.error("error!",e); @@ -80,22 +80,13 @@ public class BsOrderController { } } - @RequestMapping(value="/create",method = RequestMethod.POST) + @RequestMapping(value="/getPddOrderList",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "创建订单") - public ResponseData create(@RequestBody JSONObject jsonObject) { + @ApiOperation(value = "用时间段查询推广订单接口") + public ResponseData getPddOrderList() { try { - // 用户session - UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); - if (userSession == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); - } - - jsonObject.put("userId", userSession.getUser().getId()); - jsonObject.put("userPhone", userSession.getUser().getPhone()); - - return ResponseMsgUtil.success(bsOrderService.create(jsonObject)); + return ResponseMsgUtil.success(orderService.getOrderList()); } catch (Exception e) { log.error("error!",e); @@ -103,4 +94,6 @@ public class BsOrderController { } } + + } diff --git a/cweb/src/main/java/com/hfkj/controller/partner/PartnerController.java b/cweb/src/main/java/com/hfkj/controller/partner/PartnerController.java index c6f0055..5b05c80 100644 --- a/cweb/src/main/java/com/hfkj/controller/partner/PartnerController.java +++ b/cweb/src/main/java/com/hfkj/controller/partner/PartnerController.java @@ -1,14 +1,12 @@ package com.hfkj.controller.partner; import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageInfo; 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.controller.cornucopia.CornucopiaController; import com.hfkj.entity.BsPartnerLevel; import com.hfkj.entity.BsPartnerPool; import com.hfkj.entity.BsPartnerPoolPre; @@ -26,7 +24,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; @@ -106,7 +103,7 @@ public class PartnerController { @RequestMapping(value="/getUserPartner",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询合伙人等级与当期投入总元宝,与用户当前等级") - public ResponseData getUserPartner() { + public ResponseData getUserPartner(@RequestParam(value = "level" , required = false) Integer level) { try { // 用户session @@ -115,10 +112,14 @@ public class PartnerController { throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); } + // 查询上一期 + String lotteryNo = DateUtil.date2String(new Date() , DateUtil.YMD); JSONObject obj = new JSONObject(); // 查询当期用户内容 Map map = new HashMap<>(); map.put("status" , 1); + map.put("level" , level); + map.put("lotteryNo" , lotteryNo); List list = bsPartnerPoolPreService.queryAllList(map); BigDecimal toDayPartner = list.stream().map(BsPartnerPoolPre::getGoldCoin).reduce(BigDecimal.ZERO, BigDecimal::add); obj.put("toDayPartner" , toDayPartner); @@ -126,8 +127,8 @@ public class PartnerController { List partnerLevels = bsPartnerLevelService.queryAllList(map); obj.put("partnerLevels" , partnerLevels); // 查询用户合伙人等级 - BsPartnerPool partnerPool = bsPartnerPoolService.queryDetail(userSession.getUser().getId()); - obj.put("partnerPool" , partnerPool); + BsPartnerPool partnerPool = bsPartnerPoolService.queryDetail(userSession.getUser().getId() , level); + obj.put("partnerLevel" , partnerPool); return ResponseMsgUtil.success(obj); @@ -140,7 +141,7 @@ public class PartnerController { @RequestMapping(value="/prePartner",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询上一期竞选与竞选排名") - public ResponseData prePartner() { + public ResponseData prePartner(@RequestParam(value = "level" , required = true) Integer level) { try { // 用户session @@ -151,15 +152,27 @@ public class PartnerController { // 查询上一期 String lotteryNo = DateUtil.date2String(new Date() , DateUtil.YMD); - Integer preLotteryNo = Integer.parseInt(lotteryNo) - 1; + Map map = new HashMap<>(); - map.put("status" , 2); - map.put("lotteryNo" , preLotteryNo.toString()); - List list = bsPartnerPoolPreService.queryAllList(map); + map.put("status" , 1); + map.put("level" , level); + List list = bsPartnerPoolService.queryAllList(map); + + + Map userMap = new HashMap<>(); + userMap.put("userId" , userSession.getUser().getId()); + userMap.put("lotteryNo" , lotteryNo); + + Map mapPre = new HashMap<>(); + int preLotteryNo = Integer.parseInt(lotteryNo) - 1; + mapPre.put("lotteryNo" , Integer.toString(preLotteryNo)); + map.put("level" , level); + List pres = bsPartnerPoolPreService.queryAllList(mapPre); JSONObject obj = new JSONObject(); // 插入上一期内容 obj.put("partnerPoolPre" , list); - obj.put("userPoolPre" , list.stream().filter(s->s.getUserId().equals(userSession.getUser().getId()))); + obj.put("partnerPoolUser" , bsPartnerPoolPreService.queryDetail(userMap)); + obj.put("userPoolPre" , pres.stream().filter(s->s.getUserId().equals(userSession.getUser().getId())).filter(s->s.getLevel().equals(level)).findFirst().orElse(null)); return ResponseMsgUtil.success(obj); diff --git a/cweb/src/main/java/com/hfkj/controller/promotion/PromotionController.java b/cweb/src/main/java/com/hfkj/controller/promotion/PromotionController.java new file mode 100644 index 0000000..e979f0d --- /dev/null +++ b/cweb/src/main/java/com/hfkj/controller/promotion/PromotionController.java @@ -0,0 +1,59 @@ +package com.hfkj.controller.promotion; + +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.security.UserCenter; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.controller.order.BsOrderController; +import com.hfkj.model.ResponseData; +import com.hfkj.model.UserSessionObject; +import com.hfkj.service.promotion.PromotionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +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="/promotion") +@Api(value="推广管理") +public class PromotionController { + + private static final Logger log = LoggerFactory.getLogger(BsOrderController.class); + + @Resource + private UserCenter userCenter; + + @Resource + private PromotionService promotionService; + + @RequestMapping(value="/createUrl",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "创建推广链接") + public ResponseData createUrl(@RequestBody JSONObject jsonObject) { + try { + + // 用户session + UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); + if (userSession == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); + } + + jsonObject.put("userId", userSession.getUser().getId()); + + return ResponseMsgUtil.success(promotionService.createUrl(jsonObject)); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java b/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java index 37fb154..9b90240 100644 --- a/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java +++ b/schedule/src/main/java/com/hfkj/schedule/UserGradeSchedule.java @@ -2,22 +2,30 @@ package com.hfkj.schedule; import com.hfkj.common.security.SessionObject; import com.hfkj.common.security.UserCenter; +import com.hfkj.common.utils.DateUtil; import com.hfkj.common.utils.ListUtil; +import com.hfkj.dao.BsUserGradeCountMapper; import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserGradeCount; import com.hfkj.model.UserSessionObject; +import com.hfkj.service.user.BsUserCountService; import com.hfkj.service.user.BsUserGradeService; import com.hfkj.service.user.BsUserService; import com.hfkj.service.user.impl.BsUserServiceImpl; +import com.hfkj.sysenum.user.UserGradeEnum; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import javax.annotation.Resource; +import java.util.Date; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; /** * @className: UserGradeSchedule @@ -31,6 +39,10 @@ public class UserGradeSchedule { @Resource private BsUserGradeService userGradeService; @Resource + private BsUserCountService userCountService; + @Resource + private BsUserGradeCountMapper userGradeCountMapper; + @Resource private UserCenter userCenter; @Scheduled(cron = "0 0 5 * * ?") // 每日凌晨05:00:00 执行一次 @@ -108,6 +120,32 @@ public class UserGradeSchedule { } + @Scheduled(cron = "0 30 5 * * ?") // 每日凌晨05:30:00 执行一次 + public void count() { + try { + // 昨日时间 + Map todayTime = DateUtil.getTodayTimeObj(); + + BsUserGradeCount userGradeCount = new BsUserGradeCount(); + userGradeCount.setStartTime(todayTime.get("timeS")); + userGradeCount.setEndTime(new Date()); + userGradeCount.setCreateTime(new Date()); + + List> mapList = userCountService.countUserGrade(todayTime.get("timeS"), userGradeCount.getEndTime()); + List> grade1 = mapList.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade1.getCode())).collect(Collectors.toList()); + List> grade2 = mapList.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade2.getCode())).collect(Collectors.toList()); + List> grade3 = mapList.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade3.getCode())).collect(Collectors.toList()); + List> grade4 = mapList.stream().filter(o -> Integer.valueOf(o.get("grade").toString()).equals(UserGradeEnum.grade4.getCode())).collect(Collectors.toList()); + userGradeCount.setGrade1(grade1.isEmpty()?0L:Long.parseLong(grade1.get(0).get("count").toString())); + userGradeCount.setGrade2(grade2.isEmpty()?0L:Long.parseLong(grade2.get(0).get("count").toString())); + userGradeCount.setGrade3(grade3.isEmpty()?0L:Long.parseLong(grade3.get(0).get("count").toString())); + userGradeCount.setGrade4(grade4.isEmpty()?0L:Long.parseLong(grade4.get(0).get("count").toString())); + userGradeCountMapper.insert(userGradeCount); + + } catch (Exception e) { + System.out.println("统计失败!!!"); + } + } } diff --git a/service/lib/taobao-sdk-java-elm.jar b/service/lib/taobao-sdk-java-elm.jar new file mode 100644 index 0000000..15bf43d Binary files /dev/null and b/service/lib/taobao-sdk-java-elm.jar differ diff --git a/service/pom.xml b/service/pom.xml index d1447a7..45f70b3 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -275,6 +275,14 @@ 1.0.1 ${basedir}/lib/taobao-sdk.jar + + taobao-elm.skd + taobao-open-elm-sdk + system + 1.0.1 + ${basedir}/lib/taobao-sdk-java-elm.jar + + pop.skd pop-open-sdk diff --git a/service/src/main/java/com/hfkj/common/utils/DateUtil.java b/service/src/main/java/com/hfkj/common/utils/DateUtil.java index 89cd92d..63ea876 100644 --- a/service/src/main/java/com/hfkj/common/utils/DateUtil.java +++ b/service/src/main/java/com/hfkj/common/utils/DateUtil.java @@ -9,8 +9,7 @@ import java.text.ParseException; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.time.*; -import java.util.Calendar; -import java.util.Date; +import java.util.*; public class DateUtil { @@ -35,6 +34,102 @@ public class DateUtil { private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + /** + * 获取今天时间对象 + * @return + */ + public static Map getTodayTimeObj() { + Map map = new HashMap<>(); + // 开始 + Calendar timeS = Calendar.getInstance(); + timeS.set(Calendar.HOUR_OF_DAY, 00); + timeS.set(Calendar.MINUTE, 00); + timeS.set(Calendar.SECOND, 00); + map.put("timeS", timeS.getTime()); + // 结束 + Calendar timeE = Calendar.getInstance(); + timeE.set(Calendar.HOUR_OF_DAY, 23); + timeE.set(Calendar.MINUTE, 59); + timeE.set(Calendar.SECOND, 59); + map.put("timeE", timeE.getTime()); + return map; + } + + /** + * 获取昨日时间对象 + * @return + */ + public static Map getYesterdayTimeObj() { + Map map = new HashMap<>(); + // 开始 + Calendar timeS = Calendar.getInstance(); + timeS.add(Calendar.DAY_OF_MONTH, -1); + timeS.set(Calendar.HOUR_OF_DAY, 00); + timeS.set(Calendar.MINUTE, 00); + timeS.set(Calendar.SECOND, 00); + map.put("timeS", timeS.getTime()); + // 结束 + Calendar timeE = Calendar.getInstance(); + timeE.add(Calendar.DAY_OF_MONTH, -1); + timeE.set(Calendar.HOUR_OF_DAY, 23); + timeE.set(Calendar.MINUTE, 59); + timeE.set(Calendar.SECOND, 59); + map.put("timeE", timeE.getTime()); + return map; + } + + /** + * 获取本月时间对象 + * @return + */ + public static Map getThisMonthTimeObj() { + Map map = new HashMap<>(); + // 开始 + Calendar timeS = Calendar.getInstance(); + timeS.set(Calendar.DATE, 1); + timeS.set(Calendar.HOUR_OF_DAY, 00); + timeS.set(Calendar.MINUTE, 00); + timeS.set(Calendar.SECOND, 00); + map.put("timeS", timeS.getTime()); + // 结束 + Calendar timeE = Calendar.getInstance(); + timeE.set(Calendar.DATE, 1); + timeE.add(Calendar.MONTH, 1); + timeE.add(Calendar.DATE, -1); + timeE.set(Calendar.HOUR_OF_DAY, 23); + timeE.set(Calendar.MINUTE, 59); + timeE.set(Calendar.SECOND, 59); + map.put("timeE", timeE.getTime()); + return map; + } + + /** + * 获取上月时间对象 + * @return + */ + public static Map getLastMonthTimeObj() { + Map map = new HashMap<>(); + // 开始 + Calendar timeS = Calendar.getInstance(); + timeS.set(Calendar.MONTH, timeS.get(Calendar.MONTH)-1); + timeS.set(Calendar.DATE, 1); + timeS.set(Calendar.HOUR_OF_DAY, 00); + timeS.set(Calendar.MINUTE, 00); + timeS.set(Calendar.SECOND, 00); + map.put("timeS", timeS.getTime()); + // 结束 + Calendar timeE = Calendar.getInstance(); + timeE.set(Calendar.DATE, 1); + timeE.add(Calendar.DATE, -1); + timeE.set(Calendar.HOUR_OF_DAY, 23); + timeE.set(Calendar.MINUTE, 59); + timeE.set(Calendar.SECOND, 59); + map.put("timeE", timeE.getTime()); + return map; + } + + + public static Integer getThisYear(){ Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.YEAR); @@ -100,24 +195,6 @@ public class DateUtil { return strtodate; } - /** - * @throws - * @Title: getDateBegin - * @Description: TODO(获取指定日期开始) - * @author: 杜江 - * @param: [date] - * @return: java.util.Date - */ - public static Date getDateBegin(Date date) { - LocalDate nowDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); - //设置零点 - LocalDateTime beginTime = LocalDateTime.of(nowDate, LocalTime.MIN); - //将时间进行格式化 - ZoneId zoneId = ZoneId.systemDefault(); - ZonedDateTime zdt = beginTime.atZone(zoneId); - return Date.from(zdt.toInstant()); - } - /** * date转换成UNIX时间戳,毫秒 * @@ -156,21 +233,6 @@ public class DateUtil { return cal.getTime(); } - /** - * @throws - * @Title: addSeconds - * @Description: TODO(指定日期 , 指定秒后的时间) - * @author: 杜江 - * @param: [date, seconds] - * @return: java.util.Date - */ - public static Date addSeconds(Date date, int seconds) { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - calendar.add(Calendar.SECOND, seconds); - return calendar.getTime(); - } - /** * 获取某月最后一天日期 * @return Date @@ -679,67 +741,7 @@ public class DateUtil { } - /** - * 字符串日期转换成中文格式日期 - * - * @param date 字符串日期 yyyy-MM-dd - * @return yyyy年MM月dd日 - * @throws Exception - */ - public static String dateToCnDate(Date date) { - try { - String dateString = date2String(date, Y_M_D); - String result = ""; - String[] cnDate = new String[]{"〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"}; - String ten = "十"; - String[] dateStr = dateString.split("-"); - for (int i = 0; i < dateStr.length; i++) { - for (int j = 0; j < dateStr[i].length(); j++) { - String charStr = dateStr[i]; - String str = String.valueOf(charStr.charAt(j)); - if (charStr.length() == 2) { - if (charStr.equals("10")) { - result += ten; - break; - } else { - if (j == 0) { - if (charStr.charAt(j) == '1') - result += ten; - else if (charStr.charAt(j) == '0') - result += ""; - else - result += cnDate[Integer.parseInt(str)] + ten; - } - if (j == 1) { - if (charStr.charAt(j) == '0') - result += ""; - else - result += cnDate[Integer.parseInt(str)]; - } - } - } else { - result += cnDate[Integer.parseInt(str)]; - } - } - if (i == 0) { - result += "年"; - continue; - } - if (i == 1) { - result += "月"; - continue; - } - if (i == 2) { - result += "日"; - continue; - } - } - return result; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } + /** diff --git a/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java b/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java index 41315bf..de5b081 100644 --- a/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java +++ b/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java @@ -137,6 +137,7 @@ public class HttpsUtils { i++; } apiUrl += param; + apiUrl += "&query_request=" + o; String result = null; HttpClient httpClient = null; try { @@ -502,6 +503,42 @@ public class HttpsUtils { return null; } + public static JSONObject doPostS(String apiUrl, Map body) { + CloseableHttpClient httpClient = null; + if (apiUrl.startsWith("https")) { + httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) + .setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); + } else { + httpClient = HttpClients.createDefault(); + } + String httpStr = null; + CloseableHttpResponse response = null; + + try { + HttpPost httpPost = new HttpPost(apiUrl); + httpPost.setConfig(requestConfig); + StringEntity stringEntity = new StringEntity(JSON.toJSONString(body), "UTF-8");// 解决中文乱码问题 + stringEntity.setContentEncoding("UTF-8"); + stringEntity.setContentType("application/json"); + httpPost.setEntity(stringEntity); + response = httpClient.execute(httpPost); + HttpEntity entity = response.getEntity(); + httpStr = EntityUtils.toString(entity, "UTF-8"); + return JSON.parseObject(httpStr); + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + if (response != null) { + try { + EntityUtils.consume(response.getEntity()); + } catch (IOException e) { + log.error(e.getMessage(),e); + } + } + } + return null; + } + public static JSONObject doPostForm(String apiUrl, String body, Map header) { CloseableHttpClient httpClient = null; if (apiUrl.startsWith("https")) { diff --git a/service/src/main/java/com/hfkj/common/utils/TaoBaoUtil.java b/service/src/main/java/com/hfkj/common/utils/TaoBaoUtil.java new file mode 100644 index 0000000..b62ce99 --- /dev/null +++ b/service/src/main/java/com/hfkj/common/utils/TaoBaoUtil.java @@ -0,0 +1,111 @@ +package com.hfkj.common.utils; + +import com.alipay.api.internal.util.StringUtils; +import com.taobao.top.Constants; + +import javax.crypto.Mac; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.security.MessageDigest; +import java.util.Arrays; +import java.util.Map; + +public class TaoBaoUtil { + + public static String signTopRequest(Map params, String secret, String signMethod) throws IOException { + // 第一步:检查参数是否已经排序 + String[] keys = params.keySet().toArray(new String[0]); + Arrays.sort(keys); + + // 第二步:把所有参数名和参数值串在一起 + StringBuilder query = new StringBuilder(); + if (Constants.SIGN_METHOD_MD5.equals(signMethod)) { //签名的摘要算法,可选值为:hmac,md5,hmac-sha256 + query.append(secret); + } + for (String key : keys) { + String value = params.get(key); + if (StringUtils.areNotEmpty(key, value)) { + query.append(key).append(value); + } + } + + // 第三步:使用MD5/HMAC加密 + byte[] bytes; + if (Constants.SIGN_METHOD_HMAC.equals(signMethod)) { + bytes = encryptHMAC(query.toString(), secret); + } else { + query.append(secret); + bytes = encryptMD5(query.toString()); + } + + // 第四步:把二进制转化为大写的十六进制(正确签名应该为32大写字符串,此方法需要时使用) + return byte2hex(bytes); + } + + + // 将字节数组转换为十六进制字符串 + public static String byte2hex(byte[] bytes) { + // 创建一个StringBuilder对象,用于存储转换后的十六进制字符串 + StringBuilder sign = new StringBuilder(); + // 遍历字节数组 + for (byte aByte : bytes) { + // 将字节数组中的每个字节转换为十六进制字符串 + String hex = Integer.toHexString(aByte & 0xFF); + // 如果转换后的十六进制字符串长度为1,则在前面补0 + if (hex.length() == 1) { + sign.append("0"); + } + // 将转换后的十六进制字符串转换为大写,并添加到StringBuilder对象中 + sign.append(hex.toUpperCase()); + } + // 返回转换后的十六进制字符串 + return sign.toString(); + } + + // 加密HMAC + public static byte[] encryptHMAC(String data, String secret) throws IOException { + // 声明一个字节数组 + byte[] bytes = null; + try { + // 创建一个SecretKey对象,使用secret和Constants.CHARSET_UTF8编码 + SecretKey secretKey = new SecretKeySpec(secret.getBytes(Constants.CHARSET_UTF8), "HmacMD5"); + // 获取Mac实例 + Mac mac = Mac.getInstance(secretKey.getAlgorithm()); + // 初始化Mac对象 + mac.init(secretKey); + // 使用Mac对象对data进行加密,使用Constants.CHARSET_UTF8编码 + bytes = mac.doFinal(data.getBytes(Constants.CHARSET_UTF8)); + } catch (GeneralSecurityException gse) { + // 抛出IOException异常 + throw new IOException(gse.toString()); + } + // 返回加密后的字节数组 + return bytes; + } + + // 加密MD5 + public static byte[] encryptMD5(String data) throws IOException { + // 将字符串转换为字节数组 + return encryptMD5(data.getBytes(Constants.CHARSET_UTF8)); + } + + // 加密数据为MD5 + public static byte[] encryptMD5(byte[] data) throws IOException { + // 声明一个字节数组,用于存储加密后的数据 + byte[] bytes = null; + try { + // 获取MD5加密算法实例 + MessageDigest md = MessageDigest.getInstance("MD5"); + // 对数据进行加密 + bytes = md.digest(data); + } catch (GeneralSecurityException gse) { + // 如果发生异常,则抛出IO异常 + throw new IOException(gse.toString()); + } + // 返回加密后的数据 + return bytes; + } + +} diff --git a/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java b/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java index 08c462e..61b1f81 100644 --- a/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsOrderMapperExt.java @@ -1,7 +1,18 @@ package com.hfkj.dao; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + /** * mapper扩展类 */ public interface BsOrderMapperExt { -} \ No newline at end of file + + @Select("") + Long countPlaceOrder(@Param("timeS") String timeS, @Param("timeE")String timeE); +} diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapper.java b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapper.java new file mode 100644 index 0000000..70ed14a --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapper.java @@ -0,0 +1,125 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserGradeConfig; +import com.hfkj.entity.BsUserGradeConfigExample; +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 BsUserGradeConfigMapper extends BsUserGradeConfigMapperExt { + @SelectProvider(type=BsUserGradeConfigSqlProvider.class, method="countByExample") + long countByExample(BsUserGradeConfigExample example); + + @DeleteProvider(type=BsUserGradeConfigSqlProvider.class, method="deleteByExample") + int deleteByExample(BsUserGradeConfigExample example); + + @Delete({ + "delete from bs_user_grade_config", + "where id = #{id,jdbcType=INTEGER}" + }) + int deleteByPrimaryKey(Integer id); + + @Insert({ + "insert into bs_user_grade_config (grade, grade_income_ratio, ", + "order_income_ratio, promotion_conditions_1, ", + "promotion_conditions_2, promotion_conditions_3, ", + "create_time, update_time, ", + "ext_1, ext_2, ext_3)", + "values (#{grade,jdbcType=INTEGER}, #{gradeIncomeRatio,jdbcType=DECIMAL}, ", + "#{orderIncomeRatio,jdbcType=DECIMAL}, #{promotionConditions1,jdbcType=DECIMAL}, ", + "#{promotionConditions2,jdbcType=DECIMAL}, #{promotionConditions3,jdbcType=DECIMAL}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(BsUserGradeConfig record); + + @InsertProvider(type=BsUserGradeConfigSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(BsUserGradeConfig record); + + @SelectProvider(type=BsUserGradeConfigSqlProvider.class, method="selectByExample") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true), + @Result(column="grade", property="grade", jdbcType=JdbcType.INTEGER), + @Result(column="grade_income_ratio", property="gradeIncomeRatio", jdbcType=JdbcType.DECIMAL), + @Result(column="order_income_ratio", property="orderIncomeRatio", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_1", property="promotionConditions1", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_2", property="promotionConditions2", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_3", property="promotionConditions3", jdbcType=JdbcType.DECIMAL), + @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 selectByExample(BsUserGradeConfigExample example); + + @Select({ + "select", + "id, grade, grade_income_ratio, order_income_ratio, promotion_conditions_1, promotion_conditions_2, ", + "promotion_conditions_3, create_time, update_time, ext_1, ext_2, ext_3", + "from bs_user_grade_config", + "where id = #{id,jdbcType=INTEGER}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true), + @Result(column="grade", property="grade", jdbcType=JdbcType.INTEGER), + @Result(column="grade_income_ratio", property="gradeIncomeRatio", jdbcType=JdbcType.DECIMAL), + @Result(column="order_income_ratio", property="orderIncomeRatio", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_1", property="promotionConditions1", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_2", property="promotionConditions2", jdbcType=JdbcType.DECIMAL), + @Result(column="promotion_conditions_3", property="promotionConditions3", jdbcType=JdbcType.DECIMAL), + @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) + }) + BsUserGradeConfig selectByPrimaryKey(Integer id); + + @UpdateProvider(type=BsUserGradeConfigSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") BsUserGradeConfig record, @Param("example") BsUserGradeConfigExample example); + + @UpdateProvider(type=BsUserGradeConfigSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") BsUserGradeConfig record, @Param("example") BsUserGradeConfigExample example); + + @UpdateProvider(type=BsUserGradeConfigSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(BsUserGradeConfig record); + + @Update({ + "update bs_user_grade_config", + "set grade = #{grade,jdbcType=INTEGER},", + "grade_income_ratio = #{gradeIncomeRatio,jdbcType=DECIMAL},", + "order_income_ratio = #{orderIncomeRatio,jdbcType=DECIMAL},", + "promotion_conditions_1 = #{promotionConditions1,jdbcType=DECIMAL},", + "promotion_conditions_2 = #{promotionConditions2,jdbcType=DECIMAL},", + "promotion_conditions_3 = #{promotionConditions3,jdbcType=DECIMAL},", + "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=INTEGER}" + }) + int updateByPrimaryKey(BsUserGradeConfig record); +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapperExt.java b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapperExt.java new file mode 100644 index 0000000..89426ed --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigMapperExt.java @@ -0,0 +1,7 @@ +package com.hfkj.dao; + +/** + * mapper扩展类 + */ +public interface BsUserGradeConfigMapperExt { +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeConfigSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigSqlProvider.java new file mode 100644 index 0000000..0f23fd4 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeConfigSqlProvider.java @@ -0,0 +1,332 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserGradeConfig; +import com.hfkj.entity.BsUserGradeConfigExample.Criteria; +import com.hfkj.entity.BsUserGradeConfigExample.Criterion; +import com.hfkj.entity.BsUserGradeConfigExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class BsUserGradeConfigSqlProvider { + + public String countByExample(BsUserGradeConfigExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("bs_user_grade_config"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(BsUserGradeConfigExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("bs_user_grade_config"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(BsUserGradeConfig record) { + SQL sql = new SQL(); + sql.INSERT_INTO("bs_user_grade_config"); + + if (record.getGrade() != null) { + sql.VALUES("grade", "#{grade,jdbcType=INTEGER}"); + } + + if (record.getGradeIncomeRatio() != null) { + sql.VALUES("grade_income_ratio", "#{gradeIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getOrderIncomeRatio() != null) { + sql.VALUES("order_income_ratio", "#{orderIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions1() != null) { + sql.VALUES("promotion_conditions_1", "#{promotionConditions1,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions2() != null) { + sql.VALUES("promotion_conditions_2", "#{promotionConditions2,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions3() != null) { + sql.VALUES("promotion_conditions_3", "#{promotionConditions3,jdbcType=DECIMAL}"); + } + + 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(BsUserGradeConfigExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("grade"); + sql.SELECT("grade_income_ratio"); + sql.SELECT("order_income_ratio"); + sql.SELECT("promotion_conditions_1"); + sql.SELECT("promotion_conditions_2"); + sql.SELECT("promotion_conditions_3"); + sql.SELECT("create_time"); + sql.SELECT("update_time"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.FROM("bs_user_grade_config"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + BsUserGradeConfig record = (BsUserGradeConfig) parameter.get("record"); + BsUserGradeConfigExample example = (BsUserGradeConfigExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_config"); + + if (record.getId() != null) { + sql.SET("id = #{record.id,jdbcType=INTEGER}"); + } + + if (record.getGrade() != null) { + sql.SET("grade = #{record.grade,jdbcType=INTEGER}"); + } + + if (record.getGradeIncomeRatio() != null) { + sql.SET("grade_income_ratio = #{record.gradeIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getOrderIncomeRatio() != null) { + sql.SET("order_income_ratio = #{record.orderIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions1() != null) { + sql.SET("promotion_conditions_1 = #{record.promotionConditions1,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions2() != null) { + sql.SET("promotion_conditions_2 = #{record.promotionConditions2,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions3() != null) { + sql.SET("promotion_conditions_3 = #{record.promotionConditions3,jdbcType=DECIMAL}"); + } + + 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 parameter) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_config"); + + sql.SET("id = #{record.id,jdbcType=INTEGER}"); + sql.SET("grade = #{record.grade,jdbcType=INTEGER}"); + sql.SET("grade_income_ratio = #{record.gradeIncomeRatio,jdbcType=DECIMAL}"); + sql.SET("order_income_ratio = #{record.orderIncomeRatio,jdbcType=DECIMAL}"); + sql.SET("promotion_conditions_1 = #{record.promotionConditions1,jdbcType=DECIMAL}"); + sql.SET("promotion_conditions_2 = #{record.promotionConditions2,jdbcType=DECIMAL}"); + sql.SET("promotion_conditions_3 = #{record.promotionConditions3,jdbcType=DECIMAL}"); + 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}"); + + BsUserGradeConfigExample example = (BsUserGradeConfigExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(BsUserGradeConfig record) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_config"); + + if (record.getGrade() != null) { + sql.SET("grade = #{grade,jdbcType=INTEGER}"); + } + + if (record.getGradeIncomeRatio() != null) { + sql.SET("grade_income_ratio = #{gradeIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getOrderIncomeRatio() != null) { + sql.SET("order_income_ratio = #{orderIncomeRatio,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions1() != null) { + sql.SET("promotion_conditions_1 = #{promotionConditions1,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions2() != null) { + sql.SET("promotion_conditions_2 = #{promotionConditions2,jdbcType=DECIMAL}"); + } + + if (record.getPromotionConditions3() != null) { + sql.SET("promotion_conditions_3 = #{promotionConditions3,jdbcType=DECIMAL}"); + } + + 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=INTEGER}"); + + return sql.toString(); + } + + protected void applyWhere(SQL sql, BsUserGradeConfigExample 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 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 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()); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapper.java b/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapper.java new file mode 100644 index 0000000..0635d42 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapper.java @@ -0,0 +1,108 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserGradeCount; +import com.hfkj.entity.BsUserGradeCountExample; +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 BsUserGradeCountMapper extends BsUserGradeCountMapperExt { + @SelectProvider(type=BsUserGradeCountSqlProvider.class, method="countByExample") + long countByExample(BsUserGradeCountExample example); + + @DeleteProvider(type=BsUserGradeCountSqlProvider.class, method="deleteByExample") + int deleteByExample(BsUserGradeCountExample example); + + @Delete({ + "delete from bs_user_grade_count", + "where id = #{id,jdbcType=BIGINT}" + }) + int deleteByPrimaryKey(Long id); + + @Insert({ + "insert into bs_user_grade_count (start_time, end_time, ", + "grade1, grade2, grade3, ", + "grade4, create_time)", + "values (#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, ", + "#{grade1,jdbcType=BIGINT}, #{grade2,jdbcType=BIGINT}, #{grade3,jdbcType=BIGINT}, ", + "#{grade4,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(BsUserGradeCount record); + + @InsertProvider(type=BsUserGradeCountSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(BsUserGradeCount record); + + @SelectProvider(type=BsUserGradeCountSqlProvider.class, method="selectByExample") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="grade1", property="grade1", jdbcType=JdbcType.BIGINT), + @Result(column="grade2", property="grade2", jdbcType=JdbcType.BIGINT), + @Result(column="grade3", property="grade3", jdbcType=JdbcType.BIGINT), + @Result(column="grade4", property="grade4", jdbcType=JdbcType.BIGINT), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP) + }) + List selectByExample(BsUserGradeCountExample example); + + @Select({ + "select", + "id, start_time, end_time, grade1, grade2, grade3, grade4, create_time", + "from bs_user_grade_count", + "where id = #{id,jdbcType=BIGINT}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="grade1", property="grade1", jdbcType=JdbcType.BIGINT), + @Result(column="grade2", property="grade2", jdbcType=JdbcType.BIGINT), + @Result(column="grade3", property="grade3", jdbcType=JdbcType.BIGINT), + @Result(column="grade4", property="grade4", jdbcType=JdbcType.BIGINT), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP) + }) + BsUserGradeCount selectByPrimaryKey(Long id); + + @UpdateProvider(type=BsUserGradeCountSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") BsUserGradeCount record, @Param("example") BsUserGradeCountExample example); + + @UpdateProvider(type=BsUserGradeCountSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") BsUserGradeCount record, @Param("example") BsUserGradeCountExample example); + + @UpdateProvider(type=BsUserGradeCountSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(BsUserGradeCount record); + + @Update({ + "update bs_user_grade_count", + "set start_time = #{startTime,jdbcType=TIMESTAMP},", + "end_time = #{endTime,jdbcType=TIMESTAMP},", + "grade1 = #{grade1,jdbcType=BIGINT},", + "grade2 = #{grade2,jdbcType=BIGINT},", + "grade3 = #{grade3,jdbcType=BIGINT},", + "grade4 = #{grade4,jdbcType=BIGINT},", + "create_time = #{createTime,jdbcType=TIMESTAMP}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKey(BsUserGradeCount record); +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapperExt.java b/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapperExt.java new file mode 100644 index 0000000..667288f --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeCountMapperExt.java @@ -0,0 +1,29 @@ +package com.hfkj.dao; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; +import java.util.Map; + +/** + * mapper扩展类 + */ +public interface BsUserGradeCountMapperExt { + + @Select("") + List> collect(@Param("timeS") String timeS, @Param("timeE") String timeE); +} diff --git a/service/src/main/java/com/hfkj/dao/BsUserGradeCountSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsUserGradeCountSqlProvider.java new file mode 100644 index 0000000..7f4919d --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserGradeCountSqlProvider.java @@ -0,0 +1,276 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserGradeCount; +import com.hfkj.entity.BsUserGradeCountExample.Criteria; +import com.hfkj.entity.BsUserGradeCountExample.Criterion; +import com.hfkj.entity.BsUserGradeCountExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class BsUserGradeCountSqlProvider { + + public String countByExample(BsUserGradeCountExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("bs_user_grade_count"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(BsUserGradeCountExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("bs_user_grade_count"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(BsUserGradeCount record) { + SQL sql = new SQL(); + sql.INSERT_INTO("bs_user_grade_count"); + + if (record.getStartTime() != null) { + sql.VALUES("start_time", "#{startTime,jdbcType=TIMESTAMP}"); + } + + if (record.getEndTime() != null) { + sql.VALUES("end_time", "#{endTime,jdbcType=TIMESTAMP}"); + } + + if (record.getGrade1() != null) { + sql.VALUES("grade1", "#{grade1,jdbcType=BIGINT}"); + } + + if (record.getGrade2() != null) { + sql.VALUES("grade2", "#{grade2,jdbcType=BIGINT}"); + } + + if (record.getGrade3() != null) { + sql.VALUES("grade3", "#{grade3,jdbcType=BIGINT}"); + } + + if (record.getGrade4() != null) { + sql.VALUES("grade4", "#{grade4,jdbcType=BIGINT}"); + } + + if (record.getCreateTime() != null) { + sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); + } + + return sql.toString(); + } + + public String selectByExample(BsUserGradeCountExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("start_time"); + sql.SELECT("end_time"); + sql.SELECT("grade1"); + sql.SELECT("grade2"); + sql.SELECT("grade3"); + sql.SELECT("grade4"); + sql.SELECT("create_time"); + sql.FROM("bs_user_grade_count"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + BsUserGradeCount record = (BsUserGradeCount) parameter.get("record"); + BsUserGradeCountExample example = (BsUserGradeCountExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_count"); + + if (record.getId() != null) { + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + } + + if (record.getStartTime() != null) { + sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}"); + } + + if (record.getEndTime() != null) { + sql.SET("end_time = #{record.endTime,jdbcType=TIMESTAMP}"); + } + + if (record.getGrade1() != null) { + sql.SET("grade1 = #{record.grade1,jdbcType=BIGINT}"); + } + + if (record.getGrade2() != null) { + sql.SET("grade2 = #{record.grade2,jdbcType=BIGINT}"); + } + + if (record.getGrade3() != null) { + sql.SET("grade3 = #{record.grade3,jdbcType=BIGINT}"); + } + + if (record.getGrade4() != null) { + sql.SET("grade4 = #{record.grade4,jdbcType=BIGINT}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + } + + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExample(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_count"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}"); + sql.SET("end_time = #{record.endTime,jdbcType=TIMESTAMP}"); + sql.SET("grade1 = #{record.grade1,jdbcType=BIGINT}"); + sql.SET("grade2 = #{record.grade2,jdbcType=BIGINT}"); + sql.SET("grade3 = #{record.grade3,jdbcType=BIGINT}"); + sql.SET("grade4 = #{record.grade4,jdbcType=BIGINT}"); + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + + BsUserGradeCountExample example = (BsUserGradeCountExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(BsUserGradeCount record) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_grade_count"); + + if (record.getStartTime() != null) { + sql.SET("start_time = #{startTime,jdbcType=TIMESTAMP}"); + } + + if (record.getEndTime() != null) { + sql.SET("end_time = #{endTime,jdbcType=TIMESTAMP}"); + } + + if (record.getGrade1() != null) { + sql.SET("grade1 = #{grade1,jdbcType=BIGINT}"); + } + + if (record.getGrade2() != null) { + sql.SET("grade2 = #{grade2,jdbcType=BIGINT}"); + } + + if (record.getGrade3() != null) { + sql.SET("grade3 = #{grade3,jdbcType=BIGINT}"); + } + + if (record.getGrade4() != null) { + sql.SET("grade4 = #{grade4,jdbcType=BIGINT}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); + } + + sql.WHERE("id = #{id,jdbcType=BIGINT}"); + + return sql.toString(); + } + + protected void applyWhere(SQL sql, BsUserGradeCountExample 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 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 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()); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserMapper.java b/service/src/main/java/com/hfkj/dao/BsUserMapper.java index 876339b..42dc362 100644 --- a/service/src/main/java/com/hfkj/dao/BsUserMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsUserMapper.java @@ -42,12 +42,14 @@ public interface BsUserMapper extends BsUserMapperExt { "insert into bs_user (head_img, `name`, ", "phone, grade, wechat_num, ", "invite_user_id, invite_time, ", + "partner_level, partner_income_per, ", "`status`, create_time, ", "update_time, ext_1, ", "ext_2, ext_3)", "values (#{headImg,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ", "#{phone,jdbcType=VARCHAR}, #{grade,jdbcType=INTEGER}, #{wechatNum,jdbcType=VARCHAR}, ", "#{inviteUserId,jdbcType=BIGINT}, #{inviteTime,jdbcType=TIMESTAMP}, ", + "#{partnerLevel,jdbcType=INTEGER}, #{partnerIncomePer,jdbcType=DECIMAL}, ", "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" @@ -69,6 +71,8 @@ public interface BsUserMapper extends BsUserMapperExt { @Result(column="wechat_num", property="wechatNum", jdbcType=JdbcType.VARCHAR), @Result(column="invite_user_id", property="inviteUserId", jdbcType=JdbcType.BIGINT), @Result(column="invite_time", property="inviteTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="partner_level", property="partnerLevel", jdbcType=JdbcType.INTEGER), + @Result(column="partner_income_per", property="partnerIncomePer", jdbcType=JdbcType.DECIMAL), @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), @@ -81,7 +85,8 @@ public interface BsUserMapper extends BsUserMapperExt { @Select({ "select", "id, head_img, `name`, phone, grade, wechat_num, invite_user_id, invite_time, ", - "`status`, create_time, update_time, ext_1, ext_2, ext_3", + "partner_level, partner_income_per, `status`, create_time, update_time, ext_1, ", + "ext_2, ext_3", "from bs_user", "where id = #{id,jdbcType=BIGINT}" }) @@ -94,6 +99,8 @@ public interface BsUserMapper extends BsUserMapperExt { @Result(column="wechat_num", property="wechatNum", jdbcType=JdbcType.VARCHAR), @Result(column="invite_user_id", property="inviteUserId", jdbcType=JdbcType.BIGINT), @Result(column="invite_time", property="inviteTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="partner_level", property="partnerLevel", jdbcType=JdbcType.INTEGER), + @Result(column="partner_income_per", property="partnerIncomePer", jdbcType=JdbcType.DECIMAL), @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), @@ -121,6 +128,8 @@ public interface BsUserMapper extends BsUserMapperExt { "wechat_num = #{wechatNum,jdbcType=VARCHAR},", "invite_user_id = #{inviteUserId,jdbcType=BIGINT},", "invite_time = #{inviteTime,jdbcType=TIMESTAMP},", + "partner_level = #{partnerLevel,jdbcType=INTEGER},", + "partner_income_per = #{partnerIncomePer,jdbcType=DECIMAL},", "`status` = #{status,jdbcType=INTEGER},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "update_time = #{updateTime,jdbcType=TIMESTAMP},", diff --git a/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java b/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java index 4078eb8..1e5277e 100644 --- a/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java @@ -4,4 +4,4 @@ package com.hfkj.dao; * mapper扩展类 */ public interface BsUserMapperExt { -} \ No newline at end of file +} diff --git a/service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java index d73baf0..107aec7 100644 --- a/service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java @@ -56,6 +56,14 @@ public class BsUserSqlProvider { sql.VALUES("invite_time", "#{inviteTime,jdbcType=TIMESTAMP}"); } + if (record.getPartnerLevel() != null) { + sql.VALUES("partner_level", "#{partnerLevel,jdbcType=INTEGER}"); + } + + if (record.getPartnerIncomePer() != null) { + sql.VALUES("partner_income_per", "#{partnerIncomePer,jdbcType=DECIMAL}"); + } + if (record.getStatus() != null) { sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); } @@ -97,6 +105,8 @@ public class BsUserSqlProvider { sql.SELECT("wechat_num"); sql.SELECT("invite_user_id"); sql.SELECT("invite_time"); + sql.SELECT("partner_level"); + sql.SELECT("partner_income_per"); sql.SELECT("`status`"); sql.SELECT("create_time"); sql.SELECT("update_time"); @@ -152,6 +162,14 @@ public class BsUserSqlProvider { sql.SET("invite_time = #{record.inviteTime,jdbcType=TIMESTAMP}"); } + if (record.getPartnerLevel() != null) { + sql.SET("partner_level = #{record.partnerLevel,jdbcType=INTEGER}"); + } + + if (record.getPartnerIncomePer() != null) { + sql.SET("partner_income_per = #{record.partnerIncomePer,jdbcType=DECIMAL}"); + } + if (record.getStatus() != null) { sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); } @@ -192,6 +210,8 @@ public class BsUserSqlProvider { sql.SET("wechat_num = #{record.wechatNum,jdbcType=VARCHAR}"); sql.SET("invite_user_id = #{record.inviteUserId,jdbcType=BIGINT}"); sql.SET("invite_time = #{record.inviteTime,jdbcType=TIMESTAMP}"); + sql.SET("partner_level = #{record.partnerLevel,jdbcType=INTEGER}"); + sql.SET("partner_income_per = #{record.partnerIncomePer,jdbcType=DECIMAL}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); @@ -236,6 +256,14 @@ public class BsUserSqlProvider { sql.SET("invite_time = #{inviteTime,jdbcType=TIMESTAMP}"); } + if (record.getPartnerLevel() != null) { + sql.SET("partner_level = #{partnerLevel,jdbcType=INTEGER}"); + } + + if (record.getPartnerIncomePer() != null) { + sql.SET("partner_income_per = #{partnerIncomePer,jdbcType=DECIMAL}"); + } + if (record.getStatus() != null) { sql.SET("`status` = #{status,jdbcType=INTEGER}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsUser.java b/service/src/main/java/com/hfkj/entity/BsUser.java index 9dae977..7447507 100644 --- a/service/src/main/java/com/hfkj/entity/BsUser.java +++ b/service/src/main/java/com/hfkj/entity/BsUser.java @@ -1,6 +1,7 @@ package com.hfkj.entity; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; /** @@ -53,6 +54,16 @@ public class BsUser implements Serializable { */ private Date inviteTime; + /** + * 合伙人等级 + */ + private Integer partnerLevel; + + /** + * 合伙人权益收益加成 + */ + private BigDecimal partnerIncomePer; + /** * 状态 0:删除 1:正常 2:禁用 */ @@ -140,6 +151,22 @@ public class BsUser implements Serializable { this.inviteTime = inviteTime; } + public Integer getPartnerLevel() { + return partnerLevel; + } + + public void setPartnerLevel(Integer partnerLevel) { + this.partnerLevel = partnerLevel; + } + + public BigDecimal getPartnerIncomePer() { + return partnerIncomePer; + } + + public void setPartnerIncomePer(BigDecimal partnerIncomePer) { + this.partnerIncomePer = partnerIncomePer; + } + public Integer getStatus() { return status; } @@ -208,6 +235,8 @@ public class BsUser implements Serializable { && (this.getWechatNum() == null ? other.getWechatNum() == null : this.getWechatNum().equals(other.getWechatNum())) && (this.getInviteUserId() == null ? other.getInviteUserId() == null : this.getInviteUserId().equals(other.getInviteUserId())) && (this.getInviteTime() == null ? other.getInviteTime() == null : this.getInviteTime().equals(other.getInviteTime())) + && (this.getPartnerLevel() == null ? other.getPartnerLevel() == null : this.getPartnerLevel().equals(other.getPartnerLevel())) + && (this.getPartnerIncomePer() == null ? other.getPartnerIncomePer() == null : this.getPartnerIncomePer().equals(other.getPartnerIncomePer())) && (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())) @@ -228,6 +257,8 @@ public class BsUser implements Serializable { result = prime * result + ((getWechatNum() == null) ? 0 : getWechatNum().hashCode()); result = prime * result + ((getInviteUserId() == null) ? 0 : getInviteUserId().hashCode()); result = prime * result + ((getInviteTime() == null) ? 0 : getInviteTime().hashCode()); + result = prime * result + ((getPartnerLevel() == null) ? 0 : getPartnerLevel().hashCode()); + result = prime * result + ((getPartnerIncomePer() == null) ? 0 : getPartnerIncomePer().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()); @@ -251,6 +282,8 @@ public class BsUser implements Serializable { sb.append(", wechatNum=").append(wechatNum); sb.append(", inviteUserId=").append(inviteUserId); sb.append(", inviteTime=").append(inviteTime); + sb.append(", partnerLevel=").append(partnerLevel); + sb.append(", partnerIncomePer=").append(partnerIncomePer); sb.append(", status=").append(status); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); diff --git a/service/src/main/java/com/hfkj/entity/BsUserExample.java b/service/src/main/java/com/hfkj/entity/BsUserExample.java index 43d5a69..f305789 100644 --- a/service/src/main/java/com/hfkj/entity/BsUserExample.java +++ b/service/src/main/java/com/hfkj/entity/BsUserExample.java @@ -1,5 +1,6 @@ package com.hfkj.entity; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -645,6 +646,126 @@ public class BsUserExample { return (Criteria) this; } + public Criteria andPartnerLevelIsNull() { + addCriterion("partner_level is null"); + return (Criteria) this; + } + + public Criteria andPartnerLevelIsNotNull() { + addCriterion("partner_level is not null"); + return (Criteria) this; + } + + public Criteria andPartnerLevelEqualTo(Integer value) { + addCriterion("partner_level =", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelNotEqualTo(Integer value) { + addCriterion("partner_level <>", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelGreaterThan(Integer value) { + addCriterion("partner_level >", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelGreaterThanOrEqualTo(Integer value) { + addCriterion("partner_level >=", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelLessThan(Integer value) { + addCriterion("partner_level <", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelLessThanOrEqualTo(Integer value) { + addCriterion("partner_level <=", value, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelIn(List values) { + addCriterion("partner_level in", values, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelNotIn(List values) { + addCriterion("partner_level not in", values, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelBetween(Integer value1, Integer value2) { + addCriterion("partner_level between", value1, value2, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerLevelNotBetween(Integer value1, Integer value2) { + addCriterion("partner_level not between", value1, value2, "partnerLevel"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerIsNull() { + addCriterion("partner_income_per is null"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerIsNotNull() { + addCriterion("partner_income_per is not null"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerEqualTo(BigDecimal value) { + addCriterion("partner_income_per =", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerNotEqualTo(BigDecimal value) { + addCriterion("partner_income_per <>", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerGreaterThan(BigDecimal value) { + addCriterion("partner_income_per >", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("partner_income_per >=", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerLessThan(BigDecimal value) { + addCriterion("partner_income_per <", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerLessThanOrEqualTo(BigDecimal value) { + addCriterion("partner_income_per <=", value, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerIn(List values) { + addCriterion("partner_income_per in", values, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerNotIn(List values) { + addCriterion("partner_income_per not in", values, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("partner_income_per between", value1, value2, "partnerIncomePer"); + return (Criteria) this; + } + + public Criteria andPartnerIncomePerNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("partner_income_per not between", value1, value2, "partnerIncomePer"); + return (Criteria) this; + } + public Criteria andStatusIsNull() { addCriterion("`status` is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/entity/BsUserGradeConfig.java b/service/src/main/java/com/hfkj/entity/BsUserGradeConfig.java new file mode 100644 index 0000000..137beef --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserGradeConfig.java @@ -0,0 +1,230 @@ +package com.hfkj.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * bs_user_grade_config + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class BsUserGradeConfig implements Serializable { + private Integer id; + + /** + * 等级 + */ + private Integer grade; + + /** + * 等级收益 + */ + private BigDecimal gradeIncomeRatio; + + /** + * 订单收益 + */ + private BigDecimal orderIncomeRatio; + + /** + * 晋升条件1 + */ + private BigDecimal promotionConditions1; + + /** + * 晋升条件2 + */ + private BigDecimal promotionConditions2; + + /** + * 晋升条件3 + */ + private BigDecimal promotionConditions3; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 修改时间 + */ + private Date updateTime; + + private String ext1; + + private String ext2; + + private String ext3; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getGrade() { + return grade; + } + + public void setGrade(Integer grade) { + this.grade = grade; + } + + public BigDecimal getGradeIncomeRatio() { + return gradeIncomeRatio; + } + + public void setGradeIncomeRatio(BigDecimal gradeIncomeRatio) { + this.gradeIncomeRatio = gradeIncomeRatio; + } + + public BigDecimal getOrderIncomeRatio() { + return orderIncomeRatio; + } + + public void setOrderIncomeRatio(BigDecimal orderIncomeRatio) { + this.orderIncomeRatio = orderIncomeRatio; + } + + public BigDecimal getPromotionConditions1() { + return promotionConditions1; + } + + public void setPromotionConditions1(BigDecimal promotionConditions1) { + this.promotionConditions1 = promotionConditions1; + } + + public BigDecimal getPromotionConditions2() { + return promotionConditions2; + } + + public void setPromotionConditions2(BigDecimal promotionConditions2) { + this.promotionConditions2 = promotionConditions2; + } + + public BigDecimal getPromotionConditions3() { + return promotionConditions3; + } + + public void setPromotionConditions3(BigDecimal promotionConditions3) { + this.promotionConditions3 = promotionConditions3; + } + + 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; + } + BsUserGradeConfig other = (BsUserGradeConfig) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getGrade() == null ? other.getGrade() == null : this.getGrade().equals(other.getGrade())) + && (this.getGradeIncomeRatio() == null ? other.getGradeIncomeRatio() == null : this.getGradeIncomeRatio().equals(other.getGradeIncomeRatio())) + && (this.getOrderIncomeRatio() == null ? other.getOrderIncomeRatio() == null : this.getOrderIncomeRatio().equals(other.getOrderIncomeRatio())) + && (this.getPromotionConditions1() == null ? other.getPromotionConditions1() == null : this.getPromotionConditions1().equals(other.getPromotionConditions1())) + && (this.getPromotionConditions2() == null ? other.getPromotionConditions2() == null : this.getPromotionConditions2().equals(other.getPromotionConditions2())) + && (this.getPromotionConditions3() == null ? other.getPromotionConditions3() == null : this.getPromotionConditions3().equals(other.getPromotionConditions3())) + && (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 + ((getGrade() == null) ? 0 : getGrade().hashCode()); + result = prime * result + ((getGradeIncomeRatio() == null) ? 0 : getGradeIncomeRatio().hashCode()); + result = prime * result + ((getOrderIncomeRatio() == null) ? 0 : getOrderIncomeRatio().hashCode()); + result = prime * result + ((getPromotionConditions1() == null) ? 0 : getPromotionConditions1().hashCode()); + result = prime * result + ((getPromotionConditions2() == null) ? 0 : getPromotionConditions2().hashCode()); + result = prime * result + ((getPromotionConditions3() == null) ? 0 : getPromotionConditions3().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(", grade=").append(grade); + sb.append(", gradeIncomeRatio=").append(gradeIncomeRatio); + sb.append(", orderIncomeRatio=").append(orderIncomeRatio); + sb.append(", promotionConditions1=").append(promotionConditions1); + sb.append(", promotionConditions2=").append(promotionConditions2); + sb.append(", promotionConditions3=").append(promotionConditions3); + 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(); + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsUserGradeConfigExample.java b/service/src/main/java/com/hfkj/entity/BsUserGradeConfigExample.java new file mode 100644 index 0000000..b8cb000 --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserGradeConfigExample.java @@ -0,0 +1,974 @@ +package com.hfkj.entity; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class BsUserGradeConfigExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public BsUserGradeConfigExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andGradeIsNull() { + addCriterion("grade is null"); + return (Criteria) this; + } + + public Criteria andGradeIsNotNull() { + addCriterion("grade is not null"); + return (Criteria) this; + } + + public Criteria andGradeEqualTo(Integer value) { + addCriterion("grade =", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeNotEqualTo(Integer value) { + addCriterion("grade <>", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeGreaterThan(Integer value) { + addCriterion("grade >", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeGreaterThanOrEqualTo(Integer value) { + addCriterion("grade >=", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeLessThan(Integer value) { + addCriterion("grade <", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeLessThanOrEqualTo(Integer value) { + addCriterion("grade <=", value, "grade"); + return (Criteria) this; + } + + public Criteria andGradeIn(List values) { + addCriterion("grade in", values, "grade"); + return (Criteria) this; + } + + public Criteria andGradeNotIn(List values) { + addCriterion("grade not in", values, "grade"); + return (Criteria) this; + } + + public Criteria andGradeBetween(Integer value1, Integer value2) { + addCriterion("grade between", value1, value2, "grade"); + return (Criteria) this; + } + + public Criteria andGradeNotBetween(Integer value1, Integer value2) { + addCriterion("grade not between", value1, value2, "grade"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioIsNull() { + addCriterion("grade_income_ratio is null"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioIsNotNull() { + addCriterion("grade_income_ratio is not null"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioEqualTo(BigDecimal value) { + addCriterion("grade_income_ratio =", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioNotEqualTo(BigDecimal value) { + addCriterion("grade_income_ratio <>", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioGreaterThan(BigDecimal value) { + addCriterion("grade_income_ratio >", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("grade_income_ratio >=", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioLessThan(BigDecimal value) { + addCriterion("grade_income_ratio <", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioLessThanOrEqualTo(BigDecimal value) { + addCriterion("grade_income_ratio <=", value, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioIn(List values) { + addCriterion("grade_income_ratio in", values, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioNotIn(List values) { + addCriterion("grade_income_ratio not in", values, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("grade_income_ratio between", value1, value2, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andGradeIncomeRatioNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("grade_income_ratio not between", value1, value2, "gradeIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioIsNull() { + addCriterion("order_income_ratio is null"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioIsNotNull() { + addCriterion("order_income_ratio is not null"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioEqualTo(BigDecimal value) { + addCriterion("order_income_ratio =", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioNotEqualTo(BigDecimal value) { + addCriterion("order_income_ratio <>", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioGreaterThan(BigDecimal value) { + addCriterion("order_income_ratio >", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("order_income_ratio >=", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioLessThan(BigDecimal value) { + addCriterion("order_income_ratio <", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioLessThanOrEqualTo(BigDecimal value) { + addCriterion("order_income_ratio <=", value, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioIn(List values) { + addCriterion("order_income_ratio in", values, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioNotIn(List values) { + addCriterion("order_income_ratio not in", values, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("order_income_ratio between", value1, value2, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andOrderIncomeRatioNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("order_income_ratio not between", value1, value2, "orderIncomeRatio"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1IsNull() { + addCriterion("promotion_conditions_1 is null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1IsNotNull() { + addCriterion("promotion_conditions_1 is not null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1EqualTo(BigDecimal value) { + addCriterion("promotion_conditions_1 =", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1NotEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_1 <>", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1GreaterThan(BigDecimal value) { + addCriterion("promotion_conditions_1 >", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1GreaterThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_1 >=", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1LessThan(BigDecimal value) { + addCriterion("promotion_conditions_1 <", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1LessThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_1 <=", value, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1In(List values) { + addCriterion("promotion_conditions_1 in", values, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1NotIn(List values) { + addCriterion("promotion_conditions_1 not in", values, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1Between(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_1 between", value1, value2, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions1NotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_1 not between", value1, value2, "promotionConditions1"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2IsNull() { + addCriterion("promotion_conditions_2 is null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2IsNotNull() { + addCriterion("promotion_conditions_2 is not null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2EqualTo(BigDecimal value) { + addCriterion("promotion_conditions_2 =", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2NotEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_2 <>", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2GreaterThan(BigDecimal value) { + addCriterion("promotion_conditions_2 >", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2GreaterThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_2 >=", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2LessThan(BigDecimal value) { + addCriterion("promotion_conditions_2 <", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2LessThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_2 <=", value, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2In(List values) { + addCriterion("promotion_conditions_2 in", values, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2NotIn(List values) { + addCriterion("promotion_conditions_2 not in", values, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2Between(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_2 between", value1, value2, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions2NotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_2 not between", value1, value2, "promotionConditions2"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3IsNull() { + addCriterion("promotion_conditions_3 is null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3IsNotNull() { + addCriterion("promotion_conditions_3 is not null"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3EqualTo(BigDecimal value) { + addCriterion("promotion_conditions_3 =", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3NotEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_3 <>", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3GreaterThan(BigDecimal value) { + addCriterion("promotion_conditions_3 >", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3GreaterThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_3 >=", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3LessThan(BigDecimal value) { + addCriterion("promotion_conditions_3 <", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3LessThanOrEqualTo(BigDecimal value) { + addCriterion("promotion_conditions_3 <=", value, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3In(List values) { + addCriterion("promotion_conditions_3 in", values, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3NotIn(List values) { + addCriterion("promotion_conditions_3 not in", values, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3Between(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_3 between", value1, value2, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andPromotionConditions3NotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("promotion_conditions_3 not between", value1, value2, "promotionConditions3"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andExt1IsNull() { + addCriterion("ext_1 is null"); + return (Criteria) this; + } + + public Criteria andExt1IsNotNull() { + addCriterion("ext_1 is not null"); + return (Criteria) this; + } + + public Criteria andExt1EqualTo(String value) { + addCriterion("ext_1 =", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotEqualTo(String value) { + addCriterion("ext_1 <>", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThan(String value) { + addCriterion("ext_1 >", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThanOrEqualTo(String value) { + addCriterion("ext_1 >=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThan(String value) { + addCriterion("ext_1 <", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThanOrEqualTo(String value) { + addCriterion("ext_1 <=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Like(String value) { + addCriterion("ext_1 like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotLike(String value) { + addCriterion("ext_1 not like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1In(List values) { + addCriterion("ext_1 in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotIn(List values) { + addCriterion("ext_1 not in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Between(String value1, String value2) { + addCriterion("ext_1 between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotBetween(String value1, String value2) { + addCriterion("ext_1 not between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt2IsNull() { + addCriterion("ext_2 is null"); + return (Criteria) this; + } + + public Criteria andExt2IsNotNull() { + addCriterion("ext_2 is not null"); + return (Criteria) this; + } + + public Criteria andExt2EqualTo(String value) { + addCriterion("ext_2 =", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotEqualTo(String value) { + addCriterion("ext_2 <>", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThan(String value) { + addCriterion("ext_2 >", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThanOrEqualTo(String value) { + addCriterion("ext_2 >=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThan(String value) { + addCriterion("ext_2 <", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThanOrEqualTo(String value) { + addCriterion("ext_2 <=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Like(String value) { + addCriterion("ext_2 like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotLike(String value) { + addCriterion("ext_2 not like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2In(List values) { + addCriterion("ext_2 in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotIn(List values) { + addCriterion("ext_2 not in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Between(String value1, String value2) { + addCriterion("ext_2 between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotBetween(String value1, String value2) { + addCriterion("ext_2 not between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt3IsNull() { + addCriterion("ext_3 is null"); + return (Criteria) this; + } + + public Criteria andExt3IsNotNull() { + addCriterion("ext_3 is not null"); + return (Criteria) this; + } + + public Criteria andExt3EqualTo(String value) { + addCriterion("ext_3 =", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotEqualTo(String value) { + addCriterion("ext_3 <>", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThan(String value) { + addCriterion("ext_3 >", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThanOrEqualTo(String value) { + addCriterion("ext_3 >=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThan(String value) { + addCriterion("ext_3 <", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThanOrEqualTo(String value) { + addCriterion("ext_3 <=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Like(String value) { + addCriterion("ext_3 like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotLike(String value) { + addCriterion("ext_3 not like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3In(List values) { + addCriterion("ext_3 in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotIn(List values) { + addCriterion("ext_3 not in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Between(String value1, String value2) { + addCriterion("ext_3 between", value1, value2, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotBetween(String value1, String value2) { + addCriterion("ext_3 not between", value1, value2, "ext3"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsUserGradeCount.java b/service/src/main/java/com/hfkj/entity/BsUserGradeCount.java new file mode 100644 index 0000000..54e7e4b --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserGradeCount.java @@ -0,0 +1,174 @@ +package com.hfkj.entity; + +import java.io.Serializable; +import java.util.Date; + +/** + * bs_user_grade_count + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class BsUserGradeCount implements Serializable { + /** + * 主键 + */ + private Long id; + + /** + * 统计周期 + */ + private Date startTime; + + /** + * 统计周期 + */ + private Date endTime; + + /** + * 见习会员数量 + */ + private Long grade1; + + /** + * 正式会员数量 + */ + private Long grade2; + + /** + * 团长数量 + */ + private Long grade3; + + /** + * 渠道数量 + */ + private Long grade4; + + private Date createTime; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public Long getGrade1() { + return grade1; + } + + public void setGrade1(Long grade1) { + this.grade1 = grade1; + } + + public Long getGrade2() { + return grade2; + } + + public void setGrade2(Long grade2) { + this.grade2 = grade2; + } + + public Long getGrade3() { + return grade3; + } + + public void setGrade3(Long grade3) { + this.grade3 = grade3; + } + + public Long getGrade4() { + return grade4; + } + + public void setGrade4(Long grade4) { + this.grade4 = grade4; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + BsUserGradeCount other = (BsUserGradeCount) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime())) + && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime())) + && (this.getGrade1() == null ? other.getGrade1() == null : this.getGrade1().equals(other.getGrade1())) + && (this.getGrade2() == null ? other.getGrade2() == null : this.getGrade2().equals(other.getGrade2())) + && (this.getGrade3() == null ? other.getGrade3() == null : this.getGrade3().equals(other.getGrade3())) + && (this.getGrade4() == null ? other.getGrade4() == null : this.getGrade4().equals(other.getGrade4())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode()); + result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode()); + result = prime * result + ((getGrade1() == null) ? 0 : getGrade1().hashCode()); + result = prime * result + ((getGrade2() == null) ? 0 : getGrade2().hashCode()); + result = prime * result + ((getGrade3() == null) ? 0 : getGrade3().hashCode()); + result = prime * result + ((getGrade4() == null) ? 0 : getGrade4().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().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(", startTime=").append(startTime); + sb.append(", endTime=").append(endTime); + sb.append(", grade1=").append(grade1); + sb.append(", grade2=").append(grade2); + sb.append(", grade3=").append(grade3); + sb.append(", grade4=").append(grade4); + sb.append(", createTime=").append(createTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsUserGradeCountExample.java b/service/src/main/java/com/hfkj/entity/BsUserGradeCountExample.java new file mode 100644 index 0000000..9411bed --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserGradeCountExample.java @@ -0,0 +1,703 @@ +package com.hfkj.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class BsUserGradeCountExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public BsUserGradeCountExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andStartTimeIsNull() { + addCriterion("start_time is null"); + return (Criteria) this; + } + + public Criteria andStartTimeIsNotNull() { + addCriterion("start_time is not null"); + return (Criteria) this; + } + + public Criteria andStartTimeEqualTo(Date value) { + addCriterion("start_time =", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotEqualTo(Date value) { + addCriterion("start_time <>", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeGreaterThan(Date value) { + addCriterion("start_time >", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeGreaterThanOrEqualTo(Date value) { + addCriterion("start_time >=", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeLessThan(Date value) { + addCriterion("start_time <", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeLessThanOrEqualTo(Date value) { + addCriterion("start_time <=", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeIn(List values) { + addCriterion("start_time in", values, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotIn(List values) { + addCriterion("start_time not in", values, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeBetween(Date value1, Date value2) { + addCriterion("start_time between", value1, value2, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotBetween(Date value1, Date value2) { + addCriterion("start_time not between", value1, value2, "startTime"); + return (Criteria) this; + } + + public Criteria andEndTimeIsNull() { + addCriterion("end_time is null"); + return (Criteria) this; + } + + public Criteria andEndTimeIsNotNull() { + addCriterion("end_time is not null"); + return (Criteria) this; + } + + public Criteria andEndTimeEqualTo(Date value) { + addCriterion("end_time =", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotEqualTo(Date value) { + addCriterion("end_time <>", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeGreaterThan(Date value) { + addCriterion("end_time >", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeGreaterThanOrEqualTo(Date value) { + addCriterion("end_time >=", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeLessThan(Date value) { + addCriterion("end_time <", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeLessThanOrEqualTo(Date value) { + addCriterion("end_time <=", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeIn(List values) { + addCriterion("end_time in", values, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotIn(List values) { + addCriterion("end_time not in", values, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeBetween(Date value1, Date value2) { + addCriterion("end_time between", value1, value2, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotBetween(Date value1, Date value2) { + addCriterion("end_time not between", value1, value2, "endTime"); + return (Criteria) this; + } + + public Criteria andGrade1IsNull() { + addCriterion("grade1 is null"); + return (Criteria) this; + } + + public Criteria andGrade1IsNotNull() { + addCriterion("grade1 is not null"); + return (Criteria) this; + } + + public Criteria andGrade1EqualTo(Long value) { + addCriterion("grade1 =", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1NotEqualTo(Long value) { + addCriterion("grade1 <>", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1GreaterThan(Long value) { + addCriterion("grade1 >", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1GreaterThanOrEqualTo(Long value) { + addCriterion("grade1 >=", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1LessThan(Long value) { + addCriterion("grade1 <", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1LessThanOrEqualTo(Long value) { + addCriterion("grade1 <=", value, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1In(List values) { + addCriterion("grade1 in", values, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1NotIn(List values) { + addCriterion("grade1 not in", values, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1Between(Long value1, Long value2) { + addCriterion("grade1 between", value1, value2, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade1NotBetween(Long value1, Long value2) { + addCriterion("grade1 not between", value1, value2, "grade1"); + return (Criteria) this; + } + + public Criteria andGrade2IsNull() { + addCriterion("grade2 is null"); + return (Criteria) this; + } + + public Criteria andGrade2IsNotNull() { + addCriterion("grade2 is not null"); + return (Criteria) this; + } + + public Criteria andGrade2EqualTo(Long value) { + addCriterion("grade2 =", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2NotEqualTo(Long value) { + addCriterion("grade2 <>", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2GreaterThan(Long value) { + addCriterion("grade2 >", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2GreaterThanOrEqualTo(Long value) { + addCriterion("grade2 >=", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2LessThan(Long value) { + addCriterion("grade2 <", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2LessThanOrEqualTo(Long value) { + addCriterion("grade2 <=", value, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2In(List values) { + addCriterion("grade2 in", values, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2NotIn(List values) { + addCriterion("grade2 not in", values, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2Between(Long value1, Long value2) { + addCriterion("grade2 between", value1, value2, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade2NotBetween(Long value1, Long value2) { + addCriterion("grade2 not between", value1, value2, "grade2"); + return (Criteria) this; + } + + public Criteria andGrade3IsNull() { + addCriterion("grade3 is null"); + return (Criteria) this; + } + + public Criteria andGrade3IsNotNull() { + addCriterion("grade3 is not null"); + return (Criteria) this; + } + + public Criteria andGrade3EqualTo(Long value) { + addCriterion("grade3 =", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3NotEqualTo(Long value) { + addCriterion("grade3 <>", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3GreaterThan(Long value) { + addCriterion("grade3 >", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3GreaterThanOrEqualTo(Long value) { + addCriterion("grade3 >=", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3LessThan(Long value) { + addCriterion("grade3 <", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3LessThanOrEqualTo(Long value) { + addCriterion("grade3 <=", value, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3In(List values) { + addCriterion("grade3 in", values, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3NotIn(List values) { + addCriterion("grade3 not in", values, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3Between(Long value1, Long value2) { + addCriterion("grade3 between", value1, value2, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade3NotBetween(Long value1, Long value2) { + addCriterion("grade3 not between", value1, value2, "grade3"); + return (Criteria) this; + } + + public Criteria andGrade4IsNull() { + addCriterion("grade4 is null"); + return (Criteria) this; + } + + public Criteria andGrade4IsNotNull() { + addCriterion("grade4 is not null"); + return (Criteria) this; + } + + public Criteria andGrade4EqualTo(Long value) { + addCriterion("grade4 =", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4NotEqualTo(Long value) { + addCriterion("grade4 <>", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4GreaterThan(Long value) { + addCriterion("grade4 >", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4GreaterThanOrEqualTo(Long value) { + addCriterion("grade4 >=", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4LessThan(Long value) { + addCriterion("grade4 <", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4LessThanOrEqualTo(Long value) { + addCriterion("grade4 <=", value, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4In(List values) { + addCriterion("grade4 in", values, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4NotIn(List values) { + addCriterion("grade4 not in", values, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4Between(Long value1, Long value2) { + addCriterion("grade4 between", value1, value2, "grade4"); + return (Criteria) this; + } + + public Criteria andGrade4NotBetween(Long value1, Long value2) { + addCriterion("grade4 not between", value1, value2, "grade4"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/model/BsOrderModel.java b/service/src/main/java/com/hfkj/model/BsOrderModel.java new file mode 100644 index 0000000..d0f114f --- /dev/null +++ b/service/src/main/java/com/hfkj/model/BsOrderModel.java @@ -0,0 +1,24 @@ +package com.hfkj.model; + +import com.hfkj.entity.BsOrder; +import lombok.Data; + +@Data +public class BsOrderModel extends BsOrder { + + + /** + * 关系类型 1:直属好友 2:团队成员 + */ + private Integer relType; + + /** + * 用户id + */ + private Long userId; + + /** + * 名称 + */ + private String name; +} diff --git a/service/src/main/java/com/hfkj/service/cornucopia/Impl/BsCornucopiaLotteryRecordServiceImpl.java b/service/src/main/java/com/hfkj/service/cornucopia/Impl/BsCornucopiaLotteryRecordServiceImpl.java index 67f3d43..7601cac 100644 --- a/service/src/main/java/com/hfkj/service/cornucopia/Impl/BsCornucopiaLotteryRecordServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/cornucopia/Impl/BsCornucopiaLotteryRecordServiceImpl.java @@ -56,11 +56,11 @@ public class BsCornucopiaLotteryRecordServiceImpl implements BsCornucopiaLottery if (MapUtils.getInteger(map, "type") != null) { criteria.andTypeEqualTo(MapUtils.getInteger(map, "type")); } - if (MapUtils.getLong(map, "startTime") != null) { - criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "startTime"))); + if (MapUtils.getLong(map, "createTimeS") != null) { + criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "createTimeS"))); } - if (MapUtils.getLong(map, "endTime") != null) { - criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(map, "endTime"))); + if (MapUtils.getLong(map, "createTimeE") != null) { + criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(map, "createTimeE"))); } if (MapUtils.getString(map, "lotteryNo") != null) { criteria.andLotteryNoLike("%" + MapUtils.getString(map, "lotteryNo") + "%"); diff --git a/service/src/main/java/com/hfkj/service/elm/ElmService.java b/service/src/main/java/com/hfkj/service/elm/ElmService.java new file mode 100644 index 0000000..84ad5df --- /dev/null +++ b/service/src/main/java/com/hfkj/service/elm/ElmService.java @@ -0,0 +1,99 @@ +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.AlibabaAlscUnionMediaZoneAddRequest; +import com.taobao.api.response.AlibabaAlscUnionElemePromotionOfficialactivityGetResponse; +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 { + + private static Logger log = LoggerFactory.getLogger(TaoBaoService.class); + + + 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 { + + // 打印日志,开始本地联盟饿了么推广官方活动查询 + log.info("============ 本地联盟饿了么推广官方活动查询-START ============="); + + // 创建淘宝客户端 + TaobaoClient client = new DefaultTaobaoClient(url, appKey, appsecret); + // 创建请求对象 + AlibabaAlscUnionElemePromotionOfficialactivityGetRequest req = new AlibabaAlscUnionElemePromotionOfficialactivityGetRequest(); + // 创建活动请求对象 + AlibabaAlscUnionElemePromotionOfficialactivityGetRequest.ActivityRequest obj1 = new AlibabaAlscUnionElemePromotionOfficialactivityGetRequest.ActivityRequest(); + // 设置pid + obj1.setPid(pid); + // 设置活动id + obj1.setActivityId(activityId); + // 设置sid + obj1.setSid(userId.toString()); + // 设置请求参数 + req.setQueryRequest(obj1); + // 执行请求 + AlibabaAlscUnionElemePromotionOfficialactivityGetResponse rsp = client.execute(req); + + // 打印日志,请求接口 + log.info("请求接口:" + "officialactivity"); + // 打印日志,请求参数 + log.info("请求参数:" + JSONObject.toJSONString(obj1)); + // 打印日志,响应参数 + log.info("响应参数:" + rsp); + // 打印日志,结束本地联盟饿了么推广官方活动查询 + log.info("============ 本地联盟饿了么推广官方活动查询--END =============="); + // 返回响应参数 + return JSONObject.parseObject(JSON.toJSONString(rsp.getData().getLink())); + + } + + + public static JSONObject mediaZoneAdd(String sessionKey) throws Exception { + + // 打印日志, 本地生活媒体推广位创建 + log.info("============ 本地生活媒体推广位创建-START ============="); + + // 创建淘宝客户端 + TaobaoClient client = new DefaultTaobaoClient(url, appKey, appsecret); + AlibabaAlscUnionMediaZoneAddRequest req = new AlibabaAlscUnionMediaZoneAddRequest(); + req.setZoneName("推广位"); + req.setMediaId("1"); + AlibabaAlscUnionMediaZoneAddResponse rsp = client.execute(req, sessionKey); + + // 打印日志,请求接口 + log.info("请求接口:" + "officialactivity"); + // 打印日志,请求参数 + log.info("请求参数:" + JSONObject.toJSONString(req)); + // 打印日志,响应参数 + log.info("响应参数:" + rsp); + // 打印日志, 本地生活媒体推广位创建 + log.info("============ 本地生活媒体推广位创建--END =============="); + // 返回响应参数 + return JSONObject.parseObject(JSON.toJSONString(rsp)); + + } +} diff --git a/service/src/main/java/com/hfkj/service/meituan/MeiTuanService.java b/service/src/main/java/com/hfkj/service/meituan/MeiTuanService.java index 35c2ad6..738b14a 100644 --- a/service/src/main/java/com/hfkj/service/meituan/MeiTuanService.java +++ b/service/src/main/java/com/hfkj/service/meituan/MeiTuanService.java @@ -33,6 +33,25 @@ public class MeiTuanService { } } + /** + * @MethodName orderList + * @Description: 订单列表查询接口 + * @param param + * @return: com.alibaba.fastjson.JSONObject + * @Author: Sum1Dream + * @Date: 2024/10/23 上午10:42 + */ + public static JSONObject orderList(JSONObject param)throws Exception { + JSONObject object = request("order" , param); + + if (object.getInteger("status").equals(0)) { + return object; + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("des")); + } + } + + /** * @MethodName request * @Description: 统一请求 diff --git a/service/src/main/java/com/hfkj/service/order/BsOrderService.java b/service/src/main/java/com/hfkj/service/order/BsOrderService.java index 1cd6103..ef41422 100644 --- a/service/src/main/java/com/hfkj/service/order/BsOrderService.java +++ b/service/src/main/java/com/hfkj/service/order/BsOrderService.java @@ -2,6 +2,7 @@ package com.hfkj.service.order; import com.alibaba.fastjson.JSONObject; import com.hfkj.entity.BsOrder; +import com.hfkj.model.BsOrderModel; import java.util.List; import java.util.Map; @@ -34,14 +35,6 @@ public interface BsOrderService { * @return */ void cacheDelete(String orderNo); - - /** - * 创建订单 - * @param jsonObject 订单 - * @return - */ - JSONObject create(JSONObject jsonObject) throws Exception; - /** * @MethodName findByOrderNo * @Description: 查询订单 @@ -62,5 +55,26 @@ public interface BsOrderService { */ List getOrderList(Map map); + /** + * @MethodName getOrderList + * @Description:用时间段查询推广订单接口 + * @param + * @return: com.alibaba.fastjson.JSONObject + * @Author: Sum1Dream + * @Date: 2024/10/23 上午10:27 + */ + JSONObject getOrderList() throws Exception; + + /** + * @MethodName getOrderListParent + * @Description: 获取订单 + * @param map + * @return: java.util.List + * @Author: Sum1Dream + * @Date: 2024/10/24 下午2:52 + */ + List getOrderListParent(Map map); + + } diff --git a/service/src/main/java/com/hfkj/service/order/Impl/BsOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/order/Impl/BsOrderServiceImpl.java index e269e8e..244d94e 100644 --- a/service/src/main/java/com/hfkj/service/order/Impl/BsOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/Impl/BsOrderServiceImpl.java @@ -1,20 +1,31 @@ package com.hfkj.service.order.Impl; 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.OrderUtil; import com.hfkj.common.utils.RedisUtil; import com.hfkj.dao.BsOrderMapper; import com.hfkj.entity.BsOrder; import com.hfkj.entity.BsOrderExample; +import com.hfkj.model.BsOrderModel; +import com.hfkj.model.UserTeamModel; 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.user.BsUserParentRelService; import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.OrderUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.*; +import java.util.stream.Collectors; @Service("bsOrderService") public class BsOrderServiceImpl implements BsOrderService { @@ -31,7 +42,7 @@ public class BsOrderServiceImpl implements BsOrderService { private BsOrderMapper bsOrderMapper; @Resource - private OrderBusinessService orderBusinessService; + private BsUserParentRelService userParentRelService; @Override public BsOrder editData(BsOrder order) { @@ -54,44 +65,6 @@ public class BsOrderServiceImpl implements BsOrderService { redisUtil.del(CACHE_KEY + orderNo); } - @Override - public JSONObject create(JSONObject body) throws Exception { - - BsOrder order = new BsOrder(); - order.setOrderNo(OrderUtil.generateOrderNo()); - order.setUpdateTime(new Date()); - order.setCreateTime(new Date()); - order.setStatus(20); - order.setTotalPrice(body.getBigDecimal("totalPrice")); - order.setUserPhone(body.getString("phone")); - order.setUserId(body.getLong("userId")); - - JSONObject map = new JSONObject(); - map.put("orderNo", order.getOrderNo()); - map.put("uid", order.getUserId()); - map.put("searchId", body.getString("searchId")); - map.put("goodsSign", body.getString("goodsSign")); - map.put("url", body.getString("url")); - order.setCustomparameters(map.toJSONString()); - order.setGoodsName(body.getString("goodsName")); - order.setType(body.getInteger("type")); - order.setImg(body.getString("img")); - - bsOrderMapper.insert(order); - - // 淘宝订单业务 - if (body.getInteger("type") == 1) { - return orderBusinessService.taobaoUrl(order); - } - // 拼多多订单业务 - if (body.getInteger("type") == 2) { - return orderBusinessService.pddUrl(order); - } - - - - return null; - } @Override public BsOrder findByOrderNo(String orderNo) { @@ -120,16 +93,16 @@ public class BsOrderServiceImpl implements BsOrderService { BsOrderExample example = new BsOrderExample(); BsOrderExample.Criteria criteria = example.createCriteria(); - if (MapUtils.getString(map , "orderNo") != null) { + if (StringUtils.isNotBlank(MapUtils.getString(map , "orderNo"))) { criteria.andOrderNoEqualTo(MapUtils.getString(map , "orderNo")); } if (MapUtils.getInteger(map , "type") != null) { criteria.andTypeEqualTo(MapUtils.getInteger(map , "type")); } - if (MapUtils.getString(map , "userPhone") != null) { + if (StringUtils.isNotBlank(MapUtils.getString(map , "userPhone"))) { criteria.andUserPhoneEqualTo(MapUtils.getString(map , "userPhone")); } - if (MapUtils.getString(map , "goodsName") != null) { + if (StringUtils.isNotBlank(MapUtils.getString(map , "goodsName"))) { criteria.andGoodsNameLike("%" + MapUtils.getString(map , "goodsName") + "%"); } if (MapUtils.getLong(map, "createTimeS") != null) { @@ -146,4 +119,64 @@ public class BsOrderServiceImpl implements BsOrderService { } return bsOrderMapper.selectByExample(example); } + + @Override + public JSONObject getOrderList() throws Exception{ + return PddService.getOrderList(); + } + + @Override + public List getOrderListParent(Map map) { + + // 判断map中是否包含userId键,如果不存在则抛出异常 + if (MapUtils.getLong(map , "userId") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前用户未登陆"); + } + + // 创建一个BsOrderModel类型的列表 + List orderModels = new ArrayList<>(); + + // 查询用户订单 + if (MapUtils.getInteger(map , "orderType").equals(1)) { + // 获取订单列表 + List list = getOrderList(map); + // 遍历订单列表 + for (BsOrder order :list) { + // 创建订单模型 + BsOrderModel orderModel = new BsOrderModel(); + // 将订单属性复制到订单模型中 + BeanUtils.copyProperties(order, orderModel); + // 将订单模型添加到订单模型列表中 + orderModels.add(orderModel); + } + return orderModels; + } + // 查询团队订单 + if (MapUtils.getInteger(map , "orderType").equals(2)) { + // 查询团队用户 + Map param = new HashMap<>(); + param.put("parentUserId", MapUtils.getLong(map , "userId")); + // 查询下级数据 + List subList = userParentRelService.getTeamSubList(param); + // 查询订单 + map.put("userId" , null); + List orderList = getOrderList(map); + // 遍历下级数据 + for (UserTeamModel userTeamModel : subList) { + List list = orderList.stream().filter(bsOrder -> bsOrder.getUserId().equals(userTeamModel.getUserId())).collect(Collectors.toList()); + for (BsOrder order : list) { + BsOrderModel orderModel = new BsOrderModel(); + BeanUtils.copyProperties(order, orderModel); + orderModel.setRelType(userTeamModel.getRelType()); + orderModel.setUserId(userTeamModel.getUserId()); + orderModel.setName(userTeamModel.getName()); + orderModels.add(orderModel); + } + } + return orderModels; + } + + + return null; + } } diff --git a/service/src/main/java/com/hfkj/service/order/OrderBusinessService.java b/service/src/main/java/com/hfkj/service/order/OrderBusinessService.java index a152a77..bc0071f 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderBusinessService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderBusinessService.java @@ -1,22 +1,9 @@ package com.hfkj.service.order; -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.ResponseMsgUtil; -import com.hfkj.dao.BsOrderMapper; -import com.hfkj.entity.BsOrder; -import com.hfkj.service.pdd.PddService; -import com.hfkj.service.taobao.TaoBaoService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.util.HashMap; -import java.util.Map; - - /** * 创建订单业务 * @className: OrderBusinessService @@ -28,41 +15,4 @@ public class OrderBusinessService { Logger log = LoggerFactory.getLogger(OrderBusinessService.class); - // 淘口令生成业务 - public JSONObject taobaoUrl(BsOrder bsOrder) throws Exception{ - JSONObject jsonObject = JSONObject.parseObject(bsOrder.getCustomparameters()); - JSONObject object = TaoBaoService.createCommand(jsonObject.getString("url")); - if (!object.getBoolean("success")) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!"); - } - return object.getJSONObject("data"); - - } - - //多多进宝推广链接生成 - public JSONObject pddUrl(BsOrder bsOrder) throws Exception{ - - JSONObject jsonObject = JSONObject.parseObject(bsOrder.getCustomparameters()); - String goodsSign = jsonObject.getString("goodsSign"); - String searchId = jsonObject.getString("searchId"); - - if (searchId == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "缺少searchId!"); - } - if (goodsSign == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "缺少goodsSign!"); - } - - Map mapUser = new HashMap<>(); - mapUser.put("uid", bsOrder.getUserId()); - - // 判断是否需要授权 - JSONObject object = PddService.authority(mapUser.toString()); - boolean generateAuthorityUrl = object.getJSONObject("authorityQueryResponse").getInteger("bind") == 0; - JSONObject o = PddService.promotion(searchId , goodsSign , generateAuthorityUrl , mapUser.toString()); - - return o.getJSONObject("goodsPromotionUrlGenerateResponse").getJSONArray("goodsPromotionUrlList").getJSONObject(0); - - } - } diff --git a/service/src/main/java/com/hfkj/service/partner/BsPartnerPoolService.java b/service/src/main/java/com/hfkj/service/partner/BsPartnerPoolService.java index cf63c9b..6b10847 100644 --- a/service/src/main/java/com/hfkj/service/partner/BsPartnerPoolService.java +++ b/service/src/main/java/com/hfkj/service/partner/BsPartnerPoolService.java @@ -44,6 +44,7 @@ public interface BsPartnerPoolService { * @Date: 2024/7/4 下午2:30 */ BsPartnerPool queryDetail(Long userId); + BsPartnerPool queryDetail(Long userId , Integer level); /** * @MethodName queryAllList diff --git a/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerLevelServiceImpl.java b/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerLevelServiceImpl.java index bfab83a..92f875b 100644 --- a/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerLevelServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerLevelServiceImpl.java @@ -8,6 +8,7 @@ import com.hfkj.entity.BsPartnerLevelExample; import com.hfkj.entity.BsPartnerPool; import com.hfkj.service.partner.BsPartnerLevelService; import com.hfkj.service.partner.BsPartnerPoolService; +import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -74,6 +75,10 @@ public class BsPartnerLevelServiceImpl implements BsPartnerLevelService { BsPartnerLevelExample example = new BsPartnerLevelExample(); BsPartnerLevelExample.Criteria criteria = example.createCriteria(); + if (MapUtils.getInteger(map, "level") != null) { + criteria.andLevelEqualTo(MapUtils.getInteger(map, "level")); + } + criteria.andStatusEqualTo(1); return bsPartnerLevelMapper.selectByExample(example); diff --git a/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerPoolPreServiceImpl.java b/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerPoolPreServiceImpl.java index e416f00..a906626 100644 --- a/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerPoolPreServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerPoolPreServiceImpl.java @@ -6,6 +6,7 @@ import com.hfkj.entity.BsPartnerPoolPre; import com.hfkj.entity.BsPartnerPoolPreExample; import com.hfkj.service.partner.BsPartnerPoolPreService; import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -75,6 +76,9 @@ public class BsPartnerPoolPreServiceImpl implements BsPartnerPoolPreService { if (MapUtils.getString(map, "num") != null) { criteria.andLotteryNoLike("%" + MapUtils.getString(map, "num") + "%"); } + if (StringUtils.isNotBlank(MapUtils.getString(map, "lotteryNo"))) { + criteria.andLotteryNoEqualTo(MapUtils.getString(map, "lotteryNo")); + } List list = bsPartnerPoolPreMapper.selectByExample(example); @@ -95,19 +99,19 @@ public class BsPartnerPoolPreServiceImpl implements BsPartnerPoolPreService { if (MapUtils.getInteger(map, "userId") != null) { criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); } - if (MapUtils.getString(map, "num") != null) { - criteria.andLotteryNoLike("%" + MapUtils.getString(map, "num") + "%"); + if (StringUtils.isNotBlank(MapUtils.getString(map, "num"))) { + criteria.andNumLike("%" + MapUtils.getString(map, "num") + "%"); } if (MapUtils.getInteger(map, "status") != null) { criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); } - if (MapUtils.getLong(map, "startTime") != null) { - criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "startTime"))); + if (MapUtils.getLong(map, "createTimeS") != null) { + criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "createTimeS"))); } - if (MapUtils.getLong(map, "endTime") != null) { - criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(map, "endTime"))); + if (MapUtils.getLong(map, "createTimeE") != null) { + criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(map, "createTimeE"))); } - if (MapUtils.getString(map, "lotteryNo") != null) { + if (StringUtils.isNotBlank(MapUtils.getString(map, "lotteryNo"))) { criteria.andLotteryNoEqualTo(MapUtils.getString(map, "lotteryNo")); } diff --git a/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerPoolServiceImpl.java b/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerPoolServiceImpl.java index fd69439..c23eb3c 100644 --- a/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerPoolServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerPoolServiceImpl.java @@ -44,6 +44,7 @@ public class BsPartnerPoolServiceImpl implements BsPartnerPoolService { } } + @Override public BsPartnerPool queryDetail(Long userId) { BsPartnerPoolExample example = new BsPartnerPoolExample(); @@ -59,6 +60,24 @@ public class BsPartnerPoolServiceImpl implements BsPartnerPoolService { return null; } + @Override + public BsPartnerPool queryDetail(Long userId , Integer level) { + BsPartnerPoolExample example = new BsPartnerPoolExample(); + BsPartnerPoolExample.Criteria criteria = example.createCriteria(); + if (level != null) { + criteria.andLevelEqualTo(level); + } + criteria.andUserIdEqualTo(userId); + + List list = bsPartnerPoolMapper.selectByExample(example); + + if (!list.isEmpty()) { + return list.get(0); + } + + return null; + } + @Override public List queryAllList(Map map) { BsPartnerPoolExample example = new BsPartnerPoolExample(); @@ -73,6 +92,7 @@ public class BsPartnerPoolServiceImpl implements BsPartnerPoolService { if (MapUtils.getString(map, "num") != null) { criteria.andNumLike("%" + MapUtils.getString(map, "num") + "%"); } + criteria.andUserIdIsNotNull(); criteria.andStatusEqualTo(1); return bsPartnerPoolMapper.selectByExample(example); diff --git a/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerUserRecordServiceImpl.java b/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerUserRecordServiceImpl.java index 9ec8e19..3d50404 100644 --- a/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerUserRecordServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/partner/Impl/BsPartnerUserRecordServiceImpl.java @@ -84,11 +84,11 @@ public class BsPartnerUserRecordServiceImpl implements BsPartnerUserRecordServic if (MapUtils.getString(map, "userName") != null) { criteria.andUserNameLike("%" + MapUtils.getString(map, "userName") + "%"); } - if (MapUtils.getLong(map, "startTime") != null) { - criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "startTime"))); + if (MapUtils.getLong(map, "createTimeS") != null) { + criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "createTimeS"))); } - if (MapUtils.getLong(map, "endTime") != null) { - criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(map, "endTime"))); + if (MapUtils.getLong(map, "createTimeE") != null) { + criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(map, "createTimeE"))); } if (MapUtils.getString(map, "lotteryNo") != null) { criteria.andLotteryNoLike("%" + MapUtils.getString(map, "lotteryNo") + "%"); diff --git a/service/src/main/java/com/hfkj/service/partner/Impl/PartnerServiceImpl.java b/service/src/main/java/com/hfkj/service/partner/Impl/PartnerServiceImpl.java index d0fd899..665dd39 100644 --- a/service/src/main/java/com/hfkj/service/partner/Impl/PartnerServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/partner/Impl/PartnerServiceImpl.java @@ -57,6 +57,14 @@ public class PartnerServiceImpl implements PartnerService { if (isPartner(jsonObject.getLong("userId"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户当期已投入!"); } + + Calendar calendar = Calendar.getInstance(); + // 获取当前的小时 + int hour = calendar.get(Calendar.HOUR_OF_DAY); + // 判断当前时间是否在 23点-24点之间 + if (hour >= 23) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前时间不允许投入!"); + } Long userId = jsonObject.getLong("userId"); BigDecimal goldCoin = jsonObject.getBigDecimal("goldCoin"); // 锁编号 @@ -164,30 +172,40 @@ public class PartnerServiceImpl implements PartnerService { List partnerPoolsPreL5 = partnerPoolPres.stream().filter(s-> s.getLevel().equals(5)).sorted(Comparator.comparing(BsPartnerPoolPre::getCampaignNo)).sorted(Comparator.comparing(BsPartnerPoolPre::getGoldCoin).reversed()).collect(Collectors.toList()); List pres = new ArrayList<>(); + List levelList = bsPartnerLevelService.queryAllList(new HashMap<>()); + // 查询开奖记录 + // 根据彩票号码查询合伙人池记录 BsPartnerPoolRecord partnerPoolRecord = bsPartnerPoolRecordService.queryDetail(lotteryNo); + // 如果合伙人池记录不为空 if (partnerPoolRecord != null) { + // 如果合伙人池记录状态为2,抛出异常 if (partnerPoolRecord.getStatus().equals(2)) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当期已经竞选结算!"); } + // 将合伙人池记录状态设置为2 partnerPoolRecord.setStatus(2); + // 设置彩票时间 partnerPoolRecord.setLotteryTime(new Date()); + // 更新合伙人池记录 bsPartnerPoolRecordService.edit(partnerPoolRecord); } - // todo 计算当期的时候需要先预站一个位置 如果当前用户大那么顺序往下走 // L1参选 for (BsPartnerPoolPre partnerPoolPre : partnerPoolsPreL1) { + // 如果合伙人池预约状态为1 if (partnerPoolPre.getStatus().equals(1)) { // 查询还未被占位的合伙人位置并且当前合伙人金额大于 List poolList = partnerPoolsL1.stream().filter(s-> s.getGoldCoin().compareTo(partnerPoolPre.getGoldCoin()) < 0).filter(s->s.getStatus().equals(1)).collect(Collectors.toList()); + // 如果查询结果不为空 if (!poolList.isEmpty()) { BsPartnerPool pool = poolList.get(0); // 竞选成功 if (pool.getUserId() != null) { - campaignPartner(partnerPoolPre , pool); + BsPartnerLevel level = levelList.stream().filter(s-> s.getLevel().equals(pool.getLevel())).findFirst().orElse(null); + campaignPartner(partnerPoolPre , pool , level); } // 配置参数 pool.setUserId(partnerPoolPre.getUserId()); @@ -212,14 +230,20 @@ public class PartnerServiceImpl implements PartnerService { // L2参选 for (BsPartnerPoolPre partnerPoolPre : partnerPoolsPreL2) { + // 如果合伙人池预约状态为1 if (partnerPoolPre.getStatus().equals(1)) { + // 查询还未被占位的合伙人位置并且当前合伙人金额大于 List poolList = partnerPoolsL2.stream().filter(s-> s.getGoldCoin().compareTo(partnerPoolPre.getGoldCoin()) < 0).filter(s->s.getStatus().equals(1)).collect(Collectors.toList()); + // 如果查询结果不为空 if (!poolList.isEmpty()) { BsPartnerPool pool = poolList.get(0); + // 竞选成功 if (pool.getUserId() != null) { - campaignPartner(partnerPoolPre , pool); + BsPartnerLevel level = levelList.stream().filter(s-> s.getLevel().equals(pool.getLevel())).findFirst().orElse(null); + campaignPartner(partnerPoolPre , pool , level); } + // 配置参数 pool.setUserId(partnerPoolPre.getUserId()); pool.setGoldCoin(partnerPoolPre.getGoldCoin()); pools.add(pool); @@ -232,6 +256,7 @@ public class PartnerServiceImpl implements PartnerService { }) .collect(Collectors.toList()); + // 配置预约竞选参数 partnerPoolPre.setStatus(2); partnerPoolPre.setNum(pool.getNum()); pres.add(partnerPoolPre); @@ -242,13 +267,19 @@ public class PartnerServiceImpl implements PartnerService { // L3参选 for (BsPartnerPoolPre partnerPoolPre : partnerPoolsPreL3) { + // 如果合伙人池预约状态为1 if (partnerPoolPre.getStatus().equals(1)) { + // 查询还未被占位的合伙人位置并且当前合伙人金额大于 List poolList = partnerPoolsL3.stream().filter(s-> s.getGoldCoin().compareTo(partnerPoolPre.getGoldCoin()) < 0).filter(s->s.getStatus().equals(1)).collect(Collectors.toList()); + // 如果查询结果不为空 if (!poolList.isEmpty()) { BsPartnerPool pool = poolList.get(0); + // 竞选成功 if (pool.getUserId() != null) { - campaignPartner(partnerPoolPre , pool); + BsPartnerLevel level = levelList.stream().filter(s-> s.getLevel().equals(pool.getLevel())).findFirst().orElse(null); + campaignPartner(partnerPoolPre , pool , level); } + // 配置参数 pool.setUserId(partnerPoolPre.getUserId()); pool.setGoldCoin(partnerPoolPre.getGoldCoin()); pools.add(pool); @@ -261,6 +292,7 @@ public class PartnerServiceImpl implements PartnerService { }) .collect(Collectors.toList()); + // 配置预约竞选参数 partnerPoolPre.setStatus(2); partnerPoolPre.setNum(pool.getNum()); pres.add(partnerPoolPre); @@ -270,13 +302,19 @@ public class PartnerServiceImpl implements PartnerService { // L4参选 for (BsPartnerPoolPre partnerPoolPre : partnerPoolsPreL4) { + // 如果合伙人池预约状态为1 if (partnerPoolPre.getStatus().equals(1)) { + // 查询还未被占位的合伙人位置并且当前合伙人金额大于 List poolList = partnerPoolsL4.stream().filter(s-> s.getGoldCoin().compareTo(partnerPoolPre.getGoldCoin()) < 0).filter(s->s.getStatus().equals(1)).collect(Collectors.toList()); + // 如果查询结果不为空 if (!poolList.isEmpty()) { BsPartnerPool pool = poolList.get(0); + // 竞选成功 if (pool.getUserId() != null) { - campaignPartner(partnerPoolPre , pool); + BsPartnerLevel level = levelList.stream().filter(s-> s.getLevel().equals(pool.getLevel())).findFirst().orElse(null); + campaignPartner(partnerPoolPre , pool , level); } + // 配置参数 pool.setUserId(partnerPoolPre.getUserId()); pool.setGoldCoin(partnerPoolPre.getGoldCoin()); pools.add(pool); @@ -289,6 +327,7 @@ public class PartnerServiceImpl implements PartnerService { }) .collect(Collectors.toList()); + // 配置预约竞选参数 partnerPoolPre.setStatus(2); partnerPoolPre.setNum(pool.getNum()); pres.add(partnerPoolPre); @@ -298,13 +337,19 @@ public class PartnerServiceImpl implements PartnerService { // L5参选 for (BsPartnerPoolPre partnerPoolPre : partnerPoolsPreL5) { + // 如果合伙人池预约状态为1 if (partnerPoolPre.getStatus().equals(1)) { + // 查询还未被占位的合伙人位置并且当前合伙人金额大于 List poolList = partnerPoolsL5.stream().filter(s-> s.getGoldCoin().compareTo(partnerPoolPre.getGoldCoin()) < 0).filter(s->s.getStatus().equals(1)).collect(Collectors.toList()); + // 如果查询结果不为空 if (!poolList.isEmpty()) { BsPartnerPool pool = poolList.get(0); + // 竞选成功 if (pool.getUserId() != null) { - campaignPartner(partnerPoolPre , pool); + BsPartnerLevel level = levelList.stream().filter(s-> s.getLevel().equals(pool.getLevel())).findFirst().orElse(null); + campaignPartner(partnerPoolPre , pool , level); } + // 配置参数 pool.setUserId(partnerPoolPre.getUserId()); pool.setGoldCoin(partnerPoolPre.getGoldCoin()); pools.add(pool); @@ -317,6 +362,7 @@ public class PartnerServiceImpl implements PartnerService { }) .collect(Collectors.toList()); + // 配置预约竞选参数 partnerPoolPre.setStatus(2); partnerPoolPre.setNum(pool.getNum()); pres.add(partnerPoolPre); @@ -324,14 +370,18 @@ public class PartnerServiceImpl implements PartnerService { } } + // 更新合伙人池状态 for (BsPartnerPool pool : pools) { pool.setStatus(1); pool.setUpdateTime(new Date()); bsPartnerPoolService.edit(pool); } + // 更新合伙人池预约状态 for (BsPartnerPoolPre partnerPoolPre: pres) { + // 如果合伙人池预约状态为1 if (partnerPoolPre.getStatus().equals(1)) { + // 将合伙人池预约状态设置为3 partnerPoolPre.setStatus(3); partnerPoolPre.setUpdateTime(new Date()); BsUser user = bsUserService.getUser(partnerPoolPre.getUserId()); @@ -347,7 +397,6 @@ public class PartnerServiceImpl implements PartnerService { } - } @Override @@ -358,12 +407,17 @@ public class PartnerServiceImpl implements PartnerService { List partnerLevels = bsPartnerLevelService.queryAllList(new HashMap<>()); String lotteryNo = DateUtil.date2String(new Date() , DateUtil.YMD); for (BsPartnerPool pool : partnerPools) { + // 判断合伙人是否有金币且用户ID不为空 if (pool.getGoldCoin().compareTo(new BigDecimal(0)) > 0 && pool.getUserId() != null) { + // 根据合伙人等级查询分红等级 BsPartnerLevel level = partnerLevels.stream().filter(s-> s.getLevel().equals(pool.getLevel())).findFirst().get(); + // 根据彩票编号和用户ID查询合伙人用户记录 BsPartnerUserRecord partnerUserRecord = bsPartnerUserRecordService.queryDetail(lotteryNo , pool.getUserId()); + // 根据用户ID查询用户信息 BsUser user = bsUserService.getUser(pool.getUserId()); + // 如果合伙人用户记录为空,则创建新的合伙人用户记录 if (partnerUserRecord == null) { partnerUserRecord = new BsPartnerUserRecord(); partnerUserRecord.setCreateTime(new Date()); @@ -372,6 +426,7 @@ public class PartnerServiceImpl implements PartnerService { partnerUserRecord.setLotteryTime(new Date()); partnerUserRecord.setUserId(pool.getUserId()); partnerUserRecord.setUserName(user.getName()); + // 计算分红金额 partnerUserRecord.setGoldCoin(pool.getGoldCoin().multiply(level.getDividendsPer())); partnerUserRecord.setProportion(level.getDividendsPer()); partnerUserRecord.setType(1); @@ -387,59 +442,124 @@ public class PartnerServiceImpl implements PartnerService { userAccountService.recharge(user.getId(),partnerUserRecord.getGoldCoin(), UserAccountRecordSourceTypeEnum.type4, userRechargeParam); } - - } - } } @Override - public List partnerData(Long startTime, Long endTime) throws Exception { + public List partnerData(Long createTimeS, Long createTimeE) throws Exception { + // 创建一个Map,用于存储查询参数 Map params = new HashMap<>(); - params.put("startTime", startTime); - params.put("endTime", endTime); + // 将createTimeS参数放入Map中 + params.put("createTimeS", createTimeS); + // 将createTimeE参数放入Map中 + params.put("createTimeE", createTimeE); + // 调用bsPartnerPoolPreService的queryAllList方法,查询所有符合条件的BsPartnerPoolPre对象,并将结果存入list中 List list = bsPartnerPoolPreService.queryAllList(params); + // 使用stream流将list中的BsPartnerPoolPre对象按照level进行分组,并将结果存入collect中 Map> collect = list.stream().collect(Collectors.groupingBy(BsPartnerPoolPre::getLevel)); - List countRecords = collect.keySet().stream().map(key -> { + // 如果collect不为空,则将collect中的数据转换为JSONObject对象,并存入list中 + if (!collect.isEmpty()) { + return collect.keySet().stream().map(key -> { + // 创建一个JSONObject对象 + JSONObject goodObject = new JSONObject(true); + // 将level放入JSONObject中 + goodObject.put("level",key); + // 获取collect中level为key的BsPartnerPoolPre对象列表 + List pres = collect.get(key); + // 将pres的大小放入JSONObject中 + goodObject.put("campaignUserNum", pres.size()); + // 将pres中所有BsPartnerPoolPre对象的goldCoin相加,并存入JSONObject中 + goodObject.put("campaignGoldCoin", pres.stream().map(BsPartnerPoolPre::getGoldCoin).reduce(BigDecimal.ZERO, BigDecimal::add)); + // 返回JSONObject对象 + return goodObject; + }).collect(Collectors.toList()); + } + + + // 调用bsPartnerLevelService的queryAllList方法,查询所有BsPartnerLevel对象,并将结果存入levelList中 + List levelList = bsPartnerLevelService.queryAllList(new HashMap<>()); + // 使用stream流将levelList中的BsPartnerLevel对象按照level进行分组,并将结果存入listMap中 + Map> listMap = levelList.stream().collect(Collectors.groupingBy(BsPartnerLevel::getLevel)); + // 将listMap中的数据转换为JSONObject对象,并存入list中 + return listMap.keySet().stream().map(key -> { + // 创建一个JSONObject对象 JSONObject goodObject = new JSONObject(true); + // 将level放入JSONObject中 goodObject.put("level",key); - List pres = collect.get(key); - goodObject.put("campaignUserNum", pres.size()); - goodObject.put("campaignGoldCoin", pres.stream().map(BsPartnerPoolPre::getGoldCoin).reduce(BigDecimal.ZERO, BigDecimal::add)); + // 将campaignUserNum设置为0 + goodObject.put("campaignUserNum", 0); + // 将campaignGoldCoin设置为BigDecimal.ZERO + goodObject.put("campaignGoldCoin", BigDecimal.ZERO); + // 返回JSONObject对象 return goodObject; }).collect(Collectors.toList()); - return countRecords; } @Override - public List dividendData(Long startTime, Long endTime) throws Exception { + public List dividendData(Long createTimeS, Long createTimeE) throws Exception { + // 创建一个Map,用于存储查询参数 Map params = new HashMap<>(); - params.put("startTime", startTime); - params.put("endTime", endTime); + // 将createTimeS参数存入Map + params.put("createTimeS", createTimeS); + // 将createTimeE参数存入Map + params.put("createTimeE", createTimeE); + // 将type参数存入Map params.put("type", 1); + // 根据参数查询所有用户记录 List userRecords = bsPartnerUserRecordService.queryAllList(params); - Map> collect = userRecords.stream().collect(Collectors.groupingBy(BsPartnerUserRecord::getLevel)); - List countRecords = collect.keySet().stream().map(key -> { + // 如果查询结果不为空 + if (!userRecords.isEmpty()) { + // 将查询结果按照level进行分组 + Map> collect = userRecords.stream().collect(Collectors.groupingBy(BsPartnerUserRecord::getLevel)); + // 返回分组后的结果 + return collect.keySet().stream().map(key -> { + // 创建一个JSONObject对象 + JSONObject goodObject = new JSONObject(true); + // 将level存入JSONObject + goodObject.put("level",key); + // 获取当前level的用户记录 + List pres = collect.get(key); + // 将用户记录数量存入JSONObject + goodObject.put("dividendCount", pres.size()); + // 将用户记录的金币数量累加存入JSONObject + goodObject.put("dividendGoldCoin", pres.stream().map(BsPartnerUserRecord::getGoldCoin).reduce(BigDecimal.ZERO, BigDecimal::add)); + // 返回JSONObject + return goodObject; + }).collect(Collectors.toList()); + } + + // 如果查询结果为空,查询所有等级 + List list = bsPartnerLevelService.queryAllList(new HashMap<>()); + // 将查询结果按照level进行分组 + Map> listMap = list.stream().collect(Collectors.groupingBy(BsPartnerLevel::getLevel)); + // 返回分组后的结果 + return listMap.keySet().stream().map(key -> { + // 创建一个JSONObject对象 JSONObject goodObject = new JSONObject(true); + // 将level存入JSONObject goodObject.put("level",key); - List pres = collect.get(key); - goodObject.put("dividendCount", pres.size()); - goodObject.put("dividendGoldCoin", pres.stream().map(BsPartnerUserRecord::getGoldCoin).reduce(BigDecimal.ZERO, BigDecimal::add)); + // 将用户记录数量存入JSONObject + goodObject.put("dividendCount", 0); + // 将用户记录的金币数量存入JSONObject + goodObject.put("dividendGoldCoin", BigDecimal.ZERO); + // 返回JSONObject return goodObject; }).collect(Collectors.toList()); - return countRecords; + } // 竞选成功返利 - private void campaignPartner(BsPartnerPoolPre partnerPoolPre , BsPartnerPool pool) throws Exception { + private void campaignPartner(BsPartnerPoolPre partnerPoolPre , BsPartnerPool pool , BsPartnerLevel level) throws Exception { + // 创建BsPartnerUserRecord对象 BsPartnerUserRecord userRecord = new BsPartnerUserRecord(); + // 根据pool.getUserId()获取BsUser对象 BsUser bsUser = bsUserService.getUser(pool.getUserId()); // 查询差价 BigDecimal differencePrice = partnerPoolPre.getGoldCoin().subtract(pool.getGoldCoin()); @@ -462,6 +582,16 @@ public class PartnerServiceImpl implements PartnerService { pre.setUpdateTime(new Date()); bsPartnerPoolPreService.edit(pre); + // 如果level不为空 + if (level != null) { + // 设置用户合伙人收入比例 + bsUser.setPartnerIncomePer(level.getIncomePer()); + // 设置用户合伙人等级 + bsUser.setPartnerLevel(level.getLevel()); + // 编辑用户数据 + bsUserService.editData(bsUser); + } + // 收益记录 Map userRechargeParam = new HashMap<>(); userRechargeParam.put("sourceId", userRecord.getId()); diff --git a/service/src/main/java/com/hfkj/service/partner/PartnerService.java b/service/src/main/java/com/hfkj/service/partner/PartnerService.java index 071fcdf..fb9675f 100644 --- a/service/src/main/java/com/hfkj/service/partner/PartnerService.java +++ b/service/src/main/java/com/hfkj/service/partner/PartnerService.java @@ -36,22 +36,22 @@ public interface PartnerService { /** * @MethodName partnerData * @Description: 合伙人数据统计 - * @param startTime - * @param endTime + * @param createTimeS + * @param createTimeE * @return: com.alibaba.fastjson.JSONObject * @Author: Sum1Dream * @Date: 2024/10/18 下午2:06 */ - List partnerData(Long startTime, Long endTime) throws Exception; + List partnerData(Long createTimeS, Long createTimeE) throws Exception; /** * @MethodName dividendData * @Description: 分红统计 - * @param startTime - * @param endTime + * @param createTimeS + * @param createTimeE * @return: com.alibaba.fastjson.JSONObject * @Author: Sum1Dream * @Date: 2024/10/18 下午2:25 */ - List dividendData(Long startTime, Long endTime) throws Exception; + List dividendData(Long createTimeS, Long createTimeE) throws Exception; } diff --git a/service/src/main/java/com/hfkj/service/pdd/PddService.java b/service/src/main/java/com/hfkj/service/pdd/PddService.java index 782de2b..a5c523e 100644 --- a/service/src/main/java/com/hfkj/service/pdd/PddService.java +++ b/service/src/main/java/com/hfkj/service/pdd/PddService.java @@ -2,22 +2,19 @@ package com.hfkj.service.pdd; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.hfkj.common.utils.DateUtil; import com.pdd.pop.sdk.common.util.JsonUtil; import com.pdd.pop.sdk.http.PopClient; import com.pdd.pop.sdk.http.PopHttpClient; -import com.pdd.pop.sdk.http.api.pop.request.PddDdkGoodsPromotionUrlGenerateRequest; -import com.pdd.pop.sdk.http.api.pop.request.PddDdkGoodsSearchRequest; -import com.pdd.pop.sdk.http.api.pop.request.PddDdkMemberAuthorityQueryRequest; -import com.pdd.pop.sdk.http.api.pop.request.PddDdkRpPromUrlGenerateRequest; -import com.pdd.pop.sdk.http.api.pop.response.PddDdkGoodsPromotionUrlGenerateResponse; -import com.pdd.pop.sdk.http.api.pop.response.PddDdkGoodsSearchResponse; - -import com.pdd.pop.sdk.http.api.pop.response.PddDdkMemberAuthorityQueryResponse; -import com.pdd.pop.sdk.http.api.pop.response.PddDdkRpPromUrlGenerateResponse; +import com.pdd.pop.sdk.http.api.pop.request.*; +import com.pdd.pop.sdk.http.api.pop.response.*; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.xml.crypto.Data; import java.util.ArrayList; +import java.util.Date; import java.util.List; public class PddService { @@ -163,5 +160,36 @@ public class PddService { } + /** + * @MethodName getOrderList + * @Description:用时间段查询推广订单接口 + * @param + * @return: com.alibaba.fastjson.JSONObject + * @Author: Sum1Dream + * @Date: 2024/10/23 上午10:27 + */ + public static JSONObject getOrderList() throws Exception { + + log.info("============ 拼多多请求-START ============="); + String clientId = "71a050c5d93d4169a237539af44c7c33"; + String clientSecret = "b96def667dd28660d09f19ba2e9e9f23d810d563"; + PopClient client = new PopHttpClient(clientId, clientSecret); + + PddDdkOrderListRangeGetRequest request = new PddDdkOrderListRangeGetRequest(); + request.setCashGiftOrder(true); + request.setStartTime("2024-05-07 00:00:00"); + request.setPageSize(300); + request.setEndTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")); + PddDdkOrderListRangeGetResponse response = client.syncInvoke(request); + + log.info("请求接口:" + "authority"); + log.info("请求参数:" + JSONObject.toJSONString(request)); + log.info("响应参数:" + JsonUtil.transferToJson(response)); + log.info("============ 拼多多请求-END =============="); + return JSONObject.parseObject(JSON.toJSONString(response)); + + } + + } diff --git a/service/src/main/java/com/hfkj/service/promotion/Impl/PromotionServiceImpl.java b/service/src/main/java/com/hfkj/service/promotion/Impl/PromotionServiceImpl.java new file mode 100644 index 0000000..9f55e82 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/promotion/Impl/PromotionServiceImpl.java @@ -0,0 +1,29 @@ +package com.hfkj.service.promotion.Impl; + +import com.alibaba.fastjson.JSONObject; +import com.hfkj.service.promotion.PromotionBusinessService; +import com.hfkj.service.promotion.PromotionService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service("promotionService") +public class PromotionServiceImpl implements PromotionService { + + @Resource + private PromotionBusinessService promotionBusinessService; + + @Override + public JSONObject createUrl(JSONObject body) throws Exception { + + // 淘宝订单业务 + if (body.getInteger("type") == 1) { + return promotionBusinessService.taobaoUrl(body); + } + // 拼多多订单业务 + if (body.getInteger("type") == 2) { + return promotionBusinessService.pddUrl(body); + } + return null; + } +} diff --git a/service/src/main/java/com/hfkj/service/promotion/PromotionBusinessService.java b/service/src/main/java/com/hfkj/service/promotion/PromotionBusinessService.java new file mode 100644 index 0000000..c4ff9ac --- /dev/null +++ b/service/src/main/java/com/hfkj/service/promotion/PromotionBusinessService.java @@ -0,0 +1,63 @@ +package com.hfkj.service.promotion; + +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.service.pdd.PddService; +import com.hfkj.service.taobao.TaoBaoService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; + + +/** + * 创建推广业务 + * @className: PromotionBusinessService + * @author: HuRui + * @date: 2024/5/7 + **/ +@Component +public class PromotionBusinessService { + Logger log = LoggerFactory.getLogger(PromotionBusinessService.class); + + + // 淘口令生成业务 + public JSONObject taobaoUrl(JSONObject jsonObject) throws Exception{ + JSONObject object = TaoBaoService.createCommand(jsonObject.getString("url")); + if (!object.getBoolean("success")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!"); + } + return object.getJSONObject("data"); + + } + + //多多进宝推广链接生成 + public JSONObject pddUrl(JSONObject jsonObject) throws Exception{ + + String goodsSign = jsonObject.getString("goodsSign"); + String searchId = jsonObject.getString("searchId"); + + if (searchId == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "缺少searchId!"); + } + if (goodsSign == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "缺少goodsSign!"); + } + + Map mapUser = new HashMap<>(); + mapUser.put("uid", jsonObject.getLong("userId")); + + // 判断是否需要授权 + JSONObject object = PddService.authority(mapUser.toString()); + boolean generateAuthorityUrl = object.getJSONObject("authorityQueryResponse").getInteger("bind") == 0; + JSONObject o = PddService.promotion(searchId , goodsSign , generateAuthorityUrl , mapUser.toString()); + + return o.getJSONObject("goodsPromotionUrlGenerateResponse").getJSONArray("goodsPromotionUrlList").getJSONObject(0); + + } + +} diff --git a/service/src/main/java/com/hfkj/service/promotion/PromotionService.java b/service/src/main/java/com/hfkj/service/promotion/PromotionService.java new file mode 100644 index 0000000..bede88f --- /dev/null +++ b/service/src/main/java/com/hfkj/service/promotion/PromotionService.java @@ -0,0 +1,20 @@ +package com.hfkj.service.promotion; + +import com.alibaba.fastjson.JSONObject; + +/** + * @ClassName PromotionService + * @Author Sum1Dream + * @Description + * @Date 2024/10/23 上午10:26 + **/ +public interface PromotionService { + + + /** + * 创建推广链接 + * @param jsonObject 订单 + * @return + */ + JSONObject createUrl(JSONObject jsonObject) throws Exception; +} diff --git a/service/src/main/java/com/hfkj/service/taobao/TaoBaoService.java b/service/src/main/java/com/hfkj/service/taobao/TaoBaoService.java index 59f9bf5..cb4f99f 100644 --- a/service/src/main/java/com/hfkj/service/taobao/TaoBaoService.java +++ b/service/src/main/java/com/hfkj/service/taobao/TaoBaoService.java @@ -1,15 +1,10 @@ package com.hfkj.service.taobao; 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; import com.hfkj.common.exception.SysCode; -import com.hfkj.common.utils.ResponseMsgUtil; -import com.hfkj.entity.SecDictionary; -import com.hfkj.model.*; -import com.hfkj.service.sec.SecDictionaryService; import com.taobao.top.DefaultTopApiClient; import com.taobao.top.TopApiClient; import com.taobao.top.ability304.Ability304; @@ -181,26 +176,6 @@ public class TaoBaoService { return JSONObject.parseObject(JSON.toJSONString(response)); } - public static JSONObject officialActivity(String clickUrl) throws Exception { - log.info("============ 淘口令生成-START ============="); - - TopApiClient client = new DefaultTopApiClient(appKey,appsecret,url); - Ability375 apiPackage = new Ability375(client); - // create domain - - // create request - TaobaoTbkTpwdCreateRequest request = new TaobaoTbkTpwdCreateRequest(); - request.setUrl(clickUrl); - - TaobaoTbkTpwdCreateResponse response = apiPackage.taobaoTbkTpwdCreate(request); - - log.info("请求接口:" + "taobaoTbkTpwdCreate"); - log.info("请求参数:" + JSONObject.toJSONString(request)); - log.info("响应参数:" + response); - log.info("============ 淘口令生成--END =============="); - return JSONObject.parseObject(JSON.toJSONString(response)); - - } } diff --git a/service/src/main/java/com/hfkj/service/user/BsUserCountService.java b/service/src/main/java/com/hfkj/service/user/BsUserCountService.java new file mode 100644 index 0000000..c36b310 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/BsUserCountService.java @@ -0,0 +1,55 @@ +package com.hfkj.service.user; + +import com.hfkj.sysenum.user.UserGradeEnum; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @className: BsUserService + * @author: HuRui + * @date: 2024/10/20 + **/ +public interface BsUserCountService { + + /** + * 平台总注册用户数 + * @param timeS + * @param timeE + */ + Long countPlatformRegister(Date timeS, Date timeE); + + /** + * 新增用户数 + * @param timeS + * @param timeE + * @return + */ + Long countAdd(Date timeS, Date timeE); + + /** + * 登录用户数 + * @param timeS + * @param timeE + * @return + */ + Long countLogin(Date timeS, Date timeE); + + /** + * 下单用户数 + * @param timeS + * @param timeE + * @return + */ + Long countPlaceOrder(Date timeS, Date timeE) throws Exception; + + /** + * 统计等级用户 + * @param timeS + * @param timeE + * @return + */ + List> countUserGrade(Date timeS, Date timeE) throws Exception; + +} diff --git a/service/src/main/java/com/hfkj/service/user/BsUserGradeConfigService.java b/service/src/main/java/com/hfkj/service/user/BsUserGradeConfigService.java new file mode 100644 index 0000000..a76f61d --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/BsUserGradeConfigService.java @@ -0,0 +1,35 @@ +package com.hfkj.service.user; + +import com.hfkj.entity.BsUserGradeConfig; +import com.hfkj.sysenum.user.UserGradeEnum; + +import java.util.List; +import java.util.Map; + +/** + * @className: BsUserGradeConfigService + * @author: HuRui + * @date: 2024/10/23 + **/ +public interface BsUserGradeConfigService { + + /** + * 修改数据 + * @param data + */ + void updateData(BsUserGradeConfig data); + + /** + * 获取配置 + * @param userGrade + * @return + */ + BsUserGradeConfig getConfig(UserGradeEnum userGrade); + + /** + * 查询列表 + * @param param + * @return + */ + List getList(Map param); +} diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserCountServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserCountServiceImpl.java new file mode 100644 index 0000000..0f6b350 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserCountServiceImpl.java @@ -0,0 +1,66 @@ +package com.hfkj.service.user.impl; + +import com.hfkj.common.utils.DateUtil; +import com.hfkj.dao.BsOrderMapper; +import com.hfkj.dao.BsUserGradeCountMapper; +import com.hfkj.dao.BsUserLoginLogMapper; +import com.hfkj.dao.BsUserMapper; +import com.hfkj.entity.BsUserExample; +import com.hfkj.entity.BsUserGradeCount; +import com.hfkj.entity.BsUserLoginLogExample; +import com.hfkj.service.user.BsUserCountService; +import com.hfkj.sysenum.user.UserGradeEnum; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @className: BsUserCountServiceImpl + * @author: HuRui + * @date: 2024/10/20 + **/ +@Service("userCountService") +public class BsUserCountServiceImpl implements BsUserCountService { + @Resource + private BsUserMapper userMapper; + @Resource + private BsUserLoginLogMapper userLoginLogMapper; + @Resource + private BsUserGradeCountMapper userGradeCountMapper; + @Resource + private BsOrderMapper orderMapper; + + @Override + public Long countPlatformRegister(Date timeS, Date timeE) { + BsUserExample example = new BsUserExample(); + example.createCriteria().andCreateTimeGreaterThanOrEqualTo(timeS).andCreateTimeLessThanOrEqualTo(timeE); + return userMapper.countByExample(example); + } + + @Override + public Long countAdd(Date timeS, Date timeE) { + BsUserExample example = new BsUserExample(); + example.createCriteria().andCreateTimeGreaterThanOrEqualTo(timeS).andCreateTimeLessThanOrEqualTo(timeE); + return userMapper.countByExample(example); + } + + @Override + public Long countLogin(Date timeS, Date timeE) { + BsUserLoginLogExample example = new BsUserLoginLogExample(); + example.createCriteria().andCreateTimeGreaterThanOrEqualTo(timeS).andCreateTimeLessThanOrEqualTo(timeE); + return userLoginLogMapper.countByExample(example); + } + + @Override + public Long countPlaceOrder(Date timeS, Date timeE) throws Exception { + return orderMapper.countPlaceOrder(DateUtil.date2String(timeS, DateUtil.Y_M_D_HMS), DateUtil.date2String(timeE, DateUtil.Y_M_D_HMS)); + } + + @Override + public List> countUserGrade(Date timeS, Date timeE) throws Exception { + return userGradeCountMapper.collect(DateUtil.date2String(timeS, DateUtil.Y_M_D_HMS), DateUtil.date2String(timeE, DateUtil.Y_M_D_HMS)); + } +} diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserGradeConfigServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserGradeConfigServiceImpl.java new file mode 100644 index 0000000..db4cc91 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserGradeConfigServiceImpl.java @@ -0,0 +1,60 @@ +package com.hfkj.service.user.impl; + +import com.hfkj.common.utils.RedisUtil; +import com.hfkj.dao.BsUserGradeConfigMapper; +import com.hfkj.entity.BsUserGradeConfig; +import com.hfkj.entity.BsUserGradeConfigExample; +import com.hfkj.service.user.BsUserGradeConfigService; +import com.hfkj.sysenum.user.UserGradeEnum; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @className: BsUserGradeConfigServiceImpl + * @author: HuRui + * @date: 2024/10/23 + **/ +@Service("userGradeConfigService") +public class BsUserGradeConfigServiceImpl implements BsUserGradeConfigService { + @Resource + private BsUserGradeConfigMapper userGradeConfigMapper; + @Resource + private RedisUtil redisUtil; + private final static String CACHE = "USER_GRADE_CONFIG:"; + @Override + public void updateData(BsUserGradeConfig data) { + userGradeConfigMapper.updateByPrimaryKey(data); + // 缓存 + redisUtil.set(CACHE+data.getGrade(), data); + } + + @Override + public BsUserGradeConfig getConfig(UserGradeEnum userGrade) { + Object cache = redisUtil.get(CACHE + userGrade); + if (cache != null) { + return (BsUserGradeConfig) cache; + } + + BsUserGradeConfigExample example = new BsUserGradeConfigExample(); + example.createCriteria().andGradeEqualTo(userGrade.getCode()); + List list = userGradeConfigMapper.selectByExample(example); + if (!list.isEmpty()) { + BsUserGradeConfig data = list.get(0); + // 缓存 + redisUtil.set(CACHE+data.getGrade(), data); + return data; + } + return null; + } + + @Override + public List getList(Map param) { + BsUserGradeConfigExample example = new BsUserGradeConfigExample(); + example.createCriteria(); + example.setOrderByClause("id asc"); + return userGradeConfigMapper.selectByExample(example); + } +} diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java index 0a708f5..3085fba 100644 --- a/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java @@ -186,8 +186,8 @@ public class BsUserServiceImpl implements BsUserService { if (user == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户"); } - if (!user.getStatus().equals(UserStatusEnum.status1.getCode())) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "状态不正确,无法封禁"); + if (!user.getStatus().equals(UserStatusEnum.status2.getCode())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "状态不正确,无法恢复"); } user.setStatus(UserStatusEnum.status1.getCode()); updateInfo(user);