liurunyu
2024-05-23 cf30dd4d7622429b06aa0ffeca4d1eeed4d3749e
Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
30个文件已添加
18个文件已修改
2925 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateUnitMapper.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupUnit.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateGroup.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateUnit.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmCommandHistory.java 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroup.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroupOne.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnit.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnitOne.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupUnitMapper.xml 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml 172 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateUnitMapper.xml 160 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml 199 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java 301 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/QueryVo.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java 213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/QueryVo.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/pom.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/PipIrrRemoteApplication.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/ComSupport.java 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/RestTemplateConfig.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebFilterConfiguration.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebListenerConfiguration.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/result/RemoteResultCode.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/CommandResultCtrl.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/Addr.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/DtoBase.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/utils/RestTemplateUtils.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/dto/DTOValve.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java
New file
@@ -0,0 +1,28 @@
package com.dy.pipIrrGlobal.daoIr;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoIr.IrGroupUnit;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author :WuZeYu
 * @Date :2024/5/22  13:41
 * @LastEditTime :2024/5/22  13:41
 * @Description
 */
@Mapper
public interface IrGroupUnitMapper extends BaseMapper<IrGroupUnit> {
    //增
    int insertSelective(IrGroupUnit record);
    //删
    int deleteLogicById(Long id);
    //删by unitId groupId
    int deleteByUnitIdGroupId(IrGroupUnit record);
    //删by unitId
    int deleteByUnitId(Long unitId);
    //删by  groupId
    int deleteByGroupId(Long groupId);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java
New file
@@ -0,0 +1,50 @@
package com.dy.pipIrrGlobal.daoIr;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit;
import com.dy.pipIrrGlobal.voIr.VoGroup;
import com.dy.pipIrrGlobal.voIr.VoGroupOne;
import com.dy.pipIrrGlobal.voIr.VoUnit;
import com.dy.pipIrrGlobal.voIr.VoUnitOne;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
 * @author :WuZeYu
 * @Date :2024/5/21  15:32
 * @LastEditTime :2024/5/21  15:32
 * @Description
 */
@Mapper
public interface IrIrrigateGroupMapper extends BaseMapper<IrIrrigateGroup> {
    //增
    int insertSelective(IrIrrigateGroup record);
    //删
    int deleteLogicById(Long id);
    //改
    int updateByPrimaryKeySelective(IrIrrigateGroup record);
    //查一个
    VoGroupOne selectById(Long id);
    /**
     * 根据指定条件获取取水口记录数
     *
     * @param params
     * @return
     */
    Long getRecordCount(Map<?, ?> params);
    /**
     * 根据指定条件获取取水口记录
     *
     * @param params
     * @return
     */
    List<VoGroup> getIrrigateGroups(Map<?, ?> params);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateUnitMapper.java
@@ -1,6 +1,15 @@
package com.dy.pipIrrGlobal.daoIr;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit;
import com.dy.pipIrrGlobal.voIr.VoProject;
import com.dy.pipIrrGlobal.voIr.VoProjectOne;
import com.dy.pipIrrGlobal.voIr.VoUnit;
import com.dy.pipIrrGlobal.voIr.VoUnitOne;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
 * @author :WuZeYu
@@ -9,5 +18,32 @@
 * @Description
 */
@Mapper
public interface IrIrrigateUnitMapper {
public interface IrIrrigateUnitMapper extends BaseMapper<IrIrrigateUnit> {
    //增
    int insertSelective(IrIrrigateUnit record);
    //删
    int deleteLogicById(Long id);
    //改
    int updateByPrimaryKeySelective(IrIrrigateUnit record);
    //查一个
    VoUnitOne selectById(Long id);
    /**
     * 根据指定条件获取取水口记录数
     *
     * @param params
     * @return
     */
    Long getRecordCount(Map<?, ?> params);
    /**
     * 根据指定条件获取取水口记录
     *
     * @param params
     * @return
     */
    List<VoUnit> getUnits(Map<?, ?> params);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java
@@ -49,7 +49,7 @@
    Long getSupperByVillageId(long vaId);
    /**
     * 根据指定条件获取取水口记录数
     * 根据指定条件获取项目记录数
     *
     * @param params
     * @return
@@ -57,7 +57,7 @@
    Long getRecordCount(Map<?, ?> params);
    /**
     * 根据指定条件获取取水口记录
     * 根据指定条件获取项目记录
     *
     * @param params
     * @return
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerMapper.java
@@ -86,4 +86,11 @@
     * @return
     */
    Integer deleteIntakeId(@Param("controllerId") Long controllerId);
    /**
     * 根据取水口ID获取阀控器地址
     * @param intakeId 取水口ID
     * @return 阀控器地址
     */
    String getRtuAddrByIntakeId(Long intakeId);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java
New file
@@ -0,0 +1,27 @@
package com.dy.pipIrrGlobal.daoRm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author ZhuBaoMin
 * @date 2024-05-22 14:29
 * @LastEditTime 2024-05-22 14:29
 * @Description
 */
@Mapper
public interface RmCommandHistoryMapper extends BaseMapper<RmCommandHistory> {
    int deleteByPrimaryKey(Long id);
    int insert(RmCommandHistory record);
    int insertSelective(RmCommandHistory record);
    RmCommandHistory selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(RmCommandHistory record);
    int updateByPrimaryKey(RmCommandHistory record);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupUnit.java
New file
@@ -0,0 +1,77 @@
package com.dy.pipIrrGlobal.pojoIr;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Date;
/**
 * @author :WuZeYu
 * @Date :2024/5/22  13:43
 * @LastEditTime :2024/5/22  13:43
 * @Description
 */
/**
 * 轮灌组灌溉单元中间表
 */
@TableName(value="ir_group_unit", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "轮灌组灌溉单元中间表实体")
public class IrGroupUnit implements BaseEntity {
    public static final long serialVersionUID = 202405221354001L;
    /**
     * 主键
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long id;
    /**
     * 轮灌组ID
     */
    @Schema(description = "轮灌组ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "轮灌组ID不能为空")
    private Long groupId;
    /**
     * 灌溉单元ID
     */
    @Schema(description = "灌溉单元ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "灌溉单元ID不能为空")
    private Long unitId;
    /**
     * 操作人ID
     */
    @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "操作人ID不能为空")
    private Long operator;
    /**
     * 操作时间
     */
    @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date operateDt;
    /**
     * 逻辑删除标识;0-未删除,1-删除
     */
    @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Byte deleted;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateGroup.java
New file
@@ -0,0 +1,84 @@
package com.dy.pipIrrGlobal.pojoIr;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank;
import java.util.Date;
/**
 * @author :WuZeYu
 * @Date :2024/5/21  15:34
 * @LastEditTime :2024/5/21  15:34
 * @Description
 */
/**
 * 轮灌组表
 */
@TableName(value="ir_irrigate_group", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "轮灌组实体")
public class IrIrrigateGroup implements BaseEntity {
    public static final long serialVersionUID = 202405211534001L;
    /**
     * 主键
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long id;
    /**
     * 轮灌组编码
     */
    @Schema(description = "轮灌组编码", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "轮灌组编码不能为空")
    private String groupCode;
    /**
     * 项目ID
     */
    @Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "项目ID不能为空")
    private Long projectId;
    /**
     * 备注
     */
    @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
    private String remarks;
    /**
     * 操作人ID
     */
    @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "操作人ID不能为空")
    private Long operator;
    /**
     * 操作时间
     */
    @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date operateDt;
    /**
     * 逻辑删除标识;0-未删除,1-删除
     */
    @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Byte deleted;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateUnit.java
@@ -12,11 +12,10 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
@@ -30,8 +29,8 @@
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "项目实体")
public class IrIrrigateUnit {
@Schema(name = "灌溉单元实体")
public class IrIrrigateUnit  implements BaseEntity {
    public static final long serialVersionUID = 202405161833001L;
    /**
@@ -52,8 +51,7 @@
     * 灌溉面积
     */
    @Schema(description = "灌溉面积", requiredMode = Schema.RequiredMode.REQUIRED)
    @Length(message = "项目名称不大于{max}字",max = 12)
    private float area;
    private Float area;
    /**
     * 操作人ID
     */
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmCommandHistory.java
New file
@@ -0,0 +1,116 @@
package com.dy.pipIrrGlobal.pojoRm;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.dy.common.po.BaseEntity;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-05-21 16:53
 * @LastEditTime 2024-05-21 16:53
 * @Description 命令日志实体类
 */
/**
 * 命令日志表
 */
@TableName(value = "rm_command_history", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class RmCommandHistory implements BaseEntity{
    public static final long serialVersionUID = 202401151517005L;
    /**
     * 主键
     */
    @JSONField(serializeUsing = ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    private Long id;
    /**
     * 功能码
     */
    @JSONField(serializeUsing = ObjectWriterImplToString.class)
    @NotBlank(message = "功能码不能为空")
    private String commandCode;
    /**
     * 操作内容
     */
    private String commandName;
    /**
     * 阀控器地址
     */
    @NotBlank(message = "阀控器地址不能为空")
    private String rtuaddr;
    /**
     * 通讯协议
     */
    @NotBlank(message = "通讯协议不能为空")
    private String protocol;
    /**
     * 命令类型
     */
    @NotBlank(message = "命令类型不能为空")
    private String commandType;
    /**
     * 回调URL
     */
    @NotBlank(message = "回调URL不能为空")
    private String callback;
    /**
     * 参数数据
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
    private JSONObject param;
    /**
     * 发送命令时间
     */
    @NotNull(message = "发送命令时间不能为空")
    private Date sendTime;
    /**
     * 操作人
     */
    @JSONField(serializeUsing = ObjectWriterImplToString.class)
    @NotNull(message = "操作人不能为空")
    private Long operator;
    /**
     * 命令结果;0-失败,1-成功
     */
    private Byte result;
    /**
     * 收到命令结果时间
     */
    private Date resultTime;
    /**
     * 命令结果内容
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
    private JSONObject resultText;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroup.java
New file
@@ -0,0 +1,51 @@
package com.dy.pipIrrGlobal.voIr;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
/**
 * @author :WuZeYu
 * @Date :2024/5/21  16:34
 * @LastEditTime :2024/5/21  16:34
 * @Description
 */
@Data
@Schema(name = "轮灌组视图")
public class VoGroup  implements BaseEntity {
    @Schema(description = "所属项目名称")
    public String projectName;
    @Schema(description = "轮灌组编码")
    private String groupCode;
    @Schema(description = "灌溉单元数量")
    private Integer itemCount;
    @Schema(description = "轮灌组ID")
    private String id;
    @Schema(description = "备注")
    private String remarks;
    @Schema(description = "所属项目Id")
    public String projectId;
    /**
     * 操作人名字
     */
    @Schema(description = "操作人名字")
    private String operatorName;
    @Schema(description = "操作人Id")
    private String operator;
    /**
     * 操作时间
     */
    @Schema(description = "操作时间")
    private Date operateDt;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroupOne.java
New file
@@ -0,0 +1,51 @@
package com.dy.pipIrrGlobal.voIr;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
/**
 * @author :WuZeYu
 * @Date :2024/5/21  16:34
 * @LastEditTime :2024/5/21  16:34
 * @Description
 */
@Data
@Schema(name = "轮灌组视图(查一个)")
public class VoGroupOne  implements BaseEntity {
    @Schema(description = "所属项目名称")
    public String projectName;
    @Schema(description = "轮灌组编码")
    private String groupCode;
    @Schema(description = "灌溉单元数量")
    private Integer itemCount;
    @Schema(description = "轮灌组ID")
    private String id;
    @Schema(description = "备注")
    private String remarks;
    @Schema(description = "所属项目Id")
    public String projectId;
    /**
     * 操作人名字
     */
    @Schema(description = "操作人名字")
    private String operatorName;
    @Schema(description = "操作人Id")
    private String operator;
    /**
     * 操作时间
     */
    @Schema(description = "操作时间")
    private Date operateDt;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnit.java
New file
@@ -0,0 +1,52 @@
package com.dy.pipIrrGlobal.voIr;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
/**
 * @author :WuZeYu
 * @Date :2024/5/21  9:04
 * @LastEditTime :2024/5/21  9:04
 * @Description
 */
@Data
@Schema(title = "灌溉单元视图对象")
public class VoUnit  implements BaseEntity {
    @Schema(description = "所属项目名称")
    public String projectName;
    @Schema(description = "轮灌组编码")
    private int groupCode;
    @Schema(description = "灌溉单元ID")
    private String unitId;
    @Schema(description = "灌溉面积")
    private Integer area;
    @Schema(description = "备注")
    private String remarks;
    @Schema(description = "所属项目Id")
    public String projectId;
    /**
     * 操作人名字
     */
    @Schema(description = "操作人名字")
    private String operatorName;
    @Schema(description = "操作人Id")
    private String operator;
    /**
     * 操作时间
     */
    @Schema(description = "操作时间")
    private Date operateDt;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnitOne.java
New file
@@ -0,0 +1,50 @@
package com.dy.pipIrrGlobal.voIr;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
/**
 * @author :WuZeYu
 * @Date :2024/5/21  9:05
 * @LastEditTime :2024/5/21  9:05
 * @Description
 */
@Data
@Schema(name = "灌溉单元视图(查一个)")
public class VoUnitOne implements BaseEntity {
    @Schema(description = "所属项目名称")
    public String projectName;
    @Schema(description = "轮灌组编码")
    private int groupCode;
    @Schema(description = "灌溉单元ID")
    private String id;
    @Schema(description = "灌溉面积")
    private Integer area;
    @Schema(description = "备注")
    private String remarks;
    @Schema(description = "所属项目Id")
    public String projectId;
    /**
     * 操作人名字
     */
    @Schema(description = "操作人名字")
    private String operatorName;
    @Schema(description = "操作人Id")
    private String operator;
    /**
     * 操作时间
     */
    @Schema(description = "操作时间")
    private Date operateDt;
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupUnitMapper.xml
New file
@@ -0,0 +1,91 @@
<?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.dy.pipIrrGlobal.daoIr.IrGroupUnitMapper">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit">
        <!--@mbg.generated-->
        <!--@Table ir_group_unit-->
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="group_id" jdbcType="BIGINT" property="groupId" />
        <result column="unit_id" jdbcType="BIGINT" property="unitId" />
        <result column="operator" jdbcType="BIGINT" property="operator" />
        <result column="operate_time" jdbcType="TIMESTAMP" property="operateDt" />
        <result column="deleted" jdbcType="TINYINT" property="deleted" />
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, group_id, unit_id, `operator`,
        operate_time, deleted
    </sql>
    <!--添加-->
    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit">
        <!--@mbg.generated-->
        insert into ir_group_unit
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="groupId != null">
                group_id,
            </if>
            <if test="unitId != null">
                unit_id,
            </if>
            <if test="operator != null">
                `operator`,
            </if>
            <if test="operateDt != null">
                operate_time,
            </if>
            <if test="deleted != null">
                deleted,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="groupId != null">
                #{groupId,jdbcType=BIGINT},
            </if>
            <if test="unitId != null">
                #{unitId,jdbcType=BIGINT},
            </if>
            <if test="operator != null">
                #{operator,jdbcType=BIGINT},
            </if>
            <if test="operateDt != null">
                #{operateDt,jdbcType=TIMESTAMP},
            </if>
            <if test="deleted != null">
                #{deleted,jdbcType=TINYINT},
            </if>
        </trim>
    </insert>
    <!--逻辑删除-->
    <delete id="deleteLogicById" parameterType="java.lang.Long">
        <!--@mbg.generated-->
        update ir_group_unit
        set deleted = 1
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <delete id="deleteByUnitIdGroupId" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit">
        update ir_group_unit
        set deleted = 1,operator = #{operator,jdbcType=BIGINT},operate_time = #{operateDt,jdbcType=TIMESTAMP}
        where group_id = #{groupId,jdbcType=BIGINT} and unit_id = #{unitId,jdbcType=BIGINT}
    </delete>
    <delete id="deleteByUnitId">
        update ir_group_unit
        set deleted = 1
        where unit_id = #{unitId,jdbcType=BIGINT}
    </delete>
    <delete id="deleteByGroupId">
        update ir_group_unit
        set deleted = 1
        where group_id = #{groupId,jdbcType=BIGINT}
    </delete>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml
New file
@@ -0,0 +1,172 @@
<?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.dy.pipIrrGlobal.daoIr.IrIrrigateGroupMapper">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup">
        <!--@mbg.generated-->
        <!--@Table ir_irrigate_group-->
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="project_id" jdbcType="BIGINT" property="projectId" />
        <result column="group_code" jdbcType="VARCHAR" property="groupCode" />
        <result column="remarks" jdbcType="VARCHAR" property="remarks" />
        <result column="operator" jdbcType="BIGINT" property="operator" />
        <result column="operate_time" jdbcType="TIMESTAMP" property="operateDt" />
        <result column="deleted" jdbcType="TINYINT" property="deleted" />
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, project_id, group_code, remarks, `operator`,
        operate_time, deleted
    </sql>
    <!--添加-->
    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup">
        <!--@mbg.generated-->
        insert into ir_irrigate_group
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="projectId != null">
                project_id,
            </if>
            <if test="groupCode != null">
                group_code,
            </if>
            <if test="remarks != null">
                remarks,
            </if>
            <if test="operator != null">
                `operator`,
            </if>
            <if test="operateDt != null">
                operate_time,
            </if>
            <if test="deleted != null">
                deleted,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="projectId != null">
                #{projectId,jdbcType=BIGINT},
            </if>
            <if test="groupCode != null">
                #{groupCode,jdbcType=VARCHAR},
            </if>
            <if test="remarks != null">
                #{remarks,jdbcType=VARCHAR},
            </if>
            <if test="operator != null">
                #{operator,jdbcType=BIGINT},
            </if>
            <if test="operateDt != null">
                #{operateDt,jdbcType=TIMESTAMP},
            </if>
            <if test="deleted != null">
                #{deleted,jdbcType=TINYINT},
            </if>
        </trim>
    </insert>
    <!--逻辑删除-->
    <delete id="deleteLogicById" parameterType="java.lang.Long">
        <!--@mbg.generated-->
        update ir_irrigate_group
        set deleted = 1
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <!--修改一个轮罐组-->
    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup">
        update ir_irrigate_group
        <set>
            <if test="projectId != null">
                project_id = #{projectId,jdbcType=BIGINT},
            </if>
            <if test="groupCode != null">
                group_code = #{groupCode,jdbcType=VARCHAR},
            </if>
            <if test="remarks != null">
                remarks = #{remarks,jdbcType=VARCHAR},
            </if>
            <if test="operator != null">
                operator = #{operator,jdbcType=BIGINT},
            </if>
            <if test="operateDt != null">
                operate_time = #{operateDt,jdbcType=TIMESTAMP},
            </if>
            <if test="deleted != null">
                deleted = #{deleted,jdbcType=TINYINT},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <!--查一个轮罐组-->
    <select id="selectById" resultType="com.dy.pipIrrGlobal.voIr.VoGroupOne">
        select
        CAST(pro.id AS char)AS projectId,
        pro.project_name  AS  projectName,
        CAST(gro.id AS char)AS id,
        CAST(gro.operator AS char)AS operator,
        cli.name         AS operatorName,
        gro.group_code   AS groupCode,
        COUNT(gu.group_id)   AS itemCount,
        gro.remarks,
        gro.operate_time  AS  operateDt
        from ir_irrigate_group gro
        left join ir_project pro on pro.id = gro.project_id
        left join se_client cli on cli.id = gro.operator
        left join ir_group_unit gu on gu.group_id = gro.id
        where gro.id = #{id,jdbcType=BIGINT} and gro.deleted = 0 and gu.deleted = 0 and pro.deleted = 0
    </select>
    <!--分页查轮灌组-->
    <select id="getIrrigateGroups" resultType="com.dy.pipIrrGlobal.voIr.VoGroup">
        SELECT
        CAST(pro.id AS char)AS projectId,
        pro.project_name  AS  projectName,
        CAST(gro.id AS char)AS id,
        CAST(gro.operator AS char)AS operator,
        cli.name         AS operatorName,
        gro.group_code   AS groupCode,
        COUNT(gu.group_id)   AS itemCount,
        gro.remarks,
        gro.operate_time  AS  operateDt
        from ir_irrigate_group gro
        left join ir_project pro on pro.id = gro.project_id
        left join se_client cli on cli.id = gro.operator
        left join ir_group_unit gu on gu.group_id = gro.id
        <where>
            gro.deleted = 0 and gu.deleted = 0 and pro.deleted = 0
            <if test="projectName != null and projectName != ''">
                AND pro.project_name LIKE CONCAT('%', #{projectName}, '%')
            </if>
        <if test="groupCode != null and groupCode != ''">
            AND gro.group_code = #{groupCode}
        </if>
        </where>
        ORDER BY gro.operate_time DESC
        <if test="pageCurr != null and pageSize != null">
            LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
        </if>
    </select>
    <!--分页查轮灌组记录数-->
    <select id="getRecordCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        from ir_irrigate_group gro
        left join ir_project pro on pro.id = gro.project_id
        left join se_client cli on cli.id = gro.operator
        left join ir_group_unit gu on gu.group_id = gro.id
        <where>
            gro.deleted = 0 and gu.deleted = 0 and pro.deleted = 0
            <if test="projectName != null and projectName != ''">
                AND pro.project_name LIKE CONCAT('%', #{projectName}, '%')
            </if>
            <if test="groupCode != null and groupCode != ''">
                AND gro.group_code = #{groupCode}
            </if>
        </where>
    </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateUnitMapper.xml
@@ -1,17 +1,12 @@
<?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.dy.pipIrrGlobal.daoIr.IrIrrigateUnitMapper">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrProject">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit">
        <!--@mbg.generated-->
        <!--@Table ir_project-->
        <!--@Table ir_irrigate_unit-->
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="project_name" jdbcType="VARCHAR" property="projectName" />
        <result column="province_id" jdbcType="BIGINT" property="provinceId" />
        <result column="city_id" jdbcType="BIGINT" property="cityId" />
        <result column="county_id" jdbcType="BIGINT" property="countyId" />
        <result column="town_id" jdbcType="BIGINT" property="townId" />
        <result column="village_id" jdbcType="BIGINT" property="villageId" />
        <result column="project_state" jdbcType="TINYINT" property="projectState" />
        <result column="project_id" jdbcType="BIGINT" property="projectId" />
        <result column="area" jdbcType="FLOAT" property="area" />
        <result column="remarks" jdbcType="VARCHAR" property="remarks" />
        <result column="operator" jdbcType="BIGINT" property="operator" />
        <result column="operate_time" jdbcType="TIMESTAMP" property="operateDt" />
@@ -19,7 +14,152 @@
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, project_name, province_id, city_id, county_id, town_id, `village_id`, project_state, remarks, `operator`,
        id, project_id, area, remarks, `operator`,
        operate_time, deleted
    </sql>
    <!--添加-->
    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit">
        <!--@mbg.generated-->
        insert into ir_irrigate_unit
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="projectId != null">
                project_id,
            </if>
            <if test="area != null">
                area,
            </if>
            <if test="remarks != null">
                remarks,
            </if>
            <if test="operator != null">
                `operator`,
            </if>
            <if test="operateDt != null">
                operate_time,
            </if>
            <if test="deleted != null">
                deleted,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="projectId != null">
                #{projectId,jdbcType=BIGINT},
            </if>
            <if test="area != null">
                #{area,jdbcType=FLOAT},
            </if>
            <if test="remarks != null">
                #{remarks,jdbcType=VARCHAR},
            </if>
            <if test="operator != null">
                #{operator,jdbcType=BIGINT},
            </if>
            <if test="operateDt != null">
                #{operateDt,jdbcType=TIMESTAMP},
            </if>
            <if test="deleted != null">
                #{deleted,jdbcType=TINYINT},
            </if>
        </trim>
    </insert>
    <!--逻辑删除-->
    <delete id="deleteLogicById" parameterType="java.lang.Long">
        <!--@mbg.generated-->
        update ir_irrigate_unit
        set deleted = 1
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <!--修改一个灌溉单元-->
    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit">
        update ir_irrigate_unit
        <set>
            <if test="projectId != null">
                project_id = #{projectId,jdbcType=BIGINT},
            </if>
            <if test="area != null">
                area = #{area,jdbcType=FLOAT},
            </if>
            <if test="remarks != null">
                remarks = #{remarks,jdbcType=VARCHAR},
            </if>
            <if test="operator != null">
                operator = #{operator,jdbcType=BIGINT},
            </if>
            <if test="operateDt != null">
                operate_time = #{operateDt,jdbcType=TIMESTAMP},
            </if>
            <if test="deleted != null">
                deleted = #{deleted,jdbcType=TINYINT},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <!--查一个灌溉单元-->
    <select id="selectById" resultType="com.dy.pipIrrGlobal.voIr.VoUnitOne">
        select
        CAST(pro.id AS char)AS projectId,
        pro.project_name  AS  projectName,
        CAST(uni.id AS char)AS id,
        CAST(uni.operator AS char)AS operator,
        cli.name         AS operatorName,
        uni.area,
        uni.remarks,
        uni.operate_time  AS  operateDt
        from ir_irrigate_unit uni
        left join ir_project pro on pro.id = uni.project_id
        left join se_client cli on cli.id = uni.operator
        where uni.id = #{id,jdbcType=BIGINT} and uni.deleted = 0
    </select>
    <!--分页查灌溉单元-->
    <select id="getUnits" resultType="com.dy.pipIrrGlobal.voIr.VoUnit">
        SELECT
        CAST(pro.id AS char)AS projectId,
        pro.project_name  AS  projectName,
        CAST(uni.id AS char)AS unitId,
        CAST(uni.operator AS char)AS operator,
        cli.name         AS operatorName,
        uni.area,
        uni.remarks,
        uni.operate_time  AS  operateDt
        FROM ir_irrigate_unit uni
        left join ir_project pro on pro.id = uni.project_id
        left join se_client cli on cli.id = uni.operator
        <where>
            uni.deleted = 0
            <if test="projectName != null and projectName != ''">
                AND pro.project_name LIKE CONCAT('%', #{projectName}, '%')
            </if>
<!--            <if test = "groupCode != null and groupCode != ''">-->
<!--                AND pro.project_state = #{groupCode}-->
<!--            </if>-->
        </where>
        ORDER BY uni.operate_time DESC
        <if test="pageCurr != null and pageSize != null">
            LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
        </if>
    </select>
    <!--分页查灌溉单元记录数-->
    <select id="getRecordCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM ir_irrigate_unit uni
        left join ir_project pro on pro.id = uni.project_id
        left join se_client cli on cli.id = uni.operator
        <where>
            uni.deleted = 0
            <if test="projectName != null and projectName != ''">
                AND pro.project_name LIKE CONCAT('%', #{projectName}, '%')
            </if>
            <!--            <if test = "groupCode != null and groupCode != ''">-->
            <!--                AND pro.project_state = #{groupCode}-->
            <!--            </if>-->
        </where>
    </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml
@@ -171,7 +171,7 @@
    <!--查询一个信息-->
    <select id="selectById" resultType="com.dy.pipIrrGlobal.voIr.VoProjectOne">
        select
        CAST(pro.id AS char)AS projectId,
        CAST(pro.id AS char)AS id,
        CAST(pro.province_id AS char)AS provinceId,
        CAST(pro.city_id AS char)AS cityId,
        CAST(pro.county_id AS char)AS countyId,
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml
@@ -251,4 +251,9 @@
  <select id="getBindedCount" resultType="java.lang.Integer">
    SELECT COUNT(*) AS recordCount FROM pr_controller WHERE rtuAddr = (SELECT rtuAddr FROM pr_controller_tramp WHERE id = ${controllerId}) AND intakeId IS NOT NULL
  </select>
  <!--根据取水口ID获取阀控器地址-->
  <select id="getRtuAddrByIntakeId" resultType="java.lang.String">
    SELECT rtuAddr FROM pr_controller WHERE deleted = 0 AND intakeId = #{intakeId} LIMIT 0,1
  </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
New file
@@ -0,0 +1,199 @@
<?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.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
    <!--@mbg.generated-->
    <!--@Table rm_command_history-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="command_code" jdbcType="VARCHAR" property="commandCode" />
    <result column="command_name" jdbcType="VARCHAR" property="commandName" />
    <result column="rtuAddr" jdbcType="VARCHAR" property="rtuaddr" />
    <result column="protocol" jdbcType="VARCHAR" property="protocol" />
    <result column="command_type" jdbcType="VARCHAR" property="commandType" />
    <result column="callBack" jdbcType="VARCHAR" property="callback" />
<!--    <result column="param" jdbcType="VARCHAR" property="param" />-->
    <result column="param" property="param" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" />
    <result column="send_time" jdbcType="TIMESTAMP" property="sendTime" />
    <result column="operator" jdbcType="BIGINT" property="operator" />
    <result column="result" jdbcType="TINYINT" property="result" />
    <result column="result_time" jdbcType="TIMESTAMP" property="resultTime" />
    <result column="result_text" property="resultText" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, command_code, command_name, rtuAddr, protocol, command_type, callBack, param,
    send_time, `operator`, `result`, result_time, result_text
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from rm_command_history
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from rm_command_history
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
    <!--@mbg.generated-->
    insert into rm_command_history (id, command_code, command_name,
      rtuAddr, protocol, command_type,
      callBack, param, send_time,
      `operator`, `result`, result_time,
      result_text)
    values (#{id,jdbcType=BIGINT}, #{commandCode,jdbcType=VARCHAR}, #{commandName,jdbcType=VARCHAR},
      #{rtuaddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{commandType,jdbcType=VARCHAR},
      #{callback,jdbcType=VARCHAR}, #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, #{sendTime,jdbcType=TIMESTAMP},
      #{operator,jdbcType=BIGINT}, #{result,jdbcType=TINYINT}, #{resultTime,jdbcType=TIMESTAMP},
      #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
    <!--@mbg.generated-->
    insert into rm_command_history
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="commandCode != null">
        command_code,
      </if>
      <if test="commandName != null">
        command_name,
      </if>
      <if test="rtuaddr != null">
        rtuAddr,
      </if>
      <if test="protocol != null">
        protocol,
      </if>
      <if test="commandType != null">
        command_type,
      </if>
      <if test="callback != null">
        callBack,
      </if>
      <if test="param != null">
        param,
      </if>
      <if test="sendTime != null">
        send_time,
      </if>
      <if test="operator != null">
        `operator`,
      </if>
      <if test="result != null">
        `result`,
      </if>
      <if test="resultTime != null">
        result_time,
      </if>
      <if test="resultText != null">
        result_text,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="commandCode != null">
        #{commandCode,jdbcType=VARCHAR},
      </if>
      <if test="commandName != null">
        #{commandName,jdbcType=VARCHAR},
      </if>
      <if test="rtuaddr != null">
        #{rtuaddr,jdbcType=VARCHAR},
      </if>
      <if test="protocol != null">
        #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="commandType != null">
        #{commandType,jdbcType=VARCHAR},
      </if>
      <if test="callback != null">
        #{callback,jdbcType=VARCHAR},
      </if>
      <if test="param != null">
        #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
      </if>
      <if test="sendTime != null">
        #{sendTime,jdbcType=TIMESTAMP},
      </if>
      <if test="operator != null">
        #{operator,jdbcType=BIGINT},
      </if>
      <if test="result != null">
        #{result,jdbcType=TINYINT},
      </if>
      <if test="resultTime != null">
        #{resultTime,jdbcType=TIMESTAMP},
      </if>
      <if test="resultText != null">
        #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
    <!--@mbg.generated-->
    update rm_command_history
    <set>
      <if test="commandCode != null">
        command_code = #{commandCode,jdbcType=VARCHAR},
      </if>
      <if test="commandName != null">
        command_name = #{commandName,jdbcType=VARCHAR},
      </if>
      <if test="rtuaddr != null">
        rtuAddr = #{rtuaddr,jdbcType=VARCHAR},
      </if>
      <if test="protocol != null">
        protocol = #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="commandType != null">
        command_type = #{commandType,jdbcType=VARCHAR},
      </if>
      <if test="callback != null">
        callBack = #{callback,jdbcType=VARCHAR},
      </if>
      <if test="param != null">
        param = #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
      </if>
      <if test="sendTime != null">
        send_time = #{sendTime,jdbcType=TIMESTAMP},
      </if>
      <if test="operator != null">
        `operator` = #{operator,jdbcType=BIGINT},
      </if>
      <if test="result != null">
        `result` = #{result,jdbcType=TINYINT},
      </if>
      <if test="resultTime != null">
        result_time = #{resultTime,jdbcType=TIMESTAMP},
      </if>
      <if test="resultText != null">
        result_text = #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
    <!--@mbg.generated-->
    update rm_command_history
    set command_code = #{commandCode,jdbcType=VARCHAR},
      command_name = #{commandName,jdbcType=VARCHAR},
      rtuAddr = #{rtuaddr,jdbcType=VARCHAR},
      protocol = #{protocol,jdbcType=VARCHAR},
      command_type = #{commandType,jdbcType=VARCHAR},
      callBack = #{callback,jdbcType=VARCHAR},
      param = #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
      send_time = #{sendTime,jdbcType=TIMESTAMP},
      `operator` = #{operator,jdbcType=BIGINT},
      `result` = #{result,jdbcType=TINYINT},
      result_time = #{resultTime,jdbcType=TIMESTAMP},
      result_text = #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java
New file
@@ -0,0 +1,301 @@
package com.dy.pipIrrIrrigate.irrigateGroup;
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoIr.IrGroupUnit;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit;
import com.dy.pipIrrGlobal.voIr.VoGroup;
import com.dy.pipIrrGlobal.voIr.VoGroupOne;
import com.dy.pipIrrGlobal.voIr.VoUnit;
import com.dy.pipIrrGlobal.voIr.VoUnitOne;
import com.dy.pipIrrGlobal.voSe.VoActiveCard;
import com.dy.pipIrrIrrigate.irrigateUnit.IrrigateUnitSv;
import com.dy.pipIrrIrrigate.irrigateGroup.QueryVo;
import com.dy.pipIrrIrrigate.result.IrrigateResultCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
/**
 * @author :WuZeYu
 * @Date :2024/5/21  16:19
 * @LastEditTime :2024/5/21  16:19
 * @Description
 */
@Slf4j
@Tag(name = "轮灌组", description = "轮灌组")
@RestController
@RequestMapping(path = "group")
@RequiredArgsConstructor
public class IrrigateGroupCtrl {
    @Autowired
    private IrrigateGroupSv irrigateGroupSv;
    /**
     * 创建轮灌组
     *
     * @param po            轮灌组实体对象
     * @param bindingResult
     * @return 添加是否成功
     */
    @Operation(summary = "创建轮灌组记录", description = "创建轮灌组记录")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> add(@RequestBody @Valid IrIrrigateGroup po, BindingResult bindingResult) {
        if (bindingResult != null && bindingResult.hasErrors()) {
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            Integer rec = Optional.ofNullable(irrigateGroupSv.addIrrigateGroup(po)).orElse(0);
            if (rec == 0) {
                return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage());
            }
        } catch (Exception e) {
            log.error("创建轮灌组异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * 逻辑删除灌溉单元
     * @param
     * @return
     */
    @Operation(summary = "逻辑删除轮灌组", description = "逻辑删除轮灌组")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "delete")
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> delete( Long id) {
        if (id == null ) {
            BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage());
        }
//        Long groupId = Long.parseLong(map.get("id").toString());
        try {
            Integer rows = irrigateGroupSv.deleteIrrigateGroup(id);
            if (rows == 0) {
                return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage());
            }
        } catch (Exception e) {
            log.error("删除轮灌组异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * 批量删除
     * @param groupIds
     * @return
     */
    @PostMapping(path = "delete_batch", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> delete_batch(@RequestBody Map<String, List> groupIds) {
        if (groupIds == null || groupIds.size() <= 0) {
            BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage());
        }
        List ids = groupIds.get("groupIds");
        for (int i = 0; i < ids.size(); i++) {
            long groupId = Long.parseLong(ids.get(i).toString());
            try {
                Integer rows = irrigateGroupSv.deleteIrrigateGroup(groupId);
                if (rows == 0) {
                    return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage());
                }
            } catch (Exception e) {
                log.error("删除轮灌组异常", e);
                return BaseResponseUtils.buildException(e.getMessage());
            }
        }
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * 修改灌溉单元
     * @param po
     * @param bindingResult
     * @return
     */
    @Operation(summary = "修改轮灌组", description = "修改轮灌组")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> update(@RequestBody @Valid IrIrrigateGroup po, BindingResult bindingResult){
        if (bindingResult != null && bindingResult.hasErrors()) {
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            Integer rec = Optional.ofNullable(irrigateGroupSv.updateIrrigateGroup(po)).orElse(0);
            if (rec == 0) {
                return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage());
            }
        } catch (Exception e) {
            log.error("修改轮灌组异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * 获取一个轮灌组
     *
     * @return 获取一个轮灌组
     */
    @Operation(summary = "获取一个轮灌组", description = "获取一个轮灌组")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "获取一个轮灌组(BaseResponse.content:{})",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = IrIrrigateGroup.class))}
            )
    })
    @GetMapping(path = "one")
    @SsoAop()
    public BaseResponse<VoGroupOne> one(@RequestParam Long id) {
        VoGroupOne irIrrigateGroup = this.irrigateGroupSv.selectById(id);
        return BaseResponseUtils.buildSuccess(irIrrigateGroup);
    }
    /**
     * 分页查询
     * @param vo
     * @return
     */
    @Operation(summary = "获得一页轮灌组记录", description = "获得一页轮灌组记录")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "获得一页灌溉单元记录(BaseResponse.content:QueryResultVo[{}])",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = VoActiveCard.class))}
            )
    })
    @GetMapping(path = "some")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoGroup>>> getIrrigateGroups(QueryVo vo) {
        try {
            QueryResultVo<List<VoGroup>> res = irrigateGroupSv.getIrrigateGroups(vo);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("获取轮灌组记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 轮灌组添加灌溉单元
     *
     * @param po            轮灌组灌溉单元中间表
     * @param bindingResult
     * @return 添加是否成功
     */
    @Operation(summary = "轮灌组添加灌溉单元", description = "轮灌组添加灌溉单元")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "add_unit", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> addGroupUnit(@RequestBody @Valid IrGroupUnit po, BindingResult bindingResult) {
        if (bindingResult != null && bindingResult.hasErrors()) {
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            Integer rec = Optional.ofNullable(irrigateGroupSv.addGroupUnit(po)).orElse(0);
            if (rec == 0) {
                return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage());
            }
        } catch (Exception e) {
            log.error("轮灌组添加灌溉单元异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * 逻辑删除 轮灌组移除灌溉单元
     * @param
     * @return
     */
    @Operation(summary = "轮灌组移除灌溉单元", description = "轮灌组移除灌溉单元")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "remove_unit")
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> deleteGroupUnit(@RequestBody @Valid IrGroupUnit po, BindingResult bindingResult) {
        if (bindingResult != null && bindingResult.hasErrors()) {
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            Integer rec = Optional.ofNullable(irrigateGroupSv.deleteGroupUnit(po)).orElse(0);
            if (rec == 0) {
                return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage());
            }
        } catch (Exception e) {
            log.error("轮灌组移除灌溉单元异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java
New file
@@ -0,0 +1,135 @@
package com.dy.pipIrrIrrigate.irrigateGroup;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoIr.IrGroupUnitMapper;
import com.dy.pipIrrGlobal.daoIr.IrIrrigateGroupMapper;
import com.dy.pipIrrGlobal.pojoIr.IrGroupUnit;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup;
import com.dy.pipIrrGlobal.voIr.VoGroup;
import com.dy.pipIrrGlobal.voIr.VoGroupOne;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author :WuZeYu
 * @Date :2024/5/21  15:57
 * @LastEditTime :2024/5/21  15:57
 * @Description
 */
@Slf4j
@Service
public class IrrigateGroupSv {
    @Autowired
    private IrIrrigateGroupMapper irIrrigateGroupMapper;
    @Autowired
    private IrGroupUnitMapper irGroupUnitMapper;
    /**
     * 创建轮灌组
     *
     * @param po
     * @return
     */
    public Integer addIrrigateGroup(IrIrrigateGroup po) {
        po.setOperateDt(new Date());
        po.setDeleted((byte) 0);
        int rows = irIrrigateGroupMapper.insertSelective(po);
        if (rows == 0) {
            return 0;
        }
        return 1;
    }
    /**
     * 删除轮灌组
     *
     * @param id
     */
    public Integer deleteIrrigateGroup(Long id) {
        int rows = irIrrigateGroupMapper.deleteLogicById(id);
        int rows1 = irGroupUnitMapper.deleteByGroupId(id);
        if (rows == 0) {
            return 0;
        }
        return 1;
    }
    /**
     * 修改轮灌组
     * @param po
     * @return
     */
    public Integer updateIrrigateGroup(IrIrrigateGroup po){
        po.setOperateDt(new Date());
        int rows = irIrrigateGroupMapper.updateByPrimaryKeySelective(po);
        if (rows == 0){
            return 0;
        }
        return 1;
    }
    /**
     * 获取一个轮灌组
     * @param id
     * @return
     */
    public VoGroupOne selectById(Long id){
        VoGroupOne unit = irIrrigateGroupMapper.selectById(id);
        return unit;
    }
    /**
     * 分页查询轮灌组
     * @param queryVo
     * @return
     */
    public QueryResultVo<List<VoGroup>> getIrrigateGroups(QueryVo queryVo){
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
        Long itemTotal = irIrrigateGroupMapper.getRecordCount(params);
        QueryResultVo<List<VoGroup>> rsVo = new QueryResultVo<>();
        rsVo.pageSize = queryVo.pageSize;
        rsVo.pageCurr = queryVo.pageCurr;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = irIrrigateGroupMapper.getIrrigateGroups(params);
        return rsVo;
    }
    /**
     * 轮灌组添加灌溉单元
     *
     * @param po
     * @return
     */
    public Integer addGroupUnit(IrGroupUnit po) {
        po.setOperateDt(new Date());
        po.setDeleted((byte) 0);
        int rows = irGroupUnitMapper.insertSelective(po);
        if (rows == 0) {
            return 0;
        }
        return 1;
    }
    /**
     * 轮灌组移除灌溉单元
     *
     * @param po
     * @return
     */
    public Integer deleteGroupUnit(IrGroupUnit po) {
        po.setOperateDt(new Date());
        int rows = irGroupUnitMapper.deleteByUnitIdGroupId(po);
        if (rows == 0) {
            return 0;
        }
        return 1;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/QueryVo.java
New file
@@ -0,0 +1,26 @@
package com.dy.pipIrrIrrigate.irrigateGroup;
import com.dy.common.webUtil.QueryConditionVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
/**
 * @author :WuZeYu
 * @Date :2024/5/15  21:11
 * @LastEditTime :2024/5/15  21:11
 * @Description
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Schema(name = "项目查询条件")
public class QueryVo extends QueryConditionVo {
    @Schema(description = "项目名称")
    public String projectName;
    @Schema(description = "轮罐组名称")
    public String groupCode;
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java
@@ -1,12 +1,39 @@
package com.dy.pipIrrIrrigate.irrigateUnit;
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit;
import com.dy.pipIrrGlobal.pojoIr.IrProject;
import com.dy.pipIrrGlobal.voIr.VoProject;
import com.dy.pipIrrGlobal.voIr.VoProjectOne;
import com.dy.pipIrrGlobal.voIr.VoUnit;
import com.dy.pipIrrGlobal.voIr.VoUnitOne;
import com.dy.pipIrrGlobal.voSe.VoActiveCard;
import com.dy.pipIrrIrrigate.irrigateUnit.QueryVo;
import com.dy.pipIrrIrrigate.result.IrrigateResultCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
/**
 * @author :WuZeYu
@@ -17,9 +44,189 @@
@Slf4j
@Tag(name = "灌溉单元", description = "灌溉单元")
@RestController
@RequestMapping(path = "irrigate/unit")
@RequestMapping(path = "unit")
@RequiredArgsConstructor
public class IrrigateUnitCtrl {
    @Autowired
    private  IrrigateUnitSv irrigateUnitSv;
    /**
     * 创建灌溉单元
     *
     * @param po            灌溉单元实体对象
     * @param bindingResult
     * @return 添加是否成功
     */
    @Operation(summary = "创建灌溉单元记录", description = "创建灌溉单元记录")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> add(@RequestBody @Valid IrIrrigateUnit po, BindingResult bindingResult) {
        if (bindingResult != null && bindingResult.hasErrors()) {
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            Integer rec = Optional.ofNullable(irrigateUnitSv.addIrrigateUnit(po)).orElse(0);
            if (rec == 0) {
                return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage());
            }
        } catch (Exception e) {
            log.error("创建灌溉单元异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * 逻辑删除灌溉单元
     * @param map
     * @return
     */
    @Operation(summary = "逻辑删除灌溉单元", description = "逻辑删除灌溉单元")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "delete", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> delete(@RequestBody Map map) {
        if (map == null || map.size() <= 0) {
            BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage());
        }
        Long unitId = Long.parseLong(map.get("id").toString());
        try {
            Integer rows = irrigateUnitSv.deleteUnit(unitId);
            if (rows == 0) {
                return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage());
            }
        } catch (Exception e) {
            log.error("删除灌溉单元异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * 批量删除
     * @param unitIds
     * @return
     */
    @PostMapping(path = "delete_batch", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> delete_batch(@RequestBody Map<String, List> unitIds) {
        if (unitIds == null || unitIds.size() <= 0) {
            BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage());
        }
        List ids = unitIds.get("unitIds");
        for (int i = 0; i < ids.size(); i++) {
            long unitId = Long.parseLong(ids.get(i).toString());
            try {
                Integer rows = irrigateUnitSv.deleteUnit(unitId);
                if (rows == 0) {
                    return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage());
                }
            } catch (Exception e) {
                log.error("删除灌溉单元异常", e);
                return BaseResponseUtils.buildException(e.getMessage());
            }
        }
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * 修改灌溉单元
     * @param po
     * @param bindingResult
     * @return
     */
    @Operation(summary = "修改灌溉单元", description = "修改灌溉单元")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> update(@RequestBody @Valid IrIrrigateUnit po, BindingResult bindingResult){
        if (bindingResult != null && bindingResult.hasErrors()) {
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            Integer rec = Optional.ofNullable(irrigateUnitSv.updateUnit(po)).orElse(0);
            if (rec == 0) {
                return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage());
            }
        } catch (Exception e) {
            log.error("修改灌溉单元异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * 获取一个灌溉单元
     *
     * @return 获取一个灌溉单元
     */
    @Operation(summary = "获取一个灌溉单元", description = "获取一个灌溉单元")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "获取一个灌溉单元(BaseResponse.content:{})",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = IrIrrigateUnit.class))}
            )
    })
    @GetMapping(path = "one")
    @SsoAop()
    public BaseResponse<VoUnitOne> one(@RequestParam Long id) {
        VoUnitOne irIrrigateUnit = this.irrigateUnitSv.selectById(id);
            return BaseResponseUtils.buildSuccess(irIrrigateUnit);
    }
    /**
     * 分页查询
     * @param vo
     * @return
     */
    @Operation(summary = "获得一页灌溉单元记录", description = "获得一页灌溉单元记录")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "获得一页灌溉单元记录(BaseResponse.content:QueryResultVo[{}])",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = VoActiveCard.class))}
            )
    })
    @GetMapping(path = "some")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoUnit>>> getUnits(QueryVo vo) {
        try {
            QueryResultVo<List<VoUnit>> res = irrigateUnitSv.getUnits(vo);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("获取灌溉单元记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java
@@ -1,7 +1,23 @@
package com.dy.pipIrrIrrigate.irrigateUnit;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoIr.IrIrrigateUnitMapper;
import com.dy.pipIrrGlobal.daoIr.IrProjectMapper;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit;
import com.dy.pipIrrGlobal.pojoIr.IrProject;
import com.dy.pipIrrGlobal.voIr.VoProject;
import com.dy.pipIrrGlobal.voIr.VoProjectOne;
import com.dy.pipIrrGlobal.voIr.VoUnit;
import com.dy.pipIrrGlobal.voIr.VoUnitOne;
import com.dy.pipIrrIrrigate.irrigateUnit.QueryVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author :WuZeYu
@@ -12,4 +28,77 @@
@Slf4j
@Service
public class IrrigateUnitSv {
    @Autowired
    private IrIrrigateUnitMapper irIrrigateUnitMapper;
    /**
     * 创建灌溉单元
     *
     * @param po
     * @return
     */
    public Integer addIrrigateUnit(IrIrrigateUnit po) {
        po.setOperateDt(new Date());
        po.setDeleted((byte) 0);
        int rows = irIrrigateUnitMapper.insertSelective(po);
        if (rows == 0) {
            return 0;
        }
        return 1;
    }
    /**
     * 删除灌溉单元
     *
     * @param id
     */
    public Integer deleteUnit(Long id) {
        int rows = irIrrigateUnitMapper.deleteLogicById(id);
        if (rows == 0) {
            return 0;
        }
        return 1;
    }
    /**
     * 修改灌溉单元
     * @param po
     * @return
     */
    public Integer updateUnit(IrIrrigateUnit po){
        po.setOperateDt(new Date());
        int rows = irIrrigateUnitMapper.updateByPrimaryKeySelective(po);
        if (rows == 0){
            return 0;
        }
        return 1;
    }
    /**
     * 获取一个灌溉单元
     * @param id
     * @return
     */
    public VoUnitOne selectById(Long id){
        VoUnitOne unit = irIrrigateUnitMapper.selectById(id);
        return unit;
    }
    /**
     * 分页查询项目
     * @param queryVo
     * @return
     */
    public QueryResultVo<List<VoUnit>> getUnits(QueryVo queryVo){
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
        Long itemTotal = irIrrigateUnitMapper.getRecordCount(params);
        QueryResultVo<List<VoUnit>> rsVo = new QueryResultVo<>();
        rsVo.pageSize = queryVo.pageSize;
        rsVo.pageCurr = queryVo.pageCurr;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = irIrrigateUnitMapper.getUnits(params);
        return rsVo;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/QueryVo.java
New file
@@ -0,0 +1,26 @@
package com.dy.pipIrrIrrigate.irrigateUnit;
import com.dy.common.webUtil.QueryConditionVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
/**
 * @author :WuZeYu
 * @Date :2024/5/15  21:11
 * @LastEditTime :2024/5/15  21:11
 * @Description
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Schema(name = "项目查询条件")
public class QueryVo extends QueryConditionVo {
    @Schema(description = "项目名称")
    public String projectName;
    @Schema(description = "轮罐组名称")
    public String groupCode;
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java
@@ -224,11 +224,9 @@
    @SsoAop()
    public BaseResponse<VoProjectOne> one(@RequestParam Long id) {
        VoProjectOne irProject = this.projectSv.selectById(id);
        if (irProject == null) {
            return BaseResponseUtils.buildFail(IrrigateResultCode.NO_PROJECT.getMessage());
        } else {
            return BaseResponseUtils.buildSuccess(irProject);
        }
    }
    /**
@@ -247,12 +245,9 @@
    })
    @GetMapping(path = "some")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoProject>>> getIntakes(QueryVo vo) {
    public BaseResponse<QueryResultVo<List<VoProject>>> getProjects(QueryVo vo) {
        try {
            QueryResultVo<List<VoProject>> res = projectSv.getProjects(vo);
            if (res == null) {
                return BaseResponseUtils.buildFail(IrrigateResultCode.NO_PROJECT.getMessage());
            }
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("获取项目记录异常", e);
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java
@@ -23,6 +23,11 @@
    NO_PROJECT(10005, "无符合条件的项目记录");
//    /**
//     * 灌溉单元
//     */
//    ADD_IRRIGATE_UNIT_FAIL(20001, "创建灌溉单元失败"),
    private final Integer code;
    private final String message;
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java
@@ -244,4 +244,6 @@
        String fileName = URLEncoder.encode(rawFileName, "UTF-8").replaceAll("\\+", "%20");
        response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java
@@ -2,10 +2,6 @@
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.dy.common.mw.protocol.Command;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoPr.PrControllerMapper;
import com.dy.pipIrrGlobal.daoPr.PrIntakeControllerMapper;
@@ -13,24 +9,16 @@
import com.dy.pipIrrGlobal.pojoPr.PrController;
import com.dy.pipIrrGlobal.pojoPr.PrIntakeController;
import com.dy.pipIrrGlobal.voPr.VoController;
import com.dy.pipIrrProject.result.ProjectResultCode;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import static com.dy.common.mw.protocol.CommandType.innerCommand;
/**
 * @author ZhuBaoMin
pipIrr-platform/pipIrr-web/pipIrr-web-remote/pom.xml
@@ -2,6 +2,14 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <dependencies>
        <dependency>
            <groupId>com.dy</groupId>
            <artifactId>pipIrr-web-project</artifactId>
            <version>1.0.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <parent>
        <artifactId>pipIrr-web</artifactId>
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/PipIrrRemoteApplication.java
@@ -18,7 +18,7 @@
                })
        }
)
@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoBa"})
@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoRm", "com.dy.pipIrrGlobal.daoPr"})
public class PipIrrRemoteApplication {
    public static void main(String[] args) {
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/ComSupport.java
New file
@@ -0,0 +1,143 @@
package com.dy.pipIrrRemote.common;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.dy.common.mw.protocol.Command;
import com.dy.common.mw.protocol.CommandType;
import com.dy.common.mw.protocol.p206V202404.CodeV202404;
import com.dy.common.mw.protocol.p206V202404.ProtocolConstantV206V202404;
import com.dy.common.mw.protocol.p206V202404.downVos.ComCdXyVo;
import com.dy.common.webUtil.BaseResponse;
import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-05-21 15:30
 * @LastEditTime 2024-05-21 15:30
 * @Description
 */
//@RequiredArgsConstructor
public class ComSupport {
    //@NotNull
    //private final CommandSv commandSv;
    protected static String mwUrlTest = "http://127.0.0.1:8070/rtuMw/com/test" ;
    protected static String mwUrlSendCom = "http://127.0.0.1:8070/rtuMw/com/send" ;
    //protected static String rtuAddr = "37142501020100215" ;
    protected static String rtuResultSendWebUrl = "http://127.0.0.1:8081/remote/comRes/receive" ;
    protected static String controllerType = "57" ;//控制器类型
    protected static Integer projectNo = 10 ;//项目编码
    protected static String icCardAddr = "04BEA5BB" ;//IC卡地址
    protected static String icCardNo = "37142501020500001" ;//IC卡编号(用户卡序列号)
    protected String protocolName = ProtocolConstantV206V202404.protocolName;
    protected String commandTypeInner = CommandType.innerCommand;
    protected String commandTypeOuter = CommandType.outerCommand;
    @Autowired
    private RestTemplate restTemplate;
    protected ComCdXyVo comCdXyVo(){
        ComCdXyVo comVo = new ComCdXyVo() ;
        comVo.controllerType = controllerType ;
        comVo.projectNo = projectNo  ;
        return comVo ;
    }
    /**
     * 创建命令日志对象
     * @param commandCode 功能码
     * @param rtuAddr 阀控器地址
     * @param param 参数数据
     * @param operator 操作员
     * @return 零零日志对象
     */
    protected RmCommandHistory getComHistory(String commandCode, String rtuAddr, Object param, Long operator ) {
        RmCommandHistory rmCommandHistory = new RmCommandHistory();
        rmCommandHistory.setCommandCode(commandCode);
        rmCommandHistory.setCommandName(CodeV202404.getCodeName(commandCode));
        rmCommandHistory.setRtuaddr(rtuAddr);
        rmCommandHistory.setProtocol(protocolName);
        rmCommandHistory.setCommandType(commandTypeOuter);
        rmCommandHistory.setCallback(rtuResultSendWebUrl);
        rmCommandHistory.setParam((JSONObject) JSON.toJSON(param));
        rmCommandHistory.setSendTime(new Date());
        rmCommandHistory.setOperator(operator);
        return rmCommandHistory;
    }
    /**
     * 构造命令对象
     * @param comId 命令ID
     * @param commandCode 功能码
     * @param rtuAddr RTU地址
     * @param param 参数数据
     * @return 构造好的命令对象
     */
    protected Command command(String comId, String commandCode, String rtuAddr, Object param){
        Command com = new Command() ;
        com.id = comId==null?Command.defaultId:(comId.trim().equals("")?Command.defaultId:comId);
        com.code = commandCode ;
        com.rtuAddr = rtuAddr ;
        com.protocol = protocolName;
        com.type = commandTypeOuter;
        com.rtuResultSendWebUrl = rtuResultSendWebUrl ;
        com.param = param ;
        return com ;
    }
    /**
     * 连接通信中间件测试
     * @return
     */
    protected BaseResponse sendTest(){
        String url = UriComponentsBuilder.fromUriString(mwUrlTest)
                .build()
                .toUriString();
        HttpHeaders headers = new HttpHeaders();
        HttpEntity<?> httpEntity = new HttpEntity<>(headers);
        ResponseEntity<BaseResponse> response = null;
        try {
            // 通过Get方式调用接口
            response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, BaseResponse.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response.getBody();
    }
    /**
     * 发送命令
     * @return
     */
    protected BaseResponse sendCom2Mw(Command com){
        String url = UriComponentsBuilder.fromUriString(mwUrlSendCom)
                .build()
                .toUriString();
        HttpHeaders headers = new HttpHeaders();
        HttpEntity<Command> httpEntity = new HttpEntity<>(com, headers);
        ResponseEntity<BaseResponse> response = null;
        try {
            // 通过Post方式调用接口
            response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, BaseResponse.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response.getBody();
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
New file
@@ -0,0 +1,51 @@
package com.dy.pipIrrRemote.common;
import com.dy.pipIrrGlobal.daoPr.PrControllerMapper;
import com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper;
import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
 * @author ZhuBaoMin
 * @date 2024-05-21 17:14
 * @LastEditTime 2024-05-21 17:14
 * @Description 命令日志服务类
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class CommandSv {
    private final RmCommandHistoryMapper rmCommandHistoryMapper;
    private final PrControllerMapper prControllerMapper;
    /**
     * 根据取水口ID获取阀控器地址
     * @param intakeId 取水口ID
     * @return 阀控器地址
     */
    public String getRtuAddrByIntakeId(Long intakeId) {
        return prControllerMapper.getRtuAddrByIntakeId(intakeId);
    }
    /**
     * 添加命令日志
     * @param po 命令日志对象
     * @return 字符串类型的主键
     */
    public String insert(RmCommandHistory po) {
        rmCommandHistoryMapper.insert(po);
        return (po.getId()).toString();
    }
    /**
     * 修改命令日志信息
     * @param po 命令日志对象
     * @return 影响记录数量
     */
    public Integer update(RmCommandHistory po) {
        return rmCommandHistoryMapper.updateByPrimaryKeySelective(po);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/RestTemplateConfig.java
New file
@@ -0,0 +1,21 @@
package com.dy.pipIrrRemote.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
/**
 * @author ZhuBaoMin
 * @date 2024-05-07 17:09
 * @LastEditTime 2024-05-07 17:09
 * @Description
 */
@Configuration
public class RestTemplateConfig {
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebFilterConfiguration.java
New file
@@ -0,0 +1,51 @@
package com.dy.pipIrrRemote.config;
import com.dy.common.webFilter.DevOfDataSourceNameSetFilter;
import com.dy.common.webFilter.UserTokenFilter;
import jakarta.servlet.Filter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * @author ZhuBaoMin
 * @date 2024-05-07 14:51
 * @LastEditTime 2024-05-07 14:51
 * @Description
 */
@Configuration
public class WebFilterConfiguration {
    @Value("${pipIrr.global.dev}")
    public String isDevStage ;//是否为开发阶段
    @Value("${pipIrr.global.dsName}")
    public String dsName ;//开发阶段的数据源名称
    /**
     * DevOfDataSourceNameSetFilter与UserTokenFilter只能一个被配置上,
     * 所以他们的order都是1
     */
    private static final int order_UserTokenFilter = 1 ;//与下面
    private static final int order_DevOfDataSourceNameSetFilter = 1 ;
    @Bean
    public FilterRegistrationBean<? extends Filter> RegFilter() {
        FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>();
        if(this.isDevStage != null && !this.isDevStage.trim().equals("") && this.isDevStage.trim().equalsIgnoreCase("true")){
            filterRegistrationBean.setFilter(new DevOfDataSourceNameSetFilter());
            filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则
            filterRegistrationBean.addInitParameter("dataSourceName",dsName);//设置init参数
            filterRegistrationBean.setName("DevOfDataSourceNameSetFilter");//设置过滤器名称
            filterRegistrationBean.setOrder(order_DevOfDataSourceNameSetFilter);//执行次序
        }else{
            filterRegistrationBean.setFilter(new UserTokenFilter());
            filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则
            filterRegistrationBean.setName("UserTokenFilter");//设置过滤器名称
            filterRegistrationBean.setOrder(order_UserTokenFilter);//执行次序
        }
        return filterRegistrationBean;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebListenerConfiguration.java
New file
@@ -0,0 +1,68 @@
package com.dy.pipIrrRemote.config;
import com.dy.common.webListener.GenerateIdSetSuffixListener;
import jakarta.servlet.ServletContextListener;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * @author ZhuBaoMin
 * @date 2024-05-07 14:52
 * @LastEditTime 2024-05-07 14:52
 * @Description
 */
@Configuration
public class WebListenerConfiguration {
    /**
     * 启动顺序
     */
    //private static final int order_config = 0 ;
    private static final int order_idSetSuffix = 1 ;
    //private static final int order_init = 2 ;
    /*
    * 解析各种***.config配置的ConfigListener,暂时不采用此种配置方式
    *
    @Bean
    public ConfigListener getGlConfigListener(){
        return new ConfigListener() ;
    }
    /**
     * 外部提供Listener
     * @param listener 外部提供Listener
     * @return 注册Bean
    @Bean
    public ServletListenerRegistrationBean<? extends ServletContextListener> regConfigListener(ConfigListener listener) {
        ServletListenerRegistrationBean<ConfigListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>();
        listenerRegistrationBean.setListener(listener);
        listenerRegistrationBean.setOrder(order_config);
        return listenerRegistrationBean;
    }
    */
    /**
     * 内部提供listener,该listener在系统启动时,根据配置 设置ID产生器的后缀
     * @return 注册Bean
     */
    @Bean
    public ServletListenerRegistrationBean<? extends ServletContextListener> regSsoListener() {
        ServletListenerRegistrationBean<GenerateIdSetSuffixListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>();
        listenerRegistrationBean.setListener(new GenerateIdSetSuffixListener());
        listenerRegistrationBean.setOrder(order_idSetSuffix);
        return listenerRegistrationBean;
    }
//    /**
//     * 内部提供listener,该listener在系统启动时,初始化数据库数据
//     * @return 注册Bean
//     */
//    @Bean
//    public ServletListenerRegistrationBean<? extends ServletContextListener> regInitListener() {
//        ServletListenerRegistrationBean<InitListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>();
//        listenerRegistrationBean.setListener(new InitListener());
//        listenerRegistrationBean.setOrder(order_init);
//        return listenerRegistrationBean;
//    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/result/RemoteResultCode.java
New file
@@ -0,0 +1,29 @@
package com.dy.pipIrrRemote.result;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
 * @author ZhuBaoMin
 * @date 2024-05-07 14:54
 * @LastEditTime 2024-05-07 14:54
 * @Description
 */
@Getter
@AllArgsConstructor
public enum RemoteResultCode {
    /**
     * 远程操作
     */
    DIVIDE_FAIL(10001, "分水房添加失败"),
    DELETE_DIVIDE_FAIL(10001, "分水房删除失败"),
    NO_DIVIDES(10001, "无符合条件的分水房记录"),
    /**
     * RTU
     */
    RTU_ADDR_CANNOT_BE_NULL(20001, "阀控器地址不能为空");
    private final Integer code;
    private final String message;
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/CommandResultCtrl.java
New file
@@ -0,0 +1,29 @@
package com.dy.pipIrrRemote.rtu;
import com.dy.common.mw.protocol.Data;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author ZhuBaoMin
 * @date 2024-05-23 8:19
 * @LastEditTime 2024-05-23 8:19
 * @Description
 */
@Slf4j
@RestController
@RequestMapping(path="comRes")
public class CommandResultCtrl {
    @PostMapping(path = "receive", consumes = MediaType.APPLICATION_JSON_VALUE)
    public BaseResponse<String> receive(@RequestBody Data data) {
        log.info(data.toString()) ;
        return BaseResponseUtils.buildSuccess("ok");
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java
New file
@@ -0,0 +1,116 @@
package com.dy.pipIrrRemote.rtu;
import com.dy.common.aop.SsoAop;
import com.dy.common.mw.protocol.Command;
import com.dy.common.mw.protocol.p206V202404.CodeV202404;
import com.dy.common.mw.protocol.p206V202404.downVos.ComCd10Vo;
import com.dy.common.mw.protocol.p206V202404.downVos.ComCdXyVo;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
import com.dy.pipIrrRemote.common.ComSupport;
import com.dy.pipIrrRemote.common.CommandSv;
import com.dy.pipIrrRemote.result.RemoteResultCode;
import com.dy.pipIrrRemote.rtu.dto.Addr;
import com.dy.pipIrrRemote.rtu.dto.DtoBase;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Objects;
/**
 * @author ZhuBaoMin
 * @date 2024-05-21 14:31
 * @LastEditTime 2024-05-21 14:31
 * @Description 设备终端控制类
 */
@Slf4j
@RestController
@RequestMapping(path="rtu")
@RequiredArgsConstructor
public class RtuCtrl extends ComSupport {
    private final CommandSv commandSv;
    protected static String controllerType = "57";
    /**
     * 设置设备终端地址
     * @param addr 设置设备终端地址传入对象
     * @param bindingResult
     * @return
     */
    @PostMapping(path = "set_addr", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> setAddr(@RequestBody @Valid Addr addr, BindingResult bindingResult) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        String commandCode = CodeV202404.cd_10;
        Long intakeId = addr.getIntakeId();
        String newRtuAddr = addr.getNewRtuAddr();
        Long operator = addr.getOperator();
        // 取水口ID换阀控器地址
        String rtuAddr = commandSv.getRtuAddrByIntakeId(intakeId);
        if(rtuAddr == null || rtuAddr.length() == 0) {
            return BaseResponseUtils.buildError(RemoteResultCode.RTU_ADDR_CANNOT_BE_NULL.getMessage());
        }
        // 创建视图
        ComCd10Vo param = new ComCd10Vo() ;
        param.controllerType = controllerType;
        param.projectNo = Integer.parseInt(commandCode);
        param.rtuNewAddr = newRtuAddr;
        // 创建命令日志对象并添加到数据库中
        RmCommandHistory rmCommandHistory = getComHistory(commandCode, rtuAddr, param, operator);
        String comId = commandSv.insert(rmCommandHistory);
        // 构造命令
        Command com = command(comId, commandCode, rtuAddr, param);
        return sendCom2Mw(com);
    }
    @PostMapping(path = "clear_usage_record", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> clearUsageRecord(@RequestBody @Valid DtoBase po, BindingResult bindingResult) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        String commandCode = CodeV202404.cd_97;
        Long intakeId = po.getIntakeId();
        Long operator = po.getOperator();
        // 取水口ID换阀控器地址
        String rtuAddr = commandSv.getRtuAddrByIntakeId(intakeId);
        if(rtuAddr == null || rtuAddr.length() == 0) {
            return BaseResponseUtils.buildError(RemoteResultCode.RTU_ADDR_CANNOT_BE_NULL.getMessage());
        }
        // 创建视图
        ComCdXyVo param = new ComCdXyVo();
        param.controllerType = controllerType;
        param.projectNo = Integer.parseInt(commandCode);
        // 创建命令日志对象并添加到数据库中
        RmCommandHistory rmCommandHistory = getComHistory(commandCode, rtuAddr, param, operator);
        String comId = commandSv.insert(rmCommandHistory);
        // 构造命令
        Command com = command(comId, commandCode, rtuAddr, param);
        return sendCom2Mw(com);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/Addr.java
New file
@@ -0,0 +1,22 @@
package com.dy.pipIrrRemote.rtu.dto;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-05-22 16:56
 * @LastEditTime 2024-05-22 16:56
 * @Description
 */
@Data
public class Addr extends DtoBase {
    public static final long serialVersionUID = 202405221656001L;
    /**
     * 新的阀控器地址
     */
    @NotBlank(message = "新的阀控器地址不能为空")
    private String newRtuAddr;
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/DtoBase.java
New file
@@ -0,0 +1,28 @@
package com.dy.pipIrrRemote.rtu.dto;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-05-22 16:54
 * @LastEditTime 2024-05-22 16:54
 * @Description
 */
@Data
public class DtoBase {
    public static final long serialVersionUID = 202405221655001L;
    /**
     * 取水口ID
     */
    @NotNull(message = "取水口不能为空")
    private Long intakeId;
    /**
     * 操作人
     */
    @NotNull(message = "操作人不能为空")
    private Long operator;
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/utils/RestTemplateUtils.java
New file
@@ -0,0 +1,97 @@
package com.dy.pipIrrRemote.utils;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
 * @author ZhuBaoMin
 * @date 2024-05-07 17:07
 * @LastEditTime 2024-05-07 17:07
 * @Description
 */
@Component
public class RestTemplateUtils {
    @Autowired
    private RestTemplate restTemplate;
    public JSONObject get(String url, Map<String, Object> queryParams) throws IOException {
        return get(url, queryParams, new HashMap<>(1));
    }
    public JSONObject get(String url, Map<String, Object> queryParams, Map<String, String> headerParams) throws IOException {
        String tempUrl = setParamsByAppendUrl(queryParams, url);
        HttpHeaders headers = new HttpHeaders();
        headerParams.forEach(headers::add);
        HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(null, headers);
        ResponseEntity<String> response = restTemplate.exchange(tempUrl, HttpMethod.GET, httpEntity, String.class);
        return JSONObject.parseObject(response.getBody());
    }
    public JSONObject get2(String url, Map<String, Object> queryParams, Map<String, String> headerParams) throws IOException {
        String tempUrl = setParamsByPath(queryParams, url);
        HttpHeaders headers = new HttpHeaders();
        headerParams.forEach(headers::add);
        HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(null, headers);
        ResponseEntity<String> response = restTemplate.exchange(tempUrl, HttpMethod.GET, httpEntity, String.class, queryParams);
        return JSONObject.parseObject(response.getBody());
    }
    public JSONObject post(String url, String json, Map<String, String> headerParams) {
        HttpHeaders headers = new HttpHeaders();
        headerParams.forEach(headers::add);
        headers.setContentType(MediaType.APPLICATION_JSON);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        HttpEntity<String> httpEntity = new HttpEntity<>(json, headers);
        ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class);
        return JSONObject.parseObject(response.getBody());
    }
    private String setParamsByPath(Map<String, Object> queryParams, String url) {
        // url?id={id}&name={name}
        if (queryParams == null || queryParams.isEmpty()) {
            return url;
        }
        StringBuilder sb = new StringBuilder();
        try {
            for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
                sb.append("&").append(entry.getKey()).append("=").append("{").append(entry.getKey()).append("}");
            }
            if (!url.contains("?")) {
                sb.deleteCharAt(0).insert(0, "?");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return url + sb;
    }
    private String setParamsByAppendUrl(Map<String, Object> queryParams, String url) {
        // url?id=1&name=zzc
        if (queryParams == null || queryParams.isEmpty()) {
            return url;
        }
        StringBuilder sb = new StringBuilder();
        try {
            for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
                sb.append("&").append(entry.getKey()).append("=");
                sb.append(entry.getValue());
            }
            if (!url.contains("?")) {
                sb.deleteCharAt(0).insert(0, "?");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return url + sb;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java
New file
@@ -0,0 +1,108 @@
package com.dy.pipIrrRemote.valve;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrRemote.utils.RestTemplateUtils;
import com.dy.pipIrrRemote.valve.dto.DTOValve;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
 * @author ZhuBaoMin
 * @date 2024-05-07 14:59
 * @LastEditTime 2024-05-07 14:59
 * @Description
 */
@Slf4j
@Tag(name = "分水房管理", description = "分水房操作")
@RestController
@RequestMapping(path="valve")
@RequiredArgsConstructor
public class ValveCtrl {
    private final RestTemplateUtils restTemplateUtils;
    private CompletableFuture<String> futureValue = new CompletableFuture<>();
    /**
     * 远程开关阀
     * @param po 开关阀传入对象
     * @param bindingResult
     * @return
     */
    @Operation(summary = "远程开关阀", description = "远程开关阀")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "operate", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> open(@RequestBody @Valid DTOValve po, BindingResult bindingResult) throws ExecutionException, InterruptedException {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        String a = null;
        try {
            a = futureValue.get(10, TimeUnit.SECONDS);
        } catch (TimeoutException e) {
            return BaseResponseUtils.buildFail("1分钟后去查看结果");
        }
        futureValue = new CompletableFuture<>();
        Map<String, Object> param = new HashMap<>();
        param.put("controllerType", "01");
        param.put("projectNo", 100);
        param.put("rtuNewAddr", "202405061656120001");
        Map<String, Object> postParams = new HashMap<>();
        postParams.put("id", 2024050616450001L);
        postParams.put("protocol", "p1");
        postParams.put("rtuAddr", "20001");
        postParams.put("type", "outerCommand");
        postParams.put("code", "10");
        postParams.put("noRtMwDealRes", false);
        postParams.put("rtuResultSendWebUrl", "127.0.0.1/remote/");
        postParams.put("param", param);
        Map<String, String> headerParams = new HashMap<>();
        JSONObject job_result = restTemplateUtils.post("http://localhost:8070/accMw/com/send", JSON.toJSONString(postParams), headerParams);
        return BaseResponseUtils.buildSuccess(a) ;
    }
    @GetMapping("/setValue")
    public String setValue(String name) {
        futureValue.complete(name);
        return "Value set";
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/dto/DTOValve.java
New file
@@ -0,0 +1,48 @@
package com.dy.pipIrrRemote.valve.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
/**
 * @author ZhuBaoMin
 * @date 2024-05-07 15:05
 * @LastEditTime 2024-05-07 15:05
 * @Description 远程开阀、远程关阀传入对象
 */
@Data
@Schema(name = "开关阀传入对象")
public class DTOValve {
    public static final long serialVersionUID = 202405071506001L;
    /**
     * 取水口ID
     */
    @Schema(description = "取水口ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "取水口不能为空")
    private Long intakeId;
    /**
     * 虚拟卡ID
     */
    @Schema(description = "虚拟卡ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "虚拟卡不能为空")
    private Long vcId;
    /**
     * 操作类型,1-开阀,2-关阀
     */
    @Schema(description = "操作类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "操作类型不能为空")
    @Range(min = 1, max = 2)
    private Integer operateType;
    /**
     * 操作人
     */
    @Schema(description = "操作人", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "操作人不能为空")
    private Long operator;
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml
@@ -6,7 +6,7 @@
management:
    server:
        port: ${pipIrr.remote.actutorPort}
#web服务端口,tomcat默认是8080
#web服务端口,tomcat默认是8081
server:
    port: ${pipIrr.remote.webPort}
    servlet:
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java
@@ -35,6 +35,4 @@
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java
@@ -42,4 +42,10 @@
        return restTemplate;
    }
    //简单RestTemplate实例
    @Bean
    public RestTemplate simpleRestTemplate() {
        return new RestTemplate();
    }
}