Browse Source

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

zhongwei
ty 4 months ago
parent
commit
7aae190cca
  1. 53
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java
  2. 53
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataParamVo.java
  3. 17
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryTemplateParamVo.java
  4. 17
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/MonitorPointVo.java
  5. 1
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/aspect/LimitRemindAspect.java
  6. 54
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java
  7. 43
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/HistoryTemplateController.java
  8. 11
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryTemplateMapper.java
  9. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryTemplateMapper.xml
  10. 20
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java
  11. 15
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryTemplateService.java
  12. 147
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java
  13. 39
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryTemplateServiceImpl.java
  14. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java
  15. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  16. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java
  17. 19
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java
  18. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java
  19. 21
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java
  20. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  21. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java
  22. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java
  23. 10
      hzims-service/safeproduct/src/main/resources/dict/dict.sql

53
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java

@ -0,0 +1,53 @@
package com.hnac.hzims.history.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* 设备树绑定巡检实体类
* @author tanghaihao
* @date 2023年06月14日 16:46
*/
@Data
@TableName("hzims_device_history_template")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备历史数据模板")
public class HistoryTemplateEntity extends TenantEntity {
@ApiModelProperty(value = "模板名称")
private Long templateName;
@ApiModelProperty(value = "站点编码")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "属性1")
private String realId1;
@ApiModelProperty(value = "属性1名称")
private String realName1;
@ApiModelProperty(value = "属性2")
private String realId2;
@ApiModelProperty(value = "属性2名称")
private String realName2;
@ApiModelProperty(value = "属性3")
private String realId3;
@ApiModelProperty(value = "属性3名称")
private String realName3;
@ApiModelProperty(value = "属性4")
private String realId4;
@ApiModelProperty(value = "属性4名称")
private String realName4;
}

53
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataParamVo.java

@ -0,0 +1,53 @@
package com.hnac.hzims.history.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* @author ysj
*/
@Data
@ApiModel(value = "设备历史查询参数")
public class HistoryDataParamVo {
@ApiModelProperty(value = "第一个点位")
private String firstAttrId;
@ApiModelProperty(value = "第二个点位")
private String secondAttrId;
@ApiModelProperty(value = "第三个点位")
private String thirdlyAttrId;
@ApiModelProperty(value = "第四个点位")
private String fourthAttrId;
@ApiModelProperty(value = "第五个点位")
private String fifthAttrId;
@ApiModelProperty(value = "开始时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private LocalDateTime startTime;
@ApiModelProperty(value = "结束时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private LocalDateTime endTime;
@ApiModelProperty(value = "是否分页")
private Boolean isPage;
@ApiModelProperty(value = "页码")
private Integer current;
@ApiModelProperty(value = "页码条数")
private Integer pageSize;
}

17
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryTemplateParamVo.java

@ -0,0 +1,17 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class HistoryTemplateParamVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "用户Id")
private Long createUser;
}

17
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/MonitorPointVo.java

@ -0,0 +1,17 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class MonitorPointVo {
@ApiModelProperty(value = "站点Id")
private String monitorId;
@ApiModelProperty(value = "用户Id")
private String monitorName;
}

1
hzims-service/assets/src/main/java/com/hnac/hzims/spare/aspect/LimitRemindAspect.java

