Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
haungxing 5 months ago
parent
commit
53a4a8d8be
  1. 50
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHistoryVo.java
  2. 28
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmHistoryParamVo.java
  3. 27
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/DeviceElectricVo.java
  4. 14
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectContentEntity.java
  5. 1
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java
  6. 59
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneEvaluationExportDTO.java
  7. 150
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java
  8. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java
  9. 1
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java
  10. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java
  11. 9
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java
  12. 5
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.java
  13. 23
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml
  14. 5
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  15. 15
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  16. 24
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java
  17. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.xml
  18. 20
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java
  19. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/UserDeptConfigController.java
  20. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/UserDeptConfigService.java
  21. 41
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/UserDeptConfigServiceImpl.java
  22. 50
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java
  23. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java
  24. 99
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java
  25. 40
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java
  26. BIN
      hzims-service/safeproduct/src/main/resources/template/卫生考核表.xlsx

50
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHistoryVo.java

@ -0,0 +1,50 @@
package com.hnac.hzims.alarm.config.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
* @author ysj
*/
@Data
public class AlarmHistoryVo {
@ApiModelProperty(value = "站点编号")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "告警类型")
private Integer alarmType;
@ApiModelProperty(value = "告警内容")
private String alarmContext;
@ApiModelProperty("处理人")
private Long handleUser;
@ApiModelProperty("处理人名称")
private Long handleUserName;
@ApiModelProperty("处理附件地址")
private String filePath;
@ApiModelProperty(value = "告警时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
private LocalDateTime alarmTime;
@ApiModelProperty("处理时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date handleTime;
}

28
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/show/vo/AlarmHistoryParamVo.java

@ -0,0 +1,28 @@
package com.hnac.hzims.alarm.show.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
* @date 2023/03/17 10:02:33
* @version 4.0.0
*/
@Data
public class AlarmHistoryParamVo {
@ApiModelProperty(value = "站点编号")
private String stationId;
@ApiModelProperty(value = "告警日期 : yyyy-MM-dd")
private String alarmTime;
@ApiModelProperty(value = "告警类型")
private Integer alarmType;
@ApiModelProperty(value = "处理方式")
private Long handleWay;
}

27
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/DeviceElectricVo.java

@ -0,0 +1,27 @@
package com.hnac.hzims.electric.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author 表头
*/
@Data
public class DeviceElectricVo {
@ApiModelProperty(value = "设备编号")
private String deviceCode;
@ApiModelProperty(value = "字符串格式时间")
private String strTime;
@ApiModelProperty(value = "时间")
private Integer time;
@ApiModelProperty(value = "有功电量")
private Double generate;
@ApiModelProperty(value = "无功电量")
private Double reactiveGenerate;
}

14
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectContentEntity.java

@ -65,6 +65,20 @@ public class ProjectContentEntity extends BaseEntity {
private String checkTypeSon;
/**
* 检测类型子类(多组)
*/
@ApiModelProperty(value = "检测类型子类(多组)")
@TableField(exist = false)
private String multiCheckTypeSon;
/**
* ai识别分析方式设备或大模型
*/
@ApiModelProperty(value = "ai识别分析方式,设备或大模型")
@TableField(exist = false)
private String analyserType;
/**
* 表针识别表盘ID
*/
@ApiModelProperty(value = "表针识别,表盘ID")

1
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java

@ -20,6 +20,7 @@ public interface SafeProductConstant {
*/
String DOCX_SUFFIX = ".docx";
String PDF_SUFFIX = ".pdf";
String XLSX_SUFFIX = ".xlsx";
/**
* 培训管理

59
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneEvaluationExportDTO.java

@ -0,0 +1,59 @@
package com.hnac.hzims.safeproduct.dto;
import com.hnac.hzims.safeproduct.vo.HygieneEvaluationPeopleVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author liwen
* @date 2024-08-20
*/
@Data
@ApiModel(value = "卫生考核导出DTO类")
public class HygieneEvaluationExportDTO {
@ApiModelProperty(value = "年份")
private String year;
@ApiModelProperty(value = "月份")
private String month;
@ApiModelProperty(value = "第一周开始日")
private String firstWeekStart;
@ApiModelProperty(value = "第一周结束日")
private String firstWeekEnd;
@ApiModelProperty(value = "第二周开始日")
private String secondWeekStart;
@ApiModelProperty(value = "第二周结束日")
private String secondWeekEnd;
@ApiModelProperty(value = "第三周开始日")
private String thirdWeekStart;
@ApiModelProperty(value = "第三周结束日")
private String thirdWeekEnd;
@ApiModelProperty(value = "第四周开始日")
private String fourthWeekStart;
@ApiModelProperty(value = "第四周结束日")
private String fourthWeekEnd;
@ApiModelProperty(value = "第五周开始日")
private String fifthWeekStart;
@ApiModelProperty(value = "第五周结束日")
private String fifthWeekEnd;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "考核人员列表")
private List<HygieneEvaluationPeopleVO> evaluationList;
}

150
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java

@ -2,25 +2,37 @@ package com.hnac.hzims.electric.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.electric.entity.ThirtyEntity;
import com.hnac.hzims.electric.entity.ThreeEntity;
import com.hnac.hzims.electric.service.IElectricReportService;
import com.hnac.hzims.electric.service.ThirtyService;
import com.hnac.hzims.electric.service.ThreeService;
import com.hnac.hzims.electric.vo.DeviceElectricVo;
import com.hnac.hzims.electric.vo.TableHeadVo;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.operational.station.vo.StationsByDeptIdsParamVo;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -36,10 +48,14 @@ public class ElectricReportServiceImpl implements IElectricReportService {
private final ThirtyService thirtyService;
private final IEmInfoService deviceService;
private final ISysClient sysClient;
private final IStationClient stationClient;
private final IAnalyseDataSearchClient analyseDataSearchClient;
/**
* 基础报表
* @param deptId
@ -433,7 +449,65 @@ public class ElectricReportServiceImpl implements IElectricReportService {
Map<String,Object> result = new HashMap<>();
// 日
if (type == 0) {
// 站点设备集合
List<EmInfoEntity> devices = deviceService.list(Wrappers.<EmInfoEntity>lambdaQuery()
.eq(EmInfoEntity::getCreateDept,station.getData().getRefDept())
.eq(EmInfoEntity::getEmType,2)
.eq(EmInfoEntity::getHomePageDisplay,1)
);
if(CollectionUtil.isEmpty(devices)){
return new HashMap<>();
}
Date date = DateUtil.parse(time,DateUtil.PATTERN_DATE);
// 根据设备查询当日有功/无功电量
List<DeviceElectricVo> electrics = this.deviceElectrics(devices,date);
// 表头
List<TableHeadVo> tableHeads = new ArrayList<>();
TableHeadVo firstHead = new TableHeadVo();
firstHead.setTableName("时间");
firstHead.setIsChildren(false);
tableHeads.add(firstHead);
TableHeadVo secondHead = new TableHeadVo();
secondHead.setTableName("时总计发电量");
secondHead.setIsChildren(true);
secondHead.setChildren(Arrays.asList("时总有功","时总无功"));
tableHeads.add(secondHead);
// 根据设备分组
devices.forEach(device->{
TableHeadVo tableHead = new TableHeadVo();
tableHead.setTableName(device.getName() + "发电量(kWh)");
tableHead.setIsChildren(true);
tableHead.setChildren(Arrays.asList("时有功","时无功"));
tableHeads.add(tableHead);
});
result.put("tableHead",tableHeads);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
Date end = calendar.getTime();
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
Date start = calendar.getTime();
List<List<Object>> tableDate = new ArrayList<>();
while (start.compareTo(end) < 0){
List<Object> item = new ArrayList<>();
String hours = DateUtil.format(start,"yyyy-MM-dd HH");
item.add(start.getMonth() + 1 + "月");
// 总计:有功、无功
item.add(electrics.stream().filter(electric -> electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getGenerate).sum());
item.add(electrics.stream().filter(electric -> electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getReactiveGenerate).sum());
// 遍历机组
devices.stream().sorted(Comparator.comparing(EmInfoEntity::getEmIndex)).forEach(device->{
item.add(electrics.stream().filter(electric -> electric.getDeviceCode().equals(device.getNumber()) && electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getGenerate).sum());
item.add(electrics.stream().filter(electric -> electric.getDeviceCode().equals(device.getNumber()) && electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getReactiveGenerate).sum());
});
calendar.add(Calendar.DAY_OF_MONTH,1);
start = calendar.getTime();
tableDate.add(item);
}
result.put("tableDate",tableDate);
}
// 月
else if (type == 1) {
@ -561,4 +635,80 @@ public class ElectricReportServiceImpl implements IElectricReportService {
}
return result;
}
/**
* 查询设备当日有功/无功电量
* @param devices
* @return
*/
private List<DeviceElectricVo> deviceElectrics(List<EmInfoEntity> devices,Date date) {
List<DeviceElectricVo> electrics = new ArrayList<>();
devices.forEach(device->{
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
Date endTime = calendar.getTime();
LocalDateTime end = LocalDateTime.parse(DateUtil.format(new Date(), DateUtil.format(endTime,DateUtil.PATTERN_DATETIME)), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME));
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
Date startTime = calendar.getTime();
LocalDateTime start = LocalDateTime.parse(DateUtil.format(new Date(), DateUtil.format(startTime,DateUtil.PATTERN_DATETIME)), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME));
AnalyseCodeByAnalyseDataPO param = new AnalyseCodeByAnalyseDataPO();
param.setDeviceCode(device.getNumber());
List<AnalyzeDataConditionPO> conditions = new ArrayList<>();
// 有功电量
AnalyzeDataConditionPO generate = new AnalyzeDataConditionPO();
generate.setFull(1);
generate.setKeepFigures(2);
generate.setAccessRules(6);
generate.setSaveTimeType(2);
generate.setSignages("generation_capacity");
generate.setTimeInterval(1);
generate.setBeginTime(start);
generate.setEndTime(end);
conditions.add(generate);
// 无功电量
AnalyzeDataConditionPO reactive = new AnalyzeDataConditionPO();
reactive.setFull(1);
reactive.setKeepFigures(2);
reactive.setAccessRules(6);
reactive.setSaveTimeType(2);
reactive.setSignages("reactive_generation");
reactive.setTimeInterval(1);
reactive.setBeginTime(start);
reactive.setEndTime(end);conditions.add(reactive);
param.setSignboardConditions(conditions);
R<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(param);
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData())){
return;
}
while (startTime.compareTo(endTime) < 0){
DeviceElectricVo electric = new DeviceElectricVo();
electric.setStrTime(DateUtil.format(startTime,"yyyy-MM-dd HH"));
electric.setTime(startTime.getHours());
if(ObjectUtil.isEmpty(result.getData().get(0)) || CollectionUtil.isEmpty(result.getData().get(0).getList())){
electric.setGenerate(result.getData().get(0).getList().stream().filter(o->o.getTs().contains(electric.getStrTime())).mapToDouble(val->{
if(StringUtils.isEmpty(val.getVal())){
return 0.0;
}
return Double.parseDouble(val.getVal());
}).sum());
}else{
electric.setGenerate(0.0);
}
if(ObjectUtil.isEmpty(result.getData().get(1)) || CollectionUtil.isEmpty(result.getData().get(1).getList())){
electric.setReactiveGenerate(result.getData().get(1).getList().stream().filter(o->o.getTs().contains(electric.getStrTime())).mapToDouble(val->{
if(StringUtils.isEmpty(val.getVal())){
return 0.0;
}
return Double.parseDouble(val.getVal());
}).sum());
}else{
electric.setReactiveGenerate(0.0);
}
electrics.add(electric);
calendar.add(Calendar.HOUR_OF_DAY,+1);
startTime = calendar.getTime();
}
});
return electrics;
}
}

