Commit d4bd94ed6629560174214d303fc7896383831351
1 parent
479764a3
fix: 修复bug
Showing
38 changed files
with
647 additions
and
703 deletions
ruoyi-admin/src/main/java/com/ruoyi/common/ConstSignInConstSignInProperties.java
| @@ -13,6 +13,8 @@ public interface ConstSignInConstSignInProperties { | @@ -13,6 +13,8 @@ public interface ConstSignInConstSignInProperties { | ||
| 13 | String SIGN_NO_SCHEDULING_EX_NUM_STRING = "无排班异常"; | 13 | String SIGN_NO_SCHEDULING_EX_NUM_STRING = "无排班异常"; |
| 14 | Integer SIGN_ALCOHOL_EX_NUM = 3; | 14 | Integer SIGN_ALCOHOL_EX_NUM = 3; |
| 15 | String SIGN_ALCOHOL_EX_NUM_STRING = "酒精超标异常"; | 15 | String SIGN_ALCOHOL_EX_NUM_STRING = "酒精超标异常"; |
| 16 | + Integer EQUIPMENT_ALCOHOL_EX_NUM = 4; | ||
| 17 | + String EQUIPMENT_ALCOHOL_EX_NUM_STRING = "设备异常"; | ||
| 16 | 18 | ||
| 17 | String HAVE_EX = "有异常"; | 19 | String HAVE_EX = "有异常"; |
| 18 | String NO_EX = "无异常"; | 20 | String NO_EX = "无异常"; |
| @@ -58,7 +60,7 @@ public interface ConstSignInConstSignInProperties { | @@ -58,7 +60,7 @@ public interface ConstSignInConstSignInProperties { | ||
| 58 | */ | 60 | */ |
| 59 | Integer ALCOHOL_FLAG_YES = 1; | 61 | Integer ALCOHOL_FLAG_YES = 1; |
| 60 | String ALCOHOL_FLAG_YES_STRING = "已测试"; | 62 | String ALCOHOL_FLAG_YES_STRING = "已测试"; |
| 61 | - Integer ALCOHOL_FLAG_NO = 2; | 63 | + Integer ALCOHOL_FLAG_NO = 0; |
| 62 | String ALCOHOL_FLAG_NO_STRING = "未测试"; | 64 | String ALCOHOL_FLAG_NO_STRING = "未测试"; |
| 63 | 65 | ||
| 64 | /** | 66 | /** |
ruoyi-admin/src/main/java/com/ruoyi/common/ErrorTypeProperties.java
| @@ -8,7 +8,7 @@ public interface ErrorTypeProperties { | @@ -8,7 +8,7 @@ public interface ErrorTypeProperties { | ||
| 8 | String EQUIPMENT_ERROR = "设备异常"; | 8 | String EQUIPMENT_ERROR = "设备异常"; |
| 9 | String ALCOHOL_SIGN_IN_ERROR = "酒精测试超标,"; | 9 | String ALCOHOL_SIGN_IN_ERROR = "酒精测试超标,"; |
| 10 | String WORK_DAY_ERROR = "当天没有排班,"; | 10 | String WORK_DAY_ERROR = "当天没有排班,"; |
| 11 | - String SIGN_IN_TIMEOUT = "签到异常,"; | ||
| 12 | - String SIGN_OUT_TIMEOUT = "签退异常,"; | 11 | + String SIGN_IN_TIMEOUT = "没有在规定时间内签到,"; |
| 12 | + String SIGN_OUT_TIMEOUT = "没有在规定时间内签退,"; | ||
| 13 | 13 | ||
| 14 | } | 14 | } |
ruoyi-admin/src/main/java/com/ruoyi/common/cache/NowSchedulingCache.java
0 → 100644
| 1 | +package com.ruoyi.common.cache; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollectionUtil; | ||
| 4 | +import com.ruoyi.driver.mapper.DriverSchedulingMapper; | ||
| 5 | +import com.ruoyi.pojo.entity.DriverScheduling; | ||
| 6 | +import com.ruoyi.utils.ConstDateUtil; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | +import org.springframework.stereotype.Component; | ||
| 10 | + | ||
| 11 | +import java.util.*; | ||
| 12 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 13 | + | ||
| 14 | +@Component | ||
| 15 | +public class NowSchedulingCache { | ||
| 16 | + private final DriverSchedulingMapper schedulingMapper; | ||
| 17 | + Logger log = LoggerFactory.getLogger(SchedulingCache.class); | ||
| 18 | + /** | ||
| 19 | + * 当天初版排班 | ||
| 20 | + */ | ||
| 21 | + private static ConcurrentHashMap<String, Map<String, List<DriverScheduling>>> cacheNowDayScheduling = new ConcurrentHashMap<>(); | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + public NowSchedulingCache(DriverSchedulingMapper driverSchedulingMapper) { | ||
| 25 | + this.schedulingMapper = driverSchedulingMapper; | ||
| 26 | + log.info("项目启动加载中获取排班表-----"); | ||
| 27 | + cacheNowDaySchedulingInit(); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + private void cacheNowDaySchedulingInit() { | ||
| 31 | + // 查询今天和昨天 | ||
| 32 | + for (int i = 0; i > -2; i--) { | ||
| 33 | + Map<String, List<DriverScheduling>> resultMap =new HashMap<>(800); | ||
| 34 | + String date = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i)); | ||
| 35 | + List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, null, null, null); | ||
| 36 | + handleResultMap(resultMap,schedulingList); | ||
| 37 | + cacheNowDayScheduling.put(date,resultMap); | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + private void handleResultMap(Map<String, List<DriverScheduling>> resultMap, List<DriverScheduling> schedulingList) { | ||
| 42 | + for (DriverScheduling scheduling : schedulingList) { | ||
| 43 | + List<DriverScheduling> list = resultMap.get(scheduling.getJobCode()); | ||
| 44 | + if (CollectionUtil.isEmpty(list)){ | ||
| 45 | + resultMap.put(scheduling.getJobCode(),new ArrayList<>(Arrays.asList(scheduling))); | ||
| 46 | + }else { | ||
| 47 | + list.add(scheduling); | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public void setCacheScheduling(String key, Map<String, List<DriverScheduling>> mapValue) { | ||
| 53 | + cacheNowDayScheduling.put(key, mapValue); | ||
| 54 | + } | ||
| 55 | + public Map<String,List<DriverScheduling>> getCacheScheduling(String key) { | ||
| 56 | + return cacheNowDayScheduling.get(key); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public void removeCacheSchedulingByKey(String key) { | ||
| 60 | + cacheNowDayScheduling.remove(key); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public List<String> getKeys(){ | ||
| 64 | + return new ArrayList<>(cacheNowDayScheduling.keySet()); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public Integer size(){ | ||
| 68 | + return cacheNowDayScheduling.size(); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public List<DriverScheduling> getCacheSchedulingMapValueByHKey(String key, String HKey) { | ||
| 72 | + if (Objects.isNull(cacheNowDayScheduling.get(key))) { | ||
| 73 | + return null; | ||
| 74 | + } | ||
| 75 | + List<DriverScheduling> list = cacheNowDayScheduling.get(key).get(HKey); | ||
| 76 | + | ||
| 77 | + return Objects.isNull(list) ? null : list; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public List<String> getHKeysByKey(String key) { | ||
| 81 | + return new ArrayList<>(cacheNowDayScheduling.get(key).keySet()); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public List<String> getKes() { | ||
| 85 | + return new ArrayList<>(cacheNowDayScheduling.keySet()); | ||
| 86 | + } | ||
| 87 | +} |
ruoyi-admin/src/main/java/com/ruoyi/common/cache/SchedulingCache.java
| 1 | package com.ruoyi.common.cache; | 1 | package com.ruoyi.common.cache; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollectionUtil; | ||
| 4 | +import com.ruoyi.pojo.entity.DriverScheduling; | ||
| 3 | import com.ruoyi.pojo.response.ResponseSchedulingDto; | 5 | import com.ruoyi.pojo.response.ResponseSchedulingDto; |
| 6 | +import com.ruoyi.service.SchedulingService; | ||
| 4 | import com.ruoyi.utils.ConstDateUtil; | 7 | import com.ruoyi.utils.ConstDateUtil; |
| 5 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| 6 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| @@ -9,7 +12,6 @@ import org.springframework.http.HttpMethod; | @@ -9,7 +12,6 @@ import org.springframework.http.HttpMethod; | ||
| 9 | import org.springframework.stereotype.Component; | 12 | import org.springframework.stereotype.Component; |
| 10 | import org.springframework.web.client.RestTemplate; | 13 | import org.springframework.web.client.RestTemplate; |
| 11 | 14 | ||
| 12 | -import javax.annotation.Resource; | ||
| 13 | import java.security.MessageDigest; | 15 | import java.security.MessageDigest; |
| 14 | import java.util.*; | 16 | import java.util.*; |
| 15 | import java.util.concurrent.ConcurrentHashMap; | 17 | import java.util.concurrent.ConcurrentHashMap; |
| @@ -27,21 +29,28 @@ public class SchedulingCache { | @@ -27,21 +29,28 @@ public class SchedulingCache { | ||
| 27 | 29 | ||
| 28 | Logger log = LoggerFactory.getLogger(SchedulingCache.class); | 30 | Logger log = LoggerFactory.getLogger(SchedulingCache.class); |
| 29 | 31 | ||
| 32 | + | ||
| 33 | + | ||
| 30 | // @Value("${api.url.getSchedulingInfoNew}") | 34 | // @Value("${api.url.getSchedulingInfoNew}") |
| 31 | private static final String getSchedulingInfoUrl = "http://101.95.136.206:9089/webservice/rest/schedule_real/sch_jk_db/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s"; | 35 | private static final String getSchedulingInfoUrl = "http://101.95.136.206:9089/webservice/rest/schedule_real/sch_jk_db/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s"; |
| 32 | // @Value("${api.config.nonce}") | 36 | // @Value("${api.config.nonce}") |
| 33 | private static final String NONCE = "adfsad"; | 37 | private static final String NONCE = "adfsad"; |
| 34 | // @Value("${api.config.password}") | 38 | // @Value("${api.config.password}") |
| 35 | private static final String PASSWORD = "c4dd3d8cb9a82f6d6a625818618b28ca7bebb464"; | 39 | private static final String PASSWORD = "c4dd3d8cb9a82f6d6a625818618b28ca7bebb464"; |
| 36 | - @Resource | ||
| 37 | - private SchedulingCache schedulingCache; | 40 | + |
| 41 | + /** | ||
| 42 | + * 实时更新排班 | ||
| 43 | + */ | ||
| 38 | private static ConcurrentHashMap<String, Map<String, List<ResponseSchedulingDto>>> cacheScheduling = new ConcurrentHashMap<>(); | 44 | private static ConcurrentHashMap<String, Map<String, List<ResponseSchedulingDto>>> cacheScheduling = new ConcurrentHashMap<>(); |
| 39 | 45 | ||
| 46 | + | ||
| 40 | public SchedulingCache() { | 47 | public SchedulingCache() { |
| 41 | log.info("项目启动加载中-----"); | 48 | log.info("项目启动加载中-----"); |
| 42 | // schedulingInit(); | 49 | // schedulingInit(); |
| 43 | } | 50 | } |
| 44 | 51 | ||
| 52 | + | ||
| 53 | + | ||
| 45 | private void schedulingInit() { | 54 | private void schedulingInit() { |
| 46 | String formatNowDate = ConstDateUtil.formatDate(new Date()); | 55 | String formatNowDate = ConstDateUtil.formatDate(new Date()); |
| 47 | String url = getUrl(formatNowDate); | 56 | String url = getUrl(formatNowDate); |
ruoyi-admin/src/main/java/com/ruoyi/controller/ReportController.java
| @@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult; | @@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult; | ||
| 4 | import com.ruoyi.common.utils.poi.ExcelUtil; | 4 | import com.ruoyi.common.utils.poi.ExcelUtil; |
| 5 | import com.ruoyi.pojo.request.ReportViewRequestVo; | 5 | import com.ruoyi.pojo.request.ReportViewRequestVo; |
| 6 | import com.ruoyi.pojo.request.ReportErrorRequestVo; | 6 | import com.ruoyi.pojo.request.ReportErrorRequestVo; |
| 7 | +import com.ruoyi.pojo.response.ExportReportViewResponseVo; | ||
| 7 | import com.ruoyi.pojo.response.ReportErrorResponseVo; | 8 | import com.ruoyi.pojo.response.ReportErrorResponseVo; |
| 8 | import com.ruoyi.pojo.response.ReportViewResponseVo; | 9 | import com.ruoyi.pojo.response.ReportViewResponseVo; |
| 9 | import com.ruoyi.service.ReportService; | 10 | import com.ruoyi.service.ReportService; |
| @@ -37,6 +38,12 @@ public class ReportController { | @@ -37,6 +38,12 @@ public class ReportController { | ||
| 37 | return AjaxResult.success(reportService.getReportScrollViewTable(requestVo,response)); | 38 | return AjaxResult.success(reportService.getReportScrollViewTable(requestVo,response)); |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 41 | + @ApiOperation("签到报表集合查询") | ||
| 42 | + @GetMapping("/bigView") | ||
| 43 | + public AjaxResult getBigView(HttpServletResponse response, @ApiParam @ModelAttribute ReportViewRequestVo requestVo) { | ||
| 44 | + return AjaxResult.success(reportService.getBigView(requestVo,response)); | ||
| 45 | + } | ||
| 46 | + | ||
| 40 | @ApiOperation("获取详情") | 47 | @ApiOperation("获取详情") |
| 41 | @GetMapping("/detail") | 48 | @GetMapping("/detail") |
| 42 | public AjaxResult getDetail(HttpServletResponse response, @ApiParam @ModelAttribute @Validated ReportViewRequestVo requestVo) { | 49 | public AjaxResult getDetail(HttpServletResponse response, @ApiParam @ModelAttribute @Validated ReportViewRequestVo requestVo) { |
| @@ -53,12 +60,9 @@ public class ReportController { | @@ -53,12 +60,9 @@ public class ReportController { | ||
| 53 | @ApiOperation("签到报表导出") | 60 | @ApiOperation("签到报表导出") |
| 54 | @PostMapping("/export") | 61 | @PostMapping("/export") |
| 55 | public void exportReport(@ApiParam ReportViewRequestVo requestVo, HttpServletResponse response) { | 62 | public void exportReport(@ApiParam ReportViewRequestVo requestVo, HttpServletResponse response) { |
| 56 | - List<ReportViewResponseVo> list = reportService.exportReportList(requestVo, response); | 63 | + List<ExportReportViewResponseVo> list = reportService.exportReportList(requestVo, response); |
| 57 | // 不导出图片清空路径信息 | 64 | // 不导出图片清空路径信息 |
| 58 | - if (!EXPORT.equals(requestVo.getExportFlag())){ | ||
| 59 | -// list = list.stream().map(item->{item.setImage("");return item;}).collect(Collectors.toList()); | ||
| 60 | - } | ||
| 61 | - ExcelUtil<ReportViewResponseVo> util = new ExcelUtil<ReportViewResponseVo>(ReportViewResponseVo.class); | 65 | + ExcelUtil<ExportReportViewResponseVo> util = new ExcelUtil<ExportReportViewResponseVo>(ExportReportViewResponseVo.class); |
| 62 | util.exportEasyExcel(response, list, "签到报表"); | 66 | util.exportEasyExcel(response, list, "签到报表"); |
| 63 | } | 67 | } |
| 64 | 68 |
ruoyi-admin/src/main/java/com/ruoyi/driver/mapper/DriverSchedulingMapper.java
| @@ -6,6 +6,8 @@ import com.ruoyi.pojo.response.ReportViewResponseVo; | @@ -6,6 +6,8 @@ import com.ruoyi.pojo.response.ReportViewResponseVo; | ||
| 6 | import com.ruoyi.pojo.response.ResponseSchedulingDto; | 6 | import com.ruoyi.pojo.response.ResponseSchedulingDto; |
| 7 | import org.apache.ibatis.annotations.Param; | 7 | import org.apache.ibatis.annotations.Param; |
| 8 | 8 | ||
| 9 | +import java.math.BigDecimal; | ||
| 10 | +import java.util.Date; | ||
| 9 | import java.util.List; | 11 | import java.util.List; |
| 10 | 12 | ||
| 11 | /** | 13 | /** |
| @@ -19,6 +21,6 @@ public interface DriverSchedulingMapper { | @@ -19,6 +21,6 @@ public interface DriverSchedulingMapper { | ||
| 19 | 21 | ||
| 20 | List<DriverScheduling> queryToDay(@Param("date") String date, @Param("name") String name,@Param("jobCode") String jobCode,@Param("lineName")String lineName ); | 22 | List<DriverScheduling> queryToDay(@Param("date") String date, @Param("name") String name,@Param("jobCode") String jobCode,@Param("lineName")String lineName ); |
| 21 | 23 | ||
| 22 | - void updateRoster(@Param("scheduling") DriverScheduling scheduling, @Param("signInId") Long id, @Param("exType") Integer exType); | 24 | + void updateRoster(@Param("scheduling") DriverScheduling scheduling, @Param("signInId") Long id, @Param("exType") Integer exType, @Param("signTime")Date signTime, @Param("remark") String remark, @Param("signType") Integer signType, @Param("alcoholFlag") Integer alcoholFlag, @Param("alcoholIntake")BigDecimal alcoholIntake); |
| 23 | 25 | ||
| 24 | } | 26 | } |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| @@ -21,7 +21,6 @@ import com.ruoyi.common.global.ResultCode; | @@ -21,7 +21,6 @@ import com.ruoyi.common.global.ResultCode; | ||
| 21 | import com.ruoyi.common.utils.file.FileUploadUtils; | 21 | import com.ruoyi.common.utils.file.FileUploadUtils; |
| 22 | import com.ruoyi.common.utils.file.FileUtils; | 22 | import com.ruoyi.common.utils.file.FileUtils; |
| 23 | import com.ruoyi.common.utils.file.MimeTypeUtils; | 23 | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| 24 | -import com.ruoyi.driver.mapper.DriverSchedulingMapper; | ||
| 25 | import com.ruoyi.equipment.mapper.EquipmentMapper; | 24 | import com.ruoyi.equipment.mapper.EquipmentMapper; |
| 26 | import com.ruoyi.framework.config.ServerConfig; | 25 | import com.ruoyi.framework.config.ServerConfig; |
| 27 | import com.ruoyi.job.DriverJob; | 26 | import com.ruoyi.job.DriverJob; |
| @@ -155,7 +154,7 @@ public class DriverServiceImpl implements IDriverService { | @@ -155,7 +154,7 @@ public class DriverServiceImpl implements IDriverService { | ||
| 155 | // 如果当前有效范围内签到记录无效如酒精测试异常则重复当前操作 | 154 | // 如果当前有效范围内签到记录无效如酒精测试异常则重复当前操作 |
| 156 | if ((Math.abs(nowBetween) <= 60) && timeMap.get(index).getExType().equals(SIGN_ALCOHOL_EX_NUM) && timeMap.get(index).getBcType().equals(BC_TYPE_OUT)) { | 155 | if ((Math.abs(nowBetween) <= 60) && timeMap.get(index).getExType().equals(SIGN_ALCOHOL_EX_NUM) && timeMap.get(index).getBcType().equals(BC_TYPE_OUT)) { |
| 157 | return timeMap.get(index); | 156 | return timeMap.get(index); |
| 158 | - }else { | 157 | + } else { |
| 159 | index = index < timeMap.size() - 1 ? index + 1 : index; | 158 | index = index < timeMap.size() - 1 ? index + 1 : index; |
| 160 | } | 159 | } |
| 161 | } | 160 | } |
| @@ -311,31 +310,17 @@ public class DriverServiceImpl implements IDriverService { | @@ -311,31 +310,17 @@ public class DriverServiceImpl implements IDriverService { | ||
| 311 | List<Driver> drivers = driverMapper.getDrivers(driver); | 310 | List<Driver> drivers = driverMapper.getDrivers(driver); |
| 312 | Long now = System.currentTimeMillis(); | 311 | Long now = System.currentTimeMillis(); |
| 313 | List<DriverResponseVo> vos = new ArrayList<>(drivers.size()); | 312 | List<DriverResponseVo> vos = new ArrayList<>(drivers.size()); |
| 314 | -// List<ResponseSchedulingDto> schedulingList = schedulingCache.getCacheSchedulingMapValueByHKey(ConstDateUtil.formatDate(new Date()), driver.getJobCode()); | ||
| 315 | List<DriverScheduling> dto = null; | 313 | List<DriverScheduling> dto = null; |
| 316 | Boolean schedulingFlag = true; | 314 | Boolean schedulingFlag = true; |
| 317 | Boolean alcoholFlag = true; | 315 | Boolean alcoholFlag = true; |
| 318 | - dto = schedulingService.queryScheduling(driver.getJobCode(), now); | ||
| 319 | 316 | ||
| 320 | - DriverResponseVo vo = null; | ||
| 321 | - // 给出计划操作 | ||
| 322 | - if (!CollectionUtil.isEmpty(dto)) { | ||
| 323 | - DriverSignRecommendation item = checkTime(dto, now); | ||
| 324 | - if (BC_TYPE_OUT.equals(item.getBcType()) && !CollectionUtil.isEmpty(drivers)) { | ||
| 325 | - // 售票员无需酒精测试 | ||
| 326 | - if (item.getPosts().equals(PERSONNEL_POSTS_DRIVER)) | ||
| 327 | - vo = new DriverResponseVo(item.getTimestamps(), drivers.get(0), SIGN_IN_STRING, alcoholFlag, schedulingFlag,item.getNbbm(),item.getLpName(),item.getLineName()); | ||
| 328 | - else | ||
| 329 | - vo = new DriverResponseVo(item.getTimestamps(), drivers.get(0), SIGN_IN_STRING, !alcoholFlag, schedulingFlag,item.getNbbm(),item.getLpName(),item.getLineName()); | ||
| 330 | - } else if (BC_TYPE_IN.equals(item.getBcType()) && !CollectionUtil.isEmpty(drivers)) { | ||
| 331 | - vo = new DriverResponseVo(item.getTimestamps(), drivers.get(0), SIGN_IN_OUT_STRING, !alcoholFlag, !schedulingFlag,item.getNbbm(),item.getLpName(),item.getLineName()); | ||
| 332 | - } | ||
| 333 | - } | ||
| 334 | // 更新信息 | 317 | // 更新信息 |
| 335 | for (Driver item : drivers) { | 318 | for (Driver item : drivers) { |
| 319 | + dto = schedulingService.queryScheduling(item.getJobCode(), now); | ||
| 320 | + DriverResponseVo vo = handleRecommendation(item, now, dto, schedulingFlag, alcoholFlag); | ||
| 336 | // 无排班 | 321 | // 无排班 |
| 337 | if (Objects.isNull(vo)) { | 322 | if (Objects.isNull(vo)) { |
| 338 | - vos.add(new DriverResponseVo(null, item, null, false, false,"","","")); | 323 | + vos.add(new DriverResponseVo(null, item, null, false, false, "", "", "")); |
| 339 | } else { | 324 | } else { |
| 340 | vos.add(vo); | 325 | vos.add(vo); |
| 341 | } | 326 | } |
| @@ -343,6 +328,24 @@ public class DriverServiceImpl implements IDriverService { | @@ -343,6 +328,24 @@ public class DriverServiceImpl implements IDriverService { | ||
| 343 | return vos; | 328 | return vos; |
| 344 | } | 329 | } |
| 345 | 330 | ||
| 331 | + private DriverResponseVo handleRecommendation(Driver drivers, Long now, List<DriverScheduling> dto, Boolean schedulingFlag, Boolean alcoholFlag) { | ||
| 332 | + DriverResponseVo vo = null; | ||
| 333 | + // 给出计划操作 | ||
| 334 | + if (!CollectionUtil.isEmpty(dto)) { | ||
| 335 | + DriverSignRecommendation recommendation = checkTime(dto, now); | ||
| 336 | + if (BC_TYPE_OUT.equals(recommendation.getBcType())) { | ||
| 337 | + // 售票员无需酒精测试 | ||
| 338 | + if (recommendation.getPosts().equals(PERSONNEL_POSTS_DRIVER)) | ||
| 339 | + vo = new DriverResponseVo(recommendation.getTimestamps(), drivers, SIGN_IN_STRING, alcoholFlag, schedulingFlag, recommendation.getNbbm(), recommendation.getLpName(), recommendation.getLineName()); | ||
| 340 | + else | ||
| 341 | + vo = new DriverResponseVo(recommendation.getTimestamps(), drivers, SIGN_IN_STRING, !alcoholFlag, schedulingFlag, recommendation.getNbbm(), recommendation.getLpName(), recommendation.getLineName()); | ||
| 342 | + } else if (BC_TYPE_IN.equals(recommendation.getBcType())) { | ||
| 343 | + vo = new DriverResponseVo(recommendation.getTimestamps(), drivers, SIGN_IN_OUT_STRING, !alcoholFlag, !schedulingFlag, recommendation.getNbbm(), recommendation.getLpName(), recommendation.getLineName()); | ||
| 344 | + } | ||
| 345 | + } | ||
| 346 | + return vo; | ||
| 347 | + } | ||
| 348 | + | ||
| 346 | 349 | ||
| 347 | @Override | 350 | @Override |
| 348 | public AjaxResult faceRegistrationFeedback(String deviceId, List<String> jobCodes) { | 351 | public AjaxResult faceRegistrationFeedback(String deviceId, List<String> jobCodes) { |
ruoyi-admin/src/main/java/com/ruoyi/eexception/controller/EquipmentExceptionController.java
| @@ -3,6 +3,7 @@ package com.ruoyi.eexception.controller; | @@ -3,6 +3,7 @@ package com.ruoyi.eexception.controller; | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | import javax.servlet.http.HttpServletResponse; | 4 | import javax.servlet.http.HttpServletResponse; |
| 5 | 5 | ||
| 6 | +import com.ruoyi.pojo.response.EquipmentExceptionResponseVo; | ||
| 6 | import io.swagger.annotations.Api; | 7 | import io.swagger.annotations.Api; |
| 7 | import io.swagger.annotations.ApiOperation; | 8 | import io.swagger.annotations.ApiOperation; |
| 8 | import org.springframework.security.access.prepost.PreAuthorize; | 9 | import org.springframework.security.access.prepost.PreAuthorize; |
| @@ -33,7 +34,6 @@ import com.ruoyi.common.core.page.TableDataInfo; | @@ -33,7 +34,6 @@ import com.ruoyi.common.core.page.TableDataInfo; | ||
| 33 | @RestController | 34 | @RestController |
| 34 | @RequestMapping("/eexception/eexception") | 35 | @RequestMapping("/eexception/eexception") |
| 35 | @Api(tags = "设备异常接口") | 36 | @Api(tags = "设备异常接口") |
| 36 | -@Deprecated | ||
| 37 | public class EquipmentExceptionController extends BaseController | 37 | public class EquipmentExceptionController extends BaseController |
| 38 | { | 38 | { |
| 39 | @Autowired | 39 | @Autowired |
| @@ -48,7 +48,7 @@ public class EquipmentExceptionController extends BaseController | @@ -48,7 +48,7 @@ public class EquipmentExceptionController extends BaseController | ||
| 48 | public TableDataInfo list(EquipmentException equipmentException) | 48 | public TableDataInfo list(EquipmentException equipmentException) |
| 49 | { | 49 | { |
| 50 | startPage(); | 50 | startPage(); |
| 51 | - List<EquipmentException> list = equipmentExceptionService.selectEquipmentExceptionList(equipmentException); | 51 | + List<EquipmentExceptionResponseVo> list = equipmentExceptionService.selectEquipmentExceptionList(equipmentException); |
| 52 | return getDataTable(list); | 52 | return getDataTable(list); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| @@ -61,8 +61,8 @@ public class EquipmentExceptionController extends BaseController | @@ -61,8 +61,8 @@ public class EquipmentExceptionController extends BaseController | ||
| 61 | @ApiOperation("导出设备异常记录列表") | 61 | @ApiOperation("导出设备异常记录列表") |
| 62 | public void export(HttpServletResponse response, EquipmentException equipmentException) | 62 | public void export(HttpServletResponse response, EquipmentException equipmentException) |
| 63 | { | 63 | { |
| 64 | - List<EquipmentException> list = equipmentExceptionService.selectEquipmentExceptionList(equipmentException); | ||
| 65 | - ExcelUtil<EquipmentException> util = new ExcelUtil<EquipmentException>(EquipmentException.class); | 64 | + List<EquipmentExceptionResponseVo> list = equipmentExceptionService.selectEquipmentExceptionList(equipmentException); |
| 65 | + ExcelUtil<EquipmentExceptionResponseVo> util = new ExcelUtil<EquipmentExceptionResponseVo>(EquipmentExceptionResponseVo.class); | ||
| 66 | util.exportExcel(response, list, "设备异常记录数据"); | 66 | util.exportExcel(response, list, "设备异常记录数据"); |
| 67 | } | 67 | } |
| 68 | 68 |
ruoyi-admin/src/main/java/com/ruoyi/eexception/domain/EquipmentException.java
| @@ -47,5 +47,7 @@ public class EquipmentException extends BaseEntity | @@ -47,5 +47,7 @@ public class EquipmentException extends BaseEntity | ||
| 47 | @ApiModelProperty("处理状态") | 47 | @ApiModelProperty("处理状态") |
| 48 | private Integer status; | 48 | private Integer status; |
| 49 | 49 | ||
| 50 | + @ApiModelProperty("异常类型") | ||
| 51 | + private Integer exType; | ||
| 50 | 52 | ||
| 51 | } | 53 | } |
ruoyi-admin/src/main/java/com/ruoyi/eexception/mapper/EquipmentExceptionMapper.java
| @@ -3,6 +3,7 @@ package com.ruoyi.eexception.mapper; | @@ -3,6 +3,7 @@ package com.ruoyi.eexception.mapper; | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | import com.ruoyi.eexception.domain.EquipmentException; | 4 | import com.ruoyi.eexception.domain.EquipmentException; |
| 5 | import com.ruoyi.pojo.request.ReportErrorRequestVo; | 5 | import com.ruoyi.pojo.request.ReportErrorRequestVo; |
| 6 | +import com.ruoyi.pojo.response.EquipmentExceptionResponseVo; | ||
| 6 | 7 | ||
| 7 | /** | 8 | /** |
| 8 | * 设备异常记录Mapper接口 | 9 | * 设备异常记录Mapper接口 |
| @@ -26,7 +27,15 @@ public interface EquipmentExceptionMapper | @@ -26,7 +27,15 @@ public interface EquipmentExceptionMapper | ||
| 26 | * @param equipmentException 设备异常记录 | 27 | * @param equipmentException 设备异常记录 |
| 27 | * @return 设备异常记录集合 | 28 | * @return 设备异常记录集合 |
| 28 | */ | 29 | */ |
| 29 | - public List<EquipmentException> selectEquipmentExceptionList(EquipmentException equipmentException); | 30 | + public List<EquipmentExceptionResponseVo> selectEquipmentExceptionList(EquipmentException equipmentException); |
| 31 | + /** | ||
| 32 | + * 查询设备异常记录列表 | ||
| 33 | + * | ||
| 34 | + * @param requestVo 设备异常记录 | ||
| 35 | + * @return 设备异常记录集合 | ||
| 36 | + */ | ||
| 37 | + public List<EquipmentExceptionResponseVo> selectEquipmentExceptionListByVo(ReportErrorRequestVo requestVo); | ||
| 38 | + | ||
| 30 | 39 | ||
| 31 | /** | 40 | /** |
| 32 | * 新增设备异常记录 | 41 | * 新增设备异常记录 |
| @@ -61,4 +70,6 @@ public interface EquipmentExceptionMapper | @@ -61,4 +70,6 @@ public interface EquipmentExceptionMapper | ||
| 61 | public int deleteEquipmentExceptionByIds(Long[] ids); | 70 | public int deleteEquipmentExceptionByIds(Long[] ids); |
| 62 | 71 | ||
| 63 | List<EquipmentException> getEquipmentErrorList(ReportErrorRequestVo request); | 72 | List<EquipmentException> getEquipmentErrorList(ReportErrorRequestVo request); |
| 73 | + | ||
| 74 | + EquipmentException selectEquipmentExceptionByDeviceIdStatus(EquipmentException equipmentException); | ||
| 64 | } | 75 | } |
ruoyi-admin/src/main/java/com/ruoyi/eexception/service/IEquipmentExceptionService.java
| @@ -2,6 +2,7 @@ package com.ruoyi.eexception.service; | @@ -2,6 +2,7 @@ package com.ruoyi.eexception.service; | ||
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | import com.ruoyi.eexception.domain.EquipmentException; | 4 | import com.ruoyi.eexception.domain.EquipmentException; |
| 5 | +import com.ruoyi.pojo.response.EquipmentExceptionResponseVo; | ||
| 5 | 6 | ||
| 6 | /** | 7 | /** |
| 7 | * 设备异常记录Service接口 | 8 | * 设备异常记录Service接口 |
| @@ -25,7 +26,7 @@ public interface IEquipmentExceptionService | @@ -25,7 +26,7 @@ public interface IEquipmentExceptionService | ||
| 25 | * @param equipmentException 设备异常记录 | 26 | * @param equipmentException 设备异常记录 |
| 26 | * @return 设备异常记录集合 | 27 | * @return 设备异常记录集合 |
| 27 | */ | 28 | */ |
| 28 | - public List<EquipmentException> selectEquipmentExceptionList(EquipmentException equipmentException); | 29 | + public List<EquipmentExceptionResponseVo> selectEquipmentExceptionList(EquipmentException equipmentException); |
| 29 | 30 | ||
| 30 | /** | 31 | /** |
| 31 | * 新增设备异常记录 | 32 | * 新增设备异常记录 |
ruoyi-admin/src/main/java/com/ruoyi/eexception/service/impl/EquipmentExceptionServiceImpl.java
| 1 | package com.ruoyi.eexception.service.impl; | 1 | package com.ruoyi.eexception.service.impl; |
| 2 | 2 | ||
| 3 | +import java.util.Date; | ||
| 3 | import java.util.List; | 4 | import java.util.List; |
| 4 | import java.util.Objects; | 5 | import java.util.Objects; |
| 5 | 6 | ||
| @@ -8,14 +9,15 @@ import com.ruoyi.common.utils.SecurityUtils; | @@ -8,14 +9,15 @@ import com.ruoyi.common.utils.SecurityUtils; | ||
| 8 | import com.ruoyi.common.utils.StringUtils; | 9 | import com.ruoyi.common.utils.StringUtils; |
| 9 | import com.ruoyi.equipment.domain.Equipment; | 10 | import com.ruoyi.equipment.domain.Equipment; |
| 10 | import com.ruoyi.equipment.mapper.EquipmentMapper; | 11 | import com.ruoyi.equipment.mapper.EquipmentMapper; |
| 12 | +import com.ruoyi.pojo.response.EquipmentExceptionResponseVo; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 14 | import org.springframework.stereotype.Service; |
| 13 | import com.ruoyi.eexception.mapper.EquipmentExceptionMapper; | 15 | import com.ruoyi.eexception.mapper.EquipmentExceptionMapper; |
| 14 | import com.ruoyi.eexception.domain.EquipmentException; | 16 | import com.ruoyi.eexception.domain.EquipmentException; |
| 15 | import com.ruoyi.eexception.service.IEquipmentExceptionService; | 17 | import com.ruoyi.eexception.service.IEquipmentExceptionService; |
| 16 | 18 | ||
| 17 | -import static com.ruoyi.common.ConstEquipmentProperties.EQUIPMENT_PROCESS_FLOW_COMMIT; | ||
| 18 | -import static com.ruoyi.common.ConstEquipmentProperties.EQUIPMENT_STATUS_ILLNESS; | 19 | +import static com.ruoyi.common.ConstEquipmentProperties.*; |
| 20 | +import static com.ruoyi.common.ConstSignInConstSignInProperties.EQUIPMENT_ALCOHOL_EX_NUM; | ||
| 19 | 21 | ||
| 20 | /** | 22 | /** |
| 21 | * 设备异常记录Service业务层处理 | 23 | * 设备异常记录Service业务层处理 |
| @@ -51,7 +53,7 @@ public class EquipmentExceptionServiceImpl implements IEquipmentExceptionService | @@ -51,7 +53,7 @@ public class EquipmentExceptionServiceImpl implements IEquipmentExceptionService | ||
| 51 | * @return 设备异常记录 | 53 | * @return 设备异常记录 |
| 52 | */ | 54 | */ |
| 53 | @Override | 55 | @Override |
| 54 | - public List<EquipmentException> selectEquipmentExceptionList(EquipmentException equipmentException) | 56 | + public List<EquipmentExceptionResponseVo> selectEquipmentExceptionList(EquipmentException equipmentException) |
| 55 | { | 57 | { |
| 56 | return equipmentExceptionMapper.selectEquipmentExceptionList(equipmentException); | 58 | return equipmentExceptionMapper.selectEquipmentExceptionList(equipmentException); |
| 57 | } | 59 | } |
| @@ -73,9 +75,16 @@ public class EquipmentExceptionServiceImpl implements IEquipmentExceptionService | @@ -73,9 +75,16 @@ public class EquipmentExceptionServiceImpl implements IEquipmentExceptionService | ||
| 73 | if (Objects.isNull(equipment)){ | 75 | if (Objects.isNull(equipment)){ |
| 74 | throw new RuntimeException("设备不存在"); | 76 | throw new RuntimeException("设备不存在"); |
| 75 | } | 77 | } |
| 78 | + EquipmentException exception = equipmentExceptionMapper.selectEquipmentExceptionByDeviceIdStatus(equipmentException); | ||
| 79 | + if (!Objects.isNull(exception)){ | ||
| 80 | + throw new RuntimeException("已经提交过报修,等待维修人员处理。"); | ||
| 81 | + } | ||
| 82 | + if (Objects.isNull(equipmentException.getExType())) | ||
| 83 | + equipmentException.setExType(EQUIPMENT_ALCOHOL_EX_NUM); | ||
| 76 | equipment.setStatus(EQUIPMENT_STATUS_ILLNESS); | 84 | equipment.setStatus(EQUIPMENT_STATUS_ILLNESS); |
| 77 | equipmentMapper.updateEquipment(equipment); | 85 | equipmentMapper.updateEquipment(equipment); |
| 78 | equipmentException.setStatus(EQUIPMENT_PROCESS_FLOW_COMMIT); | 86 | equipmentException.setStatus(EQUIPMENT_PROCESS_FLOW_COMMIT); |
| 87 | + equipmentException.setCreateTime(new Date()); | ||
| 79 | return equipmentExceptionMapper.insertEquipmentException(equipmentException); | 88 | return equipmentExceptionMapper.insertEquipmentException(equipmentException); |
| 80 | } | 89 | } |
| 81 | 90 | ||
| @@ -88,6 +97,12 @@ public class EquipmentExceptionServiceImpl implements IEquipmentExceptionService | @@ -88,6 +97,12 @@ public class EquipmentExceptionServiceImpl implements IEquipmentExceptionService | ||
| 88 | @Override | 97 | @Override |
| 89 | public int updateEquipmentException(EquipmentException equipmentException) | 98 | public int updateEquipmentException(EquipmentException equipmentException) |
| 90 | { | 99 | { |
| 100 | + EquipmentException equipmentException1 = equipmentExceptionMapper.selectEquipmentExceptionById(equipmentException.getId()); | ||
| 101 | + if (EQUIPMENT_ALCOHOL_EX_NUM.equals(equipmentException1.getExType()) && equipmentException.getStatus().equals(EQUIPMENT_PROCESS_FLOW_COMPLETE)){ | ||
| 102 | + Equipment equipment = equipmentMapper.selectEquipmentByDeviceId(equipmentException.getDeviceId()); | ||
| 103 | + equipment.setStatus(EQUIPMENT_STATUS_HEALTH); | ||
| 104 | + equipmentMapper.updateEquipment(equipment); | ||
| 105 | + } | ||
| 91 | return equipmentExceptionMapper.updateEquipmentException(equipmentException); | 106 | return equipmentExceptionMapper.updateEquipmentException(equipmentException); |
| 92 | } | 107 | } |
| 93 | 108 |
ruoyi-admin/src/main/java/com/ruoyi/equipment/mapper/EquipmentMapper.java
| @@ -4,7 +4,6 @@ import java.util.List; | @@ -4,7 +4,6 @@ import java.util.List; | ||
| 4 | 4 | ||
| 5 | import com.ruoyi.driver.domain.Driver; | 5 | import com.ruoyi.driver.domain.Driver; |
| 6 | import com.ruoyi.equipment.domain.Equipment; | 6 | import com.ruoyi.equipment.domain.Equipment; |
| 7 | -import com.ruoyi.global_exception.domain.GlobalException; | ||
| 8 | import com.ruoyi.pojo.domain.EquipmentDriverExpand; | 7 | import com.ruoyi.pojo.domain.EquipmentDriverExpand; |
| 9 | import org.apache.ibatis.annotations.Param; | 8 | import org.apache.ibatis.annotations.Param; |
| 10 | 9 |
ruoyi-admin/src/main/java/com/ruoyi/global_exception/controller/GlobalExceptionController.java deleted
100644 → 0
| 1 | -package com.ruoyi.global_exception.controller; | ||
| 2 | - | ||
| 3 | -import java.util.List; | ||
| 4 | -import javax.servlet.http.HttpServletResponse; | ||
| 5 | - | ||
| 6 | -import com.ruoyi.common.global.Result; | ||
| 7 | -import com.ruoyi.pojo.request.GlobalExceptionRequestVo; | ||
| 8 | -import io.swagger.annotations.Api; | ||
| 9 | -import io.swagger.annotations.ApiOperation; | ||
| 10 | -import io.swagger.annotations.ApiParam; | ||
| 11 | -import org.springframework.security.access.prepost.PreAuthorize; | ||
| 12 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 13 | -import org.springframework.validation.annotation.Validated; | ||
| 14 | -import org.springframework.web.bind.annotation.GetMapping; | ||
| 15 | -import org.springframework.web.bind.annotation.PostMapping; | ||
| 16 | -import org.springframework.web.bind.annotation.PutMapping; | ||
| 17 | -import org.springframework.web.bind.annotation.DeleteMapping; | ||
| 18 | -import org.springframework.web.bind.annotation.PathVariable; | ||
| 19 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 20 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 21 | -import org.springframework.web.bind.annotation.RestController; | ||
| 22 | -import com.ruoyi.common.annotation.Log; | ||
| 23 | -import com.ruoyi.common.core.controller.BaseController; | ||
| 24 | -import com.ruoyi.common.core.domain.AjaxResult; | ||
| 25 | -import com.ruoyi.common.enums.BusinessType; | ||
| 26 | -import com.ruoyi.global_exception.domain.GlobalException; | ||
| 27 | -import com.ruoyi.global_exception.service.IGlobalExceptionService; | ||
| 28 | -import com.ruoyi.common.utils.poi.ExcelUtil; | ||
| 29 | -import com.ruoyi.common.core.page.TableDataInfo; | ||
| 30 | - | ||
| 31 | -/** | ||
| 32 | - * global_exceptionController | ||
| 33 | - * | ||
| 34 | - * @author global_exception | ||
| 35 | - * @date 2023-08-14 | ||
| 36 | - */ | ||
| 37 | -@RestController | ||
| 38 | -@RequestMapping("/global_exception/global_exception") | ||
| 39 | -@Api(tags = "异常管理") | ||
| 40 | -public class GlobalExceptionController extends BaseController | ||
| 41 | -{ | ||
| 42 | - @Autowired | ||
| 43 | - private IGlobalExceptionService globalExceptionService; | ||
| 44 | - | ||
| 45 | - /** | ||
| 46 | - * 查询global_exception列表 | ||
| 47 | - */ | ||
| 48 | - @PreAuthorize("@ss.hasPermi('global_exception:global_exception:list')") | ||
| 49 | - @GetMapping("/list") | ||
| 50 | - public TableDataInfo list(GlobalException globalException) | ||
| 51 | - { | ||
| 52 | - startPage(); | ||
| 53 | - List<GlobalException> list = globalExceptionService.selectGlobalExceptionList(globalException); | ||
| 54 | - return getDataTable(list); | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - /** | ||
| 58 | - * 导出global_exception列表 | ||
| 59 | - */ | ||
| 60 | - @PreAuthorize("@ss.hasPermi('global_exception:global_exception:export')") | ||
| 61 | - @Log(title = "global_exception", businessType = BusinessType.EXPORT) | ||
| 62 | - @PostMapping("/export") | ||
| 63 | - public void export(HttpServletResponse response, GlobalException globalException) | ||
| 64 | - { | ||
| 65 | - List<GlobalException> list = globalExceptionService.selectGlobalExceptionList(globalException); | ||
| 66 | - ExcelUtil<GlobalException> util = new ExcelUtil<GlobalException>(GlobalException.class); | ||
| 67 | - util.exportExcel(response, list, "global_exception数据"); | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - /** | ||
| 71 | - * 获取global_exception详细信息 | ||
| 72 | - */ | ||
| 73 | - @PreAuthorize("@ss.hasPermi('global_exception:global_exception:query')") | ||
| 74 | - @GetMapping(value = "/{id}") | ||
| 75 | - public AjaxResult getInfo(@PathVariable("id") Long id) | ||
| 76 | - { | ||
| 77 | - return success(globalExceptionService.selectGlobalExceptionById(id)); | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - /** | ||
| 81 | - * 新增global_exception | ||
| 82 | - */ | ||
| 83 | - @PreAuthorize("@ss.hasPermi('global_exception:global_exception:add')") | ||
| 84 | -// @Log(title = "global_exception", businessType = BusinessType.INSERT) | ||
| 85 | - @ApiOperation("新增异常") | ||
| 86 | - @PostMapping | ||
| 87 | - public Result<?> add(@RequestBody @ApiParam @Validated GlobalExceptionRequestVo globalException) | ||
| 88 | - { | ||
| 89 | - return Result.OK(globalExceptionService.insertGlobalException(globalException)); | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - /** | ||
| 93 | - * 修改global_exception | ||
| 94 | - */ | ||
| 95 | - @PreAuthorize("@ss.hasPermi('global_exception:global_exception:edit')") | ||
| 96 | -// @Log(title = "global_exception", businessType = BusinessType.UPDATE) | ||
| 97 | - @PutMapping | ||
| 98 | - public AjaxResult edit(@RequestBody GlobalException globalException) | ||
| 99 | - { | ||
| 100 | - return toAjax(globalExceptionService.updateGlobalException(globalException)); | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - /** | ||
| 104 | - * 删除global_exception | ||
| 105 | - */ | ||
| 106 | - @PreAuthorize("@ss.hasPermi('global_exception:global_exception:remove')") | ||
| 107 | - @Log(title = "global_exception", businessType = BusinessType.DELETE) | ||
| 108 | - @DeleteMapping("/{ids}") | ||
| 109 | - public AjaxResult remove(@PathVariable Long[] ids) | ||
| 110 | - { | ||
| 111 | - return toAjax(globalExceptionService.deleteGlobalExceptionByIds(ids)); | ||
| 112 | - } | ||
| 113 | -} |
ruoyi-admin/src/main/java/com/ruoyi/global_exception/domain/GlobalException.java deleted
100644 → 0
| 1 | -package com.ruoyi.global_exception.domain; | ||
| 2 | - | ||
| 3 | -import io.swagger.annotations.ApiModel; | ||
| 4 | -import io.swagger.annotations.ApiModelProperty; | ||
| 5 | -import lombok.Data; | ||
| 6 | -import org.apache.commons.lang3.builder.ToStringBuilder; | ||
| 7 | -import org.apache.commons.lang3.builder.ToStringStyle; | ||
| 8 | -import com.ruoyi.common.annotation.Excel; | ||
| 9 | -import com.ruoyi.common.core.domain.BaseEntity; | ||
| 10 | -import org.springframework.format.annotation.DateTimeFormat; | ||
| 11 | - | ||
| 12 | -import javax.validation.constraints.NotBlank; | ||
| 13 | -import javax.validation.constraints.NotEmpty; | ||
| 14 | -import javax.validation.constraints.NotNull; | ||
| 15 | -import java.io.Serializable; | ||
| 16 | -import java.util.Date; | ||
| 17 | - | ||
| 18 | -/** | ||
| 19 | - * global_exception对象 global_exception | ||
| 20 | - * | ||
| 21 | - * @author global_exception | ||
| 22 | - * @date 2023-08-14 | ||
| 23 | - */ | ||
| 24 | -@ApiModel("异常对象") | ||
| 25 | -@Data | ||
| 26 | -public class GlobalException implements Serializable { | ||
| 27 | - private static final long serialVersionUID = 1L; | ||
| 28 | - | ||
| 29 | - /** | ||
| 30 | - * id | ||
| 31 | - */ | ||
| 32 | - @ApiModelProperty("主键") | ||
| 33 | - private Long id; | ||
| 34 | - | ||
| 35 | - /** | ||
| 36 | - * 提交工号 | ||
| 37 | - */ | ||
| 38 | - @Excel(name = "提交工号") | ||
| 39 | - @ApiModelProperty("提交工号") | ||
| 40 | - @NotBlank | ||
| 41 | - private String jobCode; | ||
| 42 | - | ||
| 43 | - /** | ||
| 44 | - * 设备号 | ||
| 45 | - */ | ||
| 46 | - @Excel(name = "设备号") | ||
| 47 | - @ApiModelProperty("设备号") | ||
| 48 | - @NotBlank | ||
| 49 | - private String deviceId; | ||
| 50 | - | ||
| 51 | - /** | ||
| 52 | - * 问题类型 | ||
| 53 | - */ | ||
| 54 | - @Excel(name = "问题类型") | ||
| 55 | - @ApiModelProperty("问题类型(1:识别异常,2:设备异常") | ||
| 56 | - @NotNull | ||
| 57 | - private Long type; | ||
| 58 | - | ||
| 59 | - /** | ||
| 60 | - * 处理情况 | ||
| 61 | - */ | ||
| 62 | - @Excel(name = "处理情况") | ||
| 63 | - @ApiModelProperty("处理情况 (3:未处理,2:处理中,1:已处理") | ||
| 64 | - @NotNull | ||
| 65 | - private Integer handle; | ||
| 66 | - | ||
| 67 | - @ApiModelProperty("创建时间") | ||
| 68 | - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 69 | - private Date createTime; | ||
| 70 | - @ApiModelProperty("修改时间") | ||
| 71 | - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 72 | - private Date updateTime; | ||
| 73 | - @Excel(name = "问题描述") | ||
| 74 | - @ApiModelProperty("问题描述") | ||
| 75 | - @NotBlank | ||
| 76 | - private String remark; | ||
| 77 | - | ||
| 78 | -} |
ruoyi-admin/src/main/java/com/ruoyi/global_exception/mapper/GlobalExceptionMapper.java deleted
100644 → 0
| 1 | -package com.ruoyi.global_exception.mapper; | ||
| 2 | - | ||
| 3 | -import java.util.List; | ||
| 4 | -import com.ruoyi.global_exception.domain.GlobalException; | ||
| 5 | -import org.apache.ibatis.annotations.Param; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * global_exceptionMapper接口 | ||
| 9 | - * | ||
| 10 | - * @author global_exception | ||
| 11 | - * @date 2023-08-14 | ||
| 12 | - */ | ||
| 13 | -public interface GlobalExceptionMapper | ||
| 14 | -{ | ||
| 15 | - /** | ||
| 16 | - * 查询global_exception | ||
| 17 | - * | ||
| 18 | - * @param id global_exception主键 | ||
| 19 | - * @return global_exception | ||
| 20 | - */ | ||
| 21 | - public GlobalException selectGlobalExceptionById(Long id); | ||
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * 查询global_exception列表 | ||
| 25 | - * | ||
| 26 | - * @param globalException global_exception | ||
| 27 | - * @return global_exception集合 | ||
| 28 | - */ | ||
| 29 | - public List<GlobalException> selectGlobalExceptionList(GlobalException globalException); | ||
| 30 | - | ||
| 31 | - /** | ||
| 32 | - * 新增global_exception | ||
| 33 | - * | ||
| 34 | - * @param globalException global_exception | ||
| 35 | - * @return 结果 | ||
| 36 | - */ | ||
| 37 | - public int insertGlobalException(GlobalException globalException); | ||
| 38 | - | ||
| 39 | - /** | ||
| 40 | - * 修改global_exception | ||
| 41 | - * | ||
| 42 | - * @param globalException global_exception | ||
| 43 | - * @return 结果 | ||
| 44 | - */ | ||
| 45 | - public int updateGlobalException(GlobalException globalException); | ||
| 46 | - | ||
| 47 | - /** | ||
| 48 | - * 删除global_exception | ||
| 49 | - * | ||
| 50 | - * @param id global_exception主键 | ||
| 51 | - * @return 结果 | ||
| 52 | - */ | ||
| 53 | - public int deleteGlobalExceptionById(Long id); | ||
| 54 | - | ||
| 55 | - /** | ||
| 56 | - * 批量删除global_exception | ||
| 57 | - * | ||
| 58 | - * @param ids 需要删除的数据主键集合 | ||
| 59 | - * @return 结果 | ||
| 60 | - */ | ||
| 61 | - public int deleteGlobalExceptionByIds(Long[] ids); | ||
| 62 | - | ||
| 63 | -} |
ruoyi-admin/src/main/java/com/ruoyi/global_exception/service/IGlobalExceptionService.java deleted
100644 → 0
| 1 | -package com.ruoyi.global_exception.service; | ||
| 2 | - | ||
| 3 | -import java.util.List; | ||
| 4 | -import com.ruoyi.global_exception.domain.GlobalException; | ||
| 5 | -import com.ruoyi.pojo.request.GlobalExceptionRequestVo; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * global_exceptionService接口 | ||
| 9 | - * | ||
| 10 | - * @author global_exception | ||
| 11 | - * @date 2023-08-14 | ||
| 12 | - */ | ||
| 13 | -public interface IGlobalExceptionService | ||
| 14 | -{ | ||
| 15 | - /** | ||
| 16 | - * 查询global_exception | ||
| 17 | - * | ||
| 18 | - * @param id global_exception主键 | ||
| 19 | - * @return global_exception | ||
| 20 | - */ | ||
| 21 | - public GlobalException selectGlobalExceptionById(Long id); | ||
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * 查询global_exception列表 | ||
| 25 | - * | ||
| 26 | - * @param globalException global_exception | ||
| 27 | - * @return global_exception集合 | ||
| 28 | - */ | ||
| 29 | - public List<GlobalException> selectGlobalExceptionList(GlobalException globalException); | ||
| 30 | - | ||
| 31 | - /** | ||
| 32 | - * 新增global_exception | ||
| 33 | - * | ||
| 34 | - * @param globalException global_exception | ||
| 35 | - * @return 结果 | ||
| 36 | - */ | ||
| 37 | - public String insertGlobalException(GlobalExceptionRequestVo globalException); | ||
| 38 | - | ||
| 39 | - /** | ||
| 40 | - * 修改global_exception | ||
| 41 | - * | ||
| 42 | - * @param globalException global_exception | ||
| 43 | - * @return 结果 | ||
| 44 | - */ | ||
| 45 | - public int updateGlobalException(GlobalException globalException); | ||
| 46 | - | ||
| 47 | - /** | ||
| 48 | - * 批量删除global_exception | ||
| 49 | - * | ||
| 50 | - * @param ids 需要删除的global_exception主键集合 | ||
| 51 | - * @return 结果 | ||
| 52 | - */ | ||
| 53 | - public int deleteGlobalExceptionByIds(Long[] ids); | ||
| 54 | - | ||
| 55 | - /** | ||
| 56 | - * 删除global_exception信息 | ||
| 57 | - * | ||
| 58 | - * @param id global_exception主键 | ||
| 59 | - * @return 结果 | ||
| 60 | - */ | ||
| 61 | - public int deleteGlobalExceptionById(Long id); | ||
| 62 | -} |
ruoyi-admin/src/main/java/com/ruoyi/global_exception/service/impl/GlobalExceptionServiceImpl.java deleted
100644 → 0
| 1 | -package com.ruoyi.global_exception.service.impl; | ||
| 2 | - | ||
| 3 | -import java.util.Date; | ||
| 4 | -import java.util.List; | ||
| 5 | -import java.util.Objects; | ||
| 6 | - | ||
| 7 | -import com.ruoyi.common.utils.DateUtils; | ||
| 8 | -import com.ruoyi.common.utils.SecurityUtils; | ||
| 9 | -import com.ruoyi.driver.domain.Driver; | ||
| 10 | -import com.ruoyi.driver.mapper.DriverMapper; | ||
| 11 | -import com.ruoyi.equipment.domain.Equipment; | ||
| 12 | -import com.ruoyi.equipment.mapper.EquipmentMapper; | ||
| 13 | -import com.ruoyi.pojo.request.GlobalExceptionRequestVo; | ||
| 14 | -import org.springframework.beans.BeanUtils; | ||
| 15 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 16 | -import org.springframework.stereotype.Service; | ||
| 17 | -import com.ruoyi.global_exception.mapper.GlobalExceptionMapper; | ||
| 18 | -import com.ruoyi.global_exception.domain.GlobalException; | ||
| 19 | -import com.ruoyi.global_exception.service.IGlobalExceptionService; | ||
| 20 | - | ||
| 21 | -import static com.ruoyi.common.ConstEquipmentProperties.*; | ||
| 22 | - | ||
| 23 | -/** | ||
| 24 | - * global_exceptionService业务层处理 | ||
| 25 | - * | ||
| 26 | - * @author global_exception | ||
| 27 | - * @date 2023-08-14 | ||
| 28 | - */ | ||
| 29 | -@Service | ||
| 30 | -public class GlobalExceptionServiceImpl implements IGlobalExceptionService { | ||
| 31 | - @Autowired | ||
| 32 | - private GlobalExceptionMapper globalExceptionMapper; | ||
| 33 | - | ||
| 34 | - @Autowired | ||
| 35 | - private DriverMapper driverMapper; | ||
| 36 | - | ||
| 37 | - @Autowired | ||
| 38 | - private EquipmentMapper equipmentMapper; | ||
| 39 | - | ||
| 40 | - /** | ||
| 41 | - * 查询global_exception | ||
| 42 | - * | ||
| 43 | - * @param id global_exception主键 | ||
| 44 | - * @return global_exception | ||
| 45 | - */ | ||
| 46 | - @Override | ||
| 47 | - public GlobalException selectGlobalExceptionById(Long id) { | ||
| 48 | - return globalExceptionMapper.selectGlobalExceptionById(id); | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - /** | ||
| 52 | - * 查询global_exception列表 | ||
| 53 | - * | ||
| 54 | - * @param globalException global_exception | ||
| 55 | - * @return global_exception | ||
| 56 | - */ | ||
| 57 | - @Override | ||
| 58 | - public List<GlobalException> selectGlobalExceptionList(GlobalException globalException) { | ||
| 59 | - return globalExceptionMapper.selectGlobalExceptionList(globalException); | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - /** | ||
| 63 | - * 新增global_exception | ||
| 64 | - * | ||
| 65 | - * @param globalException global_exception | ||
| 66 | - * @return 结果 | ||
| 67 | - */ | ||
| 68 | - @Override | ||
| 69 | - public String insertGlobalException(GlobalExceptionRequestVo globalException) { | ||
| 70 | - if (Objects.isNull(driverMapper.getDriverInfoByJobCode(globalException.getJobCode()))) { | ||
| 71 | - throw new RuntimeException("工号不存在"); | ||
| 72 | - } | ||
| 73 | - Equipment equipment = new Equipment(); | ||
| 74 | - equipment.setDeviceId(globalException.getDeviceId()); | ||
| 75 | - if (Objects.isNull(equipmentMapper.selectEquipmentList(equipment))) { | ||
| 76 | - throw new RuntimeException("设备号不存在"); | ||
| 77 | - } | ||
| 78 | - if (EQUIPMENT_STATUS_ILLNESS.equals(globalException.getType())) { | ||
| 79 | - equipment.setStatus(EQUIPMENT_STATUS_ILLNESS); | ||
| 80 | - updateEquipment(equipment); | ||
| 81 | - } | ||
| 82 | - GlobalException exception = new GlobalException(); | ||
| 83 | - BeanUtils.copyProperties(globalException, exception); | ||
| 84 | - exception.setCreateTime(DateUtils.getNowDate()); | ||
| 85 | - exception.setUpdateTime(DateUtils.getNowDate()); | ||
| 86 | - exception.setHandle(EQUIPMENT_PROCESS_FLOW_COMMIT); | ||
| 87 | - if (globalExceptionMapper.insertGlobalException(exception) == 1) { | ||
| 88 | - return "新增成功"; | ||
| 89 | - } | ||
| 90 | - return "新增失败"; | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - private void updateEquipment(Equipment equipment) { | ||
| 94 | - equipmentMapper.updateEquipment(equipment); | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - | ||
| 98 | - /** | ||
| 99 | - * 修改global_exception | ||
| 100 | - * | ||
| 101 | - * @param globalException global_exception | ||
| 102 | - * @return 结果 | ||
| 103 | - */ | ||
| 104 | - @Override | ||
| 105 | - public int updateGlobalException(GlobalException globalException) { | ||
| 106 | - globalException.setUpdateTime(DateUtils.getNowDate()); | ||
| 107 | - return globalExceptionMapper.updateGlobalException(globalException); | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - /** | ||
| 111 | - * 批量删除global_exception | ||
| 112 | - * | ||
| 113 | - * @param ids 需要删除的global_exception主键 | ||
| 114 | - * @return 结果 | ||
| 115 | - */ | ||
| 116 | - @Override | ||
| 117 | - public int deleteGlobalExceptionByIds(Long[] ids) { | ||
| 118 | - return globalExceptionMapper.deleteGlobalExceptionByIds(ids); | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - /** | ||
| 122 | - * 删除global_exception信息 | ||
| 123 | - * | ||
| 124 | - * @param id global_exception主键 | ||
| 125 | - * @return 结果 | ||
| 126 | - */ | ||
| 127 | - @Override | ||
| 128 | - public int deleteGlobalExceptionById(Long id) { | ||
| 129 | - return globalExceptionMapper.deleteGlobalExceptionById(id); | ||
| 130 | - } | ||
| 131 | -} |
ruoyi-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| @@ -75,7 +75,7 @@ public class SignInServiceImpl implements ISignInService { | @@ -75,7 +75,7 @@ public class SignInServiceImpl implements ISignInService { | ||
| 75 | private RedisCache redisCache; | 75 | private RedisCache redisCache; |
| 76 | 76 | ||
| 77 | @Resource | 77 | @Resource |
| 78 | - private ThreadJobService threadJobConfig; | 78 | + private ThreadJobService threadJobService; |
| 79 | 79 | ||
| 80 | /** | 80 | /** |
| 81 | * 查询签到 | 81 | * 查询签到 |
| @@ -91,12 +91,11 @@ public class SignInServiceImpl implements ISignInService { | @@ -91,12 +91,11 @@ public class SignInServiceImpl implements ISignInService { | ||
| 91 | /** | 91 | /** |
| 92 | * 查询签到列表 | 92 | * 查询签到列表 |
| 93 | * | 93 | * |
| 94 | - * @param signIn 签到 | 94 | + * @param vo 签到 |
| 95 | * @return 签到 | 95 | * @return 签到 |
| 96 | */ | 96 | */ |
| 97 | @Override | 97 | @Override |
| 98 | - public List<SignInResponseVo> selectSignInList(SignInResponseVo signIn) { | ||
| 99 | - SignInResponseVo vo = new SignInResponseVo(signIn); | 98 | + public List<SignInResponseVo> selectSignInList(SignInResponseVo vo) { |
| 100 | List<SignInResponseVo> vos = signInMapper.selectSignInList(vo); | 99 | List<SignInResponseVo> vos = signInMapper.selectSignInList(vo); |
| 101 | return vos; | 100 | return vos; |
| 102 | } | 101 | } |
| @@ -188,7 +187,7 @@ public class SignInServiceImpl implements ISignInService { | @@ -188,7 +187,7 @@ public class SignInServiceImpl implements ISignInService { | ||
| 188 | if (Objects.isNull(driver)) return AjaxResult.warn("这个工号的员工不存在!"); | 187 | if (Objects.isNull(driver)) return AjaxResult.warn("这个工号的员工不存在!"); |
| 189 | // 查询地址 | 188 | // 查询地址 |
| 190 | Equipment equipment = equipmentMapper.selectEquipmentByDeviceId(signIn.getDeviceId()); | 189 | Equipment equipment = equipmentMapper.selectEquipmentByDeviceId(signIn.getDeviceId()); |
| 191 | - SignInResponseVo vo = getSignInResponseVo(driver,signIn, equipment); | 190 | + SignInResponseVo vo = getSignInResponseVo(driver, signIn, equipment); |
| 192 | signIn.setCreateTime(new Date()); | 191 | signIn.setCreateTime(new Date()); |
| 193 | signIn.setRemark(""); | 192 | signIn.setRemark(""); |
| 194 | GlobalIndex globalIndex = new GlobalIndex(); | 193 | GlobalIndex globalIndex = new GlobalIndex(); |
| @@ -198,6 +197,7 @@ public class SignInServiceImpl implements ISignInService { | @@ -198,6 +197,7 @@ public class SignInServiceImpl implements ISignInService { | ||
| 198 | if (checkSignIn(now, dto, globalIndex, signIn, driver)) { | 197 | if (checkSignIn(now, dto, globalIndex, signIn, driver)) { |
| 199 | signIn.setStatus(SIGN_IN_SUCCESS); | 198 | signIn.setStatus(SIGN_IN_SUCCESS); |
| 200 | signIn.setExType(SIGN_NO_EX_NUM); | 199 | signIn.setExType(SIGN_NO_EX_NUM); |
| 200 | + signIn.setRemark("正常"); | ||
| 201 | } else { | 201 | } else { |
| 202 | signIn.setStatus(SIGN_IN_FAIL); | 202 | signIn.setStatus(SIGN_IN_FAIL); |
| 203 | signIn.setRemark(signIn.getRemark().replaceFirst(",$", "。")); | 203 | signIn.setRemark(signIn.getRemark().replaceFirst(",$", "。")); |
| @@ -205,14 +205,13 @@ public class SignInServiceImpl implements ISignInService { | @@ -205,14 +205,13 @@ public class SignInServiceImpl implements ISignInService { | ||
| 205 | // base64转图片 | 205 | // base64转图片 |
| 206 | signIn.setIp(IpUtils.getIpAddr()); | 206 | signIn.setIp(IpUtils.getIpAddr()); |
| 207 | 207 | ||
| 208 | - uploadImage(signIn); | 208 | + uploadImage(signIn, vo); |
| 209 | signInMapper.insertSignIn(signIn); | 209 | signInMapper.insertSignIn(signIn); |
| 210 | // 更新考勤 | 210 | // 更新考勤 |
| 211 | schedulingService.computedSignInBySignIn(dto, signIn, globalIndex); | 211 | schedulingService.computedSignInBySignIn(dto, signIn, globalIndex); |
| 212 | - // 测试用户特殊处理 TODO 更新签到记录 | ||
| 213 | - if (signIn.getJobCode().equals("700002") || signIn.getJobCode().equals("700001")) { | ||
| 214 | - return AjaxResult.success(SIGN_IN_SUCCESS_STRING, vo); | ||
| 215 | - } | 212 | + |
| 213 | + // 异常保存到异常异常中 | ||
| 214 | + threadJobService.asyncInsertExceptionRecord(signIn); | ||
| 216 | 215 | ||
| 217 | // 驾驶人员二次签到酒精测试异常 | 216 | // 驾驶人员二次签到酒精测试异常 |
| 218 | if (PERSONNEL_POSTS_DRIVER.equals(driver.getPosts()) && SIGN_IN_FAIL.equals(signIn.getStatus()) && signIn.getRemark().contains(ALCOHOL_SIGN_IN_ERROR)) { | 217 | if (PERSONNEL_POSTS_DRIVER.equals(driver.getPosts()) && SIGN_IN_FAIL.equals(signIn.getStatus()) && signIn.getRemark().contains(ALCOHOL_SIGN_IN_ERROR)) { |
| @@ -354,7 +353,7 @@ public class SignInServiceImpl implements ISignInService { | @@ -354,7 +353,7 @@ public class SignInServiceImpl implements ISignInService { | ||
| 354 | if (currentScheduling.getBcType().equals(BC_TYPE_OUT) && Objects.isNull(currentScheduling.getSignInId())) { | 353 | if (currentScheduling.getBcType().equals(BC_TYPE_OUT) && Objects.isNull(currentScheduling.getSignInId())) { |
| 355 | DriverSignRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1); | 354 | DriverSignRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1); |
| 356 | // 上一次无记|签到,type:签退 当前时间小于最近签到时间 -> 超时签退 | 355 | // 上一次无记|签到,type:签退 当前时间小于最近签到时间 -> 超时签退 |
| 357 | - if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_OUT) && lastClosestTimestamp.getBcType().equals(BC_TYPE_IN)){ | 356 | + if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_OUT) && lastClosestTimestamp.getBcType().equals(BC_TYPE_IN)) { |
| 358 | signIn.setRemark(SIGN_OUT_TIMEOUT); | 357 | signIn.setRemark(SIGN_OUT_TIMEOUT); |
| 359 | globalIndex.setIndex(lastClosestTimestamp.getIndex()); | 358 | globalIndex.setIndex(lastClosestTimestamp.getIndex()); |
| 360 | result = false; | 359 | result = false; |
| @@ -366,7 +365,7 @@ public class SignInServiceImpl implements ISignInService { | @@ -366,7 +365,7 @@ public class SignInServiceImpl implements ISignInService { | ||
| 366 | result = false; | 365 | result = false; |
| 367 | } | 366 | } |
| 368 | // 当前最近无记录|签到,type:签到|签退 -> 签到超时给上 | 367 | // 当前最近无记录|签到,type:签到|签退 -> 签到超时给上 |
| 369 | - else { | 368 | + else { |
| 370 | signIn.setRemark(SIGN_IN_TIMEOUT); | 369 | signIn.setRemark(SIGN_IN_TIMEOUT); |
| 371 | globalIndex.setIndex(currentScheduling.getIndex()); | 370 | globalIndex.setIndex(currentScheduling.getIndex()); |
| 372 | result = false; | 371 | result = false; |
| @@ -376,13 +375,13 @@ public class SignInServiceImpl implements ISignInService { | @@ -376,13 +375,13 @@ public class SignInServiceImpl implements ISignInService { | ||
| 376 | if (currentScheduling.getBcType().equals(BC_TYPE_IN) && Objects.isNull(currentScheduling.getSignInId())) { | 375 | if (currentScheduling.getBcType().equals(BC_TYPE_IN) && Objects.isNull(currentScheduling.getSignInId())) { |
| 377 | DriverSignRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1); | 376 | DriverSignRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1); |
| 378 | // 上一次无记|签退,type:签到 当前时间小于最近签退时间 -> 签到异常 | 377 | // 上一次无记|签退,type:签到 当前时间小于最近签退时间 -> 签到异常 |
| 379 | - if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_OUT)) { | 378 | + if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_IN)) { |
| 380 | signIn.setRemark(SIGN_IN_TIMEOUT); | 379 | signIn.setRemark(SIGN_IN_TIMEOUT); |
| 381 | globalIndex.setIndex(lastClosestTimestamp.getIndex()); | 380 | globalIndex.setIndex(lastClosestTimestamp.getIndex()); |
| 382 | result = false; | 381 | result = false; |
| 383 | } | 382 | } |
| 384 | // 当前无记|签退 , type:签退|签到 ——> 签退异常 | 383 | // 当前无记|签退 , type:签退|签到 ——> 签退异常 |
| 385 | - else { | 384 | + else { |
| 386 | signIn.setRemark(SIGN_OUT_TIMEOUT); | 385 | signIn.setRemark(SIGN_OUT_TIMEOUT); |
| 387 | globalIndex.setIndex(currentScheduling.getIndex()); | 386 | globalIndex.setIndex(currentScheduling.getIndex()); |
| 388 | result = false; | 387 | result = false; |
| @@ -404,7 +403,7 @@ public class SignInServiceImpl implements ISignInService { | @@ -404,7 +403,7 @@ public class SignInServiceImpl implements ISignInService { | ||
| 404 | } | 403 | } |
| 405 | } | 404 | } |
| 406 | 405 | ||
| 407 | - private void uploadImage(SignIn signIn) throws IOException { | 406 | + private void uploadImage(SignIn signIn, SignInResponseVo vo) throws IOException { |
| 408 | String base64 = signIn.getImage(); | 407 | String base64 = signIn.getImage(); |
| 409 | // 图片路径 | 408 | // 图片路径 |
| 410 | String filePath = RuoYiConfig.getUploadPath(); | 409 | String filePath = RuoYiConfig.getUploadPath(); |
| @@ -419,9 +418,10 @@ public class SignInServiceImpl implements ISignInService { | @@ -419,9 +418,10 @@ public class SignInServiceImpl implements ISignInService { | ||
| 419 | // 获取文件上传路径 | 418 | // 获取文件上传路径 |
| 420 | String pathFileName = getPathFileName(filePath, fileName); | 419 | String pathFileName = getPathFileName(filePath, fileName); |
| 421 | signIn.setImage(pathFileName); | 420 | signIn.setImage(pathFileName); |
| 421 | + vo.setImage(signIn.getImage()); | ||
| 422 | log.info("开始上传签到图片"); | 422 | log.info("开始上传签到图片"); |
| 423 | // 异步上传文件 | 423 | // 异步上传文件 |
| 424 | - threadJobConfig.asyncStartUploadBase64Image(absPath, base64); | 424 | + threadJobService.asyncStartUploadBase64Image(absPath, base64); |
| 425 | } | 425 | } |
| 426 | 426 | ||
| 427 | /** | 427 | /** |
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
| @@ -3,6 +3,7 @@ package com.ruoyi.job; | @@ -3,6 +3,7 @@ package com.ruoyi.job; | ||
| 3 | import cn.hutool.http.HttpUtil; | 3 | import cn.hutool.http.HttpUtil; |
| 4 | import com.alibaba.fastjson2.JSON; | 4 | import com.alibaba.fastjson2.JSON; |
| 5 | import com.alibaba.fastjson2.JSONArray; | 5 | import com.alibaba.fastjson2.JSONArray; |
| 6 | +import com.ruoyi.common.cache.NowSchedulingCache; | ||
| 6 | import com.ruoyi.common.cache.SchedulingCache; | 7 | import com.ruoyi.common.cache.SchedulingCache; |
| 7 | import com.ruoyi.common.core.redis.RedisCache; | 8 | import com.ruoyi.common.core.redis.RedisCache; |
| 8 | import com.ruoyi.common.utils.StringUtils; | 9 | import com.ruoyi.common.utils.StringUtils; |
| @@ -51,6 +52,8 @@ import static com.ruoyi.common.redispre.GlobalRedisPreName.*; | @@ -51,6 +52,8 @@ import static com.ruoyi.common.redispre.GlobalRedisPreName.*; | ||
| 51 | @Slf4j | 52 | @Slf4j |
| 52 | public class DriverJob implements InitializingBean { | 53 | public class DriverJob implements InitializingBean { |
| 53 | 54 | ||
| 55 | + @Resource | ||
| 56 | + private NowSchedulingCache nowSchedulingCache; | ||
| 54 | 57 | ||
| 55 | @Autowired | 58 | @Autowired |
| 56 | private RedisCache redisCache; | 59 | private RedisCache redisCache; |
| @@ -92,6 +95,7 @@ public class DriverJob implements InitializingBean { | @@ -92,6 +95,7 @@ public class DriverJob implements InitializingBean { | ||
| 92 | @Value("${api.config.nonce}") | 95 | @Value("${api.config.nonce}") |
| 93 | private String nonce; | 96 | private String nonce; |
| 94 | 97 | ||
| 98 | + private static NowSchedulingCache NOW_SCHEDULING_CACHE; | ||
| 95 | private static ThreadJobService THREAD_JOB_SERVICE; | 99 | private static ThreadJobService THREAD_JOB_SERVICE; |
| 96 | private static SchedulingCache SCHEDULING_CACHE; | 100 | private static SchedulingCache SCHEDULING_CACHE; |
| 97 | private static EquipmentMapper EQUIPMENT_MAPPER; | 101 | private static EquipmentMapper EQUIPMENT_MAPPER; |
| @@ -177,6 +181,7 @@ public class DriverJob implements InitializingBean { | @@ -177,6 +181,7 @@ public class DriverJob implements InitializingBean { | ||
| 177 | return result; | 181 | return result; |
| 178 | } | 182 | } |
| 179 | 183 | ||
| 184 | + // 弃用 无用方法 | ||
| 180 | public void clearExceptionYesterdayRecord() { | 185 | public void clearExceptionYesterdayRecord() { |
| 181 | // 获取当前日期时间 | 186 | // 获取当前日期时间 |
| 182 | Calendar calendar = Calendar.getInstance(); | 187 | Calendar calendar = Calendar.getInstance(); |
| @@ -219,15 +224,30 @@ public class DriverJob implements InitializingBean { | @@ -219,15 +224,30 @@ public class DriverJob implements InitializingBean { | ||
| 219 | } | 224 | } |
| 220 | 225 | ||
| 221 | private void deleteScheduling() { | 226 | private void deleteScheduling() { |
| 222 | - String nowKey = DRIVER_SCHEDULING_PRE + ConstDateUtil.formatDate(new Date()); | ||
| 223 | - String yesterdayKey = DRIVER_SCHEDULING_PRE + ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1)); | 227 | + String nowDate = ConstDateUtil.formatDate(new Date()); |
| 228 | + String yesterdayDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1)); | ||
| 229 | + | ||
| 230 | + String nowKey = DRIVER_SCHEDULING_PRE + nowDate; | ||
| 231 | + String yesterdayKey = DRIVER_SCHEDULING_PRE + yesterdayDate; | ||
| 232 | + // 考情keys | ||
| 233 | + List<String> nowKeys = NOW_SCHEDULING_CACHE.getKes(); | ||
| 234 | + // 实时keys | ||
| 224 | List<String> keys = SCHEDULING_CACHE.getKeys(); | 235 | List<String> keys = SCHEDULING_CACHE.getKeys(); |
| 236 | + | ||
| 237 | + // 删除实时排班 | ||
| 225 | for (int i = 0; i < keys.size(); i++) { | 238 | for (int i = 0; i < keys.size(); i++) { |
| 226 | if (nowKey.equals(keys.get(i)) || yesterdayKey.equals(keys.get(i))){ | 239 | if (nowKey.equals(keys.get(i)) || yesterdayKey.equals(keys.get(i))){ |
| 227 | continue; | 240 | continue; |
| 228 | } | 241 | } |
| 229 | SCHEDULING_CACHE.removeCacheSchedulingByKey(keys.get(i)); | 242 | SCHEDULING_CACHE.removeCacheSchedulingByKey(keys.get(i)); |
| 230 | } | 243 | } |
| 244 | + // 删除考勤 | ||
| 245 | + for (int i = 0; i < nowKeys.size(); i++) { | ||
| 246 | + if (nowDate.equals(nowKeys.get(i)) || yesterdayDate.equals(nowKeys.get(i))){ | ||
| 247 | + continue; | ||
| 248 | + } | ||
| 249 | + NOW_SCHEDULING_CACHE.removeCacheSchedulingByKey(nowKeys.get(i)); | ||
| 250 | + } | ||
| 231 | } | 251 | } |
| 232 | 252 | ||
| 233 | /** | 253 | /** |
| @@ -286,11 +306,10 @@ public class DriverJob implements InitializingBean { | @@ -286,11 +306,10 @@ public class DriverJob implements InitializingBean { | ||
| 286 | List<ResponseSchedulingDto> schedulingList = driverSchedulingMap.get(key); | 306 | List<ResponseSchedulingDto> schedulingList = driverSchedulingMap.get(key); |
| 287 | schedulingList.sort(Comparator.comparing(ResponseSchedulingDto::getFcsjT)); | 307 | schedulingList.sort(Comparator.comparing(ResponseSchedulingDto::getFcsjT)); |
| 288 | } | 308 | } |
| 289 | - // 存入数据库 | 309 | + // 存入签到报表 |
| 290 | THREAD_JOB_SERVICE.asyncComputedScheduling(driverSchedulingMap); | 310 | THREAD_JOB_SERVICE.asyncComputedScheduling(driverSchedulingMap); |
| 291 | - // 存入缓存 | 311 | + // 实时排班直接存入缓存 |
| 292 | SCHEDULING_CACHE.setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap); | 312 | SCHEDULING_CACHE.setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap); |
| 293 | -// REDIS_CACHE.setCacheMap(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap, 2, TimeUnit.DAYS); | ||
| 294 | log.info("拉取排班完毕:{}", dateKey); | 313 | log.info("拉取排班完毕:{}", dateKey); |
| 295 | return driverSchedulingMap; | 314 | return driverSchedulingMap; |
| 296 | } | 315 | } |
| @@ -484,5 +503,6 @@ public class DriverJob implements InitializingBean { | @@ -484,5 +503,6 @@ public class DriverJob implements InitializingBean { | ||
| 484 | APP_SECRET = appSecret; | 503 | APP_SECRET = appSecret; |
| 485 | SCHEDULING_CACHE = schedulingCache; | 504 | SCHEDULING_CACHE = schedulingCache; |
| 486 | EQUIPMENT_MAPPER = equipmentMapper; | 505 | EQUIPMENT_MAPPER = equipmentMapper; |
| 506 | + NOW_SCHEDULING_CACHE = nowSchedulingCache; | ||
| 487 | } | 507 | } |
| 488 | } | 508 | } |
ruoyi-admin/src/main/java/com/ruoyi/pojo/entity/DriverScheduling.java
| 1 | package com.ruoyi.pojo.entity; | 1 | package com.ruoyi.pojo.entity; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | +import org.apache.poi.hpsf.Decimal; | ||
| 4 | 5 | ||
| 6 | +import java.math.BigDecimal; | ||
| 5 | import java.util.Date; | 7 | import java.util.Date; |
| 6 | 8 | ||
| 7 | @Data | 9 | @Data |
| @@ -19,4 +21,13 @@ public class DriverScheduling { | @@ -19,4 +21,13 @@ public class DriverScheduling { | ||
| 19 | private Long zdsjT; | 21 | private Long zdsjT; |
| 20 | private Long signInId; | 22 | private Long signInId; |
| 21 | private Integer exType; | 23 | private Integer exType; |
| 24 | + private Integer signType; | ||
| 25 | + private Date signTime; | ||
| 26 | + private Integer alcoholFlag; | ||
| 27 | + private BigDecimal alcoholIntake; | ||
| 28 | + private String remark; | ||
| 29 | + /** | ||
| 30 | + * 不是当前表的属性 | ||
| 31 | + */ | ||
| 32 | + private String fleetName; | ||
| 22 | } | 33 | } |
ruoyi-admin/src/main/java/com/ruoyi/pojo/request/ReportErrorRequestVo.java
| @@ -26,16 +26,21 @@ public class ReportErrorRequestVo { | @@ -26,16 +26,21 @@ public class ReportErrorRequestVo { | ||
| 26 | * 错误类型 | 26 | * 错误类型 |
| 27 | */ | 27 | */ |
| 28 | @ApiModelProperty("错误类型") | 28 | @ApiModelProperty("错误类型") |
| 29 | - private String errorType; | 29 | + private Integer exType; |
| 30 | /** | 30 | /** |
| 31 | - * 开始时间 | 31 | + * 错误类型 |
| 32 | + */ | ||
| 33 | + @ApiModelProperty("场地名称") | ||
| 34 | + private String siteName; | ||
| 35 | + /** | ||
| 36 | + * 指定日期 | ||
| 32 | */ | 37 | */ |
| 33 | - @ApiModelProperty("开始时间") | ||
| 34 | - private String startTime; | 38 | + @ApiModelProperty("指定日期") |
| 39 | + private String date; | ||
| 35 | /** | 40 | /** |
| 36 | - * 结束时间 | 41 | + * 主键 |
| 37 | */ | 42 | */ |
| 38 | - @ApiModelProperty("结束时间") | ||
| 39 | - private String endTime; | 43 | + @ApiModelProperty("主键") |
| 44 | + private String id; | ||
| 40 | 45 | ||
| 41 | } | 46 | } |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/EquipmentExceptionResponseVo.java
0 → 100644
| 1 | +package com.ruoyi.pojo.response; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.eexception.domain.EquipmentException; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * | ||
| 8 | + * @author 20412 | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +public class EquipmentExceptionResponseVo extends EquipmentException { | ||
| 12 | + /** | ||
| 13 | + * 姓名 | ||
| 14 | + */ | ||
| 15 | + private String personnelName; | ||
| 16 | + /** | ||
| 17 | + * 场地名称 | ||
| 18 | + */ | ||
| 19 | + private String siteName; | ||
| 20 | + | ||
| 21 | +} |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ExportReportViewResponseVo.java
| 1 | package com.ruoyi.pojo.response; | 1 | package com.ruoyi.pojo.response; |
| 2 | 2 | ||
| 3 | import com.alibaba.excel.annotation.ExcelProperty; | 3 | import com.alibaba.excel.annotation.ExcelProperty; |
| 4 | +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.HeadRowHeight; | ||
| 7 | +import com.ruoyi.common.utils.bean.BeanUtils; | ||
| 8 | +import com.ruoyi.pojo.entity.DriverScheduling; | ||
| 4 | import io.swagger.annotations.ApiModel; | 9 | import io.swagger.annotations.ApiModel; |
| 5 | import io.swagger.annotations.ApiModelProperty; | 10 | import io.swagger.annotations.ApiModelProperty; |
| 6 | import lombok.Data; | 11 | import lombok.Data; |
| 7 | 12 | ||
| 13 | +import java.math.BigDecimal; | ||
| 8 | import java.util.Date; | 14 | import java.util.Date; |
| 15 | +import java.util.List; | ||
| 16 | +import java.util.Objects; | ||
| 17 | + | ||
| 18 | +import static com.ruoyi.common.ConstSignInConstSignInProperties.*; | ||
| 9 | 19 | ||
| 10 | /** | 20 | /** |
| 11 | * @author 20412 | 21 | * @author 20412 |
| 12 | */ | 22 | */ |
| 13 | @Data | 23 | @Data |
| 14 | @ApiModel("报表对象表") | 24 | @ApiModel("报表对象表") |
| 25 | +@HeadRowHeight(25) | ||
| 26 | +@HeadFontStyle(fontHeightInPoints = 10,fontName = "黑体") | ||
| 15 | public class ExportReportViewResponseVo { | 27 | public class ExportReportViewResponseVo { |
| 16 | @ExcelProperty(value = "工号") | 28 | @ExcelProperty(value = "工号") |
| 17 | private String jobCode; | 29 | private String jobCode; |
| @@ -23,41 +35,127 @@ public class ExportReportViewResponseVo { | @@ -23,41 +35,127 @@ public class ExportReportViewResponseVo { | ||
| 23 | @ExcelProperty(value = "线路") | 35 | @ExcelProperty(value = "线路") |
| 24 | private String lineName; | 36 | private String lineName; |
| 25 | 37 | ||
| 26 | - @ApiModelProperty("车队名称") | ||
| 27 | - @ExcelProperty(value = "车队名称") | 38 | + @ApiModelProperty("部门") |
| 39 | + @ExcelProperty(value = "部门") | ||
| 40 | + @ColumnWidth(12) | ||
| 28 | private String fleetName; | 41 | private String fleetName; |
| 29 | 42 | ||
| 30 | @ExcelProperty(value = "车辆自编号") | 43 | @ExcelProperty(value = "车辆自编号") |
| 44 | + @ColumnWidth(12) | ||
| 31 | private String nbbm; | 45 | private String nbbm; |
| 32 | 46 | ||
| 33 | @ExcelProperty(value = "计划签到时间") | 47 | @ExcelProperty(value = "计划签到时间") |
| 48 | + @ColumnWidth(20) | ||
| 34 | private Date planSignInTime; | 49 | private Date planSignInTime; |
| 35 | @ExcelProperty(value = "实际签到时间") | 50 | @ExcelProperty(value = "实际签到时间") |
| 51 | + @ColumnWidth(20) | ||
| 36 | private Date actualSignInTime; | 52 | private Date actualSignInTime; |
| 53 | + @ExcelProperty(value = "是否酒精测试") | ||
| 54 | + @ColumnWidth(12) | ||
| 55 | + private String alcoholStringIn; | ||
| 56 | + @ExcelProperty(value = "酒精测试含量") | ||
| 57 | + @ColumnWidth(12) | ||
| 58 | + private BigDecimal alcoholIntakeIn; | ||
| 37 | @ExcelProperty(value = "签到结果") | 59 | @ExcelProperty(value = "签到结果") |
| 60 | + @ColumnWidth(12) | ||
| 38 | private String signInResultString; | 61 | private String signInResultString; |
| 39 | @ExcelProperty(value = "计划签退时间") | 62 | @ExcelProperty(value = "计划签退时间") |
| 63 | + @ColumnWidth(20) | ||
| 40 | private Date planSignOutTime; | 64 | private Date planSignOutTime; |
| 41 | @ExcelProperty(value = "实际签退时间") | 65 | @ExcelProperty(value = "实际签退时间") |
| 66 | + @ColumnWidth(20) | ||
| 42 | private Date actualSignOutTime; | 67 | private Date actualSignOutTime; |
| 68 | + @ExcelProperty(value = "是否酒精测试") | ||
| 69 | + @ColumnWidth(12) | ||
| 70 | + private String alcoholStringOut; | ||
| 71 | + @ExcelProperty(value = "酒精测试含量") | ||
| 72 | + @ColumnWidth(12) | ||
| 73 | + private BigDecimal alcoholIntakeOut; | ||
| 43 | @ExcelProperty(value = "签退结果") | 74 | @ExcelProperty(value = "签退结果") |
| 44 | private String signOutResultString; | 75 | private String signOutResultString; |
| 45 | 76 | ||
| 77 | + @ExcelProperty(value = "有无分班") | ||
| 78 | + private String haveSecondFlagString; | ||
| 46 | 79 | ||
| 47 | @ExcelProperty(value = "分班计划签到时间") | 80 | @ExcelProperty(value = "分班计划签到时间") |
| 81 | + @ColumnWidth(20) | ||
| 48 | private Date secondPlanSignInTime; | 82 | private Date secondPlanSignInTime; |
| 49 | @ExcelProperty(value = "分班实际签到时间") | 83 | @ExcelProperty(value = "分班实际签到时间") |
| 84 | + @ColumnWidth(20) | ||
| 50 | private Date secondActualSignInTime; | 85 | private Date secondActualSignInTime; |
| 86 | + | ||
| 87 | + @ExcelProperty(value = "是否酒精测试") | ||
| 88 | + @ColumnWidth(12) | ||
| 89 | + private String secondAlcoholStringIn; | ||
| 90 | + @ExcelProperty(value = "酒精测试含量") | ||
| 91 | + @ColumnWidth(12) | ||
| 92 | + private BigDecimal secondAlcoholIntakeIn; | ||
| 51 | @ExcelProperty(value = "分班签到结果") | 93 | @ExcelProperty(value = "分班签到结果") |
| 94 | + @ColumnWidth(12) | ||
| 52 | private String secondSignInResultString; | 95 | private String secondSignInResultString; |
| 53 | @ExcelProperty(value = "分班计划签退时间") | 96 | @ExcelProperty(value = "分班计划签退时间") |
| 97 | + @ColumnWidth(20) | ||
| 54 | private Date secondPlanSignOutTime; | 98 | private Date secondPlanSignOutTime; |
| 55 | @ExcelProperty(value = "分班实际签退时间") | 99 | @ExcelProperty(value = "分班实际签退时间") |
| 100 | + @ColumnWidth(20) | ||
| 56 | private Date secondActualSignOutTime; | 101 | private Date secondActualSignOutTime; |
| 102 | + | ||
| 103 | + @ExcelProperty(value = "是否酒精测试") | ||
| 104 | + @ColumnWidth(12) | ||
| 105 | + private String secondAlcoholStringOut; | ||
| 106 | + @ExcelProperty(value = "酒精测试含量") | ||
| 107 | + @ColumnWidth(12) | ||
| 108 | + private BigDecimal secondAlcoholIntakeOut; | ||
| 57 | @ExcelProperty(value = "分班签退结果") | 109 | @ExcelProperty(value = "分班签退结果") |
| 110 | + @ColumnWidth(12) | ||
| 58 | private String secondSignOutResultString; | 111 | private String secondSignOutResultString; |
| 59 | 112 | ||
| 60 | @ExcelProperty(value = "排班日期") | 113 | @ExcelProperty(value = "排班日期") |
| 61 | - private Date schedulingDate; | 114 | + @ColumnWidth(20) |
| 115 | + private Date scheduleDate; | ||
| 116 | + | ||
| 117 | + public ExportReportViewResponseVo(List<DriverScheduling> driverSchedulings) { | ||
| 118 | + BeanUtils.copyProperties(driverSchedulings.get(0), this); | ||
| 119 | + int size = driverSchedulings.size(); | ||
| 120 | + this.setHaveSecondFlagString(size >= 4 ? "有分班":"无分班"); | ||
| 121 | + if (size <= 3) { | ||
| 122 | + handleFirst(driverSchedulings, size); | ||
| 123 | + } | ||
| 124 | + // 有分班 | ||
| 125 | + else { | ||
| 126 | + // 签到 | ||
| 127 | + handleFirst(driverSchedulings, 2); | ||
| 128 | + handelSecond(driverSchedulings, size); | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + private void handelSecond(List<DriverScheduling> driverSchedulings, int size) { | ||
| 133 | + // 签到 | ||
| 134 | + this.setSecondPlanSignInTime(new Date(driverSchedulings.get(2).getFcsjT())); | ||
| 135 | + this.setSecondActualSignInTime(driverSchedulings.get(2).getSignTime()); | ||
| 136 | + this.setSecondAlcoholStringIn(ALCOHOL_FLAG_YES.equals(driverSchedulings.get(2).getAlcoholFlag()) ? ALCOHOL_FLAG_YES_STRING : ALCOHOL_FLAG_NO_STRING); | ||
| 137 | + this.setSecondAlcoholIntakeIn(driverSchedulings.get(2).getAlcoholIntake()); | ||
| 138 | + this.setSecondSignInResultString(Objects.isNull(driverSchedulings.get(2).getSignInId()) ? "未签到" : driverSchedulings.get(2).getRemark()); | ||
| 139 | + // 签退 | ||
| 140 | + this.setSecondPlanSignOutTime(new Date(driverSchedulings.get(size - 1).getZdsjT())); | ||
| 141 | + this.setSecondActualSignOutTime(driverSchedulings.get(size - 1).getSignTime()); | ||
| 142 | + this.setSecondAlcoholStringOut(ALCOHOL_FLAG_YES.equals(driverSchedulings.get(size - 1).getAlcoholFlag()) ? ALCOHOL_FLAG_YES_STRING : ALCOHOL_FLAG_NO_STRING); | ||
| 143 | + this.setSecondAlcoholIntakeOut(driverSchedulings.get(size - 1).getAlcoholIntake()); | ||
| 144 | + this.setSecondSignInResultString(Objects.isNull(driverSchedulings.get(size -1).getSignInId()) ? "未签退" : driverSchedulings.get(size -1).getRemark()); | ||
| 145 | + } | ||
| 62 | 146 | ||
| 147 | + private void handleFirst(List<DriverScheduling> driverSchedulings, int size) { | ||
| 148 | + // 签到 | ||
| 149 | + this.setPlanSignInTime(new Date(driverSchedulings.get(0).getFcsjT())); | ||
| 150 | + this.setActualSignInTime(driverSchedulings.get(0).getSignTime()); | ||
| 151 | + this.setAlcoholStringIn(ALCOHOL_FLAG_YES.equals(driverSchedulings.get(0).getAlcoholFlag()) ? ALCOHOL_FLAG_YES_STRING : ALCOHOL_FLAG_NO_STRING); | ||
| 152 | + this.setAlcoholIntakeIn(driverSchedulings.get(0).getAlcoholIntake()); | ||
| 153 | + this.setSignInResultString(Objects.isNull(driverSchedulings.get(0).getSignInId()) ? "未签到": driverSchedulings.get(0).getRemark()); | ||
| 154 | + // 签退 | ||
| 155 | + this.setPlanSignOutTime(new Date(driverSchedulings.get(size - 1).getZdsjT())); | ||
| 156 | + this.setActualSignOutTime(driverSchedulings.get(size - 1).getSignTime()); | ||
| 157 | + this.setAlcoholStringOut(ALCOHOL_FLAG_YES.equals(driverSchedulings.get(size - 1).getAlcoholFlag()) ? ALCOHOL_FLAG_YES_STRING : ALCOHOL_FLAG_NO_STRING); | ||
| 158 | + this.setAlcoholIntakeOut(driverSchedulings.get(size - 1).getAlcoholIntake()); | ||
| 159 | + this.setSignOutResultString(Objects.isNull(driverSchedulings.get(size - 1).getSignInId()) ? "未签退": driverSchedulings.get(size - 1).getRemark()); | ||
| 160 | + } | ||
| 63 | } | 161 | } |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ReportDetailResponseVo.java
| @@ -11,10 +11,14 @@ import java.util.Date; | @@ -11,10 +11,14 @@ import java.util.Date; | ||
| 11 | @Data | 11 | @Data |
| 12 | @ApiModel("签到报表查看详情vo") | 12 | @ApiModel("签到报表查看详情vo") |
| 13 | public class ReportDetailResponseVo { | 13 | public class ReportDetailResponseVo { |
| 14 | + private String jobCode; | ||
| 14 | private String name; | 15 | private String name; |
| 15 | private String posts; | 16 | private String posts; |
| 16 | private String lineName; | 17 | private String lineName; |
| 17 | private String lpName; | 18 | private String lpName; |
| 19 | + private String fleetName; | ||
| 20 | + private String nbbm; | ||
| 21 | + private String exString; | ||
| 18 | /** | 22 | /** |
| 19 | * 计划操作 | 23 | * 计划操作 |
| 20 | */ | 24 | */ |
| @@ -24,15 +28,19 @@ public class ReportDetailResponseVo { | @@ -24,15 +28,19 @@ public class ReportDetailResponseVo { | ||
| 24 | */ | 28 | */ |
| 25 | private String actualAction; | 29 | private String actualAction; |
| 26 | /** | 30 | /** |
| 27 | - * 是否酒精测试 | 31 | + * 打卡时间 |
| 28 | */ | 32 | */ |
| 29 | - private Boolean alcoholFlag; | 33 | + private Date planTime; |
| 30 | /** | 34 | /** |
| 31 | - * 签到时间 | 35 | + * 实际打卡时间 |
| 32 | */ | 36 | */ |
| 33 | - private Date createTime; | 37 | + private Date actualTime; |
| 34 | /** | 38 | /** |
| 35 | * 原因 | 39 | * 原因 |
| 36 | */ | 40 | */ |
| 37 | private String remark; | 41 | private String remark; |
| 42 | + /** | ||
| 43 | + * 是否酒精测试 | ||
| 44 | + */ | ||
| 45 | + private String alcoholString; | ||
| 38 | } | 46 | } |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ReportErrorResponseVo.java
| @@ -18,7 +18,7 @@ import java.util.Date; | @@ -18,7 +18,7 @@ import java.util.Date; | ||
| 18 | public class ReportErrorResponseVo {; | 18 | public class ReportErrorResponseVo {; |
| 19 | @ApiModelProperty("异常类型") | 19 | @ApiModelProperty("异常类型") |
| 20 | @ExcelProperty(value = "异常类型") | 20 | @ExcelProperty(value = "异常类型") |
| 21 | - private String errorType; | 21 | + private Integer exType; |
| 22 | @ApiModelProperty("姓名") | 22 | @ApiModelProperty("姓名") |
| 23 | @ExcelProperty(value = "姓名") | 23 | @ExcelProperty(value = "姓名") |
| 24 | private String name; | 24 | private String name; |
| @@ -31,14 +31,18 @@ public class ReportErrorResponseVo {; | @@ -31,14 +31,18 @@ public class ReportErrorResponseVo {; | ||
| 31 | @ApiModelProperty("设备id") | 31 | @ApiModelProperty("设备id") |
| 32 | @ExcelProperty(value = "设备id") | 32 | @ExcelProperty(value = "设备id") |
| 33 | private String deviceId; | 33 | private String deviceId; |
| 34 | - @ApiModelProperty("时间") | ||
| 35 | - @ExcelProperty(value = "时间") | 34 | + @ExcelProperty(value = "场地名称") |
| 35 | + private String siteName; | ||
| 36 | + @ApiModelProperty("发生时间") | ||
| 37 | + @ExcelProperty(value = "发生时间") | ||
| 36 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 38 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 37 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") | 39 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") |
| 38 | private Date createTime; | 40 | private Date createTime; |
| 39 | - @ApiModelProperty("备注") | ||
| 40 | - @ExcelProperty(value = "备注") | ||
| 41 | - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 42 | - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") | 41 | + |
| 42 | + @ApiModelProperty("标题") | ||
| 43 | + @ExcelProperty(value = "标题") | ||
| 44 | + private String title; | ||
| 45 | + @ApiModelProperty("详情") | ||
| 46 | + @ExcelProperty(value = "详情") | ||
| 43 | private String remark; | 47 | private String remark; |
| 44 | } | 48 | } |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ReportViewResponseVo.java
| @@ -37,6 +37,7 @@ public class ReportViewResponseVo { | @@ -37,6 +37,7 @@ public class ReportViewResponseVo { | ||
| 37 | @ApiModelProperty("车辆自编号") | 37 | @ApiModelProperty("车辆自编号") |
| 38 | private String lpName; | 38 | private String lpName; |
| 39 | 39 | ||
| 40 | + | ||
| 40 | private Integer planSignInCount; | 41 | private Integer planSignInCount; |
| 41 | private Integer actualSignInCount; | 42 | private Integer actualSignInCount; |
| 42 | private Integer planSignOutCount; | 43 | private Integer planSignOutCount; |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/SignInResponseVo.java
| @@ -24,6 +24,12 @@ public class SignInResponseVo extends SignIn { | @@ -24,6 +24,12 @@ public class SignInResponseVo extends SignIn { | ||
| 24 | @Excel( name = "场地名称") | 24 | @Excel( name = "场地名称") |
| 25 | String siteName; | 25 | String siteName; |
| 26 | 26 | ||
| 27 | + @ExcelIgnore | ||
| 28 | + /** | ||
| 29 | + * 打卡日期 | ||
| 30 | + */ | ||
| 31 | + String date; | ||
| 32 | + | ||
| 27 | public SignInResponseVo(SignIn signIn){ | 33 | public SignInResponseVo(SignIn signIn){ |
| 28 | this.setDeviceId(signIn.getDeviceId()); | 34 | this.setDeviceId(signIn.getDeviceId()); |
| 29 | this.setId(signIn.getId()); | 35 | this.setId(signIn.getId()); |
ruoyi-admin/src/main/java/com/ruoyi/service/ReportService.java
| @@ -10,21 +10,28 @@ import com.ruoyi.in.mapper.SignInMapper; | @@ -10,21 +10,28 @@ import com.ruoyi.in.mapper.SignInMapper; | ||
| 10 | import com.ruoyi.pojo.entity.DriverScheduling; | 10 | import com.ruoyi.pojo.entity.DriverScheduling; |
| 11 | import com.ruoyi.pojo.request.ReportViewRequestVo; | 11 | import com.ruoyi.pojo.request.ReportViewRequestVo; |
| 12 | import com.ruoyi.pojo.request.ReportErrorRequestVo; | 12 | import com.ruoyi.pojo.request.ReportErrorRequestVo; |
| 13 | -import com.ruoyi.pojo.response.ReportDetailResponseVo; | ||
| 14 | -import com.ruoyi.pojo.response.ReportErrorResponseVo; | ||
| 15 | -import com.ruoyi.pojo.response.ReportSignInResponseVo; | ||
| 16 | -import com.ruoyi.pojo.response.ReportViewResponseVo; | 13 | +import com.ruoyi.pojo.response.*; |
| 14 | +import com.ruoyi.utils.ConstDateUtil; | ||
| 15 | +import org.springframework.beans.BeanUtils; | ||
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| 19 | 18 | ||
| 20 | import javax.annotation.Resource; | 19 | import javax.annotation.Resource; |
| 21 | import javax.servlet.http.HttpServletResponse; | 20 | import javax.servlet.http.HttpServletResponse; |
| 21 | +import javax.validation.constraints.NotBlank; | ||
| 22 | import java.text.SimpleDateFormat; | 22 | import java.text.SimpleDateFormat; |
| 23 | +import java.time.LocalDate; | ||
| 24 | +import java.time.YearMonth; | ||
| 25 | +import java.time.format.DateTimeFormatter; | ||
| 23 | import java.util.*; | 26 | import java.util.*; |
| 24 | import java.util.stream.Collectors; | 27 | import java.util.stream.Collectors; |
| 25 | 28 | ||
| 29 | +import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT; | ||
| 30 | +import static com.ruoyi.common.ConstSignInConstSignInProperties.*; | ||
| 26 | import static com.ruoyi.common.ErrorTypeProperties.EQUIPMENT_ERROR; | 31 | import static com.ruoyi.common.ErrorTypeProperties.EQUIPMENT_ERROR; |
| 27 | import static com.ruoyi.common.ErrorTypeProperties.SIGN_IN_ERROR; | 32 | import static com.ruoyi.common.ErrorTypeProperties.SIGN_IN_ERROR; |
| 33 | +import static com.ruoyi.common.ReportProperties.DAY; | ||
| 34 | +import static com.ruoyi.common.ReportProperties.MONTH; | ||
| 28 | 35 | ||
| 29 | /** | 36 | /** |
| 30 | * @author 20412 | 37 | * @author 20412 |
| @@ -51,86 +58,138 @@ public class ReportService { | @@ -51,86 +58,138 @@ public class ReportService { | ||
| 51 | * 查询报表信息 | 58 | * 查询报表信息 |
| 52 | */ | 59 | */ |
| 53 | public List<ReportViewResponseVo> getReportScrollViewTable(ReportViewRequestVo requestVo, HttpServletResponse response) { | 60 | public List<ReportViewResponseVo> getReportScrollViewTable(ReportViewRequestVo requestVo, HttpServletResponse response) { |
| 54 | - List<ReportViewResponseVo> reportScrollViewTable = schedulingService.queryReportTableResponseVo(requestVo,response); | 61 | + List<ReportViewResponseVo> reportScrollViewTable = schedulingService.queryReportTableResponseVo(requestVo, response); |
| 55 | return reportScrollViewTable; | 62 | return reportScrollViewTable; |
| 56 | } | 63 | } |
| 57 | 64 | ||
| 58 | public List<ReportErrorResponseVo> getErrorReportList(ReportErrorRequestVo request) { | 65 | public List<ReportErrorResponseVo> getErrorReportList(ReportErrorRequestVo request) { |
| 59 | - // 获取基础报表信息 | ||
| 60 | - List<SignIn> signInList = signInMapper.getSignErrorList(request); | ||
| 61 | - List<EquipmentException> exceptionList = exceptionMapper.getEquipmentErrorList(request); | ||
| 62 | - // 封装到集合返回前端 | ||
| 63 | - List<ReportErrorResponseVo> responses = new ArrayList<>(); | ||
| 64 | - // 获取对应名称 | ||
| 65 | - Set<String> jobCodes = new HashSet<>(); | ||
| 66 | - signInList.stream().forEach(item -> { | ||
| 67 | - jobCodes.add(item.getJobCode()); | ||
| 68 | - }); | ||
| 69 | - exceptionList.stream().forEach(item -> { | ||
| 70 | - jobCodes.add(item.getJobCode()); | ||
| 71 | - }); | ||
| 72 | - Map<String, String> names = driverMapper.getNameByJobCode(jobCodes).stream().collect(Collectors.toMap(Driver::getJobCode, Driver::getPersonnelName)); | ||
| 73 | - if (SIGN_IN_ERROR.equals(request.getErrorType())) { | ||
| 74 | - copyToResponse(names, signInList, responses); | ||
| 75 | - } else if (EQUIPMENT_ERROR.equals(request.getErrorType())) { | ||
| 76 | - copyToResponseByException(names, exceptionList, responses); | ||
| 77 | - } else { | ||
| 78 | - copyToResponse(names, signInList, responses); | ||
| 79 | - copyToResponseByException(names, exceptionList, responses); | ||
| 80 | - } | ||
| 81 | - responses = sortListByCreateTime(responses); | ||
| 82 | - | ||
| 83 | - // 清除缓存 | ||
| 84 | - jobCodes.clear(); | ||
| 85 | - signInList.clear(); | ||
| 86 | - exceptionList.clear(); | ||
| 87 | - return responses; | 66 | + List<EquipmentExceptionResponseVo> list = exceptionMapper.selectEquipmentExceptionListByVo(request); |
| 67 | + return list.stream().map(item->{ | ||
| 68 | + ReportErrorResponseVo vo = new ReportErrorResponseVo(); | ||
| 69 | + vo.setRemark(item.getRemark()); | ||
| 70 | + vo.setName(item.getPersonnelName()); | ||
| 71 | + vo.setSiteName(item.getSiteName()); | ||
| 72 | + vo.setImage(item.getImage()); | ||
| 73 | + vo.setJobCode(item.getJobCode()); | ||
| 74 | + vo.setDeviceId(item.getDeviceId()); | ||
| 75 | + vo.setExType(item.getExType()); | ||
| 76 | + vo.setCreateTime(item.getCreateTime()); | ||
| 77 | + vo.setTitle(item.getTitle()); | ||
| 78 | + return vo; | ||
| 79 | + }).collect(Collectors.toList()); | ||
| 88 | } | 80 | } |
| 89 | 81 | ||
| 90 | - private List<ReportErrorResponseVo> sortListByCreateTime(List<ReportErrorResponseVo> responses) { | ||
| 91 | - responses = responses.stream().sorted(Comparator.comparing(ReportErrorResponseVo::getCreateTime, Comparator.reverseOrder())).collect(Collectors.toList()); | ||
| 92 | - return responses; | 82 | + |
| 83 | + | ||
| 84 | + public List<ExportReportViewResponseVo> exportReportList(ReportViewRequestVo requestVo, HttpServletResponse response) { | ||
| 85 | + // 处理天 | ||
| 86 | + if (requestVo.getExportFlag().equals(DAY)){ | ||
| 87 | + return getDayReportTableResponseVo(requestVo.getDate(),response); | ||
| 88 | + } | ||
| 89 | + // 处理月 | ||
| 90 | + else if (requestVo.getExportFlag().equals(MONTH)) { | ||
| 91 | + return getMonthReportTableResponseVo(requestVo, response); | ||
| 92 | + } | ||
| 93 | + return null; | ||
| 93 | } | 94 | } |
| 94 | 95 | ||
| 95 | - private void copyToResponseByException(Map<String, String> names, List<EquipmentException> exceptionList, List<ReportErrorResponseVo> responses) { | ||
| 96 | - exceptionList.forEach(item -> { | ||
| 97 | - ReportErrorResponseVo vo = new ReportErrorResponseVo(); | ||
| 98 | - vo.setName(names.get(item.getJobCode())); | ||
| 99 | - vo.setImage(item.getImage()); | ||
| 100 | - vo.setRemark(item.getRemark()); | ||
| 101 | - vo.setCreateTime(item.getCreateTime()); | ||
| 102 | - vo.setDeviceId(item.getDeviceId()); | ||
| 103 | - vo.setErrorType(EQUIPMENT_ERROR); | ||
| 104 | - responses.add(vo); | ||
| 105 | - }); | 96 | + private List<ExportReportViewResponseVo> getDayReportTableResponseVo(String date, HttpServletResponse response) { |
| 97 | + List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, null, null, null); | ||
| 98 | + Map<String,List<DriverScheduling>> resultMap = new HashMap<>(800); | ||
| 99 | + List<ExportReportViewResponseVo> vo = new ArrayList<>(800); | ||
| 100 | + handleResultMap(date,resultMap,schedulingList); | ||
| 101 | + handleResultList(vo,resultMap); | ||
| 102 | + return vo; | ||
| 106 | } | 103 | } |
| 107 | 104 | ||
| 108 | - private void copyToResponse(Map<String, String> names, List<SignIn> signInList, List<ReportErrorResponseVo> responses) { | ||
| 109 | - signInList.forEach(item -> { | ||
| 110 | - ReportErrorResponseVo vo = new ReportErrorResponseVo(); | ||
| 111 | - vo.setName(names.get(item.getJobCode())); | ||
| 112 | - vo.setImage(item.getImage()); | ||
| 113 | - vo.setRemark(item.getRemark()); | ||
| 114 | - vo.setCreateTime(item.getCreateTime()); | ||
| 115 | - vo.setJobCode(item.getJobCode()); | ||
| 116 | -// vo.setDeviceId(); | ||
| 117 | - vo.setErrorType(SIGN_IN_ERROR); | ||
| 118 | - responses.add(vo); | ||
| 119 | - }); | 105 | + private void handleResultList(List<ExportReportViewResponseVo> vo, Map<String, List<DriverScheduling>> resultMap) { |
| 106 | + for (String key : resultMap.keySet()) { | ||
| 107 | + resultMap.get(key).sort(Comparator.comparing(DriverScheduling::getFcsjT)); | ||
| 108 | + vo.add(new ExportReportViewResponseVo(resultMap.get(key)) ); | ||
| 109 | + } | ||
| 120 | } | 110 | } |
| 121 | 111 | ||
| 122 | - public String getDateDay(Date createTime) { | ||
| 123 | - SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 124 | - return simple.format(createTime); | 112 | + private void handleResultMap(@NotBlank String date, Map<String, List<DriverScheduling>> resultMap, List<DriverScheduling> schedulingList) { |
| 113 | + for (DriverScheduling item : schedulingList) { | ||
| 114 | + String key = date + item.getJobCode(); | ||
| 115 | + if (Objects.isNull(resultMap.get(key))){ | ||
| 116 | + resultMap.put(key,new ArrayList<>(Arrays.asList(item))); | ||
| 117 | + }else { | ||
| 118 | + resultMap.get(key).add(item); | ||
| 119 | + } | ||
| 120 | + } | ||
| 125 | } | 121 | } |
| 126 | 122 | ||
| 127 | - public List<ReportViewResponseVo> exportReportList(ReportViewRequestVo requestVo, HttpServletResponse response) { | 123 | + private List<ExportReportViewResponseVo> getMonthReportTableResponseVo(ReportViewRequestVo requestVo, HttpServletResponse response) { |
| 124 | + List<ExportReportViewResponseVo> responseVos = new ArrayList<>(10000); | ||
| 125 | + List<String> days = getNowMonthAllDay(requestVo.getDate()); | ||
| 126 | + for (String day : days) { | ||
| 127 | + List<ExportReportViewResponseVo> dayReportTableResponseVo = getDayReportTableResponseVo(day, response); | ||
| 128 | + responseVos.addAll(dayReportTableResponseVo); | ||
| 129 | + } | ||
| 130 | + return responseVos; | ||
| 131 | + } | ||
| 128 | 132 | ||
| 129 | - return null; | 133 | + private List<String> getNowMonthAllDay(@NotBlank String dateString) { |
| 134 | + // 获取当前年月 | ||
| 135 | + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | ||
| 136 | + LocalDate formatDate = LocalDate.parse(dateString, formatter); | ||
| 137 | + int month = formatDate.getMonthValue(); | ||
| 138 | + int year = formatDate.getYear(); | ||
| 139 | + YearMonth yearMonth = YearMonth.of(year,month); | ||
| 140 | + | ||
| 141 | + // 获取当前月份的第一天和最后一天日期 | ||
| 142 | + LocalDate firstDay = yearMonth.atDay(1); | ||
| 143 | + LocalDate lastDay = yearMonth.atEndOfMonth(); | ||
| 144 | + | ||
| 145 | + // 获取当前月份的所有日期集合 | ||
| 146 | + List<String> datesInMonth = new ArrayList<>(); | ||
| 147 | + LocalDate date = firstDay; | ||
| 148 | + while (!date.isAfter(lastDay)) { | ||
| 149 | + datesInMonth.add(date.toString()); | ||
| 150 | + date = date.plusDays(1); | ||
| 151 | + } | ||
| 152 | + return datesInMonth; | ||
| 130 | } | 153 | } |
| 131 | 154 | ||
| 132 | public List<ReportDetailResponseVo> getReportDetail(ReportViewRequestVo vo, HttpServletResponse response) { | 155 | public List<ReportDetailResponseVo> getReportDetail(ReportViewRequestVo vo, HttpServletResponse response) { |
| 156 | + List<ReportDetailResponseVo> responseVos = new ArrayList<>(); | ||
| 133 | List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName()); | 157 | List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName()); |
| 134 | - return null; | 158 | + for (DriverScheduling scheduling : toDay) { |
| 159 | + ReportDetailResponseVo reportDetailResponseVo = new ReportDetailResponseVo(); | ||
| 160 | + handleReportDetail(reportDetailResponseVo, scheduling); | ||
| 161 | + responseVos.add(reportDetailResponseVo); | ||
| 162 | + } | ||
| 163 | + responseVos.sort(Comparator.comparing(ReportDetailResponseVo::getPlanTime)); | ||
| 164 | + return responseVos; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + private void handleReportDetail(ReportDetailResponseVo reportDetailResponseVo, DriverScheduling scheduling) { | ||
| 168 | + BeanUtils.copyProperties(scheduling, reportDetailResponseVo); | ||
| 169 | + reportDetailResponseVo.setPlanAction(scheduling.getBcType().equals(BC_TYPE_OUT) ? SIGN_IN_STRING : SIGN_IN_OUT_STRING); | ||
| 170 | + reportDetailResponseVo.setPlanTime(scheduling.getBcType().equals(BC_TYPE_OUT) ? new Date(scheduling.getFcsjT()) : new Date(scheduling.getZdsjT())); | ||
| 171 | + reportDetailResponseVo.setExString(SIGN_NO_EX_NUM.equals(scheduling.getExType()) ? NO_EX : HAVE_EX); | ||
| 172 | + | ||
| 173 | + // 设置操作 当前有操作的 | ||
| 174 | + if (!Objects.isNull(scheduling.getSignInId())) { | ||
| 175 | + reportDetailResponseVo.setActualTime(scheduling.getSignTime()); | ||
| 176 | + reportDetailResponseVo.setActualAction(scheduling.getSignType().equals(SIGN_IN) ? SIGN_IN_STRING : SIGN_IN_OUT_STRING); | ||
| 177 | + reportDetailResponseVo.setRemark(scheduling.getRemark()); | ||
| 178 | + reportDetailResponseVo.setAlcoholString(ALCOHOL_FLAG_YES.equals(scheduling.getAlcoholFlag()) ? ALCOHOL_FLAG_YES_STRING : ALCOHOL_FLAG_NO_STRING); | ||
| 179 | + } | ||
| 180 | + // 当前无操作 | ||
| 181 | + else { | ||
| 182 | + reportDetailResponseVo.setRemark(scheduling.getBcType().equals(BC_TYPE_OUT) ? "未签到" : "未签退"); | ||
| 183 | + reportDetailResponseVo.setAlcoholString(ALCOHOL_FLAG_NO_STRING); | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public List<SignInResponseVo> getBigView(ReportViewRequestVo requestVo, HttpServletResponse response) { | ||
| 189 | + SignInResponseVo vo = new SignInResponseVo(); | ||
| 190 | + vo.setDate(requestVo.getDate()); | ||
| 191 | + vo.setJobCode(requestVo.getJobCode()); | ||
| 192 | + List<SignInResponseVo> vos = signInMapper.selectSignInList(vo); | ||
| 193 | + return vos; | ||
| 135 | } | 194 | } |
| 136 | } | 195 | } |
ruoyi-admin/src/main/java/com/ruoyi/service/SchedulingService.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.ruoyi.common.cache.NowSchedulingCache; | ||
| 4 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; | 5 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 5 | import com.ruoyi.in.domain.SignIn; | 6 | import com.ruoyi.in.domain.SignIn; |
| 6 | import com.ruoyi.in.mapper.SignInMapper; | 7 | import com.ruoyi.in.mapper.SignInMapper; |
| @@ -14,6 +15,7 @@ import org.springframework.beans.BeanUtils; | @@ -14,6 +15,7 @@ import org.springframework.beans.BeanUtils; | ||
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
| 16 | 17 | ||
| 18 | +import javax.annotation.Resource; | ||
| 17 | import javax.servlet.http.HttpServletResponse; | 19 | import javax.servlet.http.HttpServletResponse; |
| 18 | import java.time.LocalDate; | 20 | import java.time.LocalDate; |
| 19 | import java.time.LocalDateTime; | 21 | import java.time.LocalDateTime; |
| @@ -34,6 +36,9 @@ import static com.ruoyi.common.ReportProperties.NOW; | @@ -34,6 +36,9 @@ import static com.ruoyi.common.ReportProperties.NOW; | ||
| 34 | @Service | 36 | @Service |
| 35 | public class SchedulingService { | 37 | public class SchedulingService { |
| 36 | 38 | ||
| 39 | + @Resource | ||
| 40 | + private NowSchedulingCache nowSchedulingCache; | ||
| 41 | + | ||
| 37 | @Autowired | 42 | @Autowired |
| 38 | private DriverSchedulingMapper schedulingMapper; | 43 | private DriverSchedulingMapper schedulingMapper; |
| 39 | 44 | ||
| @@ -48,10 +53,9 @@ public class SchedulingService { | @@ -48,10 +53,9 @@ public class SchedulingService { | ||
| 48 | * @return | 53 | * @return |
| 49 | */ | 54 | */ |
| 50 | public List<DriverScheduling> queryScheduling(String jobCode, Long now) { | 55 | public List<DriverScheduling> queryScheduling(String jobCode, Long now) { |
| 51 | - // TODO 查表变成缓存查询 | ||
| 52 | List<DriverScheduling> dto = null; | 56 | List<DriverScheduling> dto = null; |
| 53 | for (int i = 0; i > -2; i--) { | 57 | for (int i = 0; i > -2; i--) { |
| 54 | - dto = schedulingMapper.queryToDay(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i)), null, jobCode, null); | 58 | + dto = nowSchedulingCache.getCacheSchedulingMapValueByHKey(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i)),jobCode); |
| 55 | if (!CollectionUtil.isEmpty(dto)) { | 59 | if (!CollectionUtil.isEmpty(dto)) { |
| 56 | dto.sort(Comparator.comparing(DriverScheduling::getZdsjT)); | 60 | dto.sort(Comparator.comparing(DriverScheduling::getZdsjT)); |
| 57 | if (i == -1) { | 61 | if (i == -1) { |
| @@ -69,6 +73,7 @@ public class SchedulingService { | @@ -69,6 +73,7 @@ public class SchedulingService { | ||
| 69 | return dto; | 73 | return dto; |
| 70 | } | 74 | } |
| 71 | 75 | ||
| 76 | + | ||
| 72 | /** | 77 | /** |
| 73 | * 计算签到逻辑 | 78 | * 计算签到逻辑 |
| 74 | * | 79 | * |
| @@ -105,14 +110,19 @@ public class SchedulingService { | @@ -105,14 +110,19 @@ public class SchedulingService { | ||
| 105 | * @param globalIndex | 110 | * @param globalIndex |
| 106 | */ | 111 | */ |
| 107 | public void computedSignInBySignIn(List<DriverScheduling> dto, SignIn signIn, GlobalIndex globalIndex) { | 112 | public void computedSignInBySignIn(List<DriverScheduling> dto, SignIn signIn, GlobalIndex globalIndex) { |
| 113 | + // 无排班不记录不在考勤表不更新 | ||
| 114 | + if (CollectionUtil.isEmpty(dto)) { | ||
| 115 | + return; | ||
| 116 | + } | ||
| 117 | + | ||
| 108 | // 更新最新的签到记录判断是否需要更新考勤 | 118 | // 更新最新的签到记录判断是否需要更新考勤 |
| 109 | // 记录为空直接插入记录 | 119 | // 记录为空直接插入记录 |
| 110 | if (Objects.isNull(dto.get(globalIndex.getIndex()).getSignInId())) { | 120 | if (Objects.isNull(dto.get(globalIndex.getIndex()).getSignInId())) { |
| 111 | - schedulingMapper.updateRoster(dto.get(globalIndex.getIndex()), signIn.getId(), signIn.getExType()); | 121 | + schedulingMapper.updateRoster(dto.get(globalIndex.getIndex()), signIn.getId(), signIn.getExType(), signIn.getCreateTime(), signIn.getRemark(), signIn.getType(), signIn.getAlcoholFlag(), signIn.getAlcoholIntake()); |
| 112 | } | 122 | } |
| 113 | // 之前的无效 | 123 | // 之前的无效 |
| 114 | else if (!dto.get(globalIndex.getIndex()).getExType().equals(SIGN_NO_EX_NUM)) { | 124 | else if (!dto.get(globalIndex.getIndex()).getExType().equals(SIGN_NO_EX_NUM)) { |
| 115 | - schedulingMapper.updateRoster(dto.get(globalIndex.getIndex()), signIn.getId(), signIn.getExType()); | 125 | + schedulingMapper.updateRoster(dto.get(globalIndex.getIndex()), signIn.getId(), signIn.getExType(), signIn.getCreateTime(), signIn.getRemark(), signIn.getType(), signIn.getAlcoholFlag(), signIn.getAlcoholIntake()); |
| 116 | } | 126 | } |
| 117 | // 之前的有效 | 127 | // 之前的有效 |
| 118 | else { | 128 | else { |
| @@ -134,9 +144,8 @@ public class SchedulingService { | @@ -134,9 +144,8 @@ public class SchedulingService { | ||
| 134 | signIn.setRemark(signIn.getRemark().replaceFirst(",$", "。")); | 144 | signIn.setRemark(signIn.getRemark().replaceFirst(",$", "。")); |
| 135 | signInMapper.updateSignIn(signIn); | 145 | signInMapper.updateSignIn(signIn); |
| 136 | } | 146 | } |
| 137 | - | ||
| 138 | // 之前是签到 | 目前无效 -》往后更新 | 147 | // 之前是签到 | 目前无效 -》往后更新 |
| 139 | - schedulingMapper.updateRoster(dto.get(globalIndex.getIndex() + 1), signIn.getId(), signIn.getExType()); | 148 | + schedulingMapper.updateRoster(dto.get(globalIndex.getIndex() + 1), signIn.getId(), signIn.getExType(), signIn.getCreateTime(), signIn.getRemark(), signIn.getType(), signIn.getAlcoholFlag(), signIn.getAlcoholIntake()); |
| 140 | } | 149 | } |
| 141 | 150 | ||
| 142 | public List<ReportViewResponseVo> queryReportTableResponseVo(ReportViewRequestVo requestVo, HttpServletResponse response) { | 151 | public List<ReportViewResponseVo> queryReportTableResponseVo(ReportViewRequestVo requestVo, HttpServletResponse response) { |
ruoyi-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| @@ -3,6 +3,7 @@ package com.ruoyi.service; | @@ -3,6 +3,7 @@ package com.ruoyi.service; | ||
| 3 | 3 | ||
| 4 | import cn.hutool.core.collection.CollectionUtil; | 4 | import cn.hutool.core.collection.CollectionUtil; |
| 5 | import cn.hutool.http.HttpUtil; | 5 | import cn.hutool.http.HttpUtil; |
| 6 | +import com.ruoyi.common.cache.NowSchedulingCache; | ||
| 6 | import com.ruoyi.common.config.RuoYiConfig; | 7 | import com.ruoyi.common.config.RuoYiConfig; |
| 7 | import com.ruoyi.common.exception.file.FileUploadException; | 8 | import com.ruoyi.common.exception.file.FileUploadException; |
| 8 | import com.ruoyi.common.utils.StringUtils; | 9 | import com.ruoyi.common.utils.StringUtils; |
| @@ -10,6 +11,9 @@ import com.ruoyi.common.utils.file.FileUploadUtils; | @@ -10,6 +11,9 @@ import com.ruoyi.common.utils.file.FileUploadUtils; | ||
| 10 | import com.ruoyi.driver.domain.Driver; | 11 | import com.ruoyi.driver.domain.Driver; |
| 11 | import com.ruoyi.driver.mapper.DriverMapper; | 12 | import com.ruoyi.driver.mapper.DriverMapper; |
| 12 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; | 13 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 14 | +import com.ruoyi.eexception.domain.EquipmentException; | ||
| 15 | +import com.ruoyi.eexception.mapper.EquipmentExceptionMapper; | ||
| 16 | +import com.ruoyi.in.domain.SignIn; | ||
| 13 | import com.ruoyi.job.DriverJob; | 17 | import com.ruoyi.job.DriverJob; |
| 14 | import com.ruoyi.pojo.entity.DriverScheduling; | 18 | import com.ruoyi.pojo.entity.DriverScheduling; |
| 15 | import com.ruoyi.pojo.response.ResponseSchedulingDto; | 19 | import com.ruoyi.pojo.response.ResponseSchedulingDto; |
| @@ -29,12 +33,15 @@ import org.springframework.transaction.support.DefaultTransactionDefinition; | @@ -29,12 +33,15 @@ import org.springframework.transaction.support.DefaultTransactionDefinition; | ||
| 29 | import org.springframework.web.client.RestTemplate; | 33 | import org.springframework.web.client.RestTemplate; |
| 30 | import sun.misc.BASE64Decoder; | 34 | import sun.misc.BASE64Decoder; |
| 31 | 35 | ||
| 36 | +import javax.annotation.Resource; | ||
| 32 | import java.io.*; | 37 | import java.io.*; |
| 33 | import java.util.*; | 38 | import java.util.*; |
| 34 | import java.util.stream.Collectors; | 39 | import java.util.stream.Collectors; |
| 35 | 40 | ||
| 36 | import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_IN; | 41 | import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_IN; |
| 37 | import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT; | 42 | import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT; |
| 43 | +import static com.ruoyi.common.ConstEquipmentProperties.*; | ||
| 44 | +import static com.ruoyi.common.ConstSignInConstSignInProperties.SIGN_NO_EX_NUM; | ||
| 38 | 45 | ||
| 39 | 46 | ||
| 40 | /** | 47 | /** |
| @@ -53,10 +60,16 @@ public class ThreadJobService { | @@ -53,10 +60,16 @@ public class ThreadJobService { | ||
| 53 | @Autowired | 60 | @Autowired |
| 54 | private DriverSchedulingMapper schedulingMapper; | 61 | private DriverSchedulingMapper schedulingMapper; |
| 55 | 62 | ||
| 63 | + @Resource | ||
| 64 | + private NowSchedulingCache nowSchedulingCache; | ||
| 65 | + | ||
| 56 | 66 | ||
| 57 | @Autowired | 67 | @Autowired |
| 58 | private PlatformTransactionManager transactionManager; | 68 | private PlatformTransactionManager transactionManager; |
| 59 | 69 | ||
| 70 | + @Autowired | ||
| 71 | + private EquipmentExceptionMapper exceptionMapper; | ||
| 72 | + | ||
| 60 | @Value("${api.headImage}") | 73 | @Value("${api.headImage}") |
| 61 | private String headImagePre; | 74 | private String headImagePre; |
| 62 | 75 | ||
| @@ -115,6 +128,22 @@ public class ThreadJobService { | @@ -115,6 +128,22 @@ public class ThreadJobService { | ||
| 115 | } | 128 | } |
| 116 | 129 | ||
| 117 | @Async | 130 | @Async |
| 131 | + public void asyncInsertExceptionRecord(SignIn signIn){ | ||
| 132 | + if (!SIGN_NO_EX_NUM.equals(signIn.getExType())){ | ||
| 133 | + EquipmentException exception = new EquipmentException(); | ||
| 134 | + exception.setExType(signIn.getExType()); | ||
| 135 | + exception.setDeviceId(signIn.getDeviceId()); | ||
| 136 | + exception.setJobCode(signIn.getJobCode()); | ||
| 137 | + exception.setStatus(EQUIPMENT_PROCESS_FLOW_COMMIT); | ||
| 138 | + exception.setImage(signIn.getImage()); | ||
| 139 | + exception.setTitle("打卡异常"); | ||
| 140 | + exception.setRemark(signIn.getRemark()); | ||
| 141 | + exception.setCreateTime(signIn.getCreateTime()); | ||
| 142 | + exceptionMapper.insertEquipmentException(exception); | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + @Async | ||
| 118 | public void asyncUploadDriverWithUpdateImageUrl(List<Driver> drivers, String token) { | 147 | public void asyncUploadDriverWithUpdateImageUrl(List<Driver> drivers, String token) { |
| 119 | // 插入数据 | 148 | // 插入数据 |
| 120 | for (Driver driver : drivers) { | 149 | for (Driver driver : drivers) { |
| @@ -254,10 +283,18 @@ public class ThreadJobService { | @@ -254,10 +283,18 @@ public class ThreadJobService { | ||
| 254 | public void asyncComputedScheduling(Map<String, List<ResponseSchedulingDto>> originSchedulingMap) { | 283 | public void asyncComputedScheduling(Map<String, List<ResponseSchedulingDto>> originSchedulingMap) { |
| 255 | //查询当天是否保存过考情表 如果存在则保存 | 284 | //查询当天是否保存过考情表 如果存在则保存 |
| 256 | List<DriverScheduling> dto = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd"), null,null,null); | 285 | List<DriverScheduling> dto = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd"), null,null,null); |
| 286 | + // 存入缓存 | ||
| 257 | if (!CollectionUtil.isEmpty(dto) || originSchedulingMap.size() == 0) { | 287 | if (!CollectionUtil.isEmpty(dto) || originSchedulingMap.size() == 0) { |
| 258 | -// log.info("今天已获取过考勤数据"); | 288 | + String date = ConstDateUtil.formatDate(new Date()); |
| 289 | + if (CollectionUtil.isEmpty(nowSchedulingCache.getCacheScheduling(date))){ | ||
| 290 | + Map<String, List<DriverScheduling>> resultMap =new HashMap<>(800); | ||
| 291 | + handleResultMap(resultMap,dto); | ||
| 292 | + nowSchedulingCache.setCacheScheduling(date,resultMap); | ||
| 293 | + } | ||
| 259 | return; | 294 | return; |
| 260 | } | 295 | } |
| 296 | + | ||
| 297 | + | ||
| 261 | List<DriverScheduling> bcList = new ArrayList<>(1000); | 298 | List<DriverScheduling> bcList = new ArrayList<>(1000); |
| 262 | for (String key : originSchedulingMap.keySet()) { | 299 | for (String key : originSchedulingMap.keySet()) { |
| 263 | List<ResponseSchedulingDto> schedulingList = originSchedulingMap.get(key); | 300 | List<ResponseSchedulingDto> schedulingList = originSchedulingMap.get(key); |
| @@ -279,4 +316,15 @@ public class ThreadJobService { | @@ -279,4 +316,15 @@ public class ThreadJobService { | ||
| 279 | schedulingMapper.insertRoster(bcList); | 316 | schedulingMapper.insertRoster(bcList); |
| 280 | } | 317 | } |
| 281 | 318 | ||
| 319 | + private void handleResultMap(Map<String, List<DriverScheduling>> resultMap, List<DriverScheduling> schedulingList) { | ||
| 320 | + for (DriverScheduling scheduling : schedulingList) { | ||
| 321 | + List<DriverScheduling> list = resultMap.get(scheduling.getJobCode()); | ||
| 322 | + if (CollectionUtil.isEmpty(list)){ | ||
| 323 | + resultMap.put(scheduling.getJobCode(),new ArrayList<>(Arrays.asList(scheduling))); | ||
| 324 | + }else { | ||
| 325 | + list.add(scheduling); | ||
| 326 | + } | ||
| 327 | + } | ||
| 328 | + } | ||
| 329 | + | ||
| 282 | } | 330 | } |
ruoyi-admin/src/main/java/com/ruoyi/utils/ConstDateUtil.java
| 1 | package com.ruoyi.utils; | 1 | package com.ruoyi.utils; |
| 2 | 2 | ||
| 3 | +import java.text.ParseException; | ||
| 3 | import java.text.SimpleDateFormat; | 4 | import java.text.SimpleDateFormat; |
| 4 | import java.time.Instant; | 5 | import java.time.Instant; |
| 5 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| @@ -21,6 +22,7 @@ public class ConstDateUtil { | @@ -21,6 +22,7 @@ public class ConstDateUtil { | ||
| 21 | return simpleDateFormat.format(date); | 22 | return simpleDateFormat.format(date); |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 25 | + | ||
| 24 | public static Date getTheSpecifiedNumberOfDaysOfTime(Integer amount) { | 26 | public static Date getTheSpecifiedNumberOfDaysOfTime(Integer amount) { |
| 25 | // 获取当前日期时间 | 27 | // 获取当前日期时间 |
| 26 | Calendar calendar = Calendar.getInstance(); | 28 | Calendar calendar = Calendar.getInstance(); |
ruoyi-admin/src/main/resources/mapper/driver_scheduling/DriverSchedulingMapper.xml
| @@ -19,7 +19,9 @@ | @@ -19,7 +19,9 @@ | ||
| 19 | <result column="zdsj_t" property="zdsjT" jdbcType="BIGINT"/> | 19 | <result column="zdsj_t" property="zdsjT" jdbcType="BIGINT"/> |
| 20 | <result column="sign_in_id" property="signInId" jdbcType="BIGINT"/> | 20 | <result column="sign_in_id" property="signInId" jdbcType="BIGINT"/> |
| 21 | <result column="ex_type" property="exType" jdbcType="TINYINT"/> | 21 | <result column="ex_type" property="exType" jdbcType="TINYINT"/> |
| 22 | - | 22 | + <result column="sign_time" property="signTime" jdbcType="DATETIMEOFFSET"/> |
| 23 | + <result column="alcohol_flag" property="alcoholFlag" jdbcType="DATETIMEOFFSET"/> | ||
| 24 | + <result column="alcohol_intake" property="alcoholIntake"/> | ||
| 23 | </resultMap> | 25 | </resultMap> |
| 24 | <insert id="insertRoster" useGeneratedKeys="true" keyProperty="id"> | 26 | <insert id="insertRoster" useGeneratedKeys="true" keyProperty="id"> |
| 25 | insert into scheduling (schedule_date,line_name,job_code,`name`,posts,lp_name,nbbm,bc_type,fcsj_t,zdsj_t) | 27 | insert into scheduling (schedule_date,line_name,job_code,`name`,posts,lp_name,nbbm,bc_type,fcsj_t,zdsj_t) |
| @@ -45,22 +47,27 @@ | @@ -45,22 +47,27 @@ | ||
| 45 | <update id="updateRoster"> | 47 | <update id="updateRoster"> |
| 46 | update scheduling | 48 | update scheduling |
| 47 | set sign_in_id = #{signInId}, | 49 | set sign_in_id = #{signInId}, |
| 48 | - ex_type = #{exType} | 50 | + ex_type = #{exType}, |
| 51 | + sign_time = #{signTime}, | ||
| 52 | + remark = #{remark}, | ||
| 53 | + sign_type = #{signType}, | ||
| 54 | + alcohol_flag = #{alcoholFlag}, | ||
| 55 | + alcohol_intake = #{alcoholIntake} | ||
| 49 | where id = #{scheduling.id} | 56 | where id = #{scheduling.id} |
| 50 | </update> | 57 | </update> |
| 51 | 58 | ||
| 52 | <select id="queryToDay" resultType="com.ruoyi.pojo.entity.DriverScheduling" resultMap="Scheduling"> | 59 | <select id="queryToDay" resultType="com.ruoyi.pojo.entity.DriverScheduling" resultMap="Scheduling"> |
| 53 | - select * from | ||
| 54 | - scheduling | 60 | + select scheduling.*,driver.fleet_name fleetName from |
| 61 | + scheduling join driver on driver.job_code = scheduling.job_code | ||
| 55 | where schedule_date = #{date} | 62 | where schedule_date = #{date} |
| 56 | <if test="jobCode !=null and jobCode != ''"> | 63 | <if test="jobCode !=null and jobCode != ''"> |
| 57 | - and job_code = #{jobCode} | 64 | + and driver.job_code = #{jobCode} |
| 58 | </if> | 65 | </if> |
| 59 | <if test="name !=null and name != ''"> | 66 | <if test="name !=null and name != ''"> |
| 60 | and `name` = #{name} | 67 | and `name` = #{name} |
| 61 | </if> | 68 | </if> |
| 62 | <if test="lineName !=null and lineName != ''"> | 69 | <if test="lineName !=null and lineName != ''"> |
| 63 | - and line_name = #{lineName} | 70 | + and scheduling.line_name like concat('%', #{lineName}, '%') |
| 64 | </if> | 71 | </if> |
| 65 | 72 | ||
| 66 | </select> | 73 | </select> |
ruoyi-admin/src/main/resources/mapper/eexception/EquipmentExceptionMapper.xml
| @@ -4,6 +4,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -4,6 +4,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 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"> | ||
| 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 | + </resultMap> | ||
| 7 | <resultMap type="EquipmentException" id="EquipmentExceptionResult"> | 20 | <resultMap type="EquipmentException" id="EquipmentExceptionResult"> |
| 8 | <result property="id" column="id" /> | 21 | <result property="id" column="id" /> |
| 9 | <result property="title" column="title" /> | 22 | <result property="title" column="title" /> |
| @@ -13,19 +26,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -13,19 +26,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 13 | <result property="status" column="status" /> | 26 | <result property="status" column="status" /> |
| 14 | <result property="createTime" column="create_time" /> | 27 | <result property="createTime" column="create_time" /> |
| 15 | <result property="remark" column="remark" /> | 28 | <result property="remark" column="remark" /> |
| 29 | + <result property="exType" column="ex_type" /> | ||
| 16 | </resultMap> | 30 | </resultMap> |
| 17 | 31 | ||
| 18 | <sql id="selectEquipmentExceptionVo"> | 32 | <sql id="selectEquipmentExceptionVo"> |
| 19 | - select id, title, device_id, job_code, image, status, create_time, remark from equipment_exception | 33 | + select id, title, device_id, job_code, image, status, create_time, remark,ex_type from equipment_exception |
| 20 | </sql> | 34 | </sql> |
| 21 | 35 | ||
| 22 | - <select id="selectEquipmentExceptionList" parameterType="EquipmentException" resultMap="EquipmentExceptionResult"> | ||
| 23 | - <include refid="selectEquipmentExceptionVo"/> | ||
| 24 | - <where> | 36 | + <select id="selectEquipmentExceptionList" parameterType="com.ruoyi.pojo.response.EquipmentExceptionResponseVo" resultMap="EquipmentExceptionResponseResult"> |
| 37 | + select equipment_exception.id, title, equipment.site_name , equipment_exception.device_id,driver.personnel_name,driver.job_code, equipment_exception.image, equipment_exception.status, equipment_exception.create_time, equipment_exception.ex_type,equipment_exception.remark | ||
| 38 | + from | ||
| 39 | + equipment_exception join driver on driver.job_code = equipment_exception.job_code join equipment on equipment.device_id = equipment_exception.device_id | ||
| 40 | + <where> | ||
| 41 | + ex_type = 4 | ||
| 25 | <if test="title != null and title != ''"> and title = #{title}</if> | 42 | <if test="title != null and title != ''"> and title = #{title}</if> |
| 26 | <if test="deviceId != null "> and device_id = #{deviceId}</if> | 43 | <if test="deviceId != null "> and device_id = #{deviceId}</if> |
| 27 | - <if test="jobCode != null and jobCode != ''"> and job_code = #{jobCode}</if> | ||
| 28 | - <if test="image != null and image != ''"> and image = #{image}</if> | 44 | + <if test="jobCode != null and jobCode != ''"> and driver.job_code = #{jobCode}</if> |
| 29 | <if test="status != null "> and status = #{status}</if> | 45 | <if test="status != null "> and status = #{status}</if> |
| 30 | </where> | 46 | </where> |
| 31 | order by id desc | 47 | order by id desc |
| @@ -46,6 +62,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -46,6 +62,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 46 | and job_code = #{jobCode} | 62 | and job_code = #{jobCode} |
| 47 | </if> | 63 | </if> |
| 48 | </select> | 64 | </select> |
| 65 | + <select id="selectEquipmentExceptionListByVo" | ||
| 66 | + resultType="com.ruoyi.pojo.response.EquipmentExceptionResponseVo" resultMap="EquipmentExceptionResponseResult"> | ||
| 67 | + | ||
| 68 | + select equipment_exception.id, title, equipment.site_name , equipment_exception.device_id,driver.personnel_name,driver.job_code, equipment_exception.image, equipment_exception.status, equipment_exception.create_time, equipment_exception.ex_type,equipment_exception.remark | ||
| 69 | + from | ||
| 70 | + equipment_exception join driver on driver.job_code = equipment_exception.job_code join equipment on equipment.device_id = equipment_exception.device_id | ||
| 71 | + <where> | ||
| 72 | + equipment_exception.`status` != 1 | ||
| 73 | + <if test="siteName != null and siteName != ''"> and equipment.site_name = #{siteName}</if> | ||
| 74 | + <if test="jobCode != null and jobCode != ''"> and driver.job_code = #{jobCode}</if> | ||
| 75 | + <if test="exType != null "> and ex_type = #{exType}</if> | ||
| 76 | + <if test="id != null "> and equipment_exception.id #{id}</if> | ||
| 77 | + <if test="date != null "> and equipment_exception.create_time like concat(#{date},'%')</if> | ||
| 78 | + </where> | ||
| 79 | + </select> | ||
| 80 | + <select id="selectEquipmentExceptionByDeviceIdStatus" | ||
| 81 | + resultType="com.ruoyi.eexception.domain.EquipmentException"> | ||
| 82 | + select id from equipment_exception where device_id = #{deviceId} and ex_type = 4 and `status` != 1 limit 1 | ||
| 83 | + </select> | ||
| 49 | 84 | ||
| 50 | <insert id="insertEquipmentException" parameterType="EquipmentException" useGeneratedKeys="true" keyProperty="id"> | 85 | <insert id="insertEquipmentException" parameterType="EquipmentException" useGeneratedKeys="true" keyProperty="id"> |
| 51 | insert into equipment_exception | 86 | insert into equipment_exception |
| @@ -57,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -57,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 57 | <if test="status != null">status,</if> | 92 | <if test="status != null">status,</if> |
| 58 | <if test="createTime != null">create_time,</if> | 93 | <if test="createTime != null">create_time,</if> |
| 59 | <if test="remark != null and remark != ''">remark,</if> | 94 | <if test="remark != null and remark != ''">remark,</if> |
| 95 | + <if test="exType != null and exType != ''">ex_type,</if> | ||
| 60 | </trim> | 96 | </trim> |
| 61 | <trim prefix="values (" suffix=")" suffixOverrides=","> | 97 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 62 | <if test="title != null">#{title},</if> | 98 | <if test="title != null">#{title},</if> |
| @@ -66,6 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -66,6 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 66 | <if test="status != null">#{status},</if> | 102 | <if test="status != null">#{status},</if> |
| 67 | <if test="createTime != null">#{createTime},</if> | 103 | <if test="createTime != null">#{createTime},</if> |
| 68 | <if test="remark != null and remark != ''">#{remark},</if> | 104 | <if test="remark != null and remark != ''">#{remark},</if> |
| 105 | + <if test="exType != null and exType != ''">#{exType},</if> | ||
| 69 | </trim> | 106 | </trim> |
| 70 | </insert> | 107 | </insert> |
| 71 | 108 |
ruoyi-admin/src/main/resources/mapper/equipment/EquipmentMapper.xml
| @@ -130,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -130,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 130 | <if test="id !=null"> | 130 | <if test="id !=null"> |
| 131 | and id = #{id} | 131 | and id = #{id} |
| 132 | </if> | 132 | </if> |
| 133 | - <if test="device_id !=null and id == null"> | 133 | + <if test="deviceId !=null and id == null"> |
| 134 | and device_id = #{deviceId} | 134 | and device_id = #{deviceId} |
| 135 | </if> | 135 | </if> |
| 136 | </update> | 136 | </update> |
ruoyi-admin/src/main/resources/mapper/global_exception/GlobalExceptionMapper.xml deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8" ?> | ||
| 2 | -<!DOCTYPE mapper | ||
| 3 | -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 4 | -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 5 | -<mapper namespace="com.ruoyi.global_exception.mapper.GlobalExceptionMapper"> | ||
| 6 | - | ||
| 7 | - <resultMap type="GlobalException" id="GlobalExceptionResult"> | ||
| 8 | - <result property="id" column="id" /> | ||
| 9 | - <result property="jobCode" column="job_code" /> | ||
| 10 | - <result property="deviceId" column="device_id" /> | ||
| 11 | - <result property="type" column="type" /> | ||
| 12 | - <result property="remark" column="remark" /> | ||
| 13 | - <result property="handle" column="handle" /> | ||
| 14 | - <result property="createTime" column="create_time" /> | ||
| 15 | - <result property="updateTime" column="update_time" /> | ||
| 16 | - </resultMap> | ||
| 17 | - | ||
| 18 | - <sql id="selectGlobalExceptionVo"> | ||
| 19 | - select id, job_code, device_id, type, remark, handle, create_time, update_time from global_exception | ||
| 20 | - </sql> | ||
| 21 | - | ||
| 22 | - <select id="selectGlobalExceptionList" parameterType="GlobalException" resultMap="GlobalExceptionResult"> | ||
| 23 | - <include refid="selectGlobalExceptionVo"/> | ||
| 24 | - <where> | ||
| 25 | - <if test="jobCode != null and jobCode != ''"> and job_code = #{jobCode}</if> | ||
| 26 | - <if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if> | ||
| 27 | - <if test="type != null "> and type = #{type}</if> | ||
| 28 | - <if test="handle != null "> and handle = #{handle}</if> | ||
| 29 | - </where> | ||
| 30 | - </select> | ||
| 31 | - | ||
| 32 | - <select id="selectGlobalExceptionById" parameterType="Long" resultMap="GlobalExceptionResult"> | ||
| 33 | - <include refid="selectGlobalExceptionVo"/> | ||
| 34 | - where id = #{id} | ||
| 35 | - </select> | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - <insert id="insertGlobalException" parameterType="GlobalException"> | ||
| 39 | - insert into global_exception | ||
| 40 | - <trim prefix="(" suffix=")" suffixOverrides=","> | ||
| 41 | - <if test="id != null">id,</if> | ||
| 42 | - <if test="jobCode != null">job_code,</if> | ||
| 43 | - <if test="deviceId != null">device_id,</if> | ||
| 44 | - <if test="type != null">type,</if> | ||
| 45 | - <if test="remark != null">remark,</if> | ||
| 46 | - <if test="handle != null">handle,</if> | ||
| 47 | - <if test="createTime != null">create_time,</if> | ||
| 48 | - <if test="updateTime != null">update_time,</if> | ||
| 49 | - </trim> | ||
| 50 | - <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
| 51 | - <if test="id != null">#{id},</if> | ||
| 52 | - <if test="jobCode != null">#{jobCode},</if> | ||
| 53 | - <if test="deviceId != null">#{deviceId},</if> | ||
| 54 | - <if test="type != null">#{type},</if> | ||
| 55 | - <if test="remark != null">#{remark},</if> | ||
| 56 | - <if test="handle != null">#{handle},</if> | ||
| 57 | - <if test="createTime != null">#{createTime},</if> | ||
| 58 | - <if test="updateTime != null">#{updateTime},</if> | ||
| 59 | - </trim> | ||
| 60 | - </insert> | ||
| 61 | - | ||
| 62 | - <update id="updateGlobalException" parameterType="GlobalException"> | ||
| 63 | - update global_exception | ||
| 64 | - <trim prefix="SET" suffixOverrides=","> | ||
| 65 | - <if test="jobCode != null">job_code = #{jobCode},</if> | ||
| 66 | - <if test="deviceId != null">device_id = #{deviceId},</if> | ||
| 67 | - <if test="type != null">type = #{type},</if> | ||
| 68 | - <if test="remark != null">remark = #{remark},</if> | ||
| 69 | - <if test="handle != null">handle = #{handle},</if> | ||
| 70 | - <if test="createTime != null">create_time = #{createTime},</if> | ||
| 71 | - <if test="updateTime != null">update_time = #{updateTime},</if> | ||
| 72 | - </trim> | ||
| 73 | - where id = #{id} | ||
| 74 | - </update> | ||
| 75 | - | ||
| 76 | - <delete id="deleteGlobalExceptionById" parameterType="Long"> | ||
| 77 | - delete from global_exception where id = #{id} | ||
| 78 | - </delete> | ||
| 79 | - | ||
| 80 | - <delete id="deleteGlobalExceptionByIds" parameterType="String"> | ||
| 81 | - delete from global_exception where id in | ||
| 82 | - <foreach item="id" collection="array" open="(" separator="," close=")"> | ||
| 83 | - #{id} | ||
| 84 | - </foreach> | ||
| 85 | - </delete> | ||
| 86 | -</mapper> | ||
| 87 | \ No newline at end of file | 0 | \ No newline at end of file |
ruoyi-admin/src/main/resources/mapper/in/SignInMapper.xml
| @@ -50,12 +50,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -50,12 +50,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 50 | <if test="jobCode != null and jobCode != ''"> and jobCode = #{jobCode}</if> | 50 | <if test="jobCode != null and jobCode != ''"> and jobCode = #{jobCode}</if> |
| 51 | <if test="ip != null and ip != ''"> and ip = #{ip}</if> | 51 | <if test="ip != null and ip != ''"> and ip = #{ip}</if> |
| 52 | <if test="image != null and image != ''"> and image = #{image}</if> | 52 | <if test="image != null and image != ''"> and image = #{image}</if> |
| 53 | - <if test="status != null "> and status = #{status}</if> | 53 | + <if test="status != null "> and sign_in.status = #{status}</if> |
| 54 | <if test="singnIn != null and singnIn != ''"> and singn_in = #{singnIn}</if> | 54 | <if test="singnIn != null and singnIn != ''"> and singn_in = #{singnIn}</if> |
| 55 | <if test="alcoholFlag != null "> and alcohol_flag = #{alcoholFlag}</if> | 55 | <if test="alcoholFlag != null "> and alcohol_flag = #{alcoholFlag}</if> |
| 56 | <if test="type != null "> and type = #{type}</if> | 56 | <if test="type != null "> and type = #{type}</if> |
| 57 | <if test="alcoholIntake != null "> and alcohol_intake = #{alcoholIntake}</if> | 57 | <if test="alcoholIntake != null "> and alcohol_intake = #{alcoholIntake}</if> |
| 58 | <if test="siteName != null "> and site_name = #{siteName}</if> | 58 | <if test="siteName != null "> and site_name = #{siteName}</if> |
| 59 | + <if test="date != null "> and sign_in.create_time LIKE concat(#{date},'%')</if> | ||
| 59 | order by create_time desc | 60 | order by create_time desc |
| 60 | </select> | 61 | </select> |
| 61 | 62 |
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
| @@ -24,6 +24,11 @@ import java.util.Set; | @@ -24,6 +24,11 @@ import java.util.Set; | ||
| 24 | import java.util.UUID; | 24 | import java.util.UUID; |
| 25 | import java.util.stream.Collectors; | 25 | import java.util.stream.Collectors; |
| 26 | import javax.servlet.http.HttpServletResponse; | 26 | import javax.servlet.http.HttpServletResponse; |
| 27 | + | ||
| 28 | +import com.alibaba.excel.write.metadata.WriteSheet; | ||
| 29 | +import com.alibaba.excel.write.metadata.style.WriteCellStyle; | ||
| 30 | +import com.alibaba.excel.write.metadata.style.WriteFont; | ||
| 31 | +import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; | ||
| 27 | import org.apache.commons.lang3.ArrayUtils; | 32 | import org.apache.commons.lang3.ArrayUtils; |
| 28 | import org.apache.commons.lang3.RegExUtils; | 33 | import org.apache.commons.lang3.RegExUtils; |
| 29 | import org.apache.commons.lang3.reflect.FieldUtils; | 34 | import org.apache.commons.lang3.reflect.FieldUtils; |