给前端使用

This commit is contained in:
杨晓东 2025-11-21 13:45:35 +08:00
parent cc67568a85
commit bf77da6df7
16 changed files with 166 additions and 371 deletions

View File

@ -1,104 +0,0 @@
package com.shgx.web.controller.dryingroom;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.shgx.common.annotation.Log;
import com.shgx.common.core.controller.BaseController;
import com.shgx.common.core.domain.AjaxResult;
import com.shgx.common.enums.BusinessType;
import com.shgx.dryingroom.web.domain.DryDataCollector;
import com.shgx.dryingroom.web.service.IDryDataCollectorService;
import com.shgx.common.utils.poi.ExcelUtil;
import com.shgx.common.core.page.TableDataInfo;
/**
* 数据采集器Controller
*
* @author shgx
* @date 2025-10-16
*/
@RestController
@RequestMapping("/dry/collector")
public class DryDataCollectorController extends BaseController
{
@Autowired
private IDryDataCollectorService dryDataCollectorService;
/**
* 查询数据采集器列表
*/
@PreAuthorize("@ss.hasPermi('dry:collector:list')")
@GetMapping("/list")
public TableDataInfo list(DryDataCollector dryDataCollector)
{
startPage();
List<DryDataCollector> list = dryDataCollectorService.selectDryDataCollectorList(dryDataCollector);
return getDataTable(list);
}
/**
* 导出数据采集器列表
*/
@PreAuthorize("@ss.hasPermi('dry:collector:export')")
@Log(title = "数据采集器", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DryDataCollector dryDataCollector)
{
List<DryDataCollector> list = dryDataCollectorService.selectDryDataCollectorList(dryDataCollector);
ExcelUtil<DryDataCollector> util = new ExcelUtil<DryDataCollector>(DryDataCollector.class);
util.exportExcel(response, list, "数据采集器数据");
}
/**
* 获取数据采集器详细信息
*/
@PreAuthorize("@ss.hasPermi('dry:collector:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(dryDataCollectorService.selectDryDataCollectorById(id));
}
/**
* 新增数据采集器
*/
@PreAuthorize("@ss.hasPermi('dry:collector:add')")
@Log(title = "数据采集器", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DryDataCollector dryDataCollector)
{
return toAjax(dryDataCollectorService.insertDryDataCollector(dryDataCollector));
}
/**
* 修改数据采集器
*/
@PreAuthorize("@ss.hasPermi('dry:collector:edit')")
@Log(title = "数据采集器", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DryDataCollector dryDataCollector)
{
return toAjax(dryDataCollectorService.updateDryDataCollector(dryDataCollector));
}
/**
* 删除数据采集器
*/
@PreAuthorize("@ss.hasPermi('dry:collector:remove')")
@Log(title = "数据采集器", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(dryDataCollectorService.deleteDryDataCollectorByIds(ids));
}
}

View File

@ -4,7 +4,11 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.shgx.dryingroom.web.domain.DryEquipmentInfo;
import com.shgx.dryingroom.web.domain.dto.ParamThresholdDTO;
import com.shgx.dryingroom.web.service.IDryEquipmentInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -28,6 +32,7 @@ import com.shgx.common.core.page.TableDataInfo;
* @author shgx
* @date 2025-10-16
*/
@Api(tags = "设备信息相关模块")
@RestController
@RequestMapping("/dry/info")
public class DryEquipmentInfoController extends BaseController
@ -111,4 +116,17 @@ public class DryEquipmentInfoController extends BaseController
{
return toAjax(dryEquipmentInfoService.closeAlarm(id));
}
/**
* 获取规则列表
* @return
*/
@ApiOperation(value = "查询规则列表")
@ApiResponse(code = 200, message = "查询成功", response = AjaxResult.class)
@GetMapping("/ruleList")
public AjaxResult getRuleList()
{
List<ParamThresholdDTO> result = dryEquipmentInfoService.ruleList();
return success(result);
}
}

View File

@ -2,6 +2,8 @@ package com.shgx.web.controller.dryingroom;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.*;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -27,6 +29,7 @@ import com.shgx.common.core.page.TableDataInfo;
* @author shgx
* @date 2025-10-16
*/
@Api(tags = "物料温度阈值模块")
@RestController
@RequestMapping("/dry/threshold")
public class DryParamThresholdController extends BaseController
@ -37,6 +40,10 @@ public class DryParamThresholdController extends BaseController
/**
* 查询参数阈值列表
*/
@ApiOperation(value = "查询物料温度阈值列表")
@ApiResponses({
@ApiResponse(code = 200, message = "查询成功", response = TableDataInfo.class),
})
@PreAuthorize("@ss.hasPermi('dry:threshold:list')")
@GetMapping("/list")
public TableDataInfo list(DryParamThreshold dryParamThreshold)

