自动化条件保存
parent
cd36d21d01
commit
955adba5cb
|
|
@ -0,0 +1,104 @@
|
|||
package com.agri.system.controller;
|
||||
|
||||
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.agri.common.annotation.Log;
|
||||
import com.agri.common.core.controller.BaseController;
|
||||
import com.agri.common.core.domain.AjaxResult;
|
||||
import com.agri.common.enums.BusinessType;
|
||||
import com.agri.system.domain.SysRollerAir;
|
||||
import com.agri.system.service.ISysRollerAirService;
|
||||
import com.agri.common.utils.poi.ExcelUtil;
|
||||
import com.agri.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 自动化卷膜风口大小设置Controller
|
||||
*
|
||||
* @author lld
|
||||
* @date 2026-03-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/assets/air")
|
||||
public class SysRollerAirController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysRollerAirService sysRollerAirService;
|
||||
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRollerAir sysRollerAir)
|
||||
{
|
||||
startPage();
|
||||
List<SysRollerAir> list = sysRollerAirService.selectSysRollerAirList(sysRollerAir);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出自动化卷膜风口大小设置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:export')")
|
||||
@Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysRollerAir sysRollerAir)
|
||||
{
|
||||
List<SysRollerAir> list = sysRollerAirService.selectSysRollerAirList(sysRollerAir);
|
||||
ExcelUtil<SysRollerAir> util = new ExcelUtil<SysRollerAir>(SysRollerAir.class);
|
||||
util.exportExcel(response, list, "自动化卷膜风口大小设置数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自动化卷膜风口大小设置详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(sysRollerAirService.selectSysRollerAirById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增自动化卷膜风口大小设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:add')")
|
||||
@Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysRollerAir sysRollerAir)
|
||||
{
|
||||
return toAjax(sysRollerAirService.insertSysRollerAir(sysRollerAir));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自动化卷膜风口大小设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:edit')")
|
||||
@Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysRollerAir sysRollerAir)
|
||||
{
|
||||
return toAjax(sysRollerAirService.updateSysRollerAir(sysRollerAir));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自动化卷膜风口大小设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:remove')")
|
||||
@Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysRollerAirService.deleteSysRollerAirByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
package com.agri.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.agri.common.annotation.Excel;
|
||||
import com.agri.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 自动化卷膜风口大小设置对象 sys_roller_air
|
||||
*
|
||||
* @author lld
|
||||
* @date 2026-03-04
|
||||
*/
|
||||
@TableName("sys_roller_air")
|
||||
public class SysRollerAir extends BaseEntity
|
||||
{
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 设备IMEI码 */
|
||||
@Excel(name = "设备IMEI码")
|
||||
private String imei;
|
||||
|
||||
/** 卷膜器编号/标识 */
|
||||
@Excel(name = "卷膜器编号/标识")
|
||||
private String roller;
|
||||
|
||||
/** 操作类型 0-停止 1-运行 2-查询 3-重置 */
|
||||
@Excel(name = "操作类型 0-停止 1-运行 2-查询 3-重置")
|
||||
private Long opType;
|
||||
|
||||
/** 操作参数(JSON格式,存储风口大小等配置) */
|
||||
@Excel(name = "操作参数(JSON格式,存储风口大小等配置)")
|
||||
private String payload;
|
||||
|
||||
/** 客户端ID */
|
||||
@Excel(name = "客户端ID")
|
||||
private String clientid;
|
||||
|
||||
/** 操作执行时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
@Excel(name = "操作执行时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date opTime;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setImei(String imei)
|
||||
{
|
||||
this.imei = imei;
|
||||
}
|
||||
|
||||
public String getImei()
|
||||
{
|
||||
return imei;
|
||||
}
|
||||
|
||||
public void setRoller(String roller)
|
||||
{
|
||||
this.roller = roller;
|
||||
}
|
||||
|
||||
public String getRoller()
|
||||
{
|
||||
return roller;
|
||||
}
|
||||
|
||||
public void setOpType(Long opType)
|
||||
{
|
||||
this.opType = opType;
|
||||
}
|
||||
|
||||
public Long getOpType()
|
||||
{
|
||||
return opType;
|
||||
}
|
||||
|
||||
public void setPayload(String payload)
|
||||
{
|
||||
this.payload = payload;
|
||||
}
|
||||
|
||||
public String getPayload()
|
||||
{
|
||||
return payload;
|
||||
}
|
||||
|
||||
public void setClientid(String clientid)
|
||||
{
|
||||
this.clientid = clientid;
|
||||
}
|
||||
|
||||
public String getClientid()
|
||||
{
|
||||
return clientid;
|
||||
}
|
||||
|
||||
public void setOpTime(Date opTime)
|
||||
{
|
||||
this.opTime = opTime;
|
||||
}
|
||||
|
||||
public Date getOpTime()
|
||||
{
|
||||
return opTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("imei", getImei())
|
||||
.append("roller", getRoller())
|
||||
.append("opType", getOpType())
|
||||
.append("payload", getPayload())
|
||||
.append("clientid", getClientid())
|
||||
.append("opTime", getOpTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.agri.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.agri.system.domain.SysRollerAir;
|
||||
|
||||
/**
|
||||
* 自动化卷膜风口大小设置Mapper接口
|
||||
*
|
||||
* @author lld
|
||||
* @date 2026-03-04
|
||||
*/
|
||||
public interface SysRollerAirMapper extends BaseMapper<SysRollerAir>
|
||||
{
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 自动化卷膜风口大小设置
|
||||
*/
|
||||
public SysRollerAir selectSysRollerAirById(Long id);
|
||||
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置列表
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 自动化卷膜风口大小设置集合
|
||||
*/
|
||||
public List<SysRollerAir> selectSysRollerAirList(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 新增自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysRollerAir(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 修改自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysRollerAir(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 删除自动化卷膜风口大小设置
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRollerAirById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除自动化卷膜风口大小设置
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRollerAirByIds(Long[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.agri.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.agri.system.domain.SysRollerAir;
|
||||
|
||||
/**
|
||||
* 自动化卷膜风口大小设置Service接口
|
||||
*
|
||||
* @author lld
|
||||
* @date 2026-03-04
|
||||
*/
|
||||
public interface ISysRollerAirService extends IService<SysRollerAir> {
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 自动化卷膜风口大小设置
|
||||
*/
|
||||
public SysRollerAir selectSysRollerAirById(Long id);
|
||||
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置列表
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 自动化卷膜风口大小设置集合
|
||||
*/
|
||||
public List<SysRollerAir> selectSysRollerAirList(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 新增自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysRollerAir(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 修改自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysRollerAir(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 批量删除自动化卷膜风口大小设置
|
||||
*
|
||||
* @param ids 需要删除的自动化卷膜风口大小设置主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRollerAirByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除自动化卷膜风口大小设置信息
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRollerAirById(Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.agri.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.agri.common.utils.DateUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.agri.system.mapper.SysRollerAirMapper;
|
||||
import com.agri.system.domain.SysRollerAir;
|
||||
import com.agri.system.service.ISysRollerAirService;
|
||||
|
||||
/**
|
||||
* 自动化卷膜风口大小设置Service业务层处理
|
||||
*
|
||||
* @author lld
|
||||
* @date 2026-03-04
|
||||
*/
|
||||
@Service
|
||||
public class SysRollerAirServiceImpl extends ServiceImpl<SysRollerAirMapper, SysRollerAir> implements ISysRollerAirService
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 自动化卷膜风口大小设置
|
||||
*/
|
||||
@Override
|
||||
public SysRollerAir selectSysRollerAirById(Long id)
|
||||
{
|
||||
return baseMapper.selectSysRollerAirById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置列表
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 自动化卷膜风口大小设置
|
||||
*/
|
||||
@Override
|
||||
public List<SysRollerAir> selectSysRollerAirList(SysRollerAir sysRollerAir)
|
||||
{
|
||||
return baseMapper.selectSysRollerAirList(sysRollerAir);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysRollerAir(SysRollerAir sysRollerAir)
|
||||
{
|
||||
sysRollerAir.setCreateTime(DateUtils.getNowDate());
|
||||
return baseMapper.insertSysRollerAir(sysRollerAir);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysRollerAir(SysRollerAir sysRollerAir)
|
||||
{
|
||||
sysRollerAir.setUpdateTime(DateUtils.getNowDate());
|
||||
return baseMapper.updateSysRollerAir(sysRollerAir);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除自动化卷膜风口大小设置
|
||||
*
|
||||
* @param ids 需要删除的自动化卷膜风口大小设置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysRollerAirByIds(Long[] ids)
|
||||
{
|
||||
return baseMapper.deleteSysRollerAirByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自动化卷膜风口大小设置信息
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysRollerAirById(Long id)
|
||||
{
|
||||
return baseMapper.deleteSysRollerAirById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,8 @@ spring:
|
|||
username: admin # Mosquitto共用账号
|
||||
password: Admin#12345678 # Mosquitto密码
|
||||
client-id: springboot-backend # 截取UUID前8位(自动去横线)
|
||||
default-topic: dtu/+/up,dtu/+/ack,frontend/+/control/+,frontend/+/online # 后端监听的主题
|
||||
# 后端监听的主题
|
||||
default-topic: dtu/+/up,dtu/+/ack,frontend/+/control/+,frontend/+/online, frontend/+/+/config
|
||||
qos: 0 # 消息可靠性
|
||||
timeout: 60 # 连接超时
|
||||
keep-alive: 60 # 心跳间隔
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ agri:
|
|||
addressEnabled: true
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 卷膜滚轴长度和秒数
|
||||
per-lap:
|
||||
sec: 18 # 以秒为单位
|
||||
len: 2.13 # 以cm为单位
|
||||
# 开启增强
|
||||
knife4j:
|
||||
enable: true
|
||||
|
|
|
|||
|
|
@ -0,0 +1,97 @@
|
|||
<?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="com.agri.system.mapper.SysRollerAirMapper">
|
||||
|
||||
<resultMap type="SysRollerAir" id="SysRollerAirResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="imei" column="imei" />
|
||||
<result property="roller" column="roller" />
|
||||
<result property="opType" column="op_type" />
|
||||
<result property="payload" column="payload" />
|
||||
<result property="clientid" column="clientid" />
|
||||
<result property="opTime" column="op_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysRollerAirVo">
|
||||
select id, imei, roller, op_type, payload, clientid, op_time, create_by, create_time, update_by, update_time from sys_roller_air
|
||||
</sql>
|
||||
|
||||
<select id="selectSysRollerAirList" parameterType="SysRollerAir" resultMap="SysRollerAirResult">
|
||||
<include refid="selectSysRollerAirVo"/>
|
||||
<where>
|
||||
<if test="imei != null and imei != ''"> and imei = #{imei}</if>
|
||||
<if test="roller != null and roller != ''"> and roller = #{roller}</if>
|
||||
<if test="opType != null "> and op_type = #{opType}</if>
|
||||
<if test="payload != null and payload != ''"> and payload = #{payload}</if>
|
||||
<if test="clientid != null and clientid != ''"> and clientid = #{clientid}</if>
|
||||
<if test="opTime != null "> and op_time = #{opTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysRollerAirById" parameterType="Long" resultMap="SysRollerAirResult">
|
||||
<include refid="selectSysRollerAirVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysRollerAir" parameterType="SysRollerAir" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_roller_air
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="imei != null and imei != ''">imei,</if>
|
||||
<if test="roller != null and roller != ''">roller,</if>
|
||||
<if test="opType != null">op_type,</if>
|
||||
<if test="payload != null">payload,</if>
|
||||
<if test="clientid != null">clientid,</if>
|
||||
<if test="opTime != null">op_time,</if>
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="imei != null and imei != ''">#{imei},</if>
|
||||
<if test="roller != null and roller != ''">#{roller},</if>
|
||||
<if test="opType != null">#{opType},</if>
|
||||
<if test="payload != null">#{payload},</if>
|
||||
<if test="clientid != null">#{clientid},</if>
|
||||
<if test="opTime != null">#{opTime},</if>
|
||||
#{createBy},
|
||||
#{createTime},
|
||||
#{updateBy},
|
||||
#{updateTime},
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysRollerAir" parameterType="SysRollerAir">
|
||||
update sys_roller_air
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="imei != null and imei != ''">imei = #{imei},</if>
|
||||
<if test="roller != null and roller != ''">roller = #{roller},</if>
|
||||
<if test="opType != null">op_type = #{opType},</if>
|
||||
<if test="payload != null">payload = #{payload},</if>
|
||||
<if test="clientid != null">clientid = #{clientid},</if>
|
||||
<if test="opTime != null">op_time = #{opTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysRollerAirById" parameterType="Long">
|
||||
delete from sys_roller_air where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysRollerAirByIds" parameterType="String">
|
||||
delete from sys_roller_air where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
package com.agri.framework.interceptor;
|
||||
|
||||
import com.agri.framework.config.MqttConfig;
|
||||
import com.agri.system.domain.SysRollerAir;
|
||||
import com.agri.system.service.*;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
public class FrontendConfigHandler {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(FrontendConfigHandler.class);
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Resource
|
||||
private MqttConfig.MqttMessageSender mqttMessageSender;
|
||||
|
||||
@Autowired
|
||||
private ISysRollerAirService sysRollerAirService;
|
||||
|
||||
@Value("${spring.mqtt.dtu-ctl-lock-ttl}")
|
||||
private int dtuCtlLockTTL;
|
||||
|
||||
@Value("${agri.per-lap.len}")
|
||||
private BigDecimal perLapLen;
|
||||
|
||||
@Value("${agri.per-lap.sec}")
|
||||
private BigDecimal perLapSec;
|
||||
/**
|
||||
* 处理前端控制指令:权限校验+分布式锁+转发给设备
|
||||
*/
|
||||
public void handle(String topic, String payload) throws MqttException {
|
||||
// 解析前端clientId、设备ID
|
||||
String[] parts = topic.split("/");
|
||||
String clientId = parts[1];
|
||||
String deviceId = parts[2];
|
||||
|
||||
// 新增:入参非空校验(JDK 8兼容)
|
||||
if (!StringUtils.hasText(clientId) || !StringUtils.hasText(deviceId)) {
|
||||
log.error("【指令处理】clientId或deviceId为空,topic={}", topic);
|
||||
return;
|
||||
}
|
||||
// 解析功能码({"功能码":状态码}格式)
|
||||
Map<String, Integer> funcCodeMap = null;
|
||||
try {
|
||||
funcCodeMap = JSON.parseObject(payload, new TypeReference<Map<String, Integer>>() {
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("【指令处理】功能码解析失败,payload={}", payload, e);
|
||||
return;
|
||||
}
|
||||
if (funcCodeMap == null || funcCodeMap.isEmpty()) {
|
||||
log.warn("【指令处理】前端{}操作设备{}失败:功能码为空", clientId, deviceId);
|
||||
return;
|
||||
}
|
||||
// 提取第一个功能码作为锁标识
|
||||
String funcType = funcCodeMap.keySet().iterator().next();
|
||||
|
||||
// 2. 分布式锁:设备ID+功能类型(避免同设备同功能并发控制)
|
||||
String lockKey = "lock:" + deviceId + ":" + funcType;
|
||||
Boolean lockSuccess = stringRedisTemplate.opsForValue().setIfAbsent(
|
||||
lockKey, clientId, dtuCtlLockTTL, TimeUnit.SECONDS // 延长至15秒,适配设备回执场景
|
||||
);
|
||||
if (lockSuccess == null || !lockSuccess) {
|
||||
String errorTopic = "frontend/" + clientId + "/dtu/" + deviceId + "/listener";
|
||||
mqttMessageSender.publish(errorTopic, "{\"msg\":\"设备" + funcType + "功能忙,请稍后重试\",\"clientId\":\""+clientId+"\"}");
|
||||
log.warn("【分布式锁】前端{}操作设备{}的{}功能失败;可能其他用户正在操作此功能", clientId, deviceId, funcType);
|
||||
return;
|
||||
}
|
||||
// 转发前端指令
|
||||
String deviceTopic = "dtu/" + deviceId + "/down";
|
||||
mqttMessageSender.publish(deviceTopic, payload);
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
// 3. 记录日志
|
||||
log.info("【指令处理】前端{}于{}控制设备{}的{}功能,指令:{}",
|
||||
clientId, currentTime, deviceId, funcType, payload);
|
||||
|
||||
String funcName = funcType.substring(0, funcType.length() - 1);
|
||||
Integer funcCode = funcCodeMap.get("funcType");
|
||||
|
||||
// 当卷膜 开 暂停,才执行的逻辑
|
||||
if (funcCode == 0 && funcType.contains("k")) {
|
||||
SysRollerAir sysRollerAir = sysRollerAirService.lambdaQuery()
|
||||
.eq(SysRollerAir::getImei, deviceId)
|
||||
.eq(SysRollerAir::getRoller, funcName)
|
||||
.eq(SysRollerAir::getOpType, 1)
|
||||
.orderByDesc(SysRollerAir::getId)
|
||||
.last("limit 1")
|
||||
.one();
|
||||
BigDecimal ventTotalLen = BigDecimal.ZERO;
|
||||
if (ObjectUtils.isNotEmpty(sysRollerAir)
|
||||
&& sysRollerAir.getOpTime().isBefore(currentTime)) {
|
||||
|
||||
long time = Math.abs(Duration.between(currentTime, sysRollerAir.getOpTime()).getSeconds());
|
||||
BigDecimal ventTotalTime = BigDecimal.valueOf(time);
|
||||
|
||||
// 除以一圈的时间乘以一圈的长度
|
||||
ventTotalLen = ventTotalTime.divide(perLapSec, 2, RoundingMode.HALF_UP)
|
||||
.multiply(perLapLen).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
String config = "{\"ventTotalLen\": " + ventTotalLen +",\"clientId\":\""+clientId+"\"}";
|
||||
// 查数据库、最后一条卷膜开暂停。计算时间发送自动关时间
|
||||
mqttMessageSender.publish("frontend/"+clientId+"/dtu/"+deviceId+"/config", config);
|
||||
}
|
||||
// 插入记录
|
||||
SysRollerAir rollerAir = new SysRollerAir();
|
||||
rollerAir.setImei(deviceId);
|
||||
rollerAir.setRoller(funcName);
|
||||
rollerAir.setOpType(funcCode);
|
||||
rollerAir.setPayload(payload);
|
||||
rollerAir.setClientid(clientId);
|
||||
rollerAir.setOpTime(currentTime);
|
||||
sysRollerAirService.save(rollerAir);
|
||||
log.info("【指令转发】前端{} → 设备{}的{}功能", clientId, deviceId, funcType);
|
||||
}
|
||||
}
|
||||
|
|
@ -100,6 +100,13 @@ public class FrontendControlHandler {
|
|||
log.error("【指令处理】clientId或deviceId为空,topic={}", topic);
|
||||
return;
|
||||
}
|
||||
// 1. 权限校验(示例:admin开头有全权限)
|
||||
if (!checkPermission(clientId, deviceId)) {
|
||||
String errorTopic = "frontend/" + clientId + "/dtu/" + deviceId + "/listener";
|
||||
mqttMessageSender.publish(errorTopic, "{\"msg\":\"无设备操作权限\"}");
|
||||
log.warn("【权限校验】前端{}操作设备{}失败", clientId, deviceId);
|
||||
return;
|
||||
}
|
||||
// 4. 转发指令到设备
|
||||
String deviceTopic = "dtu/" + deviceId + "/down";
|
||||
JSONObject payloadObj;
|
||||
|
|
@ -134,14 +141,6 @@ public class FrontendControlHandler {
|
|||
// 提取第一个功能码作为锁标识
|
||||
String funcType = funcCodeMap.keySet().iterator().next();
|
||||
|
||||
// 1. 权限校验(示例:admin开头有全权限)
|
||||
if (!checkPermission(clientId, deviceId)) {
|
||||
String errorTopic = "frontend/" + clientId + "/dtu/" + deviceId + "/listener";
|
||||
mqttMessageSender.publish(errorTopic, "{\"msg\":\"无设备操作权限\"}");
|
||||
log.warn("【权限校验】前端{}操作设备{}失败", clientId, deviceId);
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 分布式锁:设备ID+功能类型(避免同设备同功能并发控制)
|
||||
String lockKey = "lock:" + deviceId + ":" + funcType;
|
||||
Boolean lockSuccess = stringRedisTemplate.opsForValue().setIfAbsent(
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package com.agri.framework.web.dispatcher;
|
||||
|
||||
import com.agri.common.utils.wechat.WxUtil;
|
||||
import com.agri.framework.interceptor.DeviceAckHandler;
|
||||
import com.agri.framework.interceptor.DeviceStatusHandler;
|
||||
import com.agri.framework.interceptor.FrontendControlHandler;
|
||||
import com.agri.framework.interceptor.FrontendOnlineHandler;
|
||||
import com.agri.framework.interceptor.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -50,7 +47,7 @@ public class MqttMessageDispatcher {
|
|||
* 前端在线心跳处理器
|
||||
*/
|
||||
@Resource
|
||||
private DeviceAckHandler deviceAckHandler;
|
||||
private FrontendConfigHandler frontendConfigHandler;
|
||||
|
||||
/**
|
||||
* 消息分发处理:根据主题类型路由到不同处理方法
|
||||
|
|
@ -74,6 +71,9 @@ public class MqttMessageDispatcher {
|
|||
// 新增:前端在线心跳主题:frontend/{clientId}/online
|
||||
else if (topic.matches("frontend/\\w+/online")) {
|
||||
frontendOnlineHandler.handle(topic, payload);
|
||||
} // 新增:前端在线心跳主题:frontend/{clientId}/online
|
||||
else if (topic.matches("frontend/\\w+/\\w+/config")) {
|
||||
frontendConfigHandler.handle(topic, payload);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
WxUtil.pushText("【MQTT消息处理异常】\n topic: "+ topic+"\n cause: "+e);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
package com.agri.quartz.task;
|
||||
|
||||
public class AgriStatusTask {
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.agri.quartz.task;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 卷膜自动模式定时检查
|
||||
* 每五分钟执行一次
|
||||
* 1、查询大棚列表开启自动模式的大棚,获取imei
|
||||
* 2、根据imei查询dtu_data最后一分钟最后一条温度数据
|
||||
* 3、查询参数设置获取 风口总长 预留风口长度 在条件内开启指定风口,第一次开 预留风口+条件内设定的风口长度 还是得存日志、、、
|
||||
* 4、下发开启或者关闭指令 起个自动关任务 需要改自动关逻辑,自动模式,监听处不转发回执
|
||||
* todo通知用户
|
||||
*/
|
||||
@Component("rollerAutoTask")
|
||||
public class RollerAutoTask {
|
||||
|
||||
}
|
||||
|
|
@ -13,17 +13,11 @@ import com.agri.system.domain.SysUserAgri;
|
|||
import com.agri.system.domain.vo.AgriInfoView;
|
||||
import com.agri.system.service.ISysAgriInfoService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
|
@ -130,8 +124,22 @@ public class SysAgriInfoController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:agri:addAgriFromMobile')")
|
||||
@PostMapping("/addAgriFromMobile")
|
||||
public Map<String, Object> addAgriFromMobile(@RequestBody SysAgriInfo sysAgriInfo) {
|
||||
public AjaxResult addAgriFromMobile(@RequestBody SysAgriInfo sysAgriInfo) {
|
||||
|
||||
return success(sysAgriInfoService.addAgriFromMobile(sysAgriInfo));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('assets:agri:switchAgriMode')")
|
||||
@PostMapping("/switchAgriMode/{imei}")
|
||||
public AjaxResult switchAgriMode(@PathVariable String imei, @RequestParam("code") Integer code) {
|
||||
|
||||
if (StringUtils.isEmpty(imei) || code == null) {
|
||||
return error();
|
||||
}
|
||||
sysAgriInfoService.lambdaUpdate()
|
||||
.eq(SysAgriInfo::getImei, imei)
|
||||
.set(SysAgriInfo::getWorkMode, code)
|
||||
.update();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,104 @@
|
|||
package com.agri.system.controller;
|
||||
|
||||
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.agri.common.annotation.Log;
|
||||
import com.agri.common.core.controller.BaseController;
|
||||
import com.agri.common.core.domain.AjaxResult;
|
||||
import com.agri.common.enums.BusinessType;
|
||||
import com.agri.system.domain.SysRollerAir;
|
||||
import com.agri.system.service.ISysRollerAirService;
|
||||
import com.agri.common.utils.poi.ExcelUtil;
|
||||
import com.agri.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 自动化卷膜风口大小设置Controller
|
||||
*
|
||||
* @author lld
|
||||
* @date 2026-03-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/assets/air")
|
||||
public class SysRollerAirController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysRollerAirService sysRollerAirService;
|
||||
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRollerAir sysRollerAir)
|
||||
{
|
||||
startPage();
|
||||
List<SysRollerAir> list = sysRollerAirService.selectSysRollerAirList(sysRollerAir);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出自动化卷膜风口大小设置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:export')")
|
||||
@Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysRollerAir sysRollerAir)
|
||||
{
|
||||
List<SysRollerAir> list = sysRollerAirService.selectSysRollerAirList(sysRollerAir);
|
||||
ExcelUtil<SysRollerAir> util = new ExcelUtil<SysRollerAir>(SysRollerAir.class);
|
||||
util.exportExcel(response, list, "自动化卷膜风口大小设置数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自动化卷膜风口大小设置详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(sysRollerAirService.selectSysRollerAirById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增自动化卷膜风口大小设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:add')")
|
||||
@Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysRollerAir sysRollerAir)
|
||||
{
|
||||
return toAjax(sysRollerAirService.insertSysRollerAir(sysRollerAir));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自动化卷膜风口大小设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:edit')")
|
||||
@Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysRollerAir sysRollerAir)
|
||||
{
|
||||
return toAjax(sysRollerAirService.updateSysRollerAir(sysRollerAir));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自动化卷膜风口大小设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('assets:air:remove')")
|
||||
@Log(title = "自动化卷膜风口大小设置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysRollerAirService.deleteSysRollerAirByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.agri.system.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.agri.common.annotation.Excel;
|
||||
import com.agri.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 自动化卷膜风口大小设置对象 sys_roller_air
|
||||
*
|
||||
* @author lld
|
||||
* @date 2026-03-04
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_roller_air")
|
||||
public class SysRollerAir extends BaseEntity
|
||||
{
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 设备IMEI码 */
|
||||
@Excel(name = "设备IMEI码")
|
||||
private String imei;
|
||||
|
||||
/** 卷膜器编号/标识 */
|
||||
@Excel(name = "卷膜器编号/标识")
|
||||
private String roller;
|
||||
|
||||
/** 操作类型 0-停止 1-运行 2-查询 3-重置 */
|
||||
@Excel(name = "操作类型 0-停止 1-运行 2-查询 3-重置")
|
||||
private Integer opType;
|
||||
|
||||
/** 操作参数(JSON格式,存储风口大小等配置) */
|
||||
@Excel(name = "操作参数(JSON格式,存储风口大小等配置)")
|
||||
private String payload;
|
||||
|
||||
/** 客户端ID */
|
||||
@Excel(name = "客户端ID")
|
||||
private String clientid;
|
||||
|
||||
/** 操作执行时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
@Excel(name = "操作执行时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private LocalDateTime opTime;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("imei", getImei())
|
||||
.append("roller", getRoller())
|
||||
.append("opType", getOpType())
|
||||
.append("payload", getPayload())
|
||||
.append("clientid", getClientid())
|
||||
.append("opTime", getOpTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||
import com.agri.common.annotation.Excel;
|
||||
import com.agri.common.core.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 卷膜参数配置对象 sys_roller_param
|
||||
*
|
||||
|
|
@ -44,15 +46,18 @@ public class SysRollerParam extends BaseEntity
|
|||
|
||||
/** 预留风口长度(cm) */
|
||||
@Excel(name = "预留风口长度(cm)")
|
||||
private Long reservedLen;
|
||||
private BigDecimal reservedLen;
|
||||
|
||||
/** 手动计算风口总长(cm) */
|
||||
@Excel(name = "手动计算风口总长(cm)")
|
||||
private Long manualTotalLen;
|
||||
private BigDecimal manualTotalLen;
|
||||
|
||||
/** 自动计算风口总长(cm) */
|
||||
@Excel(name = "自动计算风口总长(cm)")
|
||||
private Long autoTotalLen;
|
||||
private BigDecimal autoTotalLen;
|
||||
|
||||
@Excel(name = "最终风口总长")
|
||||
private BigDecimal ventTotalLen;
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
|
|
@ -94,32 +99,32 @@ public class SysRollerParam extends BaseEntity
|
|||
return refTempCode;
|
||||
}
|
||||
|
||||
public void setReservedLen(Long reservedLen)
|
||||
public void setReservedLen(BigDecimal reservedLen)
|
||||
{
|
||||
this.reservedLen = reservedLen;
|
||||
}
|
||||
|
||||
public Long getReservedLen()
|
||||
public BigDecimal getReservedLen()
|
||||
{
|
||||
return reservedLen;
|
||||
}
|
||||
|
||||
public void setManualTotalLen(Long manualTotalLen)
|
||||
public void setManualTotalLen(BigDecimal manualTotalLen)
|
||||
{
|
||||
this.manualTotalLen = manualTotalLen;
|
||||
}
|
||||
|
||||
public Long getManualTotalLen()
|
||||
public BigDecimal getManualTotalLen()
|
||||
{
|
||||
return manualTotalLen;
|
||||
}
|
||||
|
||||
public void setAutoTotalLen(Long autoTotalLen)
|
||||
public void setAutoTotalLen(BigDecimal autoTotalLen)
|
||||
{
|
||||
this.autoTotalLen = autoTotalLen;
|
||||
}
|
||||
|
||||
public Long getAutoTotalLen()
|
||||
public BigDecimal getAutoTotalLen()
|
||||
{
|
||||
return autoTotalLen;
|
||||
}
|
||||
|
|
@ -132,6 +137,14 @@ public class SysRollerParam extends BaseEntity
|
|||
this.refTemp = refTemp;
|
||||
}
|
||||
|
||||
public BigDecimal getVentTotalLen() {
|
||||
return ventTotalLen;
|
||||
}
|
||||
|
||||
public void setVentTotalLen(BigDecimal ventTotalLen) {
|
||||
this.ventTotalLen = ventTotalLen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
package com.agri.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.agri.system.domain.SysRollerAir;
|
||||
|
||||
/**
|
||||
* 自动化卷膜风口大小设置Mapper接口
|
||||
*
|
||||
* @author lld
|
||||
* @date 2026-03-04
|
||||
*/
|
||||
public interface SysRollerAirMapper extends BaseMapper<SysRollerAir>
|
||||
{
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 自动化卷膜风口大小设置
|
||||
*/
|
||||
public SysRollerAir selectSysRollerAirById(Long id);
|
||||
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置列表
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 自动化卷膜风口大小设置集合
|
||||
*/
|
||||
public List<SysRollerAir> selectSysRollerAirList(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 新增自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysRollerAir(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 修改自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysRollerAir(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 删除自动化卷膜风口大小设置
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRollerAirById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除自动化卷膜风口大小设置
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRollerAirByIds(Long[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.agri.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.agri.system.domain.SysRollerAir;
|
||||
|
||||
/**
|
||||
* 自动化卷膜风口大小设置Service接口
|
||||
*
|
||||
* @author lld
|
||||
* @date 2026-03-04
|
||||
*/
|
||||
public interface ISysRollerAirService extends IService<SysRollerAir> {
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 自动化卷膜风口大小设置
|
||||
*/
|
||||
public SysRollerAir selectSysRollerAirById(Long id);
|
||||
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置列表
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 自动化卷膜风口大小设置集合
|
||||
*/
|
||||
public List<SysRollerAir> selectSysRollerAirList(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 新增自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysRollerAir(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 修改自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysRollerAir(SysRollerAir sysRollerAir);
|
||||
|
||||
/**
|
||||
* 批量删除自动化卷膜风口大小设置
|
||||
*
|
||||
* @param ids 需要删除的自动化卷膜风口大小设置主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRollerAirByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除自动化卷膜风口大小设置信息
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRollerAirById(Long id);
|
||||
}
|
||||
|
|
@ -150,13 +150,13 @@ public class SysAutoTermServiceImpl extends ServiceImpl<SysAutoTermMapper, SysAu
|
|||
return roller + "参考温度未设置,请点击相应页签左上角设置后重试!";
|
||||
}
|
||||
|
||||
boolean hasLen = (config.getManualTotalLen() != null && config.getManualTotalLen() > 0)
|
||||
|| (config.getAutoTotalLen() != null && config.getAutoTotalLen() > 0);
|
||||
boolean hasLen = (config.getManualTotalLen() != null && config.getManualTotalLen().compareTo(BigDecimal.ZERO)>0)
|
||||
|| (config.getAutoTotalLen() != null && config.getAutoTotalLen().compareTo(BigDecimal.ZERO)>0);
|
||||
if (!hasLen) {
|
||||
return roller + "计算风口总长和手动设置风口长度至少填写一个!";
|
||||
}
|
||||
|
||||
if (config.getReservedLen() == null || config.getReservedLen() <= 0) {
|
||||
if (config.getReservedLen() == null || config.getReservedLen().compareTo(BigDecimal.ZERO)<=0) {
|
||||
return roller + "预留风口长度未设置,请点击相应页签右上角设置后重试!";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,94 @@
|
|||
package com.agri.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.agri.common.utils.DateUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.agri.system.mapper.SysRollerAirMapper;
|
||||
import com.agri.system.domain.SysRollerAir;
|
||||
import com.agri.system.service.ISysRollerAirService;
|
||||
|
||||
/**
|
||||
* 自动化卷膜风口大小设置Service业务层处理
|
||||
*
|
||||
* @author lld
|
||||
* @date 2026-03-04
|
||||
*/
|
||||
@Service
|
||||
public class SysRollerAirServiceImpl extends ServiceImpl<SysRollerAirMapper, SysRollerAir> implements ISysRollerAirService
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 自动化卷膜风口大小设置
|
||||
*/
|
||||
@Override
|
||||
public SysRollerAir selectSysRollerAirById(Long id)
|
||||
{
|
||||
return baseMapper.selectSysRollerAirById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自动化卷膜风口大小设置列表
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 自动化卷膜风口大小设置
|
||||
*/
|
||||
@Override
|
||||
public List<SysRollerAir> selectSysRollerAirList(SysRollerAir sysRollerAir)
|
||||
{
|
||||
return baseMapper.selectSysRollerAirList(sysRollerAir);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysRollerAir(SysRollerAir sysRollerAir)
|
||||
{
|
||||
sysRollerAir.setCreateTime(DateUtils.getNowDate());
|
||||
return baseMapper.insertSysRollerAir(sysRollerAir);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自动化卷膜风口大小设置
|
||||
*
|
||||
* @param sysRollerAir 自动化卷膜风口大小设置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysRollerAir(SysRollerAir sysRollerAir)
|
||||
{
|
||||
sysRollerAir.setUpdateTime(DateUtils.getNowDate());
|
||||
return baseMapper.updateSysRollerAir(sysRollerAir);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除自动化卷膜风口大小设置
|
||||
*
|
||||
* @param ids 需要删除的自动化卷膜风口大小设置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysRollerAirByIds(Long[] ids)
|
||||
{
|
||||
return baseMapper.deleteSysRollerAirByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自动化卷膜风口大小设置信息
|
||||
*
|
||||
* @param id 自动化卷膜风口大小设置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysRollerAirById(Long id)
|
||||
{
|
||||
return baseMapper.deleteSysRollerAirById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -85,14 +85,14 @@ public class RollerParamValidateUtil {
|
|||
// 规则3:计算风口总长和手动设置风口长度至少填写一个!
|
||||
rules.add(new CheckRule("计算风口总长和手动设置风口长度至少填写一个!请填写后重试!", (rollerParam, term) ->
|
||||
// 前端:!((manualTotalLen>0) || (autoTotalLen>0))
|
||||
!((rollerParam.getManualTotalLen() != null && rollerParam.getManualTotalLen() > 0)
|
||||
|| (rollerParam.getAutoTotalLen() != null && rollerParam.getAutoTotalLen() > 0))
|
||||
!((rollerParam.getManualTotalLen() != null && rollerParam.getManualTotalLen().compareTo(BigDecimal.ZERO)>0)
|
||||
|| (rollerParam.getAutoTotalLen() != null && rollerParam.getAutoTotalLen().compareTo(BigDecimal.ZERO)>0))
|
||||
));
|
||||
|
||||
// 规则4:预留风口长度未设置!
|
||||
rules.add(new CheckRule("预留风口长度未设置,请点击相应页签右上角设置后重试!", (rollerParam, term) ->
|
||||
// 前端:!(reservedLen && reservedLen > 0)
|
||||
!(rollerParam.getReservedLen() != null && rollerParam.getReservedLen() > 0)
|
||||
!(rollerParam.getReservedLen() != null && rollerParam.getReservedLen().compareTo(BigDecimal.ZERO) > 0)
|
||||
));
|
||||
|
||||
// 规则5:温度控制未设置!
|
||||
|
|
|
|||
|
|
@ -0,0 +1,97 @@
|
|||
<?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="com.agri.system.mapper.SysRollerAirMapper">
|
||||
|
||||
<resultMap type="SysRollerAir" id="SysRollerAirResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="imei" column="imei" />
|
||||
<result property="roller" column="roller" />
|
||||
<result property="opType" column="op_type" />
|
||||
<result property="payload" column="payload" />
|
||||
<result property="clientid" column="clientid" />
|
||||
<result property="opTime" column="op_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysRollerAirVo">
|
||||
select id, imei, roller, op_type, payload, clientid, op_time, create_by, create_time, update_by, update_time from sys_roller_air
|
||||
</sql>
|
||||
|
||||
<select id="selectSysRollerAirList" parameterType="SysRollerAir" resultMap="SysRollerAirResult">
|
||||
<include refid="selectSysRollerAirVo"/>
|
||||
<where>
|
||||
<if test="imei != null and imei != ''"> and imei = #{imei}</if>
|
||||
<if test="roller != null and roller != ''"> and roller = #{roller}</if>
|
||||
<if test="opType != null "> and op_type = #{opType}</if>
|
||||
<if test="payload != null and payload != ''"> and payload = #{payload}</if>
|
||||
<if test="clientid != null and clientid != ''"> and clientid = #{clientid}</if>
|
||||
<if test="opTime != null "> and op_time = #{opTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysRollerAirById" parameterType="Long" resultMap="SysRollerAirResult">
|
||||
<include refid="selectSysRollerAirVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysRollerAir" parameterType="SysRollerAir" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_roller_air
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="imei != null and imei != ''">imei,</if>
|
||||
<if test="roller != null and roller != ''">roller,</if>
|
||||
<if test="opType != null">op_type,</if>
|
||||
<if test="payload != null">payload,</if>
|
||||
<if test="clientid != null">clientid,</if>
|
||||
<if test="opTime != null">op_time,</if>
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="imei != null and imei != ''">#{imei},</if>
|
||||
<if test="roller != null and roller != ''">#{roller},</if>
|
||||
<if test="opType != null">#{opType},</if>
|
||||
<if test="payload != null">#{payload},</if>
|
||||
<if test="clientid != null">#{clientid},</if>
|
||||
<if test="opTime != null">#{opTime},</if>
|
||||
#{createBy},
|
||||
#{createTime},
|
||||
#{updateBy},
|
||||
#{updateTime},
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysRollerAir" parameterType="SysRollerAir">
|
||||
update sys_roller_air
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="imei != null and imei != ''">imei = #{imei},</if>
|
||||
<if test="roller != null and roller != ''">roller = #{roller},</if>
|
||||
<if test="opType != null">op_type = #{opType},</if>
|
||||
<if test="payload != null">payload = #{payload},</if>
|
||||
<if test="clientid != null">clientid = #{clientid},</if>
|
||||
<if test="opTime != null">op_time = #{opTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysRollerAirById" parameterType="Long">
|
||||
delete from sys_roller_air where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysRollerAirByIds" parameterType="String">
|
||||
delete from sys_roller_air where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue