Commit 6beff445713398479c7c296927d1e138c02e1a61
1 parent
7364a92c
feat: 按天导出工作表
Showing
6 changed files
with
218 additions
and
95 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/ReportController.java
| @@ -59,10 +59,7 @@ public class ReportController { | @@ -59,10 +59,7 @@ public class ReportController { | ||
| 59 | @ApiOperation("签到报表导出") | 59 | @ApiOperation("签到报表导出") |
| 60 | @PostMapping("/export") | 60 | @PostMapping("/export") |
| 61 | public void exportReport(@ApiParam ReportViewRequestVo requestVo, HttpServletResponse response) { | 61 | public void exportReport(@ApiParam ReportViewRequestVo requestVo, HttpServletResponse response) { |
| 62 | - List<ExportReportViewResponseVo> list = reportService.exportReportList(requestVo, response); | ||
| 63 | - // 不导出图片清空路径信息 | ||
| 64 | - ExcelUtil<ExportReportViewResponseVo> util = new ExcelUtil<ExportReportViewResponseVo>(ExportReportViewResponseVo.class); | ||
| 65 | - util.exportEasyExcel(response, list, "签到报表"); | 62 | + reportService.exportReportList(requestVo, response); |
| 66 | } | 63 | } |
| 67 | 64 | ||
| 68 | @ApiOperation("告警通知") | 65 | @ApiOperation("告警通知") |
Bsth-admin/src/main/java/com/ruoyi/eexception/domain/EquipmentException.java
Bsth-admin/src/main/java/com/ruoyi/pojo/response/ReportErrorResponseVo.java
| 1 | package com.ruoyi.pojo.response; | 1 | package com.ruoyi.pojo.response; |
| 2 | 2 | ||
| 3 | +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 3 | import com.alibaba.excel.annotation.ExcelProperty; | 4 | import com.alibaba.excel.annotation.ExcelProperty; |
| 4 | import com.alibaba.excel.annotation.write.style.ColumnWidth; | 5 | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| 5 | import com.alibaba.excel.annotation.write.style.HeadFontStyle; | 6 | import com.alibaba.excel.annotation.write.style.HeadFontStyle; |
| @@ -19,6 +20,7 @@ import java.util.Date; | @@ -19,6 +20,7 @@ import java.util.Date; | ||
| 19 | @Data | 20 | @Data |
| 20 | @ApiModel("异常报表对象") | 21 | @ApiModel("异常报表对象") |
| 21 | @HeadFontStyle(fontHeightInPoints = 10,fontName = "黑体") | 22 | @HeadFontStyle(fontHeightInPoints = 10,fontName = "黑体") |
| 23 | +@ExcelIgnoreUnannotated | ||
| 22 | public class ReportErrorResponseVo { | 24 | public class ReportErrorResponseVo { |
| 23 | @ApiModelProperty("工号") | 25 | @ApiModelProperty("工号") |
| 24 | @ExcelProperty(value = "工号") | 26 | @ExcelProperty(value = "工号") |
| @@ -44,8 +46,8 @@ public class ReportErrorResponseVo { | @@ -44,8 +46,8 @@ public class ReportErrorResponseVo { | ||
| 44 | @ExcelProperty(value = "车辆自编号") | 46 | @ExcelProperty(value = "车辆自编号") |
| 45 | @ColumnWidth(20) | 47 | @ColumnWidth(20) |
| 46 | private String nbbm; | 48 | private String nbbm; |
| 47 | - @ApiModelProperty("计划时间") | ||
| 48 | - @ExcelProperty(value = "计划时间") | 49 | + @ApiModelProperty("计划打卡时间") |
| 50 | + @ExcelProperty(value = "计划打卡时间") | ||
| 49 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 51 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 50 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") | 52 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") |
| 51 | @ColumnWidth(20) | 53 | @ColumnWidth(20) |
Bsth-admin/src/main/java/com/ruoyi/service/ReportService.java
| 1 | package com.ruoyi.service; | 1 | package com.ruoyi.service; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollectionUtil; | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | +import com.alibaba.excel.EasyExcel; | ||
| 5 | +import com.alibaba.excel.ExcelWriter; | ||
| 6 | +import com.alibaba.excel.write.metadata.WriteSheet; | ||
| 7 | +import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; | ||
| 4 | import com.ruoyi.common.global.Result; | 8 | import com.ruoyi.common.global.Result; |
| 5 | import com.ruoyi.common.global.ResultCode; | 9 | import com.ruoyi.common.global.ResultCode; |
| 6 | import com.ruoyi.common.utils.SecurityUtils; | 10 | import com.ruoyi.common.utils.SecurityUtils; |
| 7 | -import com.ruoyi.driver.mapper.DriverMapper; | 11 | +import com.ruoyi.common.utils.poi.ExcelUtil; |
| 12 | +import com.ruoyi.domain.DriverScheduling; | ||
| 8 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; | 13 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 9 | import com.ruoyi.eexception.mapper.EquipmentExceptionMapper; | 14 | import com.ruoyi.eexception.mapper.EquipmentExceptionMapper; |
| 10 | import com.ruoyi.in.mapper.SignInMapper; | 15 | import com.ruoyi.in.mapper.SignInMapper; |
| 11 | -import com.ruoyi.domain.DriverScheduling; | ||
| 12 | -import com.ruoyi.pojo.request.ReportViewRequestVo; | ||
| 13 | import com.ruoyi.pojo.request.ReportErrorRequestVo; | 16 | import com.ruoyi.pojo.request.ReportErrorRequestVo; |
| 17 | +import com.ruoyi.pojo.request.ReportViewRequestVo; | ||
| 14 | import com.ruoyi.pojo.response.*; | 18 | import com.ruoyi.pojo.response.*; |
| 15 | import com.ruoyi.pojo.vo.PersonSignDataResponseVo; | 19 | import com.ruoyi.pojo.vo.PersonSignDataResponseVo; |
| 16 | import com.ruoyi.system.domain.SysNotice; | 20 | import com.ruoyi.system.domain.SysNotice; |
| @@ -25,6 +29,7 @@ import javax.annotation.Resource; | @@ -25,6 +29,7 @@ import javax.annotation.Resource; | ||
| 25 | import javax.servlet.http.HttpServletRequest; | 29 | import javax.servlet.http.HttpServletRequest; |
| 26 | import javax.servlet.http.HttpServletResponse; | 30 | import javax.servlet.http.HttpServletResponse; |
| 27 | import javax.validation.constraints.NotBlank; | 31 | import javax.validation.constraints.NotBlank; |
| 32 | +import java.io.OutputStream; | ||
| 28 | import java.time.LocalDate; | 33 | import java.time.LocalDate; |
| 29 | import java.time.YearMonth; | 34 | import java.time.YearMonth; |
| 30 | import java.time.format.DateTimeFormatter; | 35 | import java.time.format.DateTimeFormatter; |
| @@ -57,9 +62,6 @@ public class ReportService { | @@ -57,9 +62,6 @@ public class ReportService { | ||
| 57 | @Autowired | 62 | @Autowired |
| 58 | private EquipmentExceptionMapper exceptionMapper; | 63 | private EquipmentExceptionMapper exceptionMapper; |
| 59 | 64 | ||
| 60 | - @Autowired | ||
| 61 | - private DriverMapper driverMapper; | ||
| 62 | - | ||
| 63 | @Resource | 65 | @Resource |
| 64 | private SchedulingService schedulingService; | 66 | private SchedulingService schedulingService; |
| 65 | 67 | ||
| @@ -81,7 +83,6 @@ public class ReportService { | @@ -81,7 +83,6 @@ public class ReportService { | ||
| 81 | vo.setRemark(item.getRemark()); | 83 | vo.setRemark(item.getRemark()); |
| 82 | vo.setName(item.getPersonnelName()); | 84 | vo.setName(item.getPersonnelName()); |
| 83 | vo.setSiteName(item.getSiteName()); | 85 | vo.setSiteName(item.getSiteName()); |
| 84 | - vo.setImage(item.getImage()); | ||
| 85 | vo.setJobCode(item.getJobCode()); | 86 | vo.setJobCode(item.getJobCode()); |
| 86 | vo.setDeviceId(item.getDeviceId()); | 87 | vo.setDeviceId(item.getDeviceId()); |
| 87 | vo.setExType(item.getExType()); | 88 | vo.setExType(item.getExType()); |
| @@ -96,20 +97,90 @@ public class ReportService { | @@ -96,20 +97,90 @@ public class ReportService { | ||
| 96 | } | 97 | } |
| 97 | 98 | ||
| 98 | 99 | ||
| 99 | - public List<ExportReportViewResponseVo> exportReportList(ReportViewRequestVo requestVo, HttpServletResponse response) { | 100 | + public void exportReportList(ReportViewRequestVo requestVo, HttpServletResponse response) { |
| 101 | + List<ExportReportViewResponseVo> list = null; | ||
| 100 | // 处理天 | 102 | // 处理天 |
| 101 | if (requestVo.getExportFlag().equals(DAY)) { | 103 | if (requestVo.getExportFlag().equals(DAY)) { |
| 102 | - return getDayReportTableResponseVo(requestVo.getDate()); | 104 | + list = getDayReportTableResponseVo(requestVo.getDate()); |
| 105 | + // 查询无排班异常 | ||
| 106 | + ReportErrorRequestVo errorVo = new ReportErrorRequestVo(); | ||
| 107 | + errorVo.setDate(requestVo.getDate()); | ||
| 108 | + errorVo.setExType(SIGN_NO_SCHEDULING_EX_NUM); | ||
| 109 | + List<EquipmentExceptionResponseVo> errorList = exceptionMapper.selectEquipmentExceptionListByVo(errorVo); | ||
| 110 | + ExcelWriter excelWriter = null; | ||
| 111 | + try (OutputStream os = response.getOutputStream()) { | ||
| 112 | + excelWriter = EasyExcel.write(os).build(); | ||
| 113 | + WriteSheet writeSheet = EasyExcel.writerSheet(0, "签到报表").head(ExportReportViewResponseVo.class).build(); | ||
| 114 | + excelWriter.write(list, writeSheet); | ||
| 115 | + // 无排班打卡表 | ||
| 116 | + Map<String, List<EquipmentExceptionResponseVo>> map = new HashMap<>(); | ||
| 117 | + transfromMap(errorList, map); | ||
| 118 | + List<List<String>> errorListHead = createErrorListHead(map); | ||
| 119 | + WriteSheet writeSheet1 = EasyExcel.writerSheet(1, "无排班打卡表").head(errorListHead).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build(); | ||
| 120 | + excelWriter.write(createErrorListData(errorListHead.size(), map), writeSheet1); | ||
| 121 | + excelWriter.finish(); | ||
| 122 | + } catch (Exception e) { | ||
| 123 | + System.out.println(e.getMessage()); | ||
| 124 | + } | ||
| 125 | + return; | ||
| 103 | } | 126 | } |
| 104 | // 处理月 | 127 | // 处理月 |
| 105 | else if (requestVo.getExportFlag().equals(MONTH)) { | 128 | else if (requestVo.getExportFlag().equals(MONTH)) { |
| 106 | - return getMonthReportTableResponseVo(requestVo); | 129 | + list = getMonthReportTableResponseVo(requestVo); |
| 107 | } | 130 | } |
| 108 | // 处理导出任意时间段 后台追加限制条件 366 天为最长导出时间 | 131 | // 处理导出任意时间段 后台追加限制条件 366 天为最长导出时间 |
| 109 | else if (requestVo.getExportFlag().equals(TIME_PERIOD)) { | 132 | else if (requestVo.getExportFlag().equals(TIME_PERIOD)) { |
| 110 | - return getTimePeriodReportTableResponseVo(requestVo); | 133 | + list = getTimePeriodReportTableResponseVo(requestVo); |
| 134 | + } | ||
| 135 | + if (!DAY.equals(requestVo.getExportFlag())) { | ||
| 136 | + // 不导出图片清空路径信息 | ||
| 137 | + ExcelUtil<ExportReportViewResponseVo> util = new ExcelUtil<ExportReportViewResponseVo>(ExportReportViewResponseVo.class); | ||
| 138 | + util.exportEasyExcel(response, list, "签到报表"); | ||
| 111 | } | 139 | } |
| 112 | - return null; | 140 | + } |
| 141 | + | ||
| 142 | + private static void transfromMap(List<EquipmentExceptionResponseVo> errorList, Map<String, List<EquipmentExceptionResponseVo>> map) { | ||
| 143 | + // 以工号封装成map | ||
| 144 | + for (EquipmentExceptionResponseVo exceptionResponseVo : errorList) { | ||
| 145 | + List<EquipmentExceptionResponseVo> vos = map.get(exceptionResponseVo.getJobCode()); | ||
| 146 | + if (CollectionUtil.isEmpty(vos)) { | ||
| 147 | + map.put(exceptionResponseVo.getJobCode(), new ArrayList<>(Arrays.asList(exceptionResponseVo))); | ||
| 148 | + } else { | ||
| 149 | + vos.add(exceptionResponseVo); | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + /** | ||
| 155 | + * 不确定数据列数 | ||
| 156 | + * | ||
| 157 | + * @return | ||
| 158 | + */ | ||
| 159 | + private List<List<String>> createErrorListData(int column, Map<String, List<EquipmentExceptionResponseVo>> map) { | ||
| 160 | + // 封装数据 | ||
| 161 | + List<List<String>> result = new ArrayList<>(); | ||
| 162 | + map.forEach((key, value) -> { | ||
| 163 | + List<String> data = new ArrayList<>(); | ||
| 164 | + data.add(key); | ||
| 165 | + data.add(value.get(0).getPersonnelName()); | ||
| 166 | + data.add(value.get(0).getFleetName()); | ||
| 167 | + for (int i = 0; i < column; i++) { | ||
| 168 | + if (value.size() > i) { | ||
| 169 | + EquipmentExceptionResponseVo vo = value.get(i); | ||
| 170 | + data.add(ConstDateUtil.formatDate("yyyy-MM-dd HH:mm:ss", vo.getCreateTime())); | ||
| 171 | + if (vo.getSignType() == null) { | ||
| 172 | + data.add(""); | ||
| 173 | + }else { | ||
| 174 | + data.add(vo.getSignType().equals(SIGN_IN) ? "签到" : "签退"); | ||
| 175 | + } | ||
| 176 | + } else { | ||
| 177 | + data.add(""); | ||
| 178 | + data.add(""); | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + result.add(data); | ||
| 182 | + }); | ||
| 183 | + return result; | ||
| 113 | } | 184 | } |
| 114 | 185 | ||
| 115 | private List<ExportReportViewResponseVo> getTimePeriodReportTableResponseVo(ReportViewRequestVo requestVo) { | 186 | private List<ExportReportViewResponseVo> getTimePeriodReportTableResponseVo(ReportViewRequestVo requestVo) { |
| @@ -176,10 +247,28 @@ public class ReportService { | @@ -176,10 +247,28 @@ public class ReportService { | ||
| 176 | private List<ExportReportViewResponseVo> getDayReportTableResponseVo(String date) { | 247 | private List<ExportReportViewResponseVo> getDayReportTableResponseVo(String date) { |
| 177 | List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, null, null, null); | 248 | List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, null, null, null); |
| 178 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); | 249 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); |
| 179 | - List<ExportReportViewResponseVo> vo = new ArrayList<>(800); | 250 | + List<ExportReportViewResponseVo> signVo = new ArrayList<>(800); |
| 180 | handlerResultMap(date, resultMap, schedulingList); | 251 | handlerResultMap(date, resultMap, schedulingList); |
| 181 | - handleResultList(vo, resultMap); | ||
| 182 | - return vo; | 252 | + handleResultList(signVo, resultMap); |
| 253 | + return signVo; | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + private List<List<String>> createErrorListHead(Map<String, List<EquipmentExceptionResponseVo>> map) { | ||
| 257 | + List<List<String>> list = new ArrayList<>(); | ||
| 258 | + list.add(Arrays.asList("工号")); | ||
| 259 | + list.add(Arrays.asList("姓名")); | ||
| 260 | + list.add(Arrays.asList("部门")); | ||
| 261 | + List<Integer> maxSignCount = Arrays.asList(0); | ||
| 262 | + map.forEach((key, value) -> { | ||
| 263 | + if (maxSignCount.get(0) < value.size()) { | ||
| 264 | + maxSignCount.set(0, value.size()); | ||
| 265 | + } | ||
| 266 | + }); | ||
| 267 | + for (int i = 0; i < maxSignCount.get(0) * 2; i = i + 2) { | ||
| 268 | + list.add(Arrays.asList("打卡时间")); | ||
| 269 | + list.add(Arrays.asList("打卡类型")); | ||
| 270 | + } | ||
| 271 | + return list; | ||
| 183 | } | 272 | } |
| 184 | 273 | ||
| 185 | private void handleResultList(List<ExportReportViewResponseVo> vo, Map<String, List<DriverScheduling>> resultMap) { | 274 | private void handleResultList(List<ExportReportViewResponseVo> vo, Map<String, List<DriverScheduling>> resultMap) { |
| @@ -219,6 +308,7 @@ public class ReportService { | @@ -219,6 +308,7 @@ public class ReportService { | ||
| 219 | List<String> days = getNowMonthAllDay(requestVo.getDate()); | 308 | List<String> days = getNowMonthAllDay(requestVo.getDate()); |
| 220 | for (String day : days) { | 309 | for (String day : days) { |
| 221 | List<ExportReportViewResponseVo> dayReportTableResponseVo = getDayReportTableResponseVo(day); | 310 | List<ExportReportViewResponseVo> dayReportTableResponseVo = getDayReportTableResponseVo(day); |
| 311 | + // TODO 修改 | ||
| 222 | responseVos.addAll(dayReportTableResponseVo); | 312 | responseVos.addAll(dayReportTableResponseVo); |
| 223 | } | 313 | } |
| 224 | return responseVos; | 314 | return responseVos; |
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| @@ -182,6 +182,7 @@ public class ThreadJobService { | @@ -182,6 +182,7 @@ public class ThreadJobService { | ||
| 182 | exception.setLineName(scheduling.getLineName()); | 182 | exception.setLineName(scheduling.getLineName()); |
| 183 | exception.setPlanTime(scheduling.getBcType().equals(BC_TYPE_IN) ? new Date(scheduling.getZdsjT()) : new Date(scheduling.getFcsjT())); | 183 | exception.setPlanTime(scheduling.getBcType().equals(BC_TYPE_IN) ? new Date(scheduling.getZdsjT()) : new Date(scheduling.getFcsjT())); |
| 184 | } | 184 | } |
| 185 | + exception.setSignType(signIn.getType()); | ||
| 185 | exceptionMapper.insertEquipmentException(exception); | 186 | exceptionMapper.insertEquipmentException(exception); |
| 186 | // 发送通知 | 187 | // 发送通知 |
| 187 | sendNotice(signIn, driver, dto, globalIndex); | 188 | sendNotice(signIn, driver, dto, globalIndex); |
| @@ -219,10 +220,12 @@ public class ThreadJobService { | @@ -219,10 +220,12 @@ public class ThreadJobService { | ||
| 219 | } | 220 | } |
| 220 | 221 | ||
| 221 | private String getResultString(BigDecimal alcoholIntake) { | 222 | private String getResultString(BigDecimal alcoholIntake) { |
| 222 | - if (alcoholIntake.compareTo(new BigDecimal(20)) >= 0 && alcoholIntake.compareTo(new BigDecimal(80)) < 0) | 223 | + if (alcoholIntake.compareTo(new BigDecimal(20)) >= 0 && alcoholIntake.compareTo(new BigDecimal(80)) < 0) { |
| 223 | return "饮酒后驾驶机动车"; | 224 | return "饮酒后驾驶机动车"; |
| 224 | - else | 225 | + } else { |
| 225 | return "醉酒后驾驶机动车"; | 226 | return "醉酒后驾驶机动车"; |
| 227 | + } | ||
| 228 | + | ||
| 226 | } | 229 | } |
| 227 | 230 | ||
| 228 | @Async | 231 | @Async |
| @@ -525,7 +528,7 @@ public class ThreadJobService { | @@ -525,7 +528,7 @@ public class ThreadJobService { | ||
| 525 | DriverScheduling scheduling = nowScheduling.get(nowScheduling.size() - 1); | 528 | DriverScheduling scheduling = nowScheduling.get(nowScheduling.size() - 1); |
| 526 | scheduling.setZdsjT(scheduling.getFcsjT()); | 529 | scheduling.setZdsjT(scheduling.getFcsjT()); |
| 527 | } catch (Exception e) { | 530 | } catch (Exception e) { |
| 528 | - log.error("特殊处理失败:{}",e.getMessage()); | 531 | + log.error("特殊处理失败:{}", e.getMessage()); |
| 529 | } | 532 | } |
| 530 | // 处理青蒸线区间 区间删除注意特殊情况放到最后可能没有全部都是区间倒是nowScheduling 为0 然后get报错 | 533 | // 处理青蒸线区间 区间删除注意特殊情况放到最后可能没有全部都是区间倒是nowScheduling 为0 然后get报错 |
| 531 | if (nowScheduling.get(0).getLineName().startsWith("青蒸线")) { | 534 | if (nowScheduling.get(0).getLineName().startsWith("青蒸线")) { |
Bsth-admin/src/main/resources/mapper/eexception/EquipmentExceptionMapper.xml
| 1 | <?xml version="1.0" encoding="UTF-8" ?> | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <!DOCTYPE mapper | 2 | <!DOCTYPE mapper |
| 3 | -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 4 | -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 4 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 5 | <mapper namespace="com.ruoyi.eexception.mapper.EquipmentExceptionMapper"> | 5 | <mapper namespace="com.ruoyi.eexception.mapper.EquipmentExceptionMapper"> |
| 6 | - | 6 | + |
| 7 | <resultMap type="com.ruoyi.pojo.response.EquipmentExceptionResponseVo" id="EquipmentExceptionResponseResult"> | 7 | <resultMap type="com.ruoyi.pojo.response.EquipmentExceptionResponseVo" id="EquipmentExceptionResponseResult"> |
| 8 | - <result property="id" column="id" /> | ||
| 9 | - <result property="title" column="title" /> | ||
| 10 | - <result property="deviceId" column="device_id" /> | ||
| 11 | - <result property="jobCode" column="job_code" /> | ||
| 12 | - <result property="image" column="image" /> | ||
| 13 | - <result property="status" column="status" /> | ||
| 14 | - <result property="createTime" column="create_time" /> | ||
| 15 | - <result property="remark" column="remark" /> | ||
| 16 | - <result property="exType" column="ex_type" /> | ||
| 17 | - <result property="personnelName" column="personnel_name" /> | ||
| 18 | - <result property="siteName" column="site_name" /> | ||
| 19 | - <result property="fleetName" column="fleet_name" /> | ||
| 20 | - <result property="nbbm" column="nbbm" /> | ||
| 21 | - <result property="lineName" column="line_name" /> | ||
| 22 | - <result property="planTime" column="plan_time" /> | 8 | + <result property="id" column="id"/> |
| 9 | + <result property="title" column="title"/> | ||
| 10 | + <result property="deviceId" column="device_id"/> | ||
| 11 | + <result property="jobCode" column="job_code"/> | ||
| 12 | + <result property="image" column="image"/> | ||
| 13 | + <result property="status" column="status"/> | ||
| 14 | + <result property="createTime" column="create_time"/> | ||
| 15 | + <result property="remark" column="remark"/> | ||
| 16 | + <result property="exType" column="ex_type"/> | ||
| 17 | + <result property="personnelName" column="personnel_name"/> | ||
| 18 | + <result property="siteName" column="site_name"/> | ||
| 19 | + <result property="fleetName" column="fleet_name"/> | ||
| 20 | + <result property="nbbm" column="nbbm"/> | ||
| 21 | + <result property="lineName" column="line_name"/> | ||
| 22 | + <result property="planTime" column="plan_time"/> | ||
| 23 | + <result property="signType" column="sign_type"/> | ||
| 23 | </resultMap> | 24 | </resultMap> |
| 24 | <resultMap type="EquipmentException" id="EquipmentExceptionResult"> | 25 | <resultMap type="EquipmentException" id="EquipmentExceptionResult"> |
| 25 | - <result property="id" column="id" /> | ||
| 26 | - <result property="title" column="title" /> | ||
| 27 | - <result property="deviceId" column="device_id" /> | ||
| 28 | - <result property="jobCode" column="job_code" /> | ||
| 29 | - <result property="image" column="image" /> | ||
| 30 | - <result property="status" column="status" /> | ||
| 31 | - <result property="createTime" column="create_time" /> | ||
| 32 | - <result property="remark" column="remark" /> | ||
| 33 | - <result property="exType" column="ex_type" /> | ||
| 34 | - <result property="planTime" column="plan_time" /> | 26 | + <result property="id" column="id"/> |
| 27 | + <result property="title" column="title"/> | ||
| 28 | + <result property="deviceId" column="device_id"/> | ||
| 29 | + <result property="jobCode" column="job_code"/> | ||
| 30 | + <result property="image" column="image"/> | ||
| 31 | + <result property="status" column="status"/> | ||
| 32 | + <result property="createTime" column="create_time"/> | ||
| 33 | + <result property="remark" column="remark"/> | ||
| 34 | + <result property="exType" column="ex_type"/> | ||
| 35 | + <result property="planTime" column="plan_time"/> | ||
| 36 | + <result property="signType" column="sign_type"/> | ||
| 35 | </resultMap> | 37 | </resultMap> |
| 36 | 38 | ||
| 37 | <sql id="selectEquipmentExceptionVo"> | 39 | <sql id="selectEquipmentExceptionVo"> |
| 38 | - select id, title, device_id, job_code, image, status, create_time, remark,ex_type,plan_time from equipment_exception | 40 | + select id, |
| 41 | + title, | ||
| 42 | + device_id, | ||
| 43 | + job_code, | ||
| 44 | + image, | ||
| 45 | + status, | ||
| 46 | + create_time, | ||
| 47 | + remark, | ||
| 48 | + ex_type, | ||
| 49 | + plan_time, | ||
| 50 | + sign_type | ||
| 51 | + from equipment_exception | ||
| 39 | </sql> | 52 | </sql> |
| 40 | 53 | ||
| 41 | - <select id="selectEquipmentExceptionList" parameterType="com.ruoyi.pojo.response.EquipmentExceptionResponseVo" resultMap="EquipmentExceptionResponseResult"> | 54 | + <select id="selectEquipmentExceptionList" parameterType="com.ruoyi.pojo.response.EquipmentExceptionResponseVo" |
| 55 | + resultMap="EquipmentExceptionResponseResult"> | ||
| 42 | select equipment_exception.id, title, equipment.site_name , | 56 | select equipment_exception.id, title, equipment.site_name , |
| 43 | - equipment_exception.device_id,driver.personnel_name, | ||
| 44 | - driver.job_code, equipment_exception.image, | ||
| 45 | - equipment_exception.status, equipment_exception.create_time, | ||
| 46 | - equipment_exception.ex_type,equipment_exception.remark, | ||
| 47 | - equipment_exception.plan_time | 57 | + equipment_exception.device_id,driver.personnel_name, |
| 58 | + driver.job_code, equipment_exception.image, | ||
| 59 | + equipment_exception.status, equipment_exception.create_time, | ||
| 60 | + equipment_exception.ex_type,equipment_exception.remark, | ||
| 61 | + equipment_exception.plan_time | ||
| 48 | from | 62 | from |
| 49 | - equipment_exception | ||
| 50 | - join driver on driver.job_code = equipment_exception.job_code | ||
| 51 | - join equipment on equipment.device_id = equipment_exception.device_id | 63 | + equipment_exception |
| 64 | + join driver on driver.job_code = equipment_exception.job_code | ||
| 65 | + join equipment on equipment.device_id = equipment_exception.device_id | ||
| 52 | <where> | 66 | <where> |
| 53 | ex_type = 4 | 67 | ex_type = 4 |
| 54 | - <if test="title != null and title != ''"> and title = #{title}</if> | ||
| 55 | - <if test="deviceId != null "> and device_id = #{deviceId}</if> | ||
| 56 | - <if test="jobCode != null and jobCode != ''"> and driver.job_code = #{jobCode}</if> | ||
| 57 | - <if test="status != null "> and status = #{status}</if> | 68 | + <if test="title != null and title != ''">and title = #{title}</if> |
| 69 | + <if test="deviceId != null ">and device_id = #{deviceId}</if> | ||
| 70 | + <if test="jobCode != null and jobCode != ''">and driver.job_code = #{jobCode}</if> | ||
| 71 | + <if test="status != null ">and status = #{status}</if> | ||
| 58 | </where> | 72 | </where> |
| 59 | order by id desc | 73 | order by id desc |
| 60 | </select> | 74 | </select> |
| 61 | - | 75 | + |
| 62 | <select id="selectEquipmentExceptionById" parameterType="Long" resultMap="EquipmentExceptionResult"> | 76 | <select id="selectEquipmentExceptionById" parameterType="Long" resultMap="EquipmentExceptionResult"> |
| 63 | <include refid="selectEquipmentExceptionVo"/> | 77 | <include refid="selectEquipmentExceptionVo"/> |
| 64 | where id = #{id} | 78 | where id = #{id} |
| @@ -75,43 +89,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -75,43 +89,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 75 | </if> | 89 | </if> |
| 76 | </select> | 90 | </select> |
| 77 | <select id="selectEquipmentExceptionListByVo" | 91 | <select id="selectEquipmentExceptionListByVo" |
| 78 | - resultType="com.ruoyi.pojo.response.EquipmentExceptionResponseVo" resultMap="EquipmentExceptionResponseResult"> | 92 | + resultType="com.ruoyi.pojo.response.EquipmentExceptionResponseVo" |
| 93 | + resultMap="EquipmentExceptionResponseResult"> | ||
| 79 | select equipment_exception.id, title, | 94 | select equipment_exception.id, title, |
| 80 | - equipment.site_name , | ||
| 81 | - equipment_exception.device_id, | ||
| 82 | - driver.personnel_name, | ||
| 83 | - driver.job_code, | ||
| 84 | - equipment_exception.image, | ||
| 85 | - equipment_exception.status, | ||
| 86 | - equipment_exception.create_time, | ||
| 87 | - equipment_exception.ex_type, | ||
| 88 | - equipment_exception.remark, | ||
| 89 | - equipment_exception.fleet_name, | ||
| 90 | - equipment_exception.nbbm, | ||
| 91 | - equipment_exception.line_name, | ||
| 92 | - equipment_exception.plan_time | 95 | + equipment.site_name , |
| 96 | + equipment_exception.device_id, | ||
| 97 | + driver.personnel_name, | ||
| 98 | + driver.job_code, | ||
| 99 | + equipment_exception.image, | ||
| 100 | + equipment_exception.status, | ||
| 101 | + equipment_exception.create_time, | ||
| 102 | + equipment_exception.ex_type, | ||
| 103 | + equipment_exception.remark, | ||
| 104 | + equipment_exception.fleet_name, | ||
| 105 | + equipment_exception.nbbm, | ||
| 106 | + equipment_exception.line_name, | ||
| 107 | + equipment_exception.plan_time, | ||
| 108 | + equipment_exception.sign_type | ||
| 93 | from | 109 | from |
| 94 | - equipment_exception | ||
| 95 | - join driver on driver.job_code = equipment_exception.job_code | ||
| 96 | - join equipment on equipment.device_id = equipment_exception.device_id | 110 | + equipment_exception |
| 111 | + join driver on driver.job_code = equipment_exception.job_code | ||
| 112 | + join equipment on equipment.device_id = equipment_exception.device_id | ||
| 97 | <where> | 113 | <where> |
| 98 | equipment_exception.`status` != 1 | 114 | equipment_exception.`status` != 1 |
| 99 | - <if test="fleetName != null and fleetName != ''"> and equipment_exception.fleet_name like concat(#{fleetName},'%')</if> | ||
| 100 | - <if test="lineName != null and lineName != ''"> and equipment_exception.line_name like concat(#{lineName},'%')</if> | ||
| 101 | - <if test="jobCode != null and jobCode != ''"> and driver.job_code = #{jobCode}</if> | ||
| 102 | - <if test="exType != null "> and ex_type = #{exType}</if> | ||
| 103 | - <if test="id != null "> and equipment_exception.id #{id}</if> | 115 | + <if test="fleetName != null and fleetName != ''">and equipment_exception.fleet_name like |
| 116 | + concat(#{fleetName},'%') | ||
| 117 | + </if> | ||
| 118 | + <if test="lineName != null and lineName != ''">and equipment_exception.line_name like | ||
| 119 | + concat(#{lineName},'%') | ||
| 120 | + </if> | ||
| 121 | + <if test="jobCode != null and jobCode != ''">and driver.job_code = #{jobCode}</if> | ||
| 122 | + <if test="exType != null ">and ex_type = #{exType}</if> | ||
| 123 | + <if test="id != null ">and equipment_exception.id #{id}</if> | ||
| 104 | <if test="date != null "> | 124 | <if test="date != null "> |
| 105 | and | 125 | and |
| 106 | equipment_exception.create_time >= CONCAT(#{date}, ' 02:30:00') | 126 | equipment_exception.create_time >= CONCAT(#{date}, ' 02:30:00') |
| 107 | and | 127 | and |
| 108 | - equipment_exception.create_time <= CONCAT(DATE_ADD(#{date}, INTERVAL 1 DAY), ' 02:30:00') | 128 | + equipment_exception.create_time <= CONCAT(DATE_ADD(#{date}, INTERVAL 1 DAY), ' 02:30:00') |
| 109 | </if> | 129 | </if> |
| 110 | </where> | 130 | </where> |
| 131 | + order by equipment_exception.create_time | ||
| 111 | </select> | 132 | </select> |
| 112 | <select id="selectEquipmentExceptionByDeviceIdStatus" | 133 | <select id="selectEquipmentExceptionByDeviceIdStatus" |
| 113 | resultType="com.ruoyi.eexception.domain.EquipmentException"> | 134 | resultType="com.ruoyi.eexception.domain.EquipmentException"> |
| 114 | - select id from equipment_exception where device_id = #{deviceId} and ex_type = 4 and `status` != 1 limit 1 | 135 | + select id |
| 136 | + from equipment_exception | ||
| 137 | + where device_id = #{deviceId} | ||
| 138 | + and ex_type = 4 | ||
| 139 | + and `status` != 1 limit 1 | ||
| 115 | </select> | 140 | </select> |
| 116 | 141 | ||
| 117 | <insert id="insertEquipmentException" parameterType="EquipmentException" useGeneratedKeys="true" keyProperty="id"> | 142 | <insert id="insertEquipmentException" parameterType="EquipmentException" useGeneratedKeys="true" keyProperty="id"> |
| @@ -129,7 +154,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -129,7 +154,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 129 | <if test="nbbm != null and nbbm != ''">nbbm,</if> | 154 | <if test="nbbm != null and nbbm != ''">nbbm,</if> |
| 130 | <if test="lineName != null and lineName != ''">line_name,</if> | 155 | <if test="lineName != null and lineName != ''">line_name,</if> |
| 131 | <if test="planTime != null">plan_time,</if> | 156 | <if test="planTime != null">plan_time,</if> |
| 132 | - </trim> | 157 | + <if test="signType != null">sign_type,</if> |
| 158 | + </trim> | ||
| 133 | <trim prefix="values (" suffix=")" suffixOverrides=","> | 159 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 134 | <if test="title != null">#{title},</if> | 160 | <if test="title != null">#{title},</if> |
| 135 | <if test="deviceId != null">#{deviceId},</if> | 161 | <if test="deviceId != null">#{deviceId},</if> |
| @@ -143,7 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -143,7 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 143 | <if test="nbbm != null and nbbm != ''">#{nbbm},</if> | 169 | <if test="nbbm != null and nbbm != ''">#{nbbm},</if> |
| 144 | <if test="lineName != null and lineName != ''">#{lineName},</if> | 170 | <if test="lineName != null and lineName != ''">#{lineName},</if> |
| 145 | <if test="planTime != null ">#{planTime},</if> | 171 | <if test="planTime != null ">#{planTime},</if> |
| 146 | - </trim> | 172 | + <if test="signType != null ">#{signType},</if> |
| 173 | + </trim> | ||
| 147 | </insert> | 174 | </insert> |
| 148 | 175 | ||
| 149 | <update id="updateEquipmentException" parameterType="EquipmentException"> | 176 | <update id="updateEquipmentException" parameterType="EquipmentException"> |
| @@ -161,11 +188,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -161,11 +188,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 161 | </update> | 188 | </update> |
| 162 | 189 | ||
| 163 | <delete id="deleteEquipmentExceptionById" parameterType="Long"> | 190 | <delete id="deleteEquipmentExceptionById" parameterType="Long"> |
| 164 | - delete from equipment_exception where id = #{id} | 191 | + delete |
| 192 | + from equipment_exception | ||
| 193 | + where id = #{id} | ||
| 165 | </delete> | 194 | </delete> |
| 166 | 195 | ||
| 167 | <delete id="deleteEquipmentExceptionByIds" parameterType="String"> | 196 | <delete id="deleteEquipmentExceptionByIds" parameterType="String"> |
| 168 | - delete from equipment_exception where id in | 197 | + delete from equipment_exception where id in |
| 169 | <foreach item="id" collection="array" open="(" separator="," close=")"> | 198 | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| 170 | #{id} | 199 | #{id} |
| 171 | </foreach> | 200 | </foreach> |