袁野 3 weeks ago
parent ef0080286d
commit 97ed274f67
  1. 22
      cweb/src/main/java/com/hfkj/controller/ClientController.java
  2. 75
      cweb/src/main/java/com/hfkj/controller/GoodsController.java
  3. 36
      cweb/src/main/java/com/hfkj/controller/TestController.java
  4. 14
      cweb/src/main/java/com/hfkj/controller/order/BsOrderController.java
  5. 55
      schedule/src/main/java/com/hfkj/schedule/OrderSchedule.java
  6. 4
      service/src/main/java/com/hfkj/model/GoodsModel.java
  7. 2
      service/src/main/java/com/hfkj/model/PublishInfoModel.java
  8. 2
      service/src/main/java/com/hfkj/service/goods/impl/GoodsDataServiceImpl.java
  9. 5
      service/src/main/java/com/hfkj/service/order/BsOrderService.java
  10. 198
      service/src/main/java/com/hfkj/service/order/Impl/BsOrderServiceImpl.java
  11. 118
      service/src/main/java/com/hfkj/service/taobao/TaoBaoService.java
  12. 3
      service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java

@ -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,6 +5,7 @@ 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;
@ -23,10 +24,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,6 +43,8 @@ public class GoodsController {
@Resource
private BsUserService bsUserService;
@Resource
private BsOrderService orderService;
@RequestMapping(value="/goodsList",method = RequestMethod.GET)
@ -67,7 +70,7 @@ public class GoodsController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户未授权!");
}
JSONObject jsonObject = TaoBaoService.material(title , pageNo , pageSize , bsUser.getSpecialId());
JSONObject jsonObject = TaoBaoService.material(title , pageNo , pageSize , bsUser.getSpecialId() , bsUser.getRelationId());
if (!jsonObject.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
@ -169,5 +172,67 @@ public class GoodsController {
}
}
@RequestMapping(value="/getPublisherInfo",method = RequestMethod.GET)
@ResponseBody
@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);
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 {
orderService.getOrderTaoBaoList("2024-11-04 09:34:00" , "2024-11-04 12:34:00" );
return ResponseMsgUtil.success("1");
} 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);
return ResponseMsgUtil.exception(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,6 +46,37 @@ import java.util.Map;
public class TestController {
private static Logger log = LoggerFactory.getLogger(TestController.class);
@Autowired
private UserCenter userCenter;
@Resource
private BsUserService bsUserService;
@RequestMapping(value="/getPublisherInfo",method = RequestMethod.GET)
@ResponseBody
@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);
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);
}
}

@ -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 = "统计订单")

@ -0,0 +1,55 @@
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 30 1 * * ?") // 每日凌晨05:30:00 执行一次
public void pddOrder() {
try {
// 昨日时间
orderService.getOrderPddList("2024-10-01 00:00:00");
} 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("查询失败!!!");
}
}
}

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

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

@ -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();

