From cf30dd4d7622429b06aa0ffeca4d1eeed4d3749e Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期四, 23 五月 2024 08:53:10 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java | 89 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/result/RemoteResultCode.java | 29 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/DtoBase.java | 28 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java | 4 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateUnitMapper.xml | 160 +++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java | 6 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java | 135 ++ pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java | 108 ++ pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java | 11 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/QueryVo.java | 26 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroupOne.java | 51 + pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java | 51 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateUnit.java | 10 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java | 116 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateUnitMapper.java | 38 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java | 213 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/utils/RestTemplateUtils.java | 97 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnit.java | 52 + pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java | 12 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/CommandResultCtrl.java | 29 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateGroup.java | 84 + pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/ComSupport.java | 143 ++ pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/RestTemplateConfig.java | 21 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnitOne.java | 50 + pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java | 2 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java | 50 + pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/dto/DTOValve.java | 48 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebListenerConfiguration.java | 68 + pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/PipIrrRemoteApplication.java | 2 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml | 199 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/Addr.java | 22 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java | 28 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupUnit.java | 77 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroup.java | 51 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml | 172 +++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java | 27 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmCommandHistory.java | 116 ++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml | 5 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java | 5 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml | 2 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerMapper.java | 7 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupUnitMapper.xml | 91 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml | 2 pipIrr-platform/pipIrr-web/pipIrr-web-remote/pom.xml | 8 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/QueryVo.java | 26 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java | 301 ++++++ pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebFilterConfiguration.java | 51 + 48 files changed, 2,878 insertions(+), 47 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java new file mode 100644 index 0000000..5ec4a32 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java @@ -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); + + //鍒燽y unitId groupId + int deleteByUnitIdGroupId(IrGroupUnit record); + //鍒燽y unitId + int deleteByUnitId(Long unitId); + //鍒燽y groupId + int deleteByGroupId(Long groupId); +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java new file mode 100644 index 0000000..744862d --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java @@ -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); + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰曟暟 + * + * @param params + * @return + */ + Long getRecordCount(Map<?, ?> params); + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰� + * + * @param params + * @return + */ + List<VoGroup> getIrrigateGroups(Map<?, ?> params); +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateUnitMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateUnitMapper.java index 7fc478a..d7cd2b6 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateUnitMapper.java +++ b/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); + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰曟暟 + * + * @param params + * @return + */ + Long getRecordCount(Map<?, ?> params); + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰� + * + * @param params + * @return + */ + List<VoUnit> getUnits(Map<?, ?> params); } diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java index 3d3e0a0..ddfa487 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java @@ -49,7 +49,7 @@ Long getSupperByVillageId(long vaId); /** - * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰曟暟 + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇椤圭洰璁板綍鏁� * * @param params * @return @@ -57,7 +57,7 @@ Long getRecordCount(Map<?, ?> params); /** - * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰� + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇椤圭洰璁板綍 * * @param params * @return diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerMapper.java index f9dbdc5..4c3f20a 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrControllerMapper.java @@ -86,4 +86,11 @@ * @return */ Integer deleteIntakeId(@Param("controllerId") Long controllerId); + + /** + * 鏍规嵁鍙栨按鍙D鑾峰彇闃�鎺у櫒鍦板潃 + * @param intakeId 鍙栨按鍙D + * @return 闃�鎺у櫒鍦板潃 + */ + String getRtuAddrByIntakeId(Long intakeId); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java new file mode 100644 index 0000000..9e104c3 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java @@ -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); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupUnit.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupUnit.java new file mode 100644 index 0000000..766d3db --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupUnit.java @@ -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; + + /** + * 杞亴缁処D + */ + @Schema(description = "杞亴缁処D", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "杞亴缁処D涓嶈兘涓虹┖") + private Long groupId; + + /** + * 鐏屾簤鍗曞厓ID + */ + @Schema(description = "鐏屾簤鍗曞厓ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "鐏屾簤鍗曞厓ID涓嶈兘涓虹┖") + private Long unitId; + + /** + * 鎿嶄綔浜篒D + */ + @Schema(description = "鎿嶄綔浜篒D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鎿嶄綔浜篒D涓嶈兘涓虹┖") + 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; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateGroup.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateGroup.java new file mode 100644 index 0000000..9c098d3 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateGroup.java @@ -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; + + /** + * 鎿嶄綔浜篒D + */ + @Schema(description = "鎿嶄綔浜篒D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鎿嶄綔浜篒D涓嶈兘涓虹┖") + 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; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateUnit.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateUnit.java index 0806184..6f49902 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateUnit.java +++ b/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; /** * 鎿嶄綔浜篒D */ diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmCommandHistory.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmCommandHistory.java new file mode 100644 index 0000000..1baa9a3 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmCommandHistory.java @@ -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; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroup.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroup.java new file mode 100644 index 0000000..506cd9a --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroup.java @@ -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 = "杞亴缁処D") + private String id; + + + @Schema(description = "澶囨敞") + private String remarks; + + @Schema(description = "鎵�灞為」鐩甀d") + public String projectId; + + /** + * 鎿嶄綔浜哄悕瀛� + */ + @Schema(description = "鎿嶄綔浜哄悕瀛�") + private String operatorName; + + @Schema(description = "鎿嶄綔浜篒d") + private String operator; + + /** + * 鎿嶄綔鏃堕棿 + */ + @Schema(description = "鎿嶄綔鏃堕棿") + private Date operateDt; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroupOne.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroupOne.java new file mode 100644 index 0000000..6af70a6 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroupOne.java @@ -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 = "杞亴缁処D") + private String id; + + + @Schema(description = "澶囨敞") + private String remarks; + + @Schema(description = "鎵�灞為」鐩甀d") + public String projectId; + + /** + * 鎿嶄綔浜哄悕瀛� + */ + @Schema(description = "鎿嶄綔浜哄悕瀛�") + private String operatorName; + + @Schema(description = "鎿嶄綔浜篒d") + private String operator; + + /** + * 鎿嶄綔鏃堕棿 + */ + @Schema(description = "鎿嶄綔鏃堕棿") + private Date operateDt; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnit.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnit.java new file mode 100644 index 0000000..a6aaed0 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnit.java @@ -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 = "鎵�灞為」鐩甀d") + public String projectId; + + /** + * 鎿嶄綔浜哄悕瀛� + */ + @Schema(description = "鎿嶄綔浜哄悕瀛�") + private String operatorName; + + @Schema(description = "鎿嶄綔浜篒d") + private String operator; + + /** + * 鎿嶄綔鏃堕棿 + */ + @Schema(description = "鎿嶄綔鏃堕棿") + private Date operateDt; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnitOne.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnitOne.java new file mode 100644 index 0000000..446a101 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoUnitOne.java @@ -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 = "鎵�灞為」鐩甀d") + public String projectId; + + /** + * 鎿嶄綔浜哄悕瀛� + */ + @Schema(description = "鎿嶄綔浜哄悕瀛�") + private String operatorName; + + @Schema(description = "鎿嶄綔浜篒d") + private String operator; + + /** + * 鎿嶄綔鏃堕棿 + */ + @Schema(description = "鎿嶄綔鏃堕棿") + private Date operateDt; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupUnitMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupUnitMapper.xml new file mode 100644 index 0000000..4fa6d92 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupUnitMapper.xml @@ -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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml new file mode 100644 index 0000000..fa78683 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml @@ -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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateUnitMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateUnitMapper.xml index a23be44..0c9c37a 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateUnitMapper.xml +++ b/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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml index 3fbb007..daeda58 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml +++ b/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, diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml index 1c5ffbd..40f061c 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml +++ b/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> + + <!--鏍规嵁鍙栨按鍙D鑾峰彇闃�鎺у櫒鍦板潃--> + <select id="getRtuAddrByIntakeId" resultType="java.lang.String"> + SELECT rtuAddr FROM pr_controller WHERE deleted = 0 AND intakeId = #{intakeId} LIMIT 0,1 + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml new file mode 100644 index 0000000..37c0c6c --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml @@ -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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java new file mode 100644 index 0000000..092c73d --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java @@ -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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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 = "鑾峰彇涓�涓疆鐏岀粍锛圔aseResponse.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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java new file mode 100644 index 0000000..f776ad5 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java @@ -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; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/QueryVo.java new file mode 100644 index 0000000..85437aa --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/QueryVo.java @@ -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; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java index f2b0bf9..2688634 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java +++ b/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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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()); + } + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java index 3ce61e4..620ae40 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java +++ b/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; + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/QueryVo.java new file mode 100644 index 0000000..bba1fb9 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/QueryVo.java @@ -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; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java index 9308c6e..6f46207 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java +++ b/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); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java index 8d4670b..2dec946 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java +++ b/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; } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java index c4bd05d..b5fb236 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java +++ b/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"); } + + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java index 090d07f..32ae257 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java +++ b/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 diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/pom.xml index 1363c26..a41ff4b 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/pom.xml +++ b/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> diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/PipIrrRemoteApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/PipIrrRemoteApplication.java index e5bb6de..54c73f5 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/PipIrrRemoteApplication.java +++ b/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) { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/ComSupport.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/ComSupport.java new file mode 100644 index 0000000..ccba930 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/ComSupport.java @@ -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(); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java new file mode 100644 index 0000000..4ce8d37 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java @@ -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; + + /** + * 鏍规嵁鍙栨按鍙D鑾峰彇闃�鎺у櫒鍦板潃 + * @param intakeId 鍙栨按鍙D + * @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); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/RestTemplateConfig.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/RestTemplateConfig.java new file mode 100644 index 0000000..ede1522 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/RestTemplateConfig.java @@ -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(); + } + +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebFilterConfiguration.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebFilterConfiguration.java new file mode 100644 index 0000000..e0949b3 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebFilterConfiguration.java @@ -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涓嶶serTokenFilter鍙兘涓�涓閰嶇疆涓婏紝 + * 鎵�浠ヤ粬浠殑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; + } + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebListenerConfiguration.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebListenerConfiguration.java new file mode 100644 index 0000000..3c04122 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/config/WebListenerConfiguration.java @@ -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 ; + + /* + * 瑙f瀽鍚勭***.config閰嶇疆鐨凜onfigListener锛屾殏鏃朵笉閲囩敤姝ょ閰嶇疆鏂瑰紡 + * + @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; +// } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/result/RemoteResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/result/RemoteResultCode.java new file mode 100644 index 0000000..b6ccda8 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/result/RemoteResultCode.java @@ -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; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/CommandResultCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/CommandResultCtrl.java new file mode 100644 index 0000000..4e605a7 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/CommandResultCtrl.java @@ -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"); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java new file mode 100644 index 0000000..32f9a91 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java @@ -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(); + + // 鍙栨按鍙D鎹㈤榾鎺у櫒鍦板潃 + 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(); + + // 鍙栨按鍙D鎹㈤榾鎺у櫒鍦板潃 + 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); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/Addr.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/Addr.java new file mode 100644 index 0000000..561d13a --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/Addr.java @@ -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; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/DtoBase.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/DtoBase.java new file mode 100644 index 0000000..6f05d1f --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/dto/DtoBase.java @@ -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; + + /** + * 鍙栨按鍙D + */ + @NotNull(message = "鍙栨按鍙d笉鑳戒负绌�") + private Long intakeId; + + /** + * 鎿嶄綔浜� + */ + @NotNull(message = "鎿嶄綔浜轰笉鑳戒负绌�") + private Long operator; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/utils/RestTemplateUtils.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/utils/RestTemplateUtils.java new file mode 100644 index 0000000..31deb69 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/utils/RestTemplateUtils.java @@ -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; + } + +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java new file mode 100644 index 0000000..e986f2e --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java @@ -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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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"; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/dto/DTOValve.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/dto/DTOValve.java new file mode 100644 index 0000000..0f4f645 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/dto/DTOValve.java @@ -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; + + /** + * 鍙栨按鍙D + */ + @Schema(description = "鍙栨按鍙D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍙栨按鍙d笉鑳戒负绌�") + private Long intakeId; + + /** + * 铏氭嫙鍗D + */ + @Schema(description = "铏氭嫙鍗D", 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; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml index 9627a3d..a3e69d7 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml @@ -6,7 +6,7 @@ management: server: port: ${pipIrr.remote.actutorPort} -#web鏈嶅姟绔彛锛宼omcat榛樿鏄�8080 +#web鏈嶅姟绔彛锛宼omcat榛樿鏄�8081 server: port: ${pipIrr.remote.webPort} servlet: diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java index 45e2f21..ab6a5cc 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java @@ -35,6 +35,4 @@ } - - } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java index cb8956b..58cefe3 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java @@ -42,4 +42,10 @@ return restTemplate; } + + //绠�鍗昍estTemplate瀹炰緥 + @Bean + public RestTemplate simpleRestTemplate() { + return new RestTemplate(); + } } \ No newline at end of file -- Gitblit v1.8.0