liujie
2025-08-18 fd2d4c117db9be24b75be9150bd50407ba9ff0ab
update
13个文件已修改
2个文件已添加
277 ■■■■■ 已修改文件
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysCouponActivityController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TOpenCityController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/UserCouponRecordController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TUser.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/WxMaSubscribeMessageUtil.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/report/operationalData.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tCar/tCar_add.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tCar/tCar_edit.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tDriver/tDriver_add.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tDriver/tDriver_edit.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tOpenCity/tOpenCity_add.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tOpenCity/tOpenCity_edit.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityInviteMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/WxMaSubscribeMessageUtil.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysCouponActivityController.java
@@ -19,6 +19,7 @@
import com.stylefeng.guns.modular.system.service.ISysCouponActivityService;
import com.stylefeng.guns.modular.system.service.ISysCouponRecordService;
import com.stylefeng.guns.modular.system.service.ITUserService;
import com.stylefeng.guns.modular.system.util.WxMaSubscribeMessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -49,6 +50,7 @@
    @Autowired
    private ISysCouponRecordService couponRecordService;
    /**
     * 跳转到首页
@@ -245,6 +247,11 @@
            userCouponRecord.setCouponActivityId(sysCouponActivity.getId());
            userCouponRecord.setCouponId(sysCouponActivity.getCouponId());
            userCouponRecord.setActivityType(1);
            SysCouponRecord sysCouponRecord = couponRecordService.selectById(sysCouponActivity.getCouponId());
            //判断发送类型1=全部用户,2=选择用户
            if(sysCouponActivity.getSendType()==1){
                Wrapper wrapper = new EntityWrapper<TUser>();
@@ -256,6 +263,15 @@
                    userCouponRecord.setUserId(user.getId());
                    for (int i=0;i<sysCouponActivity.getNumber();i++){
                        userCouponRecord.insert();
                        // 订阅通知
                        if(user.getOpenId()!=null){
                            // 推送订阅消息
                            WxMaSubscribeMessageUtil.push(user.getAppletsOpenId(),sysCouponRecord.getName(),sysCouponRecord.getMoney().doubleValue());
                        }
                    }
                }
                sysCouponActivity.setSendUserNum(list.size());
@@ -266,6 +282,13 @@
                    userCouponRecord.setUserId(userId.getJSONObject(j).getInteger("userId"));
                    for (int i=0;i<sysCouponActivity.getNumber();i++){
                        userCouponRecord.insert();
                        TUser user = userService.selectById(userCouponRecord.getUserId());
                        // 订阅通知
                        if(user.getOpenId()!=null){
                            // 推送订阅消息
                            WxMaSubscribeMessageUtil.push(user.getAppletsOpenId(),sysCouponRecord.getName(),sysCouponRecord.getMoney().doubleValue());
                        }
                    }
                }
                sysCouponActivity.setSendUserNum(userId.size());
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TOpenCityController.java
@@ -192,9 +192,9 @@
                businessType = 2;
            }else if ("跨城出行".equals(type)){
                businessType = 3;
            }else if ("跨城小件物流".equals(type)){
                businessType = 4;
            }else if ("同城小件物流".equals(type)){
                businessType = 4;
            }else if ("跨城小件物流".equals(type)){
                businessType = 5;
            }else if ("包车".equals(type)){
                businessType = 6;
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/UserCouponRecordController.java
@@ -87,6 +87,7 @@
    @ResponseBody
    public Object add(UserCouponRecord userCouponRecord) {
        userCouponRecordService.insert(userCouponRecord);
        return SUCCESS_TIP;
    }
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TUser.java
@@ -136,6 +136,8 @@
    // 加入黑名单时间
    private Date blackTime;
    private String appletsOpenId;
    public Integer getId() {
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/WxMaSubscribeMessageUtil.java
New file
@@ -0,0 +1,92 @@
package com.stylefeng.guns.modular.system.util;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
/**
 * @BelongsProject: xxx
 * @BelongsPackage: com.xxx.commons.utils
 * @ClassName WxMaSubscribeMessageUtil
 * @Author: handsome boy__LiuWenCheng
 * @CreateTime: 2024-09-05  15:58
 */