@ -67,7 +67,10 @@ public interface BsOrderService {
* @Author: Sum1Dream
* @Date: 2024/10/23 上午10:27
*/
JSONObject getOrderList(String startTime) throws Exception;
void getOrderPddList(String startTime) throws Exception;
void getOrderTaoBaoList(String startTime , String endTime) throws Exception;
/**
* @MethodName getOrderListParent

@ -20,12 +20,15 @@ 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;
@ -36,6 +39,7 @@ 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;
@ -146,12 +150,19 @@ public class BsOrderServiceImpl implements BsOrderService {
}
@Override
public JSONObject getOrderList(String startTime) throws Exception{
public void getOrderPddList(String startTime) throws Exception{
pddOrder(startTime);
return null;
}
@Override
public void getOrderTaoBaoList(String startTime , String endTime) {
try {
taoBaoOrder(startTime , endTime);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
@Override
public List<BsOrderModel> getOrderListParent(Map<String, Object> map) {
@ -177,6 +188,9 @@ 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));
}
return orderModels;
}
@ -209,11 +223,6 @@ public class BsOrderServiceImpl implements BsOrderService {
@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, "订单状态不可返利");
}
Map<String,Object> otherParam = new HashMap<>();
otherParam.put("sourceId", bsOrder.getId());
otherParam.put("sourceOrderNo", bsOrder.getOrderNo());
@ -225,15 +234,13 @@ public class BsOrderServiceImpl implements BsOrderService {
}
// 根据开始时间获取拼多多订单列表
private void pddOrder(String startTime) throws Exception{
// 调用PddService的getOrderList方法获取订单列表
PddDdkOrderListRangeGetResponse rangeGetResponse = PddService.getOrderList(startTime);
// 调用getOrderList方法获取本地订单列表
List<BsOrder> list = getOrderList(new HashMap<>());
List<BsUser> userList = userService.getList(new HashMap<>());
// 判断rangeGetResponse是否为空
if (rangeGetResponse != null) {
// 获取订单列表
@ -263,7 +270,7 @@ 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(Long.valueOf(uid));
BsUser user = userList.stream().filter(s->s.getId().equals(Long.valueOf(uid))).findFirst().orElse(null);
if (bsOrder == null) {
// 如果BsOrder对象为空,则创建新的BsOrder对象
bsOrder = new BsOrder();
@ -293,44 +300,144 @@ public class BsOrderServiceImpl implements BsOrderService {
bsOrder.setFinishTime(DateUtil.long2Date(orderListItem.getOrderSettleTime()*1000));
}
if (orderListItem.getOrderModifyAt() != null) {
bsOrder.setRefundTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000));
if (bsOrder.getStatus().equals(4)) {
if (orderListItem.getOrderModifyAt() != null) {
bsOrder.setCancelTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000));
}
}
if (orderListItem.getOrderModifyAt() != null) {
bsOrder.setCancelTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000));
}
create(bsOrder);
}else {
// 如果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 (bsOrder.getStatus() != 8) {
// 如果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() == 5){
orderRebate(bsOrder);
} else {
editData(bsOrder);
}
}
if (orderListItem.getOrderCreateTime() != null) {
bsOrder.setCreateTime(DateUtil.long2Date(orderListItem.getOrderCreateTime()*1000));
}
}
}
}
}
private void taoBaoOrder(String startTime , String endTime) throws Exception {
TaobaoTbkOrderDetailsGetResponse response = TaoBaoService.getOrderList(startTime , endTime);
List<BsOrder> list = getOrderList(new HashMap<>());
Map<String , Object> reMap = new HashMap<>();
reMap.put("relationId" , 1);
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);
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(bsOrder);
} else {
if (bsOrder.getStatus() != 8) {
bsOrder.setOrderNo(orderListItem.getTradeParentId());
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.getOrderSettleTime() != null) {
bsOrder.setFinishTime(DateUtil.long2Date(orderListItem.getOrderSettleTime()*1000));
if (orderListItem.getTkPaidTime() != null) {
bsOrder.setPayTime(DateUtil.format(orderListItem.getTkPaidTime() , "yyyy-MM-dd HH:mm:ss"));
}
if (orderListItem.getOrderModifyAt() != null) {
bsOrder.setRefundTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000));
if (orderListItem.getTkCreateTime() != null) {
bsOrder.setCreateTime(DateUtil.format(orderListItem.getTkCreateTime() , "yyyy-MM-dd HH:mm:ss"));
}
if (orderListItem.getOrderModifyAt() != null) {
bsOrder.setCancelTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000));
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){
orderRebate(bsOrder);
@ -341,10 +448,25 @@ public class BsOrderServiceImpl implements BsOrderService {
}
}
}
}
}
private Integer taoBaoStatus(Long status) {
int result = 6;
if (status == 3) {
result = 3;
} else if (status == 12) {
result = 0;
} else if (status == 13) {
result = 4;
} else if (status == 14) {
result = 1;
}
return result;
}
}

@ -5,6 +5,7 @@ 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;
@ -15,11 +16,12 @@ 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.TaobaoTbkScInvitecodeGetRequest;
import com.taobao.top.ability425.request.TaobaoTbkScPublisherInfoGetRequest;
import com.taobao.top.ability425.request.TaobaoTbkScPublisherInfoSaveRequest;
import com.taobao.top.ability425.response.TaobaoTbkScInvitecodeGetResponse;
import com.taobao.top.ability425.response.TaobaoTbkScPublisherInfoGetResponse;
import com.taobao.top.ability425.response.TaobaoTbkScPublisherInfoSaveResponse;
import com.taobao.top.defaultability.Defaultability;
@ -34,7 +36,12 @@ 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;
@ -60,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) throws Exception {
public static JSONObject material(String title , Long pageNo , Long pageSize , String specialId , String relationId ) throws Exception {
if (StringUtils.isBlank(title)) {
title = "百货";
}
@ -76,7 +83,8 @@ public class TaoBaoService {
TaobaoTbkDgMaterialOptionalUpgradeRequest request = new TaobaoTbkDgMaterialOptionalUpgradeRequest();
request.setQ(title);
request.setPageNo(pageNo);
request.setRelationId(specialId);
request.setRelationId(relationId);
request.setSpecialId(specialId);
request.setHasCoupon(true);
request.setPageSize(pageSize);
request.setAdzoneId(115764450446L);
@ -193,4 +201,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));
}
}

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

Loading…
Cancel
Save