puzhibing
2026-02-02 f042c70637540c9262a99404fb1d2185cf3aea17
修改bug
4个文件已修改
516 ■■■■■ 已修改文件
DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/QianYunTongConfig.java 307 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/UserUtil.java 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/model/RegisterViaMobileRequest.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java
@@ -29,7 +29,12 @@
import com.stylefeng.guns.modular.system.service.impl.CarServiceImpl;
import com.stylefeng.guns.modular.system.util.*;
import com.stylefeng.guns.modular.system.util.qianyuntong.OrderUtil;
import com.stylefeng.guns.modular.system.util.qianyuntong.QianYunTongConfig;
import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil;
import com.stylefeng.guns.modular.system.util.qianyuntong.model.ModifyTravelItineraryRequest;
import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTUserInfo;
import com.stylefeng.guns.modular.system.util.qianyuntong.model.RegisterViaMobile;
import com.stylefeng.guns.modular.system.util.qianyuntong.model.RegisterViaMobileRequest;
import com.stylefeng.guns.modular.system.warpper.BaseWarpper;
import com.stylefeng.guns.modular.system.warpper.MerchantCouponListWarpper;
import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper;
@@ -182,6 +187,9 @@
    @Value("${qyt.admin_url}")
    private String adminUrl;
    @Autowired
    private QianYunTongConfig qianYunTongConfig;
    /**
@@ -548,17 +556,39 @@
            return ResultUtil.error("司机处于离线状态");
        }
        OrderCrossCity orderCrossCity = new OrderCrossCity();
        UserInfo userInfo = userInfoMapper.queryByPhone(orderCrossCityWarpper.getPassengersPhone());
        String phone = orderCrossCityWarpper.getPassengersPhone();
        UserInfo userInfo = userInfoMapper.queryByPhone(phone);
        if(userInfo == null){//添加用户信息
            userInfo = new UserInfo();
            Integer integer = userInfoMapper.selectCount(null) + 1000001;
            userInfo.setNickName(ToolUtil.isNotEmpty(orderCrossCityWarpper.getPassengers()) ? orderCrossCityWarpper.getPassengers() : "GRJY" + String.valueOf(integer).substring(1));
            String nickName = ToolUtil.isNotEmpty(orderCrossCityWarpper.getPassengers()) ? orderCrossCityWarpper.getPassengers() : "GRJY" + String.valueOf(integer).substring(1);
            //调中台接口查询用户
            List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone);
            String onconUUID = null;
            if (null == infoByPhone || infoByPhone.isEmpty()) {
                RegisterViaMobileRequest request = new RegisterViaMobileRequest();
                request.setMobile(phone);
                request.setEncryptType("aesbase64");
                request.setPassword(AESUtils.encryptBase64("123456"));
                request.setNickname(nickName);
                request.setAppid(qianYunTongConfig.getAppid());
                RegisterViaMobile register = UserUtil.registerViaMobileNoCode(request);
                if (!"0".equals(register.getStatus())) {
                    return ResultUtil.error(register.getDesc());
                }
                onconUUID = register.getOnconUUID();
            }else{
                onconUUID = UserUtil.getOnconUUIDByMobile(phone);
            }
            userInfo = new UserInfo();
            userInfo.setNickName(nickName);
            userInfo.setName(orderCrossCityWarpper.getPassengers());
            userInfo.setPhone(orderCrossCityWarpper.getPassengersPhone());
            userInfo.setState(1);
            userInfo.setFlag(1);
            userInfo.setInsertTime(new Date());
            userInfo.setInsertUser(uid);
            userInfo.setOnconUUID(onconUUID);
            userInfoMapper.insert(userInfo);
        }
        orderCrossCity.setUserId(userInfo.getId());
DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/QianYunTongConfig.java
@@ -11,107 +11,210 @@
@Data
@Component
public class QianYunTongConfig {
    @Value("${spring.profiles.active}")
    private String activeProfile;
    /**
     * appkey
     */
    private String appkey;
    /**
     * 私钥地址
     */
    private String privateKeyPath;
    /**
     * 消费者账号
     */
    private String userName;
    /**
     * 状态
     * 1:生产环境
     * 2:测试环境
     */
    private String status;
    /**
     * API地址
     */
    private String apiUrl;
    /**
     * 桶名
     */
    private String bucketName;
    /**
     * 小程序appId
     */
    private String appId;
    /**
     * HOS的基础路径(公共前缀)
     */
    private String endPoint;
    /**
     * 账户的ID
     */
    private String account;
    /**
     * 向UAAS服务请求到的access_key
     */
    private String accessKey;
    /**
     * 向UAAS服务请求到的secret_key
     */
    private String secretKey;
    /**
     * 场景编号
     */
    String sceneId;
    public QianYunTongConfig getQianYunTongConfig() {
        if("dev".equals(activeProfile)){
            this.appkey = "10001104";
            this.privateKeyPath = "C:\\Users\\39373\\Desktop\\黔云通\\private_key_test.pem";
            this.userName = "xiaofei";
            this.status = "1";
            this.setApiUrl("https://test-zhongtai.stqcloud.com:10070");
            this.setBucketName("bucuTest0625");
            this.setAppId("wxcc3c9058e2b294db");
            this.setEndPoint("http://10.88.152.214:27731/v1");
            this.setAccount("1c2e41f0dcb411f0a0e9dbc62f2c3adc");
            this.setAccessKey("WIVX6PDNO2PJTRSM1J6B");
            this.setSecretKey("eEOceRq9gUCRFfez7jyBRU9AluYtb8OVFPmJlVMJ");
            this.sceneId = "1948289607125864448";
        }
        if("test".equals(activeProfile)){
            this.setAppkey("10001104");
            this.setPrivateKeyPath("/etraffic/server/private_key_test.pem");
            this.setUserName("xiaofei");
            this.setStatus("1");
            this.setApiUrl("https://test-zhongtai.stqcloud.com:10070");
            this.setBucketName("bucuTest0625");
            this.setAppId("wxcc3c9058e2b294db");
            this.setEndPoint("http://10.88.152.214:27731/v1");
            this.setAccount("1c2e41f0dcb411f0a0e9dbc62f2c3adc");
            this.setAccessKey("WIVX6PDNO2PJTRSM1J6B");
            this.setSecretKey("eEOceRq9gUCRFfez7jyBRU9AluYtb8OVFPmJlVMJ");
            this.sceneId = "1948289607125864448";
        }
        if("prod".equals(activeProfile)){
            this.setAppkey("10001104");
            this.setPrivateKeyPath("/etraffic/server/private_key.pem");
            this.setUserName("xiwang");
            this.setStatus("1");
            this.setApiUrl("http://jjzhongtai.stqcloud.com:10010");
            this.setBucketName("qyt20250702");
            this.setAppId("wxcc3c9058e2b294db");
            this.setEndPoint("http://10.30.52.45:27741/v1");
            this.setAccount("d8bef0a04db511f0b79d01a3e2b7587e");
            this.setAccessKey("TYMFTFD5SIIT15DCCUD7");
            this.setSecretKey("AoI1dkH3yoAvXoaQlREO3ed9mwQJFluLTliS9T1z");
            this.sceneId = "";
        }
        return this;
    }
    @Value("${spring.profiles.active}")
    private String activeProfile;
    /**
     * appkey
     */
    private String appkey;
    /**
     * appid
     */
    private String appid;
    /**
     * 私钥地址
     */
    private String privateKeyPath;
    /**
     * 消费者账号
     */
    private String userName;
    /**
     * 状态
     * 1:生产环境
     * 2:测试环境
     */
    private String status;
    /**
     * API地址
     */
    private String apiUrl;
    /**
     * 桶名
     */
    private String bucketName;
    /**
     * 小程序appId
     */
    private String appId;
    /**
     * HOS的基础路径(公共前缀)
     */
    private String endPoint;
    /**
     * 账户的ID
     */
    private String account;
    /**
     * 向UAAS服务请求到的access_key
     */
    private String accessKey;
    /**
     * 向UAAS服务请求到的secret_key
     */
    private String secretKey;
    public String getActiveProfile() {
        return activeProfile;
    }
    public void setActiveProfile(String activeProfile) {
        this.activeProfile = activeProfile;
    }
    public String getAppkey() {
        return appkey;
    }
    public void setAppkey(String appkey) {
        this.appkey = appkey;
    }
    public String getPrivateKeyPath() {
        return privateKeyPath;
    }
    public void setPrivateKeyPath(String privateKeyPath) {
        this.privateKeyPath = privateKeyPath;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getApiUrl() {
        return apiUrl;
    }
    public void setApiUrl(String apiUrl) {
        this.apiUrl = apiUrl;
    }
    public String getBucketName() {
        return bucketName;
    }
    public void setBucketName(String bucketName) {
        this.bucketName = bucketName;
    }
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getEndPoint() {
        return endPoint;
    }
    public void setEndPoint(String endPoint) {
        this.endPoint = endPoint;
    }
    public String getAccount() {
        return account;
    }
    public void setAccount(String account) {
        this.account = account;
    }
    public String getAccessKey() {
        return accessKey;
    }
    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }
    public String getSecretKey() {
        return secretKey;
    }
    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }
    public String getAppid() {
        return appid;
    }
    public void setAppid(String appid) {
        this.appid = appid;
    }
    public QianYunTongConfig getQianYunTongConfig() {
        if("dev".equals(activeProfile)){
            this.appkey = "10001104";
            this.appId = "yx_8vlsvdfxgtcufjx8";
            this.privateKeyPath = "E:\\项目文档\\黔云通\\private_key_test.pem";
            this.userName = "xiaofei";
            this.status = "1";
            this.setApiUrl("https://test-zhongtai.stqcloud.com:10070");
            this.setBucketName("bucuTest0625");
            this.setAppId("wxcc3c9058e2b294db");
            this.setEndPoint("http://10.88.152.214:27731/v1");
            this.setAccount("1c2e41f0dcb411f0a0e9dbc62f2c3adc");
            this.setAccessKey("WIVX6PDNO2PJTRSM1J6B");
            this.setSecretKey("eEOceRq9gUCRFfez7jyBRU9AluYtb8OVFPmJlVMJ");
        }
        if("test".equals(activeProfile)){
            this.setAppkey("10001104");
            this.appid = "yx_8vlsvdfxgtcufjx8";
            this.setPrivateKeyPath("/etraffic/server/private_key_test.pem");
            this.setUserName("xiaofei");
            this.setStatus("1");
            this.setApiUrl("https://test-zhongtai.stqcloud.com:10070");
            this.setBucketName("bucuTest0625");
            this.setAppId("wxcc3c9058e2b294db");
            this.setEndPoint("http://10.88.152.214:27731/v1");
            this.setAccount("1c2e41f0dcb411f0a0e9dbc62f2c3adc");
            this.setAccessKey("WIVX6PDNO2PJTRSM1J6B");
            this.setSecretKey("eEOceRq9gUCRFfez7jyBRU9AluYtb8OVFPmJlVMJ");
        }
        if("prod".equals(activeProfile)){
            this.setAppkey("10001104");
            this.appid = "yx_mdkrc2i9jcyvaggi";
            this.setPrivateKeyPath("/etraffic/server/private_key.pem");
            this.setUserName("xiwang");
            this.setStatus("1");
            this.setApiUrl("http://jjzhongtai.stqcloud.com:10010");
            this.setBucketName("qyt20250702");
            this.setAppId("wxcc3c9058e2b294db");
            this.setEndPoint("http://10.30.52.45:27741/v1");
            this.setAccount("d8bef0a04db511f0b79d01a3e2b7587e");
            this.setAccessKey("TYMFTFD5SIIT15DCCUD7");
            this.setSecretKey("AoI1dkH3yoAvXoaQlREO3ed9mwQJFluLTliS9T1z");
        }
        return this;
    }
    
}
DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/UserUtil.java
@@ -120,6 +120,56 @@
        }
        return jsonObject.getObject("object", RegisterViaMobile.class);
    }
    /**
     * 根据手机号注册用户
     *
     * @param request
     * @return
     */
    public static RegisterViaMobile registerViaMobileNoCode(RegisterViaMobileRequest request) {
        //请求路径
        String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/m1_register_via_mobile";
        //私钥文件
        String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath();
        //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密
        String appKey = qianYunTongConfig.getAppkey();//appkey
        Map<String, String> headers = new HashMap<>();
        headers.put("Content-Type", "application/json");
        Map<String, Object> contentMap = new HashMap<String, Object>();
        Date nowdate = new Date();
        SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss");
        String timeStamp = date.format(nowdate);
        String messageId = UUID.randomUUID().toString().replaceAll("-", "");
        contentMap.put(SystemParameterNames.getAppKey(), appKey);
        contentMap.put(SystemParameterNames.getMessage_id(), messageId);
        contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName());
        contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus());
        contentMap.put("content", new Gson().toJson(request));
        log.info("【根据手机号注册用户】请求地址:" + url);
        log.info("【根据手机号注册用户】请求参数:" + JSON.toJSONString(contentMap));
        String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap);
        log.info("【根据手机号注册用户】请求结果:" + result);
        JSONObject jsonObject = JSON.parseObject(result);
        String retCode = jsonObject.getString("retCode");
        if (!"0".equals(retCode)) {
            log.error("【根据手机号注册用户】请求失败:" + result);
            throw new RuntimeException("【根据手机号注册用户】请求失败:" + result);
        }
        JSONObject object = jsonObject.getJSONObject("object");
        String status = object.getString("status");
        if (!"0".equals(status)) {
            log.error("【根据手机号注册用户】失败:" + object.toJSONString());
            throw new RuntimeException("【根据手机号注册用户】失败:" + object.toJSONString());
        }
        return jsonObject.getObject("object", RegisterViaMobile.class);
    }
    
    
    /**
@@ -271,7 +321,55 @@
        }
        return list;
    }
    /**
     * 根据手机号码获取易信uuid
     * @param mobile
     * @return
     */
    public static String getOnconUUIDByMobile(String mobile) {
        //请求路径
        String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/getOnconUUIDByMobile";
        //私钥文件
        String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath();
        //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密
        String appKey = qianYunTongConfig.getAppkey();//appkey
        Map<String, String> headers = new HashMap<>();
        headers.put("Content-Type", "application/json");
        Map<String, Object> contentMap = new HashMap<String, Object>();
        Date nowdate = new Date();
        SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss");
        String timeStamp = date.format(nowdate);
        String messageId = UUID.randomUUID().toString().replaceAll("-", "");
        contentMap.put(SystemParameterNames.getAppKey(), appKey);
        contentMap.put(SystemParameterNames.getMessage_id(), messageId);
        contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName());
        contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus());
        Map<String, String> map = new HashMap<>();
        map.put("mobile", mobile);
        contentMap.put("content", JSON.toJSONString(map));
        log.info("【根据手机号码获取易信uuid】请求地址:" + url);
        log.info("【根据手机号码获取易信uuid】请求参数:" + JSON.toJSONString(contentMap));
        String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap);
        log.info("【根据手机号码获取易信uuid】请求结果:" + result);
        JSONObject jsonObject = JSON.parseObject(result);
        String retCode = jsonObject.getString("retCode");
        if (!"0".equals(retCode)) {
            log.error("【根据手机号码获取易信uuid】请求失败:" + result);
            throw new RuntimeException("【根据手机号码获取易信uuid】请求失败:" + result);
        }
        JSONObject object = jsonObject.getJSONObject("object");
        Integer status = object.getInteger("status");
        if(0 != status){
            log.error("【身份证实名认证】请求失败:" + object.getString("desc"));
            throw new RuntimeException("【身份证实名认证】请求失败:" + object.getString("desc"));
        }
        return object.getString("onconUUID");
    }
    
    /**
     * 实名认证
DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/model/RegisterViaMobileRequest.java
@@ -8,39 +8,42 @@
 */
@Data
public class RegisterViaMobileRequest {
    /**
     * 手机号码
     */
    private String mobile;
    /**
     * 客户端appid
     */
    private String appId;
    /**
     * 用户密码
     */
    private String password;
    /**
     * 短信验证码
     */
    private String verify_code;
    /**
     * 验证码类型
     * 0:短信发送的验证码;1:一键获取手机号返回注册验证码;2、验证码验证成功后生成的Ticket
     */
    private String verify_code_type;
    /**
     * 加密类型
     * 第三方系统可以填写空
     */
    private String encryptType;
    /**
     * 用户类型
     * 0:普通用户
     */
    private String user_type;
    /**
     * 昵称
     */
    private String nickname;
    /**
     * 手机号码
     */
    private String mobile;
    /**
     */
    private String appid;
    /**
     * 客户端appid
     */
    private String appId;
    /**
     * 用户密码
     */
    private String password;
    /**
     * 短信验证码
     */
    private String verify_code;
    /**
     * 验证码类型
     * 0:短信发送的验证码;1:一键获取手机号返回注册验证码;2、验证码验证成功后生成的Ticket
     */
    private String verify_code_type;
    /**
     * 加密类型
     * 第三方系统可以填写空
     */
    private String encryptType;
    /**
     * 用户类型
     * 0:普通用户
     */
    private String user_type;
    /**
     * 昵称
     */
    private String nickname;
}