8
hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java

@ -73,4 +73,12 @@ public class DeviceHistoryController extends BladeController {
public R<Map<String, Object>> historyCurve(@RequestBody HistoryDataParamVo param) {
return R.data(service.historyCurve(param));
}
@PostMapping("/history_tabulation")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "设备历史数据列表", notes = "获取设备历史数据列表")
public R<Map<String, Object>> historyTabulation(@RequestBody HistoryDataParamVo param) {
return R.data(service.historyTabulation(param));
}
}

1
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java

@ -27,4 +27,5 @@ public interface IHistoryDeviceService {
Map<String, Object> historyCurve(HistoryDataParamVo param);
Map<String, Object> historyTabulation(HistoryDataParamVo param);
}

10
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java

@ -191,6 +191,16 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
return result.getData();
}
/**
* 获取设备历史数据列表
* @param param
* @return
*/
@Override
public Map<String, Object> historyTabulation(HistoryDataParamVo param) {
return null;
}
/**
* 计算查询数据维度

9
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java

@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.alarm.config.vo.AlarmHistoryVo;
import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.show.vo.AlarmHistoryParamVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.alarm.source.service.SystemAlarmService;
@ -66,4 +68,11 @@ public class ShowAlarmController extends BladeController {
return R.data(alarmService.alarmVideos(stationCode,deviceCode,realId,alarmType));
}
@GetMapping ("/history")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "告警列表分页", notes = "传入: AlarmConfigEntity对象,分页参数")
public R<IPage<AlarmHistoryVo>> history(AlarmHistoryParamVo param, Query query) {
return R.data(alarmService.pageCondition(param,Condition.getPage(query)));
}
}

5
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.java

@ -1,7 +1,11 @@
package com.hnac.hzims.alarm.show.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.config.vo.AlarmHistoryVo;
import com.hnac.hzims.alarm.show.vo.AlarmHistoryParamVo;
import org.apache.ibatis.annotations.Param;
/**
* @author ysj
@ -9,4 +13,5 @@ import com.hnac.hzims.alarm.config.entity.AlarmEntity;
public interface AlarmMapper extends BaseMapper<AlarmEntity> {
IPage<AlarmHistoryVo> pageCondition(@Param(value="param") AlarmHistoryParamVo param, IPage<AlarmHistoryVo> page);
}

23
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.xml

@ -2,4 +2,27 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.alarm.show.mapper.AlarmMapper">
<select id="pageCondition" resultType="com.hnac.hzims.alarm.config.vo.AlarmHistoryVo">
SELECT ALARM.STATION_ID,ALARM.STATION_NAME,ALARM.ALARM_TYPE,ALARM.ALARM_CONTEXT,
HANDLE.HANDLE_WAY,HANDLE.CREATE_USER HANDLE_USER,HANDLE.CREATE_USER_NAME HANDLE_USER_NAME,ALARM.ALARM_TIME,
HANDLE.CREATE_TIME HANDLE_TIME,HANDLE.FILE_PATH
FROM HZIMS_ALARM ALARM
LEFT JOIN HZIMS_ALARM_HANDLE HANDLE
ON ALARM.ALARM_ID = HANDLE.ALARM_ID
<where>
ALARM.IS_DELETED = 0
<if test="param.stationId != null and param.stationId != ''">
AND ALARM.STATION_ID = #{param.stationId}
</if>
<if test="param.alarmTime != null and param.alarmTime != ''">
AND ALARM.ALARM_TIME like CONCAT('%',#{param.alarmTime}, '%')
</if>
<if test="param.alarmType != null and param.alarmType != ''">
AND ALARM.ALARM_TYPE = #{param.alarmType}
</if>
<if test="param.handleWay != null and param.handleWay != ''">
AND HANDLE.HANDLE_WAY = #{param.handleWay}
</if>
</where>
</select>
</mapper>

5
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java

@ -4,9 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.alarm.config.entity.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.alarm.config.vo.AlarmHistoryVo;
import com.hnac.hzims.alarm.show.vo.AlarmHistoryParamVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo;
import org.springframework.web.socket.TextMessage;
import java.util.List;
@ -25,4 +26,6 @@ public interface AlarmService extends IService<AlarmEntity> {
TextMessage majorAlarm(List<String> stations);
List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmType);
IPage<AlarmHistoryVo> pageCondition(AlarmHistoryParamVo param, IPage<AlarmHistoryVo> page);
}

15
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java

@ -9,14 +9,15 @@ import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.config.service.AlarmConfigService;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.alarm.config.vo.AlarmHistoryVo;
import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo;
import com.hnac.hzims.alarm.show.mapper.AlarmMapper;
import com.hnac.hzims.alarm.show.service.AlarmHandleService;
import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.show.vo.AlarmHistoryParamVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.alarm.source.service.MessageService;
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
@ -418,6 +419,7 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
throw new ServiceException("未查询到告警视频信息!");
}
/**
*查询站点绑定视频信息
* @param stationCode
@ -544,4 +546,15 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
return alarmVideo;
}).collect(Collectors.toList());
}
/**
* 告警历史分页查询
* @param param
* @param page
* @return
*/
@Override
public IPage<AlarmHistoryVo> pageCondition(AlarmHistoryParamVo param, IPage<AlarmHistoryVo> page) {
return this.baseMapper.pageCondition(param,page);
}
}

