Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 7 months ago
parent
commit
8e17639856
  1. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  2. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java
  3. 39
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmVideoClient.java
  4. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  5. 42
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmVideoClient.java
  6. 2
      hzims-service/equipment/src/main/resources/db/2.0.1.sql
  7. 9
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java
  8. 9
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  9. 76
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  10. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/constant/TicketConstant.java
  11. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java
  12. 5
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/MergeDocUtils.java
  13. 12
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/ObjectUtils.java
  14. BIN
      hzims-service/ticket/src/main/resources/template/水力机械工作票模版.docx

5
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -81,8 +81,8 @@ public interface IEmInfoClient {
String GET_CHILDREN_BY_EM_CODE = API_PREFIX + "/getChildrenByEmCode"; String GET_CHILDREN_BY_EM_CODE = API_PREFIX + "/getChildrenByEmCode";
String GET_EM_CREATE_TABLE = API_PREFIX + "/getEmCreateTable"; String GET_EM_CREATE_TABLE = API_PREFIX + "/getEmCreateTable";
String GET_VIDEO_DEVICE_BY_EM_CODE = API_PREFIX + "/getVideoDeviceByEmCode"; String GET_VIDEO_DEVICE_BY_EM_CODE = API_PREFIX + "/getVideoDeviceByEmCode";
String DEVICE_BY_PATH = API_PREFIX + "/deviceByPath"; String DEVICE_BY_PATH = API_PREFIX + "/deviceByPath";
String EM_INFO_LIST = API_PREFIX + "/emInfoList";
@PostMapping(DETAIL) @PostMapping(DETAIL)
EmInfoEntity getByCode(@RequestParam("code") String id); EmInfoEntity getByCode(@RequestParam("code") String id);
@ -166,4 +166,7 @@ public interface IEmInfoClient {
@GetMapping(DEVICE_BY_PATH) @GetMapping(DEVICE_BY_PATH)
List<EmInfoEntity> deviceByPath(@RequestParam("emCode") String emCode); List<EmInfoEntity> deviceByPath(@RequestParam("emCode") String emCode);
@GetMapping(EM_INFO_LIST)
R<List<EmInfoEntity>> emInfoList(EmInfoEntity req);
} }

5
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java

@ -109,4 +109,9 @@ public class IEmInfoClientBack implements IEmInfoClient {
public List<EmInfoEntity> deviceByPath(String emCode) { public List<EmInfoEntity> deviceByPath(String emCode) {
return new ArrayList<>(); return new ArrayList<>();
} }
@Override
public R<List<EmInfoEntity>> emInfoList(EmInfoEntity req) {
return R.fail("远程调用失败");
}
} }

39
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmVideoClient.java

@ -0,0 +1,39 @@
package com.hnac.hzims.equipment.feign;
import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @Author: huangxing
* @Date: 2024/04/19 17:00
*/
@FeignClient(value = EquipmentConstants.APP_NAME)
public interface IEmVideoClient {
String API_PREFIX = "/feign/em/video";
String GET_EM_BANDING_VIDEOS = API_PREFIX + "/getEmBandingVideos";
String IS_BANDING_VIDEO_BY_EM_CODES = API_PREFIX + "/isBandingVideoByEmCode";
/**
* 获取设备绑定视频列表
* @param emCodes 设备编号
* @return 视频列表
*/
@GetMapping(GET_EM_BANDING_VIDEOS)
R<List<EmVideoBandingEntity>> getEmBandingVideos(@RequestParam String emCodes);
/**
* 验证设备编号是否绑定视频
* @param emCode 设备编号
* @return 是否绑定视频结果
*/
@GetMapping(IS_BANDING_VIDEO_BY_EM_CODES)
R isBandingVideoByEmCode(@RequestParam String emCode);
}

