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

View File

@ -11,7 +11,7 @@
Target Server Version : 80029 Target Server Version : 80029
File Encoding : 65001 File Encoding : 65001
Date: 08/10/2022 15:18:14 Date: 09/10/2022 14:51:19
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
@ -27,7 +27,7 @@ CREATE TABLE `paper_rule` (
`type` int NULL DEFAULT NULL COMMENT '试题类型1-理论题2-实训题', `type` int NULL DEFAULT NULL COMMENT '试题类型1-理论题2-实训题',
`subType` int NULL DEFAULT NULL COMMENT '规则类型:理论题(1-单选题2-多选题3-判断题);实训题(4-单操实训5-场景实训)', `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', `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 '每题分值', `score` int NULL DEFAULT NULL COMMENT '每题分值',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; ) 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 Target Server Version : 80029
File Encoding : 65001 File Encoding : 65001
Date: 08/10/2022 15:18:36 Date: 09/10/2022 14:51:35
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
@ -25,13 +25,13 @@ CREATE TABLE `paper_user` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户试卷id', `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户试卷id',
`user_id` bigint NOT NULL COMMENT '用户id', `user_id` bigint NOT NULL COMMENT '用户id',
`pc_id` bigint NOT NULL COMMENT '生成用户试卷的paper_compostion的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 '用户最终得分', `score` int NULL DEFAULT NULL COMMENT '用户最终得分',
`start_time` datetime NULL DEFAULT NULL COMMENT '用户开始做题时间', `start_time` datetime NULL DEFAULT NULL COMMENT '用户开始做题时间',
`end_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 '原因', `cause` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '原因',
`create_time` datetime NULL DEFAULT NULL COMMENT '用户试卷生成时间', `create_time` datetime NULL DEFAULT NULL COMMENT '用户试卷生成时间',
PRIMARY KEY (`id`) USING BTREE 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; SET FOREIGN_KEY_CHECKS = 1;

View File

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

View File

@ -6,19 +6,12 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
@ConfigurationProperties(prefix="wechat") @ConfigurationProperties(prefix = "wechat")
@Getter @Getter
@Setter @Setter
public class WeChatConfig { public class WeChatConfig {
private String domainUri; private String domainUri;
private String appId;
private String appSecret;
private String wxApiUrl;
private String wmBaseUrl; private String wmBaseUrl;
private String spAppId; private String spAppId;
@ -33,18 +26,6 @@ public class WeChatConfig {
private String spApp3Secret; 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) { public String getWmLoginUrl(String state) {
return String.format(wmBaseUrl, "login", state); return String.format(wmBaseUrl, "login", state);
} }
@ -57,41 +38,10 @@ public class WeChatConfig {
return String.format(wmBaseUrl, "distribute", state); return String.format(wmBaseUrl, "distribute", state);
} }
public String getWmJointRoomUrl(String state) {
return String.format(wmBaseUrl, "joint", state);
}
public String getWmSimulationUrl(String state) { public String getWmSimulationUrl(String state) {
return String.format(wmBaseUrl, "simulation", 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) { public String getCode2SessionUrl(String wmCode) {
return new StringBuilder(this.domainUri) return new StringBuilder(this.domainUri)
.append("/sns/jscode2session?appid=").append(spAppId) .append("/sns/jscode2session?appid=").append(spAppId)
@ -116,23 +66,6 @@ public class WeChatConfig {
.append("&grant_type=authorization_code").toString(); .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) { public String getOrgBindCode(String state) {
return String.format(wmBaseUrl, "company", state); return String.format(wmBaseUrl, "company", state);
} }

View File

@ -98,6 +98,11 @@ public class PaperApiTestController {
rt.setPcId(2L); rt.setPcId(2L);
System.out.println(JsonUtils.writeValueAsString(rt)); 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){ public static void main(String[]args){
createPaperCompositionReqVo(); createPaperCompositionReqVo();
paperCompositionBasicVo(); paperCompositionBasicVo();
@ -107,5 +112,6 @@ public class PaperApiTestController {
paperRuleVo(); paperRuleVo();
paperSubmitAnswerReqVo(); paperSubmitAnswerReqVo();
findPaperUserForCompositionReqVo(); findPaperUserForCompositionReqVo();
findPaperCompositionByAccountReqVo();
} }
} }

View File

@ -76,14 +76,21 @@ public class PaperCompositionController {
} }
/** /**
* 分页查找试卷蓝图 * 根据(组织id试卷蓝图名称简介)分页查找试卷蓝图
*/ */
@PostMapping("/find/page") @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){ public PageVO<PaperUserInfoVo>findPaperUserByPage(@RequestBody FindPaperUserForCompositionReqVo req, @RequestAttribute AccountVO user){
return this.paperUserFindPageService.findPaperUserByPage(req,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.constants.ProjectDeviceType;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor; 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.services.project.DeviceService;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
@ -14,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
/** /**
*项目设备管理接口() * 项目设备管理接口()
*/ */
@RestController @RestController
@RequestMapping(path = "/api/device") @RequestMapping(path = "/api/device")
@ -24,37 +25,34 @@ public class DeviceController {
private DeviceService deviceService; private DeviceService deviceService;
/** /**
*分页查询项目设备 * 分页查询项目设备
*/ */
@GetMapping("/paging") @GetMapping("/paging")
public PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO, public PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO) {
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) return this.deviceService.pagingQuery(queryVO);
LoginUserInfoVO userLoginInfo) {
return this.deviceService.pagingQuery(queryVO, userLoginInfo);
} }
/** /**
*项目设备编号是否已经存在 * 项目设备编号是否已经存在
*/ */
@GetMapping("/exist/{code}") @GetMapping("/exist/{code}")
public boolean isDeviceCodeExist(@PathVariable String code, public boolean isDeviceCodeExist(@PathVariable String code, String projectCode) {
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) String project = Project.isDefault(projectCode) ? Project.DEFAULT_PROJECT_CODE : projectCode;
LoginUserInfoVO userLoginInfo) { return this.deviceService.isDeviceCodeExist(project, code);
return this.deviceService.isDeviceCodeExist(userLoginInfo.getProject(), code);
} }
/** /**
*新建项目设备 * 新建项目设备
*/ */
@PostMapping("") @PostMapping("")
public String create(@RequestBody @Validated ProjectDeviceVO deviceVO, public String create(@RequestBody @Validated ProjectDeviceVO deviceVO,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) @RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
LoginUserInfoVO userLoginInfo) { LoginUserInfoVO userLoginInfo) {
return this.deviceService.create(deviceVO, userLoginInfo); return this.deviceService.create(deviceVO, userLoginInfo);
} }
/** /**
*获取设备详情包含配置信息 * 获取设备详情包含配置信息
*/ */
@GetMapping("/{id}") @GetMapping("/{id}")
public ProjectDeviceVO getDeviceDetailInfoById(@PathVariable Long id) { public ProjectDeviceVO getDeviceDetailInfoById(@PathVariable Long id) {
@ -62,7 +60,7 @@ public class DeviceController {
} }
/** /**
*添加/修改道岔设备网关映射配置 * 添加/修改道岔设备网关映射配置
*/ */
@PutMapping("/{id}/config/plcgateway") @PutMapping("/{id}/config/plcgateway")
public void updatePlcGatewayConfig(@PathVariable Long id, @RequestBody @Validated PlcGatewayConfigVO configVO) { public void updatePlcGatewayConfig(@PathVariable Long id, @RequestBody @Validated PlcGatewayConfigVO configVO) {
@ -70,7 +68,7 @@ public class DeviceController {
} }
/** /**
*添加/修改道岔设备网关映射配置 * 添加/修改道岔设备网关映射配置
*/ */
@PutMapping("/{id}/config/switch") @PutMapping("/{id}/config/switch")
public void updateSwitchConfig(@PathVariable Long id, @RequestBody @Validated SwitchConfigVO configVO) { public void updateSwitchConfig(@PathVariable Long id, @RequestBody @Validated SwitchConfigVO configVO) {
@ -78,7 +76,7 @@ public class DeviceController {
} }
/** /**
*添加/修改信号机设备网关映射配置 * 添加/修改信号机设备网关映射配置
*/ */
@PutMapping("/{id}/config/signal") @PutMapping("/{id}/config/signal")
public void updateSignalConfig(@PathVariable Long id, @RequestBody @Validated SignalConfigVO configVO) { public void updateSignalConfig(@PathVariable Long id, @RequestBody @Validated SignalConfigVO configVO) {
@ -86,7 +84,7 @@ public class DeviceController {
} }
/** /**
*添加/修改屏蔽门设备网关映射配置 * 添加/修改屏蔽门设备网关映射配置
*/ */
@PutMapping("/{id}/config/psc") @PutMapping("/{id}/config/psc")
public void updatePscConfig(@PathVariable Long id, @RequestBody @Validated PscConfigVO configVO) { public void updatePscConfig(@PathVariable Long id, @RequestBody @Validated PscConfigVO configVO) {
@ -94,7 +92,7 @@ public class DeviceController {
} }
/** /**
*添加/修改屏蔽门设备网关映射配置 * 添加/修改屏蔽门设备网关映射配置
*/ */
@PutMapping("/{id}/config/psd") @PutMapping("/{id}/config/psd")
public void updatePsdConfig(@PathVariable Long id, @RequestBody @Validated PsdConfigVO configVO) { public void updatePsdConfig(@PathVariable Long id, @RequestBody @Validated PsdConfigVO configVO) {
@ -102,7 +100,7 @@ public class DeviceController {
} }
/** /**
*添加/修改屏蔽门设备网关映射配置 * 添加/修改屏蔽门设备网关映射配置
*/ */
@PutMapping("/{id}/config/psl") @PutMapping("/{id}/config/psl")
public void updatePslConfig(@PathVariable Long id, @RequestBody @Validated PslConfigVO configVO) { public void updatePslConfig(@PathVariable Long id, @RequestBody @Validated PslConfigVO configVO) {
@ -110,7 +108,7 @@ public class DeviceController {
} }
/** /**
*添加/修改屏蔽门设备网关映射配置 * 添加/修改屏蔽门设备网关映射配置
*/ */
@PutMapping("/{id}/config/ibp") @PutMapping("/{id}/config/ibp")
public void updateIbpConfig(@PathVariable Long id, @RequestBody @Validated IbpConfigVO configVO) { public void updateIbpConfig(@PathVariable Long id, @RequestBody @Validated IbpConfigVO configVO) {
@ -118,7 +116,7 @@ public class DeviceController {
} }
/** /**
*添加/修改虚拟IBP盘配置 * 添加/修改虚拟IBP盘配置
*/ */
@PutMapping("/{id}/config/vribp") @PutMapping("/{id}/config/vribp")
public void updateVrIbpConfig(@PathVariable Long id, @RequestBody @Validated VrIbpConfigVO configVO) { public void updateVrIbpConfig(@PathVariable Long id, @RequestBody @Validated VrIbpConfigVO configVO) {
@ -126,7 +124,7 @@ public class DeviceController {
} }
/** /**
*添加/修改现地工作站配置 * 添加/修改现地工作站配置
*/ */
@PutMapping("/{id}/config/lw") @PutMapping("/{id}/config/lw")
public void updateLwConfig(@PathVariable Long id, @RequestBody @Validated LwConfigVO configVO) { public void updateLwConfig(@PathVariable Long id, @RequestBody @Validated LwConfigVO configVO) {
@ -134,7 +132,7 @@ public class DeviceController {
} }
/** /**
*添加/修改大屏工作站配置 * 添加/修改大屏工作站配置
*/ */
@PutMapping("/{id}/config/lsw") @PutMapping("/{id}/config/lsw")
public void updateLswConfig(@PathVariable Long id, @RequestBody @Validated LswConfigVO configVO) { public void updateLswConfig(@PathVariable Long id, @RequestBody @Validated LswConfigVO configVO) {
@ -142,7 +140,7 @@ public class DeviceController {
} }
/** /**
*添加/修改CCTV工作站配置 * 添加/修改CCTV工作站配置
*/ */
@PutMapping("/{id}/config/cctv") @PutMapping("/{id}/config/cctv")
public void updateCctvConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) { public void updateCctvConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) {
@ -150,7 +148,7 @@ public class DeviceController {
} }
/** /**
*添加/修改电子沙盘工作站配置 * 添加/修改电子沙盘工作站配置
*/ */
@PutMapping("/{id}/config/sandbox") @PutMapping("/{id}/config/sandbox")
public void updateSandboxConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) { public void updateSandboxConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) {
@ -158,7 +156,7 @@ public class DeviceController {
} }
/** /**
*添加/修改虚拟屏蔽门工作站配置 * 添加/修改虚拟屏蔽门工作站配置
*/ */
@PutMapping("/{id}/config/vrpsd") @PutMapping("/{id}/config/vrpsd")
public void updateVrpsdConfig(@PathVariable Long id, @RequestBody @Validated VrpsdConfigVO configVO) { public void updateVrpsdConfig(@PathVariable Long id, @RequestBody @Validated VrpsdConfigVO configVO) {
@ -166,7 +164,7 @@ public class DeviceController {
} }
/** /**
*添加/修改现地综合监控工作站配置 * 添加/修改现地综合监控工作站配置
*/ */
@PutMapping("/{id}/config/iscslw") @PutMapping("/{id}/config/iscslw")
public void updateIscsLwConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) { public void updateIscsLwConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) {
@ -174,7 +172,7 @@ public class DeviceController {
} }
/** /**
*添加/修改中心综合监控工作站配置 * 添加/修改中心综合监控工作站配置
*/ */
@PutMapping("/{id}/config/iscscw") @PutMapping("/{id}/config/iscscw")
public void updateIscsCwConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) { public void updateIscsCwConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) {
@ -182,7 +180,7 @@ public class DeviceController {
} }
/** /**
*添加/修改联锁工作站配置 * 添加/修改联锁工作站配置
*/ */
@PutMapping("/{id}/config/ilw") @PutMapping("/{id}/config/ilw")
public void updateIlwConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) { public void updateIlwConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) {
@ -198,7 +196,7 @@ public class DeviceController {
} }
/** /**
*删除设备 * 删除设备
*/ */
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public void delete(@PathVariable Long id) { public void delete(@PathVariable Long id) {
@ -206,12 +204,12 @@ public class DeviceController {
} }
/** /**
*查询某个类型的所有设备 * 查询某个类型的所有设备
*/ */
@GetMapping("/{type}/all") @GetMapping("/{type}/all")
public List<ProjectDeviceVO> queryByType(@PathVariable ProjectDeviceType type, public List<ProjectDeviceVO> queryByType(@PathVariable ProjectDeviceType type,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) @RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
LoginUserInfoVO userLoginInfo) { LoginUserInfoVO userLoginInfo) {
return this.deviceService.queryByType(type, userLoginInfo.getProject()); return this.deviceService.queryByType(type, userLoginInfo.getProject());
} }
@ -223,37 +221,37 @@ public class DeviceController {
// } // }
@PostMapping("/xty/addOrUpdate") @PostMapping("/xty/addOrUpdate")
public void addOrUpdateXtyDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY) public void addOrUpdateXtyDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
AccountVO accountVO) { AccountVO accountVO) {
this.deviceService.addOrUpdateXtyDeviceConfig(accountVO); this.deviceService.addOrUpdateXtyDeviceConfig(accountVO);
} }
@PostMapping("/gzb/addOrUpdate") @PostMapping("/gzb/addOrUpdate")
public void addOrUpdateGzbDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY) public void addOrUpdateGzbDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
AccountVO accountVO) { AccountVO accountVO) {
this.deviceService.addOrUpdateGzbDeviceConfig(accountVO); this.deviceService.addOrUpdateGzbDeviceConfig(accountVO);
} }
@PostMapping("/sdy/addOrUpdate") @PostMapping("/sdy/addOrUpdate")
public void addOrUpdateSdyDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY) public void addOrUpdateSdyDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
AccountVO accountVO) { AccountVO accountVO) {
this.deviceService.addOrUpdateSdyDeviceConfig(accountVO); this.deviceService.addOrUpdateSdyDeviceConfig(accountVO);
} }
@PostMapping("/zjd/addOrUpdate") @PostMapping("/zjd/addOrUpdate")
public void addOrUpdateZjdDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY) public void addOrUpdateZjdDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
AccountVO accountVO) { AccountVO accountVO) {
this.deviceService.addOrUpdateRichorDeviceConfig(accountVO); this.deviceService.addOrUpdateRichorDeviceConfig(accountVO);
} }
@PostMapping("/sr/addOrUpdate/{mapId}") @PostMapping("/sr/addOrUpdate/{mapId}")
public void addOrUpdateSrDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY) public void addOrUpdateSrDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
AccountVO accountVO, @PathVariable Long mapId) { AccountVO accountVO, @PathVariable Long mapId) {
this.deviceService.addOrUpdateSrDeviceConfig(accountVO, mapId); this.deviceService.addOrUpdateSrDeviceConfig(accountVO, mapId);
} }
@PostMapping("/hhcj/addOrUpdate") @PostMapping("/hhcj/addOrUpdate")
public void addOrUpdateHhcjDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY) public void addOrUpdateHhcjDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
AccountVO accountVO) { AccountVO accountVO) {
this.deviceService.addOrUpdateHhcjDeviceConfig(accountVO); this.deviceService.addOrUpdateHhcjDeviceConfig(accountVO);
} }
} }

View File

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

View File

@ -1,7 +1,10 @@
package club.joylink.rtss.services.paper; 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.PaperCompositionDAO;
import club.joylink.rtss.dao.paper.PaperRuleDAO; 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.PaperComposition;
import club.joylink.rtss.entity.paper.PaperCompositionExample; import club.joylink.rtss.entity.paper.PaperCompositionExample;
import club.joylink.rtss.entity.paper.PaperRule; import club.joylink.rtss.entity.paper.PaperRule;
@ -30,6 +33,8 @@ public class PaperCompositionService {
private PaperCompositionDAO compositionDAO; private PaperCompositionDAO compositionDAO;
@Autowired @Autowired
private PaperRuleDAO ruleDAO; 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()); 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) @Transactional(readOnly = true)
public PageVO<PaperCompositionVo> findPaperCompositionByPage(FindPaperCompositionPageReqVo req, AccountVO user) { public PageVO<PaperCompositionVo> findPaperCompositionByPage(FindPaperCompositionPageReqVo req) {
PaperCompositionExample pcEx = new PaperCompositionExample(); PaperCompositionExample pcEx = new PaperCompositionExample();
PaperCompositionExample.Criteria pcExCriteria = pcEx.createCriteria(); PaperCompositionExample.Criteria pcExCriteria = pcEx.createCriteria();
if (null != req.getOrgId()) {
pcExCriteria.andOrgIdEqualTo(req.getOrgId());
}
if (null != req.getName()) { if (null != req.getName()) {
if (req.getNameLike()) { if (req.getNameLike()) {
pcExCriteria.andNameLike(String.format("%%%s%%", req.getName())); pcExCriteria.andNameLike(String.format("%%%s%%", req.getName()));

View File

@ -194,11 +194,11 @@ public class PaperUserCreateService {
// //
PaperQuestionExample questionExample = new PaperQuestionExample(); PaperQuestionExample questionExample = new PaperQuestionExample();
if (null == tagArray) { 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 { } else {
for (String tag : tagArray) { 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; 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.PaperCompositionDAO;
import club.joylink.rtss.dao.paper.PaperUserDAO; 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.PaperComposition;
import club.joylink.rtss.entity.paper.PaperUser; import club.joylink.rtss.entity.paper.PaperUser;
import club.joylink.rtss.entity.paper.PaperUserExample; import club.joylink.rtss.entity.paper.PaperUserExample;
import club.joylink.rtss.exception.PaperExceptionAssert; import club.joylink.rtss.exception.PaperExceptionAssert;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO; 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.FindPaperUserForCompositionReqVo;
import club.joylink.rtss.vo.paper.PaperUserInfoVo; import club.joylink.rtss.vo.paper.PaperUserInfoVo;
import club.joylink.rtss.vo.paper.convertor.PaperUserConvertor; import club.joylink.rtss.vo.paper.convertor.PaperUserConvertor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -26,10 +33,65 @@ public class PaperUserFindPageService {
private PaperCompositionDAO paperCompositionDAO; private PaperCompositionDAO paperCompositionDAO;
@Autowired @Autowired
private PaperUserDAO paperUserDAO; 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) { public PageVO<PaperUserInfoVo> findPaperUserByPage(FindPaperUserForCompositionReqVo req, AccountVO user) {
PageVO<PaperUserInfoVo> page = new PageVO<>(); PageVO<PaperUserInfoVo> page = new PageVO<>();
// //
@ -75,4 +137,20 @@ public class PaperUserFindPageService {
// //
return page; 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 * @param userLoginInfo
* @return * @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 @Autowired
private IMapService iMapService; private IMapService iMapService;
// 修改项目编码 20221009
@Override @Override
public PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO, public PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO) {
LoginUserInfoVO userLoginInfo) {
ProjectDeviceExample example = new ProjectDeviceExample(); ProjectDeviceExample example = new ProjectDeviceExample();
ProjectDeviceExample.Criteria criteria = example.createCriteria(); ProjectDeviceExample.Criteria criteria = example.createCriteria();
if (!Objects.equals(userLoginInfo.getProject(), Project.DEFAULT_PROJECT_CODE)) { if (StringUtils.hasText(queryVO.getProjectCode())) {
criteria.andProjectCodeEqualTo(userLoginInfo.getProject()); criteria.andProjectCodeEqualTo(queryVO.getProjectCode());
} }
if (StringUtils.hasText(queryVO.getCode())) { if (StringUtils.hasText(queryVO.getCode())) {
criteria.andCodeLike(String.format("%%%s%%", queryVO.getCode())); criteria.andCodeLike(String.format("%%%s%%", queryVO.getCode()));
@ -77,8 +77,6 @@ public class DeviceServiceImpl implements DeviceService {
@Override @Override
public boolean isDeviceCodeExist(String project, String code) { 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(); ProjectDeviceExample example = new ProjectDeviceExample();
example.createCriteria().andProjectCodeEqualTo(project).andCodeEqualTo(code); example.createCriteria().andProjectCodeEqualTo(project).andCodeEqualTo(code);
if (this.projectDeviceDAO.countByExample(example) > 0) { if (this.projectDeviceDAO.countByExample(example) > 0) {
@ -90,9 +88,6 @@ public class DeviceServiceImpl implements DeviceService {
@Override @Override
public String create(ProjectDeviceVO deviceVO, LoginUserInfoVO userLoginInfo) { public String create(ProjectDeviceVO deviceVO, LoginUserInfoVO userLoginInfo) {
ProjectDevice projectDevice = deviceVO.buildDB(); 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.setCreator(userLoginInfo.getAccountVO().getId());
projectDevice.setCreateTime(LocalDateTime.now()); projectDevice.setCreateTime(LocalDateTime.now());
this.projectDeviceDAO.insert(projectDevice); this.projectDeviceDAO.insert(projectDevice);

View File

@ -284,6 +284,7 @@ public class ProjectDeviceVO {
@JsonIgnore @JsonIgnore
public ProjectDevice buildDB() { public ProjectDevice buildDB() {
ProjectDevice device = new ProjectDevice(); ProjectDevice device = new ProjectDevice();
device.setProjectCode(this.getProject());
device.setCode(this.getCode()); device.setCode(this.getCode());
device.setType(this.getType().name()); device.setType(this.getType().name());
return device; 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 @Setter
@NoArgsConstructor @NoArgsConstructor
public class FindPaperCompositionPageReqVo extends PageQueryVO { public class FindPaperCompositionPageReqVo extends PageQueryVO {
/**
* 组织id<br>
* 选填<br>
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long orgId;
/** /**
* 试卷蓝图名称<br> * 试卷蓝图名称<br>
* 选填<br> * 选填<br>
@ -42,11 +48,11 @@ public class FindPaperCompositionPageReqVo extends PageQueryVO {
*/ */
private Boolean profileLike = true; private Boolean profileLike = true;
/** /**
* 根据试卷蓝图的状态查找,默认值FindState.All<br> * 根据试卷蓝图的状态查找,默认值FindPcType.All<br>
* All(1)-所有,Editing(2)-正在编辑的,CanUse(3)-可以用于生成试卷的,Locked(4)-封存,Used(5)-已经被使用过<br> * All(1)-所有,Editing(2)-正在编辑的,CanUse(3)-可以用于生成试卷的,Locked(4)-封存,Used(5)-已经被使用过<br>
* 选填<br> * 选填<br>
*/ */
private FindState findState = FindState.All; private FindPcType findState = FindPcType.All;
/** /**
* 以什么来排序 * 以什么来排序
* <p> * <p>
@ -62,87 +68,12 @@ public class FindPaperCompositionPageReqVo extends PageQueryVO {
* 选填 * 选填
*/ */
private Boolean desc = true; private Boolean desc = true;
//////////////////////////////////////////////////////////////////////
/** /**
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)<br> * 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)<br>
* 选填<br> * 选填<br>
*/ */
public List<PaperCompositionState> stateList() { public List<PaperCompositionState> stateList(){
List<PaperCompositionState> list = new ArrayList<>(); return FindPcType.stateList(findState);
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);
}
}
} }
} }

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; * 是否降序true-降序false-升序默认值为true;
*/ */
private Boolean desc = 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; 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 serverPort: 20002
clientPort: 20001 clientPort: 20001
minio:
endpoint: http://192.168.3.233:8900
accessKey: jladmin
secretKey: Joylink@0503
bucket: rtss
spring: spring:
profiles: profiles:
active: room active: dev
application: application:
name: joylink-rtss name: joylink-rtss
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
default-property-inclusion: non_null default-property-inclusion: non_null
# 后续转为MINIO后删除
servlet: servlet:
multipart: multipart:
max-file-size: 10MB max-file-size: 10MB
@ -43,6 +38,7 @@ spring:
port: 465 port: 465
class: javax.net.ssl.SSLSocketFactory class: javax.net.ssl.SSLSocketFactory
fallback: false fallback: false
# 数据库连接配置
datasource: datasource:
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
hikari: hikari:
@ -53,59 +49,42 @@ spring:
pool-name: HikariPool pool-name: HikariPool
max-lifetime: 1800000 # 池中连接关闭后的最长生命周期单位ms max-lifetime: 1800000 # 池中连接关闭后的最长生命周期单位ms
connection-timeout: 30000 # 等待连接的超时时间单位ms connection-timeout: 30000 # 等待连接的超时时间单位ms
# mybatis 设置
mybatis: mybatis:
mapper-locations: classpath:mybatis/mapper/*.xml mapper-locations: classpath:mybatis/mapper/*.xml
type-aliases-package: club.joylink.rtss.entity
configuration:
map-underscore-to-camel-case: true
pagehelper: pagehelper:
helper-dialect: mysql helper-dialect: mysql
reasonable: true reasonable: true
support-methods-arguments: true support-methods-arguments: true
params: count=countSql params: count=countSql
# 微信配置
wechat: wechat:
app-id: wx41cb66db5faf330f
app-secret: eb7199c1e73417be6a4d38b4a848effb
domain-uri: https://api.weixin.qq.com 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-id: wxe9150dbbcbf9440b
sp-app-secret: 4b5d453e5ec246a3f1b72360c59e4fab sp-app-secret: 4b5d453e5ec246a3f1b72360c59e4fab
sp-app2-id: wxecb0321367be529c sp-app2-id: wxecb0321367be529c
sp-app2-secret: 3c31cb41588f27a78160092249123766 sp-app2-secret: 3c31cb41588f27a78160092249123766
sp-app3-id: wxe6140d5985333338 sp-app3-id: wxe6140d5985333338
sp-app3-secret: 6b7359860c22e3607467df421cd24eef 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: tencent-cloud:
app-id: 1400093601 app-id: 1400093601
app-key: 4a724df65b2bb7e4dc9b4302693f2485 app-key: 4a724df65b2bb7e4dc9b4302693f2485
domain-uri: https://yun.tim.qq.com/v5/tlssmssvr domain-uri: https://yun.tim.qq.com/v5/tlssmssvr
allow-send: true allow-send: true
common: # 环境连接配置 start
env: dev
#修改swgger接口前缀默认为/v2/api-docs
springfox:
documentation:
swagger:
v2:
path: /swagger/api-docs
--- ---
spring: spring:
profiles: dev profiles: dev
datasource: 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 username: root
password: root password: joylink0503
tencent-cloud: tencent-cloud:
allow-send: false allow-send: false
@ -117,33 +96,16 @@ logging:
level: level:
club.joylink.rtss: DEBUG club.joylink.rtss: DEBUG
minio:
endpoint: http://192.168.3.233:8900
accessKey: jladmin
secretKey: Joylink@0503
bucket: oss-rtss
common: common:
env: dev env: dev
license-secret-key: joylink 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: spring:
profiles: local-test profiles: local-test
@ -152,9 +114,6 @@ spring:
username: root username: root
password: joylink0503 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: tencent-cloud:
allow-send: false allow-send: false
@ -164,35 +123,15 @@ logging:
level: level:
club.joylink.rtss: INFO club.joylink.rtss: INFO
minio:
endpoint: http://192.168.3.233:8900
accessKey: jladmin
secretKey: Joylink@0503
bucket: oss-rtss
common: common:
env: test 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: spring:
@ -211,16 +150,23 @@ logging:
level: level:
club.joylink.rtss: INFO club.joylink.rtss: INFO
minio:
endpoint: http://192.168.3.233:8900
accessKey: jladmin
secretKey: Joylink@0503
bucket: oss-rtss
common: common:
env: local env: local
license-secret-key: joylink license-secret-key: joylink
--- ---
spring: spring:
profiles: room profiles: test
datasource: 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 username: root
password: joylink0503 password: Joylink@0503
tencent-cloud: tencent-cloud:
allow-send: false allow-send: false
@ -231,6 +177,38 @@ logging:
level: level:
club.joylink.rtss: INFO club.joylink.rtss: INFO
minio:
endpoint: https://joylink.club
accessKey: jladmin
secretKey: Joylink@0503
bucket: oss-rtss
common: common:
env: room env: test
license-secret-key: joylink
---
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