@Component
public class WxMaSubscribeMessageUtil {
    public static String appId = "wx4d36488fa2cd2718";
    public static String appSecret = "f3874e9c813f31a2e90c37346eb74d82";
    /**
     * 活动即将开始通知
     * @param openId
     */
    public static void push(String openId,String name ,Double money) {
        String accessToken = getAccessToken();
        String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken;
        JSONObject data = new JSONObject();
        data.put("touser", openId);
        data.put("template_id", "loQAaLfhJvkkvZL0ILKbwKJiXiHq5db6SLqeLX_V54c");
        data.put("page", "/pages/index/index/index" );
        // 设置消息内容
        JSONObject messageData = new JSONObject();
        JSONObject thing1 = new JSONObject();
        thing1.put("value", name);
        messageData.put("thing1", thing1);
        JSONObject time2 = new JSONObject();
        time2.put("value", "您的专属优惠券已到账,快点打车用掉吧~");
        messageData.put("thing2", time2);
        // 转化成年月日时分的时间格式
        JSONObject thing3 = new JSONObject();
        thing3.put("value", money);
        messageData.put("amount3", thing3);
        // 打印 messageData 的内容
        System.out.println("messageData: " + messageData.toJSONString());
        data.put("data", messageData);
        // 打印 data 的内容
        System.out.println("data: " + data.toJSONString());
        // 发送消息
        String result = HttpUtil.post(url, data.toString());
        System.out.println("订阅消息结果:" + result);
    }
    public static void main(String[] args) {
        push("oTrbv6yS0oceps4FVbW6UcaIWscI","张三", Double.valueOf(10.0d));
    }
    public static String getAccessToken() {
        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
        url = url.replace("APPID", appId).replace("APPSECRET", appSecret);
        try {
            String result = HttpUtil.get(url);
            JSONObject jsonObject = JSON.parseObject(result);
            return jsonObject.getString("access_token");
        } catch (Exception e) {
            System.err.println("请求失败:" + e.getMessage());
            e.printStackTrace();
            return null;
        }
    }
}
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/report/operationalData.html
@@ -10,6 +10,7 @@
                                <#SelectCon id="type" name="类别" >
                                    <option value="2">出租车</option>
                                    <option value="3">跨城出行</option>
                                    <option value="4">同城小件物流</option>
                                </#SelectCon>
                            </div>
                            <div class="col-sm-3">
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tCar/tCar_add.html
@@ -53,6 +53,10 @@
                                    <input type="checkbox" name="serverBox" id="serverBox3" value="3" onclick="TCarInfoDlg.kcServerClick()">
                                    <label for="serverBox3"> 跨城 </label>
                                </div>
                                <div class="checkbox checkbox-success  checkbox-inline">
                                    <input type="checkbox" name="serverBox" id="serverBox4" value="4">
                                    <label for="serverBox4"> 同城小件物流 </label>
                                </div>
                            </div>
                        </fieldset>
                    </div>
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tCar/tCar_edit.html
@@ -55,6 +55,10 @@
                                    <input type="checkbox" name="serverBox" id="serverBox3" value="3" ${2 == three ? 'checked=checked' : ''} onclick="TCarInfoDlg.kcServerClick()">
                                    <label for="serverBox3"> 跨城 </label>
                                </div>
                                <div class="checkbox checkbox-success  checkbox-inline">
                                    <input type="checkbox" name="serverBox" id="serverBox4" value="4" ${2 == four ? 'checked=checked' : ''} onclick="TCarInfoDlg.kcServerClick()">
                                    <label for="serverBox4"> 同城小件物流 </label>
                                </div>
                            </div>
                        </fieldset>
                    </div>
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tDriver/tDriver_add.html
@@ -78,6 +78,10 @@
                                    <input type="checkbox" name="serverBox" id="serverBox3" value="3" onclick="YesDriverInfoDlg.checkBox()" >
                                    <label for="serverBox3"> 跨城 </label>
                                </div>
                                <div class="checkbox checkbox-success  checkbox-inline">
                                    <input type="checkbox" name="serverBox" id="serverBox4" value="4" >
                                    <label for="serverBox4"> 同城小件物流 </label>
                                </div>
                            </div>
                        </fieldset>
                    </div>
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tDriver/tDriver_edit.html
@@ -81,6 +81,10 @@
                                    <input type="checkbox" name="serverBox" id="serverBox3" value="3" ${2 == three ? 'checked=checked' : ''} onclick="YesDriverInfoDlg.checkBox()" >
                                    <label for="serverBox3"> 跨城 </label>
                                </div>
                                <div class="checkbox checkbox-success  checkbox-inline">
                                    <input type="checkbox" name="serverBox" id="serverBox4" value="4" ${2 == four ? 'checked=checked' : ''}  >
                                    <label for="serverBox4"> 同城小件物流 </label>
                                </div>
                            </div>
                        </fieldset>
                    </div>
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tOpenCity/tOpenCity_add.html
@@ -28,6 +28,7 @@
                                <option value="">选择经营业务</option>
                                <option value="2">出租车</option>
                                <option value="3">跨城出行</option>
                                <option value="4">同城小件物流</option>
                            </select>
                        </div>
                        <div class="col-sm-3" >
ManagementOKTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tOpenCity/tOpenCity_edit.html
@@ -35,6 +35,7 @@
                                <option value="">选择经营业务</option>
                                <option value="2">出租车</option>
                                <option value="3">跨城出行</option>
                                <option value="4">同城小件物流</option>
                            </select>
                        </div>
                        <div class="col-sm-3" >
UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityInviteMapper.xml
@@ -33,7 +33,8 @@
        c.couponUseType as couponUseType,
        c.couponType as couponType,
        a.totalPrice as totalPrice,
        a.lavePrice as lavePrice
        a.lavePrice as lavePrice,
        c.name as name
        from t_user_activity_invite a
        left join t_user_activity b on (a.userActivityId = b.id)
        left join t_sys_coupon_record c on (a.couponId = c.id)
UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java
@@ -42,6 +42,7 @@
import java.io.*;
import java.math.BigDecimal;
import java.security.SecureRandom;
import java.time.LocalDateTime;
import java.util.*;
@@ -278,6 +279,14 @@
                            userCouponRecordService.insert(userCouponRecord);
                            //修改剩余可发放总金额
                            lavePrice -= Double.valueOf(String.valueOf(map.get("money")));
                            // 订阅通知
                            UserInfo userInfo1 = userInfoMapper.selectById(uid);
                            if(userInfo1.getOpenId()!=null){
                                // 推送订阅消息
                                WxMaSubscribeMessageUtil.push(userInfo1.getAppletsOpenId(),map.get("name").toString(),userCouponRecord.getMoney());
                            }
                        }
                        UserActivityInvite uai = userActivityInviteMapper.selectById(Integer.valueOf(map.get("id").toString()));
                        uai.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
@@ -434,6 +443,15 @@
                        userCouponRecordService.insert(userCouponRecord);
                        //修改剩余可发放总金额
                        lavePrice -= Double.valueOf(String.valueOf(map.get("money")));
                        // 订阅通知
                        UserInfo userInfo1 = userInfoMapper.selectById(uid);
                        if(userInfo1.getOpenId()!=null){
                            // 推送订阅消息
                            WxMaSubscribeMessageUtil.push(userInfo1.getAppletsOpenId(),map.get("name").toString(),userCouponRecord.getMoney());
                        }
                    }
                    UserActivityInvite uai = userActivityInviteMapper.selectById(Integer.valueOf(map.get("id").toString()));
                    uai.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