8
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.service.IEmInfoService; import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.vo.DeviceVO; import com.hnac.hzims.equipment.vo.DeviceVO;
@ -147,6 +148,13 @@ public class EmInfoClient implements IEmInfoClient {
return service.deviceByPath(emCode); return service.deviceByPath(emCode);
} }
@Override
@GetMapping(EM_INFO_LIST)
public R<List<EmInfoEntity>> emInfoList(EmInfoEntity req) {
LambdaQueryWrapper<EmInfoEntity> queryWrapper = Condition.getQueryWrapper(EmInfoEntity.class, req);
return R.data(service.list(queryWrapper));
}
@PostMapping(GET_EM_CREATE_TABLE) @PostMapping(GET_EM_CREATE_TABLE)
@Override @Override
public List<CreateTableVO> getEmCreateTable(List<String> tableNames) { public List<CreateTableVO> getEmCreateTable(List<String> tableNames) {

42
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmVideoClient.java

@ -0,0 +1,42 @@
package com.hnac.hzims.equipment.feign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import com.hnac.hzims.equipment.service.IEmVideoBandingService;
import com.hnac.hzims.equipment.service.IEmVideoService;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collection;
import java.util.List;
/**
* @Author: huangxing
* @Date: 2024/04/24 11:21
*/
@RestController
@AllArgsConstructor
public class EmVideoClient implements IEmVideoClient{
private final IEmVideoBandingService emVideoBandingService;
@Override
@GetMapping(GET_EM_BANDING_VIDEOS)
public R<List<EmVideoBandingEntity>> getEmBandingVideos(@RequestParam String emCodes) {
LambdaQueryWrapper<EmVideoBandingEntity> wrapper = Wrappers.<EmVideoBandingEntity>lambdaQuery().in(EmVideoBandingEntity::getEmCode, Func.toStrList(",",emCodes));
return R.data(emVideoBandingService.list(wrapper));
}
@Override
public R isBandingVideoByEmCode(String emCode) {
LambdaQueryWrapper<EmVideoBandingEntity> wrapper = Wrappers.<EmVideoBandingEntity>lambdaQuery().eq(EmVideoBandingEntity::getEmCode, emCode);
List<EmVideoBandingEntity> videoList = emVideoBandingService.list(wrapper);
return R.status(CollectionUtil.isNotEmpty(videoList));
}
}

2
hzims-service/equipment/src/main/resources/db/2.0.1.sql

@ -1,2 +1,2 @@
-- 批量处理设备历史数据,将其设为一级设备 -- 批量处理设备历史数据,将其设为一级设备
update hzims_em_info set `path` = CONCAT('/',`NUMBER`) where `path` is null and `is_deleted` = 0 update hzims_em_info set `path` = CONCAT('/',`NUMBER`) where `path` is null and `is_deleted` = 0;

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

@ -6,6 +6,7 @@ import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.source.service.SystemAlarmService; import com.hnac.hzims.alarm.source.service.SystemAlarmService;
import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo; import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -53,4 +54,12 @@ public class ShowAlarmController extends BladeController {
return R.data(alarmService.counts(alarm)); return R.data(alarmService.counts(alarm));
} }
@GetMapping("/getVideosByStationAndRealId")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "站点")
public R<List<EmVideoBandingEntity>> getVideosByStationAndRealId(@ApiParam("站点编号") @RequestParam String stationCode,
@ApiParam("监测点ID") @RequestParam String realId) {
return R.data(alarmService.getVideosByStationAndRealId(stationCode,realId));
}
} }

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

@ -3,6 +3,7 @@ package com.hnac.hzims.alarm.show.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo; import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
@ -20,4 +21,12 @@ public interface AlarmService extends BaseService<AlarmEntity> {
List<AlarmEntity> broadcast(String startTime, String endTime); List<AlarmEntity> broadcast(String startTime, String endTime);
TextMessage majorAlarm(List<Long> depts); TextMessage majorAlarm(List<Long> depts);
/**
* 根据站点realId 获取视频列表
* @param stationCode 站点编号
* @param realId hz3000点位信息
* @return 视频列表
*/
List<EmVideoBandingEntity> getVideosByStationAndRealId(String stationCode,String realId);
} }

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

