删除掉版本发布之初处理数据的接口和一些很久以前的sql

This commit is contained in:
joylink_zhangsai 2023-05-24 16:27:49 +08:00
parent cc9e63842d
commit e7cab0591d
5 changed files with 835 additions and 754 deletions

View File

@ -25,118 +25,128 @@ import org.springframework.web.bind.annotation.RestController;
/**
* 试卷蓝图业务接口
* <p>
* 试卷蓝图状态解释<br>
* 编辑中-可以修改删除;封存-不可以修改删除可以用来生成试卷可以状态迁移编辑中和已使用已使用-已经被用来生成过试卷不可以修改删除状态也不能改变
* 试卷蓝图状态解释<br> 编辑中-可以修改删除;封存-不可以修改删除可以用来生成试卷可以状态迁移编辑中和已使用已使用-已经被用来生成过试卷不可以修改删除状态也不能改变
*/
@Slf4j
@RestController
@RequestMapping("/api/v2/paper/composition")
public class PaperCompositionController {
@Autowired
private PaperCompositionService compositionService;
/**
* 数据管理查询
*
* @param req
* @return
*/
@Role(value = RoleEnum.SuperAdmin)
@PostMapping(path = "/manage/paging")
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionForPage(@RequestBody FindPaperCompositionPageReqVo req) {
return this.compositionService.findPaperCompositionByPage(req);
}
@Autowired
private PaperCompositionService compositionService;
/**
* 创建试卷蓝图包括规则定义
* 参数 tags 只支持单个
*
* @param orgId 组织id
*/
@PostMapping("/{orgId}")
public CreatePaperCompositionRspVo createPaperCompositionWithRuleForOrg(@PathVariable("orgId") Long orgId, @RequestBody PaperCompositionWithRuleVo req, @RequestAttribute AccountVO user) {
req.setOrgId(orgId);
return this.compositionService.createPaperCompositionWithRule(req, user);
}
/**
* 数据管理查询
*
* @param req
* @return
*/
@Role(value = RoleEnum.SuperAdmin)
@PostMapping(path = "/manage/paging")
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionForPage(
@RequestBody FindPaperCompositionPageReqVo req) {
return this.compositionService.findPaperCompositionByPage(req);
}
/**
* 更新试卷蓝图包括规则定义
* 参数 tags 只支持单个
*/
@PutMapping
public void updatePaperCompositionWithRule(@RequestBody PaperCompositionWithRuleVo req, @RequestAttribute AccountVO user) {
this.compositionService.updatePaperCompositionWithRule(req, user);
}
/**
* 创建试卷蓝图包括规则定义 参数 tags 只支持单个
*
* @param orgId 组织id
*/
@PostMapping("/{orgId}")
public CreatePaperCompositionRspVo createPaperCompositionWithRuleForOrg(
@PathVariable("orgId") Long orgId, @RequestBody PaperCompositionWithRuleVo req,
@RequestAttribute AccountVO user) {
req.setOrgId(orgId);
return this.compositionService.createPaperCompositionWithRule(req, user);
}
/**
* 更新试卷蓝图包括规则定义 参数 tags 只支持单个
*/
@PutMapping
public void updatePaperCompositionWithRule(@RequestBody PaperCompositionWithRuleVo req,
@RequestAttribute AccountVO user) {
this.compositionService.updatePaperCompositionWithRule(req, user);
}
/**
* 将编辑好的试卷蓝图封存
*/
@PutMapping("/{pcId}/lock")
public void lockPaperComposition(@PathVariable("pcId") Long pcId, @RequestAttribute AccountVO user) {
compositionService.lockPaperComposition(pcId, user);
}
/**
* 将编辑好的试卷蓝图封存
*/
@PutMapping("/{pcId}/lock")
public void lockPaperComposition(@PathVariable("pcId") Long pcId,
@RequestAttribute AccountVO user) {
compositionService.lockPaperComposition(pcId, user);
}
/**
* 将封存的试卷蓝图设置失效
*/
@PutMapping("/{pcId}/invalid")
public void invalidPaperComposition(@PathVariable("pcId") Long pcId, @RequestAttribute AccountVO user) {
compositionService.unlockPaperComposition(pcId, user);
}
/**
* 将封存的试卷蓝图设置失效
*/
@PutMapping("/{pcId}/invalid")
public void invalidPaperComposition(@PathVariable("pcId") Long pcId,
@RequestAttribute AccountVO user) {
compositionService.unlockPaperComposition(pcId, user);
}
/**
* 删除试卷蓝图(只能删除处于编辑状态的)
*
* @param pcId 试卷蓝图id
*/
@DeleteMapping("/{pcId}")
public void deletePaperComposition(@PathVariable("pcId") Long pcId, @RequestAttribute AccountVO user) {
compositionService.deletePaperComposition(pcId, user);
}
/**
* 删除试卷蓝图(只能删除处于编辑状态的)
*
* @param pcId 试卷蓝图id
*/
@DeleteMapping("/{pcId}")
public void deletePaperComposition(@PathVariable("pcId") Long pcId,
@RequestAttribute AccountVO user) {
compositionService.deletePaperComposition(pcId, user);
}
/**
* 根据(组织id线路id试卷蓝图名称简介)分页查找试卷蓝图
*/
@PostMapping("/find/page")
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPage(@RequestBody FindPaperCompositionPageReqVo req) {
return this.compositionService.findPaperCompositionByPage(req);
}
/**
* 根据(组织id线路id试卷蓝图名称简介)分页查找试卷蓝图
*/
@PostMapping("/find/page")
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPage(
@RequestBody FindPaperCompositionPageReqVo req) {
return this.compositionService.findPaperCompositionByPage(req);
}
/**
* 根据mapId查询蓝图的基本信息
*
* @return
*/
@PostMapping("/find/list")
public List<PaperCompositionWithRuleVo> findPaperCompositionByList(@RequestBody FindPaperCompositionPageReqVo req) {
return this.compositionService.findPaperCompositionList(req);
}
/**
* 根据mapId查询蓝图的基本信息
*
* @return
*/
@PostMapping("/find/list")
public List<PaperCompositionWithRuleVo> findPaperCompositionByList(
@RequestBody FindPaperCompositionPageReqVo req) {
return this.compositionService.findPaperCompositionList(req);
}
/**
* 根据试卷蓝图名称简介分页查找某个组织的试卷蓝图
*/
@PostMapping("/find/page/for/{orgId}")
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionForOrgByPage(@PathVariable("orgId") Long orgId, @RequestBody FindPaperCompositionPageReqVo req) {
req.setOrgId(orgId);
return this.compositionService.findPaperCompositionByPage(req);
}
/**
* 根据试卷蓝图名称简介分页查找某个组织的试卷蓝图
*/
@PostMapping("/find/page/for/{orgId}")
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionForOrgByPage(
@PathVariable("orgId") Long orgId, @RequestBody FindPaperCompositionPageReqVo req) {
req.setOrgId(orgId);
return this.compositionService.findPaperCompositionByPage(req);
}
/**
* 根据账户分页查找试卷蓝图
*/
@PostMapping("/find/page/by/account")
public PageVO<PaperCompositionWithRuleVo> findAccountPaperCompositionByPage(@RequestBody FindPaperCompositionByAccountReqVo req) {
return this.compositionService.findPaperCompositionByPageForAccount(req);
}
/**
* 根据账户分页查找试卷蓝图
*/
@PostMapping("/find/page/by/account")
public PageVO<PaperCompositionWithRuleVo> findAccountPaperCompositionByPage(
@RequestBody FindPaperCompositionByAccountReqVo req) {
return this.compositionService.findPaperCompositionByPageForAccount(req);
}
/**
* 获取试卷完整的蓝图包括规则
*
* @param pcId 试卷蓝图id
*/
@GetMapping("/{pcId}")
public PaperCompositionWithRuleVo findPaperComposition(@PathVariable("pcId") Long pcId, @RequestAttribute AccountVO user) {
return this.compositionService.findPaperComposition(pcId, user);
}
/**
* 获取试卷完整的蓝图包括规则
*
* @param pcId 试卷蓝图id
*/
@GetMapping("/{pcId}")
public PaperCompositionWithRuleVo findPaperComposition(@PathVariable("pcId") Long pcId,
@RequestAttribute AccountVO user) {
return this.compositionService.findPaperComposition(pcId, user);
}
}

View File

