4203 changed files with 1288433 additions and 0 deletions
@ -0,0 +1,6 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="ProjectRootManager"> |
|||
<output url="file://$PROJECT_DIR$/out" /> |
|||
</component> |
|||
</project> |
@ -0,0 +1,59 @@ |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>cc.admin</groupId> |
|||
<artifactId>cc-admin-api</artifactId> |
|||
<version>1.0.0</version> |
|||
</parent> |
|||
<artifactId>dust</artifactId> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>cc.admin</groupId> |
|||
<artifactId>base-common</artifactId> |
|||
<version>1.0.0</version> |
|||
</dependency> |
|||
<!-- OpenCSV for CSV parsing --> |
|||
<dependency> |
|||
<groupId>com.opencsv</groupId> |
|||
<artifactId>opencsv</artifactId> |
|||
<version>5.5.2</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-databind</artifactId> |
|||
<version>2.13.3</version> |
|||
</dependency> |
|||
<!-- Jackson Core --> |
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-core</artifactId> |
|||
<version>2.13.3</version> |
|||
</dependency> |
|||
<!-- Jackson Annotations --> |
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-annotations</artifactId> |
|||
<version>2.13.3</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>cc.admin</groupId> |
|||
<artifactId>influxdb</artifactId> |
|||
<version>1.0.0</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>cc.admin</groupId> |
|||
<artifactId>influxdb</artifactId> |
|||
<version>1.0.0</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.alibaba</groupId> |
|||
<artifactId>easyexcel</artifactId> |
|||
<version>4.0.0</version> |
|||
</dependency> |
|||
</dependencies> |
|||
</project> |
@ -0,0 +1,174 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.sys.base.controller.BaseController; |
|||
import cc.admin.common.sys.query.QueryGenerator; |
|||
import cc.admin.modules.dust.entity.DustAlarm; |
|||
import cc.admin.modules.dust.service.IDustAlarmService; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.Arrays; |
|||
|
|||
/** |
|||
* @Description: 警报记录表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "警报记录表") |
|||
@RestController |
|||
@RequestMapping("/dust/alarm") |
|||
public class DustAlarmController extends BaseController<DustAlarm, IDustAlarmService> { |
|||
@Autowired |
|||
private IDustAlarmService dustAlarmService; |
|||
|
|||
/** |
|||
* 分页列表查询 |
|||
* |
|||
* @param key |
|||
* @param pageNo |
|||
* @param pageSize |
|||
* @param req |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "警报记录表-分页列表查询") |
|||
@ApiOperation(value = "警报记录表-分页列表查询", notes = "警报记录表-分页列表查询") |
|||
@GetMapping(value = "/list") |
|||
public Result<?> queryPageList( |
|||
@RequestParam(name = "systemId", required = false) String systemId, |
|||
@RequestParam(name = "startTime", required = false) String startTime, |
|||
@RequestParam(name = "endTime", required = false) String endTime, |
|||
@RequestParam(name = "alarmContent", required = false) String alarmContent, |
|||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|||
HttpServletRequest req) { |
|||
QueryWrapper<DustAlarm> queryWrapper = new QueryWrapper<>(); |
|||
if (null != alarmContent) { |
|||
queryWrapper.like("alarm_content", alarmContent); // type 保持精确匹配
|
|||
} |
|||
if (StrUtil.isNotEmpty(systemId)) { |
|||
queryWrapper.eq("system_id", systemId); // systemId 保持精确匹配
|
|||
} |
|||
if (startTime != null) { |
|||
queryWrapper.ge("create_time", startTime); |
|||
} |
|||
if (endTime != null) { |
|||
queryWrapper.le("create_time", endTime); |
|||
} |
|||
queryWrapper.orderByAsc("sort_order") |
|||
.orderByDesc("create_time"); |
|||
Page<DustAlarm> page = new Page<DustAlarm>(pageNo, pageSize); |
|||
IPage<DustAlarm> pageList = dustAlarmService.page(page, queryWrapper); |
|||
return Result.ok(pageList); |
|||
} |
|||
|
|||
/** |
|||
* 添加 |
|||
* |
|||
* @param dustAlarm |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "警报记录表-添加") |
|||
@ApiOperation(value = "警报记录表-添加", notes = "警报记录表-添加") |
|||
@PostMapping(value = "/add") |
|||
public Result<?> add(@RequestBody DustAlarm dustAlarm) { |
|||
dustAlarmService.save(dustAlarm); |
|||
return Result.ok("添加成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dustAlarm |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "警报记录表-编辑") |
|||
@ApiOperation(value = "警报记录表-编辑", notes = "警报记录表-编辑") |
|||
@PutMapping(value = "/edit") |
|||
public Result<?> edit(@RequestBody DustAlarm dustAlarm) { |
|||
dustAlarmService.updateById(dustAlarm); |
|||
return Result.ok("编辑成功!"); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 通过id删除 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "警报记录表-通过id删除") |
|||
@ApiOperation(value = "警报记录表-通过id删除", notes = "警报记录表-通过id删除") |
|||
@DeleteMapping(value = "/delete") |
|||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|||
dustAlarmService.removeById(id); |
|||
return Result.ok("删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "警报记录表-批量删除") |
|||
@ApiOperation(value = "警报记录表-批量删除", notes = "警报记录表-批量删除") |
|||
@DeleteMapping(value = "/deleteBatch") |
|||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|||
this.dustAlarmService.removeByIds(Arrays.asList(ids.split(","))); |
|||
return Result.ok("批量删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id查询 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "警报记录表-通过id查询") |
|||
@ApiOperation(value = "警报记录表-通过id查询", notes = "警报记录表-通过id查询") |
|||
@GetMapping(value = "/queryById") |
|||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|||
DustAlarm dustAlarm = dustAlarmService.getById(id); |
|||
return Result.ok(dustAlarm); |
|||
} |
|||
|
|||
/** |
|||
* 导出excel |
|||
* |
|||
* @param request |
|||
* @param dustAlarm |
|||
*/ |
|||
@RequestMapping(value = "/exportXls") |
|||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, DustAlarm dustAlarm) { |
|||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
|||
return super.exportXls(request, dustAlarm, DustAlarm.class, "警报记录表"); |
|||
} |
|||
|
|||
/** |
|||
* 通过excel导入数据 |
|||
* |
|||
* @param request |
|||
* @param response |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
|||
return super.importExcel(request, response, DustAlarm.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,251 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.util.RedisUtil; |
|||
import cc.admin.modules.dust.entity.*; |
|||
import cc.admin.modules.dust.po.DustQuery; |
|||
import cc.admin.modules.dust.service.*; |
|||
import cc.admin.modules.dust.utils.RecommendPlanUtils; |
|||
import cc.admin.modules.dust.vo.CombinationResult; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.collections.CollectionUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import oshi.util.StringUtil; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.io.IOException; |
|||
import java.util.*; |
|||
import java.util.concurrent.CompletableFuture; |
|||
import java.util.concurrent.CopyOnWriteArrayList; |
|||
import java.util.stream.Collectors; |
|||
import java.util.stream.IntStream; |
|||
|
|||
|
|||
@Slf4j |
|||
@Api(tags = "计算表") |
|||
@RestController |
|||
@RequestMapping("/dust/config") |
|||
public class DustController { |
|||
@Autowired |
|||
private IPipeDiameterThicknessService iPipeDiameterThicknessService; |
|||
@Autowired |
|||
private IPipeService pipeService; |
|||
@Autowired |
|||
private RedisUtil redisUtil; |
|||
@Resource |
|||
private IRecommendPlanService iRecommendPlanService; |
|||
|
|||
/** |
|||
* 初步计算 |
|||
* |
|||
* @param airVolume 风量(单位根据实际情况设定) |
|||
* @param airSpeed 风速(单位根据实际情况设定) |
|||
* @return 计算得到的 管径值 |
|||
* @throws IllegalArgumentException 如果 airVolume 或 airSpeed 非正 |
|||
*/ |
|||
public static double calculate(double airVolume, double airSpeed) { |
|||
// 检查输入是否为有效的正数
|
|||
if (airVolume <= 0 || airSpeed <= 0) { |
|||
throw new IllegalArgumentException("风量和风速必须是正数。"); |
|||
} |
|||
|
|||
// 计算 d 的值
|
|||
return 2000 * Math.sqrt(airVolume / airSpeed / 3600 / Math.PI); |
|||
} |
|||
|
|||
/** |
|||
* 初步计算 |
|||
* |
|||
* @param airVolume 风量(单位根据实际情况设定) |
|||
* @param diameter 管道内径(单位根据实际情况设定) |
|||
* @return 计算得到的 风速 |
|||
* @throws IllegalArgumentException 如果 airVolume 或 airSpeed 非正 |
|||
*/ |
|||
public static double calculateAirSpeed(double airVolume, double diameter) { |
|||
|
|||
double radiusMeters = diameter / 2000.0; // 2000 = 2 * 1000 (to get radius in meters)
|
|||
|
|||
double area = Math.PI * Math.pow(radiusMeters, 2); |
|||
|
|||
return airVolume / (area * 3600.0); |
|||
} |
|||
|
|||
|
|||
@AutoLog(value = "初步计算") |
|||
@ApiOperation(value = "初步计算", notes = "初步计算") |
|||
@GetMapping(value = "/designPipe") |
|||
public Result<?> designPipe(@RequestParam(name = "designPlanId", required = true) String designPlanId, |
|||
@RequestParam(name = "pipeDiameterId", required = true) String pipeDiameterId) { |
|||
// 创建 QueryWrapper 以获取所有匹配的 DesignPlanPipeConfig
|
|||
QueryWrapper<Pipe> configQueryWrapper = new QueryWrapper<>(); |
|||
configQueryWrapper.eq("design_plan_id", designPlanId); |
|||
|
|||
List<Pipe> configList = pipeService.list(configQueryWrapper); |
|||
|
|||
if (CollectionUtils.isEmpty(configList)) { |
|||
return Result.ok(null); |
|||
} |
|||
List<Pipe> design = design(designPlanId, pipeDiameterId, configList); |
|||
|
|||
return Result.ok(design); |
|||
} |
|||
|
|||
private List<Pipe> design(String designPlanId, String pipeDiameterId, List<Pipe> configList) { |
|||
Map<String, List<Pipe>> pipesGroupedByParentId = configList.stream() |
|||
.filter(a -> StringUtils.isNotBlank(a.getParentId()) && a.getIsLeaf().equals(1)).collect(Collectors.groupingBy(Pipe::getParentId)); |
|||
List<Pipe> pipesToUpdate = new ArrayList<>(); |
|||
|
|||
PipeDiameterThickness byId = iPipeDiameterThicknessService.getById(pipeDiameterId); |
|||
List<Double> collect = Arrays.stream(byId.getDiameter().split(",")) |
|||
.map(str -> str.replaceAll("[\\u00A0\\s]+", "").trim()) // 去除所有空白字符,包括非断行空格
|
|||
.filter(str -> !str.isEmpty()) // 过滤空字符串
|
|||
.map(Double::parseDouble) |
|||
.collect(Collectors.toList()); |
|||
|
|||
|
|||
for (Map.Entry<String, List<Pipe>> entry : pipesGroupedByParentId.entrySet()) { |
|||
List<Pipe> parentPipes = entry.getValue(); |
|||
parentPipes.sort(Comparator.comparingInt(Pipe::getSortOrder)); |
|||
// 计算累积值
|
|||
double cumulativeSum = 0.0; |
|||
|
|||
for (Pipe pipe : parentPipes) { |
|||
double valveOpening = pipe.getValveOpening(); |
|||
double v = valveOpening / 100.0; |
|||
double adjustedFlow = pipe.getFlow() * v; |
|||
cumulativeSum += adjustedFlow; |
|||
double calculate = calculate(cumulativeSum, 19d); |
|||
double ceil = collect.stream() |
|||
.filter(num -> num >= calculate) // 过滤出不小于 calculate 的数
|
|||
.min(Double::compareTo) |
|||
.orElseGet(() -> collect.stream() |
|||
.max(Double::compareTo) |
|||
.orElse(Double.NaN)); |
|||
// 更新当前 Pipe 对象
|
|||
if (null != pipe.getDiameter()) { |
|||
pipe.setComputeDiameter(pipe.getDiameter()); |
|||
} |
|||
pipe.setDiameter(ceil); |
|||
pipe.setPipeDiameter(calculate); |
|||
pipe.setPipeFlow(cumulativeSum); |
|||
pipe.setValveOpening(valveOpening); |
|||
pipesToUpdate.add(pipe); |
|||
|
|||
|
|||
} |
|||
} |
|||
redisUtil.set(designPlanId, pipesToUpdate); |
|||
return pipesToUpdate; |
|||
} |
|||
|
|||
@AutoLog(value = "平衡计算") |
|||
@ApiOperation(value = "平衡计算", notes = "平衡计算") |
|||
@PostMapping(value = "/balance") |
|||
public Result<?> balance(@RequestBody DustQuery query) { |
|||
Object object = redisUtil.get(query.getDesignPlanId()); |
|||
|
|||
if (ObjectUtils.isEmpty(object)) { |
|||
return Result.error("设计方案管道配置不能为空"); |
|||
} |
|||
|
|||
Map<String, Double> pipeIdToValveOpeningMap = query.getList().stream() |
|||
.collect(Collectors.toMap( |
|||
Pipe::getId, |
|||
Pipe::getValveOpening, |
|||
(existing, replacement) -> existing)); |
|||
|
|||
Set<String> pipeIdsSet = pipeIdToValveOpeningMap.keySet(); |
|||
List<Pipe> pipes = convertToList(object); |
|||
|
|||
List<Pipe> filteredPipes = pipes.stream() |
|||
.filter(pipe -> pipeIdsSet.contains(pipe.getId())) // 假设 Pipe 类有 getId() 方法
|
|||
.collect(Collectors.toList()); |
|||
|
|||
Map<String, List<Pipe>> pipesGroupedByParentId = filteredPipes.stream() |
|||
.filter(a -> StringUtils.isNotBlank(a.getParentId()) && a.getIsLeaf().equals(1)).collect(Collectors.groupingBy(Pipe::getParentId)); |
|||
|
|||
|
|||
for (Map.Entry<String, List<Pipe>> entry : pipesGroupedByParentId.entrySet()) { |
|||
List<Pipe> parentPipes = entry.getValue(); |
|||
parentPipes.sort(Comparator.comparingInt(Pipe::getSortOrder)); |
|||
|
|||
// 计算累积值
|
|||
double cumulativeSum = 0.0; |
|||
double diameter; |
|||
for (Pipe pipe : parentPipes) { |
|||
double valveOpening = pipeIdToValveOpeningMap.getOrDefault(pipe.getId(), 100.0); |
|||
double v = valveOpening / 100.0; |
|||
double adjustedFlow = pipe.getFlow() * v; |
|||
cumulativeSum += adjustedFlow; |
|||
diameter = pipe.getDiameter(); |
|||
if (null != pipe.getComputeDiameter()) { |
|||
diameter = pipe.getComputeDiameter(); |
|||
} |
|||
double windSpeed = calculateAirSpeed(cumulativeSum, diameter); |
|||
log.info("风量{},开度: {},管道内径{}", cumulativeSum, v, diameter); |
|||
pipe.setWindSpeed(windSpeed); |
|||
pipe.setPipeFlow(cumulativeSum); |
|||
pipe.setValveOpening(valveOpening); |
|||
} |
|||
} |
|||
|
|||
return Result.ok(pipes); |
|||
} |
|||
|
|||
public List<Pipe> convertToList(Object object) { |
|||
if (!(object instanceof Collection<?>)) { |
|||
throw new IllegalArgumentException("Object is not a Collection"); |
|||
} |
|||
|
|||
Collection<?> collection = (Collection<?>) object; |
|||
List<Pipe> list = new ArrayList<>(); |
|||
|
|||
int index = 0; |
|||
for (Object item : collection) { |
|||
if (item == null) { |
|||
throw new NullPointerException("Collection contains null element at index " + index); |
|||
} |
|||
if (item instanceof Pipe) { |
|||
list.add((Pipe) item); |
|||
} else { |
|||
String foundType = item.getClass().getName(); |
|||
throw new ClassCastException("Element at index " + index + " is not a DesignPlanPipeConfig. Found: " + foundType); |
|||
} |
|||
index++; |
|||
} |
|||
return list; |
|||
} |
|||
|
|||
@AutoLog(value = "推荐方案") |
|||
@ApiOperation(value = "推荐方案", notes = "推荐方案") |
|||
@GetMapping(value = "/recommend") |
|||
public Result<?> recommend(@RequestParam(name = "designPlanId", required = true) String designPlanId, |
|||
@RequestParam(name = "parentPipeId", required = true) String parentPipeId, |
|||
@RequestParam(name = "pipeDiameterId", required = true) String pipeDiameterId, |
|||
@RequestParam(name = "minSpeed", required = true) Double minSpeed, |
|||
@RequestParam(name = "minRate", required = true) Double minRate) throws IOException { |
|||
QueryWrapper<Pipe> configQueryWrapper = new QueryWrapper<>(); |
|||
configQueryWrapper.eq("design_plan_id", designPlanId); |
|||
configQueryWrapper.eq("parent_id", parentPipeId); |
|||
List<Pipe> configList = pipeService.list(configQueryWrapper); |
|||
if (CollectionUtils.isEmpty(configList)){ |
|||
return Result.error("管道为空"); |
|||
} |
|||
List<Pipe> data = design(designPlanId, pipeDiameterId, configList); |
|||
data.sort(Comparator.comparingInt(Pipe::getSortOrder)); |
|||
|
|||
Set<Integer> pipeIndexes = IntStream.range(0, data.size()) |
|||
.filter(i -> data.get(i).getValveOpening() == 100) // 满足条件的 Pipe 的下标
|
|||
.boxed() // 转换为 Integer 类型
|
|||
.collect(Collectors.toSet()); |
|||
List<RecommendPlan> recommendPlanList = RecommendPlanUtils.generateCombinations(data, minSpeed, minRate, pipeIndexes); |
|||
return Result.ok(recommendPlanList); |
|||
} |
|||
} |
@ -0,0 +1,311 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.sys.base.controller.BaseController; |
|||
import cc.admin.common.sys.query.QueryGenerator; |
|||
import cc.admin.modules.dust.entity.DustDataTag; |
|||
import cc.admin.modules.dust.entity.DustSystem; |
|||
import cc.admin.modules.dust.service.IDustDataTagService; |
|||
import cc.admin.modules.dust.service.IDustSystemService; |
|||
import cc.admin.modules.dust.vo.DataTagExcel; |
|||
import cc.admin.modules.dust.vo.DataTagPair; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.excel.EasyExcelFactory; |
|||
import com.alibaba.excel.context.AnalysisContext; |
|||
import com.alibaba.excel.event.AnalysisEventListener; |
|||
import com.alibaba.excel.read.listener.ReadListener; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.*; |
|||
import java.util.function.Function; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Description: 数据点位表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "数据点位表") |
|||
@RestController |
|||
@RequestMapping("/dust/dataTag") |
|||
public class DustDataTagController extends BaseController<DustDataTag, IDustDataTagService> { |
|||
@Autowired |
|||
private IDustDataTagService dustDataTagService; |
|||
@Autowired |
|||
private IDustSystemService iDustSystemService; |
|||
|
|||
/** |
|||
* 分页列表查询 |
|||
* |
|||
* @param key |
|||
* @param pageNo |
|||
* @param pageSize |
|||
* @param req |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "数据点位表-分页列表查询") |
|||
@ApiOperation(value = "数据点位表-分页列表查询", notes = "数据点位表-分页列表查询") |
|||
@GetMapping(value = "/list") |
|||
public Result<?> queryPageList( |
|||
@RequestParam(name = "systemId", required = false) String systemId, |
|||
@RequestParam(name = "name", required = false) String name, |
|||
@RequestParam(name = "dataTag", required = false) String dataTag, |
|||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|||
HttpServletRequest req) { |
|||
QueryWrapper<DustDataTag> queryWrapper = new QueryWrapper<>(); |
|||
if (StrUtil.isNotEmpty(systemId)) { |
|||
queryWrapper.eq("system_id", systemId); |
|||
} |
|||
if (StrUtil.isNotEmpty(name)) { |
|||
queryWrapper.eq("name", name); |
|||
} |
|||
if (StrUtil.isNotEmpty(dataTag)) { |
|||
queryWrapper.eq("data_tag", dataTag); |
|||
} |
|||
|
|||
queryWrapper.orderByAsc("sort_order") |
|||
.orderByDesc("create_time"); |
|||
Page<DustDataTag> page = new Page<DustDataTag>(pageNo, pageSize); |
|||
IPage<DustDataTag> pageList = dustDataTagService.page(page, queryWrapper); |
|||
return Result.ok(pageList); |
|||
} |
|||
|
|||
/** |
|||
* 添加 |
|||
* |
|||
* @param dustDataTag |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "数据点位表-添加") |
|||
@ApiOperation(value = "数据点位表-添加", notes = "数据点位表-添加") |
|||
@PostMapping(value = "/add") |
|||
public Result<?> add(@RequestBody DustDataTag dustDataTag) { |
|||
checkUniqueName(dustDataTag); |
|||
dustDataTagService.save(dustDataTag); |
|||
return Result.ok("添加成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dustDataTag |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "数据点位表-编辑") |
|||
@ApiOperation(value = "数据点位表-编辑", notes = "数据点位表-编辑") |
|||
@PutMapping(value = "/edit") |
|||
public Result<?> edit(@RequestBody DustDataTag dustDataTag) { |
|||
checkUniqueName(dustDataTag); |
|||
dustDataTagService.updateById(dustDataTag); |
|||
return Result.ok("编辑成功!"); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制 |
|||
* |
|||
* @param id |
|||
* @param name |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "数据点位表-复制") |
|||
@ApiOperation(value = "数据点位表-复制", notes = "数据点位表-复制") |
|||
@PostMapping(value = "/copy") |
|||
public Result<?> copy(@RequestParam(name = "id", required = true) String id, @RequestParam(name = "name", required = true) String name) { |
|||
DustDataTag dustDataTag = dustDataTagService.getById(id); |
|||
dustDataTag.setId(IdUtil.fastUUID()); |
|||
dustDataTag.setName(name); |
|||
dustDataTagService.save(dustDataTag); |
|||
return Result.ok("复制成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id删除 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "数据点位表-通过id删除") |
|||
@ApiOperation(value = "数据点位表-通过id删除", notes = "数据点位表-通过id删除") |
|||
@DeleteMapping(value = "/delete") |
|||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|||
dustDataTagService.removeById(id); |
|||
return Result.ok("删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "数据点位表-批量删除") |
|||
@ApiOperation(value = "数据点位表-批量删除", notes = "数据点位表-批量删除") |
|||
@DeleteMapping(value = "/deleteBatch") |
|||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|||
this.dustDataTagService.removeByIds(Arrays.asList(ids.split(","))); |
|||
return Result.ok("批量删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id查询 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "数据点位表-通过id查询") |
|||
@ApiOperation(value = "数据点位表-通过id查询", notes = "数据点位表-通过id查询") |
|||
@GetMapping(value = "/queryById") |
|||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|||
DustDataTag dustDataTag = dustDataTagService.getById(id); |
|||
return Result.ok(dustDataTag); |
|||
} |
|||
|
|||
/** |
|||
* 导出excel |
|||
* |
|||
* @param request |
|||
* @param dustDataTag |
|||
*/ |
|||
@RequestMapping(value = "/exportXls") |
|||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, DustDataTag dustDataTag) { |
|||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
|||
return super.exportXls(request, dustDataTag, DustDataTag.class, "数据点位表"); |
|||
} |
|||
|
|||
/** |
|||
* 通过excel导入数据 |
|||
* |
|||
* @param request |
|||
* @param response |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|||
public Result<?> importExcel(HttpServletRequest request, |
|||
HttpServletResponse response) { |
|||
try { |
|||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
|||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
|||
|
|||
if (fileMap.isEmpty()) { |
|||
return Result.error("请上传 Excel 文件"); |
|||
} |
|||
|
|||
MultipartFile file = fileMap.values().iterator().next(); |
|||
if (file == null || file.isEmpty()) { |
|||
return Result.error("上传的文件为空"); |
|||
} |
|||
List<DustDataTag> metaDataValues = new ArrayList<>(); |
|||
List<String> errorList = new ArrayList<>(); |
|||
HashSet<String> dataTagSet = new HashSet<>(); |
|||
HashSet<String> nameSet = new HashSet<>(); |
|||
|
|||
List<DustSystem> systemList = iDustSystemService.list(); |
|||
Map<String, DustSystem> systemMap = systemList.stream().collect(Collectors.toMap(DustSystem::getName, dustSystem -> dustSystem)); |
|||
EasyExcelFactory.read(file.getInputStream(), DataTagExcel.class, |
|||
new AnalysisEventListener<DataTagExcel>() { |
|||
@Override |
|||
public void invoke(DataTagExcel rowData, AnalysisContext context) { |
|||
if (StringUtils.isEmpty(rowData.getDataTag()) || StringUtils.isEmpty(rowData.getName())) { |
|||
errorList.add(String.format("第 %d 行数据不完整:名称 或 数据点位 为空", context.readRowHolder().getRowIndex() + 1)); |
|||
return; |
|||
} |
|||
if (StringUtils.isEmpty(rowData.getSystemName())) { |
|||
errorList.add(String.format("第 %d 行数据不完整:除尘系统为空", context.readRowHolder().getRowIndex() + 1)); |
|||
return; |
|||
} |
|||
// 检查 dataTag 是否重复
|
|||
String dataTag = rowData.getDataTag().trim(); |
|||
if (!dataTagSet.add(dataTag)) { |
|||
// 如果 dataTag 已存在,记录错误
|
|||
errorList.add(String.format("第 %d 行数据重复:数据点位 %s 已存在", context.readRowHolder().getRowIndex() + 1, dataTag)); |
|||
return; |
|||
} |
|||
|
|||
if (!nameSet.add(rowData.getName() + rowData.getSystemName())) { |
|||
// 如果 dataTag 已存在,记录错误
|
|||
errorList.add(String.format("第 %d 行数据重复:该系统下除尘点位名称 %s 已存在", context.readRowHolder().getRowIndex() + 1, rowData.getName())); |
|||
return; |
|||
} |
|||
DustSystem dustSystem = systemMap.get(rowData.getSystemName().trim()); |
|||
if (dustSystem == null) { |
|||
errorList.add(String.format("第 %d 行数据错误:所属系统 %s 不存在", context.readRowHolder().getRowIndex() + 1, rowData.getSystemName())); |
|||
return; |
|||
} |
|||
DustDataTag dustDataTag = new DustDataTag(); |
|||
dustDataTag.setName(rowData.getName()); |
|||
dustDataTag.setDataTag(rowData.getDataTag().trim()); |
|||
dustDataTag.setSystemId(dustSystem.getId()); |
|||
|
|||
|
|||
checkUniqueName(dustDataTag); |
|||
|
|||
|
|||
metaDataValues.add(dustDataTag); |
|||
} |
|||
|
|||
@Override |
|||
public void doAfterAllAnalysed(AnalysisContext context) { |
|||
log.info("所有数据读取完成,共有 " + metaDataValues.size() + " 条数据"); |
|||
} |
|||
}) |
|||
.sheet() |
|||
.doRead(); |
|||
|
|||
if (!errorList.isEmpty()) { |
|||
return Result.error("导入失败,存在以下错误:\n" + String.join("\n", errorList)); |
|||
} |
|||
QueryWrapper<DustDataTag> dataTagQueryWrapper = new QueryWrapper<>(); |
|||
dataTagQueryWrapper.in("data_tag", dataTagSet); |
|||
List<DustDataTag> list = dustDataTagService.list(dataTagQueryWrapper); |
|||
Map<String, DustDataTag> collect = list.stream().collect(Collectors.toMap(DustDataTag::getDataTag, Function.identity())); |
|||
for (DustDataTag metaDataValue : metaDataValues) { |
|||
DustDataTag dustDataTag = collect.get(metaDataValue.getDataTag()); |
|||
if (dustDataTag != null) { |
|||
metaDataValue.setId(dustDataTag.getId()); |
|||
} |
|||
} |
|||
dustDataTagService.saveOrUpdateBatch(metaDataValues); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return Result.error("导入失败:" + e.getMessage()); |
|||
} |
|||
return Result.ok("导入成功"); |
|||
} |
|||
|
|||
public void checkUniqueName(DustDataTag origin) { |
|||
QueryWrapper<DustDataTag> coalQueryWrapper = new QueryWrapper<>(); |
|||
coalQueryWrapper.eq("data_tag", origin.getDataTag()); |
|||
DustDataTag existing = dustDataTagService.getOne(coalQueryWrapper); |
|||
|
|||
if (existing != null) { |
|||
if (origin.getId() != null) { |
|||
// ID不同且名称已被占用才抛异常
|
|||
if (!existing.getId().equals(origin.getId())) { |
|||
throw new IllegalArgumentException("数据点位 '" + origin.getDataTag() + "' 已存在"); |
|||
} |
|||
// ID相同是更新自身,不抛异常,直接返回
|
|||
return; |
|||
} |
|||
throw new IllegalArgumentException("数据点位 '" + origin.getDataTag() + "' 已存在"); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,242 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.util.RedisUtil; |
|||
import cc.admin.influxdb.core.InfluxdbTemplate; |
|||
import cc.admin.influxdb.dust.DustLog; |
|||
import cc.admin.modules.dust.entity.*; |
|||
import cc.admin.modules.dust.service.*; |
|||
import cc.admin.modules.dust.utils.KeyUtils; |
|||
import cc.admin.modules.dust.vo.DataTagPair; |
|||
import cc.admin.modules.dust.vo.DustMonitorItemVo; |
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.time.LocalDateTime; |
|||
import java.time.ZoneOffset; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Description: 综合监控 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "综合监控") |
|||
@RestController |
|||
@RequestMapping("/dust/monitor") |
|||
public class DustMonitorController { |
|||
@Autowired |
|||
private IDustDataTagService iDustDataTagService; |
|||
@Autowired |
|||
private IDustValveService dustValveService; |
|||
@Autowired |
|||
private IDustMonitorItemService dustMonitorItemService; |
|||
@Autowired |
|||
private IDustMonitorValveService dustMonitorValveService; |
|||
@Autowired |
|||
private InfluxdbTemplate influxdbTemplate; |
|||
@Autowired |
|||
private RedisUtil redisUtil; |
|||
|
|||
@AutoLog(value = "大屏监控-监控看板") |
|||
@ApiOperation(value = "大屏监控-监控看板", notes = "大屏监控项表-监控看板") |
|||
@GetMapping(value = "/boardList") |
|||
public Result<?> boardList(HttpServletRequest req) { |
|||
|
|||
ArrayList<DustMonitorItemVo> monitorItemList = new ArrayList<>(); |
|||
|
|||
Map<Object, Object> hmget = redisUtil.hmget(KeyUtils.dustdataTag); |
|||
if (ObjectUtils.isEmpty(hmget)) { |
|||
return Result.ok(monitorItemList); |
|||
} |
|||
|
|||
List<DustMonitorItem> list = dustMonitorItemService.list(); |
|||
Map<String, DustMonitorItem> collect = list.stream().collect(Collectors.toMap( |
|||
DustMonitorItem::getSystemId, // Key mapper
|
|||
item -> item, // Value mapper
|
|||
(existing, replacement) -> existing // Merge function (keep the first item if duplicate keys)
|
|||
)); |
|||
for (String systemId : collect.keySet()) { |
|||
DustMonitorItem dustMonitorItem = collect.get(systemId); |
|||
DustMonitorItemVo vo = new DustMonitorItemVo(); |
|||
BeanUtil.copyProperties(dustMonitorItem, vo); |
|||
Double inletPressure = hmget.get(dustMonitorItem.getInletPressureDataTagId()) != null |
|||
? Double.valueOf(hmget.get(dustMonitorItem.getInletPressureDataTagId()).toString()) : null; |
|||
|
|||
Double outletPressure = hmget.get(dustMonitorItem.getOutletPressureDataTagId()) != null |
|||
? Double.valueOf(hmget.get(dustMonitorItem.getOutletPressureDataTagId()).toString()) : null; |
|||
|
|||
Double pressureDifference = hmget.get(dustMonitorItem.getPressureDifferenceId()) != null |
|||
? Double.valueOf(hmget.get(dustMonitorItem.getPressureDifferenceId()).toString()) : null; |
|||
|
|||
Double fanSpeed = hmget.get(dustMonitorItem.getFanSpeedDataTagId()) != null |
|||
? Double.valueOf(hmget.get(dustMonitorItem.getFanSpeedDataTagId()).toString()) : null; |
|||
|
|||
Double motorCurrent = hmget.get(dustMonitorItem.getMotorCurrentDataTagId()) != null |
|||
? Double.valueOf(hmget.get(dustMonitorItem.getMotorCurrentDataTagId()).toString()) : null; |
|||
|
|||
Double cemsAirVolume = hmget.get(dustMonitorItem.getCemsAirVolumeDataTagId()) != null |
|||
? Double.valueOf(hmget.get(dustMonitorItem.getCemsAirVolumeDataTagId()).toString()) : null; |
|||
|
|||
Double dustConcentration = hmget.get(dustMonitorItem.getDustConcentrationDataTagId()) != null |
|||
? Double.valueOf(hmget.get(dustMonitorItem.getDustConcentrationDataTagId()).toString()) : null; |
|||
|
|||
Integer fanStatus = toInteger(hmget.get(dustMonitorItem.getFanStatusDataTagId())); |
|||
vo.setInletPressureDataTagValue(inletPressure); |
|||
vo.setOutletPressureDataTagValue(outletPressure); |
|||
vo.setPressureDifference(pressureDifference); |
|||
vo.setFanSpeedDataTagValue(fanSpeed); |
|||
vo.setMotorCurrentDataTagValue(motorCurrent); |
|||
vo.setCemsAirVolumeDataTagValue(cemsAirVolume); |
|||
vo.setDustConcentrationDataTagValue(dustConcentration); |
|||
vo.setFanStatusDataTagStatus(fanStatus); |
|||
monitorItemList.add(vo); |
|||
} |
|||
|
|||
return Result.ok(monitorItemList); |
|||
} |
|||
|
|||
private Integer toInteger(Object value) { |
|||
if (value == null) return null; |
|||
try { |
|||
return Integer.valueOf(value.toString()); |
|||
} catch (NumberFormatException e) { |
|||
return null; // 或返回默认值,比如 0
|
|||
} |
|||
} |
|||
|
|||
@AutoLog(value = "大屏监控-阀门点位") |
|||
@ApiOperation(value = "大屏监控-阀门点位", notes = "大屏监控项表-阀门点位") |
|||
@GetMapping(value = "/boardValve") |
|||
public Result<?> boardValve(HttpServletRequest req) { |
|||
|
|||
Map<Object, Object> hmget = redisUtil.hmget(KeyUtils.dustdataTag); |
|||
|
|||
List<DustMonitorValve> list = dustMonitorValveService.valveList(); |
|||
|
|||
Map<String, DustMonitorValve> collect = list.stream().collect(Collectors.toMap( |
|||
DustMonitorValve::getValveId, // Key mapper
|
|||
item -> item, // Value mapper
|
|||
(existing, replacement) -> existing // Merge function (keep the first item if duplicate keys)
|
|||
)); |
|||
ArrayList<DustMonitorValve> objects = new ArrayList<>(); |
|||
for (String key : collect.keySet()) { |
|||
DustMonitorValve dustMonitorValve = collect.get(key); |
|||
Integer status = toInteger(hmget.get(dustMonitorValve.getDataTagId())); |
|||
dustMonitorValve.setStatus(status); |
|||
objects.add(dustMonitorValve); |
|||
} |
|||
return Result.ok(objects); |
|||
} |
|||
|
|||
@AutoLog(value = "大屏监控-阀门状态") |
|||
@ApiOperation(value = "大屏监控表-阀门状态", notes = "大屏监控项表-阀门状态") |
|||
@GetMapping(value = "/valveStatusList") |
|||
public Result<?> valveStatusList(HttpServletRequest req, |
|||
@RequestParam(name = "systemId", required = true) String systemId) { |
|||
|
|||
QueryWrapper<DustValve> valveQueryWrapper = new QueryWrapper<>(); |
|||
valveQueryWrapper.eq("system_id", systemId); |
|||
List<DustValve> list = dustValveService.list(valveQueryWrapper); |
|||
if (ObjectUtils.isEmpty(list)) { |
|||
return Result.ok(new ArrayList<>()); |
|||
} |
|||
Map<Object, Object> hmget = redisUtil.hmget(KeyUtils.dustdataTag); |
|||
for (DustValve dustValve : list) { |
|||
Integer status = toInteger(hmget.get(dustValve.getDataTagId())); |
|||
dustValve.setStatus(status); |
|||
} |
|||
return Result.ok(list); |
|||
} |
|||
|
|||
@AutoLog(value = "历史记录") |
|||
@ApiOperation(value = "历史记录", notes = "历史记录") |
|||
@GetMapping(value = "/historyList") |
|||
public Result<?> historyList(HttpServletRequest req, |
|||
@RequestParam(name = "systemId", required = true) String systemId, |
|||
@RequestParam(name = "startTime", required = true) String startTime, |
|||
@RequestParam(name = "endTime", required = true) String endTime) { |
|||
|
|||
QueryWrapper<DustMonitorItem> objectQueryWrapper = new QueryWrapper<>(); |
|||
objectQueryWrapper.eq("system_id", systemId); |
|||
DustMonitorItem one = dustMonitorItemService.getOne(objectQueryWrapper); |
|||
if (ObjectUtils.isEmpty(one)) { |
|||
return Result.ok(new ArrayList<>()); |
|||
} |
|||
// 从 one 中提取 dataTag 列表
|
|||
List<DataTagPair> dataTag = new ArrayList<>(); |
|||
dataTag.add(new DataTagPair(one.getInletPressureDataTagId(), "除尘器进气压力(pa)")); |
|||
dataTag.add(new DataTagPair(one.getOutletPressureDataTagId(), "除尘器出气压力(pa)")); |
|||
dataTag.add(new DataTagPair(one.getFanSpeedDataTagId(), "风机转速(r/min)")); |
|||
dataTag.add(new DataTagPair(one.getMotorCurrentDataTagId(), "电机电流(A)")); |
|||
dataTag.add(new DataTagPair(one.getDustConcentrationDataTagId(), "粉尘浓度(mg/m³)")); |
|||
dataTag.add(new DataTagPair(one.getCemsAirVolumeDataTagId(), "烟尘CEMS风量(m³/h)")); |
|||
dataTag.add(new DataTagPair(one.getPressureDifferenceId(), "除尘器进出口压差(pa)")); |
|||
|
|||
QueryWrapper<DustDataTag> dataTagQueryWrapper = new QueryWrapper<>(); |
|||
dataTagQueryWrapper.in("id", dataTag.stream().map(DataTagPair::getTagId).collect(Collectors.toList())); |
|||
List<DustDataTag> list = iDustDataTagService.list(dataTagQueryWrapper); |
|||
|
|||
HashMap<String, List<DustLog>> resultMap = new HashMap<>(); |
|||
if (CollectionUtils.isNotEmpty(list)) { |
|||
// 时间格式化和转换
|
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|||
LocalDateTime startTimeDateTime = LocalDateTime.parse(startTime, formatter); |
|||
LocalDateTime endTimeDateTime = LocalDateTime.parse(endTime, formatter); |
|||
long startTimeEpochSeconds = startTimeDateTime.toEpochSecond(ZoneOffset.UTC); |
|||
long endTimeEpochSeconds = endTimeDateTime.toEpochSecond(ZoneOffset.UTC); |
|||
|
|||
|
|||
Map<String, DustDataTag> tagIdToDustDataTag = list.stream() |
|||
.collect(Collectors.toMap( |
|||
DustDataTag::getId, |
|||
dustDataTag -> dustDataTag, |
|||
(existing, replacement) -> existing |
|||
)); |
|||
|
|||
for (DataTagPair dataTagPair : dataTag) { |
|||
String tagId = dataTagPair.getTagId(); |
|||
String description = dataTagPair.getDescription(); |
|||
DustDataTag dustDataTag = tagIdToDustDataTag.get(tagId); |
|||
if (dustDataTag != null) { |
|||
String sqlStr = String.format( |
|||
"SELECT first(value) as value " + // 这里添加了空格
|
|||
"FROM dust_log " + |
|||
"WHERE time >= %ds AND time <= %ds " + |
|||
"AND dataTag = '%s' " + |
|||
"GROUP BY time(1m)", |
|||
startTimeEpochSeconds, endTimeEpochSeconds, dustDataTag.getId() |
|||
); |
|||
|
|||
String format = String.format(sqlStr, startTimeEpochSeconds, endTimeEpochSeconds); |
|||
List<DustLog> mqttLogs = influxdbTemplate.selectList( |
|||
format, |
|||
DustLog.class); |
|||
mqttLogs = mqttLogs.stream() |
|||
.filter(log -> log.getValue() != null) |
|||
.collect(Collectors.toList()); |
|||
resultMap.put(description, mqttLogs); |
|||
} else { |
|||
resultMap.put(description, new ArrayList<>()); |
|||
} |
|||
} |
|||
} |
|||
return Result.ok(resultMap); |
|||
} |
|||
} |
@ -0,0 +1,328 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.sys.base.controller.BaseController; |
|||
import cc.admin.common.sys.query.QueryGenerator; |
|||
import cc.admin.modules.dust.entity.DustDataTag; |
|||
import cc.admin.modules.dust.entity.DustMonitorItem; |
|||
import cc.admin.modules.dust.entity.DustSystem; |
|||
import cc.admin.modules.dust.entity.DustValve; |
|||
import cc.admin.modules.dust.enums.ValveType; |
|||
import cc.admin.modules.dust.service.IDustDataTagService; |
|||
import cc.admin.modules.dust.service.IDustMonitorItemService; |
|||
import cc.admin.modules.dust.service.IDustSystemService; |
|||
import cc.admin.modules.dust.vo.DataValveExcel; |
|||
import cc.admin.modules.dust.vo.DustMonitorItemExcel; |
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.excel.EasyExcelFactory; |
|||
import com.alibaba.excel.context.AnalysisContext; |
|||
import com.alibaba.excel.event.AnalysisEventListener; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.*; |
|||
import java.util.function.Consumer; |
|||
import java.util.function.Function; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Description: 大屏监控项表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "大屏监控项表") |
|||
@RestController |
|||
@RequestMapping("/dust/monitorItem") |
|||
public class DustMonitorItemController extends BaseController<DustMonitorItem, IDustMonitorItemService> { |
|||
@Autowired |
|||
private IDustMonitorItemService dustMonitorItemService; |
|||
@Autowired |
|||
private IDustSystemService dustSystemService; |
|||
@Autowired |
|||
private IDustDataTagService dustDataTagService; |
|||
/** |
|||
* 分页列表查询 |
|||
* |
|||
* @param key |
|||
* @param pageNo |
|||
* @param pageSize |
|||
* @param req |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏监控项表-分页列表查询") |
|||
@ApiOperation(value = "大屏监控项表-分页列表查询", notes = "大屏监控项表-分页列表查询") |
|||
@GetMapping(value = "/list") |
|||
public Result<?> queryPageList( |
|||
@RequestParam(name = "key", required = false) String key, |
|||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|||
HttpServletRequest req) { |
|||
QueryWrapper<DustMonitorItem> queryWrapper = QueryGenerator.initQueryWrapper(new DustMonitorItem(), req.getParameterMap()); |
|||
if (StrUtil.isNotEmpty(key)) { |
|||
|
|||
} |
|||
queryWrapper.orderByAsc("sort_order") |
|||
.orderByDesc("create_time"); |
|||
Page<DustMonitorItem> page = new Page<DustMonitorItem>(pageNo, pageSize); |
|||
IPage<DustMonitorItem> pageList = dustMonitorItemService.page(page, queryWrapper); |
|||
return Result.ok(pageList); |
|||
} |
|||
|
|||
/** |
|||
* 添加 |
|||
* |
|||
* @param dustMonitorItem |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏监控项表-添加") |
|||
@ApiOperation(value = "大屏监控项表-添加", notes = "大屏监控项表-添加") |
|||
@PostMapping(value = "/add") |
|||
public Result<?> add(@RequestBody DustMonitorItem dustMonitorItem) { |
|||
checkUniqueName(dustMonitorItem); |
|||
dustMonitorItemService.save(dustMonitorItem); |
|||
return Result.ok("添加成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dustMonitorItem |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏监控项表-编辑") |
|||
@ApiOperation(value = "大屏监控项表-编辑", notes = "大屏监控项表-编辑") |
|||
@PutMapping(value = "/edit") |
|||
public Result<?> edit(@RequestBody DustMonitorItem dustMonitorItem) { |
|||
checkUniqueName(dustMonitorItem); |
|||
dustMonitorItemService.updateById(dustMonitorItem); |
|||
return Result.ok("编辑成功!"); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 通过id删除 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏监控项表-通过id删除") |
|||
@ApiOperation(value = "大屏监控项表-通过id删除", notes = "大屏监控项表-通过id删除") |
|||
@DeleteMapping(value = "/delete") |
|||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|||
dustMonitorItemService.removeById(id); |
|||
return Result.ok("删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏监控项表-批量删除") |
|||
@ApiOperation(value = "大屏监控项表-批量删除", notes = "大屏监控项表-批量删除") |
|||
@DeleteMapping(value = "/deleteBatch") |
|||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|||
this.dustMonitorItemService.removeByIds(Arrays.asList(ids.split(","))); |
|||
return Result.ok("批量删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id查询 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏监控项表-通过id查询") |
|||
@ApiOperation(value = "大屏监控项表-通过id查询", notes = "大屏监控项表-通过id查询") |
|||
@GetMapping(value = "/queryById") |
|||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|||
DustMonitorItem dustMonitorItem = dustMonitorItemService.getById(id); |
|||
return Result.ok(dustMonitorItem); |
|||
} |
|||
|
|||
/** |
|||
* 导出excel |
|||
* |
|||
* @param request |
|||
* @param dustMonitorItem |
|||
*/ |
|||
@RequestMapping(value = "/exportXls") |
|||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, DustMonitorItem dustMonitorItem) { |
|||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
|||
return super.exportXls(request, dustMonitorItem, DustMonitorItem.class, "大屏监控项表"); |
|||
} |
|||
|
|||
|
|||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|||
public Result<?> importExcel(HttpServletRequest request, |
|||
HttpServletResponse response) { |
|||
try { |
|||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
|||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
|||
|
|||
if (fileMap.isEmpty()) { |
|||
return Result.error("请上传 Excel 文件"); |
|||
} |
|||
|
|||
MultipartFile file = fileMap.values().iterator().next(); |
|||
if (file == null || file.isEmpty()) { |
|||
return Result.error("上传的文件为空"); |
|||
} |
|||
List<DustMonitorItemExcel> metaDataValues = new ArrayList<>(); |
|||
List<String> errorList = new ArrayList<>(); |
|||
HashSet<String> idSet = new HashSet<>(); |
|||
HashSet<String> NameSet = new HashSet<>(); |
|||
|
|||
EasyExcelFactory.read(file.getInputStream(), DustMonitorItemExcel.class, |
|||
new AnalysisEventListener<DustMonitorItemExcel>() { |
|||
@Override |
|||
public void invoke(DustMonitorItemExcel rowData, AnalysisContext context) { |
|||
int rowIndex = context.readRowHolder().getRowIndex() + 1; |
|||
|
|||
// 将所有 dataTag 添加到 idSet 并检查重复
|
|||
String[] dataTags = { |
|||
rowData.getCemsAirVolumeDataTagName()+rowData.getSystemName(), |
|||
rowData.getOutletPressureDataTagName()+rowData.getSystemName(), |
|||
rowData.getInletPressureDataTagName()+rowData.getSystemName(), |
|||
rowData.getDustConcentrationDataTagName()+rowData.getSystemName(), |
|||
rowData.getFanStatusDataTagStatusName()+rowData.getSystemName(), |
|||
rowData.getFanSpeedDataTagName()+rowData.getSystemName(), |
|||
rowData.getMotorCurrentDataTagName()+rowData.getSystemName() |
|||
}; |
|||
NameSet.add(rowData.getCemsAirVolumeDataTagName()); |
|||
NameSet.add(rowData.getOutletPressureDataTagName()); |
|||
NameSet.add(rowData.getInletPressureDataTagName()); |
|||
NameSet.add(rowData.getDustConcentrationDataTagName()); |
|||
NameSet.add(rowData.getFanStatusDataTagStatusName()); |
|||
NameSet.add(rowData.getFanSpeedDataTagName()); |
|||
NameSet.add(rowData.getMotorCurrentDataTagName()); |
|||
// 检查 dataTag 是否重复
|
|||
for (String dataTag : dataTags) { |
|||
if (StringUtils.isNotEmpty(dataTag)) { // 跳过空值
|
|||
if (!idSet.add(dataTag)) { // 如果添加失败,说明已存在
|
|||
errorList.add(String.format("第 %d 行数据重复:数据点位 %s 已存在", rowIndex, dataTag)); |
|||
return; // 发现重复后直接返回(根据你的代码逻辑)
|
|||
} |
|||
} |
|||
} |
|||
metaDataValues.add(rowData); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public void doAfterAllAnalysed(AnalysisContext context) { |
|||
log.info("所有数据读取完成,共有 " + metaDataValues.size() + " 条数据"); |
|||
} |
|||
}) |
|||
.sheet() |
|||
.doRead(); |
|||
|
|||
if (!errorList.isEmpty()) { |
|||
return Result.error("导入失败,存在以下错误:\n" + String.join("\n", errorList)); |
|||
} |
|||
|
|||
List<DustSystem> systemList = dustSystemService.list(); |
|||
Map<String, DustSystem> systemMap = systemList.stream().collect(Collectors.toMap(DustSystem::getName, dustSystem -> dustSystem)); |
|||
|
|||
QueryWrapper<DustDataTag> objectQueryWrapper = new QueryWrapper<>(); |
|||
objectQueryWrapper.eq("name",idSet); |
|||
List<DustDataTag> dataTagList = dustDataTagService.list(objectQueryWrapper); |
|||
Map<String, DustDataTag> tagMap = dataTagList.stream().collect(Collectors.toMap( |
|||
dustDataTag -> dustDataTag.getDataTag() + dustDataTag.getSystemId(), |
|||
Function.identity())); |
|||
ArrayList<DustMonitorItem> objects = new ArrayList<>(); |
|||
|
|||
|
|||
List<DustMonitorItem> list = dustMonitorItemService.list(); |
|||
Map<String, DustMonitorItem> collect = list.stream().collect(Collectors.toMap(DustMonitorItem::getSystemId, Function.identity())); |
|||
|
|||
for (DustMonitorItemExcel metaDataValue : metaDataValues) { |
|||
DustMonitorItem dustMonitorItem = new DustMonitorItem(); |
|||
DustSystem dustSystem = systemMap.get(metaDataValue.getSystemName().trim()); |
|||
if (null != dustSystem){ |
|||
dustMonitorItem.setSystemId(dustSystem.getId()); |
|||
} |
|||
DustDataTag dustDataTag = tagMap.get(metaDataValue.getInletPressureDataTagName().trim()+ dustMonitorItem.getSystemId()); |
|||
if (dustDataTag != null){ |
|||
dustMonitorItem.setInletPressureDataTagId(dustDataTag.getId()); |
|||
} |
|||
DustDataTag dustDataTag1 = tagMap.get(metaDataValue.getOutletPressureDataTagName().trim() + dustMonitorItem.getSystemId()); |
|||
if (dustDataTag1 != null){ |
|||
dustMonitorItem.setOutletPressureDataTagId(dustDataTag1.getId()); |
|||
} |
|||
|
|||
DustDataTag dustDataTag2 = tagMap.get(metaDataValue.getDustConcentrationDataTagName().trim() + dustMonitorItem.getSystemId()); |
|||
if (dustDataTag2 != null){ |
|||
dustMonitorItem.setDustConcentrationDataTagId(dustDataTag2.getId()); |
|||
} |
|||
|
|||
DustDataTag dustDataTag3 = tagMap.get(metaDataValue.getCemsAirVolumeDataTagName().trim() + dustMonitorItem.getSystemId()); |
|||
if (dustDataTag3 != null){ |
|||
dustMonitorItem.setCemsAirVolumeDataTagId(dustDataTag3.getId()); |
|||
} |
|||
|
|||
DustDataTag dustDataTag4 = tagMap.get(metaDataValue.getMotorCurrentDataTagName().trim() + dustMonitorItem.getSystemId()); |
|||
if (dustDataTag4 != null){ |
|||
dustMonitorItem.setMotorCurrentDataTagId(dustDataTag4.getId()); |
|||
} |
|||
|
|||
DustDataTag dustDataTag5 = tagMap.get(metaDataValue.getFanStatusDataTagStatusName().trim() + dustMonitorItem.getSystemId()); |
|||
if (dustDataTag5 != null){ |
|||
dustMonitorItem.setFanStatusDataTagId(dustDataTag5.getId()); |
|||
} |
|||
|
|||
DustDataTag dustDataTag6 = tagMap.get(metaDataValue.getFanSpeedDataTagName().trim() + dustMonitorItem.getSystemId()); |
|||
if (dustDataTag6 != null){ |
|||
dustMonitorItem.setFanSpeedDataTagId(dustDataTag6.getId()); |
|||
} |
|||
|
|||
DustMonitorItem dustMonitorItem1 = collect.get(dustMonitorItem.getSystemId()); |
|||
if (null != dustMonitorItem1){ |
|||
dustMonitorItem.setId(dustMonitorItem1.getId()); |
|||
} |
|||
objects.add(dustMonitorItem); |
|||
} |
|||
dustMonitorItemService.saveOrUpdateBatch(objects); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return Result.error("导入失败:" + e.getMessage()); |
|||
} |
|||
return Result.ok("导入成功"); |
|||
} |
|||
|
|||
public void checkUniqueName(DustMonitorItem item) { |
|||
QueryWrapper<DustMonitorItem> coalQueryWrapper = new QueryWrapper<>(); |
|||
coalQueryWrapper.eq("system_id", item.getSystemId()); |
|||
DustMonitorItem existing = dustMonitorItemService.getOne(coalQueryWrapper); |
|||
|
|||
if (existing != null) { |
|||
if (item.getId() != null) { |
|||
// ID不同且名称已被占用才抛异常
|
|||
if (!existing.getId().equals(item.getId())) { |
|||
throw new IllegalArgumentException("系统已存在"); |
|||
} |
|||
// ID相同是更新自身,不抛异常,直接返回
|
|||
return; |
|||
} |
|||
throw new IllegalArgumentException("系统已存在"); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,162 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.sys.base.controller.BaseController; |
|||
import cc.admin.common.sys.query.QueryGenerator; |
|||
import cc.admin.modules.dust.entity.DustMonitorValve; |
|||
import cc.admin.modules.dust.service.IDustMonitorValveService; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.Arrays; |
|||
|
|||
/** |
|||
* @Description: 大屏阀门监控表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "大屏阀门监控表") |
|||
@RestController |
|||
@RequestMapping("/dust/monitorValve") |
|||
public class DustMonitorValveController extends BaseController<DustMonitorValve, IDustMonitorValveService> { |
|||
@Autowired |
|||
private IDustMonitorValveService dustMonitorValveService; |
|||
|
|||
/** |
|||
* 分页列表查询 |
|||
* |
|||
* @param key |
|||
* @param pageNo |
|||
* @param pageSize |
|||
* @param req |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏阀门监控表-分页列表查询") |
|||
@ApiOperation(value = "大屏阀门监控表-分页列表查询", notes = "大屏阀门监控表-分页列表查询") |
|||
@GetMapping(value = "/list") |
|||
public Result<?> queryPageList( |
|||
@RequestParam(name = "key", required = false) String key, |
|||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|||
HttpServletRequest req) { |
|||
QueryWrapper<DustMonitorValve> queryWrapper = QueryGenerator.initQueryWrapper(new DustMonitorValve(), req.getParameterMap()); |
|||
if (StrUtil.isNotEmpty(key)) { |
|||
|
|||
} |
|||
queryWrapper.orderByAsc("sort_order") |
|||
.orderByDesc("create_time"); |
|||
Page<DustMonitorValve> page = new Page<DustMonitorValve>(pageNo, pageSize); |
|||
IPage<DustMonitorValve> pageList = dustMonitorValveService.page(page, queryWrapper); |
|||
return Result.ok(pageList); |
|||
} |
|||
|
|||
/** |
|||
* 添加 |
|||
* |
|||
* @param dustMonitorValve |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏阀门监控表-添加") |
|||
@ApiOperation(value = "大屏阀门监控表-添加", notes = "大屏阀门监控表-添加") |
|||
@PostMapping(value = "/add") |
|||
public Result<?> add(@RequestBody DustMonitorValve dustMonitorValve) { |
|||
dustMonitorValveService.save(dustMonitorValve); |
|||
return Result.ok("添加成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dustMonitorValve |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏阀门监控表-编辑") |
|||
@ApiOperation(value = "大屏阀门监控表-编辑", notes = "大屏阀门监控表-编辑") |
|||
@PutMapping(value = "/edit") |
|||
public Result<?> edit(@RequestBody DustMonitorValve dustMonitorValve) { |
|||
dustMonitorValveService.updateById(dustMonitorValve); |
|||
return Result.ok("编辑成功!"); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 通过id删除 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏阀门监控表-通过id删除") |
|||
@ApiOperation(value = "大屏阀门监控表-通过id删除", notes = "大屏阀门监控表-通过id删除") |
|||
@DeleteMapping(value = "/delete") |
|||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|||
dustMonitorValveService.removeById(id); |
|||
return Result.ok("删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏阀门监控表-批量删除") |
|||
@ApiOperation(value = "大屏阀门监控表-批量删除", notes = "大屏阀门监控表-批量删除") |
|||
@DeleteMapping(value = "/deleteBatch") |
|||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|||
this.dustMonitorValveService.removeByIds(Arrays.asList(ids.split(","))); |
|||
return Result.ok("批量删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id查询 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "大屏阀门监控表-通过id查询") |
|||
@ApiOperation(value = "大屏阀门监控表-通过id查询", notes = "大屏阀门监控表-通过id查询") |
|||
@GetMapping(value = "/queryById") |
|||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|||
DustMonitorValve dustMonitorValve = dustMonitorValveService.getById(id); |
|||
return Result.ok(dustMonitorValve); |
|||
} |
|||
|
|||
/** |
|||
* 导出excel |
|||
* |
|||
* @param request |
|||
* @param dustMonitorValve |
|||
*/ |
|||
@RequestMapping(value = "/exportXls") |
|||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, DustMonitorValve dustMonitorValve) { |
|||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
|||
return super.exportXls(request, dustMonitorValve, DustMonitorValve.class, "大屏阀门监控表"); |
|||
} |
|||
|
|||
/** |
|||
* 通过excel导入数据 |
|||
* |
|||
* @param request |
|||
* @param response |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
|||
return super.importExcel(request, response, DustMonitorValve.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,182 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.sys.base.controller.BaseController; |
|||
import cc.admin.common.sys.query.QueryGenerator; |
|||
import cc.admin.modules.dust.entity.DustDataTag; |
|||
import cc.admin.modules.dust.entity.DustSystem; |
|||
import cc.admin.modules.dust.service.IDustSystemService; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.Arrays; |
|||
|
|||
/** |
|||
* @Description: 除尘系统表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "除尘系统表") |
|||
@RestController |
|||
@RequestMapping("/dust/system") |
|||
public class DustSystemController extends BaseController<DustSystem, IDustSystemService> { |
|||
@Autowired |
|||
private IDustSystemService dustSystemService; |
|||
|
|||
/** |
|||
* 分页列表查询 |
|||
* |
|||
* @param key |
|||
* @param pageNo |
|||
* @param pageSize |
|||
* @param req |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "除尘系统表-分页列表查询") |
|||
@ApiOperation(value = "除尘系统表-分页列表查询", notes = "除尘系统表-分页列表查询") |
|||
@GetMapping(value = "/list") |
|||
public Result<?> queryPageList( |
|||
@RequestParam(name = "key", required = false) String key, |
|||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|||
HttpServletRequest req) { |
|||
QueryWrapper<DustSystem> queryWrapper = QueryGenerator.initQueryWrapper(new DustSystem(), req.getParameterMap()); |
|||
if (StrUtil.isNotEmpty(key)) { |
|||
|
|||
} |
|||
queryWrapper.orderByAsc("sort_order") |
|||
.orderByDesc("create_time"); |
|||
Page<DustSystem> page = new Page<DustSystem>(pageNo, pageSize); |
|||
IPage<DustSystem> pageList = dustSystemService.page(page, queryWrapper); |
|||
return Result.ok(pageList); |
|||
} |
|||
|
|||
/** |
|||
* 添加 |
|||
* |
|||
* @param dustSystem |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "除尘系统表-添加") |
|||
@ApiOperation(value = "除尘系统表-添加", notes = "除尘系统表-添加") |
|||
@PostMapping(value = "/add") |
|||
public Result<?> add(@RequestBody DustSystem dustSystem) { |
|||
|
|||
dustSystemService.save(dustSystem); |
|||
return Result.ok("添加成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dustSystem |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "除尘系统表-编辑") |
|||
@ApiOperation(value = "除尘系统表-编辑", notes = "除尘系统表-编辑") |
|||
@PutMapping(value = "/edit") |
|||
public Result<?> edit(@RequestBody DustSystem dustSystem) { |
|||
dustSystemService.updateById(dustSystem); |
|||
return Result.ok("编辑成功!"); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制 |
|||
* |
|||
* @param id |
|||
* @param name |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "除尘系统表-复制") |
|||
@ApiOperation(value = "除尘系统表-复制", notes = "除尘系统表-复制") |
|||
@PostMapping(value = "/copy") |
|||
public Result<?> copy(@RequestParam(name = "id", required = true) String id, @RequestParam(name = "name", required = true) String name) { |
|||
DustSystem dustSystem = dustSystemService.getById(id); |
|||
dustSystem.setId(IdUtil.fastUUID()); |
|||
dustSystem.setName(name); |
|||
dustSystemService.save(dustSystem); |
|||
return Result.ok("复制成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id删除 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "除尘系统表-通过id删除") |
|||
@ApiOperation(value = "除尘系统表-通过id删除", notes = "除尘系统表-通过id删除") |
|||
@DeleteMapping(value = "/delete") |
|||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|||
dustSystemService.removeById(id); |
|||
return Result.ok("删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "除尘系统表-批量删除") |
|||
@ApiOperation(value = "除尘系统表-批量删除", notes = "除尘系统表-批量删除") |
|||
@DeleteMapping(value = "/deleteBatch") |
|||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|||
this.dustSystemService.removeByIds(Arrays.asList(ids.split(","))); |
|||
return Result.ok("批量删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id查询 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "除尘系统表-通过id查询") |
|||
@ApiOperation(value = "除尘系统表-通过id查询", notes = "除尘系统表-通过id查询") |
|||
@GetMapping(value = "/queryById") |
|||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|||
DustSystem dustSystem = dustSystemService.getById(id); |
|||
return Result.ok(dustSystem); |
|||
} |
|||
|
|||
/** |
|||
* 导出excel |
|||
* |
|||
* @param request |
|||
* @param dustSystem |
|||
*/ |
|||
@RequestMapping(value = "/exportXls") |
|||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, DustSystem dustSystem) { |
|||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
|||
return super.exportXls(request, dustSystem, DustSystem.class, "除尘系统表"); |
|||
} |
|||
|
|||
/** |
|||
* 通过excel导入数据 |
|||
* |
|||
* @param request |
|||
* @param response |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
|||
return super.importExcel(request, response, DustSystem.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,341 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.sys.base.controller.BaseController; |
|||
import cc.admin.common.sys.query.QueryGenerator; |
|||
import cc.admin.modules.dust.entity.DustDataTag; |
|||
import cc.admin.modules.dust.entity.DustSystem; |
|||
import cc.admin.modules.dust.entity.DustValve; |
|||
import cc.admin.modules.dust.enums.ValveType; |
|||
import cc.admin.modules.dust.service.IDustDataTagService; |
|||
import cc.admin.modules.dust.service.IDustSystemService; |
|||
import cc.admin.modules.dust.service.IDustValveService; |
|||
import cc.admin.modules.dust.utils.BeanCopyUtil; |
|||
import cc.admin.modules.dust.vo.DataTagExcel; |
|||
import cc.admin.modules.dust.vo.DataValveExcel; |
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.excel.EasyExcelFactory; |
|||
import com.alibaba.excel.context.AnalysisContext; |
|||
import com.alibaba.excel.event.AnalysisEventListener; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.*; |
|||
import java.util.function.Function; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Description: 阀门表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "阀门表") |
|||
@RestController |
|||
@RequestMapping("/dust/valve") |
|||
public class DustValveController extends BaseController<DustValve, IDustValveService> { |
|||
@Autowired |
|||
private IDustValveService dustValveService; |
|||
@Autowired |
|||
private IDustDataTagService dustDataTagService; |
|||
@Autowired |
|||
private IDustSystemService dustSystemService; |
|||
|
|||
/** |
|||
* 分页列表查询 |
|||
* @param pageNo |
|||
* @param pageSize |
|||
* @param req |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "阀门表-分页列表查询") |
|||
@ApiOperation(value = "阀门表-分页列表查询", notes = "阀门表-分页列表查询") |
|||
@GetMapping(value = "/list") |
|||
public Result<?> queryPageList( |
|||
@RequestParam(name = "systemId", required = false) String systemId, |
|||
@RequestParam(name = "dataTagId", required = false) String dataTagId, |
|||
@RequestParam(name = "name", required = false) String name, |
|||
@RequestParam(name = "parameter", required = false) String parameter, |
|||
@RequestParam(name = "location", required = false) String location, |
|||
@RequestParam(name = "type", required = false) Integer type, |
|||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|||
HttpServletRequest req) { |
|||
QueryWrapper<DustValve> queryWrapper = new QueryWrapper<>(); |
|||
if (StrUtil.isNotEmpty(parameter)) { |
|||
queryWrapper.like("parameter", parameter); // parameter 模糊查询
|
|||
} |
|||
if (StrUtil.isNotEmpty(location)) { |
|||
queryWrapper.like("location", location); // location 改为模糊查询
|
|||
} |
|||
if (StrUtil.isNotEmpty(name)) { |
|||
queryWrapper.like("name", name); // location 改为模糊查询
|
|||
} |
|||
if (null != type) { |
|||
queryWrapper.eq("type", type); // type 保持精确匹配
|
|||
} |
|||
if (StrUtil.isNotEmpty(systemId)) { |
|||
queryWrapper.eq("system_id", systemId); // systemId 保持精确匹配
|
|||
} |
|||
if (StrUtil.isNotEmpty(dataTagId)) { |
|||
queryWrapper.eq("data_tag_id", dataTagId); // systemId 保持精确匹配
|
|||
} |
|||
queryWrapper.orderByAsc("sort_order") |
|||
.orderByDesc("create_time"); |
|||
Page<DustValve> page = new Page<DustValve>(pageNo, pageSize); |
|||
IPage<DustValve> pageList = dustValveService.page(page, queryWrapper); |
|||
return Result.ok(pageList); |
|||
} |
|||
|
|||
/** |
|||
* 添加 |
|||
* |
|||
* @param dustValve |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "阀门表-添加") |
|||
@ApiOperation(value = "阀门表-添加", notes = "阀门表-添加") |
|||
@PostMapping(value = "/add") |
|||
public Result<?> add(@RequestBody DustValve dustValve) { |
|||
dustValveService.save(dustValve); |
|||
return Result.ok("添加成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dustValve |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "阀门表-编辑") |
|||
@ApiOperation(value = "阀门表-编辑", notes = "阀门表-编辑") |
|||
@PutMapping(value = "/edit") |
|||
public Result<?> edit(@RequestBody DustValve dustValve) { |
|||
dustValveService.updateById(dustValve); |
|||
return Result.ok("编辑成功!"); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 复制 |
|||
* |
|||
* @param id |
|||
* @param name |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "阀门表-复制") |
|||
@ApiOperation(value = "阀门表-复制", notes = "阀门表-复制") |
|||
@PostMapping(value = "/copy") |
|||
public Result<?> copy(@RequestParam(name = "id", required = true) String id, @RequestParam(name = "name", required = true) String name) { |
|||
DustValve dustValve = dustValveService.getById(id); |
|||
dustValve.setId(IdUtil.fastUUID()); |
|||
dustValve.setName(name); |
|||
dustValveService.save(dustValve); |
|||
return Result.ok("复制成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id删除 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "阀门表-通过id删除") |
|||
@ApiOperation(value = "阀门表-通过id删除", notes = "阀门表-通过id删除") |
|||
@DeleteMapping(value = "/delete") |
|||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|||
dustValveService.removeById(id); |
|||
return Result.ok("删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "阀门表-批量删除") |
|||
@ApiOperation(value = "阀门表-批量删除", notes = "阀门表-批量删除") |
|||
@DeleteMapping(value = "/deleteBatch") |
|||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|||
this.dustValveService.removeByIds(Arrays.asList(ids.split(","))); |
|||
return Result.ok("批量删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id查询 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "阀门表-通过id查询") |
|||
@ApiOperation(value = "阀门表-通过id查询", notes = "阀门表-通过id查询") |
|||
@GetMapping(value = "/queryById") |
|||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|||
DustValve dustValve = dustValveService.getById(id); |
|||
return Result.ok(dustValve); |
|||
} |
|||
|
|||
/** |
|||
* 导出excel |
|||
* |
|||
* @param request |
|||
* @param dustValve |
|||
*/ |
|||
@RequestMapping(value = "/exportXls") |
|||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, DustValve dustValve) { |
|||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
|||
return super.exportXls(request, dustValve, DustValve.class, "阀门表"); |
|||
} |
|||
|
|||
/** |
|||
* 通过excel导入数据 |
|||
* |
|||
* @param request |
|||
* @param response |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|||
public Result<?> importExcel(HttpServletRequest request, |
|||
HttpServletResponse response) { |
|||
try { |
|||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
|||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
|||
|
|||
if (fileMap.isEmpty()) { |
|||
return Result.error("请上传 Excel 文件"); |
|||
} |
|||
|
|||
MultipartFile file = fileMap.values().iterator().next(); |
|||
if (file == null || file.isEmpty()) { |
|||
return Result.error("上传的文件为空"); |
|||
} |
|||
List<DustValve> metaDataValues = new ArrayList<>(); |
|||
List<String> errorList = new ArrayList<>(); |
|||
HashSet<String> set = new HashSet<>(); |
|||
HashSet<String> dataTagSet = new HashSet<>(); |
|||
HashSet<String> nameSet = new HashSet<>(); |
|||
|
|||
List<DustSystem> systemList = dustSystemService.list(); |
|||
Map<String, DustSystem> systemMap = systemList.stream().collect(Collectors.toMap(DustSystem::getName, dustSystem -> dustSystem)); |
|||
|
|||
|
|||
EasyExcelFactory.read(file.getInputStream(), DataValveExcel.class, |
|||
new AnalysisEventListener<DataValveExcel>() { |
|||
@Override |
|||
public void invoke(DataValveExcel rowData, AnalysisContext context) { |
|||
int rowIndex = context.readRowHolder().getRowIndex() + 1; |
|||
|
|||
if (StringUtils.isEmpty(rowData.getSystemName())) { |
|||
errorList.add(String.format("第 %d 行数据不完整:系统名称 为空", rowIndex)); |
|||
return; |
|||
} |
|||
|
|||
if (StringUtils.isEmpty(rowData.getName())) { |
|||
errorList.add(String.format("第 %d 行数据不完整:阀门名称 为空", rowIndex)); |
|||
return; |
|||
} |
|||
if (StringUtils.isEmpty(rowData.getTypeName())) { |
|||
errorList.add(String.format("第 %d 行数据不完整:类型 为空", rowIndex)); |
|||
return; |
|||
} |
|||
|
|||
if (StringUtils.isEmpty(rowData.getDataTag())) { |
|||
errorList.add(String.format("第 %d 行数据不完整:所属点位 为空", rowIndex)); |
|||
return; |
|||
} |
|||
// 检查 dataTag 是否重复
|
|||
String dataTag = rowData.getDataTag(); |
|||
if (!set.add(dataTag + rowData.getSystemName())) { |
|||
errorList.add(String.format("第 %d 行数据重复:数据点位 %s 已存在", rowIndex, dataTag)); |
|||
return; |
|||
} |
|||
|
|||
// 验证 typeName 是否合法
|
|||
Integer valveType; |
|||
try { |
|||
valveType = ValveType.getTypeByName(rowData.getTypeName()); |
|||
} catch (IllegalArgumentException e) { |
|||
errorList.add(String.format("第 %d 行数据无效:类型 %s 不合法,应为 '升关阀' 或 '调节阀'", rowIndex, rowData.getTypeName())); |
|||
return; |
|||
} |
|||
DustValve dustValve = new DustValve(); |
|||
BeanUtil.copyProperties(rowData, dustValve); |
|||
dustValve.setType(valveType); |
|||
DustSystem dustSystem = systemMap.get(rowData.getSystemName().trim()); |
|||
if (dustSystem == null) { |
|||
errorList.add(String.format("第 %d 行数据错误:所属系统 %s 不存在", context.readRowHolder().getRowIndex() + 1, rowData.getSystemName())); |
|||
return; |
|||
} |
|||
dataTagSet.add(dataTag); |
|||
nameSet.add(rowData.getName()); |
|||
dustValve.setSystemId(dustSystem.getId()); |
|||
|
|||
metaDataValues.add(dustValve); |
|||
} |
|||
|
|||
@Override |
|||
public void doAfterAllAnalysed(AnalysisContext context) { |
|||
log.info("所有数据读取完成,共有 " + metaDataValues.size() + " 条数据"); |
|||
} |
|||
}) |
|||
.sheet() |
|||
.doRead(); |
|||
|
|||
if (!errorList.isEmpty()) { |
|||
return Result.error("导入失败,存在以下错误:\n" + String.join("\n", errorList)); |
|||
} |
|||
QueryWrapper<DustDataTag> dataTagQueryWrapper = new QueryWrapper<>(); |
|||
dataTagQueryWrapper.in("name", dataTagSet); |
|||
List<DustDataTag> list = dustDataTagService.list(dataTagQueryWrapper); |
|||
|
|||
Map<String, DustDataTag> collect = list.stream().collect(Collectors.toMap( |
|||
dustDataTag -> dustDataTag.getName() + dustDataTag.getSystemId(), |
|||
Function.identity())); // 值:DustDataTag 对象本身
|
|||
|
|||
QueryWrapper<DustValve> dustValveQueryWrapper = new QueryWrapper<>(); |
|||
dustValveQueryWrapper.in("name", nameSet); |
|||
List<DustValve> valveList = dustValveService.list(dustValveQueryWrapper); |
|||
Map<String, DustValve> valveMap = valveList.stream().collect(Collectors.toMap( |
|||
dustDataTag -> dustDataTag.getName() + dustDataTag.getSystemId(), |
|||
Function.identity())); |
|||
|
|||
|
|||
for (DustValve metaDataValue : metaDataValues) { |
|||
String tag = metaDataValue.getDataTag().trim() + metaDataValue.getSystemId(); |
|||
DustDataTag dustDataTag = collect.get(tag); |
|||
if (dustDataTag != null) { |
|||
metaDataValue.setDataTagId(dustDataTag.getId()); |
|||
} |
|||
|
|||
String valve = metaDataValue.getName().trim() + metaDataValue.getSystemId(); |
|||
DustValve dustValve = valveMap.get(valve); |
|||
if (dustValve != null) { |
|||
metaDataValue.setId(dustValve.getId()); |
|||
} |
|||
} |
|||
dustValveService.saveOrUpdateBatch(metaDataValues); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return Result.error("导入失败:" + e.getMessage()); |
|||
} |
|||
return Result.ok("导入成功"); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,304 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.sys.base.controller.BaseController; |
|||
import cc.admin.common.util.RedisUtil; |
|||
import cc.admin.modules.dust.entity.Pipe; |
|||
import cc.admin.modules.dust.service.IPipeService; |
|||
import cc.admin.modules.dust.service.IRecommendPlanService; |
|||
import cc.admin.modules.dust.vo.DustConfigVo; |
|||
import cc.admin.poi.util.HeaderCell; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; |
|||
import org.apache.poi.ss.usermodel.Row; |
|||
import org.apache.poi.ss.usermodel.Sheet; |
|||
import org.apache.poi.ss.usermodel.Workbook; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.util.*; |
|||
import java.util.function.Function; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import static cc.admin.modules.dust.utils.ExcelUtil.*; |
|||
import static cc.admin.poi.util.ExcelUtil.*; |
|||
|
|||
|
|||
/** |
|||
* @Description: 管道表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "管道表") |
|||
@RestController |
|||
@RequestMapping("/pipe") |
|||
public class PipeController extends BaseController<Pipe, IPipeService> { |
|||
private static final List<HeaderCell> headerCellList = Arrays.asList( |
|||
new HeaderCell(0, 0, "序号"), |
|||
new HeaderCell(0, 1, "管道名称"), |
|||
new HeaderCell(0, 2, "设计风量"), |
|||
new HeaderCell(0, 3, "阀门开度(%)"), |
|||
new HeaderCell(0, 4, "备注") |
|||
); |
|||
@Autowired |
|||
private IPipeService pipeService; |
|||
|
|||
@AutoLog(value = "管道表-分页列表查询") |
|||
@ApiOperation(value = "管道表-分页列表查询", notes = "管道表-分页列表查询") |
|||
@GetMapping(value = "/list") |
|||
public Result<?> queryPageList( |
|||
@RequestParam(name = "key", required = false) String key, |
|||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|||
HttpServletRequest req) { |
|||
QueryWrapper<Pipe> queryWrapper = new QueryWrapper<>(); |
|||
if (StrUtil.isNotEmpty(key)) { |
|||
|
|||
} |
|||
queryWrapper.orderByAsc("sort_order"); |
|||
Page<Pipe> page = new Page<>(pageNo, pageSize); |
|||
IPage<Pipe> pageList = pipeService.page(page, queryWrapper); |
|||
return Result.ok(pageList); |
|||
} |
|||
|
|||
/** |
|||
* 添加 |
|||
* |
|||
* @param pipe |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管道表-添加") |
|||
@ApiOperation(value = "管道表-添加", notes = "管道表-添加") |
|||
@PostMapping(value = "/add") |
|||
public Result<?> add(@RequestBody Pipe pipe) { |
|||
pipeService.savePipe(pipe); |
|||
return Result.ok("添加成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param pipe |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管道表-编辑") |
|||
@ApiOperation(value = "管道表-编辑", notes = "管道表-编辑") |
|||
@PutMapping(value = "/edit") |
|||
public Result<?> edit(@RequestBody Pipe pipe) { |
|||
pipeService.updatePipe(pipe); |
|||
return Result.ok("编辑成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param pipe |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管道表-批量编辑") |
|||
@ApiOperation(value = "管道表-批量编辑", notes = "管道表-批量编辑") |
|||
@PostMapping(value = "/updateByList") |
|||
public Result<?> updateById(@RequestBody Pipe pipe) { |
|||
List<Pipe> list = pipe.getList(); |
|||
|
|||
for (Pipe pipe1 : list) { |
|||
Pipe byId = pipeService.getById(pipe1.getId()); |
|||
if (null != byId && null != byId.getDiameter()){ |
|||
pipe1.setDiameter(byId.getDiameter()); |
|||
} |
|||
} |
|||
pipeService.updateBatchById(list); |
|||
return Result.ok("编辑成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 批量编辑 |
|||
* |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管道表-批量删除") |
|||
@ApiOperation(value = "管道表-批量删除", notes = "管道表-批量删除") |
|||
@DeleteMapping(value = "/deleteBatch") |
|||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|||
this.pipeService.removeByIds(Arrays.asList(ids.split(","))); |
|||
return Result.ok("批量删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id删除 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管道表-通过id删除") |
|||
@ApiOperation(value = "管道表-通过id删除", notes = "管道表-通过id删除") |
|||
@DeleteMapping(value = "/delete") |
|||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|||
pipeService.remove(id); |
|||
return Result.ok("删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id查询 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管道表-通过id查询") |
|||
@ApiOperation(value = "管道表-通过id查询", notes = "管道表-通过id查询") |
|||
@GetMapping(value = "/queryById") |
|||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|||
Pipe pipe = pipeService.getById(id); |
|||
return Result.ok(pipe); |
|||
} |
|||
|
|||
/** |
|||
* 导出excel |
|||
* |
|||
* @param request |
|||
* @param pipe |
|||
*/ |
|||
@RequestMapping(value = "/exportXls") |
|||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, Pipe pipe) { |
|||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
|||
return super.exportXls(request, pipe, Pipe.class, "管道表"); |
|||
} |
|||
|
|||
/** |
|||
* 通过excel导入数据 |
|||
* |
|||
* @param request |
|||
* @param response |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response, |
|||
@RequestParam(name = "designPlanId", required = true) String designPlanId) { |
|||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
|||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
|||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { |
|||
MultipartFile file = entity.getValue();// 获取上传文件对象
|
|||
try { |
|||
List<String> errorList = new ArrayList<>(); // 保存错误提示信息
|
|||
List<DustConfigVo> configVoList = readXls(file.getInputStream(), errorList,designPlanId); |
|||
Map<String, Long> nameCounts = configVoList.stream() |
|||
.map(DustConfigVo::getPipeName) |
|||
.filter(pipeName -> pipeName != null && !pipeName.trim().isEmpty()) |
|||
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); |
|||
boolean hasDuplicates = nameCounts.values().stream().anyMatch(count -> count > 1); |
|||
if (hasDuplicates) { |
|||
return Result.error("导入有重复名称,请检查"); |
|||
} |
|||
DustConfigVo dustConfigVo = configVoList.get(0); |
|||
if (!dustConfigVo.getSerialNumber().equals("0")){ |
|||
return Result.error("父级管道序号必须是0"); |
|||
} |
|||
return pipeService.importList(configVoList, errorList,designPlanId); |
|||
} catch (Exception e) { |
|||
log.error(e.getMessage(), e); |
|||
return Result.error("文件导入失败:" + e.getMessage()); |
|||
} finally { |
|||
try { |
|||
file.getInputStream().close(); |
|||
} catch (IOException e) { |
|||
log.error(e.getMessage(), e); |
|||
} |
|||
} |
|||
} |
|||
return Result.error("文件导入失败!"); |
|||
|
|||
} |
|||
|
|||
private List<DustConfigVo> readXls(InputStream inputStream, List<String> errorList,String designPlanId) throws Exception { |
|||
long start = System.currentTimeMillis(); |
|||
|
|||
Workbook book = getWorkbook(inputStream); |
|||
|
|||
String sheetName = book.getSheetName(0); |
|||
Sheet sheet = book.getSheetAt(0); |
|||
|
|||
// 检查表头格式
|
|||
checkTableHeader(sheet, sheetName, headerCellList); |
|||
// 处理导入对象
|
|||
List<DustConfigVo> recordList = new ArrayList<>(); |
|||
List<String> columnNameList = headerCellList.stream().map(HeaderCell::getTitle).collect(Collectors.toList()); |
|||
|
|||
for (int j = 1; j <= sheet.getLastRowNum(); j++) { |
|||
try { |
|||
log.debug("read row {}", j); |
|||
Row row = sheet.getRow(j); |
|||
int column = 0; |
|||
|
|||
String serialNumber = readCellAsString(row.getCell(column)); |
|||
if (StrUtil.isEmpty(serialNumber)) { |
|||
errorList.add(String.format("第 %d 行%s为空", j + 1, columnNameList.get(column))); |
|||
continue; |
|||
} |
|||
if (serialNumber.contains(".0")) { |
|||
serialNumber = serialNumber.substring(0, serialNumber.indexOf(".0")); |
|||
} |
|||
String pipeName = readCellAsString(row.getCell(++column)); |
|||
Double flow = readCellAsDouble(row.getCell(++column)); |
|||
String valveOpening = readCellAsString(row.getCell(++column)); |
|||
String remark = readCellAsString(row.getCell(++column)); |
|||
DustConfigVo dustConfigVo = new DustConfigVo(); |
|||
dustConfigVo.setId(UUID.randomUUID().toString()); |
|||
dustConfigVo.setDesignPlanId(designPlanId); |
|||
dustConfigVo.setSerialNumber(serialNumber); |
|||
dustConfigVo.setPipeName(pipeName); |
|||
dustConfigVo.setIsCompute(1); |
|||
dustConfigVo.setFlow(flow != null ? flow : 0); |
|||
dustConfigVo.setValveOpening(parseValveOpening(valveOpening)); |
|||
|
|||
dustConfigVo.setSortOrder(j); |
|||
dustConfigVo.setRemark(remark); |
|||
recordList.add(dustConfigVo); |
|||
} catch (Exception e) { |
|||
log.error(e.getMessage(), e); |
|||
e.printStackTrace(); |
|||
errorList.add(String.format("%s第 %d 行数据异常:%s", sheetName, j + 1, e.getMessage())); |
|||
} |
|||
} |
|||
log.info("读excel消耗时间" + (System.currentTimeMillis() - start) + "毫秒"); |
|||
|
|||
return recordList; |
|||
|
|||
} |
|||
private Double parseValveOpening(String valveOpeningStr) { |
|||
if (valveOpeningStr == null || valveOpeningStr.trim().isEmpty()) { |
|||
return 10.0; // 默认值
|
|||
} |
|||
valveOpeningStr = valveOpeningStr.trim(); |
|||
try { |
|||
if (valveOpeningStr.endsWith("%")) { |
|||
valveOpeningStr = valveOpeningStr.substring(0, valveOpeningStr.length() - 1); |
|||
} |
|||
double v = Double.parseDouble(valveOpeningStr); |
|||
if (v <= 1){ |
|||
v = v * 100; |
|||
} |
|||
return v; |
|||
} catch (NumberFormatException e) { |
|||
log.warn("无法解析阀门开度 '{}', 使用默认值 10.0", valveOpeningStr); |
|||
return 10.0; // 默认值
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,161 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.sys.base.controller.BaseController; |
|||
import cc.admin.common.sys.query.QueryGenerator; |
|||
import cc.admin.modules.dust.entity.PipeDiameterThickness; |
|||
import cc.admin.modules.dust.service.IPipeDiameterThicknessService; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.Arrays; |
|||
|
|||
/** |
|||
* @Description: 管径壁厚对应表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "管径壁厚对应表") |
|||
@RestController |
|||
@RequestMapping("/pipe/diameterThickness") |
|||
public class PipeDiameterThicknessController extends BaseController<PipeDiameterThickness, IPipeDiameterThicknessService> { |
|||
@Autowired |
|||
private IPipeDiameterThicknessService pipeDiameterThicknessService; |
|||
|
|||
/** |
|||
* 分页列表查询 |
|||
* |
|||
* @param key |
|||
* @param pageNo |
|||
* @param pageSize |
|||
* @param req |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管径壁厚对应表-分页列表查询") |
|||
@ApiOperation(value = "管径壁厚对应表-分页列表查询", notes = "管径壁厚对应表-分页列表查询") |
|||
@GetMapping(value = "/list") |
|||
public Result<?> queryPageList( |
|||
@RequestParam(name = "key", required = false) String key, |
|||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|||
HttpServletRequest req) { |
|||
QueryWrapper<PipeDiameterThickness> queryWrapper = QueryGenerator.initQueryWrapper(new PipeDiameterThickness(), req.getParameterMap()); |
|||
if (StrUtil.isNotEmpty(key)) { |
|||
|
|||
} |
|||
|
|||
Page<PipeDiameterThickness> page = new Page<PipeDiameterThickness>(pageNo, pageSize); |
|||
IPage<PipeDiameterThickness> pageList = pipeDiameterThicknessService.page(page, queryWrapper); |
|||
return Result.ok(pageList); |
|||
} |
|||
|
|||
/** |
|||
* 添加 |
|||
* |
|||
* @param pipeDiameterThickness |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管径壁厚对应表-添加") |
|||
@ApiOperation(value = "管径壁厚对应表-添加", notes = "管径壁厚对应表-添加") |
|||
@PostMapping(value = "/add") |
|||
public Result<?> add(@RequestBody PipeDiameterThickness pipeDiameterThickness) { |
|||
pipeDiameterThicknessService.save(pipeDiameterThickness); |
|||
return Result.ok("添加成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param pipeDiameterThickness |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管径壁厚对应表-编辑") |
|||
@ApiOperation(value = "管径壁厚对应表-编辑", notes = "管径壁厚对应表-编辑") |
|||
@PutMapping(value = "/edit") |
|||
public Result<?> edit(@RequestBody PipeDiameterThickness pipeDiameterThickness) { |
|||
pipeDiameterThicknessService.updateById(pipeDiameterThickness); |
|||
return Result.ok("编辑成功!"); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 通过id删除 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管径壁厚对应表-通过id删除") |
|||
@ApiOperation(value = "管径壁厚对应表-通过id删除", notes = "管径壁厚对应表-通过id删除") |
|||
@DeleteMapping(value = "/delete") |
|||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|||
pipeDiameterThicknessService.removeById(id); |
|||
return Result.ok("删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管径壁厚对应表-批量删除") |
|||
@ApiOperation(value = "管径壁厚对应表-批量删除", notes = "管径壁厚对应表-批量删除") |
|||
@DeleteMapping(value = "/deleteBatch") |
|||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|||
this.pipeDiameterThicknessService.removeByIds(Arrays.asList(ids.split(","))); |
|||
return Result.ok("批量删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id查询 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "管径壁厚对应表-通过id查询") |
|||
@ApiOperation(value = "管径壁厚对应表-通过id查询", notes = "管径壁厚对应表-通过id查询") |
|||
@GetMapping(value = "/queryById") |
|||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|||
PipeDiameterThickness pipeDiameterThickness = pipeDiameterThicknessService.getById(id); |
|||
return Result.ok(pipeDiameterThickness); |
|||
} |
|||
|
|||
/** |
|||
* 导出excel |
|||
* |
|||
* @param request |
|||
* @param pipeDiameterThickness |
|||
*/ |
|||
@RequestMapping(value = "/exportXls") |
|||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, PipeDiameterThickness pipeDiameterThickness) { |
|||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
|||
return super.exportXls(request, pipeDiameterThickness, PipeDiameterThickness.class, "管径壁厚对应表"); |
|||
} |
|||
|
|||
/** |
|||
* 通过excel导入数据 |
|||
* |
|||
* @param request |
|||
* @param response |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
|||
return super.importExcel(request, response, PipeDiameterThickness.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,156 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.sys.base.controller.BaseController; |
|||
import cc.admin.common.sys.query.QueryGenerator; |
|||
import cc.admin.modules.dust.entity.Pipe; |
|||
import cc.admin.modules.dust.entity.RecommendPlan; |
|||
import cc.admin.modules.dust.entity.RecommendPlanPipeConfig; |
|||
import cc.admin.modules.dust.service.IPipeService; |
|||
import cc.admin.modules.dust.service.IRecommendPlanService; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.collections.CollectionUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.sql.Array; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Description: 推荐方案表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "推荐方案表") |
|||
@RestController |
|||
@RequestMapping("/recommend/plan") |
|||
public class RecommendPlanController extends BaseController<RecommendPlan, IRecommendPlanService> { |
|||
@Autowired |
|||
private IRecommendPlanService recommendPlanService; |
|||
@Autowired |
|||
private IPipeService iPipeService; |
|||
|
|||
/** |
|||
* 添加 |
|||
* |
|||
* @param recommendPlan |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "推荐方案表-添加") |
|||
@ApiOperation(value = "推荐方案表-添加", notes = "推荐方案表-添加") |
|||
@PostMapping(value = "/add") |
|||
public Result<?> add(@RequestBody RecommendPlan recommendPlan) { |
|||
recommendPlanService.save(recommendPlan); |
|||
return Result.ok("添加成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param recommendPlan |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "推荐方案表-编辑") |
|||
@ApiOperation(value = "推荐方案表-编辑", notes = "推荐方案表-编辑") |
|||
@PutMapping(value = "/edit") |
|||
public Result<?> edit(@RequestBody RecommendPlan recommendPlan) { |
|||
recommendPlanService.updateById(recommendPlan); |
|||
return Result.ok("编辑成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "推荐方案表-批量删除") |
|||
@ApiOperation(value = "推荐方案表-批量删除", notes = "推荐方案表-批量删除") |
|||
@DeleteMapping(value = "/deleteByDesignPlanId") |
|||
public Result<?> deleteByDesignPlanId(@RequestParam(name = "designPlanId", required = true) String designPlanId) { |
|||
QueryWrapper<RecommendPlan> objectQueryWrapper = new QueryWrapper<>(); |
|||
objectQueryWrapper.eq("design_plan_id", designPlanId); |
|||
recommendPlanService.deleteByDesignPlanId(designPlanId); |
|||
return Result.ok("批量删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id删除 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "推荐方案表-通过id删除") |
|||
@ApiOperation(value = "推荐方案表-通过id删除", notes = "推荐方案表-通过id删除") |
|||
@DeleteMapping(value = "/delete") |
|||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|||
recommendPlanService.removeById(id); |
|||
return Result.ok("删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "推荐方案表-批量删除") |
|||
@ApiOperation(value = "推荐方案表-批量删除", notes = "推荐方案表-批量删除") |
|||
@DeleteMapping(value = "/deleteBatch") |
|||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|||
this.recommendPlanService.removeByIds(Arrays.asList(ids.split(","))); |
|||
return Result.ok("批量删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id查询 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "推荐方案表-通过id查询") |
|||
@ApiOperation(value = "推荐方案表-通过id查询", notes = "推荐方案表-通过id查询") |
|||
@GetMapping(value = "/queryById") |
|||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|||
RecommendPlan recommendPlan = recommendPlanService.getById(id); |
|||
return Result.ok(recommendPlan); |
|||
} |
|||
|
|||
/** |
|||
* 导出excel |
|||
* |
|||
* @param request |
|||
* @param recommendPlan |
|||
*/ |
|||
@RequestMapping(value = "/exportXls") |
|||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, RecommendPlan recommendPlan) { |
|||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
|||
return super.exportXls(request, recommendPlan, RecommendPlan.class, "推荐方案表"); |
|||
} |
|||
|
|||
/** |
|||
* 通过excel导入数据 |
|||
* |
|||
* @param request |
|||
* @param response |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
|||
return super.importExcel(request, response, RecommendPlan.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,162 @@ |
|||
package cc.admin.modules.dust.controller; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.aspect.annotation.AutoLog; |
|||
import cc.admin.common.sys.base.controller.BaseController; |
|||
import cc.admin.common.sys.query.QueryGenerator; |
|||
import cc.admin.modules.dust.entity.WindSpeedColor; |
|||
import cc.admin.modules.dust.service.IWindSpeedColorService; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.Arrays; |
|||
|
|||
/** |
|||
* @Description: 风速颜色表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-01-09 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags="风速颜色表") |
|||
@RestController |
|||
@RequestMapping("/wind/speedColor") |
|||
public class WindSpeedColorController extends BaseController<WindSpeedColor, IWindSpeedColorService> { |
|||
@Autowired |
|||
private IWindSpeedColorService windSpeedColorService; |
|||
|
|||
/** |
|||
* 分页列表查询 |
|||
* |
|||
* @param key |
|||
* @param pageNo |
|||
* @param pageSize |
|||
* @param req |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "风速颜色表-分页列表查询") |
|||
@ApiOperation(value="风速颜色表-分页列表查询", notes="风速颜色表-分页列表查询") |
|||
@GetMapping(value = "/list") |
|||
public Result<?> queryPageList( |
|||
@RequestParam(name="key",required = false) String key, |
|||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
|||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
|||
HttpServletRequest req) { |
|||
QueryWrapper<WindSpeedColor> queryWrapper = QueryGenerator.initQueryWrapper(new WindSpeedColor(), req.getParameterMap()); |
|||
if (StrUtil.isNotEmpty(key)) { |
|||
|
|||
} |
|||
|
|||
Page<WindSpeedColor> page = new Page<WindSpeedColor>(pageNo, pageSize); |
|||
IPage<WindSpeedColor> pageList = windSpeedColorService.page(page, queryWrapper); |
|||
return Result.ok(pageList); |
|||
} |
|||
|
|||
/** |
|||
* 添加 |
|||
* |
|||
* @param windSpeedColor |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "风速颜色表-添加") |
|||
@ApiOperation(value="风速颜色表-添加", notes="风速颜色表-添加") |
|||
@PostMapping(value = "/add") |
|||
public Result<?> add(@RequestBody WindSpeedColor windSpeedColor) { |
|||
windSpeedColorService.save(windSpeedColor); |
|||
return Result.ok("添加成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param windSpeedColor |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "风速颜色表-编辑") |
|||
@ApiOperation(value="风速颜色表-编辑", notes="风速颜色表-编辑") |
|||
@PutMapping(value = "/edit") |
|||
public Result<?> edit(@RequestBody WindSpeedColor windSpeedColor) { |
|||
windSpeedColorService.updateById(windSpeedColor); |
|||
return Result.ok("编辑成功!"); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 通过id删除 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "风速颜色表-通过id删除") |
|||
@ApiOperation(value="风速颜色表-通过id删除", notes="风速颜色表-通过id删除") |
|||
@DeleteMapping(value = "/delete") |
|||
public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
|||
windSpeedColorService.removeById(id); |
|||
return Result.ok("删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "风速颜色表-批量删除") |
|||
@ApiOperation(value="风速颜色表-批量删除", notes="风速颜色表-批量删除") |
|||
@DeleteMapping(value = "/deleteBatch") |
|||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
|||
this.windSpeedColorService.removeByIds(Arrays.asList(ids.split(","))); |
|||
return Result.ok("批量删除成功!"); |
|||
} |
|||
|
|||
/** |
|||
* 通过id查询 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@AutoLog(value = "风速颜色表-通过id查询") |
|||
@ApiOperation(value="风速颜色表-通过id查询", notes="风速颜色表-通过id查询") |
|||
@GetMapping(value = "/queryById") |
|||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
|||
WindSpeedColor windSpeedColor = windSpeedColorService.getById(id); |
|||
return Result.ok(windSpeedColor); |
|||
} |
|||
|
|||
/** |
|||
* 导出excel |
|||
* |
|||
* @param request |
|||
* @param windSpeedColor |
|||
*/ |
|||
@RequestMapping(value = "/exportXls") |
|||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, WindSpeedColor windSpeedColor) { |
|||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
|||
return super.exportXls(request, windSpeedColor, WindSpeedColor.class, "风速颜色表"); |
|||
} |
|||
|
|||
/** |
|||
* 通过excel导入数据 |
|||
* |
|||
* @param request |
|||
* @param response |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
|||
return super.importExcel(request, response, WindSpeedColor.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,84 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import cc.admin.common.aspect.annotation.Dict; |
|||
|
|||
/** |
|||
* @Description: 设计方案表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
@TableName("design_plan") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@ApiModel(value="design_plan对象", description="设计方案表") |
|||
public class DesignPlan { |
|||
|
|||
/**主键ID*/ |
|||
@Excel(name = "主键ID", width = 15) |
|||
@ApiModelProperty(value = "主键ID") |
|||
private String id; |
|||
/**主键ID*/ |
|||
@Excel(name = "管道配置id", width = 15) |
|||
@ApiModelProperty(value = "管道配置id") |
|||
private String pipeDiameterId; |
|||
@Excel(name = "方案名称", width = 15) |
|||
@ApiModelProperty(value = "方案名称") |
|||
private String name; |
|||
/**总管风量*/ |
|||
@Excel(name = "总管风量", width = 15) |
|||
@ApiModelProperty(value = "总管风量") |
|||
private String totalFlow; |
|||
/**排序*/ |
|||
@Excel(name = "排序", width = 15) |
|||
@ApiModelProperty(value = "排序") |
|||
private Integer sortOrder; |
|||
/**备注*/ |
|||
@Excel(name = "备注", width = 15) |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
|
|||
/**删除状态(0-正常,1-已删除)*/ |
|||
@Excel(name = "方案标识位", width = 15) |
|||
@ApiModelProperty(value = "方案标识位") |
|||
private Integer planFlag; |
|||
|
|||
/**删除状态(0-正常,1-已删除)*/ |
|||
@Excel(name = "删除状态(0-正常,1-已删除)", width = 15) |
|||
@ApiModelProperty(value = "删除状态(0-正常,1-已删除)") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/**创建人*/ |
|||
@Excel(name = "创建人", width = 15) |
|||
@ApiModelProperty(value = "创建人") |
|||
private String createBy; |
|||
/**创建时间*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/**更新人*/ |
|||
@Excel(name = "更新人", width = 15) |
|||
@ApiModelProperty(value = "更新人") |
|||
private String updateBy; |
|||
/**更新时间*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
|
|||
@TableField(exist = false) |
|||
private List<String> pipeIdList; |
|||
} |
@ -0,0 +1,75 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import cc.admin.common.aspect.annotation.Dict; |
|||
|
|||
/** |
|||
* @Description: 警报记录表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
@TableName("dust_alarm") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@ApiModel(value="dust_alarm对象", description="警报记录表") |
|||
public class DustAlarm { |
|||
|
|||
/**主键ID*/ |
|||
@Excel(name = "主键ID", width = 15) |
|||
@ApiModelProperty(value = "主键ID") |
|||
private String id; |
|||
/**所属系统*/ |
|||
@Excel(name = "所属系统", width = 15) |
|||
@ApiModelProperty(value = "所属系统") |
|||
private String systemId; |
|||
/**警报时间*/ |
|||
@Excel(name = "警报时间", width = 15) |
|||
@ApiModelProperty(value = "警报时间") |
|||
private Date startTime; |
|||
/**警报结束时间*/ |
|||
@Excel(name = "警报结束时间", width = 15) |
|||
@ApiModelProperty(value = "警报结束时间") |
|||
private Date endTime; |
|||
/**警报内容*/ |
|||
@Excel(name = "警报内容", width = 15) |
|||
@ApiModelProperty(value = "警报内容") |
|||
private String alarmContent; |
|||
/**备注*/ |
|||
@Excel(name = "备注", width = 15) |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
/**删除标志*/ |
|||
@Excel(name = "删除标志", width = 15) |
|||
@ApiModelProperty(value = "删除标志") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/**创建时间*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/**创建人*/ |
|||
@Excel(name = "创建人", width = 15) |
|||
@ApiModelProperty(value = "创建人") |
|||
private String createBy; |
|||
/**更新时间*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
/**更新人*/ |
|||
@Excel(name = "更新人", width = 15) |
|||
@ApiModelProperty(value = "更新人") |
|||
private String updateBy; |
|||
} |
@ -0,0 +1,76 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import cc.admin.common.aspect.annotation.Dict; |
|||
|
|||
/** |
|||
* @Description: 数据点位表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
@TableName("dust_data_tag") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@ApiModel(value="dust_data_tag对象", description="数据点位表") |
|||
public class DustDataTag { |
|||
|
|||
/**主键ID*/ |
|||
@Excel(name = "主键ID", width = 15) |
|||
@ApiModelProperty(value = "主键ID") |
|||
private String id; |
|||
/**名称*/ |
|||
@Excel(name = "除尘系统id", width = 15) |
|||
@ApiModelProperty(value = "除尘系统id") |
|||
private String systemId; |
|||
|
|||
/**名称*/ |
|||
@Excel(name = "名称", width = 15) |
|||
@ApiModelProperty(value = "名称") |
|||
private String name; |
|||
/**数据点位*/ |
|||
@Excel(name = "数据点位", width = 15) |
|||
@ApiModelProperty(value = "数据点位") |
|||
private String dataTag; |
|||
/**排序*/ |
|||
@Excel(name = "排序", width = 15) |
|||
@ApiModelProperty(value = "排序") |
|||
private Integer sortOrder; |
|||
/**备注*/ |
|||
@Excel(name = "备注", width = 15) |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
/**删除标志*/ |
|||
@Excel(name = "删除标志", width = 15) |
|||
@ApiModelProperty(value = "删除标志") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/**创建时间*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/**创建人*/ |
|||
@Excel(name = "创建人", width = 15) |
|||
@ApiModelProperty(value = "创建人") |
|||
private String createBy; |
|||
/**更新时间*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
/**更新人*/ |
|||
@Excel(name = "更新人", width = 15) |
|||
@ApiModelProperty(value = "更新人") |
|||
private String updateBy; |
|||
} |
@ -0,0 +1,102 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import cc.admin.common.aspect.annotation.Dict; |
|||
|
|||
/** |
|||
* @Description: 大屏监控项表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
@TableName("dust_monitor_item") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@ApiModel(value="dust_monitor_item对象", description="大屏监控项表") |
|||
public class DustMonitorItem { |
|||
|
|||
/**主键ID*/ |
|||
@Excel(name = "主键ID", width = 15) |
|||
@ApiModelProperty(value = "主键ID") |
|||
private String id; |
|||
/**所属系统*/ |
|||
@Excel(name = "所属系统", width = 15) |
|||
@ApiModelProperty(value = "所属系统") |
|||
private String systemId; |
|||
/**入口压力数据点位*/ |
|||
@Excel(name = "除尘器进口压力", width = 15) |
|||
@ApiModelProperty(value = "除尘器进口压力") |
|||
private String inletPressureDataTagId; |
|||
|
|||
/**出口压力数据点位*/ |
|||
@Excel(name = "除尘器出口压力", width = 15) |
|||
@ApiModelProperty(value = "除尘器出口压力") |
|||
private String outletPressureDataTagId; |
|||
|
|||
/**除尘器进出口压差(pa)*/ |
|||
@Excel(name = "除尘器进出口压差(pa)", width = 15) |
|||
@ApiModelProperty(value = "除尘器进出口压差(pa)") |
|||
private String pressureDifferenceId; |
|||
|
|||
/**风机速度*/ |
|||
@Excel(name = "风机速度", width = 15) |
|||
@ApiModelProperty(value = "风机速度") |
|||
private String fanSpeedDataTagId; |
|||
/**电机电流*/ |
|||
@Excel(name = "电机电流", width = 15) |
|||
@ApiModelProperty(value = "电机电流") |
|||
private String motorCurrentDataTagId; |
|||
/**烟囱CEMS风量*/ |
|||
@Excel(name = "烟囱CEMS风量", width = 15) |
|||
@ApiModelProperty(value = "烟囱CEMS风量") |
|||
private String cemsAirVolumeDataTagId; |
|||
/**粉尘浓度*/ |
|||
@Excel(name = "粉尘浓度", width = 15) |
|||
@ApiModelProperty(value = "粉尘浓度") |
|||
private String dustConcentrationDataTagId; |
|||
/**风机运行状态*/ |
|||
@Excel(name = "风机运行状态", width = 15) |
|||
@ApiModelProperty(value = "风机运行状态") |
|||
private String fanStatusDataTagId; |
|||
/**排序*/ |
|||
@Excel(name = "排序", width = 15) |
|||
@ApiModelProperty(value = "排序") |
|||
private Integer sortOrder; |
|||
/**备注*/ |
|||
@Excel(name = "备注", width = 15) |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
/**删除标志*/ |
|||
@Excel(name = "删除标志", width = 15) |
|||
@ApiModelProperty(value = "删除标志") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/**创建时间*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/**创建人*/ |
|||
@Excel(name = "创建人", width = 15) |
|||
@ApiModelProperty(value = "创建人") |
|||
private String createBy; |
|||
/**更新时间*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
/**更新人*/ |
|||
@Excel(name = "更新人", width = 15) |
|||
@ApiModelProperty(value = "更新人") |
|||
private String updateBy; |
|||
} |
@ -0,0 +1,99 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import cc.admin.common.aspect.annotation.Dict; |
|||
|
|||
/** |
|||
* @Description: 大屏阀门监控表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
@TableName("dust_monitor_valve") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@ApiModel(value = "dust_monitor_valve对象", description = "大屏阀门监控表") |
|||
public class DustMonitorValve { |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
@Excel(name = "主键ID", width = 15) |
|||
@ApiModelProperty(value = "主键ID") |
|||
private String id; |
|||
/** |
|||
* 阀门ID |
|||
*/ |
|||
@Excel(name = "阀门ID", width = 15) |
|||
@ApiModelProperty(value = "阀门ID") |
|||
private String valveId; |
|||
/** |
|||
* 数据点位 |
|||
*/ |
|||
@Excel(name = "数据点位", width = 15) |
|||
@ApiModelProperty(value = "数据点位") |
|||
private String dataTagId; |
|||
/** |
|||
* 排序 |
|||
*/ |
|||
@Excel(name = "排序", width = 15) |
|||
@ApiModelProperty(value = "排序") |
|||
private Integer sortOrder; |
|||
/** |
|||
* 备注 |
|||
*/ |
|||
@Excel(name = "备注", width = 15) |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
/** |
|||
* 删除标志 |
|||
*/ |
|||
@Excel(name = "删除标志", width = 15) |
|||
@ApiModelProperty(value = "删除标志") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
@Excel(name = "创建人", width = 15) |
|||
@ApiModelProperty(value = "创建人") |
|||
private String createBy; |
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
@Excel(name = "更新人", width = 15) |
|||
@ApiModelProperty(value = "更新人") |
|||
private String updateBy; |
|||
|
|||
@ApiModelProperty(value = "所属系统") |
|||
@TableField(exist = false) |
|||
private String systemId; |
|||
|
|||
@ApiModelProperty(value = "状态") |
|||
@TableField(exist = false) |
|||
private Integer status; |
|||
} |
@ -0,0 +1,67 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import cc.admin.common.aspect.annotation.Dict; |
|||
|
|||
/** |
|||
* @Description: 除尘系统表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
@TableName("dust_system") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@ApiModel(value="dust_system对象", description="除尘系统表") |
|||
public class DustSystem { |
|||
|
|||
/**主键ID*/ |
|||
@Excel(name = "主键ID", width = 15) |
|||
@ApiModelProperty(value = "主键ID") |
|||
private String id; |
|||
/**名称*/ |
|||
@Excel(name = "名称", width = 15) |
|||
@ApiModelProperty(value = "名称") |
|||
private String name; |
|||
/**排序*/ |
|||
@Excel(name = "排序", width = 15) |
|||
@ApiModelProperty(value = "排序") |
|||
private Integer sortOrder; |
|||
/**备注*/ |
|||
@Excel(name = "备注", width = 15) |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
/**删除标志*/ |
|||
@Excel(name = "删除标志", width = 15) |
|||
@ApiModelProperty(value = "删除标志") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/**创建时间*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/**创建人*/ |
|||
@Excel(name = "创建人", width = 15) |
|||
@ApiModelProperty(value = "创建人") |
|||
private String createBy; |
|||
/**更新时间*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
/**更新人*/ |
|||
@Excel(name = "更新人", width = 15) |
|||
@ApiModelProperty(value = "更新人") |
|||
private String updateBy; |
|||
} |
@ -0,0 +1,95 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import cc.admin.common.aspect.annotation.Dict; |
|||
|
|||
/** |
|||
* @Description: 阀门表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
@TableName("dust_valve") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@ApiModel(value="dust_valve对象", description="阀门表") |
|||
public class DustValve { |
|||
|
|||
/**主键ID*/ |
|||
@Excel(name = "主键ID", width = 15) |
|||
@ApiModelProperty(value = "主键ID") |
|||
private String id; |
|||
/**所属系统*/ |
|||
@Excel(name = "所属系统", width = 15) |
|||
@ApiModelProperty(value = "所属系统") |
|||
private String systemId; |
|||
@TableField(exist = false) |
|||
private String systemName; |
|||
/**数据点位*/ |
|||
@Excel(name = "数据点位", width = 15) |
|||
@ApiModelProperty(value = "数据点位") |
|||
private String dataTagId; |
|||
@TableField(exist = false) |
|||
private String dataTag; |
|||
/**阀门名称*/ |
|||
@Excel(name = "阀门", width = 15) |
|||
@ApiModelProperty(value = "阀门") |
|||
private String name; |
|||
/**类型 (0: 升关阀, 1: 调节阀)*/ |
|||
@Excel(name = "类型 (0: 升关阀, 1: 调节阀)", width = 15) |
|||
@ApiModelProperty(value = "类型 (0: 升关阀, 1: 调节阀)") |
|||
private Integer type; |
|||
/**阀门位置*/ |
|||
@Excel(name = "除尘部位", width = 15) |
|||
@ApiModelProperty(value = "除尘部位") |
|||
private String location; |
|||
/**阀门参数*/ |
|||
@Excel(name = "阀门参数", width = 15) |
|||
@ApiModelProperty(value = "阀门参数") |
|||
private String parameter; |
|||
/**排序*/ |
|||
@Excel(name = "排序", width = 15) |
|||
@ApiModelProperty(value = "排序") |
|||
private Integer sortOrder; |
|||
/**备注*/ |
|||
@Excel(name = "备注", width = 15) |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
/**删除标志*/ |
|||
@Excel(name = "删除标志", width = 15) |
|||
@ApiModelProperty(value = "删除标志") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/**创建时间*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/**创建人*/ |
|||
@Excel(name = "创建人", width = 15) |
|||
@ApiModelProperty(value = "创建人") |
|||
private String createBy; |
|||
/**更新时间*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
/**更新人*/ |
|||
@Excel(name = "更新人", width = 15) |
|||
@ApiModelProperty(value = "更新人") |
|||
private String updateBy; |
|||
|
|||
@ApiModelProperty(value = "状态") |
|||
@TableField(exist = false) |
|||
private Integer status; |
|||
} |
@ -0,0 +1,190 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
|
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import com.baomidou.mybatisplus.annotation.FieldStrategy; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableLogic; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 管道表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
@TableName("pipe") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@ApiModel(value = "pipe对象", description = "管道表") |
|||
@JsonIgnoreProperties(ignoreUnknown = true) |
|||
public class Pipe { |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
@Excel(name = "主键ID", width = 15) |
|||
@ApiModelProperty(value = "主键ID") |
|||
private String id; |
|||
/** |
|||
* 父管道ID |
|||
*/ |
|||
@Excel(name = "父管道ID", width = 15) |
|||
@ApiModelProperty(value = "父管道ID") |
|||
private String parentId; |
|||
|
|||
/** |
|||
* 父管道ID |
|||
*/ |
|||
@Excel(name = "计划方案ID", width = 15) |
|||
@ApiModelProperty(value = "计划方案ID") |
|||
private String designPlanId; |
|||
|
|||
|
|||
/** |
|||
* 管道名称 |
|||
*/ |
|||
@Excel(name = "管道名称", width = 15) |
|||
@ApiModelProperty(value = "管道名称") |
|||
private String name; |
|||
/** |
|||
* 设计风量 |
|||
*/ |
|||
@Excel(name = "设计风量", width = 15) |
|||
@ApiModelProperty(value = "设计风量") |
|||
private Double flow; |
|||
//管道风量
|
|||
@TableField(exist = false) |
|||
private Double pipeFlow; |
|||
//开度
|
|||
@Excel(name = "节点阀门打开度", width = 15) |
|||
@ApiModelProperty(value = "节点阀门打开度") |
|||
private Double valveOpening; |
|||
//开度
|
|||
@Excel(name = "推荐方案节点阀门打开度(%)", width = 15) |
|||
@ApiModelProperty(value = "推荐方案节点阀门打开度(%)") |
|||
private Double recommendValveOpening; |
|||
//开度
|
|||
@Excel(name = "实际生产阀门打开度(%)", width = 15) |
|||
@ApiModelProperty(value = "实际生产阀门打开度(%)") |
|||
private Double productionValveOpening; |
|||
//开度
|
|||
@Excel(name = "自定义开度(%)", width = 15) |
|||
@ApiModelProperty(value = "自定义开度(%)") |
|||
private Double customValveOpening; |
|||
/** |
|||
* 所属分组 |
|||
*/ |
|||
@Excel(name = "所属分组", width = 15) |
|||
@ApiModelProperty(value = "所属分组") |
|||
private String groupName; |
|||
|
|||
@Excel(name = "选择管径", width = 15) |
|||
@ApiModelProperty(value = "选择管径") |
|||
@TableField(strategy = FieldStrategy.IGNORED) |
|||
private Double diameter; |
|||
//管道内径
|
|||
@TableField(exist = false) |
|||
private Double pipeDiameter; |
|||
//计算管道内径
|
|||
@TableField(exist = false) |
|||
private Double computeDiameter; |
|||
/** |
|||
* 壁厚 |
|||
*/ |
|||
@Excel(name = "壁厚", width = 15) |
|||
@ApiModelProperty(value = "壁厚") |
|||
private Double thickness; |
|||
/** |
|||
* 是否除尘节点(0-否,1-是) |
|||
*/ |
|||
@Excel(name = "是否除尘节点(0-否,1-是)", width = 15) |
|||
@ApiModelProperty(value = "是否除尘节点(0-否,1-是)") |
|||
private Integer isLeaf; |
|||
|
|||
/** |
|||
* 是否除尘节点(0-否,1-是) |
|||
*/ |
|||
@Excel(name = "是否加入推荐方案计算(0-否,1-是)", width = 15) |
|||
@ApiModelProperty(value = "是否加入推荐方案计算(0-否,1-是)") |
|||
private Integer isCompute; |
|||
|
|||
/** |
|||
* 是否除尘节点(0-否,1-是) |
|||
*/ |
|||
@Excel(name = "是否常开(0-否,1-是)", width = 15) |
|||
@ApiModelProperty(value = "是否常开(0-否,1-是)") |
|||
private Integer isNormallyOpen; |
|||
/** |
|||
* 排序 |
|||
*/ |
|||
@Excel(name = "排序", width = 15) |
|||
@ApiModelProperty(value = "排序") |
|||
private Integer sortOrder; |
|||
/** |
|||
* 备注 |
|||
*/ |
|||
@Excel(name = "备注", width = 15) |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
/** |
|||
* 删除状态(0-正常,1-已删除) |
|||
*/ |
|||
@Excel(name = "删除状态(0-正常,1-已删除)", width = 15) |
|||
@ApiModelProperty(value = "删除状态(0-正常,1-已删除)") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
@Excel(name = "创建人", width = 15) |
|||
@ApiModelProperty(value = "创建人") |
|||
private String createBy; |
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
@Excel(name = "更新人", width = 15) |
|||
@ApiModelProperty(value = "更新人") |
|||
private String updateBy; |
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
@Excel(name = "风速", width = 15) |
|||
@ApiModelProperty(value = "风速") |
|||
private double windSpeed; |
|||
|
|||
//---------------------
|
|||
|
|||
@TableField(exist = false) |
|||
private double branchPipeFlow;//支管风量
|
|||
@TableField(exist = false) |
|||
private double totalPipeFlow;//总管风量
|
|||
@TableField(exist = false) |
|||
private double totalWindSpeed;//总管风速
|
|||
@TableField(exist = false) |
|||
private List<Pipe> list; |
|||
@TableField(exist = false) |
|||
private List<Pipe> children = new ArrayList<>();// 初始化为一个空列表
|
|||
@TableField(exist = false) |
|||
private double area;//面积
|
|||
} |
@ -0,0 +1,71 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import cc.admin.common.aspect.annotation.Dict; |
|||
|
|||
/** |
|||
* @Description: 管径壁厚对应表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
@TableName("pipe_diameter_thickness") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@ApiModel(value="pipe_diameter_thickness对象", description="管径壁厚对应表") |
|||
public class PipeDiameterThickness { |
|||
|
|||
/**主键ID*/ |
|||
@Excel(name = "主键ID", width = 15) |
|||
@ApiModelProperty(value = "主键ID") |
|||
private String id; |
|||
/**主键ID*/ |
|||
@Excel(name = "名称", width = 15) |
|||
@ApiModelProperty(value = "名称") |
|||
private String name; |
|||
/**管道内径*/ |
|||
@Excel(name = "管道内径(逗号分割)", width = 15) |
|||
@ApiModelProperty(value = "管道内径(逗号分割)") |
|||
private String diameter; |
|||
/**排序*/ |
|||
@Excel(name = "排序", width = 15) |
|||
@ApiModelProperty(value = "排序") |
|||
private Integer sortOrder; |
|||
/**备注*/ |
|||
@Excel(name = "备注", width = 15) |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
/**删除状态(0-正常,1-已删除)*/ |
|||
@Excel(name = "删除状态(0-正常,1-已删除)", width = 15) |
|||
@ApiModelProperty(value = "删除状态(0-正常,1-已删除)") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/**创建人*/ |
|||
@Excel(name = "创建人", width = 15) |
|||
@ApiModelProperty(value = "创建人") |
|||
private String createBy; |
|||
/**创建时间*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/**更新人*/ |
|||
@Excel(name = "更新人", width = 15) |
|||
@ApiModelProperty(value = "更新人") |
|||
private String updateBy; |
|||
/**更新时间*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
} |
@ -0,0 +1,93 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import cc.admin.common.aspect.annotation.Dict; |
|||
|
|||
/** |
|||
* @Description: 推荐方案表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
@TableName("recommend_plan") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@ApiModel(value="recommend_plan对象", description="推荐方案表") |
|||
public class RecommendPlan { |
|||
|
|||
/**主键ID*/ |
|||
@Excel(name = "主键ID", width = 15) |
|||
@ApiModelProperty(value = "主键ID") |
|||
private String id; |
|||
/**关联的设计方案ID*/ |
|||
@Excel(name = "关联的设计方案ID", width = 15) |
|||
@ApiModelProperty(value = "关联的设计方案ID") |
|||
private String designPlanId; |
|||
/**推荐方案名称*/ |
|||
@Excel(name = "推荐方案名称", width = 15) |
|||
@ApiModelProperty(value = "推荐方案名称") |
|||
private String name; |
|||
/**总管风量*/ |
|||
@Excel(name = "总管风量", width = 15) |
|||
@ApiModelProperty(value = "总管风量") |
|||
private Double flow; |
|||
/**总管风量*/ |
|||
@Excel(name = "最小速度", width = 15) |
|||
@ApiModelProperty(value = "最小速度") |
|||
private Double minSpeed; |
|||
/**总管风量*/ |
|||
@Excel(name = "最大速度", width = 15) |
|||
@ApiModelProperty(value = "最大速度") |
|||
private Double maxSpeed; |
|||
/**总管风量*/ |
|||
@Excel(name = "管道ids", width = 15) |
|||
@ApiModelProperty(value = "管道ids") |
|||
private String pipeConfig; |
|||
/**排序*/ |
|||
@Excel(name = "排序", width = 15) |
|||
@ApiModelProperty(value = "排序") |
|||
private Integer sortOrder; |
|||
/**备注*/ |
|||
@Excel(name = "备注", width = 15) |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
/**删除状态(0-正常,1-已删除)*/ |
|||
@Excel(name = "删除状态(0-正常,1-已删除)", width = 15) |
|||
@ApiModelProperty(value = "删除状态(0-正常,1-已删除)") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/**创建人*/ |
|||
@Excel(name = "创建人", width = 15) |
|||
@ApiModelProperty(value = "创建人") |
|||
private String createBy; |
|||
/**创建时间*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/**更新人*/ |
|||
@Excel(name = "更新人", width = 15) |
|||
@ApiModelProperty(value = "更新人") |
|||
private String updateBy; |
|||
/**更新时间*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
|
|||
@TableField(exist = false) |
|||
private List<RecommendPlanPipeConfig> configList; |
|||
|
|||
|
|||
} |
@ -0,0 +1,67 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import cc.admin.common.aspect.annotation.Dict; |
|||
|
|||
/** |
|||
* @Description: 推荐方案管道配置表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
public class RecommendPlanPipeConfig { |
|||
|
|||
|
|||
@Excel(name = "推荐方案ID(关联recommend_plan)", width = 15) |
|||
@ApiModelProperty(value = "推荐方案ID(关联recommend_plan)") |
|||
private String recommendPlanId; |
|||
/**关联的设计方案ID*/ |
|||
@Excel(name = "关联的设计方案ID", width = 15) |
|||
@ApiModelProperty(value = "关联的设计方案ID") |
|||
private String designPlanId; |
|||
/**管道ID(关联pipe)*/ |
|||
@Excel(name = "管道ID(关联pipe)", width = 15) |
|||
@ApiModelProperty(value = "管道ID(关联pipe)") |
|||
private String pipeId; |
|||
/**节点阀门打开度(%)*/ |
|||
@Excel(name = "节点阀门打开度(%)", width = 15) |
|||
@ApiModelProperty(value = "节点阀门打开度(%)") |
|||
private Double valveOpening; |
|||
/**管道风量*/ |
|||
@Excel(name = "管道风量", width = 15) |
|||
@ApiModelProperty(value = "管道风量") |
|||
private Double pipeFlow; |
|||
/**删除状态(0-正常,1-已删除)*/ |
|||
@Excel(name = "删除状态(0-正常,1-已删除)", width = 15) |
|||
@ApiModelProperty(value = "删除状态(0-正常,1-已删除)") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/**创建人*/ |
|||
@Excel(name = "创建人", width = 15) |
|||
@ApiModelProperty(value = "创建人") |
|||
private String createBy; |
|||
/**创建时间*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/**更新人*/ |
|||
@Excel(name = "更新人", width = 15) |
|||
@ApiModelProperty(value = "更新人") |
|||
private String updateBy; |
|||
/**更新时间*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
} |
@ -0,0 +1,75 @@ |
|||
package cc.admin.modules.dust.entity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import cc.admin.common.aspect.annotation.Dict; |
|||
|
|||
/** |
|||
* @Description: 风速颜色表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-01-09 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Data |
|||
@TableName("wind_speed_color") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@ApiModel(value="wind_speed_color对象", description="风速颜色表") |
|||
public class WindSpeedColor { |
|||
|
|||
/**主键ID*/ |
|||
@Excel(name = "主键ID", width = 15) |
|||
@ApiModelProperty(value = "主键ID") |
|||
private String id; |
|||
/**风速*/ |
|||
@Excel(name = "风速", width = 15) |
|||
@ApiModelProperty(value = "风速") |
|||
private String windSpeed; |
|||
/**颜色*/ |
|||
@Excel(name = "颜色", width = 15) |
|||
@ApiModelProperty(value = "颜色") |
|||
private String color; |
|||
/**公式*/ |
|||
@Excel(name = "公式", width = 15) |
|||
@ApiModelProperty(value = "公式") |
|||
private String formula; |
|||
/**排序*/ |
|||
@Excel(name = "排序", width = 15) |
|||
@ApiModelProperty(value = "排序") |
|||
private Integer sortOrder; |
|||
/**备注*/ |
|||
@Excel(name = "备注", width = 15) |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
/**删除标志*/ |
|||
@Excel(name = "删除标志", width = 15) |
|||
@ApiModelProperty(value = "删除标志") |
|||
@TableLogic |
|||
private Integer delFlag; |
|||
/**创建者*/ |
|||
@Excel(name = "创建者", width = 15) |
|||
@ApiModelProperty(value = "创建者") |
|||
private String createBy; |
|||
/**创建时间*/ |
|||
@Excel(name = "创建时间", width = 15) |
|||
@ApiModelProperty(value = "创建时间") |
|||
private Date createTime; |
|||
/**更新者*/ |
|||
@Excel(name = "更新者", width = 15) |
|||
@ApiModelProperty(value = "更新者") |
|||
private String updateBy; |
|||
/**更新时间*/ |
|||
@Excel(name = "更新时间", width = 15) |
|||
@ApiModelProperty(value = "更新时间") |
|||
private Date updateTime; |
|||
} |
@ -0,0 +1,49 @@ |
|||
package cc.admin.modules.dust.enums; |
|||
|
|||
import lombok.Getter; |
|||
|
|||
@Getter |
|||
public enum FanStatusType { |
|||
CLOSE(0, "关闭"), |
|||
OPEN(1, "开启"); |
|||
|
|||
private final int type; |
|||
private final String name; |
|||
|
|||
FanStatusType(int type, String name) { |
|||
this.type = type; |
|||
this.name = name; |
|||
} |
|||
|
|||
// 通过 int 值获取枚举实例
|
|||
public static FanStatusType fromType(int type) { |
|||
for (FanStatusType valveType : FanStatusType.values()) { |
|||
if (valveType.getType() == type) { |
|||
return valveType; |
|||
} |
|||
} |
|||
throw new IllegalArgumentException("未知的阀门类型: " + type); |
|||
} |
|||
|
|||
// 通过 int 值获取名称
|
|||
public static String getNameByType(int type) { |
|||
FanStatusType valveType = fromType(type); |
|||
return valveType.getName(); |
|||
} |
|||
|
|||
// 通过名称获取枚举实例
|
|||
public static FanStatusType fromName(String name) { |
|||
for (FanStatusType valveType : FanStatusType.values()) { |
|||
if (valveType.getName().equals(name)) { |
|||
return valveType; |
|||
} |
|||
} |
|||
throw new IllegalArgumentException("未知的阀门名称: " + name); |
|||
} |
|||
|
|||
// 通过名称获取 int 值
|
|||
public static Integer getTypeByName(String name) { |
|||
FanStatusType valveType = fromName(name); |
|||
return valveType.getType(); |
|||
} |
|||
} |
@ -0,0 +1,49 @@ |
|||
package cc.admin.modules.dust.enums; |
|||
|
|||
import lombok.Getter; |
|||
|
|||
@Getter |
|||
public enum ValveType { |
|||
LIFTING_VALVE(0, "升关阀"), |
|||
REGULATING_VALVE(1, "调节阀"); |
|||
|
|||
private final int type; |
|||
private final String name; |
|||
|
|||
ValveType(int type, String name) { |
|||
this.type = type; |
|||
this.name = name; |
|||
} |
|||
|
|||
// 通过 int 值获取枚举实例
|
|||
public static ValveType fromType(int type) { |
|||
for (ValveType valveType : ValveType.values()) { |
|||
if (valveType.getType() == type) { |
|||
return valveType; |
|||
} |
|||
} |
|||
throw new IllegalArgumentException("未知的阀门类型: " + type); |
|||
} |
|||
|
|||
// 通过 int 值获取名称
|
|||
public static String getNameByType(int type) { |
|||
ValveType valveType = fromType(type); |
|||
return valveType.getName(); |
|||
} |
|||
|
|||
// 通过名称获取枚举实例
|
|||
public static ValveType fromName(String name) { |
|||
for (ValveType valveType : ValveType.values()) { |
|||
if (valveType.getName().equals(name)) { |
|||
return valveType; |
|||
} |
|||
} |
|||
throw new IllegalArgumentException("未知的阀门名称: " + name); |
|||
} |
|||
|
|||
// 通过名称获取 int 值
|
|||
public static Integer getTypeByName(String name) { |
|||
ValveType valveType = fromName(name); |
|||
return valveType.getType(); |
|||
} |
|||
} |
@ -0,0 +1,14 @@ |
|||
package cc.admin.modules.dust.mapper; |
|||
|
|||
import cc.admin.modules.dust.entity.DesignPlan; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @Description: 设计方案表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface DesignPlanMapper extends BaseMapper<DesignPlan> { |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package cc.admin.modules.dust.mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.apache.ibatis.annotations.Param; |
|||
import cc.admin.modules.dust.entity.DustAlarm; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @Description: 警报记录表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface DustAlarmMapper extends BaseMapper<DustAlarm> { |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package cc.admin.modules.dust.mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.apache.ibatis.annotations.Param; |
|||
import cc.admin.modules.dust.entity.DustDataTag; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @Description: 数据点位表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface DustDataTagMapper extends BaseMapper<DustDataTag> { |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package cc.admin.modules.dust.mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.apache.ibatis.annotations.Param; |
|||
import cc.admin.modules.dust.entity.DustMonitorItem; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @Description: 大屏监控项表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface DustMonitorItemMapper extends BaseMapper<DustMonitorItem> { |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package cc.admin.modules.dust.mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.apache.ibatis.annotations.Param; |
|||
import cc.admin.modules.dust.entity.DustMonitorValve; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @Description: 大屏阀门监控表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface DustMonitorValveMapper extends BaseMapper<DustMonitorValve> { |
|||
|
|||
List<DustMonitorValve> valveList(); |
|||
} |
@ -0,0 +1,17 @@ |
|||
package cc.admin.modules.dust.mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.apache.ibatis.annotations.Param; |
|||
import cc.admin.modules.dust.entity.DustSystem; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @Description: 除尘系统表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface DustSystemMapper extends BaseMapper<DustSystem> { |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package cc.admin.modules.dust.mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.apache.ibatis.annotations.Param; |
|||
import cc.admin.modules.dust.entity.DustValve; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @Description: 阀门表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface DustValveMapper extends BaseMapper<DustValve> { |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package cc.admin.modules.dust.mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
import cc.admin.modules.dust.entity.PipeDiameterThickness; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @Description: 管径壁厚对应表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface PipeDiameterThicknessMapper extends BaseMapper<PipeDiameterThickness> { |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package cc.admin.modules.dust.mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
import cc.admin.modules.dust.entity.Pipe; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @Description: 管道表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface PipeMapper extends BaseMapper<Pipe> { |
|||
|
|||
void delByDesignPlanId(String id); |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package cc.admin.modules.dust.mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
import cc.admin.modules.dust.entity.RecommendPlan; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @Description: 推荐方案表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface RecommendPlanMapper extends BaseMapper<RecommendPlan> { |
|||
|
|||
void deleteByDesignPlanId(String designPlanId); |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package cc.admin.modules.dust.mapper; |
|||
|
|||
import cc.admin.modules.dust.entity.WindSpeedColor; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
|
|||
/** |
|||
* @Description: 风速颜色表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-01-09 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface WindSpeedColorMapper extends BaseMapper<WindSpeedColor> { |
|||
|
|||
} |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="cc.admin.modules.dust.mapper.DesignPlanMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="cc.admin.modules.dust.mapper.DustAlarmMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="cc.admin.modules.dust.mapper.DustDataTagMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="cc.admin.modules.dust.mapper.DustMonitorItemMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,11 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="cc.admin.modules.dust.mapper.DustMonitorValveMapper"> |
|||
|
|||
<select id="valveList" resultType="cc.admin.modules.dust.entity.DustMonitorValve"> |
|||
select d.*,v.system_id from dust_monitor_valve d |
|||
left join dust_valve |
|||
v on d.valve_id = v.id |
|||
where d.del_flag = 0 |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="cc.admin.modules.dust.mapper.DustSystemMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="cc.admin.modules.dust.mapper.DustValveMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="cc.admin.modules.dust.mapper.PipeDiameterThicknessMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="cc.admin.modules.dust.mapper.PipeMapper"> |
|||
<delete id="delByDesignPlanId"> |
|||
delete from pipe where design_plan_id = #{designPlanId} |
|||
</delete> |
|||
</mapper> |
@ -0,0 +1,10 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="cc.admin.modules.dust.mapper.RecommendPlanMapper"> |
|||
|
|||
<delete id="deleteByDesignPlanId"> |
|||
delete from recommend_plan |
|||
WHERE design_plan_id = #{designPlanId} |
|||
</delete> |
|||
|
|||
</mapper> |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="cc.admin.modules.wind.mapper.WindSpeedColorMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,17 @@ |
|||
package cc.admin.modules.dust.po; |
|||
|
|||
|
|||
import cc.admin.modules.dust.entity.Pipe; |
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class DustQuery { |
|||
/**推荐方案id*/ |
|||
private String designPlanId; |
|||
|
|||
private List<Pipe> list; |
|||
} |
@ -0,0 +1,16 @@ |
|||
package cc.admin.modules.dust.service; |
|||
|
|||
import cc.admin.modules.dust.entity.DesignPlan; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* @Description: 设计方案表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface IDesignPlanService extends IService<DesignPlan> { |
|||
|
|||
void copy(DesignPlan designPlan,String name); |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package cc.admin.modules.dust.service; |
|||
|
|||
import cc.admin.modules.dust.entity.DustAlarm; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* @Description: 警报记录表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface IDustAlarmService extends IService<DustAlarm> { |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package cc.admin.modules.dust.service; |
|||
|
|||
import cc.admin.modules.dust.entity.DustDataTag; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* @Description: 数据点位表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface IDustDataTagService extends IService<DustDataTag> { |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package cc.admin.modules.dust.service; |
|||
|
|||
import cc.admin.modules.dust.entity.DustMonitorItem; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* @Description: 大屏监控项表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface IDustMonitorItemService extends IService<DustMonitorItem> { |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package cc.admin.modules.dust.service; |
|||
|
|||
import cc.admin.modules.dust.entity.DustMonitorValve; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 大屏阀门监控表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface IDustMonitorValveService extends IService<DustMonitorValve> { |
|||
|
|||
List<DustMonitorValve> valveList(); |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package cc.admin.modules.dust.service; |
|||
|
|||
import cc.admin.modules.dust.entity.DustSystem; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* @Description: 除尘系统表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface IDustSystemService extends IService<DustSystem> { |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package cc.admin.modules.dust.service; |
|||
|
|||
import cc.admin.modules.dust.entity.DustValve; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* @Description: 阀门表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface IDustValveService extends IService<DustValve> { |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package cc.admin.modules.dust.service; |
|||
|
|||
|
|||
import cc.admin.modules.dust.entity.PipeDiameterThickness; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @Description: 管径壁厚对应表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface IPipeDiameterThicknessService extends IService<PipeDiameterThickness> { |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package cc.admin.modules.dust.service; |
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.modules.dust.entity.Pipe; |
|||
import cc.admin.modules.dust.vo.DustConfigVo; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 管道表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface IPipeService extends IService<Pipe> { |
|||
|
|||
Result<?> importList(List<DustConfigVo> configVoList, List<String> errorList,String designPlanId); |
|||
|
|||
void delByDesignPlanId(String id); |
|||
|
|||
void savePipe(Pipe pipe); |
|||
|
|||
void updatePipe(Pipe pipe); |
|||
|
|||
void remove(String id); |
|||
} |
@ -0,0 +1,20 @@ |
|||
package cc.admin.modules.dust.service; |
|||
|
|||
import cc.admin.modules.dust.entity.RecommendPlan; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 推荐方案表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface IRecommendPlanService extends IService<RecommendPlan> { |
|||
|
|||
void deleteByDesignPlanId(String designPlanId); |
|||
} |
@ -0,0 +1,15 @@ |
|||
package cc.admin.modules.dust.service; |
|||
|
|||
|
|||
import cc.admin.modules.dust.entity.WindSpeedColor; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* @Description: 风速颜色表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-01-09 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
public interface IWindSpeedColorService extends IService<WindSpeedColor> { |
|||
|
|||
} |
@ -0,0 +1,114 @@ |
|||
package cc.admin.modules.dust.service.impl; |
|||
|
|||
|
|||
import cc.admin.modules.dust.entity.DesignPlan; |
|||
import cc.admin.modules.dust.entity.Pipe; |
|||
import cc.admin.modules.dust.mapper.DesignPlanMapper; |
|||
import cc.admin.modules.dust.service.IDesignPlanService; |
|||
import cc.admin.modules.dust.service.IPipeService; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Description: 设计方案表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Service |
|||
public class DesignPlanServiceImpl extends ServiceImpl<DesignPlanMapper, DesignPlan> implements IDesignPlanService { |
|||
@Autowired |
|||
private IPipeService iPipeService; |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void copy(DesignPlan designPlan, String name) { |
|||
|
|||
QueryWrapper<Pipe> objectQueryWrapper = new QueryWrapper<>(); |
|||
objectQueryWrapper.eq("design_plan_id", designPlan.getId()); |
|||
List<Pipe> list = iPipeService.list(objectQueryWrapper); |
|||
String id = IdUtil.fastUUID(); |
|||
designPlan.setId(id); |
|||
designPlan.setName(name); |
|||
save(designPlan); |
|||
List<Pipe> pipeTree = buildPipeTree(list,id); |
|||
|
|||
if (CollectionUtils.isNotEmpty(pipeTree)) { |
|||
|
|||
// 递归更新所有管道
|
|||
updatePipeTree(pipeTree, null); // null 表示根管道没有父管道 ID
|
|||
List<Pipe> updatedList = new ArrayList<>(); |
|||
|
|||
flattenPipeTree(pipeTree, updatedList); |
|||
|
|||
iPipeService.saveBatch(updatedList); |
|||
} |
|||
|
|||
} |
|||
|
|||
private void updatePipeTree(List<Pipe> pipes, String parentId) { |
|||
for (Pipe pipe : pipes) { |
|||
// 生成新的管道 ID
|
|||
String newPipeId = IdUtil.fastUUID(); |
|||
pipe.setId(newPipeId); |
|||
|
|||
// 设置父管道的 ID
|
|||
pipe.setParentId(parentId); // 当前管道的父管道 ID
|
|||
|
|||
// 如果当前管道有子管道,递归处理子管道
|
|||
if (pipe.getChildren() != null && !pipe.getChildren().isEmpty()) { |
|||
updatePipeTree(pipe.getChildren(), newPipeId); // 递归更新子管道
|
|||
} |
|||
} |
|||
} |
|||
|
|||
private List<Pipe> buildPipeTree(List<Pipe> allPipes,String id) { |
|||
Map<String, Pipe> pipeMap = new HashMap<>(); |
|||
List<Pipe> rootPipes = new ArrayList<>(); |
|||
|
|||
// 创建一个管道 Map,用于快速查找
|
|||
for (Pipe pipe : allPipes) { |
|||
pipeMap.put(pipe.getId(), pipe); |
|||
} |
|||
|
|||
// 处理每个管道,构建父子关系
|
|||
for (Pipe pipe : allPipes) { |
|||
pipe.setCreateTime(new Date()); |
|||
pipe.setDesignPlanId(id); |
|||
if (StringUtils.isEmpty(pipe.getParentId())) { |
|||
// 如果是根管道,直接加入根管道列表
|
|||
rootPipes.add(pipe); |
|||
} else { |
|||
// 如果是子管道,将其加入父管道的 children 列表
|
|||
Pipe parentPipe = pipeMap.get(pipe.getParentId()); |
|||
if (parentPipe != null) { |
|||
if (parentPipe.getChildren() == null) { |
|||
parentPipe.setChildren(new ArrayList<>()); // 初始化 children
|
|||
} |
|||
parentPipe.getChildren().add(pipe); |
|||
} |
|||
} |
|||
} |
|||
|
|||
return rootPipes; |
|||
} |
|||
// 递归将树状结构扁平化为平铺列表
|
|||
private void flattenPipeTree(List<Pipe> pipeTree, List<Pipe> flatList) { |
|||
for (Pipe pipe : pipeTree) { |
|||
flatList.add(pipe); // 将当前管道添加到平铺列表
|
|||
if (pipe.getChildren() != null && !pipe.getChildren().isEmpty()) { |
|||
flattenPipeTree(pipe.getChildren(), flatList); // 递归扁平化子管道
|
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
package cc.admin.modules.dust.service.impl; |
|||
|
|||
import cc.admin.modules.dust.entity.DustAlarm; |
|||
import cc.admin.modules.dust.mapper.DustAlarmMapper; |
|||
import cc.admin.modules.dust.service.IDustAlarmService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
|
|||
/** |
|||
* @Description: 警报记录表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Service |
|||
public class DustAlarmServiceImpl extends ServiceImpl<DustAlarmMapper, DustAlarm> implements IDustAlarmService { |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package cc.admin.modules.dust.service.impl; |
|||
|
|||
import cc.admin.modules.dust.entity.DustDataTag; |
|||
import cc.admin.modules.dust.mapper.DustDataTagMapper; |
|||
import cc.admin.modules.dust.service.IDustDataTagService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
|
|||
/** |
|||
* @Description: 数据点位表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Service |
|||
public class DustDataTagServiceImpl extends ServiceImpl<DustDataTagMapper, DustDataTag> implements IDustDataTagService { |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package cc.admin.modules.dust.service.impl; |
|||
|
|||
import cc.admin.modules.dust.entity.DustMonitorItem; |
|||
import cc.admin.modules.dust.mapper.DustMonitorItemMapper; |
|||
import cc.admin.modules.dust.service.IDustMonitorItemService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
|
|||
/** |
|||
* @Description: 大屏监控项表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Service |
|||
public class DustMonitorItemServiceImpl extends ServiceImpl<DustMonitorItemMapper, DustMonitorItem> implements IDustMonitorItemService { |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package cc.admin.modules.dust.service.impl; |
|||
|
|||
import cc.admin.modules.dust.entity.DustMonitorValve; |
|||
import cc.admin.modules.dust.mapper.DustMonitorValveMapper; |
|||
import cc.admin.modules.dust.service.IDustMonitorValveService; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 大屏阀门监控表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Service |
|||
public class DustMonitorValveServiceImpl extends ServiceImpl<DustMonitorValveMapper, DustMonitorValve> implements IDustMonitorValveService { |
|||
@Resource |
|||
private DustMonitorValveMapper dustMonitorValveMapper; |
|||
|
|||
@Override |
|||
public List<DustMonitorValve> valveList() { |
|||
return dustMonitorValveMapper.valveList(); |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
package cc.admin.modules.dust.service.impl; |
|||
|
|||
import cc.admin.modules.dust.entity.DustSystem; |
|||
import cc.admin.modules.dust.mapper.DustSystemMapper; |
|||
import cc.admin.modules.dust.service.IDustSystemService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
|
|||
/** |
|||
* @Description: 除尘系统表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Service |
|||
public class DustSystemServiceImpl extends ServiceImpl<DustSystemMapper, DustSystem> implements IDustSystemService { |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package cc.admin.modules.dust.service.impl; |
|||
|
|||
import cc.admin.modules.dust.entity.DustValve; |
|||
import cc.admin.modules.dust.mapper.DustValveMapper; |
|||
import cc.admin.modules.dust.service.IDustValveService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
|
|||
/** |
|||
* @Description: 阀门表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-03-27 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Service |
|||
public class DustValveServiceImpl extends ServiceImpl<DustValveMapper, DustValve> implements IDustValveService { |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package cc.admin.modules.dust.service.impl; |
|||
|
|||
|
|||
import cc.admin.modules.dust.entity.PipeDiameterThickness; |
|||
import cc.admin.modules.dust.mapper.PipeDiameterThicknessMapper; |
|||
import cc.admin.modules.dust.service.IPipeDiameterThicknessService; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @Description: 管径壁厚对应表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Service |
|||
public class PipeDiameterThicknessServiceImpl extends ServiceImpl<PipeDiameterThicknessMapper, PipeDiameterThickness> implements IPipeDiameterThicknessService { |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,166 @@ |
|||
package cc.admin.modules.dust.service.impl; |
|||
|
|||
|
|||
import cc.admin.common.api.vo.Result; |
|||
import cc.admin.common.sys.vo.LoginUser; |
|||
import cc.admin.modules.dust.entity.DesignPlan; |
|||
import cc.admin.modules.dust.entity.Pipe; |
|||
import cc.admin.modules.dust.mapper.PipeMapper; |
|||
import cc.admin.modules.dust.service.IDesignPlanService; |
|||
import cc.admin.modules.dust.service.IPipeService; |
|||
import cc.admin.modules.dust.service.IRecommendPlanService; |
|||
import cc.admin.modules.dust.vo.DustConfigVo; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.apache.shiro.SecurityUtils; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Description: 管道表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Service |
|||
public class PipeServiceImpl extends ServiceImpl<PipeMapper, Pipe> implements IPipeService { |
|||
@Resource |
|||
private IDesignPlanService designPlanService; |
|||
@Resource |
|||
private PipeMapper pipeMapper; |
|||
@Autowired |
|||
private IRecommendPlanService iRecommendPlanService; |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Result<?> importList(List<DustConfigVo> configVoList, List<String> errorList, String designPlanId) { |
|||
DesignPlan one = designPlanService.getById(designPlanId); |
|||
if (null == one) { |
|||
return Result.error("推荐方案不能为空"); |
|||
} else { |
|||
pipeMapper.delByDesignPlanId(one.getId()); |
|||
} |
|||
|
|||
Date currentTime = new Date(); |
|||
// 1. 根据 serialNumber 排序,确保父节点在前,子节点在后
|
|||
configVoList.sort(Comparator.comparing(DustConfigVo::getSerialNumber)); |
|||
|
|||
// 2. 建立 serialNumber 与 Pipe ID 的映射
|
|||
Map<String, String> serialToIdMap = new HashMap<>(); |
|||
Pipe pipe1 = new Pipe(); |
|||
// 3. 创建 Pipe 对象列表
|
|||
List<Pipe> pipesToSave = new ArrayList<>(); |
|||
for (DustConfigVo vo : configVoList) { |
|||
Pipe pipe = new Pipe(); |
|||
BeanUtils.copyProperties(vo, pipe); |
|||
pipe.setId(vo.getId()); // 生成唯一 ID
|
|||
pipe.setDesignPlanId(one.getId()); |
|||
pipe.setCreateTime(currentTime); |
|||
pipe.setName(vo.getPipeName()); |
|||
pipe.setValveOpening(vo.getValveOpening()); |
|||
if ("0".equals(vo.getSerialNumber())){ |
|||
pipe1.setParentId(pipe.getId()); |
|||
} |
|||
if (vo.getSerialNumber().matches("^\\d+$")) { // 只允许整数,不允许小数或其他形式
|
|||
pipe.setParentId(pipe1.getParentId()); // 如果是整数,则设置父节点
|
|||
} |
|||
// 设置 parentId
|
|||
String parentSerial = getParentSerial(vo.getSerialNumber()); |
|||
if (parentSerial != null) { |
|||
String parentId = serialToIdMap.get(parentSerial); |
|||
if (parentId != null && !parentId.equals(vo.getId())) { |
|||
pipe.setParentId(parentId); |
|||
} else { |
|||
if (!"0".equals(vo.getSerialNumber())){ |
|||
throw new IllegalArgumentException("Parent ID not found for parent serial: " + parentSerial); |
|||
} |
|||
} |
|||
} else { |
|||
if ("0".equals(vo.getSerialNumber())) { // 只允许整数,不允许小数或其他形式
|
|||
pipe.setParentId(null); // 如果是整数,则设置父节点
|
|||
} |
|||
} |
|||
|
|||
// 初始设置 isDustRemovalNode=false
|
|||
pipe.setIsLeaf(0); |
|||
// 添加到列表
|
|||
pipesToSave.add(pipe); |
|||
|
|||
// 更新 serialToIdMap
|
|||
serialToIdMap.put(vo.getSerialNumber(), pipe.getId()); |
|||
} |
|||
// 4. 收集所有 Pipe 的 parentIds
|
|||
Set<String> parentIds = pipesToSave.stream() |
|||
.map(Pipe::getParentId) |
|||
.filter(Objects::nonNull) |
|||
.collect(Collectors.toSet()); |
|||
|
|||
// 5. 遍历 Pipe 对象,标记没有子节点的为除尘节点
|
|||
for (Pipe pipe : pipesToSave) { |
|||
if (!parentIds.contains(pipe.getId())) { |
|||
pipe.setIsLeaf(1); |
|||
} |
|||
} |
|||
|
|||
// 批量保存所有 Pipe 对象
|
|||
if (!pipesToSave.isEmpty()) { |
|||
saveBatch(pipesToSave); |
|||
} |
|||
return buildResult(pipesToSave, errorList); |
|||
} |
|||
|
|||
private String getParentSerial(String serial) { |
|||
if (serial == null || !serial.contains(".")) { |
|||
return null; |
|||
} |
|||
int lastDotIndex = serial.lastIndexOf('.'); |
|||
return serial.substring(0, lastDotIndex); |
|||
} |
|||
|
|||
@Override |
|||
public void delByDesignPlanId(String id) { |
|||
pipeMapper.delByDesignPlanId(id); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void savePipe(Pipe pipe) { |
|||
iRecommendPlanService.deleteByDesignPlanId(pipe.getDesignPlanId()); |
|||
save(pipe); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void updatePipe(Pipe pipe) { |
|||
Pipe byId = getById(pipe.getId()); |
|||
if (byId.getIsLeaf().equals(1)) { |
|||
iRecommendPlanService.deleteByDesignPlanId(byId.getDesignPlanId()); |
|||
} |
|||
updateById(pipe); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void remove(String id) { |
|||
Pipe pipe = getById(id); |
|||
iRecommendPlanService.deleteByDesignPlanId(pipe.getDesignPlanId()); |
|||
removeById(pipe.getId()); |
|||
} |
|||
|
|||
|
|||
private Result buildResult(List<Pipe> importList, List<String> errorList) { |
|||
String message = String.format("导入成功 %d 条!", importList.size()); |
|||
if (!errorList.isEmpty()) { |
|||
message += String.format("但存在错误,共 %d 条。错误详情:%s", errorList.size(), String.join(", ", errorList)); |
|||
} |
|||
return importList.isEmpty() ? Result.error(message) : Result.ok(message); |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
package cc.admin.modules.dust.service.impl; |
|||
|
|||
import cc.admin.modules.dust.entity.RecommendPlan; |
|||
import cc.admin.modules.dust.mapper.RecommendPlanMapper; |
|||
import cc.admin.modules.dust.service.IRecommendPlanService; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import org.hibernate.validator.constraints.pl.REGON; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 推荐方案表 |
|||
* @Author: cc-admin |
|||
* @Date: 2024-12-06 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Service |
|||
public class RecommendPlanServiceImpl extends ServiceImpl<RecommendPlanMapper, RecommendPlan> implements IRecommendPlanService { |
|||
|
|||
@Resource |
|||
private RecommendPlanMapper recommendPlanMapper; |
|||
@Override |
|||
public void deleteByDesignPlanId(String designPlanId) { |
|||
recommendPlanMapper.deleteByDesignPlanId(designPlanId); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package cc.admin.modules.dust.service.impl; |
|||
|
|||
import cc.admin.modules.dust.entity.WindSpeedColor; |
|||
import cc.admin.modules.dust.mapper.WindSpeedColorMapper; |
|||
import cc.admin.modules.dust.service.IWindSpeedColorService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
|
|||
/** |
|||
* @Description: 风速颜色表 |
|||
* @Author: cc-admin |
|||
* @Date: 2025-01-09 |
|||
* @Version: V1.0.0 |
|||
*/ |
|||
@Service |
|||
public class WindSpeedColorServiceImpl extends ServiceImpl<WindSpeedColorMapper, WindSpeedColor> implements IWindSpeedColorService { |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package cc.admin.modules.dust.utils; |
|||
|
|||
import org.springframework.beans.BeanUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
public class BeanCopyUtil { |
|||
public static <S, T> List<T> copyList(List<S> sourceList, Class<T> targetClass) { |
|||
List<T> targetList = new ArrayList<>(); |
|||
for (S source : sourceList) { |
|||
try { |
|||
T target = targetClass.newInstance(); // 创建目标对象实例
|
|||
BeanUtils.copyProperties(source, target); // 复制属性
|
|||
targetList.add(target); |
|||
} catch (Exception e) { |
|||
// 异常处理
|
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
return targetList; |
|||
} |
|||
} |
@ -0,0 +1,131 @@ |
|||
package cc.admin.modules.dust.utils; |
|||
|
|||
import cc.admin.poi.util.HeaderCell; |
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.poi.EncryptedDocumentException; |
|||
import org.apache.poi.ss.usermodel.*; |
|||
|
|||
import java.io.BufferedInputStream; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Slf4j |
|||
public class ExcelUtil { |
|||
|
|||
public static Workbook getWorkbook(InputStream inputStream) throws IOException { |
|||
// 参数校验
|
|||
if (inputStream == null) { |
|||
throw new IllegalArgumentException("输入流不能为空"); |
|||
} |
|||
|
|||
// 如果不支持 mark/reset,包装成 BufferedInputStream
|
|||
InputStream bufferedInputStream = inputStream.markSupported() |
|||
? inputStream |
|||
: new BufferedInputStream(inputStream); |
|||
|
|||
try { |
|||
// 尝试创建工作簿
|
|||
return WorkbookFactory.create(bufferedInputStream); |
|||
} catch (EncryptedDocumentException e) { |
|||
throw new IOException("不支持加密的Excel文件", e); |
|||
} catch (Exception e) { |
|||
throw new IOException("无效的Excel文件格式", e); |
|||
} |
|||
} |
|||
|
|||
|
|||
public static String readCellAsString(Cell cell) { |
|||
if (cell == null) { |
|||
return null; |
|||
} |
|||
|
|||
Object cellValue = null; |
|||
switch (cell.getCellType()) { //根据cell中的类型来读取数据
|
|||
case NUMERIC: |
|||
cellValue = cell.getNumericCellValue(); |
|||
break; |
|||
case STRING: |
|||
cellValue = cell.getStringCellValue(); |
|||
break; |
|||
case BOOLEAN: |
|||
cellValue = cell.getBooleanCellValue(); |
|||
break; |
|||
case FORMULA: |
|||
cellValue = cell.getCellFormula(); |
|||
break; |
|||
case BLANK: |
|||
break; |
|||
default: |
|||
cellValue = "unsupported cell type: " + cell.getCellType(); |
|||
break; |
|||
} |
|||
|
|||
return (cellValue != null) ? cellValue.toString() : null; |
|||
|
|||
} |
|||
|
|||
public static Integer readCellAsInteger(Cell cell) { |
|||
String cellValue = readCellAsString(cell); |
|||
if (StrUtil.isNotEmpty(cellValue)) { |
|||
try { |
|||
if (cellValue.contains(".")) { |
|||
return (int) Double.parseDouble(cellValue); |
|||
} else { |
|||
return Integer.parseInt(cellValue); |
|||
} |
|||
} catch (Exception e) { |
|||
log.warn(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
public static Double readCellAsDouble(Cell cell) { |
|||
String cellValue = readCellAsString(cell); |
|||
if (StrUtil.isNotEmpty(cellValue)) { |
|||
try { |
|||
return Double.parseDouble(cellValue); |
|||
} catch (Exception e) { |
|||
log.warn(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
public static Date readCellAsDate(Cell cell, String format) { |
|||
String cellValue = readCellAsString(cell); |
|||
if (StrUtil.isNotEmpty(cellValue)) { |
|||
try { |
|||
return DateUtil.parse(cellValue, format); |
|||
} catch (Exception e) { |
|||
log.warn(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
public static void checkTableHeader(Sheet sheet, String sheetName, List<HeaderCell> headerCellList) { |
|||
Map<Integer, List<HeaderCell>> rowCellMap = headerCellList.stream().collect(Collectors.groupingBy(HeaderCell::getRow)); |
|||
|
|||
for (Integer row : rowCellMap.keySet()) { |
|||
List<HeaderCell> rowCellList = rowCellMap.get(row); |
|||
Row headerRow = sheet.getRow(row); |
|||
for (HeaderCell hc : rowCellList) { |
|||
String cellValue = readCellAsString(headerRow.getCell(hc.getColumn())); |
|||
if (cellValue == null || !cellValue.trim().equals(hc.getTitle())) { |
|||
throw new RuntimeException(String.format("%s 格式错误!%d 行 %d 列 %s != %s", sheetName, hc.getRow() + 1, hc.getColumn() + 1, cellValue, hc.getTitle())); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,7 @@ |
|||
package cc.admin.modules.dust.utils; |
|||
|
|||
public class KeyUtils { |
|||
|
|||
public static String dustdataTag = "dustdataTag"; |
|||
|
|||
} |
@ -0,0 +1,162 @@ |
|||
package cc.admin.modules.dust.utils; |
|||
|
|||
|
|||
import cc.admin.modules.dust.entity.Pipe; |
|||
import cc.admin.modules.dust.entity.RecommendPlan; |
|||
|
|||
import java.io.*; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
import java.util.stream.IntStream; |
|||
|
|||
public class RecommendPlanUtils { |
|||
|
|||
public static List<RecommendPlan> generateCombinations(List<Pipe> pipes, double minSpeed, double minRate, Set<Integer> comb) throws IOException { |
|||
|
|||
int numRes = 10; |
|||
List<Double> areas = pipes.stream() |
|||
.map(pipe -> { |
|||
double diameter = pipe.getDiameter(); |
|||
if (null != pipe.getComputeDiameter()) { |
|||
diameter = pipe.getComputeDiameter(); |
|||
} |
|||
return (Math.PI * Math.pow(diameter / 1000.0, 2.0) / 4.0) * 3600.0; // 面积计算公式
|
|||
}) |
|||
.collect(Collectors.toList()); |
|||
double minF = minSpeed * areas.get(areas.size() - 1); |
|||
|
|||
List<Double> valves = Arrays.asList(minRate, 1.0); |
|||
comb = new TreeSet<>(comb); // Ensure comb is sorted
|
|||
List<List<Object>> mmArr = new ArrayList<>(); |
|||
List<List<Object>> mArr = new ArrayList<>(); |
|||
mArr.add(Arrays.asList(new ArrayList<>(), 0.0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)); |
|||
for (int k = 0; k < pipes.size(); k++) { |
|||
mmArr = new ArrayList<>(mArr); |
|||
mArr.clear(); |
|||
double minFF = Double.POSITIVE_INFINITY; |
|||
List<Integer> minFS = new ArrayList<>(); |
|||
|
|||
if (k < comb.iterator().next()) { // 你原来是用 comb.get(0),Set 中没有索引
|
|||
for (List<Object> item : mmArr) { |
|||
List<Double> ar = (List<Double>) item.get(0); |
|||
double flow = (Double) item.get(1); |
|||
double vmax = (Double) item.get(2); |
|||
double vmin = (Double) item.get(3); |
|||
int numOnes = 0; |
|||
|
|||
for (Double value : ar) { |
|||
if (value == 1.0) { |
|||
numOnes++; |
|||
} |
|||
} |
|||
for (double valve : valves) { |
|||
double mFlow = flow + valve * pipes.get(k).getFlow(); // 假设 df 是一个简单的 List<Double>,你需要根据实际情况调整
|
|||
double mSpeed = mFlow / areas.get(k); |
|||
|
|||
if (numOnes > 0 || valve > minRate) { |
|||
if (mSpeed >= minSpeed) { |
|||
mArr.add(Arrays.asList(new ArrayList<Object>(ar) {{ |
|||
add(valve); }}, mFlow, |
|||
Math.max(mSpeed, vmax), |
|||
Math.min(mSpeed, vmin))); |
|||
} |
|||
} else { |
|||
mArr.add(Arrays.asList(new ArrayList<Object>(ar) {{ |
|||
add(valve); }}, mFlow, |
|||
Math.max(mSpeed, vmax), |
|||
Math.min(mSpeed, vmin))); |
|||
} |
|||
} |
|||
} |
|||
} else { |
|||
if (comb.contains(k)) { // 使用 contains 检查 k 是否在 comb 中
|
|||
double valve = valves.get(valves.size() - 1); |
|||
for (List<Object> item : mmArr) { |
|||
List<Double> ar = (List<Double>) item.get(0); |
|||
double flow = (Double) item.get(1); |
|||
double vmax = (Double) item.get(2); |
|||
double vmin = (Double) item.get(3); |
|||
|
|||
double mFlow = flow + valve * pipes.get(k).getFlow(); // 假设 df 是一个简单的 List<Double>,你需要根据实际情况调整
|
|||
double mSpeed = mFlow / areas.get(k); |
|||
|
|||
if (mSpeed >= minSpeed) { |
|||
mArr.add(Arrays.asList(new ArrayList<Object>(ar) {{ |
|||
add(valves.get(valves.size() - 1));}}, mFlow, |
|||
Math.max(mSpeed, vmax), |
|||
Math.min(mSpeed, vmin))); |
|||
} |
|||
} |
|||
} else { |
|||
for (List<Object> item : mmArr) { |
|||
List<Double> ar = (List<Double>) item.get(0); |
|||
double flow = (Double) item.get(1); |
|||
double vmax = (Double) item.get(2); |
|||
double vmin = (Double) item.get(3); |
|||
|
|||
for (double valve : valves) { |
|||
double mFlow = flow + valve * pipes.get(k).getFlow(); // 假设 df 是一个简单的 List<Double>,你需要根据实际情况调整
|
|||
double mSpeed = mFlow / areas.get(k); |
|||
if (mSpeed >= minSpeed) { |
|||
if (valve == valves.get(0)) { |
|||
if (mFlow >= minF) { |
|||
if (mFlow <= minFF) { |
|||
mArr.add(Arrays.asList(new ArrayList<Object>(ar) {{ |
|||
add(valve); }}, mFlow, |
|||
Math.max(mSpeed, vmax), |
|||
Math.min(mSpeed, vmin))); |
|||
|
|||
minFF = mFlow; |
|||
minFS.add(mArr.size() - 1); |
|||
} |
|||
} |
|||
} |
|||
//mArr.add(new ArrayList<>(Arrays.asList(ar.add(valve), mFlow, Math.max(mSpeed, vmax), Math.min(mSpeed, vmin))));
|
|||
mArr.add(Arrays.asList(new ArrayList<Object>(ar) {{ |
|||
add(valve); }}, mFlow, |
|||
Math.max(mSpeed, vmax), |
|||
Math.min(mSpeed, vmin))); |
|||
} |
|||
} |
|||
} |
|||
for (int ind : minFS) { |
|||
if ((double) mArr.get(ind).get(1) > minFF) { |
|||
mArr.remove(ind); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
// Sort and select results
|
|||
mArr.sort(Comparator.comparing((List<Object> item) -> (Double) item.get(1)) |
|||
.thenComparing(item -> Math.abs((Double) item.get(2))) |
|||
.thenComparing(item -> (Double) item.get(3))); |
|||
|
|||
List<RecommendPlan> recommendPlans = new ArrayList<>(); |
|||
|
|||
for (int i = 0; i < Math.min(numRes, mArr.size()); i++) { |
|||
List<Object> ar = mArr.get(i); |
|||
RecommendPlan plan = new RecommendPlan(); |
|||
List<Integer> matchingIndexes = IntStream.range(0, ((List<Object>) ar.get(0)).size()) |
|||
.filter(a -> ((List<Object>) ar.get(0)).get(a).equals(1.0)) // 查找值为 1.0 的元素
|
|||
.boxed() // 将原始的 int 转为 Integer 类型
|
|||
.collect(Collectors.toList()); |
|||
String pipeIds = matchingIndexes.stream() |
|||
.map(b -> pipes.get(b).getId()) // 使用下标获取对应的 Pipe id
|
|||
.collect(Collectors.joining(",")); |
|||
|
|||
plan.setPipeConfig(pipeIds); |
|||
plan.setFlow((Double) ar.get(1)); |
|||
plan.setMaxSpeed((Double) ar.get(2)); |
|||
plan.setMinSpeed((Double) ar.get(3)); |
|||
|
|||
recommendPlans.add(plan); |
|||
} |
|||
|
|||
return recommendPlans; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package cc.admin.modules.dust.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
@Data |
|||
public class CombinationResult { |
|||
double mainFlow; |
|||
double minSpeed; |
|||
double maxSpeed; |
|||
List<String> setNames; |
|||
|
|||
public CombinationResult(double mainFlow, double minSpeed, double maxSpeed, List<String> setNames) { |
|||
this.mainFlow = mainFlow; |
|||
this.minSpeed = minSpeed; |
|||
this.maxSpeed = maxSpeed; |
|||
this.setNames = setNames; |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
package cc.admin.modules.dust.vo; |
|||
|
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class DataTagExcel { |
|||
/**名称*/ |
|||
@ExcelProperty(value = "名称") |
|||
private String name; |
|||
|
|||
@ExcelProperty(value = "所属系统") |
|||
private String systemName; |
|||
|
|||
/**数据点位*/ |
|||
@ExcelProperty(value = "数据点位") |
|||
private String dataTag; |
|||
} |
@ -0,0 +1,31 @@ |
|||
package cc.admin.modules.dust.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class DataTagPair { |
|||
|
|||
private String tagId; |
|||
private String description; |
|||
|
|||
public DataTagPair(String tagId, String description) { |
|||
this.tagId = tagId; |
|||
this.description = description; |
|||
} |
|||
|
|||
public String getTagId() { |
|||
return tagId; |
|||
} |
|||
|
|||
public void setTagId(String tagId) { |
|||
this.tagId = tagId; |
|||
} |
|||
|
|||
public String getDescription() { |
|||
return description; |
|||
} |
|||
|
|||
public void setDescription(String description) { |
|||
this.description = description; |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
package cc.admin.modules.dust.vo; |
|||
|
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class DataValveExcel { |
|||
|
|||
@ExcelProperty(value = "所属系统") |
|||
private String systemName; |
|||
|
|||
@ExcelProperty(value = "所属点位") |
|||
private String dataTag; |
|||
|
|||
@ExcelProperty(value = "阀门") |
|||
private String name; |
|||
|
|||
@ExcelProperty(value = "类型") |
|||
private String typeName; |
|||
|
|||
@ExcelProperty(value = "除尘部位") |
|||
private String location; |
|||
|
|||
@ExcelProperty(value = "阀门参数") |
|||
private String parameter; |
|||
} |
@ -0,0 +1,38 @@ |
|||
package cc.admin.modules.dust.vo; |
|||
|
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class DustConfigVo { |
|||
private String id; |
|||
@ApiModelProperty(value = "序号") |
|||
private String serialNumber; |
|||
@ApiModelProperty(value = "计划方案id") |
|||
private String designPlanId; |
|||
|
|||
@ApiModelProperty(value = "父管道名称") |
|||
private String parentName; |
|||
|
|||
@ApiModelProperty(value = "子管道名称") |
|||
private String pipeName; |
|||
|
|||
@ApiModelProperty(value = "设计风量") |
|||
private double flow; |
|||
|
|||
@ApiModelProperty(value = "除尘节点") |
|||
private Integer isLeaf; |
|||
|
|||
@ApiModelProperty(value = "是否加入推荐方案计算(0-否,1-是)") |
|||
private Integer isCompute; |
|||
|
|||
@ApiModelProperty(value = "阀门开度") |
|||
private double valveOpening; |
|||
|
|||
@ApiModelProperty(value = "编号") |
|||
private Integer sortOrder; |
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,13 @@ |
|||
package cc.admin.modules.dust.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
@Data |
|||
public class DustData { |
|||
private String id; |
|||
private double flow; |
|||
private double diameter; |
|||
|
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package cc.admin.modules.dust.vo; |
|||
|
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class DustDesignPianExcelVo { |
|||
|
|||
@Excel(name = "推荐方案名称", width = 15) |
|||
private String designPlanName; |
|||
|
|||
@Excel(name = "管道名称", width = 15) |
|||
@ApiModelProperty(value = "管道ID(关联pipe)") |
|||
private String pipeName; |
|||
/**节点阀门打开度(%)*/ |
|||
@Excel(name = "节点阀门打开度", width = 15) |
|||
@ApiModelProperty(value = "节点阀门打开度(%)") |
|||
private Double valveOpening; |
|||
} |
@ -0,0 +1,33 @@ |
|||
package cc.admin.modules.dust.vo; |
|||
|
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class DustMonitorItemExcel { |
|||
|
|||
@ExcelProperty(value = "所属系统") |
|||
private String systemName; |
|||
|
|||
@ExcelProperty(value = "除尘器进口压力") |
|||
private String inletPressureDataTagName; |
|||
|
|||
@ExcelProperty(value = "除尘器出口压力") |
|||
private String outletPressureDataTagName; |
|||
|
|||
@ExcelProperty(value = "风机速度") |
|||
private String fanSpeedDataTagName; |
|||
|
|||
@ExcelProperty(value = "电机电流") |
|||
private String motorCurrentDataTagName; |
|||
|
|||
@ExcelProperty(value = "烟囱CEMS风量") |
|||
private String cemsAirVolumeDataTagName; |
|||
|
|||
@ExcelProperty(value = "粉尘浓度") |
|||
private String dustConcentrationDataTagName; |
|||
|
|||
@ExcelProperty(value = "风机运行状态") |
|||
private String fanStatusDataTagStatusName; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package cc.admin.modules.dust.vo; |
|||
|
|||
import cc.admin.poi.excel.annotation.Excel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class DustMonitorItemVo { |
|||
|
|||
@ApiModelProperty(value = "所属系统") |
|||
private String systemId; |
|||
|
|||
@ApiModelProperty(value = "除尘器进口压力") |
|||
private String inletPressureDataTagId; |
|||
private Double inletPressureDataTagValue; |
|||
|
|||
@ApiModelProperty(value = "除尘器出口压力") |
|||
private String outletPressureDataTagId; |
|||
private Double outletPressureDataTagValue; |
|||
@ApiModelProperty(value = "除尘器进出口压差(pa)") |
|||
private Double pressureDifference; |
|||
|
|||
@ApiModelProperty(value = "风机速度") |
|||
private String fanSpeedDataTagId; |
|||
private Double fanSpeedDataTagValue; |
|||
|
|||
@ApiModelProperty(value = "电机电流") |
|||
private String motorCurrentDataTagId; |
|||
private Double motorCurrentDataTagValue; |
|||
|
|||
@ApiModelProperty(value = "烟囱CEMS风量") |
|||
private String cemsAirVolumeDataTagId; |
|||
private Double cemsAirVolumeDataTagValue; |
|||
|
|||
@ApiModelProperty(value = "粉尘浓度") |
|||
private String dustConcentrationDataTagId; |
|||
private Double dustConcentrationDataTagValue; |
|||
|
|||
@ApiModelProperty(value = "风机运行状态") |
|||
private String fanStatusDataTagId; |
|||
private Integer fanStatusDataTagStatus; |
|||
} |
@ -0,0 +1,15 @@ |
|||
function MxINI() { |
|||
this.uploadPath = "./public/file/"; |
|||
this.mxbinPath = "../../Release/"; |
|||
this.linux = false; |
|||
this.serverPort = 1337; |
|||
this.accessControlAllowOrigin = "*"; |
|||
this.mxcad={ |
|||
uploadPath: "./public/mxcad/file/", |
|||
mxbinPath:"../../MxCAD/Release/" |
|||
}; |
|||
this.enable_gis_map_download = true; |
|||
this.file_ext_name = "mxweb"; |
|||
}; |
|||
var mxIni = new MxINI(); |
|||
module.exports = mxIni; |
@ -0,0 +1,55 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.Mxlog = void 0; |
|||
let log4js = require('log4js'); |
|||
log4js.configure({ |
|||
appenders: [ |
|||
{ |
|||
type: 'console', |
|||
category: "console" |
|||
}, |
|||
{ |
|||
type: "dateFile", |
|||
filename: 'logs/', |
|||
pattern: "yyyyMMdd.txt", |
|||
alwaysIncludePattern: true, |
|||
//category: 'console'
|
|||
} //�����ļ���ʽ
|
|||
], |
|||
replaceConsole: true, |
|||
levels: { |
|||
MXINFO: 'info', |
|||
MXERROR: 'error', |
|||
MXWARN: 'warn', |
|||
MXDEBUG: 'debug', |
|||
} |
|||
}); |
|||
var log_info = log4js.getLogger('MXINFO'); |
|||
class Mxlog { |
|||
constructor(log4js) { |
|||
this.log_info = log4js.getLogger('MXLOG'); |
|||
this.log_error = log4js.getLogger('MXERROR'); |
|||
this.log_warn = log4js.getLogger('MXWARN'); |
|||
this.log_debug = log4js.getLogger('MXDEBUG'); |
|||
} |
|||
error(obj) { |
|||
this.log_error.error(obj); |
|||
} |
|||
warn(obj) { |
|||
this.log_warn.warn(obj); |
|||
} |
|||
info(obj) { |
|||
this.log_info.info(obj); |
|||
} |
|||
debug(obj) { |
|||
this.log_debug.debug(obj); |
|||
} |
|||
use(app) { |
|||
//ҳ��������־,��auto�Ļ�,Ĭ�ϼ�����WARN
|
|||
app.use(log4js.connectLogger(log_info, { level: 'auto', format: ':method :url' })); |
|||
//app.use(log4js.connectLogger(log_info, { level: 'debug', format: ':method :url' }));
|
|||
} |
|||
} |
|||
exports.Mxlog = Mxlog; |
|||
exports.default = new Mxlog(log4js); |
|||
//# sourceMappingURL=log.js.map
|
@ -0,0 +1,28 @@ |
|||
#!/usr/bin/env pwsh |
|||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
|||
|
|||
$exe="" |
|||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
|||
# Fix case when both the Windows and Linux builds of Node |
|||
# are installed in the same directory |
|||
$exe=".exe" |
|||
} |
|||
$ret=0 |
|||
if (Test-Path "$basedir/node$exe") { |
|||
# Support pipeline input |
|||
if ($MyInvocation.ExpectingInput) { |
|||
$input | & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args |
|||
} else { |
|||
& "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args |
|||
} |
|||
$ret=$LASTEXITCODE |
|||
} else { |
|||
# Support pipeline input |
|||
if ($MyInvocation.ExpectingInput) { |
|||
$input | & "node$exe" "$basedir/../acorn/bin/acorn" $args |
|||
} else { |
|||
& "node$exe" "$basedir/../acorn/bin/acorn" $args |
|||
} |
|||
$ret=$LASTEXITCODE |
|||
} |
|||
exit $ret |
@ -0,0 +1,12 @@ |
|||
#!/bin/sh |
|||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
|||
|
|||
case `uname` in |
|||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
|||
esac |
|||
|
|||
if [ -x "$basedir/node" ]; then |
|||
exec "$basedir/node" "$basedir/../babylon/bin/babylon.js" "$@" |
|||
else |
|||
exec node "$basedir/../babylon/bin/babylon.js" "$@" |
|||
fi |
@ -0,0 +1,12 @@ |
|||
#!/bin/sh |
|||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
|||
|
|||
case `uname` in |
|||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
|||
esac |
|||
|
|||
if [ -x "$basedir/node" ]; then |
|||
exec "$basedir/node" "$basedir/../ejs/bin/cli.js" "$@" |
|||
else |
|||
exec node "$basedir/../ejs/bin/cli.js" "$@" |
|||
fi |
@ -0,0 +1,28 @@ |
|||
#!/usr/bin/env pwsh |
|||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
|||
|
|||
$exe="" |
|||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
|||
# Fix case when both the Windows and Linux builds of Node |
|||
# are installed in the same directory |
|||
$exe=".exe" |
|||
} |
|||
$ret=0 |
|||
if (Test-Path "$basedir/node$exe") { |
|||
# Support pipeline input |
|||
if ($MyInvocation.ExpectingInput) { |
|||
$input | & "$basedir/node$exe" "$basedir/../jake/bin/cli.js" $args |
|||
} else { |
|||
& "$basedir/node$exe" "$basedir/../jake/bin/cli.js" $args |
|||
} |
|||
$ret=$LASTEXITCODE |
|||
} else { |
|||
# Support pipeline input |
|||
if ($MyInvocation.ExpectingInput) { |
|||
$input | & "node$exe" "$basedir/../jake/bin/cli.js" $args |
|||
} else { |
|||
& "node$exe" "$basedir/../jake/bin/cli.js" $args |
|||
} |
|||
$ret=$LASTEXITCODE |
|||
} |
|||
exit $ret |
@ -0,0 +1,12 @@ |
|||
#!/bin/sh |
|||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
|||
|
|||
case `uname` in |
|||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
|||
esac |
|||
|
|||
if [ -x "$basedir/node" ]; then |
|||
exec "$basedir/node" "$basedir/../js-yaml/bin/js-yaml.js" "$@" |
|||
else |
|||
exec node "$basedir/../js-yaml/bin/js-yaml.js" "$@" |
|||
fi |
@ -0,0 +1,17 @@ |
|||
@ECHO off |
|||
GOTO start |
|||
:find_dp0 |
|||
SET dp0=%~dp0 |
|||
EXIT /b |
|||
:start |
|||
SETLOCAL |
|||
CALL :find_dp0 |
|||
|
|||
IF EXIST "%dp0%\node.exe" ( |
|||
SET "_prog=%dp0%\node.exe" |
|||
) ELSE ( |
|||
SET "_prog=node" |
|||
SET PATHEXT=%PATHEXT:;.JS;=;% |
|||
) |
|||
|
|||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\which\bin\node-which" %* |
@ -0,0 +1,17 @@ |
|||
@ECHO off |
|||
GOTO start |
|||
:find_dp0 |
|||
SET dp0=%~dp0 |
|||
EXIT /b |
|||
:start |
|||
SETLOCAL |
|||
CALL :find_dp0 |
|||
|
|||
IF EXIST "%dp0%\node.exe" ( |
|||
SET "_prog=%dp0%\node.exe" |
|||
) ELSE ( |
|||
SET "_prog=node" |
|||
SET PATHEXT=%PATHEXT:;.JS;=;% |
|||
) |
|||
|
|||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rimraf\bin.js" %* |
@ -0,0 +1,28 @@ |
|||
#!/usr/bin/env pwsh |
|||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent |
|||
|
|||
$exe="" |
|||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { |
|||
# Fix case when both the Windows and Linux builds of Node |
|||
# are installed in the same directory |
|||
$exe=".exe" |
|||
} |
|||
$ret=0 |
|||
if (Test-Path "$basedir/node$exe") { |
|||
# Support pipeline input |
|||
if ($MyInvocation.ExpectingInput) { |
|||
$input | & "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args |
|||
} else { |
|||
& "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args |
|||
} |
|||
$ret=$LASTEXITCODE |
|||
} else { |
|||
# Support pipeline input |
|||
if ($MyInvocation.ExpectingInput) { |
|||
$input | & "node$exe" "$basedir/../rimraf/bin.js" $args |
|||
} else { |
|||
& "node$exe" "$basedir/../rimraf/bin.js" $args |
|||
} |
|||
$ret=$LASTEXITCODE |
|||
} |
|||
exit $ret |
@ -0,0 +1,12 @@ |
|||
#!/bin/sh |
|||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
|||
|
|||
case `uname` in |
|||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
|||
esac |
|||
|
|||
if [ -x "$basedir/node" ]; then |
|||
exec "$basedir/node" "$basedir/../sshpk/bin/sshpk-conv" "$@" |
|||
else |
|||
exec node "$basedir/../sshpk/bin/sshpk-conv" "$@" |
|||
fi |
@ -0,0 +1,12 @@ |
|||
#!/bin/sh |
|||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
|||
|
|||
case `uname` in |
|||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
|||
esac |
|||
|
|||
if [ -x "$basedir/node" ]; then |
|||
exec "$basedir/node" "$basedir/../sshpk/bin/sshpk-verify" "$@" |
|||
else |
|||
exec node "$basedir/../sshpk/bin/sshpk-verify" "$@" |
|||
fi |
@ -0,0 +1,12 @@ |
|||
#!/bin/sh |
|||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
|||
|
|||
case `uname` in |
|||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
|||
esac |
|||
|
|||
if [ -x "$basedir/node" ]; then |
|||
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@" |
|||
else |
|||
exec node "$basedir/../typescript/bin/tsc" "$@" |
|||
fi |
@ -0,0 +1,12 @@ |
|||
#!/bin/sh |
|||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") |
|||
|
|||
case `uname` in |
|||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; |
|||
esac |
|||
|
|||
if [ -x "$basedir/node" ]; then |
|||
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@" |
|||
else |
|||
exec node "$basedir/../typescript/bin/tsserver" "$@" |
|||
fi |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue