lige
2023-11-30 3f28b46171934066aeeff9af80d3f0ce6afb3adf
ltkj-admin/src/main/java/com/ltkj/web/controller/mall/WxMallOrderController.java
@@ -2,6 +2,8 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
@@ -29,6 +31,7 @@
import com.ltkj.mall.mallOrderUtils.OrderUtil;
import com.ltkj.system.service.ISysConfigService;
import com.ltkj.web.config.redis.OrderDelayService;
import com.ltkj.web.wxUtils.WxUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -465,6 +468,53 @@
//        final MallTimeConfig one = mallTimeConfigService.getOne(wq);
//        one.setNowNum(one.getNowNum()-1);
//        mallTimeConfigService.updateById(one);
        //发订单信息给wx订阅服务消息————————————————start————————————————————————————————————————
        Map<String, Object> res = new HashMap<>();
        res.put("touser",UserHoder.getWxuser().getOpenid());
        res.put("template_id","Gzc2BgzSsEY9uki6FThNQRLD1_An6uqpSve3PaU58PQ");
        res.put("page","pages/mine/index");
        res.put("miniprogram_state","formal");
        //订阅消息参数值
        JSONObject data = new JSONObject();
        JSONObject amount3 = new JSONObject();
        amount3.put("value", order.getOrderSn());
        data.put("character_string2", amount3);
        JSONObject time4 = new JSONObject();
        String dateFormat = DateUtil.format(order.getCreateTime(), "yyyy-MM-dd HH:mm:ss");
        time4.put("value", dateFormat);
        data.put("time1", time4);
        final TjPackage byId = packageService.getById(order.getPacId());
        if (byId!=null){
            JSONObject thing5 = new JSONObject();
            thing5.put("value",byId.getPacName());
            data.put("thing3", thing5);
        }else {
            JSONObject thing5 = new JSONObject();
            thing5.put("value","体检项目");
            data.put("thing3", thing5);
        }
        JSONObject name1 = new JSONObject();
        name1.put("value",order.getActualPrice()+"元");
        data.put("amount4", name1);
        if (order.getPayId()!=null){
            JSONObject thing6 = new JSONObject();
            thing6.put("value", "已付款");
            data.put("phrase8", thing6);
        }else {
            JSONObject thing6 = new JSONObject();
            thing6.put("value", "未付款");
            data.put("phrase8", thing6);
        }
        WxUtil.sendCommonSubscribeMessage(res,data);
        //发订单信息给wx订阅服务消息————————————————end————————————————————————————————————————
        return AjaxResult.success();
    }