Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-zhouyin

This commit is contained in:
tiger_zhou 2022-10-10 08:52:08 +08:00
commit 5bb5c07031
25 changed files with 618 additions and 397 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 80029
File Encoding : 65001
Date: 08/10/2022 15:18:04
Date: 09/10/2022 14:50:58
*/
SET NAMES utf8mb4;
@ -25,7 +25,7 @@ CREATE TABLE `paper_composition` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '试卷蓝图id',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '试卷蓝图名称',
`profile` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '试卷蓝图简介',
`company_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '组织id',
`org_id` bigint NULL DEFAULT NULL COMMENT '组织id',
`start_time` datetime NULL DEFAULT NULL COMMENT '启用起始时间',
`end_time` datetime NULL DEFAULT NULL COMMENT '启用截止时间',
`valid_duration` int NULL DEFAULT NULL COMMENT '完成考试有效最长时长单位min',

View File

@ -11,7 +11,7 @@
Target Server Version : 80029
File Encoding : 65001
Date: 08/10/2022 15:18:14
Date: 09/10/2022 14:51:19
*/
SET NAMES utf8mb4;
@ -27,7 +27,7 @@ CREATE TABLE `paper_rule` (
`type` int NULL DEFAULT NULL COMMENT '试题类型1-理论题2-实训题',
`subType` int NULL DEFAULT NULL COMMENT '规则类型:理论题(1-单选题2-多选题3-判断题);实训题(4-单操实训5-场景实训)',
`tags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '筛选题目的标签,即根据标签来筛选题目;List<String>的json',
`sum` int NULL DEFAULT NULL COMMENT '该类型题目数量',
`amount` int NULL DEFAULT NULL COMMENT '该类型题目数量',
`score` int NULL DEFAULT NULL COMMENT '每题分值',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

View File

