Merge remote-tracking branch 'origin/test-training2' into test-training2
This commit is contained in:
commit
f132220891
@ -66,6 +66,9 @@ public class UserController {
|
|||||||
@Role({RoleEnum.SuperAdmin, RoleEnum.Admin})
|
@Role({RoleEnum.SuperAdmin, RoleEnum.Admin})
|
||||||
@GetMapping(path = "sync")
|
@GetMapping(path = "sync")
|
||||||
public String sync( HttpServletResponse response){
|
public String sync( HttpServletResponse response){
|
||||||
|
if(!this.syncService.initData()){
|
||||||
|
return "正在同步。。。";
|
||||||
|
}
|
||||||
File file = this.syncService.sync();
|
File file = this.syncService.sync();
|
||||||
if(Objects.isNull(file) || !file.exists()){
|
if(Objects.isNull(file) || !file.exists()){
|
||||||
return "未找到统计的同步文件";
|
return "未找到统计的同步文件";
|
||||||
|
@ -5,6 +5,7 @@ import club.joylink.rtss.entity.permission.PermissionSubjectExample;
|
|||||||
import club.joylink.rtss.vo.permission.PermissionSubjectStatusEnum;
|
import club.joylink.rtss.vo.permission.PermissionSubjectStatusEnum;
|
||||||
import club.joylink.rtss.vo.permission.subject.PermissionSubjectQueryVO;
|
import club.joylink.rtss.vo.permission.subject.PermissionSubjectQueryVO;
|
||||||
import club.joylink.rtss.vo.permission.subject.PermissionSubjectVO;
|
import club.joylink.rtss.vo.permission.subject.PermissionSubjectVO;
|
||||||
|
import org.apache.ibatis.annotations.Insert;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
@ -81,6 +82,19 @@ public interface PermissionSubjectDAO {
|
|||||||
|
|
||||||
int insert(PermissionSubject record);
|
int insert(PermissionSubject record);
|
||||||
|
|
||||||
|
@Insert("<script>" +
|
||||||
|
"insert into rts_permission_subject (permission_id, subject_type, subject_id, amount, remains, `status`,forever, start_time, end_time,create_time, distribute_id, parent_id,is_sync)" +
|
||||||
|
" values " +
|
||||||
|
"<foreach collection=\"list\" item=\"item\" index=\"index\" separator=\",\"> " +
|
||||||
|
"(#{item.permissionId,jdbcType=BIGINT}, #{item.subjectType,jdbcType=VARCHAR}, #{item.subjectId,jdbcType=BIGINT}," +
|
||||||
|
" #{item.amount,jdbcType=INTEGER}, #{item.remains,jdbcType=INTEGER}, #{item.status,jdbcType=INTEGER}, " +
|
||||||
|
" #{item.forever,jdbcType=BIT}, #{item.startTime,jdbcType=TIMESTAMP}, #{item.endTime,jdbcType=TIMESTAMP}," +
|
||||||
|
" #{item.createTime,jdbcType=TIMESTAMP}, #{item.distributeId,jdbcType=BIGINT}, #{item.parentId,jdbcType=BIGINT}," +
|
||||||
|
" #{item.isSync,jdbcType=BIT})" +
|
||||||
|
"</foreach>" +
|
||||||
|
|
||||||
|
"</script>")
|
||||||
|
void batchInsert(@Param("list") List<PermissionSubject> list);
|
||||||
int insertSelective(PermissionSubject record);
|
int insertSelective(PermissionSubject record);
|
||||||
|
|
||||||
List<PermissionSubject> selectByExample(PermissionSubjectExample example);
|
List<PermissionSubject> selectByExample(PermissionSubjectExample example);
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package club.joylink.rtss.dao.permission;
|
package club.joylink.rtss.dao.permission;
|
||||||
|
|
||||||
|
import club.joylink.rtss.entity.permission.PermissionSubject;
|
||||||
import club.joylink.rtss.entity.permission.PermissionSystemAbility;
|
import club.joylink.rtss.entity.permission.PermissionSystemAbility;
|
||||||
import club.joylink.rtss.entity.permission.PermissionSystemAbilityExample;
|
import club.joylink.rtss.entity.permission.PermissionSystemAbilityExample;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Insert;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@ -16,6 +19,14 @@ public interface PermissionSystemAbilityDAO {
|
|||||||
|
|
||||||
int deleteByPrimaryKey(Long id);
|
int deleteByPrimaryKey(Long id);
|
||||||
|
|
||||||
|
@Insert("<script>" +
|
||||||
|
"insert into rts_permission_system_ability (permission_id, system_ability_id, is_sync)" +
|
||||||
|
" values " +
|
||||||
|
"<foreach collection=\"list\" item=\"item\" index=\"index\" separator=\",\"> " +
|
||||||
|
"(#{item.permissionId,jdbcType=BIGINT}, #{item.systemAbilityId,jdbcType=BIGINT}, #{item.isSync,jdbcType=BIT})" +
|
||||||
|
"</foreach>" +
|
||||||
|
"</script>")
|
||||||
|
void batchInsert(@Param("list") List<PermissionSystemAbility> list);
|
||||||
int insert(PermissionSystemAbility record);
|
int insert(PermissionSystemAbility record);
|
||||||
|
|
||||||
int insertSelective(PermissionSystemAbility record);
|
int insertSelective(PermissionSystemAbility record);
|
||||||
|
@ -135,6 +135,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
|
|||||||
return msgList;
|
return msgList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
|
||||||
@Override
|
@Override
|
||||||
public List<String> generateLpf(long mapId, long creatorId) {
|
public List<String> generateLpf(long mapId, long creatorId) {
|
||||||
List<MapPassengerFlowVO> pfDataList = mapPassengerFlowDataService.queryAllPassengerFlowBaseDataOfMap(mapId);
|
List<MapPassengerFlowVO> pfDataList = mapPassengerFlowDataService.queryAllPassengerFlowBaseDataOfMap(mapId);
|
||||||
|
@ -38,6 +38,7 @@ import java.io.FileWriter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -68,14 +69,16 @@ public class OldPermissionDataSyncService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MapInfoDAO mapInfoDAO;
|
private MapInfoDAO mapInfoDAO;
|
||||||
|
|
||||||
static final Map<Long,Simulation.Type> MAPID_TYPE_MAP = Maps.newHashMap();
|
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();
|
static final List<ErrorMsgVO> SYNC_RESULT_LIST = Lists.newArrayList();
|
||||||
|
|
||||||
static{
|
static{
|
||||||
MAPID_TYPE_MAP.put(154L,Simulation.Type.RAILWAY); //大铁标准站
|
MAPID_TYPE_MAP.put(154L,GgenerateType.RAILWAY); //大铁标准站
|
||||||
// MAPID_TYPE_MAP.put(81L,Simulation.Type.RAILWAY); //北交大客流
|
MAPID_TYPE_MAP.put(81L,GgenerateType.DAKE_STREAM); //北交大客流
|
||||||
MAPID_TYPE_MAP.put(161L,Simulation.Type.EMERGENCY); //武汉8号线应急调度
|
MAPID_TYPE_MAP.put(161L,GgenerateType.EMERGENCY); //武汉8号线应急调度
|
||||||
}
|
}
|
||||||
|
|
||||||
private void truncateAllTable(){
|
private void truncateAllTable(){
|
||||||
syncDAO.clearRtsPermission();
|
syncDAO.clearRtsPermission();
|
||||||
syncDAO.clearRtsDistribute();
|
syncDAO.clearRtsDistribute();
|
||||||
@ -83,42 +86,69 @@ public class OldPermissionDataSyncService {
|
|||||||
syncDAO.clearRtsPermissionSystemAbility();
|
syncDAO.clearRtsPermissionSystemAbility();
|
||||||
syncDAO.clearRtsPermissionSubject();
|
syncDAO.clearRtsPermissionSubject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean initData(){
|
||||||
|
if(ISRUN.compareAndSet(false,true)){
|
||||||
|
SYNC_RESULT_LIST.clear();
|
||||||
|
try{
|
||||||
|
truncateAllTable();
|
||||||
|
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);
|
||||||
|
ISRUN.compareAndSet(true,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public File sync(){
|
public File sync(){
|
||||||
SYNC_RESULT_LIST.clear();
|
|
||||||
truncateAllTable();
|
try{
|
||||||
|
|
||||||
List<UserPermissionVO> userPermissionList = syncDAO.findCanUsedData();
|
List<UserPermissionVO> userPermissionList = syncDAO.findCanUsedData();
|
||||||
List<SyncVO> syncVOList = findAllPermission(userPermissionList);
|
Map<Long,List<SystemAbility>> funMapIdMap = this.findSystemAbilityGroupMapId();
|
||||||
|
List<SyncVO> syncVOList = findAllPermission(userPermissionList,funMapIdMap);
|
||||||
List<DistributeDataVO> distributeDataVOList = distributeData(syncVOList);
|
List<DistributeDataVO> distributeDataVOList = distributeData(syncVOList);
|
||||||
List<PermissionSubject> psList = this.userPermission(userPermissionList);
|
List<PermissionSubject> psList = this.userPermission(userPermissionList,funMapIdMap);
|
||||||
insertPermission(syncVOList);
|
insertPermission(syncVOList);
|
||||||
insertDistribute(distributeDataVOList);
|
insertDistribute(distributeDataVOList);
|
||||||
insertUserPermission(psList);
|
insertUserPermission(psList);
|
||||||
return outErrorMsg();
|
File file = outErrorMsg();
|
||||||
|
return file;
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("用户权限同步失败 msg:" + e.getMessage(),e);
|
||||||
|
throw e;
|
||||||
|
}finally {
|
||||||
|
ISRUN.compareAndSet(true,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private File outErrorMsg(){
|
private File outErrorMsg(){
|
||||||
List<Long> createMapErrorList = SYNC_RESULT_LIST.stream().filter(d->d.errorType == ErrorType.CREATE_MAP).map(d->d.getPermissionVO().getMapId()).distinct().collect(Collectors.toList());
|
|
||||||
MapInfoExample example = new MapInfoExample();
|
|
||||||
example.createCriteria().andIdIn(createMapErrorList);
|
|
||||||
List<MapInfo> mapInfoList = this.mapInfoDAO.selectByExample(example);
|
|
||||||
|
|
||||||
List<String> xiajiaList = mapInfoList.stream().filter(d->!Objects.equals(d.getStatus(),"1")).map(d->String.format("%s [%s] [%s]",d.getId(),d.getName(),Objects.equals(d.getStatus(),"1")?"正常":"下架")).collect(Collectors.toList());
|
|
||||||
List<String> zhengchangList = mapInfoList.stream().filter(d->Objects.equals(d.getStatus(),"1")).map(d->String.format("%s [%s] [%s]",d.getId(),d.getName(),Objects.equals(d.getStatus(),"1")?"正常":"下架")).collect(Collectors.toList());
|
|
||||||
|
|
||||||
BufferedWriter bw = null;
|
BufferedWriter bw = null;
|
||||||
try{
|
try{
|
||||||
File file = File.createTempFile("error",".txt");
|
File file = File.createTempFile("error",".txt");
|
||||||
bw = new BufferedWriter(new FileWriter(file));
|
bw = new BufferedWriter(new FileWriter(file));
|
||||||
bw.write("------------------------------\n");
|
bw.write("------------------------------\n");
|
||||||
bw.write("创建子系统错误【下架】的数据\n");
|
// bw.write("创建子系统错误【下架】的数据\n");
|
||||||
bw.write(Joiner.on(",").join(xiajiaList));
|
// bw.write(Joiner.on(",").join(xiajiaList));
|
||||||
bw.write("\n\n");
|
// bw.write("\n\n");
|
||||||
bw.write("------------------------------\n");
|
// bw.write("------------------------------\n");
|
||||||
bw.write("创建子系统正常【创建失败】的数据\n");
|
// bw.write("创建子系统正常【创建失败】的数据\n");
|
||||||
bw.write(Joiner.on(",").join(zhengchangList));
|
// bw.write(Joiner.on(",").join(zhengchangList));
|
||||||
bw.write("\n\n\n\n");
|
// bw.write("\n\n\n\n");
|
||||||
bw.write("------------------------------\n");
|
bw.write("------------------------------\n");
|
||||||
for (ErrorMsgVO errorMsgVO : SYNC_RESULT_LIST) {
|
for (ErrorMsgVO errorMsgVO : SYNC_RESULT_LIST) {
|
||||||
bw.write(errorMsgVO.toString());
|
bw.write(errorMsgVO.toString());
|
||||||
@ -144,11 +174,10 @@ public class OldPermissionDataSyncService {
|
|||||||
for (SyncVO syncVO : syncVOList) {
|
for (SyncVO syncVO : syncVOList) {
|
||||||
syncVO.permission.setIsSync(true);
|
syncVO.permission.setIsSync(true);
|
||||||
this.acPermissionDAO.customerSyncInsert(syncVO.permission);
|
this.acPermissionDAO.customerSyncInsert(syncVO.permission);
|
||||||
for (PermissionSystemAbility sa : syncVO.getSystemAbility()) {
|
syncVO.getSystemAbility().forEach(d->d.setIsSync(true));
|
||||||
sa.setIsSync(true);
|
|
||||||
permissionSystemAbilityDAO.insert(sa);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
List<PermissionSystemAbility> tmpList = syncVOList.stream().map(d->d.getSystemAbility()).flatMap(d->d.stream()).collect(Collectors.toList());
|
||||||
|
this.permissionSystemAbilityDAO.batchInsert(tmpList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertDistribute(List<DistributeDataVO> distributeDataVOList){
|
private void insertDistribute(List<DistributeDataVO> distributeDataVOList){
|
||||||
@ -164,15 +193,19 @@ public class OldPermissionDataSyncService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void insertUserPermission(List<PermissionSubject> psList){
|
private void insertUserPermission(List<PermissionSubject> psList){
|
||||||
|
if(CollectionUtils.isEmpty(psList)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (PermissionSubject ps : psList) {
|
for (PermissionSubject ps : psList) {
|
||||||
ps.setIsSync(true);
|
ps.setIsSync(true);
|
||||||
this.subjectDAO.insert(ps);
|
// this.subjectDAO.insert(ps);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<PermissionSubject> userPermission(List<UserPermissionVO> voList){
|
this.subjectDAO.batchInsert(psList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<PermissionSubject> userPermission(List<UserPermissionVO> voList,Map<Long,List<SystemAbility>> funMapIdMap){
|
||||||
List<PermissionSubject> psList = Lists.newArrayList();
|
List<PermissionSubject> psList = Lists.newArrayList();
|
||||||
Map<Long,List<SystemAbility>> funMapIdMap = this.findSystemAbilityGroupMapId();
|
|
||||||
for (UserPermissionVO userPermissionVO : voList) {
|
for (UserPermissionVO userPermissionVO : voList) {
|
||||||
List<SystemAbility> mapList = funMapIdMap.get(userPermissionVO.getMapId());
|
List<SystemAbility> mapList = funMapIdMap.get(userPermissionVO.getMapId());
|
||||||
if(CollectionUtils.isEmpty(mapList)){
|
if(CollectionUtils.isEmpty(mapList)){
|
||||||
@ -197,18 +230,15 @@ public class OldPermissionDataSyncService {
|
|||||||
return datavoList;
|
return datavoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<SyncVO> findAllPermission(List<UserPermissionVO> userPermissionList){
|
private List<SyncVO> findAllPermission(List<UserPermissionVO> userPermissionList,Map<Long,List<SystemAbility>> funMapIdMap){
|
||||||
List<UserPermissionVO> handleDataList = this.easyBeforehand(userPermissionList);
|
List<UserPermissionVO> handleDataList = this.easyBeforehand(userPermissionList);
|
||||||
this.abilityService.autoSynchMapSystemData(0L);
|
|
||||||
|
|
||||||
Map<Long,List<SystemAbility>> funMapIdMap = this.findSystemAbilityGroupMapId();
|
|
||||||
List<SyncVO> syncVOList = Lists.newArrayList();
|
List<SyncVO> syncVOList = Lists.newArrayList();
|
||||||
Set<Long> existPermissionIdSet = Sets.newHashSet();
|
Set<Long> existPermissionIdSet = Sets.newHashSet();
|
||||||
for (UserPermissionVO permissionVO : handleDataList) {
|
for (UserPermissionVO permissionVO : handleDataList) {
|
||||||
List<SystemAbility> mapList = funMapIdMap.get(permissionVO.getMapId());
|
List<SystemAbility> mapList = funMapIdMap.get(permissionVO.getMapId());
|
||||||
if(CollectionUtils.isEmpty(mapList)){
|
if(CollectionUtils.isEmpty(mapList)){
|
||||||
log.error("{} 为找到对应的功能",permissionVO.getMapId());
|
log.error("{} 为找到对应的功能",permissionVO.getMapId());
|
||||||
SYNC_RESULT_LIST.add(new ErrorMsgVO(ErrorType.PERSSION_NOTFIND_MAP,permissionVO,""));
|
SYNC_RESULT_LIST.add(new ErrorMsgVO(ErrorType.PERSSION_NOTFIND_MAP,permissionVO,String.format("mapid[%s] 未在 rts_permission_system_ability 表中找到对应的数据",permissionVO.getMapId())));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!existPermissionIdSet.add(permissionVO.getPermissionId())){
|
if(!existPermissionIdSet.add(permissionVO.getPermissionId())){
|
||||||
@ -251,29 +281,50 @@ public class OldPermissionDataSyncService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<UserPermissionVO> easyBeforehand(List<UserPermissionVO> userPermissionList){
|
private void generate(MapInfo mi){
|
||||||
Set<Long> existMapIdSet = Sets.newHashSet();
|
Simulation.Type type = Simulation.Type.METRO;
|
||||||
userPermissionList.forEach(d-> {
|
GgenerateType gt = MAPID_TYPE_MAP.get(mi.getId());
|
||||||
if(Objects.isNull(d.getMapId())){
|
if(gt == GgenerateType.RAILWAY){
|
||||||
d.setErrorData(true);
|
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{
|
}else{
|
||||||
if(existMapIdSet.add(d.getMapId())){
|
this.generate(type,mi);
|
||||||
Simulation.Type type = Objects.isNull(MAPID_TYPE_MAP.get(d.getMapId())) ? Simulation.Type.METRO : MAPID_TYPE_MAP.get(d.getMapId());
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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){
|
||||||
RtsMapFunctionGenerateParamVO paramVO = new RtsMapFunctionGenerateParamVO();
|
RtsMapFunctionGenerateParamVO paramVO = new RtsMapFunctionGenerateParamVO();
|
||||||
paramVO.setSimTypes(Arrays.asList(type));
|
paramVO.setSimTypes(Arrays.asList(type));
|
||||||
try{
|
try{
|
||||||
this.rtsMapFunctionService.generate(d.getMapId(),paramVO,0L);
|
this.rtsMapFunctionService.generate(mi.getId(),paramVO,0L);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
|
|
||||||
d.setErrorData(true);
|
SYNC_RESULT_LIST.add(new ErrorMsgVO(ErrorType.CREATE_MAP,mi,e.getMessage()));
|
||||||
SYNC_RESULT_LIST.add(new ErrorMsgVO(ErrorType.CREATE_MAP,d,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.getIsPackage())) d.setIsPackage(false);
|
||||||
|
if(Objects.isNull(d.getMapId())){
|
||||||
|
// d.setErrorData(true);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
userPermissionList.stream().filter(UserPermissionVO::isErrorData).collect(Collectors.toList());
|
Map<Boolean,List<UserPermissionVO>> userPermissionMapList = userPermissionList.stream().collect(Collectors.groupingBy(UserPermissionVO::getIsPackage));
|
||||||
Map<Boolean,List<UserPermissionVO>> userPermissionMapList = userPermissionList.stream().filter(d->!d.getIsPackage()).collect(Collectors.groupingBy(UserPermissionVO::getIsPackage));
|
|
||||||
List<UserPermissionVO> voList = userPermissionMapList.get(false);
|
List<UserPermissionVO> voList = userPermissionMapList.get(false);
|
||||||
List<UserPermissionVO> packAgeVOList = userPermissionMapList.get(true);
|
List<UserPermissionVO> packAgeVOList = userPermissionMapList.get(true);
|
||||||
if(!CollectionUtils.isEmpty(packAgeVOList)){
|
if(!CollectionUtils.isEmpty(packAgeVOList)){
|
||||||
@ -390,7 +441,15 @@ public class OldPermissionDataSyncService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum GgenerateType {
|
||||||
|
/** 地铁 */
|
||||||
|
METRO,
|
||||||
|
/** 铁路/大铁 */
|
||||||
|
RAILWAY,
|
||||||
|
/** 应急调度(Emergency dispatching command system) */
|
||||||
|
EMERGENCY,
|
||||||
|
DAKE_STREAM,
|
||||||
|
}
|
||||||
public enum ErrorType{
|
public enum ErrorType{
|
||||||
CREATE_MAP,
|
CREATE_MAP,
|
||||||
PERSSION_NOTFIND_MAP;
|
PERSSION_NOTFIND_MAP;
|
||||||
@ -400,7 +459,7 @@ public class OldPermissionDataSyncService {
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class ErrorMsgVO{
|
public static class ErrorMsgVO{
|
||||||
ErrorType errorType;
|
ErrorType errorType;
|
||||||
UserPermissionVO permissionVO;
|
Object permissionVO;
|
||||||
String msg;
|
String msg;
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
|
@ -34,6 +34,6 @@ public class UserPermissionVO {
|
|||||||
private Integer amount;
|
private Integer amount;
|
||||||
private Integer remains;
|
private Integer remains;
|
||||||
private String mapName;
|
private String mapName;
|
||||||
private boolean errorData;
|
// private boolean errorData;
|
||||||
private List<PermissionVO> permissionVO;
|
private List<PermissionVO> permissionVO;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,6 @@
|
|||||||
,A.forever,A.amount,A.remains,C.name as map_name
|
,A.forever,A.amount,A.remains,C.name as map_name
|
||||||
from user_permission A left join permission B on A.permission_id = B.id
|
from user_permission A left join permission B on A.permission_id = B.id
|
||||||
left join map_info C on B.map_id = C.id
|
left join map_info C on B.map_id = C.id
|
||||||
where 1 = 1 and C.id is not null
|
where 1 = 1 and C.id is not null and C.status = '1'
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -14,6 +14,7 @@ public class SyncServiceTest {
|
|||||||
private OldPermissionDataSyncService syncService;
|
private OldPermissionDataSyncService syncService;
|
||||||
@Test
|
@Test
|
||||||
public void sync(){
|
public void sync(){
|
||||||
|
this.syncService.initData();
|
||||||
File file = this.syncService.sync();
|
File file = this.syncService.sync();
|
||||||
if(Objects.isNull(file)){
|
if(Objects.isNull(file)){
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user