From 717cbdcb0cc7c9120d443547f61412a5c9f20dbf Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 17 May 2023 15:47:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=AE=9E=E7=89=A9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/GoodsOrderController.java | 57 +++++ .../consumer/OrderMobileRechargeConsumer.java | 99 -------- .../schedule/HighRechargeOrderSchedule.java | 2 +- .../java/com/hai/config/RechargeConfig.java | 2 +- .../mobile/service/MobileHandleService.java | 14 ++ .../service/impl/MobileHandleServiceImpl.java | 6 + .../order/model/GoodsChildOrderExtModel.java | 19 ++ .../com/hai/order/service/OrderService.java | 10 + .../impl/OrderCreateHandleServiceImpl.java | 2 + .../order/service/impl/OrderServiceImpl.java | 35 +++ .../impl/OutRechargeOrderServiceImpl.java | 224 ++++++++++++++---- 11 files changed, 325 insertions(+), 145 deletions(-) delete mode 100644 hai-order/src/main/java/com/web/rocketmq/consumer/OrderMobileRechargeConsumer.java create mode 100644 hai-service/src/main/java/com/hai/mobile/service/MobileHandleService.java create mode 100644 hai-service/src/main/java/com/hai/mobile/service/impl/MobileHandleServiceImpl.java create mode 100644 hai-service/src/main/java/com/hai/order/model/GoodsChildOrderExtModel.java diff --git a/hai-order/src/main/java/com/web/controller/business/GoodsOrderController.java b/hai-order/src/main/java/com/web/controller/business/GoodsOrderController.java index e83fe3ed..fceb0525 100644 --- a/hai-order/src/main/java/com/web/controller/business/GoodsOrderController.java +++ b/hai-order/src/main/java/com/web/controller/business/GoodsOrderController.java @@ -21,6 +21,7 @@ import com.hai.goods.service.GoodsSkuService; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; import com.hai.order.model.ExportOrderMobileModel; +import com.hai.order.model.GoodsChildOrderExtModel; import com.hai.order.model.GoodsOrderExtModel; import com.hai.order.service.OrderService; import com.hai.order.type.OrderPayType; @@ -195,4 +196,60 @@ public class GoodsOrderController { return ResponseMsgUtil.exception(e); } } + + + @RequestMapping(value = "/getOrderChildList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询子订单列表") + public ResponseData getOrderChildList(@RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "childOrderNo", required = false) String childOrderNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { + try { + + UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + Map map = new HashMap<>(); + + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); + map.put("orderNo", orderNo); + map.put("secUserId", userInfoModel.getSecUser().getId()); + map.put("childOrderNo", childOrderNo); + map.put("memPhone", memPhone); + map.put("status", status); + + + List list = orderService.getChildOrderList(map); + + List goodsChildOrderExtModels = new ArrayList<>(); + + GoodsChildOrderExtModel model; + + for (HighChildOrder order : list) { + model = new GoodsChildOrderExtModel(); + BeanUtils.copyProperties(order, model); + GoodsOrder goodsOrder = goodsOrderExtService.findGoodsOrder(order.getChildOrderNo()); + if (goodsOrder != null) { + model.setLogisticsStatus(goodsOrder.getStatus()); + } + goodsChildOrderExtModels.add(model); + } + goodsChildOrderExtModels = goodsChildOrderExtModels.stream().sorted(Comparator.comparing(GoodsChildOrderExtModel::getLogisticsStatus)).collect(Collectors.toList()); + + return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, goodsChildOrderExtModels.size(), pageSize, new PageInfo<>(goodsChildOrderExtModels))); + + } catch (Exception e) { + log.error("OrderCouponController --> getOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-order/src/main/java/com/web/rocketmq/consumer/OrderMobileRechargeConsumer.java b/hai-order/src/main/java/com/web/rocketmq/consumer/OrderMobileRechargeConsumer.java deleted file mode 100644 index 4a9a8f27..00000000 --- a/hai-order/src/main/java/com/web/rocketmq/consumer/OrderMobileRechargeConsumer.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.web.rocketmq.consumer; - -import com.alibaba.fastjson.JSONObject; -import com.hai.common.exception.ErrorCode; -import com.hai.common.exception.ErrorHelp; -import com.hai.common.exception.SysCode; -import com.hai.config.CommonSysConst; -import com.hai.config.RechargeConfig; -import com.hai.entity.OutRechargeChildOrder; -import com.hai.entity.OutRechargeOrder; -import com.hai.service.OutRechargeChildOrderService; -import com.hai.service.OutRechargeOrderService; -import lombok.extern.slf4j.Slf4j; -import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; -import org.apache.rocketmq.spring.core.RocketMQListener; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.util.Date; - -@Component -@Slf4j -@RocketMQMessageListener(consumerGroup = "order-mobile-recharge-group", topic = "order-topic",selectorExpression = "mobile-recharge") -public class OrderMobileRechargeConsumer implements RocketMQListener { - - @Resource - private OutRechargeOrderService outRechargeOrderService; - - @Resource - private OutRechargeChildOrderService outRechargeChildOrderService; - - @Override - public void onMessage(OutRechargeChildOrder childOrder) { - - JSONObject object = new JSONObject(); - - OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(childOrder.getParentOrderId()); - - object.put("rechargePrice" , outRechargeOrder.getRechargePrice()); - object.put("rechargeMobile" , outRechargeOrder.getRechargeContent()); - object.put("productId" , outRechargeOrder.getGoodsId()); - object.put("parentOrderId" , outRechargeOrder.getId()); - - // -1 取消,0充值中 ,1充值成功,2充值失败,3部分成功 - Integer status = outRechargeOrderService.getRechargeOrderLegality(childOrder); - - if (status == 2 || status == -1) { - // 补充下单参数 - object = outRechargeOrderService.prepaidRechargeOrderHandle(object); - - // 尖椒充值 - if (object.getInteger("rechargePlatform") == 1) { - object.put("out_order_id", childOrder.getOrderNo()); - object.put("amount", object.getBigDecimal("rechargePrice")); - object.put("mobile", object.getString("rechargeMobile")); - object.put("notifyUrl", CommonSysConst.getSysConfig().getJjNotifyUrl()); - JSONObject returnObject = RechargeConfig.rechargeOrderByJj(object); - childOrder.setExt1(returnObject.toJSONString()); - } - - // 龙阅 - if (object.getInteger("rechargePlatform") == 2) { - - if (object.getString("code") == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - - object.put("out_trade_num", childOrder.getOrderNo()); - object.put("product_id", object.getString("code")); - object.put("mobile", object.getString("rechargeMobile")); - object.put("notifyUrl", CommonSysConst.getSysConfig().getLyNotifyUrl()); - JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object); - childOrder.setExt1(returnObject.toJSONString()); - } - - // 畅停充值 - if (object.getInteger("rechargePlatform") == 4) { - - if (object.getString("code") == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - - object.put("orderid", childOrder.getOrderNo()); - object.put("product_id", object.getString("code")); - object.put("phone", object.getString("rechargeMobile")); - object.put("price", object.getBigDecimal("rechargePrice")); - JSONObject returnObject = RechargeConfig.rechargeOrderByHg(object); - childOrder.setExt1(returnObject.toJSONString()); - } - - - System.out.println("消费内容:" + childOrder); - - childOrder.setUpdateTime(new Date()); - outRechargeChildOrderService.updateOrder(childOrder); - } - - } -} diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java index 2e309e0c..82a8f998 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java @@ -50,7 +50,7 @@ public class HighRechargeOrderSchedule { * @Date 14:18 2022/5/31 * @Param [] */ - @Scheduled(cron = "0 0/60 * * * ?") //每120分钟执行一次 + @Scheduled(cron = "0 0/60 * * * ?") //每60分钟执行一次 public void initRechargeOrder() { log.info("处理话费订单定时任务开始"); Map map = new HashMap<>(); diff --git a/hai-service/src/main/java/com/hai/config/RechargeConfig.java b/hai-service/src/main/java/com/hai/config/RechargeConfig.java index 716b50c4..b63b44d3 100644 --- a/hai-service/src/main/java/com/hai/config/RechargeConfig.java +++ b/hai-service/src/main/java/com/hai/config/RechargeConfig.java @@ -100,7 +100,7 @@ public class RechargeConfig { paramMap.put("out_trade_nums" , object.getString("out_trade_nums")); paramMap.put("sign", WxUtils.generateSignatureLy(paramMap , CommonSysConst.getSysConfig().getLyApiKey() , WXPayConstants.SignType.MD5)); - log.info("发起龙阅订单查询="); + log.info("发起龙阅订单查询"); log.info("龙阅订单查询-请求参数: " + JSON.toJSONString(paramMap)); JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/check", paramMap); diff --git a/hai-service/src/main/java/com/hai/mobile/service/MobileHandleService.java b/hai-service/src/main/java/com/hai/mobile/service/MobileHandleService.java new file mode 100644 index 00000000..f17d57ed --- /dev/null +++ b/hai-service/src/main/java/com/hai/mobile/service/MobileHandleService.java @@ -0,0 +1,14 @@ +package com.hai.mobile.service; + +/** + * @serviceName MobileHandleService.java + * @author Sum1Dream + * @version 1.0.0 + * @Description // 话费业务处理 + * @createTime 11:09 2023/5/17 + **/ +public interface MobileHandleService { + + + +} diff --git a/hai-service/src/main/java/com/hai/mobile/service/impl/MobileHandleServiceImpl.java b/hai-service/src/main/java/com/hai/mobile/service/impl/MobileHandleServiceImpl.java new file mode 100644 index 00000000..1c4d734f --- /dev/null +++ b/hai-service/src/main/java/com/hai/mobile/service/impl/MobileHandleServiceImpl.java @@ -0,0 +1,6 @@ +package com.hai.mobile.service.impl; + +import com.hai.mobile.service.MobileHandleService; + +public class MobileHandleServiceImpl implements MobileHandleService { +} diff --git a/hai-service/src/main/java/com/hai/order/model/GoodsChildOrderExtModel.java b/hai-service/src/main/java/com/hai/order/model/GoodsChildOrderExtModel.java new file mode 100644 index 00000000..d81ac31c --- /dev/null +++ b/hai-service/src/main/java/com/hai/order/model/GoodsChildOrderExtModel.java @@ -0,0 +1,19 @@ +package com.hai.order.model; + +import com.hai.entity.HighChildOrder; + +public class GoodsChildOrderExtModel extends HighChildOrder { + + /** + * 1:待发货 2:已发货 3:配送中 4:已送达 5:已取消 6:退货中 7:已退货 8:待支付 0:删除'; + */ + private String logisticsStatus; + + public String getLogisticsStatus() { + return logisticsStatus; + } + + public void setLogisticsStatus(String logisticsStatus) { + this.logisticsStatus = logisticsStatus; + } +} diff --git a/hai-service/src/main/java/com/hai/order/service/OrderService.java b/hai-service/src/main/java/com/hai/order/service/OrderService.java index ed9ef88d..2c0b1333 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderService.java @@ -103,4 +103,14 @@ public interface OrderService { */ List phoneErrorOrder(); + + /** + * @Author Sum1Dream + * @Name getChildOrderList + * @Description // 查询子订单数量 + * @Date 15:54 2023/5/16 + * @Param [param] + * @Return java.util.List + */ + List getChildOrderList(Map param); } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index 7847cd56..736fd74f 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -883,6 +883,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setPraiseStatus(0); childOrder.setCreateTime(new Date()); + // 生成充值订单 outRechargeOrder.setUserId(order.getMemId()); outRechargeOrder.setRechargeContent(rechargeContent); outRechargeOrder.setCompanyId(outRechargePrice.getCompanyId()); @@ -929,6 +930,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setGoodsType(OrderChildGoodsType.TYPE11.getNumber()); childOrder.setGoodsId(createOrderChild.getGoodsId()); childOrder.setGoodsName(goods.getName()); + childOrder.setSecUserId(goods.getOpId()); childOrder.setSkuId(createOrderChild.getSkuId()); childOrder.setGoodsSpecName(goodsSku.getName()); childOrder.setGoodsPrice(goodsSku.getOriginalPrice()); diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 6be554d5..0b2f6bd3 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -861,4 +861,39 @@ public class OrderServiceImpl implements OrderService { public List phoneErrorOrder() { return orderMapper.phoneErrorOrder(); } + + @Override + public List getChildOrderList(Map param) { + + HighChildOrderExample example = new HighChildOrderExample(); + HighChildOrderExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getString(param, "orderNo") != null) { + criteria.andOrderNoEqualTo(MapUtils.getString(param, "orderNo")); + } + + if (MapUtils.getString(param, "childOrderNo") != null) { + criteria.andChildOrderNoEqualTo(MapUtils.getString(param, "childOrderNo")); + } + + if (MapUtils.getString(param, "memPhone") != null) { + criteria.andMemPhoneEqualTo(MapUtils.getString(param, "memPhone")); + } + if (MapUtils.getInteger(param, "status") != null) { + criteria.andChildOrderStatusEqualTo(MapUtils.getInteger(param, "status")); + } + if (MapUtils.getLong(param, "createTimeS") != null) { + criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeS"))); + } + if (MapUtils.getLong(param, "createTimeE") != null) { + criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(param, "createTimeE"))); + } + if (MapUtils.getLong(param, "secUserId") != null) { + criteria.andSecUserIdEqualTo(MapUtils.getLong(param, "secUserId")); + } + example.setOrderByClause("create_time desc"); + + + return childOrderMapper.selectByExample(example); + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index bc31ef77..08f69a69 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -399,42 +399,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } - @Override - public void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) { - JSONObject object = new JSONObject(); - object.put("rechargePrice" , outRechargeOrder.getRechargePrice()); - object.put("rechargeMobile" , outRechargeOrder.getRechargeContent()); - object.put("productId" , outRechargeOrder.getGoodsId()); - object.put("parentOrderId" , outRechargeOrder.getId()); - - // 判断参数是否为空 - if ( - object.getBigDecimal("rechargePrice") == null || - object.getString("rechargeMobile") == null || - object.getInteger("productId") == null || - object.getLong("parentOrderId") == null - ) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - - // 定义子订单对象 - OutRechargeChildOrder childOrder = new OutRechargeChildOrder(); - - // 补充下单参数 - object = prepaidRechargeOrderHandle(object); - - // 补充子订单参数 - childOrder.setParentOrderId(object.getLong("parentOrderId")); - childOrder.setRechargePlatform(object.getInteger("rechargePlatform")); - childOrder.setStatus(102); - childOrder.setOrderNo("CZ" + OrderUtil.generateOrderNo()); - childOrder.setUpdateTime(new Date()); - childOrder.setCreateTime(new Date()); - - outRechargeChildOrderService.insertOrder(childOrder); - rocketMQTemplate.syncSend(OrderTopic.MOBILE_TOPIC_PROFIT_RECHARGE.getTopic(), childOrder); - } @Override public void prepaidRechargeHandle(OutRechargeOrder outRechargeOrder){ @@ -483,6 +448,178 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } +// @Override +// public void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) { +// +// JSONObject object = new JSONObject(); +// object.put("rechargePrice" , outRechargeOrder.getRechargePrice()); +// object.put("rechargeMobile" , outRechargeOrder.getRechargeContent()); +// object.put("productId" , outRechargeOrder.getGoodsId()); +// object.put("parentOrderId" , outRechargeOrder.getId()); +// +// // 判断参数是否为空 +// if ( +// object.getBigDecimal("rechargePrice") == null || +// object.getString("rechargeMobile") == null || +// object.getInteger("productId") == null || +// object.getLong("parentOrderId") == null +// ) { +// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); +// } +// +// // 定义子订单对象 +// OutRechargeChildOrder childOrder = new OutRechargeChildOrder(); +// +// // 补充下单参数 +// object = prepaidRechargeOrderHandle(object); +// +// // 补充子订单参数 +// childOrder.setParentOrderId(object.getLong("parentOrderId")); +// childOrder.setRechargePlatform(object.getInteger("rechargePlatform")); +// childOrder.setStatus(102); +// childOrder.setOrderNo("CZ" + OrderUtil.generateOrderNo()); +// childOrder.setUpdateTime(new Date()); +// childOrder.setCreateTime(new Date()); +// +// outRechargeChildOrderService.insertOrder(childOrder); +// +// // -1 取消,0充值中 ,1充值成功,2充值失败,3部分成功 +// Integer status = outRechargeOrderService.getRechargeOrderLegality(childOrder); +// +// if (status == 2 || status == -1) { +// // 补充下单参数 +// object = outRechargeOrderService.prepaidRechargeOrderHandle(object); +// +// // 尖椒充值 +// if (object.getInteger("rechargePlatform") == 1) { +// object.put("out_order_id", childOrder.getOrderNo()); +// object.put("amount", object.getBigDecimal("rechargePrice")); +// object.put("mobile", object.getString("rechargeMobile")); +// object.put("notifyUrl", CommonSysConst.getSysConfig().getJjNotifyUrl()); +// JSONObject returnObject = RechargeConfig.rechargeOrderByJj(object); +// childOrder.setExt1(returnObject.toJSONString()); +// } +// +// // 龙阅 +// if (object.getInteger("rechargePlatform") == 2) { +// +// if (object.getString("code") == null) { +// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); +// } +// +// object.put("out_trade_num", childOrder.getOrderNo()); +// object.put("product_id", object.getString("code")); +// object.put("mobile", object.getString("rechargeMobile")); +// object.put("notifyUrl", CommonSysConst.getSysConfig().getLyNotifyUrl()); +// JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object); +// childOrder.setExt1(returnObject.toJSONString()); +// } +// +// // 畅停充值 +// if (object.getInteger("rechargePlatform") == 4) { +// +// if (object.getString("code") == null) { +// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); +// } +// +// object.put("orderid", childOrder.getOrderNo()); +// object.put("product_id", object.getString("code")); +// object.put("phone", object.getString("rechargeMobile")); +// object.put("price", object.getBigDecimal("rechargePrice")); +// JSONObject returnObject = RechargeConfig.rechargeOrderByHg(object); +// childOrder.setExt1(returnObject.toJSONString()); +// } +// +// +// System.out.println("消费内容:" + childOrder); +// +// childOrder.setUpdateTime(new Date()); +// outRechargeChildOrderService.updateOrder(childOrder); +// } +// } + + @Override + public void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) { + + JSONObject object = new JSONObject(); + object.put("rechargePrice" , outRechargeOrder.getRechargePrice()); + object.put("rechargeMobile" , outRechargeOrder.getRechargeContent()); + object.put("productId" , outRechargeOrder.getGoodsId()); + object.put("parentOrderId" , outRechargeOrder.getId()); + + // 判断参数是否为空 + if ( + object.getBigDecimal("rechargePrice") == null || + object.getString("rechargeMobile") == null || + object.getInteger("productId") == null || + object.getLong("parentOrderId") == null + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 定义子订单对象 + OutRechargeChildOrder childOrder = new OutRechargeChildOrder(); + + // 补充下单参数 + object = prepaidRechargeOrderHandle(object); + + // 补充子订单参数 + childOrder.setParentOrderId(object.getLong("parentOrderId")); + childOrder.setRechargePlatform(object.getInteger("rechargePlatform")); + childOrder.setStatus(102); + childOrder.setOrderNo("CZ" + OrderUtil.generateOrderNo()); + childOrder.setUpdateTime(new Date()); + childOrder.setCreateTime(new Date()); + outRechargeChildOrderService.insertOrder(childOrder); + // 尖椒充值 + if (object.getInteger("rechargePlatform") == 1) { + object.put("out_order_id", childOrder.getOrderNo()); + object.put("amount", object.getBigDecimal("rechargePrice")); + object.put("mobile", object.getString("rechargeMobile")); + object.put("notifyUrl", CommonSysConst.getSysConfig().getJjNotifyUrl()); + JSONObject returnObject = RechargeConfig.rechargeOrderByJj(object); + childOrder.setRechargePlatform(1); + childOrder.setExt1("尖椒" + returnObject.toJSONString()); + childOrder.setExt2(object.toJSONString()); + } + + // 龙阅 + if (object.getInteger("rechargePlatform") == 2) { + + if (object.getString("code") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + object.put("out_trade_num", childOrder.getOrderNo()); + object.put("product_id", object.getString("code")); + object.put("mobile", object.getString("rechargeMobile")); + object.put("notifyUrl", CommonSysConst.getSysConfig().getLyNotifyUrl()); + JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object); + childOrder.setRechargePlatform(2); + childOrder.setExt1("龙阅充值" + returnObject.toJSONString()); + childOrder.setExt2(object.toJSONString()); + } + + // 畅停充值 + if (object.getInteger("rechargePlatform") == 4) { + + if (object.getString("code") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + object.put("orderid", childOrder.getOrderNo()); + object.put("product_id", object.getString("code")); + object.put("phone", object.getString("rechargeMobile")); + object.put("price", object.getBigDecimal("rechargePrice")); + JSONObject returnObject = RechargeConfig.rechargeOrderByHg(object); + childOrder.setRechargePlatform(4); + childOrder.setExt1("畅停" + returnObject.toJSONString()); + childOrder.setExt2(object.toJSONString()); + } + childOrder.setUpdateTime(new Date()); + outRechargeChildOrderService.updateOrder(childOrder); + } + @Override public void completeOrder(Long orderId) { @@ -567,11 +704,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { objectData = (JSONObject) objects; } if (objectData.size() == 0) { - if (jsonObject.getInteger("errno") == 0) { - return 2; - } else { - return 99; - } + return 99; } else { // -1取消,0充值中 ,1充值成功,2充值失败,3部分成功 return objectData.getInteger("state"); @@ -584,9 +717,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { JSONObject jsonObject = RechargeConfig.checkOrderByHg(object); if (jsonObject.getJSONArray("data") == null) { - if (jsonObject.getInteger("code") == 20001) { - return 2; - } return 99; } else { JSONArray objectJSONArray = jsonObject.getJSONArray("data"); @@ -740,6 +870,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { return hours > 71 ? 2 : 1; } } + if (status == 99) { + return 4; + } // 充值订单为充值成功 if (status == 1) { // 修改充值订单状态 @@ -758,7 +891,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { // 修改充值订单状态 rechargeChildOrderHandle(childOrderList.get(0) , 103); // 如果订单记录超过5条退款 反之继续充值 - if (childOrderList.size() > 4) { + if (childOrderList.size() > 2) { return 2; } else { // 如果订单记录超过71小时 反之继续充值 @@ -766,6 +899,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } } + if (status == 99) { + return 4; + } if (status == 1) { // 修改充值订单状态 rechargeChildOrderHandle(childOrderList.get(0) , 101);