Commit 6bc0472553f3e752bf84796e84b9c0ceff262fdc
1 parent
b6f145b7
设备号
Showing
19 changed files
with
362 additions
and
55 deletions
Bsth-admin/src/main/java/com/ruoyi/common/cache/SchedulingCache.java
| ... | ... | @@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 12 | 12 | import org.springframework.core.ParameterizedTypeReference; |
| 13 | 13 | import org.springframework.data.redis.core.RedisTemplate; |
| 14 | 14 | import org.springframework.http.HttpMethod; |
| 15 | +import org.springframework.http.client.SimpleClientHttpRequestFactory; | |
| 15 | 16 | import org.springframework.stereotype.Component; |
| 16 | 17 | import org.springframework.web.client.RestTemplate; |
| 17 | 18 | |
| ... | ... | @@ -176,22 +177,33 @@ public class SchedulingCache { |
| 176 | 177 | } |
| 177 | 178 | |
| 178 | 179 | public List<ResponseSchedulingDto> requestScheduling(String getSchedulingInfoUrl, RedisCache redisCache, String key) { |
| 179 | - List<ResponseSchedulingDto> originSchedulingList = null; | |
| 180 | + List<ResponseSchedulingDto> originSchedulingList = new ArrayList<>(); | |
| 180 | 181 | int index = 0; |
| 181 | 182 | int size = 0; |
| 182 | 183 | while (size == 0) { |
| 183 | - originSchedulingList = new RestTemplate().exchange( | |
| 184 | - getSchedulingInfoUrl, HttpMethod.GET, null, new ParameterizedTypeReference<List<ResponseSchedulingDto>>() { | |
| 185 | - }).getBody(); | |
| 186 | - size = CollectionUtils.size(originSchedulingList); | |
| 187 | - index++; | |
| 188 | - if (index > 10 || size > 0) { | |
| 189 | - break; | |
| 190 | - } | |
| 191 | 184 | try { |
| 192 | - Thread.sleep(1000); | |
| 193 | - } catch (InterruptedException e) { | |
| 194 | - throw new RuntimeException(e); | |
| 185 | + index++; | |
| 186 | + if (index > 1) { | |
| 187 | + break; | |
| 188 | + } | |
| 189 | + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); | |
| 190 | + factory.setReadTimeout(1000 * 60 * 20); | |
| 191 | + factory.setConnectTimeout(1000 * 60 * 20); | |
| 192 | + originSchedulingList = new RestTemplate(factory).exchange( | |
| 193 | + getSchedulingInfoUrl, HttpMethod.GET, null, new ParameterizedTypeReference<List<ResponseSchedulingDto>>() { | |
| 194 | + }).getBody(); | |
| 195 | + size = CollectionUtils.size(originSchedulingList); | |
| 196 | + | |
| 197 | + if (size > 0) { | |
| 198 | + break; | |
| 199 | + } | |
| 200 | + try { | |
| 201 | + Thread.sleep(1000); | |
| 202 | + } catch (InterruptedException e) { | |
| 203 | + throw new RuntimeException(e); | |
| 204 | + } | |
| 205 | + } catch (Exception e) { | |
| 206 | + log.error("[{}],[{}]", index, getSchedulingInfoUrl, e); | |
| 195 | 207 | } |
| 196 | 208 | } |
| 197 | 209 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/controller/app/SignReportController.java
0 → 100644
| 1 | +package com.ruoyi.controller.app; | |
| 2 | + | |
| 3 | +import com.ruoyi.common.core.controller.BaseController; | |
| 4 | +import com.ruoyi.common.core.domain.ResponseResult; | |
| 5 | +import com.ruoyi.domain.dss.app.vo.SignReportVo; | |
| 6 | +import com.ruoyi.service.SignReportServer; | |
| 7 | +import io.swagger.annotations.Api; | |
| 8 | +import io.swagger.annotations.ApiOperation; | |
| 9 | +import io.swagger.annotations.ApiParam; | |
| 10 | +import lombok.extern.slf4j.Slf4j; | |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 13 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 14 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 15 | +import org.springframework.web.bind.annotation.RestController; | |
| 16 | + | |
| 17 | +import java.util.List; | |
| 18 | + | |
| 19 | +@Slf4j | |
| 20 | +@RestController | |
| 21 | +@RequestMapping("/app/sign/report") | |
| 22 | +@Api(tags = "【App对接】签到对接") | |
| 23 | +public class SignReportController extends BaseController { | |
| 24 | + @Autowired | |
| 25 | + private SignReportServer signReportServer; | |
| 26 | + | |
| 27 | + @ApiOperation("签到数据统计(设备状态、检查人数、异常人数、酒驾人数);(dateStr格式为yyyy-MM-dd)") | |
| 28 | + @ApiParam(name = "dateStr", value = "查询日期(格式为yyyy-MM-dd)", required = true,example="2024-12-11") | |
| 29 | + @GetMapping("/equipment/people/num/{dateStr}") | |
| 30 | + public ResponseResult<SignReportVo> equipmentAndPeopleNumStatistics(@PathVariable String dateStr) { | |
| 31 | + SignReportVo vo = signReportServer.querySignReportVo(dateStr); | |
| 32 | + return ResponseResult.success(vo); | |
| 33 | + } | |
| 34 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/controller/dss/DssDriverController.java
| ... | ... | @@ -666,25 +666,25 @@ public class DssDriverController extends BaseController { |
| 666 | 666 | private LinggangScheduling convertScheduling(GetBusPlanListDTO dto) { |
| 667 | 667 | LinggangScheduling scheduling = new LinggangScheduling(); |
| 668 | 668 | if (Objects.equals(1, dto.getDateType())) { |
| 669 | - scheduling.setStartScheduleDate(DateUtil.shortDate(DateUtils.addDays(new Date(), 1))); | |
| 669 | + scheduling.setStartScheduleDate(DateUtil.shortDate(new Date())); | |
| 670 | 670 | scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); |
| 671 | 671 | |
| 672 | - String timeStr = DateUtil.YYYY_MM_DD_LINK.format(scheduling.getEndScheduleDate()) + " 06:00:00"; | |
| 673 | - try { | |
| 674 | - scheduling.setFcsjT(DateUtil.YYYY_MM_DD_LINK.parse(timeStr).getTime()); | |
| 675 | - } catch (ParseException e) { | |
| 676 | - log.error("格式化时间错误", e); | |
| 677 | - } | |
| 672 | +// String timeStr = DateUtil.YYYY_MM_DD_LINK.format(scheduling.getEndScheduleDate()) + " 06:00:00"; | |
| 673 | +// try { | |
| 674 | +// // scheduling.setFcsjT(DateUtil.YYYY_MM_DD_LINK.parse(timeStr).getTime()); | |
| 675 | +// } catch (ParseException e) { | |
| 676 | +// log.error("格式化时间错误", e); | |
| 677 | +// } | |
| 678 | 678 | } else if (Objects.equals(0, dto.getDateType())) { |
| 679 | 679 | scheduling.setStartScheduleDate(DateUtil.shortDate(new Date())); |
| 680 | 680 | scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); |
| 681 | 681 | |
| 682 | - String timeStr = DateUtil.YYYY_MM_DD_LINK.format(scheduling.getEndScheduleDate()) + " 06:00:00"; | |
| 683 | - try { | |
| 684 | - scheduling.setFcsjT(DateUtil.YYYY_MM_DD_LINK.parse(timeStr).getTime()); | |
| 685 | - } catch (ParseException e) { | |
| 686 | - log.error("格式化时间错误", e); | |
| 687 | - } | |
| 682 | +// String timeStr = DateUtil.YYYY_MM_DD_LINK.format(scheduling.getEndScheduleDate()) + " 06:00:00"; | |
| 683 | +// try { | |
| 684 | +// scheduling.setFcsjT(DateUtil.YYYY_MM_DD_LINK.parse(timeStr).getTime()); | |
| 685 | +// } catch (ParseException e) { | |
| 686 | +// log.error("格式化时间错误", e); | |
| 687 | +// } | |
| 688 | 688 | } else { |
| 689 | 689 | scheduling.setStartScheduleDate(DateUtil.shortDate(new Date())); |
| 690 | 690 | scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 3)); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
| ... | ... | @@ -125,18 +125,15 @@ public class KeyBoxController extends BaseController { |
| 125 | 125 | if (Objects.isNull(scheduling)) { |
| 126 | 126 | return ResponseResult.error(TipEnum.TIP_3.getCode(), TipEnum.TIP_3.getMsg()); |
| 127 | 127 | } |
| 128 | - LinggangKeyWorkLocation workLocation = queryKeyWorkLocation(scheduling, dto); | |
| 129 | - if (Objects.isNull(workLocation)) { | |
| 130 | - return ResponseResult.error(TipEnum.TIP_4.getCode(), TipEnum.TIP_4.getMsg()); | |
| 131 | - } | |
| 128 | + LinggangKeyWorkLocation workLocation = queryKeyWorkLocation1(scheduling, dto); | |
| 132 | 129 | |
| 133 | - KeyInfo keyInfo = queryKeyInfo(workLocation.getKeyInfoId()); | |
| 134 | - if (Objects.isNull(keyInfo)) { | |
| 130 | + CarInfo carInfo = queryCarInfo(scheduling.getNbbm()); | |
| 131 | + if (Objects.isNull(carInfo)) { | |
| 135 | 132 | return ResponseResult.error404(); |
| 136 | 133 | } |
| 137 | 134 | |
| 138 | - CarInfo carInfo = queryCarInfo(scheduling.getNbbm()); | |
| 139 | - if (Objects.isNull(carInfo)) { | |
| 135 | + KeyInfo keyInfo = queryKeyInfoByCar(carInfo); | |
| 136 | + if (Objects.isNull(keyInfo)) { | |
| 140 | 137 | return ResponseResult.error404(); |
| 141 | 138 | } |
| 142 | 139 | |
| ... | ... | @@ -485,10 +482,15 @@ public class KeyBoxController extends BaseController { |
| 485 | 482 | |
| 486 | 483 | } |
| 487 | 484 | |
| 485 | + Date nowDate = new Date(); | |
| 486 | + | |
| 488 | 487 | LinggangKeyWorkLocation location = new LinggangKeyWorkLocation(); |
| 489 | 488 | location.setDevice(dto.getDevice()); |
| 489 | + location.setStartScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(nowDate, -1)); | |
| 490 | + location.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(nowDate, 1)); | |
| 491 | + location.setKeyInfoIds(keyInfoIds); | |
| 490 | 492 | |
| 491 | - List<LinggangKeyWorkLocation> locations = linggangKeyWorkLocationService.listRecent(location, keyInfoIds, new Date()); | |
| 493 | + List<LinggangKeyWorkLocation> locations = linggangKeyWorkLocationService.list(location); | |
| 492 | 494 | if (CollectionUtils.isEmpty(locations)) { |
| 493 | 495 | return ResponseResult.success(); |
| 494 | 496 | } |
| ... | ... | @@ -514,20 +516,57 @@ public class KeyBoxController extends BaseController { |
| 514 | 516 | locationEq = new LinggangKeyWorkLocation(); |
| 515 | 517 | locationEq.setYardId(sourceEq.getYardId()); |
| 516 | 518 | locationEq.setStartScheduleDate(date); |
| 517 | - locationEq.setKeyInfoIds(keyInfoIds); | |
| 518 | - locationEq.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(locationEq.getStartScheduleDate(), 1)); | |
| 519 | + //locationEq.setKeyInfoIds(keyInfoIds); | |
| 519 | 520 | |
| 521 | + locationEq.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(locationEq.getStartScheduleDate(), 1)); | |
| 522 | + // locationEq.setType1(1); | |
| 523 | + | |
| 524 | + IPage<LinggangKeyWorkLocation> page = new Page<>(); | |
| 525 | + | |
| 526 | + page.setTotal(0); | |
| 527 | + page.setSize(dto.getPageSize()); | |
| 528 | + page.setPages(0); | |
| 529 | + page.setCurrent(dto.getPageNum()); | |
| 530 | + | |
| 531 | + List<LinggangKeyWorkLocation> sourceList = linggangKeyWorkLocationService.list(locationEq, new OrderEntity()); | |
| 532 | + List<LinggangKeyWorkLocation> locationList = new ArrayList<>(); | |
| 533 | + List<LinggangKeyWorkLocation> locationList1 = new ArrayList<>(); | |
| 534 | + if (Objects.nonNull(sourceList) && CollectionUtils.isNotEmpty(sourceList)) { | |
| 535 | + | |
| 536 | + Map<Integer, List<LinggangKeyWorkLocation>> maps = sourceList.stream().filter(cl -> Objects.nonNull(cl.getKeyInfoId())).collect(Collectors.groupingBy(LinggangKeyWorkLocation::getKeyInfoId)); | |
| 537 | + for (Map.Entry<Integer, List<LinggangKeyWorkLocation>> entry : maps.entrySet()) { | |
| 538 | + LinggangKeyWorkLocation linggangKeyWorkLocation = entry.getValue().stream().max(Comparator.comparing(LinggangKeyWorkLocation::getCreateTime)).get(); | |
| 539 | + if (Objects.nonNull(linggangKeyWorkLocation) && Objects.equals(linggangKeyWorkLocation.getType1(), 1)) { | |
| 540 | + locationList.add(linggangKeyWorkLocation); | |
| 541 | + } else if (Objects.nonNull(linggangKeyWorkLocation) && Objects.equals(linggangKeyWorkLocation.getType1(), 0)) { | |
| 542 | + locationList1.add(linggangKeyWorkLocation); | |
| 543 | + } | |
| 544 | + } | |
| 520 | 545 | |
| 521 | - IPage<LinggangKeyWorkLocation> page = linggangKeyWorkLocationService.pageList(new Page<>(dto.getPageNum(), dto.getPageSize()), locationEq, new OrderEntity()); | |
| 522 | - | |
| 546 | + List<LinggangKeyWorkLocation> targetList = new ArrayList<>(); | |
| 547 | + int size = CollectionUtils.size(locationList); | |
| 548 | + for (int i = 0; i < page.getSize(); i++) { | |
| 549 | + int index = Convert.toInt((page.getCurrent() - 1) * page.getSize() + i); | |
| 550 | + if (index < 0 || index >= size) { | |
| 551 | + break; | |
| 552 | + } | |
| 553 | + targetList.add(locationList.get(index)); | |
| 554 | + } | |
| 555 | + page.setRecords(targetList); | |
| 556 | + page.setTotal(size); | |
| 557 | + page.setSize(dto.getPageSize()); | |
| 558 | + page.setPages(size % dto.getPageSize() == 0 ? size / dto.getPageSize() : size / dto.getPageSize() + 1); | |
| 559 | + page.setCurrent(dto.getPageNum()); | |
| 560 | + } | |
| 523 | 561 | List<LinggangScheduling> schedulings = Collections.emptyList(); |
| 524 | 562 | List<CarInfo> carInfos = Collections.emptyList(); |
| 525 | 563 | List<NewDriver> drivers = Collections.emptyList(); |
| 526 | 564 | List<Equipment> yarnCabinetStateEqus = Collections.emptyList(); |
| 565 | + Collection<KeyInfo> keyInfos1 = null; | |
| 527 | 566 | |
| 528 | 567 | if (Objects.nonNull(page) && CollectionUtils.isNotEmpty(page.getRecords())) { |
| 529 | 568 | Set<Integer> keyIds = page.getRecords().stream().map(LinggangKeyWorkLocation::getKeyInfoId).collect(Collectors.toSet()); |
| 530 | - Collection<KeyInfo> keyInfos1 = keyInfoService.listByIds(keyIds); | |
| 569 | + keyInfos1 = keyInfoService.listByIds(keyIds); | |
| 531 | 570 | if (CollectionUtils.isNotEmpty(keyInfos1)) { |
| 532 | 571 | Set<String> plateNums = keyInfos1.stream().map(KeyInfo::getPlateNum).collect(Collectors.toSet()); |
| 533 | 572 | carInfos = carInfoService.listPlateNums(plateNums); |
| ... | ... | @@ -536,7 +575,7 @@ public class KeyBoxController extends BaseController { |
| 536 | 575 | SchedulingDateEntity schedulingDateEntity = schedulingServiceV1.switchSchedulingDate(new Date()); |
| 537 | 576 | |
| 538 | 577 | LinggangScheduling scheduling = new LinggangScheduling(); |
| 539 | - scheduling.setStartScheduleDate(schedulingDateEntity.getStartDate()); | |
| 578 | + scheduling.setStartScheduleDate(DateUtil.shortDate(schedulingDateEntity.getStartDate())); | |
| 540 | 579 | scheduling.setEndScheduleDate(schedulingDateEntity.getEndDate()); |
| 541 | 580 | |
| 542 | 581 | schedulings = schedulingService.listNbbm(scheduling, nbbms); |
| ... | ... | @@ -552,7 +591,8 @@ public class KeyBoxController extends BaseController { |
| 552 | 591 | yarnCabinetStateEqus = equipmentService.listNameAndIDBydeviceIds(deviceCodes); |
| 553 | 592 | |
| 554 | 593 | } |
| 555 | - YarnCabinetStatePageVO pageVO = conertYarnCabinetStatePageVO(locations, equipment, errorCount, depositCount, equipmentList, locationsOfEq, page, schedulings, dto, carInfos, drivers, yarnCabinetStateEqus); | |
| 594 | + YarnCabinetStatePageVO pageVO = conertYarnCabinetStatePageVO(locations, equipment, errorCount, depositCount, equipmentList, locationList1, page, schedulings, dto, carInfos, drivers, yarnCabinetStateEqus, keyInfos1); | |
| 595 | + | |
| 556 | 596 | return ResponseResult.success(pageVO); |
| 557 | 597 | } |
| 558 | 598 | |
| ... | ... | @@ -624,14 +664,14 @@ public class KeyBoxController extends BaseController { |
| 624 | 664 | return null; |
| 625 | 665 | } else if (1 == size) { |
| 626 | 666 | LinggangKeyWorkLocation keyWorkLocation = lists.get(0); |
| 627 | - return Objects.equals(keyWorkLocation.getType1(), 2) || Objects.equals(keyWorkLocation.getType1(), 1) ? keyWorkLocation : null; | |
| 667 | + return Objects.equals(keyWorkLocation.getType1(), 2) || Objects.equals(keyWorkLocation.getType1(), 0) ? keyWorkLocation : null; | |
| 628 | 668 | } |
| 629 | 669 | LinggangKeyWorkLocation keyWorkLocation = lists.get(0); |
| 630 | 670 | if (Objects.equals(keyWorkLocation.getType1(), 2)) { |
| 631 | 671 | //初始化的数据 |
| 632 | 672 | keyWorkLocation = lists.get(1); |
| 633 | 673 | } |
| 634 | - if (Objects.equals(keyWorkLocation.getType1(), 1)) { | |
| 674 | + if (Objects.equals(keyWorkLocation.getType1(), 0)) { | |
| 635 | 675 | //已归还的钥匙 |
| 636 | 676 | return keyWorkLocation; |
| 637 | 677 | } else if (Objects.equals(keyWorkLocation.getType1(), 2)) { |
| ... | ... | @@ -645,6 +685,31 @@ public class KeyBoxController extends BaseController { |
| 645 | 685 | } |
| 646 | 686 | |
| 647 | 687 | |
| 688 | + private LinggangKeyWorkLocation queryKeyWorkLocation1(LinggangScheduling scheduling, WorkPlateV2DTO dto) { | |
| 689 | + CarInfo carInfo = carInfoService.getOneByNbbm(scheduling.getNbbm()); | |
| 690 | + if (Objects.isNull(carInfo)) { | |
| 691 | + return null; | |
| 692 | + } | |
| 693 | + | |
| 694 | + List<KeyInfo> keyInfos = keyInfoService.listPlateNum(carInfo.getPlateNum()); | |
| 695 | + if (CollectionUtils.isEmpty(keyInfos)) { | |
| 696 | + return null; | |
| 697 | + } | |
| 698 | + | |
| 699 | + LinggangKeyWorkLocation workLocation = new LinggangKeyWorkLocation(); | |
| 700 | + workLocation.setKeyInfoId(keyInfos.get(0).getId()); | |
| 701 | + workLocation.setMaxCreateDate(dto.getTime()); | |
| 702 | + | |
| 703 | + List<LinggangKeyWorkLocation> lists = linggangKeyWorkLocationService.getTenByKeyIdAndTime(workLocation); | |
| 704 | + int size = CollectionUtils.size(lists); | |
| 705 | + if (0 == size) { | |
| 706 | + return null; | |
| 707 | + } else { | |
| 708 | + return lists.get(0); | |
| 709 | + } | |
| 710 | + } | |
| 711 | + | |
| 712 | + | |
| 648 | 713 | private List<LinggangKeyWorkLocation> queryKeyWorkLocation(KeyBasicSyncDTO dto) throws ParseException { |
| 649 | 714 | LinggangKeyWorkLocation workLocation = new LinggangKeyWorkLocation(); |
| 650 | 715 | |
| ... | ... | @@ -660,6 +725,11 @@ public class KeyBoxController extends BaseController { |
| 660 | 725 | return keyInfoService.getById(keyId); |
| 661 | 726 | } |
| 662 | 727 | |
| 728 | + private KeyInfo queryKeyInfoByCar(CarInfo carInfo) { | |
| 729 | + List<KeyInfo> keys = keyInfoService.listPlateNum(carInfo.getPlateNum()); | |
| 730 | + return CollectionUtils.isEmpty(keys) ? null : keys.get(0); | |
| 731 | + } | |
| 732 | + | |
| 663 | 733 | private List<KeyInfo> queryKeyInfos(Collection<Integer> ids) { |
| 664 | 734 | if (CollectionUtils.isEmpty(ids)) { |
| 665 | 735 | return Collections.emptyList(); |
| ... | ... | @@ -721,10 +791,14 @@ public class KeyBoxController extends BaseController { |
| 721 | 791 | |
| 722 | 792 | if (Objects.nonNull(equipment)) { |
| 723 | 793 | vo.setDeviceName(equipment.getName()); |
| 794 | + vo.setDevice(equipment.getDeviceId()); | |
| 724 | 795 | } |
| 725 | 796 | // vo.setYardName(keyInfo.getY) |
| 726 | - vo.setDevice(workLocation.getDevice()); | |
| 727 | - vo.setCabinetNo(workLocation.getCabinetNo()); | |
| 797 | + | |
| 798 | + if (Objects.nonNull(workLocation)) { | |
| 799 | + vo.setDevice(workLocation.getDevice()); | |
| 800 | + vo.setCabinetNo(workLocation.getCabinetNo()); | |
| 801 | + } | |
| 728 | 802 | vo.setPlateNum(carInfo.getNbbm()); |
| 729 | 803 | |
| 730 | 804 | return vo; |
| ... | ... | @@ -891,7 +965,7 @@ public class KeyBoxController extends BaseController { |
| 891 | 965 | List<LinggangKeyWorkLocation> locationsOfEqs, |
| 892 | 966 | IPage<LinggangKeyWorkLocation> page, List<LinggangScheduling> schedulings, |
| 893 | 967 | YarnCabinetStatePageDTO dto, List<CarInfo> carInfos, List<NewDriver> drivers, |
| 894 | - List<Equipment> yarnCabinetStateEqus) { | |
| 968 | + List<Equipment> yarnCabinetStateEqus, Collection<KeyInfo> keyInfos1) { | |
| 895 | 969 | if (CollectionUtils.isEmpty(locations)) { |
| 896 | 970 | return null; |
| 897 | 971 | } |
| ... | ... | @@ -928,7 +1002,7 @@ public class KeyBoxController extends BaseController { |
| 928 | 1002 | if (optional.isPresent()) { |
| 929 | 1003 | if (Objects.equals(255, optional.get().getType())) { |
| 930 | 1004 | keysVO.setState(255); |
| 931 | - } else if ((Objects.equals(0, optional.get().getType()) || Objects.equals(2, optional.get().getType()))) { | |
| 1005 | + } else if (Objects.equals(1, optional.get().getType1())) { | |
| 932 | 1006 | keysVO.setState(1); |
| 933 | 1007 | } |
| 934 | 1008 | } |
| ... | ... | @@ -940,6 +1014,7 @@ public class KeyBoxController extends BaseController { |
| 940 | 1014 | return cabinetsVO; |
| 941 | 1015 | |
| 942 | 1016 | }).collect(Collectors.toList()); |
| 1017 | + | |
| 943 | 1018 | vo.setCabinets(cabinets); |
| 944 | 1019 | } |
| 945 | 1020 | |
| ... | ... | @@ -953,19 +1028,29 @@ public class KeyBoxController extends BaseController { |
| 953 | 1028 | List<YarnCabinetStatePageOutKeysRecordsVo> recordsVos = page.getRecords().stream().map(l -> { |
| 954 | 1029 | YarnCabinetStatePageOutKeysRecordsVo recordsVo = new YarnCabinetStatePageOutKeysRecordsVo(); |
| 955 | 1030 | if (CollectionUtils.isNotEmpty(schedulings)) { |
| 956 | - Optional<LinggangScheduling> optional = schedulings.stream().filter(sc -> Objects.equals(l.getSchedulingId(), sc.getId())).findFirst(); | |
| 1031 | + Optional<LinggangScheduling> optional = schedulings.stream().filter(sc -> (Objects.equals(l.getSchedulingId(), sc.getId()) || Objects.equals(l.getJobCode(), sc.getJobCode()))).findFirst(); | |
| 1032 | + if (!optional.isPresent() && CollectionUtils.isNotEmpty(keyInfos1)) { | |
| 1033 | + Optional<KeyInfo> keyInfoOptional = keyInfos1.stream().filter(k -> Objects.equals(k.getId(), l.getKeyInfoId())).findFirst(); | |
| 1034 | + if (keyInfoOptional.isPresent() && CollectionUtils.isNotEmpty(carInfos)) { | |
| 1035 | + Optional<CarInfo> carInfoOpt = carInfos.stream().filter(k -> Objects.equals(k.getPlateNum(), keyInfoOptional.get().getPlateNum())).findFirst(); | |
| 1036 | + if (carInfoOpt.isPresent()) { | |
| 1037 | + optional = schedulings.stream().filter(sc -> Objects.equals(sc.getNbbm(), carInfoOpt.get().getNbbm())).findFirst(); | |
| 1038 | + } | |
| 1039 | + } | |
| 1040 | + } | |
| 957 | 1041 | if (optional.isPresent()) { |
| 958 | 1042 | recordsVo.setRouteName(optional.get().getLineName()); |
| 959 | 1043 | recordsVo.setSelfCode(optional.get().getNbbm()); |
| 1044 | + Optional<LinggangScheduling> opsc = optional; | |
| 960 | 1045 | if (CollectionUtils.isNotEmpty(carInfos)) { |
| 961 | - Optional<CarInfo> optCar = carInfos.stream().filter(c -> Objects.equals(c.getNbbm(), optional.get().getNbbm())).findFirst(); | |
| 1046 | + Optional<CarInfo> optCar = carInfos.stream().filter(c -> Objects.equals(c.getNbbm(), opsc.get().getNbbm())).findFirst(); | |
| 962 | 1047 | if (optCar.isPresent()) { |
| 963 | 1048 | recordsVo.setPlate(optCar.get().getPlateNum()); |
| 964 | 1049 | } |
| 965 | 1050 | } |
| 966 | 1051 | |
| 967 | 1052 | if (CollectionUtils.isNotEmpty(drivers)) { |
| 968 | - Optional<NewDriver> opt = drivers.stream().filter(d -> Objects.equals(d.getJobCode(), optional.get().getJobCode())).findFirst(); | |
| 1053 | + Optional<NewDriver> opt = drivers.stream().filter(d -> Objects.equals(d.getJobCode(), opsc.get().getJobCode())).findFirst(); | |
| 969 | 1054 | if (opt.isPresent()) { |
| 970 | 1055 | recordsVo.setStaffName(opt.get().getPersonnelName()); |
| 971 | 1056 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/domain/dss/app/vo/SignEquipmentVo.java
0 → 100644
| 1 | +package com.ruoyi.domain.dss.app.vo; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.AllArgsConstructor; | |
| 6 | +import lombok.Data; | |
| 7 | +import lombok.EqualsAndHashCode; | |
| 8 | +import lombok.NoArgsConstructor; | |
| 9 | +import lombok.experimental.Accessors; | |
| 10 | + | |
| 11 | +@Data | |
| 12 | +@NoArgsConstructor | |
| 13 | +@AllArgsConstructor | |
| 14 | +@ApiModel(value = "App对接签到信息-设备状态") | |
| 15 | +@Accessors(chain = true) | |
| 16 | +@EqualsAndHashCode(callSuper = false) | |
| 17 | +public class SignEquipmentVo implements java.io.Serializable{ | |
| 18 | + @ApiModelProperty(value = "设备号") | |
| 19 | + private String deviceId; | |
| 20 | + @ApiModelProperty(value = "设备状态,1:正常;2异常") | |
| 21 | + private Integer status; | |
| 22 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/domain/dss/app/vo/SignReportVo.java
0 → 100644
| 1 | +package com.ruoyi.domain.dss.app.vo; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.AllArgsConstructor; | |
| 6 | +import lombok.Data; | |
| 7 | +import lombok.EqualsAndHashCode; | |
| 8 | +import lombok.NoArgsConstructor; | |
| 9 | +import lombok.experimental.Accessors; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +@Data | |
| 14 | +@NoArgsConstructor | |
| 15 | +@AllArgsConstructor | |
| 16 | +@ApiModel(value = "App对接签到信息") | |
| 17 | +@Accessors(chain = true) | |
| 18 | +@EqualsAndHashCode(callSuper = false) | |
| 19 | +public class SignReportVo implements java.io.Serializable { | |
| 20 | + @ApiModelProperty(value = "设备状态") | |
| 21 | + private List<SignEquipmentVo> signEquipmentVos; | |
| 22 | + @ApiModelProperty(value = "检查人数") | |
| 23 | + private Integer checkNum; | |
| 24 | + @ApiModelProperty(value = "异常人数") | |
| 25 | + private Integer exceptionNum; | |
| 26 | + @ApiModelProperty(value = "酒驾人数") | |
| 27 | + private Integer alcoholNum; | |
| 28 | + | |
| 29 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/domain/dss2/log/EquipmengLogDTO.java
0 → 100644
| 1 | +package com.ruoyi.domain.dss2.log; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson2.JSON; | |
| 4 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 5 | +import io.swagger.annotations.ApiModel; | |
| 6 | +import io.swagger.annotations.ApiModelProperty; | |
| 7 | +import lombok.Data; | |
| 8 | +import lombok.experimental.Accessors; | |
| 9 | + | |
| 10 | +import java.util.Date; | |
| 11 | + | |
| 12 | +@Data | |
| 13 | +@ApiModel(value = "蓝斯设备日志") | |
| 14 | +@Accessors(chain = true) | |
| 15 | +public class EquipmengLogDTO { | |
| 16 | + @ApiModelProperty(value = "设备上线号") | |
| 17 | + private String device; | |
| 18 | + | |
| 19 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |
| 20 | + @ApiModelProperty(value = "产生日志的时间,yyyy-MM-dd HH:mm:ss") | |
| 21 | + private Date time; | |
| 22 | + | |
| 23 | + @ApiModelProperty(value = "日志内容") | |
| 24 | + private String content; | |
| 25 | + | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public String toString() { | |
| 29 | + return JSON.toJSONString(this); | |
| 30 | + } | |
| 31 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/LinggangKeyWorkLocation.java
Bsth-admin/src/main/java/com/ruoyi/eexception/service/impl/EquipmentExceptionServiceImpl.java
| ... | ... | @@ -77,7 +77,8 @@ public class EquipmentExceptionServiceImpl implements IEquipmentExceptionService |
| 77 | 77 | } |
| 78 | 78 | EquipmentException exception = equipmentExceptionMapper.selectEquipmentExceptionByDeviceIdStatus(equipmentException); |
| 79 | 79 | if (!Objects.isNull(exception)){ |
| 80 | - throw new RuntimeException("已经提交过报修,等待维修人员处理。"); | |
| 80 | + return 1; | |
| 81 | +// throw new RuntimeException("已经提交过报修,等待维修人员处理。"); | |
| 81 | 82 | } |
| 82 | 83 | if (Objects.isNull(equipmentException.getExType())) |
| 83 | 84 | equipmentException.setExType(EQUIPMENT_ALCOHOL_EX_NUM); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/mapper/SignReportMappper.java
0 → 100644
| 1 | +package com.ruoyi.mapper; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
| 4 | +import com.ruoyi.domain.dss.app.vo.SignReportVo; | |
| 5 | +import org.apache.ibatis.annotations.Mapper; | |
| 6 | +import org.apache.ibatis.annotations.Param; | |
| 7 | + | |
| 8 | +@Mapper | |
| 9 | +public interface SignReportMappper extends BaseMapper<SignReportVo> { | |
| 10 | + SignReportVo querySignReport(@Param("dateStr") String dateStr); | |
| 11 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/SignReportServer.java
0 → 100644
Bsth-admin/src/main/java/com/ruoyi/service/impl/SignReportServerImpl.java
0 → 100644
| 1 | +package com.ruoyi.service.impl; | |
| 2 | + | |
| 3 | +import com.ruoyi.domain.dss.app.vo.SignEquipmentVo; | |
| 4 | +import com.ruoyi.domain.dss.app.vo.SignReportVo; | |
| 5 | +import com.ruoyi.equipment.domain.Equipment; | |
| 6 | +import com.ruoyi.equipment.service.IEquipmentService; | |
| 7 | +import com.ruoyi.mapper.SignReportMappper; | |
| 8 | +import com.ruoyi.service.SignReportServer; | |
| 9 | +import org.springframework.stereotype.Service; | |
| 10 | +import org.apache.commons.collections4.CollectionUtils; | |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | + | |
| 13 | +import java.util.List; | |
| 14 | +import java.util.stream.Collectors; | |
| 15 | + | |
| 16 | +@Service | |
| 17 | +public class SignReportServerImpl implements SignReportServer { | |
| 18 | + @Autowired | |
| 19 | + private IEquipmentService iEquipmentService; | |
| 20 | + @Autowired | |
| 21 | + private SignReportMappper signReportMappper; | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public SignReportVo querySignReportVo(String dateStr) { | |
| 25 | + SignReportVo reportVo = signReportMappper.querySignReport(dateStr); | |
| 26 | + List<Equipment> equipmentList = iEquipmentService.list(); | |
| 27 | + if (CollectionUtils.isNotEmpty(equipmentList)) { | |
| 28 | + List<SignEquipmentVo> vos = equipmentList.stream().map(e -> { | |
| 29 | + SignEquipmentVo equipmentVo = new SignEquipmentVo(); | |
| 30 | + equipmentVo.setDeviceId(e.getDeviceId()); | |
| 31 | + equipmentVo.setStatus(e.getStatus()); | |
| 32 | + return equipmentVo; | |
| 33 | + }).collect(Collectors.toList()); | |
| 34 | + | |
| 35 | + reportVo.setSignEquipmentVos(vos); | |
| 36 | + } | |
| 37 | + return reportVo; | |
| 38 | + } | |
| 39 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/equipment/self/check/LingangEquimentSelfCheckServiceImpl.java
| ... | ... | @@ -86,8 +86,8 @@ public class LingangEquimentSelfCheckServiceImpl extends ServiceImpl<LingangEqui |
| 86 | 86 | */ |
| 87 | 87 | @Override |
| 88 | 88 | public boolean insert(LingangEquimentSelfCheck entity) { |
| 89 | - if (Objects.equals(entity.getWine(), 2) || Objects.equals(2, entity.getTherm()) || Objects.equals(2, entity.getHorn()) | |
| 90 | - || Objects.equals(2, entity.getMike()) || Objects.equals(2, entity.getLock()) || | |
| 89 | + if (Objects.equals(entity.getWine(), 2) || Objects.equals(2, entity.getHorn()) | |
| 90 | + || Objects.equals(2, entity.getLock()) || | |
| 91 | 91 | Objects.equals(entity.getCamerasSaveExceptionFlag(), Boolean.TRUE)) { |
| 92 | 92 | EquipmentException equipmentException = insertEquipmentException(entity); |
| 93 | 93 | entity.setQuipmentExceptionId(equipmentException.getId()); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/location/LinggangKeyWorkLocationServiceImpl.java
| ... | ... | @@ -176,6 +176,15 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | @Override |
| 179 | + public List<LinggangKeyWorkLocation> list(LinggangKeyWorkLocation entity, OrderEntity orderEntity) { | |
| 180 | + LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity); | |
| 181 | + switchTime(entity, wrapper); | |
| 182 | + switchTypes(entity, wrapper); | |
| 183 | + orderColumn(wrapper, orderEntity); | |
| 184 | + return list(wrapper); | |
| 185 | + } | |
| 186 | + | |
| 187 | + @Override | |
| 179 | 188 | public List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity, Date date) { |
| 180 | 189 | LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity); |
| 181 | 190 | if (Objects.nonNull(date)) { | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/key/location/LinggangKeyWorkLocationService.java
| ... | ... | @@ -27,6 +27,8 @@ public interface LinggangKeyWorkLocationService extends IService<LinggangKeyWork |
| 27 | 27 | */ |
| 28 | 28 | List<LinggangKeyWorkLocation> list(LinggangKeyWorkLocation entity); |
| 29 | 29 | |
| 30 | + List<LinggangKeyWorkLocation> list(LinggangKeyWorkLocation entity, OrderEntity orderEntity); | |
| 31 | + | |
| 30 | 32 | List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity, Date date); |
| 31 | 33 | |
| 32 | 34 | List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity, Collection<Long> schedulingIds); | ... | ... |
Bsth-admin/src/main/resources/application-druid-dev.yml
| ... | ... | @@ -32,6 +32,7 @@ spring: |
| 32 | 32 | #url: jdbc:mysql://192.168.168.124:3306/lingang_all_in_one?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true |
| 33 | 33 | url: jdbc:mysql://192.168.168.124:3306/lingang_all_in_one?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true |
| 34 | 34 | # url: jdbc:mysql://127.0.0.1:3306/lingang_all_in_one?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true |
| 35 | + # url: jdbc:mysql://192.168.169.100:3306/lingang_all_in_one1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&useAffectedRows=true&allowMultiQueries=true | |
| 35 | 36 | username: root |
| 36 | 37 | password: guzijian |
| 37 | 38 | # password: 1 | ... | ... |
Bsth-admin/src/main/resources/application-druid-prd.yml
| ... | ... | @@ -231,5 +231,8 @@ bsth: |
| 231 | 231 | # path: D:/work/code/jienengjiancha/bsth-alcohol-sign/Bsth-admin/src/main/resources/libs/WIN64 |
| 232 | 232 | faceFeature: |
| 233 | 233 | url: http://222.76.217.238:8880/fcgi-bin/entry.fcgi/system |
| 234 | + process: | |
| 235 | + sign: | |
| 236 | + url: http://127.0.0.1:9103/commonOpenDataApi/sendAppAndSmsNotice | |
| 234 | 237 | skip: |
| 235 | 238 | url: /big/view/queryNumberByType;/big/view/queryLineInfo/*;/big/view/querySignDetails;/report/list/**;/system/dict/data/**;/app/version/check/**;/app/checkDeviceHeart;/app/download;"/driver/**;/in/**;/eexception/**;/equipment/**;/report/**;/login;/register;/captchaImage;/dss/Driver/Auth;/login/no/code | ... | ... |
Bsth-admin/src/main/resources/logback.xml
| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | <configuration> |
| 3 | 3 | <!-- 日志存放路径 --> |
| 4 | 4 | <springProperty name="log.path" source="log.path" defaultValue="d:/logs" /> |
| 5 | - /> | |
| 6 | 5 | <!-- <property name="log.path" value="/home/ruoyi/logs" />--> |
| 7 | 6 | <!-- 日志输出格式 --> |
| 8 | 7 | <property name="log.pattern" value="%d{yyyyMMdd HH:mm:ss.SSS}[%X{userId}][%X{requestId}][%thread][%logger{20}]-[%method,%line]-%msg%n" /> |
| ... | ... | @@ -72,7 +71,7 @@ |
| 72 | 71 | <pattern>${log.pattern}</pattern> |
| 73 | 72 | </encoder> |
| 74 | 73 | </appender> |
| 75 | - | |
| 74 | + | |
| 76 | 75 | <!-- 系统模块日志级别控制 --> |
| 77 | 76 | <logger name="com.ruoyi" level="info" /> |
| 78 | 77 | <!-- Spring日志级别控制 --> | ... | ... |
Bsth-admin/src/main/resources/mapper/SignReportMapper.xml
0 → 100644
| 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.mapper.SignReportMappper"> | |
| 6 | + <select id="querySignReport" resultType="com.ruoyi.domain.dss.app.vo.SignReportVo"> | |
| 7 | + select ( | |
| 8 | + select count(jobCode)checkNum from( | |
| 9 | + select si.jobCode jobCode from sign_in si where si.create_time like CONCAT(#{dateStr},'%') GROUP by si.jobCode | |
| 10 | + )t)checkNum | |
| 11 | + ,( | |
| 12 | + select count(jobCode)exceptionNum from( | |
| 13 | + select si.jobCode from sign_in si where si.create_time like CONCAT(#{dateStr},'%') and si.ex_type <![CDATA[ <> ]]>0 GROUP by si.jobCode | |
| 14 | + )t1)exceptionNum | |
| 15 | + ,( | |
| 16 | + select count(jobCode)exceptionNum from( | |
| 17 | + select si.jobCode from sign_in si where si.create_time like CONCAT(#{dateStr},'%') and si.ex_type =3 GROUP by si.jobCode | |
| 18 | + )t1)alcoholNum | |
| 19 | + </select> | |
| 20 | +</mapper> | |
| 0 | 21 | \ No newline at end of file | ... | ... |