Merge remote-tracking branch 'origin/test' into third-part-control
This commit is contained in:
commit
680edf87e7
@ -212,8 +212,8 @@ public class MapController {
|
||||
|
||||
@ApiOperation("校验所有地图数据")
|
||||
@GetMapping("/all/simulationCheck")
|
||||
public List<MapVO> doSimulationCheckAll(@ApiIgnore @RequestAttribute AccountVO user) {
|
||||
return this.iMapService.doSimulationCheckAll(user);
|
||||
public List<MapVO> doSimulationCheckAll(@ApiIgnore @RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return this.iMapService.doSimulationCheckAll(loginInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "检测地图仿真数据是否存在错误")
|
||||
|
@ -18,26 +18,6 @@ import java.util.List;
|
||||
@Repository
|
||||
public interface SysAccountDAO extends MyBatisBaseDao<SysAccount, Long, SysAccountExample> {
|
||||
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
@Insert(value = "<script>" +
|
||||
" insert into sys_account (account, `type`, org_id, `name`, nickname, \n" +
|
||||
" avatar_path, `password`, mobile, \n" +
|
||||
" nationcode, email, wx_id, \n" +
|
||||
" wx_union_id, wm_open_id, `status`, \n" +
|
||||
" roles, create_time, \n" +
|
||||
" update_user_id, update_time)\n" +
|
||||
" values " +
|
||||
" <foreach collection=\"list\" item=\"entity\" separator=\",\"> " +
|
||||
" (#{entity.account,jdbcType=VARCHAR}, #{entity.type,jdbcType=VARCHAR}, #{entity.orgId, jdbcType=BIGINT}, #{entity.name,jdbcType=VARCHAR}, #{entity.nickname,jdbcType=VARCHAR}, \n" +
|
||||
" #{entity.avatarPath,jdbcType=VARCHAR}, #{entity.password,jdbcType=VARCHAR}, #{entity.mobile,jdbcType=VARCHAR}, \n" +
|
||||
" #{entity.nationcode,jdbcType=VARCHAR}, #{entity.email,jdbcType=VARCHAR}, #{entity.wxId,jdbcType=VARCHAR}, \n" +
|
||||
" #{entity.wxUnionId,jdbcType=VARCHAR}, #{entity.wmOpenId,jdbcType=VARCHAR}, #{entity.status,jdbcType=VARCHAR}, \n" +
|
||||
" #{entity.roles,jdbcType=VARCHAR}, #{entity.createTime,jdbcType=TIMESTAMP}, \n" +
|
||||
" #{entity.updateUserId,jdbcType=BIGINT}, #{entity.updateTime,jdbcType=TIMESTAMP})" +
|
||||
" </foreach>" +
|
||||
"</script>")
|
||||
int batchInsert(@Param("list") List<SysAccount> userList);
|
||||
|
||||
@Select("<script>" +
|
||||
"SELECT COUNT(DISTINCT id) as 'quantity', DATE(sys_account.create_time) as 'date' " +
|
||||
" FROM sys_account " +
|
||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.DictionaryDetailVO;
|
||||
import club.joylink.rtss.vo.client.MapQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
@ -300,6 +301,7 @@ public interface IMapService {
|
||||
/**
|
||||
* 校验所有地图数据
|
||||
* @return
|
||||
* @param userInfo
|
||||
*/
|
||||
List<MapVO> doSimulationCheckAll(AccountVO user);
|
||||
List<MapVO> doSimulationCheckAll(LoginUserInfoVO userInfo);
|
||||
}
|
||||
|
@ -144,9 +144,6 @@ public interface ISysUserService {
|
||||
*/
|
||||
AccountVO createUserOfWechatMicro(WmUserSession wmUserSession);
|
||||
|
||||
@Transactional
|
||||
void batchCreateUser(List<SysAccount> newSysUsers);
|
||||
|
||||
void createUser(SysAccount account);
|
||||
|
||||
String createAccount(AccountCreateVO accountCreateVO, AccountVO user);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import club.joylink.rtss.constants.MapStatus;
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import club.joylink.rtss.dao.Map3dDataDAO;
|
||||
@ -13,11 +14,14 @@ import club.joylink.rtss.services.cache.ICacheService;
|
||||
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
|
||||
import club.joylink.rtss.services.simulation.SchedulingService;
|
||||
import club.joylink.rtss.services.training.ITrainingV1Service;
|
||||
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.util.VersionUtil;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.DictionaryDetailVO;
|
||||
import club.joylink.rtss.vo.client.MapQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
@ -103,6 +107,9 @@ public class MapService implements IMapService {
|
||||
@Autowired
|
||||
private IRunPlanRoutingService runPlanDataService;
|
||||
|
||||
@Autowired
|
||||
private GroupSimulationService groupSimulationService;
|
||||
|
||||
@Override
|
||||
public List<DictionaryDetailVO> queryCityHasMap(String dicCode) {
|
||||
MapInfoExample example = new MapInfoExample();
|
||||
@ -887,19 +894,22 @@ public class MapService implements IMapService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapVO> doSimulationCheckAll(AccountVO user) {
|
||||
public List<MapVO> doSimulationCheckAll(LoginUserInfoVO userInfo) {
|
||||
List<MapVO> mapVOS = listOnline();
|
||||
List<MapVO> errorMaps = new ArrayList<>();
|
||||
for (MapVO map : mapVOS) {
|
||||
List<String> list = null;
|
||||
Simulation simulation = null;
|
||||
try {
|
||||
list = doSimulationCheck(map.getId(), user);
|
||||
simulation = groupSimulationService.create(userInfo, map.getId(), MapPrdTypeEnum.JOINT, Simulation.FunctionalType.SIMULATION);
|
||||
} catch (RuntimeException e) {
|
||||
errorMaps.add(map);
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
errorMaps.add(map);
|
||||
if (simulation != null) {
|
||||
if (!CollectionUtils.isEmpty(simulation.getDataErrMsgList())) {
|
||||
errorMaps.add(map);
|
||||
}
|
||||
groupSimulationService.clearSimulation(simulation.getId(), userInfo.getAccountVO());
|
||||
}
|
||||
}
|
||||
return errorMaps;
|
||||
|
@ -516,19 +516,13 @@ public class SysUserService implements ISysUserService {
|
||||
account.setNickname(generateNickname());
|
||||
account.setCreateTime(LocalDateTime.now());
|
||||
account.setRoles(BusinessConsts.ROLE_01);
|
||||
this.sysAccountDAO.insert(account);
|
||||
this.sysAccountDAO.insertSelective(account);
|
||||
return new AccountVO(account);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void batchCreateUser(List<SysAccount> newSysUsers) {
|
||||
this.sysAccountDAO.batchInsert(newSysUsers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUser(SysAccount newSysUser) {
|
||||
this.sysAccountDAO.insert(newSysUser);
|
||||
this.sysAccountDAO.insertSelective(newSysUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -550,7 +544,7 @@ public class SysUserService implements ISysUserService {
|
||||
sysAccount.setStatus(BusinessConsts.STATUS_USE);
|
||||
sysAccount.setRoles(BusinessConsts.ROLE_01);
|
||||
sysAccount.setCreateTime(LocalDateTime.now());
|
||||
this.sysAccountDAO.insert(sysAccount);
|
||||
this.sysAccountDAO.insertSelective(sysAccount);
|
||||
return sysAccount.getId().toString();
|
||||
}
|
||||
|
||||
@ -867,7 +861,7 @@ public class SysUserService implements ISysUserService {
|
||||
account.setRoles(BusinessConsts.ROLE_01);
|
||||
account.setCreateTime(LocalDateTime.now());
|
||||
account.setStatus(StatusEnum.Valid.getCode());
|
||||
this.sysAccountDAO.insert(account);
|
||||
this.sysAccountDAO.insertSelective(account);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -915,7 +909,7 @@ public class SysUserService implements ISysUserService {
|
||||
sysAccount.setStatus(BusinessConsts.STATUS_USE);
|
||||
sysAccount.setRoles(BusinessConsts.ROLE_01);
|
||||
sysAccount.setCreateTime(LocalDateTime.now());
|
||||
this.sysAccountDAO.insert(sysAccount);
|
||||
this.sysAccountDAO.insertSelective(sysAccount);
|
||||
vo = new AccountVO(sysAccount);
|
||||
} else {
|
||||
vo = new AccountVO(sysAccounts.get(0));
|
||||
|
@ -67,7 +67,7 @@ public class UserGenerateServiceImpl implements UserGenerateService {
|
||||
offlineUser.setStatus(BusinessConsts.STATUS_USE);
|
||||
offlineUser.setRoles(BusinessConsts.ROLE_01);
|
||||
offlineUser.setCreateTime(now);
|
||||
this.sysAccountDAO.insert(offlineUser);
|
||||
this.sysAccountDAO.insertSelective(offlineUser);
|
||||
// 生成用户权限
|
||||
// if (generateConfigVO.getGeneratePermission()) {
|
||||
// this.iUserPermissionService2.generateUserPermissions(new UserVO(offlineUser),
|
||||
|
@ -3,10 +3,8 @@ package club.joylink.rtss.services.student;
|
||||
import club.joylink.rtss.constants.*;
|
||||
import club.joylink.rtss.dao.*;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.*;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.goods.GoodsVO;
|
||||
import club.joylink.rtss.vo.client.order.OrderCreateVO;
|
||||
import club.joylink.rtss.vo.client.order.OrderDetailCreateVO;
|
||||
import club.joylink.rtss.vo.client.permissionDistribute.DistributeVO;
|
||||
@ -14,12 +12,9 @@ import club.joylink.rtss.vo.client.student.*;
|
||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionAndAmountVO;
|
||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionDistributeVO;
|
||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||
import club.joylink.rtss.vo.map.MapVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
@ -85,85 +80,7 @@ public class DepartUserStaticServiceImpl implements IDepartUserStatisticService
|
||||
@Autowired
|
||||
private OrgUserDAO departmentUserDAO;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, AccountVO creator) {
|
||||
/*
|
||||
*插入班级表
|
||||
*/
|
||||
//检车班级是否存在
|
||||
StudentClassExample classExample = new StudentClassExample();
|
||||
classExample.createCriteria().andNameEqualTo(importStudentInfo.getClassName()).andProjectCodeEqualTo(projectCode);
|
||||
List<StudentClass> studentClasses = this.studentClassDAO.selectByExample(classExample);
|
||||
StudentClass studentClass;
|
||||
boolean classExist = false;
|
||||
if (CollectionUtils.isEmpty(studentClasses)) {
|
||||
studentClass = new StudentClass();
|
||||
studentClass.setCreatorId(creator.getId());
|
||||
studentClass.setName(importStudentInfo.getClassName());
|
||||
studentClass.setProjectCode(projectCode);
|
||||
this.studentClassDAO.insert(studentClass);
|
||||
} else {
|
||||
classExist = true;
|
||||
studentClass = studentClasses.get(0);
|
||||
}
|
||||
|
||||
/*
|
||||
*插入系统用户表
|
||||
*/
|
||||
List<SysAccount> sysAccounts = StudentUserVO.convert2DBList(importStudentInfo.getStudents());
|
||||
//检查学生是否存在,存在则更新班级用户关系
|
||||
//班级不存在,学生存在,踢出学生入库列表,删除关系
|
||||
//班级存在,学生存在,踢出学入库生列表
|
||||
boolean finalClassExist = classExist;
|
||||
List<SysAccount> oldSysUsers = new ArrayList<>();
|
||||
List<SysAccount> newSysUsers = sysAccounts.stream().filter(account -> {
|
||||
SysAccountExample userExample = new SysAccountExample();
|
||||
userExample.createCriteria().andAccountEqualTo(account.getAccount());
|
||||
List<SysAccount> users = this.sysAccountDAO.selectByExample(userExample);
|
||||
if (!CollectionUtils.isEmpty(users)) {
|
||||
oldSysUsers.add(users.get(0));
|
||||
StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample();
|
||||
relIdClassExample.createCriteria().andStudentUserIdEqualTo(users.get(0).getId()).andClassIdNotEqualTo(studentClass.getId());
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(this.studentRelIdClassDAO.countByExample(relIdClassExample) <= 0,
|
||||
"其他班级已存在相同学号的学生!");
|
||||
// relIdClassExample.clear();
|
||||
// relIdClassExample.createCriteria().andStudentUserIdEqualTo(users.get(0).getId());
|
||||
// this.studentRelIdClassDAO.deleteByExample(relIdClassExample);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if (!CollectionUtils.isEmpty(newSysUsers)) {
|
||||
this.sysAccountDAO.batchInsert(newSysUsers);
|
||||
}
|
||||
oldSysUsers.addAll(newSysUsers);
|
||||
//增加班级-用户关系
|
||||
(finalClassExist ? newSysUsers : oldSysUsers).forEach(account -> {
|
||||
StudentRelIdClass studentRelIdClass = new StudentRelIdClass();
|
||||
studentRelIdClass.setClassId(studentClass.getId());
|
||||
studentRelIdClass.setStudentUserId(account.getId());
|
||||
this.studentRelIdClassDAO.insert(studentRelIdClass);
|
||||
});
|
||||
//【只考虑了贵州装备项目】检查学生的权限,自动给没有权限的学生分发权限(创建权限分发给赵杰,从赵杰的权限再分发给学生)---
|
||||
if (CollectionUtils.isEmpty(oldSysUsers)) return;
|
||||
List<MapVO> gzbMaps = iMapService.queryOnlineMapInfoListOfProject(Project.valueOf(projectCode));
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertCollectionNotEmpty(gzbMaps,
|
||||
String.format("项目[%s]没有在线的地图", projectCode));
|
||||
Long gzbMapId = gzbMaps.get(0).getId();
|
||||
Permission permission = iPermissionService.findTeachPermissionEntity(gzbMapId);
|
||||
log.warn(String.format("项目[%s]没有有效的教学权限", projectCode));
|
||||
if (permission == null) return;
|
||||
GoodsVO good = iGoodsService.queryGoodsByPermissionId(permission.getId());
|
||||
List<Long> userIds = oldSysUsers.stream().map(SysAccount::getId).collect(Collectors.toList());
|
||||
List<UserPermission> userPermissions = iUserPermissionService.findEntity(userIds, true);
|
||||
List<Long> usersWithPermissions = userPermissions.stream()
|
||||
.filter(up -> permission.getId().equals(up.getPermissionId())).map(UserPermission::getUserId).collect(Collectors.toList());
|
||||
distributePermissions2ZJ(good.getId(), userIds, usersWithPermissions);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @Override
|
||||
// public List<StudentClassVO> getClassesByProjectCode(String projectCode) {
|
||||
// StudentClassExample classExample = new StudentClassExample();
|
||||
// classExample.createCriteria().andProjectCodeEqualTo(projectCode);
|
||||
|
@ -10,15 +10,7 @@ import java.util.List;
|
||||
|
||||
public interface IDepartUserStatisticService {
|
||||
|
||||
/**
|
||||
* 导入学生用户及班级信息
|
||||
* @param projectCode 归属项目
|
||||
* @param importStudentInfo 导入的学生信息
|
||||
* @param creator 导入人员
|
||||
*/
|
||||
void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, AccountVO creator);
|
||||
|
||||
// /**
|
||||
// /**
|
||||
// * 根据项目查询班级
|
||||
// * @param projectCode
|
||||
// * @return
|
||||
|
@ -3,12 +3,10 @@ package club.joylink.rtss.simulation.cbtc.ATS.service;
|
||||
import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
|
||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.StationPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.status.DeviceStatus;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.StationTurnBackStrategyOption;
|
||||
@ -288,8 +286,8 @@ public class AtsRouteSettingService {
|
||||
// 处理站前折返的进路排列
|
||||
routePaths = repository.queryRoutePaths(trainSection, nextSection);
|
||||
} else if (train.isStop() && !trainSection.isNormalStandTrack() && (trainSection.isTurnBackTrack())) { // 折返轨停车
|
||||
// 判断从当前时间到折返后下一计划到站时间中是否存在出库的冲突计划
|
||||
if (this.containsConflictOutBoundPlan(simulation, tripPlan)) {
|
||||
// 判断从当前时间到折返后下一计划到站时间中是否存在冲突计划
|
||||
if (this.containsConflictPlan(simulation, tripPlan)) {
|
||||
log.debug(String.format("折返与出库冲突,不排列"));
|
||||
return null;
|
||||
}
|
||||
@ -346,11 +344,12 @@ public class AtsRouteSettingService {
|
||||
* @param tripPlan
|
||||
* @return
|
||||
*/
|
||||
private boolean containsConflictOutBoundPlan(Simulation simulation, TripPlan tripPlan) {
|
||||
private boolean containsConflictPlan(Simulation simulation, TripPlan tripPlan) {
|
||||
LocalTime current = simulation.getSystemTime().toLocalTime();
|
||||
LocalTime arriveTime = tripPlan.getFirstStationPlan().getArriveTime();
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
// 判断是否有冲突的出库计划
|
||||
if (tripPlan.isTurnBack()) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
LocalTime arriveTime = tripPlan.getFirstStationPlan().getArriveTime();
|
||||
if (current.isAfter(arriveTime)) {
|
||||
return false;
|
||||
}
|
||||
@ -362,11 +361,10 @@ public class AtsRouteSettingService {
|
||||
}
|
||||
}
|
||||
}
|
||||
StationPlan stationPlan = repository.queryStationPlanBetween(tripPlan.getPlanList().get(0).getStation(), current, arriveTime);
|
||||
if (stationPlan != null)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
// 判断是否有冲突的运行计划
|
||||
StationPlan stationPlan = repository.queryStationPlanBetween(tripPlan.getPlanList().get(0).getStation(), current, arriveTime);
|
||||
return stationPlan != null;
|
||||
}
|
||||
|
||||
private Route selectRouteOfPaths(Simulation simulation, TrainInfo train,
|
||||
|
@ -52,7 +52,7 @@ public class LocalInitSuperAdminTask implements ApplicationRunner {
|
||||
sysAccount.setStatus(StatusEnum.Valid.getCode());
|
||||
sysAccount.setRoles(BusinessConsts.ROLE_05);
|
||||
sysAccount.setCreateTime(LocalDateTime.now());
|
||||
this.sysAccountDAO.insert(sysAccount);
|
||||
this.sysAccountDAO.insertSelective(sysAccount);
|
||||
log.info(String.format("local superadmin not exist,init.account:%s,password:%s",
|
||||
account, password));
|
||||
} else {
|
||||
|
@ -3,6 +3,7 @@ package club.joylink.rtss.vo.client.org;
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.entity.SysAccount;
|
||||
import club.joylink.rtss.util.EncryptUtil;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -34,6 +35,7 @@ public class ImportOrgUserVO {
|
||||
SysAccount account = new SysAccount();
|
||||
account.setName(this.name);
|
||||
account.setAccount(this.account);
|
||||
account.setType(AccountVO.Type_1);
|
||||
account.setNickname(this.name);
|
||||
account.setPassword(EncryptUtil.md5(BusinessConsts.GZB_DEFAULT_PASSWORD));
|
||||
account.setStatus(BusinessConsts.STATUS_USE);
|
||||
|
Loading…
Reference in New Issue
Block a user