@ -37,159 +37,169 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/mapFunction")
public class MapFunctionController {
@Autowired
private RtsMapFunctionService rtsMapFunctionService;
@Autowired
private MapFunctionTemplateService mapFunctionTemplateService;
@Autowired
private RtsMapFunctionService rtsMapFunctionService;
/**
* 创建地图功能
*/
@Role(RoleEnum.Admin)
@PostMapping("")
public void create(@RequestBody MapFunctionCreateVO createVO, @RequestAttribute LoginUserInfoVO loginInfo) {
rtsMapFunctionService.create(createVO, loginInfo.getAccountVO().getId());
}
@Autowired
private MapFunctionTemplateService mapFunctionTemplateService;
/**
* 生成地图功能
*/
@Role(RoleEnum.Admin)
@PostMapping("/{mapId}/generate")
public List<String> generate(@PathVariable long mapId, @RequestBody @Validated MapFunctionGenerateParamVO paramVO,
@RequestAttribute LoginUserInfoVO loginInfo) {
return rtsMapFunctionService.generate(mapId, paramVO, loginInfo.getAccountVO().getId());
}
/**
* 创建地图功能
*/
@Role(RoleEnum.Admin)
@PostMapping("")
public void create(@RequestBody MapFunctionCreateVO createVO,
@RequestAttribute LoginUserInfoVO loginInfo) {
rtsMapFunctionService.create(createVO, loginInfo.getAccountVO().getId());
}
/**
* 列表查询地图功能
*/
@GetMapping("/list")
public List<MapFunctionVO> listQuery(MapFunctionQueryVO queryVO) {
return rtsMapFunctionService.listQuery(queryVO);
}
/**
* 生成地图功能
*/
@Role(RoleEnum.Admin)
@PostMapping("/{mapId}/generate")
public List<String> generate(@PathVariable long mapId,
@RequestBody @Validated MapFunctionGenerateParamVO paramVO,
@RequestAttribute LoginUserInfoVO loginInfo) {
return rtsMapFunctionService.generate(mapId, paramVO, loginInfo.getAccountVO().getId());
}
/**
* 分页查询地图功能
*/
@GetMapping("/paged")
public PageVO<MapFunctionVO> pagedQuery(MapFunctionQueryVO queryVO) {
return rtsMapFunctionService.pagedQuery(queryVO);
}
/**
* 列表查询地图功能
*/
@GetMapping("/list")
public List<MapFunctionVO> listQuery(MapFunctionQueryVO queryVO) {
return rtsMapFunctionService.listQuery(queryVO);
}
/**
* 删除地图功能
*/
@Role(RoleEnum.Admin)
@DeleteMapping("/{id}")
public void delete(@PathVariable long id) {
rtsMapFunctionService.delete(id);
}
/**
* 分页查询地图功能
*/
@GetMapping("/paged")
public PageVO<MapFunctionVO> pagedQuery(MapFunctionQueryVO queryVO) {
return rtsMapFunctionService.pagedQuery(queryVO);
}
/**
* 批量删除地图功能
*/
@Role(RoleEnum.Admin)
@DeleteMapping("/batch/{mapId}")
public void batchDelete(@PathVariable long mapId) {
rtsMapFunctionService.batchDelete(mapId);
}
/**
* 删除地图功能
*/
@Role(RoleEnum.Admin)
@DeleteMapping("/{id}")
public void delete(@PathVariable long id) {
rtsMapFunctionService.delete(id);
}
/**
* 更新地图功能
*/
@Role(RoleEnum.Admin)
@PutMapping("/{id}")
public void update(@PathVariable long id, @RequestBody MapFunctionUpdateVO updateVO, @RequestAttribute LoginUserInfoVO loginInfo) {
rtsMapFunctionService.update(id, updateVO, loginInfo.getAccountVO().getId());
}
/**
* 批量删除地图功能
*/
@Role(RoleEnum.Admin)
@DeleteMapping("/batch/{mapId}")
public void batchDelete(@PathVariable long mapId) {
rtsMapFunctionService.batchDelete(mapId);
}
/**
* 根据ID获取地图功能信息
*/
@GetMapping("/{id}")
public MapFunctionVO queryOne(@PathVariable Long id) {
return rtsMapFunctionService.get(id);
}
/**
* 更新地图功能
*/
@Role(RoleEnum.Admin)
@PutMapping("/{id}")
public void update(@PathVariable long id, @RequestBody MapFunctionUpdateVO updateVO,
@RequestAttribute LoginUserInfoVO loginInfo) {
rtsMapFunctionService.update(id, updateVO, loginInfo.getAccountVO().getId());
}
/**
* 更新分组
* @param groupMap k- group v-mapFunctionIds
*/
@PutMapping("/group")
public void updateGroup(@RequestBody Map<String, List<Long>> groupMap,
@RequestAttribute AccountVO user) {
rtsMapFunctionService.updateGroup(groupMap, user.getId());
}
/**
* 根据ID获取地图功能信息
*/
@GetMapping("/{id}")
public MapFunctionVO queryOne(@PathVariable Long id) {
return rtsMapFunctionService.get(id);
}
/**
* 跨线路批量修改线路功能
*/
@PutMapping("/crossMap/batch")
public void batchModifyDesc(@RequestBody MapFunctionBatchModifyVO vo) {
rtsMapFunctionService.batchModify(vo);
}
/**
* 更新分组
*
* @param groupMap k- group v-mapFunctionIds
*/
@PutMapping("/group")
public void updateGroup(@RequestBody Map<String, List<Long>> groupMap,
@RequestAttribute AccountVO user) {
rtsMapFunctionService.updateGroup(groupMap, user.getId());
}
/**
* 创建线路功能模板
*/
@PostMapping("/template")
public void create(@RequestBody MapFunctionTemplateCreateVO createVO, @RequestAttribute AccountVO user) {
mapFunctionTemplateService.create(createVO, user.getId());
}
/**
* 跨线路批量修改线路功能
*/
@PutMapping("/crossMap/batch")
public void batchModifyDesc(@RequestBody MapFunctionBatchModifyVO vo) {
rtsMapFunctionService.batchModify(vo);
}
/**
* 列表查询线路功能模板
*/
@GetMapping("/template/list")
public List<MapFunctionTemplateVO> listQuery(MapFunctionTemplateQueryVO queryVO) {
return mapFunctionTemplateService.listQuery(queryVO);
}
/**
* 创建线路功能模板
*/
@PostMapping("/template")
public void create(@RequestBody MapFunctionTemplateCreateVO createVO,
@RequestAttribute AccountVO user) {
mapFunctionTemplateService.create(createVO, user.getId());
}
/**
* 分页查询线路功能模板
*/
@GetMapping("/template/paged")
public PageVO<MapFunctionTemplateVO> pagedQuery(MapFunctionTemplateQueryVO queryVO) {
return mapFunctionTemplateService.pagedQuery(queryVO);
}
/**
* 列表查询线路功能模板
*/
@GetMapping("/template/list")
public List<MapFunctionTemplateVO> listQuery(MapFunctionTemplateQueryVO queryVO) {
return mapFunctionTemplateService.listQuery(queryVO);
}
/**
* 更新线路功能模板
*/
@PutMapping("/template/{id}")
public MapFunctionTemplateVO update(@PathVariable long id, @RequestBody MapFunctionTemplateCreateVO createVO,
@RequestAttribute AccountVO user) {
return mapFunctionTemplateService.update(id, createVO, user.getId());
}
/**
* 分页查询线路功能模板
*/
@GetMapping("/template/paged")
public PageVO<MapFunctionTemplateVO> pagedQuery(MapFunctionTemplateQueryVO queryVO) {
return mapFunctionTemplateService.pagedQuery(queryVO);
}
/**
* 删除线路功能模板
*/
@DeleteMapping("/template/{id}")
public void deleteTemplate(@PathVariable long id) {
mapFunctionTemplateService.delete(id);
}
/**
* 更新线路功能模板
*/
@PutMapping("/template/{id}")
public MapFunctionTemplateVO update(@PathVariable long id,
@RequestBody MapFunctionTemplateCreateVO createVO,
@RequestAttribute AccountVO user) {
return mapFunctionTemplateService.update(id, createVO, user.getId());
}
/**
* 根据模板生成地图功能
* @return 生成过程中的特殊情况日志
*/
@PostMapping("/generate/from/template")
public List<String> generateFromTemplate(@RequestBody MapFunctionGenerateVO vo, @RequestAttribute AccountVO user) {
return rtsMapFunctionService.generateFromTemplate(vo, user.getId());
}
/**
* 删除线路功能模板
*/
@DeleteMapping("/template/{id}")
public void deleteTemplate(@PathVariable long id) {
mapFunctionTemplateService.delete(id);
}
/**
* 根据地图原有的线路功能信息生成新的线路功能信息模板与当前数据名称匹配
*
* @param mapIds 地图ID列表
* @param user 登录用户信息
* @return 没有生成信息记录方便用户自定义操作
*/
@PostMapping("/generate/mapIds")
public List<String> generateFunByOldData(@RequestBody List<Long> mapIds, @RequestAttribute AccountVO user) {
return rtsMapFunctionService.generateFunByOldData(mapIds, user);
}
/**
* 根据模板生成地图功能
*
* @return 生成过程中的特殊情况日志
*/
@PostMapping("/generate/from/template")
public List<String> generateFromTemplate(@RequestBody MapFunctionGenerateVO vo,
@RequestAttribute AccountVO user) {
return rtsMapFunctionService.generateFromTemplate(vo, user.getId());
}
/**
* 根据地图原有的线路功能信息生成新的线路功能信息模板与当前数据名称匹配
*
* @param mapIds 地图ID列表
* @param user 登录用户信息
* @return 没有生成信息记录方便用户自定义操作
*/
@PostMapping("/generate/mapIds")
public List<String> generateFunByOldData(@RequestBody List<Long> mapIds,
@RequestAttribute AccountVO user) {
return rtsMapFunctionService.generateFunByOldData(mapIds, user);
}
}

