会员查询与考试成绩提交
parent
e3fbbe7922
commit
c209aa3da3
|
@ -0,0 +1,21 @@
|
||||||
|
package com.jwl.driver.server.autoconfigure;
|
||||||
|
|
||||||
|
import com.jwl.driver.server.util.SpringAsyncUtil;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* spring工具类
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class SecurityAutoConfiguration {
|
||||||
|
|
||||||
|
@Bean(name = {"SpringAsyncUtilBySecurityConfigurationProperties"})
|
||||||
|
@ConditionalOnMissingBean({SpringAsyncUtil.class})
|
||||||
|
public SpringAsyncUtil springAsyncUtil() {
|
||||||
|
return new SpringAsyncUtil();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,9 +1,21 @@
|
||||||
package com.jwl.driver.server.controller;
|
package com.jwl.driver.server.controller;
|
||||||
|
|
||||||
|
|
||||||
|
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 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.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -13,8 +25,27 @@ import org.springframework.stereotype.Controller;
|
||||||
* @author Automated procedures
|
* @author Automated procedures
|
||||||
* @since 2023-08-10
|
* @since 2023-08-10
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Api(tags = "会员")
|
||||||
@RequestMapping("//tdMember")
|
@RestController
|
||||||
|
@RequestMapping("/tdMember")
|
||||||
|
@Slf4j
|
||||||
public class TdMemberController {
|
public class TdMemberController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ITdMemberService memberService;
|
||||||
|
|
||||||
|
@ApiOperation("查询会员列表")
|
||||||
|
@PostMapping("/queryMember")
|
||||||
|
public BaseResponse queryMember(@RequestBody MemberQueryDto queryDto) {
|
||||||
|
log.info("获取会员列表======>queryDto:{}", queryDto);
|
||||||
|
return BaseResponse.success(memberService.queryMember(queryDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("查询用户开通的会员")
|
||||||
|
@PostMapping("/queryUserMember")
|
||||||
|
public BaseResponse queryUserMember(@RequestBody MemberQueryDto queryDto) {
|
||||||
|
log.info("获取用户会员列表======>queryDto:{}", queryDto);
|
||||||
|
return BaseResponse.success(memberService.queryUserMember(queryDto));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class TdQuestionController {
|
||||||
|
|
||||||
@ApiOperation("根据id获取题目")
|
@ApiOperation("根据id获取题目")
|
||||||
@PostMapping("/queryQuestionById")
|
@PostMapping("/queryQuestionById")
|
||||||
public BaseResponse queryQuestionById(@RequestParam QuestionQueryDto queryDto) {
|
public BaseResponse queryQuestionById(@RequestBody QuestionQueryDto queryDto) {
|
||||||
log.info("获取题型======>queryDto:{}", queryDto);
|
log.info("获取题型======>queryDto:{}", queryDto);
|
||||||
return BaseResponse.success(tdQuestionService.queryQuestionById(queryDto));
|
return BaseResponse.success(tdQuestionService.queryQuestionById(queryDto));
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class TdQuestionController {
|
||||||
|
|
||||||
@ApiOperation("根据id列表获取题目")
|
@ApiOperation("根据id列表获取题目")
|
||||||
@PostMapping("/queryQuestionByIdList")
|
@PostMapping("/queryQuestionByIdList")
|
||||||
public BaseResponse queryQuestionByIdList(@RequestParam QuestionQueryDto queryDto) {
|
public BaseResponse queryQuestionByIdList(@RequestBody QuestionQueryDto queryDto) {
|
||||||
log.info("获取题型======>queryDto:{}", queryDto);
|
log.info("获取题型======>queryDto:{}", queryDto);
|
||||||
return BaseResponse.success(tdQuestionService.queryQuestionByIdList(queryDto));
|
return BaseResponse.success(tdQuestionService.queryQuestionByIdList(queryDto));
|
||||||
}
|
}
|
||||||
|
@ -50,14 +50,14 @@ public class TdQuestionController {
|
||||||
|
|
||||||
@ApiOperation("根据查询条件获取题目")
|
@ApiOperation("根据查询条件获取题目")
|
||||||
@PostMapping("/queryQuestion")
|
@PostMapping("/queryQuestion")
|
||||||
public BaseResponse queryQuestion(@RequestParam QuestionQueryDto queryDto) {
|
public BaseResponse queryQuestion(@RequestBody QuestionQueryDto queryDto) {
|
||||||
log.info("获取题型======>queryDto:{}", queryDto);
|
log.info("获取题型======>queryDto:{}", queryDto);
|
||||||
return BaseResponse.success(tdQuestionService.queryQuestion(queryDto));
|
return BaseResponse.success(tdQuestionService.queryQuestion(queryDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取模拟考试题目")
|
@ApiOperation("获取模拟考试题目")
|
||||||
@PostMapping("/getTestQuestion")
|
@PostMapping("/getTestQuestion")
|
||||||
public BaseResponse getTestQuestion(@RequestParam QuestionQueryDto queryDto) {
|
public BaseResponse getTestQuestion(@RequestBody QuestionQueryDto queryDto) {
|
||||||
log.info("获取模拟考试题目======>queryDto:{}", queryDto);
|
log.info("获取模拟考试题目======>queryDto:{}", queryDto);
|
||||||
if (Objects.isNull(queryDto.getCarTypeId()) && Objects.isNull(queryDto.getSubject())){
|
if (Objects.isNull(queryDto.getCarTypeId()) && Objects.isNull(queryDto.getSubject())){
|
||||||
throw new BusinessException("缺少必要参数");
|
throw new BusinessException("缺少必要参数");
|
||||||
|
|
|
@ -1,10 +1,21 @@
|
||||||
package com.jwl.driver.server.controller;
|
package com.jwl.driver.server.controller;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||||
|
import com.jwl.driver.server.dto.TestSubmitDto;
|
||||||
|
import com.jwl.driver.server.response.BaseResponse;
|
||||||
|
import com.jwl.driver.server.service.ITdQuestionService;
|
||||||
|
import com.jwl.driver.server.service.ITdQuestionTestService;
|
||||||
|
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 org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 模拟考试成绩表; 前端控制器
|
* 模拟考试成绩表; 前端控制器
|
||||||
|
@ -13,8 +24,23 @@ import org.springframework.stereotype.Controller;
|
||||||
* @author Automated procedures
|
* @author Automated procedures
|
||||||
* @since 2023-08-10
|
* @since 2023-08-10
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Api(tags = "考试")
|
||||||
@RequestMapping("//tdQuestionTest")
|
@RestController
|
||||||
|
@RequestMapping("/tdQuestionTest")
|
||||||
|
@Slf4j
|
||||||
public class TdQuestionTestController {
|
public class TdQuestionTestController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ITdQuestionTestService testService;
|
||||||
|
|
||||||
|
@ApiOperation("提交考试成绩")
|
||||||
|
@PostMapping("/testSubmit")
|
||||||
|
public BaseResponse testSubmit(@RequestBody @Valid TestSubmitDto submitDto) {
|
||||||
|
log.info("考试成绩======>submitDto:{}", submitDto);
|
||||||
|
return BaseResponse.success(testService.testSubmit(submitDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class TdSysConfigListController {
|
||||||
*/
|
*/
|
||||||
@ApiOperation("通过多个配置key 和 carTypeId 查询多个配置列表")
|
@ApiOperation("通过多个配置key 和 carTypeId 查询多个配置列表")
|
||||||
@GetMapping("/querySysConfigMap")
|
@GetMapping("/querySysConfigMap")
|
||||||
public BaseResponse querySysConfigMap(@RequestParam("configKey") String configKeys, @RequestParam("carTypeId") Integer carTypeId) {
|
public BaseResponse querySysConfigMap(@RequestParam("configKeys") String configKeys, @RequestParam("carTypeId") Integer carTypeId) {
|
||||||
log.info("request to querySysConfigList :{}", configKeys);
|
log.info("request to querySysConfigList :{}", configKeys);
|
||||||
Map<String, Map<String, String>> map = configListService.querySysConfigMap(Arrays.asList(configKeys.split(",")), carTypeId);
|
Map<String, Map<String, String>> map = configListService.querySysConfigMap(Arrays.asList(configKeys.split(",")), carTypeId);
|
||||||
return BaseResponse.success(map);
|
return BaseResponse.success(map);
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
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;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 会员查询入参;
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Automated procedures
|
||||||
|
* @since 2023-08-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel("会员查询入参")
|
||||||
|
public class MemberQueryDto implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("会员标识")
|
||||||
|
private Integer memberId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("车型标识")
|
||||||
|
private Integer carTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科目标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("科目标识")
|
||||||
|
private String subject;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.jwl.driver.server.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
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;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 曹林
|
||||||
|
* @description 成绩提交入参
|
||||||
|
* @create 2023/8/14 21:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel("成绩提交入参")
|
||||||
|
public class TestSubmitDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("车型标识")
|
||||||
|
@NotNull(message = "车型标识不能为空")
|
||||||
|
private Integer carTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试得分
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("考试得分")
|
||||||
|
@NotNull(message = "考试得分不能为空")
|
||||||
|
@Max(100)
|
||||||
|
@Min(0)
|
||||||
|
private Integer score;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试时长,单位为秒
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("考试时长,单位为秒")
|
||||||
|
@NotNull(message = "k考试时间不能为空")
|
||||||
|
@Max(3600)
|
||||||
|
@Min(0)
|
||||||
|
private Integer testTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -43,6 +43,12 @@ public class TdMember implements Serializable {
|
||||||
@TableField("CAR_TYPE_ID")
|
@TableField("CAR_TYPE_ID")
|
||||||
private Integer carTypeId;
|
private Integer carTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科目
|
||||||
|
*/
|
||||||
|
@TableField("SUBJECTS")
|
||||||
|
private String subjects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员价格,单位元
|
* 会员价格,单位元
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package com.jwl.driver.server.mapper;
|
package com.jwl.driver.server.mapper;
|
||||||
|
|
||||||
|
import com.jwl.driver.server.dto.MemberQueryDto;
|
||||||
import com.jwl.driver.server.entity.TdMember;
|
import com.jwl.driver.server.entity.TdMember;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.jwl.driver.server.vo.MemberVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -13,4 +18,18 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
*/
|
*/
|
||||||
public interface TdMemberMapper extends BaseMapper<TdMember> {
|
public interface TdMemberMapper extends BaseMapper<TdMember> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取会员列表
|
||||||
|
* @param queryDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<MemberVo> queryMember(@Param("queryDto") MemberQueryDto queryDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户会员
|
||||||
|
* @param queryDto
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<MemberVo> queryUserMember(@Param("queryDto") MemberQueryDto queryDto, @Param("userId") Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.springframework.stereotype.Component;
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RedisCache {
|
public class RedisCache {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public RedisTemplate redisTemplate;
|
public RedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package com.jwl.driver.server.service;
|
package com.jwl.driver.server.service;
|
||||||
|
|
||||||
|
import com.jwl.driver.server.dto.MemberQueryDto;
|
||||||
import com.jwl.driver.server.entity.TdMember;
|
import com.jwl.driver.server.entity.TdMember;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.jwl.driver.server.vo.MemberVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -13,4 +17,17 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
*/
|
*/
|
||||||
public interface ITdMemberService extends IService<TdMember> {
|
public interface ITdMemberService extends IService<TdMember> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询会员列表
|
||||||
|
* @param queryDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<MemberVo> queryMember(MemberQueryDto queryDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户开通的会员
|
||||||
|
* @param queryDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<MemberVo> queryUserMember(MemberQueryDto queryDto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.jwl.driver.server.service;
|
package com.jwl.driver.server.service;
|
||||||
|
|
||||||
|
import com.jwl.driver.server.dto.TestSubmitDto;
|
||||||
import com.jwl.driver.server.entity.TdQuestionTest;
|
import com.jwl.driver.server.entity.TdQuestionTest;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
@ -13,4 +14,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
*/
|
*/
|
||||||
public interface ITdQuestionTestService extends IService<TdQuestionTest> {
|
public interface ITdQuestionTestService extends IService<TdQuestionTest> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交卷 考试提交
|
||||||
|
* @param submitDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean testSubmit(TestSubmitDto submitDto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
package com.jwl.driver.server.service.impl;
|
package com.jwl.driver.server.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.jwl.driver.server.constant.Constants;
|
||||||
|
import com.jwl.driver.server.dto.MemberQueryDto;
|
||||||
import com.jwl.driver.server.entity.TdMember;
|
import com.jwl.driver.server.entity.TdMember;
|
||||||
import com.jwl.driver.server.mapper.TdMemberMapper;
|
import com.jwl.driver.server.mapper.TdMemberMapper;
|
||||||
import com.jwl.driver.server.service.ITdMemberService;
|
import com.jwl.driver.server.service.ITdMemberService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.jwl.driver.server.util.SecurityUtil;
|
||||||
|
import com.jwl.driver.server.vo.MemberVo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 会员类型表; 服务实现类
|
* 会员类型表; 服务实现类
|
||||||
|
@ -17,4 +26,39 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class TdMemberServiceImpl extends ServiceImpl<TdMemberMapper, TdMember> implements ITdMemberService {
|
public class TdMemberServiceImpl extends ServiceImpl<TdMemberMapper, TdMember> implements ITdMemberService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MemberVo> queryMember(MemberQueryDto queryDto) {
|
||||||
|
|
||||||
|
List<MemberVo> resultList = new ArrayList<>();
|
||||||
|
|
||||||
|
//获取用户已开通且未到期的会员(即使该会员已不售卖了)
|
||||||
|
List<MemberVo> userMemberList = queryUserMember(queryDto);
|
||||||
|
Map<Integer, MemberVo> userMemberMap = userMemberList.stream().collect(Collectors.toMap(MemberVo::getMemberId, v -> v, (v1, v2) -> v1));
|
||||||
|
|
||||||
|
//将用户购买的已停售但未过期的会员放在最前面
|
||||||
|
List<MemberVo> expireMemberlist = userMemberList.stream().filter(s -> StrUtil.equals(s.getIsActive(), Constants.IS_ACTIVE_FALSE)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtil.isNotEmpty(expireMemberlist)){
|
||||||
|
resultList.addAll(expireMemberlist);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取现在可开通的会员
|
||||||
|
List<MemberVo> memberList = this.getBaseMapper().queryMember(queryDto);
|
||||||
|
if (CollectionUtil.isNotEmpty(memberList)){
|
||||||
|
for (MemberVo memberVo : memberList) {
|
||||||
|
if(userMemberMap.containsKey(memberVo.getMemberId())){
|
||||||
|
resultList.add(userMemberMap.get(memberVo.getMemberId()));
|
||||||
|
}else {
|
||||||
|
resultList.add(memberVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MemberVo> queryUserMember(MemberQueryDto queryDto) {
|
||||||
|
return this.getBaseMapper().queryUserMember(queryDto,SecurityUtil.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
package com.jwl.driver.server.service.impl;
|
package com.jwl.driver.server.service.impl;
|
||||||
|
|
||||||
|
import com.jwl.driver.server.dto.SecurityUser;
|
||||||
|
import com.jwl.driver.server.dto.TestSubmitDto;
|
||||||
import com.jwl.driver.server.entity.TdQuestionTest;
|
import com.jwl.driver.server.entity.TdQuestionTest;
|
||||||
import com.jwl.driver.server.mapper.TdQuestionTestMapper;
|
import com.jwl.driver.server.mapper.TdQuestionTestMapper;
|
||||||
import com.jwl.driver.server.service.ITdQuestionTestService;
|
import com.jwl.driver.server.service.ITdQuestionTestService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.jwl.driver.server.util.SecurityUtil;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -17,4 +24,15 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class TdQuestionTestServiceImpl extends ServiceImpl<TdQuestionTestMapper, TdQuestionTest> implements ITdQuestionTestService {
|
public class TdQuestionTestServiceImpl extends ServiceImpl<TdQuestionTestMapper, TdQuestionTest> implements ITdQuestionTestService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean testSubmit(TestSubmitDto submitDto) {
|
||||||
|
|
||||||
|
TdQuestionTest questionTest = new TdQuestionTest();
|
||||||
|
BeanUtils.copyProperties(submitDto,questionTest);
|
||||||
|
questionTest.setUserId(SecurityUtil.getUserId())
|
||||||
|
.setCreateTime(LocalDateTime.now());
|
||||||
|
|
||||||
|
return this.save(questionTest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,10 @@ public class SecurityUtil {
|
||||||
String token = TokenThreadUtil.getToken();
|
String token = TokenThreadUtil.getToken();
|
||||||
if (StrUtil.isBlank(token))
|
if (StrUtil.isBlank(token))
|
||||||
throw new BusinessException(ErrorCode.AUTH_ERROR, "尚未登录");
|
throw new BusinessException(ErrorCode.AUTH_ERROR, "尚未登录");
|
||||||
SecurityUser securityUser = null;
|
SecurityUser securityUser = new SecurityUser();
|
||||||
TdSysUser tdSysUser = redisCache.getCacheObject(token);
|
TdSysUser tdSysUser = redisCache.getCacheObject(token);
|
||||||
|
|
||||||
if (Objects.isNull(securityUser)){
|
if (Objects.isNull(tdSysUser)){
|
||||||
throw new BusinessException(ErrorCode.AUTH_ERROR, "登录信息已失效");
|
throw new BusinessException(ErrorCode.AUTH_ERROR, "登录信息已失效");
|
||||||
}
|
}
|
||||||
BeanUtils.copyProperties(tdSysUser,securityUser);
|
BeanUtils.copyProperties(tdSysUser,securityUser);
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.jwl.driver.server.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 曹林
|
||||||
|
* @description 会员列表出参
|
||||||
|
* @create 2023/8/13 17:13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel("会员列表出参")
|
||||||
|
public class MemberVo {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("用户标识")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员结束时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("会员结束时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime endDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("会员标识")
|
||||||
|
private Integer memberId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("会员名称")
|
||||||
|
private String memberName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("车型标识")
|
||||||
|
private Integer carTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科目
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("科目")
|
||||||
|
private String subjects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员价格,单位元
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("会员价格,单位元")
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员折扣,单位元
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("会员折扣,单位元")
|
||||||
|
private BigDecimal discount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("会员时间")
|
||||||
|
private Integer duration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时长单位,1:天,2:月 3:年
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("时长单位,1:天,2:月 3:年")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员描述
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("会员描述")
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否生效
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("是否生效")
|
||||||
|
private String isActive;
|
||||||
|
|
||||||
|
}
|
|
@ -2,13 +2,19 @@ package com.jwl.driver.server.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 曹林
|
* @author 曹林
|
||||||
* @description 驾考题目出参
|
* @description 驾考题目出参
|
||||||
* @create 2023/8/13 17:13
|
* @create 2023/8/13 17:13
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel("驾考题目出参")
|
||||||
public class QusetionVo {
|
public class QusetionVo {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -2,4 +2,63 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!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.TdMemberMapper">
|
<mapper namespace="com.jwl.driver.server.mapper.TdMemberMapper">
|
||||||
|
|
||||||
|
<select id="queryMember" resultType="com.jwl.driver.server.vo.MemberVo">
|
||||||
|
select
|
||||||
|
tm.MEMBER_ID,
|
||||||
|
tm.MEMBER_NAME,
|
||||||
|
tm.CAR_TYPE_ID,
|
||||||
|
tm.PRICE,
|
||||||
|
tm.DISCOUNT,
|
||||||
|
tm.DURATION,
|
||||||
|
tm.SUBJECTS,
|
||||||
|
tm.UNIT,
|
||||||
|
tm.DESC,
|
||||||
|
tm.IS_ACTIVE
|
||||||
|
from
|
||||||
|
td_member tm
|
||||||
|
<where>
|
||||||
|
tm.IS_ACTIVE = '0'
|
||||||
|
<if test="queryDto.memberId !=null">
|
||||||
|
and tm.MEMBER_ID = #{queryDto.memberId}
|
||||||
|
</if>
|
||||||
|
<if test="queryDto.carTypeId !=null">
|
||||||
|
and tm.CAR_TYPE_ID = #{queryDto.carTypeId}
|
||||||
|
</if>
|
||||||
|
<if test="queryDto.subject !=null and queryDto.subject !=''">
|
||||||
|
and find_in_set(#{queryDto.subject},tm.SUBJECTS)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by tm.SHOW_ORDER
|
||||||
|
</select>
|
||||||
|
<select id="queryUserMember" resultType="com.jwl.driver.server.vo.MemberVo">
|
||||||
|
select
|
||||||
|
tsum.USER_ID,
|
||||||
|
tsum.END_DATE,
|
||||||
|
tm.MEMBER_ID,
|
||||||
|
tm.MEMBER_NAME,
|
||||||
|
tm.CAR_TYPE_ID,
|
||||||
|
tm.PRICE,
|
||||||
|
tm.DISCOUNT,
|
||||||
|
tm.DURATION,
|
||||||
|
tm.SUBJECTS,
|
||||||
|
tm.UNIT,
|
||||||
|
tm.DESC,
|
||||||
|
tm.IS_ACTIVE
|
||||||
|
from
|
||||||
|
td_sys_user_member tsum
|
||||||
|
left join td_member tm on tsum.MEMBER_ID = tm.MEMBER_ID
|
||||||
|
<where>
|
||||||
|
tsum.USER_ID = #{userId} and sysdate() between tsum.START_DATE and tsum.END_DATE
|
||||||
|
<if test="queryDto.memberId !=null">
|
||||||
|
and tsum.MEMBER_ID = #{queryDto.memberId}
|
||||||
|
</if>
|
||||||
|
<if test="queryDto.carTypeId !=null">
|
||||||
|
and tm.CAR_TYPE_ID = #{queryDto.carTypeId}
|
||||||
|
</if>
|
||||||
|
<if test="queryDto.subject !=null and queryDto.subject !=''">
|
||||||
|
and find_in_set(#{queryDto.subject},tm.SUBJECTS)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by tm.SHOW_ORDER
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
tq.CAR_TYPE_ID,
|
tq.CAR_TYPE_ID,
|
||||||
tq.IS_ACTIVE
|
tq.IS_ACTIVE
|
||||||
from td_question tq
|
from td_question tq
|
||||||
left join td_question_point tqp on tq.QUESTION_ID = tqp.QUESTION_ID and tq.CAR_TYPE_ID = tqp.CAR_TYPE_ID and
|
left join td_point_question tpq on tq.QUESTION_ID = tpq.QUESTION_ID and tq.CAR_TYPE_ID = tpq.CAR_TYPE_ID and
|
||||||
tqp.IS_ACTIVE = '0'
|
tpq.IS_ACTIVE = '0'
|
||||||
<where>
|
<where>
|
||||||
tq.IS_ACTIVE = '0'
|
tq.IS_ACTIVE = '0'
|
||||||
<if test="queryDto.questionId !=null">
|
<if test="queryDto.questionId !=null">
|
||||||
|
@ -49,14 +49,14 @@
|
||||||
<if test="queryDto.carTypeId !=null">
|
<if test="queryDto.carTypeId !=null">
|
||||||
and tq.CAR_TYPE_ID = #{queryDto.carTypeId}
|
and tq.CAR_TYPE_ID = #{queryDto.carTypeId}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDto.type !=null">
|
<if test="queryDto.type !=null and queryDto.type != ''">
|
||||||
and tq.TYPE = #{queryDto.type}
|
and tq.TYPE = #{queryDto.type}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDto.cid !=null and queryDto.cid !=''">
|
<if test="queryDto.cid !=null and queryDto.cid !=''">
|
||||||
and find_in_set(#{queryDto.cid},tq.CIDS)
|
and find_in_set(#{queryDto.cid},tq.CIDS)
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDto.point !=null and queryDto.point !=''">
|
<if test="queryDto.point !=null and queryDto.point !=''">
|
||||||
and tqp.POINT = #{queryDto.point}
|
and tpq.POINT = #{queryDto.point}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
group by tq.QUESTION_ID
|
group by tq.QUESTION_ID
|
||||||
|
|
Loading…
Reference in New Issue