diff --git a/pqs-gateway/src/main/resources/bootstrap.yml b/pqs-gateway/src/main/resources/bootstrap.yml index 6f00e5549..fdb192d09 100644 --- a/pqs-gateway/src/main/resources/bootstrap.yml +++ b/pqs-gateway/src/main/resources/bootstrap.yml @@ -180,7 +180,6 @@ logging: whitelist: urls: - - / - /user-boot/user/generateSm2Key - /user-boot/theme/getTheme - /user-boot/user/updateFirstPassword @@ -199,6 +198,7 @@ whitelist: - /*/v2/api-docs - /favicon.ico - /system-boot/theme/getTheme + - /system-boot/image/toStream - /cs-system-boot/appinfo/queryAppInfoByType #- /device-boot/** #- /system-boot/** diff --git a/pqs-influx/src/main/java/com/njcn/influx/imapper/CommonMapper.java b/pqs-influx/src/main/java/com/njcn/influx/imapper/CommonMapper.java index 2e52137e6..696598b10 100644 --- a/pqs-influx/src/main/java/com/njcn/influx/imapper/CommonMapper.java +++ b/pqs-influx/src/main/java/com/njcn/influx/imapper/CommonMapper.java @@ -36,4 +36,6 @@ public interface CommonMapper extends InfluxDbBaseMapper { @Select(value = "#{sql}",resultType = HarmonicHistoryData.class) List getHistoryResult(@Param("sql")String sql); + + List getTopTemperature(InfluxQueryWrapper influxQueryWrapper); } diff --git a/pqs-influx/src/main/java/com/njcn/influx/pojo/dto/StatisticalDataDTO.java b/pqs-influx/src/main/java/com/njcn/influx/pojo/dto/StatisticalDataDTO.java index 0be9650b4..3ff181244 100644 --- a/pqs-influx/src/main/java/com/njcn/influx/pojo/dto/StatisticalDataDTO.java +++ b/pqs-influx/src/main/java/com/njcn/influx/pojo/dto/StatisticalDataDTO.java @@ -32,6 +32,10 @@ public class StatisticalDataDTO { @Column(name = "value_type") private String valueType; + @Column(name = "cl_did") + private String clDid; + + /** * 指标值 */ diff --git a/pqs-influx/src/main/java/com/njcn/influx/service/CommonService.java b/pqs-influx/src/main/java/com/njcn/influx/service/CommonService.java index 9fa4ee660..29b0162ab 100644 --- a/pqs-influx/src/main/java/com/njcn/influx/service/CommonService.java +++ b/pqs-influx/src/main/java/com/njcn/influx/service/CommonService.java @@ -68,4 +68,14 @@ public interface CommonService { * @return StatisticalDataDTO */ StatisticalDataDTO selectBySql(StringBuilder sql); + /*获取各个模块温度数据*/ + + /** + * + * @param lineId + * @param tableName apf_data + * @param columnName Apf_Temp_Env + * @return + */ + List getTopTemperature(String lineId,String tableName, String columnName); } diff --git a/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java b/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java index 4a36fd97d..eb161ba10 100644 --- a/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java +++ b/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java @@ -108,6 +108,16 @@ public class CommonServiceImpl implements CommonService { return commonMapper.selectBySql(sql); } + @Override + public List getTopTemperature(String lineId, String tableName, String columnName) { + InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(tableName,StatisticalDataDTO.class); + influxQueryWrapper.select(StatisticalDataDTO::getLineId) + .select(StatisticalDataDTO::getClDid) + .last(columnName,InfluxDBTableConstant.VALUE) + .eq(InfluxDBTableConstant.LINE_ID,lineId).groupBy(InfluxDBTableConstant.CL_DID); + return commonMapper.getTopTemperature(influxQueryWrapper); + } + /*表名换成了id本方法做转换*/ private String getTableNameByClassId(String classId){ DictData data = dicDataFeignClient.getDicDataById(classId).getData(); diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/controller/ImageToStreamController.java b/pqs-system/system-boot/src/main/java/com/njcn/system/controller/ImageToStreamController.java new file mode 100644 index 000000000..ca833d33b --- /dev/null +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/controller/ImageToStreamController.java @@ -0,0 +1,85 @@ +package com.njcn.system.controller; + +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.FileUtil; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.pq.pojo.param.LargeScreenParam; +import com.njcn.device.pq.pojo.vo.DataScaleVO; +import com.njcn.oss.utils.FileStorageUtil; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.io.InputStreamResource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.util.List; +import java.util.Objects; + +/** + * Description: + * Date: 2023/8/30 11:08【需求编号】 + * + * @author clam + * @version V1.0.0 + */ + +@Slf4j +@Api(tags = "图片处理") +@RestController +@AllArgsConstructor +@RequestMapping("/image") +public class ImageToStreamController extends BaseController { + private final FileStorageUtil fileStorageUtil; + /** + * 数据规模 + */ + @GetMapping("/toStream") + @ApiImplicitParam(name = "bgImage", value = "图片路径", required = true) + public void toStream(@RequestParam("bgImage") String bgImage,HttpServletResponse response) { + + byte[] buffer = new byte[1024]; + FileInputStream fis = null; + BufferedInputStream bis = null; + try { + //获取部分参数,用于从minIO上将文件下载到tmp(此步骤不是必须) + InputStream fileStream = fileStorageUtil.getFileStream(bgImage); + + response.setContentType("application/octet-stream"); + response.setHeader("content-type", "image/png"); + response.setHeader("Content-Disposition", "attachment;fileName=download" +System.currentTimeMillis() + "");// 设置文件名 + //返回流处理 + bis = new BufferedInputStream(fileStream); + OutputStream os = response.getOutputStream(); + int i = bis.read(buffer); + while (i != -1) { + os.write(buffer, 0, i); + i = bis.read(buffer); + } + }catch (Exception e) { + + }finally { + if (bis != null) { + try { + bis.close(); + } catch (IOException ignored) { + } + } + if (fis != null) { + try { + fis.close(); + } catch (IOException ignored) { + } + } + } + } +} diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/controller/UserLogController.java b/pqs-system/system-boot/src/main/java/com/njcn/system/controller/UserLogController.java index c95d34d58..986680799 100644 --- a/pqs-system/system-boot/src/main/java/com/njcn/system/controller/UserLogController.java +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/controller/UserLogController.java @@ -12,6 +12,7 @@ import com.njcn.common.utils.HttpResultUtil; import com.njcn.system.pojo.po.UserLog; import com.njcn.system.service.IUserLogService; import com.njcn.web.controller.BaseController; +import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.utils.RequestUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -63,7 +64,8 @@ public class UserLogController extends BaseController { @OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY) @PostMapping("/query") @ApiOperation("查询审计日志(治理模块)") - public HttpResult> queryUserLog() { + @ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true) + public HttpResult> queryUserLog(@RequestBody BaseParam baseParam) { String methodDescribe = getMethodDescribe("queryUserLog"); List list = userLogService.lambdaQuery().eq(UserLog::getLoginName, RequestUtil.getUsername()). in(UserLog::getServiceName, Stream.of(ServerInfo.CS_DEVICE_BOOT, @@ -71,7 +73,8 @@ public class UserLogController extends BaseController { ServerInfo.CS_REPORT_BOOT, ServerInfo.CS_EVENT_BOOT, ServerInfo.CS_WARN_BOOT, - ServerInfo.CS_SYSTEM_BOOT).collect(Collectors.toList())).orderByDesc(UserLog::getCreateTime).last("limit 100").list(); + ServerInfo.CS_SYSTEM_BOOT).collect(Collectors.toList())).between(UserLog::getCreateTime,baseParam.getSearchBeginTime(),baseParam.getSearchEndTime()) + .orderByDesc(UserLog::getCreateTime).last("limit 100").list(); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); } }