24
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java

@ -1,5 +1,6 @@
package com.hnac.hzims.bigmodel.zhipuai.handler;
import cn.hutool.core.lang.Assert;
import com.hnac.hzinfo.exception.HzServiceException;
import com.zhipu.oapi.Constants;
import com.zhipu.oapi.service.v4.model.ChatCompletionRequest;
@ -35,7 +36,7 @@ public class ZhipuAnalysisHandlerGlm4v extends AbstractZhipuAnalysisHandler {
@Override
public ModelApiResponse sendRequest(String text, String url) {
ChatCompletionRequest request = getRequest(text, url);
log.info("send zhipu ai request :{}", Optional.ofNullable(request).map(req -> JsonUtil.toJson(req)).orElse("null"));
log.info("send zhipu ai request :{}", Optional.ofNullable(request).map(JsonUtil::toJson).orElse("null"));
return client.invokeModelApi(request);
}
@ -70,19 +71,18 @@ public class ZhipuAnalysisHandlerGlm4v extends AbstractZhipuAnalysisHandler {
@Override
public String getResult(String text, String url) {
ModelApiResponse response = sendRequest(text, url);
log.info("get zhi pu ai response : {}", Optional.ofNullable(response).map(resp -> JsonUtil.toJson(resp)).orElse("null"));
if (response.isSuccess()) {
try {
String resultJson = response.getData().getChoices().get(0).getMessage().getContent().toString();
resultJson = resultJson.substring(resultJson.indexOf("{"), resultJson.lastIndexOf("}") + 1).trim();
return resultJson;
} catch (Exception e) {
log.info("get data from response error", e);
}
} else {
log.info("get zhi pu ai response : {}", Optional.ofNullable(response).map(JsonUtil::toJson).orElse("null"));
Assert.<HzServiceException>isTrue(Objects.nonNull(response) && response.isSuccess(), () -> {
throw new HzServiceException(response.getMsg());
});
try {
String resultJson = response.getData().getChoices().get(0).getMessage().getContent().toString();
resultJson = resultJson.substring(resultJson.indexOf("{"), resultJson.lastIndexOf("}") + 1).trim();
return resultJson;
} catch (Exception e) {
log.info("get data from response error", e);
throw new HzServiceException("获取数据失败");
}
return null;
}
}

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.xml

@ -3,7 +3,7 @@
<mapper namespace="com.hnac.hzinfo.inspect.obj.mapper.ProjectContentMapper">
<select id="getListByProjectId" resultType="com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity">
SELECT t.*,c.code, c.name, c.description, c.check_type,c.CHECK_TYPE_SON,c.CAMERA_ADDR,c.OTHER_PARAM, c.record_type, c.CLOCK_ID, c.CAMERA_ID, c.DICT_TYPE,c.CHECK_VAL
SELECT t.*,c.code, c.name, c.description, c.check_type,c.CHECK_TYPE_SON,c.CAMERA_ADDR,c.OTHER_PARAM,c.ANALYSER_TYPE,c.MULTI_CHECK_TYPE_SON,c.record_type, c.CLOCK_ID, c.CAMERA_ID, c.DICT_TYPE,c.CHECK_VAL
from hz_st_re_project_content t
left JOIN hz_st_re_content c on (t.content_id=c.id)
where t.project_id=#{projectId} AND t.is_deleted=0 ORDER BY t.SORT DESC

20
hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java

@ -228,7 +228,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
// 容量
area.setCapacity(stationReals.stream().mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum());
// 负荷
area.setLoad(reals.stream().mapToDouble(o->{
area.setLoad(stationReals.stream().mapToDouble(o->{
if("MW".equalsIgnoreCase(o.getPowerUnit())){
return o.getActivePower() * 1000;
}
@ -246,13 +246,13 @@ public class HydroelectricServiceImpl implements HydroelectricService {
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(LOAD_HYDROPOWER_TARGET_KEY);
if (CollectionUtil.isNotEmpty(targets)) {
List<HydropowerUnitTargetVo> stationTargets = targets.stream().filter(device -> refDepts.contains(device.getDeptId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(targets)) {
if (CollectionUtil.isNotEmpty(stationTargets)) {
// 年发电量
area.setGenerateYear(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum());
area.setGenerateYear(stationTargets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum());
// 月发电量
area.setGenerateMon(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum());
area.setGenerateMon(stationTargets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum());
// 日发电量
area.setGenerateDay(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum());
area.setGenerateDay(stationTargets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum());
// 年计划发电量
area.setGeneratePlanYear(plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
if(area.getGeneratePlanYear() <= 0 || area.getGenerateYear() <= 0){
@ -322,7 +322,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
// 容量
group.setCapacity(stationReals.stream().mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum());
// 负荷
group.setLoad(reals.stream().mapToDouble(o->{
group.setLoad(stationReals.stream().mapToDouble(o->{
if("MW".equalsIgnoreCase(o.getPowerUnit())){
return o.getActivePower() * 1000;
}
@ -340,13 +340,13 @@ public class HydroelectricServiceImpl implements HydroelectricService {
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(LOAD_HYDROPOWER_TARGET_KEY);
if (CollectionUtil.isNotEmpty(targets)) {
List<HydropowerUnitTargetVo> stationTargets = targets.stream().filter(device -> refDepts.contains(device.getDeptId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(targets)) {
if (CollectionUtil.isNotEmpty(stationTargets)) {
// 年发电量
group.setGenerateYear(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum());
group.setGenerateYear(stationTargets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum());
// 月发电量
group.setGenerateMon(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum());
group.setGenerateMon(stationTargets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum());
// 日发电量
group.setGenerateDay(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum());
group.setGenerateDay(stationTargets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum());
// 年计划发电量
group.setGeneratePlanYear(planClient.getPlanPowerYear(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), DateUtil.format(new Date(),"yyyy")));
if(group.getGeneratePlanYear() <= 0 || group.getGenerateYear() <= 0){

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/UserDeptConfigController.java

@ -38,9 +38,7 @@ public class UserDeptConfigController extends BladeController {
@ApiOperationSupport(order = 2)
@ApiOperation(value = "查询站点用户机构配置保存记录", notes = "传入userId")
public R query(@RequestParam("userId") String userId) {
return R.data(userDeptConfigService.getOne(Wrappers.<UserDeptConfigEntity>lambdaQuery()
.eq(UserDeptConfigEntity::getCreateUser,userId)
));
return R.data(userDeptConfigService.queryByUserId(userId));
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/UserDeptConfigService.java

@ -8,4 +8,6 @@ import com.hnac.hzims.operational.station.entity.UserDeptConfigEntity;
*/
public interface UserDeptConfigService extends IService<UserDeptConfigEntity> {
boolean submit(UserDeptConfigEntity entity);
UserDeptConfigEntity queryByUserId(String userId);
}

41
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/UserDeptConfigServiceImpl.java

@ -9,12 +9,18 @@ import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.service.UserDeptConfigService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
/**
* @author 86187
*/
@ -61,4 +67,39 @@ public class UserDeptConfigServiceImpl extends ServiceImpl<UserDeptConfigMapper,
return super.saveOrUpdate(entity);
}
@Override
public UserDeptConfigEntity queryByUserId(String userId) {
UserDeptConfigEntity config = this.getOne(Wrappers.<UserDeptConfigEntity>lambdaQuery()
.eq(UserDeptConfigEntity::getCreateUser,userId)
);
if(ObjectUtil.isNotEmpty(config)){
return config;
}
config = new UserDeptConfigEntity();
R<List<Dept>> depts = sysClient.getDeptByCurrentUser();
if(depts.isSuccess() && ObjectUtil.isNotEmpty(depts.getData())){
Optional<Dept> optional = depts.getData().stream().min(Comparator.comparing(Dept::getDeptCategory));
if(optional.isPresent()){
config.setDeptId(optional.get().getId());
config.setDeptName(optional.get().getDeptName());
if(optional.get().getDeptCategory() == 4){
StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getRefDept,optional.get().getId())
);
if(ObjectUtil.isNotEmpty(station)){
config.setStationId(station.getCode());
config.setStationName(station.getName());
}else{
config.setStationId(null);
config.setStationName(null);
}
}else{
config.setStationId(null);
config.setStationName(null);
}
}
}
return config;
}
}

50
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java

@ -39,7 +39,7 @@ import java.util.Map;
@RestController
@AllArgsConstructor
@RequestMapping("/hygiene")
@Business(module = Constants.APP_NAME, value = "卫生自查", ignore = false)
@Business(module = Constants.APP_NAME, value = "卫生自查")
@Api(value = "卫生自查", tags = "卫生自查接口")
public class HygieneController extends BladeController {
@ -52,7 +52,7 @@ public class HygieneController extends BladeController {
@PostMapping("/savePlan")
@ApiOperation(value = "新增卫生自查计划")
@ApiOperationSupport(order = 1)
@Operate(label = "新增卫生自查计划", type = BusinessType.INSERT, ignore = false)
@Operate(label = "新增卫生自查计划", type = BusinessType.INSERT)
public R savePlan(@Valid @RequestBody HygienePlanDTO hygienePlanDTO) {
return hygienePlanService.savePlan(hygienePlanDTO);
}
@ -60,7 +60,7 @@ public class HygieneController extends BladeController {
@PostMapping("/updatePlan")
@ApiOperation(value = "修改卫生自查计划")
@ApiOperationSupport(order = 2)
@Operate(label = "修改卫生自查计划", type = BusinessType.UPDATE, ignore = false)
@Operate(label = "修改卫生自查计划", type = BusinessType.UPDATE)
public R updatePlan(@Valid @RequestBody HygienePlanDTO hygienePlanDTO) {
return hygienePlanService.updatePlan(hygienePlanDTO);
}
@ -68,7 +68,7 @@ public class HygieneController extends BladeController {
@PostMapping("/removePlan")
@ApiOperation(value = "删除卫生自查计划")
@ApiOperationSupport(order = 3)
@Operate(label = "删除卫生自查计划", type = BusinessType.DELETE, ignore = false)
@Operate(label = "删除卫生自查计划", type = BusinessType.DELETE)
public R removePlan(@RequestParam Long id) {
return R.status(hygienePlanService.removePlan(id));
}
@ -76,7 +76,7 @@ public class HygieneController extends BladeController {
@GetMapping("/planDetail")
@ApiOperation(value = "卫生自查计划详情")
@ApiOperationSupport(order = 4)
@Operate(label = "卫生自查计划详情", type = BusinessType.QUERY, ignore = false)
@Operate(label = "卫生自查计划详情", type = BusinessType.QUERY)
public R<HygienePlanDetailVO> planDetail(@RequestParam Long id) {
return R.data(hygienePlanService.getPlan(id));
}
@ -90,7 +90,7 @@ public class HygieneController extends BladeController {
})
@ApiOperation(value = "卫生自查计划分页")
@ApiOperationSupport(order = 5)
@Operate(label = "卫生自查计划分页", type = BusinessType.QUERY, ignore = false)
@Operate(label = "卫生自查计划分页", type = BusinessType.QUERY)
public R<IPage<HygienePlanEntity>> planPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<HygienePlanEntity> page = hygienePlanService.planPage(param, query);
return R.data(page);
@ -99,7 +99,7 @@ public class HygieneController extends BladeController {
@PostMapping("/saveRecord")
@ApiOperation(value = "新增卫生自查记录")
@ApiOperationSupport(order = 6)
@Operate(label = "新增卫生自查记录", type = BusinessType.INSERT, ignore = false)
@Operate(label = "新增卫生自查记录", type = BusinessType.INSERT)
public R saveRecord(@Valid @RequestBody HygieneRecordDTO hygieneRecordDTO) {
return hygieneRecordService.saveRecord(hygieneRecordDTO);
}
@ -107,7 +107,7 @@ public class HygieneController extends BladeController {
@PostMapping("/updateRecord")
@ApiOperation(value = "修改卫生自查记录")
@ApiOperationSupport(order = 7)
@Operate(label = "修改卫生自查记录", type = BusinessType.UPDATE, ignore = false)
@Operate(label = "修改卫生自查记录", type = BusinessType.UPDATE)
public R updateRecord(@Valid @RequestBody HygieneRecordDTO hygieneRecordDTO) {
return hygieneRecordService.updateRecord(hygieneRecordDTO);
}
@ -115,7 +115,7 @@ public class HygieneController extends BladeController {
@PostMapping("/removeRecord")
@ApiOperation(value = "删除卫生自查记录")
@ApiOperationSupport(order = 8)
@Operate(label = "删除卫生自查记录", type = BusinessType.DELETE, ignore = false)
@Operate(label = "删除卫生自查记录", type = BusinessType.DELETE)
public R removeRecord(@RequestParam Long id) {
return R.status(hygieneRecordService.removeById(id));
}
@ -123,7 +123,7 @@ public class HygieneController extends BladeController {
@GetMapping("/recordDetail")
@ApiOperation(value = "卫生自查记录详情")
@ApiOperationSupport(order = 9)
@Operate(label = "卫生自查记录详情", type = BusinessType.QUERY, ignore = false)
@Operate(label = "卫生自查记录详情", type = BusinessType.QUERY)
public R<HygieneRecordDetailVO> recordDetail(@RequestParam Long id) {
return R.data(hygieneRecordService.getRecordDetail(id));
}
@ -137,7 +137,7 @@ public class HygieneController extends BladeController {
})
@ApiOperation(value = "卫生自查记录分页")
@ApiOperationSupport(order = 10)
@Operate(label = "卫生自查记录分页", type = BusinessType.QUERY, ignore = false)
@Operate(label = "卫生自查记录分页", type = BusinessType.QUERY)
public R<IPage<HygieneRecordPageVO>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<HygieneRecordPageVO> page = hygieneRecordService.recordPage(param, query);
return R.data(page);
@ -146,7 +146,7 @@ public class HygieneController extends BladeController {
@GetMapping("/dataByMonth")
@ApiOperation(value = "月度统计表")
@ApiOperationSupport(order = 11)
@Operate(label = "月度统计表", type = BusinessType.QUERY, ignore = false)
@Operate(label = "月度统计表", type = BusinessType.QUERY)
public R<IPage<HygieneMonthVO>> dataByMonth(@RequestParam String month, String unit, Query query) {
IPage<HygieneMonthVO> page = hygienePlanService.dataByMonth(month, unit, query);
return R.data(page);
@ -155,7 +155,7 @@ public class HygieneController extends BladeController {
@GetMapping("/exportHygieneRecordData")
@ApiOperation(value = "卫生自查记录表导出")
@ApiOperationSupport(order = 12)
@Operate(label = "卫生自查记录表导出", type = BusinessType.EXPORT, ignore = false)
@Operate(label = "卫生自查记录表导出", type = BusinessType.EXPORT)
public void exportHygieneRecordData(@RequestParam Long id, HttpServletResponse response) {
hygieneRecordService.exportHygieneRecordData(id, response);
}
@ -167,7 +167,7 @@ public class HygieneController extends BladeController {
})
@ApiOperation(value = "月度数据导出")
@ApiOperationSupport(order = 13)
@Operate(label = "月度数据导出", type = BusinessType.EXPORT, ignore = false)
@Operate(label = "月度数据导出", type = BusinessType.EXPORT)
public void exportMonthData(@ApiIgnore @RequestParam Map<String, Object> param, Query query, HttpServletResponse response) {
hygienePlanService.exportMonthData(param, query, response);
}
@ -181,7 +181,7 @@ public class HygieneController extends BladeController {
})
@ApiOperation(value = "卫生自查计划导出")
@ApiOperationSupport(order = 14)
@Operate(label = "卫生自查计划导出", type = BusinessType.EXPORT, ignore = false)
@Operate(label = "卫生自查计划导出", type = BusinessType.EXPORT)
public void exportHygienePlanData(@ApiIgnore @RequestParam Map<String, Object> param, HttpServletResponse response) {
hygienePlanService.exportHygienePlanData(param, response);
}
@ -189,7 +189,7 @@ public class HygieneController extends BladeController {
@PostMapping("/saveHygieneTemplate")
@ApiOperation(value = "新增卫生自查模板")
@ApiOperationSupport(order = 15)
@Operate(label = "新增卫生自查模板", type = BusinessType.INSERT, ignore = false)
@Operate(label = "新增卫生自查模板", type = BusinessType.INSERT)
public R saveHygieneTemplate(@RequestBody HygieneTemplateDTO hygieneTemplateDTO) {
boolean save = hygieneTemplateService.saveHygieneTemplate(hygieneTemplateDTO);
return R.status(save);
@ -198,7 +198,7 @@ public class HygieneController extends BladeController {
@PostMapping("/updateHygieneTemplate")
@ApiOperation(value = "修改卫生自查模板")
@ApiOperationSupport(order = 16)
@Operate(label = "修改卫生自查模板", type = BusinessType.UPDATE, ignore = false)
@Operate(label = "修改卫生自查模板", type = BusinessType.UPDATE)
public R updateHygieneTemplate(@RequestBody HygieneTemplateDTO hygieneTemplateDTO) {
boolean update = hygieneTemplateService.updateHygieneTemplate(hygieneTemplateDTO);
return R.status(update);
@ -207,7 +207,7 @@ public class HygieneController extends BladeController {
@PostMapping("/removeHygieneTemplate")
@ApiOperation(value = "删除卫生自查模板")
@ApiOperationSupport(order = 17)
@Operate(label = "删除卫生自查模板", type = BusinessType.DELETE, ignore = false)
@Operate(label = "删除卫生自查模板", type = BusinessType.DELETE)
public R removeHygieneTemplate(@RequestParam Long id) {
boolean remove = hygieneTemplateService.removeHygieneTemplate(id);
return R.status(remove);
@ -216,7 +216,7 @@ public class HygieneController extends BladeController {
@GetMapping("/hygieneTemplateDetail")
@ApiOperation(value = "卫生自查模板详情")
@ApiOperationSupport(order = 18)
@Operate(label = "卫生自查模板详情", type = BusinessType.QUERY, ignore = false)
@Operate(label = "卫生自查模板详情", type = BusinessType.QUERY)
public R<HygieneTemplateDetailVO> hygieneTemplateDetail(@RequestParam Long id) {
HygieneTemplateDetailVO detail = hygieneTemplateService.getHygieneTemplateDetail(id);
return R.data(detail);
@ -225,7 +225,7 @@ public class HygieneController extends BladeController {
@GetMapping("/hygieneTemplatePage")
@ApiOperation(value = "卫生自查模板分页")
@ApiOperationSupport(order = 19)
@Operate(label = "卫生自查模板分页", type = BusinessType.QUERY, ignore = false)
@Operate(label = "卫生自查模板分页", type = BusinessType.QUERY)
public R<IPage<HygieneTemplateEntity>> hygieneTemplatePage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<HygieneTemplateEntity> page = hygieneTemplateService.getHygieneTemplatePage(param, query);
return R.data(page);
@ -240,7 +240,7 @@ public class HygieneController extends BladeController {
})
@ApiOperation(value = "卫生月度详情列表")
@ApiOperationSupport(order = 20)
@Operate(label = "卫生月度详情列表", type = BusinessType.QUERY, ignore = false)
@Operate(label = "卫生月度详情列表", type = BusinessType.QUERY)
public R<IPage<HygienePlanEntity>> detailListByMonth(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<HygienePlanEntity> page = hygienePlanService.getDetailListByMonth(param, query);
return R.data(page);
@ -254,4 +254,12 @@ public class HygieneController extends BladeController {
HygieneEvaluationPageVO page = hygieneRecordService.getEvaluationPage(month);
return R.data(page);
}
@GetMapping("/exportEvaluationData")
@ApiOperation(value = "卫生考核数据导出")
@ApiOperationSupport(order = 22)
@Operate(label = "卫生考核数据导出", type = BusinessType.EXPORT)
public void exportEvaluationData(@RequestParam String month, HttpServletResponse response) {
hygieneRecordService.exportEvaluationData(month, response);
}
}

7
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java

@ -78,4 +78,11 @@ public interface IHygieneRecordService extends IService<HygieneRecordEntity> {
* @return 考核记录表VO类
*/
HygieneEvaluationPageVO getEvaluationPage(String month);
/**
* 卫生考核数据导出
* @param month 当前月份
* @param response 响应类
*/
void exportEvaluationData(String month, HttpServletResponse response);
}

99
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java

@ -1,17 +1,24 @@
package com.hnac.hzims.safeproduct.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import com.hnac.hzims.safeproduct.dto.HygieneEvaluationExportDTO;
import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum;
import com.hnac.hzims.safeproduct.hazard.util.ExcelConvertPdf;
import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper;
import com.hnac.hzims.safeproduct.mapper.HygieneRecordMapper;
import com.hnac.hzims.safeproduct.service.IHygieneRecordService;
@ -19,6 +26,9 @@ import com.hnac.hzims.safeproduct.service.IHygieneZoneService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.*;
import com.hnac.hzinfo.exception.HzServiceException;
import com.itextpdf.text.DocumentException;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -32,7 +42,14 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.ZoneId;
@ -268,21 +285,21 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
String[] scores = comprehensiveScoreList.get(i).split(",");
// 查询责任区对应的负责人名称
List<HygieneZoneEntity> peopleNameList = baseMapper.selectHygieneZoneByIds(Arrays.asList(zoneIds));
// 遍历责任区数据
for (int j = 0; j < zoneIds.length; j++) {
List<HygieneEvaluationScoreVO> scoreList = new ArrayList<>();
HygieneEvaluationPeopleVO peopleVO = new HygieneEvaluationPeopleVO();
// 查询责任区的负责人名称
String zoneId = zoneIds[j];
Optional<HygieneZoneEntity> zoneOptional = peopleNameList.stream().filter(x -> x.getId().equals(Long.valueOf(zoneId))).findFirst();
if (zoneOptional.isPresent()) {
// 卫生记录周数
Integer weekNo = hygieneRecordEntity.getWeekNum();
// 考核人名称
// 负责人名称
String principal = zoneOptional.get().getPrincipal();
// 判断单位内该名称是否已存在
// 判断单位内该名称是否已存在,存在则补充新的考核分数据,否则新增其考核分数据
Optional<HygieneEvaluationPeopleVO> checkPeople = evaluationList.stream().filter(x -> x.getPrincipal().equals(principal) &&
x.getUnit().equals(hygieneRecordEntity.getUnit())).findFirst();
if (checkPeople.isPresent()) {
peopleVO = checkPeople.get();
scoreList = peopleVO.getScoreList();
@ -307,11 +324,85 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
evaluationList.add(peopleVO);
}
}
// 考核人员列表
pageVO.setEvaluationList(evaluationList);
return pageVO;
}
/**
* 卫生考核数据导出
*/
@Override
public void exportEvaluationData(String month, HttpServletResponse response) {
HygieneEvaluationPageVO page = this.getEvaluationPage(month);
if (ObjectUtil.isEmpty(page)) {
throw new HzServiceException(ResultCode.FAILURE, "无卫生考核数据");
}
// 数据处理
HygieneEvaluationExportDTO exportDTO = new HygieneEvaluationExportDTO();
exportDTO.setRemark(page.getRemark());
// 年份、月份
String[] time = month.split("-");
exportDTO.setYear(time[0]);
exportDTO.setMonth(time[1]);
// 周数据
List<HygieneWeekVO> weekList = page.getWeekList();
weekList.forEach(week -> {
String start = DateUtil.format(week.getStartDate(), "yyyy-MM-dd");
start = start.substring(start.indexOf("-") + 1);
String end = DateUtil.format(week.getEndDate(), "yyyy-MM-dd");
end = end.substring(end.indexOf("-") + 1);
switch (week.getWeekNum()) {
case 1:
exportDTO.setFirstWeekStart(start);
exportDTO.setFirstWeekEnd(end);
break;
case 2:
exportDTO.setSecondWeekStart(start);
exportDTO.setSecondWeekEnd(end);
break;
case 3:
exportDTO.setThirdWeekStart(start);
exportDTO.setThirdWeekEnd(end);
break;
case 4:
exportDTO.setFourthWeekStart(start);
exportDTO.setFourthWeekEnd(end);
break;
case 5:
exportDTO.setFifthWeekStart(start);
exportDTO.setFifthWeekEnd(end);
break;
}
});
// 考核人员数据
exportDTO.setEvaluationList(page.getEvaluationList());
// 封装参数
Map<String, Object> params = BaseUtil.obj2Map(exportDTO);
TemplateExportParams templateParams = new TemplateExportParams("template/卫生考核表.xlsx", true);
// 导出
try {
String fileName = URLEncoder.encode("卫生考核表.xlsx", "UTF-8");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
response.setContentType("application/vnd.ms-excel;charset=utf-8");
Workbook workbook = ExcelExportUtil.exportExcel(templateParams, params);
Sheet sheet = workbook.getSheetAt(0);
BaseUtil.mergeCell(0, 0, JSONArray.parseArray(JSON.toJSONString(exportDTO)), "unit").forEach(sheet::addMergedRegion);
BaseUtil.mergeCell(0, 7, JSONArray.parseArray(JSON.toJSONString(exportDTO)), "remark").forEach(sheet::addMergedRegion);
String pdfPath = "D://" + "/卫生考核表" + SafeProductConstant.PDF_SUFFIX;
OutputStream outputStream = Files.newOutputStream(Paths.get(pdfPath));
ExcelConvertPdf.excelConvertPdf(workbook, outputStream);
BaseUtil.readPdf(response, pdfPath);
} catch (UnsupportedEncodingException e) {
log.error("卫生考核表导出异常-UnsupportedEncodingException:" + e.getMessage());
} catch (DocumentException e) {
log.error("卫生考核表导出异常-DocumentException:" + e.getMessage());
} catch (IOException e) {
log.error("卫生考核表导出异常-IOException:" + e.getMessage());
}
}
/**
* 查询是否存在同月编号
* @param currentMonth 当月
* @return 存在则返回上一编号否则返回null

40
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java

@ -1,10 +1,13 @@
package com.hnac.hzims.safeproduct.utils;
import cn.afterturn.easypoi.word.WordExportUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xwpf.usermodel.*;
import org.json.JSONArray;
import org.json.JSONObject;
@ -421,4 +424,41 @@ public class BaseUtil {
throw new ServiceException("标准总分值未全部分配");
}
}
/**
*
* @param initRow 起始行数
* @param initColumn 起始列数
* @param data 数据
* @param attribute 合并属性
* @return 单元格列表
*/
public static List<CellRangeAddress> mergeCell(int initRow, int initColumn, com.alibaba.fastjson.JSONArray data, String attribute) {
List<CellRangeAddress> result = Lists.newArrayList();
String initAttribute = com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(data.get(0))).getString(attribute);
int mergeCount = 1;
for (int index = 0; index < data.size(); index++) {
if (index == 0) {
continue;
}
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(data.get(index)));
if (object.getString(attribute).equals(initAttribute)) {
mergeCount++;
}
else {
if (mergeCount > 1) {
result.add(new CellRangeAddress(initRow, initRow+mergeCount-1, initColumn, initColumn));
}
initRow = initRow+mergeCount;
initAttribute = object.getString(attribute);
mergeCount = 1;
}
if (index == data.size() -1) {
if (mergeCount > 1) {
result.add(new CellRangeAddress(initRow, initRow + mergeCount-1, initColumn, initColumn));
}
}
}
return result;
}
}

BIN
hzims-service/safeproduct/src/main/resources/template/卫生考核表.xlsx

Binary file not shown.
Loading…
Cancel
Save