Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-zhouyin
This commit is contained in:
commit
4f138401db
@ -1,9 +1,6 @@
|
||||
package club.joylink.rtss.controller.paper;
|
||||
|
||||
import club.joylink.rtss.services.paper.PaperUserCreateService;
|
||||
import club.joylink.rtss.services.paper.PaperUserLoadQuestionService;
|
||||
import club.joylink.rtss.services.paper.PaperUserService;
|
||||
import club.joylink.rtss.services.paper.PaperUserSubmitAnswerService;
|
||||
import club.joylink.rtss.services.paper.*;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.paper.*;
|
||||
@ -26,6 +23,8 @@ public class PaperUserController {
|
||||
private PaperUserLoadQuestionService paperUserLoadQuestionService;
|
||||
@Autowired
|
||||
private PaperUserSubmitAnswerService paperUserSubmitAnswerService;
|
||||
@Autowired
|
||||
private PaperUserFindPageService paperUserFindPageService;
|
||||
|
||||
/**
|
||||
* 根据试卷蓝图生成用户的试卷
|
||||
@ -89,11 +88,11 @@ public class PaperUserController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查看用户试卷基本信息
|
||||
* 分页查询某个试卷蓝图的所有用户试卷基本信息
|
||||
*/
|
||||
public PageVO<PaperUserInfoVo> findPageUserByPage(@RequestBody FindPaperUserByPageReqVo req, @RequestAttribute AccountVO user) {
|
||||
|
||||
return null;
|
||||
@PostMapping("/user/page/composition")
|
||||
public PageVO<PaperUserInfoVo>findPaperUserByPage(@RequestBody FindPaperUserForCompositionReqVo req, @RequestAttribute AccountVO user){
|
||||
return this.paperUserFindPageService.findPaperUserByPage(req,user);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,9 +3,10 @@ package club.joylink.rtss.controller.project;
|
||||
import club.joylink.rtss.entity.project.Project;
|
||||
import club.joylink.rtss.entity.project.ProjectView;
|
||||
import club.joylink.rtss.services.project.ProjectService;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.project.ProjectQueryVO;
|
||||
import club.joylink.rtss.vo.project.ProjectVO;
|
||||
import club.joylink.rtss.vo.project.ProjectViewQueryVO;
|
||||
import club.joylink.rtss.vo.project.ProjectViewVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -23,7 +24,7 @@ public class ProjectInfoController {
|
||||
private ProjectService projectService;
|
||||
|
||||
@GetMapping("/page")
|
||||
public PageVO<Project> pagingQuery(PageQueryVO queryVO) {
|
||||
public PageVO<Project> pagingQuery(ProjectQueryVO queryVO) {
|
||||
return projectService.pagingQuery(queryVO);
|
||||
}
|
||||
|
||||
@ -58,7 +59,7 @@ public class ProjectInfoController {
|
||||
}
|
||||
|
||||
@GetMapping("/viewSetting/page")
|
||||
public PageVO<ProjectView> projectViewPagingQuery(PageQueryVO queryVO) {
|
||||
public PageVO<ProjectView> projectViewPagingQuery(ProjectViewQueryVO queryVO) {
|
||||
return projectService.projectViewPagingQuery(queryVO);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,78 @@
|
||||
package club.joylink.rtss.services.paper;
|
||||
|
||||
import club.joylink.rtss.dao.paper.PaperCompositionDAO;
|
||||
import club.joylink.rtss.dao.paper.PaperUserDAO;
|
||||
import club.joylink.rtss.entity.paper.PaperComposition;
|
||||
import club.joylink.rtss.entity.paper.PaperUser;
|
||||
import club.joylink.rtss.entity.paper.PaperUserExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.paper.FindPaperUserForCompositionReqVo;
|
||||
import club.joylink.rtss.vo.paper.PaperUserInfoVo;
|
||||
import club.joylink.rtss.vo.paper.convertor.PaperUserConvertor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户试卷分页查询业务实现
|
||||
*/
|
||||
@Service
|
||||
public class PaperUserFindPageService {
|
||||
@Autowired
|
||||
private PaperCompositionDAO paperCompositionDAO;
|
||||
@Autowired
|
||||
private PaperUserDAO paperUserDAO;
|
||||
|
||||
/**
|
||||
* 分页查询某个试卷蓝图的所有用户试卷基本信息
|
||||
*/
|
||||
public PageVO<PaperUserInfoVo> findPaperUserByPage(FindPaperUserForCompositionReqVo req, AccountVO user) {
|
||||
PageVO<PaperUserInfoVo> page = new PageVO<>();
|
||||
//
|
||||
PaperComposition pc = paperCompositionDAO.selectByPrimaryKey(req.getPcId());
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(pc);
|
||||
PaperUserExample example = new PaperUserExample();
|
||||
PaperUserExample.Criteria c = example.createCriteria().andPcIdEqualTo(req.getPcId());
|
||||
switch (req.getFindType()){
|
||||
case Pass:c.andScoreIsNotNull().andScoreGreaterThanOrEqualTo(pc.getPassScore());break;
|
||||
case NotPass:c.andScoreIsNotNull().andScoreLessThan(pc.getPassScore());break;
|
||||
case NotComplete:c.andScoreIsNull();break;
|
||||
case Complete:c.andScoreIsNotNull();break;
|
||||
case All:break;
|
||||
}
|
||||
long sum = paperUserDAO.countByExample(example);
|
||||
page.setTotal(sum);
|
||||
page.setPageNum(req.getPageNum());
|
||||
page.setPageSize(req.getPageSize());
|
||||
page.setList(new ArrayList<>());
|
||||
if (sum > 0) {
|
||||
//
|
||||
String orderBy = req.getOrderBy().with();
|
||||
long startIndex = (req.getPageNum() - 1) * req.getPageSize();
|
||||
//
|
||||
if (req.getDesc()) {
|
||||
example.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
|
||||
} else {
|
||||
example.setOrderByClause(String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
|
||||
}
|
||||
List<PaperUser> pContent = this.paperUserDAO.selectByExample(example);
|
||||
if (null != pContent) {
|
||||
pContent.forEach(t -> {
|
||||
PaperUserInfoVo pi = new PaperUserInfoVo();
|
||||
pi.setPcId(pc.getId());
|
||||
pi.setName(pc.getName());
|
||||
pi.setProfile(pc.getProfile());
|
||||
pi.setCompanyId(pc.getCompanyId());
|
||||
pi.setPaper(PaperUserConvertor.convert(t));
|
||||
page.getList().add(pi);
|
||||
});
|
||||
}
|
||||
}
|
||||
//
|
||||
return page;
|
||||
}
|
||||
}
|
@ -64,7 +64,6 @@ public class PaperUserSubmitAnswerService {
|
||||
break;
|
||||
case Training:
|
||||
rsp.setResult(submitTrainingAnswer(puq, req));
|
||||
;
|
||||
break;
|
||||
}
|
||||
//记录用户答题情况
|
||||
|
@ -2,9 +2,10 @@ package club.joylink.rtss.services.project;
|
||||
|
||||
import club.joylink.rtss.entity.project.Project;
|
||||
import club.joylink.rtss.entity.project.ProjectView;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.project.ProjectQueryVO;
|
||||
import club.joylink.rtss.vo.project.ProjectVO;
|
||||
import club.joylink.rtss.vo.project.ProjectViewQueryVO;
|
||||
import club.joylink.rtss.vo.project.ProjectViewVO;
|
||||
|
||||
import java.util.List;
|
||||
@ -17,7 +18,7 @@ public interface ProjectService {
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
PageVO<Project> pagingQuery(PageQueryVO queryVO);
|
||||
PageVO<Project> pagingQuery(ProjectQueryVO queryVO);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
@ -52,7 +53,7 @@ public interface ProjectService {
|
||||
/**
|
||||
* 前端设置信息分页
|
||||
*/
|
||||
PageVO<ProjectView> projectViewPagingQuery(PageQueryVO queryVO);
|
||||
PageVO<ProjectView> projectViewPagingQuery(ProjectViewQueryVO queryVO);
|
||||
|
||||
/**
|
||||
* 获取所有的前端配置
|
||||
|
@ -8,9 +8,10 @@ import club.joylink.rtss.entity.project.ProjectView;
|
||||
import club.joylink.rtss.entity.project.ProjectViewExample;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.project.ProjectQueryVO;
|
||||
import club.joylink.rtss.vo.project.ProjectVO;
|
||||
import club.joylink.rtss.vo.project.ProjectViewQueryVO;
|
||||
import club.joylink.rtss.vo.project.ProjectViewVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@ -40,10 +41,16 @@ public class ProjectServiceImpl implements ProjectService {
|
||||
private ProjectViewDAO projectViewDAO;
|
||||
|
||||
@Override
|
||||
public PageVO<Project> pagingQuery(PageQueryVO queryVO) {
|
||||
public PageVO<Project> pagingQuery(ProjectQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
ProjectExample projectExample = new ProjectExample();
|
||||
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
|
||||
ProjectExample.Criteria criteria = projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
|
||||
if (!StringUtils.isEmpty(queryVO.getCode())) {
|
||||
criteria.andCodeEqualTo(queryVO.getCode());
|
||||
}
|
||||
if (!StringUtils.isEmpty(queryVO.getName())) {
|
||||
criteria.andNameLike(queryVO.getName());
|
||||
}
|
||||
Page<Project> page = (Page<Project>) projectDAO.selectWithBLOBsByExample(projectExample);
|
||||
return PageVO.convert(page, page.getResult());
|
||||
}
|
||||
@ -113,10 +120,16 @@ public class ProjectServiceImpl implements ProjectService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<ProjectView> projectViewPagingQuery(PageQueryVO queryVO) {
|
||||
public PageVO<ProjectView> projectViewPagingQuery(ProjectViewQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
ProjectViewExample projectViewExample = new ProjectViewExample();
|
||||
projectViewExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
|
||||
ProjectViewExample.Criteria criteria = projectViewExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
|
||||
if (!StringUtils.isEmpty(queryVO.getProject())) {
|
||||
criteria.andProjectEqualTo(queryVO.getProject());
|
||||
}
|
||||
if (!StringUtils.isEmpty(queryVO.getMarkKey())) {
|
||||
criteria.andMarkKeyEqualTo(queryVO.getMarkKey());
|
||||
}
|
||||
Page<ProjectView> page = (Page<ProjectView>) projectViewDAO.selectWithBLOBsByExample(projectViewExample);
|
||||
return PageVO.convert(page, page.getResult());
|
||||
}
|
||||
|
@ -149,13 +149,12 @@ public class DisCmdDb {
|
||||
locker.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
//当receiptState为AllSigned时member为null
|
||||
private DisCmdReceipt createReceipt(DisCmdReceipt.Status receiptState, DisCmd cmd, DisCmdCompany cp, SimulationMember member) {
|
||||
DisCmdReceipt r = new DisCmdReceipt();
|
||||
r.setId(this.getCmdReceiptId());
|
||||
//
|
||||
DisCmdCompany sendCp = cmd.getSendCompany();
|
||||
MapElement memDev = member.getDevice();
|
||||
//
|
||||
DisCmdCompanyState state = this.cmdStateMap.get(cp.getId());
|
||||
r.setState(receiptState);
|
||||
@ -174,7 +173,7 @@ public class DisCmdDb {
|
||||
case AllSigned:break;
|
||||
case TrainSrmSent:
|
||||
case TrainSrmReceived:r.setSrmStationCode(cp.getTransStationCode());break;
|
||||
case Signed:r.setRcCpCode(memDev.getCode());
|
||||
case Signed:r.setRcCpCode(member.getDevice().getCode());
|
||||
case ProxySigned:r.setSignedBy(member.getName());break;
|
||||
case Rejected:r.setRejectBy(member.getName());break;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public class DisCmdFindService {
|
||||
db.lock();
|
||||
//迭代所有调令
|
||||
db.getUnSafeCmdMap().values().forEach(cmd->{
|
||||
|
||||
//迭代调令的所有单位
|
||||
cmd.companies().forEach(cp->{
|
||||
if(cp.getCpType().equals(holderType)){
|
||||
@ -41,6 +42,12 @@ public class DisCmdFindService {
|
||||
rsp.addDisCmd(cmd.copy());
|
||||
rsp.addCompany(cp.copy());
|
||||
rsp.addCompanyState(db.getUnSafeCmdStateMap().get(cp.getId()).copy());
|
||||
if(!cp.getRsCompany()){//发令单位
|
||||
cmd.getRcvCompanies().forEach(rcp->{
|
||||
rsp.addCompany(rcp.copy());
|
||||
rsp.addCompanyState(db.getUnSafeCmdStateMap().get(rcp.getId()).copy());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -68,8 +68,8 @@ public class DisCmdSendService {
|
||||
//
|
||||
cmd.getRcvCompanies().forEach(rc -> {
|
||||
this.doSend(simulation, db, cmd, rc, sender);
|
||||
this.pushDisCmdToClient(simulation, db, cmd, rc);
|
||||
});
|
||||
this.pushDisCmdToClient(simulation, db, cmd);
|
||||
} finally {
|
||||
db.unlock();
|
||||
}
|
||||
@ -128,12 +128,12 @@ public class DisCmdSendService {
|
||||
/**
|
||||
* 推送调令到前端客户端
|
||||
*/
|
||||
private void pushDisCmdToClient(Simulation simulation, DisCmdDb db, DisCmd cmd, DisCmdCompany to) {
|
||||
private void pushDisCmdToClient(Simulation simulation, DisCmdDb db, DisCmd cmd) {
|
||||
//获取客户端未读的受令推送
|
||||
cmd.getRcvCompanies().forEach(rc -> {
|
||||
DisCmdCompanyState rcState = db.getUnSafeCmdStateMap().get(rc.getId());
|
||||
if (DisCmdCompanyState.Status.Sent.equals(rcState.getState())) {//已发送但未读
|
||||
this.sendDisCmdMessage(simulation, db, cmd, to);
|
||||
this.sendDisCmdMessage(simulation, db, cmd, rc);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,13 +1,29 @@
|
||||
package club.joylink.rtss.vo.paper;
|
||||
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 分页查询用户试卷请求
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class FindPaperUserByPageReqVo extends PageQueryVO {
|
||||
|
||||
/**
|
||||
* 试卷蓝图id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long pcId;
|
||||
/**
|
||||
* 组织id
|
||||
*/
|
||||
private String companyId;
|
||||
}
|
||||
|
@ -0,0 +1,117 @@
|
||||
package club.joylink.rtss.vo.paper;
|
||||
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 根据试卷蓝图分页查询相关用户试卷
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class FindPaperUserForCompositionReqVo extends PageQueryVO {
|
||||
|
||||
/**
|
||||
* 试卷蓝图id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@NotNull
|
||||
private Long pcId;
|
||||
/**
|
||||
* 查询类型,默认所有
|
||||
*/
|
||||
private FindType findType = FindType.All;
|
||||
/**
|
||||
* 以什么来排序,默认以用户试卷创建时间
|
||||
*/
|
||||
private OrderByType orderBy = OrderByType.CreateTime;
|
||||
/**
|
||||
* 是否降序,true-降序,false-升序,默认值为true;
|
||||
*/
|
||||
private Boolean desc = true;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
public enum OrderByType {
|
||||
CreateTime(1, "create_time"),//用户试卷创建时间
|
||||
StartTime(2, "start_time"),//用户开始答题时间
|
||||
Score(3, "score"),//用户最终得分
|
||||
;
|
||||
private Integer value;
|
||||
private String orderBy;
|
||||
|
||||
private OrderByType(Integer value, String type) {
|
||||
this.value = value;
|
||||
this.orderBy = type;
|
||||
}
|
||||
|
||||
public String with() {
|
||||
return this.orderBy;
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static OrderByType getItem(Integer value) {
|
||||
return map.get(value);
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Integer getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
private static Map<Integer, OrderByType> map = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (OrderByType t : values()) {
|
||||
map.put(t.value, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询类型枚举
|
||||
*/
|
||||
public enum FindType {
|
||||
All(1),//所有
|
||||
Pass(2),//所有及格的
|
||||
NotPass(3),//所有不及格的
|
||||
NotComplete(4),//未完成考试
|
||||
Complete(5),//完成考试,即及格和不及格的
|
||||
;
|
||||
private Integer value;
|
||||
|
||||
private FindType(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static FindType getItem(Integer value) {
|
||||
return map.get(value);
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Integer getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
private static Map<Integer, FindType> map = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (FindType t : values()) {
|
||||
map.put(t.value, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ public class PaperCompositionVo {
|
||||
private String profile;
|
||||
|
||||
/**
|
||||
* 项目code
|
||||
* 组织id
|
||||
*/
|
||||
private String companyId;
|
||||
|
||||
|
@ -7,4 +7,27 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class PaperUserInfoVo {
|
||||
/**
|
||||
* 试卷蓝图id
|
||||
*/
|
||||
private Long pcId;
|
||||
|
||||
/**
|
||||
* 试卷蓝图名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 试卷蓝图简介
|
||||
*/
|
||||
private String profile;
|
||||
|
||||
/**
|
||||
* 组织id
|
||||
*/
|
||||
private String companyId;
|
||||
/**
|
||||
* 试卷
|
||||
*/
|
||||
private PaperUserVo paper;
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package club.joylink.rtss.vo.project;
|
||||
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class ProjectQueryVO extends PageQueryVO {
|
||||
/**
|
||||
* 项目编码,后端使用
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package club.joylink.rtss.vo.project;
|
||||
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ProjectViewQueryVO extends PageQueryVO {
|
||||
|
||||
private String markKey;
|
||||
|
||||
private String project;
|
||||
}
|
Loading…
Reference in New Issue
Block a user