袁野 4 hours ago
parent 97ed274f67
commit 09c600a3f1
  1. 2
      cweb/src/main/java/com/hfkj/controller/GoodsController.java
  2. 48
      cweb/src/main/java/com/hfkj/controller/TakeOutController.java
  3. 1
      cweb/src/main/java/com/hfkj/controller/promotion/PromotionController.java
  4. 19
      schedule/src/main/java/com/hfkj/schedule/OrderSchedule.java
  5. 2
      service/src/main/java/com/hfkj/entity/BsOrder.java
  6. 13
      service/src/main/java/com/hfkj/service/meituan/MeiTuanService.java
  7. 6
      service/src/main/java/com/hfkj/service/order/BsOrderService.java
  8. 226
      service/src/main/java/com/hfkj/service/order/Impl/BsOrderServiceImpl.java
  9. 4
      service/src/main/java/com/hfkj/service/pdd/PddService.java
  10. 2
      service/src/main/java/com/hfkj/service/promotion/PromotionBusinessService.java
  11. 4
      service/src/main/java/com/hfkj/service/taobao/TaoBaoService.java

@ -70,7 +70,7 @@ public class GoodsController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户未授权!"); 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")) { if (!jsonObject.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");

@ -2,10 +2,12 @@ package com.hfkj.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.security.UserCenter; import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.UserSessionObject; import com.hfkj.model.UserSessionObject;
import com.hfkj.service.meituan.MeiTuanService; import com.hfkj.service.meituan.MeiTuanService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.user.BsUserAccountRecordService; import com.hfkj.service.user.BsUserAccountRecordService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; 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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.time.format.DateTimeFormatter;
import java.util.Date;
@Controller @Controller
@RequestMapping(value="/takeOut") @RequestMapping(value="/takeOut")
@Api(value="外卖") @Api(value="外卖")
@ -28,6 +34,9 @@ public class TakeOutController {
@Autowired @Autowired
private UserCenter userCenter; private UserCenter userCenter;
@Resource
private BsOrderService orderService;
@RequestMapping(value="/generateLink",method = RequestMethod.GET) @RequestMapping(value="/generateLink",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "自助取链接口 ") @ApiOperation(value = "自助取链接口 ")
@ -40,7 +49,7 @@ public class TakeOutController {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("actId" , actId); jsonObject.put("actId" , actId);
jsonObject.put("sid" , session.getUser().getId()); jsonObject.put("sid" , String.valueOf(session.getUser().getId()));
jsonObject.put("linkType" , linkType); jsonObject.put("linkType" , linkType);
JSONObject object = MeiTuanService.generateLink(jsonObject); 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) @RequestMapping(value="/orderList",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "订单列表查询接口") @ApiOperation(value = "订单列表查询接口")
public ResponseData orderList( public ResponseData orderList(
@RequestParam(value = "actId" , required = false) Long actId, @RequestParam(value = "actId" , required = false) Long actId
@RequestParam(value = "startTime" , required = false) Long startTime,
@RequestParam(value = "endTime" , required = false) Integer endTime
) { ) {
try { 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) { } catch (Exception e) {
log.error("error!",e); log.error("error!",e);

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

@ -24,11 +24,14 @@ public class OrderSchedule {
@Resource @Resource
private BsOrderService orderService; private BsOrderService orderService;
@Scheduled(cron = "0 30 1 * * ?") // 每日凌晨05:30:00 执行一次 @Scheduled(cron = "0 0/15 * * * ?") // 每日凌晨05:30:00 执行一次
public void pddOrder() { public void pddOrder() {
try { 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) { } catch (Exception e) {
System.out.println("查询失败!!!"); 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("查询失败!!!");
}
}
} }

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

@ -10,6 +10,8 @@ import com.hfkj.config.CommonSysConst;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Date;
public class MeiTuanService { public class MeiTuanService {
private static Logger log = LoggerFactory.getLogger(MeiTuanService.class); private static Logger log = LoggerFactory.getLogger(MeiTuanService.class);
@ -42,7 +44,16 @@ public class MeiTuanService {
* @Date: 2024/10/23 上午10:42 * @Date: 2024/10/23 上午10:42
*/ */
public static JSONObject orderList(JSONObject param)throws Exception { 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)) { if (object.getInteger("status").equals(0)) {
return object; return object;

@ -67,10 +67,12 @@ public interface BsOrderService {
* @Author: Sum1Dream * @Author: Sum1Dream
* @Date: 2024/10/23 上午10:27 * @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 * @MethodName getOrderListParent

@ -1,6 +1,7 @@
package com.hfkj.service.order.Impl; package com.hfkj.service.order.Impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
@ -15,6 +16,7 @@ import com.hfkj.entity.BsOrderExample;
import com.hfkj.entity.BsUser; import com.hfkj.entity.BsUser;
import com.hfkj.model.BsOrderModel; import com.hfkj.model.BsOrderModel;
import com.hfkj.model.UserTeamModel; import com.hfkj.model.UserTeamModel;
import com.hfkj.service.meituan.MeiTuanService;
import com.hfkj.service.order.BsOrderService; import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.OrderBusinessService; import com.hfkj.service.order.OrderBusinessService;
import com.hfkj.service.pdd.PddService; import com.hfkj.service.pdd.PddService;
@ -150,8 +152,14 @@ public class BsOrderServiceImpl implements BsOrderService {
} }
@Override @Override
public void getOrderPddList(String startTime) throws Exception{ public void getOrderPddList(String startTime , String endTime) {
pddOrder(startTime); try {
pddOrder(startTime , endTime);
} catch (Exception e) {
System.out.println(e.getMessage());
}
} }
@Override @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 @Override
public List<BsOrderModel> getOrderListParent(Map<String, Object> map) { public List<BsOrderModel> getOrderListParent(Map<String, Object> map) {
@ -188,9 +205,18 @@ public class BsOrderServiceImpl implements BsOrderService {
orderModel.setGold(order.getPromotionAmount().multiply(goldCoinExchangeRate)); orderModel.setGold(order.getPromotionAmount().multiply(goldCoinExchangeRate));
// 将订单模型添加到订单模型列表中 // 将订单模型添加到订单模型列表中
orderModels.add(orderModel); 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)); // 根据订单查询淘宝订单
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; return orderModels;
} }
@ -222,22 +248,28 @@ public class BsOrderServiceImpl implements BsOrderService {
} }
@Override @Override
public void orderRebate(BsOrder bsOrder) throws Exception { public void orderRebate(BsOrder bsOrder){
Map<String,Object> otherParam = new HashMap<>();
otherParam.put("sourceId", bsOrder.getId()); try {
otherParam.put("sourceOrderNo", bsOrder.getOrderNo()); Map<String,Object> otherParam = new HashMap<>();
userContributeService.purchase(bsOrder.getPromotionAmount(), bsOrder.getUserId(), otherParam); otherParam.put("sourceId", bsOrder.getId());
bsOrder.setStatus(8); otherParam.put("sourceOrderNo", bsOrder.getOrderNo());
bsOrder.setUpdateTime(new Date()); userContributeService.purchase(bsOrder.getPromotionAmount(), bsOrder.getUserId(), otherParam);
bsOrder.setFinishTime(new Date()); bsOrder.setStatus(3);
editData(bsOrder); 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方法获取订单列表 // 调用PddService的getOrderList方法获取订单列表
PddDdkOrderListRangeGetResponse rangeGetResponse = PddService.getOrderList(startTime); PddDdkOrderListRangeGetResponse rangeGetResponse = PddService.getOrderList(startTime , endTime);
// 调用getOrderList方法获取本地订单列表 // 调用getOrderList方法获取本地订单列表
List<BsOrder> list = getOrderList(new HashMap<>()); List<BsOrder> list = getOrderList(new HashMap<>());
List<BsUser> userList = userService.getList(new HashMap<>()); List<BsUser> userList = userService.getList(new HashMap<>());
@ -281,7 +313,7 @@ public class BsOrderServiceImpl implements BsOrderService {
} }
bsOrder.setCreateTime(new Date()); bsOrder.setCreateTime(new Date());
bsOrder.setUpdateTime(new Date()); bsOrder.setUpdateTime(new Date());
bsOrder.setStatus(orderListItem.getOrderStatus()); bsOrder.setStatus(pddStatus(Long.valueOf(orderListItem.getOrderStatus())));
bsOrder.setImg(orderListItem.getGoodsThumbnailUrl()); bsOrder.setImg(orderListItem.getGoodsThumbnailUrl());
bsOrder.setType(2); bsOrder.setType(2);
bsOrder.setGoodsName(orderListItem.getGoodsName()); bsOrder.setGoodsName(orderListItem.getGoodsName());
@ -308,7 +340,7 @@ public class BsOrderServiceImpl implements BsOrderService {
create(bsOrder); create(bsOrder);
}else { }else {
if (bsOrder.getStatus() != 8) { if (bsOrder.getStatus() == 2) {
// 如果BsOrder对象不为空,则更新BsOrder对象 // 如果BsOrder对象不为空,则更新BsOrder对象
bsOrder.setUpdateTime(new Date()); bsOrder.setUpdateTime(new Date());
bsOrder.setStatus(orderListItem.getOrderStatus()); bsOrder.setStatus(orderListItem.getOrderStatus());
@ -339,7 +371,7 @@ public class BsOrderServiceImpl implements BsOrderService {
} }
// 如果订单状态为5,则调用orderRebate方法 // 如果订单状态为5,则调用orderRebate方法
if (bsOrder.getStatus() == 5){ if (bsOrder.getStatus() == 2 && orderListItem.getOrderStatus().equals(5)){
orderRebate(bsOrder); orderRebate(bsOrder);
} else { } else {
editData(bsOrder); editData(bsOrder);
@ -352,25 +384,31 @@ public class BsOrderServiceImpl implements BsOrderService {
} }
} }
} }
} }
// 淘宝
private void taoBaoOrder(String startTime , String endTime) throws Exception { private void taoBaoOrder(String startTime , String endTime) throws Exception {
// 调用TaoBaoService的getOrderList方法,获取淘宝订单列表
TaobaoTbkOrderDetailsGetResponse response = TaoBaoService.getOrderList(startTime , endTime); TaobaoTbkOrderDetailsGetResponse response = TaoBaoService.getOrderList(startTime , endTime);
// 调用getOrderList方法,获取本地订单列表
List<BsOrder> list = getOrderList(new HashMap<>()); List<BsOrder> list = getOrderList(new HashMap<>());
// 创建一个Map,用于存储relationId
Map<String , Object> reMap = new HashMap<>(); Map<String , Object> reMap = new HashMap<>();
reMap.put("relationId" , 1); reMap.put("relationId" , 1);
// 调用userService的getList方法,获取用户列表
List<BsUser> userList = userService.getList(reMap); List<BsUser> userList = userService.getList(reMap);
// 获取淘宝订单列表中的订单信息
List<TaobaoTbkOrderDetailsGetPublisherOrderDto> results = response.getData().getResults(); List<TaobaoTbkOrderDetailsGetPublisherOrderDto> results = response.getData().getResults();
if (results != null && !results.isEmpty()) { if (results != null && !results.isEmpty()) {
for (TaobaoTbkOrderDetailsGetPublisherOrderDto orderListItem : results) { for (TaobaoTbkOrderDetailsGetPublisherOrderDto orderListItem : results) {
// 根据订单号,从本地订单列表中查找订单
BsOrder bsOrder = list.stream().filter(s->s.getOrderNo().equals(orderListItem.getTradeParentId())).findFirst().orElse(null); 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); BsUser bsUser = userList.stream().filter(s->s.getRelationId().equals(orderListItem.getRelationId().toString())).findFirst().orElse(null);
// 如果本地订单列表中没有该订单,则创建一个新的订单
if (bsOrder == null) { if (bsOrder == null) {
bsOrder = new BsOrder(); bsOrder = new BsOrder();
bsOrder.setOrderNo(orderListItem.getTradeParentId()); bsOrder.setOrderNo(orderListItem.getTradeParentId());
@ -408,9 +446,11 @@ public class BsOrderServiceImpl implements BsOrderService {
if (orderListItem.getModifiedTime() != null) { if (orderListItem.getModifiedTime() != null) {
bsOrder.setCancelTime(DateUtil.format(orderListItem.getModifiedTime() , "yyyy-MM-dd HH:mm:ss")); bsOrder.setCancelTime(DateUtil.format(orderListItem.getModifiedTime() , "yyyy-MM-dd HH:mm:ss"));
} }
// 调用create方法,将新订单保存到本地订单列表中
create(bsOrder); create(bsOrder);
} else { } else {
if (bsOrder.getStatus() != 8) { // 如果本地订单列表中已有该订单,则更新订单信息
if (bsOrder.getStatus() == 2) {
bsOrder.setOrderNo(orderListItem.getTradeParentId()); bsOrder.setOrderNo(orderListItem.getTradeParentId());
bsOrder.setUpdateTime(new Date()); bsOrder.setUpdateTime(new Date());
bsOrder.setStatus(taoBaoStatus(orderListItem.getTkStatus())); 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")); bsOrder.setCancelTime(DateUtil.format(orderListItem.getModifiedTime() , "yyyy-MM-dd HH:mm:ss"));
} }
// 如果订单状态为5,则调用orderRebate方法 // 如果订单状态为5,则调用orderRebate方法
if (bsOrder.getStatus() == 5){ if (bsOrder.getStatus() == 2 && orderListItem.getTkStatus() == 3){
orderRebate(bsOrder); orderRebate(bsOrder);
} else { } else {
// 否则,调用editData方法,更新订单信息
editData(bsOrder); 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<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) { private Integer taoBaoStatus(Long status) {
int result = 6; int result = 4;
if (status == 3) { if (status == 3) {
result = 3; result = 2;
} else if (status == 12) { } else if (status == 12) {
result = 0; result = 1;
} else if (status == 13) { } else if (status == 13) {
result = 4; result = 4;
} else if (status == 14) { } else if (status == 14) {
result = 2;
}
return result;
}
private Integer meiTuanStatus(Long status) {
int result = 4;
if (status == 1) {
result = 1; result = 1;
} else if (status == 8) {
result = 2;
} else if (status == 9) {
result = 4;
} }
return result; return result;
} }

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

@ -27,7 +27,7 @@ public class PromotionBusinessService {
// 淘口令生成业务 // 淘口令生成业务
public JSONObject taobaoUrl(JSONObject jsonObject) throws Exception{ 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")) { if (!object.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
} }

@ -67,7 +67,7 @@ public class TaoBaoService {
* @Author: Sum1Dream * @Author: Sum1Dream
* @Date: 2024/9/10 下午1:52 * @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)) { if (StringUtils.isBlank(title)) {
title = "百货"; title = "百货";
} }
@ -83,8 +83,6 @@ public class TaoBaoService {
TaobaoTbkDgMaterialOptionalUpgradeRequest request = new TaobaoTbkDgMaterialOptionalUpgradeRequest(); TaobaoTbkDgMaterialOptionalUpgradeRequest request = new TaobaoTbkDgMaterialOptionalUpgradeRequest();
request.setQ(title); request.setQ(title);
request.setPageNo(pageNo); request.setPageNo(pageNo);
request.setRelationId(relationId);
request.setSpecialId(specialId);
request.setHasCoupon(true); request.setHasCoupon(true);
request.setPageSize(pageSize); request.setPageSize(pageSize);
request.setAdzoneId(115764450446L); request.setAdzoneId(115764450446L);

Loading…
Cancel
Save