Merge remote-tracking branch 'origin/master' into master
正在显示
4 个修改的文件
包含
122 行增加
和
26 行删除
1 | package com.skua.modules.edu.controller; | 1 | package com.skua.modules.edu.controller; |
2 | 2 | ||
3 | 3 | ||
4 | import cn.hutool.core.bean.BeanUtil; | ||
5 | import cn.hutool.core.util.StrUtil; | ||
6 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
4 | import com.baomidou.mybatisplus.core.metadata.IPage; | 7 | import com.baomidou.mybatisplus.core.metadata.IPage; |
5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 8 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
9 | import com.skua.common.constant.BusinessConstant; | ||
6 | import com.skua.core.api.vo.Result; | 10 | import com.skua.core.api.vo.Result; |
7 | import com.skua.core.aspect.annotation.AutoLog; | 11 | import com.skua.core.aspect.annotation.AutoLog; |
8 | import com.skua.core.context.BaseContextHandler; | 12 | import com.skua.core.context.BaseContextHandler; |
9 | import com.skua.core.util.DateUtils; | 13 | import com.skua.core.util.DateUtils; |
14 | import com.skua.modules.base.service.IBaseService; | ||
15 | import com.skua.modules.biz.IBusinessService; | ||
10 | import com.skua.modules.edu.entity.*; | 16 | import com.skua.modules.edu.entity.*; |
11 | import com.skua.modules.edu.service.IPaperService; | 17 | import com.skua.modules.edu.service.IPaperService; |
12 | import com.skua.modules.edu.service.IUserPaperService; | 18 | import com.skua.modules.edu.service.IUserPaperService; |
... | @@ -30,6 +36,8 @@ import javax.servlet.http.HttpServletResponse; | ... | @@ -30,6 +36,8 @@ import javax.servlet.http.HttpServletResponse; |
30 | import java.io.IOException; | 36 | import java.io.IOException; |
31 | import java.math.BigInteger; | 37 | import java.math.BigInteger; |
32 | import java.net.URLEncoder; | 38 | import java.net.URLEncoder; |
39 | import java.util.*; | ||
40 | import java.util.stream.Collectors; | ||
33 | 41 | ||
34 | @Slf4j | 42 | @Slf4j |
35 | @Api(tags="在线考试-用户考试") | 43 | @Api(tags="在线考试-用户考试") |
... | @@ -41,16 +49,20 @@ public class UserPaperController { | ... | @@ -41,16 +49,20 @@ public class UserPaperController { |
41 | 49 | ||
42 | @Autowired | 50 | @Autowired |
43 | private IUserPaperService userPaperService; | 51 | private IUserPaperService userPaperService; |
52 | @Autowired | ||
53 | private IBaseService baseService; | ||
54 | @Autowired | ||
55 | private IBusinessService businessService; | ||
44 | 56 | ||
45 | // 我的 考试 | 57 | // 我的 考试 |
46 | @AutoLog(value = "在线考试--试卷列表") | 58 | @AutoLog(value = "在线考试--试卷列表") |
47 | @ApiOperation(value="在线考试--试卷列表", notes="在线考试--试卷列表") | 59 | @ApiOperation(value="在线考试--试卷列表", notes="在线考试--试卷列表") |
48 | @GetMapping(value = "/paperList") | 60 | @GetMapping(value = "/paperList") |
49 | public Result<IPage<Paper>> queryPageList(Paper paper, | 61 | public Result<Object> queryPageList(Paper paper, |
50 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | 62 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
51 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | 63 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
52 | HttpServletRequest req) throws Exception{ | 64 | HttpServletRequest req) throws Exception{ |
53 | Result<IPage<Paper>> result = new Result<IPage<Paper>>(); | 65 | // Result<IPage<Paper>> result = new Result<IPage<Paper>>(); |
54 | //QueryWrapper<Paper> queryWrapper = new QueryWrapper<>() ;// QueryGenerator.initQueryWrapper(paperAnswer, req.getParameterMap()); | 66 | //QueryWrapper<Paper> queryWrapper = new QueryWrapper<>() ;// QueryGenerator.initQueryWrapper(paperAnswer, req.getParameterMap()); |
55 | Page<Paper> page = new Page<Paper>(pageNo, pageSize); | 67 | Page<Paper> page = new Page<Paper>(pageNo, pageSize); |
56 | /* queryWrapper.like("exam_user_ids", BaseContextHandler.getUserId()); | 68 | /* queryWrapper.like("exam_user_ids", BaseContextHandler.getUserId()); |
... | @@ -58,14 +70,42 @@ public class UserPaperController { | ... | @@ -58,14 +70,42 @@ public class UserPaperController { |
58 | queryWrapper.le("start_time",currentDate);// 当前时间 > 开始结束时间 | 70 | queryWrapper.le("start_time",currentDate);// 当前时间 > 开始结束时间 |
59 | queryWrapper.ge("end_time",currentDate); | 71 | queryWrapper.ge("end_time",currentDate); |
60 | IPage<Paper> pageList = paperService.page(page, queryWrapper);*/ | 72 | IPage<Paper> pageList = paperService.page(page, queryWrapper);*/ |
61 | paper.setUserId(BaseContextHandler.getUserId()); | 73 | String nowStr = DateUtils.now(); |
62 | paper.setStartTime(DateUtils.now()); | 74 | paper.setStartTime(nowStr); |
63 | paper.setEndTime( DateUtils.now() ); | 75 | paper.setEndTime(nowStr); |
64 | paper.setExamStatus(0);//考试状态是未考试的 | 76 | // paper.setExamStatus(0);//考试状态是未考试的 |
65 | IPage<Paper> pageList = paperService.queryMyPaperByList(page ,paper); | 77 | // IPage<Paper> pageList = paperService.queryMyPaperByList(page ,paper); |
66 | result.setSuccess(true); | 78 | QueryWrapper<?> queryWrapper0 = new QueryWrapper<>(); |
67 | result.setResult(pageList); | 79 | queryWrapper0.eq(StringUtils.isNotEmpty(paper.getUserId()), "edu_paper_task.user_id", paper.getUserId()) |
68 | return result; | 80 | .like(StringUtils.isNotEmpty(paper.getPaperTitle()), "edu_paper.paper_title", paper.getPaperTitle()) |
81 | .ge("edu_paper.end_time", nowStr) | ||
82 | .le("edu_paper.start_time", nowStr) | ||
83 | .in("edu_paper_task.depart_id", Arrays.asList(BaseContextHandler.getDeparts().split(","))) | ||
84 | .orderByDesc("edu_paper_task.create_time", "edu_paper_task.user_id"); | ||
85 | List<String> columnList0 = new ArrayList<String>(){{ | ||
86 | add("edu_paper_task.depart_id"); | ||
87 | add("edu_paper_task.status as exam_status"); | ||
88 | add("edu_paper_task.user_id"); | ||
89 | add("edu_paper.*"); | ||
90 | }}; | ||
91 | IPage<Map<String, Object>> mapIPage0 = baseService.queryForPage(new Page<>(pageNo, pageSize), "select " + String.join(",", columnList0) + " from edu_paper_task left join edu_paper on edu_paper_task.paper_id = edu_paper.id", queryWrapper0); | ||
92 | // 翻译 | ||
93 | Map<String, String> sysDepartDictMap = businessService.dictMap("sys_depart", null); | ||
94 | Map<String, String> sysUserDictMap = businessService.dictMap("sys_user", null); | ||
95 | // 封装结果集 | ||
96 | IPage<Map<String, Object>> mapIPage = new Page<>(pageNo, pageSize); | ||
97 | mapIPage.setTotal(mapIPage0.getTotal()); | ||
98 | mapIPage.setRecords(mapIPage0.getRecords().stream().map(item -> { | ||
99 | Paper tmpPaper = BeanUtil.toBean(item, Paper.class); | ||
100 | Map<String, Object> tmpMap = BeanUtil.beanToMap(tmpPaper); | ||
101 | tmpMap.put("userId" + BusinessConstant.dictText, sysUserDictMap.get(tmpMap.get("userId"))); | ||
102 | tmpMap.put("departId" + BusinessConstant.dictText, sysDepartDictMap.get(tmpMap.get("departId"))); | ||
103 | if (tmpPaper.getSendTime() != null) { | ||
104 | tmpMap.put("sendTime", com.skua.tool.util.DateUtils.date2Str(tmpPaper.getSendTime(), BusinessConstant.dateFormat)); | ||
105 | } | ||
106 | return tmpMap; | ||
107 | }).collect(Collectors.toList())); | ||
108 | return Result.ok(mapIPage); | ||
69 | 109 | ||
70 | } | 110 | } |
71 | 111 | ||
... | @@ -148,12 +188,11 @@ public class UserPaperController { | ... | @@ -148,12 +188,11 @@ public class UserPaperController { |
148 | @AutoLog(value = "在线考试--历史试卷列表") | 188 | @AutoLog(value = "在线考试--历史试卷列表") |
149 | @ApiOperation(value="在线考试--历史试卷列表", notes="在线考试--历史试卷列表") | 189 | @ApiOperation(value="在线考试--历史试卷列表", notes="在线考试--历史试卷列表") |
150 | @GetMapping(value = "/historyList") | 190 | @GetMapping(value = "/historyList") |
151 | public Result<IPage<Paper>> historyList( | 191 | public Result<Object> historyList( |
152 | Paper paper, | 192 | Paper paper, |
153 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | 193 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
154 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | 194 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
155 | HttpServletRequest req) throws Exception { | 195 | HttpServletRequest req) throws Exception { |
156 | Result<IPage<Paper>> result = new Result<IPage<Paper>>(); | ||
157 | /* StringBuffer sql = new StringBuffer(); | 196 | /* StringBuffer sql = new StringBuffer(); |
158 | sql.append("select up.score, p.* from edu_user_paper up "); | 197 | sql.append("select up.score, p.* from edu_user_paper up "); |
159 | sql.append(" left join edu_paper p on p.id = up.paper_id "); | 198 | sql.append(" left join edu_paper p on p.id = up.paper_id "); |
... | @@ -164,16 +203,35 @@ public class UserPaperController { | ... | @@ -164,16 +203,35 @@ public class UserPaperController { |
164 | Page<Map<String, Object>> pageList = iCommonSqlService.queryForPage(page, sql.toString()); | 203 | Page<Map<String, Object>> pageList = iCommonSqlService.queryForPage(page, sql.toString()); |
165 | List<Paper> paperList = JoinSqlUtils.multiMaps2Beans(pageList.getRecords(), Paper.class); | 204 | List<Paper> paperList = JoinSqlUtils.multiMaps2Beans(pageList.getRecords(), Paper.class); |
166 | */ | 205 | */ |
167 | 206 | String departIds = BaseContextHandler.getDeparts(); | |
168 | Page<Paper> page = new Page<Paper>(pageNo, pageSize); | 207 | QueryWrapper<?> queryWrapper0 = new QueryWrapper<>(); |
169 | if(StringUtils.isEmpty(paper.getUserId())){ | 208 | queryWrapper0.eq(StringUtils.isNotEmpty(paper.getUserId()),"edu_user_paper.user_id", paper.getUserId()) |
170 | paper.setUserId(BaseContextHandler.getUserId());//获取当前用户编号 | 209 | .like(StringUtils.isNotEmpty(paper.getPaperTitle()), "edu_paper.paper_title", paper.getPaperTitle()) |
171 | } | 210 | .in("edu_user_paper.depart_id", Arrays.asList(departIds.split(","))) |
172 | IPage<Paper> paperList = paperService.queryMyPaperRecoredByList(page,paper); | 211 | .orderByDesc("edu_user_paper.start_time", "edu_user_paper.score"); |
173 | 212 | List<String> columnList = new ArrayList<String>(){{ | |
174 | result.setResult(paperList); | 213 | add("edu_user_paper.id as eduUserPaperId"); |
175 | result.setSuccess(true); | 214 | add("edu_user_paper.score"); |
176 | return result; | 215 | add("edu_user_paper.user_id"); |
216 | add("edu_user_paper.rank"); | ||
217 | add("edu_user_paper.depart_id"); | ||
218 | add("edu_user_paper.id as 'user_paper_id'"); | ||
219 | add("edu_paper.*"); | ||
220 | }}; | ||
221 | IPage<Map<String, Object>> mapIPage = baseService.queryForPage(new Page<>(pageNo, pageSize), "select " + String.join(",", columnList) + " from edu_user_paper left join edu_paper on edu_user_paper.paper_id = edu_paper.id", queryWrapper0); | ||
222 | // 翻译 | ||
223 | Map<String, String> sysDepartDictMap = businessService.dictMap("sys_depart", null); | ||
224 | Map<String, String> sysUserDictMap = businessService.dictMap("sys_user", null); | ||
225 | // 封装结果集 | ||
226 | IPage<Map<String, Object>> paperIPage = new Page<>(pageNo, pageSize); | ||
227 | paperIPage.setTotal(mapIPage.getTotal()); | ||
228 | paperIPage.setRecords(mapIPage.getRecords().stream().map(item -> { | ||
229 | Map<String, Object> tmpMap = item.keySet().stream().collect(Collectors.toMap(StrUtil::toCamelCase, key -> item.get(key) == null ? "" : item.get(key))); | ||
230 | tmpMap.put("userId" + BusinessConstant.dictText, sysUserDictMap.get(tmpMap.get("userId"))); | ||
231 | tmpMap.put("departId" + BusinessConstant.dictText, sysDepartDictMap.get(tmpMap.get("departId"))); | ||
232 | return tmpMap; | ||
233 | }).collect(Collectors.toList())); | ||
234 | return Result.ok(paperIPage); | ||
177 | } | 235 | } |
178 | //历史试卷详情 history_detail | 236 | //历史试卷详情 history_detail |
179 | @AutoLog(value = "在线考试--历史试卷详情(复习)") | 237 | @AutoLog(value = "在线考试--历史试卷详情(复习)") |
... | @@ -285,4 +343,17 @@ public class UserPaperController { | ... | @@ -285,4 +343,17 @@ public class UserPaperController { |
285 | spacing.setLineRule(STLineSpacingRule.EXACT); | 343 | spacing.setLineRule(STLineSpacingRule.EXACT); |
286 | } | 344 | } |
287 | 345 | ||
346 | @AutoLog(value = "设备维修流程-通过id删除") | ||
347 | @ApiOperation(value = "设备维修流程-通过id删除", notes = "设备维修流程-通过id删除") | ||
348 | @DeleteMapping(value = "/delete") | ||
349 | public Result<?> delete(@RequestParam(name = "id", required = true) String id) { | ||
350 | try { | ||
351 | boolean flag = userPaperService.removeById(id); | ||
352 | } catch (Exception e) { | ||
353 | log.error("删除失败: {}", e.getMessage()); | ||
354 | return Result.error("删除失败!"); | ||
355 | } | ||
356 | return Result.ok("删除成功!"); | ||
357 | } | ||
358 | |||
288 | } | 359 | } | ... | ... |
... | @@ -2,6 +2,8 @@ package com.skua.modules.report.service; | ... | @@ -2,6 +2,8 @@ package com.skua.modules.report.service; |
2 | 2 | ||
3 | import com.skua.modules.report.vo.ProductDataVO; | 3 | import com.skua.modules.report.vo.ProductDataVO; |
4 | 4 | ||
5 | import java.util.Map; | ||
6 | |||
5 | /** | 7 | /** |
6 | * @auther kangwei | 8 | * @auther kangwei |
7 | * @create 2024-10-14-9:11 | 9 | * @create 2024-10-14-9:11 |
... | @@ -14,4 +16,6 @@ public interface IOperationReportService { | ... | @@ -14,4 +16,6 @@ public interface IOperationReportService { |
14 | * @return | 16 | * @return |
15 | */ | 17 | */ |
16 | ProductDataVO handeReportMonthData(String departIds,Integer year, Integer season,String startDate,String endDate); | 18 | ProductDataVO handeReportMonthData(String departIds,Integer year, Integer season,String startDate,String endDate); |
19 | |||
20 | Map<String, String> dataAnalysisOfMonth(Map<String, Object> paramMap); | ||
17 | } | 21 | } | ... | ... |
... | @@ -27,10 +27,7 @@ import java.math.BigDecimal; | ... | @@ -27,10 +27,7 @@ import java.math.BigDecimal; |
27 | import java.math.RoundingMode; | 27 | import java.math.RoundingMode; |
28 | import java.time.LocalDate; | 28 | import java.time.LocalDate; |
29 | import java.time.format.DateTimeFormatter; | 29 | import java.time.format.DateTimeFormatter; |
30 | import java.util.ArrayList; | 30 | import java.util.*; |
31 | import java.util.HashMap; | ||
32 | import java.util.List; | ||
33 | import java.util.Map; | ||
34 | import java.util.stream.Collectors; | 31 | import java.util.stream.Collectors; |
35 | 32 | ||
36 | /*** | 33 | /*** |
... | @@ -222,6 +219,29 @@ public class OperationReportServiceImpl implements IOperationReportService { | ... | @@ -222,6 +219,29 @@ public class OperationReportServiceImpl implements IOperationReportService { |
222 | return productDataVO; | 219 | return productDataVO; |
223 | } | 220 | } |
224 | 221 | ||
222 | @Override | ||
223 | public Map<String, String> dataAnalysisOfMonth(Map<String, Object> paramMap) { | ||
224 | // 请求参数 | ||
225 | String startTime = ConvertUtils.getString(paramMap.get("startTime")); | ||
226 | String endTime = ConvertUtils.getString(paramMap.get("endTime")); | ||
227 | List<String> timeList = DateUtils.intervalByDay(startTime, endTime, BusinessConstant.dateFormat.split("-")[0]); | ||
228 | String departId = ConvertUtils.getString(paramMap.get("departId")); | ||
229 | List<String> departIdList = Arrays.asList(departId.split(",")); | ||
230 | List<String> codeList = new ArrayList<String>(){{ | ||
231 | // 污水(万吨) 水质水量日数据报表-出水量 | ||
232 | add(""); | ||
233 | }}; | ||
234 | QueryWrapper<?> queryWrapper0 = new QueryWrapper<>(); | ||
235 | queryWrapper0.in("", codeList) | ||
236 | .ge("", startTime) | ||
237 | .le("", endTime) | ||
238 | .groupBy("f_report_itemv.depart_id"); | ||
239 | List<Map<String, Object>> queryMapList0 = baseService.queryForList("", queryWrapper0); | ||
240 | // 封装结果集 | ||
241 | Map<String, String> resMap = new LinkedHashMap<>(); | ||
242 | return resMap; | ||
243 | } | ||
244 | |||
225 | public Double formatDouble(Object obj ){ | 245 | public Double formatDouble(Object obj ){ |
226 | Double value = ConvertUtils.getDouble(obj,0d); | 246 | Double value = ConvertUtils.getDouble(obj,0d); |
227 | BigDecimal bd = BigDecimal.valueOf(value); | 247 | BigDecimal bd = BigDecimal.valueOf(value); | ... | ... |
... | @@ -87,6 +87,7 @@ public class MybatisInterceptor implements Interceptor { | ... | @@ -87,6 +87,7 @@ public class MybatisInterceptor implements Interceptor { |
87 | add("inspection_point_trigger_config"); | 87 | add("inspection_point_trigger_config"); |
88 | 88 | ||
89 | //在线考试 | 89 | //在线考试 |
90 | add("edu_paper");//用户的试卷 | ||
90 | add("edu_user_paper");//用户的试卷 | 91 | add("edu_user_paper");//用户的试卷 |
91 | add("edu_question");//试题 | 92 | add("edu_question");//试题 |
92 | add("edu_question_db");//题库 | 93 | add("edu_question_db");//题库 | ... | ... |
-
请 注册 或 登录 后发表评论