Compare commits
No commits in common. "master" and "dev-zcx" have entirely different histories.
26
pom.xml
26
pom.xml
|
@ -20,17 +20,6 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- 使用谷歌的gson来实现json的传递-->
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
@ -63,13 +52,6 @@
|
|||
<version>${mybatis-plus-boot-starter.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.28</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
|
@ -186,14 +168,6 @@
|
|||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<testFailureIgnore>true</testFailureIgnore>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ public class CorsConfig implements WebMvcConfigurer {
|
|||
"/error",
|
||||
"/webjars/**",
|
||||
"/doc.html",
|
||||
"/tdQuestion/duima/*",
|
||||
"/tdSysUserMember/duima/**");
|
||||
"/tdQuestion/duima/*");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,11 +30,8 @@ public class RedisConfig {
|
|||
serializer.setObjectMapper(mapper);
|
||||
|
||||
redisTemplate.setValueSerializer(serializer);
|
||||
redisTemplate.setHashValueSerializer(serializer);
|
||||
//使用StringRedisSerializer来序列化和反序列化redis的key值
|
||||
redisTemplate.setKeySerializer(serializer);
|
||||
redisTemplate.setHashValueSerializer(serializer);
|
||||
// redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.afterPropertiesSet();
|
||||
return redisTemplate;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ public class Constants {
|
|||
public static String MESSAGE_CODE_PREFIX = "code_";
|
||||
|
||||
//短信验证码的模板
|
||||
// public static String MESSAGE_TEMPLATE = "SMS_198880447";
|
||||
public static String MESSAGE_TEMPLATE = "SMS_463155307";
|
||||
public static String MESSAGE_TEMPLATE = "SMS_198880447";
|
||||
|
||||
//是否有效-有效
|
||||
public static String IS_ACTIVE_TRUE = "0";
|
||||
|
@ -36,45 +35,16 @@ public class Constants {
|
|||
//科目四
|
||||
public static String SUBJECT_FOUR = "4";
|
||||
|
||||
//判断题
|
||||
//单选题
|
||||
public static String QUESTION_TYPE_ONE = "1";
|
||||
|
||||
//单选题
|
||||
//判断题
|
||||
public static String QUESTION_TYPE_TWO = "2";
|
||||
|
||||
//多选题
|
||||
public static String QUESTION_TYPE_THREE = "3";
|
||||
|
||||
//字典表题目科一分类标识
|
||||
public static String QUESTION_CATEGORY_OF_SUBJECT_ONE = "QusetionCategoryOfSubjectOne";
|
||||
|
||||
//字典表题目科四分类标识
|
||||
public static String QUESTION_CATEGORY_OF_SUBJECT_FOUR = "QusetionCategoryOfSubjectFour";
|
||||
|
||||
//微信支付
|
||||
public static String WECHAT_PAY = "weChatPay";
|
||||
|
||||
//题库版本前缀
|
||||
public static String QUESTION_VERSOPN_PREFIX = "QuestionVersion_";
|
||||
|
||||
//redis 有效期(单位秒)
|
||||
public static String REDIS_EXPIRE_TIME = "RedisExprieTime";
|
||||
|
||||
//考试题型数量配置项
|
||||
public static String TEST_QUESTION_TYPE_NUM = "TestQuestionTypeNum";
|
||||
|
||||
//配置项列表前缀
|
||||
public static String CONFIG_LIST_PREFIX = "configListOf_";
|
||||
|
||||
//配置项前缀
|
||||
public static String CONFIG_PREFIX = "configOf_";
|
||||
|
||||
//专项数量前缀
|
||||
public static String SPECIAL_NUM_PREFIX= "SpecialNum_";
|
||||
|
||||
//token手机号前缀
|
||||
public static String PHONE_PREFIX= "loginPhone_";
|
||||
|
||||
|
||||
//字典表题目分类标识
|
||||
public static String QUESTION_CATEGORY = "QusetionCategory";
|
||||
|
||||
}
|
||||
|
|
|
@ -31,9 +31,6 @@ public class ErrorCode {
|
|||
// 业务异常编码,异常原因已知
|
||||
public static final String BUSINESS = "E008";
|
||||
|
||||
// 题库版本异常
|
||||
public static final String VERSION_ERROR = "4001";
|
||||
|
||||
public static final String NOT_SHOW = "NOO1";
|
||||
|
||||
private ErrorCode() {
|
||||
|
|
|
@ -1,43 +1,30 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
import com.jwl.driver.server.config.WechatPayConfig;
|
||||
import com.jwl.driver.server.entity.OrderPayInfo;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.service.IOrderPayInfoService;
|
||||
import com.jwl.driver.server.util.InputStreamUtil;
|
||||
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.core.util.IOUtil;
|
||||
import com.wechat.pay.java.core.util.PemUtil;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
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 org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 微信支付小程序 接口
|
||||
*/
|
||||
@Api(tags = "小程序支付")
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/applet/pay")
|
||||
@Slf4j
|
||||
public class AppletPayController {
|
||||
|
@ -45,37 +32,30 @@ public class AppletPayController {
|
|||
@Resource
|
||||
private WechatPayConfig wechatPayConfig;
|
||||
|
||||
@Autowired
|
||||
private IOrderPayInfoService orderPayInfoService;
|
||||
|
||||
//生成预支付订单
|
||||
@ApiOperation("生成预支付订单")
|
||||
@PostMapping("/prepay")
|
||||
public BaseResponse createPrepay(@RequestBody AppletPayVo payDto){
|
||||
// 构建service
|
||||
log.info("payDto===================>{}",payDto);
|
||||
JsapiServiceExtension service = createService();
|
||||
OrderPayInfo orderPayInfo = orderPayInfoService.createOrderPayInfo(payDto.getMoney(),payDto.getUserId(), payDto.getDescription(), payDto.getTradeType(), payDto.getOutTradeNo(),"applet");
|
||||
|
||||
// 请求下单参数
|
||||
PrepayRequest request = new PrepayRequest();
|
||||
Amount amount = new Amount();
|
||||
amount.setTotal(Integer.valueOf((payDto.getMoney().multiply(new BigDecimal("100")).setScale(0).toString())+""));
|
||||
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(orderPayInfo.getPayId().toString());
|
||||
request.setOutTradeNo(payDto.getOutTradeNo());
|
||||
|
||||
Payer payer = new Payer();
|
||||
payer.setOpenid(WechatPayUtil.getOpenId(wechatPayConfig.getAppId(), wechatPayConfig.getAppSecret(), payDto.getCode()));
|
||||
request.setPayer(payer);
|
||||
// 调用下单方法,得到应答
|
||||
PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);
|
||||
// 使用微信扫描 code_url 对应的二维码,即可体验Native支付
|
||||
log.info("response=================>{}",response);
|
||||
// return BaseResponse.success();
|
||||
// log.info(response);
|
||||
return BaseResponse.success(response);
|
||||
|
||||
}
|
||||
|
@ -85,8 +65,7 @@ public class AppletPayController {
|
|||
Config config =
|
||||
new RSAAutoCertificateConfig.Builder()
|
||||
.merchantId(wechatPayConfig.getMchId())
|
||||
.privateKey(PemUtil.loadPrivateKeyFromString(InputStreamUtil.getContentStr("wechatPay/apiclient_key.pem")))
|
||||
// .privateKeyFromPath(wechatPayConfig.getPrivateKeyPath())
|
||||
.privateKeyFromPath(wechatPayConfig.getPrivateKeyPath())
|
||||
.merchantSerialNumber(wechatPayConfig.getMchSerialNo())
|
||||
.apiV3Key(wechatPayConfig.getApiV3Key())
|
||||
.build();
|
||||
|
|
|
@ -1,42 +1,29 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
import com.jwl.driver.server.config.WechatPayConfig;
|
||||
import com.jwl.driver.server.entity.OrderPayInfo;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.service.IOrderPayInfoService;
|
||||
import com.jwl.driver.server.util.InputStreamUtil;
|
||||
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.core.util.IOUtil;
|
||||
import com.wechat.pay.java.core.util.PemUtil;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
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 org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 微信支付小程序 接口
|
||||
*/
|
||||
@Api(tags = "H5支付")
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/H5/pay")
|
||||
@Slf4j
|
||||
public class H5PayController {
|
||||
|
@ -44,46 +31,40 @@ public class H5PayController {
|
|||
@Resource
|
||||
private WechatPayConfig wechatPayConfig;
|
||||
|
||||
@Autowired
|
||||
private IOrderPayInfoService orderPayInfoService;
|
||||
|
||||
//生成预支付订单
|
||||
@ApiOperation("生成预支付订单")
|
||||
@PostMapping("/prepay")
|
||||
public BaseResponse createPrepay(@RequestBody H5PayVo payVo){
|
||||
// 构建service
|
||||
H5Service service = createService();
|
||||
//在order_pay_info里新增一条数据
|
||||
OrderPayInfo orderPayInfo = orderPayInfoService.createOrderPayInfo(payVo.getMoney(),payVo.getUserId(),payVo.getDescription(), payVo.getTradeType(), payVo.getOutTradeNo(), "h5");
|
||||
|
||||
// 请求下单参数
|
||||
// 请求下单参数
|
||||
PrepayRequest request = new PrepayRequest();
|
||||
Amount amount = new Amount();
|
||||
amount.setTotal(Integer.valueOf((payVo.getMoney().multiply(new BigDecimal("100")).setScale(0).toString())+""));
|
||||
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(orderPayInfo.getPayId().toString());
|
||||
request.setOutTradeNo(payVo.getOutTradeNo());
|
||||
//场景参数
|
||||
SceneInfo sceneInfo = new SceneInfo();
|
||||
sceneInfo.setPayerClientIp(payVo.getClientIp());
|
||||
request.setSceneInfo(sceneInfo);
|
||||
|
||||
// 调用下单方法,得到应答
|
||||
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())
|
||||
.privateKey(PemUtil.loadPrivateKeyFromString(InputStreamUtil.getContentStr("wechatPay/apiclient_key.pem")))
|
||||
// .privateKeyFromPath(wechatPayConfig.getPrivateKeyPath())
|
||||
.privateKeyFromPath(wechatPayConfig.getPrivateKeyPath())
|
||||
.merchantSerialNumber(wechatPayConfig.getMchSerialNo())
|
||||
.apiV3Key(wechatPayConfig.getApiV3Key())
|
||||
.build();
|
||||
|
|
|
@ -1,27 +1,20 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jwl.driver.server.config.WechatPayConfig;
|
||||
import com.jwl.driver.server.entity.OrderPayInfo;
|
||||
import com.jwl.driver.server.enums.PurchaseProductTypeEnum;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.service.IOrderPayInfoService;
|
||||
import com.jwl.driver.server.service.ITdMemberService;
|
||||
import com.jwl.driver.server.service.ITdSysUserMemberService;
|
||||
import com.jwl.driver.server.util.InputStreamUtil;
|
||||
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 com.wechat.pay.java.core.util.PemUtil;
|
||||
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.http.HttpRequest;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
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;
|
||||
|
@ -37,19 +30,12 @@ import javax.annotation.Resource;
|
|||
* @since 2023-08-10
|
||||
*/
|
||||
@Api(tags = "支付回调")
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/payNoticeLog")
|
||||
@Slf4j
|
||||
public class PayNoticeLogController {
|
||||
@Resource
|
||||
private WechatPayConfig wechatPayConfig;
|
||||
|
||||
@Autowired
|
||||
private ITdSysUserMemberService userMemberService;
|
||||
|
||||
@Autowired
|
||||
private IOrderPayInfoService payInfoService;
|
||||
|
||||
/**
|
||||
* 支付回调接口 本接口不能做验证
|
||||
* @param wechatPayCertificateSerialNumber
|
||||
|
@ -66,12 +52,10 @@ public class PayNoticeLogController {
|
|||
@RequestHeader("Wechatpay-Timestamp") String timstamp,
|
||||
@RequestHeader("Wechatpay-Nonce") String nonce,
|
||||
@RequestBody String requestBody){
|
||||
log.info("支付回调信息==============》{}",requestBody);
|
||||
NotificationConfig config = new RSAAutoCertificateConfig.Builder()
|
||||
.merchantId(wechatPayConfig.getMchId())
|
||||
.privateKey(PemUtil.loadPrivateKeyFromString(InputStreamUtil.getContentStr("wechatPay/apiclient_key.pem")))
|
||||
// .privateKeyFromPath(wechatPayConfig.getPrivateKeyPath())
|
||||
.merchantSerialNumber(wechatPayConfig.getMchSerialNo())
|
||||
.privateKeyFromPath(wechatPayConfig.getPrivateKeyPath())
|
||||
.merchantSerialNumber(wechatPayConfig.getPrivateKeyPath())
|
||||
.apiV3Key(wechatPayConfig.getApiV3Key())
|
||||
.build();
|
||||
RequestParam requestParam = new RequestParam.Builder()
|
||||
|
@ -92,22 +76,11 @@ public class PayNoticeLogController {
|
|||
System.out.println("decryptObject="+decryptObject.toJSONString());
|
||||
|
||||
String trade_state=decryptObject.getString("trade_state");
|
||||
//取业务id
|
||||
String outTradeNo = decryptObject.getString("out_trade_no");
|
||||
JSONObject jsonResponse = new JSONObject();
|
||||
OrderPayInfo payInfo = payInfoService.getById(Long.parseLong(outTradeNo));
|
||||
if(trade_state.equals("SUCCESS")) {
|
||||
//各种业务逻辑
|
||||
//1.订单详情表里修改数据
|
||||
payInfoService.payNotice(payInfo,Boolean.TRUE);
|
||||
//2.如果购买商品是会员则冲会员,其余的则不做操作
|
||||
if (StrUtil.equals(payInfo.getPurchaseProductType(), PurchaseProductTypeEnum.MEMBER.getValue())){
|
||||
userMemberService.purchaseMember(payInfo);
|
||||
}
|
||||
}else{
|
||||
//还是各种业务逻辑
|
||||
//1.订单详情表里修改数据
|
||||
payInfoService.payNotice(payInfo,Boolean.FALSE);
|
||||
}
|
||||
jsonResponse.put("code", "SUCCESS");
|
||||
jsonResponse.put("message", "成功");
|
||||
|
|
|
@ -4,7 +4,6 @@ package com.jwl.driver.server.controller;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -14,9 +13,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/payPrepay")
|
||||
@Controller
|
||||
@RequestMapping("//payPrepay")
|
||||
public class PayPrepayController {
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.jwl.driver.server.dto.MemberQueryDto;
|
|||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.service.ITdMemberService;
|
||||
import com.jwl.driver.server.util.SecurityUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -47,6 +46,6 @@ public class TdMemberController {
|
|||
@PostMapping("/queryUserMember")
|
||||
public BaseResponse queryUserMember(@RequestBody MemberQueryDto queryDto) {
|
||||
log.info("获取用户会员列表======>queryDto:{}", queryDto);
|
||||
return BaseResponse.success(memberService.queryUserMember(queryDto, SecurityUtil.getUserId()));
|
||||
return BaseResponse.success(memberService.queryUserMember(queryDto));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
|
||||
import com.jwl.driver.server.dto.ProjectDto;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.service.ITdProjectService;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 考试项目表; 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Api(tags = "考试项目")
|
||||
@RestController
|
||||
@RequestMapping("/tdTestProject")
|
||||
@Slf4j
|
||||
public class TdProjectController {
|
||||
|
||||
@Autowired
|
||||
private ITdProjectService projectService;
|
||||
|
||||
@ApiOperation("获取项目列表 (考试项目和基础操作)")
|
||||
@PostMapping("/queryProjectList")
|
||||
public BaseResponse list(@RequestBody ProjectDto projectDto) {
|
||||
log.info("获取考试项目=========》projectDto{}",projectDto);
|
||||
return BaseResponse.success(projectService.queryProjectList(projectDto));
|
||||
}
|
||||
}
|
|
@ -2,19 +2,19 @@ package com.jwl.driver.server.controller;
|
|||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.jwl.driver.server.dto.QuestionAddDto;
|
||||
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 javax.validation.Valid;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -44,6 +44,7 @@ public class TdQuestionController {
|
|||
return BaseResponse.success(tdQuestionService.queryQuestionById(queryDto));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("根据id列表获取题目")
|
||||
@PostMapping("/queryQuestionByIdList")
|
||||
public BaseResponse queryQuestionByIdList(@RequestBody QuestionQueryDto queryDto) {
|
||||
|
@ -51,20 +52,14 @@ public class TdQuestionController {
|
|||
return BaseResponse.success(tdQuestionService.queryQuestionByIdList(queryDto));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("根据查询条件获取题目")
|
||||
@PostMapping("/queryQuestion")
|
||||
public BaseResponse queryQuestion(@RequestBody QuestionQueryDto queryDto) {
|
||||
log.info("根据查询条件获取题目======>queryDto:{}", queryDto);
|
||||
log.info("获取题型======>queryDto:{}", queryDto);
|
||||
return BaseResponse.success(tdQuestionService.queryQuestion(queryDto));
|
||||
}
|
||||
|
||||
@ApiOperation("根据查询条件获取题目Id")
|
||||
@PostMapping("/queryQuestionId")
|
||||
public BaseResponse queryQuestionId(@RequestBody QuestionQueryDto queryDto) {
|
||||
log.info("根据查询条件获取题目Id======>queryDto:{}", queryDto);
|
||||
return BaseResponse.success(tdQuestionService.queryQuestionId(queryDto));
|
||||
}
|
||||
|
||||
@ApiOperation("获取模拟考试题目")
|
||||
@PostMapping("/getTestQuestion")
|
||||
public BaseResponse getTestQuestion(@RequestBody QuestionQueryDto queryDto) {
|
||||
|
@ -75,13 +70,6 @@ public class TdQuestionController {
|
|||
return BaseResponse.success(tdQuestionService.getTestQuestion(queryDto));
|
||||
}
|
||||
|
||||
@ApiOperation("获取模拟考试题目Id")
|
||||
@PostMapping("/getTestQuestionId")
|
||||
public BaseResponse getTestQuestionId(@RequestBody QuestionQueryDto queryDto) {
|
||||
log.info("根据查询条件获取题目Id======>queryDto:{}", queryDto);
|
||||
return BaseResponse.success(tdQuestionService.getTestQuestionId(queryDto));
|
||||
}
|
||||
|
||||
@ApiOperation("题目分类")
|
||||
@PostMapping("/questionCategory")
|
||||
public BaseResponse questionCategory(@RequestBody QuestionQueryDto queryDto) {
|
||||
|
@ -104,29 +92,13 @@ 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;
|
||||
}
|
||||
|
||||
@ApiOperation("新增题库")
|
||||
@PostMapping("/insert")
|
||||
public Map insertQuestion(@RequestBody @Valid QuestionAddDto addDto) {
|
||||
log.info("新增题库======>QuestionAddDto:{}", addDto);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("code", 200);
|
||||
result.put("data", tdQuestionService.insertQuestion(addDto));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("查询各专项分类题目数量")
|
||||
@PostMapping("/querySpecialNum")
|
||||
public BaseResponse querySpecialNum(@RequestBody QuestionQueryDto queryDto) {
|
||||
log.info("查询各专项分类题目数量======>queryDto:{}", queryDto);
|
||||
return BaseResponse.success(tdQuestionService.querySpecialNum(queryDto));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.jwl.driver.server.controller;
|
|||
|
||||
|
||||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||
import com.jwl.driver.server.dto.TestQueryDto;
|
||||
import com.jwl.driver.server.dto.TestSubmitDto;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.service.ITdQuestionService;
|
||||
|
@ -41,10 +40,7 @@ public class TdQuestionTestController {
|
|||
return BaseResponse.success(testService.testSubmit(submitDto));
|
||||
}
|
||||
|
||||
@ApiOperation("获取考试统计")
|
||||
@PostMapping("/testTotal")
|
||||
public BaseResponse testTotal(@RequestBody @Valid TestQueryDto queryDto) {
|
||||
log.info("考试统计查询======>queryDto:{}", queryDto);
|
||||
return BaseResponse.success(testService.testTotal(queryDto));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
|
||||
import com.jwl.driver.server.dto.TestSubmitDto;
|
||||
import com.jwl.driver.server.entity.TdQuestionVersion;
|
||||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.service.ITdQuestionVersionService;
|
||||
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 javax.validation.Valid;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 题库版本表; 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-09-03
|
||||
*/
|
||||
@Api(tags = "题库版本")
|
||||
@RestController
|
||||
@RequestMapping("/tdQuestionVersion")
|
||||
@Slf4j
|
||||
public class TdQuestionVersionController {
|
||||
|
||||
@Autowired
|
||||
private ITdQuestionVersionService versionService;
|
||||
|
||||
@ApiOperation("获取题库当前版本")
|
||||
@GetMapping("/currentVersion")
|
||||
public BaseResponse testSubmit(@RequestParam Integer carTypeId) {
|
||||
log.info("获取题库当前版本======>carTypeId:{}", carTypeId);
|
||||
return BaseResponse.success(versionService.currentVersion(carTypeId));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("题库版本更新")
|
||||
@PostMapping("/addVersion")
|
||||
public BaseResponse addVersion(@RequestBody TdQuestionVersion versionDto) {
|
||||
log.info("题库版本更新======>versionDto:{}", versionDto);
|
||||
if (Objects.isNull(versionDto.getCarTypeId())){
|
||||
throw new BusinessException("缺少必要参数");
|
||||
}
|
||||
|
||||
return BaseResponse.success(versionService.addVersion(versionDto));
|
||||
}
|
||||
|
||||
}
|
|
@ -41,31 +41,21 @@ public class TdSysConfigListController {
|
|||
@ApiOperation("根据configKey和carTypeId查询系统配置列表")
|
||||
@GetMapping("/querySysConfigList")
|
||||
public BaseResponse querySysConfigList(@RequestParam("configKey") String configKey, @RequestParam("carTypeId") Integer carTypeId) {
|
||||
log.info("request to querySysConfigList :{}, carTypeId:{}", configKey,carTypeId);
|
||||
log.info("request to querySysConfigList :{}", configKey);
|
||||
List<TdSysConfigList> resultList = configListService.querySysConfigList(configKey, carTypeId);
|
||||
return BaseResponse.success(resultList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过多个configKey(以逗号分隔) 和 carTypeId 查询多个配置列表
|
||||
* 通过多个配置key 和 carTypeId 查询多个配置列表
|
||||
*/
|
||||
@ApiOperation("通过多个configKey(以逗号分隔) 和 carTypeId 查询多个配置列表")
|
||||
@ApiOperation("通过多个配置key 和 carTypeId 查询多个配置列表")
|
||||
@GetMapping("/querySysConfigMap")
|
||||
public BaseResponse querySysConfigMap(@RequestParam("configKeys") String configKeys, @RequestParam("carTypeId") Integer carTypeId) {
|
||||
log.info("request to querySysConfigMap :{}, carTypeId:{}", configKeys,carTypeId);
|
||||
log.info("request to querySysConfigList :{}", configKeys);
|
||||
Map<String, Map<String, String>> map = configListService.querySysConfigMap(Arrays.asList(configKeys.split(",")), carTypeId);
|
||||
return BaseResponse.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据configKey和carTypeId查询系统配置列表数量
|
||||
*/
|
||||
@ApiOperation("根据configKey和carTypeId查询系统配置列表数量")
|
||||
@GetMapping("/querySysConfigListNum")
|
||||
public BaseResponse querySysConfigListNum(@RequestParam("configKey") String configKey, @RequestParam("carTypeId") Integer carTypeId) {
|
||||
log.info("request to querySysConfigListNum :{}, carTypeId:{}", configKey,carTypeId);
|
||||
Integer listNum = configListService.querySysConfigListNum(configKey, carTypeId);
|
||||
return BaseResponse.success(listNum);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,35 +1,10 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jwl.driver.server.dto.MemberQueryDto;
|
||||
import com.jwl.driver.server.dto.UserMemberDto;
|
||||
import com.jwl.driver.server.entity.TdSysUser;
|
||||
import com.jwl.driver.server.entity.TdSysUserMember;
|
||||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.service.ITdCarService;
|
||||
import com.jwl.driver.server.service.ITdMemberService;
|
||||
import com.jwl.driver.server.service.ITdSysUserMemberService;
|
||||
import com.jwl.driver.server.service.ITdSysUserService;
|
||||
import com.jwl.driver.server.vo.MemberVo;
|
||||
import com.jwl.driver.server.vo.UserMemberVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.User;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户会员表; 前端控制器
|
||||
|
@ -38,87 +13,8 @@ import java.util.Map;
|
|||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tdSysUserMember")
|
||||
@Slf4j
|
||||
@Api(tags = "用户会员")
|
||||
@Controller
|
||||
@RequestMapping("//tdSysUserMember")
|
||||
public class TdSysUserMemberController {
|
||||
|
||||
@Resource
|
||||
private ITdMemberService memberService;
|
||||
@Resource
|
||||
private ITdSysUserMemberService userMemberService;
|
||||
@Resource
|
||||
private ITdCarService tdCarService;
|
||||
@Resource
|
||||
private ITdSysUserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询会员列表
|
||||
* */
|
||||
@ApiOperation("查询车型列表")
|
||||
@GetMapping("/duima/car/list")
|
||||
public Map getCarList(){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("code", 200);
|
||||
result.put("data", tdCarService.list());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询会员列表
|
||||
* */
|
||||
@ApiOperation("查询会员类型列表")
|
||||
@GetMapping("/duima/member/list")
|
||||
public Map getMemberList(MemberQueryDto memberQueryDto){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("code", 200);
|
||||
result.put("data", memberService.queryMember(memberQueryDto));
|
||||
return result;
|
||||
}
|
||||
|
||||
//查询用户会员列表
|
||||
@ApiOperation("查询会员用户列表")
|
||||
@GetMapping("/duima/user/member/list")
|
||||
public Map getUserMemberList(UserMemberDto userMemberDto){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("code", 200);
|
||||
result.put("data", userMemberService.queryUserMemberList(userMemberDto));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//新增会员
|
||||
|
||||
@ApiOperation("新增用户会员")
|
||||
@PostMapping("/duima/user/member")
|
||||
public Map addUserMember(@RequestBody UserMemberVo userMemberVo){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
final LocalDateTime nowTime = LocalDateTime.now();
|
||||
|
||||
//跟进手机号查询用户
|
||||
LambdaQueryWrapper<TdSysUser> cond = new LambdaQueryWrapper<TdSysUser>()
|
||||
.eq(TdSysUser::getPhone,userMemberVo.getPhone());
|
||||
TdSysUser user = userService.getOne(cond);
|
||||
if(user == null){
|
||||
result.put("code", 500);
|
||||
result.put("msg", "用户不存在");
|
||||
return result;
|
||||
}
|
||||
|
||||
TdSysUserMember userMember = new TdSysUserMember()
|
||||
.setMemberId(userMemberVo.getMemberId())
|
||||
.setUserId(user.getUserId())
|
||||
.setCreateTime(nowTime)
|
||||
.setUpdateTime(nowTime)
|
||||
.setStartDate(LocalDateTime.of(LocalDate.now(), LocalTime.MIN))
|
||||
.setEndDate(LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusYears(1).minusSeconds(1));
|
||||
result.put("code", 200);
|
||||
result.put("data", userMemberService.saveOrUpdate(userMember));
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 考试项目表; 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("//tdTestProject")
|
||||
public class TdTestProjectController {
|
||||
|
||||
}
|
|
@ -11,10 +11,10 @@ import org.springframework.stereotype.Controller;
|
|||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-20
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("//tdVideos")
|
||||
public class TdVideosController {
|
||||
@RequestMapping("//tdTestProjectVideos")
|
||||
public class TdTestProjectVideosController {
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
||||
|
||||
}
|
|
@ -23,6 +23,6 @@ public class LoginUserDto {
|
|||
@NotBlank(message = "登陆验证码不能为空")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "来源")
|
||||
private String id;
|
||||
@ApiModelProperty(value = "驾校id",required = false)
|
||||
private Long schoolId;
|
||||
}
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
package com.jwl.driver.server.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 考试项目查询;
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("考试项目查询入参")
|
||||
public class ProjectDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 考试项目
|
||||
*/
|
||||
@ApiModelProperty("考试项目")
|
||||
private Integer projectId;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@ApiModelProperty("类型 1:考试项目 2:基础操作")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 所属科目
|
||||
*/
|
||||
@ApiModelProperty("所属科目")
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 车型标识
|
||||
*/
|
||||
@ApiModelProperty("车型标识")
|
||||
private Integer carTypeId;
|
||||
|
||||
/**
|
||||
* 驾驶类型,手动挡,自动挡,A2:B2等(在字典表里配置)
|
||||
*/
|
||||
@ApiModelProperty("驾驶类型")
|
||||
private String driveType;
|
||||
|
||||
}
|
|
@ -93,57 +93,4 @@ public class QuestionQueryDto implements Serializable {
|
|||
@ApiModelProperty("题目")
|
||||
private String question;
|
||||
|
||||
/**
|
||||
* 是否易错
|
||||
*/
|
||||
@ApiModelProperty("是否易错")
|
||||
private Integer isError;
|
||||
/**
|
||||
* 是否v新规
|
||||
*/
|
||||
@ApiModelProperty("是否v新规")
|
||||
private Integer isNew;
|
||||
|
||||
/**
|
||||
* 是否是图片
|
||||
*/
|
||||
@ApiModelProperty("是否是图片")
|
||||
private Integer isImage;
|
||||
|
||||
/**
|
||||
* 考点
|
||||
*/
|
||||
@ApiModelProperty("考点")
|
||||
private String examKey;
|
||||
|
||||
/**
|
||||
* 是否精讯500题
|
||||
*/
|
||||
@ApiModelProperty("是否精讯500题")
|
||||
private Integer isVip;
|
||||
|
||||
/**
|
||||
* 是否精讯600题
|
||||
*/
|
||||
@ApiModelProperty("是否精讯600题")
|
||||
private Integer isVip2;
|
||||
|
||||
/**
|
||||
* 是否密卷1
|
||||
*/
|
||||
@ApiModelProperty("是否密卷1")
|
||||
private Integer isExam1;
|
||||
|
||||
/**
|
||||
* 是否密卷2
|
||||
*/
|
||||
@ApiModelProperty("是否密卷2")
|
||||
private Integer isExam2;
|
||||
|
||||
/**
|
||||
* 题库版本id
|
||||
*/
|
||||
@ApiModelProperty("题库版本id")
|
||||
private Long versionId;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
package com.jwl.driver.server.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 成绩查询入参
|
||||
* @create 2023/8/14 21:22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("成绩查询入参")
|
||||
public class TestQueryDto {
|
||||
|
||||
/**
|
||||
* 车型标识
|
||||
*/
|
||||
@ApiModelProperty(value = "车型标识",required = true)
|
||||
@NotNull(message = "车型标识不能为空")
|
||||
private Integer carTypeId;
|
||||
|
||||
/**
|
||||
* 科目
|
||||
*/
|
||||
@ApiModelProperty(value = "科目",required = true)
|
||||
@NotNull(message = "考试科目不能为空")
|
||||
private String subject ;
|
||||
}
|
|
@ -1,38 +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;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 考试题目类型蚕食
|
||||
* @create 2023/8/11 22:21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TestQuestionTypeDto {
|
||||
|
||||
//科目
|
||||
private String subject;
|
||||
|
||||
private List<TestOfChapter> chapterList;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class TestOfChapter {
|
||||
//章节
|
||||
private String chapter;
|
||||
//判断题
|
||||
private Integer judgeNum;
|
||||
//单选题
|
||||
private Integer radioNum;
|
||||
//多选题
|
||||
private Integer multipleChoiceNum;
|
||||
}
|
||||
|
||||
}
|
|
@ -8,7 +8,6 @@ import lombok.experimental.Accessors;
|
|||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -29,13 +28,6 @@ public class TestSubmitDto {
|
|||
@NotNull(message = "车型标识不能为空")
|
||||
private Integer carTypeId;
|
||||
|
||||
/**
|
||||
* 科目
|
||||
*/
|
||||
@ApiModelProperty(value = "科目",required = true)
|
||||
@NotBlank(message = "考试科目不能为空")
|
||||
private String subject ;
|
||||
|
||||
/**
|
||||
* 考试得分
|
||||
*/
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package com.jwl.driver.server.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserMemberDto {
|
||||
private String phone;
|
||||
private Integer memberId;
|
||||
}
|
|
@ -31,16 +31,10 @@ public class OrderPayInfo implements Serializable {
|
|||
private Long payId;
|
||||
|
||||
/**
|
||||
* 购买的商品类型:1.购买会员,2.证件照上传,3.查询体检信息
|
||||
* 会员标识
|
||||
*/
|
||||
@TableField("PURCHASE_PRODUCT_TYPE")
|
||||
private String purchaseProductType;
|
||||
|
||||
/**
|
||||
* 购买商品主键标识
|
||||
*/
|
||||
@TableField("PURCHASE_PRODUCT_ID")
|
||||
private String purchaseProductId;
|
||||
@TableField("MEMBER_ID")
|
||||
private Integer memberId;
|
||||
|
||||
/**
|
||||
* 支付金额,单位元
|
||||
|
|
|
@ -76,8 +76,8 @@ public class TdMember implements Serializable {
|
|||
/**
|
||||
* 会员描述
|
||||
*/
|
||||
@TableField("DESCRIPTION")
|
||||
private String DESCRIPTION;
|
||||
@TableField("DESC")
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
|
|
@ -115,12 +115,6 @@ public class TdQuestion implements Serializable {
|
|||
@TableField("BEST_ANSWER")
|
||||
private String bestAnswer;
|
||||
|
||||
/**
|
||||
* 答题技巧
|
||||
*/
|
||||
@TableField("SKILL_INFO")
|
||||
private String skillInfo;
|
||||
|
||||
/**
|
||||
* 章节标识
|
||||
*/
|
||||
|
|
|
@ -36,12 +36,6 @@ public class TdQuestionTest implements Serializable {
|
|||
@TableField("CAR_TYPE_ID")
|
||||
private Integer carTypeId;
|
||||
|
||||
/**
|
||||
* 考试科目
|
||||
*/
|
||||
@TableField("SUBJECT")
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 用户标识
|
||||
*/
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
package com.jwl.driver.server.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 题库版本表;
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-09-03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class TdQuestionVersion implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 题库版本
|
||||
*/
|
||||
@TableId(value = "VERSION_ID", type = IdType.AUTO)
|
||||
private Long versionId;
|
||||
|
||||
/**
|
||||
* 车型标识
|
||||
*/
|
||||
@TableField("CAR_TYPE_ID")
|
||||
private Integer carTypeId;
|
||||
|
||||
/**
|
||||
* 是否生效
|
||||
*/
|
||||
@TableField("IS_ACTIVE")
|
||||
private String isActive;
|
||||
|
||||
/**
|
||||
* 备注说明
|
||||
*/
|
||||
@TableField("DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("CREATE_TIME")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
}
|
|
@ -4,11 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -82,8 +77,6 @@ public class TdSysConfig implements Serializable {
|
|||
* 创建时间
|
||||
*/
|
||||
@TableField("CREATE_TIME")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
|
|
|
@ -4,11 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -68,8 +63,6 @@ public class TdSysConfigList implements Serializable {
|
|||
* 创建时间
|
||||
*/
|
||||
@TableField("CREATE_TIME")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
|
|
@ -19,21 +19,15 @@ import lombok.experimental.Accessors;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class TdProject implements Serializable {
|
||||
public class TdTestProject implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 考试项目
|
||||
*/
|
||||
@TableId("PROJECT_ID")
|
||||
private Integer projectId;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@TableField("TYPE")
|
||||
private String type;
|
||||
@TableId("TEST_PROJECT_ID")
|
||||
private Integer testProjectId;
|
||||
|
||||
/**
|
||||
* 所属科目
|
||||
|
@ -53,12 +47,6 @@ public class TdProject implements Serializable {
|
|||
@TableField("DRIVE_TYPE")
|
||||
private String driveType;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@TableField("DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
|
@ -15,12 +15,12 @@ import lombok.experimental.Accessors;
|
|||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-20
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class TdVideos implements Serializable {
|
||||
public class TdTestProjectVideos implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -31,41 +31,21 @@ public class TdVideos implements Serializable {
|
|||
private Integer videoId;
|
||||
|
||||
/**
|
||||
* 类型标识
|
||||
* 考试项目
|
||||
*/
|
||||
@TableField("TYPE_ID")
|
||||
private Integer typeId;
|
||||
@TableField("TEST_PROJECT_ID")
|
||||
private Integer testProjectId;
|
||||
|
||||
/**
|
||||
* 视频图片
|
||||
*/
|
||||
@TableField("VIDEO_IMAGE")
|
||||
private String videoImage;
|
||||
|
||||
/**
|
||||
* 视频链接
|
||||
*/
|
||||
@TableField("VIDEO_URL")
|
||||
private String videoUrl;
|
||||
|
||||
/**
|
||||
* 视频时长(秒)
|
||||
*/
|
||||
@TableField("VIDEO_TIME")
|
||||
private Integer videoTime;
|
||||
|
||||
/**
|
||||
* 显示序号
|
||||
*/
|
||||
@TableField("SHOW_ORDER")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@TableField("DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
|
@ -1,47 +0,0 @@
|
|||
package com.jwl.driver.server.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 支付状态
|
||||
* @create 2023/8/20 1:19
|
||||
*/
|
||||
public enum PayStatus {
|
||||
NOT(1, "未支付"),
|
||||
SUCCESS(2, "支付成功"),
|
||||
FAIL(3, "支付失败");
|
||||
|
||||
private Integer value;
|
||||
private String name;
|
||||
public static final Map<Integer, PayStatus> valueMap = new HashMap();
|
||||
|
||||
public static PayStatus fromValue(Integer value) {
|
||||
return (PayStatus)valueMap.get(value);
|
||||
}
|
||||
|
||||
private PayStatus(Integer value, String name) {
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
static {
|
||||
PayStatus[] var0 = values();
|
||||
int var1 = var0.length;
|
||||
|
||||
for(int var2 = 0; var2 < var1; ++var2) {
|
||||
PayStatus value = var0[var2];
|
||||
valueMap.put(value.getValue(), value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package com.jwl.driver.server.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 购买产品类型
|
||||
* @create 2023/9/17 17:19
|
||||
*/
|
||||
public enum PurchaseProductTypeEnum {
|
||||
MEMBER("1", "会员"),
|
||||
|
||||
UPLOAD_PHOTO_ID ("2", "上传证件照"),
|
||||
|
||||
PHYSICAL_EXAMINATION_INFORMATION("3", "体检信息");
|
||||
|
||||
private String value;
|
||||
private String desc;
|
||||
public static final Map<String, PurchaseProductTypeEnum> valueMap = new HashMap();
|
||||
|
||||
public static PurchaseProductTypeEnum fromValue(String value) {
|
||||
return (PurchaseProductTypeEnum)valueMap.get(value);
|
||||
}
|
||||
|
||||
private PurchaseProductTypeEnum(String value, String name) {
|
||||
this.value = value;
|
||||
this.desc = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
static {
|
||||
PurchaseProductTypeEnum[] var0 = values();
|
||||
int var1 = var0.length;
|
||||
|
||||
for(int var2 = 0; var2 < var1; ++var2) {
|
||||
PurchaseProductTypeEnum value = var0[var2];
|
||||
valueMap.put(value.getValue(), value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
package com.jwl.driver.server.generator;
|
||||
|
||||
public class MysqlParamGenerator {
|
||||
private static final String host = "118.31.23.45";
|
||||
private static final String database = "driver_server";
|
||||
private static final String host = "127.0.0.1:3306";
|
||||
private static final String database = "driver_test";
|
||||
private static final String url = "jdbc:mysql://" + host + "/" + database + "?characterEncoding=utf-8&autoReconnect=true&serverTimezone=Asia/Shanghai&failOverReadOnly=false";
|
||||
private static final String userName = "root";
|
||||
private static final String password = "admin231280";
|
||||
private static final String password = "123456";
|
||||
|
||||
private static final String module = "com.jwl.driver.server";
|
||||
// projectPath项为空即可
|
||||
private static final String projectPath = "";
|
||||
private static final String projectPath = "/driver-server";
|
||||
|
||||
// todo 实体类是否继承基础类-具备开始时间和结束时间实体类的基础属性
|
||||
private static final String superEntityClass = "";
|
||||
|
|
|
@ -3,11 +3,10 @@ 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;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -24,42 +23,14 @@ public interface TdQuestionMapper extends BaseMapper<TdQuestion> {
|
|||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<QuestionVo> queryQuestion(@Param("queryDto") QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 获取考题id
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<Long> queryQuestionId(@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);
|
||||
|
||||
/**
|
||||
* 随机查询考题Id
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<Long> queryQuestionIdByRandom(@Param("queryDto") QuestionQueryDto queryDto);
|
||||
|
||||
int updateQuestion(@Param("questionVo") QuestionVo questionVo);
|
||||
|
||||
/**
|
||||
* 获取专项分类里题目数量
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
Map<String, Integer> querySpecialNum(@Param("queryDto") QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 获取车型最大排序
|
||||
* @param carTypeId
|
||||
* @return
|
||||
*/
|
||||
Integer queryMaxSort(@Param("carTypeId") int carTypeId);
|
||||
int updateQuestion(@Param("qusetionVo") QusetionVo qusetionVo);
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package com.jwl.driver.server.mapper;
|
||||
|
||||
import com.jwl.driver.server.entity.TdQuestionVersion;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 题库版本表; Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-09-03
|
||||
*/
|
||||
public interface TdQuestionVersionMapper extends BaseMapper<TdQuestionVersion> {
|
||||
|
||||
}
|
|
@ -1,12 +1,7 @@
|
|||
package com.jwl.driver.server.mapper;
|
||||
|
||||
import com.jwl.driver.server.dto.UserMemberDto;
|
||||
import com.jwl.driver.server.entity.TdSysUserMember;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jwl.driver.server.vo.UserMemberVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -18,5 +13,4 @@ import java.util.List;
|
|||
*/
|
||||
public interface TdSysUserMemberMapper extends BaseMapper<TdSysUserMember> {
|
||||
|
||||
List<UserMemberVo> queryUserMemberList(@Param("userMemberDto") UserMemberDto userMemberDto);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.jwl.driver.server.mapper;
|
||||
|
||||
import com.jwl.driver.server.entity.TdProject;
|
||||
import com.jwl.driver.server.entity.TdTestProject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
|
@ -11,6 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
public interface TdProjectMapper extends BaseMapper<TdProject> {
|
||||
public interface TdTestProjectMapper extends BaseMapper<TdTestProject> {
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.jwl.driver.server.mapper;
|
||||
|
||||
import com.jwl.driver.server.entity.TdVideos;
|
||||
import com.jwl.driver.server.entity.TdTestProjectVideos;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
|
@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-20
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
public interface TdVideosMapper extends BaseMapper<TdVideos> {
|
||||
public interface TdTestProjectVideosMapper extends BaseMapper<TdTestProjectVideos> {
|
||||
|
||||
}
|
|
@ -2,9 +2,6 @@ package com.jwl.driver.server.service;
|
|||
|
||||
import com.jwl.driver.server.entity.OrderPayInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jwl.driver.server.vo.H5PayVo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -16,22 +13,4 @@ import java.math.BigDecimal;
|
|||
*/
|
||||
public interface IOrderPayInfoService extends IService<OrderPayInfo> {
|
||||
|
||||
/**
|
||||
* 微信支付创建预支付申请
|
||||
* @param money
|
||||
* @param userIdStr
|
||||
* @param description
|
||||
* @param tradeType
|
||||
* @param outTradeNo
|
||||
* @param payType
|
||||
* @return
|
||||
*/
|
||||
OrderPayInfo createOrderPayInfo(BigDecimal money,String userIdStr,String description,String tradeType,String outTradeNo,String payType);
|
||||
|
||||
/**
|
||||
* 支付结果
|
||||
* @param payInfo
|
||||
* @param payResult
|
||||
*/
|
||||
Boolean payNotice( OrderPayInfo payInfo, Boolean payResult);
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@ public interface ITdMemberService extends IService<TdMember> {
|
|||
/**
|
||||
* 获取用户开通的会员
|
||||
* @param queryDto
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<MemberVo> queryUserMember(MemberQueryDto queryDto,Long userId);
|
||||
List<MemberVo> queryUserMember(MemberQueryDto queryDto);
|
||||
}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package com.jwl.driver.server.service;
|
||||
|
||||
import com.jwl.driver.server.dto.ProjectDto;
|
||||
import com.jwl.driver.server.entity.TdProject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jwl.driver.server.vo.ProjectVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 考试项目表; 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
public interface ITdProjectService extends IService<TdProject> {
|
||||
|
||||
/**
|
||||
* 获取考试项目列表
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<ProjectVo> queryProjectList(ProjectDto queryDto);
|
||||
}
|
|
@ -1,14 +1,12 @@
|
|||
package com.jwl.driver.server.service;
|
||||
|
||||
import com.jwl.driver.server.dto.QuestionAddDto;
|
||||
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;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -26,42 +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);
|
||||
|
||||
/**
|
||||
* 根据查询条件获取题目Id
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<Long> queryQuestionId(QuestionQueryDto queryDto);
|
||||
List<QusetionVo> queryQuestion(QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 获取考试题目
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<QuestionVo> getTestQuestion(QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 获取考试题目Id
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<Long> getTestQuestionId(QuestionQueryDto queryDto);
|
||||
List<QusetionVo> getTestQuestion(QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 题目分类
|
||||
|
@ -72,24 +56,8 @@ public interface ITdQuestionService extends IService<TdQuestion> {
|
|||
|
||||
/**
|
||||
* 修改题库
|
||||
* @param questionVo
|
||||
* @param qusetionVo
|
||||
* @return
|
||||
*/
|
||||
int updateQuestion(QuestionVo questionVo);
|
||||
|
||||
|
||||
/**
|
||||
* 新增题库
|
||||
* @param addDto
|
||||
* @return
|
||||
*/
|
||||
Boolean insertQuestion(QuestionAddDto addDto);
|
||||
|
||||
/**
|
||||
* 获取专项分类里题目数量
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
Map<String,Integer> querySpecialNum(QuestionQueryDto queryDto);
|
||||
|
||||
int updateQuestion(QusetionVo qusetionVo);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package com.jwl.driver.server.service;
|
||||
|
||||
import com.jwl.driver.server.dto.TestQueryDto;
|
||||
import com.jwl.driver.server.dto.TestSubmitDto;
|
||||
import com.jwl.driver.server.entity.TdQuestionTest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jwl.driver.server.vo.TestTotalVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -21,12 +19,5 @@ public interface ITdQuestionTestService extends IService<TdQuestionTest> {
|
|||
* @param submitDto
|
||||
* @return
|
||||
*/
|
||||
TdQuestionTest testSubmit(TestSubmitDto submitDto);
|
||||
|
||||
/**
|
||||
* 考试成绩统计
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
TestTotalVo testTotal(TestQueryDto queryDto);
|
||||
Boolean testSubmit(TestSubmitDto submitDto);
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
package com.jwl.driver.server.service;
|
||||
|
||||
import com.jwl.driver.server.entity.TdQuestionVersion;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 题库版本表; 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-09-03
|
||||
*/
|
||||
public interface ITdQuestionVersionService extends IService<TdQuestionVersion> {
|
||||
|
||||
/**
|
||||
* 获取题库当前版本号
|
||||
* @param carTypeId
|
||||
* @return
|
||||
*/
|
||||
Long currentVersion(Integer carTypeId);
|
||||
|
||||
/**
|
||||
* 题库版本更新
|
||||
* @param versionDto
|
||||
* @return
|
||||
*/
|
||||
Boolean addVersion(TdQuestionVersion versionDto);
|
||||
}
|
|
@ -25,18 +25,10 @@ public interface ITdSysConfigListService extends IService<TdSysConfigList> {
|
|||
List<TdSysConfigList> querySysConfigList(String configKey, Integer carTypeId);
|
||||
|
||||
/**
|
||||
* 通过多个configKey 和 carTypeId 查询多个配置列表
|
||||
* 通过多个配置key 和 carTypeId 查询多个配置列表
|
||||
* @param configKeyList
|
||||
* @param carTypeId
|
||||
* @return
|
||||
*/
|
||||
Map<String, Map<String, String>> querySysConfigMap(List<String> configKeyList, Integer carTypeId);
|
||||
|
||||
/**
|
||||
* 根据configKey和carTypeId查询系统配置列表数量
|
||||
* @param configKey
|
||||
* @param carTypeId
|
||||
* @return
|
||||
*/
|
||||
Integer querySysConfigListNum(String configKey, Integer carTypeId);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
package com.jwl.driver.server.service;
|
||||
|
||||
import com.jwl.driver.server.dto.UserMemberDto;
|
||||
import com.jwl.driver.server.entity.OrderPayInfo;
|
||||
import com.jwl.driver.server.entity.TdSysUserMember;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jwl.driver.server.vo.UserMemberVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -18,12 +13,4 @@ import java.util.List;
|
|||
*/
|
||||
public interface ITdSysUserMemberService extends IService<TdSysUserMember> {
|
||||
|
||||
/**
|
||||
* 慧眼充值
|
||||
* @param payInfo
|
||||
* @return
|
||||
*/
|
||||
Boolean purchaseMember(OrderPayInfo payInfo);
|
||||
|
||||
List<UserMemberVo> queryUserMemberList(UserMemberDto userMemberDto);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -21,7 +20,7 @@ public interface ITdSysUserService extends IService<TdSysUser> {
|
|||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
Boolean code(String phone);
|
||||
String code(String phone);
|
||||
|
||||
/**
|
||||
* 用户登陆
|
||||
|
@ -44,8 +43,8 @@ public interface ITdSysUserService extends IService<TdSysUser> {
|
|||
|
||||
/**
|
||||
* 绑定驾校
|
||||
* @param schoolDto
|
||||
* @param userDto
|
||||
* @return
|
||||
*/
|
||||
Boolean bindSchool(DriverSchoolDto schoolDto);
|
||||
Boolean bindSchool(LoginUserDto userDto);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.jwl.driver.server.service;
|
||||
|
||||
import com.jwl.driver.server.entity.TdTestProject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 考试项目表; 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
public interface ITdTestProjectService extends IService<TdTestProject> {
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.jwl.driver.server.service;
|
||||
|
||||
import com.jwl.driver.server.entity.TdVideos;
|
||||
import com.jwl.driver.server.entity.TdTestProjectVideos;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
|
@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-20
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
public interface ITdVideosService extends IService<TdVideos> {
|
||||
public interface ITdTestProjectVideosService extends IService<TdTestProjectVideos> {
|
||||
|
||||
}
|
|
@ -1,28 +1,10 @@
|
|||
package com.jwl.driver.server.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.jwl.driver.server.constant.Constants;
|
||||
import com.jwl.driver.server.entity.OrderPayInfo;
|
||||
import com.jwl.driver.server.entity.TdMember;
|
||||
import com.jwl.driver.server.entity.TdSysUser;
|
||||
import com.jwl.driver.server.enums.PayStatus;
|
||||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.mapper.OrderPayInfoMapper;
|
||||
import com.jwl.driver.server.service.IOrderPayInfoService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jwl.driver.server.service.ITdMemberService;
|
||||
import com.jwl.driver.server.service.ITdSysUserService;
|
||||
import com.jwl.driver.server.util.SecurityUtil;
|
||||
import com.jwl.driver.server.vo.H5PayVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -33,60 +15,6 @@ import java.util.Objects;
|
|||
* @since 2023-08-10
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class OrderPayInfoServiceImpl extends ServiceImpl<OrderPayInfoMapper, OrderPayInfo> implements IOrderPayInfoService {
|
||||
|
||||
@Autowired
|
||||
private ITdSysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ITdMemberService memberService;
|
||||
|
||||
@Autowired
|
||||
private Snowflake snowflake;
|
||||
|
||||
@Override
|
||||
public OrderPayInfo createOrderPayInfo(BigDecimal money,String userIdStr,String description,String tradeType,String outTradeNo,String payType) {
|
||||
Long userId = StrUtil.isNotBlank(userIdStr) ? Long.parseLong(userIdStr) : SecurityUtil.getUserId();
|
||||
TdSysUser user = userService.getById(userId);
|
||||
if (Objects.isNull(user)) {
|
||||
log.error("数据异常,用户不存在" + userId);
|
||||
throw new BusinessException("数据缺失");
|
||||
}
|
||||
TdMember member = memberService.getById(Integer.parseInt(outTradeNo));
|
||||
if (Objects.isNull(member) || StrUtil.equals(Constants.IS_ACTIVE_FALSE, member.getIsActive())) {
|
||||
log.error("数据异常,会员不存在或者已过期" + outTradeNo);
|
||||
throw new BusinessException("数据缺失");
|
||||
}
|
||||
OrderPayInfo orderPayInfo = new OrderPayInfo()
|
||||
.setPayId(snowflake.nextId())
|
||||
.setPurchaseProductType(tradeType)
|
||||
.setPurchaseProductId(outTradeNo)
|
||||
.setMoney(money)
|
||||
.setPaymentType(Constants.WECHAT_PAY)
|
||||
.setPayType(payType)
|
||||
.setDescription(user.getUserName() + "-" + member.getMemberName())
|
||||
.setPayStatus(PayStatus.NOT.getValue())
|
||||
.setDeleteStatus(0)
|
||||
.setUserId(userId)
|
||||
.setCreateTime(LocalDateTime.now())
|
||||
.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
this.save(orderPayInfo);
|
||||
return orderPayInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean payNotice( OrderPayInfo payInfo, Boolean payResult) {
|
||||
log.info("支付回调信息===============> payInfo{} , payResult{}",payInfo,payResult);
|
||||
if (Objects.isNull(payInfo)){
|
||||
throw new BusinessException("订单信息不存在");
|
||||
}
|
||||
payInfo.setPayStatus(payResult?PayStatus.SUCCESS.getValue() : PayStatus.FAIL.getValue())
|
||||
.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
this.updateById(payInfo);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,7 @@ import com.jwl.driver.server.mapper.TdMemberMapper;
|
|||
import com.jwl.driver.server.service.ITdMemberService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jwl.driver.server.util.SecurityUtil;
|
||||
import com.jwl.driver.server.util.TokenThreadUtil;
|
||||
import com.jwl.driver.server.vo.MemberVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -26,7 +24,6 @@ import java.util.stream.Collectors;
|
|||
* @since 2023-08-10
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TdMemberServiceImpl extends ServiceImpl<TdMemberMapper, TdMember> implements ITdMemberService {
|
||||
|
||||
@Override
|
||||
|
@ -35,15 +32,7 @@ public class TdMemberServiceImpl extends ServiceImpl<TdMemberMapper, TdMember> i
|
|||
List<MemberVo> resultList = new ArrayList<>();
|
||||
|
||||
//获取用户已开通且未到期的会员(即使该会员已不售卖了)
|
||||
List<MemberVo> userMemberList = new ArrayList<>();
|
||||
try {
|
||||
if (StrUtil.isNotBlank(TokenThreadUtil.getToken())){
|
||||
userMemberList = queryUserMember(queryDto,SecurityUtil.getUserId());
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.info("===================>用户没有登录");
|
||||
}
|
||||
|
||||
List<MemberVo> userMemberList = queryUserMember(queryDto);
|
||||
Map<Integer, MemberVo> userMemberMap = userMemberList.stream().collect(Collectors.toMap(MemberVo::getMemberId, v -> v, (v1, v2) -> v1));
|
||||
|
||||
//将用户购买的已停售但未过期的会员放在最前面
|
||||
|
@ -68,8 +57,8 @@ public class TdMemberServiceImpl extends ServiceImpl<TdMemberMapper, TdMember> i
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<MemberVo> queryUserMember(MemberQueryDto queryDto,Long userId) {
|
||||
return this.getBaseMapper().queryUserMember(queryDto,userId);
|
||||
public List<MemberVo> queryUserMember(MemberQueryDto queryDto) {
|
||||
return this.getBaseMapper().queryUserMember(queryDto,SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
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.core.conditions.query.QueryWrapper;
|
||||
import com.jwl.driver.server.constant.Constants;
|
||||
import com.jwl.driver.server.dto.ProjectDto;
|
||||
import com.jwl.driver.server.entity.TdProject;
|
||||
import com.jwl.driver.server.entity.TdVideos;
|
||||
import com.jwl.driver.server.mapper.TdProjectMapper;
|
||||
import com.jwl.driver.server.service.ITdProjectService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jwl.driver.server.service.ITdVideosService;
|
||||
import com.jwl.driver.server.vo.ProjectVo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 考试项目表; 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Service
|
||||
public class TdProjectServiceImpl extends ServiceImpl<TdProjectMapper, TdProject> implements ITdProjectService {
|
||||
|
||||
@Autowired
|
||||
private ITdVideosService videosService;
|
||||
|
||||
@Override
|
||||
public List<ProjectVo> queryProjectList(ProjectDto queryDto) {
|
||||
|
||||
List<ProjectVo> resultList = new ArrayList<>();
|
||||
LambdaQueryWrapper<TdProject> queryWrapper = new LambdaQueryWrapper<TdProject>()
|
||||
.eq(Objects.nonNull(queryDto.getProjectId()),TdProject::getProjectId,queryDto.getProjectId())
|
||||
.eq(StrUtil.isNotBlank(queryDto.getType()),TdProject::getType,queryDto.getType())
|
||||
.eq(Objects.nonNull(queryDto.getCarTypeId()),TdProject::getCarTypeId,queryDto.getCarTypeId())
|
||||
.eq(StrUtil.isNotBlank(queryDto.getSubject()),TdProject::getSubject,queryDto.getSubject())
|
||||
.eq(StrUtil.isNotBlank(queryDto.getDriveType()),TdProject::getDriveType,queryDto.getDriveType())
|
||||
.eq(TdProject::getIsActive, Constants.IS_ACTIVE_TRUE)
|
||||
.orderByAsc(TdProject::getShowOrder);
|
||||
List<TdProject> tdProjects = this.getBaseMapper().selectList(queryWrapper);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(tdProjects)){
|
||||
for (TdProject tdProject : tdProjects) {
|
||||
ProjectVo projectVo = new ProjectVo();
|
||||
BeanUtils.copyProperties(tdProject,projectVo);
|
||||
//查询项目视频
|
||||
List<TdVideos> videoList = videosService.list(new QueryWrapper<TdVideos>().lambda().eq(TdVideos::getTypeId, tdProject.getProjectId()).orderByAsc(TdVideos::getShowOrder));
|
||||
if (CollectionUtil.isNotEmpty(videoList)){
|
||||
projectVo.setVideoList(videoList);
|
||||
projectVo.setImageUrl(videoList.get(0).getVideoImage());
|
||||
}
|
||||
resultList.add(projectVo);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
}
|
|
@ -2,32 +2,18 @@ package com.jwl.driver.server.service.impl;
|
|||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.generator.config.IFileCreate;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.jwl.driver.server.constant.Constants;
|
||||
import com.jwl.driver.server.constant.ErrorCode;
|
||||
import com.jwl.driver.server.dto.QuestionAddDto;
|
||||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||
import com.jwl.driver.server.dto.TestQuestionTypeDto;
|
||||
import com.jwl.driver.server.entity.TdQuestion;
|
||||
import com.jwl.driver.server.entity.TdSysConfig;
|
||||
import com.jwl.driver.server.entity.TdSysConfigList;
|
||||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.mapper.TdQuestionMapper;
|
||||
import com.jwl.driver.server.redis.RedisCache;
|
||||
import com.jwl.driver.server.service.ITdQuestionService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jwl.driver.server.service.ITdQuestionVersionService;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import com.jwl.driver.server.vo.QusetionVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -43,7 +29,6 @@ import java.util.stream.Collectors;
|
|||
* @since 2023-08-10
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuestion> implements ITdQuestionService {
|
||||
|
||||
@Autowired
|
||||
|
@ -52,150 +37,51 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
@Autowired
|
||||
private ITdSysConfigListService configListService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ITdQuestionVersionService versionService;
|
||||
|
||||
@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) {
|
||||
public List<TdQuestion> queryQuestionByIdList(QuestionQueryDto queryDto) {
|
||||
LambdaQueryWrapper<TdQuestion> queryWrapper = new LambdaQueryWrapper<TdQuestion>()
|
||||
.in(TdQuestion::getQuestionId,queryDto.getQuestionIdList());
|
||||
|
||||
QuestionQueryDto newDto = new QuestionQueryDto()
|
||||
.setQuestionIdList(queryDto.getQuestionIdList());
|
||||
return queryQuestion(newDto);
|
||||
return this.getBaseMapper().selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuestionVo> queryQuestion(QuestionQueryDto queryDto) {
|
||||
//校验题库版本是否一致
|
||||
checkQuestionVersion(queryDto.getCarTypeId(), queryDto.getVersionId());
|
||||
|
||||
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<Long> queryQuestionId(QuestionQueryDto queryDto) {
|
||||
//校验题库版本是否一致
|
||||
checkQuestionVersion(queryDto.getCarTypeId(), queryDto.getVersionId());
|
||||
public List<QusetionVo> getTestQuestion(QuestionQueryDto queryDto) {
|
||||
List<QusetionVo> resultList = new ArrayList<>();
|
||||
|
||||
List<Long> questionIds = this.getBaseMapper().queryQuestionId(queryDto);
|
||||
return questionIds;
|
||||
}
|
||||
if (StrUtil.equals(Constants.SUBJECT_ONE,queryDto.getSubject())){
|
||||
//40道判断题 60道单选 每题1分
|
||||
queryDto.setType(Constants.QUESTION_TYPE_ONE)
|
||||
.setNum(60);
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
|
||||
@Override
|
||||
public List<QuestionVo> getTestQuestion(QuestionQueryDto queryDto) {
|
||||
queryDto.setType(Constants.QUESTION_TYPE_TWO)
|
||||
.setNum(40);
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
|
||||
//校验题库版本是否一致
|
||||
checkQuestionVersion(queryDto.getCarTypeId(), queryDto.getVersionId());
|
||||
}else if(StrUtil.equals(Constants.SUBJECT_FOUR,queryDto.getSubject())){
|
||||
//20道判断题 20道单选 10道多选,每题2分,如果各车型不统一 可以配在数据库里
|
||||
queryDto.setType(Constants.QUESTION_TYPE_TWO)
|
||||
.setNum(20);
|
||||
|
||||
List<QuestionVo> resultList = new ArrayList<>();
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
queryDto.setType(Constants.QUESTION_TYPE_ONE)
|
||||
.setNum(20);
|
||||
|
||||
TdSysConfig tdSysConfig = configService.queryConfigByKey(Constants.TEST_QUESTION_TYPE_NUM, queryDto.getCarTypeId());
|
||||
if (Objects.isNull(tdSysConfig)) {
|
||||
log.info("config is not exist");
|
||||
throw new BusinessException("获取信息异常");
|
||||
}
|
||||
|
||||
List<TestQuestionTypeDto> testQuestionTypeDtos = JSON.parseArray(tdSysConfig.getConfigJson(), TestQuestionTypeDto.class);
|
||||
Optional<TestQuestionTypeDto> optional = testQuestionTypeDtos.stream().filter(s -> StrUtil.equals(s.getSubject(), queryDto.getSubject())).findFirst();
|
||||
if (optional.isPresent()) {
|
||||
TestQuestionTypeDto testQuestionTypeDto = optional.get();
|
||||
List<TestQuestionTypeDto.TestOfChapter> chapterList = testQuestionTypeDto.getChapterList();
|
||||
if (CollectionUtil.isEmpty(chapterList)){
|
||||
return resultList;
|
||||
}
|
||||
for (TestQuestionTypeDto.TestOfChapter testOfChapter : chapterList) {
|
||||
//判断题
|
||||
if (Objects.nonNull(testOfChapter.getJudgeNum()) && testOfChapter.getJudgeNum() > 0) {
|
||||
queryDto.setType(Constants.QUESTION_TYPE_ONE)
|
||||
.setChapter(testOfChapter.getChapter())
|
||||
.setNum(testOfChapter.getJudgeNum());
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
}
|
||||
}
|
||||
for (TestQuestionTypeDto.TestOfChapter testOfChapter : chapterList) {
|
||||
//单选
|
||||
if (Objects.nonNull(testOfChapter.getRadioNum()) && testOfChapter.getRadioNum() > 0) {
|
||||
queryDto.setType(Constants.QUESTION_TYPE_TWO)
|
||||
.setChapter(testOfChapter.getChapter())
|
||||
.setNum(testOfChapter.getRadioNum());
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
}
|
||||
}
|
||||
for (TestQuestionTypeDto.TestOfChapter testOfChapter : chapterList) {
|
||||
//多选
|
||||
if (Objects.nonNull(testOfChapter.getMultipleChoiceNum()) && testOfChapter.getMultipleChoiceNum() > 0) {
|
||||
queryDto.setType(Constants.QUESTION_TYPE_THREE)
|
||||
.setChapter(testOfChapter.getChapter())
|
||||
.setNum(testOfChapter.getMultipleChoiceNum());
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
}
|
||||
}
|
||||
}
|
||||
questionOptionHandler(resultList);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getTestQuestionId(QuestionQueryDto queryDto) {
|
||||
//校验题库版本是否一致
|
||||
checkQuestionVersion(queryDto.getCarTypeId(), queryDto.getVersionId());
|
||||
|
||||
List<Long> resultList = new ArrayList<>();
|
||||
|
||||
TdSysConfig tdSysConfig = configService.queryConfigByKey(Constants.TEST_QUESTION_TYPE_NUM, queryDto.getCarTypeId());
|
||||
if (Objects.isNull(tdSysConfig)) {
|
||||
log.info("config is not exist");
|
||||
throw new BusinessException("获取信息异常");
|
||||
}
|
||||
|
||||
List<TestQuestionTypeDto> testQuestionTypeDtos = JSON.parseArray(tdSysConfig.getConfigJson(), TestQuestionTypeDto.class);
|
||||
Optional<TestQuestionTypeDto> optional = testQuestionTypeDtos.stream().filter(s -> StrUtil.equals(s.getSubject(), queryDto.getSubject())).findFirst();
|
||||
if (optional.isPresent()) {
|
||||
TestQuestionTypeDto testQuestionTypeDto = optional.get();
|
||||
List<TestQuestionTypeDto.TestOfChapter> chapterList = testQuestionTypeDto.getChapterList();
|
||||
if (CollectionUtil.isEmpty(chapterList)){
|
||||
return resultList;
|
||||
}
|
||||
for (TestQuestionTypeDto.TestOfChapter testOfChapter : chapterList) {
|
||||
//判断题
|
||||
if (Objects.nonNull(testOfChapter.getJudgeNum()) && testOfChapter.getJudgeNum() > 0) {
|
||||
queryDto.setType(Constants.QUESTION_TYPE_ONE)
|
||||
.setChapter(testOfChapter.getChapter())
|
||||
.setNum(testOfChapter.getJudgeNum());
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionIdByRandom(queryDto));
|
||||
}
|
||||
}
|
||||
for (TestQuestionTypeDto.TestOfChapter testOfChapter : chapterList) {
|
||||
//单选
|
||||
if (Objects.nonNull(testOfChapter.getRadioNum()) && testOfChapter.getRadioNum() > 0) {
|
||||
queryDto.setType(Constants.QUESTION_TYPE_TWO)
|
||||
.setChapter(testOfChapter.getChapter())
|
||||
.setNum(testOfChapter.getRadioNum());
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionIdByRandom(queryDto));
|
||||
}
|
||||
}
|
||||
for (TestQuestionTypeDto.TestOfChapter testOfChapter : chapterList) {
|
||||
//多选
|
||||
if (Objects.nonNull(testOfChapter.getMultipleChoiceNum()) && testOfChapter.getMultipleChoiceNum() > 0) {
|
||||
queryDto.setType(Constants.QUESTION_TYPE_THREE)
|
||||
.setChapter(testOfChapter.getChapter())
|
||||
.setNum(testOfChapter.getMultipleChoiceNum());
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionIdByRandom(queryDto));
|
||||
}
|
||||
}
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
queryDto.setType(Constants.QUESTION_TYPE_THREE)
|
||||
.setNum(10);
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
@ -205,28 +91,18 @@ 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;
|
||||
}
|
||||
|
||||
final Integer carTypeId = tdQuestionVos.get(0).getCarTypeId();
|
||||
final String subject = tdQuestionVos.get(0).getSubject();
|
||||
//获取分类
|
||||
List<TdSysConfigList> categoryList = new ArrayList<>();
|
||||
if (StrUtil.equals(Constants.SUBJECT_ONE,subject)){
|
||||
categoryList = configListService.querySysConfigList(Constants.QUESTION_CATEGORY_OF_SUBJECT_ONE, carTypeId);
|
||||
} else if (StrUtil.equals(Constants.SUBJECT_FOUR,subject)){
|
||||
categoryList = configListService.querySysConfigList(Constants.QUESTION_CATEGORY_OF_SUBJECT_FOUR, carTypeId);
|
||||
}
|
||||
|
||||
List<TdSysConfigList> categoryList = configListService.querySysConfigList(Constants.QUESTION_CATEGORY, Constants.DEFAULT_CARTYPE_ID);
|
||||
Map<String, String> categoryMap = categoryList.stream().collect(Collectors.toMap(TdSysConfigList::getConfigItemCode, TdSysConfigList::getConfigItemName, (v1, v2) -> v1));
|
||||
Map<String, Integer> totalMap = new HashMap<>();
|
||||
Map<String, List<Long>> errorQuestionIdMap = new HashMap<>();
|
||||
Map<String,Integer> totalMap = new HashMap<>();
|
||||
|
||||
for (QuestionVo tdQuestionVo : tdQuestionVos) {
|
||||
String category = tdQuestionVo.getCategory();
|
||||
if (StrUtil.isBlank(category)) {
|
||||
for (TdQuestion tdQuestion : tdQuestions) {
|
||||
String category = tdQuestion.getCategory();
|
||||
if (StrUtil.isBlank(category)){
|
||||
continue;
|
||||
}
|
||||
String[] split = category.split(",");
|
||||
|
@ -234,13 +110,8 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
if (totalMap.containsKey(s)) { //判断Map集合中是否有该字符
|
||||
Integer value = totalMap.get(s); //通过key找出集合中的value
|
||||
totalMap.put(s, value + 1); //将值的数据加1,然后添加到集合中去
|
||||
List<Long> errorQuestionIdList = errorQuestionIdMap.get(s);
|
||||
errorQuestionIdList.add(tdQuestionVo.getQuestionId());
|
||||
} else {
|
||||
totalMap.put(s, 1); //此时集合中没有该Key,所以将该字符作为键加入到集合中
|
||||
List<Long> errorQuestionIdList = new ArrayList<>();
|
||||
errorQuestionIdList.add(tdQuestionVo.getQuestionId());
|
||||
errorQuestionIdMap.put(s, errorQuestionIdList);
|
||||
totalMap.put(s,1); //此时集合中没有该Key,所以将该字符作为键加入到集合中
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -248,8 +119,7 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
for (String category : totalMap.keySet()) {
|
||||
QusetionCategoryVo categoryVo = new QusetionCategoryVo()
|
||||
.setCategory(category)
|
||||
.setErrorQuestionIdList(errorQuestionIdMap.get(category))
|
||||
.setCategoryName(categoryMap.getOrDefault(category, "其他类型"))
|
||||
.setCategoryName(categoryMap.getOrDefault(category,"其他类型"))
|
||||
.setNum(totalMap.get(category));
|
||||
resultList.add(categoryVo);
|
||||
}
|
||||
|
@ -257,112 +127,7 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
}
|
||||
|
||||
@Override
|
||||
public int updateQuestion(QuestionVo questionVo) {
|
||||
return this.getBaseMapper().updateQuestion(questionVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertQuestion(QuestionAddDto addDto) {
|
||||
|
||||
TdQuestion question = new TdQuestion();
|
||||
BeanUtils.copyProperties(addDto,question);
|
||||
//获取该车型最大的排序
|
||||
if (Objects.isNull(question.getShowOrder())){
|
||||
Integer sort = this.getBaseMapper().queryMaxSort(question.getCarTypeId());
|
||||
if (Objects.isNull(sort)){
|
||||
sort = 1;
|
||||
}else {
|
||||
sort = sort + 1;
|
||||
}
|
||||
question.setShowOrder(sort);
|
||||
}
|
||||
question.setIsActive(Constants.IS_ACTIVE_TRUE);
|
||||
return this.save(question);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> querySpecialNum(QuestionQueryDto queryDto) {
|
||||
//校验题库版本是否一致
|
||||
checkQuestionVersion(queryDto.getCarTypeId(), queryDto.getVersionId());
|
||||
|
||||
Map<String, Integer> resultMap = redisCache.getCacheObject(Constants.SPECIAL_NUM_PREFIX + queryDto.getCarTypeId() + "_" + queryDto.getSubject());
|
||||
if (Objects.nonNull(resultMap)) {
|
||||
return resultMap;
|
||||
}
|
||||
resultMap = this.getBaseMapper().querySpecialNum(queryDto);
|
||||
|
||||
if (CollectionUtil.isEmpty(resultMap)) {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
TdSysConfig tdSysConfig = configService.queryConfigByKey(Constants.REDIS_EXPIRE_TIME, Constants.DEFAULT_CARTYPE_ID);
|
||||
if (Objects.isNull(tdSysConfig)) {
|
||||
log.info("config is not exist");
|
||||
throw new BusinessException("系统异常");
|
||||
}
|
||||
// 塞入redis中
|
||||
redisCache.setCacheObject(Constants.SPECIAL_NUM_PREFIX + queryDto.getCarTypeId() + "_" + queryDto.getSubject(), resultMap, Long.parseLong(tdSysConfig.getConfigValue()));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 问题选项规整
|
||||
*/
|
||||
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()) || StrUtil.equals(questionVo.getType(), Constants.QUESTION_TYPE_ONE)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验题库是否一直
|
||||
*
|
||||
* @param carTypeId
|
||||
* @param version
|
||||
*/
|
||||
private void checkQuestionVersion(Integer carTypeId, Long version) {
|
||||
if (Objects.isNull(carTypeId) || Objects.isNull(version)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Long versionId = versionService.currentVersion(carTypeId);
|
||||
if (!Objects.equals(versionId, version)) {
|
||||
throw new BusinessException(ErrorCode.VERSION_ERROR, "题库已更新");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<TestQuestionTypeDto> testQuestionTypeDtos = new ArrayList<>();
|
||||
String jsonString = JSONArray.toJSONString(testQuestionTypeDtos);
|
||||
System.out.println(jsonString);
|
||||
|
||||
List<TestQuestionTypeDto> testQuestionTypeDtos1 = JSONArray.parseArray(jsonString, TestQuestionTypeDto.class);
|
||||
System.out.println(testQuestionTypeDtos1);
|
||||
public int updateQuestion(QusetionVo qusetionVo) {
|
||||
return this.getBaseMapper().updateQuestion(qusetionVo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +1,17 @@
|
|||
package com.jwl.driver.server.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jwl.driver.server.dto.SecurityUser;
|
||||
import com.jwl.driver.server.dto.TestQueryDto;
|
||||
import com.jwl.driver.server.dto.TestSubmitDto;
|
||||
import com.jwl.driver.server.entity.TdQuestionTest;
|
||||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.mapper.TdQuestionTestMapper;
|
||||
import com.jwl.driver.server.service.ITdQuestionTestService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jwl.driver.server.util.SecurityUtil;
|
||||
import com.jwl.driver.server.vo.TestTotalVo;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.OptionalDouble;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -36,47 +26,13 @@ public class TdQuestionTestServiceImpl extends ServiceImpl<TdQuestionTestMapper,
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TdQuestionTest testSubmit(TestSubmitDto submitDto) {
|
||||
public Boolean testSubmit(TestSubmitDto submitDto) {
|
||||
|
||||
TdQuestionTest questionTest = new TdQuestionTest();
|
||||
BeanUtils.copyProperties(submitDto, questionTest);
|
||||
BeanUtils.copyProperties(submitDto,questionTest);
|
||||
questionTest.setUserId(SecurityUtil.getUserId())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
boolean save = this.save(questionTest);
|
||||
if (!save){
|
||||
throw new BusinessException("考试成绩提交失败");
|
||||
}
|
||||
|
||||
return questionTest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TestTotalVo testTotal(TestQueryDto queryDto) {
|
||||
TestTotalVo testTotalVo = new TestTotalVo();
|
||||
LambdaQueryWrapper<TdQuestionTest> queryWrapper = new LambdaQueryWrapper<TdQuestionTest>()
|
||||
.eq(TdQuestionTest::getCarTypeId, queryDto.getCarTypeId())
|
||||
.eq(TdQuestionTest::getSubject, queryDto.getSubject())
|
||||
.eq(TdQuestionTest::getUserId, SecurityUtil.getUserId())
|
||||
.orderByDesc(TdQuestionTest::getCreateTime);
|
||||
|
||||
List<TdQuestionTest> list = this.list(queryWrapper);
|
||||
Long passNum = list.stream().filter(s -> s.getScore() >= 90).count();
|
||||
testTotalVo.setTestNum(list.size())
|
||||
.setPassNum(passNum.intValue());
|
||||
//取最近的五次
|
||||
if (CollectionUtil.isNotEmpty(list) && list.size() > 5) {
|
||||
list = list.subList(0, 5);
|
||||
}
|
||||
List<TdQuestionTest> recentTestList = CollectionUtil.reverse(list);
|
||||
//最近五次的平均分
|
||||
OptionalDouble averaged = recentTestList.stream().mapToInt(TdQuestionTest::getScore).average();
|
||||
Integer average = 0;
|
||||
if (averaged.isPresent()){
|
||||
Double averageScore = averaged.getAsDouble();
|
||||
average = averageScore.intValue();
|
||||
}
|
||||
testTotalVo.setRecentTestList(recentTestList)
|
||||
.setRecentAverageScore(average);
|
||||
return testTotalVo;
|
||||
return this.save(questionTest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
package com.jwl.driver.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jwl.driver.server.constant.Constants;
|
||||
import com.jwl.driver.server.entity.TdQuestionVersion;
|
||||
import com.jwl.driver.server.entity.TdSysConfig;
|
||||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.mapper.TdQuestionVersionMapper;
|
||||
import com.jwl.driver.server.redis.RedisCache;
|
||||
import com.jwl.driver.server.service.ITdQuestionVersionService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jwl.driver.server.service.ITdSysConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 题库版本表; 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-09-03
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TdQuestionVersionServiceImpl extends ServiceImpl<TdQuestionVersionMapper, TdQuestionVersion> implements ITdQuestionVersionService {
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ITdSysConfigService configService;
|
||||
|
||||
@Override
|
||||
public Long currentVersion(Integer carTypeId) {
|
||||
|
||||
Integer value = redisCache.getCacheObject(Constants.QUESTION_VERSOPN_PREFIX + carTypeId);
|
||||
|
||||
if (value !=null){
|
||||
return value.longValue();
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<TdQuestionVersion> cond = new LambdaQueryWrapper<TdQuestionVersion>()
|
||||
.eq(TdQuestionVersion::getCarTypeId,carTypeId)
|
||||
.eq(TdQuestionVersion::getIsActive,Constants.IS_ACTIVE_TRUE);
|
||||
|
||||
TdQuestionVersion tdQuestionVersion = this.getBaseMapper().selectOne(cond);
|
||||
if (Objects.isNull(tdQuestionVersion)){
|
||||
throw new BusinessException("题库版本异常");
|
||||
}
|
||||
|
||||
TdSysConfig tdSysConfig = configService.queryConfigByKey(Constants.REDIS_EXPIRE_TIME, Constants.DEFAULT_CARTYPE_ID);
|
||||
if (Objects.isNull(tdSysConfig)){
|
||||
log.info("config is not exist");
|
||||
throw new BusinessException("系统未知异常");
|
||||
}
|
||||
// 塞入redis中
|
||||
redisCache.setCacheObject(Constants.QUESTION_VERSOPN_PREFIX + carTypeId,tdQuestionVersion.getVersionId(),Long.parseLong(tdSysConfig.getConfigValue()));
|
||||
return tdQuestionVersion.getVersionId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean addVersion(TdQuestionVersion versionDto) {
|
||||
|
||||
LambdaQueryWrapper<TdQuestionVersion> cond = new LambdaQueryWrapper<TdQuestionVersion>()
|
||||
.eq(TdQuestionVersion::getCarTypeId,versionDto.getCarTypeId())
|
||||
.eq(TdQuestionVersion::getIsActive,Constants.IS_ACTIVE_TRUE);
|
||||
|
||||
TdQuestionVersion tdQuestionVersion = this.getBaseMapper().selectOne(cond);
|
||||
|
||||
if (Objects.nonNull(tdQuestionVersion)){
|
||||
tdQuestionVersion.setIsActive(Constants.IS_ACTIVE_FALSE);
|
||||
this.getBaseMapper().updateById(tdQuestionVersion);
|
||||
}
|
||||
TdQuestionVersion newVersion = new TdQuestionVersion();
|
||||
BeanUtils.copyProperties(versionDto,newVersion);
|
||||
newVersion.setCreateTime(LocalDateTime.now())
|
||||
.setIsActive(Constants.IS_ACTIVE_TRUE);
|
||||
this.baseMapper.insert(newVersion);
|
||||
//删除原redis
|
||||
redisCache.deleteObject(Constants.QUESTION_VERSOPN_PREFIX + versionDto.getCarTypeId());
|
||||
redisCache.deleteObjectLike(Constants.SPECIAL_NUM_PREFIX + versionDto.getCarTypeId() );
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
|
@ -1,22 +1,18 @@
|
|||
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.jwl.driver.server.constant.Constants;
|
||||
import com.jwl.driver.server.entity.TdSysConfig;
|
||||
import com.jwl.driver.server.entity.TdSysConfigList;
|
||||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.mapper.TdSysConfigListMapper;
|
||||
import com.jwl.driver.server.redis.RedisCache;
|
||||
import com.jwl.driver.server.service.ITdSysConfigListService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jwl.driver.server.service.ITdSysConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -28,44 +24,17 @@ import java.util.stream.Collectors;
|
|||
* @since 2023-08-10
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TdSysConfigListServiceImpl extends ServiceImpl<TdSysConfigListMapper, TdSysConfigList> implements ITdSysConfigListService {
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ITdSysConfigService configService;
|
||||
|
||||
@Override
|
||||
public List<TdSysConfigList> querySysConfigList(String configKey, Integer carTypeId) {
|
||||
|
||||
List<TdSysConfigList> configLists = redisCache.getCacheObject(Constants.CONFIG_LIST_PREFIX + configKey + "_" + carTypeId);
|
||||
if (CollectionUtil.isNotEmpty(configLists)) {
|
||||
return configLists;
|
||||
}
|
||||
//redis中没有则查询数据库
|
||||
LambdaQueryWrapper<TdSysConfigList> queryWrapper = new LambdaQueryWrapper<TdSysConfigList>()
|
||||
.eq(TdSysConfigList::getCarTypeId, carTypeId)
|
||||
.eq(TdSysConfigList::getConfigKey, configKey)
|
||||
.eq(TdSysConfigList::getIsActive, Constants.IS_ACTIVE_TRUE)
|
||||
.orderByAsc(TdSysConfigList::getShowOrder);
|
||||
configLists = this.getBaseMapper().selectList(queryWrapper);
|
||||
|
||||
if (CollectionUtil.isEmpty(configLists)) {
|
||||
return configLists;
|
||||
}
|
||||
|
||||
//获取redis缓存时间
|
||||
TdSysConfig tdSysConfig = configService.queryConfigByKey(Constants.REDIS_EXPIRE_TIME, Constants.DEFAULT_CARTYPE_ID);
|
||||
if (Objects.isNull(tdSysConfig)) {
|
||||
log.info("config is not exist");
|
||||
throw new BusinessException("系统异常");
|
||||
}
|
||||
// 塞入redis中
|
||||
redisCache.setCacheObject(Constants.CONFIG_LIST_PREFIX + configKey + "_" + carTypeId, configLists, Long.parseLong(tdSysConfig.getConfigValue()));
|
||||
|
||||
return configLists;
|
||||
return this.getBaseMapper().selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,10 +55,4 @@ public class TdSysConfigListServiceImpl extends ServiceImpl<TdSysConfigListMappe
|
|||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer querySysConfigListNum(String configKey, Integer carTypeId) {
|
||||
List<TdSysConfigList> configLists = querySysConfigList(configKey, carTypeId);
|
||||
return CollectionUtil.isEmpty(configLists) ? 0 : configLists.size();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
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.core.conditions.query.QueryWrapper;
|
||||
import com.jwl.driver.server.constant.Constants;
|
||||
import com.jwl.driver.server.entity.TdSysConfig;
|
||||
import com.jwl.driver.server.entity.TdSysConfigList;
|
||||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.mapper.TdSysConfigMapper;
|
||||
import com.jwl.driver.server.redis.RedisCache;
|
||||
import com.jwl.driver.server.service.ITdSysConfigService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -32,50 +30,24 @@ import java.util.stream.Collectors;
|
|||
@Slf4j
|
||||
public class TdSysConfigServiceImpl extends ServiceImpl<TdSysConfigMapper, TdSysConfig> implements ITdSysConfigService {
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Override
|
||||
public TdSysConfig queryConfigByKey(String configKey, Integer carTypeId) {
|
||||
log.info("获取系统配置参数,configKey:{}", configKey);
|
||||
|
||||
TdSysConfig config = redisCache.getCacheObject(Constants.CONFIG_PREFIX + configKey + "_" + carTypeId);
|
||||
if (Objects.nonNull(config)){
|
||||
return config;
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<TdSysConfig> queryWrapper = new QueryWrapper<TdSysConfig>().lambda()
|
||||
.eq(TdSysConfig::getCarTypeId,carTypeId)
|
||||
.eq(TdSysConfig::getConfigKey, configKey)
|
||||
.eq(TdSysConfig::getIsActive, Constants.IS_ACTIVE_TRUE);
|
||||
config = getOne(queryWrapper);
|
||||
|
||||
if (Objects.isNull(config)){
|
||||
return config;
|
||||
}
|
||||
|
||||
//获取redis缓存时间
|
||||
TdSysConfig tdSysConfig = null;
|
||||
if (StrUtil.equals(configKey,Constants.REDIS_EXPIRE_TIME)){
|
||||
tdSysConfig = config;
|
||||
}else {
|
||||
tdSysConfig = queryConfigByKey(Constants.REDIS_EXPIRE_TIME, Constants.DEFAULT_CARTYPE_ID);
|
||||
}
|
||||
|
||||
if (Objects.isNull(tdSysConfig)) {
|
||||
log.info("config is not exist");
|
||||
throw new BusinessException("系统异常");
|
||||
}
|
||||
// 塞入redis中
|
||||
redisCache.setCacheObject(Constants.CONFIG_PREFIX + configKey + "_" + carTypeId, config, Long.parseLong(tdSysConfig.getConfigValue()));
|
||||
|
||||
return config;
|
||||
return getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryConfigValueByKey(String configKey, Integer carTypeId) {
|
||||
log.info("获取系统配置参数,configKey:{}", configKey);
|
||||
TdSysConfig config = queryConfigByKey(configKey,carTypeId);
|
||||
LambdaQueryWrapper<TdSysConfig> queryWrapper = new QueryWrapper<TdSysConfig>().lambda()
|
||||
.eq(TdSysConfig::getCarTypeId,carTypeId)
|
||||
.eq(TdSysConfig::getConfigKey, configKey)
|
||||
.eq(TdSysConfig::getIsActive, Constants.IS_ACTIVE_TRUE);
|
||||
TdSysConfig config = getOne(queryWrapper);
|
||||
if(null == config) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,28 +1,10 @@
|
|||
package com.jwl.driver.server.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jwl.driver.server.dto.UserMemberDto;
|
||||
import com.jwl.driver.server.entity.OrderPayInfo;
|
||||
import com.jwl.driver.server.entity.TdMember;
|
||||
import com.jwl.driver.server.entity.TdSysUserMember;
|
||||
import com.jwl.driver.server.exception.BusinessException;
|
||||
import com.jwl.driver.server.mapper.TdSysUserMemberMapper;
|
||||
import com.jwl.driver.server.service.IOrderPayInfoService;
|
||||
import com.jwl.driver.server.service.ITdMemberService;
|
||||
import com.jwl.driver.server.service.ITdSysUserMemberService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jwl.driver.server.service.ITdSysUserService;
|
||||
import com.jwl.driver.server.vo.UserMemberVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -35,69 +17,4 @@ import java.util.Objects;
|
|||
@Service
|
||||
public class TdSysUserMemberServiceImpl extends ServiceImpl<TdSysUserMemberMapper, TdSysUserMember> implements ITdSysUserMemberService {
|
||||
|
||||
@Autowired
|
||||
private IOrderPayInfoService payInfoService;
|
||||
|
||||
@Autowired
|
||||
private ITdMemberService memberService;
|
||||
|
||||
@Autowired
|
||||
private ITdSysUserMemberService userMemberService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean purchaseMember(OrderPayInfo payInfo) {
|
||||
final LocalDateTime nowTime = LocalDateTime.now();
|
||||
|
||||
if (Objects.isNull(payInfo)){
|
||||
throw new BusinessException("订单信息不存在");
|
||||
}
|
||||
final Long userId = payInfo.getUserId();
|
||||
final Integer memberId = Integer.parseInt(payInfo.getPurchaseProductId());
|
||||
// 查询会员 不管有效无效
|
||||
TdMember member = memberService.getById(memberId);
|
||||
if (Objects.isNull(member)){
|
||||
throw new BusinessException("购买的会员不存在");
|
||||
}
|
||||
//查看该用户是否存在有效会员
|
||||
LambdaQueryWrapper<TdSysUserMember> cond = new LambdaQueryWrapper<TdSysUserMember>()
|
||||
.eq(TdSysUserMember::getUserId,userId)
|
||||
.eq(TdSysUserMember::getMemberId,memberId)
|
||||
.gt(TdSysUserMember::getEndDate, nowTime);
|
||||
|
||||
TdSysUserMember userMember = this.getOne(cond);
|
||||
//如果用户没购买该会员 或者该会员已过期就新建一个会员
|
||||
if (Objects.isNull(userMember)){
|
||||
userMember = new TdSysUserMember()
|
||||
.setMemberId(memberId)
|
||||
.setUserId(userId)
|
||||
.setCreateTime(nowTime)
|
||||
.setUpdateTime(nowTime)
|
||||
.setStartDate(LocalDateTime.of(LocalDate.now(), LocalTime.MIN))
|
||||
.setEndDate(LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusDays(1).minusSeconds(1));
|
||||
boolean save = this.save(userMember);
|
||||
if (!save){
|
||||
throw new BusinessException("充值会员失败");
|
||||
}
|
||||
}
|
||||
LocalDateTime endTime = userMember.getEndDate();
|
||||
if (StrUtil.equals(member.getUnit(),"1")){
|
||||
endTime = endTime.plusDays(member.getDuration());
|
||||
}else if (StrUtil.equals(member.getUnit(),"2")){
|
||||
endTime = endTime.plusMonths(member.getDuration());
|
||||
} else if (StrUtil.equals(member.getUnit(),"3")) {
|
||||
endTime = endTime.plusYears(member.getDuration());
|
||||
}
|
||||
userMember.setEndDate(endTime.minusDays(1));
|
||||
boolean update = this.update(userMember, cond);
|
||||
if (!update){
|
||||
throw new BusinessException("会员充值失败");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserMemberVo> queryUserMemberList(UserMemberDto userMemberDto) {
|
||||
return getBaseMapper().queryUserMemberList(userMemberDto);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,8 @@ package com.jwl.driver.server.service.impl;
|
|||
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
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;
|
||||
|
@ -14,9 +12,11 @@ import com.jwl.driver.server.mapper.TdSysUserMapper;
|
|||
import com.jwl.driver.server.redis.RedisCache;
|
||||
import com.jwl.driver.server.service.ITdSysUserService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jwl.driver.server.util.*;
|
||||
import com.jwl.driver.server.util.DateTimeUtil;
|
||||
import com.jwl.driver.server.util.SecurityUtil;
|
||||
import com.jwl.driver.server.util.SmsUtil;
|
||||
import com.jwl.driver.server.util.TokenThreadUtil;
|
||||
import com.jwl.driver.server.vo.LoginUserVo;
|
||||
import com.jwl.driver.server.vo.SchoolVO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
@ -49,7 +49,7 @@ public class TdSysUserServiceImpl extends ServiceImpl<TdSysUserMapper, TdSysUser
|
|||
private Integer codeExpireTime;
|
||||
|
||||
@Override
|
||||
public Boolean code(String phone) {
|
||||
public String code(String phone) {
|
||||
|
||||
if (!PhoneUtil.isPhone(phone)) {
|
||||
throw new BusinessException("手机号格式不正确");
|
||||
|
@ -62,7 +62,7 @@ public class TdSysUserServiceImpl extends ServiceImpl<TdSysUserMapper, TdSysUser
|
|||
|
||||
String code = SmsUtil.sendMessage(phone);
|
||||
redisCache.setCacheObject((Constants.MESSAGE_CODE_PREFIX + phone), code, codeExpireTime, TimeUnit.SECONDS);
|
||||
return Boolean.TRUE;
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -87,37 +87,16 @@ public class TdSysUserServiceImpl extends ServiceImpl<TdSysUserMapper, TdSysUser
|
|||
TdSysUser tdSysUser = this.baseMapper.selectOne(cond);
|
||||
//todo 用户基础信息填写这里还要完善一下
|
||||
if (tdSysUser == null) {
|
||||
|
||||
tdSysUser = new TdSysUser()
|
||||
.setUserName("车友")
|
||||
.setAvatar("")
|
||||
.setPhone(loginUserDto.getPhone())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
|
||||
//根据id查询驾校信息
|
||||
if(!StringUtil.isNullOrEmpty(loginUserDto.getId())){
|
||||
String result = HttpUtils.sendGet("https://xueche.ahduima.com/duima/applet/school/"+loginUserDto.getId());
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if(jsonObject.get("data") != null){
|
||||
SchoolVO schoolVO = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("data")), SchoolVO.class);
|
||||
tdSysUser.setSchoolId(schoolVO.getSchoolId())
|
||||
.setSchoolName(schoolVO.getSchoolName())
|
||||
.setSchoolPhone(schoolVO.getPhone());
|
||||
}
|
||||
}
|
||||
|
||||
int insert = this.getBaseMapper().insert(tdSysUser);
|
||||
if (insert != 1) {
|
||||
throw new BusinessException("用户注册异常");
|
||||
}
|
||||
}
|
||||
//清除上一个人登陆的token信息
|
||||
String oldToken = redisCache.getCacheObject(Constants.PHONE_PREFIX + tdSysUser.getPhone());
|
||||
if (StrUtil.isNotBlank(oldToken)){
|
||||
redisCache.deleteObject(Constants.PHONE_PREFIX + tdSysUser.getPhone());
|
||||
redisCache.deleteObject(oldToken);
|
||||
}
|
||||
|
||||
String token = UUID.randomUUID().toString();
|
||||
LoginUserVo loginUserVo = new LoginUserVo();
|
||||
BeanUtils.copyProperties(tdSysUser, loginUserVo);
|
||||
|
@ -125,7 +104,6 @@ public class TdSysUserServiceImpl extends ServiceImpl<TdSysUserMapper, TdSysUser
|
|||
loginUserVo.setDays(DateTimeUtil.getIntervalDays(loginUserVo.getCreateTime(),LocalDateTime.now()) + 1);
|
||||
// 存入redis
|
||||
redisCache.setCacheObject(token, tdSysUser, tokenExpireTime, TimeUnit.DAYS);
|
||||
redisCache.setCacheObject(Constants.PHONE_PREFIX + tdSysUser.getPhone(), token, tokenExpireTime, TimeUnit.DAYS);
|
||||
return loginUserVo;
|
||||
}
|
||||
|
||||
|
@ -133,11 +111,6 @@ public class TdSysUserServiceImpl extends ServiceImpl<TdSysUserMapper, TdSysUser
|
|||
public Boolean loginOut() {
|
||||
String token = TokenThreadUtil.getToken();
|
||||
if (StrUtil.isNotBlank(token)) {
|
||||
TdSysUser tdSysUser = redisCache.getCacheObject(token);
|
||||
if (Objects.nonNull(tdSysUser) && Objects.nonNull(tdSysUser.getPhone())){
|
||||
redisCache.deleteObject(Constants.PHONE_PREFIX + tdSysUser.getPhone());
|
||||
}
|
||||
|
||||
redisCache.deleteObject(token);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
|
@ -163,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>()
|
||||
|
@ -173,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){
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.jwl.driver.server.service.impl;
|
||||
|
||||
import com.jwl.driver.server.entity.TdTestProject;
|
||||
import com.jwl.driver.server.mapper.TdTestProjectMapper;
|
||||
import com.jwl.driver.server.service.ITdTestProjectService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 考试项目表; 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Service
|
||||
public class TdTestProjectServiceImpl extends ServiceImpl<TdTestProjectMapper, TdTestProject> implements ITdTestProjectService {
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.jwl.driver.server.service.impl;
|
||||
|
||||
import com.jwl.driver.server.entity.TdTestProjectVideos;
|
||||
import com.jwl.driver.server.mapper.TdTestProjectVideosMapper;
|
||||
import com.jwl.driver.server.service.ITdTestProjectVideosService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 视频标识表; 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Service
|
||||
public class TdTestProjectVideosServiceImpl extends ServiceImpl<TdTestProjectVideosMapper, TdTestProjectVideos> implements ITdTestProjectVideosService {
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package com.jwl.driver.server.service.impl;
|
||||
|
||||
import com.jwl.driver.server.entity.TdVideos;
|
||||
import com.jwl.driver.server.mapper.TdVideosMapper;
|
||||
import com.jwl.driver.server.service.ITdVideosService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 视频标识表; 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-20
|
||||
*/
|
||||
@Service
|
||||
public class TdVideosServiceImpl extends ServiceImpl<TdVideosMapper, TdVideos> implements ITdVideosService {
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package com.jwl.driver.server.util;
|
||||
|
||||
import com.wechat.pay.java.core.util.IOUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 流处理
|
||||
* @create 2023/8/24 14:41
|
||||
*/
|
||||
public class InputStreamUtil {
|
||||
|
||||
// 获取文件内容
|
||||
public static String getContentStr(String filePath){
|
||||
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath);
|
||||
String contentStr;
|
||||
try {
|
||||
Throwable var2 = null;
|
||||
try {
|
||||
contentStr = IOUtil.toString(inputStream);
|
||||
} catch (Throwable var13) {
|
||||
var2 = var13;
|
||||
throw var13;
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
if (var2 != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (Throwable var12) {
|
||||
var2.addSuppressed(var12);
|
||||
}
|
||||
} else {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (IOException var15) {
|
||||
throw new UncheckedIOException(var15);
|
||||
}
|
||||
return contentStr;
|
||||
}
|
||||
}
|
|
@ -35,8 +35,7 @@ public class SmsUtil {
|
|||
private static String url = "dysmsapi.aliyuncs.com";
|
||||
private static String appkey = "LTAI4GH1CqJtaUVpmD1oYEUZ";
|
||||
private static String secret = "DFG848ea8U0QaQcdiHAYznUrCWfJzn";
|
||||
// private static String smsFreeSignName = "对嘛科技";
|
||||
private static String smsFreeSignName = "金武联";
|
||||
private static String smsFreeSignName = "对嘛科技";
|
||||
|
||||
//用于存储短信验证码
|
||||
// private static Map<String, String> codeMap = new HashMap<>();
|
||||
|
|
|
@ -4,14 +4,12 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel("微信支付")
|
||||
public class AppletPayVo {
|
||||
|
||||
@ApiModelProperty("支付金额")
|
||||
private BigDecimal money;//金额
|
||||
private Double money;//金额
|
||||
|
||||
@ApiModelProperty("小程序端 获取的code")
|
||||
private String code;//小程序端 获取的code
|
||||
|
@ -22,10 +20,7 @@ public class AppletPayVo {
|
|||
@ApiModelProperty("支付描述")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty("商户系统的订单类型")
|
||||
private String tradeType;
|
||||
|
||||
@ApiModelProperty("商户系统的订单号")
|
||||
private String outTradeNo;
|
||||
|
||||
}
|
||||
}
|
|
@ -4,13 +4,11 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@ApiModel("H5支付")
|
||||
@Data
|
||||
public class H5PayVo {
|
||||
@ApiModelProperty("支付金额")
|
||||
private BigDecimal money;//金额
|
||||
private Double money;//金额
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private String userId;
|
||||
|
@ -18,9 +16,6 @@ public class H5PayVo {
|
|||
@ApiModelProperty("支付描述")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty("商户系统的订单类型")
|
||||
private String tradeType;
|
||||
|
||||
@ApiModelProperty("商户系统的订单号")
|
||||
private String outTradeNo;
|
||||
|
||||
|
|
|
@ -60,12 +60,6 @@ public class LoginUserVo {
|
|||
@ApiModelProperty("驾校名称")
|
||||
private String schoolName;
|
||||
|
||||
/**
|
||||
* 驾校电话
|
||||
*/
|
||||
@ApiModelProperty("驾校电话")
|
||||
private String schoolPhone;
|
||||
|
||||
/**
|
||||
* 驾校名称
|
||||
*/
|
||||
|
|
|
@ -89,7 +89,7 @@ public class MemberVo {
|
|||
* 会员描述
|
||||
*/
|
||||
@ApiModelProperty("会员描述")
|
||||
private String description;
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 是否生效
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
package com.jwl.driver.server.vo;
|
||||
|
||||
|
||||
import com.jwl.driver.server.entity.TdVideos;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 考试项目表;
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("考试项目出参")
|
||||
public class ProjectVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 考试项目
|
||||
*/
|
||||
@ApiModelProperty("考试项目")
|
||||
private Integer projectId;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@ApiModelProperty("类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 所属科目
|
||||
*/
|
||||
@ApiModelProperty("所属科目")
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 车型标识
|
||||
*/
|
||||
@ApiModelProperty("车型标识")
|
||||
private Integer carTypeId;
|
||||
|
||||
/**
|
||||
* 驾驶类型,手动挡,自动挡,A2:B2等(在字典表里配置)
|
||||
*/
|
||||
@ApiModelProperty("驾驶类型")
|
||||
private String driveType;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty("描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 是否生效
|
||||
*/
|
||||
@ApiModelProperty("是否生效")
|
||||
private String isActive;
|
||||
|
||||
/**
|
||||
* 显示序号
|
||||
*/
|
||||
@ApiModelProperty("显示序号")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 图片url
|
||||
*/
|
||||
@ApiModelProperty("图片url")
|
||||
private String imageUrl;
|
||||
|
||||
@ApiModelProperty("视频列表")
|
||||
private List<TdVideos> videoList;
|
||||
}
|
|
@ -1,217 +0,0 @@
|
|||
package com.jwl.driver.server.vo;
|
||||
|
||||
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 驾考题目出参
|
||||
* @create 2023/8/13 17:13
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("驾考题目出参")
|
||||
public class QuestionVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 题目标识
|
||||
*/
|
||||
@ApiModelProperty("题目标识")
|
||||
private Long questionId;
|
||||
|
||||
/**
|
||||
* 题目内容
|
||||
*/
|
||||
@ApiModelProperty("题目内容")
|
||||
private String question;
|
||||
|
||||
/**
|
||||
* 选项A
|
||||
*/
|
||||
@ApiModelProperty("选项A")
|
||||
private String chooseA;
|
||||
|
||||
/**
|
||||
* 选项B
|
||||
*/
|
||||
@ApiModelProperty("选项B")
|
||||
private String chooseB;
|
||||
|
||||
/**
|
||||
* 选项C
|
||||
*/
|
||||
@ApiModelProperty("选项C")
|
||||
private String chooseC;
|
||||
|
||||
/**
|
||||
* 选项D
|
||||
*/
|
||||
@ApiModelProperty("选项D")
|
||||
private String chooseD;
|
||||
|
||||
/**
|
||||
* 选项E
|
||||
*/
|
||||
@ApiModelProperty("选项E")
|
||||
private String chooseE;
|
||||
|
||||
/**
|
||||
* 选项F
|
||||
*/
|
||||
@ApiModelProperty("选项F")
|
||||
private String chooseF;
|
||||
|
||||
/**
|
||||
* 选项G
|
||||
*/
|
||||
@ApiModelProperty("选项G")
|
||||
private String chooseG;
|
||||
|
||||
/**
|
||||
* 正确答案
|
||||
*/
|
||||
@ApiModelProperty("正确答案")
|
||||
private String trueAnswer;
|
||||
|
||||
/**
|
||||
* 未知
|
||||
*/
|
||||
@ApiModelProperty("未知")
|
||||
private String cids;
|
||||
|
||||
/**
|
||||
* 题型分类
|
||||
*/
|
||||
@ApiModelProperty("题型分类")
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 题目图片url
|
||||
*/
|
||||
@ApiModelProperty("题目图片url")
|
||||
private String imageUrl;
|
||||
|
||||
/**
|
||||
* 未知
|
||||
*/
|
||||
@ApiModelProperty("未知")
|
||||
private String sohuImg;
|
||||
|
||||
/**
|
||||
* 最佳回答
|
||||
*/
|
||||
@ApiModelProperty("最佳回答")
|
||||
private String bestAnswer;
|
||||
|
||||
/**
|
||||
* 答题技巧
|
||||
*/
|
||||
@ApiModelProperty("答题技巧")
|
||||
private String skillInfo;
|
||||
|
||||
/**
|
||||
* 章节标识
|
||||
*/
|
||||
@ApiModelProperty("章节标识")
|
||||
private String chapter;
|
||||
|
||||
/**
|
||||
* 所属科目,1:科目1,2:科目4
|
||||
*/
|
||||
@ApiModelProperty("所属科目,1:科目1,2:科目4")
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 选择
|
||||
*/
|
||||
@ApiModelProperty("选择")
|
||||
private String options;
|
||||
|
||||
@ApiModelProperty("选项列表")
|
||||
private List<QuestionOption> optionList;
|
||||
|
||||
/**
|
||||
* 题目类型,1:选择题 2:判断题,3:多选题
|
||||
*/
|
||||
@ApiModelProperty("题目类型,1:选择题 2:判断题,3:多选题")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 显示序号
|
||||
*/
|
||||
@ApiModelProperty("显示序号")
|
||||
private int showOrder;
|
||||
|
||||
/**
|
||||
* 车型
|
||||
*/
|
||||
@ApiModelProperty("车型")
|
||||
private Integer carTypeId;
|
||||
|
||||
/**
|
||||
* 是否生效
|
||||
*/
|
||||
@ApiModelProperty("是否生效")
|
||||
private String isActive;
|
||||
|
||||
/**
|
||||
* 是否vip题型
|
||||
*/
|
||||
@ApiModelProperty("是否VIP")
|
||||
private Integer isVip;
|
||||
/**
|
||||
* 是否易错
|
||||
*/
|
||||
@ApiModelProperty("是否易错")
|
||||
private Integer isError;
|
||||
/**
|
||||
* 是否v新规
|
||||
*/
|
||||
@ApiModelProperty("是否新规")
|
||||
private Integer isNew;
|
||||
/**
|
||||
* 考点
|
||||
*/
|
||||
@ApiModelProperty("考点")
|
||||
private String examKeys;
|
||||
|
||||
/**
|
||||
* 是否精讯600题
|
||||
*/
|
||||
@ApiModelProperty("精讯600题")
|
||||
private Integer isVip2;
|
||||
|
||||
/**
|
||||
* 是否密卷1
|
||||
*/
|
||||
@ApiModelProperty("是否密卷1")
|
||||
private Integer isExam1;
|
||||
|
||||
/**
|
||||
* 是否密卷2
|
||||
*/
|
||||
@ApiModelProperty("是否密卷2")
|
||||
private Integer isExam2;
|
||||
|
||||
|
||||
@Data
|
||||
@Accessors
|
||||
@AllArgsConstructor
|
||||
public static class QuestionOption{
|
||||
@ApiModelProperty("选项")
|
||||
private String op;
|
||||
|
||||
@ApiModelProperty("选项描述")
|
||||
private String opDesc;
|
||||
|
||||
@ApiModelProperty("选项值")
|
||||
private String opValue;
|
||||
}
|
||||
}
|
|
@ -5,8 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 题型分类
|
||||
|
@ -37,10 +35,4 @@ public class QusetionCategoryVo {
|
|||
@ApiModelProperty("类型数量")
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 错题ID列表
|
||||
*/
|
||||
@ApiModelProperty("错题ID列表")
|
||||
private List<Long> errorQuestionIdList;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,31 +1,34 @@
|
|||
package com.jwl.driver.server.dto;
|
||||
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 javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 驾考新增入参
|
||||
* @description 驾考题目出参
|
||||
* @create 2023/8/13 17:13
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("驾考题目出参")
|
||||
public class QuestionAddDto {
|
||||
public class QusetionVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 题目标识
|
||||
*/
|
||||
@ApiModelProperty("题目标识")
|
||||
private Long questionId;
|
||||
|
||||
/**
|
||||
* 题目内容
|
||||
*/
|
||||
@ApiModelProperty(value = "题目内容",required = true)
|
||||
@ApiModelProperty("题目内容")
|
||||
private String question;
|
||||
|
||||
/**
|
||||
|
@ -128,7 +131,6 @@ public class QuestionAddDto {
|
|||
* 题目类型,1:选择题 2:判断题,3:多选题
|
||||
*/
|
||||
@ApiModelProperty("题目类型,1:选择题 2:判断题,3:多选题")
|
||||
@NotBlank
|
||||
private String type;
|
||||
|
||||
/**
|
||||
|
@ -141,7 +143,6 @@ public class QuestionAddDto {
|
|||
* 车型
|
||||
*/
|
||||
@ApiModelProperty("车型")
|
||||
@NotNull
|
||||
private Integer carTypeId;
|
||||
|
||||
/**
|
||||
|
@ -154,7 +155,6 @@ public class QuestionAddDto {
|
|||
* 是否vip题型
|
||||
*/
|
||||
@ApiModelProperty("是否VIP")
|
||||
@NotNull
|
||||
private Integer isVip;
|
||||
/**
|
||||
* 是否易错
|
|
@ -1,20 +0,0 @@
|
|||
package com.jwl.driver.server.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SchoolVO {
|
||||
private Long schoolId;
|
||||
|
||||
/** 驾校名称 */
|
||||
private String schoolName;
|
||||
|
||||
/** 负责人 */
|
||||
private String leader;
|
||||
|
||||
/** 联系电话 */
|
||||
private String phone;
|
||||
|
||||
/** 部门状态(0正常 1停用) */
|
||||
private String status;
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package com.jwl.driver.server.vo;
|
||||
|
||||
import com.jwl.driver.server.entity.TdQuestionTest;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 考试成绩统计出参
|
||||
* @create 2023/8/21 0:39
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("考试成绩统计出参")
|
||||
public class TestTotalVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 考试次数
|
||||
*/
|
||||
@ApiModelProperty("考试次数")
|
||||
private Integer testNum;
|
||||
|
||||
/**
|
||||
* 合格次数
|
||||
*/
|
||||
@ApiModelProperty("合格次数")
|
||||
private Integer passNum;
|
||||
|
||||
/**
|
||||
* 最近考试平均得分(超过五次按最近五次计算)
|
||||
*/
|
||||
@ApiModelProperty("最近考试平均得分(超过五次按最近五次计算)")
|
||||
private Integer recentAverageScore;
|
||||
|
||||
/**
|
||||
* 最近考试情况(超过五次返回最近五次)
|
||||
*/
|
||||
@ApiModelProperty("最近考试情况(超过五次返回最近五次)")
|
||||
private List<TdQuestionTest> recentTestList;
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package com.jwl.driver.server.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("用户学员")
|
||||
public class UserMemberVo {
|
||||
|
||||
@ApiModelProperty("用户标识")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("手机号")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 会员结束时间
|
||||
*/
|
||||
@ApiModelProperty("会员结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endDate;
|
||||
|
||||
/**
|
||||
* 会员结束时间
|
||||
*/
|
||||
@ApiModelProperty("会员开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
/**
|
||||
* 会员标识
|
||||
*/
|
||||
@ApiModelProperty("会员标识")
|
||||
private Integer memberId;
|
||||
|
||||
/**
|
||||
* 会员名称
|
||||
*/
|
||||
@ApiModelProperty("会员名称")
|
||||
private String memberName;
|
||||
|
||||
/**
|
||||
* 车型标识
|
||||
*/
|
||||
@ApiModelProperty("车型标识")
|
||||
private Integer carTypeId;
|
||||
|
||||
@ApiModelProperty("车型")
|
||||
private String carName;
|
||||
|
||||
/**
|
||||
* 科目
|
||||
*/
|
||||
@ApiModelProperty("科目")
|
||||
private String subjects;
|
||||
|
||||
/**
|
||||
* 会员价格,单位元
|
||||
*/
|
||||
@ApiModelProperty("会员价格,单位元")
|
||||
private BigDecimal price;
|
||||
|
||||
}
|
|
@ -1,32 +1,18 @@
|
|||
spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# host: 127.0.0.1
|
||||
# port: 6379
|
||||
# database: 8
|
||||
# timeout: 5000
|
||||
# auth: caolin123
|
||||
host: 118.31.23.45
|
||||
port: 6973
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
database: 8
|
||||
timeout: 5000
|
||||
password: c12&%3s7l=
|
||||
auth: caolin123
|
||||
|
||||
|
||||
# 数据库 配置
|
||||
datasource:
|
||||
# 本地
|
||||
# url: jdbc:mysql://127.0.0.1:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
|
||||
# username: root
|
||||
# password: 123456
|
||||
# 测试库
|
||||
url: jdbc:mysql://118.31.23.45:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://127.0.0.1:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: admin231280
|
||||
# 生产库
|
||||
# url: jdbc:mysql://114.55.169.15:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
|
||||
# username: root
|
||||
# password: Zhou202109
|
||||
|
||||
password: 123456
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
host: 118.31.23.45
|
||||
port: 6379
|
||||
database: 8
|
||||
timeout: 5000
|
||||
password: 123456
|
||||
|
||||
# 数据库 配置
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://118.31.23.45:3306/driver_server?characterEncoding=utf-8&autoReconnect=true&maxReconnects=2&useSSL=false&allowPublicKeyRetrieval=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: Zhou202109
|
||||
|
||||
password: admin231280
|
||||
|
|
|
@ -2,10 +2,10 @@ spring:
|
|||
# redis 配置
|
||||
redis:
|
||||
host: 118.31.23.45
|
||||
port: 6973
|
||||
port: 6379
|
||||
database: 8
|
||||
timeout: 5000
|
||||
password: c12&%3s7l=
|
||||
password: 123456
|
||||
|
||||
# 数据库 配置
|
||||
datasource:
|
||||
|
|
|
@ -7,7 +7,7 @@ spring:
|
|||
application:
|
||||
name: '@artifactId@'
|
||||
profiles:
|
||||
active: prod
|
||||
active: test
|
||||
#mybatis
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:/mapper/**Mapper.xml
|
||||
|
@ -35,39 +35,19 @@ driver:
|
|||
auth-config:
|
||||
# 约定为若 preAuth 为 true,则所有请求(除不需权限校验url集合noAuthEndPoints外)都需要身份认证
|
||||
# 为 false,则所有请求(除需要权限校验url集合needAuthEndPoints外)都不需要身份认证
|
||||
preAuth: false
|
||||
preAuth: true
|
||||
# 不需权限校验url集合
|
||||
noAuthEndPoints:
|
||||
# - /driver-api/v2/api-docs
|
||||
# - /driver-api/swagger-resources
|
||||
# - /driver-api/favicon.ico
|
||||
# - /driver-api/tdSysUser/code
|
||||
# - /driver-api/payNoticeLog
|
||||
# - /driver-api/tdQuestion/duima/list
|
||||
# - /driver-api/tdQuestion/duima/update
|
||||
# - /driver-api/tdQuestion/queryQuestionById
|
||||
# - /driver-api/tdQuestion/queryQuestionByIdList
|
||||
# - /driver-api/tdQuestion/queryQuestion
|
||||
# - /driver-api/tdQuestion/getTestQuestion
|
||||
# - /driver-api/tdQuestion/questionCategory
|
||||
# - /driver-api/tdMember/queryMember
|
||||
# - /driver-api/tdSysConfig/queryConfigByKey
|
||||
# - /driver-api/tdSysConfig/queryConfigValueByKey
|
||||
# - /driver-api/tdSysConfig/queryConfigByKeys
|
||||
# - /driver-api/tdSysConfigList/querySysConfigList
|
||||
# - /driver-api/tdSysConfigList/querySysConfigMap
|
||||
# - /driver-api/tdCar/list
|
||||
# - driver-api/tdTestProject/queryProjectList
|
||||
- /driver-api/v2/api-docs
|
||||
- /driver-api/swagger-resources
|
||||
- /driver-api/favicon.ico
|
||||
- /driver-api/tdSysUser/code
|
||||
- /tdQuestion/duima/list
|
||||
- /tdQuestion/duima/update
|
||||
- /payNoticeLog
|
||||
|
||||
# 需要权限校验url集合
|
||||
needAuthEndPoints:
|
||||
- /driver-api/tdSysUser/loginOut
|
||||
- /driver-api/tdSysUser/queryUserMessage
|
||||
- /driver-api/tdSysUser/bindSchool
|
||||
- /driver-api/tdQuestionTest/testSubmit
|
||||
- /driver-api/tdQuestionTest/testTotal
|
||||
- /driver-api/tdMember/queryUserMember
|
||||
- /driver-api/applet/pay/prepay
|
||||
- /driver-api/H5/pay/prepay
|
||||
|
||||
# token 有效期1年
|
||||
token:
|
||||
|
@ -78,13 +58,14 @@ message:
|
|||
code:
|
||||
expireTime: 300
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
tm.DURATION,
|
||||
tm.SUBJECTS,
|
||||
tm.UNIT,
|
||||
tm.DESCRIPTION,
|
||||
tm.DESC,
|
||||
tm.IS_ACTIVE
|
||||
from
|
||||
td_member tm
|
||||
|
@ -42,7 +42,7 @@
|
|||
tm.DURATION,
|
||||
tm.SUBJECTS,
|
||||
tm.UNIT,
|
||||
tm.DESCRIPTION,
|
||||
tm.DESC,
|
||||
tm.IS_ACTIVE
|
||||
from
|
||||
td_sys_user_member tsum
|
||||
|
|
|
@ -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,
|
||||
|
@ -19,7 +19,6 @@
|
|||
tq.IMAGE_URL,
|
||||
tq.SOHU_IMG,
|
||||
tq.BEST_ANSWER,
|
||||
tq.SKILL_INFO,
|
||||
tq.CHAPTER,
|
||||
tq.SUBJECT,
|
||||
tq.OPTIONS,
|
||||
|
@ -63,30 +62,6 @@
|
|||
<if test="queryDto.type !=null and queryDto.type != ''">
|
||||
and tq.TYPE = #{queryDto.type}
|
||||
</if>
|
||||
<if test="queryDto.isError !=null">
|
||||
and tq.IS_ERROR = #{queryDto.isError}
|
||||
</if>
|
||||
<if test="queryDto.isNew !=null">
|
||||
and tq.IS_NEW = #{queryDto.isNew}
|
||||
</if>
|
||||
<if test="queryDto.isImage !=null">
|
||||
and tq.IMAGE_URL is not null
|
||||
</if>
|
||||
<if test="queryDto.examKey !=null and queryDto.examKey != ''">
|
||||
and find_in_set(#{queryDto.examKey},tq.EXAM_KEYS)
|
||||
</if>
|
||||
<if test="queryDto.isVip !=null">
|
||||
and tq.IS_VIP = #{queryDto.isVip}
|
||||
</if>
|
||||
<if test="queryDto.isVip2 !=null">
|
||||
and tq.IS_VIP2 = #{queryDto.isVip2}
|
||||
</if>
|
||||
<if test="queryDto.isExam1 !=null">
|
||||
and tq.IS_EXAM1 = #{queryDto.isExam1}
|
||||
</if>
|
||||
<if test="queryDto.isExam2 !=null">
|
||||
and tq.IS_EXAM2 = #{queryDto.isExam2}
|
||||
</if>
|
||||
<if test="queryDto.cid !=null and queryDto.cid !=''">
|
||||
and find_in_set(#{queryDto.cid},tq.CIDS)
|
||||
</if>
|
||||
|
@ -101,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,
|
||||
|
@ -118,7 +93,6 @@
|
|||
tq.IMAGE_URL,
|
||||
tq.SOHU_IMG,
|
||||
tq.BEST_ANSWER,
|
||||
tq.SKILL_INFO,
|
||||
tq.CHAPTER,
|
||||
tq.SUBJECT,
|
||||
tq.OPTIONS,
|
||||
|
@ -145,154 +119,37 @@
|
|||
<if test="queryDto.type !=null">
|
||||
and tq.TYPE = #{queryDto.type}
|
||||
</if>
|
||||
<if test="queryDto.chapter !=null and queryDto.chapter !=''">
|
||||
and tq.CHAPTER = #{queryDto.chapter}
|
||||
</if>
|
||||
</where>
|
||||
order by rand() limit ${queryDto.num};
|
||||
</select>
|
||||
|
||||
<update id="updateQuestion" parameterType="com.jwl.driver.server.vo.QuestionVo">
|
||||
update td_question
|
||||
<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="qusetionVo.isError !=null">
|
||||
IS_ERROR = #{qusetionVo.isError},
|
||||
</if>
|
||||
<if test="questionVo.skillInfo !=null and questionVo.skillInfo !=''">
|
||||
SKILL_INFO = #{questionVo.skillInfo},
|
||||
<if test="qusetionVo.isNew !=null">
|
||||
IS_NEW = #{qusetionVo.isNew},
|
||||
</if>
|
||||
<if test="questionVo.isError !=null">
|
||||
IS_ERROR = #{questionVo.isError},
|
||||
<if test="qusetionVo.examKeys !=null">
|
||||
EXAM_KEYS = #{qusetionVo.examKeys},
|
||||
</if>
|
||||
<if test="questionVo.isNew !=null">
|
||||
IS_NEW = #{questionVo.isNew},
|
||||
<if test="qusetionVo.isVip2 !=null">
|
||||
IS_VIP2 = #{qusetionVo.isVip2},
|
||||
</if>
|
||||
<if test="questionVo.examKeys !=null">
|
||||
EXAM_KEYS = #{questionVo.examKeys},
|
||||
<if test="qusetionVo.isExam1 !=null">
|
||||
IS_EXAM1 = #{qusetionVo.isExam1},
|
||||
</if>
|
||||
<if test="questionVo.isVip2 !=null">
|
||||
IS_VIP2 = #{questionVo.isVip2},
|
||||
</if>
|
||||
<if test="questionVo.isExam1 !=null">
|
||||
IS_EXAM1 = #{questionVo.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>
|
||||
|
||||
<select id="querySpecialNum" resultType="java.util.Map">
|
||||
select count(IF(IS_NEW = '1', IS_NEW, NULL)) as newQuestionNum,
|
||||
count(IF(IS_ERROR = '1', IS_ERROR, NULL)) as errorQuestionNum,
|
||||
count(IF(TYPE = '1', TYPE, NULL)) as judgeQuestionNum,
|
||||
count(IF(TYPE = '2', TYPE, NULL)) as radioQuestionNum,
|
||||
count(IF(TYPE = '3', TYPE, NULL)) as multipleChoiceQuestionNum,
|
||||
count(IFNULL(IMAGE_URL, NULL)) as imageQuestionNum
|
||||
from td_question
|
||||
where CAR_TYPE_ID = #{queryDto.carTypeId}
|
||||
and SUBJECT = #{queryDto.subject}
|
||||
and IS_ACTIVE = '0'
|
||||
</select>
|
||||
|
||||
<select id="queryQuestionId" resultType="java.lang.Long">
|
||||
select
|
||||
tq.QUESTION_ID
|
||||
from td_question tq
|
||||
left join td_point_question tpq on tq.QUESTION_ID = tpq.QUESTION_ID and tq.CAR_TYPE_ID = tpq.CAR_TYPE_ID and
|
||||
tpq.IS_ACTIVE = '0'
|
||||
<where>
|
||||
tq.IS_ACTIVE = '0'
|
||||
<if test="queryDto.questionId !=null">
|
||||
and tq.QUESTION_ID = #{queryDto.questionId}
|
||||
</if>
|
||||
<if test="queryDto.questionIdList !=null and queryDto.questionIdList.size() > 0">
|
||||
and tq.QUESTION_ID in
|
||||
<foreach collection="queryDto.questionIdList" open="(" item="item" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="queryDto.chapter !=null and queryDto.chapter !=''">
|
||||
and tq.CHAPTER = #{queryDto.chapter}
|
||||
</if>
|
||||
<if test="queryDto.question !=null and queryDto.question !=''">
|
||||
and tq.QUESTION like concat('%' , #{queryDto.question} , '%')
|
||||
</if>
|
||||
<if test="queryDto.subject !=null and queryDto.subject !=''">
|
||||
and tq.SUBJECT = #{queryDto.subject}
|
||||
</if>
|
||||
<if test="queryDto.carTypeId !=null">
|
||||
and tq.CAR_TYPE_ID = #{queryDto.carTypeId}
|
||||
</if>
|
||||
<if test="queryDto.type !=null and queryDto.type != ''">
|
||||
and tq.TYPE = #{queryDto.type}
|
||||
</if>
|
||||
<if test="queryDto.isError !=null">
|
||||
and tq.IS_ERROR = #{queryDto.isError}
|
||||
</if>
|
||||
<if test="queryDto.isNew !=null">
|
||||
and tq.IS_NEW = #{queryDto.isNew}
|
||||
</if>
|
||||
<if test="queryDto.isImage !=null">
|
||||
and tq.IMAGE_URL is not null
|
||||
</if>
|
||||
<if test="queryDto.examKey !=null and queryDto.examKey != ''">
|
||||
and find_in_set(#{queryDto.examKey},tq.EXAM_KEYS)
|
||||
</if>
|
||||
<if test="queryDto.isVip !=null">
|
||||
and tq.IS_VIP = #{queryDto.isVip}
|
||||
</if>
|
||||
<if test="queryDto.isVip2 !=null">
|
||||
and tq.IS_VIP2 = #{queryDto.isVip2}
|
||||
</if>
|
||||
<if test="queryDto.isExam1 !=null">
|
||||
and tq.IS_EXAM1 = #{queryDto.isExam1}
|
||||
</if>
|
||||
<if test="queryDto.isExam2 !=null">
|
||||
and tq.IS_EXAM2 = #{queryDto.isExam2}
|
||||
</if>
|
||||
<if test="queryDto.cid !=null and queryDto.cid !=''">
|
||||
and find_in_set(#{queryDto.cid},tq.CIDS)
|
||||
</if>
|
||||
<if test="queryDto.category !=null and queryDto.category !=''">
|
||||
and find_in_set(#{queryDto.category},tq.CATEGORY)
|
||||
</if>
|
||||
<if test="queryDto.point !=null and queryDto.point !=''">
|
||||
and tpq.POINT = #{queryDto.point}
|
||||
</if>
|
||||
</where>
|
||||
group by tq.QUESTION_ID
|
||||
order by tq.SHOW_ORDER asc
|
||||
</select>
|
||||
|
||||
<select id="queryQuestionIdByRandom" resultType="java.lang.Long">
|
||||
select
|
||||
tq.QUESTION_ID
|
||||
from td_question tq
|
||||
<where>
|
||||
tq.IS_ACTIVE = '0'
|
||||
<if test="queryDto.subject !=null and queryDto.subject !=''">
|
||||
and tq.SUBJECT = #{queryDto.subject}
|
||||
</if>
|
||||
<if test="queryDto.carTypeId !=null">
|
||||
and tq.CAR_TYPE_ID = #{queryDto.carTypeId}
|
||||
</if>
|
||||
<if test="queryDto.type !=null">
|
||||
and tq.TYPE = #{queryDto.type}
|
||||
</if>
|
||||
<if test="queryDto.chapter !=null and queryDto.chapter !=''">
|
||||
and tq.CHAPTER = #{queryDto.chapter}
|
||||
</if>
|
||||
</where>
|
||||
order by rand() limit ${queryDto.num};
|
||||
</select>
|
||||
|
||||
<select id="queryMaxSort" resultType="java.lang.Integer">
|
||||
select
|
||||
MAX(tq.SHOW_ORDER)
|
||||
from td_question tq
|
||||
where tq.CAR_TYPE_ID = #{carTypeId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -2,33 +2,4 @@
|
|||
<!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.TdSysUserMemberMapper">
|
||||
|
||||
|
||||
<select id="queryUserMemberList" resultType="com.jwl.driver.server.vo.UserMemberVo">
|
||||
select
|
||||
tm.MEMBER_ID,
|
||||
tm.MEMBER_NAME,
|
||||
tm.CAR_TYPE_ID,
|
||||
tm.PRICE,
|
||||
tm.SUBJECTS,
|
||||
su.USER_ID,
|
||||
su.PHONE,
|
||||
c.CAR_NAME,
|
||||
um.START_DATE,
|
||||
um.END_DATE
|
||||
from
|
||||
td_sys_user_member um
|
||||
left join td_member tm on um.MEMBER_ID = tm.MEMBER_ID
|
||||
left join td_sys_user su on su.USER_ID = um.USER_ID
|
||||
left join td_car c on c.CAR_TYPE_ID = TM.CAR_TYPE_ID
|
||||
<where>
|
||||
<if test="userMemberDto.phone !=null">
|
||||
and su.PHONE like concat("%" + #{userMemberDto.phone} + "%")
|
||||
</if>
|
||||
<if test="userMemberDto.memberId !=null">
|
||||
and tm.MEMBER_ID = #{userMemberDto.memberId}
|
||||
</if>
|
||||
</where>
|
||||
order by um.CREATE_TIME
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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.TdProjectMapper">
|
||||
<mapper namespace="com.jwl.driver.server.mapper.TdTestProjectMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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.TdQuestionVersionMapper">
|
||||
<mapper namespace="com.jwl.driver.server.mapper.TdTestProjectVideosMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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.TdVideosMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,74 +0,0 @@
|
|||
package com.jwl.driver.server;
|
||||
|
||||
import com.jwl.driver.server.config.WechatPayConfig;
|
||||
import com.jwl.driver.server.entity.OrderPayInfo;
|
||||
import com.jwl.driver.server.service.IOrderPayInfoService;
|
||||
import com.jwl.driver.server.service.ITdSysUserMemberService;
|
||||
import com.jwl.driver.server.util.InputStreamUtil;
|
||||
import com.wechat.pay.java.core.Config;
|
||||
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
||||
import com.wechat.pay.java.core.util.IOUtil;
|
||||
import com.wechat.pay.java.core.util.PemUtil;
|
||||
import com.wechat.pay.java.service.payments.h5.H5Service;
|
||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.data.repository.init.ResourceReader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 微信支付
|
||||
* @create 2023/8/21 10:36
|
||||
*/
|
||||
@SpringBootTest
|
||||
@Profile("dev")
|
||||
public class WechatPayTest {
|
||||
|
||||
@Autowired
|
||||
private WechatPayConfig wechatPayConfig;
|
||||
|
||||
@Autowired
|
||||
private ITdSysUserMemberService userMemberService;
|
||||
|
||||
@Autowired
|
||||
private IOrderPayInfoService payInfoService;
|
||||
|
||||
@Test
|
||||
void createService() throws IOException {
|
||||
Config config =
|
||||
new RSAAutoCertificateConfig.Builder()
|
||||
.merchantId(wechatPayConfig.getMchId())
|
||||
.privateKey(PemUtil.loadPrivateKeyFromString(InputStreamUtil.getContentStr("wechatPay/apiclient_key.pem")))
|
||||
// .privateKeyFromPath(wechatPayConfig.getPrivateKeyPath())
|
||||
.merchantSerialNumber(wechatPayConfig.getMchSerialNo())
|
||||
.apiV3Key(wechatPayConfig.getApiV3Key())
|
||||
.build();
|
||||
H5Service service = new H5Service.Builder().config(config).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
void purchaseMember(){
|
||||
String trade_state = "SUCCESS";
|
||||
String outTradeNo = "1694594904308846592";
|
||||
OrderPayInfo payInfo = payInfoService.getById(Long.parseLong(outTradeNo));
|
||||
if(trade_state.equals("SUCCESS")) {
|
||||
//各种业务逻辑
|
||||
//1.订单详情表里修改数据
|
||||
payInfoService.payNotice(payInfo,Boolean.FALSE);
|
||||
//2.冲会员
|
||||
userMemberService.purchaseMember(payInfo);
|
||||
|
||||
}else{
|
||||
//还是各种业务逻辑
|
||||
//1.订单详情表里修改数据
|
||||
payInfoService.payNotice(payInfo,Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue