pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml
@@ -5,8 +5,8 @@ #name: ym type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver # url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull # url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull username: root password: dysql,;.abc!@# druid: pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml
@@ -21,7 +21,8 @@ <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <!--@mbg.generated--> select <include refid="Base_Column_List" /> <!-- <include refid="Base_Column_List" />--> * from se_virtual_card where id = #{id,jdbcType=BIGINT} </select> pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml
@@ -40,6 +40,12 @@ <optional>true</optional> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.1</version> </dependency> <!--OkHttp--> <dependency> <groupId>com.squareup.okhttp3</groupId> pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java
@@ -513,6 +513,7 @@ String sessionKey = job.getString("session_key"); Long clientId = clientSv.getClientIdByPhone(phoneNumber); String SessionId = ""; if(clientId != null) { // 添加微信用户账户记录 SeOpenId seOpenId = new SeOpenId(); @@ -520,7 +521,11 @@ seOpenId.setOpenId(openid); seOpenId.setSessionKey(sessionKey); seOpenId.setCreateTime(new Date()); Long SessionId = clientSv.addOpenId(seOpenId); //Long SessionId = clientSv.addOpenId(seOpenId); Long rec = clientSv.addOpenId(seOpenId); if(rec != null) { SessionId = String.valueOf(rec); } return BaseResponseUtils.buildSuccess(SessionId); } else { pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientSv.java
@@ -174,7 +174,8 @@ */ public Long addOpenId(SeOpenId po) { seOpenIdMapper.insert(po); return po.getClientId(); //return po.getClientId(); return po.getId(); } /** pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java
@@ -18,6 +18,7 @@ import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM; import com.dy.pipIrrSell.virtualCard.enums.RefundItemStateENUM; import com.dy.pipIrrSell.wallet.enums.RefundStatusENUM; import com.dy.pipIrrSell.wechatpay.dto.Code2Session; import com.dy.pipIrrSell.wechatpay.dto.DtoOrder; import com.dy.pipIrrSell.wechatpay.dto.NotifyResource; import com.dy.pipIrrSell.wechatpay.dto.OrderNotify; @@ -73,6 +74,7 @@ private final String privateCertFileName = PayInfo.privateCertFileName; private final String appid = PayInfo.appid; private final String secret = PayInfo.secret; private final String mchid = PayInfo.mchid; private final String schema = PayInfo.schema; private final String signType = PayInfo.signType; @@ -83,6 +85,68 @@ // 平台证书公钥 private final Map CERTIFICATE_MAP = new HashMap(); /** * 登录凭证校验,农户绑定账号逻辑包含登录凭证校验,此接口作废 * @param code2Session 登录凭证校验传入对象 * @param bindingResult * @return * @throws Exception */ @Operation(summary = "登录凭证校验", description = "登录凭证校验") @ApiResponses(value = { @ApiResponse( responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, description = "操作结果:true:成功,false:失败(BaseResponse.content)", content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = Boolean.class))} ) }) @PostMapping(path = "getSessionId") @Transactional(rollbackFor = Exception.class) @SsoAop() public BaseResponse<Boolean> getSessionId(@RequestBody @Valid Code2Session code2Session, BindingResult bindingResult) throws Exception { if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } String phoneNumber = code2Session.getPhoneNumber(); String jsCode = code2Session.getJs_code(); Map<String, Object> queryParams = new HashMap<>(); queryParams.put("appid", appid); queryParams.put("secret", secret); queryParams.put("js_code", jsCode); queryParams.put("grant_type", grantType); Map<String, String> headerParams = new HashMap<>(); JSONObject job = restTemplateUtil.get(loginUrl, queryParams, headerParams); if(job.getLong("errcode") != null && job.getLong("errcode") >= -1) { return BaseResponseUtils.buildFail("登录凭证校验失败"); } String openid = job.getString("openid"); String sessionKey = job.getString("session_key"); Long clientId = clientSv.getClientIdByPhone(phoneNumber); String SessionId = ""; if(clientId != null) { // 添加微信用户账户记录 SeOpenId seOpenId = new SeOpenId(); seOpenId.setClientId(clientId); seOpenId.setOpenId(openid); seOpenId.setSessionKey(sessionKey); seOpenId.setCreateTime(new Date()); Long rec = clientSv.addOpenId(seOpenId); if(rec != null) { SessionId = String.valueOf(rec); } return BaseResponseUtils.buildSuccess(SessionId); } else { return BaseResponseUtils.buildError(SellResultCode.PHONE_NUMBER_IS_ERROR.getMessage()); } } /** * 下载微信支付平台证书 测试完废除 @@ -221,6 +285,7 @@ if(job_result == null) { return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_ADD_FAIL.getMessage()); } return BaseResponseUtils.buildSuccess(job_result) ; } pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Code2Session.java
@@ -36,4 +36,10 @@ @Schema(description = "js_code", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @NotBlank(message = "js_code不能为空") private String js_code; /** * 手机号 */ @NotBlank(message = "手机号不能为空") private String phoneNumber; }