@ -94,7 +94,6 @@ public class LimitRemindAspect {
* @param spRecordEntityList 出入库备品备件列表 * @param spRecordEntityList 出入库备品备件列表
* @param warehouseId 仓库ID * @param warehouseId 仓库ID
*/ */
// final static ExecutorService executorService = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
public void pushWarehouseThread(Long warehouseId, List<SpRecordEntity> spRecordEntityList) { public void pushWarehouseThread(Long warehouseId, List<SpRecordEntity> spRecordEntityList) {
try { try {
Runnable runnable = new Runnable() { Runnable runnable = new Runnable() {

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

@ -0,0 +1,54 @@
package com.hnac.hzims.history.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.history.service.IHistoryDeviceService;
import com.hnac.hzims.history.vo.HistoryDataParamVo;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/history")
@Api(value = "设备历史数据", tags = "设备历史数据")
public class DeviceHistoryController extends BladeController {
private final IHistoryDeviceService service;
@GetMapping ("/device")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "查询项目设备列表", notes = "传入TrainEntity")
public R<List<DeviceInstanceVO>> device(@RequestParam(value="projectId") String projectId) {
return R.data(service.device(projectId));
}
@GetMapping ("/monitor_point")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "设备监测点查询", notes = "传入TrainEntity")
public R<List<DeviceInstanceAttrVO>> monitor_point(@RequestParam(value="projectId",required = false) String projectId,
@RequestParam(value="deviceCode",required = false) String deviceCode,
@RequestParam(value="deviceName",required = false) String deviceName,
@RequestParam(value="attrName",required = false) String attrName) {
return R.data(service.monitor_point(projectId,deviceCode,deviceName,attrName));
}
@PostMapping("/history_curve")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "设备历史数据曲线图", notes = "获取设备历史数据曲线图")
public R<Map<String, Object>> historyCurve(@RequestBody HistoryDataParamVo param) {
return R.data(service.historyCurve(param));
}
}

43
hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/HistoryTemplateController.java

@ -0,0 +1,43 @@
package com.hnac.hzims.history.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.history.entity.HistoryTemplateEntity;
import com.hnac.hzims.history.service.IHistoryTemplateService;
import com.hnac.hzims.history.vo.HistoryTemplateParamVo;
import com.hnac.hzims.safeproduct.train.entity.InstitutionalEntity;
import com.hnac.hzims.safeproduct.train.vo.InstitutionalParamVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/history/template")
@Api(value = "设备历史数据模板", tags = "设备历史数据模板")
public class HistoryTemplateController extends BladeController {
private final IHistoryTemplateService service;
@PostMapping("/save")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增历史数据模板", notes = "传入TrainEntity")
public R save(@RequestBody HistoryTemplateEntity entity) {
return R.status(service.save(entity));
}
@GetMapping("/pages")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "分页历史数据模板", notes = "查询条件:entity")
public R<IPage<HistoryTemplateEntity>> pageCondition(HistoryTemplateParamVo params, Query query) {
return R.data(service.pageCondition(params, Condition.getPage(query)));
}
}

11
hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryTemplateMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.history.mapper;
import com.hnac.hzims.history.entity.HistoryTemplateEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface HistoryTemplateMapper extends UserDataScopeBaseMapper<HistoryTemplateEntity> {
}

5
hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryTemplateMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.history.mapper.HistoryTemplateMapper" >
</mapper>

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

@ -0,0 +1,20 @@
package com.hnac.hzims.history.service;
import com.hnac.hzims.history.vo.HistoryDataParamVo;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import java.util.List;
import java.util.Map;
/**
* @author ysj
*/
public interface IHistoryDeviceService {
List<DeviceInstanceVO> device(String projectId);
List<DeviceInstanceAttrVO> monitor_point(String projectId,String deviceCode,String deviceName, String attrName);
Map<String, Object> historyCurve(HistoryDataParamVo param);
}

15
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryTemplateService.java

@ -0,0 +1,15 @@
package com.hnac.hzims.history.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.history.entity.HistoryTemplateEntity;
import com.hnac.hzims.history.vo.HistoryTemplateParamVo;
/**
* @author ysj
*/
public interface IHistoryTemplateService extends IService<HistoryTemplateEntity> {
IPage<HistoryTemplateEntity> pageCondition(HistoryTemplateParamVo params, IPage<HistoryTemplateEntity> page);
}

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

@ -0,0 +1,147 @@
package com.hnac.hzims.history.service.impl;
import com.hnac.hzims.history.service.IHistoryDeviceService;
import com.hnac.hzims.history.vo.HistoryDataParamVo;
import com.hnac.hzinfo.sdk.core.response.Result;
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.device.vo.DeviceInstanceVO;
import lombok.AllArgsConstructor;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ysj
*/
@Service
@AllArgsConstructor
public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
private final DeviceClient deviceClient;
private final DeviceDataClient deviceDataClient;
/**
* 项目设备列表
* @param projectId
* @return
*/
@Override
public List<DeviceInstanceVO> device(String projectId) {
R<List<DeviceInstanceVO>> result = deviceClient.getOnlineDeviceInstanceSearchName(projectId,"");
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
return result.getData();
}
/**
* 设备点位列表
* @param deviceCode
* @param attrName
* @return
*/
@Override
public List<DeviceInstanceAttrVO> monitor_point(String projectId,String deviceCode,String deviceName, String attrName) {
List<DeviceInstanceAttrVO> result = new ArrayList<>();
// 查询所有
if(StringUtil.isEmpty(deviceCode)){
R<List<DeviceInstanceVO>> instances = deviceClient.getOnlineDeviceInstanceSearchName(projectId,"");
if(!instances.isSuccess() || CollectionUtil.isEmpty(instances.getData())){
return result;
}
instances.getData().stream().sorted(Comparator.comparing(DeviceInstanceVO::getName)).forEach(instance->{
Result<List<DeviceInstanceAttrVO>> attrs = deviceClient.getDeviceAttrByName(instance.getCode(),"");
if(!attrs.isSuccess() || CollectionUtil.isEmpty(attrs.getData())){
return;
}
result.addAll(attrs.getData().stream().filter(o-> StringUtil.isNotBlank(o.getFacDeviceAttrId())).peek(attr->{
attr.setName(instance.getName() + "-" + attr.getName());
}).collect(Collectors.toList()));
});
}
// 根据设备查询
Result<List<DeviceInstanceAttrVO>> attrs = deviceClient.getDeviceAttrByName(deviceCode,attrName);
if(!attrs.isSuccess() || CollectionUtil.isEmpty(attrs.getData())){
return result;
}
return attrs.getData().stream().filter(o-> StringUtil.isNotBlank(o.getFacDeviceAttrId())).peek(attr->{
attr.setName(deviceName + "-" + attr.getName());
}).collect(Collectors.toList());
}
/**
* 设备历史数据曲线图
* @param param
* @return
*/
@Override
public Map<String, Object> historyCurve(HistoryDataParamVo param) {
// 计算查询数据维度 : 0-10秒 、 1-1分钟 、2-5分钟 .....
Integer intervalType = this.computeInterval(param.getStartTime(),param.getEndTime());
// 查询数据
Result<Map<String, Object>> result = deviceDataClient.getLineDataByRealId(
param.getFirstAttrId(),
param.getSecondAttrId(),
param.getThirdlyAttrId(),
param.getFourthAttrId(),
param.getFifthAttrId(),
param.getStartTime(),
param.getEndTime(),
// 默认查询设备 : 0-厂组点, 1-设备
1,
intervalType,
param.getIsPage(),
param.getCurrent(),
param.getPageSize()
);
if(!result.isSuccess()){
throw new ServiceException(result.getMsg());
}
if(CollectionUtil.isEmpty(result.getData())){
return new HashMap<>();
}
return result.getData();
}
/**
* 计算查询数据维度
* @param startTime
* @param endTime
* @return
*/
private Integer computeInterval(LocalDateTime startTime, LocalDateTime endTime) {
long seconds = endTime.toEpochSecond(ZoneOffset.UTC) - startTime.toEpochSecond(ZoneOffset.UTC);
// 小于一天 : 10秒一条数据
if(seconds < 60 * 60 * 24L){
return 0;
// 小于5天 : 1分钟一条数据
}else if(seconds < 60 * 60 * 24 * 5L){
return 1;
// 小于15天 : 5分钟一条数据
}else if(seconds < 60 * 60 * 24 * 15L){
return 2;
// 小于30天 : 10分钟一条数据
}else if(seconds < 60 * 60 * 24 * 30L){
return 3;
// 小于90天 : 30分钟一条数据
}else if(seconds < 60 * 60 * 24 * 90L){
return 4;
// 小于180天 : 60分钟一条数据
}else if(seconds < 60 * 60 * 24 * 180L){
return 5;
}
return 5;
}
}

39
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryTemplateServiceImpl.java

@ -0,0 +1,39 @@
package com.hnac.hzims.history.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.history.entity.HistoryTemplateEntity;
import com.hnac.hzims.history.mapper.HistoryTemplateMapper;
import com.hnac.hzims.history.service.IHistoryTemplateService;
import com.hnac.hzims.history.vo.HistoryTemplateParamVo;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@Service
public class HistoryTemplateServiceImpl extends ServiceImpl<HistoryTemplateMapper, HistoryTemplateEntity> implements IHistoryTemplateService {
/**
* 分页历史数据模板
* @param params
* @param page
* @return
*/
@Override
public IPage<HistoryTemplateEntity> pageCondition(HistoryTemplateParamVo params, IPage<HistoryTemplateEntity> page) {
LambdaQueryWrapper<HistoryTemplateEntity> wrapper = new LambdaQueryWrapper();
wrapper.orderByDesc(HistoryTemplateEntity::getCreateTime);
if(StringUtil.isNotBlank(params.getStationId())){
wrapper.eq(HistoryTemplateEntity::getStationId,params.getStationId());
}
if(ObjectUtil.isNotEmpty(params.getCreateUser())){
wrapper.eq(HistoryTemplateEntity::getCreateUser,params.getCreateUser());
}
return super.page(page,wrapper);
}
}

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java

@ -62,7 +62,7 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
private final static String recent_year_power_data = "hzims:operation:key:power:data"; private final static String recent_year_power_data = "hzims:operation:key:power:data";
private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("obtain-generation-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("obtain-generation-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy());
/** /**

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -132,7 +132,7 @@ public class RealTargetServiceImpl implements RealTargetService {
private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key";
// 创建线程池 // 创建线程池
private static final ExecutorService pool = new ThreadPoolExecutor(20, 20, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-power-data-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); private static final ExecutorService pool = new ThreadPoolExecutor(20, 20, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("load-power-data-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy());
@Override @Override
public void loadEmInfo(String param) { public void loadEmInfo(String param) {

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java

@ -878,7 +878,7 @@ public class ShowServiceImpl implements ShowService {
DutyTaskVo task = new DutyTaskVo(); DutyTaskVo task = new DutyTaskVo();
//通过线程池异步获取月报各模块内容 主要分为五块内容 //通过线程池异步获取月报各模块内容 主要分为五块内容
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("duty-task-count-pool-%d").build(); ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("duty-task-count-pool-%d").build();
ExecutorService exe = new ThreadPoolExecutor(4, 4, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); ExecutorService exe = new ThreadPoolExecutor(4, 4, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
//监控线程执行完后返回结果 //监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(4); CountDownLatch countDownLatch = new CountDownLatch(4);
List<Long> list = Collections.singletonList(createDept); List<Long> list = Collections.singletonList(createDept);

19
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java

@ -78,7 +78,7 @@ public class MonitorServiceImpl implements MonitorService {
private final IAnalyseDataSearchClient analyseDataSearchClient; private final IAnalyseDataSearchClient analyseDataSearchClient;
private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy());
@Value("${hzims.equipment.emInfo.emInfoList}") @Value("${hzims.equipment.emInfo.emInfoList}")
@ -223,8 +223,13 @@ public class MonitorServiceImpl implements MonitorService {
countDownLatch.countDown(); countDownLatch.countDown();
})); }));
try { try {
// 等待所有线程执行完成 // 等待所有线程执行完成(至多等待三秒,超过三秒任务认为线程发生阻塞)
countDownLatch.await(); boolean flag = countDownLatch.await(3,TimeUnit.SECONDS);
if(!flag){
// 清空线程任务
pool.shutdownNow();
log.error("实时数据调度发生阻塞 : {}" , DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
}
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
@ -321,7 +326,13 @@ public class MonitorServiceImpl implements MonitorService {
} }
// 等待所有线程执行完成 // 等待所有线程执行完成
try { try {
countDownLatch.await(); // 等待所有线程执行完成(至多等待二秒,超过二秒任务认为线程发生阻塞)
boolean flag = countDownLatch.await(2,TimeUnit.SECONDS);
if(!flag){
// 清空线程任务
pool.shutdownNow();
log.error("集中监控数据调度发生阻塞 : {}" , DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
}
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java

@ -426,7 +426,7 @@ public class ReportServiceImpl implements ReportService {
private void taskMonth(List<Long> areas, AreaMonthReportVo areaMonthReport, String startTime, String endTime) { private void taskMonth(List<Long> areas, AreaMonthReportVo areaMonthReport, String startTime, String endTime) {
//通过线程池异步获取月报各模块内容 主要分为五块内容 //通过线程池异步获取月报各模块内容 主要分为五块内容
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("area_month_report-pool-%d").build(); ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("area_month_report-pool-%d").build();
ExecutorService exe = new ThreadPoolExecutor(4, 4, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); ExecutorService exe = new ThreadPoolExecutor(4, 4, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
//监控线程执行完后返回结果 //监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(4); CountDownLatch countDownLatch = new CountDownLatch(4);
// 日常维护 // 日常维护

21
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java

@ -57,6 +57,7 @@ import org.springblade.system.vo.CreateTableVO;
import org.springblade.system.vo.TemplateVO; import org.springblade.system.vo.TemplateVO;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -950,7 +951,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
} }
R<BladeFile> r; R<BladeFile> r;
try { try {
r = putFile(file); r = putFile(file);
if (!r.isSuccess()) { if (!r.isSuccess()) {
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错" ); throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错" );
@ -982,5 +982,24 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
} }
return R.fail("shangc"); return R.fail("shangc");
} }
// 将File 转换为 MultipartFile
public MultipartFile getMultipartFile(File file) {
FileItem item = new DiskFileItemFactory().createItem("file"
, MediaType.MULTIPART_FORM_DATA_VALUE
, true
, file.getName());
try (InputStream input = Files.newInputStream(file.toPath());
OutputStream os = item.getOutputStream()) {
// 流转移
IOUtils.copy(input, os);
} catch (Exception e) {
throw new IllegalArgumentException("Invalid file: " + e, e);
}
return new CommonsMultipartFile(item);
}
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -1424,7 +1424,7 @@ public class HydropowerServiceImpl implements HydropowerService {
List<Long> deptList = Collections.singletonList(duty.getCreateDept()); List<Long> deptList = Collections.singletonList(duty.getCreateDept());
// 使用多线程处理数据 // 使用多线程处理数据
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("duty_data-pool-%d").build(); ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("duty_data-pool-%d").build();
ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
CountDownLatch countDownLatch = new CountDownLatch(DUTY_POOL_QUANTITY); CountDownLatch countDownLatch = new CountDownLatch(DUTY_POOL_QUANTITY);
// 下一班组 // 下一班组
pool.execute(()-> { pool.execute(()-> {

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java

@ -458,7 +458,7 @@ public class WindHomeServiceImpl implements WindHomeService {
// 使用多线程处理数据 // 使用多线程处理数据
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("duty_data-pool-%d").build(); ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("duty_data-pool-%d").build();
ExecutorService pool = new ThreadPoolExecutor(4, 4, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); ExecutorService pool = new ThreadPoolExecutor(4, 4, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
CountDownLatch countDownLatch = new CountDownLatch(4); CountDownLatch countDownLatch = new CountDownLatch(4);
// 缺陷 // 缺陷
pool.execute(()-> { pool.execute(()-> {

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java

@ -94,7 +94,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
private final IHistoryDataSearchClient historyDataSearchClient; private final IHistoryDataSearchClient historyDataSearchClient;
// 创建线程池 // 创建线程池
private static final ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("generate-run-report-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy()); private static final ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("generate-run-report-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy());
/** /**
* 查询站点月报运行数据 * 查询站点月报运行数据

10
hzims-service/safeproduct/src/main/resources/dict/dict.sql

@ -55,3 +55,13 @@ INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748201, 0, 'rectification_status', '-1', '整改状态', 1, '', 0, 0, 0, -1, 'hzims_safeproduct'); INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748201, 0, 'rectification_status', '-1', '整改状态', 1, '', 0, 0, 0, -1, 'hzims_safeproduct');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748202, 1397731100361748201, 'rectification_status', '0', '未整改', 1, '', 0, 0, 0, -1, 'hzims_safeproduct'); INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748202, 1397731100361748201, 'rectification_status', '0', '未整改', 1, '', 0, 0, 0, -1, 'hzims_safeproduct');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748203, 1397731100361748201, 'rectification_status', '1', '已整改', 2, '', 0, 0, 0, -1, 'hzims_safeproduct'); INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748203, 1397731100361748201, 'rectification_status', '1', '已整改', 2, '', 0, 0, 0, -1, 'hzims_safeproduct');
#资料类型
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748301, 0, 'institutional_type', '-1', '资料类型', 1, '', 0, 0, 0, -1, 'hzims_safeproduct');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748302, 1397731100361748301, 'institutional_type', '0', '制度', 1, '', 0, 0, 0, -1, 'hzims_safeproduct');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748303, 1397731100361748301, 'institutional_type', '1', '资料', 2, '', 0, 0, 0, -1, 'hzims_safeproduct');
#文档权限范围
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748401, 0, 'file_purview', '-1', '文档权限范围', 1, '', 0, 0, 0, -1, 'hzims_safeproduct');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748402, 1397731100361748401, 'file_purview', '0', '厂站', 1, '', 0, 0, 0, -1, 'hzims_safeproduct');
INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1397731100361748403, 1397731100361748401, 'file_purview', '1', '完全公开', 2, '', 0, 0, 0, -1, 'hzims_safeproduct');
Loading…
Cancel
Save