View File

@ -44,6 +44,12 @@
<version>1.2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -1,77 +0,0 @@
package com.shgx.dryingroom.web.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.shgx.common.annotation.Excel;
import com.shgx.common.core.domain.BaseEntity;
import java.time.LocalDateTime;
/**
* 数据采集器对象 dry_data_collector
*
* @author shgx
* @date 2025-10-16
*/
@Data
@TableName("dry_data_collector")
public class DryDataCollector extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
@TableId(type = IdType.AUTO)
private Long id;
/** 采集器编号 */
@TableField("collector_code")
private String collectorCode;
/** 采集器型号 */
@Excel(name = "采集器型号")
@TableField("model")
private String model;
/** IP地址 */
@Excel(name = "IP地址")
@TableField("ip_address")
private String ipAddress;
/** 状态1-正常0-故障 */
@Excel(name = "状态")
@TableField("status")
private Long status;
/** 最后心跳时间 */
@Excel(name = "最后心跳时间")
@TableField("last_heartbeat")
private LocalDateTime lastHeartbeat;
/** 描述 */
@Excel(name = "描述")
@TableField("description")
private String description;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("collectorCode", getCollectorCode())
.append("model", getModel())
.append("ipAddress", getIpAddress())
.append("status", getStatus())
.append("lastHeartbeat", getLastHeartbeat())
.append("description", getDescription())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,58 @@
package com.shgx.dryingroom.web.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.shgx.common.annotation.Excel;
import com.shgx.common.core.domain.BaseEntity;
/**
* 设备字典 dry_equipment_dictionary
*
* @author shgx
* @date 2025-10-16
*/
@Data
@TableName("dry_equipment_dictionary")
public class DryEquipmentDictionary extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
@TableId(type = IdType.AUTO)
private Long id;
/** 设备号 */
@TableField("equipment_code")
private String equipmentCode;
/** 设备名称 */
@Excel(name = "设备名称")
@TableField("equipment_name")
private String equipmentName;
/** 站点 */
@Excel(name = "站点")
@TableField("site")
private String site;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("equipmentCode", getEquipmentCode())
.append("equipmentName", getEquipmentName())
.append("equipmentType", getSite())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -51,10 +51,10 @@ public class DryEquipmentInfo extends BaseEntity
@TableField("status")
private String status;
/** 设定温度 */
@Excel(name = "设定温度")
@TableField("set_tem")
private String setTem;
/** 设定规则 */
@Excel(name = "设定规则")
@TableField("set_rule")
private String setRule;
@Override
public String toString() {
@ -65,7 +65,7 @@ public class DryEquipmentInfo extends BaseEntity
.append("equipmentType", getEquipmentType())
.append("location", getLocation())
.append("status", getStatus())
.append("setTem", getSetTem())
.append("setRule", getSetRule())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -18,45 +20,72 @@ import com.shgx.common.core.domain.BaseEntity;
*/
@Data
@TableName("dry_param_threshold")
@ApiModel(value = "DryParamThreshold", description = "干燥参数阈值查询/提交参数")
public class DryParamThreshold extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
@ApiModelProperty(value = "主键ID", required = false, example = "1001", hidden = true)
@TableId(type = IdType.AUTO)
private Long id;
/** 设备编号 */
@ApiModelProperty(value = "设备编号", required = false, example = "DEVICE-2024-001")
@Excel(name = "设备编号")
@TableField("equipment_code")
private String equipmentCode;
/** 物料编号 */
@ApiModelProperty(value = "物料编号", required = false, example = "MATERIAL-2025-112")
@Excel(name = "物料编号")
@TableField("material_code")
private String materialCode;
/** 物料名称 */
@ApiModelProperty(value = "物料名称", required = false, example = "注塑切片")
@Excel(name = "物料名称")
@TableField("material_name")
private String materialName;
/** 规则名称 */
@ApiModelProperty(value = "规则名称", required = false, example = "TEMP")
@Excel(name = "规则名称")
@TableField("rule_name")
private String ruleName;
/** 参数编码TEMP、DEW */
@ApiModelProperty(value = "参数编码", required = false, example = "TEMP")
@Excel(name = "参数编码")
@TableField("param_code")
private String paramCode;
/** 参数名称:温度、露点 */
@ApiModelProperty(value = "参数名称", required = false, example = "温度")
@Excel(name = "参数名称")
@TableField("param_name")
private String paramName;
/** 单位:℃、%、℃ */
@ApiModelProperty(value = "单位", required = false, example = "")
@Excel(name = "单位")
@TableField("unit")
private String unit;
/** 最低阈值 */
@ApiModelProperty(value = "最低阈值", required = false, example = "30")
@Excel(name = "最低阈值")
@TableField("min_value")
private String minValue;
/** 最高阈值 */
@ApiModelProperty(value = "最高阈值", required = false, example = "70")
@Excel(name = "最高阈值")
@TableField("max_value")
private String maxValue;
/** 是否启用该阈值1启用0停用 */
@ApiModelProperty(value = "是否启用", required = false, example = "1")
@Excel(name = "是否启用该阈值")
@TableField("is_enabled")
private String isEnabled;
@ -66,6 +95,8 @@ public class DryParamThreshold extends BaseEntity
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("equipmentCode", getEquipmentCode())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("paramCode", getParamCode())
.append("paramName", getParamName())
.append("unit", getUnit())

View File

@ -0,0 +1,6 @@
package com.shgx.dryingroom.web.domain.dto;
public class ParamThresholdDTO {
public String ruleName;
}

View File

@ -1,12 +0,0 @@
package com.shgx.dryingroom.web.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shgx.dryingroom.web.domain.DryDataCollector;
/**
* 数据采集器Mapper接口
*
* @author shgx
* @date 2025-10-16
*/
public interface DryDataCollectorMapper extends BaseMapper<DryDataCollector> { }

View File

@ -0,0 +1,4 @@
package com.shgx.dryingroom.web.mapper;
public interface DryEquipmentDictionaryMapper {
}

View File

@ -1,61 +0,0 @@
package com.shgx.dryingroom.web.service;
import java.util.List;
import com.shgx.dryingroom.web.domain.DryDataCollector;
/**
* 数据采集器Service接口
*
* @author shgx
* @date 2025-10-16
*/
public interface IDryDataCollectorService
{
/**
* 查询数据采集器
*
* @param id 数据采集器主键
* @return 数据采集器
*/
public DryDataCollector selectDryDataCollectorById(Long id);
/**
* 查询数据采集器列表
*
* @param dryDataCollector 数据采集器
* @return 数据采集器集合
*/
public List<DryDataCollector> selectDryDataCollectorList(DryDataCollector dryDataCollector);
/**
* 新增数据采集器
*
* @param dryDataCollector 数据采集器
* @return 结果
*/
public int insertDryDataCollector(DryDataCollector dryDataCollector);
/**
* 修改数据采集器
*
* @param dryDataCollector 数据采集器
* @return 结果
*/
public int updateDryDataCollector(DryDataCollector dryDataCollector);
/**
* 批量删除数据采集器
*
* @param ids 需要删除的数据采集器主键集合
* @return 结果
*/
public int deleteDryDataCollectorByIds(Long[] ids);
/**
* 删除数据采集器信息
*
* @param id 数据采集器主键
* @return 结果
*/
public int deleteDryDataCollectorById(Long id);
}

View File

@ -2,6 +2,7 @@ package com.shgx.dryingroom.web.service;
import java.util.List;
import com.shgx.dryingroom.web.domain.DryEquipmentInfo;
import com.shgx.dryingroom.web.domain.dto.ParamThresholdDTO;
/**
* 设备信息Service接口
@ -65,4 +66,10 @@ public interface IDryEquipmentInfoService
* @return
*/
public int closeAlarm(Long id);
/**
* 规则列表
* @return
*/
public List<ParamThresholdDTO> ruleList();
}

View File

@ -1,110 +0,0 @@
package com.shgx.dryingroom.web.service.impl;
import java.util.Arrays;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.shgx.common.utils.DateUtils;
import com.shgx.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.shgx.dryingroom.web.mapper.DryDataCollectorMapper;
import com.shgx.dryingroom.web.domain.DryDataCollector;
import com.shgx.dryingroom.web.service.IDryDataCollectorService;
/**
* 数据采集器Service业务层处理
*
* @author shgx
* @date 2025-10-16
*/
@Service
@DS("postgres")
public class DryDataCollectorServiceImpl implements IDryDataCollectorService
{
@Autowired
private DryDataCollectorMapper dryDataCollectorMapper;
/**
* 查询数据采集器
*
* @param id 数据采集器主键
* @return 数据采集器
*/
@Override
public DryDataCollector selectDryDataCollectorById(Long id)
{
return dryDataCollectorMapper.selectById(id);
}
/**
* 查询数据采集器列表
*
* @param dryDataCollector 数据采集器
* @return 数据采集器
*/
@Override
public List<DryDataCollector> selectDryDataCollectorList(DryDataCollector dryDataCollector)
{
LambdaQueryWrapper<DryDataCollector> queryWrapper = new LambdaQueryWrapper<>(dryDataCollector);
return dryDataCollectorMapper.selectList(queryWrapper.orderByDesc(DryDataCollector::getCreateTime));
}
/**
* 新增数据采集器
*
* @param dryDataCollector 数据采集器
* @return 结果
*/
@Override
public int insertDryDataCollector(DryDataCollector dryDataCollector)
{
dryDataCollector.setCreateBy(SecurityUtils.getUsername());
dryDataCollector.setCreateTime(DateUtils.getNowDate());
return dryDataCollectorMapper.insert(dryDataCollector);
}
/**
* 修改数据采集器
*
* @param dryDataCollector 数据采集器
* @return 结果
*/
@Override
public int updateDryDataCollector(DryDataCollector dryDataCollector)
{
dryDataCollector.setUpdateBy(SecurityUtils.getUsername());
dryDataCollector.setUpdateTime(DateUtils.getNowDate());
return dryDataCollectorMapper.updateById(dryDataCollector);
}
/**
* 批量删除数据采集器
*
* @param ids 需要删除的数据采集器主键
* @return 结果
*/
@Override
public int deleteDryDataCollectorByIds(Long[] ids)
{
List<Long> idList = Arrays.asList(ids);
return dryDataCollectorMapper.deleteByIds(idList);
}
/**
* 删除数据采集器信息
*
* @param id 数据采集器主键
* @return 结果
*/
@Override
public int deleteDryDataCollectorById(Long id)
{
return dryDataCollectorMapper.deleteById(id);
}
}

