瀏覽代碼

测试服

花田厝 8 月之前
父節點
當前提交
b7c0914010

+ 5 - 1
jsjp-admin/src/main/java/com/miaxis/app/controller/tms/TmsStudentInfoController.java

@@ -7,6 +7,7 @@ import com.miaxis.common.constant.Constants;
 import com.miaxis.common.core.controller.BaseController;
 import com.miaxis.common.core.domain.Response;
 import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.newgzpt.service.IGzptUserInfoService;
 import com.miaxis.tms.dto.*;
 import com.miaxis.tms.service.ITmsStudentInfoService;
 import com.miaxis.tms.vo.*;
@@ -43,7 +44,8 @@ public class TmsStudentInfoController extends BaseController {
     @Autowired
     private ICoachManySchoolService coachManySchoolService;
 
-
+    @Autowired
+    private IGzptUserInfoService gzptUserInfoService;
     /**
      * 查询我的学员信息列表(查询用)
      */
@@ -234,6 +236,8 @@ public class TmsStudentInfoController extends BaseController {
     @GetMapping("/updateStudentAppCoachIdById")
     @ApiOperation("根据学员ID绑定APP教练员")
     public Response updateStuAppCoachIdById(TmsStudentInfoQrDTO studentInfoQrDTO) {
+        //修改公众平台绑定字段
+        gzptUserInfoService.updateUserBindCoach(studentInfoQrDTO.getId());
         return Response.success(studentInfoService.upStuAppCoachIdById(studentInfoQrDTO));
     }
 

+ 262 - 43
jsjp-admin/src/main/java/com/miaxis/app/controller/wx/WxJsjpController.java

@@ -3,13 +3,18 @@ package com.miaxis.app.controller.wx;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.miaxis.common.config.AppConfig;
 import com.miaxis.common.config.WxpayConfig;
 import com.miaxis.common.constant.Constants;
 import com.miaxis.common.core.controller.BaseController;
 import com.miaxis.common.core.domain.Response;
 import com.miaxis.common.core.domain.entity.SysDictData;
+import com.miaxis.common.core.domain.entity.UserInfo;
 import com.miaxis.common.enums.OrderStatusEnum;
 import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.SecurityUtils;
+import com.miaxis.common.utils.ServletUtils;
+import com.miaxis.common.utils.ip.IpUtils;
 import com.miaxis.common.utils.uuid.CommonUtils;
 import com.miaxis.exam.domain.ExamInfo;
 import com.miaxis.exam.service.IExamInfoService;
@@ -21,9 +26,15 @@ import com.miaxis.newgzpt.service.IGzptSchPayConfigService;
 import com.miaxis.newgzpt.service.IGzptUserInfoService;
 import com.miaxis.system.service.ISysDictDataService;
 import com.miaxis.wx.domain.WxJsOrder;
+import com.miaxis.wx.domain.WxOrder;
 import com.miaxis.wx.dto.WxOrderDTO;
 import com.miaxis.wx.dto.WxOrderGoodsDTO;
 import com.miaxis.wx.service.IWxJsOrderService;
+import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
+import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier;
+import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
+import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials;
+import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.Data;
@@ -45,6 +56,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.IOException;
 import java.security.PrivateKey;
 import java.security.Signature;
 import java.util.Base64;
@@ -60,7 +72,7 @@ import static com.miaxis.common.utils.OrderCodeFactory.getOrderCode;
  */
 @RestController
 @RequiredArgsConstructor
-@RequestMapping(Constants.OPEN_PREFIX+"/wxjs")
+@RequestMapping(Constants.OPEN_PREFIX + "/wxjs")
 @Api(tags = {"【APP-微信支付】"})
 @Slf4j
 public class WxJsjpController extends BaseController {
@@ -77,10 +89,9 @@ public class WxJsjpController extends BaseController {
     @Autowired
     private ISysDictDataService dictDataService;
 
-    @Value("${app.appid}")
-    private String appid;
-    @Value("${wxpay.notifyUrl}")
-    private  String notifyUrl ;
+
+    @Autowired
+    private AppConfig appConfig;
 
     @Autowired
     private IGzptUserInfoService userInfoService;
@@ -103,7 +114,7 @@ public class WxJsjpController extends BaseController {
      */
     @PostMapping(value = "/prepareOrder")
     @ApiOperation("极速驾培微信下单")
-    public Response<WxParamEntity> getPrepareOrder(@RequestBody WxOrderDTO wxOrderDTO) throws Exception{
+    public Response<WxParamEntity> getPrepareOrder(@RequestBody WxOrderDTO wxOrderDTO) throws Exception {
         SysDictData sysDictData = dictDataService.selectDictDataById(wxOrderDTO.getDictCode());
         String[] values = sysDictData.getDictValue().split(",");
 
@@ -130,28 +141,43 @@ public class WxJsjpController extends BaseController {
         order.setIsShare(isShare);
         order.setCreateId(gzptUserInfo.getOutCreateId());
 
-        Double price = Double.parseDouble(values[0])*100;   //订单总额
-        int b =  new Double(price).intValue();
+        Double price = Double.parseDouble(values[0]) * 100;   //订单总额
+        int b = new Double(price).intValue();
         order.setTotal(b);
 
-        if(isShare==1) {
-            //如果是合作驾校
-            if (wxOrderDTO.getPhoneType()!=null && wxOrderDTO.getPhoneType()==1) { //苹果
-                int priceApple = Integer.parseInt(values[3]);   //订单总额
-                order.setSchoolCommission(priceApple);
-            } else if (wxOrderDTO.getPhoneType()!=null && wxOrderDTO.getPhoneType()==2) { //安卓
-                int priceAndroid = Integer.parseInt(values[2]);   //订单总额
-                order.setSchoolCommission(priceAndroid);
+        if (isShare == 1) {
+            //营口学员已绑定教练员
+            if ("2108".equals(gzptUserInfo.getCity()) && gzptUserInfo.getIsBindCoach() == 1) {
+                //如果是合作驾校
+                if (wxOrderDTO.getPhoneType() != null && wxOrderDTO.getPhoneType() == 1) { //苹果
+                    int priceApple = Integer.parseInt(values[3]);   //订单总额
+                    order.setSchoolCommission(priceApple);
+                } else if (wxOrderDTO.getPhoneType() != null && wxOrderDTO.getPhoneType() == 2) { //安卓
+                    int priceAndroid = Integer.parseInt(values[2]);   //订单总额
+                    order.setSchoolCommission(priceAndroid);
+                }
+            }
+            //非营口只判断有合作
+            if (!"2108".equals(gzptUserInfo.getCity())) {
+                //如果是合作驾校
+                if (wxOrderDTO.getPhoneType() != null && wxOrderDTO.getPhoneType() == 1) { //苹果
+                    int priceApple = Integer.parseInt(values[3]);   //订单总额
+                    order.setSchoolCommission(priceApple);
+                } else if (wxOrderDTO.getPhoneType() != null && wxOrderDTO.getPhoneType() == 2) { //安卓
+                    int priceAndroid = Integer.parseInt(values[2]);   //订单总额
+                    order.setSchoolCommission(priceAndroid);
+                }
             }
+
         }
 
 
-       if(sysDictData.getDictLabel().indexOf("计时")!=-1){
-           int isActiva = schActivationService.isSchActivation(gzptUserInfo.getOutId());
-           if(isActiva==1){
-               throw new CustomException("该学员已激活,请退出APP后再重新获取套餐");
-           }
-       }
+        if (sysDictData.getDictLabel().indexOf("计时") != -1) {
+            int isActiva = schActivationService.isSchActivation(gzptUserInfo.getOutId());
+            if (isActiva == 1) {
+                throw new CustomException("该学员已激活,请退出APP后再重新获取套餐");
+            }
+        }
 
         order.setOrderStatus(OrderStatusEnum.PROCESSING.getCode());
         wxJsOrderService.save(order);
@@ -164,15 +190,15 @@ public class WxJsjpController extends BaseController {
      */
     @PostMapping(value = "/getPrepareGoodsOrder")
     @ApiOperation("微信商品下单")
-    public Response<WxParamEntity> getPrepareGoodsOrder(@RequestBody WxOrderGoodsDTO wxOrderGoodsDTO) throws Exception{
-        if(wxOrderGoodsDTO.getGoodsType()==2) {
+    public Response<WxParamEntity> getPrepareGoodsOrder(@RequestBody WxOrderGoodsDTO wxOrderGoodsDTO) throws Exception {
+        if (wxOrderGoodsDTO.getGoodsType() == 2) {
             GzptUserInfo gzptUserInfo = userInfoService.getInfoById(wxOrderGoodsDTO.getUserId());
 
             VipUserExam vipUserExam = vipUserExamService.getUserExamByUserIdAndGoodsId(wxOrderGoodsDTO.getUserId(), wxOrderGoodsDTO.getGoodsId());
             if (vipUserExam != null) {
                 Date expirationTime = vipUserExam.getExpirationTime();
                 Date now = new Date();
-                if (expirationTime != null && now.compareTo(expirationTime)<0) {
+                if (expirationTime != null && now.compareTo(expirationTime) < 0) {
                     throw new CustomException("您已购买过该考场,退回上个页面,重新进入。");
                 }
             }
@@ -198,7 +224,7 @@ public class WxJsjpController extends BaseController {
             order.setOrderStatus(OrderStatusEnum.PROCESSING.getCode());
             wxJsOrderService.save(order);
             return Response.success(placeWxOrder(order, examInfo.getName()));
-        } else if (wxOrderGoodsDTO.getGoodsType()==3) {
+        } else if (wxOrderGoodsDTO.getGoodsType() == 3) {
             throw new CustomException("请正确传入GoodsType,GoodsType=2未开发");
         } else {
             throw new CustomException("请正确传入GoodsType。");
@@ -209,70 +235,71 @@ public class WxJsjpController extends BaseController {
 
     //下单
     private WxParamEntity placeWxOrder(WxJsOrder order, String goodsName) throws Exception {
-        HttpPost httpPost = initHttpPost();
+        HttpPost httpPost = initHttpPost(wxpayConfig.getV3url());
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         ObjectMapper objectMapper = new ObjectMapper();
         ObjectNode rootNode = objectMapper.createObjectNode();
-        rootNode.put("mchid",wxpayConfig.getMerchantId())
-                .put("appid", appid)
+        rootNode.put("mchid", wxpayConfig.getMerchantId())
+                .put("appid", appConfig.getAppid())
                 .put("description", goodsName)
-                .put("notify_url", notifyUrl)
+                .put("notify_url", wxpayConfig.getNotifyUrl())
                 .put("out_trade_no", order.getOutTradeNo());
         rootNode.putObject("amount").put("total", order.getTotal());
         objectMapper.writeValue(bos, rootNode);
         httpPost.setEntity(new StringEntity(rootNode.toString(), "utf-8"));
         HttpResponse response = httpClient.execute(httpPost);
         String bodyAsString = EntityUtils.toString(response.getEntity());
-        if (JSONObject.parseObject(bodyAsString).get("prepay_id") == null){
+        if (JSONObject.parseObject(bodyAsString).get("prepay_id") == null) {
             throw new CustomException(JSONObject.parseObject(bodyAsString).get("message").toString());
         }
-        return getWxParamJson(bodyAsString,order.getOutTradeNo());
+        return getWxParamJson(bodyAsString, order.getOutTradeNo());
 
     }
 
+
     // 生成调用调起微信支付所需参数
     private WxParamEntity getWxParamJson(String bodyAsString, String orderCode) throws Exception {
         WxParamEntity wxParamEntity = new WxParamEntity();
-        wxParamEntity.setAppId(appid);
+        wxParamEntity.setAppId(appConfig.getAppid());
         wxParamEntity.setPartnerId(wxpayConfig.getMerchantId());
-        String  prepayId = JSONObject.parseObject(bodyAsString).getString("prepay_id");
+        String prepayId = JSONObject.parseObject(bodyAsString).getString("prepay_id");
         wxParamEntity.setPrepayId(prepayId);
         wxParamEntity.setPackageValue("Sign=WXPay");
         String nonce_str = RandomStringUtils.randomAlphanumeric(32);
         wxParamEntity.setNonceStr(nonce_str);
-        String timestamp = String.valueOf(System.currentTimeMillis()/1000);
+        String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
         wxParamEntity.setTimeStamp(timestamp);
 
         StringBuffer sb = new StringBuffer();
-        sb.append(appid + "\n");
+        sb.append(appConfig.getAppid() + "\n");
         sb.append(timestamp + "\n");
         sb.append(nonce_str + "\n");
-        sb.append(prepayId+ "\n");
+        sb.append(prepayId + "\n");
 
 
         File file = new ClassPathResource("wechatpay/apiclient_key.pem").getFile();
-        String realPath =file.getAbsolutePath();
+        String realPath = file.getAbsolutePath();
         PrivateKey privateKey = CommonUtils.getPrivateKey(realPath);
         // 进行签名服务
         Signature signature = Signature.getInstance("SHA256withRSA");
         signature.initSign(privateKey);
         signature.update(sb.toString().getBytes("UTF-8"));
         byte[] signedData = signature.sign();
-        String base64Str =  Base64.getEncoder().encodeToString(signedData);
+        String base64Str = Base64.getEncoder().encodeToString(signedData);
         wxParamEntity.setSign(base64Str);
 
         return wxParamEntity;
     }
 
-    private HttpPost initHttpPost() {
-        HttpPost httpPost = new HttpPost(wxpayConfig.getV3url());
+    private HttpPost initHttpPost(String url) {
+        HttpPost httpPost = new HttpPost(url);
         httpPost.addHeader("Accept", "application/json");
-        httpPost.addHeader("Content-type","application/json; charset=utf-8");
+        httpPost.addHeader("Content-type", "application/json; charset=utf-8");
         return httpPost;
     }
 
     @Data
-    class  WxParamEntity{
+    class WxParamEntity {
         String appId;
         String partnerId;
         String prepayId;
@@ -283,13 +310,205 @@ public class WxJsjpController extends BaseController {
 
     }
 
+    /**
+     * 微信H5商品下单
+     */
+    @PostMapping(value = "/getH5PrepareGoodsOrder")
+    @ApiOperation("微信H5商品下单")
+    public Response<JSONObject> getH5PrepareGoodsOrder(@RequestBody WxOrderGoodsDTO wxOrderGoodsDTO) throws Exception {
+        if (wxOrderGoodsDTO.getGoodsType() == 2) {
+            GzptUserInfo gzptUserInfo = userInfoService.getInfoById(wxOrderGoodsDTO.getUserId());
+
+            VipUserExam vipUserExam = vipUserExamService.getUserExamByUserIdAndGoodsId(wxOrderGoodsDTO.getUserId(), wxOrderGoodsDTO.getGoodsId());
+            if (vipUserExam != null) {
+                Date expirationTime = vipUserExam.getExpirationTime();
+                Date now = new Date();
+                if (expirationTime != null && now.compareTo(expirationTime) < 0) {
+                    throw new CustomException("您已购买过该考场,退回上个页面,重新进入。");
+                }
+            }
+            ExamInfo examInfo = examInfoService.getById(wxOrderGoodsDTO.getGoodsId());
+            //创建本地微信订单
+            WxJsOrder order = new WxJsOrder();
+            String orderCode = getOrderCode(wxOrderGoodsDTO.getUserId());
+            order.setGoodsId(wxOrderGoodsDTO.getGoodsId());
+            order.setGoodsName(examInfo.getName());
+            order.setGoodsType(wxOrderGoodsDTO.getGoodsType());
+            order.setOutTradeNo(orderCode);
+            order.setUserId(wxOrderGoodsDTO.getUserId());
+            order.setUserName(gzptUserInfo.getUserName());
+            order.setLogincode(gzptUserInfo.getLogincode());
+            order.setPhoneType(wxOrderGoodsDTO.getPhoneType()); //手机类型 1:苹果 2:安卓
+            order.setTotal(examInfo.getPrice());
+            order.setIsShare(0);
+            order.setDqbh(gzptUserInfo.getCity());
+            order.setDqmc(gzptUserInfo.getCityName());
+            order.setSchool(gzptUserInfo.getSchool());
+            order.setSchoolName(gzptUserInfo.getSchoolName());
+            order.setCreateId(gzptUserInfo.getOutCreateId());
+            order.setOrderStatus(OrderStatusEnum.PROCESSING.getCode());
+            wxJsOrderService.save(order);
+            return Response.success(placeH5WxOrder(order, examInfo.getName()));
+        } else if (wxOrderGoodsDTO.getGoodsType() == 3) {
+            throw new CustomException("请正确传入GoodsType,GoodsType=2未开发");
+        } else {
+            throw new CustomException("请正确传入GoodsType。");
+        }
+
+    }
+
+
+    /**
+     * 微信H5支付获取预订单id
+     */
+    @PostMapping(value = "/h5PrepareOrder")
+    @ApiOperation("微信H5支付下单")
+    public Response<JSONObject> h5PrepareOrder(@RequestBody WxOrderDTO wxOrderDTO) throws Exception {
+
+        SysDictData sysDictData = dictDataService.selectDictDataById(wxOrderDTO.getDictCode());
+        String[] values = sysDictData.getDictValue().split(",");
+
+        int isShare = 0;
+
+        //创建本地微信订单
+        WxJsOrder order = new WxJsOrder();
+        GzptUserInfo gzptUserInfo = userInfoService.getInfoById(wxOrderDTO.getUserId());
+        //获取合作驾校配置表
+        isShare = schPayConfigService.isSchPayConfigByUser(gzptUserInfo);
+
+        String orderCode = getOrderCode(gzptUserInfo.getId());
+        order.setOutTradeNo(orderCode);
+        order.setUserId(gzptUserInfo.getId());
+        order.setUserName(gzptUserInfo.getUserName());
+        order.setLogincode(gzptUserInfo.getLogincode());
+        order.setGoodsName(sysDictData.getDictLabel());
+        order.setGoodsType(1);
+        order.setPhoneType(wxOrderDTO.getPhoneType());  //手机类型
+        order.setDqbh(gzptUserInfo.getCity());
+        order.setDqmc(gzptUserInfo.getCityName());
+        order.setSchool(gzptUserInfo.getSchool());
+        order.setSchoolName(gzptUserInfo.getSchoolName());
+        order.setIsShare(isShare);
+        order.setCreateId(gzptUserInfo.getOutCreateId());
+
+        Double price = Double.parseDouble(values[0]) * 100;   //订单总额
+        int b = new Double(price).intValue();
+        order.setTotal(b);
+
+        if (isShare == 1) {
+
+            //营口学员已绑定教练员
+            if ("2108".equals(gzptUserInfo.getCity()) && gzptUserInfo.getIsBindCoach() == 1) {
+                //如果是合作驾校
+                if (wxOrderDTO.getPhoneType() != null && wxOrderDTO.getPhoneType() == 1) { //苹果
+                    int priceApple = Integer.parseInt(values[3]);   //订单总额
+                    order.setSchoolCommission(priceApple);
+                } else if (wxOrderDTO.getPhoneType() != null && wxOrderDTO.getPhoneType() == 2) { //安卓
+                    int priceAndroid = Integer.parseInt(values[2]);   //订单总额
+                    order.setSchoolCommission(priceAndroid);
+                }
+            }
+            //非营口只判断有合作
+            if (!"2108".equals(gzptUserInfo.getCity())) {
+                //如果是合作驾校
+                if (wxOrderDTO.getPhoneType() != null && wxOrderDTO.getPhoneType() == 1) { //苹果
+                    int priceApple = Integer.parseInt(values[3]);   //订单总额
+                    order.setSchoolCommission(priceApple);
+                } else if (wxOrderDTO.getPhoneType() != null && wxOrderDTO.getPhoneType() == 2) { //安卓
+                    int priceAndroid = Integer.parseInt(values[2]);   //订单总额
+                    order.setSchoolCommission(priceAndroid);
+                }
+            }
+
+        }
+
+        if (sysDictData.getDictLabel().indexOf("计时") != -1) {
+            int isActiva = schActivationService.isSchActivation(gzptUserInfo.getOutId());
+            if (isActiva == 1) {
+                throw new CustomException("该学员已激活,请退出APP后再重新获取套餐");
+            }
+        }
+
+        order.setOrderStatus(OrderStatusEnum.PROCESSING.getCode());
+        wxJsOrderService.save(order);
+
+        return Response.success(placeH5WxOrder(order, sysDictData.getDictLabel()));
+
+    }
+
 
+    /**
+     * 微信H5下单
+     *
+     * @param order
+     * @param goodsName
+     * @return
+     * @throws Exception
+     */
+    private JSONObject placeH5WxOrder(WxJsOrder order, String goodsName) throws Exception {
 
+        HttpPost httpPost = initHttpPost(wxpayConfig.getV3H5Url());
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        ObjectMapper objectMapper = new ObjectMapper();
+        ObjectNode rootNode = objectMapper.createObjectNode();
+        ObjectNode sceneInfoNode = objectMapper.createObjectNode();
+        ObjectNode h5InfoNode = objectMapper.createObjectNode();
 
+        rootNode.put("mchid", wxpayConfig.getMerchantId())
+                .put("appid", appConfig.getAppid())
+                .put("description", goodsName)
+                .put("notify_url", wxpayConfig.getNotifyUrl())
+                .put("out_trade_no", order.getOutTradeNo());
+        rootNode.putObject("amount").put("total", order.getTotal()).put("currency", "CNY");
+
+        //前端类型 1:app 2:小程序 3:公众号
+        if (order.getPhoneType() == 1) { //1苹果  又是APP中支付
+            h5InfoNode.put("type", "iOS");
+            h5InfoNode.put("bundle_id", appConfig.getBundleId());
+        } else if (order.getPhoneType() == 2) { //2安卓 又是APP中支付
+            h5InfoNode.put("type", "Android");
+            h5InfoNode.put("package_name", appConfig.getPackageName());
+        } else {
+            h5InfoNode.put("type", "Wap");
+        }
+        String ipAddr = IpUtils.getIpAddr(ServletUtils.getRequest()); //获取请求IP
+        sceneInfoNode.put("payer_client_ip", ipAddr)
+                .set("h5_info", h5InfoNode);
+        rootNode.set("scene_info", sceneInfoNode);
+        objectMapper.writeValue(bos, rootNode);
+        httpPost.setEntity(new StringEntity(rootNode.toString(), "utf-8"));
+
+        HttpClient httpClient = initHttpClient();
+        HttpResponse response = httpClient.execute(httpPost);
+        String bodyAsString = EntityUtils.toString(response.getEntity());
+        //if (JSONObject.parseObject(bodyAsString).get("prepay_id") == null){
+        //    throw new CustomException(JSONObject.parseObject(bodyAsString).get("message").toString());
+        //}
+
+        return JSONObject.parseObject(bodyAsString);
+
+    }
 
 
+    private HttpClient initHttpClient() throws IOException {
+        File file = new ClassPathResource("wechatpay/apiclient_key.pem").getFile();
+        String realPath = file.getAbsolutePath();
+        PrivateKey privateKey = CommonUtils.getPrivateKey(realPath);
 
+        // 加载平台证书(mchId:商户号,mchSerialNo:商户证书序列号,apiV3Key:V3密钥)
+        AutoUpdateCertificatesVerifier verifier = new AutoUpdateCertificatesVerifier(
+                new WechatPay2Credentials(wxpayConfig.getMerchantId(),
+                        new PrivateKeySigner(wxpayConfig.getSerialNumber(), privateKey)),
+                wxpayConfig.getV3key().getBytes("utf-8"));
 
+        // 初始化httpClient
+        HttpClient httpClient = WechatPayHttpClientBuilder.create()
+                .withMerchant(wxpayConfig.getMerchantId(), wxpayConfig.getSerialNumber(), privateKey)
+                .withValidator(new WechatPay2Validator(verifier)).build();
+
+        return httpClient;
+
+    }
 
 
 }

+ 5 - 0
jsjp-admin/src/main/resources/application-dev.yml

@@ -90,6 +90,9 @@ feign:
 app:
     appid: wx606fa102dbc4b8ab
     secret: 93832292771493dc2aae6797edbc387c
+    bundleId: com.kestrel.JSJPStudent
+    packageName: com.jsjp.student
+
 
 # 教练管家 微信开放平台
 coachApp:
@@ -132,6 +135,8 @@ aliyun:
 # 极速驾培微信支付
 wxpay:
     v3url: https://api.mch.weixin.qq.com/v3/pay/transactions/app
+    v3JsUrl: https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi
+    v3H5Url: https://api.mch.weixin.qq.com/v3/pay/transactions/h5
     v3urlRefund: https://api.mch.weixin.qq.com/v3/refund/domestic/refunds
     merchantId: 1611324484
     serialNumber: 53EBF541F383371B121D7B57B25305FC0BB04F42

+ 21 - 0
jsjp-common/src/main/java/com/miaxis/common/config/AppConfig.java

@@ -0,0 +1,21 @@
+package com.miaxis.common.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "app")
+public class AppConfig {
+    //appid
+    private String appid;
+    //secret
+    private String secret;
+    //bundleId IOS
+    private String bundleId;
+    //packageName 安卓
+    private String packageName;
+
+
+}

+ 7 - 2
jsjp-common/src/main/java/com/miaxis/common/config/WxpayConfig.java

@@ -8,10 +8,16 @@ import org.springframework.stereotype.Component;
 @Component
 @ConfigurationProperties(prefix = "wxpay")
 public class WxpayConfig {
-
+    //APP支付下单地址
     private String v3url;
+    //小程序 公众号微信体系内支付下单地址
+    private String v3JsUrl;
+    //H5 微信支付下单
+    private String v3H5Url;
     //退款
     private String v3urlRefund;
+    //通知地址
+    private String notifyUrl;
     //退款回调
     private String notifyUrlRefund;
     //商户id
@@ -19,6 +25,5 @@ public class WxpayConfig {
     private String serialNumber;
     private String v3key;
 
-    private String appId;
 
 }

+ 6 - 0
jsjp-service/src/main/java/com/miaxis/newgzpt/domain/GzptUserInfo.java

@@ -161,4 +161,10 @@ public class GzptUserInfo implements Serializable {
     @TableField("OUT_CREATE_ID")
     private Long outCreateId;
 
+
+    @ApiModelProperty(value = "是否绑定教练员  0否 1是")
+    @TableField("IS_BIND_COACH")
+    private Long isBindCoach;
+
+
 }

+ 5 - 0
jsjp-service/src/main/java/com/miaxis/newgzpt/mapper/GzptUserInfoMapper.java

@@ -29,4 +29,9 @@ public interface GzptUserInfoMapper extends BaseMapper<GzptUserInfo> {
     GzptUserInfo getAppleUserInfo(GzptAppleInfoDTO appleInfoDTO);
 
     Long saveGzptUserInfo(GzptUserInfo gzptUserInfo);
+
+    GzptUserInfo getInfoByOutId(Long outId);
+
+    Integer updateUserBindCoach(Long outId);
+
 }

+ 4 - 0
jsjp-service/src/main/java/com/miaxis/newgzpt/service/IGzptUserInfoService.java

@@ -27,6 +27,10 @@ public interface IGzptUserInfoService extends IService<GzptUserInfo> {
 
     GzptUserInfo getInfoById(Long id);
 
+    Integer updateUserBindCoach(Long outId);
+
+    GzptUserInfo getInfoByOutId(Long outId);
+
     List<GzptExamInfoVO> getUserScoreByOutId(Long stuOutId);
 
     Long saveGzptUserInfo(GzptUserInfo userInfo);

+ 11 - 0
jsjp-service/src/main/java/com/miaxis/newgzpt/service/impl/GzptUserInfoServiceImpl.java

@@ -52,6 +52,17 @@ public class GzptUserInfoServiceImpl extends ServiceImpl<GzptUserInfoMapper, Gzp
         return  mapper.getInfoById(id);
     }
 
+    @Override
+    public Integer updateUserBindCoach(Long outId) {
+        return mapper.updateUserBindCoach(outId);
+    }
+
+
+    @Override
+    public GzptUserInfo getInfoByOutId(Long outId) {
+        return  mapper.getInfoByOutId(outId);
+    }
+
     @Override
     public List<GzptExamInfoVO> getUserScoreByOutId(Long stuOutId) {
         return mapper.getUserScoreByOutId(stuOutId);

+ 3 - 0
jsjp-service/src/main/java/com/miaxis/tms/service/impl/TmsStudentInfoServiceImpl.java

@@ -83,6 +83,9 @@ public class TmsStudentInfoServiceImpl extends ServiceImpl<TmsStudentInfoMapper,
 
     @Override
     public int upStuAppCoachIdById(TmsStudentInfoQrDTO studentInfoQrDTO) {
+
+
+
         return mapper.upStuAppCoachIdById(studentInfoQrDTO);
     }
 

+ 11 - 0
jsjp-service/src/main/resources/mapper/newgzpt/GzptUserInfoMapper.xml

@@ -59,6 +59,17 @@
     </select>
 
 
+    <select id="getInfoByOutId"  resultType="com.miaxis.newgzpt.domain.GzptUserInfo">
+        select * from GZPT_USER_INFO where out_id =#{outId,jdbcType=NUMERIC}
+    </select>
+
+
+    <update id="updateUserBindCoach">
+        update gzpt_user_info set is_bind_coach = 1 where out_id = #{outId,jdbcType=NUMERIC}
+    </update>
+
+
+
     <delete id="removeVipByUserId" parameterType="long">
         delete from user_vip where user_id = #{userId}
     </delete>