| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.bouncycastle</groupId> |
| | | <artifactId>bcprov-jdk15on</artifactId> |
| | | <version>1.70</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | @Override |
| | | public ResultUtil updateDriver(RegisteredWarpper registeredWarpper, Integer uid) throws Exception { |
| | | Driver driver = this.selectById(uid); |
| | | //调用中台接口校验实名信息 |
| | | Boolean auth = UserUtil.idCardAuth(registeredWarpper.getName(), registeredWarpper.getIdCard()); |
| | | if(!auth){ |
| | | return ResultUtil.error("实名认证失败,请输入正确的姓名和身份证号码"); |
| | | } |
| | | driver.setName(registeredWarpper.getName()); |
| | | driver.setSex(registeredWarpper.getSex()); |
| | | driver.setIdCard(registeredWarpper.getIdCard()); |
| | |
| | | boolean b = true; |
| | | for(String t : split){ |
| | | for(DriverService driverService : list){ |
| | | if(driverService.getType() == Integer.valueOf(t)){ |
| | | if(driverService.getType().equals(Integer.valueOf(t))){ |
| | | b = false; |
| | | break; |
| | | } |
| | |
| | | StaffNodeInfo staffNodeInfo = object.getObject("data", StaffNodeInfo.class); |
| | | return staffNodeInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建账号-同步证联开户信息 |
| | | * @param request |
| | | * @return 状态 0 成功 其他失败 |
| | | */ |
| | | public static Integer addAccountInfo(AddAccountInfoRequest request){ |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/addAccountInfo"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//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(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | 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 resCode = jsonObject.getString("resCode"); |
| | | if (!"000000".equals(resCode)) { |
| | | log.error("【创建账号-同步证联开户信息】请求失败:" + jsonObject.getString("resMsg")); |
| | | return -1; |
| | | } |
| | | return jsonObject.getInteger("status"); |
| | | } |
| | | } |
| | |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 实名认证 |
| | | * @param realName |
| | | * @param cardNo |
| | | * @return |
| | | */ |
| | | public static Boolean idCardAuth(String realName, String cardNo) { |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/idCardAuth"; |
| | | //私钥文件 |
| | | 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("realName", realName); |
| | | map.put("cardNo", cardNo); |
| | | contentMap.put("content", JSON.toJSONString(map)); |
| | | 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); |
| | | return null; |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【身份证实名认证】失败:" + object.toJSONString()); |
| | | return null; |
| | | } |
| | | JSONArray data = object.getJSONArray("data"); |
| | | return true; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/24 18:45 |
| | | */ |
| | | @Data |
| | | public class AddAccountInfoRequest { |
| | | /** |
| | | * 易信编号 |
| | | * (个人帐号传onconuuid, |
| | | * 企业帐号传企业编号) |
| | | */ |
| | | private String custId; |
| | | /** |
| | | * 帐号编号 |
| | | */ |
| | | private String accountNo; |
| | | /** |
| | | * 帐户名称 |
| | | */ |
| | | private String accountName; |
| | | /** |
| | | * 租户标识: 黔南-522700 |
| | | */ |
| | | private String partnerId; |
| | | /** |
| | | * 场景编号:网约车-100 |
| | | */ |
| | | private String industryCode; |
| | | /** |
| | | * 支付方式: 501101 |
| | | */ |
| | | private String payModeId; |
| | | /** |
| | | * 支付模式: APP |
| | | */ |
| | | private String accessMode; |
| | | /** |
| | | * 司机手机号 |
| | | */ |
| | | private String mobile; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian; |
| | | |
| | | import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| | | |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.KeyGenerator; |
| | | import javax.crypto.SecretKey; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.Security; |
| | | import java.util.Base64; |
| | | |
| | | /** |
| | | * SM4国密工具类 |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/24 15:29 |
| | | */ |
| | | public class SM4Util { |
| | | private static final String ALGORITHM_NAME = "SM4"; |
| | | |
| | | private static final String ALGORITHM_MODE = "SM4/ECB/PKCS5Padding"; |
| | | |
| | | |
| | | static { |
| | | Security.addProvider(new BouncyCastleProvider()); |
| | | } |
| | | |
| | | /** |
| | | * 生成 SM4 密钥 |
| | | * @return 密钥的 Base64 编码字符串 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static String generateKey() throws Exception { |
| | | KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM_NAME, "BC"); |
| | | kg.init(128); |
| | | SecretKey secretKey = kg.generateKey(); |
| | | return Base64.getEncoder().encodeToString(secretKey.getEncoded()); |
| | | } |
| | | |
| | | /** |
| | | * SM4 加密 |
| | | * @param plainText 明文 |
| | | * @param key 密钥的 Base64 编码字符串 |
| | | * @return 密文的 Base64 编码字符串 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static String encrypt(String plainText, String key) throws Exception { |
| | | byte[] keyBytes = Base64.getDecoder().decode(key); |
| | | SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, ALGORITHM_NAME); |
| | | Cipher cipher = Cipher.getInstance(ALGORITHM_MODE, "BC"); |
| | | cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec); |
| | | byte[] encryptedBytes = cipher.doFinal(plainText.getBytes(StandardCharsets.UTF_8)); |
| | | return Base64.getEncoder().encodeToString(encryptedBytes); |
| | | } |
| | | |
| | | /** |
| | | * SM4 解密 |
| | | * @param cipherText 密文的 Base64 编码字符串 |
| | | * @param key 密钥的 Base64 编码字符串 |
| | | * @return 明文 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static String decrypt(String cipherText, String key) throws Exception { |
| | | byte[] keyBytes = Base64.getDecoder().decode(key); |
| | | SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, ALGORITHM_NAME); |
| | | Cipher cipher = Cipher.getInstance(ALGORITHM_MODE, "BC"); |
| | | cipher.init(Cipher.DECRYPT_MODE, secretKeySpec); |
| | | byte[] cipherBytes = Base64.getDecoder().decode(cipherText); |
| | | byte[] decryptedBytes = cipher.doFinal(cipherBytes); |
| | | return new String(decryptedBytes, StandardCharsets.UTF_8); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | // 生成密钥 |
| | | String key = generateKey(); |
| | | System.out.println("生成的密钥: " + key); |
| | | |
| | | // 明文 |
| | | String plainText = "Hello, SM4!"; |
| | | System.out.println("明文: " + plainText); |
| | | |
| | | // 加密 |
| | | String cipherText = encrypt(plainText, key); |
| | | System.out.println("密文: " + cipherText); |
| | | |
| | | // 解密 |
| | | String decryptedText = decrypt(cipherText, key); |
| | | System.out.println("解密后的明文: " + decryptedText); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.stylefeng.guns.modular.system.util.SpringContextsUtil; |
| | | import com.stylefeng.guns.modular.system.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.TokenRequest; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/24 14:06 |
| | | */ |
| | | public class TokenUtil { |
| | | |
| | | private static ZhengLianConfig zhengLianConfig = SpringContextsUtil.getBean(ZhengLianConfig.class).getZhengLianConfig(); |
| | | |
| | | |
| | | |
| | | public static void getToken(TokenRequest request){ |
| | | request.setAppid(zhengLianConfig.getAppid()); |
| | | HttpRequest post = HttpUtil.createPost(zhengLianConfig.getUrl()); |
| | | String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); |
| | | post.header("msgId", UUIDUtil.getRandomCode()); |
| | | post.header("merchNo", zhengLianConfig.getMerchNo()); |
| | | post.header("txCode","ZLPAY.ACC.T0001"); |
| | | post.header("version","1.0.1"); |
| | | post.header("encrp","1"); |
| | | post.header("signa","1"); |
| | | post.header("encrpNo","123456"); |
| | | post.header("signNo","123456"); |
| | | post.header("timestamp", timestamp); |
| | | post.header("Content-Length", ""); |
| | | post.header("Content-Type", "application/json;charset=utf-8"); |
| | | |
| | | |
| | | |
| | | post.body("{}"); |
| | | |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/8 11:31 |
| | | */ |
| | | @Data |
| | | @Component |
| | | public class ZhengLianConfig { |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String activeProfile; |
| | | /** |
| | | * 接口地址 |
| | | */ |
| | | private String url; |
| | | /** |
| | | * appid |
| | | */ |
| | | private String appid; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | private String merchNo; |
| | | /** |
| | | * 加密证书序列号 |
| | | */ |
| | | private String encrpNo; |
| | | /** |
| | | * 签名证书序列号 |
| | | */ |
| | | private String signNo; |
| | | |
| | | /** |
| | | * 获取不同环境的配置 |
| | | * @return |
| | | */ |
| | | public ZhengLianConfig getZhengLianConfig() { |
| | | if("dev".equals(activeProfile)){ |
| | | this.url = "https://gatewaytest.zqpay.com"; |
| | | this.appid = "F9BFEEA567196A92E053376010ACF004"; |
| | | this.merchNo = "B00000871"; |
| | | this.encrpNo = "123456"; |
| | | this.signNo = "123456"; |
| | | } |
| | | if("test".equals(activeProfile)){ |
| | | this.url = "https://gatewaytest.zqpay.com"; |
| | | this.appid = "F9BFEEA567196A92E053376010ACF004"; |
| | | this.merchNo = "B00000871"; |
| | | this.encrpNo = "123456"; |
| | | this.signNo = "123456"; |
| | | } |
| | | if("prod".equals(activeProfile)){ |
| | | this.url = "https://gateway.zqpay.com"; |
| | | this.appid = ""; |
| | | this.merchNo = ""; |
| | | this.encrpNo = ""; |
| | | this.signNo = ""; |
| | | } |
| | | return this; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/24 15:06 |
| | | */ |
| | | @Data |
| | | public class TokenRequest { |
| | | /** |
| | | * 应用appid |
| | | */ |
| | | private String appid; |
| | | /** |
| | | * APP 端用户唯一标识 |
| | | */ |
| | | private String appUserId; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String userName; |
| | | /** |
| | | * 证件号码 |
| | | */ |
| | | private String certNo; |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 访问类型 |
| | | * 01 证联收银台支付 |
| | | * 04 HOME 页 |
| | | * 06 申请免密签约 |
| | | * 07 商户收银台支付 |
| | | * 08 开户(绑卡) |
| | | * 09 开通支付账户 |
| | | * 10 打开付款码 |
| | | */ |
| | | private String type; |
| | | /** |
| | | * 终端信息域 |
| | | */ |
| | | private TradeTerminalInfo tradeTerminalInfo; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/24 15:10 |
| | | */ |
| | | @Data |
| | | public class TradeTerminalInfo { |
| | | /** |
| | | * 用于标识交易设 备 公 网 IP地 址 |
| | | */ |
| | | private String ip; |
| | | /** |
| | | * 终端类型: |
| | | * 0:web |
| | | * 1:ANDROID |
| | | * 2:IOS |
| | | * 3:其它 |
| | | */ |
| | | private String terminal; |
| | | /** |
| | | * 用于标识交易设备 MAC 地址 |
| | | */ |
| | | private String mac; |
| | | } |
| | |
| | | @RequestMapping(value = "/logout", method = RequestMethod.GET) |
| | | public String logOut(HttpServletRequest request) { |
| | | request.getSession().invalidate(); |
| | | HttpUtil.get("https://passport.teamshub.com/logout?logouturl=https%3A%2F%2Fsso.teamshub.com%2Flogout%3F%0Alogoutat%3Dhttps%253A%252F%252Ftraffic.qytzt.cn%253A443%252F"); |
| | | HttpUtil.get("https://passport.teamshub.com/logout?logouturl=https%3A%2F%2Fsso.teamshub.com%2Flogout%3Flogoutat%3Dhttps%253A%252F%252Ftraffic.qytzt.cn%253A443%252F"); |
| | | return REDIRECT + "/"; |
| | | } |
| | | |
| | |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | <a href="https://passport.teamshub.com/logout?logouturl=https%3A%2F%2Fsso.teamshub.com%2Flogout%3F%0Alogoutat%3Dhttps%253A%252F%252Ftraffic.qytzt.cn%253A443%252F" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a> |
| | | <a class="roll-nav roll-right J_tabExit" href="https://passport.teamshub.com/logout?logouturl=https%3A%2F%2Fsso.teamshub.com%2Flogout%3Flogoutat%3Dhttps%253A%252F%252Ftraffic.qytzt.cn%253A443%252F"><i class="fa fa fa-sign-out"></i> 退出</a> |
| | | </div> |
| | | <div class="row J_mainContent" id="content-main"> |
| | | <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="${ctxPath}/blackboard?type=${type}" frameborder="0" data-id="${ctxPath}/blackboard" seamless></iframe> |
| | |
| | | <li><a class="J_menuItem" href="${ctxPath}/mgr/user_info">个人资料</a></li> |
| | | <li><a class="J_menuItem" href="${ctxPath}/mgr/user_chpwd">修改密码</a></li> |
| | | <li class="divider"></li> |
| | | <li><a href="https://passport.teamshub.com/logout?logouturl=https%3A%2F%2Fsso.teamshub.com%2Flogout%3F%0Alogoutat%3Dhttps%253A%252F%252Ftraffic.qytzt.cn%253A443%252F">安全退出</a> |
| | | <li><a href="https://passport.teamshub.com/logout?logouturl=https%3A%2F%2Fsso.teamshub.com%2Flogout%3Flogoutat%3Dhttps%253A%252F%252Ftraffic.qytzt.cn%253A443%252F">安全退出</a> |
| | | </li> |
| | | </ul> |
| | | </div> |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | // public void cloudPay(String total_fee,String transaction_id,int type) { |
| | | // if(type==1){ |
| | | // BigDecimal divide = new BigDecimal(total_fee).divide(new BigDecimal(100)); |
| | | // total_fee=divide.toString(); |
| | | // } |
| | | // Company company = companyService.selectOne(new EntityWrapper<Company>() |
| | | // .eq("type", 1) |
| | | // .last("LIMIT 1")); |
| | | // // 查询平台开户信息 |
| | | // TEnterpriseWithdrawal enterpriseWithdrawal = enterpriseWithdrawalService.selectOne(new EntityWrapper<TEnterpriseWithdrawal>() |
| | | // .eq("companyId", company.getId())); |
| | | // DepositReq depositReq = new DepositReq(); |
| | | // depositReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | // depositReq.setTotalAmount(new BigDecimal(total_fee).multiply(new BigDecimal(100)).intValue()); // 总金额 |
| | | // depositReq.setAmount(new BigDecimal(total_fee).multiply(new BigDecimal(100)).intValue()); // 支付金额 |
| | | // depositReq.setDiscountAmount(0); // 优惠金额 |
| | | // depositReq.setBalanceAcctId(enterpriseWithdrawal.getBalanceAcctId()); |
| | | // depositReq.setDepositType("1"); |
| | | // depositReq.setPaymentType(PaymentTypeEnum.CUP_APP.getCode()); |
| | | // depositReq.setPaymentTradeNo(transaction_id); // 系统交易流水号 |
| | | // depositReq.setPaymentSucceededAt(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date())); |
| | | // depositReq.setOrderNo(transaction_id); |
| | | // depositReq.setOrderAmount(new BigDecimal(total_fee).multiply(new BigDecimal(100)).longValue()); |
| | | // depositReq.setProductName("用户支付充值"); |
| | | // depositReq.setProductCount(1); |
| | | // |
| | | // try { |
| | | // DepositResp depositResp = DepositExample.create(depositReq); |
| | | // System.err.println(depositResp); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |