ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java
@@ -87,6 +87,10 @@ return R.fail("会员订单回调失败:" + cause.getMessage()); } @Override public void vipWxRefund(String out_refund_no, String refund_id, String tradeState, String success_time) { log.error("会员订单微信退款回调失败:" + cause.getMessage()); } @Override public R<TActivityVO> activityStatistics(TActivityStatisticsQuery dto) { ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java
@@ -71,6 +71,20 @@ /** * 会员订单微信退款回调 * @param out_refund_no * @param refund_id * @param tradeState * @param success_time */ @PostMapping("/t-vip-order/vipWxRefund") void vipWxRefund(@RequestParam("out_refund_no") String out_refund_no, @RequestParam("refund_id") String refund_id, @RequestParam("tradeState") String tradeState, @RequestParam("success_time") String success_time); /** * 管理后台 活动费用统计 * @param * @return ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java
@@ -10,6 +10,8 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.integration.api.model.*; import com.ruoyi.integration.drainage.TCECUtil; import com.ruoyi.integration.drainage.model.NotificationChargeOrderInfoResult; import com.ruoyi.integration.iotda.constant.SendTagConstant; import com.ruoyi.integration.iotda.enums.ServiceIdMenu; import com.ruoyi.integration.iotda.model.*; @@ -29,6 +31,8 @@ import java.io.IOException; import java.math.BigDecimal; import java.util.*; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** @@ -54,7 +58,9 @@ @Resource private ChargingMessageUtil chargingMessageUtil; private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(100, 500, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); @@ -116,23 +122,43 @@ break; case SendTagConstant.PING: long PING = System.currentTimeMillis(); PingMessage pingMessage = JSON.parseObject(content.toJSONString(),PingMessage.class); //存储缓存中,5分钟有效 // redisTemplate.opsForValue().set("ping:" + pingMessage.getCharging_pile_code() + pingMessage.getCharging_gun_code(), pingMessage, 5, TimeUnit.MINUTES); String fullName = pingMessage.getCharging_pile_code() + pingMessage.getCharging_gun_code(); //主动丢弃一次心跳数据,用于降低调华为接口评率,防止被限流 boolean heartRate = redisTemplate.hasKey("HeartRate:" + fullName); if(heartRate){ redisTemplate.delete("HeartRate:" + fullName); break; } redisTemplate.opsForValue().set("HeartRate:" + fullName, System.currentTimeMillis()); // 响应硬件 Pong pong = new Pong(); pong.setCharging_pile_code(pingMessage.getCharging_pile_code()); pong.setCharging_gun_code(pingMessage.getCharging_gun_code()); pong.setCharging_gun_status(0); iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong)); Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", (pingMessage.getCharging_pile_code() + pingMessage.getCharging_gun_code())); //缓解高并发调华为接口触发限流 // threadPoolExecutor.execute(()->{ // long longValue = Double.valueOf(Math.random() * 1000).longValue(); // System.err.println("随机等待" + longValue + "毫秒:" + fullName); // try { // Thread.sleep(longValue); // } catch (InterruptedException e) { // throw new RuntimeException(e); // } // // // 响应硬件 // Pong pong = new Pong(); // pong.setCharging_pile_code(pingMessage.getCharging_pile_code()); // pong.setCharging_gun_code(pingMessage.getCharging_gun_code()); // pong.setCharging_gun_status(0); // iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong)); // }); Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", fullName); //小于1分钟才处理数据,防止频繁查询数据 if(null != time && (System.currentTimeMillis() - time) < 60000){ log.warn("PING消息处理:{} 毫秒", System.currentTimeMillis() - PING); break; } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/produce/IotMessageProduce.java
@@ -2,19 +2,13 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSONObject; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.iotda.v5.IoTDAClient; import com.huaweicloud.sdk.iotda.v5.model.CreateMessageRequest; import com.huaweicloud.sdk.iotda.v5.model.CreateMessageResponse; import com.huaweicloud.sdk.iotda.v5.model.DeviceMessageRequest; import com.ruoyi.common.core.utils.uuid.UUID; import com.ruoyi.integration.iotda.builder.IotBuilder; import com.ruoyi.integration.iotda.config.IotDAConfig; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; @@ -27,9 +21,6 @@ @Autowired private IotBuilder iotBuilder; @Autowired private IotDAConfig config; /** ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TVipOrderController.java
@@ -19,9 +19,11 @@ import com.ruoyi.order.api.model.TExchangeOrder; import com.ruoyi.order.api.model.TShoppingOrder; import com.ruoyi.order.api.model.TVipOrder; import com.ruoyi.order.api.model.TVipOrderRefund; import com.ruoyi.order.api.query.ShoppingOrderQuery; import com.ruoyi.order.api.query.VipShoppingOrderQuery; import com.ruoyi.order.dto.TEnterpriseExport; import com.ruoyi.order.service.TVipOrderRefundService; import com.ruoyi.order.service.TVipOrderService; import com.ruoyi.other.api.domain.TEnterpriseUserApplication; import com.ruoyi.other.api.feignClient.OtherClient; @@ -39,6 +41,8 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -60,8 +64,10 @@ private TVipOrderService vipOrderService; @Resource private AppUserClient appUserClient; @Autowired @Resource private OtherClient otherClient; @Resource private TVipOrderRefundService vipOrderRefundService; @@ -139,6 +145,25 @@ } @PostMapping("/vipWxRefund") public void vipWxRefund(@RequestParam("out_refund_no") String out_refund_no, @RequestParam("refund_id") String refund_id, @RequestParam("tradeState") String tradeState, @RequestParam("success_time") String success_time){ if("SUCCESS".equals(tradeState)){ TVipOrderRefund vipOrderRefund = vipOrderRefundService.getOne(new LambdaUpdateWrapper<TVipOrderRefund>().eq(TVipOrderRefund::getRefundCode, out_refund_no)); vipOrderRefund.setRefundSerialNumber(refund_id); vipOrderRefund.setRefundStatus(2); vipOrderRefund.setRefundTime(LocalDateTime.parse(success_time, DateTimeFormatter.ofPattern("yyyy-MM-DDTHH:mm:ss+TIMEZONE"))); vipOrderRefundService.updateById(vipOrderRefund); TVipOrder vipOrder = vipOrderService.getById(vipOrderRefund.getVipOrderId()); vipOrder.setRefundStatus(2); vipOrderService.updateById(vipOrder); } } @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "导出") ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -1532,6 +1532,7 @@ if (siteIds.isEmpty()) siteIds.add(-1); dto.setSiteIds(siteIds); List<ChargingOrderVO> list = this.baseMapper.chargingOrder(pageInfo, dto, startTime1, startTime2, endTime1, endTime2); BigDecimal total = new BigDecimal("0"); long time = 0L; BigDecimal electronicMoney = new BigDecimal("0"); @@ -2885,7 +2886,6 @@ tChargingOrder.setStatus(5); } TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); chargingOrderRefund.setChargingOrderId(tChargingOrder.getId()); chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); @@ -2894,7 +2894,7 @@ chargingOrderRefund.setRefundTime(LocalDateTime.now()); chargingOrderRefund.setCode(tChargingOrder.getCode()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); chargingOrderRefund.setRefundTitle("后台退款"); chargingOrderRefund.setRefundContent("后台退款"); chargingOrderRefund.setRefundReason("后台退款"); @@ -2908,7 +2908,7 @@ model.setOut_refund_no(chargingOrderRefund.getRefundCode()); model.setTransaction_id(tChargingOrder.getRechargeSerialNumber()); model.setReason("取消订单"); model.setNotify_url("/order/t-shopping-order/cancelShoppingOrderWxRefund"); model.setNotify_url("/payment/wx/refund/notify"); WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue()); amount.setTotal(tChargingOrder.getRechargeAmount().multiply(new BigDecimal(100)).intValue()); @@ -2961,69 +2961,69 @@ } } if (payOrderQueryDto.getType() == 2) { TShoppingOrder tChargingOrder = shoppingOrderService.getById(payOrderQueryDto.getOrderId()); if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount()) == -1) { TShoppingOrder shoppingOrder = shoppingOrderService.getById(payOrderQueryDto.getOrderId()); if (shoppingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount()) == -1) { return R.fail("退款金额需小于支付金额"); } if ((tChargingOrder.getPaymentAmount().subtract(tChargingOrder.getRefundAmount()).compareTo(payOrderQueryDto.getRefundAmount())) == 0) { tChargingOrder.setStatus(5); if ((shoppingOrder.getPaymentAmount().subtract(shoppingOrder.getRefundAmount()).compareTo(payOrderQueryDto.getRefundAmount())) == 0) { shoppingOrder.setStatus(5); } TShoppingOrderRefund chargingOrderRefund = new TShoppingOrderRefund(); chargingOrderRefund.setShoppingOrderId(tChargingOrder.getId()); chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); chargingOrderRefund.setRefundStatus(1); chargingOrderRefund.setPayType(tChargingOrder.getPaymentType()); chargingOrderRefund.setRefundTime(LocalDateTime.now()); chargingOrderRefund.setCode(tChargingOrder.getCode()); TShoppingOrderRefund shoppingOrderRefund = new TShoppingOrderRefund(); shoppingOrderRefund.setShoppingOrderId(shoppingOrder.getId()); shoppingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); shoppingOrderRefund.setRefundStatus(1); shoppingOrderRefund.setPayType(shoppingOrder.getPaymentType()); shoppingOrderRefund.setRefundTime(LocalDateTime.now()); shoppingOrderRefund.setCode(shoppingOrder.getCode()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); chargingOrderRefund.setRefundTitle("后台退款"); chargingOrderRefund.setRefundContent("后台退款"); chargingOrderRefund.setRefundReason("后台退款"); chargingOrderRefund.setRefundRemark(payOrderQueryDto.getRemark()); chargingOrderRefund.setRefundTotalAmount(tChargingOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); chargingOrderRefund.setPayAmount(tChargingOrder.getPaymentAmount()); shoppingOrderRefund.setRefundCode("GWF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); shoppingOrderRefund.setRefundTitle("后台退款"); shoppingOrderRefund.setRefundContent("后台退款"); shoppingOrderRefund.setRefundReason("后台退款"); shoppingOrderRefund.setRefundRemark(payOrderQueryDto.getRemark()); shoppingOrderRefund.setRefundTotalAmount(shoppingOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); shoppingOrderRefund.setPayAmount(shoppingOrder.getPaymentAmount()); if (1 == tChargingOrder.getPaymentType()) { if (1 == shoppingOrder.getPaymentType()) { WxPaymentRefundModel model = new WxPaymentRefundModel(); model.setOut_trade_no(tChargingOrder.getCode()); model.setOut_refund_no(chargingOrderRefund.getRefundCode()); model.setTransaction_id(tChargingOrder.getSerialNumber()); model.setOut_trade_no(shoppingOrder.getCode()); model.setOut_refund_no(shoppingOrderRefund.getRefundCode()); model.setTransaction_id(shoppingOrder.getSerialNumber()); model.setReason("取消订单"); model.setNotify_url("/order/t-shopping-order/cancelShoppingOrderWxRefund"); model.setNotify_url("/payment/wx/refund/notify"); WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue()); amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); amount.setTotal(shoppingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); amount.setCurrency("CNY"); model.setAmount(amount); R<Map<String, Object>> orderR = wxPaymentClient.refundOrderR(model); if (200 == orderR.getCode()) { tChargingOrder.setRefundStatus(2); tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount() == null ? BigDecimal.valueOf(0) : tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); shoppingOrderService.updateById(tChargingOrder); shoppingOrderRefundService.save(chargingOrderRefund); shoppingOrder.setRefundStatus(2); shoppingOrder.setRefundAmount((shoppingOrder.getRefundAmount() == null ? BigDecimal.valueOf(0) : shoppingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); shoppingOrderService.updateById(shoppingOrder); shoppingOrderRefundService.save(shoppingOrderRefund); //手续费 Map<String, Object> amount1 = (Map<String, Object>) orderR.getData().get("amount"); Object refund_fee1 = amount1.get("refund_fee"); BigDecimal refund_fee = new BigDecimal(null == refund_fee1 ? "0" : refund_fee1.toString()).divide(new BigDecimal(100)); chargingOrderRefund.setRefundFee(refund_fee); shoppingOrderRefundService.updateById(chargingOrderRefund); shoppingOrderRefund.setRefundFee(refund_fee); shoppingOrderRefundService.updateById(shoppingOrderRefund); } } if (2 == tChargingOrder.getPaymentType()) { if (2 == shoppingOrder.getPaymentType()) { RefundReq dto = new RefundReq(); dto.setOutTradeNo(tChargingOrder.getCode()); dto.setOutRequestNo(tChargingOrder.getCode()); dto.setOutTradeNo(shoppingOrder.getCode()); dto.setOutRequestNo(shoppingOrder.getCode()); dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); dto.setRefundReason("取消订单"); RefundResp resp = aliPaymentClient.refund(dto).getData(); if (null != resp) { tChargingOrder.setRefundStatus(2); tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount() == null ? BigDecimal.valueOf(0) : tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); shoppingOrderService.updateById(tChargingOrder); shoppingOrderRefundService.save(chargingOrderRefund); shoppingOrder.setRefundStatus(2); shoppingOrder.setRefundAmount((shoppingOrder.getRefundAmount() == null ? BigDecimal.valueOf(0) : shoppingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); shoppingOrderService.updateById(shoppingOrder); shoppingOrderRefundService.save(shoppingOrderRefund); } } // if(3 == tChargingOrder.getPaymentType()){ @@ -3044,65 +3044,65 @@ } if (payOrderQueryDto.getType() == 3) { TVipOrder tChargingOrder = vipOrderService.getById(payOrderQueryDto.getOrderId()); if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount()) == -1) { TVipOrder vipOrder = vipOrderService.getById(payOrderQueryDto.getOrderId()); if (vipOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount()) == -1) { return R.fail("退款金额需小于支付金额"); } TVipOrderRefund chargingOrderRefund = new TVipOrderRefund(); chargingOrderRefund.setVipOrderId(tChargingOrder.getId()); chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); chargingOrderRefund.setRefundStatus(1); chargingOrderRefund.setPayType(tChargingOrder.getPaymentType()); chargingOrderRefund.setRefundTime(LocalDateTime.now()); chargingOrderRefund.setCode(tChargingOrder.getCode()); TVipOrderRefund vipOrderRefund = new TVipOrderRefund(); vipOrderRefund.setVipOrderId(vipOrder.getId()); vipOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); vipOrderRefund.setRefundStatus(1); vipOrderRefund.setPayType(vipOrder.getPaymentType()); vipOrderRefund.setRefundTime(LocalDateTime.now()); vipOrderRefund.setCode(vipOrder.getCode()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); chargingOrderRefund.setRefundTitle("后台退款"); chargingOrderRefund.setRefundContent("后台退款"); chargingOrderRefund.setRefundReason("后台退款"); chargingOrderRefund.setRefundRemark(payOrderQueryDto.getRemark()); chargingOrderRefund.setRefundTotalAmount(tChargingOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); chargingOrderRefund.setPayAmount(tChargingOrder.getPaymentAmount()); vipOrderRefund.setRefundCode("HYF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); vipOrderRefund.setRefundTitle("后台退款"); vipOrderRefund.setRefundContent("后台退款"); vipOrderRefund.setRefundReason("后台退款"); vipOrderRefund.setRefundRemark(payOrderQueryDto.getRemark()); vipOrderRefund.setRefundTotalAmount(vipOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); vipOrderRefund.setPayAmount(vipOrder.getPaymentAmount()); if (1 == tChargingOrder.getPaymentType()) { if (1 == vipOrder.getPaymentType()) { WxPaymentRefundModel model = new WxPaymentRefundModel(); model.setOut_trade_no(tChargingOrder.getCode()); model.setOut_refund_no(chargingOrderRefund.getRefundCode()); model.setTransaction_id(tChargingOrder.getSerialNumber()); model.setOut_trade_no(vipOrder.getCode()); model.setOut_refund_no(vipOrderRefund.getRefundCode()); model.setTransaction_id(vipOrder.getSerialNumber()); model.setReason("取消订单"); model.setNotify_url("/order/t-shopping-order/cancelShoppingOrderWxRefund"); model.setNotify_url("/payment/wx/refund/notify"); WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue()); amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); amount.setTotal(vipOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); amount.setCurrency("CNY"); model.setAmount(amount); R<Map<String, Object>> orderR = wxPaymentClient.refundOrderR(model); if (200 == orderR.getCode()) { tChargingOrder.setRefundStatus(2); tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount() == null ? BigDecimal.valueOf(0) : tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); vipOrderService.updateById(tChargingOrder); vipOrderRefundService.save(chargingOrderRefund); vipOrder.setRefundStatus(2); vipOrder.setRefundAmount((vipOrder.getRefundAmount() == null ? BigDecimal.valueOf(0) : vipOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); vipOrderService.updateById(vipOrder); vipOrderRefundService.save(vipOrderRefund); //手续费 Map<String, Object> amount1 = (Map<String, Object>) orderR.getData().get("amount"); Object refund_fee1 = amount1.get("refund_fee"); BigDecimal refund_fee = new BigDecimal(null == refund_fee1 ? "0" : refund_fee1.toString()).divide(new BigDecimal(100)); chargingOrderRefund.setRefundFee(refund_fee); vipOrderRefundService.updateById(chargingOrderRefund); vipOrderRefund.setRefundFee(refund_fee); vipOrderRefundService.updateById(vipOrderRefund); } } if (2 == tChargingOrder.getPaymentType()) { if (2 == vipOrder.getPaymentType()) { RefundReq dto = new RefundReq(); dto.setOutTradeNo(tChargingOrder.getCode()); dto.setOutRequestNo(tChargingOrder.getCode()); dto.setOutTradeNo(vipOrder.getCode()); dto.setOutRequestNo(vipOrder.getCode()); dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); dto.setRefundReason("取消订单"); RefundResp resp = aliPaymentClient.refund(dto).getData(); if (null != resp) { tChargingOrder.setRefundStatus(2); tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount() == null ? BigDecimal.valueOf(0) : tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); vipOrderService.updateById(tChargingOrder); vipOrderRefundService.save(chargingOrderRefund); vipOrder.setRefundStatus(2); vipOrder.setRefundAmount((vipOrder.getRefundAmount() == null ? BigDecimal.valueOf(0) : vipOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); vipOrderService.updateById(vipOrder); vipOrderRefundService.save(vipOrderRefund); } } // if(3 == tChargingOrder.getPaymentType()){ ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -990,7 +990,7 @@ ifnull(t2.refund_amount, 0) as refundAmount from t_charging_order t1 left join t_charging_order_refund t2 on t1.id = t2.charging_order_id where t1.del_flag = 0 and t1.status = 5 and t1.recharge_payment_status = 2 where t1.del_flag = 0 and t1.recharge_payment_status = 2 <if test="null != req.code and req.code!=''"> and t1.code LIKE CONCAT('%',#{req.code},'%') </if> @@ -1739,66 +1739,77 @@ </foreach> </if> </select> <select id="chargingOrderNolimit" resultType="map"> select sum(charging_capacity) as total, sum(charging_duration) as `time`, sum(electric_price) as electronicMoney, sum(income) as paymentMoney, sum(service_price) as serviceMoney from t_charging_order_summary_data where charging_order_id in ( select t1.id from t_charging_order t1 where 1=1 <if test="null != req.code and req.code!=''"> and t1.code LIKE CONCAT('%',#{req.code},'%') </if> <if test="null != req.userIds and req.userIds.size()>0"> and t1.app_user_id in <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </if> <if test="null != req.siteIds and req.siteIds.size()>0"> and t1.site_id in <foreach collection="req.siteIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </if> <if test="req.orderType != null "> and t1.order_type = #{req.orderType} </if> <if test="req.status != null "> and t1.status = #{req.status} </if> <if test="req.orderSource != null and req.orderSource == 1 "> and (t1.order_source = 0 or t1.order_source = 1 ) </if> <if test="req.orderSource != null and req.orderSource == 2 "> and t1.tripartite_platform_name = 'KuaiDian' </if> <if test="req.orderSource != null and req.orderSource == 3 "> and t1.tripartite_platform_name = 'XinDianTu' </if> <if test="req.siteId != null "> and t1.site_id = #{req.siteId} </if> <if test="req.pileId != null "> and t1.charging_pile_id = #{req.pileId} </if> <if test="req.gunId != null "> and t1.charging_gun_id = #{req.gunId} </if> <if test="startTime1 != null and startTime1!=''"> and (t1.pay_time between #{startTime1} and #{startTime2}) </if> <if test="endTime1 != null and endTime1!=''"> and (t1.end_time between #{endTime1} and #{endTime2}) </if> and t1.del_flag = 0 ) sum(aa.electricity) as total, sum(aa.charging_time) as `time`, sum(aa.charging_amount) as paymentMoney, sum(aa.period_electric_price) as electronicMoney, sum(aa.period_service_price) as serviceMoney from ( select ifnull(a.electricity, 0) as electricity, UNIX_TIMESTAMP(ifnull(a.end_time, now())) - UNIX_TIMESTAMP(ifnull(a.start_time, now())) as charging_time, ifnull(a.recharge_amount - b.refund_amount, 0) as charging_amount, ifnull(c.period_electric_price, 0) as period_electric_price, ifnull(c.period_service_price, 0) as period_service_price from t_charging_order a left join (select charging_order_id, sum(refund_amount) as refund_amount from t_charging_order_refund where refund_status = 2 group by charging_order_id) b on (a.id = b.charging_order_id) left join (select charging_order_id, sum(period_electric_price) as period_electric_price, sum(period_service_price) as period_service_price from t_charging_order_accounting_strategy group by charging_order_id) c on (a.id = c.charging_order_id) where a.del_flag = 0 <if test="null != req.code and req.code!=''"> and a.code LIKE CONCAT('%',#{req.code},'%') </if> <if test="null != req.userIds and req.userIds.size()>0"> and a.app_user_id in <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </if> <if test="null != req.siteIds and req.siteIds.size()>0"> and a.site_id in <foreach collection="req.siteIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </if> <if test="req.orderType != null "> and a.order_type = #{req.orderType} </if> <if test="req.status != null "> and a.status = #{req.status} </if> <if test="req.orderSource != null and req.orderSource == 1 "> and (a.order_source = 0 or a.order_source = 1 ) </if> <if test="req.orderSource != null and req.orderSource == 2 "> and a.tripartite_platform_name = 'KuaiDian' </if> <if test="req.orderSource != null and req.orderSource == 3 "> and a.tripartite_platform_name = 'XinDianTu' </if> <if test="req.siteId != null "> and a.site_id = #{req.siteId} </if> <if test="req.pileId != null "> and a.charging_pile_id = #{req.pileId} </if> <if test="req.gunId != null "> and a.charging_gun_id = #{req.gunId} </if> <if test="startTime1 != null and startTime1!=''"> and (a.start_time between #{startTime1} and #{startTime2}) </if> <if test="endTime1 != null and endTime1!=''"> and (a.end_time between #{endTime1} and #{endTime2}) </if> ) as aa </select> <select id="countOrdersByDate" resultType="com.ruoyi.order.vo.OrderCountByDate"> SELECT DATE_FORMAT(create_time, '%m/%d') AS `date`, COUNT(*) AS `count` FROM t_charging_order ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java
@@ -197,14 +197,15 @@ chargingOrderClient.chargingOrderStartupFailureWxRefund(out_refund_no, refund_id, tradeState, success_time); System.err.println("----充电启动失败退款回调通知"); break; case "GDF": shoppingOrderClient.cancelShoppingOrderWxRefund(out_refund_no, refund_id, tradeState, success_time); System.err.println("----商城订单取消退款回调通知"); //会员订单 case "HYF": orderClient.vipWxRefund(out_refund_no, refund_id, tradeState, success_time); System.err.println("----会员订单消退款回调通知"); break; //充电订单 //购物订单 case "GWF": chargingOrderClient.shoppingOrderWxRefund(out_refund_no, refund_id, tradeState, success_time); System.err.println("----管理后台取消购物订单退款回调通知"); System.err.println("----购物订单退款回调通知"); break; }