From 09c600a3f16c8c4c64b4b15bb2d0b483e47401d7 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Tue, 5 Nov 2024 11:44:22 +0800 Subject: [PATCH] Merge branch 'master' of http://gitea.dctpay.com/hurui/youtao --- .../com/hfkj/controller/GoodsController.java | 2 +- .../hfkj/controller/TakeOutController.java | 48 +++- .../promotion/PromotionController.java | 1 + .../java/com/hfkj/schedule/OrderSchedule.java | 19 +- .../main/java/com/hfkj/entity/BsOrder.java | 2 +- .../hfkj/service/meituan/MeiTuanService.java | 13 +- .../hfkj/service/order/BsOrderService.java | 6 +- .../order/Impl/BsOrderServiceImpl.java | 226 ++++++++++++++++-- .../java/com/hfkj/service/pdd/PddService.java | 4 +- .../promotion/PromotionBusinessService.java | 2 +- .../hfkj/service/taobao/TaoBaoService.java | 4 +- 11 files changed, 278 insertions(+), 49 deletions(-) diff --git a/cweb/src/main/java/com/hfkj/controller/GoodsController.java b/cweb/src/main/java/com/hfkj/controller/GoodsController.java index bb6d483..3ac9b16 100644 --- a/cweb/src/main/java/com/hfkj/controller/GoodsController.java +++ b/cweb/src/main/java/com/hfkj/controller/GoodsController.java @@ -70,7 +70,7 @@ public class GoodsController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户未授权!"); } - JSONObject jsonObject = TaoBaoService.material(title , pageNo , pageSize , bsUser.getSpecialId() , bsUser.getRelationId()); + JSONObject jsonObject = TaoBaoService.material(title , pageNo , pageSize ); if (!jsonObject.getBoolean("success")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!"); diff --git a/cweb/src/main/java/com/hfkj/controller/TakeOutController.java b/cweb/src/main/java/com/hfkj/controller/TakeOutController.java index 28b7425..bafe4cf 100644 --- a/cweb/src/main/java/com/hfkj/controller/TakeOutController.java +++ b/cweb/src/main/java/com/hfkj/controller/TakeOutController.java @@ -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); diff --git a/cweb/src/main/java/com/hfkj/controller/promotion/PromotionController.java b/cweb/src/main/java/com/hfkj/controller/promotion/PromotionController.java index e979f0d..03c9a2a 100644 --- a/cweb/src/main/java/com/hfkj/controller/promotion/PromotionController.java +++ b/cweb/src/main/java/com/hfkj/controller/promotion/PromotionController.java @@ -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)); diff --git a/schedule/src/main/java/com/hfkj/schedule/OrderSchedule.java b/schedule/src/main/java/com/hfkj/schedule/OrderSchedule.java index 07621c6..3999345 100644 --- a/schedule/src/main/java/com/hfkj/schedule/OrderSchedule.java +++ b/schedule/src/main/java/com/hfkj/schedule/OrderSchedule.java @@ -24,11 +24,14 @@ public class OrderSchedule { @Resource private BsOrderService orderService; - @Scheduled(cron = "0 30 1 * * ?") // 每日凌晨05:30:00 执行一次 + @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("2024-10-01 00:00:00"); + 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("查询失败!!!"); @@ -51,5 +54,17 @@ public class OrderSchedule { } } + @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("查询失败!!!"); + } + } + } diff --git a/service/src/main/java/com/hfkj/entity/BsOrder.java b/service/src/main/java/com/hfkj/entity/BsOrder.java index 5473cdf..f64eb24 100644 --- a/service/src/main/java/com/hfkj/entity/BsOrder.java +++ b/service/src/main/java/com/hfkj/entity/BsOrder.java @@ -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; 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 738b14a..217ef88 100644 --- a/service/src/main/java/com/hfkj/service/meituan/MeiTuanService.java +++ b/service/src/main/java/com/hfkj/service/meituan/MeiTuanService.java @@ -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; 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 ca566ea..fdea3ea 100644 --- a/service/src/main/java/com/hfkj/service/order/BsOrderService.java +++ b/service/src/main/java/com/hfkj/service/order/BsOrderService.java @@ -67,10 +67,12 @@ public interface BsOrderService { * @Author: Sum1Dream * @Date: 2024/10/23 上午10:27 */ - void getOrderPddList(String startTime) throws Exception; + void getOrderPddList(String startTime , String endTime); - void getOrderTaoBaoList(String startTime , String endTime) throws Exception; + void getOrderTaoBaoList(String startTime , String endTime); + + void getOrderMeiTuanList(String startTime , String endTime); /** * @MethodName getOrderListParent 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 ed2b8f7..35bb1af 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,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,6 +16,7 @@ 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; @@ -150,8 +152,14 @@ public class BsOrderServiceImpl implements BsOrderService { } @Override - public void getOrderPddList(String startTime) throws Exception{ - pddOrder(startTime); + public void getOrderPddList(String startTime , String endTime) { + try { + pddOrder(startTime , endTime); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + } @Override @@ -164,6 +172,15 @@ public class BsOrderServiceImpl implements BsOrderService { } + @Override + public void getOrderMeiTuanList(String startTime, String endTime) { + try { + meiTuanOrder(startTime , endTime); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + @Override public List getOrderListParent(Map map) { @@ -188,9 +205,18 @@ public class BsOrderServiceImpl implements BsOrderService { orderModel.setGold(order.getPromotionAmount().multiply(goldCoinExchangeRate)); // 将订单模型添加到订单模型列表中 orderModels.add(orderModel); - // 根据订单查询淘宝订单 - 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() == 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; } @@ -222,22 +248,28 @@ public class BsOrderServiceImpl implements BsOrderService { } @Override - public void orderRebate(BsOrder bsOrder) throws Exception { - Map 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); + public void orderRebate(BsOrder bsOrder){ + + try { + Map 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); + } + } // 根据开始时间获取拼多多订单列表 - 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 list = getOrderList(new HashMap<>()); List userList = userService.getList(new HashMap<>()); @@ -281,7 +313,7 @@ public class BsOrderServiceImpl implements BsOrderService { } 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()); @@ -308,7 +340,7 @@ public class BsOrderServiceImpl implements BsOrderService { create(bsOrder); }else { - if (bsOrder.getStatus() != 8) { + if (bsOrder.getStatus() == 2) { // 如果BsOrder对象不为空,则更新BsOrder对象 bsOrder.setUpdateTime(new Date()); bsOrder.setStatus(orderListItem.getOrderStatus()); @@ -339,7 +371,7 @@ public class BsOrderServiceImpl implements BsOrderService { } // 如果订单状态为5,则调用orderRebate方法 - if (bsOrder.getStatus() == 5){ + if (bsOrder.getStatus() == 2 && orderListItem.getOrderStatus().equals(5)){ orderRebate(bsOrder); } else { editData(bsOrder); @@ -352,25 +384,31 @@ public class BsOrderServiceImpl implements BsOrderService { } } } - - } - + // 淘宝 private void taoBaoOrder(String startTime , String endTime) throws Exception { + // 调用TaoBaoService的getOrderList方法,获取淘宝订单列表 TaobaoTbkOrderDetailsGetResponse response = TaoBaoService.getOrderList(startTime , endTime); + // 调用getOrderList方法,获取本地订单列表 List list = getOrderList(new HashMap<>()); + // 创建一个Map,用于存储relationId Map reMap = new HashMap<>(); reMap.put("relationId" , 1); + // 调用userService的getList方法,获取用户列表 List userList = userService.getList(reMap); + // 获取淘宝订单列表中的订单信息 List 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()); @@ -408,9 +446,11 @@ public class BsOrderServiceImpl implements BsOrderService { if (orderListItem.getModifiedTime() != null) { bsOrder.setCancelTime(DateUtil.format(orderListItem.getModifiedTime() , "yyyy-MM-dd HH:mm:ss")); } + // 调用create方法,将新订单保存到本地订单列表中 create(bsOrder); } else { - if (bsOrder.getStatus() != 8) { + // 如果本地订单列表中已有该订单,则更新订单信息 + if (bsOrder.getStatus() == 2) { bsOrder.setOrderNo(orderListItem.getTradeParentId()); bsOrder.setUpdateTime(new Date()); bsOrder.setStatus(taoBaoStatus(orderListItem.getTkStatus())); @@ -439,9 +479,10 @@ public class BsOrderServiceImpl implements BsOrderService { 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); } @@ -451,21 +492,154 @@ public class BsOrderServiceImpl implements BsOrderService { } } + } + + + + 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 list = getOrderList(new HashMap<>()); + List 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 = 6; + int result = 4; if (status == 3) { - result = 3; + result = 2; } else if (status == 12) { - result = 0; + 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; } 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 d86f293..4881885 100644 --- a/service/src/main/java/com/hfkj/service/pdd/PddService.java +++ b/service/src/main/java/com/hfkj/service/pdd/PddService.java @@ -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"); diff --git a/service/src/main/java/com/hfkj/service/promotion/PromotionBusinessService.java b/service/src/main/java/com/hfkj/service/promotion/PromotionBusinessService.java index 40d88cd..1c8e468 100644 --- a/service/src/main/java/com/hfkj/service/promotion/PromotionBusinessService.java +++ b/service/src/main/java/com/hfkj/service/promotion/PromotionBusinessService.java @@ -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, "请求失败!"); } 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 a390ade..586e14e 100644 --- a/service/src/main/java/com/hfkj/service/taobao/TaoBaoService.java +++ b/service/src/main/java/com/hfkj/service/taobao/TaoBaoService.java @@ -67,7 +67,7 @@ public class TaoBaoService { * @Author: Sum1Dream * @Date: 2024/9/10 下午1:52 */ - public static JSONObject material(String title , Long pageNo , Long pageSize , String specialId , String relationId ) throws Exception { + public static JSONObject material(String title , Long pageNo , Long pageSize ) throws Exception { if (StringUtils.isBlank(title)) { title = "百货"; } @@ -83,8 +83,6 @@ public class TaoBaoService { TaobaoTbkDgMaterialOptionalUpgradeRequest request = new TaobaoTbkDgMaterialOptionalUpgradeRequest(); request.setQ(title); request.setPageNo(pageNo); - request.setRelationId(relationId); - request.setSpecialId(specialId); request.setHasCoupon(true); request.setPageSize(pageSize); request.setAdzoneId(115764450446L);