From a8c626e4454da6b77f2bb699a99a4702a74b6429 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Thu, 21 Jul 2022 15:11:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BB=B7=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/HighTestController.java | 2 +- .../OutRechargePriceController.java | 31 ++++++++- .../controller/pay/CzOrderController.java | 69 +++++++++++++++++++ .../com/hai/schedule/HighOrderSchedule.java | 2 +- .../impl/BsRechargeCodeServiceImpl.java | 10 +++ .../hai/service/impl/CommonServiceImpl.java | 25 ++++--- .../service/impl/HighOrderServiceImpl.java | 34 +++++---- .../impl/OutRechargeOrderServiceImpl.java | 36 +++++++++- 8 files changed, 178 insertions(+), 31 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java index 0b88b9ea..4c15b3a1 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java @@ -1 +1 @@ -package com.bweb.controller; import com.alibaba.fastjson.JSONArray; 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.common.utils.DateUtil; import com.hai.common.utils.IDGenerator; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.config.QianZhuConfig; import com.hai.config.WxOrderConfig; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private OutRechargeOrderService outRechargeOrderService; @Resource private HighOrderService highOrderService; @Resource private HighUserService highUserService; @Resource private HighOilCardService oilCardService; @Resource private ApiProductService apiProductService; @RequestMapping(value = "/kfcRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "KFC退款") public ResponseData kfcRefund(@RequestParam(name = "orderNo", required = true) String orderNo,HttpServletRequest request) { try { OrderRefundModel orderRefundModel = null; if (StringUtils.isNotBlank(orderNo)) { // 查询订单 HighOrder order = highOrderService.getOrderByOrderNo(orderNo); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款 if (order != null && order.getOrderStatus() == 2) { orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), "1609882817", order.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } order.setOrderStatus(4); order.setRefundTime(new Date()); order.setRefundPrice(order.getPayRealPrice()); highOrderService.updateOrder(order); return ResponseMsgUtil.success(orderRefundModel); } } } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/oilCardRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "油卡退款") public ResponseData oilCardRefund(@RequestParam(name = "orderNo", required = true) String orderNo,HttpServletRequest request) { try { oilCardService.refund(orderNo); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/consumption",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡重新发起充值") public ResponseData consumption( @RequestParam(name = "orderNo", required = false) String orderNo ) { try { OutRechargeOrder order = outRechargeOrderService.findByOrderNo(orderNo); String goodsDesc = "重新充值"; String tranDesc = order.getRechargeContent() + "重新充值" + order.getPayRealPrice() + "元"; String instCode = "11101527"; String businessType = "hisen_consume"; String orderNoPost = "AGAIN" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5); // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(orderNoPost, order.getLaborUnionCard(), order.getPayRealPrice(), businessType, instCode, goodsDesc, tranDesc); JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); // // String s = "HFR1"; // String s1 = "AGAIN1"; // // List list = new ArrayList<>(); // // // for (Object data : array) { // JSONObject dataObject = (JSONObject) data; // if (!StringUtils.contains(dataObject.getString("orderNo"),s) && !StringUtils.contains(dataObject.getString("orderNo"),s1)) { // list.add(dataObject); // } // return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "积分充值退款") public ResponseData orderToRefund(@RequestParam(name = "orderId", required = true) Long orderId ,HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderById(orderId); // 微信退款 OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } highOrder.setOrderStatus(4); highOrder.setRefundTime(new Date()); highOrder.setRefundPrice(highOrder.getPayRealPrice()); highOrderService.updateOrder(highOrder); } if (highUserService.findGoldRepeat(3 , highOrder.getId())) { highUserService.goldHandle(highOrder.getMemId(), highOrder.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 2, 3, highOrder.getId()); }else { log.error("orderToPay error!", "已有退款记录"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录"); } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/orderToRefundByHlt", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "汇联通充值退款") public ResponseData orderToRefundByHlt(@RequestParam(name = "orderId", required = true) Long orderId ,HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderById(orderId); // 微信退款 OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), WxOrderConfig.MCH_ID_1619676214 , highOrder.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } highOrder.setOrderStatus(4); highOrder.setRefundTime(new Date()); highOrder.setRefundPrice(highOrder.getPayRealPrice()); highOrderService.updateOrder(highOrder); } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费退款") public ResponseData rechargeOrderToRefund( @RequestParam(name = "orderId", required = true) Long orderId) { try { outRechargeOrderService.rechargeOrderToRefund(orderId); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStarbucksProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "更新星巴克商品") public ResponseData getStarbucksProducts(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getStarbucksProducts(1 , 200); JSONObject object = jsonObject.getJSONObject("data"); JSONArray array = object.getJSONArray("items"); for (Object data : array) { JSONObject dataObject = (JSONObject) data; ApiStarbucksProducts starbucksProducts = apiProductService.findStarbucksProductsByGoodsId(dataObject.getLong("id")); if (dataObject.getInteger("shelfStatus") == 5) { if (starbucksProducts == null) { starbucksProducts = new ApiStarbucksProducts(); } starbucksProducts.setCategoryName(dataObject.getString("categoryName")); starbucksProducts.setCream(dataObject.getString("cream")); starbucksProducts.setCupSize(dataObject.getString("cupSize")); starbucksProducts.setDefaultImage(dataObject.getString("defaultImage")); starbucksProducts.setDes(dataObject.getString("des")); starbucksProducts.setEspresso(dataObject.getString("espresso")); starbucksProducts.setMarketGrandePrice(dataObject.getBigDecimal("marketGrandePrice")); starbucksProducts.setMarketTallPrice(dataObject.getBigDecimal("marketTallPrice")); starbucksProducts.setMarketVentiPrice(dataObject.getBigDecimal("marketVentiPrice")); starbucksProducts.setSalesGrandePrice(dataObject.getBigDecimal("salesGrandePrice")); starbucksProducts.setSalesTallPrice(dataObject.getBigDecimal("salesTallPrice")); starbucksProducts.setSalesVentiPrice(dataObject.getBigDecimal("salesVentiPrice")); starbucksProducts.setMilk(dataObject.getString("milk")); starbucksProducts.setMilkBubble(dataObject.getString("milkBubble")); starbucksProducts.setName(dataObject.getString("name")); starbucksProducts.setTemperature(dataObject.getString("temperature")); if (starbucksProducts.getId() == null) { starbucksProducts.setCreateTime(new Date()); starbucksProducts.setOperatorId(9999L); starbucksProducts.setOperatorName("系统生成"); starbucksProducts.setStatus(100); starbucksProducts.setGoodsId(dataObject.getLong("id")); apiProductService.insertStarbucksProducts(starbucksProducts); } else { starbucksProducts.setUpdateTime(new Date()); apiProductService.updateStarbucksProducts(starbucksProducts); } } } return ResponseMsgUtil.success("商品生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getKfcStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基门店") public ResponseData getKfcStore(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getKfcStore(); JSONArray object = jsonObject.getJSONArray("data"); for (Object data : object) { JSONObject dataObject = (JSONObject) data; Map mapStore = new HashMap<>(); mapStore.put("storeCode" , dataObject.getString("storeCode")); ApiKfcStores apiKfcStores = apiProductService.findKfcStores(mapStore); if (apiKfcStores == null) { apiKfcStores = new ApiKfcStores(); } apiKfcStores.setProvinceCode(dataObject.getString("provinceCode")); apiKfcStores.setProvinceName(dataObject.getString("provinceName")); apiKfcStores.setCityCode(dataObject.getString("cityCode")); apiKfcStores.setCityName(dataObject.getString("cityName")); apiKfcStores.setCityNameFirstLetter(dataObject.getString("cityNameFirstLetter")); apiKfcStores.setKfcCityId(dataObject.getInteger("kfcCityId")); apiKfcStores.setKfcCityCode(dataObject.getString("kfcCityCode")); apiKfcStores.setStoreName(dataObject.getString("storeName")); apiKfcStores.setStoreCode(dataObject.getString("storeCode")); apiKfcStores.setLon(dataObject.getString("lon")); apiKfcStores.setLat(dataObject.getString("lat")); apiKfcStores.setAddress(dataObject.getString("address")); apiKfcStores.setStartTime(dataObject.getString("startTime")); apiKfcStores.setEndTime(dataObject.getString("endTime")); apiKfcStores.setStoreStatus(dataObject.getInteger("storeStatus")); apiKfcStores.setShelfStatus(dataObject.getInteger("shelfStatus")); if (apiKfcStores.getId() == null) { apiKfcStores.setCreateTime(new Date()); apiKfcStores.setOperatorId(9999L); apiKfcStores.setOperatorName("系统生成"); apiKfcStores.setStatus(100); apiProductService.insertKfcStore(apiKfcStores); } else { apiKfcStores.setUpdateTime(new Date()); apiProductService.updateKfcStore(apiKfcStores); } } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/insertCity", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "插入城市") public ResponseData insertCity(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getAllCities(); JSONArray object = jsonObject.getJSONArray("data"); for (Object data : object) { JSONObject dataObject = (JSONObject) data; ApiCity apiCity = new ApiCity(); apiCity.setCityInitial(dataObject.getString("cityInitial")); apiCity.setCityCode(dataObject.getString("cityCode")); apiCity.setCityName(dataObject.getString("cityName")); apiCity.setProvinceCode(dataObject.getString("provinceCode")); apiCity.setProvinceName(dataObject.getString("provinceName")); apiCity.setCreateTime(new Date()); apiCity.setUpdateTime(new Date()); apiCity.setOperatorId(9999L); apiCity.setOperatorName("系统生成"); apiCity.setStatus(100); apiProductService.insertCity(apiCity); } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file +package com.bweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alipay.api.domain.ForbbidenTime; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.utils.DateUtil; import com.hai.common.utils.IDGenerator; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.config.QianZhuConfig; import com.hai.config.WxOrderConfig; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private OutRechargeOrderService outRechargeOrderService; @Resource private HighOrderService highOrderService; @Resource private HighUserService highUserService; @Resource private HighOilCardService oilCardService; @Resource private ApiProductService apiProductService; @Resource private BsRechargeCodeService rechargeCodeService; @Resource private OutRechargePriceService rechargePriceService; @RequestMapping(value = "/kfcRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "KFC退款") public ResponseData kfcRefund(@RequestParam(name = "orderNo", required = true) String orderNo,HttpServletRequest request) { try { OrderRefundModel orderRefundModel = null; if (StringUtils.isNotBlank(orderNo)) { // 查询订单 HighOrder order = highOrderService.getOrderByOrderNo(orderNo); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款 if (order != null && order.getOrderStatus() == 2) { orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), "1609882817", order.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } order.setOrderStatus(4); order.setRefundTime(new Date()); order.setRefundPrice(order.getPayRealPrice()); highOrderService.updateOrder(order); return ResponseMsgUtil.success(orderRefundModel); } } } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/oilCardRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "油卡退款") public ResponseData oilCardRefund(@RequestParam(name = "orderNo", required = true) String orderNo,HttpServletRequest request) { try { oilCardService.refund(orderNo); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/consumption",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡重新发起充值") public ResponseData consumption( @RequestParam(name = "orderNo", required = false) String orderNo ) { try { OutRechargeOrder order = outRechargeOrderService.findByOrderNo(orderNo); String goodsDesc = "重新充值"; String tranDesc = order.getRechargeContent() + "重新充值" + order.getPayRealPrice() + "元"; String instCode = "11101527"; String businessType = "hisen_consume"; String orderNoPost = "AGAIN" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5); // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(orderNoPost, order.getLaborUnionCard(), order.getPayRealPrice(), businessType, instCode, goodsDesc, tranDesc); JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); // // String s = "HFR1"; // String s1 = "AGAIN1"; // // List list = new ArrayList<>(); // // // for (Object data : array) { // JSONObject dataObject = (JSONObject) data; // if (!StringUtils.contains(dataObject.getString("orderNo"),s) && !StringUtils.contains(dataObject.getString("orderNo"),s1)) { // list.add(dataObject); // } // return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "积分充值退款") public ResponseData orderToRefund(@RequestParam(name = "orderId", required = true) Long orderId ,HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderById(orderId); // 微信退款 OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } highOrder.setOrderStatus(4); highOrder.setRefundTime(new Date()); highOrder.setRefundPrice(highOrder.getPayRealPrice()); highOrderService.updateOrder(highOrder); } if (highUserService.findGoldRepeat(3 , highOrder.getId())) { highUserService.goldHandle(highOrder.getMemId(), highOrder.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 2, 3, highOrder.getId()); }else { log.error("orderToPay error!", "已有退款记录"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录"); } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/orderToRefundByHlt", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "汇联通充值退款") public ResponseData orderToRefundByHlt(@RequestParam(name = "orderId", required = true) Long orderId ,HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderById(orderId); // 微信退款 OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), WxOrderConfig.MCH_ID_1619676214 , highOrder.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { childOrder.setChildOrdeStatus(4); } highOrder.setOrderStatus(4); highOrder.setRefundTime(new Date()); highOrder.setRefundPrice(highOrder.getPayRealPrice()); highOrderService.updateOrder(highOrder); } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费退款") public ResponseData rechargeOrderToRefund( @RequestParam(name = "orderId", required = true) Long orderId) { try { outRechargeOrderService.rechargeOrderToRefund(orderId); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStarbucksProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "更新星巴克商品") public ResponseData getStarbucksProducts(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getStarbucksProducts(1 , 200); JSONObject object = jsonObject.getJSONObject("data"); JSONArray array = object.getJSONArray("items"); for (Object data : array) { JSONObject dataObject = (JSONObject) data; ApiStarbucksProducts starbucksProducts = apiProductService.findStarbucksProductsByGoodsId(dataObject.getLong("id")); if (dataObject.getInteger("shelfStatus") == 5) { if (starbucksProducts == null) { starbucksProducts = new ApiStarbucksProducts(); } starbucksProducts.setCategoryName(dataObject.getString("categoryName")); starbucksProducts.setCream(dataObject.getString("cream")); starbucksProducts.setCupSize(dataObject.getString("cupSize")); starbucksProducts.setDefaultImage(dataObject.getString("defaultImage")); starbucksProducts.setDes(dataObject.getString("des")); starbucksProducts.setEspresso(dataObject.getString("espresso")); starbucksProducts.setMarketGrandePrice(dataObject.getBigDecimal("marketGrandePrice")); starbucksProducts.setMarketTallPrice(dataObject.getBigDecimal("marketTallPrice")); starbucksProducts.setMarketVentiPrice(dataObject.getBigDecimal("marketVentiPrice")); starbucksProducts.setSalesGrandePrice(dataObject.getBigDecimal("salesGrandePrice")); starbucksProducts.setSalesTallPrice(dataObject.getBigDecimal("salesTallPrice")); starbucksProducts.setSalesVentiPrice(dataObject.getBigDecimal("salesVentiPrice")); starbucksProducts.setMilk(dataObject.getString("milk")); starbucksProducts.setMilkBubble(dataObject.getString("milkBubble")); starbucksProducts.setName(dataObject.getString("name")); starbucksProducts.setTemperature(dataObject.getString("temperature")); if (starbucksProducts.getId() == null) { starbucksProducts.setCreateTime(new Date()); starbucksProducts.setOperatorId(9999L); starbucksProducts.setOperatorName("系统生成"); starbucksProducts.setStatus(100); starbucksProducts.setGoodsId(dataObject.getLong("id")); apiProductService.insertStarbucksProducts(starbucksProducts); } else { starbucksProducts.setUpdateTime(new Date()); apiProductService.updateStarbucksProducts(starbucksProducts); } } } return ResponseMsgUtil.success("商品生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getKfcStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基门店") public ResponseData getKfcStore(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getKfcStore(); JSONArray object = jsonObject.getJSONArray("data"); for (Object data : object) { JSONObject dataObject = (JSONObject) data; Map mapStore = new HashMap<>(); mapStore.put("storeCode" , dataObject.getString("storeCode")); ApiKfcStores apiKfcStores = apiProductService.findKfcStores(mapStore); if (apiKfcStores == null) { apiKfcStores = new ApiKfcStores(); } apiKfcStores.setProvinceCode(dataObject.getString("provinceCode")); apiKfcStores.setProvinceName(dataObject.getString("provinceName")); apiKfcStores.setCityCode(dataObject.getString("cityCode")); apiKfcStores.setCityName(dataObject.getString("cityName")); apiKfcStores.setCityNameFirstLetter(dataObject.getString("cityNameFirstLetter")); apiKfcStores.setKfcCityId(dataObject.getInteger("kfcCityId")); apiKfcStores.setKfcCityCode(dataObject.getString("kfcCityCode")); apiKfcStores.setStoreName(dataObject.getString("storeName")); apiKfcStores.setStoreCode(dataObject.getString("storeCode")); apiKfcStores.setLon(dataObject.getString("lon")); apiKfcStores.setLat(dataObject.getString("lat")); apiKfcStores.setAddress(dataObject.getString("address")); apiKfcStores.setStartTime(dataObject.getString("startTime")); apiKfcStores.setEndTime(dataObject.getString("endTime")); apiKfcStores.setStoreStatus(dataObject.getInteger("storeStatus")); apiKfcStores.setShelfStatus(dataObject.getInteger("shelfStatus")); if (apiKfcStores.getId() == null) { apiKfcStores.setCreateTime(new Date()); apiKfcStores.setOperatorId(9999L); apiKfcStores.setOperatorName("系统生成"); apiKfcStores.setStatus(100); apiProductService.insertKfcStore(apiKfcStores); } else { apiKfcStores.setUpdateTime(new Date()); apiProductService.updateKfcStore(apiKfcStores); } } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/insertCity", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "插入城市") public ResponseData insertCity(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getAllCities(); JSONArray object = jsonObject.getJSONArray("data"); for (Object data : object) { JSONObject dataObject = (JSONObject) data; ApiCity apiCity = new ApiCity(); apiCity.setCityInitial(dataObject.getString("cityInitial")); apiCity.setCityCode(dataObject.getString("cityCode")); apiCity.setCityName(dataObject.getString("cityName")); apiCity.setProvinceCode(dataObject.getString("provinceCode")); apiCity.setProvinceName(dataObject.getString("provinceName")); apiCity.setCreateTime(new Date()); apiCity.setUpdateTime(new Date()); apiCity.setOperatorId(9999L); apiCity.setOperatorName("系统生成"); apiCity.setStatus(100); apiProductService.insertCity(apiCity); } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/updatePrice", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "更新价格") public ResponseData updatePrice() { try { List list = rechargePriceService.getListRechargePrice(new HashMap<>()); for (OutRechargePrice rechargePrice : list) { BsRechargeCode rechargeCode = new BsRechargeCode(); if (rechargePrice.getGoodsId() != null) { rechargeCode.setStatus(100); rechargeCode.setUpdateTime(new Date()); rechargeCode.setCreateTime(new Date()); rechargeCode.setGoodsId(rechargePrice.getGoodsId().toString()); rechargeCode.setOperatorName("系统自动更新"); rechargeCode.setType(1); rechargeCode.setSourceId(rechargePrice.getId().toString()); rechargeCode.setRechargePlatform(2); rechargeCodeService.insertRechargeCode(rechargeCode); } } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java b/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java index 57db0dbf..b55877ee 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java @@ -263,9 +263,34 @@ public class OutRechargePriceController { UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); OutRechargePrice outRechargePrice = outRechargePriceService.findById(object.getLong("id") , null); - if (object.getInteger("status") == 1 && outRechargePrice.getRechargePlatform().contains("-2-") && outRechargePrice.getGoodsId() == null) { - log.error("OutRechargePriceController -> editPriceStatus() error!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅平台需要输入商品编码!"); + if (object.getInteger("status") == 1) { + + Map map = new HashMap<>(); + map.put("type" , 1); + map.put("sourceId" , outRechargePrice.getId()); + List rechargeCodes = bsRechargeCodeService.getListRechargeCode(map); + + if (outRechargePrice.getRechargePlatform().contains("-2-3-") && rechargeCodes.size() == 0) { + log.error("OutRechargePriceController -> editPriceStatus() error!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇平台需要输入商品编码!"); + } + + for (BsRechargeCode rechargeCode : rechargeCodes) { + + if ((rechargeCode.getRechargePlatform() == 2 || rechargeCode.getRechargePlatform() == 3) ){ + if (rechargeCode.getGoodsId() == null) { + log.error("OutRechargePriceController -> editPriceStatus() error!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇平台需要输入商品编码!"); + } + if (rechargeCode.getGoodsId().length() == 0) { + log.error("OutRechargePriceController -> editPriceStatus() error!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇平台需要输入商品编码!"); + } + + } + } + + } outRechargePrice.setStatus(object.getInteger("status")); diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java index bb5a31c1..630ce5d9 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java @@ -280,6 +280,75 @@ public class CzOrderController { } } + @RequestMapping(value = "/rechargeCallbackByCy", method = RequestMethod.POST) + @ApiOperation(value = "城宇充值回调") + @ResponseBody + public void rechargeCallbackByCy(@RequestBody String reqBodyStr, HttpServletRequest request, HttpServletResponse response) { + try { + + JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class); + + // 推送记录 + HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); + highGasOrderPush.setType(OrderPushType.type2.getType()); + highGasOrderPush.setOrderNo(dataObject.getString("out_order_id")); + highGasOrderPush.setCreateTime(new Date()); + highGasOrderPush.setCode(dataObject.getString("status")); + highGasOrderPush.setRequestContent(JSONObject.toJSONString(dataObject)); + highGasOrderPush.setReturnContent(dataObject.toJSONString()); + highGasOrderPushMapper.insert(highGasOrderPush); +// +// +// // 1 尖椒 2 龙阅 +// dataObject.put("orderNo" , dataObject.getString("out_order_id")); +// +// OutRechargeChildOrder childOrder = outRechargeChildOrderService.findByOrderNo(dataObject.getString("out_order_id")); +// +// OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderId(childOrder.getParentOrderId()); +// +// BsRequestRecord bsRequestRecord = bsRequestRecordService.findRequestRecordByOrderNo(childOrder.getOrderNo()); +// +// bsRequestRecord.setReturnContent(String.valueOf(dataObject)); +// bsRequestRecord.setUpdateTime(new Date()); +// bsRequestRecordService.updateRequestRecord(bsRequestRecord); +// +// // 判断是否充值成功 +// if (dataObject.getInteger("status") == 3) { +// new Thread(() -> { +// HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId()); +// WxMsgConfig.rechargedSuccess( +// rechargeOrder.getRechargeContent() + "充值成功", +// String.valueOf(rechargeOrder.getPayRealPrice()), +// rechargeOrder.getOrderNo(), +// rechargeOrder.getFinishTime(), +// RechargePayType.getNameByType(rechargeOrder.getPayType()), +// highUser.getOpenId()); +// }).start(); +// childOrder.setStatus(101); +// rechargeOrder.setRechargeStatus(202); +// rechargeOrder.setPayStatus(100); +// +// outRechargeOrderService.updateOrder(rechargeOrder); +// outRechargeChildOrderService.updateOrder(childOrder); +// if (rechargeOrder.getPayType() == 6) { +// apiOrderRecord(rechargeOrder); +// } +// +// } else { +// callbackResult(childOrder , rechargeOrder); +// } + + response.setCharacterEncoding("UTF-8"); + response.setContentType("text/html;charset=utf-8"); + PrintWriter writer= response.getWriter(); + writer.write("SUCCESS"); + + + } catch (Exception e) { + log.error("WechatPayController --> wechatNotify() error!", e); + } + } + // 回调结果处理 private void callbackResult(OutRechargeChildOrder childOrder , OutRechargeOrder rechargeOrder) throws Exception { diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java index 41815d27..fe31c9e2 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -93,7 +93,7 @@ public class HighOrderSchedule { * @Date 14:18 2022/5/31 * @Param [] */ - @Scheduled(cron = "0 0/5 * * * ?") //每5分钟执行一次 + @Scheduled(cron = "0 0/1 * * * ?") //每5分钟执行一次 public void initRechargeOrder() { Map map = new HashMap<>(); map.put("payStatus", String.valueOf(102)); diff --git a/hai-service/src/main/java/com/hai/service/impl/BsRechargeCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsRechargeCodeServiceImpl.java index 3ab28063..3b842faf 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsRechargeCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsRechargeCodeServiceImpl.java @@ -34,6 +34,16 @@ public class BsRechargeCodeServiceImpl implements BsRechargeCodeService { BsRechargeCodeExample example = new BsRechargeCodeExample(); BsRechargeCodeExample.Criteria criteria = example.createCriteria(); + if (MapUtils.getInteger(map, "type") != null) { + criteria.andTypeEqualTo(MapUtils.getInteger(map, "type")); + } + if (MapUtils.getString(map, "sourceId") != null) { + criteria.andSourceIdEqualTo(MapUtils.getString(map, "sourceId")); + } + if (MapUtils.getInteger(map, "rechargePlatform") != null) { + criteria.andRechargePlatformEqualTo(MapUtils.getInteger(map, "rechargePlatform")); + } + return rechargeCodeMapper.selectByExample(example); } diff --git a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java index 593df241..80ea1313 100644 --- a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java @@ -554,18 +554,21 @@ public class CommonServiceImpl implements CommonService { // 配置支付方式 JSONArray payTypeArray = object.getJSONArray("payType"); for (Object payType : payTypeArray) { + SecDictionary dictionary = mappingSysCode("PAY_TYPE", String.valueOf(payType)); - productPayType = new BsProductPayType(); - productPayType.setCreateTime(new Date()); - productPayType.setUpdateTime(new Date()); - productPayType.setPayTypeId(Integer.valueOf(String.valueOf(payType))); - productPayType.setPayTypeLogo(dictionary.getExt1()); - productPayType.setPayTypeName(dictionary.getCodeName()); - productPayType.setProductType(object.getInteger("productType")); - productPayType.setOperatorId(object.getLong("operatorId")); - productPayType.setOperatorName(object.getString("operatorName")); - productPayType.setSourceId(object.getLong("sourceId")); - bsProductPayTypeMapper.insert(productPayType); + if (dictionary != null) { + productPayType = new BsProductPayType(); + productPayType.setCreateTime(new Date()); + productPayType.setUpdateTime(new Date()); + productPayType.setPayTypeId(Integer.valueOf(String.valueOf(payType))); + productPayType.setPayTypeLogo(dictionary.getExt1()); + productPayType.setPayTypeName(dictionary.getCodeName()); + productPayType.setProductType(object.getInteger("productType")); + productPayType.setOperatorId(object.getLong("operatorId")); + productPayType.setOperatorName(object.getString("operatorName")); + productPayType.setSourceId(object.getLong("sourceId")); + bsProductPayTypeMapper.insert(productPayType); + } } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 137144e7..b666242c 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -1921,12 +1921,15 @@ public class HighOrderServiceImpl implements HighOrderService { childOrder.setGoodsImg(childObject.getString("imgUrl")); childOrder.setSaleCount(childObject.getInteger("quantity")); childOrder.setGoodsPrice(childObject.getBigDecimal("marketPrice")); - childOrder.setGoodsActualPrice(childObject.getBigDecimal("unitPrice")); - + if (object.getLong("memDiscountId") != null) { + childOrder.setGoodsActualPrice(childObject.getBigDecimal("marketPrice")); + } else { + childOrder.setGoodsActualPrice(childObject.getBigDecimal("unitPrice")); + } // 计算利润 - BigDecimal profitPrice = childObject.getBigDecimal("unitPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); + BigDecimal profitPrice = childOrder.getGoodsActualPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); // 计算子订单支付金额 - BigDecimal childPrice = childObject.getBigDecimal("unitPrice").add(profitPrice).setScale(2 , RoundingMode.HALF_UP); + BigDecimal childPrice = childOrder.getGoodsActualPrice().add(profitPrice).setScale(2 , RoundingMode.HALF_UP); if (childPrice.compareTo(childObject.getBigDecimal("marketPrice")) > 0) { childPrice = childObject.getBigDecimal("marketPrice"); } @@ -1986,13 +1989,17 @@ public class HighOrderServiceImpl implements HighOrderService { childOrder.setGoodsImg(childObject.getString("imageUrl")); childOrder.setSaleCount(childObject.getInteger("quantity")); childOrder.setGoodsPrice(childObject.getBigDecimal("originPrice")); - childOrder.setGoodsActualPrice(childObject.getBigDecimal("price")); + if (object.getLong("memDiscountId") != null) { + childOrder.setGoodsActualPrice(childObject.getBigDecimal("originPrice")); + } else { + childOrder.setGoodsActualPrice(childObject.getBigDecimal("price")); + } // 计算利润 - BigDecimal profitPrice = childObject.getBigDecimal("price").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); + BigDecimal profitPrice = childOrder.getGoodsActualPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); // 计算子订单支付金额 - BigDecimal childPrice = childObject.getBigDecimal("price").add(profitPrice).setScale(2 , RoundingMode.HALF_UP); + BigDecimal childPrice = childOrder.getGoodsActualPrice().add(profitPrice).setScale(2 , RoundingMode.HALF_UP); if (childPrice.compareTo(childObject.getBigDecimal("originPrice")) > 0) { childPrice = childObject.getBigDecimal("originPrice"); } @@ -2041,9 +2048,13 @@ public class HighOrderServiceImpl implements HighOrderService { childOrder.setGoodsName(memberProduct.getName()); childOrder.setSaleCount(1); childOrder.setGoodsPrice(marketPrice); - - childOrder.setGoodsActualPrice(orderPayPrice); - childOrder.setTotalPrice(orderPayPrice); + if (object.getLong("memDiscountId") != null) { + childOrder.setGoodsActualPrice(marketPrice); + childOrder.setTotalPrice(marketPrice); + } else { + childOrder.setGoodsActualPrice(orderPayPrice); + childOrder.setTotalPrice(orderPayPrice); + } highChildOrderMapper.insert(childOrder); @@ -2053,6 +2064,7 @@ public class HighOrderServiceImpl implements HighOrderService { HighDiscountUserRel highDiscountUserRel = null; // 判断是否有优惠券 if (object.getLong("memDiscountId") != null) { + orderPayPrice = marketPrice; // 优惠券信息 highDiscountUserRel = highDiscountUserRelService.getRelById(object.getLong("memDiscountId")); highOrder.setMemDiscountId(object.getLong("memDiscountId")); @@ -2067,7 +2079,6 @@ public class HighOrderServiceImpl implements HighOrderService { } } - // 使用优惠券 // 优惠券抵扣 if (highDiscountUserRel != null) { highOrder.setMemDiscountName(highDiscountUserRel.getHighDiscount().getDiscountName()); @@ -2097,7 +2108,6 @@ public class HighOrderServiceImpl implements HighOrderService { // 使用优惠券 if (highOrder.getMemDiscountId() != null) { - orderPayPrice = marketPrice; HighDiscountUserRel discountUserRel = highDiscountUserRelService.getRelById(highOrder.getMemDiscountId()); discountUserRel.setUseTime(new Date()); // 使用时间 discountUserRel.setStatus(2); //状态 0:已过期 1:未使用 2:已使用 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 22deb081..81356fde 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 @@ -104,6 +104,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { @Resource private ApiOrderRecordService apiOrderRecordService; + @Resource + private BsRechargeCodeService rechargeCodeService; @Override public List getListRechargeOrder(Map map) { @@ -181,7 +183,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { HighUser user = highUserService.findByUserId(object.getLong("userId")); - // 产品id Long goodsId = object.getLong("goodsId"); @@ -830,7 +831,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } } - if (type == 2) { + if (type == 3) { type = 1; } else { type++; @@ -848,6 +849,10 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { type = Integer.parseInt(string); } + // 定义查询充值产品编码 + Map map = new HashMap<>(); + map.put("type" , 1); + for (String s : rechargePlatform) { // 尖椒充值 System.out.println("话费定时任务 -> 需要重新充值:尖椒开始"); @@ -871,9 +876,13 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } // 龙阅充值 if (s.equals("2") && type == 2) { + + map.put("sourceId" , outRechargePrice.getId()); + map.put("rechargePlatform" , type); + BsRechargeCode rechargeCode = rechargeCodeService.findByMap(map); System.out.println("话费定时任务 -> 需要重新充值:龙阅开始"); object.put("out_trade_num", orderNo); - object.put("product_id", outRechargePrice.getGoodsId()); + object.put("product_id", rechargeCode.getGoodsId()); object.put("mobile", outRechargeOrder.getRechargeContent()); object.put("notifyUrl", CommonSysConst.getSysConfig().getLyNotifyUrl()); JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object); @@ -886,6 +895,27 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { rechargePlatformType = 2; break; } + // 城宇充值 + if (s.equals("3") && type == 3) { + + map.put("sourceId" , outRechargePrice.getId()); + map.put("rechargePlatform" , type); + BsRechargeCode rechargeCode = rechargeCodeService.findByMap(map); + + System.out.println("话费定时任务 -> 需要重新充值:龙阅开始"); + object.put("agentOrderId", orderNo); + object.put("productId", rechargeCode.getGoodsId()); + object.put("mobile", outRechargeOrder.getRechargeContent()); + JSONObject returnObject = RechargeConfig.rechargeOrderByCy(object); + object.put("return_content", returnObject); + if (returnObject != null && returnObject.getBoolean("success")) { + childOrder.setStatus(102); + } else { + childOrder.setStatus(103); + } + rechargePlatformType = 3; + break; + } } childOrder.setOrderNo(orderNo);