View File

@ -37,129 +37,135 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/api/user")
public class UserController {
@Autowired
private ISysUserService iSysUserService;
@Autowired
private ISysUserService iSysUserService;
@Autowired
private UserGenerateService userGenerateService;
@Autowired
private UserGenerateService userGenerateService;
@Autowired
private IDepartUserStatisticService iDepartUserStatisticService;
@Autowired
private IDepartUserStatisticService iDepartUserStatisticService;
@Autowired
private OldPermissionDataSyncService syncService;
/**
*生成线下环境用户
*/
@Role({RoleEnum.SuperAdmin})
@PostMapping(path = "/generate/offline")
public void generateOfflineUsers(@RequestBody @Validated UserGenerateConfigVO generateConfigVO,
@RequestAttribute AccountVO user) {
this.userGenerateService.generateOfflineUser(generateConfigVO, user);
}
@Autowired
private OldPermissionDataSyncService syncService;
@Role({RoleEnum.SuperAdmin, RoleEnum.Admin})
@PostMapping(path = "")
public void createAccount(@RequestBody @Validated(CreateAccountCheck.class) AccountCreateVO accountCreateVO,
@RequestAttribute AccountVO user) {
this.iSysUserService.createAccount(accountCreateVO, user);
}
/**
* 生成线下环境用户
*/
@Role({RoleEnum.SuperAdmin})
@PostMapping(path = "/generate/offline")
public void generateOfflineUsers(@RequestBody @Validated UserGenerateConfigVO generateConfigVO,
@RequestAttribute AccountVO user) {
this.userGenerateService.generateOfflineUser(generateConfigVO, user);
}
/**
*分页获取用户数据
*/
@Role({RoleEnum.Admin, RoleEnum.SuperAdmin})
@GetMapping(path = "")
public PageVO<AccountVO> queryPagedUser(UserQueryVO queryVO) {
return this.iSysUserService.queryPagedUser(queryVO);
}
@Role({RoleEnum.SuperAdmin, RoleEnum.Admin})
@PostMapping(path = "")
public void createAccount(
@RequestBody @Validated(CreateAccountCheck.class) AccountCreateVO accountCreateVO,
@RequestAttribute AccountVO user) {
this.iSysUserService.createAccount(accountCreateVO, user);
}
/**
*修改用户角色
*/
@Role(RoleEnum.SuperAdmin)
@PutMapping(path = "/{id}/role")
public void updateUserRole(@PathVariable Long id, @RequestBody AccountVO accountVO, @RequestAttribute AccountVO user) {
this.iSysUserService.updateUserRole(id, user.getId(), accountVO);
}
/**
* 分页获取用户数据
*/
@Role({RoleEnum.Admin, RoleEnum.SuperAdmin})
@GetMapping(path = "")
public PageVO<AccountVO> queryPagedUser(UserQueryVO queryVO) {
return this.iSysUserService.queryPagedUser(queryVO);
}
/**
*超管修改用户信息
*/
@Role(RoleEnum.SuperAdmin)
@PutMapping("/superAdmin/update/userInfo")
public void superAdminUpdateUserInfo(@RequestBody AccountVO updateUser, @RequestAttribute AccountVO user) {
iSysUserService.superAdminUpdateUserInfo(updateUser, user);
}
/**
* 修改用户角色
*/
@Role(RoleEnum.SuperAdmin)
@PutMapping(path = "/{id}/role")
public void updateUserRole(@PathVariable Long id, @RequestBody AccountVO accountVO,
@RequestAttribute AccountVO user) {
this.iSysUserService.updateUserRole(id, user.getId(), accountVO);
}
@Role(RoleEnum.SuperAdmin)
@DeleteMapping("/{id}")
public void delete(@PathVariable Long id) {
this.iSysUserService.logicDelete(id);
}
/**
* 超管修改用户信息
*/
@Role(RoleEnum.SuperAdmin)
@PutMapping("/superAdmin/update/userInfo")
public void superAdminUpdateUserInfo(@RequestBody AccountVO updateUser,
@RequestAttribute AccountVO user) {
iSysUserService.superAdminUpdateUserInfo(updateUser, user);
}
/**
* 修改用户密码
*/
@PutMapping(path = "/{id}/password")
public void updateUserPassword(@PathVariable Long id, @RequestBody AccountVO accountVO, @RequestAttribute AccountVO user) {
this.iSysUserService.updateUserPassword(id, accountVO.getPassword());
}
@Role(RoleEnum.SuperAdmin)
@DeleteMapping("/{id}")
public void delete(@PathVariable Long id) {
this.iSysUserService.logicDelete(id);
}
/**
* 获取微信小程序绑定二维码
*/
@GetMapping(path = "/bind/wm/url")
public WeChatBindStatusVO getWeChatBindUrl(@RequestAttribute LoginUserInfoVO loginInfo) {
return this.iSysUserService.getWeChatBindUrl(loginInfo);
}
/**
* 修改用户密码
*/
@PutMapping(path = "/{id}/password")
public void updateUserPassword(@PathVariable Long id, @RequestBody AccountVO accountVO,
@RequestAttribute AccountVO user) {
this.iSysUserService.updateUserPassword(id, accountVO.getPassword());
}
/**
* 用户绑定微信小程序
*/
@PutMapping(path = "/bind/wm")
public void userBindWm(String code, Long userId) {
this.iSysUserService.userBindWm(code, userId);
}
/**
* 获取微信小程序绑定二维码
*/
@GetMapping(path = "/bind/wm/url")
public WeChatBindStatusVO getWeChatBindUrl(@RequestAttribute LoginUserInfoVO loginInfo) {
return this.iSysUserService.getWeChatBindUrl(loginInfo);
}
/**
* 获取用户总数量
*/
@GetMapping(path = "/amount")
public int getUserAmount() {
return iSysUserService.getUserAmount();
}
/**
* 用户绑定微信小程序
*/
@PutMapping(path = "/bind/wm")
public void userBindWm(String code, Long userId) {
this.iSysUserService.userBindWm(code, userId);
}
/**
* 分页获取用户数据模糊查询
*/
@GetMapping(path = "/fuzzy")
public List<AccountVO> fuzzyQueryPagedUser(@NotBlank(message = "参数不能为空") String fuzzyParam) {
return this.iSysUserService.fuzzyQueryPagedUser(fuzzyParam);
}
/**
* 获取用户总数量
*/
@GetMapping(path = "/amount")
public int getUserAmount() {
return iSysUserService.getUserAmount();
}
/**
* 导出部门学生信息及成绩接口
*/
@PutMapping(path = "/scores")
public List<ExportStudentInfo> getStudentSores(@Validated @RequestBody StudentInfoExportParam infoExportParam) {
return this.iDepartUserStatisticService.studentInfoStatistics(infoExportParam);
}
/**
* 分页获取用户数据模糊查询
*/
@GetMapping(path = "/fuzzy")
public List<AccountVO> fuzzyQueryPagedUser(@NotBlank(message = "参数不能为空") String fuzzyParam) {
return this.iSysUserService.fuzzyQueryPagedUser(fuzzyParam);
}
/**
* 查询销售人员
*/
@GetMapping("/seller")
public List<AccountVO> querySellers() {
return iSysUserService.querySellers();
}
/**
* 导出部门学生信息及成绩接口
*/
@PutMapping(path = "/scores")
public List<ExportStudentInfo> getStudentSores(
@Validated @RequestBody StudentInfoExportParam infoExportParam) {
return this.iDepartUserStatisticService.studentInfoStatistics(infoExportParam);
}
/**
*查询管理和超管
*/
@Role({RoleEnum.Admin, RoleEnum.SuperAdmin})
@GetMapping("/adminAndSuperAdmin")
public List<AccountVO> queryAdminsAndSuperAdmins() {
return iSysUserService.queryAdminsAndSuperAdmins();
}
/**
* 查询销售人员
*/
@GetMapping("/seller")
public List<AccountVO> querySellers() {
return iSysUserService.querySellers();
}
/**
* 查询管理和超管
*/
@Role({RoleEnum.Admin, RoleEnum.SuperAdmin})
@GetMapping("/adminAndSuperAdmin")
public List<AccountVO> queryAdminsAndSuperAdmins() {
return iSysUserService.queryAdminsAndSuperAdmins();
}
}

