胡锐 3 weeks ago
commit 15369e8a32
  1. BIN
      bweb/lib/pop-sdk-1.18.23-all.jar
  2. BIN
      bweb/lib/taobao-sdk-java-elm.jar
  3. BIN
      bweb/lib/taobao-sdk.jar
  4. 29
      bweb/pom.xml
  5. BIN
      cweb/lib/taobao-sdk.jar
  6. 22
      cweb/src/main/java/com/hfkj/controller/ClientController.java
  7. 88
      cweb/src/main/java/com/hfkj/controller/GoodsController.java
  8. 48
      cweb/src/main/java/com/hfkj/controller/TakeOutController.java
  9. 37
      cweb/src/main/java/com/hfkj/controller/TestController.java
  10. 83
      cweb/src/main/java/com/hfkj/controller/order/BsOrderController.java
  11. 1
      cweb/src/main/java/com/hfkj/controller/promotion/PromotionController.java
  12. BIN
      schedule/lib/pop-sdk-1.18.23-all.jar
  13. BIN
      schedule/lib/taobao-sdk-java-elm.jar
  14. BIN
      schedule/lib/taobao-sdk.jar
  15. 28
      schedule/pom.xml
  16. 70
      schedule/src/main/java/com/hfkj/schedule/OrderSchedule.java
  17. BIN
      service/lib/taobao-sdk.jar
  18. 2
      service/src/main/java/com/hfkj/entity/BsOrder.java
  19. 4
      service/src/main/java/com/hfkj/model/GoodsModel.java
  20. 2
      service/src/main/java/com/hfkj/model/PublishInfoModel.java
  21. 32
      service/src/main/java/com/hfkj/service/elm/ElmService.java
  22. 2
      service/src/main/java/com/hfkj/service/goods/impl/GoodsDataServiceImpl.java
  23. 13
      service/src/main/java/com/hfkj/service/meituan/MeiTuanService.java
  24. 8
      service/src/main/java/com/hfkj/service/order/BsOrderService.java
  25. 429
      service/src/main/java/com/hfkj/service/order/Impl/BsOrderServiceImpl.java
  26. 4
      service/src/main/java/com/hfkj/service/pdd/PddService.java
  27. 2
      service/src/main/java/com/hfkj/service/promotion/PromotionBusinessService.java
  28. 131
      service/src/main/java/com/hfkj/service/taobao/TaoBaoService.java
  29. 3
      service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

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

