diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureCurrentDataController.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureCurrentDataController.java new file mode 100644 index 000000000..5445c6d68 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureCurrentDataController.java @@ -0,0 +1,211 @@ +package com.zhgd.xmgl.modules.steelstructure.controller; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.NumberUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureCurrentData; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensor; +import com.zhgd.xmgl.modules.steelstructure.entity.qo.CurrentDataListQO; +import com.zhgd.xmgl.modules.steelstructure.entity.vo.CurrentDataListVO; +import com.zhgd.xmgl.modules.steelstructure.entity.vo.DataAlarmVO; +import com.zhgd.xmgl.modules.steelstructure.service.SteelStructureSensorService; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureCurrentDataService; +import com.zhgd.xmgl.modules.highformwork.entity.vo.NumberDifferentTypesAlarmsRadarChartOneMonthVo; +import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressMaterialRel; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * @Title: Controller + * @Description: 钢结构自动化监测系统-监测实时数据 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/steelStructureCurrentData") +@Slf4j +@Api(tags = "钢结构自动化监测系统-监测实时数据") +public class SteelStructureCurrentDataController { + @Autowired + private ISteelStructureCurrentDataService steelStructureCurrentDataService; + @Autowired + private SteelStructureSensorService steelStructureSensorService; + + @ApiOperation(value = "分页列表查询钢结构自动化监测系统-传感器实时数据信息 form data", notes = "分页列表查询钢结构自动化监测系统-传感器实时数据信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", dataType = "string", required = true), + @ApiImplicitParam(name = "measurePointName", value = "测点名称", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "steelStructureSensorTypeId", value = "钢结构自动化监测系统-传感器类型id", paramType = "query", dataType = "long"), + @ApiImplicitParam(name = "startDate", value = "开始时间,yyyy-MM-dd HH:mm:ss", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "endDate", value = "结束时间,yyyy-MM-dd HH:mm:ss", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "pageNo", value = "当前页", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "pageSize", value = "页大小", paramType = "query", dataType = "int") + }) + @PostMapping(value = "/selectPage") + public Result> selectPage(String measurePointName, Long steelStructureSensorTypeId, String startDate, String endDate, String projectSn, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + return Result.success(steelStructureCurrentDataService.selectPageByProjectSn(measurePointName, steelStructureSensorTypeId, startDate, endDate, projectSn, pageNo, pageSize)); + } + + @ApiOperation(value = "分页列表查询钢结构自动化监测系统-监测实时数据信息", notes = "分页列表查询钢结构自动化监测系统-监测实时数据信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "alarmState", value = "报警状态:0-正常,1-预警,2-报警,3-控制", paramType = "body", required = false, dataType = "Integer"), + @ApiImplicitParam(name = "steelStructureMonitorTypeId", value = "钢结构自动化监测系统-监测类型表id", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "measurePointNumber", value = "测点编号", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "startTime", value = "开始时间,格式2020-08-16 00:00:00", dataType = "String", paramType = "body", required = false), + @ApiImplicitParam(name = "endTime", value = "结束时间,格式2020-08-16 23:59:59", dataType = "String", paramType = "body", required = false), + @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), + }) + @PostMapping(value = "/list") + public Result> queryPageList(@ApiIgnore @RequestBody Map map) { + return Result.success(steelStructureCurrentDataService.selectSteelStructureCurrentDataPage(map)); + } + + /** + * 添加 + * + * @param steelStructureCurrentData + * @return + */ + @ApiOperation(value = "添加钢结构自动化监测系统-监测实时数据信息", notes = "添加钢结构自动化监测系统-监测实时数据信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody SteelStructureCurrentData steelStructureCurrentData) { + steelStructureCurrentDataService.saveSteelStructureCurrentData(steelStructureCurrentData); + return Result.success(steelStructureCurrentData); + } + + /** + * 编辑 + * + * @param taskProgressMaterialRel + * @return + */ + @ApiOperation(value = "编辑钢结构自动化监测系统-监测实时数据", notes = "编辑钢结构自动化监测系统-监测实时数据", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody SteelStructureCurrentData taskProgressMaterialRel) { + steelStructureCurrentDataService.updateById(taskProgressMaterialRel); + return Result.ok(); + } + + /** + * 通过id删除 + * + * @return + */ + @ApiOperation(value = "删除钢结构自动化监测系统-监测实时数据", notes = "删除钢结构自动化监测系统-监测实时数据", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-监测实时数据id", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}") + @PostMapping(value = "/delete") + public Result delete(@ApiIgnore @RequestBody HashMap map) { + String id = MapUtils.getString(map, "id"); + Result result = new Result<>(); + SteelStructureCurrentData taskProgressMaterialRel = steelStructureCurrentDataService.getById(id); + if (taskProgressMaterialRel == null) { + result.error500("未找到对应实体"); + } else { + boolean ok = steelStructureCurrentDataService.removeById(id); + if (ok) { + result.success("删除成功!"); + } + } + + return result; + } + + + @ApiOperation(value = "通过分页信息查询所有相关数据(项目监测详情-数据列表、钢结构自动化监测系统配置-实时数据)", notes = "通过分页信息查询所有相关数据(项目监测详情-数据列表、钢结构自动化监测系统配置-实时数据)") + @PostMapping(value = "/selectSteelStructureCurrentDataList") + public Result selectSteelStructureCurrentDataList(@RequestBody CurrentDataListQO currentDataListQO) { + CurrentDataListVO currentDataListVO = new CurrentDataListVO(); + String sensorSn = currentDataListQO.getSensorSn(); + String measurePointNumber = currentDataListQO.getMeasurePointNumber(); + IPage page = steelStructureCurrentDataService.selectSteelStructureCurrentDataList(currentDataListQO.getProjectSn() + , measurePointNumber, sensorSn, currentDataListQO.getSteelStructureEngineeringToMonitorTypeId(), currentDataListQO.getStartTime() + , currentDataListQO.getEndTime(), currentDataListQO.getAlarmState(), currentDataListQO.getPageNo(), currentDataListQO.getPageSize()); + currentDataListVO.setData(page); + if (StringUtils.isNotBlank(sensorSn)) { + List records = page.getRecords(); + if (CollUtil.isNotEmpty(records)) { + currentDataListVO.setUnit(records.get(0).getUnit()); + currentDataListVO.setPositiveAlarmValue(NumberUtil.add(records.get(0).getAlarmValue(), records.get(0).getFiducialValue()).doubleValue()); + currentDataListVO.setNegativeAlarmValue(NumberUtil.add(NumberUtil.mul(records.get(0).getAlarmValue().floatValue(), -1), records.get(0).getFiducialValue().floatValue())); + } else { + SteelStructureSensor sensor = steelStructureSensorService.getUnitAndAlarmValueBySnAndPointNumber(sensorSn, measurePointNumber); + if (sensor != null) { + currentDataListVO.setUnit(sensor.getUnit()); + currentDataListVO.setPositiveAlarmValue(NumberUtil.add(sensor.getAlarmValue(), sensor.getFiducialValue()).doubleValue()); + currentDataListVO.setNegativeAlarmValue(NumberUtil.add(NumberUtil.mul(sensor.getAlarmValue().floatValue(), -1), sensor.getFiducialValue().floatValue())); + } else { + currentDataListVO.setUnit(""); + currentDataListVO.setPositiveAlarmValue(0d); + currentDataListVO.setNegativeAlarmValue(0d); + } + } + } + return Result.success(currentDataListVO); + } + + + @ApiOperation(value = "项目版-导出数据", notes = "项目版-导出数据") + @GetMapping(value = "/exportData") + public void exportData(HttpServletResponse response, CurrentDataListQO currentDataListQO) { + steelStructureCurrentDataService.exportData(response, currentDataListQO.getProjectSn(), currentDataListQO.getMeasurePointNumber(), currentDataListQO.getSensorSn(), currentDataListQO.getSteelStructureEngineeringToMonitorTypeId() + , currentDataListQO.getStartTime(), currentDataListQO.getEndTime(), currentDataListQO.getAlarmState()); + } + + @ApiOperation(value = "gxlt大屏导出", notes = "gxlt大屏导出", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "测点名称", paramType = "query", dataType = "string", required = true), + @ApiImplicitParam(name = "measurePointName", value = "测点名称", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "steelStructureSensorTypeId", value = "钢结构自动化监测系统-传感器类型id", paramType = "query", dataType = "long"), + @ApiImplicitParam(name = "startDate", value = "开始时间,yyyy-MM-dd HH:mm:ss", paramType = "query", dataType = "string"), + @ApiImplicitParam(name = "endDate", value = "结束时间,yyyy-MM-dd HH:mm:ss", paramType = "query", dataType = "string") + }) + @GetMapping(value = "/zwExportData") + public void zwExportData(HttpServletResponse response, String measurePointName, Long steelStructureSensorType, String startDate, String endDate, String projectSn) { + steelStructureCurrentDataService.zwExportData(response, measurePointName, steelStructureSensorType, startDate, endDate, projectSn); + } + + @GetMapping(value = "/getDataAlarmNumber") + public Result getDataAlarmNumber() { + return Result.success(steelStructureCurrentDataService.getDataAlarmNumber()); + } + + @ApiOperation(value = "查询报警周期趋势图(近一月不同类型报警数量)", notes = "查询报警周期趋势图(近一月不同类型报警数量)", httpMethod = "GET") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"), + @ApiImplicitParam(name = "steelStructurePlaneFigureId", value = "钢结构自动化监测系统-平面图配置ID", paramType = "query", required = true, dataType = "String"), + }) + @GetMapping(value = "/recent/month/alarm/graph") + public Result> getAlarmCycleTrendGraph(@RequestParam Map map) { + return Result.success(steelStructureCurrentDataService.getAlarmCycleTrendGraph(map)); + } + + @ApiOperation(value = "查询报警类型雷达图(近一月不同类型报警数量)", notes = "查询报警类型雷达图(近一月不同类型报警数量)", httpMethod = "GET") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"), + @ApiImplicitParam(name = "steelStructurePlaneFigureId", value = "钢结构自动化监测系统-平面图配置ID", paramType = "query", required = true, dataType = "String"), + }) + @GetMapping(value = "/recent/month/radar") + public Result> getNumberDifferentTypesAlarmsRadarChartOneMonth(@RequestParam Map map) { + return Result.success(steelStructureCurrentDataService.getNumberDifferentTypesAlarmsRadarChartOneMonth(map)); + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureEngineeringController.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureEngineeringController.java new file mode 100644 index 000000000..4708022ee --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureEngineeringController.java @@ -0,0 +1,126 @@ +package com.zhgd.xmgl.modules.steelstructure.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureEngineering; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureEngineeringService; +import com.zhgd.xmgl.util.MessageUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.List; +import java.util.Map; + + +/** + * @Title: Controller + * @Description: 钢结构自动化监测系统-工程 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/steelStructureEngineering") +@Slf4j +@Api(tags = "钢结构自动化监测系统-工程") +public class SteelStructureEngineeringController { + @Autowired + private ISteelStructureEngineeringService steelStructureEngineeringService; + + @ApiOperation(value = "分页列表查询钢结构自动化监测系统-工程信息", notes = "分页列表查询钢结构自动化监测系统-工程信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), + }) + @PostMapping(value = "/page") + public Result> queryPageList(@ApiIgnore @RequestBody Map map) { + return Result.success(steelStructureEngineeringService.selectSteelStructureEngineeringPage(map)); + } + + /** + * 列表查询 + */ + @ApiOperation(value = "列表查询钢结构自动化监测系统-工程信息", notes = "列表查询钢结构自动化监测系统-工程信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/list") + public Result> selectSteelStructureList(@ApiIgnore @RequestBody Map map) { + return Result.success(steelStructureEngineeringService.selectSteelStructureList(map)); + } + + /** + * 添加 + * + * @param steelStructureEngineering + * @return + */ + @ApiOperation(value = "添加钢结构自动化监测系统-工程信息", notes = "添加钢结构自动化监测系统-工程信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody @Validated SteelStructureEngineering steelStructureEngineering) { + steelStructureEngineeringService.saveSteelStructureEngineering(steelStructureEngineering); + return Result.ok(); + } + + /** + * 编辑 + * + * @param steelStructureEngineering + * @return + */ + @ApiOperation(value = "编辑钢结构自动化监测系统-工程信息", notes = "编辑钢结构自动化监测系统-工程信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody SteelStructureEngineering steelStructureEngineering) { + return Result.success(steelStructureEngineeringService.edit(steelStructureEngineering)); + } + + /** + * 通过id删除 + * + * @param + * @return + */ + @ApiOperation(value = "删除钢结构自动化监测系统-工程信息", notes = "删除钢结构自动化监测系统-工程信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-工程ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/delete") + public Result delete(@ApiIgnore @RequestBody Map map) { + steelStructureEngineeringService.deleteSteelStructureEngineering(MapUtils.getLong(map, "id")); + return Result.ok(); + } + + + /** + * 通过id查询 + * + * @param + * @return + */ + @ApiOperation(value = "通过id查询钢结构自动化监测系统-工程信息", notes = "通过id查询钢结构自动化监测系统-工程信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-工程ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/queryById") + public Result queryById(@ApiIgnore @RequestBody Map map) { + Result result = new Result(); + SteelStructureEngineering steelStructureEngineering = steelStructureEngineeringService.getById(MapUtils.getString(map, "id")); + if (steelStructureEngineering == null) { + result.error500(MessageUtil.get("notFindErr")); + } else { + result.setResult(steelStructureEngineering); + result.setSuccess(true); + } + return result; + } + + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMeasurePointController.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMeasurePointController.java new file mode 100644 index 000000000..d0e8c848f --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMeasurePointController.java @@ -0,0 +1,134 @@ +package com.zhgd.xmgl.modules.steelstructure.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMeasurePoint; +import com.zhgd.xmgl.modules.steelstructure.entity.qo.SelectMeasurePointListQO; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureMeasurePointService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.List; +import java.util.Map; + + +/** + * @Title: Controller + * @Description: 钢结构自动化监测系统-测点 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/steelStructureMeasurePoint") +@Slf4j +@Api(tags = "钢结构自动化监测系统-测点") +public class SteelStructureMeasurePointController { + @Autowired + private ISteelStructureMeasurePointService steelStructureMeasurePointService; + + /** + * 钢结构自动化监测系统配置-测点管理列表 + */ + @ApiOperation(value = "钢结构自动化监测系统配置-测点管理列表", notes = "钢结构自动化监测系统配置-测点管理列表", httpMethod = "POST") + @PostMapping(value = "/selectMeasurePointList") + public Result> selectListByPageInfo(@RequestBody SelectMeasurePointListQO selectMeasurePointListQO) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery().eq(SteelStructureMeasurePoint::getSteelStructureEngineeringToMonitorTypeId, selectMeasurePointListQO.getSteelStructureEngineeringToMonitorTypeId()); + if (StringUtils.isNotBlank(selectMeasurePointListQO.getMeasurePointNumber())) { + wrapper.like(SteelStructureMeasurePoint::getMeasurePointNumber, selectMeasurePointListQO.getMeasurePointNumber()); + } + if (selectMeasurePointListQO.getAlarmState() != null) { + wrapper.eq(SteelStructureMeasurePoint::getAlarmState, selectMeasurePointListQO.getAlarmState()); + } + return Result.success(steelStructureMeasurePointService.page(new Page<>(selectMeasurePointListQO.getPageNo(), selectMeasurePointListQO.getPageSize()), wrapper)); + } + + + @ApiOperation(value = "钢结构自动化监测系统配置-根据测点编号查询详情", notes = "钢结构自动化监测系统配置-根据测点编号查询详情") + @ApiImplicitParams({ + @ApiImplicitParam(name = "measurePointNumber", value = "测点编号", paramType = "query", required = true, dataType = "String") + }) + @GetMapping(value = "/getDetailsByMeasurePointNumber") + public Result getDetailsByMeasurePointNumber(String measurePointNumber) { + return Result.success(steelStructureMeasurePointService.getDetailsByMeasurePointNumber(measurePointNumber)); + } + + + @ApiOperation(value = "列表查询钢结构自动化监测系统所有测点信息", notes = "列表查询钢结构自动化监测系统所有测点信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "steelStructureEngineeringToMonitorTypeId", value = "钢结构自动化监测系统-工程和监测类型中间表id", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "steelStructureEngineeringId", value = "钢结构自动化监测系统-工程id", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/selectSteelStructureAllMeasurePointList") + public Result> selectSteelStructureAllMeasurePointList(@ApiIgnore @RequestBody Map map) { + return Result.success(steelStructureMeasurePointService.selectSteelStructureAllMeasurePointList(map)); + } + + /** + * 添加 + * + * @param steelStructureMeasurePoint + * @return + */ + @ApiOperation(value = "添加钢结构自动化监测系统-测点信息", notes = "添加钢结构自动化监测系统-测点信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody @Validated SteelStructureMeasurePoint steelStructureMeasurePoint) { + steelStructureMeasurePointService.saveMeasurePoint(steelStructureMeasurePoint); + return Result.ok(); + } + + /** + * 编辑 + * + * @param steelStructureMeasurePoint + * @return + */ + @ApiOperation(value = "编辑测点", notes = "编辑测点", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody SteelStructureMeasurePoint steelStructureMeasurePoint) { + steelStructureMeasurePointService.editMeasurePoint(steelStructureMeasurePoint); + return Result.ok(); + } + + /** + * 通过id删除 + * + * @param + * @return + */ + @ApiOperation(value = "删除钢结构自动化监测系统-测点信息", notes = "删除钢结构自动化监测系统-测点信息") + @ApiImplicitParam(name = "measurePointNumber", value = "钢结构自动化监测系统-测点编号", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/delete") + public Result delete(@ApiIgnore @RequestBody Map map) { + steelStructureMeasurePointService.deleteByMeasurePointNumber(MapUtils.getString(map, "measurePointNumber")); + return Result.ok(); + } + + + /** + * 通过id查询 + * + * @param + * @return + */ + @ApiOperation(value = "通过id查询钢结构自动化监测系统-测点信息", notes = "通过id查询钢结构自动化监测系统-测点信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-测点ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/queryById") + public Result queryById(@ApiIgnore @RequestBody Map map) { + return Result.success(steelStructureMeasurePointService.selectSteelStructureMeasurePointById(map)); + } + + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMeasurePointThresholdController.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMeasurePointThresholdController.java new file mode 100644 index 000000000..3014c4b10 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMeasurePointThresholdController.java @@ -0,0 +1,145 @@ +package com.zhgd.xmgl.modules.steelstructure.controller; + +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * @Title: Controller + * @Description: 钢结构自动化监测系统-测点警情设置 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/steelStructureMeasurePointThreshold") +@Slf4j +@Api(tags = "钢结构自动化监测系统-测点警情设置相关Api") +public class SteelStructureMeasurePointThresholdController { +// +// +// /** +// * 分页列表查询 +// * +// * @param steelStructureMeasurePointThreshold +// * @param pageNo +// * @param pageSize +// * @param req +// * @return +// */ +// @ApiOperation(value = "分页列表查询钢结构自动化监测系统-测点警情设置信息", notes = "分页列表查询钢结构自动化监测系统-测点警情设置信息", httpMethod = "GET") +// @GetMapping(value = "/list") +// +// public Result> queryList(SteelStructureMeasurePointThreshold steelStructureMeasurePointThreshold, +// @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, +// @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, +// HttpServletRequest req) { +// +// Result> result = new Result>(); +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(steelStructureMeasurePointThreshold, req.getParameterMap()); +// Page page = new Page(pageNo, pageSize); +// IPage pageList = steelStructureMeasurePointThresholdService.page(page, queryWrapper); +// result.setSuccess(true); +// result.setResult(pageList); +// return null; +// } +// +// /** +// * 添加 +// * +// * @param steelStructureMeasurePointThreshold +// * @return +// */ +// @ApiOperation(value = "添加钢结构自动化监测系统-测点警情设置信息", notes = "添加钢结构自动化监测系统-测点警情设置信息", httpMethod = "POST") +// @PostMapping(value = "/add") +// public Result add(@RequestBody SteelStructureMeasurePointThreshold steelStructureMeasurePointThreshold) { +// Result result = new Result(); +// try { +// // +//// steelStructureMeasurePointThresholdService.save(steelStructureMeasurePointThreshold); +// result.success("添加成功!"); +// } catch (Exception e) { +// e.printStackTrace(); +// log.info(e.getMessage()); +// result.error500("操作失败"); +// } +// return result; +// } +// +// /** +// * 编辑 +// * +// * @param steelStructureMeasurePointThreshold +// * @return +// */ +// @ApiOperation(value = "编辑钢结构自动化监测系统-测点警情设置信息", notes = "编辑钢结构自动化监测系统-测点警情设置信息", httpMethod = "PUT") +// @PutMapping(value = "/edit") +// public Result edit(@RequestBody SteelStructureMeasurePointThreshold steelStructureMeasurePointThreshold) { +//// Result result = new Result(); +//// SteelStructureMeasurePointThreshold steelStructureMeasurePointThresholdEntity = steelStructureMeasurePointThresholdService.getById(steelStructureMeasurePointThreshold.getId()); +//// if (steelStructureMeasurePointThresholdEntity == null) { +//// result.error500("未找到对应实体"); +//// } else { +//// boolean ok = steelStructureMeasurePointThresholdService.updateById(steelStructureMeasurePointThreshold); +//// +//// if (ok) { +//// result.success("修改成功!"); +//// } +//// } +//// +//// return result; +// return null; +// } +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// @ApiOperation(value = "删除钢结构自动化监测系统-测点警情设置信息", notes = "删除钢结构自动化监测系统-测点警情设置信息", httpMethod = "DELETE") +// @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-测点警情设置ID", paramType = "query", required = true, dataType = "Integer") +// @DeleteMapping(value = "/delete") +// public Result delete(@RequestParam(name = "id", required = true) String id) { +//// Result result = new Result(); +//// SteelStructureMeasurePointThreshold steelStructureMeasurePointThreshold = steelStructureMeasurePointThresholdService.getById(id); +//// if (steelStructureMeasurePointThreshold == null) { +//// result.error500("未找到对应实体"); +//// } else { +//// boolean ok = steelStructureMeasurePointThresholdService.removeById(id); +//// if (ok) { +//// result.success("删除成功!"); +//// } +//// } +//// +//// return result; +// return null; +// } +// +// +// /** +// * 通过id查询 +// * +// * @param id +// * @return +// */ +// @ApiOperation(value = "通过id查询钢结构自动化监测系统-测点警情设置信息", notes = "通过id查询钢结构自动化监测系统-测点警情设置信息", httpMethod = "GET") +// @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-测点警情设置ID", paramType = "query", required = true, dataType = "Integer") +// @GetMapping(value = "/queryById") +// public Result queryById(@RequestParam(name = "id", required = true) String id) { +//// Result result = new Result(); +//// SteelStructureMeasurePointThreshold steelStructureMeasurePointThreshold = steelStructureMeasurePointThresholdService.getById(id); +//// if (steelStructureMeasurePointThreshold == null) { +//// result.error500("未找到对应实体"); +//// } else { +//// result.setResult(steelStructureMeasurePointThreshold); +//// result.setSuccess(true); +//// } +//// return result; +// return null; +// } + + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMeasurePointToPlaneFigureController.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMeasurePointToPlaneFigureController.java new file mode 100644 index 000000000..b37384298 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMeasurePointToPlaneFigureController.java @@ -0,0 +1,126 @@ +package com.zhgd.xmgl.modules.steelstructure.controller; + +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMeasurePointToPlaneFigure; +import com.zhgd.xmgl.modules.steelstructure.service.SteelStructureMeasurePointToPlaneFigureService; +import com.zhgd.xmgl.util.MessageUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.List; +import java.util.Map; + + +/** + * @Title: Controller + * @Description: 钢结构自动化监测系统-测点和平面图配置中间表 + * @author: pds + * @date: 2021-10-09 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/steelStructurePlaneFigureCoordinate") +@Slf4j +@Api(tags = "钢结构自动化监测系统-测点和平面图配置中间表") +public class SteelStructureMeasurePointToPlaneFigureController { + @Autowired + private SteelStructureMeasurePointToPlaneFigureService steelStructurePlaneFigureCoordinateService; + + + /** + * 分页列表查询 + * + * @return + */ + @ApiOperation(value = "列表查询钢结构自动化监测系统-测点和平面图配置中间表信息", notes = "列表查询钢结构自动化监测系统-测点和平面图配置中间表信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "steelStructurePlaneFigureId", value = "钢结构自动化监测系统-平面图配置ID", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "steelStructureEngineeringId", value = "钢结构自动化监测系统-工程id", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/list") + public Result> selectList(@ApiIgnore @RequestBody Map map) { + return Result.success(steelStructurePlaneFigureCoordinateService.selectPlaneFigureCoordinateList(map)); + } + + + /** + * 编辑 + * + * @param + * @return + */ + @ApiOperation(value = "编辑钢结构自动化监测系统-测点和平面图配置中间表信息", notes = "编辑钢结构自动化监测系统-测点和平面图配置中间表信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody SteelStructureMeasurePointToPlaneFigure steelStructureMeasurePointToPlaneFigure) { + steelStructurePlaneFigureCoordinateService.editPlaneFigureCoordinate(steelStructureMeasurePointToPlaneFigure); + return Result.ok(); + } + + @ApiOperation(value = "编辑钢结构自动化监测系统-测点和平面图配置中间表信息", notes = "编辑钢结构自动化监测系统-测点和平面图配置中间表信息", httpMethod = "POST") + @PostMapping(value = "/updateFigureCoordinate") + public Result updateFigureCoordinate(@RequestBody List list) { + steelStructurePlaneFigureCoordinateService.updateFigureCoordinate(list); + return Result.ok(); + } + + @ApiOperation(value = "删除-通过设备和平面图ID删除钢结构自动化监测系统-测点和平面图配置中间表信息", notes = "删除-通过设备和平面图ID删除钢结构自动化监测系统-测点和平面图配置中间表信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "steelStructurePlaneFigureId", value = "钢结构自动化监测系统-平面图配置ID", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "steelStructureMeasurePointId", value = "钢结构自动化监测系统-测点id", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/deletePlaneFigureCoordinate") + public Result deleteSteelStructurePlaneFigureCoordinate(@ApiIgnore @RequestBody Map map) { + steelStructurePlaneFigureCoordinateService.deleteSteelStructurePlaneFigureCoordinate(map); + return Result.ok(); + } + + /** + * 通过id删除 + * + * @param + * @return + */ + @ApiOperation(value = "删除钢结构自动化监测系统-测点和平面图配置中间表信息", notes = "删除钢结构自动化监测系统-测点和平面图配置中间表信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-测点和平面图配置中间表ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/delete") + public Result delete(@ApiIgnore @RequestBody Map map) { + Result result = new Result(); + SteelStructureMeasurePointToPlaneFigure steelStructureMeasurePointToPlaneFigure = steelStructurePlaneFigureCoordinateService.getById(MapUtils.getString(map, "id")); + if (steelStructureMeasurePointToPlaneFigure == null) { + result.error500(MessageUtil.get("notFindErr")); + } else { + boolean ok = steelStructurePlaneFigureCoordinateService.removeById(MapUtils.getString(map, "id")); + if (ok) { + result.successMsg(MessageUtil.get("deleteSucess")); + } + } + + return result; + } + + @ApiOperation(value = "添加钢结构自动化监测系统-测点和平面图配置中间表信息", notes = "添加钢结构自动化监测系统-测点和平面图配置中间表信息", httpMethod = "POST") + @PostMapping(value = "/adds") + public Result adds(@RequestBody SteelStructureMeasurePointToPlaneFigure steelStructureMeasurePointToPlaneFigure) { + Result result = new Result(); + try { + steelStructurePlaneFigureCoordinateService.save(steelStructureMeasurePointToPlaneFigure); + result.successMsg("添加成功"); + } catch (Exception e) { + e.printStackTrace(); + log.info(e.getMessage()); + result.error500("添加失败"); + } + return result; + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMonitorTypeController.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMonitorTypeController.java new file mode 100644 index 000000000..21506053e --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureMonitorTypeController.java @@ -0,0 +1,132 @@ +package com.zhgd.xmgl.modules.steelstructure.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMonitorType; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureMonitorTypeService; +import com.zhgd.xmgl.util.MessageUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.List; +import java.util.Map; + + +/** + * @Title: Controller + * @Description: 钢结构自动化监测系统-监测类型 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/steelStructureMonitorType") +@Slf4j +@Api(tags = "钢结构自动化监测系统-监测内容") +public class SteelStructureMonitorTypeController { + @Autowired + private ISteelStructureMonitorTypeService steelStructureMonitorTypeService; + + + @ApiOperation(value = "分页列表查询钢结构自动化监测系统-监测类型", notes = "分页列表查询钢结构自动化监测系统-监测类型", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "steelStructureEngineeringId", value = "钢结构自动化监测系统-工程id", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), + }) + @PostMapping(value = "/page") + public Result> queryPageList(@ApiIgnore @RequestBody Map map) { + return Result.success(steelStructureMonitorTypeService.selectSteelStructureMonitorPage(map)); + } + + /** + * 列表查询 + */ + @ApiOperation(value = "列表查询钢结构自动化监测系统-监测类型(测点数量)", notes = "列表查询钢结构自动化监测系统-监测类型(测点数量)", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "steelStructureEngineeringId", value = "钢结构自动化监测系统-工程id", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/selectSteelStructureMonitorList") + public Result> selectSteelStructureMonitorList(@ApiIgnore @RequestBody Map map) { + return Result.success(steelStructureMonitorTypeService.selectSteelStructureMonitorList(map)); + } + + /** + * 列表查询 + * + * @return + */ + @ApiOperation(value = "列表查询默认钢结构自动化监测系统-监测类型列表", notes = "列表查询默认钢结构自动化监测系统-监测类型列表", httpMethod = "POST") + @PostMapping(value = "/getDefaultMonitorTypeList") + public Result> getDefaultMonitorTypeList() { + return Result.success(steelStructureMonitorTypeService.list()); + } + + /** + * 通过id查询 + * + * @param + * @return + */ + @ApiOperation(value = "通过id查询钢结构自动化监测系统-监测类型信息", notes = "通过id查询钢结构自动化监测系统-监测类型信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-监测类型ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/queryById") + public Result queryById(@ApiIgnore @RequestBody Map map) { + Result result = new Result(); + SteelStructureMonitorType steelStructureMonitorType = steelStructureMonitorTypeService.getById(MapUtils.getString(map, "id")); + if (steelStructureMonitorType == null) { + result.error500(MessageUtil.get("notFindErr")); + } else { + result.setResult(steelStructureMonitorType); + result.setSuccess(true); + } + return result; + } + + /** + * 列表查询 + */ + @ApiOperation(value = "查询监测内容列表以及测点汇总", notes = "查询监测内容列表以及测点汇总", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "steelStructureEngineeringId", value = "钢结构自动化监测系统-工程id", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/selectMonitorTypeCount") + public Result> selectMonitorTypeCount(@ApiIgnore @RequestBody Map map) { + return Result.success(steelStructureMonitorTypeService.selectMonitorTypeCount(map)); + } + + + @ApiOperation(value = "项目监测内容列表查询", notes = "项目监测内容列表查询", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "steelStructureEngineeringId", value = "钢结构自动化监测系统-工程id", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/selectMonitorTypeList") + public Result> selectMonitorTypeList(@ApiIgnore @RequestBody Map map) { + return Result.success(steelStructureMonitorTypeService.selectMonitorTypeList(map)); + } + + @ApiOperation(value = "统计查询项目监测内容告警列表", notes = "统计查询项目监测内容告警列表", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "steelStructureEngineeringId", value = "钢结构自动化监测系统-工程id", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "searchType", value = "类型,1查询近7天,2查询30天", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/selectMonitorTypeAlarmCountList") + public Result>> selectMonitorTypeAlarmCountList(@ApiIgnore @RequestBody Map map) { + return Result.success(steelStructureMonitorTypeService.selectMonitorTypeAlarmCountList(map)); + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructurePlaneFigureController.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructurePlaneFigureController.java new file mode 100644 index 000000000..870b9be0c --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructurePlaneFigureController.java @@ -0,0 +1,136 @@ +package com.zhgd.xmgl.modules.steelstructure.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructurePlaneFigure; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMeasurePointToPlaneFigure; +import com.zhgd.xmgl.modules.steelstructure.service.SteelStructureMeasurePointToPlaneFigureService; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructurePlaneFigureService; +import com.zhgd.xmgl.util.MessageUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +/** + * @Title: Controller + * @Description: 钢结构自动化监测系统-平面图配置 + * @author: pds + * @date: 2021-10-09 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/steelStructurePlaneFigure") +@Slf4j +@Api(tags = "钢结构自动化监测系统-平面图配置") +public class SteelStructurePlaneFigureController { + @Autowired + private ISteelStructurePlaneFigureService steelStructurePlaneFigureService; + + @Autowired + private SteelStructureMeasurePointToPlaneFigureService steelStructurePlaneFigureCoordinate; + + /** + * 列表查询 + * + * @return + */ + @ApiOperation(value = "列表查询钢结构自动化监测系统-平面图配置信息", notes = "列表查询钢结构自动化监测系统-平面图配置信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "steelStructureEngineeringId", value = "钢结构自动化监测系统-工程id", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/selectList") + public Result> selectList(@ApiIgnore @RequestBody Map map) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(SteelStructurePlaneFigure::getProjectSn, MapUtils.getString(map, "projectSn")) + .eq(SteelStructurePlaneFigure::getSteelStructureEngineeringId, MapUtils.getString(map, "steelStructureEngineeringId")); + List list = steelStructurePlaneFigureService.list(queryWrapper); + for (SteelStructurePlaneFigure steelStructurePlaneFigure : list) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .eq(SteelStructureMeasurePointToPlaneFigure::getSteelStructurePlaneFigureId, steelStructurePlaneFigure.getId()); + + steelStructurePlaneFigure.setMeasurePointIds(steelStructurePlaneFigureCoordinate.list(wrapper).stream().map(d -> d.getSteelStructureMeasurePointId().toString()).collect(Collectors.joining(","))); + } + return Result.success(list); + } + + /** + * 添加 + * + * @param steelStructurePlaneFigure + * @return + */ + @ApiOperation(value = "添加钢结构自动化监测系统-平面图配置信息", notes = "添加钢结构自动化监测系统-平面图配置信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody SteelStructurePlaneFigure steelStructurePlaneFigure) { + steelStructurePlaneFigureService.savesteelStructurePlaneFigure(steelStructurePlaneFigure); + return Result.ok(); + } + + /** + * 编辑 + * + * @param steelStructurePlaneFigure + * @return + */ + @ApiOperation(value = "编辑钢结构自动化监测系统-平面图配置信息", notes = "编辑钢结构自动化监测系统-平面图配置信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody SteelStructurePlaneFigure steelStructurePlaneFigure) { + steelStructurePlaneFigureService.editsteelStructurePlaneFigure(steelStructurePlaneFigure); + return Result.success(steelStructurePlaneFigure); + } + + /** + * 通过id删除 + * + * @param + * @return + */ + @ApiOperation(value = "删除钢结构自动化监测系统-平面图配置信息", notes = "删除钢结构自动化监测系统-平面图配置信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-平面图配置ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/delete") + public Result delete(@ApiIgnore @RequestBody Map map) { + steelStructurePlaneFigureService.deleteSteelStructurePlaneFigure(MapUtils.getString(map, "id")); + return Result.ok(); + } + + + /** + * 通过id查询 + * + * @param + * @return + */ + @ApiOperation(value = "通过id查询钢结构自动化监测系统-平面图配置信息", notes = "通过id查询钢结构自动化监测系统-平面图配置信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-平面图配置ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/queryById") + public Result queryById(@ApiIgnore @RequestBody Map map) { + Result result = new Result(); + SteelStructurePlaneFigure steelStructurePlaneFigure = steelStructurePlaneFigureService.getById(MapUtils.getString(map, "id")); + if (steelStructurePlaneFigure == null) { + result.error500(MessageUtil.get("notFindErr")); + } else { + result.setResult(steelStructurePlaneFigure); + result.setSuccess(true); + } + return result; + } + + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureSensorController.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureSensorController.java new file mode 100644 index 000000000..028677774 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureSensorController.java @@ -0,0 +1,53 @@ +package com.zhgd.xmgl.modules.steelstructure.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureCurrentData; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensor; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensorType; +import com.zhgd.xmgl.modules.steelstructure.service.SteelStructureSensorService; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureSensorTypeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author 邱平毅 + * @ClassName SteelStructureSensorController + * @date 2022/8/18 14:06 + * @Version 1.0 + */ +@RestController +@RequestMapping("/xmgl/steelStructureSensor") +@Slf4j +@Api(tags = "钢结构自动化监测系统-传感器") +public class SteelStructureSensorController { + + @Autowired + private SteelStructureSensorService steelStructureSensorService; + + + /** + * 通过测点编号查询传感器列表 + * + * @return + */ + @ApiOperation(value = "通过测点编号查询传感器列表", notes = "通过测点编号查询传感器列表") + @ApiImplicitParam(name = "measurePointNumber", value = "测点编号", paramType = "query", required = true, dataType = "String") + @GetMapping(value = "/getSensorListByMeasurePointNumber") + public Result> getSensorListByMeasurePointNumber(String measurePointNumber) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(SteelStructureSensor::getMeasurePointNumber, measurePointNumber); + return Result.success(steelStructureSensorService.list(queryWrapper)); + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureSensorTypeController.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureSensorTypeController.java new file mode 100644 index 000000000..fdd0e6dfe --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/controller/SteelStructureSensorTypeController.java @@ -0,0 +1,139 @@ +package com.zhgd.xmgl.modules.steelstructure.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensorType; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureSensorTypeService; +import com.zhgd.xmgl.util.MessageUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.List; +import java.util.Map; + + +/** + * @Title: Controller + * @Description: 钢结构自动化监测系统-传感器类型 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/steelStructureSensorType") +@Slf4j +@Api(tags = "钢结构自动化监测系统-传感器类型") +public class SteelStructureSensorTypeController { + @Autowired + private ISteelStructureSensorTypeService steelStructureSensorTypeService; + + @ApiOperation(value = "列表查询钢结构自动化监测系统-传感器类型信息", notes = "列表查询钢结构自动化监测系统-传感器类型信息", httpMethod = "POST") + @PostMapping(value = "/selectSteelStructureSensorTypeList") + public Result> selectSteelStructureSensorTypeList() { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(SteelStructureSensorType::getProjectSn, "-1"); + List list = steelStructureSensorTypeService.list(queryWrapper); + return Result.success(list); + } + + /** + * 添加 + * + * @param steelStructureSensorType + * @return + */ + @ApiOperation(value = "添加钢结构自动化监测系统-传感器类型信息", notes = "添加钢结构自动化监测系统-传感器类型信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody SteelStructureSensorType steelStructureSensorType) { + Result result = new Result(); + try { + steelStructureSensorTypeService.save(steelStructureSensorType); + result.successMsg(MessageUtil.get("addSucess")); + } catch (Exception e) { + e.printStackTrace(); + log.info(e.getMessage()); + result.error500(MessageUtil.get("failErr")); + } + return result; + } + + /** + * 编辑 + * + * @param steelStructureSensorType + * @return + */ + @ApiOperation(value = "编辑钢结构自动化监测系统-传感器类型信息", notes = "编辑钢结构自动化监测系统-传感器类型信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody SteelStructureSensorType steelStructureSensorType) { + Result result = new Result(); + SteelStructureSensorType steelStructureSensorTypeEntity = steelStructureSensorTypeService.getById(steelStructureSensorType.getId()); + if (steelStructureSensorTypeEntity == null) { + result.error500(MessageUtil.get("notFindErr")); + } else { + boolean ok = steelStructureSensorTypeService.updateById(steelStructureSensorType); + if (ok) { + result.successMsg(MessageUtil.get("editSucess")); + } + } + + return result; + } + + /** + * 通过id删除 + * + * @param + * @return + */ + @ApiOperation(value = "删除钢结构自动化监测系统-传感器类型信息", notes = "删除钢结构自动化监测系统-传感器类型信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-传感器类型ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/delete") + public Result delete(@ApiIgnore @RequestBody Map map) { + Result result = new Result(); + SteelStructureSensorType steelStructureSensorType = steelStructureSensorTypeService.getById(MapUtils.getString(map, "id")); + if (steelStructureSensorType == null) { + result.error500(MessageUtil.get("notFindErr")); + } else { + boolean ok = steelStructureSensorTypeService.removeById(MapUtils.getString(map, "id")); + if (ok) { + result.successMsg(MessageUtil.get("deleteSucess")); + } + } + + return result; + } + + + /** + * 通过id查询 + * + * @param + * @return + */ + @ApiOperation(value = "通过id查询钢结构自动化监测系统-传感器类型信息", notes = "通过id查询钢结构自动化监测系统-传感器类型信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "钢结构自动化监测系统-传感器类型ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/queryById") + public Result queryById(@ApiIgnore @RequestBody Map map) { + Result result = new Result(); + SteelStructureSensorType steelStructureSensorType = steelStructureSensorTypeService.getById(MapUtils.getString(map, "id")); + if (steelStructureSensorType == null) { + result.error500(MessageUtil.get("notFindErr")); + } else { + result.setResult(steelStructureSensorType); + result.setSuccess(true); + } + return result; + } + + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureCurrentData.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureCurrentData.java new file mode 100644 index 000000000..886f1f8be --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureCurrentData.java @@ -0,0 +1,197 @@ +package com.zhgd.xmgl.modules.steelstructure.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.beans.BeanUtils; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * @Description: 钢结构自动化监测系统-监测实时数据 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Data +@TableName("steel_structure_current_data") +@ApiModel(value = "SteelStructureCurrentData实体类", description = "SteelStructureCurrentData") +@Accessors(chain = true) +@NoArgsConstructor +public class SteelStructureCurrentData implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private Long id; + /** + * 项目sn + */ + @Excel(name = "项目sn", width = 15) + @ApiModelProperty(value = "项目sn") + private String projectSn; + /** + * 厂家code + */ + @Excel(name = "厂家code", width = 15) + @ApiModelProperty(value = "厂家code") + private String projectCode; + /** + * 接收时间 + */ + @Excel(name = "接收时间", width = 15) + @ApiModelProperty(value = "接收时间") + private String receiveTime; + /** + * 传感器编号 + */ + @Excel(name = "传感器编号", width = 15) + @ApiModelProperty(value = "传感器编号") + private String sensorSn; + /** + * 采样值,默认为0 + */ + @Excel(name = "采样值,默认为0", width = 15) + @ApiModelProperty(value = "采样值,默认为0") + private Float data; + /** + * 采样值 单次变化量,默认为0 + */ + @Excel(name = "采样值 单次变化量,默认为0", width = 15) + @ApiModelProperty(value = "采样值 单次变化量,默认为0") + private Float dataThis; + /** + * 采样值 累计变化量,默认为0 + */ + @Excel(name = "采样值 累计变化量,默认为0", width = 15) + @ApiModelProperty(value = "采样值 累计变化量,默认为0") + private Float dataTotal; + /** + * 采样值 变化速率,默认为0 + */ + @Excel(name = "采样值 变化速率,默认为0", width = 15) + @ApiModelProperty(value = "采样值 变化速率,默认为0") + private Float dataRate; + /** + * 报警状态 1.正常 2.超报警 3.超控制 4.变化速率报警 + */ + @Excel(name = "报警状态 1.正常 2.超报警 3.超控制 4.变化速率报警", width = 15) + @ApiModelProperty(value = "报警状态 1.正常 2.超报警 3.超控制 4.变化速率报警") + private Integer alarmState; + /** + * 创建时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + /** + * 更新时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; + + /** + * 单位 + */ + @Excel(name = "单位", width = 15) + @ApiModelProperty(value = "单位") + @TableField(exist = false) + private String unit; + + /** + * 钢结构自动化监测系统名称 + */ + @Excel(name = "钢结构自动化监测系统名称", width = 15) + @ApiModelProperty(value = "钢结构自动化监测系统名称") + @TableField(exist = false) + private String slopeName; + + + /** + * 测点编号 + */ + @Excel(name = "测点编号", width = 15) + @ApiModelProperty(value = "测点编号") + @TableField(exist = false) + private String measurePointNumber; + + /** + * 测点名称 + */ + @Excel(name = "测点名称", width = 15) + @ApiModelProperty(value = "测点名称") + @TableField(exist = false) + private String measurePointName; + + /** + * 传感器类型 + */ + @ApiModelProperty(value = "传感器类型") + @TableField(exist = false) + private String sensorTypeName; + + /** + * 累计值报警值 + */ + @ApiModelProperty(value = "累计值报警值") + @TableField(exist = false) + private Float alarmValue; + + /** + * 基准值 + */ + @ApiModelProperty(value = "基准值") + @TableField(exist = false) + private Float fiducialValue; + + /** + * 变化速率报警值 + */ + @ApiModelProperty(value = "变化速率报警值") + @TableField(exist = false) + private Float rateAlarmValue; + + /** + * 上次值 + */ + @ApiModelProperty(value = "上次值") + @TableField(exist = false) + private Float lastTimeData; + + /** + * 传感器名称 + */ + @ApiModelProperty(value = "传感器名称") + @TableField(exist = false) + private String sensorName; + /** + * 报警状态字符串 + */ + @ApiModelProperty(value = "报警状态字符串") + @TableField(exist = false) + private String AlarmStateStr; + + + public SteelStructureCurrentData(SteelStructureCurrentData steelStructureCurrentData) { + BeanUtils.copyProperties(steelStructureCurrentData, this); + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureEngineering.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureEngineering.java new file mode 100644 index 000000000..1514856d4 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureEngineering.java @@ -0,0 +1,139 @@ +package com.zhgd.xmgl.modules.steelstructure.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description: 钢结构自动化监测系统-工程 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Data +@TableName("steel_structure_engineering") +@ApiModel(value = "SteelStructureEngineering实体类", description = "SteelStructureEngineering") +public class SteelStructureEngineering implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private Long id; + /** + * 项目sn + */ + @Excel(name = "项目sn", width = 15) + @ApiModelProperty(value = "项目sn") + private String projectSn; + /** + * 边坡名称 + */ + @Excel(name = "边坡名称", width = 15) + @ApiModelProperty(value = "边坡名称") + private String slopeName; + /** + * 开工日期 + */ + @Excel(name = "开工日期", width = 20, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "开工日期") + private java.util.Date startDate; + /** + * 完工日期 + */ + @Excel(name = "完工日期", width = 20, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "完工日期") + private java.util.Date endDate; + /** + * 监测负责人id + */ + @Excel(name = "监测负责人id", width = 15) + @ApiModelProperty(value = "监测负责人id") + private Long surveyDirectorId; + /** + * 监测负责人名称 + */ + @Excel(name = "监测负责人名称", width = 15) + @ApiModelProperty(value = "监测负责人名称") + private String surveyDirectorName; + /** + * 监测人员id + */ + @Excel(name = "监测人员id", width = 15) + @ApiModelProperty(value = "监测人员id") + private Long surveyPersonnelId; + /** + * 监测人员名称 + */ + @Excel(name = "监测人员名称", width = 15) + @ApiModelProperty(value = "监测人员名称") + private String surveyPersonnelName; + /** + * 监测方案 + */ + @Excel(name = "监测方案", width = 15) + @ApiModelProperty(value = "监测方案") + private String surveyScheme; + /** + * 地勘报告 + */ + @Excel(name = "地勘报告", width = 15) + @ApiModelProperty(value = "地勘报告") + private String prospectingReport; + /** + * 设计图纸 + */ + @Excel(name = "设计图纸", width = 15) + @ApiModelProperty(value = "设计图纸") + private String deviseDrawing; + /** + * 安全等级 + */ + @Excel(name = "安全等级", width = 15) + @ApiModelProperty(value = "安全等级") + private String safetyLevel; + /** + * 状态,1进行中,2已完成 + */ + @Excel(name = "状态,1进行中,2已完成", width = 15) + @ApiModelProperty(value = "状态,1进行中,2已完成") + private Integer status; + /** + * 创建时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + /** + * 更新时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; + + @ApiModelProperty(value = "钢结构自动化监测系统-监测类型表id(多个,分隔)") + @TableField(exist = false) + @NotBlank + private String steelStructureMonitorTypeIds; + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureEngineeringToMonitorType.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureEngineeringToMonitorType.java new file mode 100644 index 000000000..205fe4c34 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureEngineeringToMonitorType.java @@ -0,0 +1,63 @@ +package com.zhgd.xmgl.modules.steelstructure.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * 钢结构自动化监测系统-工程和监测类型中间表 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "steel_structure_engineering_to_monitor_type") +public class SteelStructureEngineeringToMonitorType implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private Long id; + /** + * 钢结构自动化监测系统-工程id + */ + @Excel(name = "钢结构自动化监测系统-工程id", width = 15) + @ApiModelProperty(value = "钢结构自动化监测系统-工程id") + private Long steelStructureEngineeringId; + /** + * 钢结构自动化监测系统-监测类型表id + */ + @Excel(name = "钢结构自动化监测系统-监测类型表id", width = 15) + @ApiModelProperty(value = "钢结构自动化监测系统-监测类型表id") + private Long steelStructureMonitorTypeId; + /** + * 创建时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + /** + * 更新时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; + + @ApiModelProperty(value = "项目SN") + private String projectSn; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureMeasurePoint.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureMeasurePoint.java new file mode 100644 index 000000000..852de9655 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureMeasurePoint.java @@ -0,0 +1,121 @@ +package com.zhgd.xmgl.modules.steelstructure.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensor; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + * @Description: 钢结构自动化监测系统-测点 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Data +@TableName("steel_structure_measure_point") +@ApiModel(value = "SteelStructureMeasurePoint实体类", description = "SteelStructureMeasurePoint") +public class SteelStructureMeasurePoint implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private Long id; + /** + * 钢结构自动化监测系统-工程id + */ + @Excel(name = "钢结构自动化监测系统-工程id", width = 15) + @ApiModelProperty(value = "钢结构自动化监测系统-工程id") + private Long steelStructureEngineeringId; + /** + * 钢结构自动化监测系统-工程和监测类型中间表id + */ + @Excel(name = "钢结构自动化监测系统-工程和监测类型中间表id", width = 15) + @ApiModelProperty(value = "钢结构自动化监测系统-工程和监测类型中间表id") + @NotNull + private Long steelStructureEngineeringToMonitorTypeId; + /** + * 钢结构自动化监测系统-监测实时数据id + */ + @Excel(name = "钢结构自动化监测系统-监测实时数据id", width = 15) + @ApiModelProperty(value = "钢结构自动化监测系统-监测实时数据id") + private Long steelStructureCurrentDataId; + /** + * 测点名称 + */ + @Excel(name = "测点名称", width = 15) + @ApiModelProperty(value = "测点名称") + private String measurePointName; + /** + * 测点编号 + */ + @Excel(name = "测点编号", width = 15) + @ApiModelProperty(value = "测点编号") + private String measurePointNumber; + /** + * 测点位置 + */ + @Excel(name = "测点位置", width = 15) + @ApiModelProperty(value = "测点位置") + private String measurePointAddr; + /** + * 报警状态:1.正常 2.超报警 3.超控制 4.变化速率报警 + */ + @Excel(name = "报警状态:1.正常 2.超报警 3.超控制 4.变化速率报警", width = 15) + @ApiModelProperty(value = "报警状态:1.正常 2.超报警 3.超控制 4.变化速率报警") + private Integer alarmState; + /** + * 报警类型 + */ + @Excel(name = "报警类型", width = 15) + @ApiModelProperty(value = "报警类型") + private String alarmType; + /** + * 报警时间 + */ + @Excel(name = "报警时间", width = 15) + @ApiModelProperty(value = "报警时间") + private String alarmDate; + /** + * 创建时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + /** + * 更新时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; + + @ApiModelProperty(value = "项目SN") + private String projectSn; + /** + * 传感器编号列表 + */ + @TableField(exist = false) + @ApiModelProperty(value = "传感器编号列表") + private List sensorList; + + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureMeasurePointToPlaneFigure.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureMeasurePointToPlaneFigure.java new file mode 100644 index 000000000..8fd75bc81 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureMeasurePointToPlaneFigure.java @@ -0,0 +1,73 @@ +package com.zhgd.xmgl.modules.steelstructure.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * @Description: 钢结构自动化监测系统-测点和平面图配置中间表 + * @author: pds + * @date: 2021-10-09 + * @version: V1.0 + */ +@Data +@TableName("steel_structure_measure_point_to_plane_figure") +@ApiModel(value = "SteelStructurePlaneFigureCoordinate实体类", description = "SteelStructureMeasurePointToPlaneFigure") +public class SteelStructureMeasurePointToPlaneFigure implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private Long id; + /** + * 钢结构自动化监测系统-测点id + */ + @Excel(name = "钢结构自动化监测系统-测点id", width = 15) + @ApiModelProperty(value = "钢结构自动化监测系统-测点id") + private Long steelStructureMeasurePointId; + /** + * 钢结构自动化监测系统-平面图配置ID + */ + @Excel(name = "钢结构自动化监测系统-平面图配置ID", width = 15) + @ApiModelProperty(value = "钢结构自动化监测系统-平面图配置ID") + private Long steelStructurePlaneFigureId; + /** + * X坐标 + */ + @Excel(name = "X坐标", width = 15) + @ApiModelProperty(value = "X坐标") + private String mapX; + /** + * Y坐标 + */ + @Excel(name = "Y坐标", width = 15) + @ApiModelProperty(value = "Y坐标") + private String mapY; + /** + * 创建时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + /** + * 更新时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureMonitorType.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureMonitorType.java new file mode 100644 index 000000000..79f7e1009 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureMonitorType.java @@ -0,0 +1,66 @@ +package com.zhgd.xmgl.modules.steelstructure.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * 钢结构自动化监测系统-监测类型表 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "steel_structure_monitor_type") +@Accessors(chain = true) +public class SteelStructureMonitorType { + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private Long id; + /** + * 监测类型名称 + */ + @Excel(name = "监测类型名称", width = 15) + @ApiModelProperty(value = "监测类型名称") + private String monitorTypeName; + /** + * 监测编码 + */ + @Excel(name = "监测编码", width = 15) + @ApiModelProperty(value = "监测编码") + private String monitorTypeCode; + /** + * 单位 + */ + @Excel(name = "单位", width = 15) + @ApiModelProperty(value = "单位") + private String unit; + /** + * 创建时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + /** + * 更新时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructurePlaneFigure.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructurePlaneFigure.java new file mode 100644 index 000000000..a1cb47959 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructurePlaneFigure.java @@ -0,0 +1,80 @@ +package com.zhgd.xmgl.modules.steelstructure.entity; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * @Description: 钢结构自动化监测系统-平面图配置 + * @author: pds + * @date: 2021-10-09 + * @version: V1.0 + */ +@Data +@TableName("steel_structure_plane_figure") +@ApiModel(value = "SteelStructurePlaneFigure实体类", description = "SteelStructurePlaneFigure") +public class SteelStructurePlaneFigure implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private Long id; + /** + * 项目SN + */ + @Excel(name = "项目SN", width = 15) + @ApiModelProperty(value = "项目SN") + private String projectSn; + /** + * 钢结构自动化监测系统-工程id + */ + @Excel(name = "钢结构自动化监测系统-工程id", width = 15) + @ApiModelProperty(value = "钢结构自动化监测系统-工程id") + private Long steelStructureEngineeringId; + /** + * 平面图像名称 + */ + @Excel(name = "平面图像名称", width = 15) + @ApiModelProperty(value = "平面图像名称") + private String planeFigureName; + /** + * 图片url + */ + @Excel(name = "图片url", width = 15) + @ApiModelProperty(value = "图片url") + private String imageUrl; + /** + * 创建时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + /** + * 更新时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; + + @TableField(exist = false) + @ApiModelProperty(value = "测点ID,多个逗号分隔") + private String measurePointIds; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureSensor.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureSensor.java new file mode 100644 index 000000000..6f2a71dab --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureSensor.java @@ -0,0 +1,219 @@ +package com.zhgd.xmgl.modules.steelstructure.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureCurrentData; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.beans.BeanUtils; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "steel_structure_sensor") +@Accessors(chain = true) +@ApiModel(value = "SteelStructureSensor实体类", description = "SteelStructureSensor") +public class SteelStructureSensor implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 传感器id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "传感器id") + private Long id; + /** + * 传感器sn + */ + @Excel(name = "传感器sn", width = 15) + @ApiModelProperty(value = "传感器sn") + private String sensorSn; + /** + * 传感器名称 + */ + @Excel(name = "传感器名称", width = 15) + @ApiModelProperty(value = "传感器名称") + private String sensorName; + /** + * 传感器安装深度 + */ + @Excel(name = "传感器安装深度", width = 15) + @ApiModelProperty(value = "传感器安装深度") + private String sensorInstallationDepth; + /** + * 测点编号 + */ + @Excel(name = "测点编号", width = 15) + @ApiModelProperty(value = "测点编号") + private String measurePointNumber; + /** + * 钢结构自动化监测系统-传感器类型id + */ + @Excel(name = "钢结构自动化监测系统-传感器类型id", width = 15) + @ApiModelProperty(value = "钢结构自动化监测系统-传感器类型id") + private Long steelStructureSensorTypeId; + /** + * 报警状态 1.正常 2.超报警 3.超控制 4.变化速率报警 + */ + @Excel(name = "报警状态 1.正常 2.超报警 3.超控制 4.变化速率报警", width = 15) + @ApiModelProperty(value = "报警状态 1.正常 2.超报警 3.超控制 4.变化速率报警") + private Integer status; + /** + * 当前值 + */ + @Excel(name = "当前值", width = 15) + @ApiModelProperty(value = "当前值") + private Float data; + /** + * 采样值 累计变化量 + */ + @Excel(name = "采样值 累计变化量", width = 15) + @ApiModelProperty(value = "采样值 累计变化量") + private Float dataTotal; + /** + * 采样值 变化速率 + */ + @Excel(name = "采样值 变化速率", width = 15) + @ApiModelProperty(value = "采样值 变化速率") + private Float dataRate; + /** + * 接收时间 + */ + @Excel(name = "接收时间", width = 15) + @ApiModelProperty(value = "接收时间") + private String receiveTime; + /** + * 预警值 + */ + @Excel(name = "预警值", width = 15) + @ApiModelProperty(value = "预警值") + private Float earlyWarningValue; + /** + * 累计值报警值 + */ + @Excel(name = "累计值报警值", width = 15) + @ApiModelProperty(value = "累计值报警值") + private Float alarmValue; + /** + * 控制值 + */ + @Excel(name = "控制值", width = 15) + @ApiModelProperty(value = "控制值") + private Float controlValue; + /** + * 基准值 + */ + @Excel(name = "基准值", width = 15) + @ApiModelProperty(value = "基准值") + private Float fiducialValue; + /** + * 变化速率报警值 + */ + @Excel(name = "变化速率报警值", width = 15) + @ApiModelProperty(value = "变化速率报警值") + private Float rateAlarmValue; + /** + * 创建时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + /** + * 更新时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectSn; + + /** + * 钢结构自动化监测系统名称 + */ + @ApiModelProperty(value = "钢结构自动化监测系统名称") + @TableField(exist = false) + private String slopeName; + + /** + * 测点名称 + */ + @ApiModelProperty(value = "测点名称") + @TableField(exist = false) + private String measurePointName; + + /** + * 传感器类型 + */ + @ApiModelProperty(value = "传感器类型") + @TableField(exist = false) + private String sensorTypeName; + + + /** + * 单位 + */ + @ApiModelProperty(value = "单位") + @TableField(exist = false) + private String unit; + + @ApiModelProperty(value = "传感器编码") + @TableField(exist = false) + private String sensorTypeCode; + + + public SteelStructureSensor(String sensorSn, Long sensorTypeId, Integer status) { + this.sensorSn = sensorSn; + this.measurePointNumber = "-1"; + this.sensorName = measurePointNumber + "-" + sensorSn; + this.status = status; + this.earlyWarningValue = 0f; + this.alarmValue = 0f; + this.controlValue = 0f; + this.fiducialValue = 0f; + this.rateAlarmValue = 0f; + } + + public SteelStructureSensor(String sensorSn, Long sensorTypeId, Integer status, SteelStructureSensor steelStructureSensor) { + this.sensorSn = sensorSn; + this.status = status; + this.measurePointNumber = steelStructureSensor.getMeasurePointNumber(); + this.projectSn = steelStructureSensor.getProjectSn(); + this.sensorName = steelStructureSensor.getMeasurePointNumber() + "-" + sensorSn; + this.earlyWarningValue = steelStructureSensor.getEarlyWarningValue(); + this.alarmValue = steelStructureSensor.getAlarmValue(); + this.controlValue = steelStructureSensor.getControlValue(); + this.fiducialValue = steelStructureSensor.getFiducialValue(); + this.rateAlarmValue = steelStructureSensor.getRateAlarmValue(); + } + + public SteelStructureSensor(String sensorSn, SteelStructureSensor steelStructureSensor, SteelStructureCurrentData data) { + BeanUtils.copyProperties(steelStructureSensor, this); + this.status = data.getAlarmState(); + this.data = data.getData(); + this.dataTotal = data.getDataTotal(); + this.dataRate = data.getDataRate(); + this.receiveTime = data.getReceiveTime(); + this.sensorSn = sensorSn; + this.sensorName = steelStructureSensor.getMeasurePointNumber(); + this.id = null; + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureSensorType.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureSensorType.java new file mode 100644 index 000000000..e6a776f78 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/SteelStructureSensorType.java @@ -0,0 +1,76 @@ +package com.zhgd.xmgl.modules.steelstructure.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * @Description: 钢结构自动化监测系统-传感器类型 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Data +@TableName("steel_structure_sensor_type") +@ApiModel(value = "SteelStructureSensorType实体类", description = "SteelStructureSensorType") +public class SteelStructureSensorType implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private Long id; + /** + * 项目编号 + */ + @Excel(name = "项目编号", width = 15) + @ApiModelProperty(value = "项目编号") + private String projectSn; + /** + * 传感器类型名称 + */ + @Excel(name = "传感器类型名称", width = 15) + @ApiModelProperty(value = "传感器类型名称") + private String sensorTypeName; + /** + * 传感器编码 + */ + @Excel(name = "传感器编码", width = 15) + @ApiModelProperty(value = "传感器编码") + private String sensorTypeCode; + /** + * 单位 + */ + @Excel(name = "单位", width = 15) + @ApiModelProperty(value = "单位") + private String unit; + /** + * 创建时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + /** + * 更新时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/qo/CurrentDataListQO.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/qo/CurrentDataListQO.java new file mode 100644 index 000000000..5958cdd15 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/qo/CurrentDataListQO.java @@ -0,0 +1,35 @@ +package com.zhgd.xmgl.modules.steelstructure.entity.qo; + +import com.zhgd.xmgl.entity.PageQO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author 邱平毅 + * @ClassName CurrentDataListQO + * @date 2022/8/19 14:47 + * @Version 1.0 + */ +@Data +public class CurrentDataListQO extends PageQO { + @ApiModelProperty(value = "项目编号", required = true) + private String projectSn; + + @ApiModelProperty(value = "测点编号", required = false) + private String measurePointNumber; + + @ApiModelProperty(value = "传感器sn", required = false) + private String sensorSn; + + @ApiModelProperty(value = "钢结构自动化监测系统-工程和监测类型中间表id", required = true) + private Long steelStructureEngineeringToMonitorTypeId; + + @ApiModelProperty(value = "开始时间 2022-08-19 14:42:17格式", required = false) + private String startTime; + + @ApiModelProperty(value = "结束时间 2022-08-19 14:42:17格式", required = false) + private String endTime; + + @ApiModelProperty(value = "报警状态 1.正常 2.超报警 3.超控制 4.变化速率报警", required = false) + private Integer alarmState; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/qo/SelectMeasurePointListQO.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/qo/SelectMeasurePointListQO.java new file mode 100644 index 000000000..2f12e6dad --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/qo/SelectMeasurePointListQO.java @@ -0,0 +1,23 @@ +package com.zhgd.xmgl.modules.steelstructure.entity.qo; + +import com.zhgd.xmgl.entity.PageQO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author 邱平毅 + * @ClassName SelectMeasurePointListQO + * @date 2022/8/24 11:42 + * @Version 1.0 + */ +@Data +@ApiModel(value = "查询测点列表请求对象", description = "查询测点列表请求对象") +public class SelectMeasurePointListQO extends PageQO { + @ApiModelProperty(value = "钢结构自动化监测系统与监测内容关系ID", required = true) + private Long steelStructureEngineeringToMonitorTypeId; + @ApiModelProperty(value = "测点编号") + private String measurePointNumber; + @ApiModelProperty(value = "报警状态 1.正常 2.超报警 3.超控制 4.变化速率报警") + private Integer alarmState; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/vo/CurrentDataListVO.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/vo/CurrentDataListVO.java new file mode 100644 index 000000000..37e45a89d --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/vo/CurrentDataListVO.java @@ -0,0 +1,28 @@ +package com.zhgd.xmgl.modules.steelstructure.entity.vo; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureCurrentData; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author 邱平毅 + * @ClassName CurrentDataListVO + * @date 2022/8/23 16:39 + * @Version 1.0 + */ +@Data +@ApiModel("钢结构自动化监测系统历史数据对象") +public class CurrentDataListVO { + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("正报警值") + private Double positiveAlarmValue; + + @ApiModelProperty("负报警值") + private Double negativeAlarmValue; + + private IPage data; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/vo/DataAlarmVO.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/vo/DataAlarmVO.java new file mode 100644 index 000000000..28121ccaf --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/entity/vo/DataAlarmVO.java @@ -0,0 +1,23 @@ +package com.zhgd.xmgl.modules.steelstructure.entity.vo; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author 邱平毅 + * @ClassName DataAlramVO + * @date 2022/10/19 15:05 + * @Version 1.0 + */ +@Data +@ApiModel("钢结构自动化监测系统报警数量对象") +@NoArgsConstructor +@AllArgsConstructor +public class DataAlarmVO { + private Integer sum; + private Integer month; + private Integer week; + private Integer day; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/enums/DataStatusEnum.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/enums/DataStatusEnum.java new file mode 100644 index 000000000..f67be3597 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/enums/DataStatusEnum.java @@ -0,0 +1,46 @@ +package com.zhgd.xmgl.modules.steelstructure.enums; + +/** + * @author 邱平毅 + * @ClassName DataStatusEnum + * @date 2022/9/26 16:04 + * @Version 1.0 + * 钢结构自动化监测系统状态 + */ +public enum DataStatusEnum { + NORMAL(1, "正常"), + + SUPER_ALARM(2, "超报警"), + + SUPER_CONTROL(3, "超控制"), + + RATE_OF_CHANGE_ALARM(4, "变化速率报警"); + + + int id; + String statusName; + + public int getId() { + return id; + } + + public String getStatusName() { + return statusName; + } + + DataStatusEnum(int id, String statusName) { + this.id = id; + this.statusName = statusName; + } + + public static String getStatusNameById(Integer id) { + if (id != null) { + for (DataStatusEnum statusEnum : DataStatusEnum.values()) { + if (statusEnum.id == id) { + return statusEnum.getStatusName(); + } + } + } + return ""; + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureCurrentDataMapper.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureCurrentDataMapper.java new file mode 100644 index 000000000..9aedbceae --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureCurrentDataMapper.java @@ -0,0 +1,42 @@ +package com.zhgd.xmgl.modules.steelstructure.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureCurrentData; +import com.zhgd.xmgl.modules.highformwork.entity.vo.NumberDifferentTypesAlarmsRadarChartOneMonthVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @Description: 钢结构自动化监测系统-监测实时数据 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Mapper +public interface SteelStructureCurrentDataMapper extends BaseMapper { + IPage selectPageByProjectSn(@Param("measurePointName") String measurePointName, @Param("steelStructureSensorTypeId") Long steelStructureSensorTypeId, + @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectSn") String projectSn, Page objectPage); + + List selectSteelStructureCurrentDataPage(Page page, @Param("param") Map map); + + SteelStructureCurrentData selectNewestSteelStructureCurrentData(@Param("measurePointNumber") String measurePointNumber, @Param("projectSn") String projectSn); + + IPage selectSteelStructureCurrentDataList(@Param("projectSn") String projectSn, @Param("measurePointNumber") String measurePointNumber, @Param("sensorSn") String sensorSn, @Param("steelStructureEngineeringToMonitorTypeId") Long steelStructureEngineeringToMonitorTypeId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("alarmState") Integer alarmState, Page tPage); + + List selectArticleOneDataList(Set sensorSnList); + + List getAllEndData(); + + int updateDataTotalAndAlarmState(@Param("sensorSn") String sensorSn, @Param("fiducialValue") Float fiducialValue, @Param("alarmValue") Float alarmValue, @Param("rateAlarmValue") Float rateAlarmValue); + + List getAlarmCycleTrendGraph(Map map); + + List getNumberDifferentTypesAlarmsRadarChartOneMonth(Map map); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureEngineeringMapper.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureEngineeringMapper.java new file mode 100644 index 000000000..172b1c3b3 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureEngineeringMapper.java @@ -0,0 +1,24 @@ +package com.zhgd.xmgl.modules.steelstructure.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureEngineering; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @Description: 钢结构自动化监测系统-工程 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Mapper +public interface SteelStructureEngineeringMapper extends BaseMapper { + + List selectSteelStructureEngineeringPage(Page page, @Param("param") Map map); + + List selectSteelStructureList(Map map); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureEngineeringToMonitorTypeMapper.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureEngineeringToMonitorTypeMapper.java new file mode 100644 index 000000000..bc5b7a180 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureEngineeringToMonitorTypeMapper.java @@ -0,0 +1,15 @@ +package com.zhgd.xmgl.modules.steelstructure.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureEngineeringToMonitorType; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author 邱平毅 + * @ClassName SteelStructureEngineeringToMonitorTypeMapper + * @date 2022/8/19 11:29 + * @Version 1.0 + */ +@Mapper +public interface SteelStructureEngineeringToMonitorTypeMapper extends BaseMapper { +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureMeasurePointMapper.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureMeasurePointMapper.java new file mode 100644 index 000000000..a2cedc213 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureMeasurePointMapper.java @@ -0,0 +1,22 @@ +package com.zhgd.xmgl.modules.steelstructure.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMeasurePoint; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @Description: 钢结构自动化监测系统-测点 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Mapper +public interface SteelStructureMeasurePointMapper extends BaseMapper { + List selectSteelStructureAllMeasurePointList(Map map); + + SteelStructureMeasurePoint getDetailsByMeasurePointNumber(@Param("measurePointNumber") String measurePointNumber); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureMeasurePointToPlaneFigureMapper.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureMeasurePointToPlaneFigureMapper.java new file mode 100644 index 000000000..e7096ec13 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureMeasurePointToPlaneFigureMapper.java @@ -0,0 +1,20 @@ +package com.zhgd.xmgl.modules.steelstructure.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMeasurePointToPlaneFigure; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Description: 钢结构自动化监测系统-测点和平面图配置中间表 + * @author: pds + * @date: 2021-10-09 + * @version: V1.0 + */ +@Mapper +public interface SteelStructureMeasurePointToPlaneFigureMapper extends BaseMapper { + + List selectPlaneFigureCoordinateList(Long steelStructurePlaneFigureId); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureMonitorTypeMapper.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureMonitorTypeMapper.java new file mode 100644 index 000000000..9de780ed7 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureMonitorTypeMapper.java @@ -0,0 +1,31 @@ +package com.zhgd.xmgl.modules.steelstructure.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMonitorType; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @Description: 钢结构自动化监测系统-监测类型 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Mapper +public interface SteelStructureMonitorTypeMapper extends BaseMapper { + + List selectSteelStructureMonitorPage(Page page, @Param("steelStructureEngineeringId") Long steelStructureEngineeringId); + + List selectSteelStructureMonitorList(Map map); + + List> selectSteelStructureMonitorTypeCountList(Map map); + + List selectMonitorTypeList(Map map); + + List> selectMonitorTypeAlarmCountList(Map map); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructurePlaneFigureMapper.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructurePlaneFigureMapper.java new file mode 100644 index 000000000..2c65c3d8d --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructurePlaneFigureMapper.java @@ -0,0 +1,16 @@ +package com.zhgd.xmgl.modules.steelstructure.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructurePlaneFigure; +import org.apache.ibatis.annotations.Mapper; + +/** + * @Description: 钢结构自动化监测系统-平面图配置 + * @author: pds + * @date: 2021-10-09 + * @version: V1.0 + */ +@Mapper +public interface SteelStructurePlaneFigureMapper extends BaseMapper { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureSensorMapper.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureSensorMapper.java new file mode 100644 index 000000000..032adbac3 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureSensorMapper.java @@ -0,0 +1,26 @@ +package com.zhgd.xmgl.modules.steelstructure.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensor; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Set; + +/** + * @author 邱平毅 + * @ClassName SteelStructureSensorMapper + * @date 2022/8/18 9:42 + * @Version 1.0 + */ +@Mapper +public interface SteelStructureSensorMapper extends BaseMapper { + List getListBySensorSnSet(Set sensorSnSet); + + SteelStructureSensor getUnitAndAlarmValueBySnAndPointNumber(@Param("sensorSn") String sensorSn, @Param("measurePointNumber") String measurePointNumber); + + List getListByMeasurePointNumberList(List measurePointNumberList); + + List getListBySensorSnList(List sensorSnList); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureSensorTypeMapper.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureSensorTypeMapper.java new file mode 100644 index 000000000..7130d0dbf --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/SteelStructureSensorTypeMapper.java @@ -0,0 +1,16 @@ +package com.zhgd.xmgl.modules.steelstructure.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensorType; +import org.apache.ibatis.annotations.Mapper; + +/** + * @Description: 钢结构自动化监测系统-传感器类型 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Mapper +public interface SteelStructureSensorTypeMapper extends BaseMapper { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureCurrentDataMapper.xml b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureCurrentDataMapper.xml new file mode 100644 index 000000000..c7ef1f88c --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureCurrentDataMapper.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + update steel_structure_current_data + set data = data_total + ${fiducialValue}, + alarm_state = IF( data_rate > ${rateAlarmValue}, 4, + if(data_total > ${alarmValue}, 2, 1)) + where sensor_sn = #{sensorSn} + + + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureEngineeringMapper.xml b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureEngineeringMapper.xml new file mode 100644 index 000000000..617d920d6 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureEngineeringMapper.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureEngineeringToMonitorTypeMapper.xml b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureEngineeringToMonitorTypeMapper.xml new file mode 100644 index 000000000..111e009aa --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureEngineeringToMonitorTypeMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureMeasurePointMapper.xml b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureMeasurePointMapper.xml new file mode 100644 index 000000000..ec819b23b --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureMeasurePointMapper.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureMeasurePointToPlaneFigureMapper.xml b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureMeasurePointToPlaneFigureMapper.xml new file mode 100644 index 000000000..666246803 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureMeasurePointToPlaneFigureMapper.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureMonitorTypeMapper.xml b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureMonitorTypeMapper.xml new file mode 100644 index 000000000..ae4babe36 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureMonitorTypeMapper.xml @@ -0,0 +1,114 @@ + + + + + + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructurePlaneFigureMapper.xml b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructurePlaneFigureMapper.xml new file mode 100644 index 000000000..106e3958f --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructurePlaneFigureMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureSensorMapper.xml b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureSensorMapper.xml new file mode 100644 index 000000000..cf5962ac8 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureSensorMapper.xml @@ -0,0 +1,66 @@ + + + + + + + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureSensorTypeMapper.xml b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureSensorTypeMapper.xml new file mode 100644 index 000000000..1be35bb47 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/mapper/xml/SteelStructureSensorTypeMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureCurrentDataService.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureCurrentDataService.java new file mode 100644 index 000000000..341a4c447 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureCurrentDataService.java @@ -0,0 +1,56 @@ +package com.zhgd.xmgl.modules.steelstructure.service; + +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureCurrentData; +import com.zhgd.xmgl.modules.steelstructure.entity.vo.DataAlarmVO; +import com.zhgd.xmgl.modules.highformwork.entity.vo.NumberDifferentTypesAlarmsRadarChartOneMonthVo; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + +/** + * @Description: 钢结构自动化监测系统-监测实时数据 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +public interface ISteelStructureCurrentDataService extends IService { + + IPage selectPageByProjectSn(String measurePointName, Long sensorTypeId, String startDate, String endDate, String projectSn, Integer pageNo, Integer pageSize); + + IPage selectSteelStructureCurrentDataPage(Map map); + + void saveSteelStructureCurrentData(SteelStructureCurrentData steelStructureCurrentData); + + /** + * 批量保存实时数据 + * + * @param jsonArray + */ + void saveBatchSteelStructureCurrentData(JSONArray jsonArray); + + IPage selectSteelStructureCurrentDataList(String projectSn, String measurePointNumber, String sensorSn, Long steelStructureEngineeringToMonitorTypeId, String startTime, String endTime, Integer alarmState, Integer pageNo, Integer pageSize); + + /** + * 获取所有传感器最后一条数据时间 + * + * @return + */ + List getAllEndData(); + + void updateDataTotalAndAlarmState(String sensorSn, Float fiducialValue, Float alarmValue, Float rateAlarmValue); + + void exportData(HttpServletResponse response, String projectSn, String measurePointNumber, String sensorSn, Long steelStructureEngineeringToMonitorTypeId, String startTime, String endTime, Integer alarmState); + + void zwExportData(HttpServletResponse response, String measurePointName, Long sensorTypeId, String startDate, String endDate, String projectSn); + + DataAlarmVO getDataAlarmNumber(); + + List getNumberDifferentTypesAlarmsRadarChartOneMonth(Map map); + + List getAlarmCycleTrendGraph(Map map); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureEngineeringService.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureEngineeringService.java new file mode 100644 index 000000000..ece81ab0a --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureEngineeringService.java @@ -0,0 +1,27 @@ +package com.zhgd.xmgl.modules.steelstructure.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureEngineering; + +import java.util.List; +import java.util.Map; + +/** + * @Description: 钢结构自动化监测系统-工程 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +public interface ISteelStructureEngineeringService extends IService { + + void saveSteelStructureEngineering(SteelStructureEngineering steelStructureEngineering); + + void deleteSteelStructureEngineering(Long id); + + IPage selectSteelStructureEngineeringPage(Map map); + + List selectSteelStructureList(Map map); + + SteelStructureEngineering edit(SteelStructureEngineering steelStructureEngineering); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureMeasurePointService.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureMeasurePointService.java new file mode 100644 index 000000000..fcc07d576 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureMeasurePointService.java @@ -0,0 +1,34 @@ +package com.zhgd.xmgl.modules.steelstructure.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMeasurePoint; + +import java.util.List; +import java.util.Map; + +/** + * @Description: 钢结构自动化监测系统-测点 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +public interface ISteelStructureMeasurePointService extends IService { + void saveMeasurePoint(SteelStructureMeasurePoint steelStructureMeasurePoint); + + void editMeasurePoint(SteelStructureMeasurePoint steelStructureMeasurePoint); + + SteelStructureMeasurePoint selectSteelStructureMeasurePointById(Map map); + + List selectSteelStructureAllMeasurePointList(Map map); + + SteelStructureMeasurePoint getDetailsByMeasurePointNumber(String measurePointNumber); + + /** + * 根据关系id列表删除数据 + * + * @param relaIdList + */ + void deleteByRelaIdList(List relaIdList); + + void deleteByMeasurePointNumber(String measurePointNumber); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureMonitorTypeService.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureMonitorTypeService.java new file mode 100644 index 000000000..9af279454 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureMonitorTypeService.java @@ -0,0 +1,28 @@ +package com.zhgd.xmgl.modules.steelstructure.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMonitorType; + +import java.util.List; +import java.util.Map; + +/** + * @Description: 钢结构自动化监测系统-监测类型 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +public interface ISteelStructureMonitorTypeService extends IService { + + IPage selectSteelStructureMonitorPage(Map map); + + List selectSteelStructureMonitorList(Map map); + + Map selectMonitorTypeCount(Map map); + + List selectMonitorTypeList(Map map); + + List> selectMonitorTypeAlarmCountList(Map map); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructurePlaneFigureService.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructurePlaneFigureService.java new file mode 100644 index 000000000..6557e2452 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructurePlaneFigureService.java @@ -0,0 +1,19 @@ +package com.zhgd.xmgl.modules.steelstructure.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructurePlaneFigure; + +/** + * @Description: 钢结构自动化监测系统-平面图配置 + * @author: pds + * @date: 2021-10-09 + * @version: V1.0 + */ +public interface ISteelStructurePlaneFigureService extends IService { + + void deleteSteelStructurePlaneFigure(String id); + + void savesteelStructurePlaneFigure(SteelStructurePlaneFigure steelStructurePlaneFigure); + + void editsteelStructurePlaneFigure(SteelStructurePlaneFigure steelStructurePlaneFigure); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureSensorTypeService.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureSensorTypeService.java new file mode 100644 index 000000000..235fb120f --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/ISteelStructureSensorTypeService.java @@ -0,0 +1,14 @@ +package com.zhgd.xmgl.modules.steelstructure.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensorType; + +/** + * @Description: 钢结构自动化监测系统-传感器类型 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +public interface ISteelStructureSensorTypeService extends IService { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/SteelStructureEngineeringToMonitorTypeService.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/SteelStructureEngineeringToMonitorTypeService.java new file mode 100644 index 000000000..f5ce6b29f --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/SteelStructureEngineeringToMonitorTypeService.java @@ -0,0 +1,19 @@ +package com.zhgd.xmgl.modules.steelstructure.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureEngineeringToMonitorType; + +/** + * @author 邱平毅 + * @ClassName SteelStructureEngineeringToMonitorTypeService + * @date 2022/8/19 11:29 + * @Version 1.0 + */ +public interface SteelStructureEngineeringToMonitorTypeService extends IService { + /** + * 根据钢结构自动化监测系统id删除监测内容 + * + * @param id + */ + void deleteByExcavationId(Long id); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/SteelStructureMeasurePointToPlaneFigureService.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/SteelStructureMeasurePointToPlaneFigureService.java new file mode 100644 index 000000000..61570860a --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/SteelStructureMeasurePointToPlaneFigureService.java @@ -0,0 +1,25 @@ +package com.zhgd.xmgl.modules.steelstructure.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMeasurePointToPlaneFigure; + +import java.util.List; +import java.util.Map; + +/** + * @Description: 钢结构自动化监测系统-测点和平面图配置中间表 + * @author: pds + * @date: 2021-10-09 + * @version: V1.0 + */ +public interface SteelStructureMeasurePointToPlaneFigureService extends IService { + + List selectPlaneFigureCoordinateList(Map map); + + void editPlaneFigureCoordinate(SteelStructureMeasurePointToPlaneFigure steelStructureMeasurePointToPlaneFigure); + + void deleteSteelStructurePlaneFigureCoordinate(Map map); + + void updateFigureCoordinate(List list); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/SteelStructureSensorService.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/SteelStructureSensorService.java new file mode 100644 index 000000000..83183bf0c --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/SteelStructureSensorService.java @@ -0,0 +1,31 @@ +package com.zhgd.xmgl.modules.steelstructure.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensor; + +import java.util.List; +import java.util.Map; + +/** + * @author 邱平毅 + * @ClassName SteelStructureSensorService + * @date 2022/8/18 9:42 + * @Version 1.0 + */ +public interface SteelStructureSensorService extends IService { + /** + * 根据测点编号列表删除传感器 + * + * @param mpNumberList + */ + void deleteByMpNumberList(List mpNumberList); + + List getListBySensorAndTypeMap(Map sensorAndTypeMap); + + SteelStructureSensor getUnitAndAlarmValueBySnAndPointNumber(String sensorSn, String measurePointNumber); + + List getListBySensorSnList(List sensorSnList); + + List getListByMeasurePointNumberList(List measurePointNumberList); + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureCurrentDataServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureCurrentDataServiceImpl.java new file mode 100644 index 000000000..e53fac50c --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureCurrentDataServiceImpl.java @@ -0,0 +1,363 @@ +package com.zhgd.xmgl.modules.steelstructure.service.impl; + + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.NumberUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.jeecg.common.execption.OpenAlertException; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.async.AsyncDevExcavation; +import com.zhgd.xmgl.modules.discharging.service.impl.DischargingPlatformAlarmServiceImpl; +import com.zhgd.xmgl.modules.highformwork.entity.vo.NumberDifferentTypesAlarmsRadarChartOneMonthVo; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureCurrentData; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMeasurePoint; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMonitorType; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensor; +import com.zhgd.xmgl.modules.steelstructure.entity.vo.DataAlarmVO; +import com.zhgd.xmgl.modules.steelstructure.enums.DataStatusEnum; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureCurrentDataMapper; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureMeasurePointMapper; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureMonitorTypeMapper; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureSensorMapper; +import com.zhgd.xmgl.modules.steelstructure.service.SteelStructureSensorService; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureCurrentDataService; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureMeasurePointService; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureMonitorTypeService; +import com.zhgd.xmgl.util.JxlExcelUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @Description: 钢结构自动化监测系统-监测实时数据 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Service +@Transactional(rollbackFor = Exception.class) +@Slf4j +public class SteelStructureCurrentDataServiceImpl extends ServiceImpl implements ISteelStructureCurrentDataService { + @Autowired + private SteelStructureMonitorTypeMapper steelStructureMonitorTypeMapper; + @Autowired + private DischargingPlatformAlarmServiceImpl dischargingPlatformAlarmService; + @Autowired + private SteelStructureCurrentDataMapper steelStructureCurrentDataMapper; + @Autowired + private SteelStructureMeasurePointMapper steelStructureMeasurePointMapper; + @Autowired + ISteelStructureMonitorTypeService steelStructureMonitorTypeService; + @Autowired + ISteelStructureCurrentDataService steelStructureCurrentDataService; + @Autowired + SteelStructureSensorMapper steelStructureSensorMapper; + @Autowired + SteelStructureSensorService steelStructureSensorService; + @Autowired + ISteelStructureMeasurePointService steelStructureMeasurePointService; + @Autowired + AsyncDevExcavation asyncSteelStructure; + + @Override + public IPage selectPageByProjectSn(String measurePointName, Long sensorTypeId, String startDate, String endDate, String projectSn, Integer pageNo, Integer pageSize) { + IPage page = steelStructureCurrentDataMapper.selectPageByProjectSn(measurePointName, sensorTypeId, startDate, endDate, projectSn, new Page<>(pageNo, pageSize)); + for (SteelStructureCurrentData currentData : page.getRecords()) { + currentData.setLastTimeData(NumberUtil.sub(Optional.ofNullable(currentData.getData()).orElse(0f), Optional.ofNullable(currentData.getDataThis()).orElse(0f)).floatValue()); + } + return page; + } + + @Override + public IPage selectSteelStructureCurrentDataPage(Map map) { + int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString()); + int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString()); + Page page = new Page<>(pageNo, pageSize); + List list = steelStructureCurrentDataMapper.selectSteelStructureCurrentDataPage(page, map); + return page.setRecords(list); + } + + @Override + public IPage selectSteelStructureCurrentDataList(String projectSn, String measurePointNumber, String sensorSn, Long steelStructureEngineeringToMonitorTypeId, String startTime, String endTime, Integer alarmState, Integer pageNo, Integer pageSize) { + IPage page = steelStructureCurrentDataMapper.selectSteelStructureCurrentDataList(projectSn, measurePointNumber, sensorSn, steelStructureEngineeringToMonitorTypeId, startTime, endTime, alarmState, new Page<>(pageNo, pageSize)); + for (SteelStructureCurrentData currentData : page.getRecords()) { + currentData.setLastTimeData(NumberUtil.sub(Optional.ofNullable(currentData.getData()).orElse(0f), Optional.ofNullable(currentData.getDataThis()).orElse(0f)).floatValue()); + } + return page; + } + + @Override + public List getAllEndData() { + return steelStructureCurrentDataMapper.getAllEndData(); + } + + @Override + public void updateDataTotalAndAlarmState(String sensorSn, Float fiducialValue, Float alarmValue, Float rateAlarmValue) { + steelStructureCurrentDataMapper.updateDataTotalAndAlarmState(sensorSn, fiducialValue, Math.abs(alarmValue), Math.abs(rateAlarmValue)); + } + + @Override + public void exportData(HttpServletResponse response, String projectSn, String measurePointNumber, String sensorSn, Long steelStructureEngineeringToMonitorTypeId, String startTime, String endTime, Integer alarmState) { + try { + List list = steelStructureCurrentDataMapper.selectSteelStructureCurrentDataList(projectSn, measurePointNumber, sensorSn, steelStructureEngineeringToMonitorTypeId, startTime, endTime, alarmState, new Page<>().setSize(-1)).getRecords(); + for (SteelStructureCurrentData currentData : list) { + currentData.setLastTimeData(NumberUtil.sub(Optional.ofNullable(currentData.getData()).orElse(0f), Optional.ofNullable(currentData.getDataThis()).orElse(0f)).floatValue()); + currentData.setAlarmStateStr(DataStatusEnum.getStatusNameById(currentData.getAlarmState())); + } + String[] heads = {"测点名称", "传感器名称", "传感器编号", "传感器类型", "初始值", "采集时间", "上次值", "本次值", "本次变化量", "累计值", "累计值预警值", "变化速率", "变化速率预警值", "报警状态"}; + String[] headsStr = {"measurePointName", "sensorName", "sensorSn", "sensorTypeName", "fiducialValue", "receiveTime", "lastTimeData", "data", "dataThis", "dataTotal", "alarmValue", "dataRate", "rateAlarmValue", "alarmStateStr"}; + JxlExcelUtils.excelExport("钢结构自动化监测系统实时数据列表", heads, headsStr, list, response); + } catch (Exception e) { + log.error("导出培训记录数据异常" + e); + } + } + + @Override + public void zwExportData(HttpServletResponse response, String measurePointName, Long sensorTypeId, String startDate, String endDate, String projectSn) { + try { + List list = steelStructureCurrentDataMapper.selectPageByProjectSn(measurePointName, sensorTypeId, startDate, endDate, projectSn, new Page<>().setSize(-1)).getRecords(); + for (SteelStructureCurrentData currentData : list) { + currentData.setLastTimeData(NumberUtil.sub(Optional.ofNullable(currentData.getData()).orElse(0f), Optional.ofNullable(currentData.getDataThis()).orElse(0f)).floatValue()); + currentData.setAlarmStateStr(DataStatusEnum.getStatusNameById(currentData.getAlarmState())); + } + String[] heads = {"钢结构自动化监测系统名称", "测点名称", "传感器类型", "传感器名称", "传感器编号", "初始值", "采集时间", "上次值", "本次值", "本次变化量", "累计值", "累计值预警值", "变化速率", "变化速率预警值", "报警状态"}; + String[] headsStr = {"slopeName", "measurePointName", "sensorTypeName", "sensorName", "sensorSn", "fiducialValue", "receiveTime", "lastTimeData", "data", "dataThis", "dataTotal", "alarmValue", "dataRate", "rateAlarmValue", "alarmStateStr"}; + JxlExcelUtils.excelExport("钢结构自动化监测系统实时数据列表", heads, headsStr, list, response); + } catch (Exception e) { + log.error("导出培训记录数据异常" + e); + } + } + + @Override + public DataAlarmVO getDataAlarmNumber() { + List allList = steelStructureCurrentDataMapper.selectList(Wrappers.lambdaQuery().ne(SteelStructureCurrentData::getAlarmState, DataStatusEnum.NORMAL.getId()).isNotNull(SteelStructureCurrentData::getReceiveTime)); + int month = 0; + int week = 0; + int day = 0; + + Date currentDate = new Date(); + int currentYear = DateUtil.year(currentDate); + int currentWeek = DateUtil.weekOfYear(currentDate); + for (SteelStructureCurrentData data : allList) { + Date receiveTime = DateUtil.parse(data.getReceiveTime(), DatePattern.NORM_DATETIME_PATTERN); + if (DateUtil.isSameDay(currentDate, receiveTime)) { + // 同一天 + day++; + week++; + month++; + } else if (currentYear == DateUtil.year(receiveTime) && DateUtil.weekOfYear(receiveTime) == currentWeek) { + // 同一周 + week++; + month++; + } else if (DateUtil.isSameMonth(currentDate, receiveTime)) { + // 同一个月 + month++; + } + } + + return new DataAlarmVO(allList.size(), month, week, day); + } + + @Override + public List getAlarmCycleTrendGraph(Map map) { + //eg:[{time:2020-11-11,num:11}] + List list = steelStructureCurrentDataMapper.getAlarmCycleTrendGraph(map); + dischargingPlatformAlarmService.fillEmptyDateData(list); + return list; + } + + @Override + public List getNumberDifferentTypesAlarmsRadarChartOneMonth(Map map) { + List list = steelStructureCurrentDataMapper.getNumberDifferentTypesAlarmsRadarChartOneMonth(map); + fillData(list); + return list; + } + + private void fillData(List list) { + Map nameDataMap = list.stream().collect(Collectors.toMap(NumberDifferentTypesAlarmsRadarChartOneMonthVo::getName, o -> o)); + //类型 ,1电量(%),2 X轴(°),3 Y轴(°),4压力(kN),5沉降(mm) + //支架沉降、模板沉降、立杆轴力、压力监测、水平位移 + List typeList = steelStructureMonitorTypeMapper.selectList(null); + List dataList = typeList.stream().map(SteelStructureMonitorType::getMonitorTypeName).collect(Collectors.toList()); + list.clear(); + for (String name : dataList) { + NumberDifferentTypesAlarmsRadarChartOneMonthVo vo = nameDataMap.get(name); + if (vo == null) { + vo = new NumberDifferentTypesAlarmsRadarChartOneMonthVo(); + vo.setName(name); + vo.setNum(0); + } + list.add(vo); + } + List limitList = list.stream().sorted((o1, o2) -> o2.getNum().compareTo(o1.getNum())).limit(6).collect(Collectors.toList()); + list.clear(); + list.addAll(limitList); + } + + @Override + public void saveSteelStructureCurrentData(SteelStructureCurrentData steelStructureCurrentData) { + SteelStructureSensor steelStructureSensor = steelStructureSensorMapper.selectOne(new LambdaQueryWrapper() + .eq(SteelStructureSensor::getSensorSn, steelStructureCurrentData.getSensorSn())); + if (steelStructureSensor == null) { + throw new OpenAlertException("传感器编号不存在"); + } + steelStructureCurrentData.setProjectSn(steelStructureSensor.getProjectSn()); + steelStructureCurrentData.setId(null); + steelStructureCurrentDataMapper.insert(steelStructureCurrentData); + steelStructureMeasurePointMapper.update(null, new LambdaUpdateWrapper() + .set(SteelStructureMeasurePoint::getAlarmState, steelStructureCurrentData.getAlarmState()) + .eq(SteelStructureMeasurePoint::getMeasurePointNumber, steelStructureSensor.getMeasurePointNumber()) + ); + } + + /** + * @param currentDataList + * @return Map<传感器编号, 传感器类型> + */ + private Map getSensorAndTypeMap(JSONArray currentDataList) { + Map sensorAndTypeMap = new LinkedHashMap<>(); + for (int i = 0; i < currentDataList.size(); i++) { + // 当前数据 + JSONObject currentData = currentDataList.getJSONObject(i); + // 实时数据 + JSONObject current = currentData.getJSONObject("current"); + if (current == null || CollUtil.isEmpty(current.getJSONArray("calcValue"))) { + break; + } + JSONArray calcValue = current.getJSONArray("calcValue"); + for (int j = 0; j < calcValue.size(); j++) { + sensorAndTypeMap.put(uuidToSensorSn(currentData, j), + Optional.ofNullable(currentData.getJSONObject("metadata")).map(metadata -> metadata.getString("monitorTypeCode")).orElse(null)); + } + } + return sensorAndTypeMap; + } + + private String uuidToSensorSn(JSONObject currentData, int index) { + return currentData.getString("uuid") + (index > 0 ? "(" + (index + 1) + ")" : ""); + } + + + private List getBatchSaveListProcess(JSONArray currentDataList) { + // Map<传感器编号, 传感器类型> + Map sensorAndTypeMap = getSensorAndTypeMap(currentDataList); + + List sensorList = steelStructureSensorService.getListBySensorAndTypeMap(sensorAndTypeMap); + + Map sensorMap = sensorList.stream().collect(Collectors.toMap(SteelStructureSensor::getSensorSn, Function.identity())); + + + return createCurrentDataList(currentDataList, sensorMap); + } + + private List createCurrentDataList(JSONArray currentDataList, Map sensorMap) { + // 实时数据列表 + List steelStructureCurrentDataList = new LinkedList<>(); + // 循环创建实时数据对象,并赋值给列表 + for (int i = 0; i < currentDataList.size(); i++) { + SteelStructureCurrentData steelStructureCurrentData = new SteelStructureCurrentData(); + + JSONObject currentData = currentDataList.getJSONObject(i); + String date = currentData.getString("time").substring(0, currentData.getString("time").length() - 3); + DateTime receiveTime = DateUtil.parse(date, "yyyyMMddHHmmss"); + steelStructureCurrentData.setReceiveTime(DateUtil.format(receiveTime, "yyyy-MM-dd HH:mm:ss")); + JSONObject current = currentData.getJSONObject("current"); + log.info("currentData.current:{}", current); + int alarmState = Optional.ofNullable(current.getJSONObject("pointAlarmStatus")).map(e -> e.getInteger("alarmState")).orElse(1); + if (current != null) { + + if (currentData.getJSONObject("metadata") != null) { + steelStructureCurrentData.setProjectCode(currentData.getJSONObject("metadata").getString("projectCode")); + } + JSONArray calcValue = current.getJSONArray("calcValue"); + + if (CollUtil.isNotEmpty(calcValue)) { + for (int j = 0; j < calcValue.size(); j++) { + String sensorSn = uuidToSensorSn(currentData, j); + SteelStructureSensor sensor = sensorMap.get(sensorSn); + + steelStructureCurrentData.setProjectSn(sensor.getProjectSn()); + + JSONObject valueObject = calcValue.getJSONObject(j); + Float dataTotal = valueObject.getFloat("value"); + steelStructureCurrentData.setData(dataTotal + sensor.getFiducialValue()); + steelStructureCurrentData.setDataThis(valueObject.getFloat("variation")); + Float rateChange = valueObject.getFloat("rateChange"); + steelStructureCurrentData.setDataRate(rateChange); + steelStructureCurrentData.setDataTotal(dataTotal); + steelStructureCurrentData.setSensorSn(sensor.getSensorSn()); + steelStructureCurrentData.setAlarmState(alarmState); + steelStructureCurrentDataList.add(new SteelStructureCurrentData(steelStructureCurrentData)); + + if (alarmState != DataStatusEnum.NORMAL.getId()) { + log.info("钢结构自动化监测系统数据异常,进行通知,通知传感器编号为:{},数据为:{}", sensorSn, steelStructureCurrentData); + //asyncSteelStructure.sendExceptionData(alarmState, sensor); + } + if (!Objects.equals(sensor.getStatus(), alarmState)) { + steelStructureSensorService.update(null, Wrappers.lambdaUpdate() + .eq(SteelStructureSensor::getSensorSn, sensor.getSensorSn()).set(SteelStructureSensor::getStatus, alarmState)); + List sensorList = steelStructureSensorService.list(Wrappers.lambdaQuery().eq(SteelStructureSensor::getMeasurePointNumber, sensor.getMeasurePointNumber())); + + List statusList = sensorList.stream().map(SteelStructureSensor::getStatus).collect(Collectors.toList()); + int updateState = 1; + if (statusList.contains(4)) { + updateState = 4; + } else if (statusList.contains(3)) { + updateState = 3; + } else if (statusList.contains(2)) { + updateState = 2; + } + steelStructureMeasurePointService.update(null, Wrappers.lambdaUpdate() + .eq(SteelStructureMeasurePoint::getMeasurePointNumber, sensor.getMeasurePointNumber()).set(SteelStructureMeasurePoint::getAlarmState, updateState)); + } + + if (sensor.getReceiveTime() == null || receiveTime.getTime() >= DateUtil.parse(sensor.getReceiveTime(), DatePattern.NORM_DATETIME_PATTERN).getTime()) { + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate() + .eq(SteelStructureSensor::getSensorSn, steelStructureCurrentData.getSensorSn()) + .set(SteelStructureSensor::getStatus, steelStructureCurrentData.getAlarmState()) + .set(SteelStructureSensor::getDataRate, steelStructureCurrentData.getDataRate()) + .set(SteelStructureSensor::getReceiveTime, steelStructureCurrentData.getReceiveTime()) + .set(SteelStructureSensor::getData, steelStructureCurrentData.getData()) + .set(SteelStructureSensor::getDataTotal, steelStructureCurrentData.getDataTotal()); + steelStructureSensorService.update(updateWrapper); + } + } + } + } + } + return steelStructureCurrentDataList; + } + + + @Override + public void saveBatchSteelStructureCurrentData(JSONArray jsonArray) { + // 判断是否传送数据 + if (CollUtil.isEmpty(jsonArray)) { + log.warn("数据为空!"); + throw new NullPointerException("数据不能为空"); + } + // 实时数据列表 + List steelStructureCurrentDataList = getBatchSaveListProcess(jsonArray); + log.info("实时数据列表内容为:{}", steelStructureCurrentDataList); + // 添加到数据库 + steelStructureCurrentDataService.saveBatch(steelStructureCurrentDataList); + } + + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureEngineeringServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureEngineeringServiceImpl.java new file mode 100644 index 000000000..a2213c86d --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureEngineeringServiceImpl.java @@ -0,0 +1,122 @@ +package com.zhgd.xmgl.modules.steelstructure.service.impl; + + +import cn.hutool.core.date.DateTime; +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.zhgd.jeecg.common.execption.OpenAlertException; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureEngineering; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureEngineeringToMonitorType; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureEngineeringMapper; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureMeasurePointMapper; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureMonitorTypeMapper; +import com.zhgd.xmgl.modules.steelstructure.service.*; +import com.zhgd.xmgl.util.MessageUtil; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +/** + * @Description: 钢结构自动化监测系统-工程 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class SteelStructureEngineeringServiceImpl extends ServiceImpl implements ISteelStructureEngineeringService { + @Autowired + private SteelStructureEngineeringMapper steelStructureEngineeringMapper; + + @Autowired + private SteelStructureMonitorTypeMapper steelStructureMonitorTypeMapper; + + @Autowired + private SteelStructureMeasurePointMapper steelStructureMeasurePointMapper; + + @Autowired + private ISteelStructureMeasurePointService steelStructureMeasurePointService; + + @Autowired + private SteelStructureSensorService steelStructureSensorService; + + @Autowired + private ISteelStructureCurrentDataService steelStructureCurrentDataService; + + @Autowired + private SteelStructureEngineeringToMonitorTypeService steelStructureEngineeringToMonitorTypeService; + + @Override + public void saveSteelStructureEngineering(SteelStructureEngineering steelStructureEngineering) { + checkParams(steelStructureEngineering); + setStatus(steelStructureEngineering); + steelStructureEngineering.setId(null); + steelStructureEngineeringMapper.insert(steelStructureEngineering); + if (StringUtils.isNotEmpty(steelStructureEngineering.getSteelStructureMonitorTypeIds())) { + List relaList = Arrays.stream(steelStructureEngineering.getSteelStructureMonitorTypeIds().split(",")) + .map(item -> new SteelStructureEngineeringToMonitorType(null, steelStructureEngineering.getId(), Long.valueOf(item), null, null, steelStructureEngineering.getProjectSn())).collect(Collectors.toList()); + steelStructureEngineeringToMonitorTypeService.saveBatch(relaList); + } + } + + @Override + public void deleteSteelStructureEngineering(Long id) { + steelStructureEngineeringToMonitorTypeService.deleteByExcavationId(id); + steelStructureEngineeringMapper.deleteById(id); + } + + @Override + public IPage selectSteelStructureEngineeringPage(Map map) { + int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString()); + int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString()); + Page page = new Page<>(pageNo, pageSize); + List list = steelStructureEngineeringMapper.selectSteelStructureEngineeringPage(page, map); + return page.setRecords(list); + } + + @Override + public List selectSteelStructureList(Map map) { + return steelStructureEngineeringMapper.selectSteelStructureList(map); + } + + @Override + public SteelStructureEngineering edit(SteelStructureEngineering steelStructureEngineering) { + SteelStructureEngineering steelStructureEngineeringEntity = getById(steelStructureEngineering.getId()); + if (steelStructureEngineeringEntity == null) { + throw new OpenAlertException(MessageUtil.get("notFindErr")); + } + checkParams(steelStructureEngineering); + setStatus(steelStructureEngineering); + updateById(steelStructureEngineering); + return steelStructureEngineering; + } + + private void checkParams(SteelStructureEngineering steelStructureEngineering) { + if (steelStructureEngineering.getStartDate().compareTo(steelStructureEngineering.getEndDate()) > 0) { + throw new OpenAlertException("开工时间不能大于完工时间"); + } + } + + private void setStatus(SteelStructureEngineering steelStructureEngineering) { + Date start = steelStructureEngineering.getStartDate(); + Date end = steelStructureEngineering.getEndDate(); + DateTime now = DateTime.now(); + if (now.compareTo(start) < 0) { + steelStructureEngineering.setStatus(0); + } else if (now.compareTo(start) >= 0 && now.compareTo(end) < 0) { + steelStructureEngineering.setStatus(1); + } else { + steelStructureEngineering.setStatus(2); + } + } + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureEngineeringToEngineeringToMonitorTypeServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureEngineeringToEngineeringToMonitorTypeServiceImpl.java new file mode 100644 index 000000000..515211b95 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureEngineeringToEngineeringToMonitorTypeServiceImpl.java @@ -0,0 +1,37 @@ +package com.zhgd.xmgl.modules.steelstructure.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureEngineeringToMonitorType; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureEngineeringToMonitorTypeMapper; +import com.zhgd.xmgl.modules.steelstructure.service.SteelStructureEngineeringToMonitorTypeService; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureMeasurePointService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.stream.Collectors; + + +@Service +@Transactional(rollbackFor = Exception.class) +public class SteelStructureEngineeringToEngineeringToMonitorTypeServiceImpl extends ServiceImpl implements SteelStructureEngineeringToMonitorTypeService { + @Autowired + SteelStructureEngineeringToMonitorTypeMapper steelStructureEngineeringToMonitorTypeMapper; + + @Autowired + ISteelStructureMeasurePointService steelStructureMeasurePointService; + + @Override + public void deleteByExcavationId(Long id) { + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery().eq(SteelStructureEngineeringToMonitorType::getSteelStructureEngineeringId, id); + List relaIdList = steelStructureEngineeringToMonitorTypeMapper.selectList(queryWrapper).stream().map(SteelStructureEngineeringToMonitorType::getId).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(relaIdList)) { + steelStructureMeasurePointService.deleteByRelaIdList(relaIdList); + } + steelStructureEngineeringToMonitorTypeMapper.delete(queryWrapper); + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureMeasurePointServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureMeasurePointServiceImpl.java new file mode 100644 index 000000000..9baa04bf9 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureMeasurePointServiceImpl.java @@ -0,0 +1,240 @@ +package com.zhgd.xmgl.modules.steelstructure.service.impl; + + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.jeecg.common.execption.OpenAlertException; +import com.zhgd.xmgl.modules.steelstructure.entity.*; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureEngineeringMapper; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureEngineeringToMonitorTypeMapper; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureMeasurePointMapper; +import com.zhgd.xmgl.modules.steelstructure.service.SteelStructureSensorService; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureCurrentDataService; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureMeasurePointService; +import com.zhgd.xmgl.util.MessageUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @Description: 钢结构自动化监测系统-测点 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Service +@Transactional(rollbackFor = Exception.class) +@Slf4j +public class SteelStructureMeasurePointServiceImpl extends ServiceImpl implements ISteelStructureMeasurePointService { + @Autowired + private SteelStructureMeasurePointMapper steelStructureMeasurePointMapper; + @Autowired + private SteelStructureEngineeringMapper steelStructureEngineeringMapper; + @Autowired + private SteelStructureEngineeringToMonitorTypeMapper steelStructureEngineeringToMonitorTypeMapper; + @Autowired + private SteelStructureSensorService steelStructureSensorService; + @Autowired + ISteelStructureCurrentDataService steelStructureCurrentDataService; + + @Override + public void saveMeasurePoint(SteelStructureMeasurePoint steelStructureMeasurePoint) { + String measurePointNumber = steelStructureMeasurePoint.getMeasurePointNumber(); + // 验证测点编号是否存在 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(SteelStructureMeasurePoint::getMeasurePointNumber, measurePointNumber); + int count = steelStructureMeasurePointMapper.selectCount(queryWrapper); + if (count > 0) { + log.warn("当前监测类型,测点编号 {} 已存在!", measurePointNumber); + throw new OpenAlertException(MessageUtil.get("pointNoExistErr")); + } + SteelStructureEngineeringToMonitorType toMonitorType = steelStructureEngineeringToMonitorTypeMapper.selectById(steelStructureMeasurePoint.getSteelStructureEngineeringToMonitorTypeId()); + SteelStructureEngineering engineering = steelStructureEngineeringMapper.selectById(toMonitorType.getSteelStructureEngineeringId()); + + // 验证是否存在 + List sensorList = steelStructureMeasurePoint.getSensorList(); + verifySensorData(sensorList); + steelStructureMeasurePoint.setAlarmState(1); + steelStructureMeasurePoint.setId(null); + steelStructureMeasurePoint.setProjectSn(engineering.getProjectSn()); + steelStructureMeasurePointMapper.insert(steelStructureMeasurePoint); + + for (SteelStructureSensor steelStructureSensor : sensorList) { + steelStructureSensor.setProjectSn(engineering.getProjectSn()); + steelStructureSensor.setMeasurePointNumber(measurePointNumber); + } + steelStructureSensorService.saveBatch(sensorList); + } + + /** + * 处理传感器数据 + * + * @param sensorList + */ + private void verifySensorData(List sensorList) { + Set sensorSnSet = sensorList.stream().map(SteelStructureSensor::getSensorSn).collect(Collectors.toSet()); + if (sensorList.size() != sensorSnSet.size()) { + throw new OpenAlertException(MessageUtil.get("sensorNoRepetitionErr")); + } + List sensors = steelStructureSensorService.list(Wrappers.lambdaQuery().in(SteelStructureSensor::getSensorSn, sensorSnSet)); + if (!sensors.isEmpty()) { + StringBuilder sb = new StringBuilder(); + for (SteelStructureSensor sensor : sensors) { + sb.append(sensor.getSensorSn()); + sb.append(" "); + } + sb.append(MessageUtil.get("sensorNoExistErr")); + throw new OpenAlertException(sb.toString()); + } + } + + @Override + public void editMeasurePoint(SteelStructureMeasurePoint steelStructureMeasurePoint) { + + log.info("用户调用了编辑测点接口"); + int count = steelStructureMeasurePointMapper.selectCount(Wrappers.lambdaQuery().eq(SteelStructureMeasurePoint::getId, steelStructureMeasurePoint.getId())); + if (count != 1) { + throw new OpenAlertException(MessageUtil.get("pointNoExistErr")); + } + steelStructureMeasurePointMapper.updateById(steelStructureMeasurePoint); + + List sensorList = steelStructureMeasurePoint.getSensorList(); + for (SteelStructureSensor sensor : sensorList) { + sensor.setMeasurePointNumber(steelStructureMeasurePoint.getMeasurePointNumber()); + } + List addSensorList = sensorList.stream().filter(sensor -> sensor.getId() == null).collect(Collectors.toList()); + + List updateSensorList = sensorList.stream().filter(sensor -> sensor.getId() != null).collect(Collectors.toList()); + + Set sensorSnSet = updateSensorList.stream().map(SteelStructureSensor::getSensorSn).collect(Collectors.toSet()); + sensorSnSet.addAll(addSensorList.stream().map(SteelStructureSensor::getSensorSn).collect(Collectors.toSet())); + List existSensorList = steelStructureSensorService.list(Wrappers.lambdaQuery(SteelStructureSensor.class).eq(SteelStructureSensor::getSensorSn, sensorSnSet)); + if (CollUtil.isNotEmpty(existSensorList)) { + Set existSensorSnList = existSensorList.stream().map(SteelStructureSensor::getSensorSn).collect(Collectors.toSet()); + String joinStr = CollUtil.join(existSensorSnList, ","); + log.warn("传感器编号{}已存在!", joinStr); + throw new RuntimeException("测点中编号" + joinStr + "已存在!"); + } + + + // 判断添加的传感器编号是否存在 + if (CollUtil.isNotEmpty(addSensorList)) { + + steelStructureSensorService.saveBatch(addSensorList); + } + + List existList = steelStructureSensorService.list(Wrappers.lambdaQuery().eq(SteelStructureSensor::getMeasurePointNumber, steelStructureMeasurePoint.getMeasurePointNumber())); + + List removeSnList = existList.stream().filter(e -> { + for (SteelStructureSensor sensor : addSensorList) { + if (e.getId().equals(sensor.getId())) { + return false; + } + } + for (SteelStructureSensor sensor : updateSensorList) { + if (e.getId().equals(sensor.getId())) { + return false; + } + } + return true; + }).map(SteelStructureSensor::getSensorSn).collect(Collectors.toList()); + + + if (CollUtil.isNotEmpty(updateSensorList)) { + + Map sensorMap = existList.stream().collect(Collectors.toMap(SteelStructureSensor::getId, Function.identity())); + Map updateMap = updateSensorList.stream().collect(Collectors.toMap(SteelStructureSensor::getId, Function.identity())); + for (Map.Entry sensorEntry : sensorMap.entrySet()) { + Long id = sensorEntry.getKey(); + SteelStructureSensor sensor = sensorEntry.getValue(); + SteelStructureSensor updateSensor = updateMap.get(id); + if (updateSensor == null) { + continue; + } + // 修改历史数据的传感器编号 + String sensorSn = sensor.getSensorSn(); + String updateSensorSn = updateSensor.getSensorSn(); + if (!sensorSn.equals(updateSensorSn)) { + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate() + .eq(SteelStructureCurrentData::getSensorSn, sensorSn).set(SteelStructureCurrentData::getSensorSn, updateSensorSn); + steelStructureCurrentDataService.update(updateWrapper); + } + + // 修改变化速率状态 + Float rateAlarmValue = sensor.getRateAlarmValue(); + Float updateRateAlarmValue = updateSensor.getRateAlarmValue(); + + // 修改累计值及状态 + Float alarmValue = sensor.getAlarmValue(); + Float updateAlarmValue = updateSensor.getAlarmValue(); + + // 修改基准值及状态 + Float fiducialValue = sensor.getFiducialValue(); + Float updateFiducialValue = updateSensor.getFiducialValue(); + + + if (!Objects.equals(rateAlarmValue, updateRateAlarmValue) || !Objects.equals(alarmValue, updateAlarmValue) || !Objects.equals(fiducialValue, updateFiducialValue)) { + steelStructureCurrentDataService.updateDataTotalAndAlarmState(updateSensorSn, updateFiducialValue, updateAlarmValue, updateRateAlarmValue); + } + } + steelStructureSensorService.updateBatchById(updateSensorList); + } + if (CollUtil.isNotEmpty(removeSnList)) { + steelStructureSensorService.remove(Wrappers.lambdaQuery().in(SteelStructureSensor::getSensorSn, removeSnList)); + steelStructureCurrentDataService.remove(Wrappers.lambdaQuery().in(SteelStructureCurrentData::getSensorSn, removeSnList)); + log.info("用户删除了编号为:{}的传感器", removeSnList); + } + + } + + @Override + public SteelStructureMeasurePoint selectSteelStructureMeasurePointById(Map map) { + SteelStructureMeasurePoint measurePoint = steelStructureMeasurePointMapper.selectById(MapUtils.getString(map, "id")); + if (measurePoint != null) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(SteelStructureSensor::getMeasurePointNumber, measurePoint.getMeasurePointNumber()); + List list = steelStructureSensorService.list(queryWrapper); + measurePoint.setSensorList(list); + } + return measurePoint; + } + + @Override + public List selectSteelStructureAllMeasurePointList(Map map) { + return steelStructureMeasurePointMapper.selectSteelStructureAllMeasurePointList(map); + } + + @Override + public SteelStructureMeasurePoint getDetailsByMeasurePointNumber(String measurePointNumber) { + return steelStructureMeasurePointMapper.getDetailsByMeasurePointNumber(measurePointNumber); + } + + @Override + public void deleteByRelaIdList(List relaIdList) { + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery() + .in(SteelStructureMeasurePoint::getSteelStructureEngineeringToMonitorTypeId, relaIdList); + + List mpNumberList = steelStructureMeasurePointMapper.selectList(queryWrapper).stream().map(SteelStructureMeasurePoint::getMeasurePointNumber).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(mpNumberList)) { + steelStructureSensorService.deleteByMpNumberList(mpNumberList); + } + + steelStructureMeasurePointMapper.delete(queryWrapper); + } + + @Override + public void deleteByMeasurePointNumber(String measurePointNumber) { + steelStructureSensorService.deleteByMpNumberList(Collections.singletonList(measurePointNumber)); + steelStructureMeasurePointMapper.delete(Wrappers.lambdaQuery().in(SteelStructureMeasurePoint::getMeasurePointNumber, measurePointNumber)); + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureMeasurePointToPlaneFigureServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureMeasurePointToPlaneFigureServiceImpl.java new file mode 100644 index 000000000..8b8b785a1 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureMeasurePointToPlaneFigureServiceImpl.java @@ -0,0 +1,82 @@ +package com.zhgd.xmgl.modules.steelstructure.service.impl; + +import cn.hutool.core.map.MapUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMeasurePointToPlaneFigure; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensor; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureCurrentDataMapper; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureMeasurePointToPlaneFigureMapper; +import com.zhgd.xmgl.modules.steelstructure.service.SteelStructureSensorService; +import com.zhgd.xmgl.modules.steelstructure.service.SteelStructureMeasurePointToPlaneFigureService; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @Description: 钢结构自动化监测系统-测点和平面图配置中间表 + * @author: pds + * @date: 2021-10-09 + * @version: V1.0 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class SteelStructureMeasurePointToPlaneFigureServiceImpl extends ServiceImpl implements SteelStructureMeasurePointToPlaneFigureService { + @Autowired + private SteelStructureMeasurePointToPlaneFigureMapper steelStructureMeasurePointToPlaneFigureMapper; + @Autowired + private SteelStructureCurrentDataMapper steelStructureCurrentDataMapper; + @Autowired + private SteelStructureSensorService steelStructureSensorService; + + @Override + public List selectPlaneFigureCoordinateList(Map map) { + List list = steelStructureMeasurePointToPlaneFigureMapper.selectPlaneFigureCoordinateList(MapUtil.getLong(map, "steelStructurePlaneFigureId")); + if (list.size() > 0) { + List measurePointNumberList = list.stream().map(m -> m.get("measurePointNumber").toString()).collect(Collectors.toList()); + List sensors = steelStructureSensorService.getListByMeasurePointNumberList(measurePointNumberList); + Map> sensorMap = sensors.stream().collect(Collectors.groupingBy(SteelStructureSensor::getMeasurePointNumber)); + for (EntityMap data : list) { + data.put("sensorList", sensorMap.get(MapUtils.getString(data, "measurePointNumber"))); + } + } + return list; + } + + @Override + public void editPlaneFigureCoordinate(SteelStructureMeasurePointToPlaneFigure steelStructureMeasurePointToPlaneFigure) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(SteelStructureMeasurePointToPlaneFigure::getSteelStructurePlaneFigureId, steelStructureMeasurePointToPlaneFigure.getSteelStructurePlaneFigureId()) + .eq(SteelStructureMeasurePointToPlaneFigure::getSteelStructureMeasurePointId, steelStructureMeasurePointToPlaneFigure.getSteelStructureMeasurePointId()); + SteelStructureMeasurePointToPlaneFigure oldPlaneFigureCoordinate = steelStructureMeasurePointToPlaneFigureMapper.selectOne(queryWrapper); + if (oldPlaneFigureCoordinate != null) { + steelStructureMeasurePointToPlaneFigure.setId(oldPlaneFigureCoordinate.getId()); + steelStructureMeasurePointToPlaneFigureMapper.updateById(steelStructureMeasurePointToPlaneFigure); + } else { + steelStructureMeasurePointToPlaneFigureMapper.insert(steelStructureMeasurePointToPlaneFigure); + } + } + + @Override + public void deleteSteelStructurePlaneFigureCoordinate(Map map) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(SteelStructureMeasurePointToPlaneFigure::getSteelStructurePlaneFigureId, MapUtils.getString(map, "steelStructurePlaneFigureId")) + .eq(SteelStructureMeasurePointToPlaneFigure::getSteelStructureMeasurePointId, MapUtils.getString(map, "pointId")); + steelStructureMeasurePointToPlaneFigureMapper.delete(queryWrapper); + } + + @Override + public void updateFigureCoordinate(List list) { + if (list != null && list.size() > 0) { + for (SteelStructureMeasurePointToPlaneFigure figureCoordinate : list) { + steelStructureMeasurePointToPlaneFigureMapper.updateById(figureCoordinate); + } + } + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureMonitorTypeServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureMonitorTypeServiceImpl.java new file mode 100644 index 000000000..4f893c603 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureMonitorTypeServiceImpl.java @@ -0,0 +1,72 @@ +package com.zhgd.xmgl.modules.steelstructure.service.impl; + + +import cn.hutool.core.map.MapUtil; +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.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMonitorType; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureMonitorTypeMapper; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureMonitorTypeService; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Description: 钢结构自动化监测系统-监测类型 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class SteelStructureMonitorTypeServiceImpl extends ServiceImpl implements ISteelStructureMonitorTypeService { + @Autowired + private SteelStructureMonitorTypeMapper steelStructureMonitorTypeMapper; + + @Override + public IPage selectSteelStructureMonitorPage(Map map) { + int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString()); + int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString()); + Page page = new Page<>(pageNo, pageSize); + List list = steelStructureMonitorTypeMapper.selectSteelStructureMonitorPage(page, MapUtil.getLong(map, "steelStructureEngineeringId")); + return page.setRecords(list); + } + + @Override + public List selectSteelStructureMonitorList(Map map) { + return steelStructureMonitorTypeMapper.selectSteelStructureMonitorList(map); + } + + @Override + public Map selectMonitorTypeCount(Map map) { + Map data = new HashMap<>(); + List> list = steelStructureMonitorTypeMapper.selectSteelStructureMonitorTypeCountList(map); + int totalPointNum = 0; + if (list != null && list.size() > 0) { + for (Map typeData : list) { + totalPointNum = totalPointNum + MapUtils.getInteger(typeData, "measurePointNum"); + } + } + data.put("monitorTypeNum", list.size()); + data.put("totalPointNum", totalPointNum); + data.put("list", list); + return data; + } + + @Override + public List selectMonitorTypeList(Map map) { + return steelStructureMonitorTypeMapper.selectMonitorTypeList(map); + } + + @Override + public List> selectMonitorTypeAlarmCountList(Map map) { + return steelStructureMonitorTypeMapper.selectMonitorTypeAlarmCountList(map); + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructurePlaneFigureServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructurePlaneFigureServiceImpl.java new file mode 100644 index 000000000..8a2a8f29e --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructurePlaneFigureServiceImpl.java @@ -0,0 +1,97 @@ +package com.zhgd.xmgl.modules.steelstructure.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureMeasurePointToPlaneFigure; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructurePlaneFigure; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureMeasurePointToPlaneFigureMapper; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructurePlaneFigureMapper; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructurePlaneFigureService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Description: 钢结构自动化监测系统-平面图配置 + * @author: pds + * @date: 2021-10-09 + * @version: V1.0 + */ +@Service +public class SteelStructurePlaneFigureServiceImpl extends ServiceImpl implements ISteelStructurePlaneFigureService { + @Autowired + private SteelStructurePlaneFigureMapper steelStructurePlaneFigureMapper; + @Autowired + private SteelStructureMeasurePointToPlaneFigureMapper steelStructureMeasurePointToPlaneFigureMapper; + + @Override + public void deleteSteelStructurePlaneFigure(String id) { + steelStructurePlaneFigureMapper.deleteById(id); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(SteelStructureMeasurePointToPlaneFigure::getSteelStructurePlaneFigureId, id); + steelStructureMeasurePointToPlaneFigureMapper.delete(queryWrapper); + } + + @Override + public void savesteelStructurePlaneFigure(SteelStructurePlaneFigure steelStructurePlaneFigure) { + steelStructurePlaneFigure.setId(null); + steelStructurePlaneFigureMapper.insert(steelStructurePlaneFigure); + if (StringUtils.isNotEmpty(steelStructurePlaneFigure.getMeasurePointIds())) { + for (String pointId : steelStructurePlaneFigure.getMeasurePointIds().split(",")) { + SteelStructureMeasurePointToPlaneFigure planeFigureCoordinate = new SteelStructureMeasurePointToPlaneFigure(); + planeFigureCoordinate.setSteelStructureMeasurePointId(Long.valueOf(pointId)); + planeFigureCoordinate.setSteelStructurePlaneFigureId(steelStructurePlaneFigure.getId()); + planeFigureCoordinate.setMapY("0"); + planeFigureCoordinate.setMapX("0"); + steelStructureMeasurePointToPlaneFigureMapper.insert(planeFigureCoordinate); + } + } + } + + @Override + public void editsteelStructurePlaneFigure(SteelStructurePlaneFigure steelStructurePlaneFigure) { + steelStructurePlaneFigureMapper.updateById(steelStructurePlaneFigure); + if (StringUtils.isNotEmpty(steelStructurePlaneFigure.getMeasurePointIds())) { + QueryWrapper planeFigureCoordinateQueryWrapper = new QueryWrapper<>(); + planeFigureCoordinateQueryWrapper.lambda().eq(SteelStructureMeasurePointToPlaneFigure::getSteelStructurePlaneFigureId, steelStructurePlaneFigure.getId()); + List list = steelStructureMeasurePointToPlaneFigureMapper.selectList(planeFigureCoordinateQueryWrapper); + Map data = new HashMap<>(); + if (CollUtil.isNotEmpty(list)) { + for (SteelStructureMeasurePointToPlaneFigure planeFigureCoordinate : list) { + data.put(planeFigureCoordinate.getSteelStructureMeasurePointId().toString(), planeFigureCoordinate.getId()); + } + } + + for (String pointId : steelStructurePlaneFigure.getMeasurePointIds().split(",")) { + if (data.containsKey(pointId)) { + //从历史数据去除还存在的测点,找出已取消的测点 + data.remove(pointId); + } else { + //保存新增的测点 + SteelStructureMeasurePointToPlaneFigure planeFigureCoordinate = new SteelStructureMeasurePointToPlaneFigure(); + planeFigureCoordinate.setSteelStructureMeasurePointId(Long.valueOf(pointId)); + planeFigureCoordinate.setSteelStructurePlaneFigureId(steelStructurePlaneFigure.getId()); + planeFigureCoordinate.setMapY("0"); + planeFigureCoordinate.setMapX("0"); + steelStructureMeasurePointToPlaneFigureMapper.insert(planeFigureCoordinate); + } + } + //删除已取消的测点 + if (data.size() > 0) { + for (String key : data.keySet()) { + String id = String.valueOf(data.get(key)); + steelStructureMeasurePointToPlaneFigureMapper.deleteById(id); + } + } + + } else { + steelStructureMeasurePointToPlaneFigureMapper.delete(Wrappers.lambdaQuery().eq(SteelStructureMeasurePointToPlaneFigure::getSteelStructurePlaneFigureId, steelStructurePlaneFigure.getId())); + } + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureSensorServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureSensorServiceImpl.java new file mode 100644 index 000000000..377044a48 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureSensorServiceImpl.java @@ -0,0 +1,129 @@ +package com.zhgd.xmgl.modules.steelstructure.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.jeecg.common.execption.OpenAlertException; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureCurrentData; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensor; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureSensorMapper; +import com.zhgd.xmgl.modules.steelstructure.service.SteelStructureSensorService; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureCurrentDataService; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureSensorTypeService; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @author 邱平毅 + * @ClassName SteelStructureSensorServiceImpl + * @date 2022/8/18 9:42 + * @Version 1.0 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class SteelStructureSensorServiceImpl extends ServiceImpl implements SteelStructureSensorService { + + @Autowired + SteelStructureSensorMapper steelStructureSensorMapper; + + @Autowired + ISteelStructureCurrentDataService steelStructureCurrentDataService; + + + @Autowired + ISteelStructureSensorTypeService steelStructureSensorTypeService; + + @Autowired + SteelStructureSensorServiceImpl steelStructureSensorService; + + @Override + public void deleteByMpNumberList(List mpNumberList) { + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery().in(SteelStructureSensor::getMeasurePointNumber, mpNumberList); + + List sensors = steelStructureSensorMapper.selectList(queryWrapper); + + List sensorSnList = sensors.stream().map(SteelStructureSensor::getSensorSn).collect(Collectors.toList()); + if (!sensorSnList.isEmpty()) { + steelStructureCurrentDataService.remove(Wrappers.lambdaQuery().in(SteelStructureCurrentData::getSensorSn, sensorSnList)); + } + + steelStructureSensorMapper.delete(queryWrapper); + } + + @Override + public List getListBySensorAndTypeMap(Map sensorAndTypeMap) { + // 存在的传感器 + List existList = steelStructureSensorMapper.getListBySensorSnSet(sensorAndTypeMap.keySet()); + Set existSensorSnList = existList.stream().map(SteelStructureSensor::getSensorSn).collect(Collectors.toSet()); + // 是否存在不存在的传感器 + //if (sensorAndTypeMap.size() != existList.size()) { + + Map sensorSnThisMap = existList.stream().collect(Collectors.toMap(SteelStructureSensor::getSensorSn, Function.identity())); + + + Set noExistSensorSn = sensorAndTypeMap.keySet().stream().filter(sensorSn -> !existSensorSnList.contains(sensorSn)).collect(Collectors.toSet()); + + if (CollectionUtils.isNotEmpty(noExistSensorSn)) { + throw new OpenAlertException("传感器【" + StringUtils.join(noExistSensorSn, ",") + "】不存在"); + } + + for (SteelStructureSensor des : existList) { + String code = sensorAndTypeMap.get(des.getSensorSn()); + if (StringUtils.isNotBlank(code) && !code.equals(des.getSensorTypeCode())) { + throw new OpenAlertException("传感器【" + des.getSensorName() + "】的类型和配置的不一致"); + } + } + + + //// 获取对应编码的传感器类型 + //LambdaQueryWrapper typeWrapper = Wrappers + // .lambdaQuery().in(SteelStructureSensorType::getSensorTypeCode, sensorAndTypeMap.values()); + //// 传感器编号传感器类型 + //Map codeIdMap = steelStructureSensorTypeService + // .list(typeWrapper).stream().collect(Collectors.toMap(SteelStructureSensorType::getSensorTypeCode, SteelStructureSensorType::getId)); + // + //List createSensorList = new LinkedList<>(); + //for (String sensorSn : noExistSensorSn) { + // int lastIndexOf = sensorSn.lastIndexOf("("); + // + // SteelStructureSensor steelStructureSensor; + // if (lastIndexOf != -1 && existSensorSnList.contains(sensorSn.substring(0, lastIndexOf))) { + // steelStructureSensor = new SteelStructureSensor(sensorSn, codeIdMap.get(sensorAndTypeMap.get(sensorSn)), 1, sensorSnThisMap.get(sensorSn.substring(0, lastIndexOf))); + // } else { + // steelStructureSensor = new SteelStructureSensor(sensorSn, codeIdMap.get(sensorAndTypeMap.get(sensorSn)), 1); + // } + // createSensorList.add(steelStructureSensor); + //} + //steelStructureSensorService.saveBatch(createSensorList); + //existList.addAll(createSensorList); + //} + return existList; + } + + @Override + public SteelStructureSensor getUnitAndAlarmValueBySnAndPointNumber(String sensorSn, String measurePointNumber) { + return steelStructureSensorMapper.getUnitAndAlarmValueBySnAndPointNumber(sensorSn, measurePointNumber); + } + + + @Override + public List getListByMeasurePointNumberList(List measurePointNumberList) { + return steelStructureSensorMapper.getListByMeasurePointNumberList(measurePointNumberList); + } + + + @Override + public List getListBySensorSnList(List sensorSnList) { + return steelStructureSensorMapper.getListBySensorSnList(sensorSnList); + } + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureSensorTypeServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureSensorTypeServiceImpl.java new file mode 100644 index 000000000..1a670cad0 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/steelstructure/service/impl/SteelStructureSensorTypeServiceImpl.java @@ -0,0 +1,21 @@ +package com.zhgd.xmgl.modules.steelstructure.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.xmgl.modules.steelstructure.entity.SteelStructureSensorType; +import com.zhgd.xmgl.modules.steelstructure.mapper.SteelStructureSensorTypeMapper; +import com.zhgd.xmgl.modules.steelstructure.service.ISteelStructureSensorTypeService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * @Description: 钢结构自动化监测系统-传感器类型 + * @author: pds + * @date: 2021-10-08 + * @version: V1.0 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class SteelStructureSensorTypeServiceImpl extends ServiceImpl implements ISteelStructureSensorTypeService { + +}