@ -11,7 +11,7 @@
Target Server Version : 80029
File Encoding : 65001
Date: 08/10/2022 15:18:36
Date: 09/10/2022 14:51:35
*/
SET NAMES utf8mb4;
@ -25,13 +25,13 @@ CREATE TABLE `paper_user` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户试卷id',
`user_id` bigint NOT NULL COMMENT '用户id',
`pc_id` bigint NOT NULL COMMENT '生成用户试卷的paper_compostion的id',
`company_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '组织id',
`org_id` bigint NULL DEFAULT NULL COMMENT '组织id',
`score` int NULL DEFAULT NULL COMMENT '用户最终得分',
`start_time` datetime NULL DEFAULT NULL COMMENT '用户开始做题时间',
`end_time` datetime NULL DEFAULT NULL COMMENT '用户结束做题时间',
`cause` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '原因',
`create_time` datetime NULL DEFAULT NULL COMMENT '用户试卷生成时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -11,7 +11,7 @@
Target Server Version : 80029
File Encoding : 65001
Date: 08/10/2022 15:18:25
Date: 09/10/2022 14:51:52
*/
SET NAMES utf8mb4;
@ -24,11 +24,11 @@ DROP TABLE IF EXISTS `paper_user_question`;
CREATE TABLE `paper_user_question` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户试卷试题结果id',
`pu_id` bigint NOT NULL COMMENT '用户试卷paper_user的id',
`company_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '组织id',
`org_id` bigint NULL DEFAULT NULL COMMENT '组织id',
`type` int NULL DEFAULT NULL COMMENT '试题类型1-理论题2-实训题',
`question_id` bigint NOT NULL COMMENT '试题id',
`state` int NULL DEFAULT NULL COMMENT '试题状态1-未做(初始)2-答对3-答错4-时间到结束',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 31 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 151 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -10,15 +10,8 @@ import org.springframework.stereotype.Component;
@Getter
@Setter
public class WeChatConfig {
private String domainUri;
private String appId;
private String appSecret;
private String wxApiUrl;
private String wmBaseUrl;
private String spAppId;
@ -33,18 +26,6 @@ public class WeChatConfig {
private String spApp3Secret;
/** 微信模块基础url */
private String wxModuleUrl;
/**
* 微信小程序配置
*/
private WeChatMiniProgramConfig mini;
public String getWxApiUrl(String redirect, String state) {
return String.format(wxApiUrl, redirect, state);
}
public String getWmLoginUrl(String state) {
return String.format(wmBaseUrl, "login", state);
}
@ -57,41 +38,10 @@ public class WeChatConfig {
return String.format(wmBaseUrl, "distribute", state);
}
public String getWmJointRoomUrl(String state) {
return String.format(wmBaseUrl, "joint", state);
}
public String getWmSimulationUrl(String state) {
return String.format(wmBaseUrl, "simulation", state);
}
/**
* 获取页面access_token的url
* @return
*/
public String getPageAccessTokenUrl(String code) {
return new StringBuilder(this.domainUri)
.append("/sns/oauth2/access_token?appid=").append(this.appId)
.append("&secret=").append(this.appSecret)
.append("&code=").append(code)
.append("&grant_type=authorization_code").toString();
}
public String getJsAccessTokenUrl(String jsCode) {
return new StringBuilder(this.domainUri)
.append("/sns/oauth2/jscode2session?appid=").append(this.spAppId)
.append("&secret=").append(this.spAppSecret)
.append("&js_code=").append(jsCode)
.append("&grant_type=authorization_code").toString();
}
public String getUserInfoUrl(String access_token, String openid) {
return new StringBuilder(this.domainUri)
.append("/sns/userinfo?access_token=").append(access_token)
.append("&openid=").append(openid)
.append("&lang=zh_CN").toString();
}
public String getCode2SessionUrl(String wmCode) {
return new StringBuilder(this.domainUri)
.append("/sns/jscode2session?appid=").append(spAppId)
@ -116,23 +66,6 @@ public class WeChatConfig {
.append("&grant_type=authorization_code").toString();
}
public String getWxModuleBatchGetUserInfoUrl() {
return this.wxModuleUrl + "/api/user/batchget";
}
/**
* 获取微信服务模块打标签url
* @return
*/
public String getWxApiTagUrl() {
return this.wxModuleUrl+"/api/user/tagging";
}
public String getMsgSecCheckUrl() {
return this.wxModuleUrl + "/api/wm/msgSecCheck";
}
public String getOrgBindCode(String state) {
return String.format(wmBaseUrl, "company", state);
}

View File

@ -98,6 +98,11 @@ public class PaperApiTestController {
rt.setPcId(2L);
System.out.println(JsonUtils.writeValueAsString(rt));
}
public static void findPaperCompositionByAccountReqVo(){
FindPaperCompositionByAccountReqVo rt = new FindPaperCompositionByAccountReqVo();
rt.setAccount("18710717058");
System.out.println(JsonUtils.writeValueAsString(rt));
}
public static void main(String[]args){
createPaperCompositionReqVo();
paperCompositionBasicVo();
@ -107,5 +112,6 @@ public class PaperApiTestController {
paperRuleVo();
paperSubmitAnswerReqVo();
findPaperUserForCompositionReqVo();
findPaperCompositionByAccountReqVo();
}
}

View File

@ -76,14 +76,21 @@ public class PaperCompositionController {
}
/**
* 分页查找试卷蓝图
* 根据(组织id试卷蓝图名称简介)分页查找试卷蓝图
*/
@PostMapping("/find/page")
public PageVO<PaperCompositionVo> findPaperCompositionByPage(@RequestBody FindPaperCompositionPageReqVo req, @RequestAttribute AccountVO user) {
public PageVO<PaperCompositionVo> findPaperCompositionByPage(@RequestBody FindPaperCompositionPageReqVo req) {
return this.compositionService.findPaperCompositionByPage(req, user);
return this.compositionService.findPaperCompositionByPage(req);
}
/**
* 根据账户分页查找试卷蓝图
*/
@PostMapping("/find/page/by/account")
public PageVO<PaperCompositionVo> findAccountPaperCompositionByPage(@RequestBody FindPaperCompositionByAccountReqVo req) {
return this.compositionService.findPaperCompositionByPageForAccount(req);
}
/**
* 获取试卷完整的蓝图包括规则
*

View File

@ -102,6 +102,12 @@ public class PaperUserController {
public PageVO<PaperUserInfoVo>findPaperUserByPage(@RequestBody FindPaperUserForCompositionReqVo req, @RequestAttribute AccountVO user){
return this.paperUserFindPageService.findPaperUserByPage(req,user);
}
/**
* 教师查看某个班级的某个试卷蓝图的所有用户试卷
*/
@PostMapping("/user/page/class")
public PageVO<PaperUserInfoVo>findPaperUserByPageForClass(@RequestBody FindPaperUserForClassReqVo req, @RequestAttribute AccountVO user){
return this.paperUserFindPageService.findPaperUserByPageForClass(req);
}
}

View File

@ -2,6 +2,7 @@ package club.joylink.rtss.controller.project;
import club.joylink.rtss.constants.ProjectDeviceType;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.services.project.DeviceService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
@ -27,20 +28,17 @@ public class DeviceController {
* 分页查询项目设备
*/
@GetMapping("/paging")
public PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
LoginUserInfoVO userLoginInfo) {
return this.deviceService.pagingQuery(queryVO, userLoginInfo);
public PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO) {
return this.deviceService.pagingQuery(queryVO);
}
/**
* 项目设备编号是否已经存在
*/
@GetMapping("/exist/{code}")
public boolean isDeviceCodeExist(@PathVariable String code,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
LoginUserInfoVO userLoginInfo) {
return this.deviceService.isDeviceCodeExist(userLoginInfo.getProject(), code);
public boolean isDeviceCodeExist(@PathVariable String code, String projectCode) {
String project = Project.isDefault(projectCode) ? Project.DEFAULT_PROJECT_CODE : projectCode;
return this.deviceService.isDeviceCodeExist(project, code);
}
/**

View File

@ -24,7 +24,9 @@ public enum PaperExceptionAssert implements BusinessExceptionAssert {
PuNotSubmit(60016,"用户未交卷"),
PqExisted(60017,"试卷试题存在"),
PuqHaveTime(60018,"用户答题截止时间未到"),
PuqCanSubmit(60019,"用户可以提交试题答案")
PuqCanSubmit(60019,"用户可以提交试题答案"),
PpValid(60020,"请求参数有效"),
PdValid(60021,"数据有效"),
;
int code;

View File

@ -1,7 +1,10 @@
package club.joylink.rtss.services.paper;
import club.joylink.rtss.dao.SysAccountDAO;
import club.joylink.rtss.dao.paper.PaperCompositionDAO;
import club.joylink.rtss.dao.paper.PaperRuleDAO;
import club.joylink.rtss.entity.SysAccount;
import club.joylink.rtss.entity.SysAccountExample;
import club.joylink.rtss.entity.paper.PaperComposition;
import club.joylink.rtss.entity.paper.PaperCompositionExample;
import club.joylink.rtss.entity.paper.PaperRule;
@ -30,6 +33,8 @@ public class PaperCompositionService {
private PaperCompositionDAO compositionDAO;
@Autowired
private PaperRuleDAO ruleDAO;
@Autowired
private SysAccountDAO sysAccountDAO;
/**
* 创建试卷蓝图
@ -181,13 +186,96 @@ public class PaperCompositionService {
PaperExceptionAssert.PcCanModify.assertTrue(null != curPc && PaperCompositionState.Editing.equals(PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或状态非编辑中不能修改pcId = " + curPc.getId());
}
@Transactional(readOnly = true)
public PageVO<PaperCompositionVo> findPaperCompositionByPageForAccount(FindPaperCompositionByAccountReqVo req) {
PaperExceptionAssert.PpValid.assertTrue(null != req.getAccount() || null != req.getUserId(), "账号和用户id不能同时为空");
Long userId = req.getUserId();
if (null == userId) {
SysAccountExample accountExample = new SysAccountExample();
//
SysAccountExample.Criteria mobileC = accountExample.or();
mobileC.andMobileEqualTo(req.getAccount());
if (null != req.getPwd()) {
mobileC.andPasswordEqualTo(req.getPwd());
}
//
SysAccountExample.Criteria emailC = accountExample.or();
emailC.andEmailEqualTo(req.getAccount());
if (null != req.getPwd()) {
emailC.andPasswordEqualTo(req.getPwd());
}
//
SysAccountExample.Criteria accountC = accountExample.or();
accountC.andAccountEqualTo(req.getAccount());
if (null != req.getPwd()) {
accountC.andPasswordEqualTo(req.getPwd());
}
//
List<SysAccount> users = this.sysAccountDAO.selectByExample(accountExample);
PaperExceptionAssert.PdValid.assertTrue(null != users && users.size() == 1, "用户不存在或根据账户信息匹配了多个");
userId = users.get(0).getId();
}
//
PaperCompositionExample pcEx = new PaperCompositionExample();
PaperCompositionExample.Criteria pcExCriteria = pcEx.createCriteria();
pcExCriteria.andCreatorIdEqualTo(userId);
List<PaperCompositionState> findStates = req.stateList();
pcExCriteria.andStateIn(findStates.stream().map(pcState -> {
return pcState.getValue();
}).collect(Collectors.toList()));
//
PageVO<PaperCompositionVo> page = new PageVO<>();
//
long sum = compositionDAO.countByExample(pcEx);
page.setTotal(sum);
page.setPageNum(req.getPageNum());
page.setPageSize(req.getPageSize());
page.setList(new ArrayList<>());
if (sum > 0) {
//1--创建时间 2--更新时间 3--名称默认值为1
String orderBy = "create_time";
switch (req.getOrderBy()) {
case 1:
orderBy = "create_time";
break;
case 2:
orderBy = "update_time";
break;
case 3:
orderBy = "name";
break;
}
long startIndex = (req.getPageNum() - 1) * req.getPageSize();
//
if (req.getDesc()) {
pcEx.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
} else {
pcEx.setOrderByClause(String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
}
//
List<PaperComposition> content = compositionDAO.selectByExample(pcEx);
if (null != content) {
page.setList(new ArrayList<>(content.size()));
content.forEach(pc -> {
List<PaperRule> prList = this.findRuleByPcId(pc.getId());
page.getList().add(PaperCompositionConvertor.convert(pc, prList));
});
}
}
//
return page;
}
/**
* 分页查找试卷蓝图
*/
@Transactional(readOnly = true)
public PageVO<PaperCompositionVo> findPaperCompositionByPage(FindPaperCompositionPageReqVo req, AccountVO user) {
public PageVO<PaperCompositionVo> findPaperCompositionByPage(FindPaperCompositionPageReqVo req) {
PaperCompositionExample pcEx = new PaperCompositionExample();
PaperCompositionExample.Criteria pcExCriteria = pcEx.createCriteria();
if (null != req.getOrgId()) {
pcExCriteria.andOrgIdEqualTo(req.getOrgId());
}
if (null != req.getName()) {
if (req.getNameLike()) {
pcExCriteria.andNameLike(String.format("%%%s%%", req.getName()));

View File

@ -194,11 +194,11 @@ public class PaperUserCreateService {
//
PaperQuestionExample questionExample = new PaperQuestionExample();
if (null == tagArray) {
questionExample.createCriteria().andOrgIdEqualTo(Long.valueOf(pc.getOrgId())).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0);
questionExample.createCriteria().andOrgIdEqualTo(pc.getOrgId()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0);
} else {
for (String tag : tagArray) {
questionExample.or().andOrgIdEqualTo(Long.valueOf(pc.getOrgId())).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0).andTagsLike(String.format("%%%s%%", tag));
questionExample.or().andOrgIdEqualTo(pc.getOrgId()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0).andTagsLike(String.format("%%%s%%", tag));
}
}

View File

@ -1,18 +1,25 @@
package club.joylink.rtss.services.paper;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.OrgUserDAO;
import club.joylink.rtss.dao.paper.PaperCompositionDAO;
import club.joylink.rtss.dao.paper.PaperUserDAO;
import club.joylink.rtss.entity.OrgUser;
import club.joylink.rtss.entity.OrgUserExample;
import club.joylink.rtss.entity.paper.PaperComposition;
import club.joylink.rtss.entity.paper.PaperUser;
import club.joylink.rtss.entity.paper.PaperUserExample;
import club.joylink.rtss.exception.PaperExceptionAssert;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.paper.FindPaperUserForClassReqVo;
import club.joylink.rtss.vo.paper.FindPaperUserForCompositionReqVo;
import club.joylink.rtss.vo.paper.PaperUserInfoVo;
import club.joylink.rtss.vo.paper.convertor.PaperUserConvertor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
@ -26,10 +33,65 @@ public class PaperUserFindPageService {
private PaperCompositionDAO paperCompositionDAO;
@Autowired
private PaperUserDAO paperUserDAO;
@Autowired
private OrgUserDAO orgUserDAO;
/**
* 教师根据班级查询某个试卷蓝图的所有用户试卷基本信息
*/
@Transactional(readOnly = true)
public PageVO<PaperUserInfoVo> findPaperUserByPageForClass(FindPaperUserForClassReqVo req){
PageVO<PaperUserInfoVo> page = new PageVO<>();
PaperComposition pc = paperCompositionDAO.selectByPrimaryKey(req.getPcId());
PaperExceptionAssert.PcExisted.assertNotNull(pc,"试卷定义不存在");
//
PaperUserExample example = new PaperUserExample();
PaperUserExample.Criteria c = example.createCriteria();
c.andPcIdEqualTo(req.getPcId());
c.andUserIdIn(findAllClassStudents(req.getClassId()));
switch (req.getFindType()){
case Pass:c.andScoreIsNotNull().andScoreGreaterThanOrEqualTo(pc.getPassScore());break;
case NotPass:c.andScoreIsNotNull().andScoreLessThan(pc.getPassScore());break;
case NotComplete:c.andScoreIsNull();break;
case Complete:c.andScoreIsNotNull();break;
case All:break;
}
long sum = paperUserDAO.countByExample(example);
page.setTotal(sum);
page.setPageNum(req.getPageNum());
page.setPageSize(req.getPageSize());
page.setList(new ArrayList<>());
if (sum > 0) {
//
String orderBy = req.getOrderBy().with();
long startIndex = (req.getPageNum() - 1) * req.getPageSize();
//
if (req.getDesc()) {
example.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
} else {
example.setOrderByClause(String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
}
List<PaperUser> pContent = this.paperUserDAO.selectByExample(example);
if (null != pContent) {
pContent.forEach(t -> {
PaperUserInfoVo pi = new PaperUserInfoVo();
pi.setPcId(pc.getId());
pi.setName(pc.getName());
pi.setProfile(pc.getProfile());
pi.setOrgId(pc.getOrgId());
pi.setPaper(PaperUserConvertor.convert(t));
page.getList().add(pi);
});
}
}
return page;
}
/**
* 分页查询某个试卷蓝图的所有用户试卷基本信息
*/
@Transactional(readOnly = true)
public PageVO<PaperUserInfoVo> findPaperUserByPage(FindPaperUserForCompositionReqVo req, AccountVO user) {
PageVO<PaperUserInfoVo> page = new PageVO<>();
//
@ -75,4 +137,20 @@ public class PaperUserFindPageService {
//
return page;
}
/**
* 查询某个班级的所有学生的userId
*/
private List<Long> findAllClassStudents(Long classId){
OrgUserExample example = new OrgUserExample();
//根据班级id和身份角色来查
example.createCriteria().andOrgIdEqualTo(classId).andRoleEqualTo(BusinessConsts.OrgRole.Student.name());
List<OrgUser> sts = orgUserDAO.selectByExample(example);
List<Long> rt = new ArrayList<>(CollectionUtils.isEmpty(sts)?0:sts.size());
if(!CollectionUtils.isEmpty(sts)){
sts.forEach(st ->{
rt.add(st.getUserId());
});
}
return rt;
}
}

View File

@ -16,7 +16,7 @@ public interface DeviceService {
* @param userLoginInfo
* @return
*/
PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO, LoginUserInfoVO userLoginInfo);
PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO);
/**
* 项目设备编码是否存在

View File

@ -55,13 +55,13 @@ public class DeviceServiceImpl implements DeviceService {
@Autowired
private IMapService iMapService;
// 修改项目编码 20221009
@Override
public PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO,
LoginUserInfoVO userLoginInfo) {
public PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO) {
ProjectDeviceExample example = new ProjectDeviceExample();
ProjectDeviceExample.Criteria criteria = example.createCriteria();
if (!Objects.equals(userLoginInfo.getProject(), Project.DEFAULT_PROJECT_CODE)) {
criteria.andProjectCodeEqualTo(userLoginInfo.getProject());
if (StringUtils.hasText(queryVO.getProjectCode())) {
criteria.andProjectCodeEqualTo(queryVO.getProjectCode());
}
if (StringUtils.hasText(queryVO.getCode())) {
criteria.andCodeLike(String.format("%%%s%%", queryVO.getCode()));
@ -77,8 +77,6 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public boolean isDeviceCodeExist(String project, String code) {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotEquals(project, Project.DEFAULT_PROJECT_CODE,
String.format("项目[%s]没有权限", project));
ProjectDeviceExample example = new ProjectDeviceExample();
example.createCriteria().andProjectCodeEqualTo(project).andCodeEqualTo(code);
if (this.projectDeviceDAO.countByExample(example) > 0) {
@ -90,9 +88,6 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public String create(ProjectDeviceVO deviceVO, LoginUserInfoVO userLoginInfo) {
ProjectDevice projectDevice = deviceVO.buildDB();
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotEquals(userLoginInfo.getProject(),
Project.DEFAULT_PROJECT_CODE, String.format("项目[%s]无权添加设备", userLoginInfo.getProject()));
projectDevice.setProjectCode(userLoginInfo.getProject());
projectDevice.setCreator(userLoginInfo.getAccountVO().getId());
projectDevice.setCreateTime(LocalDateTime.now());
this.projectDeviceDAO.insert(projectDevice);

View File

@ -284,6 +284,7 @@ public class ProjectDeviceVO {
@JsonIgnore
public ProjectDevice buildDB() {
ProjectDevice device = new ProjectDevice();
device.setProjectCode(this.getProject());
device.setCode(this.getCode());
device.setType(this.getType().name());
return device;

View File

@ -0,0 +1,64 @@
package club.joylink.rtss.vo.paper;
import club.joylink.rtss.vo.client.PageQueryVO;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
/**
* 根据账号分页获取试卷蓝图
*/
@Getter
@Setter
@NoArgsConstructor
public class FindPaperCompositionByAccountReqVo extends PageQueryVO {
/**
* 用户id<br>
* account与userId不能同时为空优先使用userId二选一<br>
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long userId;
/**
* 用户账户(账号电话号码邮箱地址)<br>
* account与userId不能同时为空优先使用userId二选一<br>
*/
private String account;
/**
* 用户密码用于精确匹配查找<br>
* 选填<br>
*/
private String pwd;
/**
* 根据试卷蓝图的状态查找,默认值FindState.All<br>
* All(1)-所有,Editing(2)-正在编辑的,CanUse(3)-可以用于生成试卷的,Locked(4)-封存,Used(5)-已经被使用过<br>
* 选填<br>
*/
private FindPcType findState = FindPcType.All;
/**
* 以什么来排序
* <p>
* 1--创建时间 2--更新时间 3--名称默认值为1
* <p>
* 选填
*/
private Integer orderBy = 1;
/**
* 是否降序true-降序false-升序默认值为true;
* <p>
* 选填
*/
private Boolean desc = true;
/**
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)<br>
* 选填<br>
*/
public List<PaperCompositionState> stateList() {
return FindPcType.stateList(findState);
}
}

View File

@ -21,6 +21,12 @@ import java.util.Map;
@Setter
@NoArgsConstructor
public class FindPaperCompositionPageReqVo extends PageQueryVO {
/**
* 组织id<br>
* 选填<br>
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long orgId;
/**
* 试卷蓝图名称<br>
* 选填<br>
@ -42,11 +48,11 @@ public class FindPaperCompositionPageReqVo extends PageQueryVO {
*/
private Boolean profileLike = true;
/**
* 根据试卷蓝图的状态查找,默认值FindState.All<br>
* 根据试卷蓝图的状态查找,默认值FindPcType.All<br>
* All(1)-所有,Editing(2)-正在编辑的,CanUse(3)-可以用于生成试卷的,Locked(4)-封存,Used(5)-已经被使用过<br>
* 选填<br>
*/
private FindState findState = FindState.All;
private FindPcType findState = FindPcType.All;
/**
* 以什么来排序
* <p>
@ -62,87 +68,12 @@ public class FindPaperCompositionPageReqVo extends PageQueryVO {
* 选填
*/
private Boolean desc = true;
//////////////////////////////////////////////////////////////////////
/**
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)<br>
* 选填<br>
*/
public List<PaperCompositionState> stateList(){
List<PaperCompositionState> list = new ArrayList<>();
switch (findState) {
case All: {
list.add(PaperCompositionState.Editing);
list.add(PaperCompositionState.Locked);
list.add(PaperCompositionState.Used);
}
break;
case Used:
list.add(PaperCompositionState.Used);
break;
case CanUse: {
list.add(PaperCompositionState.Locked);
list.add(PaperCompositionState.Used);
}
case Locked:
list.add(PaperCompositionState.Locked);
break;
case Editing:
list.add(PaperCompositionState.Editing);
break;
}
return list;
}
;
public enum FindState {
/**
* 所有
*/
All(1),
/**
* 正在编辑的
*/
Editing(2),
/**
* 可以用于生成试卷的
*/
CanUse(3),
/**
* 封存
*/
Locked(4),
/**
* 已经被使用过
*/
Used(5),
;
private Integer state;
private FindState(Integer state) {
this.state = state;
}
@JsonCreator
public static FindState getItem(Integer state) {
return map.get(state);
}
@JsonValue
public Integer getValue() {
return this.state;
}
////////////////////////////////////////////////////////////////
private static Map<Integer, FindState> map = new HashMap<>();
static {
for (FindState t : values()) {
map.put(t.state, t);
}
}
return FindPcType.stateList(findState);
}
}

View File

@ -0,0 +1,51 @@
package club.joylink.rtss.vo.paper;
import club.joylink.rtss.vo.client.PageQueryVO;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;
/**
* 根据班级分页查询相关用户试卷
*/
@Getter
@Setter
@NoArgsConstructor
public class FindPaperUserForClassReqVo extends PageQueryVO {
/**
* 试卷蓝图id
*/
@JsonSerialize(using = ToStringSerializer.class)
@NotNull
private Long pcId;
/**
* 班级id即orgId
*/
@JsonSerialize(using = ToStringSerializer.class)
@NotNull
private Long classId;
/**
* 查询类型默认所有
*/
private FindPuType findType = FindPuType.All;
/**
* 以什么来排序,默认以用户试卷创建时间
*/
private FindPuOrderByType orderBy = FindPuOrderByType.CreateTime;
/**
* 是否降序true-降序false-升序默认值为true;
*/
private Boolean desc = true;
}

View File

@ -31,87 +31,15 @@ public class FindPaperUserForCompositionReqVo extends PageQueryVO {
/**
* 查询类型默认所有
*/
private FindType findType = FindType.All;
private FindPuType findType = FindPuType.All;
/**
* 以什么来排序,默认以用户试卷创建时间
*/
private OrderByType orderBy = OrderByType.CreateTime;
private FindPuOrderByType orderBy = FindPuOrderByType.CreateTime;
/**
* 是否降序true-降序false-升序默认值为true;
*/
private Boolean desc = true;
///////////////////////////////////////////////////////////////////
public enum OrderByType {
CreateTime(1, "create_time"),//用户试卷创建时间
StartTime(2, "start_time"),//用户开始答题时间
Score(3, "score"),//用户最终得分
;
private Integer value;
private String orderBy;
private OrderByType(Integer value, String type) {
this.value = value;
this.orderBy = type;
}
public String with() {
return this.orderBy;
}
@JsonCreator
public static OrderByType getItem(Integer value) {
return map.get(value);
}
@JsonValue
public Integer getValue() {
return this.value;
}
////////////////////////////////////////////////////////////////
private static Map<Integer, OrderByType> map = new HashMap<>();
static {
for (OrderByType t : values()) {
map.put(t.value, t);
}
}
}
/**
* 查询类型枚举
*/
public enum FindType {
All(1),//所有
Pass(2),//所有及格的
NotPass(3),//所有不及格的
NotComplete(4),//未完成考试
Complete(5),//完成考试即及格和不及格的
;
private Integer value;
private FindType(Integer value) {
this.value = value;
}
@JsonCreator
public static FindType getItem(Integer value) {
return map.get(value);
}
@JsonValue
public Integer getValue() {
return this.value;
}
////////////////////////////////////////////////////////////////
private static Map<Integer, FindType> map = new HashMap<>();
static {
for (FindType t : values()) {
map.put(t.value, t);
}
}
}
}

View File

@ -0,0 +1,85 @@
package club.joylink.rtss.vo.paper;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public enum FindPcType {
/**
* 所有
*/
All(1),
/**
* 正在编辑的
*/
Editing(2),
/**
* 可以用于生成试卷的
*/
CanUse(3),
/**
* 封存
*/
Locked(4),
/**
* 已经被使用过
*/
Used(5),
;
private Integer state;
private FindPcType(Integer state) {
this.state = state;
}
@JsonCreator
public static FindPcType getItem(Integer state) {
return map.get(state);
}
@JsonValue
public Integer getValue() {
return this.state;
}
/**
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)<br>
* 选填<br>
*/
public static List<PaperCompositionState> stateList(FindPcType findState) {
List<PaperCompositionState> list = new ArrayList<>();
switch (findState) {
case All: {
list.add(PaperCompositionState.Editing);
list.add(PaperCompositionState.Locked);
list.add(PaperCompositionState.Used);
}
break;
case Used:
list.add(PaperCompositionState.Used);
break;
case CanUse: {
list.add(PaperCompositionState.Locked);
list.add(PaperCompositionState.Used);
}
case Locked:
list.add(PaperCompositionState.Locked);
break;
case Editing:
list.add(PaperCompositionState.Editing);
break;
}
return list;
}
////////////////////////////////////////////////////////////////
private static Map<Integer, FindPcType> map = new HashMap<>();
static {
for (FindPcType t : values()) {
map.put(t.state, t);
}
}
}

View File

@ -0,0 +1,47 @@
package club.joylink.rtss.vo.paper;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;
/**
* 查询用户试卷时的排序类型
*/
public enum FindPuOrderByType {
CreateTime(1, "create_time"),//用户试卷创建时间
StartTime(2, "start_time"),//用户开始答题时间
Score(3, "score"),//用户最终得分
;
private Integer value;
private String orderBy;
private FindPuOrderByType(Integer value, String type) {
this.value = value;
this.orderBy = type;
}
public String with() {
return this.orderBy;
}
@JsonCreator
public static FindPuOrderByType getItem(Integer value) {
return map.get(value);
}
@JsonValue
public Integer getValue() {
return this.value;
}
////////////////////////////////////////////////////////////////
private static Map<Integer, FindPuOrderByType> map = new HashMap<>();
static {
for (FindPuOrderByType t : values()) {
map.put(t.value, t);
}
}
}

View File

@ -0,0 +1,42 @@
package club.joylink.rtss.vo.paper;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;
/**
* 查找用户试卷时的查询分类
*/
public enum FindPuType {
All(1),//所有
Pass(2),//所有及格的
NotPass(3),//所有不及格的
NotComplete(4),//未完成考试
Complete(5),//完成考试即及格和不及格的
;
private Integer value;
private FindPuType(Integer value) {
this.value = value;
}
@JsonCreator
public static FindPuType getItem(Integer value) {
return map.get(value);
}
@JsonValue
public Integer getValue() {
return this.value;
}
////////////////////////////////////////////////////////////////
private static Map<Integer, FindPuType> map = new HashMap<>();
static {
for (FindPuType t : values()) {
map.put(t.value, t);
}
}
}

View File

@ -78,23 +78,4 @@ public class MiniProgramAccessTokenManager {
}
return accessToken;
}
public String getAccessToken(boolean forceRefresh) throws WxErrorException {
if (forceRefresh) {
this.expireAccessToken();
}
if (this.isAccessTokenExpired()) {
synchronized (globalAccessTokenRefreshLock) {
if (this.isAccessTokenExpired()) {
String url = String.format(URL_GET_ACCESSTOEKN,
this.weChatConfig.getMini().getAppId(),
this.weChatConfig.getMini().getAppSecret());
WxAccessToken accessToken = this.restTemplate.getForObject(url, WxAccessToken.class);
log.info(String.format("调用微信小程序获取access_token接口获取到[%s]", accessToken.toString()));
this.updateAccessToken(accessToken.getAccess_token(), accessToken.getExpires_in());
}
}
}
return this.accessToken;
}
}

View File

@ -8,21 +8,16 @@ udp:
serverPort: 20002
clientPort: 20001
minio:
endpoint: http://192.168.3.233:8900
accessKey: jladmin
secretKey: Joylink@0503
bucket: rtss
spring:
profiles:
active: room
active: dev
application:
name: joylink-rtss
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
# 后续转为MINIO后删除
servlet:
multipart:
max-file-size: 10MB
@ -43,6 +38,7 @@ spring:
port: 465
class: javax.net.ssl.SSLSocketFactory
fallback: false
# 数据库连接配置
datasource:
driverClassName: com.mysql.cj.jdbc.Driver
hikari:
@ -53,59 +49,42 @@ spring:
pool-name: HikariPool
max-lifetime: 1800000 # 池中连接关闭后的最长生命周期单位ms
connection-timeout: 30000 # 等待连接的超时时间单位ms
# mybatis 设置
mybatis:
mapper-locations: classpath:mybatis/mapper/*.xml
type-aliases-package: club.joylink.rtss.entity
configuration:
map-underscore-to-camel-case: true
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true
params: count=countSql
# 微信配置
wechat:
app-id: wx41cb66db5faf330f
app-secret: eb7199c1e73417be6a4d38b4a848effb
domain-uri: https://api.weixin.qq.com
wx-api-url: https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wechat.app-id}&redirect_uri=http://joylink.club/wx/%s&response_type=code&scope=snsapi_base&state=%s#wechat_redirect
wm-base-url: https://joylink.club/oss/joylink/%s?state=%s
sp-app-id: wxe9150dbbcbf9440b
sp-app-secret: 4b5d453e5ec246a3f1b72360c59e4fab
sp-app2-id: wxecb0321367be529c
sp-app2-secret: 3c31cb41588f27a78160092249123766
sp-app3-id: wxe6140d5985333338
sp-app3-secret: 6b7359860c22e3607467df421cd24eef
wm-base-url: https://joylink.club/oss/joylink/%s?state=%s
wx-module-url: http://localhost:9001
mini:
access-token-task-on: false
app-id: wxe9150dbbcbf9440b
app-secret: 4b5d453e5ec246a3f1b72360c59e4fab
# 腾讯云
tencent-cloud:
app-id: 1400093601
app-key: 4a724df65b2bb7e4dc9b4302693f2485
domain-uri: https://yun.tim.qq.com/v5/tlssmssvr
allow-send: true
common:
env: dev
#修改swgger接口前缀默认为/v2/api-docs
springfox:
documentation:
swagger:
v2:
path: /swagger/api-docs
# 环境连接配置 start
---
spring:
profiles: dev
datasource:
url: jdbc:mysql://localhost:3306/joylink?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
url: jdbc:mysql://192.168.3.233:3306/joylink?useSSL=false&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: root
password: root
password: joylink0503
tencent-cloud:
allow-send: false
@ -117,33 +96,16 @@ logging:
level:
club.joylink.rtss: DEBUG
minio:
endpoint: http://192.168.3.233:8900
accessKey: jladmin
secretKey: Joylink@0503
bucket: oss-rtss
common:
env: dev
license-secret-key: joylink
---
spring:
profiles: test
datasource:
url: jdbc:mysql://172.16.0.128:3306/joylink?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: Joylink@0503
wechat:
wx-api-url: https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wechat.app-id}&redirect_uri=https://test.joylink.club/wx/%s&response_type=code&scope=snsapi_base&state=%s#wechat_redirect
wx-module-url: https://joylink.club/jlwxs
tencent-cloud:
allow-send: false
logging:
file:
path: /usr/local/joylink/logs/rtss
level:
club.joylink.rtss: INFO
common:
env: test
---
spring:
profiles: local-test
@ -152,9 +114,6 @@ spring:
username: root
password: joylink0503
wechat:
wx-api-url: https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wechat.app-id}&redirect_uri=https://test.joylink.club/wx/%s&response_type=code&scope=snsapi_base&state=%s#wechat_redirect
wx-module-url: https://joylink.club/jlwxs
tencent-cloud:
allow-send: false
@ -164,35 +123,15 @@ logging:
level:
club.joylink.rtss: INFO
minio:
endpoint: http://192.168.3.233:8900
accessKey: jladmin
secretKey: Joylink@0503
bucket: oss-rtss
common:
env: test
---
spring:
profiles: prd
datasource:
url: jdbc:mysql://192.168.0.169:3306/joylink?useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: joylink@0503
wechat:
app-id: wx41cb66db5faf330f
app-secret: eb7199c1e73417be6a4d38b4a848effb
wx-api-url: https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wechat.app-id}&redirect_uri=https://joylink.club/wx/%s&response_type=code&scope=snsapi_base&state=%s#wechat_redirect
wx-module-url: http://172.21.0.4:9001
mini:
access-token-task-on: true
file:
path: https://joylink.club/jlfile/api/upload/joylink/avatar
logging:
file:
path: /usr/local/joylink/logs/rtss
level:
club.joylink.rtss: INFO
common:
env: prd
---
spring:
@ -211,16 +150,23 @@ logging:
level:
club.joylink.rtss: INFO
minio:
endpoint: http://192.168.3.233:8900
accessKey: jladmin
secretKey: Joylink@0503
bucket: oss-rtss
common:
env: local
license-secret-key: joylink
---
spring:
profiles: room
profiles: test
datasource:
url: jdbc:mysql://192.168.3.233:3306/joylink?useSSL=false&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
url: jdbc:mysql://172.16.0.128:3306/joylink?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: joylink0503
password: Joylink@0503
tencent-cloud:
allow-send: false
@ -231,6 +177,38 @@ logging:
level:
club.joylink.rtss: INFO
minio:
endpoint: https://joylink.club
accessKey: jladmin
secretKey: Joylink@0503
bucket: oss-rtss
common:
env: room
license-secret-key: joylink
env: test
---
spring:
profiles: prd
datasource:
url: jdbc:mysql://192.168.0.169:3306/joylink?useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: joylink@0503
file:
path: https://joylink.club/jlfile/api/upload/joylink/avatar
logging:
file:
path: /usr/local/joylink/logs/rtss
level:
club.joylink.rtss: INFO
minio:
endpoint: https://joylink.club
accessKey: jladmin
secretKey: Joylink@0503
bucket: oss-rtss
common:
env: prd
# 环境连接配置 end