View File

@ -16,95 +16,111 @@ import org.springframework.stereotype.Repository;
@Repository
public interface PermissionSubjectDAO {
@Select("<script>" +
"select A.id,A.subject_type,A.subject_id," +
"(case when A.subject_type = 'user' then B.name when A.subject_type = 'org' then C.name when A.subject_type = 'project' then E.name end) as named," +
"(case when A.subject_type = 'user' then B.nickname else '' end) as nick_name," +
"(case when A.subject_type = 'project' then E.code else '' end ) as project_code,"+
" A.amount,A.remains,A.status,A.forever,A.start_time,A.end_time,A.create_time," +
" D.name as permission_name,A.permission_id,A.distribute_id,D.map_id,D.project_code as permission_project_code,D.permission_type " +
" from rts_permission_subject A left join sys_account B on A.subject_type = 'user' and A.subject_id = B.id " +
" left join org C on A.subject_type = 'org' and A.subject_id = C.id " +
" left join rts_project E on A.subject_type = 'project' and A.subject_id = E.id " +
" left join rts_permission D on A.permission_id = D.id " +
//" left join rts_distribute E on A.distribute_id = E.id " +
" where 1 = 1 " +
@Select("<script>" +
"select A.id,A.subject_type,A.subject_id," +
"(case when A.subject_type = 'user' then B.name when A.subject_type = 'org' then C.name when A.subject_type = 'project' then E.name end) as named,"
+
"(case when A.subject_type = 'user' then B.nickname else '' end) as nick_name," +
"(case when A.subject_type = 'project' then E.code else '' end ) as project_code," +
" A.amount,A.remains,A.status,A.forever,A.start_time,A.end_time,A.create_time," +
" D.name as permission_name,A.permission_id,A.distribute_id,D.map_id,D.project_code as permission_project_code,D.permission_type "
+
" from rts_permission_subject A left join sys_account B on A.subject_type = 'user' and A.subject_id = B.id "
+
" left join org C on A.subject_type = 'org' and A.subject_id = C.id " +
" left join rts_project E on A.subject_type = 'project' and A.subject_id = E.id " +
" left join rts_permission D on A.permission_id = D.id " +
//" left join rts_distribute E on A.distribute_id = E.id " +
" where 1 = 1 " +
/*"<if test=\"mapId != null and mapId != 0\"> " +
" and E.map_id = #{mapId} " +
"</if> " +*/
" and (C.id = #{orgId} or B.id = #{userId} or E.code = #{projectCode}) " +
" and A.status = #{status}" +
"</script>")
List<PermissionSubjectVO> findPermissionWithMapIdAndUserInfo(/*@Param("mapId") Long mapId,*/@Param("orgId") Long orgId,@Param("userId") Long userId,@Param("status") Integer status,@Param("projectCode") String projectCode);
@Select("<script>" +
"select A.id,A.subject_type,A.subject_id, " +
"(case when A.subject_type = 'user' then B.name when A.subject_type = 'org' then C.name when A.subject_type = 'project' then E.name end) as named," +
"(case when A.subject_type = 'user' then B.nickname else '' end) as nick_name," +
"(case when A.subject_type = 'project' then E.code else '' end ) as project_code,"+
"B.name as permission_name,A.permission_id " +
" from rts_permission_subject A left join rts_permission B on A.permission_id = B.id" +
" left join sys_account C on A.subject_type = 'user' and A.subject_id = C.id " +
" left join org D on A.subject_type = 'org' and A.subject_id = C.id " +
" left join rts_project E on A.subject_type = 'project' and A.subject_id = E.id " +
" where 1 = 1 and A.parent_id in " +
"<if test=\"idList != null and idList.size > 0\"> " +
" <foreach collection=\"idList\" open=\"(\" close=\")\" item=\"d\" separator=\" , \"> "+
" #{d}"+
" </foreach>" +
"</if> " +
"order by id asc" +
"</script>")
List<PermissionSubjectVO> findDistributePermission(List<Long> idList);
" and (C.id = #{orgId} or B.id = #{userId} or E.code = #{projectCode}) " +
" and A.status = #{status}" +
"</script>")
List<PermissionSubjectVO> findPermissionWithMapIdAndUserInfo(/*@Param("mapId") Long mapId,*/
@Param("orgId") Long orgId, @Param("userId") Long userId, @Param("status") Integer status,
@Param("projectCode") String projectCode);
@Select("<script>" +
"select A.id,A.subject_type,A.subject_id," +
"(case when A.subject_type = 'user' then B.name when A.subject_type = 'org' then C.name when A.subject_type = 'project' then E.name end) as named," +
"(case when A.subject_type = 'user' then B.nickname else '' end) as nick_name," +
"(case when A.subject_type = 'project' then E.code else '' end ) as project_code,"+
"A.amount,A.remains,A.status,A.forever,A.start_time,A.end_time,A.create_time,D.name as permission_name,A.permission_id " +
" from rts_permission_subject A left join sys_account B on A.subject_type = 'user' and A.subject_id = B.id " +
" left join org C on A.subject_type = 'org' and A.subject_id = C.id " +
" left join rts_project E on A.subject_type = 'project' and A.subject_id = E.id " +
" left join rts_permission D on A.permission_id = D.id " +
" where 1 = 1 " +
"<if test=\"vo.subType!=null and vo.subType!=''\">" +
" AND A.subject_type = #{vo.subType} " +
"</if>"+
"<if test=\"vo.named!=null and vo.named!=''\">" +
" AND (B.name = #{vo.named} or B.nickname = #{vo.named} or C.name = #{vo.named} or E.name = #{vo.named}) " +
"</if>"+
"<if test=\"vo.status!=null\">" +
" AND A.status = #{vo.status} " +
"</if>"+
" order by id desc " +
"</script>")
List<PermissionSubjectVO> customerQuery(@Param("vo") PermissionSubjectQueryVO queryVO);
@Select("<script>" +
"select A.id,A.subject_type,A.subject_id, " +
"(case when A.subject_type = 'user' then B.name when A.subject_type = 'org' then C.name when A.subject_type = 'project' then E.name end) as named,"
+
"(case when A.subject_type = 'user' then B.nickname else '' end) as nick_name," +
"(case when A.subject_type = 'project' then E.code else '' end ) as project_code," +
"B.name as permission_name,A.permission_id " +
" from rts_permission_subject A left join rts_permission B on A.permission_id = B.id" +
" left join sys_account C on A.subject_type = 'user' and A.subject_id = C.id " +
" left join org D on A.subject_type = 'org' and A.subject_id = C.id " +
" left join rts_project E on A.subject_type = 'project' and A.subject_id = E.id " +
" where 1 = 1 and A.parent_id in " +
"<if test=\"idList != null and idList.size > 0\"> " +
" <foreach collection=\"idList\" open=\"(\" close=\")\" item=\"d\" separator=\" , \"> " +
" #{d}" +
" </foreach>" +
"</if> " +
"order by id asc" +
"</script>")
List<PermissionSubjectVO> findDistributePermission(List<Long> idList);
/**
* 状态参考 {@link PermissionSubjectStatusEnum}
*/
@Update("<script> update rts_permission_subject 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(PermissionSubjectExample example);
@Select("<script>" +
"select A.id,A.subject_type,A.subject_id," +
"(case when A.subject_type = 'user' then B.name when A.subject_type = 'org' then C.name when A.subject_type = 'project' then E.name end) as named,"
+
"(case when A.subject_type = 'user' then B.nickname else '' end) as nick_name," +
"(case when A.subject_type = 'project' then E.code else '' end ) as project_code," +
"A.amount,A.remains,A.status,A.forever,A.start_time,A.end_time,A.create_time,D.name as permission_name,A.permission_id "
+
" from rts_permission_subject A left join sys_account B on A.subject_type = 'user' and A.subject_id = B.id "
+
" left join org C on A.subject_type = 'org' and A.subject_id = C.id " +
" left join rts_project E on A.subject_type = 'project' and A.subject_id = E.id " +
" left join rts_permission D on A.permission_id = D.id " +
" where 1 = 1 " +
"<if test=\"vo.subType!=null and vo.subType!=''\">" +
" AND A.subject_type = #{vo.subType} " +
"</if>" +
"<if test=\"vo.named!=null and vo.named!=''\">" +
" AND (B.name = #{vo.named} or B.nickname = #{vo.named} or C.name = #{vo.named} or E.name = #{vo.named}) "
+
"</if>" +
"<if test=\"vo.status!=null\">" +
" AND A.status = #{vo.status} " +
"</if>" +
" order by id desc " +
"</script>")
List<PermissionSubjectVO> customerQuery(@Param("vo") PermissionSubjectQueryVO queryVO);
int deleteByExample(PermissionSubjectExample example);
/**
* 状态参考 {@link PermissionSubjectStatusEnum}
*/
@Update(
"<script> update rts_permission_subject set status = 2,update_time = now() where forever = 0 and (`status` is null or `status` = 1) "
+
" <![CDATA[ and end_time < now() ]]> </script>")
void updateStatusByTimeOver();
int deleteByPrimaryKey(Long id);
long countByExample(PermissionSubjectExample example);
int insert(PermissionSubject record);
int deleteByExample(PermissionSubjectExample example);
int insertSelective(PermissionSubject record);
int deleteByPrimaryKey(Long id);
List<PermissionSubject> selectByExample(PermissionSubjectExample example);
int insert(PermissionSubject record);
PermissionSubject selectByPrimaryKey(Long id);
int insertSelective(PermissionSubject record);
int updateByExampleSelective(@Param("record") PermissionSubject record, @Param("example") PermissionSubjectExample example);
List<PermissionSubject> selectByExample(PermissionSubjectExample example);
int updateByExample(@Param("record") PermissionSubject record, @Param("example") PermissionSubjectExample example);
PermissionSubject selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(PermissionSubject record);
int updateByExampleSelective(@Param("record") PermissionSubject record,
@Param("example") PermissionSubjectExample example);
int updateByPrimaryKey(PermissionSubject record);
int updateByExample(@Param("record") PermissionSubject record,
@Param("example") PermissionSubjectExample example);
int updateByPrimaryKeySelective(PermissionSubject record);
int updateByPrimaryKey(PermissionSubject record);
}

View File

@ -54,60 +54,61 @@ import org.springframework.util.CollectionUtils;
@Service
@Slf4j
public class OldPermissionDataSyncService {
@Autowired
private IPermissionService iPermissionService;
@Autowired
private RtsPermissionDistributeDAO rtsDistributeDAO;
@Autowired
private RtsPermissionDistributeRefDAO distributeRefDAO;
@Autowired
private PermissionSubjectDAO subjectDAO;
@Autowired
private AcPermissionDAO acPermissionDAO;
@Autowired
private PermissionSystemAbilityDAO permissionSystemAbilityDAO;
@Autowired
private SystemAbilityDAO abilityDAO;
@Autowired
private SyncDAO syncDAO;
@Autowired
private SystemAbilityService abilityService;
@Autowired
private RtsMapFunctionService rtsMapFunctionService;
@Autowired
private MapInfoDAO mapInfoDAO;
@Autowired
private IPermissionService iPermissionService;
@Autowired
private RtsPermissionDistributeDAO rtsDistributeDAO;
@Autowired
private RtsPermissionDistributeRefDAO distributeRefDAO;
@Autowired
private PermissionSubjectDAO subjectDAO;
@Autowired
private AcPermissionDAO acPermissionDAO;
@Autowired
private PermissionSystemAbilityDAO permissionSystemAbilityDAO;
@Autowired
private SystemAbilityDAO abilityDAO;
private final static AtomicBoolean ISRUN = new AtomicBoolean(false);
static final Map<Long,GgenerateType> MAPID_TYPE_MAP = Maps.newHashMap();
static final List<ErrorMsgVO> SYNC_RESULT_LIST = Lists.newArrayList();
@Autowired
private SyncDAO syncDAO;
@Autowired
private SystemAbilityService abilityService;
@Autowired
private RtsMapFunctionService rtsMapFunctionService;
@Autowired
private MapInfoDAO mapInfoDAO;
static{
MAPID_TYPE_MAP.put(81L,GgenerateType.DAKE_STREAM); //北交大客流
MAPID_TYPE_MAP.put(161L,GgenerateType.EMERGENCY); //武汉8号线应急调度
MAPID_TYPE_MAP.put(127L,GgenerateType.RAILWAY); //大铁线路
MAPID_TYPE_MAP.put(133L,GgenerateType.RAILWAY); //大铁列车驾驶
MAPID_TYPE_MAP.put(154L,GgenerateType.RAILWAY); //大铁标准站
MAPID_TYPE_MAP.put(156L,GgenerateType.RAILWAY); //大铁标准站众合
MAPID_TYPE_MAP.put(157L,GgenerateType.RAILWAY); //大铁标准站成工业
MAPID_TYPE_MAP.put(213L,GgenerateType.RAILWAY); //大铁标准站京津冀
}
private final static AtomicBoolean ISRUN = new AtomicBoolean(false);
static final Map<Long, GgenerateType> MAPID_TYPE_MAP = Maps.newHashMap();
static final List<ErrorMsgVO> SYNC_RESULT_LIST = Lists.newArrayList();
private List<UserPermissionVO> findUserPermissionData(){
List<UserPermissionVO> userPermissionList = syncDAO.findCanUsedData();
List<UserPermissionVO> newList = Lists.newArrayList();
static {
MAPID_TYPE_MAP.put(81L, GgenerateType.DAKE_STREAM); //北交大客流
MAPID_TYPE_MAP.put(161L, GgenerateType.EMERGENCY); //武汉8号线应急调度
MAPID_TYPE_MAP.put(127L, GgenerateType.RAILWAY); //大铁线路
MAPID_TYPE_MAP.put(133L, GgenerateType.RAILWAY); //大铁列车驾驶
MAPID_TYPE_MAP.put(154L, GgenerateType.RAILWAY); //大铁标准站
MAPID_TYPE_MAP.put(156L, GgenerateType.RAILWAY); //大铁标准站众合
MAPID_TYPE_MAP.put(157L, GgenerateType.RAILWAY); //大铁标准站成工业
MAPID_TYPE_MAP.put(213L, GgenerateType.RAILWAY); //大铁标准站京津冀
}
userPermissionList.forEach(d->{
if(Objects.isNull(d.getForever())){
d.setForever(false);
}
if(d.getForever() || d.getEndTime().isAfter(LocalDateTime.now())){
newList.add(d);
}
private List<UserPermissionVO> findUserPermissionData() {
List<UserPermissionVO> userPermissionList = syncDAO.findCanUsedData();
List<UserPermissionVO> newList = Lists.newArrayList();
userPermissionList.forEach(d -> {
if (Objects.isNull(d.getForever())) {
d.setForever(false);
}
if (d.getForever() || d.getEndTime().isAfter(LocalDateTime.now())) {
newList.add(d);
}
// newList.add(d);
});
return newList;
}
});
return newList;
}
/* private String getErrorMsg(){
StringBuilder sb = new StringBuilder("------------------------------\n");
@ -147,321 +148,359 @@ public class OldPermissionDataSyncService {
}
}*/
private void insertPermission(List<SyncVO> syncVOList){
Set<Long> existPermissSet = Sets.newHashSet();
List<PermissionSystemAbility> allSaList = Lists.newArrayList();
for (SyncVO syncVO : syncVOList) {
if(existPermissSet.add(syncVO.getPermission().getId())){
syncVO.permission.setIsSync(true);
syncVO.getSystemAbility().forEach(d->d.setIsSync(true));
this.acPermissionDAO.customerSyncInsert(syncVO.permission);
allSaList.addAll(syncVO.getSystemAbility());
}
}
if(!CollectionUtils.isEmpty(allSaList)){
this.permissionSystemAbilityDAO.batchInsert(allSaList);
}
private void insertPermission(List<SyncVO> syncVOList) {
Set<Long> existPermissSet = Sets.newHashSet();
List<PermissionSystemAbility> allSaList = Lists.newArrayList();
for (SyncVO syncVO : syncVOList) {
if (existPermissSet.add(syncVO.getPermission().getId())) {
syncVO.permission.setIsSync(true);
syncVO.getSystemAbility().forEach(d -> d.setIsSync(true));
this.acPermissionDAO.customerSyncInsert(syncVO.permission);
allSaList.addAll(syncVO.getSystemAbility());
}
}
private void insertDistribute(List<DistributeDataVO> distributeDataVOList){
List<RtsPermissionDistributeRef> allRefList = Lists.newArrayList();
List<RtsPermissionDistribute> disList = Lists.newArrayList();
for (DistributeDataVO dataVO : distributeDataVOList) {
RtsPermissionDistribute rd = PermissionDistributeConvertor.convertDistributeDataVoTo(dataVO,dataVO.getCreatorId());
rd.setIsSync(true);
rd.setStatus(1);
disList.add(rd);
List<RtsPermissionDistributeRef> refList = PermissionDistributeConvertor.convertDistributeRefListTo(dataVO.getPermissionIds(),null);
for (RtsPermissionDistributeRef ref : refList) {
ref.setRemains(0);
ref.setIsSync(true);
allRefList.add(ref);
}
}
if(!CollectionUtils.isEmpty(disList)){
rtsDistributeDAO.customerSyncBatchInsert(disList);
}
if(!CollectionUtils.isEmpty(allRefList)){
distributeRefDAO.batchInsert(allRefList);
}
if (!CollectionUtils.isEmpty(allSaList)) {
this.permissionSystemAbilityDAO.batchInsert(allSaList);
}
}
private List<PermissionSubject> userPermission(List<UserPermissionVO> voList,Map<Long,List<SystemAbility>> funMapIdMap){
List<PermissionSubject> psList = Lists.newArrayList();
for (UserPermissionVO userPermissionVO : voList) {
List<SystemAbility> mapList = funMapIdMap.get(userPermissionVO.getMapId());
if(CollectionUtils.isEmpty(mapList)){
log.error("{} 为找到对应的功能",userPermissionVO.getMapId());
continue;
}
PermissionSubject ps = SyncConvertUtil.convertSyncSubjectFromUserPermissionVO(userPermissionVO);
private void insertDistribute(List<DistributeDataVO> distributeDataVOList) {
List<RtsPermissionDistributeRef> allRefList = Lists.newArrayList();
List<RtsPermissionDistribute> disList = Lists.newArrayList();
for (DistributeDataVO dataVO : distributeDataVOList) {
RtsPermissionDistribute rd = PermissionDistributeConvertor.convertDistributeDataVoTo(dataVO,
dataVO.getCreatorId());
rd.setIsSync(true);
rd.setStatus(1);
disList.add(rd);
List<RtsPermissionDistributeRef> refList = PermissionDistributeConvertor.convertDistributeRefListTo(
dataVO.getPermissionIds(), null);
for (RtsPermissionDistributeRef ref : refList) {
ref.setRemains(0);
ref.setIsSync(true);
allRefList.add(ref);
}
psList.add(ps);
}
return psList;
}
private List<DistributeDataVO> distributeData(List<SyncVO> syncVOList){
Set<Long> existId = new HashSet<>();
List<DistributeDataVO> datavoList = Lists.newArrayList();
for (SyncVO vo : syncVOList) {
DistributeDataVO dataVO = SyncConvertUtil.createDistributeDataVO(vo);
if(Objects.isNull(vo.getDistributeId())){
datavoList.add(dataVO);
}else if(existId.add(vo.getDistributeId())){
datavoList.add(dataVO);
}
}
return datavoList;
if (!CollectionUtils.isEmpty(disList)) {
rtsDistributeDAO.customerSyncBatchInsert(disList);
}
private List<SyncVO> findAllPermission(List<UserPermissionVO> userPermissionList,Map<Long,List<SystemAbility>> funMapIdMap){
List<UserPermissionVO> handleDataList = this.easyBeforehand(userPermissionList);
List<SyncVO> syncVOList = Lists.newArrayList();
Set<String> existPermissionIdSet = Sets.newHashSet();
for (UserPermissionVO permissionVO : handleDataList) {
List<SystemAbility> mapList = funMapIdMap.get(permissionVO.getMapId());
if(CollectionUtils.isEmpty(mapList)){
log.error("{} 为找到对应的功能",permissionVO.getMapId());
SYNC_RESULT_LIST.add(new ErrorMsgVO(ErrorType.PERSSION_NOTFIND_MAP,permissionVO,String.format("mapid[%s] 未在 rts_permission_system_ability 表中找到对应的数据",permissionVO.getMapId())));
continue;
}
if(!existPermissionIdSet.add(permissionVO.getPermissionId() + "," + permissionVO.getDistributeId())){
continue;
}
Permission permission = SyncConvertUtil.convertSyncPermissionFromPermissionVO(permissionVO);
Map<String,SystemAbility> saMap = mapList.stream().collect(Collectors.toMap(SystemAbility::getName,Function.identity()));
SystemAbility sa = this.parseMatch(permission.getName(),saMap);
String tmpName = this.parsePermissionName(permission.getName());
String newName = String.format("%s - %s",permissionVO.getMapName(),tmpName);
permission.setName(newName);
SyncVO syncVO = SyncConvertUtil.createSyncVO(permission,permissionVO);
List<SystemAbility> tmpSaList;
if(Objects.isNull(sa)){
tmpSaList = mapList.stream().filter(d-> !d.getName().contains("综合")).collect(Collectors.toList());
}else if(!CollectionUtils.isEmpty(permissionVO.getPermissionVO())){
tmpSaList = mapList.stream().filter(d-> !Objects.equals(d.getId(), sa.getId())).collect(Collectors.toList());
}else{
tmpSaList = mapList.stream().filter(d-> Objects.equals(d.getId(), sa.getId())).collect(Collectors.toList());
}
for (SystemAbility systemAbility : tmpSaList) {
syncVO.addSa(PermissionSystemAbility.of(permissionVO.getPermissionId(), systemAbility.getId()));
}
syncVOList.add(syncVO);
}
return syncVOList;
if (!CollectionUtils.isEmpty(allRefList)) {
distributeRefDAO.batchInsert(allRefList);
}
}
private List<PermissionSubject> userPermission(List<UserPermissionVO> voList,
Map<Long, List<SystemAbility>> funMapIdMap) {
List<PermissionSubject> psList = Lists.newArrayList();
for (UserPermissionVO userPermissionVO : voList) {
List<SystemAbility> mapList = funMapIdMap.get(userPermissionVO.getMapId());
if (CollectionUtils.isEmpty(mapList)) {
log.error("{} 为找到对应的功能", userPermissionVO.getMapId());
continue;
}
PermissionSubject ps = SyncConvertUtil.convertSyncSubjectFromUserPermissionVO(
userPermissionVO);
private SystemAbility parseMatch(String name, Map<String,SystemAbility> functionMap){
String tmpFunName = this.parsePermissionName(name);
for(Map.Entry<String,SystemAbility> entry : functionMap.entrySet()){
String key = entry.getKey();
String shortName = tmpFunName.substring(0,2);
if(key.contains(shortName)){
return entry.getValue();
}
}
log.info("{} ---> sourceName:{} 没有找到对应funcation功能",tmpFunName,name);
return null;
psList.add(ps);
}
return psList;
}
private void generate(MapInfo mi){
Simulation.Type type = Simulation.Type.METRO;
GgenerateType gt = MAPID_TYPE_MAP.get(mi.getId());
if(gt == GgenerateType.RAILWAY){
type = Simulation.Type.RAILWAY;
this.generate(type,mi);
}else if(gt == GgenerateType.EMERGENCY){
type = Simulation.Type.EMERGENCY;
this.generate(type,mi);
}else if(gt == GgenerateType.DAKE_STREAM){
this.generateLpf(mi);
return;
}else{
this.generate(type,mi);
}
}
private List<DistributeDataVO> distributeData(List<SyncVO> syncVOList) {
Set<Long> existId = new HashSet<>();
List<DistributeDataVO> datavoList = Lists.newArrayList();
for (SyncVO vo : syncVOList) {
private void generateLpf(MapInfo mi){
try{
this.rtsMapFunctionService.generateLpf(mi.getId(),0L);
}catch(Exception e){
SYNC_RESULT_LIST.add(new ErrorMsgVO(ErrorType.CREATE_MAP,mi,e.getMessage()));
}
DistributeDataVO dataVO = SyncConvertUtil.createDistributeDataVO(vo);
if (Objects.isNull(vo.getDistributeId())) {
datavoList.add(dataVO);
} else if (existId.add(vo.getDistributeId())) {
datavoList.add(dataVO);
}
}
private void generate(Simulation.Type type,MapInfo mi){
MapFunctionGenerateParamVO paramVO = new MapFunctionGenerateParamVO();
paramVO.setSimTypes(Arrays.asList(type));
try{
this.rtsMapFunctionService.generate(mi.getId(),paramVO,0L);
}catch(Exception e){
return datavoList;
}
SYNC_RESULT_LIST.add(new ErrorMsgVO(ErrorType.CREATE_MAP,mi,e.getMessage()));
}
private List<SyncVO> findAllPermission(List<UserPermissionVO> userPermissionList,
Map<Long, List<SystemAbility>> funMapIdMap) {
List<UserPermissionVO> handleDataList = this.easyBeforehand(userPermissionList);
List<SyncVO> syncVOList = Lists.newArrayList();
Set<String> existPermissionIdSet = Sets.newHashSet();
for (UserPermissionVO permissionVO : handleDataList) {
List<SystemAbility> mapList = funMapIdMap.get(permissionVO.getMapId());
if (CollectionUtils.isEmpty(mapList)) {
log.error("{} 为找到对应的功能", permissionVO.getMapId());
SYNC_RESULT_LIST.add(new ErrorMsgVO(ErrorType.PERSSION_NOTFIND_MAP, permissionVO,
String.format("mapid[%s] 未在 rts_permission_system_ability 表中找到对应的数据",
permissionVO.getMapId())));
continue;
}
if (!existPermissionIdSet.add(
permissionVO.getPermissionId() + "," + permissionVO.getDistributeId())) {
continue;
}
Permission permission = SyncConvertUtil.convertSyncPermissionFromPermissionVO(permissionVO);
Map<String, SystemAbility> saMap = mapList.stream()
.collect(Collectors.toMap(SystemAbility::getName, Function.identity()));
SystemAbility sa = this.parseMatch(permission.getName(), saMap);
String tmpName = this.parsePermissionName(permission.getName());
String newName = String.format("%s - %s", permissionVO.getMapName(), tmpName);
permission.setName(newName);
SyncVO syncVO = SyncConvertUtil.createSyncVO(permission, permissionVO);
List<SystemAbility> tmpSaList;
if (Objects.isNull(sa)) {
tmpSaList = mapList.stream().filter(d -> !d.getName().contains("综合"))
.collect(Collectors.toList());
} else if (!CollectionUtils.isEmpty(permissionVO.getPermissionVO())) {
tmpSaList = mapList.stream().filter(d -> !Objects.equals(d.getId(), sa.getId()))
.collect(Collectors.toList());
} else {
tmpSaList = mapList.stream().filter(d -> Objects.equals(d.getId(), sa.getId()))
.collect(Collectors.toList());
}
for (SystemAbility systemAbility : tmpSaList) {
syncVO.addSa(
PermissionSystemAbility.of(permissionVO.getPermissionId(), systemAbility.getId()));
}
syncVOList.add(syncVO);
}
private List<UserPermissionVO> easyBeforehand(List<UserPermissionVO> userPermissionList){
return syncVOList;
}
private SystemAbility parseMatch(String name, Map<String, SystemAbility> functionMap) {
String tmpFunName = this.parsePermissionName(name);
for (Map.Entry<String, SystemAbility> entry : functionMap.entrySet()) {
String key = entry.getKey();
String shortName = tmpFunName.substring(0, 2);
if (key.contains(shortName)) {
return entry.getValue();
}
}
log.info("{} ---> sourceName:{} 没有找到对应funcation功能", tmpFunName, name);
return null;
}
private void generate(MapInfo mi) {
Simulation.Type type = Simulation.Type.METRO;
GgenerateType gt = MAPID_TYPE_MAP.get(mi.getId());
if (gt == GgenerateType.RAILWAY) {
type = Simulation.Type.RAILWAY;
this.generate(type, mi);
} else if (gt == GgenerateType.EMERGENCY) {
type = Simulation.Type.EMERGENCY;
this.generate(type, mi);
} else if (gt == GgenerateType.DAKE_STREAM) {
this.generateLpf(mi);
return;
} else {
this.generate(type, mi);
}
}
private void generateLpf(MapInfo mi) {
try {
this.rtsMapFunctionService.generateLpf(mi.getId(), 0L);
} catch (Exception e) {
SYNC_RESULT_LIST.add(new ErrorMsgVO(ErrorType.CREATE_MAP, mi, e.getMessage()));
}
}
private void generate(Simulation.Type type, MapInfo mi) {
MapFunctionGenerateParamVO paramVO = new MapFunctionGenerateParamVO();
paramVO.setSimTypes(Arrays.asList(type));
try {
this.rtsMapFunctionService.generate(mi.getId(), paramVO, 0L);
} catch (Exception e) {
SYNC_RESULT_LIST.add(new ErrorMsgVO(ErrorType.CREATE_MAP, mi, e.getMessage()));
}
}
private List<UserPermissionVO> easyBeforehand(List<UserPermissionVO> userPermissionList) {
// Set<Long> existMapIdSet = Sets.newHashSet();
for (UserPermissionVO d : userPermissionList) {
if(Objects.isNull(d.getIsPackage())) d.setIsPackage(false);
if(Objects.isNull(d.getMapId())){
for (UserPermissionVO d : userPermissionList) {
if (Objects.isNull(d.getIsPackage())) {
d.setIsPackage(false);
}
if (Objects.isNull(d.getMapId())) {
// d.setErrorData(true);
continue;
}
}
Map<Boolean,List<UserPermissionVO>> userPermissionMapList = userPermissionList.stream().collect(Collectors.groupingBy(UserPermissionVO::getIsPackage));
List<UserPermissionVO> voList = userPermissionMapList.get(false);
List<UserPermissionVO> packAgeVOList = userPermissionMapList.get(true);
if(!CollectionUtils.isEmpty(packAgeVOList)){
for (UserPermissionVO userPermissionVO : packAgeVOList) {
List<Long> idLists = Splitter.on(",").omitEmptyStrings().trimResults().splitToStream(userPermissionVO.getRelPermissions()).map(Long::parseLong).collect(Collectors.toList());
idLists.remove(userPermissionVO.getPermissionId());
PermissionQueryVO queryVO = new PermissionQueryVO();
queryVO.setInIds(idLists);
List<PermissionVO> permissionVOList = this.iPermissionService.queryPermission(queryVO);
userPermissionVO.setPermissionVO(permissionVOList);
continue;
}
}
Map<Boolean, List<UserPermissionVO>> userPermissionMapList = userPermissionList.stream()
.collect(Collectors.groupingBy(UserPermissionVO::getIsPackage));
List<UserPermissionVO> voList = userPermissionMapList.get(false);
List<UserPermissionVO> packAgeVOList = userPermissionMapList.get(true);
if (!CollectionUtils.isEmpty(packAgeVOList)) {
for (UserPermissionVO userPermissionVO : packAgeVOList) {
List<Long> idLists = Splitter.on(",").omitEmptyStrings().trimResults()
.splitToStream(userPermissionVO.getRelPermissions()).map(Long::parseLong)
.collect(Collectors.toList());
idLists.remove(userPermissionVO.getPermissionId());
PermissionQueryVO queryVO = new PermissionQueryVO();
queryVO.setInIds(idLists);
List<PermissionVO> permissionVOList = this.iPermissionService.queryPermission(queryVO);
userPermissionVO.setPermissionVO(permissionVOList);
}
voList.addAll(packAgeVOList);
}
return voList;
}
voList.addAll(packAgeVOList);
}
return voList;
}
private List<SystemAbility> findSystemAbility() {
List<SystemAbility> funList = this.abilityDAO.selectByExample(null);
return funList;
}
private Map<Long, List<SystemAbility>> findSystemAbilityGroupMapId() {
List<SystemAbility> list = this.findSystemAbility();
return list.stream().collect(Collectors.groupingBy(SystemAbility::getMapId));
}
private final static String NAME_SPLIT = "-";
private String parsePermissionName(String sourceName) {
String[] tmpSS = sourceName.split(NAME_SPLIT);
String tmpFunName = tmpSS[tmpSS.length - 1].trim().replaceAll("【|】", "").trim();
return tmpFunName;
}
public static class SyncConvertUtil {
public static Permission convertSyncPermissionFromPermissionVO(UserPermissionVO vo) {
Permission permission = new Permission();
permission.setId(vo.getPermissionId());
permission.setName(vo.getPermissionName());
permission.setDes(vo.getRemarks());
permission.setCreatorId(vo.getCreatorId());
permission.setCreateTime(vo.getCreateTime());
permission.setUpdateTime(vo.getUpdateTime());
permission.setPermissionType(PermissionTypeEnum.MAP_ABILITY.getValue());
permission.setMapId(vo.getMapId());
return permission;
}
private List<SystemAbility> findSystemAbility(){
List<SystemAbility> funList = this.abilityDAO.selectByExample(null);
return funList;
public static PermissionSubject convertSyncSubjectFromUserPermissionVO(
UserPermissionVO userPermissionVO) {
PermissionSubject ps = new PermissionSubject();
ps.setPermissionId(userPermissionVO.getPermissionId());
ps.setStatus(PermissionSubjectStatusEnum.Valid.getValue());
ps.setStartTime(userPermissionVO.getStartTime());
ps.setEndTime(userPermissionVO.getEndTime());
ps.setCreateTime(userPermissionVO.getUserPermissionCreateTime());
ps.setSubjectType(PermissionSubjectTypeEnum.user.name());
ps.setSubjectId(userPermissionVO.getUserId());
ps.setAmount(userPermissionVO.getAmount());
ps.setRemains(userPermissionVO.getRemains());
ps.setForever(userPermissionVO.getForever());
ps.setDistributeId(userPermissionVO.getDistributeId());
return ps;
}
private Map<Long,List<SystemAbility>> findSystemAbilityGroupMapId(){
List<SystemAbility> list = this.findSystemAbility();
return list.stream().collect(Collectors.groupingBy(SystemAbility::getMapId));
}
private final static String NAME_SPLIT = "-";
private String parsePermissionName(String sourceName){
String[] tmpSS = sourceName.split(NAME_SPLIT);
String tmpFunName = tmpSS[tmpSS.length - 1].trim().replaceAll("【|】","").trim();
return tmpFunName;
}
public static class SyncConvertUtil{
public static DistributeDataVO createDistributeDataVO(SyncVO vo) {
DistributeDataVO dataVO = new DistributeDataVO();
dataVO.setCreatorId(vo.permission.getCreatorId());
dataVO.setId(vo.getDistributeId());
dataVO.setDsc(vo.getPermission().getName());
dataVO.setCreateTime(vo.getStartTime());
dataVO.setUpdateTime(vo.getStartTime());
dataVO.setForever(vo.forever);
dataVO.setStartTime(vo.getStartTime());
dataVO.setEndTime(vo.getEndTime());
dataVO.setStatus(PermissionDistributeStatusEnum.Valid.getValue());
dataVO.setDsc(vo.getOrganizationName());
DistributeDataVO.DistributePermissionVO dpVO = new DistributeDataVO.DistributePermissionVO();
dpVO.setPermissionId(vo.getPermission().getId());
dpVO.setDistributeId(vo.getDistributeId());
dpVO.setAmount(vo.getAmount());
dpVO.setRemains(0);
public static Permission convertSyncPermissionFromPermissionVO(UserPermissionVO vo){
Permission permission = new Permission();
permission.setId(vo.getPermissionId());
permission.setName(vo.getPermissionName());
permission.setDes(vo.getRemarks());
permission.setCreatorId(vo.getCreatorId());
permission.setCreateTime(vo.getCreateTime());
permission.setUpdateTime(vo.getUpdateTime());
permission.setPermissionType(PermissionTypeEnum.MAP_ABILITY.getValue());
permission.setMapId(vo.getMapId());
return permission;
}
public static PermissionSubject convertSyncSubjectFromUserPermissionVO(UserPermissionVO userPermissionVO){
PermissionSubject ps = new PermissionSubject();
ps.setPermissionId(userPermissionVO.getPermissionId());
ps.setStatus(PermissionSubjectStatusEnum.Valid.getValue());
ps.setStartTime(userPermissionVO.getStartTime());
ps.setEndTime(userPermissionVO.getEndTime());
ps.setCreateTime(userPermissionVO.getUserPermissionCreateTime());
ps.setSubjectType(PermissionSubjectTypeEnum.user.name());
ps.setSubjectId(userPermissionVO.getUserId());
ps.setAmount(userPermissionVO.getAmount());
ps.setRemains(userPermissionVO.getRemains());
ps.setForever(userPermissionVO.getForever());
ps.setDistributeId(userPermissionVO.getDistributeId());
return ps;
}
public static DistributeDataVO createDistributeDataVO(SyncVO vo){
DistributeDataVO dataVO = new DistributeDataVO();
dataVO.setCreatorId(vo.permission.getCreatorId());
dataVO.setId(vo.getDistributeId());
dataVO.setDsc(vo.getPermission().getName());
dataVO.setCreateTime(vo.getStartTime());
dataVO.setUpdateTime(vo.getStartTime());
dataVO.setForever(vo.forever);
dataVO.setStartTime(vo.getStartTime());
dataVO.setEndTime(vo.getEndTime());
dataVO.setStatus(PermissionDistributeStatusEnum.Valid.getValue());
dataVO.setDsc(vo.getOrganizationName());
DistributeDataVO.DistributePermissionVO dpVO = new DistributeDataVO.DistributePermissionVO();
dpVO.setPermissionId(vo.getPermission().getId());
dpVO.setDistributeId(vo.getDistributeId());
dpVO.setAmount(vo.getAmount());
dpVO.setRemains(0);
dataVO.setPermissionIds(Arrays.asList(dpVO));
return dataVO;
}
public static SyncVO createSyncVO(Permission permission,UserPermissionVO permissionVO){
SyncVO syncVO = new SyncVO(permission,new ArrayList<>());
syncVO.setAmount(permissionVO.getAmount());
syncVO.setRemains(permissionVO.getRemains());
syncVO.setForever(permissionVO.getForever());
syncVO.setStartTime(permissionVO.getStartTime());
syncVO.setEndTime(permissionVO.getEndTime());
syncVO.setDistributeId(permissionVO.getDistributeId());
syncVO.setOrganizationName(permissionVO.getOrganizationName());
return syncVO;
}
dataVO.setPermissionIds(Arrays.asList(dpVO));
return dataVO;
}
@Data
public static class SyncVO{
Permission permission;
boolean forever;
LocalDateTime startTime;
LocalDateTime endTime;
Integer amount;
Integer remains;
Long distributeId;
String organizationName;
List<PermissionSystemAbility> systemAbility;
public static SyncVO createSyncVO(Permission permission, UserPermissionVO permissionVO) {
SyncVO syncVO = new SyncVO(permission, new ArrayList<>());
syncVO.setAmount(permissionVO.getAmount());
syncVO.setRemains(permissionVO.getRemains());
syncVO.setForever(permissionVO.getForever());
syncVO.setStartTime(permissionVO.getStartTime());
syncVO.setEndTime(permissionVO.getEndTime());
syncVO.setDistributeId(permissionVO.getDistributeId());
syncVO.setOrganizationName(permissionVO.getOrganizationName());
return syncVO;
}
}
public SyncVO(Permission permission, List<PermissionSystemAbility> systemAbility) {
this.permission = permission;
this.systemAbility = systemAbility;
}
public void addSa(PermissionSystemAbility psa){
if(Objects.isNull(this.systemAbility)){
this.systemAbility = new ArrayList<>();
}
this.systemAbility.add(psa);
}
@Data
public static class SyncVO {
Permission permission;
boolean forever;
LocalDateTime startTime;
LocalDateTime endTime;
Integer amount;
Integer remains;
Long distributeId;
String organizationName;
List<PermissionSystemAbility> systemAbility;
public SyncVO(Permission permission, List<PermissionSystemAbility> systemAbility) {
this.permission = permission;
this.systemAbility = systemAbility;
}
public enum GgenerateType {
/** 地铁 */
METRO,
/** 铁路/大铁 */
RAILWAY,
/** 应急调度Emergency dispatching command system */
EMERGENCY,
DAKE_STREAM,
public void addSa(PermissionSystemAbility psa) {
if (Objects.isNull(this.systemAbility)) {
this.systemAbility = new ArrayList<>();
}
this.systemAbility.add(psa);
}
public enum ErrorType{
CREATE_MAP,
PERSSION_NOTFIND_MAP;
}
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class ErrorMsgVO{
ErrorType errorType;
Object permissionVO;
String msg;
@Override
public String toString(){
StringBuilder sb = new StringBuilder();
sb.append(String.format("类型[%s] - 原数据:[%s] -- 错误信息[%s]",this.errorType.name(),this.permissionVO.toString(),this.getMsg()));
return sb.toString();
}
}
public enum GgenerateType {
/**
* 地铁
*/
METRO,
/**
* 铁路/大铁
*/
RAILWAY,
/**
* 应急调度Emergency dispatching command system
*/
EMERGENCY,
DAKE_STREAM,
}
public enum ErrorType {
CREATE_MAP,
PERSSION_NOTFIND_MAP;
}
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class ErrorMsgVO {
ErrorType errorType;
Object permissionVO;
String msg;
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(String.format("类型[%s] - 原数据:[%s] -- 错误信息[%s]", this.errorType.name(),
this.permissionVO.toString(), this.getMsg()));
return sb.toString();
}
}
}