@ -5,10 +5,12 @@ import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrder;
import com.hfkj.entity.BsUser;
import com.hfkj.model.*;
import com.hfkj.service.elm.ElmService;
import com.hfkj.service.goods.GoodsDataService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.pdd.PddService;
@ -23,10 +25,10 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@Controller
@RequestMapping(value="/goods")
@ -42,8 +44,6 @@ public class GoodsController {
@Resource
private BsUserService bsUserService;
@RequestMapping(value="/goodsList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商品列表")
@ -55,10 +55,13 @@ public class GoodsController {
try {
List<GoodsModel> goodsList;
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
// 1:淘宝 2:拼多多
if (type == 1) {
JSONObject jsonObject = TaoBaoService.material(title , pageNo , pageSize);
JSONObject jsonObject = TaoBaoService.material(title , pageNo , pageSize );
if (!jsonObject.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
@ -66,8 +69,6 @@ public class GoodsController {
goodsList = goodsDataService.goodsModelTaoBaoList(jsonObject);
} else if (type == 2) {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
Map<String , Object> mapUser = new JSONObject();
mapUser.put("uid", userSession.getUser().getId());
JSONObject object = PddService.authority(mapUser.toString());
@ -139,12 +140,19 @@ public class GoodsController {
JSONObject tokenResult = JSONObject.parseObject(token);
JSONObject jsonObject = TaoBaoService.publisher(tokenResult.getString("access_token"));
// 用户备案
JSONObject jsonObject = TaoBaoService.publisher(tokenResult.getString("access_token") , "5FM9A9");
String body = jsonObject.getString("body");
JSONObject result = JSONObject.parseObject(body);
// 渠道备案
JSONObject relationObject = TaoBaoService.publisher(tokenResult.getString("access_token") , "JIIIVF");
String relation = relationObject.getString("body");
JSONObject relationBody = JSONObject.parseObject(relation);
BsUser user = bsUserService.getUser(userSession.getUser().getId());
user.setSpecialId(result.getJSONObject("data").getString("relation_id"));
user.setSpecialId(result.getJSONObject("data").getString("special_id"));
user.setRelationId(relationBody.getJSONObject("data").getString("relation_id"));
bsUserService.updateInfo(user);
return ResponseMsgUtil.success("绑定成功");
@ -155,17 +163,63 @@ public class GoodsController {
}
}
@RequestMapping(value="/getToken",method = RequestMethod.GET)
@RequestMapping(value="/getPublisherInfo",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取Access Token")
public ResponseData getToken(@RequestParam(value = "code" , required = false) String code
@ApiOperation(value = "淘宝客-公用-私域用户备案信息查询")
public ResponseData getPublisherInfo(@RequestParam(value = "code" , required = false) String code
) {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
JSONObject jsonObject = TaoBaoService.getToken(code);
String token = jsonObject.getString("token_result");
JSONObject tokenJson = TaoBaoService.getToken(code);
String token = tokenJson.getString("token_result");
JSONObject tokenResult = JSONObject.parseObject(token);
return ResponseMsgUtil.success(tokenResult);
BsUser user = bsUserService.getUser(userSession.getUser().getId());
// 用户备案
JSONObject jsonObject = TaoBaoService.getPublisherInfo(tokenResult.getString("access_token") , Long.valueOf(user.getRelationId()), user.getSpecialId());
return ResponseMsgUtil.success(jsonObject);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getOrderList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询订单")
public ResponseData getOrderList(@RequestParam(value = "code" , required = false) String code
) {
try {
return ResponseMsgUtil.success(ElmService.elmOrderList("2024-10-20 09:34:00" , "2024-11-04 12:34:00").getJSONArray("result"));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/generalLink",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "淘宝客-公用-私域用户备案信息查询")
public ResponseData generalLink(
@RequestParam(value = "itemId" , required = false) String itemId,
@RequestParam(value = "url" , required = false) String url
) {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
// 用户备案
JSONObject jsonObject = TaoBaoService.generalLink(itemId, url, userSession.getUser().getRelationId());
return ResponseMsgUtil.success(jsonObject);
} catch (Exception e) {
log.error("error!",e);

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

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

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

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

Binary file not shown.

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

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

Binary file not shown.

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

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

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

@ -2,28 +2,20 @@ package com.hfkj.service.elm;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.TaoBaoUtil;
import com.hfkj.service.taobao.TaoBaoService;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.AlibabaAlscUnionElemePromotionOfficialactivityGetRequest;
import com.taobao.api.request.AlibabaAlscUnionKbcpxPositiveOrderGetRequest;
import com.taobao.api.request.AlibabaAlscUnionMediaZoneAddRequest;
import com.taobao.api.response.AlibabaAlscUnionElemePromotionOfficialactivityGetResponse;
import com.taobao.api.response.AlibabaAlscUnionKbcpxPositiveOrderGetResponse;
import com.taobao.api.response.AlibabaAlscUnionMediaZoneAddResponse;
import com.taobao.top.DefaultTopApiClient;
import com.taobao.top.TopApiClient;
import com.taobao.top.ability375.Ability375;
import com.taobao.top.ability375.request.TaobaoTbkTpwdCreateRequest;
import com.taobao.top.ability375.response.TaobaoTbkTpwdCreateResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class ElmService {
@ -72,17 +64,23 @@ public class ElmService {
}
public static JSONObject mediaZoneAdd(String sessionKey) throws Exception {
public static JSONObject elmOrderList(String startTime , String endTime) 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);
AlibabaAlscUnionKbcpxPositiveOrderGetRequest req = new AlibabaAlscUnionKbcpxPositiveOrderGetRequest();
req.setDateType(1L);
req.setEndDate(endTime);
req.setBizUnit(2L);
req.setPageSize(50L);
req.setPageNumber(1L);
req.setStartDate(startTime);
req.setPid(pid);
req.setIncludeUsedStoreId(false);
AlibabaAlscUnionKbcpxPositiveOrderGetResponse rsp = client.execute(req);
// 打印日志,请求接口
log.info("请求接口:" + "officialactivity");

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

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

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

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

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

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

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

@ -264,6 +264,9 @@ public class BsUserServiceImpl implements BsUserService {
criteria.andGradeEqualTo(MapUtils.getInteger(param, "grade"));
}
if (MapUtils.getInteger(param, "relationId") != null) {
criteria.andRelationIdIsNotNull();
}
if (MapUtils.getInteger(param, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status"));
}

Loading…
Cancel
Save