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

This commit is contained in:
xzb 2022-12-07 17:04:24 +08:00
commit 6b26675fdd
38 changed files with 824 additions and 1096 deletions

View File

@ -1,54 +1,44 @@
/*
Navicat Premium Data Transfer
Source Server :
Source Server Type : MySQL
Source Server Version : 80029
Source Host : 192.168.3.233:3306
Source Schema : joylink
Target Server Type : MySQL
Target Server Version : 80029
File Encoding : 65001
Date: 28/10/2022 16:45:36
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for rts_distribute
-- ----------------------------
DROP TABLE IF EXISTS `rts_distribute`;
CREATE TABLE `rts_distribute` (
`id` bigint NOT NULL AUTO_INCREMENT,
`map_id` bigint NULL DEFAULT NULL COMMENT '地图id',
`source_subject_id` bigint NULL DEFAULT NULL COMMENT '来源主体id',
`forever` tinyint(1) NULL DEFAULT NULL COMMENT '是否永久true/false',
`status` int NULL DEFAULT NULL COMMENT '权限分发状态,1-有效2-无效',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`start_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
`end_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
`creator_id` bigint NULL DEFAULT NULL COMMENT '创建者id',
`dsc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注描述',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rts_permission
-- ----------------------------
DROP TABLE IF EXISTS `rts_permission`;
CREATE TABLE `rts_permission` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '权限id,对功能(system_ability)的管理',
`project_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '对应的projectCode',
`map_id` bigint NULL DEFAULT NULL COMMENT '对应线路的mapId',
`permission_type` int NULL DEFAULT NULL COMMENT '权限类型 0=项目1=线路2=线路功能',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '权限名称',
`des` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '权限描述',
`creator_id` bigint NULL DEFAULT NULL COMMENT '创建者id',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`is_sync` tinyint(1) NULL DEFAULT NULL COMMENT '是否同步的数据',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 2159 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rts_permission_distribute
-- ----------------------------
DROP TABLE IF EXISTS `rts_permission_distribute`;
CREATE TABLE `rts_permission_distribute` (
`id` bigint NOT NULL AUTO_INCREMENT,
`map_id` bigint NULL DEFAULT NULL COMMENT '地图id',
`source_subject_id` bigint NULL DEFAULT NULL COMMENT '来源主体id',
`forever` tinyint(1) NULL DEFAULT NULL COMMENT '是否永久true/false',
`status` int NULL DEFAULT NULL COMMENT '权限分发状态,1-有效2-无效',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`start_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
`end_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
`creator_id` bigint NULL DEFAULT NULL COMMENT '创建者id',
`dsc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注描述',
`is_sync` tinyint(1) NULL DEFAULT NULL COMMENT '是否同步的数据',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rts_permission_distribute_ref
@ -60,8 +50,9 @@ CREATE TABLE `rts_permission_distribute_ref` (
`permission_id` bigint NULL DEFAULT NULL COMMENT '权限id',
`amount` int NULL DEFAULT NULL COMMENT '总数量',
`remains` int NULL DEFAULT NULL COMMENT '剩余数量',
`is_sync` tinyint(1) NULL DEFAULT NULL COMMENT '是否同步数据',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 8615 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rts_permission_subject
@ -82,8 +73,9 @@ CREATE TABLE `rts_permission_subject` (
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`distribute_id` bigint NOT NULL COMMENT '来自对应的分发id(rts_permission_distribute)',
`parent_id` bigint NULL DEFAULT NULL COMMENT '父级id 数据来源rts_permission_distribute表source_subject_id字段',
`is_sync` tinyint(1) NULL DEFAULT NULL COMMENT '是否同步的数据',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 60903 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rts_permission_system_ability
@ -93,7 +85,8 @@ CREATE TABLE `rts_permission_system_ability` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '权限功能关联记录id',
`permission_id` bigint NULL DEFAULT NULL COMMENT '权限id',
`system_ability_id` bigint NULL DEFAULT NULL COMMENT '功能(system_ability)的id',
`is_sync` tinyint(1) NULL DEFAULT NULL COMMENT '是否同步的数据',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 58719 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;

19
sql/20221206-wei.sql Normal file
View File

@ -0,0 +1,19 @@
CREATE TABLE `rts_training2_rule` (
`id` bigint NOT NULL AUTO_INCREMENT,
`sim_type` varchar(255) DEFAULT NULL COMMENT '仿真类型',
`line_code` varchar(255) DEFAULT NULL COMMENT '线路编码',
`device_rule` varchar(255) DEFAULT NULL COMMENT '设备列表规则',
`client` varchar(255) DEFAULT NULL COMMENT '客户端',
`name` varchar(255) DEFAULT NULL COMMENT '实训名称格式',
`description` varchar(255) DEFAULT NULL COMMENT '实训描述',
`type` varchar(255) DEFAULT NULL COMMENT '实训类型',
`labels` varchar(255) DEFAULT NULL COMMENT '实训标签',
`scene_rule` varchar(255) DEFAULT NULL COMMENT '背景生成规则',
`steps` text COMMENT '步骤列表',
`failure_rule` text COMMENT '失败规则',
`creator_id` bigint DEFAULT NULL COMMENT '创建者ID',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`location_rule` varchar(255) DEFAULT NULL COMMENT '地图定位规则',
PRIMARY KEY (`id`),
KEY `sim_type` (`sim_type`)
) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

View File

@ -1,13 +1,23 @@
package club.joylink.rtss.controller.org;
import club.joylink.rtss.dao.org.OrgProjectDao;
import club.joylink.rtss.entity.org.OrgProject;
import club.joylink.rtss.services.org.IOrgProjectService;
import club.joylink.rtss.services.org.OrgService;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.org.CompanyVO;
import club.joylink.rtss.vo.client.org.OrgProjectVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
/**
* 组织-项目关系管理接口
*/
@RestController
@RequestMapping("/api/org")
public class OrgProjectController {
@ -30,4 +40,34 @@ public class OrgProjectController {
public void signInOrg(@PathVariable Long orgId, @RequestAttribute LoginUserInfoVO loginInfo) {
orgProjectService.signInOrg(orgId, loginInfo);
}
@Autowired
private OrgProjectDao orgProjectDao;
@Autowired
private OrgService orgService;
/**
* 旧数据处理用完删除
*/
@Transactional(rollbackFor = Exception.class)
@PostMapping("/oldData/handle")
public void oldDataHandle() {
orgProjectDao.deleteByExample(null);
OrgProject orgProject = new OrgProject();
orgProject.setCreateTime(LocalDateTime.now());
orgProject.setCreatorId(1L);
List<CompanyVO> orgs = orgService.queryAllTopOrg();
for (CompanyVO org : orgs) {
List<String> projectCodes = org.getProjectCodes();
if (!CollectionUtils.isEmpty(projectCodes)) {
for (String projectCode : projectCodes) {
orgProject.setId(null);
orgProject.setOrgId(org.getId());
orgProject.setProjectCode(projectCode);
orgProjectDao.insert(orgProject);
}
}
}
}
}

View File

@ -2,15 +2,37 @@ package club.joylink.rtss.controller.paper;
import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.dao.ExamDefinitionDAO;
import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.dao.UserExamMapper;
import club.joylink.rtss.dao.org.OrgProjectDao;
import club.joylink.rtss.dao.paper.PaperUserDAO;
import club.joylink.rtss.entity.ExamDefinitionExample;
import club.joylink.rtss.entity.UserExam;
import club.joylink.rtss.entity.UserExamExample;
import club.joylink.rtss.entity.org.OrgProject;
import club.joylink.rtss.entity.paper.PaperUser;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.services.paper.PaperCompositionService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.paper.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 试卷蓝图业务接口
@ -27,6 +49,7 @@ public class PaperCompositionController {
/**
* 数据管理查询
*
* @param req
* @return
*/
@ -35,9 +58,11 @@ public class PaperCompositionController {
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionForPage(@RequestBody FindPaperCompositionPageReqVo req) {
return this.compositionService.findPaperCompositionByPage(req);
}
/**
* 创建试卷蓝图包括规则定义
* 参数 tags 只支持单个
*
* @param orgId 组织id
*/
@PostMapping("/{orgId}")
@ -65,10 +90,10 @@ public class PaperCompositionController {
}
/**
* 将封存的试卷蓝图解封重新编辑
* 将封存的试卷蓝图设置失效
*/
@PutMapping("/{pcId}/unlock")
public void unlockPaperComposition(@PathVariable("pcId") Long pcId, @RequestAttribute AccountVO user) {
@PutMapping("/{pcId}/invalid")
public void invalidPaperComposition(@PathVariable("pcId") Long pcId, @RequestAttribute AccountVO user) {
compositionService.unlockPaperComposition(pcId, user);
}
@ -99,6 +124,7 @@ public class PaperCompositionController {
public List<PaperCompositionWithRuleVo> findPaperCompositionByList(@RequestBody FindPaperCompositionPageReqVo req) {
return this.compositionService.findPaperCompositionList(req);
}
/**
* 根据试卷蓝图名称简介分页查找某个组织的试卷蓝图
*/
@ -123,6 +149,96 @@ public class PaperCompositionController {
*/
@GetMapping("/{pcId}")
public PaperCompositionWithRuleVo findPaperComposition(@PathVariable("pcId") Long pcId, @RequestAttribute AccountVO user) {
return this.compositionService.findPaperComposition(pcId,user);
return this.compositionService.findPaperComposition(pcId, user);
}
@Autowired
ExamDefinitionDAO examDefinitionDAO;
@Autowired
IMapService iMapService;
@Autowired
OrgDAO orgDAO;
@Autowired
OrgProjectDao orgProjectDao;
@Autowired
UserExamMapper userExamMapper;
@Autowired
private PaperUserDAO paperUserDAO;
/**
* 旧数据处理接口用完删除
*/
@Transactional(rollbackFor = Exception.class)
@PostMapping("/oldData/handle")
public List<String> oldDataHandle(@RequestAttribute AccountVO user) {
examDefinitionDAO.deleteByExample(null);
paperUserDAO.deleteByExample(null);
List<String> msg = new ArrayList<>();
//所有在线地图
Map<Long, MapVO> onlineMaps = iMapService.listOnline().stream().collect(Collectors.toMap(MapVO::getId, Function.identity()));
//所有项目-组织对应关系
Map<String, Long> projectCode_orgId_map = orgProjectDao.selectByExample(null).stream().collect(Collectors.toMap(OrgProject::getProjectCode, OrgProject::getOrgId));
//转化试卷并记录试卷id变化
ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
examDefinitionExample.createCriteria().andStatusEqualTo("1");
Map<Long, Long> old_newExamIdMap = new HashMap<>();
examDefinitionDAO.selectByExample(examDefinitionExample).stream()
.filter(exam -> {
if (exam.getOrgId() != null) {
return true;
}
MapVO map = onlineMaps.get(exam.getMapId());
if (map == null) {
msg.add(String.format("[id:%s]的试卷对应的地图[id:%s]不存在或已下架", exam.getId(), exam.getMapId()));
return false;
}
String projectCode = map.getProjectCode();
if (!StringUtils.hasText(projectCode)) {
exam.setOrgId(projectCode_orgId_map.get("DEFAULT"));
} else {
exam.setOrgId(projectCode_orgId_map.get(projectCode));
}
return true;
}).forEach(exam -> {
PaperCompositionWithRuleVo paperCompositionWithRuleVo = new PaperCompositionWithRuleVo();
paperCompositionWithRuleVo.setMapId(exam.getMapId());
paperCompositionWithRuleVo.setName(exam.getName());
paperCompositionWithRuleVo.setProfile(exam.getRemarks());
paperCompositionWithRuleVo.setOrgId(exam.getOrgId());
paperCompositionWithRuleVo.setStartTime(exam.getStartTime());
paperCompositionWithRuleVo.setEndTime(exam.getEndTime());
paperCompositionWithRuleVo.setValidDuration(exam.getDuration() / 60);
paperCompositionWithRuleVo.setPassScore(exam.getPassingPoint());
paperCompositionWithRuleVo.setFullScore(exam.getFullPoint());
paperCompositionWithRuleVo.setCreatorId(exam.getCreatorId());
paperCompositionWithRuleVo.setCreateTime(exam.getCreateTime());
paperCompositionWithRuleVo.setUpdateTime(null);
paperCompositionWithRuleVo.setState(PaperCompositionState.Locked);
CreatePaperCompositionRspVo paperComposition = createPaperCompositionWithRuleForOrg(exam.getOrgId(), paperCompositionWithRuleVo, user);
old_newExamIdMap.put(exam.getId(), paperComposition.getId());
});
//查询试卷记录
ArrayList<Long> oldExamIds = new ArrayList<>(old_newExamIdMap.keySet());
UserExamExample userExamExample = new UserExamExample();
userExamExample.createCriteria().andExamIdIn(oldExamIds);
List<UserExam> userExams = userExamMapper.selectByExample(userExamExample);
//转化试卷记录
LocalDateTime now = LocalDateTime.now();
for (UserExam userExam : userExams) {
PaperUser paperUser = new PaperUser();
paperUser.setUserId(userExam.getUserId());
Long newExamId = old_newExamIdMap.get(userExam.getExamId());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(newExamId);
paperUser.setPcId(newExamId);
paperUser.setScore(userExam.getScore().intValue());
paperUser.setStartTime(userExam.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
if (userExam.getEndTime() != null) {
paperUser.setEndTime(userExam.getEndTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
paperUser.setCreateTime(now);
paperUserDAO.insert(paperUser);
}
return msg;
}
}

View File

@ -1,105 +0,0 @@
package club.joylink.rtss.controller.permission2;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.services.permission.PermissionDistributeService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.permission.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 权限分发业务接口V2
*/
@Deprecated
@RestController
@RequestMapping("/api/v2/permission/distribute")
public class AcPermissionDistributeController {
@Autowired
private PermissionDistributeService permissionDistributeService;
/**
* 创建权限分发
*/
@PostMapping("/create")
public CreatePermissionDistributeRspVo createPermissionDistribute(@RequestBody CreatePermissionDistributeReqVo req, @RequestAttribute AccountVO user) {
return this.permissionDistributeService.createPermissionDistribute(req, user);
}
/**
* 从权限主体二次分发权限
*
* @param permissionSubjectId 权限主体id
*/
@PostMapping("/create/from/subject/{permissionSubjectId}")
public CreatePermissionDistributeRspVo secondCreatePermissionDistribute(@PathVariable("permissionSubjectId") Long permissionSubjectId, @RequestBody CreatePermissionDistributeReqVo req, @RequestAttribute AccountVO user) {
return this.permissionDistributeService.secondCreatePermissionDistribute(permissionSubjectId, req, user);
}
/**
* 分页获取权限分发列表
*/
@PostMapping("/find/page")
public PageVO<PermissionDistributeRspVo> findPermissionDistributeByPage(@RequestBody FindPermissionDistributeByPageReqVo req) {
return this.permissionDistributeService.findPermissionDistributeByPage(req);
}
/**
* 设置权限分发立即失效
*
* @param pdId 权限分发id
*/
@PutMapping("/{pdId}/invalidate")
public void invalidatePermissionDistributeImmediately(@PathVariable("pdId") Long pdId) {
this.permissionDistributeService.invalidatePermissionDistributeImmediately(pdId);
}
/**
* 用户主动从权限分发领取权限
*
* @param pdId 权限分发id
* @param receiver 权限领取者当前登录用户
* @return 返回生成的权限主体id
*/
@GetMapping("/{pdId}/get")
public Long userReceiveFromPermissionDistribute(@PathVariable("pdId") Long pdId, @RequestAttribute AccountVO receiver) {
return this.permissionDistributeService.subjectAcceptFromPermissionDistribute(pdId, PermissionSubjectTypeEnum.user, receiver.getId());
}
/**
* 从权限分发直接分发给指定主体
*
* @param pdId 权限分发id
* @param subjectType 主体类型其值为(user,org)user-一般用户org-组织
* @return 返回生成的权限主体id
*/
@PostMapping("/{pdId}/to/{subjectType}/{subjectId}")
public Long permissionDistributeToSubject(@PathVariable("pdId") Long pdId, @PathVariable("subjectType") String subjectType, @PathVariable("subjectId") Long subjectId) {
final PermissionSubjectTypeEnum subjectTypeEnum = PermissionSubjectTypeEnum.valueOf(subjectType);
return this.permissionDistributeService.subjectAcceptFromPermissionDistribute(pdId, subjectTypeEnum, subjectId);
}
/**
* 生成分发二维码
*
* @param pdId 权限分发id
*/
@GetMapping(path = "/{pdId}/qrCode")
public String generateQrCode(@PathVariable("pdId") Long pdId, @RequestAttribute(value = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginInfo) {
return this.permissionDistributeService.generateQrCode(pdId, loginInfo);
}
/**
* 微信扫码获取权限分发相关信息
*
* @param code 用户编码
* @param id 权限分发id
*/
@GetMapping("/scan")
public ScanPermissionDistributeInfoRspVo scanPermissionDistributeInfo(String code, Long id) {
return this.permissionDistributeService.scanPermissionDistributeInfo(code, id);
}
}

View File

@ -2,7 +2,6 @@ package club.joylink.rtss.controller.permission2;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.services.permission.IDistributeService;
import club.joylink.rtss.services.permission.PermissionDistributeService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;

View File

@ -2,15 +2,16 @@ package club.joylink.rtss.controller.publish;
import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.dao.MapDataDAO;
import club.joylink.rtss.dao.MapSystemDAO;
import club.joylink.rtss.dao.RtsMapFunctionDAO;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.mapFunction.*;
import club.joylink.rtss.vo.map.MapVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -99,15 +100,16 @@ public class MapFunctionController {
@Autowired
private IMapService iMapService;
@Autowired
private MapSystemDAO mapSystemDAO;
@Autowired
private MapDataDAO mapDataDAO;
private RtsMapFunctionDAO rtsMapFunctionDAO;
/**
* 旧数据处理用完删除
*/
@Transactional(rollbackFor = Exception.class)
@PostMapping("/oldDataHandle")
public List<String> oldDataHandle() {
rtsMapFunctionDAO.deleteByExample(null);
List<MapVO> onlineMaps = iMapService.listOnline();
List<String> msgList = new ArrayList<>();
for (MapVO onlineMap : onlineMaps) {
@ -116,4 +118,24 @@ public class MapFunctionController {
}
return msgList;
}
/**
* 为所有在线地图生成功能用完删除
*/
@Transactional
@PostMapping("/generate/all")
public void generateAll(@RequestAttribute LoginUserInfoVO loginInfo) {
for (MapVO mapVO : iMapService.listOnline()) {
MapVO mapDetail = iMapService.getMapDetail(mapVO.getId());
RtsMapFunctionGenerateParamVO paramVO = new RtsMapFunctionGenerateParamVO();
List<Simulation.Type> types = new ArrayList<>();
if (mapDetail.getConfigVO().isRailway()) {
types.add(Simulation.Type.RAILWAY);
} else {
types.add(Simulation.Type.METRO);
}
paramVO.setSimTypes(types);
generate(mapDetail.getId(), paramVO, loginInfo);
}
}
}

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.controller.training2;
import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.training2.Training2PublishService;
import club.joylink.rtss.services.training2.Training2TypeEnum;
import club.joylink.rtss.vo.client.PageVO;
@ -49,28 +51,19 @@ public class TrainingV2PublishController {
return this.publishService.deletePublishedTrainings(req);
}
/**
* 根据mapId查所有的已发布单操实训的基础信息
*/
@GetMapping("/{mapId}/singles")
public List<PublishedTraining2InfoRspVo> findSingleTrainingBasicInfo(@PathVariable("mapId") Long mapId){
return this.publishService.findAllSingleTrainingBasicInfoByMapId(mapId);
}
/**
* 根据mapId查所有的已发布场景实训的基础信息
*/
@GetMapping("/{mapId}/scenes")
public List<PublishedTraining2InfoRspVo> findSceneTrainingBasicInfo(@PathVariable("mapId") Long mapId){
return this.publishService.findAllSceneTrainingBasicInfoByMapId(mapId);
@GetMapping("/infos")
public List<PublishedTraining2InfoRspVo> findTrainingListInfos(@ModelAttribute PublishedTrainingListRspVo vo){
return this.publishService.findTrainingInfo(vo);
}
/**
* 查所有的已发布场景实训的基础信息
*/
@Role(value = RoleEnum.SuperAdmin)
@GetMapping("/list")
public List<PublishedTraining2InfoRspVo> findTrainingList(Long mapId,Training2TypeEnum type){
return this.publishService.findTrainingInfo(mapId, type);
public List<PublishedTraining2InfoRspVo> findTrainingList(@ModelAttribute PublishedTrainingListRspVo vo){
return this.publishService.findTrainingInfo(vo);
}
/**

View File

@ -31,4 +31,4 @@ public interface PaperCompositionDAO {
int updateByPrimaryKeySelective(PaperComposition record);
int updateByPrimaryKey(PaperComposition record);
}
}

View File

@ -1,64 +0,0 @@
package club.joylink.rtss.dao.permission;
import club.joylink.rtss.entity.permission.RtsDistribute;
import club.joylink.rtss.entity.permission.RtsDistributeExample;
import java.time.LocalDateTime;
import java.util.List;
import club.joylink.rtss.vo.permission.PermissionDistributeStatusEnum;
import club.joylink.rtss.vo.permission.distribute.DistributeDataVO;
import club.joylink.rtss.vo.permission.distribute.DistributeQueryVO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface RtsDistributeDAO {
@Select("<script>" +
"select A.id,A.forever,A.status,A.create_time,A.update_time,A.start_time,A.end_time,A.dsc,B.nickname as nickName" +
" from rts_distribute A left join sys_account B on A.creator_id = B.id where 1= 1 " +
"<if test=\"vo.dsc!=null and vo.dsc!=''\">" +
" AND A.dsc Like CONCAT('%',#{vo.dsc},'%') " +
"</if>"+
"<if test=\"vo.status!=null\">" +
" AND A.status = #{vo.status} " +
"</if> order by A.id desc "+
"</script>")
List<DistributeDataVO> selectCustom(@Param("vo") DistributeQueryVO vo);
@Insert("<script>" +
"insert into rts_distribute (id,map_id, source_subject_id, forever,`status`, create_time, update_time,start_time, end_time, creator_id,dsc,is_sync)" +
" values (#{record.id,jdbcType=BIGINT},#{record.mapId,jdbcType=BIGINT}, #{record.sourceSubjectId,jdbcType=BIGINT}, #{record.forever,jdbcType=BIT}, " +
" #{record.status,jdbcType=INTEGER}, #{record.createTime,jdbcType=TIMESTAMP}, #{record.updateTime,jdbcType=TIMESTAMP}, " +
" #{record.startTime,jdbcType=TIMESTAMP}, #{record.endTime,jdbcType=TIMESTAMP}, #{record.creatorId,jdbcType=BIGINT}, " +
" #{record.dsc,jdbcType=VARCHAR},#{record.isSync,jdbcType=BIT})</script>")
void customerSyncInsert(@Param("record") RtsDistribute record);
/**
* 状态参考 {@link PermissionDistributeStatusEnum}
*/
@Update("<script>update rts_distribute set status = 2,update_time = now() where forever = 0 and (`status` is null or `status` = 1) <![CDATA[ and end_time < now() ]]></script>")
void updateStatusByTimeOver();
long countByExample(RtsDistributeExample example);
int deleteByExample(RtsDistributeExample example);
int deleteByPrimaryKey(Long id);
int insert(RtsDistribute record);
int insertSelective(RtsDistribute record);
List<RtsDistribute> selectByExample(RtsDistributeExample example);
RtsDistribute selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") RtsDistribute record, @Param("example") RtsDistributeExample example);
int updateByExample(@Param("record") RtsDistribute record, @Param("example") RtsDistributeExample example);
int updateByPrimaryKeySelective(RtsDistribute record);
int updateByPrimaryKey(RtsDistribute record);
}

View File

@ -1,34 +1,73 @@
package club.joylink.rtss.dao.permission;
import club.joylink.rtss.entity.permission.PermissionDistribute;
import club.joylink.rtss.entity.permission.PermissionDistributeExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import club.joylink.rtss.entity.permission.RtsPermissionDistribute;
import club.joylink.rtss.entity.permission.RtsPermissionDistributeExample;
import club.joylink.rtss.vo.permission.PermissionDistributeStatusEnum;
import club.joylink.rtss.vo.permission.distribute.DistributeDataVO;
import club.joylink.rtss.vo.permission.distribute.DistributeQueryVO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface RtsPermissionDistributeDAO {
long countByExample(PermissionDistributeExample example);
int deleteByExample(PermissionDistributeExample example);
@Select("<script>" +
"select A.id,A.forever,A.status,A.create_time,A.update_time,A.start_time,A.end_time,A.dsc,B.nickname as nickName" +
" from rts_permission_distribute A left join sys_account B on A.creator_id = B.id where 1= 1 " +
"<if test=\"vo.dsc!=null and vo.dsc!=''\">" +
" AND A.dsc Like CONCAT('%',#{vo.dsc},'%') " +
"</if>"+
"<if test=\"vo.status!=null\">" +
" AND A.status = #{vo.status} " +
"</if> order by A.id desc "+
"</script>")
List<DistributeDataVO> selectCustom(@Param("vo") DistributeQueryVO vo);
@Insert("<script>" +
"insert into rts_permission_distribute (id,map_id, source_subject_id, forever,`status`, create_time, update_time,start_time, end_time, creator_id,dsc,is_sync)" +
" values (#{record.id,jdbcType=BIGINT},#{record.mapId,jdbcType=BIGINT}, #{record.sourceSubjectId,jdbcType=BIGINT}, #{record.forever,jdbcType=BIT}, " +
" #{record.status,jdbcType=INTEGER}, #{record.createTime,jdbcType=TIMESTAMP}, #{record.updateTime,jdbcType=TIMESTAMP}, " +
" #{record.startTime,jdbcType=TIMESTAMP}, #{record.endTime,jdbcType=TIMESTAMP}, #{record.creatorId,jdbcType=BIGINT}, " +
" #{record.dsc,jdbcType=VARCHAR},#{record.isSync,jdbcType=BIT})</script>")
void customerSyncInsert(@Param("record") RtsPermissionDistribute record);
@Insert("<script>" +
"insert into rts_permission_distribute (id,map_id, source_subject_id, forever,`status`, create_time, update_time,start_time, end_time, creator_id,dsc,is_sync)" +
" values" +
"<foreach collection=\"list\" item=\"item\" index=\"index\" separator=\",\"> " +
" (#{item.id,jdbcType=BIGINT},#{item.mapId,jdbcType=BIGINT}, #{item.sourceSubjectId,jdbcType=BIGINT}, #{item.forever,jdbcType=BIT}, " +
" #{item.status,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateTime,jdbcType=TIMESTAMP}, " +
" #{item.startTime,jdbcType=TIMESTAMP}, #{item.endTime,jdbcType=TIMESTAMP}, #{item.creatorId,jdbcType=BIGINT}, " +
" #{item.dsc,jdbcType=VARCHAR},#{item.isSync,jdbcType=BIT})" +
"</foreach>" +
"</script>")
void customerSyncBatchInsert(@Param("list") List<RtsPermissionDistribute> record);
/**
* 状态参考 {@link PermissionDistributeStatusEnum}
*/
@Update("<script>update rts_permission_distribute set status = 2,update_time = now() where forever = 0 and (`status` is null or `status` = 1) <![CDATA[ and end_time < now() ]]></script>")
void updateStatusByTimeOver();
long countByExample(RtsPermissionDistributeExample example);
int deleteByExample(RtsPermissionDistributeExample example);
int deleteByPrimaryKey(Long id);
int insert(PermissionDistribute record);
int insert(RtsPermissionDistribute record);
int insertSelective(PermissionDistribute record);
int insertSelective(RtsPermissionDistribute record);
List<PermissionDistribute> selectByExample(PermissionDistributeExample example);
List<RtsPermissionDistribute> selectByExample(RtsPermissionDistributeExample example);
PermissionDistribute selectByPrimaryKey(Long id);
RtsPermissionDistribute selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") PermissionDistribute record, @Param("example") PermissionDistributeExample example);
int updateByExampleSelective(@Param("record") RtsPermissionDistribute record, @Param("example") RtsPermissionDistributeExample example);
int updateByExample(@Param("record") PermissionDistribute record, @Param("example") PermissionDistributeExample example);
int updateByExample(@Param("record") RtsPermissionDistribute record, @Param("example") RtsPermissionDistributeExample example);
int updateByPrimaryKeySelective(PermissionDistribute record);
int updateByPrimaryKeySelective(RtsPermissionDistribute record);
int updateByPrimaryKey(PermissionDistribute record);
}
int updateByPrimaryKey(RtsPermissionDistribute record);
}

View File

@ -5,6 +5,7 @@ import club.joylink.rtss.entity.permission.RtsPermissionDistributeRefExample;
import java.util.List;
import club.joylink.rtss.vo.permission.distribute.DistributeDataVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -25,6 +26,17 @@ public interface RtsPermissionDistributeRefDAO {
" where 1 = 1 and A.distribute_id = #{disId}" +
"</script>")
List<DistributeDataVO.DistributePermissionVO> selectTimeOut();
@Insert("<script>" +
"insert into rts_permission_distribute_ref (distribute_id, permission_id, amount,remains, is_sync)" +
" values " +
"<foreach collection=\"list\" item=\"item\" index=\"index\" separator=\",\"> " +
"(#{item.distributeId,jdbcType=BIGINT}, #{item.permissionId,jdbcType=BIGINT}, #{item.amount,jdbcType=INTEGER},\n" +
" #{item.remains,jdbcType=INTEGER}, #{item.isSync,jdbcType=BIT})" +
"</foreach>" +
"</script>")
void batchInsert(@Param("list") List<RtsPermissionDistributeRef> refList);
long countByExample(RtsPermissionDistributeRefExample example);
int deleteByExample(RtsPermissionDistributeRefExample example);

View File

@ -18,7 +18,7 @@ public interface SyncDAO {
@Delete("<script>delete from rts_permission where is_sync = 1</script>")
void clearRtsPermission();
@Delete("<script>delete from rts_distribute where is_sync = 1</script>")
@Delete("<script>delete from rts_permission_distribute where is_sync = 1</script>")
void clearRtsDistribute();
@Delete("<script>delete from rts_permission_distribute_ref where is_sync = 1</script>")
void clearRtsDistributeRef();

View File

@ -61,6 +61,11 @@ public class PaperComposition implements Serializable {
*/
private Integer fullScore;
/**
* 最后更新用户id
*/
private Long updateId;
/**
* 创建者id
*/
@ -77,7 +82,7 @@ public class PaperComposition implements Serializable {
private LocalDateTime updateTime;
/**
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)定于见PaperCompositionState
* 试卷蓝图状态1-正在编辑[查询修改删除]2-封存(只能查看)3- 失效只能从封存状态变更只能查看,当PaperComposition - update_id 为null 说明是同步失效的数据定于见PaperCompositionState
*/
private Integer state;

View File

@ -745,6 +745,66 @@ public class PaperCompositionExample {
return (Criteria) this;
}
public Criteria andUpdateIdIsNull() {
addCriterion("update_id is null");
return (Criteria) this;
}
public Criteria andUpdateIdIsNotNull() {
addCriterion("update_id is not null");
return (Criteria) this;
}
public Criteria andUpdateIdEqualTo(Long value) {
addCriterion("update_id =", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdNotEqualTo(Long value) {
addCriterion("update_id <>", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdGreaterThan(Long value) {
addCriterion("update_id >", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdGreaterThanOrEqualTo(Long value) {
addCriterion("update_id >=", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdLessThan(Long value) {
addCriterion("update_id <", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdLessThanOrEqualTo(Long value) {
addCriterion("update_id <=", value, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdIn(List<Long> values) {
addCriterion("update_id in", values, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdNotIn(List<Long> values) {
addCriterion("update_id not in", values, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdBetween(Long value1, Long value2) {
addCriterion("update_id between", value1, value2, "updateId");
return (Criteria) this;
}
public Criteria andUpdateIdNotBetween(Long value1, Long value2) {
addCriterion("update_id not between", value1, value2, "updateId");
return (Criteria) this;
}
public Criteria andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;

View File

@ -10,7 +10,7 @@ import lombok.Data;
*
*/
@Data
public class RtsDistribute implements Serializable {
public class RtsPermissionDistribute implements Serializable {
private Long id;
/**

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class RtsDistributeExample {
public class RtsPermissionDistributeExample {
protected String orderByClause;
protected boolean distinct;
@ -15,7 +15,7 @@ public class RtsDistributeExample {
private Long offset;
public RtsDistributeExample() {
public RtsPermissionDistributeExample() {
oredCriteria = new ArrayList<Criteria>();
}

View File

@ -14,6 +14,7 @@ import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.services.publishData.MapPassengerFlowDataService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.training2.Training2;
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.mapFunction.*;
@ -260,7 +261,8 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
supplier = getRunPlanDesignFunctionSupplier(mapId, systemNameSet, msgList, simType);
break;
case DEPOT_IL:
supplier = getDepotILFunctionSupplier(mapId, systemNameSet, msgList, prefixMsg, simType, mapMemberVOS);
// supplier = getDepotILFunctionSupplier(mapId, systemNameSet, msgList, prefixMsg, simType, mapMemberVOS);
supplier = () -> null;
break;
case YJDDZH:
supplier = getEmergencyFunctionSupplier(mapId, systemNameSet, msgList, Simulation.Type.EMERGENCY);
@ -337,6 +339,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
Supplier<RtsMapFunctionCreateVO> stationExamSystem = getExamFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<RtsMapFunctionCreateVO> joint = getJointFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<RtsMapFunctionCreateVO> trainingDesign = getTrainingDesignFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<RtsMapFunctionCreateVO> trainingRoom = getTrainingRoomFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType);
fillFunctions.add(dispatchSystem);
fillFunctions.add(stationSystem);
@ -346,10 +349,29 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
fillFunctions.add(stationExamSystem);
fillFunctions.add(joint);
fillFunctions.add(trainingDesign);
fillFunctions.add(trainingRoom);
return fillFunctions;
}
private Supplier<RtsMapFunctionCreateVO> getTrainingRoomFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType) {
//实训设计
return () -> {
String name = "实训室";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
}
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.REAL_DEVICE, null);
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.trainingDesign(true)
.hasMemberManager(true)
.hasDeviceManager(true)
.build();
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
};
}
private Supplier<RtsMapFunctionCreateVO> getTrainingDesignFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
//实训设计
return () -> {
@ -423,6 +445,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.hasVoice(true)
.hasTraining(true)
.trainingType(Training2.Type.SCENE)
.hasMemberManager(true)
.build();
return buildCreateVO(mapId, name, name, simType, null, domConfig);
@ -439,6 +462,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.hasVoice(true)
.hasTraining(true)
.trainingType(Training2.Type.SINGLE)
.build();
return buildCreateVO(mapId, name, name, simType, null, domConfig);
};

View File

@ -149,6 +149,7 @@ public class PaperCompositionService {
curPc.setCreateTime(LocalDateTime.now());
curPc.setUpdateTime(LocalDateTime.now());
curPc.setCreatorId(user.getId());
curPc.setUpdateId(user.getId());
compositionDAO.updateByPrimaryKeySelective(curPc);
// 更新规则
this.updateCompositionRule(req.getRuleList(), req.getId());
@ -216,14 +217,15 @@ public class PaperCompositionService {
//
PaperComposition nPc = new PaperComposition();
nPc.setId(curPc.getId());
nPc.setState(PaperCompositionState.Editing.getValue());
nPc.setState(PaperCompositionState.Invalid.getValue());
nPc.setUpdateId(user.getId());
compositionDAO.updateByPrimaryKeySelective(nPc);
}
/**
* 标记已封存的试卷已使用
*/
@Transactional(rollbackFor = Exception.class)
/* @Transactional(rollbackFor = Exception.class)
public void usePaperComposition(Long pcId) {
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
if (PaperCompositionState.Locked.equals(PaperCompositionState.getItem(curPc.getState()))) {
@ -232,7 +234,7 @@ public class PaperCompositionService {
nPc.setState(PaperCompositionState.Used.getValue());
compositionDAO.updateByPrimaryKeySelective(nPc);
}
}
}*/
/**
* 删除试卷蓝图(只能删除处于编辑状态的)

View File

@ -76,7 +76,7 @@ public class PaperUserCreateService {
//
Long orgId = composition.getOrgId();
// 标记封存的试卷蓝图已使用
compositionService.usePaperComposition(pcId);
// compositionService.usePaperComposition(pcId);
// 创建用户试卷
PaperUser paper = new PaperUser();
paper.setUserId(user.getId());

View File

@ -4,7 +4,7 @@ import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.dao.SysAccountDAO;
import club.joylink.rtss.dao.permission.AcPermissionDAO;
import club.joylink.rtss.dao.permission.PermissionSubjectDAO;
import club.joylink.rtss.dao.permission.RtsDistributeDAO;
import club.joylink.rtss.dao.permission.RtsPermissionDistributeDAO;
import club.joylink.rtss.dao.permission.RtsPermissionDistributeRefDAO;
import club.joylink.rtss.entity.permission.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
@ -13,7 +13,6 @@ import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.permission.PermissionDistributeStatusEnum;
import club.joylink.rtss.vo.permission.PermissionSubjectStatusEnum;
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
import club.joylink.rtss.vo.permission.convertor.PermissionDistributeConvertor;
import club.joylink.rtss.vo.permission.distribute.DistributeDataVO;
@ -29,7 +28,6 @@ import org.springframework.util.StringUtils;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@ -38,7 +36,7 @@ import java.util.stream.Collectors;
@Service
public class DistributeService implements IDistributeService{
@Autowired
private RtsDistributeDAO rtsDistributeDAO;
private RtsPermissionDistributeDAO rtsDistributeDAO;
@Autowired
private RtsPermissionDistributeRefDAO distributeRefDAO;
@Autowired
@ -63,7 +61,7 @@ public class DistributeService implements IDistributeService{
@Transactional(rollbackFor = Exception.class)
public void create(DistributeDataVO vo, AccountVO accountVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.hasText(vo.getDsc()),"请填写备注信息");
RtsDistribute rd = PermissionDistributeConvertor.convertDistributeDataVoTo(vo);
RtsPermissionDistribute rd = PermissionDistributeConvertor.convertDistributeDataVoTo(vo);
if(Objects.isNull(rd.getForever())){
rd.setForever(false);
}
@ -96,9 +94,9 @@ public class DistributeService implements IDistributeService{
public void statusInValid(List<Long> disIds) {
if(!CollectionUtils.isEmpty(disIds)){
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(disIds),"请选择要设置失效的权限数据");
RtsDistribute rd = new RtsDistribute();
RtsPermissionDistribute rd = new RtsPermissionDistribute();
rd.setStatus(PermissionDistributeStatusEnum.InValid.getValue());
RtsDistributeExample example = new RtsDistributeExample();
RtsPermissionDistributeExample example = new RtsPermissionDistributeExample();
example.createCriteria().andIdIn(disIds);
rtsDistributeDAO.updateByExampleSelective(rd,example);
}
@ -141,7 +139,7 @@ public class DistributeService implements IDistributeService{
}
private void checkDateTime(RtsDistribute permissionDistribute){
private void checkDateTime(RtsPermissionDistribute permissionDistribute){
final LocalDateTime now = LocalDateTime.now();
final LocalDateTime startTime = permissionDistribute.getStartTime();
@ -154,7 +152,7 @@ public class DistributeService implements IDistributeService{
@Transactional(rollbackFor = Exception.class)
public void subjectAcceptFromPermissionDistribute(Long pdId, PermissionSubjectTypeEnum subjectType, Long subjectId) {
// 校验分发
RtsDistribute permissionDistribute = this.rtsDistributeDAO.selectByPrimaryKey(pdId);
RtsPermissionDistribute permissionDistribute = this.rtsDistributeDAO.selectByPrimaryKey(pdId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(permissionDistribute), String.format("权限分发[id=%s]不存在", pdId));
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(PermissionDistributeStatusEnum.Valid.equals(PermissionDistributeStatusEnum.getItem(permissionDistribute.getStatus())), String.format("权限分发[id=%s]已失效", pdId));

View File

@ -3,7 +3,6 @@ package club.joylink.rtss.services.permission;
import club.joylink.rtss.dao.MapInfoDAO;
import club.joylink.rtss.dao.permission.*;
import club.joylink.rtss.entity.MapInfo;
import club.joylink.rtss.entity.MapInfoExample;
import club.joylink.rtss.entity.permission.*;
import club.joylink.rtss.services.IPermissionService;
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
@ -18,7 +17,6 @@ import club.joylink.rtss.vo.permission.PermissionTypeEnum;
import club.joylink.rtss.vo.permission.convertor.PermissionDistributeConvertor;
import club.joylink.rtss.vo.permission.distribute.DistributeDataVO;
import club.joylink.rtss.vo.permission.sync.UserPermissionVO;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@ -31,7 +29,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.BufferedWriter;
import java.io.File;
@ -49,7 +46,7 @@ public class OldPermissionDataSyncService {
@Autowired
private IPermissionService iPermissionService;
@Autowired
private RtsDistributeDAO rtsDistributeDAO;
private RtsPermissionDistributeDAO rtsDistributeDAO;
@Autowired
private RtsPermissionDistributeRefDAO distributeRefDAO;
@Autowired
@ -98,12 +95,12 @@ public class OldPermissionDataSyncService {
SYNC_RESULT_LIST.clear();
try{
truncateAllTable();
MapInfoExample example = new MapInfoExample();
/*MapInfoExample example = new MapInfoExample();
example.createCriteria().andStatusEqualTo("1" );
List<MapInfo> mapInfoList = this.mapInfoDAO.selectByExample(example);
for (MapInfo mapInfo : mapInfoList) {
this.generate(mapInfo);
}
}*/
this.abilityService.autoSynchMapSystemData(0L);
}catch (Exception e){
log.error("用户权限初始化失败 msg:" + e.getMessage(),e);
@ -199,26 +196,34 @@ public class OldPermissionDataSyncService {
if(existPermissSet.add(syncVO.getPermission().getId())){
this.acPermissionDAO.customerSyncInsert(syncVO.permission);
allSaList.addAll(syncVO.getSystemAbility());
// this.permissionSystemAbilityDAO.batchInsert(syncVO.getSystemAbility());
}
}
// List<PermissionSystemAbility> tmpList = syncVOList.stream().map(d->d.getSystemAbility()).flatMap(d->d.stream()).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(allSaList)){
this.permissionSystemAbilityDAO.batchInsert(allSaList);
this.permissionSystemAbilityDAO.batchInsert(allSaList);
}
}
private void insertDistribute(List<DistributeDataVO> distributeDataVOList){
List<RtsPermissionDistributeRef> allRefList = Lists.newArrayList();
List<RtsPermissionDistribute> disList = Lists.newArrayList();
for (DistributeDataVO dataVO : distributeDataVOList) {
RtsDistribute rd = PermissionDistributeConvertor.convertDistributeDataVoTo(dataVO,dataVO.getCreatorId());
RtsPermissionDistribute rd = PermissionDistributeConvertor.convertDistributeDataVoTo(dataVO,dataVO.getCreatorId());
rd.setIsSync(true);
this.rtsDistributeDAO.customerSyncInsert(rd);
disList.add(rd);
List<RtsPermissionDistributeRef> refList = PermissionDistributeConvertor.convertDistributeRefListTo(dataVO.getPermissionIds(),null);
for (RtsPermissionDistributeRef ref : refList) {
ref.setIsSync(true);
this.distributeRefDAO.insert(ref);
allRefList.add(ref);
}
}
if(!CollectionUtils.isEmpty(disList)){
rtsDistributeDAO.customerSyncBatchInsert(disList);
}
if(!CollectionUtils.isEmpty(allRefList)){
distributeRefDAO.batchInsert(allRefList);
}
}
private void insertUserPermission(List<PermissionSubject> psList){
@ -227,9 +232,7 @@ public class OldPermissionDataSyncService {
}
for (PermissionSubject ps : psList) {
ps.setIsSync(true);
// this.subjectDAO.insert(ps);
}
this.subjectDAO.batchInsert(psList);
}
@ -265,7 +268,6 @@ public class OldPermissionDataSyncService {
private List<SyncVO> findAllPermission(List<UserPermissionVO> userPermissionList,Map<Long,List<SystemAbility>> funMapIdMap){
List<UserPermissionVO> handleDataList = this.easyBeforehand(userPermissionList);
List<SyncVO> syncVOList = Lists.newArrayList();
// Set<Long> existPermissionIdSet = Sets.newHashSet();
Set<String> existPermissionIdSet = Sets.newHashSet();
for (UserPermissionVO permissionVO : handleDataList) {
List<SystemAbility> mapList = funMapIdMap.get(permissionVO.getMapId());
@ -365,17 +367,6 @@ public class OldPermissionDataSyncService {
for (UserPermissionVO userPermissionVO : packAgeVOList) {
List<Long> idLists = Splitter.on(",").omitEmptyStrings().trimResults().splitToStream(userPermissionVO.getRelPermissions()).map(Long::parseLong).collect(Collectors.toList());
idLists.remove(userPermissionVO.getPermissionId());
/* List<UserPermissionVO> userPermissionVOS = this.syncDAO.findPackageData(idLists);
for (UserPermissionVO vo : userPermissionVOS) {
vo.setStartTime(userPermissionVO.getStartTime());
vo.setEndTime(userPermissionVO.getEndTime());
vo.setUserId(userPermissionVO.getUserId());
vo.setForever(userPermissionVO.getForever());
vo.setAmount(userPermissionVO.getAmount());
vo.setRemains(userPermissionVO.getRemains());
}
voList.addAll(userPermissionVOS);*/
PermissionQueryVO queryVO = new PermissionQueryVO();
queryVO.setInIds(idLists);
List<PermissionVO> permissionVOList = this.iPermissionService.queryPermission(queryVO);

View File

@ -1,313 +0,0 @@
package club.joylink.rtss.services.permission;
import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.dao.SysAccountDAO;
import club.joylink.rtss.dao.permission.AcPermissionDAO;
import club.joylink.rtss.dao.permission.PermissionSubjectDAO;
import club.joylink.rtss.dao.permission.RtsPermissionDistributeDAO;
import club.joylink.rtss.entity.Org;
import club.joylink.rtss.entity.SysAccount;
import club.joylink.rtss.entity.permission.Permission;
import club.joylink.rtss.entity.permission.PermissionDistribute;
import club.joylink.rtss.entity.permission.PermissionDistributeExample;
import club.joylink.rtss.entity.permission.PermissionSubject;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.QRCodeManager;
import club.joylink.rtss.services.WxApiService;
import club.joylink.rtss.services.auth.IAuthenticateService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.permission.*;
import club.joylink.rtss.vo.permission.convertor.PermissionDistributeConvertor;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
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.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 权限分发业务
*/
@Deprecated
@Service("rts_permission_distribute_service")
public class PermissionDistributeService {
@Autowired
private RtsPermissionDistributeDAO permissionDistributeDAO;
@Autowired
private PermissionSubjectDAO permissionSubjectDAO;
@Autowired
private AcPermissionDAO permissionDAO;
@Autowired
private SysAccountDAO sysAccountDAO;
@Autowired
private OrgDAO orgDAO;
@Autowired
private QRCodeManager qrCodeManager;
@Autowired
private IAuthenticateService authenticateService;
/**
* 创建权限分发
*/
@Transactional(rollbackFor = Exception.class)
public CreatePermissionDistributeRspVo createPermissionDistribute(CreatePermissionDistributeReqVo req, AccountVO user) {
return this.createPermissionDistributeFromSource(null, req, user);
}
/**
* 从权限主体二次分发权限
*
* @param permissionSubjectId 权限主体id
*/
@Transactional(rollbackFor = Exception.class)
public CreatePermissionDistributeRspVo secondCreatePermissionDistribute(Long permissionSubjectId, CreatePermissionDistributeReqVo req, AccountVO user) {
return this.createPermissionDistributeFromSource(permissionSubjectId, req, user);
}
private CreatePermissionDistributeRspVo createPermissionDistributeFromSource(Long permissionSubjectId, CreatePermissionDistributeReqVo req, AccountVO user) {
//参数校验
if (!req.getForever()) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(null != req.getEndTime(), "当权限分发非永久有效时,结束时间不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(req.getEndTime().isAfter(req.getStartTime()), "结束时间须在开始时间后面");
}
//
final Permission permission = permissionDAO.selectByPrimaryKey(req.getPermissionId());
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != permission, String.format("权限分发的权限[id = %s]不存在", req.getPermissionId()));
//
PermissionDistribute pd = new PermissionDistribute();
pd.setPermissionId(req.getPermissionId());
pd.setAmount(req.getAmount());
pd.setRemains(req.getAmount());
pd.setForever(req.getForever());
pd.setStatus(PermissionDistributeStatusEnum.Valid.getValue());
pd.setCreateTime(LocalDateTime.now());
pd.setUpdateTime(LocalDateTime.now());
pd.setStartTime(req.getStartTime());
pd.setEndTime(req.getEndTime());
pd.setCreatorId(user.getId());
pd.setDsc(req.getDsc());
//
PermissionSubject permissionSubject = null;
if (null != permissionSubjectId) {//当从权限主体创建权限分发时
permissionSubject = this.permissionSubjectDAO.selectByPrimaryKey(permissionSubjectId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != permissionSubject, String.format("权限分发的权限主体[id = %s]不存在", permissionSubjectId));
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(req.getAmount() <= permissionSubject.getRemains(), String.format("权限二次分发,权限主体[id=%s]中剩余权限数量不足", permissionSubjectId));
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(PermissionSubjectStatusEnum.Valid.getValue().equals(permissionSubject.getStatus()), String.format("权限二次分发,权限主体[id=%s]失效", permissionSubjectId));
final boolean isForever = permissionSubject.getForever();
final LocalDateTime now = LocalDateTime.now();
final LocalDateTime startTime = permissionSubject.getStartTime();
final LocalDateTime endTime = permissionSubject.getEndTime();
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(isForever ? now.isAfter(startTime) : now.isAfter(startTime) && now.isBefore(endTime), String.format("权限二次分发,权限主体[id=%s]不在有效期内", permissionSubjectId));
//
pd.setSourceSubjectId(permissionSubjectId);
}
//
this.permissionDistributeDAO.insertSelective(pd);
//
if (null != permissionSubject) {//当从权限主体创建权限分发时,权限主体减去分发的
PermissionSubject updateSubject = new PermissionSubject();
updateSubject.setId(permissionSubject.getId());
updateSubject.setRemains(permissionSubject.getRemains()-pd.getAmount());
this.permissionSubjectDAO.updateByPrimaryKeySelective(updateSubject);
}
//
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != pd.getId(), "permissionDistributeDAO insert 未生成id返回");
CreatePermissionDistributeRspVo rsp = new CreatePermissionDistributeRspVo();
rsp.setPdId(pd.getId());
rsp.setPermissionId(pd.getPermissionId());
return rsp;
}
/**
* 分页获取权限分发列表
*/
@Transactional(readOnly = true)
public PageVO<PermissionDistributeRspVo> findPermissionDistributeByPage(FindPermissionDistributeByPageReqVo req) {
//查询条件
final PermissionDistributeExample example = new PermissionDistributeExample();
final PermissionDistributeExample.Criteria c = example.createCriteria();
if (null != req.getStatus()) {
c.andStatusEqualTo(req.getStatus().getValue());
}
if (null != req.getPermissionId()) {
c.andPermissionIdEqualTo(req.getPermissionId());
}
if (null != req.getDsc()) {
if (req.getDscLike()) {
c.andDscLike(String.format("%%%s%%", req.getDsc()));
} else {
c.andDscEqualTo(req.getDsc());
}
}
//排序
final String orderBy = req.getOrderByType().with(req.getDesc());
//分页查询
PageHelper.clearPage();
PageHelper.startPage(req.getPageNum(), req.getPageSize(), orderBy);
final Page<PermissionDistribute> sqlPage = (Page<PermissionDistribute>) this.permissionDistributeDAO.selectByExample(example);
//
List<PermissionDistributeRspVo> rtList = new ArrayList<>();
if (!CollectionUtils.isEmpty(sqlPage.getResult())) {
rtList = sqlPage.getResult().stream().map(PermissionDistributeConvertor::convertPermissionDistributeRspVoFrom).collect(Collectors.toList());
}
rtList.forEach(pd -> {
pd.fill(this.sysAccountDAO.selectByPrimaryKey(pd.getCreatorId()));
pd.fill(this.permissionDAO.selectByPrimaryKey(pd.getPermissionId()));
});
//
return PageVO.convert(sqlPage, rtList);
}
/**
* 设置权限分发立即失效
*
* @param pdId 权限分发id
*/
@Transactional(rollbackFor = Exception.class)
public void invalidatePermissionDistributeImmediately(Long pdId) {
PermissionDistribute permissionDistribute = this.permissionDistributeDAO.selectByPrimaryKey(pdId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != permissionDistribute, String.format("权限分发[id=%s]不存在", pdId));
PermissionDistribute invalid = new PermissionDistribute();
invalid.setId(pdId);
invalid.setStatus(PermissionDistributeStatusEnum.InValid.getValue());
this.permissionDistributeDAO.updateByPrimaryKeySelective(invalid);
}
/**
* 主体从权限分发获取权限
*
* @return 返回权限主体id
*/
@Transactional(rollbackFor = Exception.class)
public Long subjectAcceptFromPermissionDistribute(Long pdId, PermissionSubjectTypeEnum subjectType, Long subjectId) {
// 校验分发
PermissionDistribute permissionDistribute = this.permissionDistributeDAO.selectByPrimaryKey(pdId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != permissionDistribute, String.format("权限分发[id=%s]不存在", pdId));
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(PermissionDistributeStatusEnum.Valid.equals(PermissionDistributeStatusEnum.getItem(permissionDistribute.getStatus())), String.format("权限分发[id=%s]已失效", pdId));
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(permissionDistribute.getRemains() > 0, String.format("权限分发[id=%s]剩余权限数量不足", pdId));
final LocalDateTime now = LocalDateTime.now();
final LocalDateTime startTime = permissionDistribute.getStartTime();
final LocalDateTime endTime = permissionDistribute.getEndTime();
final boolean isForever = permissionDistribute.getForever();
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(isForever ? now.isAfter(startTime) : now.isAfter(startTime) && now.isBefore(endTime), String.format("当前时间不在权限分发[id=%s]有效时间内", pdId));
// 校验权限
Permission permission = this.permissionDAO.selectByPrimaryKey(permissionDistribute.getPermissionId());
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != permission, String.format("权限分发[id=%s]的权限[id=%s]不存在", pdId, permissionDistribute.getPermissionId()));
// 校验主体
Serializable subject = null;
switch (subjectType) {
case org: {
subject = this.orgDAO.selectByPrimaryKey(subjectId);
}
;
break;
case user: {
subject = this.sysAccountDAO.selectByPrimaryKey(subjectId);
}
;
break;
default:
}
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != subject, String.format("权限分发[id=%s]的主体[type=%s id=%s]不存在", pdId, subjectType.name(), subjectId));
//分发权限到主体
PermissionSubject permissionSubject = new PermissionSubject();
permissionSubject.setPermissionId(permissionDistribute.getPermissionId());
permissionSubject.setSubjectType(subjectType.name());
permissionSubject.setSubjectId(subjectId);
permissionSubject.setAmount(permissionDistribute.getRemains());
permissionSubject.setRemains(permissionSubject.getAmount());
permissionSubject.setStatus(PermissionSubjectStatusEnum.Valid.getValue());
permissionSubject.setForever(permissionDistribute.getForever());
permissionSubject.setStartTime(permissionDistribute.getStartTime());
permissionSubject.setEndTime(permissionDistribute.getEndTime());
permissionSubject.setDistributeId(permissionDistribute.getId());
permissionSubject.setCreateTime(LocalDateTime.now());
permissionSubject.setParentId(permissionDistribute.getSourceSubjectId());
this.permissionSubjectDAO.insertSelective(permissionSubject);
final Long permissionSubjectId = permissionSubject.getId();
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != permissionSubjectId, "permissionSubjectDAO insert 未返回id");
// 从权限分发减掉已经分发的并修改权限分发状态
PermissionDistribute updateDistribute = new PermissionDistribute();
updateDistribute.setId(permissionDistribute.getId());
updateDistribute.setRemains(permissionDistribute.getRemains() - permissionSubject.getAmount());
this.permissionDistributeDAO.updateByPrimaryKeySelective(updateDistribute);
//
return permissionSubjectId;
}
/**
* 生成权限分发二维码
*
* @param pdId 权限分发id
*/
public String generateQrCode(Long pdId, LoginUserInfoVO loginInfo) {
return qrCodeManager.getDistributeCode(pdId, loginInfo.getProject());
}
/**
* 微信扫码获取权限分发相关信息
*
* @param code 用户编码
* @param id 权限分发id
*/
@Transactional(readOnly = true)
public ScanPermissionDistributeInfoRspVo scanPermissionDistributeInfo(String code, Long id) {
AccountVO accountVO = this.authenticateService.getOrCreateUserByWmcode(WxApiService.MiniApp.JoyLink, code);
PermissionDistribute permissionDistribute = this.permissionDistributeDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != permissionDistribute, String.format("权限分发[id=%s]不存在", id));
Permission permission = this.permissionDAO.selectByPrimaryKey(permissionDistribute.getPermissionId());
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != permission, String.format("权限分发[id=%s]的权限[id=%s]不存在", id, permissionDistribute.getPermissionId()));
//
SysAccount creator = this.sysAccountDAO.selectByPrimaryKey(permissionDistribute.getCreatorId());
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != creator);
SysAccount scanner = this.sysAccountDAO.selectByPrimaryKey(accountVO.getId());
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != scanner);
//
ScanPermissionDistributeInfoRspVo rsp = new ScanPermissionDistributeInfoRspVo();
rsp.fill(permissionDistribute);
rsp.fillPermission(permission);
rsp.fillCreator(creator);
rsp.fillScanner(scanner);
//
if (null != permissionDistribute.getSourceSubjectId()) {
PermissionSubject permissionSubject = this.permissionSubjectDAO.selectByPrimaryKey(permissionDistribute.getSourceSubjectId());
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != permissionSubject);
switch (PermissionSubjectTypeEnum.valueOf(permissionSubject.getSubjectType())) {
case user: {
SysAccount subject = this.sysAccountDAO.selectByPrimaryKey(permissionSubject.getSubjectId());
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != subject);
rsp.fillSourceSubject(permissionSubject).fill(subject);
}
;
break;
case org: {
Org subject = this.orgDAO.selectByPrimaryKey(permissionSubject.getSubjectId());
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(null != subject);
rsp.fillSourceSubject(permissionSubject).fill(subject);
}
;
break;
}
}
return rsp;
}
@Transactional(rollbackFor = Exception.class)
public void updateStatusBySourceSubjectId(List<Long> ids,PermissionDistributeStatusEnum se){
if(CollectionUtils.isEmpty(ids)){
return;
}
PermissionDistributeExample example = new PermissionDistributeExample();
example.createCriteria().andSourceSubjectIdIn(ids);
PermissionDistribute pd = new PermissionDistribute();
pd.setStatus(se.getValue());
this.permissionDistributeDAO.updateByExampleSelective(pd,example);
}
}

View File

@ -100,9 +100,13 @@ public class Training2DraftService {
return rsp;
}
private boolean isExistDraft(Long userId, String draftName) {
private boolean isExistDraft(Long userId, Long mapId, Long trainingId, String draftName) {
DraftTraining2Example example = new DraftTraining2Example();
example.createCriteria().andCreatorIdEqualTo(userId).andNameEqualTo(draftName);
DraftTraining2Example.Criteria criteria =example.createCriteria().andCreatorIdEqualTo(userId)
.andMapIdEqualTo(mapId).andNameEqualTo(draftName);
if (trainingId != null) {
criteria.andIdNotEqualTo(trainingId);
}
List<DraftTraining2> find = this.trainingDao.selectByExample(example);
return null != find && !find.isEmpty();
}
@ -209,13 +213,8 @@ public class Training2DraftService {
example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId());
List<DraftTraining2> find = this.trainingDao.selectByExample(example);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), "实训草稿不存在");
//
if (null != req.getName()) {
DraftTraining2 the = find.get(0);
if (!req.getName().equals(the.getName())) {//草稿名称变了
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(this.isExistDraft(userId, req.getName()), "名称为 [" + req.getName() + "] 的草稿已经存在");
}
}
boolean isExist = this.isExistDraft(userId, find.get(0).getMapId(), req.getId(), req.getName());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(isExist, "名称为 [" + req.getName() + "] 的草稿已经存在");
//
DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs();
//

View File

@ -4,6 +4,9 @@ import club.joylink.rtss.dao.PublishedTraining2DAO;
import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.exception.BusinessException;
import club.joylink.rtss.exception.BusinessExceptionAssert;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.training2.publish.*;
import com.github.pagehelper.Page;
@ -160,33 +163,31 @@ public class Training2PublishService {
}
/**
* 根据mapId查找所有的单操实训的基础信息
* 根据mapId查所有的已发布单操或场景实训的基础信息
*
*/
@Transactional(readOnly = true)
public List<PublishedTraining2InfoRspVo> findAllSingleTrainingBasicInfoByMapId(Long mapId) {
return findTrainingInfo(mapId, Training2TypeEnum.single);
public List<PublishedTraining2InfoRspVo> findAllTrainingBasicInfoByMapIdAndType(PublishedTrainingListRspVo vo){
BusinessExceptionAssertEnum.DATA_INVALID.assertTrue(Objects.nonNull(vo.getMapId()),"请选择对应的地图");
BusinessExceptionAssertEnum.DATA_INVALID.assertTrue(Objects.nonNull(vo.getType()),"请选择对应的类型");
return findTrainingInfo(vo);
}
/**
* 根据mapId查找所有的场景实训的基础信息
*/
@Transactional(readOnly = true)
public List<PublishedTraining2InfoRspVo> findAllSceneTrainingBasicInfoByMapId(Long mapId) {
return findTrainingInfo(mapId, Training2TypeEnum.scene);
}
/**
* 根据地图ID和类型查询实训列表
*/
public List<PublishedTraining2InfoRspVo> findTrainingInfo(Long mapId, Training2TypeEnum type) {
public List<PublishedTraining2InfoRspVo> findTrainingInfo(PublishedTrainingListRspVo reqVO) {
PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria criteria = example.createCriteria();
if (mapId != null) {
criteria.andMapIdEqualTo(mapId);
if (reqVO.getMapId() != null) {
criteria.andMapIdEqualTo(reqVO.getMapId());
}
if (type != null) {
criteria.andTypeEqualTo(type.value());
if (reqVO.getType() != null) {
criteria.andTypeEqualTo(reqVO.getType().value());
}
if(StringUtils.hasText(reqVO.getName())){
criteria.andNameLike(String.format("%%%s%%", reqVO.getName()));
}
List<PublishedTraining2> list = this.publishedDao.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {

View File

@ -68,16 +68,18 @@ public class Training2RuleService {
publishedTraining2Example.createCriteria().andMapIdEqualTo(mapId).andCreatorIdEqualTo(0L);
publishedTraining2DAO.deleteByExample(publishedTraining2Example);
// 生成新数据
ruleList.forEach(rule -> {
for (RtsTraining2RuleWithBLOBs rule : ruleList) {
Training2Rule training2Rule = new Training2Rule(rule);
List<MapNamedElement> deviceList = training2Rule.getDeviceRule().filterMapDeviceList(simulation);
List<PublishedTraining2WithBLOBs> training2WithBLOBs = deviceList.stream().map(device -> {
List<PublishedTraining2WithBLOBs> training2WithBLOBs = new ArrayList<>(deviceList.size());
for (MapNamedElement device : deviceList) {
simulation.reset();
return training2Rule.convert2BO(simulation, device);
}).collect(Collectors.toList());
simulation.getRepository().vrDeviceReset();
training2WithBLOBs.add(training2Rule.convert2BO(simulation, device));
}
// 新数据入库
publishedTraining2DAO.insertList(training2WithBLOBs);
});
}
}
}
} finally {

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.simulation.cbtc.vo;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.training2.Training2;
import lombok.*;
import org.springframework.util.CollectionUtils;
@ -98,6 +99,8 @@ public class SimulationWorkParamVO {
private boolean hasTraining;
private Training2.Type trainingType;
private boolean hasExam;
private boolean trainingDesign;
@ -106,6 +109,9 @@ public class SimulationWorkParamVO {
private boolean hasVoice;
/**
* 是综合演练目前仅决定了是否显示生成仿真二维码
*/
private boolean isJoint;
private boolean hasDeviceManager;

View File

@ -28,7 +28,7 @@ public enum FindPcType {
/**
* 已经被使用过
*/
Used(5),
// Used(5),
;
private Integer state;
@ -56,15 +56,15 @@ public enum FindPcType {
case All: {
list.add(PaperCompositionState.Editing);
list.add(PaperCompositionState.Locked);
list.add(PaperCompositionState.Used);
list.add(PaperCompositionState.Invalid);
}
break;
case Used:
list.add(PaperCompositionState.Used);
break;
/* case Used:
list.add(PaperCompositionState.Locked);
break;*/
case CanUse: {
list.add(PaperCompositionState.Locked);
list.add(PaperCompositionState.Used);
// list.add(PaperCompositionState.Used);
}
break;
case Locked:

View File

@ -7,21 +7,22 @@ import java.util.HashMap;
import java.util.Map;
/**
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3- 失效只能从封存状态变更只能查看,当PaperComposition - update_id 为null 说明是同步失效的数据
*/
public enum PaperCompositionState {
/**
* 1-正在编辑
* 1-正在编辑[查询修改删除]
*/
Editing(1),
/**
* 2-封存(不能修改)
* 2-封存(只能查看)
*/
Locked(2),
/**
* 3-已经被使用(不能修改删除)
* 3- 失效只能从封存状态变更只能查看
*/
Used(3),
Invalid(3),
;
private Integer state;

View File

@ -83,7 +83,7 @@ public class PaperCompositionWithRuleVo {
private LocalDateTime updateTime;
/**
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3- 失效只能从封存状态变更只能查看,当PaperComposition - update_id 为null 说明是同步失效的数据
*/
private PaperCompositionState state;

View File

@ -2,7 +2,7 @@ package club.joylink.rtss.vo.permission.convertor;
import club.joylink.rtss.entity.permission.PermissionDistribute;
import club.joylink.rtss.entity.permission.PermissionSubject;
import club.joylink.rtss.entity.permission.RtsDistribute;
import club.joylink.rtss.entity.permission.RtsPermissionDistribute;
import club.joylink.rtss.entity.permission.RtsPermissionDistributeRef;
import club.joylink.rtss.vo.permission.PermissionDistributeRspVo;
import club.joylink.rtss.vo.permission.PermissionDistributeStatusEnum;
@ -36,8 +36,8 @@ public class PermissionDistributeConvertor {
return rt;
}
public static RtsDistribute convertDistributeDataVoTo(DistributeDataVO dataVO){
RtsDistribute dis = new RtsDistribute();
public static RtsPermissionDistribute convertDistributeDataVoTo(DistributeDataVO dataVO){
RtsPermissionDistribute dis = new RtsPermissionDistribute();
dis.setMapId(dataVO.getMapId());
dis.setForever(dataVO.getForever());
dis.setStartTime(dataVO.getStartTime());
@ -47,8 +47,8 @@ public class PermissionDistributeConvertor {
dis.setUpdateTime(dataVO.getUpdateTime());
return dis;
}
public static RtsDistribute convertDistributeDataVoTo(DistributeDataVO dataVO,Long creatorId){
RtsDistribute dis = new RtsDistribute();
public static RtsPermissionDistribute convertDistributeDataVoTo(DistributeDataVO dataVO,Long creatorId){
RtsPermissionDistribute dis = new RtsPermissionDistribute();
dis.setId(dataVO.getId());
dis.setMapId(dataVO.getMapId());
dis.setForever(dataVO.getForever());
@ -81,7 +81,7 @@ public class PermissionDistributeConvertor {
}
return refList;
}
public static PermissionSubject convertorDistributeVOTOSubject(DistributeDataVO.DistributePermissionVO dp, PermissionSubjectTypeEnum subjectType, RtsDistribute permissionDistribute, Long subjectId){
public static PermissionSubject convertorDistributeVOTOSubject(DistributeDataVO.DistributePermissionVO dp, PermissionSubjectTypeEnum subjectType, RtsPermissionDistribute permissionDistribute, Long subjectId){
PermissionSubject permissionSubject = new PermissionSubject();
permissionSubject.setPermissionId(dp.getPermissionId());
permissionSubject.setSubjectType(subjectType.name());

View File

@ -0,0 +1,20 @@
package club.joylink.rtss.vo.training2.publish;
import club.joylink.rtss.services.training2.Training2TypeEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
/**
* 已发布实训的所有信息
*/
@Data
public class PublishedTrainingListRspVo {
private Long mapId;
private Training2TypeEnum type;
private String name;
}

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.vo.training2.rule;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.Simulation;
@ -26,6 +27,7 @@ import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Getter
public enum BgSceneStatusRule {
@ -33,6 +35,14 @@ public enum BgSceneStatusRule {
/**
* 设置进路背景blockade
*/
ROUTE_SET_BG_SCENE("排列进路背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
Route route = (Route) mapElement;
route.getSwitchList().forEach(switchElement -> switchElement.getASwitch().setSingleLock(false));
return getBgScene(simulation);
}
},
ROUTE_CANCEL_BG_SCENE("取消进路背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
@ -89,6 +99,14 @@ public enum BgSceneStatusRule {
/**
* 道岔单解背景将道岔设置为封锁
*/
SWITCH_SINGLE_BLOCK_BG_SCENE("道岔单锁背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
Switch iSwitch = (Switch) mapElement;
iSwitch.setSingleLock(false);
return getBgScene(simulation);
}
},
SWITCH_SINGLE_UNBLOCK_BG_SCENE("道岔单解背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
@ -218,6 +236,41 @@ public enum BgSceneStatusRule {
return getBgScene(simulation);
}
},
SIGNAL_ROUTE_CANCEL_AUTO_SET_BG_SCENE("取消联锁自动触发背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
Signal signal = (Signal) mapElement;
Route route = signal.getRouteList().get(0);
route.setCiControl(true);
return getBgScene(simulation);
}
},
SIGNAL_SET_CI_AUTO_BG_SCENE("联锁自动进路背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
Signal signal = (Signal) mapElement;
List<Route> fltRouteList = signal.getRouteList().stream().filter(Route::isFlt).collect(Collectors.toList());
boolean isSetFlt = simulation.getRepository().getConfig().isSetRouteBeforeSetFlt();
for (Route route : fltRouteList) {
if (isSetFlt) {
openRouteDirect(simulation, route);
}
}
return getBgScene(simulation);
}
},
SIGNAL_CANCEL_SET_CI_AUTO_BG_SCENE("取消联锁自动进路背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
Signal signal = (Signal) mapElement;
List<Route> fltRouteList = signal.getRouteList().stream().filter(Route::isFlt).collect(Collectors.toList());
fltRouteList.forEach(route -> {
openRouteDirect(simulation, route);
route.setFleetMode(true);
});
return getBgScene(simulation);
}
},
/**
* 区段区故解背景
*/
@ -338,6 +391,47 @@ public enum BgSceneStatusRule {
return getBgScene(simulation);
}
},
STATION_OPEN_AUTO_SETTING_BG_SCENE("全站进路交ATS自动控背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
Station station = (Station) mapElement;
if(!station.isInterlock()) {
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
}
if (BusinessConsts.MapPrd.PrdType.Type01.equals(simulation.getBuildParams().getProdType())) {
if(station.isCentralized()) {
station.setControlMode(Station.ControlMode.Local);
}else{
station.getDeviceStation().setControlMode(Station.ControlMode.Local);
}
}
List<Route> routeList3 = simulation.getRepository().getRouteList();
for (Route route : routeList3) {
if (Objects.equals(route.getInterlockStation(), station)) {
if (route.isAtsControl()) {
route.setAtsControl(false);
}
}
}
return getBgScene(simulation);
}
},
STATION_CENTER_CONTROL_BG_SCENE ("车站设置中控背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
Station station = (Station) mapElement;
station.setControlMode(Station.ControlMode.Local);
return getBgScene(simulation);
}
},
STATION_STATION_CONTROL_BG_SCENE("车站转为站控背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
Station station = (Station) mapElement;
station.setControlMode(Station.ControlMode.Center);
return getBgScene(simulation);
}
},
STAND_EARLY_DEPART_BG_SCENE("提前发车背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
@ -379,15 +473,22 @@ public enum BgSceneStatusRule {
return getBgScene(simulation);
}
},
STAND_CANCEL_JUMP_STOP_BG_SCENE("站台取消设置跳停") {
STAND_CANCEL_JUMP_STOP_BG_SCENE("站台取消设置跳停背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
Stand stand = (Stand) mapElement;
stand.setAllSkip(true);
return getBgScene(simulation);
}
},
STAND_STRATEGY_BG_SCENE("人工折返策略设置背景") {
@Override
public String doHandle(Simulation simulation, MapElement mapElement) {
Stand stand = (Stand) mapElement;
stand.setTypeStrategy(Stand.TurnBackType.AUTO);
return getBgScene(simulation);
}
}
;
/**

View File

@ -4,9 +4,11 @@ import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
import lombok.Getter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
import java.util.function.Function;
@ -18,39 +20,85 @@ public enum MapDeviceRule {
@Override
public List<Station> filterMapDeviceList(Simulation simulation) {
List<Station> stationList = simulation.getBuildParams().getMap().getGraphDataNew().getStationList()
.stream().filter(s -> s.isVisible() && s.isCentralized() && s.isCiStation()).map(MapStationNewVO::getCode)
.stream().filter(s -> s.isVisible() && s.isCentralized() && s.isCiStation() && !s.isDepot())
.sorted(Comparator.comparing(MapStationNewVO::getSn))
.map(MapStationNewVO::getCode)
.map(code -> simulation.getRepository().getByCode(code, Station.class))
.collect(Collectors.toList());
return generateRandomElement(stationList, 1);
return generateRandomElement(stationList, NUMBER);
}
},
STAND_LIST("站台列表"){
@Override
public List<Stand> filterMapDeviceList(Simulation simulation) {
List<Station> stationList = STATION_LIST.filterMapDeviceList(simulation);
Station station = stationList.get(0);
return MapDeviceRule.generateRandomElement(station.getAllStandList(), 2);
// 车站列表
List<Station> stationList = simulation.getRepository().getStationList().stream()
.filter(station -> !station.isDepot()).sorted(Comparator.comparingInt(Station::getSn))
.collect(Collectors.toList());
Station firstStation = stationList.get(0);
Station lastStation = stationList.get(stationList.size() - 1);
List<Stand> standList = simulation.getRepository().getStandList().stream().filter(stand -> {
if (stand.getStation() != null && stand.getStation().isDepot())
return false;
// 去除第一个与最后一个站的站台
if (firstStation.equals(stand.getStation()) || lastStation.equals(stand.getStation())) {
return false;
}
if (!stand.isVisible() || !stand.hasDoor() || stand.isSmall()) { // 特殊站台
return false;
}
return true;
}).sorted(Comparator.comparingInt(stand -> stand.getStation().getSn())).collect(Collectors.toList());
return MapDeviceRule.generateRandomElement(standList, NUMBER);
}
},
ROUTE_LIST("进路列表") {
@Override
public List<Route> filterMapDeviceList(Simulation simulation) {
List<Station> stationList = STATION_LIST.filterMapDeviceList(simulation);
Station station = stationList.get(0);
List<Route> routeList = new ArrayList<>();
station.getAllStandList().stream().filter(stand -> stand.getSection().getSignalToRight() != null)
.forEach(stand -> routeList.addAll(stand.getSection().getSignalToRight().getRouteList()));
return generateRandomElement(routeList, 2);
boolean railway = simulation.getRepository().getConfig().isRailway();
List<Route> routeList = simulation.getRepository().getRouteList().stream().filter(route -> {
if (route.getStart() == null || route.getStart().isVirtual()) {
return false;
}
if (route.getStart().getStation()!= null && route.getStart().getStation().isDepot()) {
return false;
}
if (route.getStart().getDeviceStation()!= null && route.getStart().getDeviceStation().isDepot()) {
return false;
}
if (route.isGuide()) { // 引导进路跳过
return false;
}
// 排除道岔默认单锁的进路
if (route.getSwitchList().stream().anyMatch(switchElement -> switchElement.getASwitch().isSingleLock())) {
return false;
}
if (railway) {
if (route.isPassRoute() || route.isLongShuntingRoute() ||
!(Route.Type.RECEIVING.equals(route.getType()) || Route.Type.DEPARTURE.equals(route.getType()))) {
return false;
}
}
return true;
}).collect(Collectors.toList());
return generateRandomElement(routeList, NUMBER);
}
},
SWITCH_LIST("道岔列表") {
@Override
public List<Switch> filterMapDeviceList(Simulation simulation) {
List<Station> stationList = STATION_LIST.filterMapDeviceList(simulation);
Station station = stationList.get(0);
List<Switch> switchList = simulation.getRepository().getSwitchList().stream()
.filter(aSwitch -> station.equals(aSwitch.getDeviceStation())).collect(Collectors.toList());
return generateRandomElement(switchList, 2);
.filter(aSwitch -> {
if (aSwitch.getDeviceStation() != null && aSwitch.getDeviceStation().isDepot())
return false;
if (aSwitch.isSingleLock()) {
return false;
}
aSwitch.setSingleLock(false);
return true;
}).collect(Collectors.toList());
return generateRandomElement(switchList, 1);
}
},
SIGNAL_LIST("信号机列表") {
@ -61,42 +109,69 @@ public enum MapDeviceRule {
List<Signal> signalList = new ArrayList<>();
station.getAllStandList().stream().filter(stand -> stand.getSection().getSignalToRight() != null)
.forEach(stand -> signalList.add(stand.getSection().getSignalToRight()));
return generateRandomElement(signalList, 2);
return generateRandomElement(signalList, NUMBER);
}
},
SIGNAL_CI_AUTO_LIST("联锁自动触发信号机列表") {
@Override
public List<Signal> filterMapDeviceList(Simulation simulation) {
List<Signal> signalList = simulation.getRepository().getRouteList().stream().filter(route -> {
if (route.getStart() == null || route.getStart().isVirtual()
|| (route.getStart().getStation() != null && route.getStart().getStation().isDepot())) {
return false;
}
if (route.isArs() || route.isGuide()) {
return false;
}
return true;
}).map(route -> route.getStart()).distinct().collect(Collectors.toList());
return MapDeviceRule.generateRandomElement(signalList, NUMBER);
}
},
SECTION_LIST("区段列表") {
@Override
public List<Section> filterMapDeviceList(Simulation simulation) {
List<Section> sectionList = querySectionListByFunction(simulation, Section::isAxleCounterSection);
return generateRandomElement(sectionList, 2);
return generateRandomElement(sectionList, 1);
}
},
SECTION_LOGIC_LIST("逻辑区段列表") {
@Override
public List<Section> filterMapDeviceList(Simulation simulation) {
List<Section> sectionList = querySectionListByFunction(simulation, Section::isLogicSection);
return generateRandomElement(sectionList, 2);
return generateRandomElement(sectionList, NUMBER);
}
},
SECTION_PHYSICAL_LIST("物理区段列表") {
@Override
public List<Section> filterMapDeviceList(Simulation simulation) {
List<Section> sectionList = querySectionListByFunction(simulation, Section::isAxleCounterSection);
return generateRandomElement(sectionList, 2);
return generateRandomElement(sectionList, NUMBER);
}
},
SECTION_AXLE_COUNTER_LIST("道岔计轴区段列表") {
@Override
public List<Section> filterMapDeviceList(Simulation simulation) {
List<Section> sectionList = querySectionListByFunction(simulation, Section::isSwitchAxleCounterSection);
return generateRandomElement(sectionList, 2);
List<Section> sectionList = querySectionListByFunction(simulation,
(section) -> section.isAxleCounter() && !section.isSwitchAxleCounterSection());
return generateRandomElement(sectionList, NUMBER);
}
},
CONTROL_STATION_LIST("控制模式的车站列表") {
@Override
public List<Station> filterMapDeviceList(Simulation simulation) {
//找到所有有控制模式的车站
List<Station> stationList = simulation.getRepository().getStationList().stream()
.filter(Station::isHasControlMode).collect(Collectors.toList());
return MapDeviceRule.generateRandomElement(stationList, NUMBER);
}
}
;
private String description;
private static final int NUMBER = 1;
MapDeviceRule(String description) {
this.description = description;
}

View File

@ -113,14 +113,35 @@ public enum PropertyValueRule {
return buttonVO.getCode();
}
},
SIGNAL_FIRST_ROUTE_CODE_LIST("信号机关联的第一条进路编码列表") {
SIGNAL_FIRST_ROUTE_CODE_LIST("信号机关联的进路编码列表") {
@Override
public Object resolve(Simulation simulation, Object mapElement) {
Signal signal = (Signal) mapElement;
Route route = signal.getRouteList().get(0);
return List.of(route.getCode());
}
}
},
SIGNAL_FIRST_ROUTE_NAME("信号机关联的进路名称") {
@Override
public Object resolve(Simulation simulation, Object mapElement) {
Signal signal = (Signal) mapElement;
Route route = signal.getRouteList().get(0);
return route.getName();
}
},
CENTER_CONTROL_STATION_CODE_LIST("站控转中控时车站列表") {
@Override
public Object resolve(Simulation simulation, Object mapElement) {
Station station = (Station) mapElement;
return List.of(station.getCode());
}
},
CENTER_CONTROL_STATION_NAME("站控转中控时车站名称") {
@Override
public Object resolve(Simulation simulation, Object mapElement) {
return ((Station) mapElement).getName();
}
},
;
private final String description;

View File

@ -12,6 +12,7 @@
<result column="valid_duration" jdbcType="INTEGER" property="validDuration" />
<result column="pass_score" jdbcType="INTEGER" property="passScore" />
<result column="full_score" jdbcType="INTEGER" property="fullScore" />
<result column="update_id" jdbcType="BIGINT" property="updateId" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
@ -77,7 +78,7 @@
</sql>
<sql id="Base_Column_List">
id, `name`, profile, map_id, org_id, start_time, end_time, valid_duration, pass_score,
full_score, creator_id, create_time, update_time, `state`
full_score, update_id, creator_id, create_time, update_time, `state`
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperCompositionExample" resultMap="BaseResultMap">
select
@ -121,13 +122,15 @@
insert into rts_paper_composition (id, `name`, profile,
map_id, org_id, start_time,
end_time, valid_duration, pass_score,
full_score, creator_id, create_time,
update_time, `state`)
full_score, update_id, creator_id,
create_time, update_time, `state`
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR},
#{mapId,jdbcType=BIGINT}, #{orgId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP}, #{validDuration,jdbcType=INTEGER}, #{passScore,jdbcType=INTEGER},
#{fullScore,jdbcType=INTEGER}, #{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER})
#{fullScore,jdbcType=INTEGER}, #{updateId,jdbcType=BIGINT}, #{creatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.PaperComposition">
insert into rts_paper_composition
@ -162,6 +165,9 @@
<if test="fullScore != null">
full_score,
</if>
<if test="updateId != null">
update_id,
</if>
<if test="creatorId != null">
creator_id,
</if>
@ -206,6 +212,9 @@
<if test="fullScore != null">
#{fullScore,jdbcType=INTEGER},
</if>
<if test="updateId != null">
#{updateId,jdbcType=BIGINT},
</if>
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
@ -259,6 +268,9 @@
<if test="record.fullScore != null">
full_score = #{record.fullScore,jdbcType=INTEGER},
</if>
<if test="record.updateId != null">
update_id = #{record.updateId,jdbcType=BIGINT},
</if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=BIGINT},
</if>
@ -288,6 +300,7 @@
valid_duration = #{record.validDuration,jdbcType=INTEGER},
pass_score = #{record.passScore,jdbcType=INTEGER},
full_score = #{record.fullScore,jdbcType=INTEGER},
update_id = #{record.updateId,jdbcType=BIGINT},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
@ -326,6 +339,9 @@
<if test="fullScore != null">
full_score = #{fullScore,jdbcType=INTEGER},
</if>
<if test="updateId != null">
update_id = #{updateId,jdbcType=BIGINT},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
@ -352,6 +368,7 @@
valid_duration = #{validDuration,jdbcType=INTEGER},
pass_score = #{passScore,jdbcType=INTEGER},
full_score = #{fullScore,jdbcType=INTEGER},
update_id = #{updateId,jdbcType=BIGINT},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},

View File

@ -1,323 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.permission.RtsDistributeDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.permission.RtsDistribute">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="source_subject_id" jdbcType="BIGINT" property="sourceSubjectId" />
<result column="forever" jdbcType="BIT" property="forever" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="dsc" jdbcType="VARCHAR" property="dsc" />
<result column="is_sync" jdbcType="BIT" property="isSync" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, map_id, source_subject_id, forever, `status`, create_time, update_time, start_time,
end_time, creator_id, dsc, is_sync
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.permission.RtsDistributeExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from rts_distribute
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from rts_distribute
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from rts_distribute
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.permission.RtsDistributeExample">
delete from rts_distribute
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.permission.RtsDistribute" useGeneratedKeys="true">
insert into rts_distribute (map_id, source_subject_id, forever,
`status`, create_time, update_time,
start_time, end_time, creator_id,
dsc, is_sync)
values (#{mapId,jdbcType=BIGINT}, #{sourceSubjectId,jdbcType=BIGINT}, #{forever,jdbcType=BIT},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{creatorId,jdbcType=BIGINT},
#{dsc,jdbcType=VARCHAR}, #{isSync,jdbcType=BIT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.permission.RtsDistribute" useGeneratedKeys="true">
insert into rts_distribute
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mapId != null">
map_id,
</if>
<if test="sourceSubjectId != null">
source_subject_id,
</if>
<if test="forever != null">
forever,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="creatorId != null">
creator_id,
</if>
<if test="dsc != null">
dsc,
</if>
<if test="isSync != null">
is_sync,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="sourceSubjectId != null">
#{sourceSubjectId,jdbcType=BIGINT},
</if>
<if test="forever != null">
#{forever,jdbcType=BIT},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
<if test="dsc != null">
#{dsc,jdbcType=VARCHAR},
</if>
<if test="isSync != null">
#{isSync,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.permission.RtsDistributeExample" resultType="java.lang.Long">
select count(*) from rts_distribute
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update rts_distribute
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.sourceSubjectId != null">
source_subject_id = #{record.sourceSubjectId,jdbcType=BIGINT},
</if>
<if test="record.forever != null">
forever = #{record.forever,jdbcType=BIT},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=TIMESTAMP},
</if>
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=TIMESTAMP},
</if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=BIGINT},
</if>
<if test="record.dsc != null">
dsc = #{record.dsc,jdbcType=VARCHAR},
</if>
<if test="record.isSync != null">
is_sync = #{record.isSync,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update rts_distribute
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
source_subject_id = #{record.sourceSubjectId,jdbcType=BIGINT},
forever = #{record.forever,jdbcType=BIT},
`status` = #{record.status,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT},
dsc = #{record.dsc,jdbcType=VARCHAR},
is_sync = #{record.isSync,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.permission.RtsDistribute">
update rts_distribute
<set>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="sourceSubjectId != null">
source_subject_id = #{sourceSubjectId,jdbcType=BIGINT},
</if>
<if test="forever != null">
forever = #{forever,jdbcType=BIT},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if test="dsc != null">
dsc = #{dsc,jdbcType=VARCHAR},
</if>
<if test="isSync != null">
is_sync = #{isSync,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.permission.RtsDistribute">
update rts_distribute
set map_id = #{mapId,jdbcType=BIGINT},
source_subject_id = #{sourceSubjectId,jdbcType=BIGINT},
forever = #{forever,jdbcType=BIT},
`status` = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
creator_id = #{creatorId,jdbcType=BIGINT},
dsc = #{dsc,jdbcType=VARCHAR},
is_sync = #{isSync,jdbcType=BIT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -1,12 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.permission.RtsPermissionDistributeDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.permission.PermissionDistribute">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.permission.RtsPermissionDistribute">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="permission_id" jdbcType="BIGINT" property="permissionId" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="source_subject_id" jdbcType="BIGINT" property="sourceSubjectId" />
<result column="amount" jdbcType="INTEGER" property="amount" />
<result column="remains" jdbcType="INTEGER" property="remains" />
<result column="forever" jdbcType="BIT" property="forever" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
@ -15,6 +13,7 @@
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="dsc" jdbcType="VARCHAR" property="dsc" />
<result column="is_sync" jdbcType="BIT" property="isSync" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -75,10 +74,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id, permission_id, source_subject_id, amount, remains, forever, `status`, create_time,
update_time, start_time, end_time, creator_id, dsc
id, map_id, source_subject_id, forever, `status`, create_time, update_time, start_time,
end_time, creator_id, dsc, is_sync
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.permission.PermissionDistributeExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="club.joylink.rtss.entity.permission.RtsPermissionDistribute" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
@ -101,7 +100,7 @@
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
select
<include refid="Base_Column_List" />
from rts_permission_distribute
where id = #{id,jdbcType=BIGINT}
@ -110,42 +109,31 @@
delete from rts_permission_distribute
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.permission.PermissionDistributeExample">
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.permission.RtsPermissionDistribute">
delete from rts_permission_distribute
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.permission.PermissionDistribute" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
insert into rts_permission_distribute (id, permission_id, source_subject_id,
amount, remains, forever,
`status`, create_time, update_time,
start_time, end_time, creator_id,
dsc)
values (#{id,jdbcType=BIGINT}, #{permissionId,jdbcType=BIGINT}, #{sourceSubjectId,jdbcType=BIGINT},
#{amount,jdbcType=INTEGER}, #{remains,jdbcType=INTEGER}, #{forever,jdbcType=BIT},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{creatorId,jdbcType=BIGINT},
#{dsc,jdbcType=VARCHAR})
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.permission.RtsPermissionDistribute" useGeneratedKeys="true">
insert into rts_permission_distribute (map_id, source_subject_id, forever,
`status`, create_time, update_time,
start_time, end_time, creator_id,
dsc, is_sync)
values (#{mapId,jdbcType=BIGINT}, #{sourceSubjectId,jdbcType=BIGINT}, #{forever,jdbcType=BIT},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{creatorId,jdbcType=BIGINT},
#{dsc,jdbcType=VARCHAR}, #{isSync,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.permission.PermissionDistribute" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.permission.RtsPermissionDistribute" useGeneratedKeys="true">
insert into rts_permission_distribute
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="permissionId != null">
permission_id,
<if test="mapId != null">
map_id,
</if>
<if test="sourceSubjectId != null">
source_subject_id,
</if>
<if test="amount != null">
amount,
</if>
<if test="remains != null">
remains,
</if>
<if test="forever != null">
forever,
</if>
@ -170,23 +158,17 @@
<if test="dsc != null">
dsc,
</if>
<if test="isSync != null">
is_sync,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="permissionId != null">
#{permissionId,jdbcType=BIGINT},
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="sourceSubjectId != null">
#{sourceSubjectId,jdbcType=BIGINT},
</if>
<if test="amount != null">
#{amount,jdbcType=INTEGER},
</if>
<if test="remains != null">
#{remains,jdbcType=INTEGER},
</if>
<if test="forever != null">
#{forever,jdbcType=BIT},
</if>
@ -211,9 +193,12 @@
<if test="dsc != null">
#{dsc,jdbcType=VARCHAR},
</if>
<if test="isSync != null">
#{isSync,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.permission.PermissionDistributeExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="club.joylink.rtss.entity.permission.RtsPermissionDistribute" resultType="java.lang.Long">
select count(*) from rts_permission_distribute
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
@ -225,18 +210,12 @@
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.permissionId != null">
permission_id = #{record.permissionId,jdbcType=BIGINT},
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.sourceSubjectId != null">
source_subject_id = #{record.sourceSubjectId,jdbcType=BIGINT},
</if>
<if test="record.amount != null">
amount = #{record.amount,jdbcType=INTEGER},
</if>
<if test="record.remains != null">
remains = #{record.remains,jdbcType=INTEGER},
</if>
<if test="record.forever != null">
forever = #{record.forever,jdbcType=BIT},
</if>
@ -261,6 +240,9 @@
<if test="record.dsc != null">
dsc = #{record.dsc,jdbcType=VARCHAR},
</if>
<if test="record.isSync != null">
is_sync = #{record.isSync,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -269,37 +251,30 @@
<update id="updateByExample" parameterType="map">
update rts_permission_distribute
set id = #{record.id,jdbcType=BIGINT},
permission_id = #{record.permissionId,jdbcType=BIGINT},
source_subject_id = #{record.sourceSubjectId,jdbcType=BIGINT},
amount = #{record.amount,jdbcType=INTEGER},
remains = #{record.remains,jdbcType=INTEGER},
forever = #{record.forever,jdbcType=BIT},
`status` = #{record.status,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT},
dsc = #{record.dsc,jdbcType=VARCHAR}
map_id = #{record.mapId,jdbcType=BIGINT},
source_subject_id = #{record.sourceSubjectId,jdbcType=BIGINT},
forever = #{record.forever,jdbcType=BIT},
`status` = #{record.status,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT},
dsc = #{record.dsc,jdbcType=VARCHAR},
is_sync = #{record.isSync,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.permission.PermissionDistribute">
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.permission.RtsPermissionDistribute">
update rts_permission_distribute
<set>
<if test="permissionId != null">
permission_id = #{permissionId,jdbcType=BIGINT},
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="sourceSubjectId != null">
source_subject_id = #{sourceSubjectId,jdbcType=BIGINT},
</if>
<if test="amount != null">
amount = #{amount,jdbcType=INTEGER},
</if>
<if test="remains != null">
remains = #{remains,jdbcType=INTEGER},
</if>
<if test="forever != null">
forever = #{forever,jdbcType=BIT},
</if>
@ -324,23 +299,25 @@
<if test="dsc != null">
dsc = #{dsc,jdbcType=VARCHAR},
</if>
<if test="isSync != null">
is_sync = #{isSync,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.permission.PermissionDistribute">
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.permission.RtsPermissionDistribute">
update rts_permission_distribute
set permission_id = #{permissionId,jdbcType=BIGINT},
source_subject_id = #{sourceSubjectId,jdbcType=BIGINT},
amount = #{amount,jdbcType=INTEGER},
remains = #{remains,jdbcType=INTEGER},
forever = #{forever,jdbcType=BIT},
`status` = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
creator_id = #{creatorId,jdbcType=BIGINT},
dsc = #{dsc,jdbcType=VARCHAR}
set map_id = #{mapId,jdbcType=BIGINT},
source_subject_id = #{sourceSubjectId,jdbcType=BIGINT},
forever = #{forever,jdbcType=BIT},
`status` = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
creator_id = #{creatorId,jdbcType=BIGINT},
dsc = #{dsc,jdbcType=VARCHAR},
is_sync = #{isSync,jdbcType=BIT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>