From 2946b26df67e33aa47e16388809bf1044c5bda27 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Fri, 27 Dec 2024 10:14:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B1=87=E8=81=94=E9=80=9Adi?= =?UTF-8?q?stributorId=20=20=E5=8E=9F=E5=8F=82=E6=95=B0aNId4A3X=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BAorjuOND7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bweb/controller/TestController.java | 71 +++++++++++++++---- .../goods/GoodPresentController.java | 4 +- .../business/BsOrderMeiTuanController.java | 6 +- .../controller/notify/MeiTuanController.java | 2 +- .../com/hfkj/schedule/OrderGoodsSchedule.java | 55 +++++++++++++- .../java/com/hfkj/dao/GoodsMsgMapperExt.java | 4 +- .../java/com/hfkj/dao/JdSkuMapperExt.java | 32 +++++++++ .../java/com/hfkj/jd/Impl/JdServiceImpl.java | 29 ++++++-- .../src/main/java/com/hfkj/jd/JdService.java | 10 +-- .../goods/impl/BsOrderMeiTuanServiceImpl.java | 5 +- 10 files changed, 183 insertions(+), 35 deletions(-) diff --git a/bweb/src/main/java/com/bweb/controller/TestController.java b/bweb/src/main/java/com/bweb/controller/TestController.java index 6dfb830..0dcd3e0 100644 --- a/bweb/src/main/java/com/bweb/controller/TestController.java +++ b/bweb/src/main/java/com/bweb/controller/TestController.java @@ -6,19 +6,21 @@ import com.hfkj.common.exception.SysCode; import com.hfkj.common.utils.*; import com.hfkj.config.CommonSysConst; -import com.hfkj.entity.BsOrder; -import com.hfkj.entity.BsOrderGoods; -import com.hfkj.entity.GoodsUserAddress; +import com.hfkj.entity.*; import com.hfkj.jd.JdPostService; import com.hfkj.jd.JdService; import com.hfkj.mer.BsMerPayConfigService; import com.hfkj.model.ResponseData; +import com.hfkj.qianzhu.StarbucksService; import com.hfkj.service.card.BsUserCardService; import com.hfkj.service.coupon.channel.YouTuCouponService; import com.hfkj.service.goods.BsOrderGoodsService; +import com.hfkj.service.goods.BsOrderStarbucksService; import com.hfkj.service.goods.GoodsUserAddressService; +import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl; import com.hfkj.service.hlt.HuiLianTongUnionCardService; +import com.hfkj.service.order.BsOrderChildService; import com.hfkj.service.order.BsOrderRefundService; import com.hfkj.service.order.BsOrderService; import com.hfkj.service.order.OrderPayService; @@ -70,6 +72,16 @@ public class TestController { @Resource private BsOrderService orderService; + @Resource + private BsOrderStarbucksService orderStarbucksService; + + @Resource + private BsOrderChildService orderChildService; + + + @Resource + private BsOrderStarbucksServiceImpl bsOrderStarbucksService; + @RequestMapping(value="/thirdPayResult",method = RequestMethod.GET) @ResponseBody @@ -161,7 +173,7 @@ public class TestController { public ResponseData getSkuDetailInfo() { try { - GetSkuPoolInfoGoodsResp detail = JdPostService.getSkuDetailInfo(jdService.getToken() , 1235014L).getOpenRpcResult().getResult(); + GetSkuPoolInfoGoodsResp detail = JdPostService.getSkuDetailInfo(jdService.getToken() , 100017491914L).getOpenRpcResult().getResult(); return ResponseMsgUtil.success(detail); } catch (Exception e) { @@ -176,7 +188,7 @@ public class TestController { public ResponseData getSkuImageList() { try { - return ResponseMsgUtil.success(JdPostService.getSkuImageList(jdService.getToken() , "1235014")); + return ResponseMsgUtil.success(JdPostService.getSkuImageList(jdService.getToken() , "100017491914")); } catch (Exception e) { log.error("error!",e); @@ -190,7 +202,7 @@ public class TestController { public ResponseData getSellPrice() { try { - return ResponseMsgUtil.success(JdPostService.getSellPrice(jdService.getToken() , "1235014")); + return ResponseMsgUtil.success(JdPostService.getSellPrice(jdService.getToken() , "100017491914")); } catch (Exception e) { log.error("error!",e); @@ -226,6 +238,20 @@ public class TestController { } } + @RequestMapping(value="/skuList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "skuList") + public ResponseData skuList() { + try { + return ResponseMsgUtil.success(jdService.skuList()); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/queryTransByVopNormal",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "消息消费") @@ -504,14 +530,33 @@ public class TestController { public ResponseData phgSignLogin() { try { - Map map = new HashMap<>(); - map.put("appid" , "20241266600"); - map.put("phone" , "18390580471"); - map.put("sign" , SignatureUtil.createSign(map , "BCB83776BDA7F609FBE99BBB8AC33840")); - map.put("platform" , "HIGH"); - map.put("type" , "HIGH_SIGN"); - return ResponseMsgUtil.success( HttpsUtils.doPost("http://localhost:9704/user/client/phgSignLogin" , map , new HashMap<>())); + Map objectMap = new HashMap<>(); + + objectMap.put("status" , 10); + + List orderStarbucks = orderStarbucksService.getList(objectMap); + + for (BsOrderStarbucks starbucks : orderStarbucks) { + if (starbucks != null) { + // 查询星巴克订单详情 + BsOrderChild child = orderChildService.getDetail(starbucks.getChildOrderNo()); + + // 查询星巴克订单详情 + Map orderMap = new HashMap<>(); + orderMap.put("orderNo" , child.getChannelOrderNo()); + JSONObject objectOrder = StarbucksService.starbucksOrder(orderMap); + if (objectOrder != null) { + // 订单数据 + JSONObject order = objectOrder.getJSONObject("data"); + // 修改订单数据 + bsOrderStarbucksService.updateOrderStatus(child.getOrderNo() , order.getInteger("status")); + } + } + + + } + return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("error!",e); return ResponseMsgUtil.exception(e); diff --git a/bweb/src/main/java/com/bweb/controller/goods/GoodPresentController.java b/bweb/src/main/java/com/bweb/controller/goods/GoodPresentController.java index 58cc84b..2f7d31d 100644 --- a/bweb/src/main/java/com/bweb/controller/goods/GoodPresentController.java +++ b/bweb/src/main/java/com/bweb/controller/goods/GoodPresentController.java @@ -88,10 +88,10 @@ public class GoodPresentController { } - @RequestMapping(value="/getListBrand",method = RequestMethod.GET) + @RequestMapping(value="/getLisPresent",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询列表") - public ResponseData getListBrand(@RequestParam(value = "specsId" , required = false) Long specsId) { + public ResponseData getLisPresent(@RequestParam(value = "specsId" , required = false) Long specsId) { try { Map map = new HashMap<>(); diff --git a/order/src/main/java/com/order/controller/business/BsOrderMeiTuanController.java b/order/src/main/java/com/order/controller/business/BsOrderMeiTuanController.java index 6973093..8a2ac61 100644 --- a/order/src/main/java/com/order/controller/business/BsOrderMeiTuanController.java +++ b/order/src/main/java/com/order/controller/business/BsOrderMeiTuanController.java @@ -48,11 +48,11 @@ public class BsOrderMeiTuanController { @Resource private UserCenter userCenter; - + @Resource + private BsOrderMeiTuanServiceImpl bsOrderMeiTuanService; private static final Logger log = LoggerFactory.getLogger(BsOrderGoodsController.class); - @Autowired - private BsOrderMeiTuanServiceImpl bsOrderMeiTuanService; + @RequestMapping(value="/servicePrice",method = RequestMethod.GET) @ResponseBody diff --git a/order/src/main/java/com/order/controller/notify/MeiTuanController.java b/order/src/main/java/com/order/controller/notify/MeiTuanController.java index 785cddb..8262b55 100644 --- a/order/src/main/java/com/order/controller/notify/MeiTuanController.java +++ b/order/src/main/java/com/order/controller/notify/MeiTuanController.java @@ -118,7 +118,7 @@ public class MeiTuanController { "&outSidePhone=" + staffInfo.getString("staffPhone") + "&outsidePlatform=" + "WXAPPLETS" + "&outSideType=" + "SIGN" - ); + ); log.info("美团下单-参数: {}", object); data.put("status", 0); diff --git a/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java b/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java index f9caa3a..b4ef3b5 100644 --- a/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java +++ b/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java @@ -1,13 +1,17 @@ package com.hfkj.schedule; +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.*; +import com.hfkj.qianzhu.StarbucksService; import com.hfkj.service.goods.BsOrderGoodsService; import com.hfkj.service.goods.BsOrderStarbucksService; import com.hfkj.service.goods.GoodsUserAddressService; +import com.hfkj.service.goods.impl.BsOrderMeiTuanServiceImpl; +import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl; import com.hfkj.service.order.BsOrderChildService; import com.hfkj.service.order.BsOrderService; import com.hfkj.sysenum.order.OrderLogisticsStatusEnum; @@ -39,7 +43,7 @@ public class OrderGoodsSchedule { @Resource - private GoodsUserAddressService addressService; + private BsOrderStarbucksServiceImpl bsOrderStarbucksService; @Resource private BsOrderStarbucksService orderStarbucksService; @@ -49,7 +53,8 @@ public class OrderGoodsSchedule { @Resource private BsOrderService orderService; - + @Resource + private BsOrderMeiTuanServiceImpl bsOrderMeiTuanService; //每日凌晨12点5秒执行一次 @Scheduled(cron = "5 0 0 * * ?") public void orderGoodsConfirmReceipt() { @@ -143,6 +148,52 @@ public class OrderGoodsSchedule { } + } + } + + @Scheduled(cron = "5 0 0 * * ?") + public void getMeiTuan() { + Map objectMap = new HashMap<>(); + + objectMap.put("status" , 2); + + List orderMeiTuan = bsOrderMeiTuanService.getOrderList(objectMap); + + for (BsOrderMeituan meituan : orderMeiTuan) { + + if (meituan != null) { + bsOrderMeiTuanService.orderFinish(meituan.getChildOrderNo()); + } + } + } + + @Scheduled(cron = "5 0 0 * * ?") + public void getStarbucksByCompleted() { + Map objectMap = new HashMap<>(); + + objectMap.put("status" , 10); + + List orderStarbucks = orderStarbucksService.getList(objectMap); + + for (BsOrderStarbucks starbucks : orderStarbucks) { + + if (starbucks != null) { + // 查询星巴克订单详情 + BsOrderChild child = orderChildService.getDetail(starbucks.getChildOrderNo()); + + // 查询星巴克订单详情 + Map orderMap = new HashMap<>(); + orderMap.put("orderNo" , child.getChannelOrderNo()); + JSONObject objectOrder = StarbucksService.starbucksOrder(orderMap); + if (objectOrder != null) { + // 订单数据 + JSONObject order = objectOrder.getJSONObject("data"); + // 修改订单数据 + bsOrderStarbucksService.updateOrderStatus(child.getOrderNo() , order.getInteger("status")); + } + } + + } } } diff --git a/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java b/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java index 60357b3..2659956 100644 --- a/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java @@ -29,7 +29,7 @@ public interface GoodsMsgMapperExt { " FROM" + " goods_msg a join goods_specs b on a.id = b.goods_id where a.type = 1 and a.child_type=1 and a.status = 1" + " and a.goods_type_parent = #{param.goodsTypeParent} " + - " and b.title like concat('%',#{param.title},'%') " + + " and a.title like concat('%',#{param.title},'%') " + " and a.goods_type = #{param.goodsType} " + " and a.goods_brand = #{param.goodsBrand} " + " = #{param.salePriceS} ]]>" + @@ -46,7 +46,7 @@ public interface GoodsMsgMapperExt { " third_id as thirdId," + " sale_num as saleNum" + " FROM" + - " goods_msg where status = 1 " + + " goods_msg where status = 1 and third_id is null " + " and goods_type_parent = #{param.goodsTypeParent} " + " and title like concat('%',#{param.title},'%') " + " and goods_type = #{param.goodsType} " + diff --git a/service/src/main/java/com/hfkj/dao/JdSkuMapperExt.java b/service/src/main/java/com/hfkj/dao/JdSkuMapperExt.java index 5e2a260..998547d 100644 --- a/service/src/main/java/com/hfkj/dao/JdSkuMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/JdSkuMapperExt.java @@ -1,7 +1,39 @@ package com.hfkj.dao; +import com.hfkj.entity.JdSku; +import com.hfkj.model.goods.JdGoodsModel; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; +import java.util.Map; + /** * mapper扩展类 */ public interface JdSkuMapperExt { + + + + @Insert({ + "" + }) + void insertJdSkuBatch(@Param(value = "list") List list); + + + @Select("") + List getJdList(); } \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/jd/Impl/JdServiceImpl.java b/service/src/main/java/com/hfkj/jd/Impl/JdServiceImpl.java index 9fd0841..b3b6588 100644 --- a/service/src/main/java/com/hfkj/jd/Impl/JdServiceImpl.java +++ b/service/src/main/java/com/hfkj/jd/Impl/JdServiceImpl.java @@ -3,6 +3,8 @@ package com.hfkj.jd.Impl; import com.alibaba.fastjson.JSONObject; import com.hfkj.common.utils.RedisUtil; import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.dao.JdSkuMapper; +import com.hfkj.dao.JdSkuMapperExt; import com.hfkj.entity.*; import com.hfkj.jd.JdPostService; import com.hfkj.jd.JdService; @@ -31,6 +33,7 @@ import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuImageListResponse; import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuPoolInfoResponse; import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuStateListResponse; import com.jd.open.api.sdk.response.vopxx.VopMessageQueryTransByVopNormalResponse; +import org.apache.commons.collections4.ListUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -69,6 +72,9 @@ public class JdServiceImpl implements JdService { @Resource private BsOrderGoodsService bsOrderGoodsService; + @Resource + private JdSkuMapper jdSkuMapper; + private final List skuListIds = new ArrayList<>(); @@ -107,7 +113,6 @@ public class JdServiceImpl implements JdService { handleList.forEach(item->{ try { - for (Long aLong : handleList) { // 根据skuId 查询商品详情 @@ -134,7 +139,6 @@ public class JdServiceImpl implements JdService { GoodsType goodsType1 = goodsTypeService.queryDetail(category1); GoodsType goodsType2 = goodsTypeService.queryDetail(category2); - // 如果goodsType1为null,则创建一个新的GoodsType对象 if (goodsType1 == null) { goodsType1 = new GoodsType(); @@ -332,7 +336,6 @@ public class JdServiceImpl implements JdService { // 获取京东商品池编码 List skuPoolList = sku.getOpenRpcResult().getResult().getSkuPoolList(); - skuListIds.clear(); BsProductConfig productConfig = productConfigService.queryDetail(OrderChildProductTypeEnum.type6.getCode()); @@ -343,9 +346,16 @@ public class JdServiceImpl implements JdService { getSkuList(token , skuPoolInfoItemGoodsResp.getBizPoolId() , 0L); } + List sku1 = jdSkuMapper.getJdList(); + + List skuList = skuListIds.stream() + .filter(e -> !sku1.contains(e)) + .collect(Collectors.toList()); + + System.out.println("=========================当前cpu核数:{}" + cpuCoreCnt); //通过对核心数取余来计算每个线程需要处理的数据量大小 - int size = skuListIds.size() % cpuCoreCnt > 0 ? skuListIds.size() / cpuCoreCnt +1 : skuListIds.size() / cpuCoreCnt; + int size = skuList.size() % cpuCoreCnt > 0 ? skuList.size() / cpuCoreCnt +1 : skuList.size() / cpuCoreCnt; // 用于存储所有任务的Future List futureList = new ArrayList<>(); @@ -354,7 +364,7 @@ public class JdServiceImpl implements JdService { for (int i = 0; i < cpuCoreCnt; i++) { //获取每个线程要处理的数据集 - List handleList = skuListIds.subList(i * size, Math.min(skuListIds.size(), i * size + size)); + List handleList = skuList.subList(i * size, Math.min(skuList.size(), i * size + size)); //创建异步任务添加到线程池,这里使用jdk8的CompletableFuture CompletableFuture completableFuture = CompletableFuture.runAsync(() -> { //数据集处理任务 @@ -372,11 +382,16 @@ public class JdServiceImpl implements JdService { //关闭线程池 threadPool.shutdown(); }, threadPool); - System.out.println(skuListIds.size()); - + System.out.println(skuList.size()); + } + @Override + public List skuList() { + return jdSkuMapper.getJdList(); } + + /** * @MethodName getSkuList * @Description: 获取全量商品池 diff --git a/service/src/main/java/com/hfkj/jd/JdService.java b/service/src/main/java/com/hfkj/jd/JdService.java index 68c69d2..e18e591 100644 --- a/service/src/main/java/com/hfkj/jd/JdService.java +++ b/service/src/main/java/com/hfkj/jd/JdService.java @@ -1,13 +1,12 @@ package com.hfkj.jd; -import com.hfkj.entity.BsOrder; -import com.hfkj.entity.BsOrderGoods; -import com.hfkj.entity.GoodsLogistics; -import com.hfkj.entity.GoodsMsg; +import com.hfkj.entity.*; import com.jd.open.api.sdk.response.vopdd.VopOrderQueryDeliveryInfoResponse; import com.jd.open.api.sdk.response.vopdd.VopOrderQueryOrderDetailResponse; import com.jd.open.api.sdk.response.vopsh.VopAfsCreateAfsApplyResponse; +import java.util.List; + public interface JdService { /** @@ -31,6 +30,9 @@ public interface JdService { */ void getGoodsJd() throws Exception; + + List skuList(); + /** * @MethodName checkSkuSale * @Description: 校验商品可售性 diff --git a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderMeiTuanServiceImpl.java b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderMeiTuanServiceImpl.java index 74e211c..af016a4 100644 --- a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderMeiTuanServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderMeiTuanServiceImpl.java @@ -202,7 +202,10 @@ public class BsOrderMeiTuanServiceImpl implements BsOrderMeiTuanService { if (finish) { // 子订单完成 orderService.childOrderComplete(childNo); - orderMeiTuan.setFinishTime(finshDate); + orderMeiTuan.setFinishTime(new Date()); + if (finshDate != null) { + orderMeiTuan.setExt1(finshDate.toString()); + } orderMeiTuan.setUpdateTime(new Date()); orderMeiTuan.setStatus(OrderChildStatusEnum.status3.getCode()); update(orderMeiTuan);