@ -12,19 +12,30 @@ import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.source.service.MessageService; import com.hnac.hzims.alarm.source.service.MessageService;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo; import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo; import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IEmVideoClient;
import com.hnac.hzims.message.dto.MailMessageDTO; import com.hnac.hzims.message.dto.MailMessageDTO;
import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.project.ProjectClient;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
import java.util.*; import java.util.*;
@ -49,6 +60,9 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
private final IStationClient stationClient; private final IStationClient stationClient;
private final IMessageClient messageClient; private final IMessageClient messageClient;
private final IEmInfoClient emInfoClient;
private final DeviceClient deviceClient;
private final IEmVideoClient emVideoClient;
/** /**
* 查询告警列表 * 查询告警列表
@ -215,6 +229,68 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList()))); return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList())));
} }
@Override
public List<EmVideoBandingEntity> getVideosByStationAndRealId(String stationCode, String realId) {
R<StationEntity> stationR = stationClient.getStationByCode(stationCode);
Assert.isTrue(stationR.isSuccess() && Func.isNotEmpty(stationR.getData()), () -> {
throw new ServiceException("获取站点信息失败!");
});
EmInfoEntity emReq = new EmInfoEntity();
emReq.setDepartment(stationR.getData().getRefDept());
R<List<EmInfoEntity>> emListR = emInfoClient.emInfoList(emReq);
Assert.isTrue(emListR.isSuccess() && CollectionUtil.isNotEmpty(emListR.getData()), () -> {
throw new ServiceException("该站点未获取到设备!");
});
List<EmInfoEntity> emInfoList = emListR.getData();
String emCodes = emInfoList.stream().parallel()
.filter(this::isBandingVideoByEmCode)
.filter(this::isDeviceCodeExist)
.filter(em -> this.isRealIdBanding(realId, em.getNumber()))
.map(EmInfoEntity::getNumber)
.collect(Collectors.joining(","));
Assert.isTrue(StringUtil.isNotBlank(emCodes) && Func.isNotEmpty(emCodes), () -> {
throw new ServiceException("未获取到设备!");
});
R<List<EmVideoBandingEntity>> videoListR = emVideoClient.getEmBandingVideos(emCodes);
Assert.isTrue(videoListR.isSuccess(), () -> {
throw new ServiceException("获取设备绑定视频列表失败!");
});
return videoListR.getData().stream().distinct().collect(Collectors.toList());
}
/**
* 验证设备编号是否绑定视频
* @param emInfo 设备信息
* @return 是否绑定视频结果
*/
public Boolean isBandingVideoByEmCode(EmInfoEntity emInfo) {
return emVideoClient.isBandingVideoByEmCode(emInfo.getNumber()).isSuccess();
}
/**
* 验证设备实例中的属性是否绑定realId
* @param realId hz3000监测点ID
* @param emCode 设备编号
* @return 绑定结果
*/
private Boolean isRealIdBanding(String realId,String emCode) {
R<List<DeviceInstanceAttrVO>> deviceAttrR = deviceClient.getOnlineAttr(emCode);
if(deviceAttrR.isSuccess() && CollectionUtil.isNotEmpty(deviceAttrR.getData())) {
return deviceAttrR.getData().stream().anyMatch(attr -> realId.equals(attr.getFacDeviceAttrId()));
}
return false;
}
/**
* 验证设备code是否存在 (存在是true)
* @param emInfo 设备信息
* @return 是否存在
*/
private Boolean isDeviceCodeExist(EmInfoEntity emInfo) {
R<Boolean> isExistResult = deviceClient.isDeviceCodeExist(emInfo.getNumber());
return Optional.ofNullable(isExistResult).filter(r -> r.isSuccess()).map(R::getData).orElse(false);
}
/** /**
* 子类型数量集合 * 子类型数量集合

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/constant/TicketConstant.java

@ -12,7 +12,7 @@ public class TicketConstant {
/** /**
* window操作系统工作票访问路径 * window操作系统工作票访问路径
*/ */
public static final String TICKET_WINDOW_PATH = "E:/project/HZIMS/hzims-service/ticket/src/main/resources/template/"; public static final String TICKET_WINDOW_PATH = "D:/Java/hzims-back/hzims-service/ticket/src/main/resources/template/";
/** /**
* Liunx操作系统工作票访问路径 * Liunx操作系统工作票访问路径

4
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java

@ -321,7 +321,7 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMa
return pdfSavePath; return pdfSavePath;
} }
else { else {
return "E://template/"; return "D://template/";
} }
} }
@ -394,9 +394,11 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMa
if(Func.isNotEmpty(finish.getLicensorEndTime())) { if(Func.isNotEmpty(finish.getLicensorEndTime())) {
if(workTicketInfoEntity.getIsOffline()) { if(workTicketInfoEntity.getIsOffline()) {
params.put("licensorName2",finish.getEndLicensorName()); params.put("licensorName2",finish.getEndLicensorName());
params.put("licensorNameEnd",finish.getFinishLicensorName());
} }
else { else {
params.put("licensorName2",params.get("licensorName")); params.put("licensorName2",params.get("licensorName"));
params.put("licensorNameEnd",params.get("licensorName"));
} }
params.put("groundNum",finish.getGroundNum()); params.put("groundNum",finish.getGroundNum());
params.put("dismantleNum",finish.getDismantleNum()); params.put("dismantleNum",finish.getDismantleNum());

5
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/MergeDocUtils.java

@ -49,12 +49,13 @@ public class MergeDocUtils {
doc = documentList.get(0); doc = documentList.get(0);
if (i == 0) { if (i == 0) {
//首页直接分页,不再插入首页文档内容 //首页直接分页,不再插入首页文档内容
documentList.get(i).createParagraph().createRun().addBreak(BreakType.PAGE); // 去除增加得分页2024.0424
// documentList.get(i).createParagraph().createRun().addBreak(BreakType.PAGE);
} else if (i == documentList.size() - 1) { } else if (i == documentList.size() - 1) {
//尾页不再分页,直接插入最后文档内容 //尾页不再分页,直接插入最后文档内容
appendBody(doc, documentList.get(i)); appendBody(doc, documentList.get(i));
} else { } else {
documentList.get(i).createParagraph().createRun().addBreak(BreakType.PAGE); // documentList.get(i).createParagraph().createRun().addBreak(BreakType.PAGE);
appendBody(doc, documentList.get(i)); appendBody(doc, documentList.get(i));
} }
} }

12
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/ObjectUtils.java

@ -76,12 +76,12 @@ public class ObjectUtils {
*/ */
public static Map LocalDateConvertMap(LocalDateTime dateTime,String prefix,String split) { public static Map LocalDateConvertMap(LocalDateTime dateTime,String prefix,String split) {
HashMap<String, Object> result = new HashMap<String, Object>() {{ HashMap<String, Object> result = new HashMap<String, Object>() {{
put(prefix + split + "year", dateTime.getYear()); put(prefix + split + "year",String.format("%02d", dateTime.getYear()));
put(prefix + split + "month", dateTime.getMonthValue()); put(prefix + split + "month",String.format("%02d",dateTime.getMonthValue()));
put(prefix + split + "day", dateTime.getDayOfMonth()); put(prefix + split + "day",String.format("%02d", dateTime.getDayOfMonth()));
put(prefix + split + "hour", dateTime.getHour()); put(prefix + split + "hour",String.format("%02d", dateTime.getHour()));
put(prefix + split + "minuter", dateTime.getMinute()); put(prefix + split + "minuter", String.format("%02d",dateTime.getMinute()));
put(prefix + split + "second", dateTime.getSecond()); put(prefix + split + "second",String.format("%02d",dateTime.getSecond()));
}}; }};
return result; return result;
} }

BIN
hzims-service/ticket/src/main/resources/template/水力机械工作票模版.docx

Binary file not shown.
Loading…
Cancel
Save