@@ -591,6 +609,16 @@
                            userCouponRecord.setCompanyId(userInfo.getCompanyId());
                            userCouponRecord.setUserId(uid);
                            userCouponRecordService.insert(userCouponRecord);
                            // 订阅通知
                            UserInfo userInfo1 = userInfoMapper.selectById(uid);
                            if(userInfo1.getOpenId()!=null){
                                // 推送订阅消息
                                  WxMaSubscribeMessageUtil.push(userInfo1.getAppletsOpenId(),map.get("name").toString(),userCouponRecord.getMoney());
                            }
                            //修改剩余可发放总金额
                            lavePrice -= Double.valueOf(String.valueOf(map.get("money")));
                        }
@@ -1388,6 +1416,13 @@
                    //修改剩余可发放总金额
                    lavePrice -= Double.valueOf(String.valueOf(map.get("money")));
                    num++;
                    // 订阅通知
                    if(userInfo.getOpenId()!=null){
                        // 推送订阅消息
                        WxMaSubscribeMessageUtil.push(userInfo.getAppletsOpenId(),map.get("name").toString(),userCouponRecord.getMoney());
                    }
                }
                UserActivityRegistered uar = userActivityRegisteredService.selectById(Integer.valueOf(map.get("id").toString()));
                uar.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
@@ -1436,6 +1471,12 @@
                    //修改剩余可发放总金额
                    lavePrice -= Double.valueOf(String.valueOf(map.get("money")));
                    num++;
                    // 订阅通知
                    if(userInfo.getOpenId()!=null){
                        // 推送订阅消息
                        WxMaSubscribeMessageUtil.push(userInfo.getAppletsOpenId(),map.get("name").toString(),userCouponRecord.getMoney());
                    }
                }
                UserActivityRegistered uar = userActivityRegisteredService.selectById(Integer.valueOf(map.get("id").toString()));
                uar.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/WxMaSubscribeMessageUtil.java
New file
@@ -0,0 +1,92 @@
package com.stylefeng.guns.modular.system.util;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
 * @BelongsProject: xxx
 * @BelongsPackage: com.xxx.commons.utils
 * @ClassName WxMaSubscribeMessageUtil
 * @Author: handsome boy__LiuWenCheng
 * @CreateTime: 2024-09-05  15:58
 */
@Component
public class WxMaSubscribeMessageUtil {
    public static String appId = "wx4d36488fa2cd2718";
    public static String appSecret = "f3874e9c813f31a2e90c37346eb74d82";
    /**
     * 活动即将开始通知
     * @param openId
     */
    public static void push(String openId,String name ,Double money) {
        String accessToken = getAccessToken();
        String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken;
        JSONObject data = new JSONObject();
        data.put("touser", openId);
        data.put("template_id", "loQAaLfhJvkkvZL0ILKbwKJiXiHq5db6SLqeLX_V54c    ");
        data.put("page", "/pages/index/index/index" );
        // 设置消息内容
        JSONObject messageData = new JSONObject();
        JSONObject thing1 = new JSONObject();
        thing1.put("value", name);
        messageData.put("thing1", thing1);
        JSONObject time2 = new JSONObject();
        time2.put("value", "您的专属优惠券已到账,快点打车用掉吧~");
        messageData.put("thing2", time2);
        // 转化成年月日时分的时间格式
        JSONObject thing3 = new JSONObject();
        thing3.put("value", money);
        messageData.put("amount3", thing3);
        // 打印 messageData 的内容
        System.out.println("messageData: " + messageData.toJSONString());
        data.put("data", messageData);
        // 打印 data 的内容
        System.out.println("data: " + data.toJSONString());
        // 发送消息
        String result = HttpUtil.post(url, data.toString());
        System.out.println("订阅消息结果:" + result);
    }
    public static String getAccessToken() {
        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
        url = url.replace("APPID", appId).replace("APPSECRET", appSecret);
        try {
            String result = HttpUtil.get(url);
            JSONObject jsonObject = JSON.parseObject(result);
            return jsonObject.getString("access_token");
        } catch (Exception e) {
            System.err.println("请求失败:" + e.getMessage());
            e.printStackTrace();
            return null;
        }
    }
}