Compare commits
No commits in common. "32ab1db4a98ae2fe689778ecf5b62eb3f6fa9c69" and "22a98befb6279438a4e08b90171ad02c37f74eef" have entirely different histories.
32ab1db4a9
...
22a98befb6
|
@ -10,8 +10,6 @@ import org.springframework.stereotype.Component;
|
|||
public class WechatPayConfig {
|
||||
/** 应用ID */
|
||||
private String appId;
|
||||
/** 小程序秘钥 */
|
||||
private String appSecret;
|
||||
/** 商户ID */
|
||||
private String mchId;
|
||||
/** 秘钥 */
|
||||
|
@ -20,62 +18,4 @@ public class WechatPayConfig {
|
|||
private String mchSerialNo;
|
||||
/** 证书路径 */
|
||||
private String privateKeyPath;
|
||||
/** 支付回调地址 */
|
||||
private String payNoticeUrl;
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getAppSecret() {
|
||||
return appSecret;
|
||||
}
|
||||
|
||||
public void setAppSecret(String appSecret) {
|
||||
this.appSecret = appSecret;
|
||||
}
|
||||
|
||||
public String getMchId() {
|
||||
return mchId;
|
||||
}
|
||||
|
||||
public void setMchId(String mchId) {
|
||||
this.mchId = mchId;
|
||||
}
|
||||
|
||||
public String getApiV3Key() {
|
||||
return apiV3Key;
|
||||
}
|
||||
|
||||
public void setApiV3Key(String apiV3Key) {
|
||||
this.apiV3Key = apiV3Key;
|
||||
}
|
||||
|
||||
public String getMchSerialNo() {
|
||||
return mchSerialNo;
|
||||
}
|
||||
|
||||
public void setMchSerialNo(String mchSerialNo) {
|
||||
this.mchSerialNo = mchSerialNo;
|
||||
}
|
||||
|
||||
public String getPrivateKeyPath() {
|
||||
return privateKeyPath;
|
||||
}
|
||||
|
||||
public void setPrivateKeyPath(String privateKeyPath) {
|
||||
this.privateKeyPath = privateKeyPath;
|
||||
}
|
||||
|
||||
public String getPayNoticeUrl() {
|
||||
return payNoticeUrl;
|
||||
}
|
||||
|
||||
public void setPayNoticeUrl(String payNoticeUrl) {
|
||||
this.payNoticeUrl = payNoticeUrl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
import com.jwl.driver.server.config.WechatPayConfig;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.util.WechatPayUtil;
|
||||
import com.jwl.driver.server.vo.AppletPayVo;
|
||||
import com.wechat.pay.java.core.Config;
|
||||
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
||||
import com.wechat.pay.java.core.exception.ServiceException;
|
||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.*;
|
||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 微信支付小程序 接口
|
||||
*/
|
||||
@Api(tags = "小程序支付")
|
||||
@Controller
|
||||
@RequestMapping("/applet/pay")
|
||||
@Slf4j
|
||||
public class AppletPayController {
|
||||
|
||||
@Resource
|
||||
private WechatPayConfig wechatPayConfig;
|
||||
|
||||
//生成预支付订单
|
||||
@ApiOperation("生成预支付订单")
|
||||
@PostMapping("/prepay")
|
||||
public BaseResponse createPrepay(@RequestBody AppletPayVo payDto){
|
||||
// 构建service
|
||||
JsapiServiceExtension service = createService();
|
||||
|
||||
// 请求下单参数
|
||||
PrepayRequest request = new PrepayRequest();
|
||||
Amount amount = new Amount();
|
||||
amount.setTotal(Integer.valueOf((payDto.getMoney()*100)+""));
|
||||
request.setAmount(amount);
|
||||
request.setAppid(wechatPayConfig.getAppId());
|
||||
request.setMchid(wechatPayConfig.getMchId());
|
||||
request.setDescription(payDto.getDescription());
|
||||
request.setNotifyUrl(wechatPayConfig.getPayNoticeUrl());
|
||||
request.setOutTradeNo(payDto.getOutTradeNo());
|
||||
|
||||
Payer payer = new Payer();
|
||||
payer.setOpenid(WechatPayUtil.getOpenId(wechatPayConfig.getAppId(), wechatPayConfig.getAppSecret(), payDto.getCode()));
|
||||
// 调用下单方法,得到应答
|
||||
PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);
|
||||
// 使用微信扫描 code_url 对应的二维码,即可体验Native支付
|
||||
// log.info(response);
|
||||
return BaseResponse.success(response);
|
||||
|
||||
}
|
||||
|
||||
/** 构建service */
|
||||
private JsapiServiceExtension createService() {
|
||||
Config config =
|
||||
new RSAAutoCertificateConfig.Builder()
|
||||
.merchantId(wechatPayConfig.getMchId())
|
||||
.privateKeyFromPath(wechatPayConfig.getPrivateKeyPath())
|
||||
.merchantSerialNumber(wechatPayConfig.getMchSerialNo())
|
||||
.apiV3Key(wechatPayConfig.getApiV3Key())
|
||||
.build();
|
||||
JsapiServiceExtension service = new JsapiServiceExtension.Builder().config(config).build();
|
||||
|
||||
return service;
|
||||
}
|
||||
|
||||
|
||||
//查询订单接口
|
||||
@ApiOperation("查询支付订单")
|
||||
@PostMapping("/queryOrder")
|
||||
public BaseResponse queryOrder(@RequestBody AppletPayVo payDto){
|
||||
//获取openId
|
||||
QueryOrderByOutTradeNoRequest queryRequest = new QueryOrderByOutTradeNoRequest();
|
||||
queryRequest.setMchid(wechatPayConfig.getMchId());
|
||||
//支付订单id
|
||||
queryRequest.setOutTradeNo(payDto.getOutTradeNo());
|
||||
JsapiServiceExtension service = createService();
|
||||
|
||||
try {
|
||||
Transaction result = service.queryOrderByOutTradeNo(queryRequest);
|
||||
System.out.println(result.getTradeState());
|
||||
return BaseResponse.success(result);
|
||||
} catch (ServiceException e) {
|
||||
// API返回失败, 例如ORDER_NOT_EXISTS
|
||||
System.out.printf("code=[%s], message=[%s]\n", e.getErrorCode(), e.getErrorMessage());
|
||||
System.out.printf("reponse body=[%s]\n", e.getResponseBody());
|
||||
return BaseResponse.fail(e.getErrorMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//关闭订单接口
|
||||
@ApiOperation("关闭支付订单")
|
||||
@PostMapping("/closeOrder")
|
||||
public BaseResponse closeOrder(@RequestBody AppletPayVo payDto){
|
||||
JsapiServiceExtension service = createService();
|
||||
CloseOrderRequest closeRequest = new CloseOrderRequest();
|
||||
closeRequest.setMchid(wechatPayConfig.getMchId());
|
||||
closeRequest.setOutTradeNo(payDto.getOutTradeNo());
|
||||
// 方法没有返回值,意味着成功时API返回204 No Content
|
||||
service.closeOrder(closeRequest);
|
||||
return BaseResponse.success();
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
import com.jwl.driver.server.config.WechatPayConfig;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.vo.H5PayVo;
|
||||
import com.wechat.pay.java.core.Config;
|
||||
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
||||
import com.wechat.pay.java.core.exception.ServiceException;
|
||||
import com.wechat.pay.java.service.payments.h5.H5Service;
|
||||
import com.wechat.pay.java.service.payments.h5.model.*;
|
||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 微信支付小程序 接口
|
||||
*/
|
||||
@Api(tags = "H5支付")
|
||||
@Controller
|
||||
@RequestMapping("/H5/pay")
|
||||
@Slf4j
|
||||
public class H5PayController {
|
||||
|
||||
@Resource
|
||||
private WechatPayConfig wechatPayConfig;
|
||||
|
||||
//生成预支付订单
|
||||
@ApiOperation("生成预支付订单")
|
||||
@PostMapping("/prepay")
|
||||
public BaseResponse createPrepay(@RequestBody H5PayVo payVo){
|
||||
// 构建service
|
||||
H5Service service = createService();
|
||||
|
||||
// 请求下单参数
|
||||
PrepayRequest request = new PrepayRequest();
|
||||
Amount amount = new Amount();
|
||||
amount.setTotal(Integer.valueOf((payVo.getMoney()*100)+""));
|
||||
request.setAmount(amount);
|
||||
request.setAppid(wechatPayConfig.getAppId());
|
||||
request.setMchid(wechatPayConfig.getMchId());
|
||||
request.setDescription(payVo.getDescription());
|
||||
request.setNotifyUrl(wechatPayConfig.getPayNoticeUrl());
|
||||
request.setOutTradeNo(payVo.getOutTradeNo());
|
||||
//场景参数
|
||||
SceneInfo sceneInfo = new SceneInfo();
|
||||
sceneInfo.setPayerClientIp(payVo.getClientIp());
|
||||
|
||||
// 调用下单方法,得到应答
|
||||
PrepayResponse response = service.prepay(request);
|
||||
// 使用微信扫描 code_url 对应的二维码,即可体验Native支付
|
||||
// log.info(response);
|
||||
return BaseResponse.success(response);
|
||||
|
||||
}
|
||||
|
||||
private H5Service createService() {
|
||||
Config config =
|
||||
new RSAAutoCertificateConfig.Builder()
|
||||
.merchantId(wechatPayConfig.getMchId())
|
||||
.privateKeyFromPath(wechatPayConfig.getPrivateKeyPath())
|
||||
.merchantSerialNumber(wechatPayConfig.getMchSerialNo())
|
||||
.apiV3Key(wechatPayConfig.getApiV3Key())
|
||||
.build();
|
||||
H5Service service = new H5Service.Builder().config(config).build();
|
||||
|
||||
return service;
|
||||
}
|
||||
|
||||
|
||||
//查询订单接口
|
||||
@ApiOperation("查询支付订单")
|
||||
@PostMapping("/queryOrder")
|
||||
public BaseResponse queryOrder(@RequestBody H5PayVo payVo){
|
||||
//获取openId
|
||||
QueryOrderByOutTradeNoRequest queryRequest = new QueryOrderByOutTradeNoRequest();
|
||||
queryRequest.setMchid(wechatPayConfig.getMchId());
|
||||
//支付订单id
|
||||
queryRequest.setOutTradeNo(payVo.getOutTradeNo());
|
||||
H5Service service = createService();
|
||||
|
||||
try {
|
||||
Transaction result = service.queryOrderByOutTradeNo(queryRequest);
|
||||
System.out.println(result.getTradeState());
|
||||
return BaseResponse.success(result);
|
||||
} catch (ServiceException e) {
|
||||
// API返回失败, 例如ORDER_NOT_EXISTS
|
||||
System.out.printf("code=[%s], message=[%s]\n", e.getErrorCode(), e.getErrorMessage());
|
||||
System.out.printf("reponse body=[%s]\n", e.getResponseBody());
|
||||
return BaseResponse.fail(e.getErrorMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//关闭订单接口
|
||||
@ApiOperation("关闭支付订单")
|
||||
@PostMapping("/closeOrder")
|
||||
public BaseResponse closeOrder(@RequestBody H5PayVo payVo){
|
||||
H5Service service = createService();
|
||||
CloseOrderRequest closeRequest = new CloseOrderRequest();
|
||||
closeRequest.setMchid(wechatPayConfig.getMchId());
|
||||
closeRequest.setOutTradeNo(payVo.getOutTradeNo());
|
||||
// 方法没有返回值,意味着成功时API返回204 No Content
|
||||
service.closeOrder(closeRequest);
|
||||
return BaseResponse.success();
|
||||
}
|
||||
}
|
|
@ -1,25 +1,9 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jwl.driver.server.config.WechatPayConfig;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
||||
import com.wechat.pay.java.core.notification.NotificationConfig;
|
||||
import com.wechat.pay.java.core.notification.NotificationParser;
|
||||
import com.wechat.pay.java.core.notification.RequestParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.http.HttpRequest;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.servlet.resource.HttpResource;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -29,61 +13,8 @@ import javax.annotation.Resource;
|
|||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Api(tags = "支付回调")
|
||||
@Controller
|
||||
@RequestMapping("/payNoticeLog")
|
||||
@RequestMapping("//payNoticeLog")
|
||||
public class PayNoticeLogController {
|
||||
@Resource
|
||||
private WechatPayConfig wechatPayConfig;
|
||||
|
||||
/**
|
||||
* 支付回调接口 本接口不能做验证
|
||||
* @param wechatPayCertificateSerialNumber
|
||||
* @param signature
|
||||
* @param timstamp
|
||||
* @param nonce
|
||||
* @param requestBody
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("支付回调接口")
|
||||
@PostMapping()
|
||||
public JSONObject payNotice(@RequestHeader("Wechatpay-Serial") String wechatPayCertificateSerialNumber,
|
||||
@RequestHeader("Wechatpay-Signature") String signature,
|
||||
@RequestHeader("Wechatpay-Timestamp") String timstamp,
|
||||
@RequestHeader("Wechatpay-Nonce") String nonce,
|
||||
@RequestBody String requestBody){
|
||||
NotificationConfig config = new RSAAutoCertificateConfig.Builder()
|
||||
.merchantId(wechatPayConfig.getMchId())
|
||||
.privateKeyFromPath(wechatPayConfig.getPrivateKeyPath())
|
||||
.merchantSerialNumber(wechatPayConfig.getPrivateKeyPath())
|
||||
.apiV3Key(wechatPayConfig.getApiV3Key())
|
||||
.build();
|
||||
RequestParam requestParam = new RequestParam.Builder()
|
||||
.serialNumber(wechatPayCertificateSerialNumber)
|
||||
.nonce(nonce)
|
||||
.signature(signature)
|
||||
.timestamp(timstamp)
|
||||
// 若未设置signType,默认值为 WECHATPAY2-SHA256-RSA2048
|
||||
|
||||
.body(requestBody)
|
||||
.build();
|
||||
|
||||
// 初始化 NotificationParser
|
||||
NotificationParser parser = new NotificationParser(config);
|
||||
|
||||
// 验签并解密报文
|
||||
JSONObject decryptObject = parser.parse(requestParam,JSONObject.class);
|
||||
System.out.println("decryptObject="+decryptObject.toJSONString());
|
||||
|
||||
String trade_state=decryptObject.getString("trade_state");
|
||||
JSONObject jsonResponse = new JSONObject();
|
||||
if(trade_state.equals("SUCCESS")) {
|
||||
//各种业务逻辑
|
||||
}else{
|
||||
//还是各种业务逻辑
|
||||
}
|
||||
jsonResponse.put("code", "SUCCESS");
|
||||
jsonResponse.put("message", "成功");
|
||||
return jsonResponse;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,13 +6,15 @@ import com.jwl.driver.server.dto.QuestionQueryDto;
|
|||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.service.ITdQuestionService;
|
||||
import com.jwl.driver.server.vo.QuestionVo;
|
||||
import com.jwl.driver.server.vo.QusetionVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -90,11 +92,11 @@ public class TdQuestionController {
|
|||
|
||||
@ApiOperation("对嘛接口-修改题库")
|
||||
@PutMapping("/duima/update")
|
||||
public Map updateQuestion(@RequestBody QuestionVo questionVo) {
|
||||
log.info("修改题库======>questionVo:{}", questionVo);
|
||||
public Map updateQuestion(@RequestBody QusetionVo qusetionVo) {
|
||||
log.info("修改题库======>qusetionVo:{}", qusetionVo);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("code", 200);
|
||||
result.put("data", tdQuestionService.updateQuestion(questionVo));
|
||||
result.put("data", tdQuestionService.updateQuestion(qusetionVo));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
|
||||
import com.jwl.driver.server.dto.DriverSchoolDto;
|
||||
import com.jwl.driver.server.dto.LoginUserDto;
|
||||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
|
@ -65,9 +64,12 @@ public class TdSysUserController {
|
|||
|
||||
@ApiOperation("用户绑定驾校")
|
||||
@PostMapping("/bindSchool")
|
||||
public BaseResponse bindSchool(@RequestBody @Valid DriverSchoolDto schoolDto) {
|
||||
log.info("用户绑定驾校信息======>schoolDto{}",schoolDto);
|
||||
return BaseResponse.success(userService.bindSchool(schoolDto));
|
||||
public BaseResponse bindSchool(@RequestBody LoginUserDto userDto) {
|
||||
log.info("用户绑定驾校======>schoolId{}",userDto.getSchoolId());
|
||||
if (Objects.isNull(userDto.getSchoolId())){
|
||||
throw new BusinessException("缺少必要参数");
|
||||
}
|
||||
return BaseResponse.success(userService.bindSchool(userDto));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
import com.jwl.driver.server.dto.WechatPayDto;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 微信支付 接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wechat/pay")
|
||||
public class WechatPayController {
|
||||
|
||||
//生成预支付订单
|
||||
@PostMapping("/prepay")
|
||||
public BaseResponse createPrepay(@RequestBody WechatPayDto payDto){
|
||||
//获取openId
|
||||
|
||||
return BaseResponse.success();
|
||||
|
||||
}
|
||||
|
||||
//支付回调接口
|
||||
|
||||
//查询订单接口
|
||||
|
||||
//关闭订单接口
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package com.jwl.driver.server.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 登陆入参
|
||||
* @create 2023/8/11 22:21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DriverSchoolDto {
|
||||
|
||||
@ApiModelProperty(value = "驾校id",required = true)
|
||||
@NotNull(message = "驾校id不能为空")
|
||||
private Long schoolId;
|
||||
|
||||
@ApiModelProperty(value = "驾校名称",required = true)
|
||||
@NotBlank(message = "驾校名称不能为空")
|
||||
private String schoolName;
|
||||
|
||||
@ApiModelProperty(value = "驾校联系方式",required = false)
|
||||
private String schoolPhone;
|
||||
|
||||
|
||||
}
|
|
@ -22,4 +22,7 @@ public class LoginUserDto {
|
|||
@ApiModelProperty(value = "登陆验证码",required = true)
|
||||
@NotBlank(message = "登陆验证码不能为空")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "驾校id",required = false)
|
||||
private Long schoolId;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
package com.jwl.driver.server.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WechatPayDto {
|
||||
|
||||
private Double money;//金额
|
||||
|
||||
private String code;
|
||||
|
||||
|
||||
}
|
|
@ -10,7 +10,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -66,18 +65,6 @@ public class TdSysUser implements Serializable {
|
|||
@TableField("SCHOOL_ID")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 驾校名称
|
||||
*/
|
||||
@TableField("SCHOOL_NAME")
|
||||
private String schoolName;
|
||||
|
||||
/**
|
||||
* 驾校电话
|
||||
*/
|
||||
@TableField("SCHOOL_PHONE")
|
||||
private String schoolPhone;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.jwl.driver.server.mapper;
|
|||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||
import com.jwl.driver.server.entity.TdQuestion;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jwl.driver.server.vo.QuestionVo;
|
||||
import com.jwl.driver.server.vo.QusetionVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -23,14 +23,14 @@ public interface TdQuestionMapper extends BaseMapper<TdQuestion> {
|
|||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<QuestionVo> queryQuestion(@Param("queryDto") QuestionQueryDto queryDto);
|
||||
List<QusetionVo> queryQuestion(@Param("queryDto") QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 随机查询考题
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<QuestionVo> queryQuestionByRandom(@Param("queryDto") QuestionQueryDto queryDto);
|
||||
List<QusetionVo> queryQuestionByRandom(@Param("queryDto") QuestionQueryDto queryDto);
|
||||
|
||||
int updateQuestion(@Param("questionVo") QuestionVo questionVo);
|
||||
int updateQuestion(@Param("qusetionVo") QusetionVo qusetionVo);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ package com.jwl.driver.server.service;
|
|||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||
import com.jwl.driver.server.entity.TdQuestion;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jwl.driver.server.vo.QuestionVo;
|
||||
import com.jwl.driver.server.vo.QusetionCategoryVo;
|
||||
import com.jwl.driver.server.vo.QusetionVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -24,28 +24,28 @@ public interface ITdQuestionService extends IService<TdQuestion> {
|
|||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
QuestionVo queryQuestionById(QuestionQueryDto queryDto);
|
||||
TdQuestion queryQuestionById(QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 根据id列表 批量获取题目
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<QuestionVo> queryQuestionByIdList(QuestionQueryDto queryDto);
|
||||
List<TdQuestion> queryQuestionByIdList(QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 根据查询条件获取列表
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<QuestionVo> queryQuestion(QuestionQueryDto queryDto);
|
||||
List<QusetionVo> queryQuestion(QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 获取考试题目
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<QuestionVo> getTestQuestion(QuestionQueryDto queryDto);
|
||||
List<QusetionVo> getTestQuestion(QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 题目分类
|
||||
|
@ -56,8 +56,8 @@ public interface ITdQuestionService extends IService<TdQuestion> {
|
|||
|
||||
/**
|
||||
* 修改题库
|
||||
* @param questionVo
|
||||
* @param qusetionVo
|
||||
* @return
|
||||
*/
|
||||
int updateQuestion(QuestionVo questionVo);
|
||||
int updateQuestion(QusetionVo qusetionVo);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.jwl.driver.server.service;
|
||||
|
||||
import com.jwl.driver.server.dto.DriverSchoolDto;
|
||||
import com.jwl.driver.server.dto.LoginUserDto;
|
||||
import com.jwl.driver.server.entity.TdSysUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
@ -44,8 +43,8 @@ public interface ITdSysUserService extends IService<TdSysUser> {
|
|||
|
||||
/**
|
||||
* 绑定驾校
|
||||
* @param schoolDto
|
||||
* @param userDto
|
||||
* @return
|
||||
*/
|
||||
Boolean bindSchool(DriverSchoolDto schoolDto);
|
||||
Boolean bindSchool(LoginUserDto userDto);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.jwl.driver.server.service.impl;
|
|||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.generator.config.IFileCreate;
|
||||
import com.jwl.driver.server.constant.Constants;
|
||||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||
import com.jwl.driver.server.entity.TdQuestion;
|
||||
|
@ -13,8 +12,8 @@ import com.jwl.driver.server.service.ITdQuestionService;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jwl.driver.server.service.ITdSysConfigListService;
|
||||
import com.jwl.driver.server.service.ITdSysConfigService;
|
||||
import com.jwl.driver.server.vo.QuestionVo;
|
||||
import com.jwl.driver.server.vo.QusetionCategoryVo;
|
||||
import com.jwl.driver.server.vo.QusetionVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -39,30 +38,26 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
private ITdSysConfigListService configListService;
|
||||
|
||||
@Override
|
||||
public QuestionVo queryQuestionById(QuestionQueryDto queryDto) {
|
||||
QuestionQueryDto newDto = new QuestionQueryDto()
|
||||
.setQuestionId(queryDto.getQuestionId());
|
||||
List<QuestionVo> questionVos = queryQuestion(newDto);
|
||||
return CollectionUtil.isEmpty(questionVos)? null : questionVos.get(0);
|
||||
public TdQuestion queryQuestionById(QuestionQueryDto queryDto) {
|
||||
return this.getBaseMapper().selectById(queryDto.getQuestionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuestionVo> queryQuestionByIdList(QuestionQueryDto queryDto) {
|
||||
QuestionQueryDto newDto = new QuestionQueryDto()
|
||||
.setQuestionIdList(queryDto.getQuestionIdList());
|
||||
return queryQuestion(newDto);
|
||||
public List<TdQuestion> queryQuestionByIdList(QuestionQueryDto queryDto) {
|
||||
LambdaQueryWrapper<TdQuestion> queryWrapper = new LambdaQueryWrapper<TdQuestion>()
|
||||
.in(TdQuestion::getQuestionId,queryDto.getQuestionIdList());
|
||||
|
||||
return this.getBaseMapper().selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuestionVo> queryQuestion(QuestionQueryDto queryDto) {
|
||||
List<QuestionVo> questionVos = this.getBaseMapper().queryQuestion(queryDto);
|
||||
questionOptionHandler(questionVos);
|
||||
return questionVos;
|
||||
public List<QusetionVo> queryQuestion(QuestionQueryDto queryDto) {
|
||||
return this.getBaseMapper().queryQuestion(queryDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuestionVo> getTestQuestion(QuestionQueryDto queryDto) {
|
||||
List<QuestionVo> resultList = new ArrayList<>();
|
||||
public List<QusetionVo> getTestQuestion(QuestionQueryDto queryDto) {
|
||||
List<QusetionVo> resultList = new ArrayList<>();
|
||||
|
||||
if (StrUtil.equals(Constants.SUBJECT_ONE,queryDto.getSubject())){
|
||||
//40道判断题 60道单选 每题1分
|
||||
|
@ -88,7 +83,6 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
.setNum(10);
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
}
|
||||
questionOptionHandler(resultList);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
@ -97,8 +91,8 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
|
||||
List<QusetionCategoryVo> resultList = new ArrayList<>();
|
||||
//获取题目
|
||||
List<QuestionVo> tdQuestionVos = queryQuestionByIdList(queryDto);
|
||||
if (CollectionUtil.isEmpty(tdQuestionVos)){
|
||||
List<TdQuestion> tdQuestions = queryQuestionByIdList(queryDto);
|
||||
if (CollectionUtil.isEmpty(tdQuestions)){
|
||||
return resultList;
|
||||
}
|
||||
//获取分类
|
||||
|
@ -106,8 +100,8 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
Map<String, String> categoryMap = categoryList.stream().collect(Collectors.toMap(TdSysConfigList::getConfigItemCode, TdSysConfigList::getConfigItemName, (v1, v2) -> v1));
|
||||
Map<String,Integer> totalMap = new HashMap<>();
|
||||
|
||||
for (QuestionVo tdQuestionVo : tdQuestionVos) {
|
||||
String category = tdQuestionVo.getCategory();
|
||||
for (TdQuestion tdQuestion : tdQuestions) {
|
||||
String category = tdQuestion.getCategory();
|
||||
if (StrUtil.isBlank(category)){
|
||||
continue;
|
||||
}
|
||||
|
@ -133,40 +127,7 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
}
|
||||
|
||||
@Override
|
||||
public int updateQuestion(QuestionVo questionVo) {
|
||||
return this.getBaseMapper().updateQuestion(questionVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 问题选项规整
|
||||
*/
|
||||
private void questionOptionHandler(List<QuestionVo> questionVos){
|
||||
if (CollectionUtil.isNotEmpty(questionVos)){
|
||||
for (QuestionVo questionVo : questionVos) {
|
||||
//如果选项A没有值 则为判断题
|
||||
List<QuestionVo.QuestionOption> optionList = new ArrayList<>();
|
||||
if (StrUtil.isBlank(questionVo.getChooseA())){
|
||||
optionList.add(new QuestionVo.QuestionOption("A","正确","1"));
|
||||
optionList.add(new QuestionVo.QuestionOption("B","错误","2"));
|
||||
}else {
|
||||
//起码ABCD都有
|
||||
optionList.add(new QuestionVo.QuestionOption("A",questionVo.getChooseA(),"1"));
|
||||
optionList.add(new QuestionVo.QuestionOption("B",questionVo.getChooseB(),"2"));
|
||||
optionList.add(new QuestionVo.QuestionOption("C",questionVo.getChooseC(),"3"));
|
||||
optionList.add(new QuestionVo.QuestionOption("D",questionVo.getChooseD(),"4"));
|
||||
|
||||
if (StrUtil.isNotBlank(questionVo.getChooseE())){
|
||||
optionList.add(new QuestionVo.QuestionOption("E",questionVo.getChooseE(),"5"));
|
||||
}
|
||||
if (StrUtil.isNotBlank(questionVo.getChooseF())){
|
||||
optionList.add(new QuestionVo.QuestionOption("F",questionVo.getChooseF(),"6"));
|
||||
}
|
||||
if (StrUtil.isNotBlank(questionVo.getChooseG())){
|
||||
optionList.add(new QuestionVo.QuestionOption("G",questionVo.getChooseG(),"7"));
|
||||
}
|
||||
}
|
||||
questionVo.setOptionList(optionList);
|
||||
}
|
||||
}
|
||||
public int updateQuestion(QusetionVo qusetionVo) {
|
||||
return this.getBaseMapper().updateQuestion(qusetionVo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import cn.hutool.core.util.PhoneUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jwl.driver.server.constant.Constants;
|
||||
import com.jwl.driver.server.dto.DriverSchoolDto;
|
||||
import com.jwl.driver.server.dto.LoginUserDto;
|
||||
import com.jwl.driver.server.dto.SecurityUser;
|
||||
import com.jwl.driver.server.entity.TdSysUser;
|
||||
|
@ -137,7 +136,7 @@ public class TdSysUserServiceImpl extends ServiceImpl<TdSysUserMapper, TdSysUser
|
|||
}
|
||||
|
||||
@Override
|
||||
public Boolean bindSchool(DriverSchoolDto schoolDto) {
|
||||
public Boolean bindSchool(LoginUserDto userDto) {
|
||||
SecurityUser loginUser = SecurityUtil.getLoginUser();
|
||||
|
||||
LambdaQueryWrapper<TdSysUser> cond = new LambdaQueryWrapper<TdSysUser>()
|
||||
|
@ -147,9 +146,7 @@ public class TdSysUserServiceImpl extends ServiceImpl<TdSysUserMapper, TdSysUser
|
|||
if (Objects.isNull(tdSysUser)){
|
||||
throw new BusinessException("用户不存在或者已被删除");
|
||||
}
|
||||
tdSysUser.setSchoolId(schoolDto.getSchoolId())
|
||||
.setSchoolName(schoolDto.getSchoolName())
|
||||
.setSchoolPhone(schoolDto.getSchoolPhone());
|
||||
tdSysUser.setSchoolId(userDto.getSchoolId());
|
||||
|
||||
boolean result = this.updateById(tdSysUser);
|
||||
if (!result){
|
||||
|
|
|
@ -1,266 +0,0 @@
|
|||
package com.jwl.driver.server.util;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.net.ssl.*;
|
||||
import java.io.*;
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
/**
|
||||
* 通用http发送方法
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class HttpUtils
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(HttpUtils.class);
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送GET方法的请求
|
||||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendGet(String url)
|
||||
{
|
||||
return sendGet(url, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送GET方法的请求
|
||||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendGet(String url, String param)
|
||||
{
|
||||
return sendGet(url, param, "UTF-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送GET方法的请求
|
||||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @param contentType 编码类型
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendGet(String url, String param, String contentType)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
BufferedReader in = null;
|
||||
try
|
||||
{
|
||||
String urlNameString = StringUtils.isNotBlank(param) ? url + "?" + param : url;
|
||||
log.info("sendGet - {}", urlNameString);
|
||||
URL realUrl = new URL(urlNameString);
|
||||
URLConnection connection = realUrl.openConnection();
|
||||
connection.setRequestProperty("accept", "*/*");
|
||||
connection.setRequestProperty("connection", "Keep-Alive");
|
||||
connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
connection.connect();
|
||||
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null)
|
||||
{
|
||||
result.append(line);
|
||||
}
|
||||
log.info("recv - {}", result);
|
||||
}
|
||||
catch (ConnectException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (SocketTimeoutException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (in != null)
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.error("调用in.close Exception, url=" + url + ",param=" + param, ex);
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendPost(String url, String param)
|
||||
{
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
StringBuilder result = new StringBuilder();
|
||||
try
|
||||
{
|
||||
log.info("sendPost - {}", url);
|
||||
URL realUrl = new URL(url);
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
conn.setRequestProperty("Accept-Charset", "utf-8");
|
||||
conn.setRequestProperty("contentType", "utf-8");
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
out.print(param);
|
||||
out.flush();
|
||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null)
|
||||
{
|
||||
result.append(line);
|
||||
}
|
||||
log.info("recv - {}", result);
|
||||
}
|
||||
catch (ConnectException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (SocketTimeoutException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (out != null)
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
if (in != null)
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
log.error("调用in.close Exception, url=" + url + ",param=" + param, ex);
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String sendSSLPost(String url, String param)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
String urlNameString = url + "?" + param;
|
||||
try
|
||||
{
|
||||
log.info("sendSSLPost - {}", urlNameString);
|
||||
SSLContext sc = SSLContext.getInstance("SSL");
|
||||
sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom());
|
||||
URL console = new URL(urlNameString);
|
||||
HttpsURLConnection conn = (HttpsURLConnection) console.openConnection();
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
conn.setRequestProperty("Accept-Charset", "utf-8");
|
||||
conn.setRequestProperty("contentType", "utf-8");
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
|
||||
conn.setSSLSocketFactory(sc.getSocketFactory());
|
||||
conn.setHostnameVerifier(new TrustAnyHostnameVerifier());
|
||||
conn.connect();
|
||||
InputStream is = conn.getInputStream();
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||
String ret = "";
|
||||
while ((ret = br.readLine()) != null)
|
||||
{
|
||||
if (ret != null && !"".equals(ret.trim()))
|
||||
{
|
||||
result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
log.info("recv - {}", result);
|
||||
conn.disconnect();
|
||||
br.close();
|
||||
}
|
||||
catch (ConnectException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (SocketTimeoutException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static class TrustAnyTrustManager implements X509TrustManager
|
||||
{
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers()
|
||||
{
|
||||
return new X509Certificate[] {};
|
||||
}
|
||||
}
|
||||
|
||||
private static class TrustAnyHostnameVerifier implements HostnameVerifier
|
||||
{
|
||||
@Override
|
||||
public boolean verify(String hostname, SSLSession session)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,28 +1,7 @@
|
|||
package com.jwl.driver.server.util;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 微信支付工具
|
||||
*/
|
||||
public class WechatPayUtil {
|
||||
|
||||
/**
|
||||
* 获取微信openID
|
||||
* @param appId
|
||||
* @param appSecret
|
||||
* @param jsCode
|
||||
* @return
|
||||
*/
|
||||
public static String getOpenId(String appId, String appSecret, String jsCode){
|
||||
String url = "https://api.weixin.qq.com/sns/jscode2session?appid="+appId
|
||||
+"&secret="+appSecret+"&js_code="+jsCode+"&grant_type=authorization_code";
|
||||
String result = HttpUtils.sendGet(url);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if(!jsonObject.isEmpty() && (jsonObject.get("openid")!=null)){
|
||||
return jsonObject.get("openid").toString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package com.jwl.driver.server.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("微信支付")
|
||||
public class AppletPayVo {
|
||||
|
||||
@ApiModelProperty("支付金额")
|
||||
private Double money;//金额
|
||||
|
||||
@ApiModelProperty("小程序端 获取的code")
|
||||
private String code;//小程序端 获取的code
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("支付描述")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty("商户系统的订单号")
|
||||
private String outTradeNo;
|
||||
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package com.jwl.driver.server.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("H5支付")
|
||||
@Data
|
||||
public class H5PayVo {
|
||||
@ApiModelProperty("支付金额")
|
||||
private Double money;//金额
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("支付描述")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty("商户系统的订单号")
|
||||
private String outTradeNo;
|
||||
|
||||
@ApiModelProperty("用户的客户端IP")
|
||||
private String clientIp;
|
||||
}
|
|
@ -60,12 +60,6 @@ public class LoginUserVo {
|
|||
@ApiModelProperty("驾校名称")
|
||||
private String schoolName;
|
||||
|
||||
/**
|
||||
* 驾校电话
|
||||
*/
|
||||
@ApiModelProperty("驾校电话")
|
||||
private String schoolPhone;
|
||||
|
||||
/**
|
||||
* 驾校名称
|
||||
*/
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package com.jwl.driver.server.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 驾考题目出参
|
||||
|
@ -16,7 +15,7 @@ import java.util.List;
|
|||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("驾考题目出参")
|
||||
public class QuestionVo {
|
||||
public class QusetionVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -128,9 +127,6 @@ public class QuestionVo {
|
|||
@ApiModelProperty("选择")
|
||||
private String options;
|
||||
|
||||
@ApiModelProperty("选项列表")
|
||||
private List<QuestionOption> optionList;
|
||||
|
||||
/**
|
||||
* 题目类型,1:选择题 2:判断题,3:多选题
|
||||
*/
|
||||
|
@ -193,19 +189,4 @@ public class QuestionVo {
|
|||
*/
|
||||
@ApiModelProperty("是否密卷2")
|
||||
private Integer isExam2;
|
||||
|
||||
|
||||
@Data
|
||||
@Accessors
|
||||
@AllArgsConstructor
|
||||
public static class QuestionOption{
|
||||
@ApiModelProperty("选项")
|
||||
private String op;
|
||||
|
||||
@ApiModelProperty("选项描述")
|
||||
private String opDesc;
|
||||
|
||||
@ApiModelProperty("选项值")
|
||||
private String opValue;
|
||||
}
|
||||
}
|
|
@ -1,16 +1,11 @@
|
|||
spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# host: 127.0.0.1
|
||||
# port: 6379
|
||||
# database: 8
|
||||
# timeout: 5000
|
||||
# auth: caolin123
|
||||
host: 118.31.23.45
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
database: 8
|
||||
timeout: 5000
|
||||
password: 123456
|
||||
auth: caolin123
|
||||
|
||||
|
||||
# 数据库 配置
|
||||
|
|
|
@ -44,7 +44,6 @@ driver:
|
|||
- /driver-api/tdSysUser/code
|
||||
- /tdQuestion/duima/list
|
||||
- /tdQuestion/duima/update
|
||||
- /payNoticeLog
|
||||
|
||||
# 需要权限校验url集合
|
||||
needAuthEndPoints:
|
||||
|
@ -61,12 +60,9 @@ message:
|
|||
|
||||
|
||||
wechatpay:
|
||||
appId: wx756a7425037609fb
|
||||
appSecret: 3e8053032b16c574e38d554ddd438cfd
|
||||
mchId: 1650477646
|
||||
apiV3Key: JingWuLianJiaKao20120813ZhouHong
|
||||
mchSerialNo: 52974C99DFCC518EA2E5AD20C3753E38B924868D
|
||||
privateKeyPath: classpath*:/wechatPay/apiclient_key.pem
|
||||
payNoticeUrl: https://jwl.ahduima.com/driver-api/payNoticeLog
|
||||
|
||||
appId: 'wx756a7425037609fb'
|
||||
mchId: '1650477646'
|
||||
apiV3Key: 'JingWuLianJiaKao20120813ZhouHong'
|
||||
mchSerialNo: '52974C99DFCC518EA2E5AD20C3753E38B924868D'
|
||||
privateKeyPath: 'classpath*:/wechatPay/**Mapper.xml'
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jwl.driver.server.mapper.TdQuestionMapper">
|
||||
|
||||
<select id="queryQuestion" resultType="com.jwl.driver.server.vo.QuestionVo">
|
||||
<select id="queryQuestion" resultType="com.jwl.driver.server.vo.QusetionVo">
|
||||
select
|
||||
tq.QUESTION_ID,
|
||||
tq.QUESTION,
|
||||
|
@ -76,7 +76,7 @@
|
|||
order by tq.SHOW_ORDER asc
|
||||
</select>
|
||||
|
||||
<select id="queryQuestionByRandom" resultType="com.jwl.driver.server.vo.QuestionVo">
|
||||
<select id="queryQuestionByRandom" resultType="com.jwl.driver.server.vo.QusetionVo">
|
||||
select
|
||||
tq.QUESTION_ID,
|
||||
tq.QUESTION,
|
||||
|
@ -123,32 +123,32 @@
|
|||
order by rand() limit ${queryDto.num};
|
||||
</select>
|
||||
|
||||
<update id="updateQuestion" parameterType="com.jwl.driver.server.vo.QuestionVo">
|
||||
<update id="updateQuestion" parameterType="com.jwl.driver.server.vo.QusetionVo">
|
||||
update td_question
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="questionVo.isVip !=null">
|
||||
IS_VIP = #{questionVo.isVip},
|
||||
<if test="qusetionVo.isVip !=null">
|
||||
IS_VIP = #{qusetionVo.isVip},
|
||||
</if>
|
||||
<if test="questionVo.isError !=null">
|
||||
IS_ERROR = #{questionVo.isError},
|
||||
<if test="qusetionVo.isError !=null">
|
||||
IS_ERROR = #{qusetionVo.isError},
|
||||
</if>
|
||||
<if test="questionVo.isNew !=null">
|
||||
IS_NEW = #{questionVo.isNew},
|
||||
<if test="qusetionVo.isNew !=null">
|
||||
IS_NEW = #{qusetionVo.isNew},
|
||||
</if>
|
||||
<if test="questionVo.examKeys !=null">
|
||||
EXAM_KEYS = #{questionVo.examKeys},
|
||||
<if test="qusetionVo.examKeys !=null">
|
||||
EXAM_KEYS = #{qusetionVo.examKeys},
|
||||
</if>
|
||||
<if test="questionVo.isVip2 !=null">
|
||||
IS_VIP2 = #{questionVo.isVip2},
|
||||
<if test="qusetionVo.isVip2 !=null">
|
||||
IS_VIP2 = #{qusetionVo.isVip2},
|
||||
</if>
|
||||
<if test="questionVo.isExam1 !=null">
|
||||
IS_EXAM1 = #{questionVo.isExam1},
|
||||
<if test="qusetionVo.isExam1 !=null">
|
||||
IS_EXAM1 = #{qusetionVo.isExam1},
|
||||
</if>
|
||||
<if test="questionVo.isExam2 !=null">
|
||||
IS_EXAM2 = #{questionVo.isExam2},
|
||||
<if test="qusetionVo.isExam2 !=null">
|
||||
IS_EXAM2 = #{qusetionVo.isExam2},
|
||||
</if>
|
||||
</trim>
|
||||
where QUESTION_ID = #{questionVo.questionId}
|
||||
where QUESTION_ID = #{qusetionVo.questionId}
|
||||
</update>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue