From 656a75b226db2e76386608fdaf651966e1b07476 Mon Sep 17 00:00:00 2001 From: "925116093-qq.com" <925116093@qq.com> Date: Sat, 16 Aug 2025 17:56:50 +0800 Subject: [PATCH] 2025008071805 --- .../system/controller/AppletController.java | 2 +- .../controller/PayNotifyController.java | 35 + .../controllerUtil/AppletControllerUtil.java | 5 +- .../system/controllerUtil/CartOrderUtil.java | 2 +- .../system/controllerUtil/OrderUtil.java | 62 +- .../mapper/system/OrderCallMapper.xml | 12 +- .../Order/components/OrderDetailDialog.vue | 852 ++++++++++++++++++ ruoyi-ui/src/views/system/Order/index.vue | 127 ++- 8 files changed, 1081 insertions(+), 16 deletions(-) create mode 100644 ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/AppletController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/AppletController.java index 650863f..e4b3b2a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/controller/AppletController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/AppletController.java @@ -5241,7 +5241,7 @@ public class AppletController extends BaseController { // orderService.updateOrder(order); } //给新师傅进行电话通知 - YunXinPhoneUtilAPI.httpsAxbTransfer(newWorker.getPhone()); + YunXinPhoneUtilAPI.httpsAxbTransfer(newWorker.getPhone(), order.getId()); } return AjaxResult.success("转单成功"); } catch (Exception e) { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/PayNotifyController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/PayNotifyController.java index b630846..60ba27e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/controller/PayNotifyController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/PayNotifyController.java @@ -83,6 +83,9 @@ public class PayNotifyController extends BaseController { @Autowired private ISiteConfigService siteConfigService; + @Autowired + private IOrderCallService orderCallService; + @Autowired private IIntegralLogService integralLogService; @@ -2814,7 +2817,39 @@ public class PayNotifyController extends BaseController { return buildFailResponse("次卡退款回调处理异常"); } } + @PostMapping("/api/YunXin/notify") + public String apiYunXinnotify(HttpServletRequest request) throws IOException { + // 1. 读取退款回调数据 + StringBuilder xmlData = new StringBuilder(); + BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8)); + String line; + while ((line = reader.readLine()) != null) { + xmlData.append(line); + } + reader.close(); + JSONObject json = JSONObject.parseObject(xmlData.toString()); + String oid=json.getString("customerData"); + String answeredTime=json.getString("answeredTime"); + String endTime=json.getString("endTime"); + String duration=json.getString("duration"); + String callState=json.getString("callState"); + if (StringUtils.isNotBlank(oid)){ + Order order=orderService.selectOrderById(Long.valueOf(oid)); + if (order!=null){ + OrderCall orderCall=new OrderCall(); + orderCall.setOid(order.getId()); + orderCall.setType(2); + orderCall.setStartCallTime(DateUtils.parseDate(answeredTime)); + orderCall.setEndTime(DateUtils.parseDate(endTime)); + orderCall.setCallerstate(Integer.valueOf(callState)); + orderCall.setDuration(Long.valueOf(duration)); + orderCallService.insertOrderCall(orderCall); + } + } + logger.info("------------------------------------------------------------云信回调原始数据:{}", xmlData.toString()); + return buildFailResponse("非常成功"); + } /** * 处理次卡退款成功后的业务逻辑 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/AppletControllerUtil.java b/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/AppletControllerUtil.java index 94b96d4..5a1fbd6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/AppletControllerUtil.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/AppletControllerUtil.java @@ -5536,6 +5536,7 @@ public class AppletControllerUtil { order.setMainOrderId(mainorderId); order.setCreateType(1); // 用户自主下单 order.setOrderId(orderId); + order.setCreatePhone(user.getPhone()); order.setUid(user.getId()); order.setUname(user.getName()); order.setProductId(serviceGoods.getId()); @@ -5764,6 +5765,7 @@ public class AppletControllerUtil { order.setFileData(attachments); // 设置附件数据 order.setType(1); order.setTotalPrice(itemPrice); + order.setCreatePhone(user.getPhone()); int insertResult = orderService.insertOrder(order); if (insertResult <= 0) { result.put("success", false); @@ -5936,6 +5938,7 @@ public class AppletControllerUtil { order.setDeduction(new BigDecimal(0)); order.setFileData(attachments); // 设置附件数据 order.setTotalPrice(totalAmount); + order.setCreatePhone(user.getPhone()); int insertResult = orderService.insertOrder(order); if (insertResult <= 0) { result.put("success", false); @@ -6060,7 +6063,7 @@ public class AppletControllerUtil { JSONObject jsonObject = new JSONObject(); jsonObject.put("name", "用户创建报价订单,待报价"); orderLog.setContent(jsonObject.toJSONString()); - + order.setCreatePhone(user.getPhone()); orderLogService.insertOrderLog(orderLog); // // 添加订单日志 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/CartOrderUtil.java b/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/CartOrderUtil.java index cdf8519..e0030fd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/CartOrderUtil.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/CartOrderUtil.java @@ -105,7 +105,7 @@ public class CartOrderUtil { order.setDeduction(BigDecimal.ZERO); order.setBigtype(serviceGoods.getServicetype()); order.setReceiveType(Long.valueOf(dispatchtype)); // 自由抢单 - + order.setCreatePhone(user.getPhone()); int insertResult = orderService.insertOrder(order); if (insertResult <= 0) { result.put("success", false); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/OrderUtil.java b/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/OrderUtil.java index feddf27..7879bb9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/OrderUtil.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controllerUtil/OrderUtil.java @@ -33,6 +33,7 @@ public class OrderUtil { private static IUsersPayBeforService usersPayBeforService = SpringUtils.getBean(IUsersPayBeforService.class); private static IQuoteMaterialService quoteMaterialService = SpringUtils.getBean(IQuoteMaterialService.class); private static IServiceGoodsService serviceGoodsService = SpringUtils.getBean(IServiceGoodsService.class); + private static IOrderCallService orderCallService = SpringUtils.getBean(IOrderCallService.class); private static OrderLogHandler orderLogHandler = SpringUtils.getBean(OrderLogHandler.class); @@ -654,6 +655,7 @@ public class OrderUtil { for (GoodsOrder g: gorders){ g.setStatus(2L); g.setPayTime(DateUtils.getNowDate()); + g.setTransactionId(payBefor.getPaycode()); goodsOrderService.updateGoodsOrder(g); // BenefitPointsUtil.processBenefitPoints(g.getId(),g.getTotalPrice(),"2"); } @@ -679,6 +681,7 @@ public class OrderUtil { for (GoodsOrder goodsOrder : orderslist){ System.out.println("更新商品订单 - ID: " + goodsOrder.getId() + ", 原状态: " + goodsOrder.getStatus()); goodsOrder.setStatus(2L); + goodsOrder.setPayTime(DateUtils.getNowDate()); goodsOrder.setTransactionId(payBefor.getPaycode()); int updateResult = goodsOrderService.updateGoodsOrder(goodsOrder); @@ -701,7 +704,7 @@ public class OrderUtil { if (order != null) { order.setStatus(2L); order.setPayTime(DateUtils.getNowDate()); - order.setTransactionId(payBefor.getPaycode()); + order.setTransactionId(order.getTransactionId()+" "+ payBefor.getPaycode()); //BenefitPointsUtil.processBenefitPoints(order.getId(),order.getTotalPrice(),"2"); //微信发送消息 WXsendMsgUtil.sendUserForMoneySuccess(user.getOpenid(),payBefor.getOrderid(),payBefor.getAllmoney().toString(),order.getAddress(),"商品支付","商品支付成功"); @@ -721,7 +724,9 @@ public class OrderUtil { int updateResult = orderLogService.updateOrderLog(orderLog); Order order = orderService.selectOrderByOrderId(payBefor.getLastorderid()); if (order != null){ + order.setPayTime(DateUtils.getNowDate()); order.setPayPrice(order.getPayPrice().add(payBefor.getAllmoney())); + order.setTransactionId(order.getTransactionId()+" "+ payBefor.getPaycode()); orderService.updateOrder(order); } @@ -755,6 +760,8 @@ public class OrderUtil { if (updateResult > 0){ Order order = orderService.selectOrderByOrderId(payBefor.getLastorderid()); if (order != null){ + order.setPayTime(DateUtils.getNowDate()); + order.setTransactionId(order.getTransactionId()+" "+ payBefor.getPaycode()); order.setPayPrice(order.getPayPrice().add(payBefor.getAllmoney())); orderService.updateOrder(order); } @@ -773,7 +780,8 @@ public class OrderUtil { if (order != null) { - + order.setPayTime(DateUtils.getNowDate()); + order.setTransactionId(order.getTransactionId()+" "+ payBefor.getPaycode()); order.setPayPrice(order.getPayPrice().add(payBefor.getAllmoney())); orderService.updateOrder(order); @@ -812,6 +820,8 @@ public class OrderUtil { if (updateResult > 0){ Order order = orderService.selectOrderByOrderId(payBefor.getLastorderid()); if (order != null){ + order.setPayTime(DateUtils.getNowDate()); + order.setTransactionId(order.getTransactionId()+" "+ payBefor.getPaycode()); order.setPayPrice(order.getPayPrice().add(payBefor.getAllmoney())); orderService.updateOrder(order); WXsendMsgUtil.sendUserForMoneySuccess(user.getOpenid(),payBefor.getOrderid(),payBefor.getAllmoney().toString(),order.getAddress(),"差价支付","差价支付成功"); @@ -852,7 +862,8 @@ public class OrderUtil { System.out.println("查询到的师傅信息: " + (users != null ? users.toString() : "null")); if (users != null){ - + order.setPayTime(DateUtils.getNowDate()); + order.setTransactionId(order.getTransactionId()+" "+ payBefor.getPaycode()); order.setStatus(2L); order.setJsonStatus(2); order.setPayPrice(order.getPayPrice().add(userDemandQuotation.getMoney())); @@ -934,6 +945,8 @@ public class OrderUtil { System.out.println("订单日志插入结果: " + logInsertResult); System.out.println("更新订单状态为待派单"); + order.setPayTime(DateUtils.getNowDate()); + order.setTransactionId(order.getTransactionId()+" "+ payBefor.getPaycode()); order.setPayPrice(order.getPayPrice().add(payBefor.getAllmoney())); order.setStatus(1L); // 1=待预约 int orderUpdateResult = orderService.updateOrder(order); @@ -980,7 +993,8 @@ public class OrderUtil { Order order = new Order(); order.setOdertype(1); // 拼团 order.setStatus(9L); // 9=待成团 - + order.setPayTime(DateUtils.getNowDate()); + order.setTransactionId(order.getTransactionId()+" "+ payBefor.getPaycode()); order.setOrderId(ptorderid); order.setUid(payBefor.getUid()); order.setNum(payBefor.getNum()); // 默认1,可根据业务调整 @@ -1015,6 +1029,7 @@ public class OrderUtil { //20250809处理过的一个故障 order.setPayPrice(payBefor.getAllmoney()); order.setReceiveType(Long.valueOf(dispatchtype)); // 自由抢单 + order.setCreatePhone(user.getPhone()); // 预约时间 System.out.println("预约时间: " + payBefor.getMaketime()); if (payBefor.getMaketime() != null && !payBefor.getMaketime().isEmpty()) { @@ -1148,6 +1163,8 @@ public class OrderUtil { if (logInsertResult>0){ DispatchUtil.dispatchOrder(order.getId()); } + order.setPayTime(DateUtils.getNowDate()); + order.setTransactionId(order.getTransactionId()+" "+ payBefor.getPaycode()); order.setPayPrice(order.getPayPrice().add(payBefor.getAllmoney())); order.setStatus(1L); // 1=待预约 int orderUpdateResult = orderService.updateOrder(order); @@ -1180,6 +1197,8 @@ public class OrderUtil { System.out.println("订单日志插入结果: " + logInsertResult); System.out.println("更新订单状态为待派单"); + order.setPayTime(DateUtils.getNowDate()); + order.setTransactionId(order.getTransactionId()+" "+ payBefor.getPaycode()); order.setPayPrice(order.getPayPrice().add(payBefor.getAllmoney())); order.setStatus(1L); // 1=待预约 int orderUpdateResult = orderService.updateOrder(order); @@ -2034,6 +2053,41 @@ public class OrderUtil { } } + /** + * 定时任务拨打电话 + */ + public static String TheCallWorder() throws Exception { + //第一步先去查询已经派单,但是师傅还没接单的订单 + System.out.println("开始执行定时查询任务---------------------------"+new Date()); + IOrderService orderService = SpringUtils.getBean(IOrderService.class); + Order order = new Order(); + order.setIsAccept(0); + List orderList = orderService.selectOrderList(order); + if (orderList != null && !orderList.isEmpty()){ + for (Order order1 : orderList) { + if (order1.getIsAccept() == 0&&order1.getWorkerId()!=null){ + OrderCall orderCall = new OrderCall(); + orderCall.setOid(order1.getId()); + List orderCallList = orderCallService.selectOrderCallList(orderCall); + if (orderCallList != null && !orderCallList.isEmpty()){ + if (orderCallList.size()<3){ + if (orderCallList.getFirst().getCallerstate()!= 0L){ + Users user = usersService.selectUsersById(order1.getWorkerId()); + if (user != null){ + String phone = user.getPhone(); + YunXinPhoneUtilAPI.httpsAxbTransfer(phone,order1.getId()); + } + } + } + + } + } + } + } + + return ""; + } + /** * 查找用户首次下单(重载方法,支持用户对象) * 根据用户对象查找该用户首次下单的订单ID diff --git a/ruoyi-system/src/main/resources/mapper/system/OrderCallMapper.xml b/ruoyi-system/src/main/resources/mapper/system/OrderCallMapper.xml index b569be2..9716b84 100644 --- a/ruoyi-system/src/main/resources/mapper/system/OrderCallMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/OrderCallMapper.xml @@ -31,12 +31,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and oid = #{oid} - and type = #{type} - and start_call_time = #{startCallTime} - and callerstate = #{callerstate} - and end_time = #{endTime} - and duration = #{duration} - and recurl = #{recurl} + + + + + + order by id desc diff --git a/ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue b/ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue new file mode 100644 index 0000000..17a0be7 --- /dev/null +++ b/ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue @@ -0,0 +1,852 @@ + + + + + diff --git a/ruoyi-ui/src/views/system/Order/index.vue b/ruoyi-ui/src/views/system/Order/index.vue index 74031ab..de2d781 100644 --- a/ruoyi-ui/src/views/system/Order/index.vue +++ b/ruoyi-ui/src/views/system/Order/index.vue @@ -325,7 +325,7 @@ - +