diff --git a/src/main/java/com/zhgd/xmgl/entity/vo/AttendanceOfEachCompanyVo.java b/src/main/java/com/zhgd/xmgl/entity/vo/AttendanceOfEachCompanyVo.java new file mode 100644 index 000000000..9463a7375 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/entity/vo/AttendanceOfEachCompanyVo.java @@ -0,0 +1,14 @@ +package com.zhgd.xmgl.entity.vo; + +import com.zhgd.xmgl.modules.worker.entity.vo.ProjectCompanyWorkTotal; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class AttendanceOfEachCompanyVo { + @ApiModelProperty(value = "出勤总人数") + private Integer attendanceNum; + private List projectCompanyWorkTotalList; +} diff --git a/src/main/java/com/zhgd/xmgl/entity/vo/NumTypeVo.java b/src/main/java/com/zhgd/xmgl/entity/vo/NumTypeVo.java new file mode 100644 index 000000000..2f329bce9 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/entity/vo/NumTypeVo.java @@ -0,0 +1,12 @@ +package com.zhgd.xmgl.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class NumTypeVo { + @ApiModelProperty(value = "数量") + private Integer num; + @ApiModelProperty(value = "类型") + private Integer type; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/LifterController.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/LifterController.java index 1998b1295..b02ed452d 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/LifterController.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/LifterController.java @@ -5,6 +5,7 @@ import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.modules.bigdevice.entity.Lifter; import com.zhgd.xmgl.modules.bigdevice.entity.vo.LifterAndDataInfoVO; +import com.zhgd.xmgl.modules.bigdevice.entity.vo.TodayOperatingStatusStatisticsVo; import com.zhgd.xmgl.modules.bigdevice.service.ILifterService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -144,5 +145,15 @@ public class LifterController { return Result.success(lifterService.selectLifterDevAlarmCountList(map)); } + @ApiOperation(value = "查询今日运行状态统计", notes = "查询今日运行状态统计", httpMethod = "GET") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"), + @ApiImplicitParam(name = "devSn", value = "设备编号", dataType = "String", paramType = "query", required = true) + }) + @GetMapping(value = "/queryTodayOperatingStatusStatistics") + public Result queryTodayOperatingStatusStatistics(@RequestParam Map map) { + return Result.success(lifterService.queryTodayOperatingStatusStatistics(map)); + } + } diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/LifterViolationController.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/LifterViolationController.java index 5d48cfa5c..3801dde8f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/LifterViolationController.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/LifterViolationController.java @@ -12,6 +12,7 @@ import com.zhgd.xmgl.modules.basicdata.service.UploadFileService; import com.zhgd.xmgl.modules.bigdevice.entity.Lifter; import com.zhgd.xmgl.modules.bigdevice.entity.LifterViolation; import com.zhgd.xmgl.modules.bigdevice.entity.vo.StatisticsElevatorNumVo; +import com.zhgd.xmgl.modules.bigdevice.entity.vo.StatisticsElevatorViolationNumVo; import com.zhgd.xmgl.modules.bigdevice.service.ILifterService; import com.zhgd.xmgl.modules.bigdevice.service.LifterViolationService; import com.zhgd.xmgl.util.MessageUtil; @@ -175,7 +176,7 @@ public class LifterViolationController { @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"), }) @GetMapping(value = "/queryStatisticsViolationNum") - public Result queryStatisticsViolationNum(@RequestParam Map map) { + public Result queryStatisticsViolationNum(@RequestParam Map map) { return Result.success(lifterViolationService.queryStatisticsViolationNum(map)); } } diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/vo/StatisticsElevatorViolationNumVo.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/vo/StatisticsElevatorViolationNumVo.java new file mode 100644 index 000000000..f9fce3e35 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/vo/StatisticsElevatorViolationNumVo.java @@ -0,0 +1,19 @@ +package com.zhgd.xmgl.modules.bigdevice.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class StatisticsElevatorViolationNumVo { + @ApiModelProperty(value = "今日违章次数") + private Integer todayViolationNum; + @ApiModelProperty(value = "昨日违章次数(同一时段)") + private Integer yesterdayViolationNum; + @ApiModelProperty(value = "过去30日违章次数") + private Integer last30DayViolationNum; + @ApiModelProperty(value = "违章次数(相比昨日同一时段)") + private Integer todayViolationNumCompareYesterday; + @ApiModelProperty(value = "违章次数(相比过去30日)") + private Integer todayViolationNumCompareLast30Day; + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/vo/TodayOperatingStatusStatisticsVo.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/vo/TodayOperatingStatusStatisticsVo.java new file mode 100644 index 000000000..7141cd71a --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/vo/TodayOperatingStatusStatisticsVo.java @@ -0,0 +1,18 @@ +package com.zhgd.xmgl.modules.bigdevice.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class TodayOperatingStatusStatisticsVo { + @ApiModelProperty(value = "工作时长(分钟)") + private Integer workTime; + @ApiModelProperty(value = "装载次数") + private Integer loadingNum; + @ApiModelProperty(value = "装载工效") + private Integer loadingErgonomic; + @ApiModelProperty(value = "装载重量") + private Integer loadingWeight; + @ApiModelProperty(value = "违章次数") + private Integer violationNum; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/LifterViolationMapper.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/LifterViolationMapper.java index b6d6fea58..4be19da29 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/LifterViolationMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/LifterViolationMapper.java @@ -22,5 +22,11 @@ public interface LifterViolationMapper extends BaseMapper { LifterViolation getInfoById(@Param("id") Long id); + /** + * 查询违章次数 + * + * @param map + * @return + */ Integer selectLifterViolationCount(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/LifterWorkCycleMapper.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/LifterWorkCycleMapper.java index 2c6c031cf..8ae37a48e 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/LifterWorkCycleMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/LifterWorkCycleMapper.java @@ -5,6 +5,7 @@ import java.util.Map; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.bigdevice.entity.vo.TodayOperatingStatusStatisticsVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import com.zhgd.xmgl.modules.bigdevice.entity.LifterWorkCycle; @@ -13,13 +14,15 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * @Description: 升降机工作循环 * @author: pds - * @date: 2020-12-16 + * @date: 2020-12-16 * @version: V1.0 */ @Mapper public interface LifterWorkCycleMapper extends BaseMapper { - List queryLifterWorkCyclePageList(Page page, @Param("param")Map map); + List queryLifterWorkCyclePageList(Page page, @Param("param") Map map); List selectLifterWorkCycleList(Map map); + + TodayOperatingStatusStatisticsVo queryTodayWorkCycleStatusStatistics(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/xml/LifterWorkCycleMapper.xml b/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/xml/LifterWorkCycleMapper.xml index 262f6e0d9..beb5cb22a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/xml/LifterWorkCycleMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/xml/LifterWorkCycleMapper.xml @@ -20,11 +20,25 @@ SELECT a.*,b.dev_name FROM lifter_work_cycle a INNER JOIN lifter b ON a.dev_sn=b.dev_sn WHERE a.dev_sn=#{devSn} - + AND a.start_time >=CONCAT(DATE_FORMAT(#{startTime},'%Y-%m-%d'),' 00:00:00') - + AND a.end_time <=CONCAT(DATE_FORMAT(#{endTime},'%Y-%m-%d'),' 23:59:59') + + diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/ILifterService.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/ILifterService.java index 88e7f300b..da79178e8 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/ILifterService.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/ILifterService.java @@ -6,6 +6,7 @@ import com.zhgd.xmgl.modules.bigdevice.entity.Lifter; import com.zhgd.xmgl.modules.bigdevice.entity.LifterAlarm; import com.zhgd.xmgl.modules.bigdevice.entity.LifterViolation; import com.zhgd.xmgl.modules.bigdevice.entity.vo.LifterAndDataInfoVO; +import com.zhgd.xmgl.modules.bigdevice.entity.vo.TodayOperatingStatusStatisticsVo; import java.util.List; import java.util.Map; @@ -49,4 +50,6 @@ public interface ILifterService extends IService { void sendViolationMessageToRectification(LifterViolation lifterViolation, Lifter lifter); LifterAndDataInfoVO getRelatedInfo(String devSn); + + TodayOperatingStatusStatisticsVo queryTodayOperatingStatusStatistics(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/LifterViolationService.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/LifterViolationService.java index b7ec9e9c2..7a31a5ccc 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/LifterViolationService.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/LifterViolationService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.zhgd.xmgl.modules.bigdevice.entity.LifterViolation; import com.zhgd.xmgl.modules.bigdevice.entity.vo.StatisticsElevatorNumVo; +import com.zhgd.xmgl.modules.bigdevice.entity.vo.StatisticsElevatorViolationNumVo; import java.util.Map; @@ -18,5 +19,5 @@ public interface LifterViolationService extends IService { LifterViolation getInfoById(Long id); - StatisticsElevatorNumVo queryStatisticsViolationNum(Map map); + StatisticsElevatorViolationNumVo queryStatisticsViolationNum(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterAlarmServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterAlarmServiceImpl.java index e49f54d49..6b93388aa 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterAlarmServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterAlarmServiceImpl.java @@ -210,14 +210,17 @@ public class LifterAlarmServiceImpl extends ServiceImpl lifterAlarms = lifterAlarmMapper.queryAlarmsByTime(map); Map countTowerAlarmByTypeMap = countLifterAlarmByType(lifterAlarms); List typeNums = new ArrayList<>(); + Integer alarmCount = 0; for (Map.Entry entry : countTowerAlarmByTypeMap.entrySet()) { AlarmsDistinguishedNumberByAlarmType.TypeNum typeNum = new AlarmsDistinguishedNumberByAlarmType.TypeNum(); + Integer value = entry.getValue(); typeNum.setType(entry.getKey()); - typeNum.setNum(entry.getValue()); + typeNum.setNum(value); + typeNums.add(typeNum); + alarmCount += value; } - Integer count = countTowerAlarmByTypeMap.size(); AlarmsDistinguishedNumberByAlarmType rt = new AlarmsDistinguishedNumberByAlarmType(); - rt.setAlarmNum(count); + rt.setAlarmNum(alarmCount); rt.setTypeNumList(typeNums); return rt; } @@ -229,58 +232,71 @@ public class LifterAlarmServiceImpl extends ServiceImpl countLifterAlarmByType(List lifterAlarms) { Map typeNumMap = new HashMap<>(); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getPeopleCntAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getWeightAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getSpeedAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getHeightAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getObliguityXAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getObliguityYAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getWindSpeedAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getMotor1Alarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getMotor2Alarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getMotor3Alarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getTopAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getFallAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(LifterAlarm::getBottomAlarm), 0); for (LifterAlarm lifterAlarm : lifterAlarms) { if (Objects.equals(lifterAlarm.getPeopleCntAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getPeopleCntAlarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getWeightAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getWeightAlarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getSpeedAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getSpeedAlarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getHeightAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getHeightAlarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getObliguityXAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getObliguityXAlarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getObliguityYAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getObliguityYAlarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getWindSpeedAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getWindSpeedAlarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getMotor1Alarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getMotor1Alarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getMotor2Alarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getMotor2Alarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getMotor3Alarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getMotor3Alarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getTopAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getTopAlarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getFallAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getFallAlarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(lifterAlarm.getBottomAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(LifterAlarm::getBottomAlarm); - addLifterAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } } return typeNumMap; diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterServiceImpl.java index 34c286ade..811375182 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterServiceImpl.java @@ -1,7 +1,9 @@ package com.zhgd.xmgl.modules.bigdevice.service.impl; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.NumberUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -16,8 +18,10 @@ import com.zhgd.xmgl.modules.bigdevice.entity.dto.LifterDataInfoDTO; import com.zhgd.xmgl.modules.bigdevice.entity.vo.DevWorkerVO; import com.zhgd.xmgl.modules.bigdevice.entity.vo.DriverVO; import com.zhgd.xmgl.modules.bigdevice.entity.vo.LifterAndDataInfoVO; +import com.zhgd.xmgl.modules.bigdevice.entity.vo.TodayOperatingStatusStatisticsVo; import com.zhgd.xmgl.modules.bigdevice.mapper.*; import com.zhgd.xmgl.modules.bigdevice.service.ILifterService; +import com.zhgd.xmgl.modules.project.entity.SubdivisionProject; import com.zhgd.xmgl.util.MessageUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.MapUtils; @@ -41,6 +45,8 @@ import java.util.stream.Collectors; @Transactional(rollbackFor = Exception.class) @Slf4j public class LifterServiceImpl extends ServiceImpl implements ILifterService { + @Autowired + private LifterViolationMapper lifterViolationMapper; @Autowired private LifterMapper lifterMapper; @Autowired @@ -362,4 +368,14 @@ public class LifterServiceImpl extends ServiceImpl impleme } return new LifterAndDataInfoVO(lifterDataInfo, devWorker); } + + @Override + public TodayOperatingStatusStatisticsVo queryTodayOperatingStatusStatistics(Map map) { + TodayOperatingStatusStatisticsVo workCycleStatusStatistics = lifterWorkCycleMapper.queryTodayWorkCycleStatusStatistics(map); + Date date = new Date(); + map.put("queryStartTime", DateUtil.today()); + Integer todayRunNum = lifterViolationMapper.selectLifterViolationCount(map); + workCycleStatusStatistics.setViolationNum(todayRunNum); + return workCycleStatusStatistics; + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterViolationServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterViolationServiceImpl.java index 56c393dab..a449a45d3 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterViolationServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/LifterViolationServiceImpl.java @@ -2,15 +2,12 @@ package com.zhgd.xmgl.modules.bigdevice.service.impl; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zhgd.xmgl.modules.bigdevice.entity.LifterViolation; -import com.zhgd.xmgl.modules.bigdevice.entity.LifterWorkCycle; -import com.zhgd.xmgl.modules.bigdevice.entity.vo.StatisticsElevatorNumVo; +import com.zhgd.xmgl.modules.bigdevice.entity.vo.StatisticsElevatorViolationNumVo; import com.zhgd.xmgl.modules.bigdevice.mapper.LifterViolationMapper; import com.zhgd.xmgl.modules.bigdevice.service.LifterViolationService; -import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -48,23 +45,23 @@ public class LifterViolationServiceImpl extends ServiceImpl map) { + public StatisticsElevatorViolationNumVo queryStatisticsViolationNum(Map map) { Date date = new Date(); map.put("queryStartTime", DateUtil.today()); map.put("queryEndTime", null); - Integer todayRunNum = lifterViolationMapper.selectLifterViolationCount(map); + Integer todayViolationNum = lifterViolationMapper.selectLifterViolationCount(map); map.put("queryStartTime", DateUtil.formatDate(DateUtil.offsetDay(date, -1))); map.put("queryEndTime", DateUtil.formatDateTime(DateUtil.offsetDay(date, -1))); - Integer yesterdayRunNum = lifterViolationMapper.selectLifterViolationCount(map); + Integer yesterdayViolationNum = lifterViolationMapper.selectLifterViolationCount(map); map.put("queryStartTime", DateUtil.formatDateTime(DateUtil.offsetDay(date, -30))); map.put("queryEndTime", null); Integer last30DayRunNum = lifterViolationMapper.selectLifterViolationCount(map); - StatisticsElevatorNumVo vo = new StatisticsElevatorNumVo(); - vo.setTodayRunNum(todayRunNum); - vo.setYesterdayRunNum(yesterdayRunNum); - vo.setLast30DayRunNum(last30DayRunNum); - vo.setTodayRunNumCompareYesterday(todayRunNum - yesterdayRunNum); - vo.setTodayRunNumCompareLast30Day(todayRunNum - last30DayRunNum); + StatisticsElevatorViolationNumVo vo = new StatisticsElevatorViolationNumVo(); + vo.setTodayViolationNum(todayViolationNum); + vo.setYesterdayViolationNum(yesterdayViolationNum); + vo.setLast30DayViolationNum(last30DayRunNum); + vo.setTodayViolationNumCompareYesterday(todayViolationNum - yesterdayViolationNum); + vo.setTodayViolationNumCompareLast30Day(todayViolationNum - last30DayRunNum); return vo; } } diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/TowerAlarmServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/TowerAlarmServiceImpl.java index 6b39131af..c37f33a4c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/TowerAlarmServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/service/impl/TowerAlarmServiceImpl.java @@ -564,14 +564,17 @@ public class TowerAlarmServiceImpl extends ServiceImpl towerAlarms = towerAlarmMapper.queryAlarmsByTime(map); Map countTowerAlarmByTypeMap = countTowerAlarmByType(towerAlarms); List typeNums = new ArrayList<>(); + Integer alarmCount = 0; for (Map.Entry entry : countTowerAlarmByTypeMap.entrySet()) { AlarmsDistinguishedNumberByAlarmType.TypeNum typeNum = new AlarmsDistinguishedNumberByAlarmType.TypeNum(); + Integer value = entry.getValue(); typeNum.setType(entry.getKey()); - typeNum.setNum(entry.getValue()); + typeNum.setNum(value); + typeNums.add(typeNum); + alarmCount += value; } - Integer count = countTowerAlarmByTypeMap.size(); AlarmsDistinguishedNumberByAlarmType rt = new AlarmsDistinguishedNumberByAlarmType(); - rt.setAlarmNum(count); + rt.setAlarmNum(alarmCount); rt.setTypeNumList(typeNums); return rt; } @@ -583,67 +586,68 @@ public class TowerAlarmServiceImpl extends ServiceImpl countTowerAlarmByType(List towerAlarms) { Map typeNumMap = new HashMap<>(); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getMomentAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getWindSpeedAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getHeightAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getHeightLowerAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getMinRangeAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getMaxRangeAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getPosAngleAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getNegAngleAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getObliguityAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getEnvironmentAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getMultiAlarm), 0); + typeNumMap.put(ReflectionUtil.getFieldName(TowerAlarm::getStandardHighAlarm), 0); for (TowerAlarm towerAlarm : towerAlarms) { if (Objects.equals(towerAlarm.getMomentAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getMomentAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(towerAlarm.getWindSpeedAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getWindSpeedAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(towerAlarm.getHeightAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getHeightAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(towerAlarm.getHeightLowerAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getHeightLowerAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(towerAlarm.getMinRangeAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getMinRangeAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(towerAlarm.getMaxRangeAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getMaxRangeAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(towerAlarm.getPosAngleAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getPosAngleAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(towerAlarm.getNegAngleAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getNegAngleAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(towerAlarm.getObliguityAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getObliguityAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(towerAlarm.getEnvironmentAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getEnvironmentAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(towerAlarm.getMultiAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getMultiAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } if (Objects.equals(towerAlarm.getStandardHighAlarm(), 1)) { String fieldName = ReflectionUtil.getFieldName(TowerAlarm::getStandardHighAlarm); - addTowerAlarmCountByType(typeNumMap, fieldName); + typeNumMap.put(fieldName, typeNumMap.get(fieldName) + 1); } } return typeNumMap; } - - private void addTowerAlarmCountByType(Map typeNumMap, String fieldName) { - Integer integer = typeNumMap.get(fieldName); - if (integer != null) { - integer += 1; - } else { - integer = 1; - } - typeNumMap.put(fieldName, integer); - } - } diff --git a/src/main/java/com/zhgd/xmgl/modules/bimface/service/impl/ProjectBimfaceServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/bimface/service/impl/ProjectBimfaceServiceImpl.java index 6206d5a4a..16fbeb568 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bimface/service/impl/ProjectBimfaceServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/bimface/service/impl/ProjectBimfaceServiceImpl.java @@ -135,8 +135,7 @@ public class ProjectBimfaceServiceImpl extends ServiceImpl> selectEnvironmentAlarmCountTotal(@RequestBody Map map) { + public Result selectEnvironmentAlarmCountTotal(@RequestBody Map map) { return Result.success(environmentAlarmService.selectEnvironmentAlarmCountTotal(map)); } diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/entity/vo/EnvironmentAlarmCountTotalVo.java b/src/main/java/com/zhgd/xmgl/modules/environment/entity/vo/EnvironmentAlarmCountTotalVo.java new file mode 100644 index 000000000..183bdc8d8 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/environment/entity/vo/EnvironmentAlarmCountTotalVo.java @@ -0,0 +1,25 @@ +package com.zhgd.xmgl.modules.environment.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class EnvironmentAlarmCountTotalVo { + @ApiModelProperty(value = "报警总数") + private String totalAlarm; + @ApiModelProperty(value = "pm2.5报警数") + private Integer pm25Num; + @ApiModelProperty(value = "pm10报警数") + private Integer pm10Num; + @ApiModelProperty(value = "白天噪音或夜晚噪音报警数") + private Integer noiseNum; + @ApiModelProperty(value = "风速报警数") + private Integer windspeedNum; + @ApiModelProperty(value = "TSP报警数") + private Integer tspNum; + @ApiModelProperty(value = "温度报警数") + private Integer temperatureNum; + @ApiModelProperty(value = "湿度报警数") + private Integer humidityNum; + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/service/IEnvironmentAlarmService.java b/src/main/java/com/zhgd/xmgl/modules/environment/service/IEnvironmentAlarmService.java index d328524df..236508414 100644 --- a/src/main/java/com/zhgd/xmgl/modules/environment/service/IEnvironmentAlarmService.java +++ b/src/main/java/com/zhgd/xmgl/modules/environment/service/IEnvironmentAlarmService.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.modules.environment.entity.*; import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.xmgl.modules.environment.entity.vo.EnvironmentAlarmCountTotalVo; import com.zhgd.xmgl.modules.project.entity.qo.QueryProjectTodayAlarmInfoQO; import java.util.List; @@ -26,7 +27,7 @@ public interface IEnvironmentAlarmService extends IService { Map selectHistoryEnvironmentAlarmList(Map map); - Map selectEnvironmentAlarmCountTotal(Map map); + EnvironmentAlarmCountTotalVo selectEnvironmentAlarmCountTotal(Map map); void saveEnvironmentAlarmImage(JSONObject json); diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/EnvironmentAlarmServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/EnvironmentAlarmServiceImpl.java index 64e81aa7a..98b79d2a9 100644 --- a/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/EnvironmentAlarmServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/EnvironmentAlarmServiceImpl.java @@ -1,5 +1,6 @@ package com.zhgd.xmgl.modules.environment.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.xuyanwu.spring.file.storage.FileInfo; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -13,6 +14,7 @@ import com.zhgd.xmgl.modules.basicdata.service.INoticeService; import com.zhgd.xmgl.modules.basicdata.service.UploadFileService; import com.zhgd.xmgl.modules.bigdevice.mapper.BigDeviceVideoMapper; import com.zhgd.xmgl.modules.environment.entity.*; +import com.zhgd.xmgl.modules.environment.entity.vo.EnvironmentAlarmCountTotalVo; import com.zhgd.xmgl.modules.environment.mapper.EnvironmentAlarmMapper; import com.zhgd.xmgl.modules.environment.mapper.EnvironmentWarningMapper; import com.zhgd.xmgl.modules.environment.service.IEnvironmentAlarmService; @@ -791,9 +793,11 @@ public class EnvironmentAlarmServiceImpl extends ServiceImpl selectEnvironmentAlarmCountTotal(Map map) { - map.put("companyType","4"); - return environmentAlarmMapper.selectEnvironmentAlarmCountTotal(map); + public EnvironmentAlarmCountTotalVo selectEnvironmentAlarmCountTotal(Map map) { + map.put("companyType", "4"); + Map rtMap = environmentAlarmMapper.selectEnvironmentAlarmCountTotal(map); + EnvironmentAlarmCountTotalVo vo = BeanUtil.toBeanIgnoreCase(rtMap, EnvironmentAlarmCountTotalVo.class, true); + return vo; } @Override diff --git a/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProjectServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProjectServiceImpl.java index 15d79b0c1..6018e65cf 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProjectServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProjectServiceImpl.java @@ -647,17 +647,24 @@ public class ProjectServiceImpl extends ServiceImpl impl String authorization = "hmac username=\"" + fmsMonitoringScreenUsername + "\", algorithm=\"" + algorithm + "\", headers=\"date request-line\", signature=\"" + signature + "\""; String accessUrl = fmsMonitoringScreenRequestHost + "/api-gateway/v2/system/getAccessToken"; log.info("accessUrl:{},authorization:{},date:{}", accessUrl, authorization, gmtTime); - String rs = HttpRequest.get(accessUrl) - .header("authorization", authorization) - .header("date", gmtTime) - .execute().body(); - log.info("rs(获取access_token):{}", rs); - JSONObject tokenJsonObject = com.alibaba.fastjson.JSON.parseObject(rs); - if (!tokenJsonObject.getBoolean("success")) { + JSONObject tokenJsonObject = null; + String token; + try { + String rs = HttpRequest.get(accessUrl) + .header("authorization", authorization) + .header("date", gmtTime) + .execute().body(); + log.info("rs(获取access_token):{}", rs); + tokenJsonObject = com.alibaba.fastjson.JSON.parseObject(rs); + if (!tokenJsonObject.getBoolean("success")) { + throw new OpenAlertException(MessageUtil.get("thirdErr")); + } + JSONObject dataJSONObject = tokenJsonObject.getJSONObject("data"); + token = dataJSONObject.getString("token"); + } catch (Exception e) { + log.error("err:", e); throw new OpenAlertException(MessageUtil.get("thirdErr")); } - JSONObject dataJSONObject = tokenJsonObject.getJSONObject("data"); - String token = dataJSONObject.getString("token"); //返回url String url = fmsMonitoringScreenPageUrl + token; diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerAttendanceController.java b/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerAttendanceController.java index 600dedb4a..77249977a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerAttendanceController.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerAttendanceController.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.zhgd.annotation.OperLog; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.entity.vo.AttendanceOfEachCompanyVo; import com.zhgd.xmgl.entity.vo.NumberTimeTableVo; import com.zhgd.xmgl.modules.worker.service.IWorkerAttendanceService; import com.zhgd.xmgl.util.ExcelUtils; @@ -210,4 +211,16 @@ public class WorkerAttendanceController { return Result.success(workerAttendanceService.queryAttendanceTrendOfTheLastWeek(map)); } + @ApiOperation(value = "查询每个公司的出勤人数和统计人数", notes = "查询每个公司的出勤人数和统计人数", httpMethod = "GET") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"), + @ApiImplicitParam(name = "type", value = "类型,1查询前十", paramType = "query", required = false, dataType = "String"), + @ApiImplicitParam(name = "userEnterpriseId", value = "用户能查看的企业", paramType = "query", required = false, dataType = "String"), + @ApiImplicitParam(name = "personType", value = "人员类型 1、劳务人员 2、管理人员,不传查所有", paramType = "query", required = false, dataType = "String"), + }) + @GetMapping(value = "/queryAttendanceOfEachCompany") + public Result queryAttendanceOfEachCompany(@RequestParam Map map) { + return Result.success(workerAttendanceService.queryAttendanceOfEachCompany(map)); + } + } diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInfoController.java b/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInfoController.java index 6ba1fc3c0..51181f2de 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInfoController.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/controller/WorkerInfoController.java @@ -1,7 +1,6 @@ package com.zhgd.xmgl.modules.worker.controller; import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.zhgd.annotation.OperLog; import com.zhgd.jeecg.common.api.vo.Result; @@ -10,6 +9,7 @@ import com.zhgd.redis.annotation.ApiIdempotent; import com.zhgd.xmgl.modules.worker.entity.WorkerInfo; import com.zhgd.xmgl.modules.worker.entity.vo.DeclareAgeVO; import com.zhgd.xmgl.modules.worker.entity.vo.PersonnelSituationVO; +import com.zhgd.xmgl.modules.worker.entity.vo.ProjectCompanyWorkTotal; import com.zhgd.xmgl.modules.worker.entity.vo.WorkerInfoDetailsVo; import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService; import com.zhgd.xmgl.util.MessageUtil; @@ -353,7 +353,7 @@ public class WorkerInfoController { @ApiImplicitParam(name = "personType", value = "人员类型 1、劳务人员 2、管理人员,不传查所有", paramType = "query", required = false, dataType = "String"), }) @PostMapping("/selectProjectComapnyWorkTotalList") - public Result> selectProjectComapnyWorkTotalList(@RequestBody Map map) { + public Result> selectProjectComapnyWorkTotalList(@RequestBody Map map) { return Result.success(workerInfoService.selectProjectComapnyWorkTotalList(map)); } diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/entity/vo/ProjectCompanyWorkTotal.java b/src/main/java/com/zhgd/xmgl/modules/worker/entity/vo/ProjectCompanyWorkTotal.java new file mode 100644 index 000000000..6e4917cad --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/worker/entity/vo/ProjectCompanyWorkTotal.java @@ -0,0 +1,20 @@ +package com.zhgd.xmgl.modules.worker.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ProjectCompanyWorkTotal { + + @ApiModelProperty(value = "出勤人数") + private Integer presencePersonNum; + @ApiModelProperty(value = "在场人数") + private Integer attendancePersonNum; + @ApiModelProperty(value = "在册人数") + private Integer totalPersonNum; + @ApiModelProperty(value = "企业id") + private String enterpriseId; + @ApiModelProperty(value = "企业名称") + private String enterpriseName; + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerAttendanceService.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerAttendanceService.java index cca43f3f3..081754684 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerAttendanceService.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerAttendanceService.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.entity.vo.AttendanceOfEachCompanyVo; import com.zhgd.xmgl.entity.vo.NumberTimeTableVo; import com.zhgd.xmgl.modules.worker.entity.WorkerAttendance; import com.baomidou.mybatisplus.extension.service.IService; @@ -72,4 +73,6 @@ public interface IWorkerAttendanceService extends IService { List queryTodaySAttendanceTrend(Map map); List queryAttendanceTrendOfTheLastWeek(Map map); + + AttendanceOfEachCompanyVo queryAttendanceOfEachCompany(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerInfoService.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerInfoService.java index 50f49e11f..3fb02270c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerInfoService.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/IWorkerInfoService.java @@ -7,6 +7,7 @@ import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.modules.worker.entity.WorkerInfo; import com.zhgd.xmgl.modules.worker.entity.vo.DeclareAgeVO; import com.zhgd.xmgl.modules.worker.entity.vo.PersonnelSituationVO; +import com.zhgd.xmgl.modules.worker.entity.vo.ProjectCompanyWorkTotal; import com.zhgd.xmgl.modules.worker.entity.vo.WorkerInfoDetailsVo; import org.springframework.web.multipart.MultipartFile; @@ -66,7 +67,7 @@ public interface IWorkerInfoService extends IService { void exporZipWorkerInfo(HttpServletResponse response, Map map); - List selectProjectComapnyWorkTotalList(Map map); + List selectProjectComapnyWorkTotalList(Map map); List selectProjectTeamWorkTotalList(Map map); diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerAttendanceServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerAttendanceServiceImpl.java index d9308d307..ae675d917 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerAttendanceServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerAttendanceServiceImpl.java @@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.async.AsyncSendAttendance; +import com.zhgd.xmgl.entity.vo.AttendanceOfEachCompanyVo; import com.zhgd.xmgl.entity.vo.NumberTimeTableVo; import com.zhgd.xmgl.modules.basicdata.service.ICompanyService; import com.zhgd.xmgl.modules.basicdata.service.UploadFileService; @@ -26,8 +27,10 @@ import com.zhgd.xmgl.modules.project.mapper.ProjectUfaceConfigMapper; import com.zhgd.xmgl.modules.worker.entity.*; import com.zhgd.xmgl.modules.worker.entity.bo.WorkerAttendanceBo; import com.zhgd.xmgl.modules.worker.entity.dto.GetPassRecordDto; +import com.zhgd.xmgl.modules.worker.entity.vo.ProjectCompanyWorkTotal; import com.zhgd.xmgl.modules.worker.mapper.*; import com.zhgd.xmgl.modules.worker.service.IWorkerAttendanceService; +import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService; import com.zhgd.xmgl.modules.worker.service.IWorkerMonthAttendanceStatisticsService; import com.zhgd.xmgl.util.*; import lombok.extern.slf4j.Slf4j; @@ -59,6 +62,8 @@ import static com.zhgd.xmgl.config.FaceRunner.faceEngine; @Slf4j @Transactional(rollbackFor = Exception.class) public class WorkerAttendanceServiceImpl extends ServiceImpl implements IWorkerAttendanceService { + @Autowired + private IWorkerInfoService workerInfoService; @Autowired private WorkerAttendancePresenceServiceImpl workerAttendancePresenceService; @Autowired @@ -1030,6 +1035,17 @@ status 状态码 String 1表示成功;其余表示失败 return attendances; } + @Override + public AttendanceOfEachCompanyVo queryAttendanceOfEachCompany(Map map) { + //统计各企业出勤人数 + List projectCompanyWorkTotals = workerInfoService.selectProjectComapnyWorkTotalList(map); + int presencePersonNum = projectCompanyWorkTotals.stream().mapToInt(ProjectCompanyWorkTotal::getPresencePersonNum).sum(); + AttendanceOfEachCompanyVo vo = new AttendanceOfEachCompanyVo(); + vo.setAttendanceNum(presencePersonNum); + vo.setProjectCompanyWorkTotalList(projectCompanyWorkTotals); + return vo; + } + private void completeData(List attendances) { Map timeMap = attendances.stream().collect(Collectors.toMap(NumberTimeTableVo::getTime, o -> o)); attendances.clear(); diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java index cf9d4a226..ae4017254 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.zhgd.xmgl.modules.worker.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.map.MapUtil; @@ -29,6 +30,7 @@ import com.zhgd.xmgl.modules.project.service.IProjectUfaceConfigService; import com.zhgd.xmgl.modules.worker.entity.*; import com.zhgd.xmgl.modules.worker.entity.vo.DeclareAgeVO; import com.zhgd.xmgl.modules.worker.entity.vo.PersonnelSituationVO; +import com.zhgd.xmgl.modules.worker.entity.vo.ProjectCompanyWorkTotal; import com.zhgd.xmgl.modules.worker.entity.vo.WorkerInfoDetailsVo; import com.zhgd.xmgl.modules.worker.enums.EduTypeEnum; import com.zhgd.xmgl.modules.worker.mapper.*; @@ -936,7 +938,7 @@ public class WorkerInfoServiceImpl extends ServiceImpl selectProjectComapnyWorkTotalList(Map map) { + public List selectProjectComapnyWorkTotalList(Map map) { List list = workerInfoMapper.selectProjectEnterpriseList(map); if (list != null && list.size() > 0) { //统计各企业出勤人数 @@ -981,7 +983,8 @@ public class WorkerInfoServiceImpl extends ServiceImpl rtList = list.stream().map(e -> BeanUtil.toBeanIgnoreCase(e, ProjectCompanyWorkTotal.class, true)).collect(Collectors.toList()); + return rtList; } private Map getEnterpriseToMap(List> list) { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index eb03bd71c..da47387a7 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,14 +1,14 @@ -# \u73AF\u5883\u9009\u62E9 +# 环境选择 spring.profiles.active=zjsj-gsx -# \u56FD\u9645\u5316\u914D\u7F6E +# 国际化配置 spring.messages.basename=i18n/messages spring.messages.encoding=utf-8 -# \u540E\u53D1\u73B0\u7684bean\u4F1A\u8986\u76D6\u4E4B\u524D\u76F8\u540C\u540D\u79F0\u7684bean +# 后发现的bean会覆盖之前相同名称的bean spring.main.allow-bean-definition-overriding=true -# \u6570\u636E\u5E93\u9A71\u52A8\u7C7B +# 数据库驱动类 spring.datasource.driver-class-name=com.mysql.jdbc.Driver #spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -# \u6570\u636E\u5E93\u8FDE\u63A5\u6C60\u914D\u7F6E +# 数据库连接池配置 spring.datasource.type=com.zaxxer.hikari.HikariDataSource spring.datasource.hikari.minimum-idle=20 spring.datasource.hikari.maximum-pool-size=500 @@ -20,38 +20,38 @@ spring.datasource.hikari.validation-timeout=3000 #(wait_timeout-30)*1000 spring.datasource.hikari.connection-timeout=50000 spring.datasource.hikari.connection-test-query=SELECT 1 -# \u6570\u636E\u5E93\u52A0\u5BC6\u7B7E\u540D +# 数据库加密签名 jasypt.encryptor.password=JXJZHGDPT -# \u5982\u679C\u67E5\u8BE2\u7ED3\u679C\u4E2D\u5305\u542B\u7A7A\u503C\u7684\u5217\uFF0C\u5219 MyBatis \u5728\u6620\u5C04\u7684\u65F6\u5019\uFF0C\u4F1A\u4E0D\u4F1A\u6620\u5C04\u8FD9\u4E2A\u5B57\u6BB5 +# 如果查询结果中包含空值的列,则 mybatis 在映射的时候,会不会映射这个字段 mybatis-plus.configuration.call-setters-on-nulls=true -# \u5E8F\u5217\u5316\u914D\u7F6E +# 序列化配置 spring.jackson.defaultPropertyInclusion=ALWAYS -# mybatis \u914D\u7F6E +# mybatis 配置 mybatis-plus.mapper-locations=classpath*:com/zhgd/xmgl/**/*.xml,classpath*:com/zhwl/zw/**/*.xml mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2) #mybatis-plus.global-config.db-config.logic-delete-field=flag mybatis-plus.global-config.db-config.logic-delete-value=1 mybatis-plus.global-config.db-config.logic-not-delete-value=0 -# mvc \u89C6\u56FE\u5BF9\u8C61\u914D\u7F6E +# mvc 视图对象配置 spring.mvc.view.prefix=/ spring.mvc.view.suffix=.html spring.mvc.dispatch-options-request=true -# jwt\u7B7E\u540D +# jwt签名 security.jwt.token.secret-key=zhgd -# \u6587\u4EF6\u4E0A\u4F20\u914D\u7F6E +# 文件上传配置 spring.servlet.multipart.enabled=true spring.servlet.multipart.file-size-threshold=0 spring.servlet.multipart.max-file-size=1024MB spring.servlet.multipart.max-request-size=1024MB spring.servlet.multipart.resolve-lazily=false -# mqtt\u670D\u52A1\u5668\u914D\u7F6E +# mqtt服务器配置 mqtt.username=admin mqtt.password=public #mqtt.url=tcp://139.159.226.224:1883 #mqtt.url=ws://139.159.226.224:8083/mqtt mqtt.url=tcp://182.90.224.147:1883 -# \u6D88\u8D39\u8005\u548C\u63D0\u4F9B\u8005\u5BF9\u5E94\u7684\u5BA2\u6237\u7AEFid\u4EE5\u53CA\u9ED8\u8BA4topic +# 消费者和提供者对应的客户端id以及默认topic mqtt.producer.clientId=mqttProd mqtt.producer.defaultTopic=topic1 mqtt.consumer.clientId=mqttConsumer @@ -63,21 +63,21 @@ server.ssl.key-store-password=Un8&yP!o^Nyd*gm# server.ssl.key-store-type=JKS server.ssl.enabled=true image.visit.url= -# \u534E\u4E3A\u4E91\u914D\u7F6E +# 华为云配置 hw-ocr-username=szjxjzh hw-ocr-password=jxj27696951 hw-ocr-domainname=szjxjzh hw-ocr-projectid=0633b705cc000f3e2f55c010af021eec hw-ocr-endpoint=cn-east-3 hw-ocr-enable=false -# \u8679\u8F6F\u914D\u7F6E +# 虹软配置 arcsoft.appId=4F9jmKsCYKsQskYBTXK7sQZLH8dFdT7LK5Yjx5XA8gkB arcsoft.sdkKey=FUPhPPfPXrAmFrecmCSiG5BjmHSwp86QogvdCM7g8B5k arcsoft.linux.sdkKey=FUPhPPfPXrAmFrecmCSiG5BjdAskGRSejyGzUuVj4F6V arcsoft.ufaceSorce=80 -# \u6388\u6743\u6821\u9A8C +# 授权校验 checkAuthEnable=false -# \u534E\u4E3A\u4E91\u77ED\u4FE1\u670D\u52A1\u914D\u7F6E +# 华为云短信服务配置 sms.hw.appKey=JxU82mBx1x4l4RC78ynN1D9Q3neI sms.hw.appSecret=c9wi20z1z5N1YZ2T6UH2BJuTUAF4 sms.hw.verify.signchannel=88200413256 @@ -87,7 +87,7 @@ sms.hw.notice.templateId.standardAlarm=790d907f70594b4893227fc1d97e78bc sms.hw.notice.templateId.standardDevState=10930770f5954d12881143e548f8483b sms.hw.notice.templateId.carPass= swagger.enable=true -# redis\u96C6\u7FA4 +# redis集群 #spring.redis.database=0 #spring.redis.cluster.nodes=127.0.0.1:6379,192.168.40.156:6380 #spring.redis.cluster.max-redirects=3 @@ -98,22 +98,22 @@ swagger.enable=true #spring.redis.lettuce.pool.min-idle=5 #\u4E2A\u63A8\u914D\u7F6E getui.baseUrl=https://restapi.getui.com/v2/ -# \u65B0\u914D\u7F6E +# 新配置 getui.appId=vTqRdzRpeI8SnXKDawStZ3 getui.appKey=wlPjAki13R8STuofcjnXM1 getui.appSecret=Wy3FFyaXzb9MUl94FMrLo1 getui.masterSecret=zZ5bMTOjUe5v3MFhm8gLL #\u5224\u65AD\u8003\u52E4\u56DE\u8C03\u662F\u5426\u9700\u8981\u56FE\u7247,1\u662F -# \u4EBA\u5458\u8003\u52E4\u56FE\u7247\u7C7B\u578B 1\uFF1Abase64 +# 人员考勤图片类型 1:base64 imageType=1 -# jxj\u8BBE\u5907\u56FE\u7247\u7C7B\u578B +# jxj设备图片类型 jxj.dev.image.type=1 pdf.watermark=\u5B9E\u540D\u5236 -# bimface\u8BF7\u6C42URL +# bimface请求url bim.getTokenURL=https://api.bimface.com/oauth2/token bim.deleteFileURL=https://file.bimface.com/file?fileId=%s bim.uploadURL=https://file.bimface.com/upload?name=%s&url=%s -# redis \u5355\u4F53\u914D\u7F6E +# redis 单体配置 spring.redis.database=1 spring.redis.host=127.0.0.1 spring.redis.port=6379 @@ -124,28 +124,28 @@ spring.redis.lettuce.pool.max-active=8 spring.redis.lettuce.pool.max-wait=60s spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.min-idle=10 -# spring boot admin \u6240\u5728\u670D\u52A1\u5668 +# spring boot admin 所在服务器 spring.boot.admin.client.url=http://localhost:9091 -# actuator \u914D\u7F6E\u5185\u5BB9 +# actuator 配置内容 management.endpoints.web.exposure.include=* management.endpoints.enabled-by-default=true management.endpoints.web.base-path=/actuator management.endpoint.health.show-details=always management.endpoint.logfile.external-file=logs/logs/zhgd-all.log -# \u643A\u7A33\u7535\u7BB1\u83B7\u53D6\u6700\u540E\u4E00\u6761\u6570\u636E +# 携稳电箱获取最后一条数据 xiwon.postElectricRealTimeData=http://openapi.xiwon588.com/electric/realTimeData -# \u643A\u7A33\u5BC6\u94A5 +# 携稳密钥 #xiwon.appId=1638947489842 #xiwon.appSecret=36e0a5cf-02e6-421b-bf92-3b1ace11e1a2 -# \u6B63\u5F0F +# 正式 xiwon.appId=1672383573694 xiwon.appSecret=5dfe1664-51fd-40af-8fbb-a15bbcaae1d1 -# \u5149\u4F0F\u53D1\u7535\u5BA2\u6237\u4FE1\u606F +# 光伏发电客户信息 koyoe.clientId=btxny koyoe.secret=akdu5sar7w -# \u5149\u4F0F\u53D1\u7535\u8BF7\u6C42\u5730\u5740 +# 光伏发电请求地址 koyoe.base-url=https://solar.koyoe.com koyoe.get-token=${koyoe.base-url}/third-party/api/token?grant_type=client_credentials koyoe.nowData=${koyoe.base-url}/third-party/api/nowData?sn=%s -# \u662F\u5426\u8BC1\u4E66\u9A8C\u8BC1 +# 是否证书验证 is-license=false