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 | 59 | @ApiOperation("签到报表导出") |
| 60 | 60 | @PostMapping("/export") |
| 61 | 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 | 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 | 1 | package com.ruoyi.pojo.response; |
| 2 | 2 | |
| 3 | +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | |
| 3 | 4 | import com.alibaba.excel.annotation.ExcelProperty; |
| 4 | 5 | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| 5 | 6 | import com.alibaba.excel.annotation.write.style.HeadFontStyle; |
| ... | ... | @@ -19,6 +20,7 @@ import java.util.Date; |
| 19 | 20 | @Data |
| 20 | 21 | @ApiModel("异常报表对象") |
| 21 | 22 | @HeadFontStyle(fontHeightInPoints = 10,fontName = "黑体") |
| 23 | +@ExcelIgnoreUnannotated | |
| 22 | 24 | public class ReportErrorResponseVo { |
| 23 | 25 | @ApiModelProperty("工号") |
| 24 | 26 | @ExcelProperty(value = "工号") |
| ... | ... | @@ -44,8 +46,8 @@ public class ReportErrorResponseVo { |
| 44 | 46 | @ExcelProperty(value = "车辆自编号") |
| 45 | 47 | @ColumnWidth(20) |
| 46 | 48 | private String nbbm; |
| 47 | - @ApiModelProperty("计划时间") | |
| 48 | - @ExcelProperty(value = "计划时间") | |
| 49 | + @ApiModelProperty("计划打卡时间") | |
| 50 | + @ExcelProperty(value = "计划打卡时间") | |
| 49 | 51 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 50 | 52 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") |
| 51 | 53 | @ColumnWidth(20) | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/ReportService.java
| 1 | 1 | package com.ruoyi.service; |
| 2 | 2 | |
| 3 | 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 | 8 | import com.ruoyi.common.global.Result; |
| 5 | 9 | import com.ruoyi.common.global.ResultCode; |
| 6 | 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 | 13 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 9 | 14 | import com.ruoyi.eexception.mapper.EquipmentExceptionMapper; |
| 10 | 15 | import com.ruoyi.in.mapper.SignInMapper; |
| 11 | -import com.ruoyi.domain.DriverScheduling; | |
| 12 | -import com.ruoyi.pojo.request.ReportViewRequestVo; | |
| 13 | 16 | import com.ruoyi.pojo.request.ReportErrorRequestVo; |
| 17 | +import com.ruoyi.pojo.request.ReportViewRequestVo; | |
| 14 | 18 | import com.ruoyi.pojo.response.*; |
| 15 | 19 | import com.ruoyi.pojo.vo.PersonSignDataResponseVo; |
| 16 | 20 | import com.ruoyi.system.domain.SysNotice; |
| ... | ... | @@ -25,6 +29,7 @@ import javax.annotation.Resource; |
| 25 | 29 | import javax.servlet.http.HttpServletRequest; |
| 26 | 30 | import javax.servlet.http.HttpServletResponse; |
| 27 | 31 | import javax.validation.constraints.NotBlank; |
| 32 | +import java.io.OutputStream; | |
| 28 | 33 | import java.time.LocalDate; |
| 29 | 34 | import java.time.YearMonth; |
| 30 | 35 | import java.time.format.DateTimeFormatter; |
| ... | ... | @@ -57,9 +62,6 @@ public class ReportService { |
| 57 | 62 | @Autowired |
| 58 | 63 | private EquipmentExceptionMapper exceptionMapper; |
| 59 | 64 | |
| 60 | - @Autowired | |
| 61 | - private DriverMapper driverMapper; | |
| 62 | - | |
| 63 | 65 | @Resource |
| 64 | 66 | private SchedulingService schedulingService; |
| 65 | 67 | |
| ... | ... | @@ -81,7 +83,6 @@ public class ReportService { |
| 81 | 83 | vo.setRemark(item.getRemark()); |
| 82 | 84 | vo.setName(item.getPersonnelName()); |
| 83 | 85 | vo.setSiteName(item.getSiteName()); |
| 84 | - vo.setImage(item.getImage()); | |
| 85 | 86 | vo.setJobCode(item.getJobCode()); |
| 86 | 87 | vo.setDeviceId(item.getDeviceId()); |
| 87 | 88 | vo.setExType(item.getExType()); |
| ... | ... | @@ -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 | 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 | 128 | else if (requestVo.getExportFlag().equals(MONTH)) { |
| 106 | - return getMonthReportTableResponseVo(requestVo); | |
| 129 | + list = getMonthReportTableResponseVo(requestVo); | |
| 107 | 130 | } |
| 108 | 131 | // 处理导出任意时间段 后台追加限制条件 366 天为最长导出时间 |
| 109 | 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 | 186 | private List<ExportReportViewResponseVo> getTimePeriodReportTableResponseVo(ReportViewRequestVo requestVo) { |
| ... | ... | @@ -176,10 +247,28 @@ public class ReportService { |
| 176 | 247 | private List<ExportReportViewResponseVo> getDayReportTableResponseVo(String date) { |
| 177 | 248 | List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, null, null, null); |
| 178 | 249 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); |
| 179 | - List<ExportReportViewResponseVo> vo = new ArrayList<>(800); | |
| 250 | + List<ExportReportViewResponseVo> signVo = new ArrayList<>(800); | |
| 180 | 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 | 274 | private void handleResultList(List<ExportReportViewResponseVo> vo, Map<String, List<DriverScheduling>> resultMap) { |
| ... | ... | @@ -219,6 +308,7 @@ public class ReportService { |
| 219 | 308 | List<String> days = getNowMonthAllDay(requestVo.getDate()); |
| 220 | 309 | for (String day : days) { |
| 221 | 310 | List<ExportReportViewResponseVo> dayReportTableResponseVo = getDayReportTableResponseVo(day); |
| 311 | + // TODO 修改 | |
| 222 | 312 | responseVos.addAll(dayReportTableResponseVo); |
| 223 | 313 | } |
| 224 | 314 | return responseVos; | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| ... | ... | @@ -182,6 +182,7 @@ public class ThreadJobService { |
| 182 | 182 | exception.setLineName(scheduling.getLineName()); |
| 183 | 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 | 186 | exceptionMapper.insertEquipmentException(exception); |
| 186 | 187 | // 发送通知 |
| 187 | 188 | sendNotice(signIn, driver, dto, globalIndex); |
| ... | ... | @@ -219,10 +220,12 @@ public class ThreadJobService { |
| 219 | 220 | } |
| 220 | 221 | |
| 221 | 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 | 224 | return "饮酒后驾驶机动车"; |
| 224 | - else | |
| 225 | + } else { | |
| 225 | 226 | return "醉酒后驾驶机动车"; |
| 227 | + } | |
| 228 | + | |
| 226 | 229 | } |
| 227 | 230 | |
| 228 | 231 | @Async |
| ... | ... | @@ -525,7 +528,7 @@ public class ThreadJobService { |
| 525 | 528 | DriverScheduling scheduling = nowScheduling.get(nowScheduling.size() - 1); |
| 526 | 529 | scheduling.setZdsjT(scheduling.getFcsjT()); |
| 527 | 530 | } catch (Exception e) { |
| 528 | - log.error("特殊处理失败:{}",e.getMessage()); | |
| 531 | + log.error("特殊处理失败:{}", e.getMessage()); | |
| 529 | 532 | } |
| 530 | 533 | // 处理青蒸线区间 区间删除注意特殊情况放到最后可能没有全部都是区间倒是nowScheduling 为0 然后get报错 |
| 531 | 534 | if (nowScheduling.get(0).getLineName().startsWith("青蒸线")) { | ... | ... |
Bsth-admin/src/main/resources/mapper/eexception/EquipmentExceptionMapper.xml
| 1 | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | 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 | 5 | <mapper namespace="com.ruoyi.eexception.mapper.EquipmentExceptionMapper"> |
| 6 | - | |
| 6 | + | |
| 7 | 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 | 24 | </resultMap> |
| 24 | 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 | 37 | </resultMap> |
| 36 | 38 | |
| 37 | 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 | 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 | 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 | 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 | 66 | <where> |
| 53 | 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 | 72 | </where> |
| 59 | 73 | order by id desc |
| 60 | 74 | </select> |
| 61 | - | |
| 75 | + | |
| 62 | 76 | <select id="selectEquipmentExceptionById" parameterType="Long" resultMap="EquipmentExceptionResult"> |
| 63 | 77 | <include refid="selectEquipmentExceptionVo"/> |
| 64 | 78 | where id = #{id} |
| ... | ... | @@ -75,43 +89,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 75 | 89 | </if> |
| 76 | 90 | </select> |
| 77 | 91 | <select id="selectEquipmentExceptionListByVo" |
| 78 | - resultType="com.ruoyi.pojo.response.EquipmentExceptionResponseVo" resultMap="EquipmentExceptionResponseResult"> | |
| 92 | + resultType="com.ruoyi.pojo.response.EquipmentExceptionResponseVo" | |
| 93 | + resultMap="EquipmentExceptionResponseResult"> | |
| 79 | 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 | 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 | 113 | <where> |
| 98 | 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 | 124 | <if test="date != null "> |
| 105 | 125 | and |
| 106 | 126 | equipment_exception.create_time >= CONCAT(#{date}, ' 02:30:00') |
| 107 | 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 | 129 | </if> |
| 110 | 130 | </where> |
| 131 | + order by equipment_exception.create_time | |
| 111 | 132 | </select> |
| 112 | 133 | <select id="selectEquipmentExceptionByDeviceIdStatus" |
| 113 | 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 | 140 | </select> |
| 116 | 141 | |
| 117 | 142 | <insert id="insertEquipmentException" parameterType="EquipmentException" useGeneratedKeys="true" keyProperty="id"> |
| ... | ... | @@ -129,7 +154,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 129 | 154 | <if test="nbbm != null and nbbm != ''">nbbm,</if> |
| 130 | 155 | <if test="lineName != null and lineName != ''">line_name,</if> |
| 131 | 156 | <if test="planTime != null">plan_time,</if> |
| 132 | - </trim> | |
| 157 | + <if test="signType != null">sign_type,</if> | |
| 158 | + </trim> | |
| 133 | 159 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 134 | 160 | <if test="title != null">#{title},</if> |
| 135 | 161 | <if test="deviceId != null">#{deviceId},</if> |
| ... | ... | @@ -143,7 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 143 | 169 | <if test="nbbm != null and nbbm != ''">#{nbbm},</if> |
| 144 | 170 | <if test="lineName != null and lineName != ''">#{lineName},</if> |
| 145 | 171 | <if test="planTime != null ">#{planTime},</if> |
| 146 | - </trim> | |
| 172 | + <if test="signType != null ">#{signType},</if> | |
| 173 | + </trim> | |
| 147 | 174 | </insert> |
| 148 | 175 | |
| 149 | 176 | <update id="updateEquipmentException" parameterType="EquipmentException"> |
| ... | ... | @@ -161,11 +188,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 161 | 188 | </update> |
| 162 | 189 | |
| 163 | 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 | 194 | </delete> |
| 166 | 195 | |
| 167 | 196 | <delete id="deleteEquipmentExceptionByIds" parameterType="String"> |
| 168 | - delete from equipment_exception where id in | |
| 197 | + delete from equipment_exception where id in | |
| 169 | 198 | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| 170 | 199 | #{id} |
| 171 | 200 | </foreach> | ... | ... |