RTU-采集协议

This commit is contained in:
1378012178@qq.com 2025-08-25 21:15:57 +08:00
parent 1c14f8a8c5
commit 581b56c6b5
6 changed files with 325 additions and 0 deletions

View File

@ -0,0 +1,172 @@
package org.jeecg.modules.analysisrule.controller;
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.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.modules.analysisrule.entity.AnalysisRule;
import org.jeecg.modules.analysisrule.service.IAnalysisRuleService;
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;
import java.util.HashMap;
import java.util.Map;
/**
* @Description: bl_analysis_rule
* @Author: jeecg-boot
* @Date: 2025-08-25
* @Version: V1.0
*/
@Api(tags = "bl_analysis_rule")
@RestController
@RequestMapping("/analysisrule/analysisRule")
@Slf4j
public class AnalysisRuleController extends JeecgController<AnalysisRule, IAnalysisRuleService> {
@Autowired
private IAnalysisRuleService analysisRuleService;
/**
* 分页列表查询
*
* @param analysisRule
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "bl_analysis_rule-分页列表查询")
@ApiOperation(value = "bl_analysis_rule-分页列表查询", notes = "bl_analysis_rule-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<AnalysisRule>> queryPageList(AnalysisRule analysisRule,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
customeRuleMap.put("companyId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("sourceId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("stationId", QueryRuleEnum.LIKE_WITH_OR);
QueryWrapper<AnalysisRule> queryWrapper = QueryGenerator.initQueryWrapper(analysisRule, req.getParameterMap(), customeRuleMap);
queryWrapper.eq("region_type", analysisRule.getRegionType());
Page<AnalysisRule> page = new Page<AnalysisRule>(pageNo, pageSize);
IPage<AnalysisRule> pageList = analysisRuleService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param analysisRule
* @return
*/
@AutoLog(value = "bl_analysis_rule-添加")
@ApiOperation(value = "bl_analysis_rule-添加", notes = "bl_analysis_rule-添加")
@RequiresPermissions("analysisrule:bl_analysis_rule:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody AnalysisRule analysisRule) {
analysisRuleService.save(analysisRule);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param analysisRule
* @return
*/
@AutoLog(value = "bl_analysis_rule-编辑")
@ApiOperation(value = "bl_analysis_rule-编辑", notes = "bl_analysis_rule-编辑")
@RequiresPermissions("analysisrule:bl_analysis_rule:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody AnalysisRule analysisRule) {
analysisRuleService.updateById(analysisRule);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "bl_analysis_rule-通过id删除")
@ApiOperation(value = "bl_analysis_rule-通过id删除", notes = "bl_analysis_rule-通过id删除")
@RequiresPermissions("analysisrule:bl_analysis_rule:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
analysisRuleService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "bl_analysis_rule-批量删除")
@ApiOperation(value = "bl_analysis_rule-批量删除", notes = "bl_analysis_rule-批量删除")
@RequiresPermissions("analysisrule:bl_analysis_rule:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.analysisRuleService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "bl_analysis_rule-通过id查询")
@ApiOperation(value = "bl_analysis_rule-通过id查询", notes = "bl_analysis_rule-通过id查询")
@GetMapping(value = "/queryById")
public Result<AnalysisRule> queryById(@RequestParam(name = "id", required = true) String id) {
AnalysisRule analysisRule = analysisRuleService.getById(id);
if (analysisRule == null) {
return Result.error("未找到对应数据");
}
return Result.OK(analysisRule);
}
/**
* 导出excel
*
* @param request
* @param analysisRule
*/
@RequiresPermissions("analysisrule:bl_analysis_rule:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, AnalysisRule analysisRule) {
return super.exportXls(request, analysisRule, AnalysisRule.class, "bl_analysis_rule");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("analysisrule:bl_analysis_rule:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, AnalysisRule.class);
}
}

View File

@ -0,0 +1,101 @@
package org.jeecg.modules.analysisrule.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: bl_analysis_rule
* @Author: jeecg-boot
* @Date: 2025-08-25
* @Version: V1.0
*/
@Data
@TableName("bl_analysis_rule")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="bl_analysis_rule对象", description="bl_analysis_rule")
public class AnalysisRule implements Serializable {
private static final long serialVersionUID = 1L;
/**ID*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "ID")
private java.lang.Integer id;
/**卡号*/
@Excel(name = "卡号", width = 15)
@ApiModelProperty(value = "卡号")
private java.lang.String sim;
/**规则代码 1 2 3 4 5 */
@Excel(name = "规则代码 1 2 3 4 5 ", width = 15)
@ApiModelProperty(value = "规则代码 1 2 3 4 5 ")
private java.lang.String code;
/**规则描述 1:0141规则码 2:31字节长度 3:73字节长度 4:26字节长度 5:不解析*/
@Excel(name = "规则描述 1:0141规则码 2:31字节长度 3:73字节长度 4:26字节长度 5:不解析", width = 15)
@ApiModelProperty(value = "规则描述 1:0141规则码 2:31字节长度 3:73字节长度 4:26字节长度 5:不解析")
private java.lang.String remarks;
/**热力公司ID*/
@Excel(name = "热力公司ID", width = 15, dictTable = "bl_thermalcompany", dicText = "company_name", dicCode = "id")
@Dict(dictTable = "bl_thermalcompany", dicText = "company_name", dicCode = "id")
@ApiModelProperty(value = "热力公司ID")
private java.lang.Integer companyId;
/**热力公司*/
@Excel(name = "热力公司", width = 15)
@ApiModelProperty(value = "热力公司")
private java.lang.String conpanyName;
/**锅炉房ID*/
@Excel(name = "锅炉房ID", width = 15, dictTable = "bl_heatsource", dicText = "source_name", dicCode = "id")
@Dict(dictTable = "bl_heatsource", dicText = "source_name", dicCode = "id")
@ApiModelProperty(value = "锅炉房ID")
private java.lang.Integer sourceId;
/**锅炉房*/
@Excel(name = "锅炉房", width = 15)
@ApiModelProperty(value = "锅炉房")
private java.lang.String sourceName;
/**换热站ID*/
@Excel(name = "换热站ID", width = 15, dictTable = "bl_heatsourcestation", dicText = "station_name", dicCode = "id")
@Dict(dictTable = "bl_heatsourcestation", dicText = "station_name", dicCode = "id")
@ApiModelProperty(value = "换热站ID")
private java.lang.Integer stationId;
/**换热站*/
@Excel(name = "换热站", width = 15)
@ApiModelProperty(value = "换热站")
private java.lang.String stationName;
/**删除标识*/
@Excel(name = "删除标识", width = 15)
@ApiModelProperty(value = "删除标识")
@TableLogic
private java.lang.String delFlag;
/**创建时间*/
@Excel(name = "创建时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "创建时间")
private java.util.Date createDate;
/**更改时间*/
@Excel(name = "更改时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "更改时间")
private java.util.Date updateDate;
/**地区类型*/
@Excel(name = "地区类型", width = 15)
@ApiModelProperty(value = "地区类型")
private java.lang.String regionType;
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.analysisrule.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.analysisrule.entity.AnalysisRule;
/**
* @Description: bl_analysis_rule
* @Author: jeecg-boot
* @Date: 2025-08-25
* @Version: V1.0
*/
public interface AnalysisRuleMapper extends BaseMapper<AnalysisRule> {
}

View File

@ -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="org.jeecg.modules.analysisrule.mapper.AnalysisRuleMapper">
</mapper>

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.analysisrule.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.analysisrule.entity.AnalysisRule;
/**
* @Description: bl_analysis_rule
* @Author: jeecg-boot
* @Date: 2025-08-25
* @Version: V1.0
*/
public interface IAnalysisRuleService extends IService<AnalysisRule> {
}

View File

@ -0,0 +1,18 @@
package org.jeecg.modules.analysisrule.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.analysisrule.entity.AnalysisRule;
import org.jeecg.modules.analysisrule.mapper.AnalysisRuleMapper;
import org.jeecg.modules.analysisrule.service.IAnalysisRuleService;
import org.springframework.stereotype.Service;
/**
* @Description: bl_analysis_rule
* @Author: jeecg-boot
* @Date: 2025-08-25
* @Version: V1.0
*/
@Service
public class AnalysisRuleServiceImpl extends ServiceImpl<AnalysisRuleMapper, AnalysisRule> implements IAnalysisRuleService {
}