From 58a428b213066bfabb3fb2017124d748b8ca3398 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Tue, 7 Jan 2025 16:03:08 +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 | 553 ++---------------- .../controller/goods/GoodsController.java | 26 +- .../controller/cms/CmsContentController.java | 2 + .../controller/goods/GoodsController.java | 22 +- .../com/hfkj/schedule/OrderGoodsSchedule.java | 21 + .../java/com/hfkj/dao/GoodsMsgMapperExt.java | 9 +- .../java/com/hfkj/jd/Impl/JdServiceImpl.java | 8 +- .../main/java/com/hfkj/jd/JdPostService.java | 7 + .../service/goods/BsOrderGoodsService.java | 4 + .../hfkj/service/goods/GoodsMsgService.java | 2 + .../goods/impl/BsOrderGoodsServiceImpl.java | 8 + .../goods/impl/GoodsMsgServiceImpl.java | 8 + .../service/order/OrderCreateService.java | 12 +- 13 files changed, 178 insertions(+), 504 deletions(-) diff --git a/bweb/src/main/java/com/bweb/controller/TestController.java b/bweb/src/main/java/com/bweb/controller/TestController.java index 23bc72b..546cae1 100644 --- a/bweb/src/main/java/com/bweb/controller/TestController.java +++ b/bweb/src/main/java/com/bweb/controller/TestController.java @@ -13,13 +13,11 @@ import com.hfkj.jd.JdService; import com.hfkj.mer.BsMerPayConfigService; import com.hfkj.model.ResponseData; +import com.hfkj.model.goods.JdGoodsModel; 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.GoodsSpecsService; -import com.hfkj.service.goods.GoodsUserAddressService; +import com.hfkj.service.goods.*; import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl; import com.hfkj.service.hlt.HuiLianTongUnionCardService; import com.hfkj.service.order.BsOrderChildService; @@ -30,6 +28,7 @@ import com.hfkj.service.pay.huift.TradeService; import com.jd.open.api.sdk.domain.vopsp.CategoryInfoGoodsProvider.response.getCategoryInfoList.GetCategoryInfoGoodsResp; import com.jd.open.api.sdk.domain.vopsp.SkuInfoGoodsProvider.response.getSkuDetailInfo.GetSkuPoolInfoGoodsResp; import com.jd.open.api.sdk.domain.vopxx.MsgRecordProvider.response.queryTransByVopNormal.VopBizTransMessage; +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.vopdz.VopAddressConvertFourAreaByDetailStrResponse; import com.jd.open.api.sdk.response.vopxx.VopMessageQueryTransByVopNormalResponse; @@ -56,37 +55,14 @@ public class TestController { @Resource private TradeService huiftTradeService; - @Resource private BsOrderGoodsService orderGoodsService; - @Resource - private GoodsSpecsService goodsSpecsService; - @Resource - private JdService jdService; - - @Resource - private BsOrderGoodsService getOrderGoodsService; - - @Resource - private GoodsUserAddressService goodsUserAddressService; - - @Resource - private BsOrderRefundService orderRefundService; @Resource - private BsOrderService orderService; - - @Resource - private BsOrderStarbucksService orderStarbucksService; - - @Resource - private BsOrderChildService orderChildService; - + private JdService jdService; @Resource - private BsOrderStarbucksServiceImpl bsOrderStarbucksService; - @Resource - private GoodsUserAddressService deliveryAddressService; + private GoodsMsgService goodsMsgService; @RequestMapping(value="/thirdPayResult",method = RequestMethod.GET) @@ -105,29 +81,6 @@ public class TestController { } } - @RequestMapping(value="/haiOilLogin",method = RequestMethod.POST) - @ResponseBody - @ApiOperation(value = "嗨加油登陆参数") - public ResponseData haiOilLogin(@RequestBody JSONObject body) { - try { - - if (body == null|| StringUtils.isBlank(body.getString("phone"))) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - - Map map = new HashMap<>(); - map.put("appid" , CommonSysConst.getSysConfig().getHaiOilAppid()); - map.put("phone" , body.getString("phone")); - map.put("sign" , SignatureUtil.createSign(map , CommonSysConst.getSysConfig().getHaiOilAppSecret())); - - - return ResponseMsgUtil.success(map); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } @RequestMapping(value="/refundMovieOrder",method = RequestMethod.POST) @ResponseBody @@ -157,23 +110,10 @@ public class TestController { } } - @RequestMapping(value="/getSkuPoolInfo",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "getSkuPoolInfo") - public ResponseData getSkuPoolInfo() { - try { - - return ResponseMsgUtil.success(JdPostService.getSkuPoolInfo(jdService.getToken())); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } @RequestMapping(value="/queryOrderDetailByJd",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "queryOrderDetailByJd") + @ApiOperation(value = "查询京东商品订单详情") public ResponseData queryOrderDetailByJd(@RequestParam(value = "childOrderNo" , required = true) String childOrderNo, @RequestParam(value = "thirdOrderNo" , required = true) Long thirdOrderNo) { try { @@ -188,191 +128,18 @@ public class TestController { } } - @RequestMapping(value="/sign",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "sign") - public ResponseData sign(@RequestParam(value = "phone" , required = true) String phone, - @RequestParam(value = "appid" , required = true) String appid, - @RequestParam(value = "appSecret" , required = true) String appSecret) { - try { - - Map map = new HashMap<>(); - map.put("appid" , appid); - map.put("phone" , phone); - String sign = SignatureUtil.createSign(map , appSecret); - - return ResponseMsgUtil.success(sign); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - // 查询上游订单 - - @RequestMapping(value="/getSkuDetailInfo",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "getSkuDetailInfo") - public ResponseData getSkuDetailInfo() { - try { - - GetSkuPoolInfoGoodsResp detail = JdPostService.getSkuDetailInfo(jdService.getToken() , 100017491914L).getOpenRpcResult().getResult(); - return ResponseMsgUtil.success(detail); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - @RequestMapping(value="/getSkuImageList",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "getSkuImageList") - public ResponseData getSkuImageList() { - try { - - return ResponseMsgUtil.success(JdPostService.getSkuImageList(jdService.getToken() , "100017491914")); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - @RequestMapping(value="/getSellPrice",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "批量查询商品售卖价") - public ResponseData getSellPrice() { - try { - - return ResponseMsgUtil.success(JdPostService.getSellPrice(jdService.getToken() , "100017491914")); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - @RequestMapping(value="/getCategoryInfoList",method = RequestMethod.GET) + @RequestMapping(value="/orderGoodsJd",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "获取分类") - public ResponseData getCategoryInfoList() { + @ApiOperation(value = "更新京东物流信息") + public ResponseData orderGoodsJd() { try { - return ResponseMsgUtil.success(JdPostService.getCategoryInfoList(jdService.getToken() , "1235014")); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - @RequestMapping(value="/getGoodsJd",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "更新商品") - public ResponseData getGoodsJd() { - try { - jdService.getGoodsJd(); - return ResponseMsgUtil.success(""); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - - - @RequestMapping(value="/querySkuFreight",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "querySkuFreight") - public ResponseData querySkuFreight() { - try { - - List skuInfoList = new ArrayList<>(); - - com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq skuInfo = new com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq(); - - skuInfo.setSkuId(627345); - skuInfo.setSkuNum(1); - skuInfoList.add(skuInfo); - return ResponseMsgUtil.success( JdPostService.querySkuFreight(jdService.getToken() , skuInfoList , 24L ,2144L , 21037L , 58300L)); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - @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 = "消息消费") - public ResponseData queryTransByVopNormal() { - try { - - - jdService.deleteMsg(); - - return ResponseMsgUtil.success("成功!"); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - @RequestMapping(value="/tradeOrderRefund",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "手动退款") - public ResponseData tradeOrderRefund(@RequestParam(value = "orderNo" , required = true) String orderNo) { - try { - - - orderRefundService.tradeOrderRefund(orderNo,"手动退款"); - - return ResponseMsgUtil.success("成功!"); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - - @RequestMapping(value="/confirmReceipt",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "confirmReceipt") - public ResponseData confirmReceipt() { - try { - Map map = new HashMap<>(); - - map.put("logisticsStatus" , "AGENT_SIGN"); - map.put("status" , 2); - - List orderGoodsList = orderGoodsService.getList(map); + List orderGoodsList = orderGoodsService.getListByJd(); for (BsOrderGoods goods : orderGoodsList) { - - // 判断时间是否是十天前 - - if (DateUtil.differentDays(goods.getCreateTime() , new Date()) > 10) { - orderGoodsService.confirmReceipt(goods.getId()); - } + System.out.println(goods.toString()); + System.out.println(goods.getGoodsId()); + jdService.updateDeliveryInfo(goods); } return ResponseMsgUtil.success(""); @@ -382,37 +149,18 @@ public class TestController { } } - - - @RequestMapping(value="/convertFourAreaByDetailStr",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "地址详情转换京东地址编码") - public ResponseData convertFourAreaByDetailStr(@RequestParam(value = "address", required = false) String address - ) { - try { - - VopAddressConvertFourAreaByDetailStrResponse response = JdPostService.convertFourAreaByDetailStr(jdService.getToken() , address); - - return ResponseMsgUtil.success(response.getOpenRpcResult().getResult()); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - @RequestMapping(value="/getYouTuCouponList",method = RequestMethod.GET) + @RequestMapping(value="/checkSkuSale",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "获取卡券") - public ResponseData getYouTuCouponList() { + @ApiOperation(value = "京东商品价格更新") + public ResponseData checkSkuSale() { try { - JSONObject object = new JSONObject(); - object.put("time" , new Date().getTime()/1000); - - JSONObject jsonObject = YouTuCouponService.getYouTuCouponList(object); + List list = goodsMsgService.getJdList(); - return ResponseMsgUtil.success(jsonObject); + for (GoodsMsg goods : list) { + jdService.checkSkuSale(goods); + } + return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("error!",e); @@ -420,20 +168,16 @@ public class TestController { } } - @RequestMapping(value="/getMerchantCouponCode",method = RequestMethod.GET) + @RequestMapping(value="/queryDeliveryInfoByjd",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "获取电子券码") - public ResponseData getMerchantCouponCode() { + @ApiOperation(value = "查询配送信息京东") + public ResponseData queryDeliveryInfoByjd(@RequestParam(value = "childOrderNo" , required = true) String childOrderNo, + @RequestParam(value = "thirdOrderNo" , required = true) Long thirdOrderNo) { try { - JSONObject object = new JSONObject(); - object.put("id" , "759"); - object.put("tradeId" , OrderUtil.generateOrderNo()); - object.put("time" , new Date().getTime()/1000); - - JSONObject jsonObject = YouTuCouponService.getMerchantCouponCode(object); + VopOrderQueryDeliveryInfoResponse orderDetailResponse = JdPostService.queryDeliveryInfo(jdService.getToken(),thirdOrderNo, childOrderNo); - return ResponseMsgUtil.success(jsonObject); + return ResponseMsgUtil.success(orderDetailResponse); } catch (Exception e) { log.error("error!",e); @@ -441,21 +185,20 @@ public class TestController { } } - @RequestMapping(value="/merchantCouponToMember",method = RequestMethod.GET) + @RequestMapping(value="/sign",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "获取电子券码") - public ResponseData merchantCouponToMember() { + @ApiOperation(value = "sign") + public ResponseData sign(@RequestParam(value = "phone" , required = true) String phone, + @RequestParam(value = "appid" , required = true) String appid, + @RequestParam(value = "appSecret" , required = true) String appSecret) { try { - JSONObject object = new JSONObject(); - object.put("id" , "759"); - object.put("telephone" , "18090580471"); - object.put("tradeId" , OrderUtil.generateOrderNo()); - object.put("time" , new Date().getTime()/1000); - - JSONObject jsonObject = YouTuCouponService.merchantCouponToMember(object); + Map map = new HashMap<>(); + map.put("appid" , appid); + map.put("phone" , phone); + String sign = SignatureUtil.createSign(map , appSecret); - return ResponseMsgUtil.success(jsonObject); + return ResponseMsgUtil.success(sign); } catch (Exception e) { log.error("error!",e); @@ -464,84 +207,43 @@ public class TestController { } - @RequestMapping(value="/checkGoods",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "校验商品是否正确") - public ResponseData checkGoods(@RequestParam(value = "orderNo", required = false) String orderNo) { - try { - BsOrder order = orderService.getOrder(orderNo); - - return ResponseMsgUtil.success(jdService.checkGoods(order)); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - @RequestMapping(value="/queryOrderDetail",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "查询订单") - public ResponseData queryOrderDetail(@RequestParam(value = "orderNo", required = false) String orderNo) { - try { - BsOrderGoods order = getOrderGoodsService.findGoodsOrder(orderNo); - return ResponseMsgUtil.success(jdService.queryOrderDetail(order)); +// @RequestMapping(value="/getGoodsJd",method = RequestMethod.GET) +// @ResponseBody +// @ApiOperation(value = "更新商品") +// public ResponseData getGoodsJd() { +// try { +// jdService.getGoodsJd(); +// return ResponseMsgUtil.success(""); +// +// } catch (Exception e) { +// log.error("error!",e); +// return ResponseMsgUtil.exception(e); +// } +// } - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } +// @RequestMapping(value="/confirmOrder",method = RequestMethod.GET) +// @ResponseBody +// @ApiOperation(value = "确认订单") +// public ResponseData confirmOrder(@RequestParam(value = "childNo", required = false) String childNo) { +// try { +// +// BsOrderGoods order = getOrderGoodsService.findGoodsOrderByChild(childNo); +// jdService.confirmOrder(order); +// return ResponseMsgUtil.success(""); +// +// } catch (Exception e) { +// log.error("error!",e); +// return ResponseMsgUtil.exception(e); +// } +// } - @RequestMapping(value="/confirmOrder",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "确认订单") - public ResponseData confirmOrder(@RequestParam(value = "orderNo", required = false) String orderNo) { - try { - BsOrderGoods order = getOrderGoodsService.findGoodsOrder(orderNo); - jdService.confirmOrder(order); - return ResponseMsgUtil.success(""); - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - @RequestMapping(value="/queryDeliveryInfo",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "查询物流信息") - public ResponseData queryDeliveryInfo(@RequestParam(value = "orderNo", required = false) String orderNo) { - try { - - BsOrderGoods order = getOrderGoodsService.findGoodsOrder(orderNo); - return ResponseMsgUtil.success(jdService.queryDeliveryInfo(order)); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - @RequestMapping(value="/cancelOrder",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "取消订单") - public ResponseData cancelOrder(@RequestParam(value = "childNo", required = false) String childNo) { - try { - - jdService.cancelOrder(childNo); - return ResponseMsgUtil.success(""); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } @RequestMapping(value="/queryHltBalance",method = RequestMethod.GET) @ResponseBody @@ -561,130 +263,5 @@ public class TestController { } } - @RequestMapping(value="/getGoodsUpdate",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "更新商品") - public ResponseData getGoodsUpdate() { - try { - - Map map = new HashMap<>(); - map.put("status" , 3); - List orderGoodsList = getOrderGoodsService.getList(map); - - - - for (BsOrderGoods orderGoods : orderGoodsList) { - GoodsUserAddress address = goodsUserAddressService.queryDetail(orderGoods.getDeliveryAddressId()); - - if (address != null) { - orderGoods.setDeliveryAddress(address.getRegionName() + "-" + address.getAddress() + "-" + address.getConsignee() + "-" + address.getPhone()); - getOrderGoodsService.update(orderGoods); - } - } - - return ResponseMsgUtil.success(""); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } - - - @RequestMapping(value="/phgSignLogin",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "加密登陆") - public ResponseData phgSignLogin() { - try { - - 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); - } - } - - @RequestMapping(value="/querySkuFreight",method = RequestMethod.POST) - @ResponseBody - @ApiOperation(value = "查询运费") - public ResponseData querySkuFreight(@RequestBody JSONObject body) { - try { - - if (body == null || - body.getJSONArray("skuInfoList") == null - || body.getLong("addressId") == null - ) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - - JSONArray array = body.getJSONArray("skuInfoList"); - GoodsUserAddress userAddress = goodsUserAddressService.queryDetail(body.getLong("addressId")); - if (userAddress.getProvinceId() == null) { - VopAddressConvertFourAreaByDetailStrResponse response = JdPostService.convertFourAreaByDetailStr(jdService.getToken() , userAddress.getRegionName() + userAddress.getAddress()); - - if (response != null && response.getOpenRpcResult().getSuccess()) { - userAddress.setProvinceId(response.getOpenRpcResult().getResult().getProvinceId()); - userAddress.setProvinceName(response.getOpenRpcResult().getResult().getProvinceName()); - userAddress.setCityId(response.getOpenRpcResult().getResult().getCityId()); - userAddress.setCityName(response.getOpenRpcResult().getResult().getCityName()); - userAddress.setCountyId(response.getOpenRpcResult().getResult().getCountyId()); - userAddress.setCountyName(response.getOpenRpcResult().getResult().getCountyName()); - userAddress.setTownId(response.getOpenRpcResult().getResult().getTownId()); - userAddress.setTownName(response.getOpenRpcResult().getResult().getTownName()); - userAddress.setUpdateTime(new Date()); - deliveryAddressService.update(userAddress); - } - } - List skuInfoList = new ArrayList<>(); - com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq skuInfo = new com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq(); - - for(Object object : array) { - JSONObject json = (JSONObject)object; - GoodsSpecs specs = goodsSpecsService.queryDetail(json.getLong("specsId")); - if (specs.getThirdId() != null) { - skuInfo.setSkuId(Long.parseLong(specs.getThirdId())); - skuInfo.setSkuNum(json.getInteger("num")); - skuInfoList.add(skuInfo); - } - } - - if (skuInfoList.isEmpty()) { - JSONObject object = new JSONObject(); - object.put("totalFreight" , 0); - return ResponseMsgUtil.success(object); - } - return ResponseMsgUtil.success(JdPostService.querySkuFreight(jdService.getToken() , skuInfoList , userAddress.getProvinceId() ,userAddress.getCityId() , userAddress.getCountyId() , userAddress.getTownId()).getOpenRpcResult().getResult()); - - } catch (Exception e) { - log.error("error!",e); - return ResponseMsgUtil.exception(e); - } - } } diff --git a/bweb/src/main/java/com/bweb/controller/goods/GoodsController.java b/bweb/src/main/java/com/bweb/controller/goods/GoodsController.java index a974545..b7f466a 100644 --- a/bweb/src/main/java/com/bweb/controller/goods/GoodsController.java +++ b/bweb/src/main/java/com/bweb/controller/goods/GoodsController.java @@ -13,6 +13,8 @@ import com.hfkj.common.utils.OrderUtil; import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.config.CommonSysConst; import com.hfkj.entity.*; +import com.hfkj.jd.JdPostService; +import com.hfkj.jd.JdService; import com.hfkj.model.goods.GoodsModelSpecs; import com.hfkj.model.ResponseData; import com.hfkj.model.SecUserSessionObject; @@ -26,6 +28,7 @@ import com.hfkj.sysenum.fileRecords.FileRecordsEnum; import com.hfkj.sysenum.order.OrderChildStatusEnum; import com.hfkj.sysenum.order.OrderPayChannelEnum; import com.hfkj.sysenum.order.OrderPayTypeEnum; +import com.jd.open.api.sdk.response.vopdd.VopOrderCheckAccountBalanceResponse; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -77,7 +80,8 @@ public class GoodsController { @Resource private GoodsJumpService goodsJumpService; - + @Resource + private JdService jdService; @Resource private FileRecordsService fileRecordsService; @@ -500,6 +504,26 @@ public class GoodsController { } } + @RequestMapping(value = "/checkAccountBalance", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询账户余额") + public ResponseData checkAccountBalance( ) { + try { + + VopOrderCheckAccountBalanceResponse balanceResponse = JdPostService.checkAccountBalance(jdService.getToken()); + + if (balanceResponse == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "余额查询错误!"); + } + + return ResponseMsgUtil.success(balanceResponse.getOpenRpcResult().getResult().getBalanceInfo().getRemainLimit()); + + } catch (Exception e) { + log.error("GoodsDetailController --> findGoodsDetailById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/getJdGoodsList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询京东商品") diff --git a/cweb/src/main/java/com/cweb/controller/cms/CmsContentController.java b/cweb/src/main/java/com/cweb/controller/cms/CmsContentController.java index 291a501..a75f9ac 100644 --- a/cweb/src/main/java/com/cweb/controller/cms/CmsContentController.java +++ b/cweb/src/main/java/com/cweb/controller/cms/CmsContentController.java @@ -82,11 +82,13 @@ public class CmsContentController { if (cmsContent.getShowType() == 2) { goodsMap.put("goodsType", cmsContent.getShowDataId()); goodsMap.put("limit" , 4); + goodsMap.put("saleNum" , 2); goodsMsgs = goodsMsgService.getListCrest(goodsMap); } if (cmsContent.getShowType() == 3) { goodsMap.put("goodsType", cmsContent.getShowDataId()); goodsMap.put("limit" , 10); + goodsMap.put("type" , 1); goodsMsgs = goodsMsgService.getListCrest(goodsMap); } diff --git a/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java b/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java index a0f8c2c..8f72b09 100644 --- a/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java +++ b/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java @@ -88,18 +88,14 @@ public class GoodsController { @ResponseBody @ApiOperation(value = "查询品牌列表") public ResponseData getListBrand(@RequestParam(value = "title" , required = false) String title, - @RequestParam(value = "ext1" , required = false) String ext1) { + @RequestParam(value = "pageNum" , required = true) Integer pageNum, + @RequestParam(value = "pageSize" , required = true) Integer pageSize) { try { Map map = new HashMap<>(); map.put("title", title); - - JSONObject object = new JSONObject(); - object.put("list", goodsBrandService.getList(map)); - map.put("ext1", "热门"); - object.put("listExt", goodsBrandService.getList(map)); - - return ResponseMsgUtil.success(object); + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(goodsBrandService.getList(map))); } catch (Exception e) { log.error("error!",e); @@ -107,6 +103,8 @@ public class GoodsController { } } + + @RequestMapping(value = "/getListGoods", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询商品列表") @@ -118,9 +116,12 @@ public class GoodsController { @RequestParam(value = "discountId", required = false) Integer discountId, @RequestParam(value = "goodsBrand", required = false) Long goodsBrand, @RequestParam(value = "price", required = false) Integer price, + @RequestParam(value = "type", required = false) Integer type, @RequestParam(value = "saleNum", required = false) Integer saleNum, @RequestParam(value = "limit", required = false) Integer limit, @RequestParam(value = "time", required = false) Integer time, + @RequestParam(value = "salePriceS" , required = false) BigDecimal salePriceS, + @RequestParam(value = "salePriceE" , required = false) BigDecimal salePriceE, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize ) { @@ -136,6 +137,8 @@ public class GoodsController { map.put("goodsTypeParent", goodsTypeParent); map.put("goodsBrand", goodsBrand); map.put("saleNum", saleNum); + map.put("salePriceS", salePriceS); + map.put("salePriceE", salePriceE); if (limit == null && title == null && goodsType == null && goodsTypeParent == null && goodsBrand == null) { map.put("limit", 500); } else { @@ -144,6 +147,7 @@ public class GoodsController { map.put("time", time); map.put("status", 1); + map.put("type", type); if (discountId != null) { // 查询优惠券可以用规格 @@ -156,7 +160,7 @@ public class GoodsController { List sp = couponDiscountGoodsRel.stream().map(CouponDiscountGoodsRel::getSpecsId).collect(Collectors.toList()); map.put("specsId", sp); } - + System.out.println("=========================参数+" + map); List list = goodsMsgService.getListCrest(map); diff --git a/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java b/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java index b4ef3b5..e6cac6e 100644 --- a/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java +++ b/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java @@ -6,6 +6,7 @@ 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.jd.JdService; import com.hfkj.qianzhu.StarbucksService; import com.hfkj.service.goods.BsOrderGoodsService; import com.hfkj.service.goods.BsOrderStarbucksService; @@ -55,6 +56,10 @@ public class OrderGoodsSchedule { private BsOrderService orderService; @Resource private BsOrderMeiTuanServiceImpl bsOrderMeiTuanService; + + @Resource + private JdService jdService; + //每日凌晨12点5秒执行一次 @Scheduled(cron = "5 0 0 * * ?") public void orderGoodsConfirmReceipt() { @@ -196,4 +201,20 @@ public class OrderGoodsSchedule { } } + + //每55分钟执行一次 + @Scheduled(cron = "0 0/55 * * * ?") + public void orderGoodsJd() { + try { + List orderGoodsList = orderGoodsService.getListByJd(); + + for (BsOrderGoods goods : orderGoodsList) { + jdService.updateDeliveryInfo(goods); + + } + } catch (Exception e) { + log.error("HighUserController --> orderGoodsJd() error!", e); + } + + } } diff --git a/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java b/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java index cdab966..766431e 100644 --- a/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java @@ -68,14 +68,13 @@ public interface GoodsMsgMapperExt { " a.title as title," + " a.list_img as listImg," + " a.sale_num as saleNum," + - " b.sale_price as salePrice, " + - " b.sale_price as price, " + " b.third_price as thirdPrice," + " b.original_price as originalPrice," + " a.third_id as thirdId," + " b.id as specsId ," + " a.id as id," + - " MIN(b.sale_price) , " + + " MIN(b.sale_price) as salePrice , " + + " MIN(b.sale_price) as price , " + "a.create_time as createtime ," + "a.update_time as updateTime" + " FROM" + @@ -84,9 +83,11 @@ public interface GoodsMsgMapperExt { " and a.title like concat('%',#{param.title},'%') " + " and a.goods_type = #{param.goodsType} " + " and a.show_type = #{param.showType} " + + " and a.third_id is not null " + " and b.id in #{item} " + " and a.goods_brand = #{param.goodsBrand} " + - + " = #{param.salePriceS} ]]>" + + " " + " group by a.id) c" + " ORDER BY c.updateTime desc" + " ORDER BY c.createtime asc" + 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 2d6b557..513e69e 100644 --- a/service/src/main/java/com/hfkj/jd/Impl/JdServiceImpl.java +++ b/service/src/main/java/com/hfkj/jd/Impl/JdServiceImpl.java @@ -540,6 +540,7 @@ public class JdServiceImpl implements JdService { // 设置原价 specs.setOriginalPrice(price.getMarketPrice()); specs.setThirdPrice(price.getJdPrice()); + specs.setExt3(price.getSalePrice().toString()); // 设置展示图片 goodsSpecsService.update(specs); } @@ -623,7 +624,12 @@ public class JdServiceImpl implements JdService { if (!deliveryInfo.getTrackInfoList().isEmpty()) { LogisticInfoOrderOpenResp logisticInfo = deliveryInfo.getLogisticInfoList().get(0); // 查询物流信息 - GoodsLogistics logistics = bsOrderGoodsService.findGoodsLogisticsByNum(logisticInfo.getDeliveryOrderId()); + GoodsLogistics logistics = new GoodsLogistics(); + if (logisticInfo.getDeliveryOrderId() != null) { + // 查询物流信息 + logistics = bsOrderGoodsService.findGoodsLogisticsByNum(logisticInfo.getDeliveryOrderId()); + } + // 获取物流信息列表 List trackInfoList = deliveryInfo.getTrackInfoList(); // 创建一个JSON对象列表 diff --git a/service/src/main/java/com/hfkj/jd/JdPostService.java b/service/src/main/java/com/hfkj/jd/JdPostService.java index 5556b6d..011147e 100644 --- a/service/src/main/java/com/hfkj/jd/JdPostService.java +++ b/service/src/main/java/com/hfkj/jd/JdPostService.java @@ -384,6 +384,13 @@ public class JdPostService { return client.execute(request); } + //查询账户余额 + public static VopOrderCheckAccountBalanceResponse checkAccountBalance(String token ) throws Exception { + JdClient client=new DefaultJdClient(SERVER_URL,token,CommonSysConst.getSysConfig().getJDAppKey(),CommonSysConst.getSysConfig().getJDAppSecret()); + VopOrderCheckAccountBalanceRequest request=new VopOrderCheckAccountBalanceRequest(); + return client.execute(request); + } + // 申请售后 public static VopAfsCreateAfsApplyResponse createAfsApply( String token , String thirdApplyId , Integer customerExpect , Long wareId , diff --git a/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java b/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java index a5dbc1e..c27822c 100644 --- a/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java +++ b/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java @@ -98,6 +98,10 @@ public interface BsOrderGoodsService { * @return java.util.List */ List getList(Map map); + + List getListByJd(); + + List getListFinish(Map map); /** diff --git a/service/src/main/java/com/hfkj/service/goods/GoodsMsgService.java b/service/src/main/java/com/hfkj/service/goods/GoodsMsgService.java index a2d53e2..70db9c5 100644 --- a/service/src/main/java/com/hfkj/service/goods/GoodsMsgService.java +++ b/service/src/main/java/com/hfkj/service/goods/GoodsMsgService.java @@ -91,6 +91,8 @@ public interface GoodsMsgService { List getJdGoodsList(Map param); + List getJdList(); + /** * 编辑商品库存 * @param goodsId diff --git a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java index 5bd1854..2bcaa7d 100644 --- a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java @@ -198,6 +198,14 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { return bsOrderGoodsMapper.selectByExample(example); } + @Override + public List getListByJd() { + BsOrderGoodsExample example = new BsOrderGoodsExample(); + BsOrderGoodsExample.Criteria criteria = example.createCriteria(); + criteria.andStatusEqualTo(2).andThirdOrderNoIsNotNull().andLogisticsNoIsNull(); + return bsOrderGoodsMapper.selectByExample(example); + } + @Override public List getListFinish(Map map) { BsOrderGoodsExample example = new BsOrderGoodsExample(); diff --git a/service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java b/service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java index e3f5f05..59020d1 100644 --- a/service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java @@ -154,6 +154,14 @@ public class GoodsMsgServiceImpl implements GoodsMsgService { return goodsMsgMapper.getJdGoodsList(param); } + @Override + public List getJdList() { + GoodsMsgExample example = new GoodsMsgExample(); + GoodsMsgExample.Criteria criteria = example.createCriteria(); + criteria.andThirdIdIsNotNull().andStatusEqualTo(1); + return goodsMsgMapper.selectByExample(example); + } + @Override public void editSaleNum(Long goodsId, Integer num , Integer type) { diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java index c702c66..67ea64a 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -23,6 +23,7 @@ import com.hfkj.service.coupon.channel.HuiLianTongCouponService; import com.hfkj.service.goods.*; import com.hfkj.service.hlt.HuiLianTongUnionCardService; import com.hfkj.sysenum.GoodsVpdSourceEnum; +import com.hfkj.sysenum.UserLoginPlatform; import com.hfkj.sysenum.order.*; import com.jd.open.api.sdk.domain.vopsp.SkuInfoGoodsProvider.response.getSellPrice.OpenRpcResult; import com.jd.open.api.sdk.response.vopdd.VopOrderSubmitOrderResponse; @@ -179,7 +180,16 @@ public class OrderCreateService { orderCoupon.setMerId(orderChild.getMerId()); orderCoupon.setPlatformCode(businessObj.getString("platformCode")); orderCoupon.setUserId(order.getUserId()); - orderCoupon.setUserPhone(order.getUserPhone()); + + if (businessObj.getString("platformCode").equals(UserLoginPlatform.VFAMILY.getCode()) || businessObj.getString("platformCode").equals(UserLoginPlatform.GZGOV.getCode())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前产品暂不支付购买!"); + } + + if (goodsVpd.getSource().equals(GoodsVpdSourceEnum.type1.getCode()) || goodsVpd.getSource().equals(GoodsVpdSourceEnum.type3.getCode())) { + orderCoupon.setUserPhone(businessObj.getString("userPhone")); + } else { + orderCoupon.setUserPhone(order.getUserPhone()); + } orderCoupon.setGoodsId(goodsMsg.getId()); orderCoupon.setGoodsName(goodsMsg.getTitle()); orderCoupon.setGoodsTypeId(goodsMsg.getGoodsType());