kangwei : 风险巡检、
在线考试相关接口
正在显示
19 个修改的文件
包含
216 行增加
和
120 行删除
1 | package com.skua.modules.edu.controller; | ||
2 | |||
3 | import io.swagger.annotations.Api; | ||
4 | import lombok.extern.slf4j.Slf4j; | ||
5 | import org.springframework.web.bind.annotation.RequestMapping; | ||
6 | import org.springframework.web.bind.annotation.RestController; | ||
7 | |||
8 | /** | ||
9 | * 功能描述:在线考试 | ||
10 | * @auther kangwei | ||
11 | * @create 2024-09-20-14:49 | ||
12 | */ | ||
13 | @Slf4j | ||
14 | @Api(tags="在线考试-在线考试") | ||
15 | @RestController("examController") | ||
16 | @RequestMapping("/web/edu/exam") | ||
17 | public class ExamController { | ||
18 | |||
19 | //在线考试列表 | ||
20 | |||
21 | // 根据试卷获取试题 | ||
22 | |||
23 | // 在线答题 | ||
24 | |||
25 | |||
26 | // 保存答题卡,并计算成绩 | ||
27 | |||
28 | |||
29 | } |
... | @@ -136,13 +136,13 @@ public class PaperController { | ... | @@ -136,13 +136,13 @@ public class PaperController { |
136 | @AutoLog(value = "在线考试-发布试卷") | 136 | @AutoLog(value = "在线考试-发布试卷") |
137 | @ApiOperation(value="在线考试-发布试卷", notes="在线考试-发布试卷") | 137 | @ApiOperation(value="在线考试-发布试卷", notes="在线考试-发布试卷") |
138 | @GetMapping(value = "/publish") | 138 | @GetMapping(value = "/publish") |
139 | public Result<Paper> publish(@RequestParam(name="id",required=true) String id) { | 139 | public Result<Paper> publish(@RequestParam(name="id",required=true) String id,@RequestParam(name="sendStatus",required=true) String sendStatus) { |
140 | Result<Paper> result = new Result<Paper>(); | 140 | Result<Paper> result = new Result<Paper>(); |
141 | Paper paper = paperService.getById(id); | 141 | Paper paper = paperService.getById(id); |
142 | if(paper==null) { | 142 | if(paper==null) { |
143 | result.error500("未找到对应实体"); | 143 | result.error500("未找到对应实体"); |
144 | }else { | 144 | }else { |
145 | paper.setSendStatus("1"); | 145 | paper.setSendStatus(sendStatus); |
146 | paper.setSendTime( new Date()); | 146 | paper.setSendTime( new Date()); |
147 | boolean ok = paperService.updateById(paper); | 147 | boolean ok = paperService.updateById(paper); |
148 | //TODO 返回false说明什么? | 148 | //TODO 返回false说明什么? |
... | @@ -208,13 +208,13 @@ public class PaperController { | ... | @@ -208,13 +208,13 @@ public class PaperController { |
208 | @AutoLog(value = "在线考试-试卷-通过id查询") | 208 | @AutoLog(value = "在线考试-试卷-通过id查询") |
209 | @ApiOperation(value="在线考试-试卷-通过id查询", notes="在线考试-试卷-通过id查询") | 209 | @ApiOperation(value="在线考试-试卷-通过id查询", notes="在线考试-试卷-通过id查询") |
210 | @GetMapping(value = "/queryById") | 210 | @GetMapping(value = "/queryById") |
211 | public Result<Paper> queryById(@RequestParam(name="id",required=true) String id) { | 211 | public Result<PaperVO> queryById(@RequestParam(name="id",required=true) String id) { |
212 | Result<Paper> result = new Result<Paper>(); | 212 | Result<PaperVO> result = new Result<PaperVO>(); |
213 | Paper paper = paperService.getById(id); | 213 | PaperVO paperVO = paperService.queryById(id); |
214 | if(paper==null) { | 214 | if(paperVO==null) { |
215 | result.error500("未找到对应实体"); | 215 | result.error500("未找到对应实体"); |
216 | }else { | 216 | }else { |
217 | result.setResult(paper); | 217 | result.setResult(paperVO); |
218 | result.setSuccess(true); | 218 | result.setSuccess(true); |
219 | } | 219 | } |
220 | return result; | 220 | return result; | ... | ... |
... | @@ -11,4 +11,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ... | @@ -11,4 +11,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
11 | */ | 11 | */ |
12 | public interface QuestionMapper extends BaseMapper<Question> { | 12 | public interface QuestionMapper extends BaseMapper<Question> { |
13 | 13 | ||
14 | /*** | ||
15 | * 根据试卷编号获取试题集合 | ||
16 | * @param paperId | ||
17 | * @return | ||
18 | */ | ||
19 | public List<Question> selectListByPaperId(@Param("paperId") String paperId); | ||
14 | } | 20 | } | ... | ... |
... | @@ -2,4 +2,11 @@ | ... | @@ -2,4 +2,11 @@ |
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | <mapper namespace="com.skua.modules.edu.mapper.QuestionMapper"> | 3 | <mapper namespace="com.skua.modules.edu.mapper.QuestionMapper"> |
4 | 4 | ||
5 | <!-- 根据试卷编号获取试题集合--> | ||
6 | <select id="selectListByPaperId" resultType="com.skua.modules.edu.entity.Question"> | ||
7 | select q.* ,pq.score from edu_paper_question pq | ||
8 | left join edu_question q on q.id = pq.question_id | ||
9 | where pq.paper_id = #{paperId} | ||
10 | order by pq.sort asc | ||
11 | </select> | ||
5 | </mapper> | 12 | </mapper> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -3,6 +3,7 @@ package com.skua.modules.edu.service; | ... | @@ -3,6 +3,7 @@ package com.skua.modules.edu.service; |
3 | import com.skua.modules.edu.entity.Paper; | 3 | import com.skua.modules.edu.entity.Paper; |
4 | import com.baomidou.mybatisplus.extension.service.IService; | 4 | import com.baomidou.mybatisplus.extension.service.IService; |
5 | import com.skua.modules.edu.vo.PaperVO; | 5 | import com.skua.modules.edu.vo.PaperVO; |
6 | import org.bouncycastle.eac.jcajce.JcaPublicKeyConverter; | ||
6 | 7 | ||
7 | import javax.transaction.Transactional; | 8 | import javax.transaction.Transactional; |
8 | 9 | ||
... | @@ -26,4 +27,10 @@ public interface IPaperService extends IService<Paper> { | ... | @@ -26,4 +27,10 @@ public interface IPaperService extends IService<Paper> { |
26 | */ | 27 | */ |
27 | public boolean updatePaper(PaperVO paperVO) throws Exception ; | 28 | public boolean updatePaper(PaperVO paperVO) throws Exception ; |
28 | 29 | ||
30 | /*** | ||
31 | * 根据试卷编号获取试卷以及试题集合 | ||
32 | * @param id | ||
33 | * @return | ||
34 | */ | ||
35 | public PaperVO queryById(String id); | ||
29 | } | 36 | } | ... | ... |
1 | package com.skua.modules.edu.service.impl; | 1 | package com.skua.modules.edu.service.impl; |
2 | 2 | ||
3 | import com.google.gson.Gson; | ||
4 | import com.google.gson.reflect.TypeToken; | ||
3 | import com.skua.modules.edu.entity.Paper; | 5 | import com.skua.modules.edu.entity.Paper; |
4 | import com.skua.modules.edu.entity.PaperQuestion; | 6 | import com.skua.modules.edu.entity.PaperQuestion; |
5 | import com.skua.modules.edu.entity.Question; | 7 | import com.skua.modules.edu.entity.Question; |
8 | import com.skua.modules.edu.entity.QuestionOption; | ||
6 | import com.skua.modules.edu.mapper.PaperMapper; | 9 | import com.skua.modules.edu.mapper.PaperMapper; |
7 | import com.skua.modules.edu.mapper.PaperQuestionMapper; | 10 | import com.skua.modules.edu.mapper.PaperQuestionMapper; |
11 | import com.skua.modules.edu.mapper.QuestionMapper; | ||
8 | import com.skua.modules.edu.service.IPaperService; | 12 | import com.skua.modules.edu.service.IPaperService; |
9 | import com.skua.modules.edu.vo.PaperVO; | 13 | import com.skua.modules.edu.vo.PaperVO; |
10 | import org.apache.commons.beanutils.BeanUtils; | 14 | import org.springframework.beans.BeanUtils; |
15 | import org.springframework.boot.json.GsonJsonParser; | ||
11 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
12 | 17 | ||
13 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 18 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
14 | 19 | ||
15 | import javax.annotation.Resource; | 20 | import javax.annotation.Resource; |
16 | import javax.transaction.Transactional; | 21 | import javax.transaction.Transactional; |
22 | import java.lang.reflect.Type; | ||
23 | import java.util.List; | ||
17 | 24 | ||
18 | /** | 25 | /** |
19 | * 在线考试-试卷 | 26 | * 在线考试-试卷 |
... | @@ -23,6 +30,9 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements | ... | @@ -23,6 +30,9 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements |
23 | 30 | ||
24 | @Resource | 31 | @Resource |
25 | private PaperQuestionMapper paperQuestionMapper ; | 32 | private PaperQuestionMapper paperQuestionMapper ; |
33 | |||
34 | @Resource | ||
35 | private QuestionMapper questionMapper ; | ||
26 | /*** | 36 | /*** |
27 | * 添加试卷、试卷试题表 | 37 | * 添加试卷、试卷试题表 |
28 | * @param paperVO | 38 | * @param paperVO |
... | @@ -32,17 +42,13 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements | ... | @@ -32,17 +42,13 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements |
32 | public int savePaper(PaperVO paperVO)throws Exception{ | 42 | public int savePaper(PaperVO paperVO)throws Exception{ |
33 | 43 | ||
34 | // 步骤1 保存试卷表 | 44 | // 步骤1 保存试卷表 |
35 | Paper paper = new Paper(); | 45 | int count = this.baseMapper.insert( paperVO ); |
36 | //将questionVO的属性 赋值给 question | ||
37 | BeanUtils.copyProperties(paperVO, paperVO); | ||
38 | int count = this.baseMapper.insert( paper ); | ||
39 | 46 | ||
40 | // 步骤2:批量插入试题选项集合 | 47 | // 步骤2:批量插入试题选项集合 |
41 | PaperQuestion paperQuestion = null; | 48 | PaperQuestion paperQuestion = null; |
42 | int index = 1; | 49 | int index = 1; |
43 | if(paperVO.getQuestionList() != null ){ | 50 | if(paperVO.getQuestionList() != null ){ |
44 | for(Question question :paperVO.getQuestionList() ){ | 51 | for(Question question :paperVO.getQuestionList() ){ |
45 | //( String paperId, String questionId, String score, Integer sort ) | ||
46 | paperQuestion = new PaperQuestion( paperVO.getId(),question.getId(),question.getScore(), index); | 52 | paperQuestion = new PaperQuestion( paperVO.getId(),question.getId(),question.getScore(), index); |
47 | paperQuestionMapper.insert( paperQuestion ) ; | 53 | paperQuestionMapper.insert( paperQuestion ) ; |
48 | } | 54 | } |
... | @@ -59,10 +65,8 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements | ... | @@ -59,10 +65,8 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements |
59 | public boolean updatePaper(PaperVO paperVO) throws Exception { | 65 | public boolean updatePaper(PaperVO paperVO) throws Exception { |
60 | 66 | ||
61 | // 步骤1 保存试卷表 | 67 | // 步骤1 保存试卷表 |
62 | Paper paper = new Paper(); | 68 | |
63 | //将questionVO的属性 赋值给 question | 69 | int count = this.baseMapper.updateById( paperVO ); |
64 | BeanUtils.copyProperties(paperVO, paperVO); | ||
65 | int count = this.baseMapper.updateById( paper ); | ||
66 | 70 | ||
67 | //步骤2 根据试卷编号,删除试卷试题表记录 | 71 | //步骤2 根据试卷编号,删除试卷试题表记录 |
68 | paperQuestionMapper.delByPaperId( paperVO.getId() ); | 72 | paperQuestionMapper.delByPaperId( paperVO.getId() ); |
... | @@ -73,12 +77,38 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements | ... | @@ -73,12 +77,38 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements |
73 | if(paperVO.getQuestionList() != null ){ | 77 | if(paperVO.getQuestionList() != null ){ |
74 | for(Question question :paperVO.getQuestionList() ){ | 78 | for(Question question :paperVO.getQuestionList() ){ |
75 | //( String paperId, String questionId, String score, Integer sort ) | 79 | //( String paperId, String questionId, String score, Integer sort ) |
76 | paperQuestion = new PaperQuestion( paperVO.getId(),question.getId(),question.getScore(), index); | 80 | paperQuestion = new PaperQuestion( paperVO.getId(),question.getId(),question.getScore(), index++); |
77 | paperQuestionMapper.insert( paperQuestion ) ; | 81 | paperQuestionMapper.insert( paperQuestion ) ; |
78 | } | 82 | } |
79 | } | 83 | } |
80 | return true; | 84 | return true; |
81 | } | 85 | } |
82 | 86 | ||
87 | /*** | ||
88 | * 根据试卷编号获取试卷以及试题集合 | ||
89 | * @param id | ||
90 | * @return | ||
91 | */ | ||
92 | public PaperVO queryById(String id){ | ||
93 | Paper paper = this.baseMapper.selectById(id); | ||
94 | PaperVO paperVO = new PaperVO();// | ||
95 | if( paper != null ){ | ||
96 | BeanUtils.copyProperties(paper, paperVO); | ||
97 | List<Question> questionList = questionMapper.selectListByPaperId(id); | ||
98 | List<QuestionOption> optionList = null; | ||
99 | if(questionList != null && !questionList.isEmpty()){ | ||
100 | // 创建Gson实例 | ||
101 | Gson gson = new Gson(); | ||
102 | Type questionTypeListType = new TypeToken<List<QuestionOption>>() {}.getType(); | ||
103 | for( Question question : questionList){ | ||
104 | optionList = gson.fromJson(question.getQuestionData(),questionTypeListType); | ||
105 | question.setOptionList(optionList ); | ||
106 | } | ||
107 | } | ||
108 | paperVO.setQuestionList(questionList); | ||
109 | } | ||
110 | return paperVO; | ||
111 | } | ||
112 | |||
83 | 113 | ||
84 | } | 114 | } | ... | ... |
... | @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.IdType; | ... | @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.IdType; |
8 | import com.baomidou.mybatisplus.annotation.TableId; | 8 | import com.baomidou.mybatisplus.annotation.TableId; |
9 | import com.baomidou.mybatisplus.annotation.TableName; | 9 | import com.baomidou.mybatisplus.annotation.TableName; |
10 | import com.baomidou.mybatisplus.annotation.TableField; | 10 | import com.baomidou.mybatisplus.annotation.TableField; |
11 | import com.skua.modules.edu.entity.Paper; | ||
11 | import com.skua.modules.edu.entity.Question; | 12 | import com.skua.modules.edu.entity.Question; |
12 | import io.swagger.annotations.ApiModel; | 13 | import io.swagger.annotations.ApiModel; |
13 | import io.swagger.annotations.ApiModelProperty; | 14 | import io.swagger.annotations.ApiModelProperty; |
... | @@ -23,75 +24,7 @@ import org.jeecgframework.poi.excel.annotation.Excel; | ... | @@ -23,75 +24,7 @@ import org.jeecgframework.poi.excel.annotation.Excel; |
23 | */ | 24 | */ |
24 | @Data | 25 | @Data |
25 | @ApiModel(value="edu_paper数据传输对象", description="在线考试-试卷") | 26 | @ApiModel(value="edu_paper数据传输对象", description="在线考试-试卷") |
26 | public class PaperVO { | 27 | public class PaperVO extends Paper { |
27 | |||
28 | /**主键*/ | ||
29 | @ApiModelProperty(value = "主键") | ||
30 | private String id; | ||
31 | /**部门编号*/ | ||
32 | @Excel(name = "部门编号", width = 15) | ||
33 | @ApiModelProperty(value = "部门编号") | ||
34 | private String departId; | ||
35 | /**试卷标题*/ | ||
36 | @Excel(name = "试卷标题", width = 15) | ||
37 | @ApiModelProperty(value = "试卷标题") | ||
38 | private String paperTitle; | ||
39 | /**参加考试厂id*/ | ||
40 | @Excel(name = "参加考试厂id", width = 15) | ||
41 | @ApiModelProperty(value = "参加考试厂id") | ||
42 | private String examDepartId; | ||
43 | /**参加考试用户集合*/ | ||
44 | @Excel(name = "参加考试用户集合", width = 15) | ||
45 | @ApiModelProperty(value = "参加考试用户集合") | ||
46 | private String examUserIds; | ||
47 | /**状态(1启用 0不启用)*/ | ||
48 | @Excel(name = "状态(1启用 0不启用)", width = 15) | ||
49 | @ApiModelProperty(value = "状态(1启用 0不启用)") | ||
50 | private String status; | ||
51 | /**考试开始时间*/ | ||
52 | @Excel(name = "考试开始时间", width = 15) | ||
53 | @ApiModelProperty(value = "考试开始时间") | ||
54 | private String startTime; | ||
55 | /**考试结束时间*/ | ||
56 | @Excel(name = "考试结束时间", width = 15) | ||
57 | @ApiModelProperty(value = "考试结束时间") | ||
58 | private String endTime; | ||
59 | /**总分数*/ | ||
60 | @Excel(name = "总分数", width = 15) | ||
61 | @ApiModelProperty(value = "总分数") | ||
62 | private String totalScore; | ||
63 | /**及格分数*/ | ||
64 | @Excel(name = "及格分数", width = 15) | ||
65 | @ApiModelProperty(value = "及格分数") | ||
66 | private String passScore; | ||
67 | /**发布状态(0未发布,1已发布,2已撤销)*/ | ||
68 | @Excel(name = "发布状态(0未发布,1已发布,2已撤销)", width = 15) | ||
69 | @ApiModelProperty(value = "发布状态(0未发布,1已发布,2已撤销)") | ||
70 | private String sendStatus; | ||
71 | /**发布时间*/ | ||
72 | @Excel(name = "发布时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
73 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
74 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
75 | @ApiModelProperty(value = "发布时间") | ||
76 | private Date sendTime; | ||
77 | /**撤销时间*/ | ||
78 | @Excel(name = "撤销时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") | ||
79 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
80 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
81 | @ApiModelProperty(value = "撤销时间") | ||
82 | private Date cancelTime; | ||
83 | /**试卷类型:1 公开 2 私有*/ | ||
84 | @Excel(name = "试卷类型:1 公开 2 私有", width = 15) | ||
85 | @ApiModelProperty(value = "试卷类型:1 公开 2 私有") | ||
86 | private String paperType; | ||
87 | /**备注*/ | ||
88 | @Excel(name = "备注", width = 15) | ||
89 | @ApiModelProperty(value = "备注") | ||
90 | private String remark; | ||
91 | |||
92 | |||
93 | @ApiModelProperty(value = "试卷试题集合") | 28 | @ApiModelProperty(value = "试卷试题集合") |
94 | private List<Question> questionList; | 29 | private List<Question> questionList; |
95 | |||
96 | |||
97 | } | 30 | } | ... | ... |
... | @@ -21,6 +21,7 @@ import java.util.Date; | ... | @@ -21,6 +21,7 @@ import java.util.Date; |
21 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 21 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
22 | import com.baomidou.mybatisplus.core.metadata.IPage; | 22 | import com.baomidou.mybatisplus.core.metadata.IPage; |
23 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 23 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
24 | import com.skua.modules.safe.vo.DangerLevelManageVO; | ||
24 | import lombok.extern.slf4j.Slf4j; | 25 | import lombok.extern.slf4j.Slf4j; |
25 | 26 | ||
26 | import org.apache.commons.lang3.StringUtils; | 27 | import org.apache.commons.lang3.StringUtils; |
... | @@ -310,9 +311,9 @@ public class DangerInspectionRecordController { | ... | @@ -310,9 +311,9 @@ public class DangerInspectionRecordController { |
310 | @AutoLog(value = "风险点:巡检情况列表") | 311 | @AutoLog(value = "风险点:巡检情况列表") |
311 | @ApiOperation(value="风险点:巡检情况列表", notes="风险点:巡检情况列表") | 312 | @ApiOperation(value="风险点:巡检情况列表", notes="风险点:巡检情况列表") |
312 | @GetMapping(value = "/detail") | 313 | @GetMapping(value = "/detail") |
313 | public Result<DangerLevelManage> queryById(DangerInspectionRecord dangerInspectionRecord) { | 314 | public Result<DangerLevelManageVO> queryById(DangerInspectionRecord dangerInspectionRecord) { |
314 | Result<DangerLevelManage> result = new Result<DangerLevelManage>(); | 315 | Result<DangerLevelManageVO> result = new Result<>(); |
315 | DangerLevelManage dangerLevelManage = inspectionRecordService.queryListByDangerId(dangerInspectionRecord.getDangerId(),dangerInspectionRecord.getStartTime(),dangerInspectionRecord.getEndDate()); | 316 | DangerLevelManageVO dangerLevelManage = inspectionRecordService.queryListByDangerId(dangerInspectionRecord.getDangerId(),dangerInspectionRecord.getStartTime(),dangerInspectionRecord.getEndDate()); |
316 | if(dangerLevelManage == null) { | 317 | if(dangerLevelManage == null) { |
317 | result.error500("未找到对应实体"); | 318 | result.error500("未找到对应实体"); |
318 | }else { | 319 | }else { | ... | ... |
... | @@ -162,7 +162,7 @@ public class DangerLevelManageController { | ... | @@ -162,7 +162,7 @@ public class DangerLevelManageController { |
162 | @GetMapping(value = "/queryById") | 162 | @GetMapping(value = "/queryById") |
163 | public Result<DangerLevelManage> queryById(@RequestParam(name="id",required=true) String id) { | 163 | public Result<DangerLevelManage> queryById(@RequestParam(name="id",required=true) String id) { |
164 | Result<DangerLevelManage> result = new Result<DangerLevelManage>(); | 164 | Result<DangerLevelManage> result = new Result<DangerLevelManage>(); |
165 | DangerLevelManage dangerLevelManage = dangerLevelManageService.getById(id); | 165 | DangerLevelManage dangerLevelManage = dangerLevelManageService.queryById(id); |
166 | if(dangerLevelManage==null) { | 166 | if(dangerLevelManage==null) { |
167 | result.error500("未找到对应实体"); | 167 | result.error500("未找到对应实体"); |
168 | }else { | 168 | }else { | ... | ... |
... | @@ -8,8 +8,10 @@ import com.skua.modules.guest.util.DateUtil; | ... | @@ -8,8 +8,10 @@ import com.skua.modules.guest.util.DateUtil; |
8 | import com.skua.modules.safe.entity.*; | 8 | import com.skua.modules.safe.entity.*; |
9 | import com.skua.modules.safe.mapper.DangerInspectionItemMapper; | 9 | import com.skua.modules.safe.mapper.DangerInspectionItemMapper; |
10 | import com.skua.modules.safe.service.*; | 10 | import com.skua.modules.safe.service.*; |
11 | import com.skua.modules.safe.vo.DangerLevelManageVO; | ||
11 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
12 | 13 | ||
14 | import org.springframework.beans.BeanUtils; | ||
13 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
14 | import org.springframework.web.bind.annotation.*; | 16 | import org.springframework.web.bind.annotation.*; |
15 | import io.swagger.annotations.Api; | 17 | import io.swagger.annotations.Api; |
... | @@ -52,27 +54,27 @@ public class APPDangerInspectionController { | ... | @@ -52,27 +54,27 @@ public class APPDangerInspectionController { |
52 | @AutoLog(value = "扫描二维码进入:风险点详情") | 54 | @AutoLog(value = "扫描二维码进入:风险点详情") |
53 | @ApiOperation(value="扫描二维码进入:风险点详情", notes="扫描二维码进入:风险点详情") | 55 | @ApiOperation(value="扫描二维码进入:风险点详情", notes="扫描二维码进入:风险点详情") |
54 | @GetMapping(value = "/queryDangerById") | 56 | @GetMapping(value = "/queryDangerById") |
55 | public Result<DangerLevelManage> queryById(@RequestParam(name="id",required=true) String id) { | 57 | public Result<DangerLevelManageVO> queryById(@RequestParam(name="id",required=true) String id) { |
56 | Result<DangerLevelManage> result = new Result<DangerLevelManage>(); | 58 | Result<DangerLevelManageVO> result = new Result<>(); |
57 | DangerLevelManage dangerInspection = dangerLevelManageService.getById(id); | 59 | DangerLevelManage dangerInspection = dangerLevelManageService.queryById(id); |
60 | DangerLevelManageVO dangerLevelManageVO = new DangerLevelManageVO();// dangerInspection ; | ||
61 | |||
62 | BeanUtils.copyProperties(dangerInspection , dangerLevelManageVO); | ||
58 | //查询:上次巡检时间 | 63 | //查询:上次巡检时间 |
59 | DangerInspectionRecord inspectionRecord = inspectionRecordService.queryOneByDangerId( id,"2" ,BaseContextHandler.getUserId());//根据分线点编号,获取巡检最后一条记录 | 64 | DangerInspectionRecord inspectionRecord = inspectionRecordService.queryOneByDangerId( id,"2" ,BaseContextHandler.getUserId());//根据分线点编号,获取巡检最后一条记录 |
60 | if(inspectionRecord != null ){ | 65 | if(inspectionRecord != null ){ |
61 | dangerInspection.setLastInspectionTime( inspectionRecord.getReportDate() ); | 66 | dangerLevelManageVO.setLastInspectionTime( inspectionRecord.getReportDate() ); |
62 | dangerInspection.setLastInspectionStatus( inspectionRecord.getStatus()); | 67 | dangerLevelManageVO.setLastInspectionStatus( inspectionRecord.getStatus()); |
63 | String dangerId = id; | 68 | String dangerId = id; |
64 | if(inspectionRecord.getStatus() != "2"){ | 69 | if( !"2".equals(inspectionRecord.getStatus()) ){ |
65 | List<DangerInspectionInfo> inspectionInfoList = inspectionRecordService.queryInspectionInfoByDangerId(dangerId ,BaseContextHandler.getUserId()); | 70 | List<DangerInspectionInfo> inspectionInfoList = inspectionRecordService.queryInspectionInfoByDangerId(dangerId ,BaseContextHandler.getUserId()); |
66 | dangerInspection.setInspectionInfoList( inspectionInfoList ) ; | 71 | dangerLevelManageVO.setInspectionInfoList( inspectionInfoList ) ; |
67 | } | 72 | } |
68 | }else{ | ||
69 | dangerInspection = new DangerLevelManage(); | ||
70 | dangerInspection.setLastInspectionTime(""); | ||
71 | } | 73 | } |
72 | if(dangerInspection==null) { | 74 | if(dangerInspection==null) { |
73 | result.error500("未找到对应实体"); | 75 | result.error500("未找到对应实体"); |
74 | }else { | 76 | }else { |
75 | result.setResult(dangerInspection); | 77 | result.setResult(dangerLevelManageVO); |
76 | result.setSuccess(true); | 78 | result.setSuccess(true); |
77 | } | 79 | } |
78 | return result; | 80 | return result; | ... | ... |
... | @@ -3,12 +3,10 @@ package com.skua.modules.safe.entity; | ... | @@ -3,12 +3,10 @@ package com.skua.modules.safe.entity; |
3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
4 | import java.util.Date; | 4 | import java.util.Date; |
5 | import java.util.List; | 5 | import java.util.List; |
6 | |||
7 | import com.baomidou.mybatisplus.annotation.IdType; | 6 | import com.baomidou.mybatisplus.annotation.IdType; |
8 | import com.baomidou.mybatisplus.annotation.TableId; | 7 | import com.baomidou.mybatisplus.annotation.TableId; |
9 | import com.baomidou.mybatisplus.annotation.TableName; | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
10 | import com.baomidou.mybatisplus.annotation.TableField; | 9 | import com.baomidou.mybatisplus.annotation.TableField; |
11 | |||
12 | import com.skua.core.aspect.annotation.Dict; | 10 | import com.skua.core.aspect.annotation.Dict; |
13 | import io.swagger.annotations.ApiModel; | 11 | import io.swagger.annotations.ApiModel; |
14 | import io.swagger.annotations.ApiModelProperty; | 12 | import io.swagger.annotations.ApiModelProperty; |
... | @@ -18,7 +16,6 @@ import lombok.experimental.Accessors; | ... | @@ -18,7 +16,6 @@ import lombok.experimental.Accessors; |
18 | import com.fasterxml.jackson.annotation.JsonFormat; | 16 | import com.fasterxml.jackson.annotation.JsonFormat; |
19 | import org.springframework.format.annotation.DateTimeFormat; | 17 | import org.springframework.format.annotation.DateTimeFormat; |
20 | import org.jeecgframework.poi.excel.annotation.Excel; | 18 | import org.jeecgframework.poi.excel.annotation.Excel; |
21 | |||
22 | /** | 19 | /** |
23 | * 风险分级管控清单 | 20 | * 风险分级管控清单 |
24 | */ | 21 | */ |
... | @@ -27,7 +24,7 @@ import org.jeecgframework.poi.excel.annotation.Excel; | ... | @@ -27,7 +24,7 @@ import org.jeecgframework.poi.excel.annotation.Excel; |
27 | @EqualsAndHashCode(callSuper = false) | 24 | @EqualsAndHashCode(callSuper = false) |
28 | @Accessors(chain = true) | 25 | @Accessors(chain = true) |
29 | @ApiModel(value="danger_level_manage对象", description="风险分级管控清单") | 26 | @ApiModel(value="danger_level_manage对象", description="风险分级管控清单") |
30 | public class DangerLevelManage implements Serializable{ | 27 | public class DangerLevelManage{ |
31 | 28 | ||
32 | /**id*/ | 29 | /**id*/ |
33 | @TableId(type = IdType.UUID) | 30 | @TableId(type = IdType.UUID) |
... | @@ -86,8 +83,8 @@ public class DangerLevelManage implements Serializable{ | ... | @@ -86,8 +83,8 @@ public class DangerLevelManage implements Serializable{ |
86 | @ApiModelProperty(value = "安全四色图") | 83 | @ApiModelProperty(value = "安全四色图") |
87 | private String dangerFour; | 84 | private String dangerFour; |
88 | 85 | ||
89 | @Excel(name = "风险点名称", width = 15) | 86 | @Excel(name = "风险点位置", width = 15) |
90 | @ApiModelProperty(value = "风险点名称") | 87 | @ApiModelProperty(value = "风险点位置") |
91 | private String dangerPlace; | 88 | private String dangerPlace; |
92 | 89 | ||
93 | @Excel(name = "关联设备", width = 15) | 90 | @Excel(name = "关联设备", width = 15) |
... | @@ -103,7 +100,6 @@ public class DangerLevelManage implements Serializable{ | ... | @@ -103,7 +100,6 @@ public class DangerLevelManage implements Serializable{ |
103 | @ApiModelProperty(value = "二维码") | 100 | @ApiModelProperty(value = "二维码") |
104 | private String qrCode; | 101 | private String qrCode; |
105 | 102 | ||
106 | |||
107 | /**创建人Id*/ | 103 | /**创建人Id*/ |
108 | @ApiModelProperty(value = "创建人Id") | 104 | @ApiModelProperty(value = "创建人Id") |
109 | private String createBy; | 105 | private String createBy; |
... | @@ -131,18 +127,33 @@ public class DangerLevelManage implements Serializable{ | ... | @@ -131,18 +127,33 @@ public class DangerLevelManage implements Serializable{ |
131 | private Integer delFlag; | 127 | private Integer delFlag; |
132 | 128 | ||
133 | 129 | ||
130 | |||
131 | @TableField(exist=false) | ||
132 | @ApiModelProperty(value = "厂区名称") | ||
133 | private String departName; | ||
134 | |||
135 | |||
136 | @TableField(exist=false) | ||
137 | @ApiModelProperty(value = "关联设备名称") | ||
138 | private String equipmentName; | ||
139 | |||
140 | |||
134 | @TableField(exist=false) | 141 | @TableField(exist=false) |
135 | @ApiModelProperty(value = "上次巡检时间") | 142 | @ApiModelProperty(value = "风险等级名称") |
136 | private String lastInspectionTime; | 143 | private String dangerLevelName; |
137 | 144 | ||
138 | 145 | ||
139 | @TableField(exist=false) | 146 | @TableField(exist=false) |
140 | @ApiModelProperty(value = "上次巡检状态 ") | 147 | @ApiModelProperty(value = "风险类型名称") |
141 | private String lastInspectionStatus; | 148 | private String dangerTypeName; |
142 | 149 | ||
143 | 150 | ||
144 | @TableField(exist=false) | 151 | @TableField(exist=false) |
145 | @ApiModelProperty(value = "巡检内容对象集合") | 152 | @ApiModelProperty(value = "风险位置名称") |
146 | private List<DangerInspectionInfo> inspectionInfoList; | 153 | private String dangerPlaceName; |
154 | |||
155 | |||
156 | |||
157 | |||
147 | 158 | ||
148 | } | 159 | } | ... | ... |
... | @@ -11,4 +11,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ... | @@ -11,4 +11,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
11 | */ | 11 | */ |
12 | public interface DangerLevelManageMapper extends BaseMapper<DangerLevelManage> { | 12 | public interface DangerLevelManageMapper extends BaseMapper<DangerLevelManage> { |
13 | 13 | ||
14 | /*** | ||
15 | * 根据id获取风险分级对象 | ||
16 | * @param id | ||
17 | * @return | ||
18 | */ | ||
19 | public DangerLevelManage queryById(@Param("id") String id); | ||
14 | } | 20 | } | ... | ... |
... | @@ -2,4 +2,14 @@ | ... | @@ -2,4 +2,14 @@ |
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | <mapper namespace="com.skua.modules.safe.mapper.DangerLevelManageMapper"> | 3 | <mapper namespace="com.skua.modules.safe.mapper.DangerLevelManageMapper"> |
4 | 4 | ||
5 | |||
6 | <select id="queryById" resultType="com.skua.modules.safe.entity.DangerLevelManage"> | ||
7 | select d.depart_name , ei.equipment_name, di.item_text 'danger_level_name', di1.item_text 'danger_type_name' , sd.struct_name 'danger_place_name', m.* from danger_level_manage m | ||
8 | left join sys_depart d on d.id = m.depart_id | ||
9 | left join equipment_info ei on ei.id = m.equip_info_id | ||
10 | left join sys_dict_item di on di.item_value = m.danger_level | ||
11 | left join sys_dict_item di1 on di1.item_value = m.danger_type | ||
12 | left join sys_struct_dict sd on sd.id = m.danger_place | ||
13 | where m.id = #{id} | ||
14 | </select> | ||
5 | </mapper> | 15 | </mapper> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -4,6 +4,7 @@ import com.skua.modules.safe.entity.DangerInspectionInfo; | ... | @@ -4,6 +4,7 @@ import com.skua.modules.safe.entity.DangerInspectionInfo; |
4 | import com.skua.modules.safe.entity.DangerInspectionRecord; | 4 | import com.skua.modules.safe.entity.DangerInspectionRecord; |
5 | import com.baomidou.mybatisplus.extension.service.IService; | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
6 | import com.skua.modules.safe.entity.DangerLevelManage; | 6 | import com.skua.modules.safe.entity.DangerLevelManage; |
7 | import com.skua.modules.safe.vo.DangerLevelManageVO; | ||
7 | 8 | ||
8 | import java.util.List; | 9 | import java.util.List; |
9 | 10 | ||
... | @@ -35,7 +36,7 @@ public interface IDangerInspectionRecordService extends IService<DangerInspectio | ... | @@ -35,7 +36,7 @@ public interface IDangerInspectionRecordService extends IService<DangerInspectio |
35 | * @param endDate | 36 | * @param endDate |
36 | * @return | 37 | * @return |
37 | */ | 38 | */ |
38 | public DangerLevelManage queryListByDangerId(String dangerId, String startTime, String endDate); | 39 | public DangerLevelManageVO queryListByDangerId(String dangerId, String startTime, String endDate); |
39 | 40 | ||
40 | 41 | ||
41 | /*** | 42 | /*** | ... | ... |
... | @@ -8,4 +8,10 @@ import com.baomidou.mybatisplus.extension.service.IService; | ... | @@ -8,4 +8,10 @@ import com.baomidou.mybatisplus.extension.service.IService; |
8 | */ | 8 | */ |
9 | public interface IDangerLevelManageService extends IService<DangerLevelManage> { | 9 | public interface IDangerLevelManageService extends IService<DangerLevelManage> { |
10 | 10 | ||
11 | /*** | ||
12 | * 根据id获取风险分级对象 | ||
13 | * @param id | ||
14 | * @return | ||
15 | */ | ||
16 | public DangerLevelManage queryById(String id); | ||
11 | } | 17 | } | ... | ... |
... | @@ -5,6 +5,8 @@ import com.skua.core.context.BaseContextHandler; | ... | @@ -5,6 +5,8 @@ import com.skua.core.context.BaseContextHandler; |
5 | import com.skua.modules.safe.entity.*; | 5 | import com.skua.modules.safe.entity.*; |
6 | import com.skua.modules.safe.mapper.*; | 6 | import com.skua.modules.safe.mapper.*; |
7 | import com.skua.modules.safe.service.IDangerInspectionRecordService; | 7 | import com.skua.modules.safe.service.IDangerInspectionRecordService; |
8 | import com.skua.modules.safe.vo.DangerLevelManageVO; | ||
9 | import org.springframework.beans.BeanUtils; | ||
8 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
9 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
10 | 12 | ||
... | @@ -164,10 +166,12 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect | ... | @@ -164,10 +166,12 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect |
164 | * @param endDate | 166 | * @param endDate |
165 | * @return | 167 | * @return |
166 | */ | 168 | */ |
167 | public DangerLevelManage queryListByDangerId(String dangerId, String startTime, String endDate){ | 169 | public DangerLevelManageVO queryListByDangerId(String dangerId, String startTime, String endDate){ |
168 | 170 | ||
169 | DangerLevelManage dangerLevelManage = dangerLevelManageMapper.selectById(dangerId); | 171 | DangerLevelManage dangerLevelManage = dangerLevelManageMapper.selectById(dangerId); |
172 | DangerLevelManageVO dangerLevelManageVO = new DangerLevelManageVO(); | ||
170 | 173 | ||
174 | BeanUtils.copyProperties(dangerLevelManage, dangerLevelManageVO); | ||
171 | //巡查对象 | 175 | //巡查对象 |
172 | LambdaQueryWrapper<DangerInspectionInfo> queryWrapper = new LambdaQueryWrapper<DangerInspectionInfo>(); | 176 | LambdaQueryWrapper<DangerInspectionInfo> queryWrapper = new LambdaQueryWrapper<DangerInspectionInfo>(); |
173 | queryWrapper.eq(DangerInspectionInfo::getDangerId, dangerId); | 177 | queryWrapper.eq(DangerInspectionInfo::getDangerId, dangerId); |
... | @@ -188,12 +192,12 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect | ... | @@ -188,12 +192,12 @@ public class DangerInspectionRecordServiceImpl extends ServiceImpl<DangerInspect |
188 | if(itemList != null ) info.setInspectionItemList( itemList ) ; | 192 | if(itemList != null ) info.setInspectionItemList( itemList ) ; |
189 | } | 193 | } |
190 | 194 | ||
191 | dangerLevelManage.setInspectionInfoList( inspectionInfoList ); | 195 | dangerLevelManageVO.setInspectionInfoList( inspectionInfoList ); |
192 | } | 196 | } |
193 | 197 | ||
194 | 198 | ||
195 | 199 | ||
196 | return dangerLevelManage; | 200 | return dangerLevelManageVO; |
197 | } | 201 | } |
198 | 202 | ||
199 | 203 | ... | ... |
1 | package com.skua.modules.safe.service.impl; | 1 | package com.skua.modules.safe.service.impl; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
3 | import com.skua.modules.safe.entity.DangerLevelManage; | 4 | import com.skua.modules.safe.entity.DangerLevelManage; |
4 | import com.skua.modules.safe.mapper.DangerLevelManageMapper; | 5 | import com.skua.modules.safe.mapper.DangerLevelManageMapper; |
5 | import com.skua.modules.safe.service.IDangerLevelManageService; | 6 | import com.skua.modules.safe.service.IDangerLevelManageService; |
... | @@ -7,10 +8,20 @@ import org.springframework.stereotype.Service; | ... | @@ -7,10 +8,20 @@ import org.springframework.stereotype.Service; |
7 | 8 | ||
8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 9 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
9 | 10 | ||
11 | import java.util.List; | ||
12 | |||
10 | /** | 13 | /** |
11 | * 风险分级管控清单 | 14 | * 风险分级管控清单 |
12 | */ | 15 | */ |
13 | @Service | 16 | @Service |
14 | public class DangerLevelManageServiceImpl extends ServiceImpl<DangerLevelManageMapper, DangerLevelManage> implements IDangerLevelManageService { | 17 | public class DangerLevelManageServiceImpl extends ServiceImpl<DangerLevelManageMapper, DangerLevelManage> implements IDangerLevelManageService { |
15 | 18 | ||
19 | /*** | ||
20 | * 根据id获取风险分级对象 | ||
21 | * @param id | ||
22 | * @return | ||
23 | */ | ||
24 | public DangerLevelManage queryById(String id){ | ||
25 | return this.baseMapper.queryById(id); | ||
26 | } | ||
16 | } | 27 | } | ... | ... |
1 | package com.skua.modules.safe.vo; | ||
2 | |||
3 | import com.skua.modules.safe.entity.DangerInspectionInfo; | ||
4 | import com.skua.modules.safe.entity.DangerLevelManage; | ||
5 | import io.swagger.annotations.ApiModel; | ||
6 | import io.swagger.annotations.ApiModelProperty; | ||
7 | import lombok.Data; | ||
8 | import lombok.EqualsAndHashCode; | ||
9 | import lombok.experimental.Accessors; | ||
10 | |||
11 | import java.util.List; | ||
12 | |||
13 | /** | ||
14 | * 风险分级管控清单 | ||
15 | */ | ||
16 | @Data | ||
17 | @EqualsAndHashCode(callSuper = false) | ||
18 | @Accessors(chain = true) | ||
19 | @ApiModel(value="danger_level_manage对象", description="风险分级管控清单") | ||
20 | public class DangerLevelManageVO extends DangerLevelManage { | ||
21 | |||
22 | |||
23 | @ApiModelProperty(value = "上次巡检时间") | ||
24 | private String lastInspectionTime; | ||
25 | |||
26 | |||
27 | @ApiModelProperty(value = "上次巡检状态 ") | ||
28 | private String lastInspectionStatus; | ||
29 | |||
30 | |||
31 | @ApiModelProperty(value = "巡检内容对象集合") | ||
32 | private List<DangerInspectionInfo> inspectionInfoList; | ||
33 | } |
-
请 注册 或 登录 后发表评论