Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
joylink_zhangsai 2020-12-02 11:27:42 +08:00
commit 76889f8411
7 changed files with 79 additions and 9 deletions

View File

@ -1,5 +1,9 @@
package club.joylink.rtss.exception;
import org.springframework.util.StringUtils;
import java.util.Objects;
public class BaseException extends RuntimeException {
private IExceptionMessage exceptionMessage;
@ -29,6 +33,9 @@ public class BaseException extends RuntimeException {
}
public String getVoMessage() {
if (!StringUtils.isEmpty(super.getMessage())) {
return super.getMessage();
}
return this.exceptionMessage.getMessage();
}
}

View File

@ -221,18 +221,21 @@ public class SysUserService implements ISysUserService {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
SysUserExample example = new SysUserExample();
SysUserExample.Criteria criteria = example.createCriteria();
if(StringUtils.hasText(queryVO.getName())) {
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
}
if(StringUtils.hasText(queryVO.getNickname())) {
if (StringUtils.hasText(queryVO.getNickname())) {
criteria.andNicknameLike(String.format("%%%s%%", queryVO.getNickname()));
}
if(StringUtils.hasText(queryVO.getMobile())) {
if (StringUtils.hasText(queryVO.getMobile())) {
criteria.andMobileLike(String.format("%%%s%%", queryVO.getMobile()));
}
if(StringUtils.hasText(queryVO.getRolesStr())) {
if (StringUtils.hasText(queryVO.getRolesStr())) {
criteria.andRolesLike(String.format("%%%s%%", queryVO.getRolesStr()));
}
if (Objects.nonNull(queryVO.getCompanyId())) {
criteria.andCompanyIdEqualTo(queryVO.getCompanyId());
}
Page<SysUser> page = (Page<SysUser>) this.sysUserDAO.selectByExample(example);
List<UserVO> userVOS = UserVO.convert2VO(page.getResult());
Map<Integer, CompanyVO> companyMap = iCompanyService.queryOrganizations().stream()

View File

@ -180,21 +180,21 @@ public class QuestionBankService implements IQuestionBankService {
if (questionVO.isSelect() || questionVO.isJudge()) {
long answerCount = questionVO.getOptionList().stream().filter(QuestionOptionVO::getCorrect).count();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1,
String.format("单选或判断题[%s]正确答案应当有且只有一个!", topic));
String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(),topic));
}
if (questionVO.isFill() || questionVO.isAnswer()) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
questionVO.getOptionList().stream().allMatch(QuestionOptionVO::getCorrect),
String.format("填空或问答题[%s]不能有错误选项!", topic));
String.format("题序[%s]:填空或问答题[%s]不能有错误选项!", questionVO.getId(),topic));
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
questionVO.getOptionList().stream().noneMatch(op -> Objects.isNull(op.getOrder())),
String.format("填空或问答题[%s]选项缺少序号!", topic));
String.format("题序[%s]:填空或问答题[%s]选项缺少序号!", questionVO.getId(),topic));
if (questionVO.getOptionList().stream().anyMatch(op -> Objects.isNull(op.getOrder()))) {
questionVO.getOptionList().sort(Comparator.comparing(QuestionOptionVO::getOrder));
AtomicInteger i = new AtomicInteger(1);
questionVO.getOptionList().forEach(o -> {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertEquals(o.getOrder(), i.getAndIncrement(),
String.format("填空或问答题[%s]选项序号不对!", topic));
String.format("题序[%s]:填空或问答题[%s]选项序号不对!", questionVO.getId(), topic));
});
}

View File

@ -1074,9 +1074,40 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
private RouteFls buildNpFls(Switch aSwitch) {
RouteFls fls = new RouteFls(new SwitchElement(aSwitch, true));
// 暂时只生成一级侧防
Switch linkedSwitch = aSwitch.queryLinkedSwitch();
if (Objects.nonNull(linkedSwitch)) {
// 联动道岔存在联动道岔定位即为一级侧防
RouteFls.FlsElement flsElement = new RouteFls.FlsElement(new SwitchElement(linkedSwitch, true));
fls.addLevel1(flsElement);
} else {
// 无联动道岔则从道岔B区段向外查询第一个反向信号机和经过的路径道岔位置构成一级侧防
Section c = aSwitch.getC();
if (c.getLeftSection() == null && c.getRightSection() == null) {
// 尽头区段不需构成侧防
return null;
}
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(c.getLeftSection() != null && c.getRightSection() != null,
String.format("道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段", c.debugStr()));
boolean right = true;
Section section = c.getRightSection();
if (c.getLeftSection() != null) { // 左向区段存在方向向左
right = false;
section = c.getLeftSection();
}
while (Objects.nonNull(section)) {
Signal oppositeSignal = section.getSignalOf(!right);
if (Objects.nonNull(oppositeSignal)) {
Section firstSection = oppositeSignal.getSection().getSectionOf(oppositeSignal.isRight());
RouteFls.FlsElement flsElement;
if (firstSection.isSwitchTrack()) {
flsElement = new RouteFls.FlsElement(oppositeSignal, new SwitchElement(firstSection.getRelSwitch(), true));
} else {
flsElement = new RouteFls.FlsElement(oppositeSignal);
}
fls.addLevel1(flsElement);
}
}
}
return null;
}

View File

@ -3,6 +3,9 @@ package club.joylink.rtss.simulation;
import java.util.Set;
public class SimulationUser {
/**
* 仿真用户唯一标识并且是发布订阅消息时的用户唯一标识
*/
private String id;
/**
* 用户仿真消息订阅

View File

@ -3,6 +3,7 @@ package club.joylink.rtss.simulation.cbtc.data.map;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
@ -26,6 +27,13 @@ public class RouteFls {
this.base = base;
}
public void addLevel1(FlsElement flsElement) {
if (level1List == null) {
level1List = new ArrayList<>();
}
level1List.add(flsElement);
}
/**
* 侧防元件
*/
@ -48,6 +56,18 @@ public class RouteFls {
*/
private SwitchElement fpae;
public FlsElement(SwitchElement switchElement) {
this.pSwitch = switchElement;
}
public FlsElement(Signal pSignal) {
this.pSignal = pSignal;
}
public FlsElement(Signal pSignal, SwitchElement fpae) {
this.pSignal = pSignal;
this.fpae = fpae;
}
}
}

View File

@ -33,6 +33,12 @@ public class UserQueryVO extends PageQueryVO {
@ApiModelProperty(value = "手机号")
private String mobile;
/**
* 单位名称
*/
@ApiModelProperty(value = "单位名称")
private Integer companyId;
/**
* 角色
*/