View File

@ -1,5 +1,6 @@
package com.shgx.dryingroom.web.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -8,6 +9,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.shgx.common.utils.DateUtils;
import com.shgx.common.utils.SecurityUtils;
import com.shgx.dryingroom.alarm.AlarmLightService;
import com.shgx.dryingroom.web.domain.DryParamThreshold;
import com.shgx.dryingroom.web.domain.dto.ParamThresholdDTO;
import com.shgx.dryingroom.web.mapper.DryParamThresholdMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.shgx.dryingroom.web.mapper.DryEquipmentInfoMapper;
@ -27,6 +31,9 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService
@Autowired
private DryEquipmentInfoMapper dryEquipmentInfoMapper;
@Autowired
private DryParamThresholdMapper paramMapper;
@Autowired
private AlarmLightService alarmLightService;
@ -132,4 +139,19 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService
}
return dryEquipmentInfoMapper.updateById(info);
}
/**
* 规则列表
* @return
*/
@Override
public List<ParamThresholdDTO> ruleList() {
List<DryParamThreshold> list = paramMapper.selectList(null);
List<ParamThresholdDTO> result = new ArrayList<>();
for (DryParamThreshold item : list) {
ParamThresholdDTO param = new ParamThresholdDTO();
param.ruleName = item.getRuleName();
}
return result;
}
}

View File

@ -75,7 +75,7 @@ public class DryEquipmentScreenServiceImpl implements IDryEquipmentScreenService
dto.setEquipmentCode(equipmentCode);
dto.setEquipmentName(equipment.getEquipmentName());
dto.setStatus(equipment.getStatus());
dto.setSetTem(equipment.getSetTem());
dto.setSetTem(equipment.getSetRule());
dto.setEquipmentType("1");
dto.setParamList(paramMap.getOrDefault(equipmentCode, Collections.emptyList()));
@ -182,7 +182,7 @@ public class DryEquipmentScreenServiceImpl implements IDryEquipmentScreenService
dto.setEquipmentCode(equipmentCode);
dto.setEquipmentName(equipment.getEquipmentName());
dto.setStatus(equipment.getStatus());
dto.setSetTem(equipment.getSetTem());
dto.setSetTem(equipment.getSetRule());
dto.setEquipmentType("2");
// 阈值规则列表
dto.setParamList(paramMap.getOrDefault(equipmentCode, Collections.emptyList()));