修改方法名
This commit is contained in:
parent
64c6261939
commit
d266d3a6bc
@ -72,7 +72,7 @@ public class CompanyService implements ICompanyService {
|
||||
|
||||
@Override
|
||||
public void addManager(Integer companyId, List<Long> userIds, UserVO user) {
|
||||
iSysUserService.ensureAdmin(user);
|
||||
iSysUserService.confirmAdmin(user);
|
||||
List<UserCompanyRel> ucrList = getUserCompanyRelEntity(userIds);
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(ucrList.stream().allMatch(ucr -> ucr.getCompanyId().equals(companyId)),
|
||||
"有的用户不属于该公司");
|
||||
@ -100,8 +100,8 @@ public class CompanyService implements ICompanyService {
|
||||
|
||||
@Override
|
||||
public void superAdminUpdateUserCompanyRel(Long userId, Integer companyId, UserVO superAdmin) {
|
||||
iSysUserService.ensureSuperAdmin(superAdmin.getId());
|
||||
iSysUserService.ensureExist(userId);
|
||||
iSysUserService.confirmSuperAdmin(superAdmin.getId());
|
||||
iSysUserService.confirmExist(userId);
|
||||
createOrUpdateUserCompanyRel(userId, companyId);
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,14 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
|
||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.dao.*;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.draftData.DraftMapFlankProtectionService;
|
||||
import club.joylink.rtss.services.draftData.DraftMapRunLevelService;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
|
||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
@ -18,13 +16,14 @@ import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.TreeNode;
|
||||
import club.joylink.rtss.vo.client.map.*;
|
||||
import club.joylink.rtss.vo.client.map.newmap.*;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@ -154,7 +153,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
DraftMapWithBLOBs draftMap = draftMapVo.convert2Draft();
|
||||
draftMap.setAuthorId(userVO.getId());
|
||||
// 名称唯一性校验
|
||||
ensureDraftMapNameNotExist(draftMap);
|
||||
confirmDraftMapNameNotExist(draftMap);
|
||||
draftMap.setUpdateTime(LocalDateTime.now());
|
||||
if (draftMap.getDrawWay()) {
|
||||
MapGraphDataNewVO graphDataVO = new MapGraphDataNewVO();
|
||||
@ -178,7 +177,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
upMap.setAuthorId(userVO.getId());
|
||||
upMap.setUpdateTime(LocalDateTime.now());
|
||||
// 名称唯一性校验
|
||||
ensureDraftMapNameNotExist(upMap);
|
||||
confirmDraftMapNameNotExist(upMap);
|
||||
//更改线路的话重置皮肤数据
|
||||
String changedLineCode = draftMapVO.getLineCode();//传递的线路code
|
||||
if (StringUtils.hasText(changedLineCode) && !Objects.equals(draftMap.getLineCode(), changedLineCode)) {
|
||||
@ -204,7 +203,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
draftMap.setName(name);
|
||||
draftMap.setUpdateTime(LocalDateTime.now());
|
||||
// 名称唯一性校验
|
||||
ensureDraftMapNameNotExist(draftMap);
|
||||
confirmDraftMapNameNotExist(draftMap);
|
||||
// 插入新副本
|
||||
draftMapDAO.insert(draftMap);
|
||||
if (draftMap.getDrawWay()) {
|
||||
@ -365,7 +364,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
draftMap.setName(name);
|
||||
draftMap.setAuthorId(userVO.getId());
|
||||
// 名称唯一性校验
|
||||
ensureDraftMapNameNotExist(draftMap);
|
||||
confirmDraftMapNameNotExist(draftMap);
|
||||
draftMap.setLineCode(mapVO.getLineCode());
|
||||
draftMap.setDrawWay(mapVO.isDrawWay());
|
||||
draftMap.setUpdateTime(LocalDateTime.now());
|
||||
@ -804,7 +803,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
draftMapDAO.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
private void ensureDraftMapNameNotExist(DraftMap map) {
|
||||
private void confirmDraftMapNameNotExist(DraftMap map) {
|
||||
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertNotTrue(checkDraftMapNameExist(map));
|
||||
}
|
||||
|
||||
@ -1183,14 +1182,14 @@ public class DraftMapService implements IDraftMapService {
|
||||
|
||||
@Override
|
||||
public void createAutoSignal(MapAutoSignalVO autoSignalVO) {
|
||||
ensureAutoSignalNotExist(autoSignalVO, null);
|
||||
confirmAutoSignalNotExist(autoSignalVO, null);
|
||||
DraftMapAutoSignal autoSignal = autoSignalVO.convert2Draft();
|
||||
draftMapAutoSignalDAO.insert(autoSignal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAutoSignal(MapAutoSignalNewVO autoSignalVO) {
|
||||
ensureAutoSignalNotExist(autoSignalVO, null);
|
||||
confirmAutoSignalNotExist(autoSignalVO, null);
|
||||
DraftMapAutoSignal autoSignal = autoSignalVO.convert2Draft();
|
||||
draftMapAutoSignalDAO.insert(autoSignal);
|
||||
}
|
||||
@ -1252,7 +1251,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
@Override
|
||||
public void updateAutoSignal(Long autoSignalId, MapAutoSignalVO autoSignalVO) {
|
||||
getDraftMapAutoSignalEntity(autoSignalId);
|
||||
ensureAutoSignalNotExist(autoSignalVO, autoSignalId);
|
||||
confirmAutoSignalNotExist(autoSignalVO, autoSignalId);
|
||||
DraftMapAutoSignal newAutoSignal = autoSignalVO.convert2Draft();
|
||||
newAutoSignal.setId(autoSignalId);
|
||||
draftMapAutoSignalDAO.updateByPrimaryKeyWithBLOBs(newAutoSignal);
|
||||
@ -1261,7 +1260,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
@Override
|
||||
public void updateAutoSignal(Long autoSignalId, MapAutoSignalNewVO autoSignalVO) {
|
||||
getDraftMapAutoSignalEntity(autoSignalId);
|
||||
ensureAutoSignalNotExist(autoSignalVO, autoSignalId);
|
||||
confirmAutoSignalNotExist(autoSignalVO, autoSignalId);
|
||||
DraftMapAutoSignal newAutoSignal = autoSignalVO.convert2Draft();
|
||||
newAutoSignal.setId(autoSignalId);
|
||||
draftMapAutoSignalDAO.updateByPrimaryKeyWithBLOBs(newAutoSignal);
|
||||
@ -1292,7 +1291,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
return !CollectionUtils.isEmpty(draftMapAutoSignals);
|
||||
}
|
||||
|
||||
private void ensureAutoSignalNotExist(MapAutoSignalVO mapAutoSignalVO, Long autoSignalId) {
|
||||
private void confirmAutoSignalNotExist(MapAutoSignalVO mapAutoSignalVO, Long autoSignalId) {
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifAutoSignalExist(mapAutoSignalVO, autoSignalId));
|
||||
}
|
||||
|
||||
@ -1308,7 +1307,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
return !CollectionUtils.isEmpty(draftMapAutoSignals);
|
||||
}
|
||||
|
||||
private void ensureAutoSignalNotExist(MapAutoSignalNewVO mapAutoSignalVO, Long autoSignalId) {
|
||||
private void confirmAutoSignalNotExist(MapAutoSignalNewVO mapAutoSignalVO, Long autoSignalId) {
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifAutoSignalExist(mapAutoSignalVO, autoSignalId));
|
||||
}
|
||||
/*------------ AutoSignal END ---------------------*/
|
||||
@ -1318,7 +1317,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
@Override
|
||||
public void createRoute(MapRouteVO routeVO) {
|
||||
// 编号唯一校验
|
||||
ensureRouteNotExist(routeVO.getMapId(), routeVO.getCode());
|
||||
confirmRouteNotExist(routeVO.getMapId(), routeVO.getCode());
|
||||
// 保存进路信息
|
||||
DraftMapRoute route = routeVO.convert2Draft();
|
||||
draftMapRouteDAO.insert(route);
|
||||
@ -1327,7 +1326,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
@Override
|
||||
public void createRoute(MapRouteNewVO routeVO) {
|
||||
// 编号唯一校验
|
||||
ensureRouteNotExist(routeVO.getMapId(), routeVO.getCode());
|
||||
confirmRouteNotExist(routeVO.getMapId(), routeVO.getCode());
|
||||
// 保存进路信息
|
||||
DraftMapRoute route = routeVO.convert2Draft();
|
||||
draftMapRouteDAO.insert(route);
|
||||
@ -1429,7 +1428,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
@Override
|
||||
public void createOverlap(MapOverlapVO mapOverlapVO) {
|
||||
if (StringUtils.hasText(mapOverlapVO.getName())) {
|
||||
ensureOverlapNameNotRepeat(mapOverlapVO);
|
||||
confirmOverlapNameNotRepeat(mapOverlapVO);
|
||||
}
|
||||
DraftMapOverlap draftMapOverlap = mapOverlapVO.convert2Draft();
|
||||
this.draftMapOverlapDAO.insert(draftMapOverlap);
|
||||
@ -1476,7 +1475,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
/*------------autoReentry start ---------------------*/
|
||||
@Override
|
||||
public void createAutoReentry(MapAutoReentryVO mapAutoReentryVO) {
|
||||
ensureAutoReentryNotExist(mapAutoReentryVO);
|
||||
confirmAutoReentryNotExist(mapAutoReentryVO);
|
||||
DraftMapAutoReentry draftMapAutoReentry = mapAutoReentryVO.convert2Draft();
|
||||
this.draftMapAutoReentryDAO.insert(draftMapAutoReentry);
|
||||
}
|
||||
@ -1988,7 +1987,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
return autoSignal;
|
||||
}
|
||||
|
||||
private void ensureRouteNotExist(Long mapId, String code) {
|
||||
private void confirmRouteNotExist(Long mapId, String code) {
|
||||
DraftMapRouteExample example = new DraftMapRouteExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andCodeEqualTo(code);
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(draftMapRouteDAO.countByExample(example) == 0);
|
||||
@ -2004,7 +2003,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
return route;
|
||||
}
|
||||
|
||||
private void ensureOverlapNameNotRepeat(MapOverlapVO mapOverlapVO) {
|
||||
private void confirmOverlapNameNotRepeat(MapOverlapVO mapOverlapVO) {
|
||||
DraftMapOverlapExample example = new DraftMapOverlapExample();
|
||||
example.createCriteria()
|
||||
.andMapIdEqualTo(mapOverlapVO.getMapId())
|
||||
@ -2023,7 +2022,7 @@ public class DraftMapService implements IDraftMapService {
|
||||
return draftMapOverlap;
|
||||
}
|
||||
|
||||
private void ensureAutoReentryNotExist(MapAutoReentryVO mapAutoReentryVO) {
|
||||
private void confirmAutoReentryNotExist(MapAutoReentryVO mapAutoReentryVO) {
|
||||
DraftMapAutoReentryExample example = new DraftMapAutoReentryExample();
|
||||
example.createCriteria()
|
||||
.andMapIdEqualTo(mapAutoReentryVO.getMapId())
|
||||
|
@ -221,7 +221,7 @@ public class GoodsService implements IGoodsService {
|
||||
* 如果要更新的商品不存在,报DBException(数据不存在)
|
||||
*/
|
||||
public void updateGoods(Long id, GoodsUpdateVO updateVO, UserVO user) {
|
||||
ensureExist(id);
|
||||
confirmExist(id);
|
||||
SaleGoods goods = updateVO.convert2DB();
|
||||
goods.setId(id);
|
||||
goods.setUpdateUserId(user.getId());
|
||||
@ -230,7 +230,7 @@ public class GoodsService implements IGoodsService {
|
||||
saleGoodsDAO.updateByPrimaryKeySelective(goods);
|
||||
}
|
||||
|
||||
private void ensureExist(Long id) {
|
||||
private void confirmExist(Long id) {
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(isExist(id),
|
||||
String.format("id为[%s]的商品不存在", id));
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public interface ISysUserService {
|
||||
/**
|
||||
* 确认用户是管理员,否则,报错
|
||||
*/
|
||||
void ensureAdmin(UserVO user);
|
||||
void confirmAdmin(UserVO user);
|
||||
|
||||
/**
|
||||
* 根据地图id查询订阅人员
|
||||
@ -253,9 +253,9 @@ public interface ISysUserService {
|
||||
boolean isSuperAdmin(Long id);
|
||||
|
||||
/**
|
||||
* 确保是超管
|
||||
* 确认用户是超管
|
||||
*/
|
||||
void ensureSuperAdmin(Long userId);
|
||||
void confirmSuperAdmin(Long userId);
|
||||
|
||||
boolean isExist(Long id);
|
||||
|
||||
@ -286,9 +286,9 @@ public interface ISysUserService {
|
||||
List<SysUser> findEntity(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 确保该用户存在
|
||||
* 确认该用户存在
|
||||
*/
|
||||
void ensureExist(Long id);
|
||||
void confirmExist(Long id);
|
||||
|
||||
void superAdminUpdateUserInfo(UserVO updateUser, UserVO superAdmin);
|
||||
|
||||
|
@ -248,7 +248,7 @@ public class LearnService implements ILearnService {
|
||||
|
||||
@Override
|
||||
public void adminDeleteComment(Long commentId, UserVO user) {
|
||||
iSysUserService.ensureAdmin(user);
|
||||
iSysUserService.confirmAdmin(user);
|
||||
learnCommentDAO.deleteByPrimaryKey(commentId);
|
||||
}
|
||||
|
||||
@ -288,7 +288,7 @@ public class LearnService implements ILearnService {
|
||||
|
||||
@Override
|
||||
public void adminDeleteMessage(Long messageId, UserVO user) {
|
||||
iSysUserService.ensureAdmin(user);
|
||||
iSysUserService.confirmAdmin(user);
|
||||
deleteMessage(messageId);
|
||||
}
|
||||
|
||||
@ -359,7 +359,7 @@ public class LearnService implements ILearnService {
|
||||
}
|
||||
|
||||
private LearnPost topCheck(Long postId, UserVO userVO) {
|
||||
iSysUserService.ensureAdmin(userVO);
|
||||
iSysUserService.confirmAdmin(userVO);
|
||||
LearnPost post = getPostEntity(postId);
|
||||
return post;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ public class MapService implements IMapService {
|
||||
public void onLine(Long id, UserVO userVO) {
|
||||
// 判断地图数据是否存在
|
||||
MapInfo map = getMapInfoEntity(id);
|
||||
iSysUserService.ensureAdmin(userVO);
|
||||
iSysUserService.confirmAdmin(userVO);
|
||||
map.setStatus(MapStatus.Online.getCode());
|
||||
mapInfoDAO.updateByPrimaryKey(map);
|
||||
}
|
||||
@ -334,7 +334,7 @@ public class MapService implements IMapService {
|
||||
public void offLine(Long id, UserVO userVO) {
|
||||
// 判断地图数据是否存在
|
||||
MapInfo map = getMapInfoEntity(id);
|
||||
iSysUserService.ensureAdmin(userVO);
|
||||
iSysUserService.confirmAdmin(userVO);
|
||||
map.setStatus(MapStatus.Offline.getCode());
|
||||
mapInfoDAO.updateByPrimaryKey(map);
|
||||
}
|
||||
@ -516,7 +516,7 @@ public class MapService implements IMapService {
|
||||
|
||||
@Override
|
||||
public void updateName(Long id, String name, UserVO userVO) {
|
||||
iSysUserService.ensureAdmin(userVO);
|
||||
iSysUserService.confirmAdmin(userVO);
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(isNameExistExcept(name, id));
|
||||
MapInfo map = getMapInfoEntity(id);
|
||||
map.setName(name);
|
||||
@ -525,7 +525,7 @@ public class MapService implements IMapService {
|
||||
|
||||
@Override
|
||||
public void updateBelongCity(Long id, String cityCode, UserVO user) {
|
||||
iSysUserService.ensureAdmin(user);
|
||||
iSysUserService.confirmAdmin(user);
|
||||
MapInfo mapInfo = findMapInfoEntity(id);
|
||||
if (Objects.nonNull(mapInfo)) {
|
||||
mapInfo.setCityCode(cityCode);
|
||||
|
@ -258,7 +258,7 @@ public class MapSystemService implements IMapSystemService {
|
||||
|
||||
@Override
|
||||
public void delete(Long id, UserVO userVO) {
|
||||
iSysUserService.ensureAdmin(userVO);
|
||||
iSysUserService.confirmAdmin(userVO);
|
||||
mapSystemDAO.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
|
@ -663,7 +663,7 @@ public class PermissionDistributeService implements IPermissionDistributeService
|
||||
|
||||
@Override
|
||||
public String createAllMapDistribute(Project project, Integer num, UserVO user) {
|
||||
iSysUserService.ensureAdmin(user);
|
||||
iSysUserService.confirmAdmin(user);
|
||||
List<MapVO> maps = iMapService.queryOnlineMapInfoListOfProject(project);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(maps,
|
||||
String.format("项目[%s]下没有地图", project));
|
||||
|
@ -263,7 +263,7 @@ public class SysUserService implements ISysUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ensureAdmin(UserVO user) {
|
||||
public void confirmAdmin(UserVO user) {
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertTrue(isAdmin(user));
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ public class SysUserService implements ISysUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ensureSuperAdmin(Long userId) {
|
||||
public void confirmSuperAdmin(Long userId) {
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertTrue(isSuperAdmin(userId));
|
||||
}
|
||||
|
||||
@ -721,7 +721,7 @@ public class SysUserService implements ISysUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ensureExist(Long id) {
|
||||
public void confirmExist(Long id) {
|
||||
getEntity(id);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user