From 802fc74478ae3f2c4e8ab7cd417f97469c84f157 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期二, 25 三月 2025 21:31:03 +0800 Subject: [PATCH] 轮灌功能 --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java | 42 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectGroupMapper.java | 28 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java | 4 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationCtrl.java | 36 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java | 9 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml | 133 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroupSimple.java | 15 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrPlanScheduleMapper.xml | 91 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/dto/Param.java | 7 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoIrrigateSchedule.java | 21 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/dto/DtoBase.java | 3 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java | 14 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrPlanSchedule.java | 51 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoProjectSimple.java | 35 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java | 7 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoGroup.java | 26 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml | 445 ++++--- pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectGroupMapper.xml | 91 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java | 37 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupIntakeMapper.xml | 88 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml | 533 +++++--- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrCropMapper.java | 3 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupIntakeMapper.java | 36 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java | 36 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml | 77 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java | 23 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoPlanSimple.java | 35 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java | 214 +- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java | 14 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProject.java | 100 - pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigateSchedule.java | 7 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupIntake.java | 47 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java | 211 +++ pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/dto/AutomaticClose.java | 5 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java | 207 ++- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateGroup.java | 67 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/crop/CropCtrl.java | 3 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigatePlan.java | 7 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java | 20 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrPlanScheduleMapper.java | 27 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateGroupMapper.java | 36 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIntakeOperate.java | 69 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java | 1 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoProject.java | 17 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java | 119 + pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java | 56 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml | 24 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java | 1 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml | 213 +- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateSchedule.java | 12 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProjectGroup.java | 52 51 files changed, 2,356 insertions(+), 1,099 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java index 2afc76d..d73733d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java @@ -12,6 +12,7 @@ import com.dy.pipIrrGlobal.command.enums.LastOperateENUM; import com.dy.pipIrrGlobal.command.result.CommandResultCode; import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper; +import com.dy.pipIrrGlobal.daoIr.IrIntakeOperateMapper; import com.dy.pipIrrGlobal.daoPr.PrCommonIntakesMapper; import com.dy.pipIrrGlobal.daoPr.PrControllerMapper; import com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper; @@ -34,7 +35,10 @@ import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -83,6 +87,9 @@ @Autowired private PrCommonIntakesMapper prCommonIntakesMapper; + + @Autowired + private IrIntakeOperateMapper irIntakeOperateMapper; public static ComSupport comSupport; @@ -279,6 +286,7 @@ Object param = po.getParam(); String rtuResultSendWebUrl = po.getRtuResultSendWebUrl(); Long operator = po.getOperator(); + Byte openType = po.getOpenType(); // 鏋勯�犲懡浠� Command com = command(comId, commandCode, rtuAddr, protocol, rtuResultSendWebUrl, param); @@ -306,6 +314,7 @@ rmCommandHistory.setResult((byte) 0); rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); //return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString()); + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, response_CallBack.getMsg()); return BaseResponseUtils.buildErrorMsg(response_CallBack.getMsg()); } @@ -321,6 +330,7 @@ rmCommandHistory.setComId(comId); rmCommandHistory.setResult((byte) 0); rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, "鍥炶皟瓒呮椂"); return BaseResponseUtils.buildErrorMsg(CommandResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage()); } @@ -359,6 +369,10 @@ rmCommandHistory.setResult((byte) 0); rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); + if(openType == 1 ) { + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, "寮�闃�澶辫触"); + } + // 寮�闃�澶辫触鍒欒В闄ゅ崰鐢紝鍏抽榾澶辫触鍒欏崰鐢� if (comType != null) { SeVirtualCard virtualCard = new SeVirtualCard(); @@ -387,6 +401,10 @@ rmCommandHistory.setResult((byte) 1); rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); + if(openType == 1) { + irIntakeOperateMapper.updateByCommandId(comId, (byte)1, null); + } + // 寮�闃�鎴愬姛鍒欏崰鐢紝鍏抽榾鎴愬姛涓嶅崰鐢� if (comType != null) { SeVirtualCard virtualCard = new SeVirtualCard(); diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/dto/Param.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/dto/Param.java index 9d5bcc7..5bf01bd 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/dto/Param.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/dto/Param.java @@ -16,7 +16,7 @@ private Long comId; /** - * 鍛戒护绫诲瀷锛�1-寮�鍙戯紝2-鍏抽榾 + * 鍛戒护绫诲瀷锛�1-寮�闃�锛�2-鍏抽榾 */ private Byte comType; @@ -41,4 +41,9 @@ private Long operator; + /** + * 寮�闃�绫诲瀷锛�1-杞亴 + */ + private Byte openType; + } diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrCropMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrCropMapper.java index 04f654c..9e75b19 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrCropMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrCropMapper.java @@ -2,11 +2,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoIr.IrCrop; -import com.dy.pipIrrGlobal.pojoIr.IrProject; import com.dy.pipIrrGlobal.voIr.VoCrop; import com.dy.pipIrrGlobal.voIr.VoCropOne; -import com.dy.pipIrrGlobal.voIr.VoProject; -import com.dy.pipIrrGlobal.voIr.VoProjectOne; import org.apache.ibatis.annotations.Mapper; import java.util.List; diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java index 5682430..88c1208 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java @@ -29,19 +29,5 @@ int updateByPrimaryKey(IrGroupClient record); - /** - * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勬暟閲� - * @param params - * @return - */ - Long getGroupCountByClientId(Map<?, ?> params); - - /** - * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛� - * @param params - * @return - */ - List<VoGroupSimple> getGroupsByClientId(Map<?, ?> params); - } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupIntakeMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupIntakeMapper.java new file mode 100644 index 0000000..319236e --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupIntakeMapper.java @@ -0,0 +1,36 @@ +package com.dy.pipIrrGlobal.daoIr; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoIr.IrGroupIntake; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @author ZhuBaoMin + * @date 2025-03-18 11:45 + * @LastEditTime 2025-03-18 11:45 + * @Description 杞亴缁勫彇姘村彛鍏宠仈瀹炰綋绫� + */ + +@Mapper +public interface IrGroupIntakeMapper extends BaseMapper<IrGroupIntake> { + int deleteByPrimaryKey(Long id); + + int insert(IrGroupIntake record); + + int insertSelective(IrGroupIntake record); + + IrGroupIntake selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(IrGroupIntake record); + + int updateByPrimaryKey(IrGroupIntake record); + + /** + * 鏍规嵁缁処D鑾峰彇鍙栨按鍙D闆嗗悎 + * @param groupId + * @return + */ + List<Long> getIntakeIdsByGroupId(Long groupId); +} \ No newline at end of file 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 index f5199fd..d713100 100644 --- 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 @@ -2,7 +2,6 @@ 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; import java.util.List; diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java new file mode 100644 index 0000000..2241e34 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java @@ -0,0 +1,36 @@ +package com.dy.pipIrrGlobal.daoIr; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoIr.IrIntakeOperate; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @author ZhuBaoMin + * @date 2025-03-25 20:41 + * @LastEditTime 2025-03-25 20:41 + * @Description + */ + +@Mapper +public interface IrIntakeOperateMapper extends BaseMapper<IrIntakeOperate> { + int deleteByPrimaryKey(Long id); + + int insert(IrIntakeOperate record); + + int insertSelective(IrIntakeOperate record); + + IrIntakeOperate selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(IrIntakeOperate record); + + int updateByPrimaryKey(IrIntakeOperate record); + + /** + * 鏍规嵁鍛戒护ID鏇存柊鍙栨按鍙f搷浣滆褰� + * @param commandId + * @param commandResult + * @return + */ + int updateByCommandId(@Param("commandId") Long commandId, @Param("commandResult") Byte commandResult, @Param("failureFactors") String failureFactors); +} \ No newline at end of file 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 index af2b58a..eaa0a00 100644 --- 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 @@ -4,27 +4,34 @@ import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup; import com.dy.pipIrrGlobal.voIr.VoGroup; import com.dy.pipIrrGlobal.voIr.VoGroupOne; +import com.dy.pipIrrGlobal.voIr.VoGroupSimple; 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 + * @author ZhuBaoMin + * @date 2025-03-18 11:21 + * @LastEditTime 2025-03-18 11:21 * @Description */ + @Mapper public interface IrIrrigateGroupMapper extends BaseMapper<IrIrrigateGroup> { - //澧� + int deleteByPrimaryKey(Long id); + + int insert(IrIrrigateGroup record); + int insertSelective(IrIrrigateGroup record); - //鍒� - int deleteLogicById(Long id); + IrIrrigateGroup selectByPrimaryKey(Long id); - //鏀� int updateByPrimaryKeySelective(IrIrrigateGroup record); + + int updateByPrimaryKey(IrIrrigateGroup record); + + int deleteLogicById(Long id); //鏌ヤ竴涓� VoGroupOne selectById(Long id); @@ -46,9 +53,16 @@ List<VoGroup> getIrrigateGroups(Map<?, ?> params); /** - * 鏍规嵁杞亴缁勭紪鍙疯幏鍙栧彇姘村彛鍒楄〃 - * @param groupId + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇杞亴缁勮褰曟暟 + * @param params * @return */ - List<Long> getIntakesByGroupId(Long groupId); -} + Long getSimpleGroupCount(Map<?, ?> params); + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇杞亴缁勫垪琛� + * @param params + * @return + */ + List<VoGroupSimple> getSimpleGroups(Map<?, ?> params); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java index ab4c01e..4d0e363 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java @@ -2,11 +2,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan; -import com.dy.pipIrrGlobal.voIr.VoIrrigatePlan; +import com.dy.pipIrrGlobal.voIr.VoPlanSimple; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; -import java.util.List; -import java.util.Map; +import java.util.Date; /** * @author ZhuBaoMin @@ -37,30 +37,29 @@ Byte getStartupMode(Long planId); /** - * 鏍规嵁鎸囧畾鐨勮鍒扞D鑾峰彇宸插彂甯冪殑鐏屾簤璁″垝鏁伴噺 - * @param planId - * @return - */ - Integer getPublishedCount(Long planId); - - /** - * 鍙戝竷鎸囧畾鐨勭亴婧夎鍒� - * @param planId - * @return - */ - int publishIrrigatePlan(Long planId); - - /** * 鏍规嵁鎸囧畾鐨勬潯浠惰幏鍙栬鍒掓暟閲� * @param params * @return */ - Long getIrrigatePlanCount(Map<?, ?> params); + //Long getIrrigatePlanCount(Map<?, ?> params); /** * 鏍规嵁鎸囧畾鐨勬潯浠惰幏鍙栬鍒掑垪琛� * @param params * @return */ - List<VoIrrigatePlan> getIrrigatePlans(Map<?, ?> params); + //List<VoIrrigatePlan> getIrrigatePlans(Map<?, ?> params); + + /** + * 鏍规嵁璁″垝ID鑾峰彇璁″垝绠�鍗曚俊鎭� + * @return + */ + VoPlanSimple getPlanSimple(Long planId); + + /** + * 鏍规嵁璁″垝ID鏇存柊璁″垝淇℃伅锛堣捣姝㈡椂闂淬�佽鍒掔姸鎬侊級 + * @param planId + * @return + */ + Integer updatePlanTimes(@Param("planStartTime") Date planStartTime, @Param("planStopTime") Date planEndTime, @Param("planId") Long planId); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java index e92aae7..3c5e6e5 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java @@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; /** @@ -30,9 +31,18 @@ int updateByPrimaryKey(IrIrrigateSchedule record); /** - * 鏍规嵁璁″垝ID鑾峰彇鐏屾簤娆″簭 + * 鏍规嵁璁″垝ID鑾峰彇鐏屾簤娆″簭璁板綍 * @param planId * @return */ - List<VoIrrigateSchedule> getIrrigateSchedules(@Param("startupMode") Byte startupMode, @Param("planId") Long planId); + List<VoIrrigateSchedule> getSchedulesByPlanId(Long planId); + + /** + * 鏍规嵁鐏屾簤娆″簭ID鏇存柊娆″簭寮�濮嬫椂闂� + * @param scheduleId + * @param startTime + * @return + */ + Integer updateScheduleStartTime(@Param("scheduleId") Long scheduleId, @Param("startTime") Date startTime); + } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java index c097651..ea83eac 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java @@ -24,4 +24,5 @@ int updateByPrimaryKeySelective(IrOpeningSchedule record); int updateByPrimaryKey(IrOpeningSchedule record); + } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrPlanScheduleMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrPlanScheduleMapper.java new file mode 100644 index 0000000..28a8648 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrPlanScheduleMapper.java @@ -0,0 +1,27 @@ +package com.dy.pipIrrGlobal.daoIr; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoIr.IrPlanSchedule; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ZhuBaoMin + * @date 2025-03-20 15:03 + * @LastEditTime 2025-03-20 15:03 + * @Description + */ + +@Mapper +public interface IrPlanScheduleMapper extends BaseMapper<IrPlanSchedule> { + int deleteByPrimaryKey(Long id); + + int insert(IrPlanSchedule record); + + int insertSelective(IrPlanSchedule record); + + IrPlanSchedule selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(IrPlanSchedule record); + + int updateByPrimaryKey(IrPlanSchedule record); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectGroupMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectGroupMapper.java new file mode 100644 index 0000000..adfa010 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectGroupMapper.java @@ -0,0 +1,28 @@ +package com.dy.pipIrrGlobal.daoIr; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoIr.IrProjectGroup; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ZhuBaoMin + * @date 2025-03-18 11:36 + * @LastEditTime 2025-03-18 11:36 + * @Description + */ + +@Mapper +public interface IrProjectGroupMapper extends BaseMapper<IrProjectGroup> { + int deleteByPrimaryKey(Long id); + + int insert(IrProjectGroup record); + + int insertSelective(IrProjectGroup record); + + IrProjectGroup selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(IrProjectGroup record); + + int updateByPrimaryKey(IrProjectGroup record); + +} \ No newline at end of file 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 ddfa487..9b0380b 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 @@ -2,36 +2,38 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoIr.IrProject; -import com.dy.pipIrrGlobal.pojoPr.PrController; -import com.dy.pipIrrGlobal.pojoPr.PrIntake; import com.dy.pipIrrGlobal.voIr.VoProject; import com.dy.pipIrrGlobal.voIr.VoProjectOne; -import com.dy.pipIrrGlobal.voPr.VoIntake; +import com.dy.pipIrrGlobal.voIr.VoProjectSimple; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; /** - * @author :WuZeYu - * @Date :2024/5/14 15:04 - * @LastEditTime :2024/5/14 15:04 + * @author ZhuBaoMin + * @date 2025-03-18 10:57 + * @LastEditTime 2025-03-18 10:57 * @Description */ + @Mapper public interface IrProjectMapper extends BaseMapper<IrProject> { - //澧� + int deleteByPrimaryKey(Long id); + + int insert(IrProject record); + int insertSelective(IrProject record); - //鍒� - int deleteLogicById(Long id); + IrProject selectByPrimaryKey(Long id); - //鏀� int updateByPrimaryKeySelective(IrProject record); - //鏌ヤ竴涓� + int updateByPrimaryKey(IrProject record); + VoProjectOne selectById(Long id); + + int deleteLogicById(Long id); /** * 淇敼椤圭洰鐘舵�� @@ -63,4 +65,18 @@ * @return */ List<VoProject> getProjects(Map<?, ?> params); -} + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇椤圭洰璁板綍(绮剧畝)鏁伴噺 + * @param params + * @return + */ + Long getSimpleProjectsCount(Map<?, ?> params); + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇椤圭洰璁板綍(绮剧畝) + * @param params + * @return + */ + List<VoProjectSimple> getSimpleProjects(Map<?, ?> params); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupIntake.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupIntake.java new file mode 100644 index 0000000..c3ad034 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupIntake.java @@ -0,0 +1,47 @@ +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 jakarta.validation.constraints.NotNull; +import lombok.*; + +/** + * @author ZhuBaoMin + * @date 2025-03-18 11:45 + * @LastEditTime 2025-03-18 11:45 + * @Description 杞亴缁勫彇姘村彛鍏宠仈瀹炰綋绫� + */ + +@TableName(value="ir_group_intake", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class IrGroupIntake implements BaseEntity { + public static final long serialVersionUID = 202503181149001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + private Long id; + + /** + * 杞亴缁処D + */ + @NotNull(message = "杞亴缁処D涓嶈兘涓虹┖") + private Long groupId; + + /** + * 鍙栨按鍙D + */ + @NotNull(message = "鍙栨按鍙D涓嶈兘涓虹┖") + private Long intakeId; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIntakeOperate.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIntakeOperate.java new file mode 100644 index 0000000..d3d39a0 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIntakeOperate.java @@ -0,0 +1,69 @@ +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 jakarta.validation.constraints.NotNull; +import lombok.*; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2025-03-24 20:53 + * @LastEditTime 2025-03-24 20:53 + * @Description 鍙栨按鍙f搷浣滃疄浣撶被 + */ + +@TableName(value="ir_intake_operate", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class IrIntakeOperate implements BaseEntity { + public static final long serialVersionUID = 202503242057001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + private Long id; + + /** + * 鍛戒护ID + */ + @NotNull(message = "鍛戒护ID涓嶈兘涓虹┖") + private Long commandId; + + /** + * 鍙栨按鍙D + */ + @NotNull(message = "鍙栨按鍙D涓嶈兘涓虹┖") + private Long intakeId; + + /** + * 鐏屾簤寮�濮嬫椂闂� + */ + private Date startTime; + + /** + * 鐏屾簤鏃堕暱 + */ + private Integer duration; + + /** + * 鍛戒护涓嬪彂缁撴灉;1-鎴愬姛锛�2-澶辫触 + */ + private Byte commandResult; + + /** + * 澶辫触鍥犵礌 + */ + private String failureFactors; + +} \ No newline at end of file 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 index 9c098d3..c202e78 100644 --- 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 @@ -6,21 +6,17 @@ 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 com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.validation.constraints.NotBlank; 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 - */ -/** - * 杞亴缁勮〃 + * @author ZhuBaoMin + * @date 2025-03-18 11:21 + * @LastEditTime 2025-03-18 11:21 + * @Description 杞亴缁勫疄浣撶被 */ @TableName(value="ir_irrigate_group", autoResultMap = true) @@ -29,56 +25,45 @@ @ToString @NoArgsConstructor @AllArgsConstructor -@Schema(name = "杞亴缁勫疄浣�") public class IrIrrigateGroup implements BaseEntity { - - public static final long serialVersionUID = 202405211534001L; + public static final long serialVersionUID = 202503181126001L; /** - * 涓婚敭 - */ + * 涓婚敭 + */ @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 = "杞亴缁勭紪鐮佷笉鑳戒负绌�") + * 杞亴缁勫悕绉� + */ + @NotBlank(message = "杞亴缁勫悕绉颁笉鑳戒负绌�") private String groupCode; /** - * 椤圭洰ID - */ - @Schema(description = "椤圭洰ID", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "椤圭洰ID涓嶈兘涓虹┖") - private Long projectId; + * 榛樿鐏屾簤鏃堕暱;绮剧‘鍒板垎閽� + */ + private Integer defaultDuration; /** - * 澶囨敞 - */ - @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; - + * 鎿嶄綔鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date operateTime; /** - * 閫昏緫鍒犻櫎鏍囪瘑;0-鏈垹闄わ紝1-鍒犻櫎 - */ - @Schema(description = "鍒犻櫎鏍囪瘑", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + * 閫昏緫鍒犻櫎鏍囪瘑;0-鏈垹闄わ紝1-鍒犻櫎 + */ private Byte deleted; -} +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigatePlan.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigatePlan.java index 90c7951..ea5f063 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigatePlan.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigatePlan.java @@ -8,7 +8,6 @@ import com.dy.common.po.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; import lombok.*; import java.util.Date; @@ -37,11 +36,6 @@ private Long id; /** - * 椤圭洰ID - */ - private Long projectId; - - /** * 璁″垝鍚嶇О */ @NotBlank(message = "璁″垝鍚嶇О涓嶈兘涓虹┖") @@ -50,7 +44,6 @@ /** * 璁″垝鍚姩妯″紡;1-鎵嬪姩鍚姩锛�2-鑷姩鍚姩 */ - @NotNull(message = "璁″垝鍚姩妯″紡涓嶈兘涓虹┖") private Byte startupMode; /** diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateSchedule.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateSchedule.java index 65b50d0..8047670 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateSchedule.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIrrigateSchedule.java @@ -38,8 +38,8 @@ /** * 鐏屾簤璁″垝ID */ - @NotNull(message = "鐏屾簤璁″垝ID涓嶈兘涓虹┖") - private Long planId; + //@NotNull(message = "鐏屾簤璁″垝ID涓嶈兘涓虹┖") + //private Long planId; /** * 杞亴缁処D @@ -53,11 +53,13 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; + + /** * 鐏屾簤缁撴潫鏃堕棿 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date stopTime; + //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + //private Date stopTime; /** * 鐏屾簤鏃堕暱;鍒嗛挓 @@ -67,7 +69,7 @@ /** * 鍙栨按鍙D鍒楄〃 */ - private String intakeIds; + //private String intakeIds; /** * 褰撳墠鐘舵��;1-姝e父锛�2-鏆傚仠锛�3-缁堟 diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrPlanSchedule.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrPlanSchedule.java new file mode 100644 index 0000000..7ff69c2 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrPlanSchedule.java @@ -0,0 +1,51 @@ +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 jakarta.validation.constraints.NotNull; +import lombok.*; + +/** + * @author ZhuBaoMin + * @date 2025-03-20 15:03 + * @LastEditTime 2025-03-20 15:03 + * @Description 璁″垝娆″簭鍏宠仈瀹炰綋绫� + */ + +@TableName(value="ir_plan_schedule", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class IrPlanSchedule implements BaseEntity { + public static final long serialVersionUID = 202503201521001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + private Long id; + + /** + * 鐏屾簤璁″垝ID + */ + @NotNull(message = "鐏屾簤璁″垝ID涓嶈兘涓虹┖") + private Long planId; + + /** + * 鐏屾簤娆″簭ID + */ + @NotNull(message = "鐏屾簤娆″簭ID涓嶈兘涓虹┖") + private Long scheduleId; + + /** + * 鎺掑簭 + */ + private Integer sort; +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProject.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProject.java index b6e9ae6..43bf84f 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProject.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProject.java @@ -6,23 +6,17 @@ 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 com.fasterxml.jackson.annotation.JsonFormat; import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; import lombok.*; -import org.hibernate.validator.constraints.Length; import java.util.Date; /** - * @author :WuZeYu - * @Date :2024/5/14 13:53 - * @LastEditTime :2024/5/14 13:53 - * @Description - */ - -/** - * 椤圭洰琛� + * @author ZhuBaoMin + * @date 2025-03-18 10:57 + * @LastEditTime 2025-03-18 10:57 + * @Description 椤圭洰瀹炰綋绫� */ @TableName(value="ir_project", autoResultMap = true) @@ -31,81 +25,71 @@ @ToString @NoArgsConstructor @AllArgsConstructor -@Schema(name = "椤圭洰瀹炰綋") public class IrProject implements BaseEntity { - public static final long serialVersionUID = 202405141427001L; + public static final long serialVersionUID = 202503181103001L; /** - * 涓婚敭 - */ + * 涓婚敭 + */ @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 = "椤圭洰鍚嶇О涓嶈兘涓虹┖") - @Length(message = "椤圭洰鍚嶇О涓嶅ぇ浜巤max}瀛�",max = 50) private String projectName; /** - * 鐪両D - */ - @Schema(description = "鐪両D", requiredMode = Schema.RequiredMode.REQUIRED) + * 鐪両D + */ private Long provinceId; + /** - * 甯侷D - */ - @Schema(description = "甯侷D", requiredMode = Schema.RequiredMode.REQUIRED) + * 甯侷D + */ private Long cityId; + /** - * 鍘縄D - */ - @Schema(description = "鍘縄D", requiredMode = Schema.RequiredMode.REQUIRED) + * 鍘縄D + */ private Long countyId; + /** - * 闀嘔D - */ - @Schema(description = "闀嘔D", requiredMode = Schema.RequiredMode.REQUIRED) + * 闀嘔D + */ private Long townId; + /** - * 鏉慖D - */ - @Schema(description = "鏉慖D", requiredMode = Schema.RequiredMode.REQUIRED) + * 鏉慖D + */ private Long villageId; - - /** - * 椤圭洰鐘舵��;1-鍚姩锛�2-鍋滄 - */ - @Schema(description = "椤圭洰鐘舵��", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + * 椤圭洰鐘舵��;1-鍚敤锛�2-搴熷純 + */ private Byte projectState; /** - * 鎿嶄綔浜篒D - */ - @Schema(description = "鎿嶄綔浜篒D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - private Long operator; - - /** - * 鎿嶄綔鏃堕棿 - */ - @Schema(description = "鎿嶄綔鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - private Date operateDt; - - /** - * 澶囨敞 - */ - @Schema(description = "澶囨敞", requiredMode = Schema.RequiredMode.REQUIRED) + * 澶囨敞淇℃伅 + */ private String remarks; /** - * 閫昏緫鍒犻櫎鏍囪瘑;0-鏈垹闄わ紝1-鍒犻櫎 - */ - @Schema(description = "鍒犻櫎鏍囪瘑", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + * 鎿嶄綔浜� + */ + private Long operator; + + /** + * 鎿嶄綔鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date operateTime; + + /** + * 閫昏緫鍒犻櫎鏍囪瘑;0-鏈垹闄わ紝1-鍒犻櫎 + */ private Byte deleted; + } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProjectGroup.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProjectGroup.java new file mode 100644 index 0000000..6d555ec --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProjectGroup.java @@ -0,0 +1,52 @@ +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 jakarta.validation.constraints.NotNull; +import lombok.*; + +/** + * @author ZhuBaoMin + * @date 2025-03-18 11:36 + * @LastEditTime 2025-03-18 11:36 + * @Description 椤圭洰杞亴缁勫叧鑱斿疄浣撶被 + */ + +@TableName(value="ir_project_group", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class IrProjectGroup implements BaseEntity { + public static final long serialVersionUID = 202503181139001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + private Long id; + + /** + * 椤圭洰ID + */ + @NotNull(message = "椤圭洰ID涓嶈兘涓虹┖") + private Long projectId; + + /** + * 杞亴缁処D + */ + @NotNull(message = "杞亴缁処D涓嶈兘涓虹┖") + private Long groupId; + + /** + * 鎺掑簭 + */ + private Integer sort; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroupSimple.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroupSimple.java index c643c0b..19a1c83 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroupSimple.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoGroupSimple.java @@ -28,4 +28,19 @@ * 杞亴缁勭紪鐮� */ private String groupCode; + + /** + * 鐏屾簤鍗曞厓鏁伴噺 + */ + private Integer intakeCount; + + /** + * 榛樿鐏屾簤鏃堕暱 + */ + private Integer defaultDuration; + + /** + * 鎺掑簭 + */ + private Integer sort; } diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoIrrigateSchedule.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoIrrigateSchedule.java index 9cd54f5..a416d54 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoIrrigateSchedule.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoIrrigateSchedule.java @@ -1,9 +1,5 @@ package com.dy.pipIrrGlobal.voIr; -import com.alibaba.fastjson2.annotation.JSONField; -import com.alibaba.fastjson2.writer.ObjectWriterImplToString; -import com.dy.common.po.BaseEntity; -import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import lombok.Data; @@ -13,24 +9,27 @@ * @author ZhuBaoMin * @date 2025-02-21 14:21 * @LastEditTime 2025-02-21 14:21 - * @Description 鐏屾簤娆″簭瑙嗗浘瀵硅薄 + * @Description 鐏屾簤娆″簭瑙嗗浘瀵硅薄锛岀敓鎴愬紑闃�璁″垝浣跨敤锛屼笉浼犵粰鍓嶇 */ @Data -@JsonPropertyOrder({ "id", "vcNum", "money", "inUse", "isAlarmValue"}) -public class VoIrrigateSchedule implements BaseEntity { +@JsonPropertyOrder({ "scheduleId", "groupId", "startTime", "duration"}) +public class VoIrrigateSchedule { private static final long serialVersionUID = 202502211423001L; /** * 鐏屾簤娆″簭ID */ - @JSONField(serializeUsing= ObjectWriterImplToString.class) private Long scheduleId; + + /** + * 杞亴缁処D + */ + private Long groupId; /** * 鐏屾簤寮�濮嬫椂闂� */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; /** @@ -38,8 +37,4 @@ */ private Integer duration; - /** - * 鍙栨按鍙D锛屽涓敤閫楀彿闅斿紑 - */ - private String intakeIds; } diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoPlanSimple.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoPlanSimple.java new file mode 100644 index 0000000..d69cd7b --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoPlanSimple.java @@ -0,0 +1,35 @@ +package com.dy.pipIrrGlobal.voIr; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.Data; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2025-03-25 17:16 + * @LastEditTime 2025-03-25 17:16 + * @Description 鐏屾簤璁″垝绠�鍗曚俊鎭鍥惧璞★紝鍙戝竷鏃舵洿鏂拌鍒掕捣姝㈡椂闂翠娇鐢� + */ + +@Data +@JsonPropertyOrder({"startupMode", "planStartTime", "duration"}) +public class VoPlanSimple { + public static final long serialVersionUID = 202503251718001L; + + /** + * 璁″垝鍚姩妯″潡 + */ + private Byte startupMode; + + /** + * 璁″垝鍚姩鏃堕棿锛岃嚜鍔ㄥ惎鍔ㄦ椂鏈夊�� + */ + private Date planStartTime; + + /** + * 鐏屾簤鎬绘椂闀� + */ + private Integer duration; + +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoProjectSimple.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoProjectSimple.java new file mode 100644 index 0000000..f211365 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoProjectSimple.java @@ -0,0 +1,35 @@ +package com.dy.pipIrrGlobal.voIr; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2025-03-20 19:17 + * @LastEditTime 2025-03-20 19:17 + * @Description 椤圭洰绠�鍗曡鍥惧璞� + */ + +@Data +@JsonPropertyOrder({"projectId", "projectName", "groupCount"}) +public class VoProjectSimple { + public static final long serialVersionUID = 202503201919001L; + + /** + * 椤圭洰ID + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + private Long projectId; + + /** + * 椤圭洰鍚嶇О + */ + private String projectName; + + /** + * 杞亴缁勬暟閲� + */ + private Integer groupCount; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml index 992f079..e4053cd 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml @@ -105,28 +105,4 @@ where id = #{id,jdbcType=BIGINT} </update> - <!--鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勬暟閲�--> - <select id="getGroupCountByClientId" resultType="java.lang.Long"> - SELECT - count(*) - FROM ir_irrigate_group grp - INNER JOIN ir_group_client gc ON gc.group_id = grp.id - WHERE grp.deleted = 0 AND gc.client_id = #{clientId} - </select> - - <!--鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛�--> - <select id="getGroupsByClientId" resultType="com.dy.pipIrrGlobal.voIr.VoGroupSimple"> - SELECT - grp.id AS groupId, - grp.group_code AS groupCode - FROM ir_irrigate_group grp - INNER JOIN ir_group_client gc ON gc.group_id = grp.id - WHERE grp.deleted = 0 AND gc.client_id = #{clientId} - ORDER BY grp.group_code - <trim prefix="limit "> - <if test="start != null and count != null"> - #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} - </if> - </trim> - </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupIntakeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupIntakeMapper.xml new file mode 100644 index 0000000..57000ab --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupIntakeMapper.xml @@ -0,0 +1,88 @@ +<?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.IrGroupIntakeMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrGroupIntake"> + <!--@mbg.generated--> + <!--@Table ir_group_intake--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="group_id" jdbcType="BIGINT" property="groupId" /> + <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, group_id, intake_id + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ir_group_intake + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ir_group_intake + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupIntake"> + <!--@mbg.generated--> + insert into ir_group_intake (id, group_id, intake_id + ) + values (#{id,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT} + ) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupIntake"> + <!--@mbg.generated--> + insert into ir_group_intake + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="groupId != null"> + group_id, + </if> + <if test="intakeId != null"> + intake_id, + </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="intakeId != null"> + #{intakeId,jdbcType=BIGINT}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupIntake"> + <!--@mbg.generated--> + update ir_group_intake + <set> + <if test="groupId != null"> + group_id = #{groupId,jdbcType=BIGINT}, + </if> + <if test="intakeId != null"> + intake_id = #{intakeId,jdbcType=BIGINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupIntake"> + <!--@mbg.generated--> + update ir_group_intake + set group_id = #{groupId,jdbcType=BIGINT}, + intake_id = #{intakeId,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} + </update> + + <!--鏍规嵁缁処D鑾峰彇鍙栨按鍙D闆嗗悎--> + <select id="getIntakeIdsByGroupId" resultType="java.lang.Long"> + SELECT + intake_id AS intakeId + FROM ir_group_intake + WHERE group_id = #{groupId} + </select> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml new file mode 100644 index 0000000..a578e97 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml @@ -0,0 +1,133 @@ +<?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.IrIntakeOperateMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrIntakeOperate"> + <!--@mbg.generated--> + <!--@Table ir_intake_operate--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="command_id" jdbcType="BIGINT" property="commandId" /> + <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> + <result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> + <result column="duration" jdbcType="INTEGER" property="duration" /> + <result column="command_result" jdbcType="TINYINT" property="commandResult" /> + <result column="failure_factors" jdbcType="VARCHAR" property="failureFactors" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, command_id, intake_id, start_time, duration, command_result, failure_factors + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ir_intake_operate + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ir_intake_operate + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIntakeOperate"> + <!--@mbg.generated--> + insert into ir_intake_operate (id, command_id, intake_id, + start_time, duration, command_result, + failure_factors) + values (#{id,jdbcType=BIGINT}, #{commandId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, + #{startTime,jdbcType=TIMESTAMP}, #{duration,jdbcType=INTEGER}, #{commandResult,jdbcType=TINYINT}, + #{failureFactors,jdbcType=VARCHAR}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIntakeOperate"> + <!--@mbg.generated--> + insert into ir_intake_operate + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="commandId != null"> + command_id, + </if> + <if test="intakeId != null"> + intake_id, + </if> + <if test="startTime != null"> + start_time, + </if> + <if test="duration != null"> + duration, + </if> + <if test="commandResult != null"> + command_result, + </if> + <if test="failureFactors != null"> + failure_factors, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="commandId != null"> + #{commandId,jdbcType=BIGINT}, + </if> + <if test="intakeId != null"> + #{intakeId,jdbcType=BIGINT}, + </if> + <if test="startTime != null"> + #{startTime,jdbcType=TIMESTAMP}, + </if> + <if test="duration != null"> + #{duration,jdbcType=INTEGER}, + </if> + <if test="commandResult != null"> + #{commandResult,jdbcType=TINYINT}, + </if> + <if test="failureFactors != null"> + #{failureFactors,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIntakeOperate"> + <!--@mbg.generated--> + update ir_intake_operate + <set> + <if test="commandId != null"> + command_id = #{commandId,jdbcType=BIGINT}, + </if> + <if test="intakeId != null"> + intake_id = #{intakeId,jdbcType=BIGINT}, + </if> + <if test="startTime != null"> + start_time = #{startTime,jdbcType=TIMESTAMP}, + </if> + <if test="duration != null"> + duration = #{duration,jdbcType=INTEGER}, + </if> + <if test="commandResult != null"> + command_result = #{commandResult,jdbcType=TINYINT}, + </if> + <if test="failureFactors != null"> + failure_factors = #{failureFactors,jdbcType=VARCHAR}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIntakeOperate"> + <!--@mbg.generated--> + update ir_intake_operate + set command_id = #{commandId,jdbcType=BIGINT}, + intake_id = #{intakeId,jdbcType=BIGINT}, + start_time = #{startTime,jdbcType=TIMESTAMP}, + duration = #{duration,jdbcType=INTEGER}, + command_result = #{commandResult,jdbcType=TINYINT}, + failure_factors = #{failureFactors,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + </update> + + <!--鏍规嵁鍛戒护ID鏇存柊鍙栨按鍙f搷浣滆褰�--> + <update id="updateByCommandId" > + update ir_intake_operate + set command_result = #{commandResult}, failure_factors = #{failureFactors} + where command_id = #{commandId} + </update> +</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 index 242f89b..5a23b4d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml @@ -1,187 +1,278 @@ <?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> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> + <!--@mbg.generated--> + <!--@Table ir_irrigate_group--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="group_code" jdbcType="VARCHAR" property="groupCode" /> + <result column="default_duration" jdbcType="INTEGER" property="defaultDuration" /> + <result column="remarks" jdbcType="VARCHAR" property="remarks" /> + <result column="operator" jdbcType="BIGINT" property="operator" /> + <result column="operate_time" jdbcType="TIMESTAMP" property="operateTime" /> + <result column="deleted" jdbcType="TINYINT" property="deleted" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, group_code, default_duration, remarks, `operator`, operate_time, deleted + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ir_irrigate_group + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ir_irrigate_group + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> + <!--@mbg.generated--> + insert into ir_irrigate_group (id, group_code, default_duration, + remarks, `operator`, operate_time, + deleted) + values (#{id,jdbcType=BIGINT}, #{groupCode,jdbcType=VARCHAR}, #{defaultDuration,jdbcType=INTEGER}, + #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, #{operateTime,jdbcType=TIMESTAMP}, + #{deleted,jdbcType=TINYINT}) + </insert> + <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="groupCode != null"> + group_code, + </if> + <if test="defaultDuration != null"> + default_duration, + </if> + <if test="remarks != null"> + remarks, + </if> + <if test="operator != null"> + `operator`, + </if> + <if test="operateTime != 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="groupCode != null"> + #{groupCode,jdbcType=VARCHAR}, + </if> + <if test="defaultDuration != null"> + #{defaultDuration,jdbcType=INTEGER}, + </if> + <if test="remarks != null"> + #{remarks,jdbcType=VARCHAR}, + </if> + <if test="operator != null"> + #{operator,jdbcType=BIGINT}, + </if> + <if test="operateTime != null"> + #{operateTime,jdbcType=TIMESTAMP}, + </if> + <if test="deleted != null"> + #{deleted,jdbcType=TINYINT}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> + <!--@mbg.generated--> + update ir_irrigate_group + <set> + <if test="groupCode != null"> + group_code = #{groupCode,jdbcType=VARCHAR}, + </if> + <if test="defaultDuration != null"> + default_duration = #{defaultDuration,jdbcType=INTEGER}, + </if> + <if test="remarks != null"> + remarks = #{remarks,jdbcType=VARCHAR}, + </if> + <if test="operator != null"> + `operator` = #{operator,jdbcType=BIGINT}, + </if> + <if test="operateTime != null"> + operate_time = #{operateTime,jdbcType=TIMESTAMP}, + </if> + <if test="deleted != null"> + deleted = #{deleted,jdbcType=TINYINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> + <!--@mbg.generated--> + update ir_irrigate_group + set group_code = #{groupCode,jdbcType=VARCHAR}, + default_duration = #{defaultDuration,jdbcType=INTEGER}, + remarks = #{remarks,jdbcType=VARCHAR}, + `operator` = #{operator,jdbcType=BIGINT}, + operate_time = #{operateTime,jdbcType=TIMESTAMP}, + deleted = #{deleted,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + </update> - <!--閫昏緫鍒犻櫎--> - <delete id="deleteLogicById" parameterType="java.lang.Long"> - <!--@mbg.generated--> - update ir_irrigate_group - set deleted = 1 - where id = #{id,jdbcType=BIGINT} - </delete> + <!--閫昏緫鍒犻櫎--> + <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> + <!--淇敼涓�涓疆缃愮粍--> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> + update ir_irrigate_group + <set> + <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="operateTime != null"> + operate_time = #{operateTime,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 pro.deleted != 1 - </select> + <!--鏌ヤ竴涓疆缃愮粍--> + <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 pro.deleted != 1 + </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 pro.deleted != 1 - <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> - GROUP BY gro.id - 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(*) FROM( - SELECT COUNT(*),gro.id 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 pro.deleted != 1 - <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> - GROUP BY gro.id - ) a - </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 pro.deleted != 1 + <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> + GROUP BY gro.id + 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(*) FROM( + SELECT COUNT(*),gro.id 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 pro.deleted != 1 + <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> + GROUP BY gro.id + ) a + </select> - <!--鏍规嵁杞亴缁勭紪鍙疯幏鍙栧彇姘村彛鍒楄〃--> - <select id="getIntakesByGroupId" resultType="java.lang.Long"> - SELECT - uni.intake_id AS intakeId - FROM ir_irrigate_group grp - INNER JOIN ir_group_unit gu ON gu.group_id = grp.id - INNER JOIN ir_irrigate_unit uni ON uni.id = gu.unit_id - WHERE grp.deleted = 0 AND grp.id = #{groupId} - </select> + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇杞亴缁勮褰曟暟--> + <select id="getSimpleGroupCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM ir_irrigate_group grp + INNER JOIN ir_project_group pg ON pg.group_id = grp.id + INNER JOIN ir_project pro ON pg.project_id = pro.id + <where> + AND grp.deleted = 0 + + <if test="projectId != null and projectId != ''"> + AND pro.id = #{projectId} + </if> + + <if test="groupCode != null and groupCode != ''"> + AND grp.group_code LIKE CONCAT('%', #{groupCode}, '%') + </if> + </where> + </select> + + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇杞亴缁勫垪琛�--> + <select id="getSimpleGroups" resultType="com.dy.pipIrrGlobal.voIr.VoGroupSimple"> + SELECT + grp.id AS groupId, + grp.group_code AS groupCode, + (SELECT COUNT(*) FROM ir_group_intake WHERE group_id = grp.id) AS intakeCount, + grp.default_duration AS defaultDuration, + pg.sort + FROM ir_irrigate_group grp + INNER JOIN ir_project_group pg ON pg.group_id = grp.id + INNER JOIN ir_project pro ON pg.project_id = pro.id + <where> + AND grp.deleted = 0 + + <if test="projectId != null and projectId != ''"> + AND pro.id = #{projectId} + </if> + + <if test="groupCode != null and groupCode != ''"> + AND grp.group_code LIKE CONCAT('%', #{groupCode}, '%') + </if> + </where> + ORDER BY pg.sort + <trim prefix="limit "> + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml index 0d4e9ed..7f5b8fc 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml @@ -5,7 +5,6 @@ <!--@mbg.generated--> <!--@Table ir_irrigate_plan--> <id column="id" jdbcType="BIGINT" property="id" /> - <result column="project_id" jdbcType="BIGINT" property="projectId" /> <result column="plan_name" jdbcType="VARCHAR" property="planName" /> <result column="startup_mode" jdbcType="TINYINT" property="startupMode" /> <result column="plan_start_time" jdbcType="TIMESTAMP" property="planStartTime" /> @@ -17,7 +16,7 @@ </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> - id, project_id, plan_name, startup_mode, plan_start_time, plan_stop_time, duration, + id, plan_name, startup_mode, plan_start_time, plan_stop_time, duration, plan_state, executing_state, deleted </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> @@ -34,11 +33,11 @@ </delete> <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan"> <!--@mbg.generated--> - insert into ir_irrigate_plan (id, project_id, plan_name, + insert into ir_irrigate_plan (id, plan_name, startup_mode, plan_start_time, plan_stop_time, duration, plan_state, executing_state, deleted) - values (#{id,jdbcType=BIGINT}, #{projectId,jdbcType=BIGINT}, #{planName,jdbcType=VARCHAR}, + values (#{id,jdbcType=BIGINT}, #{planName,jdbcType=VARCHAR}, #{startupMode,jdbcType=TINYINT}, #{planStartTime,jdbcType=TIMESTAMP}, #{planStopTime,jdbcType=TIMESTAMP}, #{duration,jdbcType=INTEGER}, #{planState,jdbcType=TINYINT}, #{executingState,jdbcType=TINYINT}, #{deleted,jdbcType=BIGINT}) @@ -49,9 +48,6 @@ <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> id, - </if> - <if test="projectId != null"> - project_id, </if> <if test="planName != null"> plan_name, @@ -81,9 +77,6 @@ <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=BIGINT}, - </if> - <if test="projectId != null"> - #{projectId,jdbcType=BIGINT}, </if> <if test="planName != null"> #{planName,jdbcType=VARCHAR}, @@ -115,9 +108,6 @@ <!--@mbg.generated--> update ir_irrigate_plan <set> - <if test="projectId != null"> - project_id = #{projectId,jdbcType=BIGINT}, - </if> <if test="planName != null"> plan_name = #{planName,jdbcType=VARCHAR}, </if> @@ -148,8 +138,7 @@ <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan"> <!--@mbg.generated--> update ir_irrigate_plan - set project_id = #{projectId,jdbcType=BIGINT}, - plan_name = #{planName,jdbcType=VARCHAR}, + set plan_name = #{planName,jdbcType=VARCHAR}, startup_mode = #{startupMode,jdbcType=TINYINT}, plan_start_time = #{planStartTime,jdbcType=TIMESTAMP}, plan_stop_time = #{planStopTime,jdbcType=TIMESTAMP}, @@ -168,108 +157,114 @@ WHERE id = #{planId} </select> - <!--鏍规嵁鎸囧畾鐨勮鍒扞D鑾峰彇宸插彂甯冪殑鐏屾簤璁″垝鏁伴噺--> - <select id="getPublishedCount" resultType="java.lang.Integer"> - SELECT COUNT(*) - FROM ir_irrigate_plan plan - WHERE plan.id = #{planId} - AND plan.plan_state = 2 - AND plan.deleted = 0 - </select> - - <!--鍙戝竷鎸囧畾鐨勭亴婧夎鍒�--> - <update id="publishIrrigatePlan"> - UPDATE ir_irrigate_plan SET plan_state = 2 WHERE id = #{planId} - </update> - <!--鏍规嵁鎸囧畾鐨勬潯浠惰幏鍙栬鍒掓暟閲�--> - <select id="getIrrigatePlanCount" resultType="java.lang.Long"> - SELECT COUNT(*) - FROM ir_irrigate_plan plan - INNER JOIN ir_project pro ON pro.id = plan.project_id - <where> - AND plan.deleted = 0 - AND pro.deleted = 0 - <if test="projectName != null and projectName != ''"> - AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') - </if> +<!-- <select id="getIrrigatePlanCount" resultType="java.lang.Long">--> +<!-- SELECT COUNT(*)--> +<!-- FROM ir_irrigate_plan plan--> +<!-- INNER JOIN ir_project pro ON pro.id = plan.project_id--> +<!-- <where>--> +<!-- AND plan.deleted = 0--> +<!-- AND pro.deleted = 0--> +<!-- <if test="projectName != null and projectName != ''">--> +<!-- AND pro.project_name LIKE CONCAT('%', #{projectName}, '%')--> +<!-- </if>--> - <if test="planName != null and planName != ''"> - AND plan.plan_name LIKE CONCAT('%', #{planName}, '%') - </if> +<!-- <if test="planName != null and planName != ''">--> +<!-- AND plan.plan_name LIKE CONCAT('%', #{planName}, '%')--> +<!-- </if>--> - <if test="startupMode != null"> - AND plan.startup_mode = #{startupMode} - </if> +<!-- <if test="startupMode != null">--> +<!-- AND plan.startup_mode = #{startupMode}--> +<!-- </if>--> - <if test="planState != null"> - AND plan.plan_state = #{planState} - </if> +<!-- <if test="planState != null">--> +<!-- AND plan.plan_state = #{planState}--> +<!-- </if>--> - <if test="executingState != null"> - AND plan.executing_state = #{executingState} - </if> - </where> - </select> +<!-- <if test="executingState != null">--> +<!-- AND plan.executing_state = #{executingState}--> +<!-- </if>--> +<!-- </where>--> +<!-- </select>--> <!--鏍规嵁鎸囧畾鐨勬潯浠惰幏鍙栬鍒掑垪琛�--> - <select id="getIrrigatePlans" resultType="com.dy.pipIrrGlobal.voIr.VoIrrigatePlan"> +<!-- <select id="getIrrigatePlans" resultType="com.dy.pipIrrGlobal.voIr.VoIrrigatePlan">--> +<!-- SELECT--> +<!-- plan.id AS planId,--> +<!-- pro.project_name AS projectName,--> +<!-- plan.plan_name AS planName,--> +<!-- CASE plan.startup_mode--> +<!-- WHEN 1 THEN '鎵嬪姩鍚姩'--> +<!-- WHEN 2 THEN '鑷姩鍚姩'--> +<!-- END AS startupMode,--> +<!-- plan.plan_start_time AS startTime,--> +<!-- plan.plan_stop_time AS stopTime,--> +<!-- plan.duration AS duration,--> +<!-- CASE plan.plan_state--> +<!-- WHEN 1 THEN '鑽夌'--> +<!-- WHEN 2 THEN '宸插彂甯�'--> +<!-- END AS planState,--> + +<!-- CASE plan.executing_state--> +<!-- WHEN 1 THEN--> +<!-- '鏈墽琛�'--> +<!-- WHEN 2 THEN--> +<!-- '鎵ц涓�'--> +<!-- WHEN 3 THEN--> +<!-- '宸叉殏鍋�'--> +<!-- WHEN 4 THEN--> +<!-- '宸茬粓姝�'--> +<!-- END AS executingState--> +<!-- FROM ir_irrigate_plan plan--> +<!-- INNER JOIN ir_project pro ON pro.id = plan.project_id--> +<!-- <where>--> +<!-- AND plan.deleted = 0--> +<!-- AND pro.deleted = 0--> +<!-- <if test="projectName != null and projectName != ''">--> +<!-- AND pro.project_name LIKE CONCAT('%', #{projectName}, '%')--> +<!-- </if>--> + +<!-- <if test="planName != null and planName != ''">--> +<!-- AND plan.plan_name LIKE CONCAT('%', #{planName}, '%')--> +<!-- </if>--> + +<!-- <if test="startupMode != null">--> +<!-- AND plan.startup_mode = #{startupMode}--> +<!-- </if>--> + +<!-- <if test="planState != null">--> +<!-- AND plan.plan_state = #{planState}--> +<!-- </if>--> + +<!-- <if test="executingState != null">--> +<!-- AND plan.executing_state = #{executingState}--> +<!-- </if>--> +<!-- </where>--> +<!-- ORDER BY plan.plan_state DESC, plan.plan_start_time--> +<!-- <trim prefix="limit ">--> +<!-- <if test="start != null and count != null">--> +<!-- #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}--> +<!-- </if>--> +<!-- </trim>--> +<!-- </select>--> + + <!--鏍规嵁璁″垝ID鑾峰彇璁″垝绠�鍗曚俊鎭�--> + <select id="getPlanSimple" resultType="com.dy.pipIrrGlobal.voIr.VoPlanSimple"> SELECT - plan.id AS planId, - pro.project_name AS projectName, - plan.plan_name AS planName, - CASE plan.startup_mode - WHEN 1 THEN '鎵嬪姩鍚姩' - WHEN 2 THEN '鑷姩鍚姩' - END AS startupMode, - plan.plan_start_time AS startTime, - plan.plan_stop_time AS stopTime, - plan.duration AS duration, - CASE plan.plan_state - WHEN 1 THEN '鑽夌' - WHEN 2 THEN '宸插彂甯�' - END AS planState, - - CASE plan.executing_state - WHEN 1 THEN - '鏈墽琛�' - WHEN 2 THEN - '鎵ц涓�' - WHEN 3 THEN - '宸叉殏鍋�' - WHEN 4 THEN - '宸茬粓姝�' - END AS executingState + plan.startup_mode AS startupMode, + plan.plan_start_time AS planStartTime, + plan.duration AS duration FROM ir_irrigate_plan plan - INNER JOIN ir_project pro ON pro.id = plan.project_id - <where> - AND plan.deleted = 0 - AND pro.deleted = 0 - <if test="projectName != null and projectName != ''"> - AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') - </if> - - <if test="planName != null and planName != ''"> - AND plan.plan_name LIKE CONCAT('%', #{planName}, '%') - </if> - - <if test="startupMode != null"> - AND plan.startup_mode = #{startupMode} - </if> - - <if test="planState != null"> - AND plan.plan_state = #{planState} - </if> - - <if test="executingState != null"> - AND plan.executing_state = #{executingState} - </if> - </where> - ORDER BY plan.plan_state DESC, plan.plan_start_time - <trim prefix="limit "> - <if test="start != null and count != null"> - #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} - </if> - </trim> + WHERE plan.id = #{planId} + AND plan.deleted = 0 AND plan_state = 1 + LIMIT 1 </select> + + <!--鏍规嵁璁″垝ID鏇存柊璁″垝淇℃伅锛堣捣姝㈡椂闂淬�佽鍒掔姸鎬侊級--> + <update id="updatePlanTimes"> + UPDATE ir_irrigate_plan + SET plan_start_time = #{planStartTime}, plan_stop_time = #{planStopTime}, plan_state = 2 + WHERE id = #{planId} + </update> + </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml index f57f2f0..982fe2f 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml @@ -5,17 +5,14 @@ <!--@mbg.generated--> <!--@Table ir_irrigate_schedule--> <id column="id" jdbcType="BIGINT" property="id" /> - <result column="plan_id" jdbcType="BIGINT" property="planId" /> <result column="group_id" jdbcType="BIGINT" property="groupId" /> <result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> - <result column="stop_time" jdbcType="TIMESTAMP" property="stopTime" /> <result column="duration" jdbcType="INTEGER" property="duration" /> - <result column="intake_ids" jdbcType="LONGVARCHAR" property="intakeIds" /> <result column="current_state" jdbcType="TINYINT" property="currentState" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> - id, plan_id, group_id, start_time, stop_time, duration, intake_ids, current_state + id, group_id, start_time, duration, current_state </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <!--@mbg.generated--> @@ -31,12 +28,9 @@ </delete> <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule"> <!--@mbg.generated--> - insert into ir_irrigate_schedule (id, plan_id, group_id, - start_time, stop_time, duration, - intake_ids, current_state) - values (#{id,jdbcType=BIGINT}, #{planId,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT}, - #{startTime,jdbcType=TIMESTAMP}, #{stopTime,jdbcType=TIMESTAMP}, #{duration,jdbcType=INTEGER}, - #{intakeIds,jdbcType=LONGVARCHAR}, #{currentState,jdbcType=TINYINT}) + insert into ir_irrigate_schedule (id, group_id, start_time, duration, current_state) + values (#{id,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT}, + #{startTime,jdbcType=TIMESTAMP}, #{duration,jdbcType=INTEGER}, #{currentState,jdbcType=TINYINT}) </insert> <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule"> <!--@mbg.generated--> @@ -45,23 +39,14 @@ <if test="id != null"> id, </if> - <if test="planId != null"> - plan_id, - </if> <if test="groupId != null"> group_id, </if> <if test="startTime != null"> start_time, </if> - <if test="stopTime != null"> - stop_time, - </if> <if test="duration != null"> duration, - </if> - <if test="intakeIds != null"> - intake_ids, </if> <if test="currentState != null"> current_state, @@ -71,23 +56,14 @@ <if test="id != null"> #{id,jdbcType=BIGINT}, </if> - <if test="planId != null"> - #{planId,jdbcType=BIGINT}, - </if> <if test="groupId != null"> #{groupId,jdbcType=BIGINT}, </if> <if test="startTime != null"> #{startTime,jdbcType=TIMESTAMP}, </if> - <if test="stopTime != null"> - #{stopTime,jdbcType=TIMESTAMP}, - </if> <if test="duration != null"> #{duration,jdbcType=INTEGER}, - </if> - <if test="intakeIds != null"> - #{intakeIds,jdbcType=LONGVARCHAR}, </if> <if test="currentState != null"> #{currentState,jdbcType=TINYINT}, @@ -98,23 +74,14 @@ <!--@mbg.generated--> update ir_irrigate_schedule <set> - <if test="planId != null"> - plan_id = #{planId,jdbcType=BIGINT}, - </if> <if test="groupId != null"> group_id = #{groupId,jdbcType=BIGINT}, </if> <if test="startTime != null"> start_time = #{startTime,jdbcType=TIMESTAMP}, </if> - <if test="stopTime != null"> - stop_time = #{stopTime,jdbcType=TIMESTAMP}, - </if> <if test="duration != null"> duration = #{duration,jdbcType=INTEGER}, - </if> - <if test="intakeIds != null"> - intake_ids = #{intakeIds,jdbcType=LONGVARCHAR}, </if> <if test="currentState != null"> current_state = #{currentState,jdbcType=TINYINT}, @@ -125,30 +92,30 @@ <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule"> <!--@mbg.generated--> update ir_irrigate_schedule - set plan_id = #{planId,jdbcType=BIGINT}, - group_id = #{groupId,jdbcType=BIGINT}, + set group_id = #{groupId,jdbcType=BIGINT}, start_time = #{startTime,jdbcType=TIMESTAMP}, - stop_time = #{stopTime,jdbcType=TIMESTAMP}, duration = #{duration,jdbcType=INTEGER}, - intake_ids = #{intakeIds,jdbcType=LONGVARCHAR}, current_state = #{currentState,jdbcType=TINYINT} where id = #{id,jdbcType=BIGINT} </update> - <!--鏍规嵁璁″垝ID鑾峰彇鐏屾簤娆″簭_妯″紡2--> - <select id="getIrrigateSchedules" resultType="com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule"> + <!--鏍规嵁璁″垝ID鑾峰彇鐏屾簤娆″簭璁板綍--> + <select id="getSchedulesByPlanId" resultType="com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule"> SELECT - id AS scheduleId, - <if test="startupMode == 1"> - null AS startTime, - duration, - </if> - <if test="startupMode == 2"> - start_time AS startTime, - TIMESTAMPDIFF(MINUTE, start_time, stop_time) AS duration, - </if> - intake_ids AS intakeIds - FROM ir_irrigate_schedule - WHERE plan_id = #{planId} + sch.id AS scheduleId, + sch.group_id AS groupId, + sch.start_time AS startTime, + sch.duration + FROM ir_irrigate_schedule sch + INNER JOIN ir_plan_schedule ps ON ps.schedule_id = sch.id + WHERE current_state = 1 AND ps.plan_id = #{planId} </select> + + <!--鏍规嵁鐏屾簤娆″簭ID鏇存柊娆″簭寮�濮嬫椂闂�--> + <update id="updateScheduleStartTime"> + UPDATE ir_irrigate_schedule + SET start_time = #{startTime} + WHERE id = #{scheduleId} + </update> + </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrPlanScheduleMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrPlanScheduleMapper.xml new file mode 100644 index 0000000..9df26cd --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrPlanScheduleMapper.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.IrPlanScheduleMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrPlanSchedule"> + <!--@mbg.generated--> + <!--@Table ir_plan_schedule--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="plan_id" jdbcType="BIGINT" property="planId" /> + <result column="schedule_id" jdbcType="BIGINT" property="scheduleId" /> + <result column="sort" jdbcType="INTEGER" property="sort" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, plan_id, schedule_id, sort + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ir_plan_schedule + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ir_plan_schedule + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrPlanSchedule"> + <!--@mbg.generated--> + insert into ir_plan_schedule (id, plan_id, schedule_id, + sort) + values (#{id,jdbcType=BIGINT}, #{planId,jdbcType=BIGINT}, #{scheduleId,jdbcType=BIGINT}, + #{sort,jdbcType=INTEGER}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrPlanSchedule"> + <!--@mbg.generated--> + insert into ir_plan_schedule + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="planId != null"> + plan_id, + </if> + <if test="scheduleId != null"> + schedule_id, + </if> + <if test="sort != null"> + sort, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="planId != null"> + #{planId,jdbcType=BIGINT}, + </if> + <if test="scheduleId != null"> + #{scheduleId,jdbcType=BIGINT}, + </if> + <if test="sort != null"> + #{sort,jdbcType=INTEGER}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrPlanSchedule"> + <!--@mbg.generated--> + update ir_plan_schedule + <set> + <if test="planId != null"> + plan_id = #{planId,jdbcType=BIGINT}, + </if> + <if test="scheduleId != null"> + schedule_id = #{scheduleId,jdbcType=BIGINT}, + </if> + <if test="sort != null"> + sort = #{sort,jdbcType=INTEGER}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrPlanSchedule"> + <!--@mbg.generated--> + update ir_plan_schedule + set plan_id = #{planId,jdbcType=BIGINT}, + schedule_id = #{scheduleId,jdbcType=BIGINT}, + sort = #{sort,jdbcType=INTEGER} + where id = #{id,jdbcType=BIGINT} + </update> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectGroupMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectGroupMapper.xml new file mode 100644 index 0000000..d9ab535 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectGroupMapper.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.IrProjectGroupMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrProjectGroup"> + <!--@mbg.generated--> + <!--@Table ir_project_group--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="project_id" jdbcType="BIGINT" property="projectId" /> + <result column="group_id" jdbcType="BIGINT" property="groupId" /> + <result column="sort" jdbcType="INTEGER" property="sort" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, project_id, group_id, sort + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ir_project_group + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ir_project_group + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProjectGroup"> + <!--@mbg.generated--> + insert into ir_project_group (id, project_id, group_id, + sort) + values (#{id,jdbcType=BIGINT}, #{projectId,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT}, + #{sort,jdbcType=INTEGER}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProjectGroup"> + <!--@mbg.generated--> + insert into ir_project_group + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="projectId != null"> + project_id, + </if> + <if test="groupId != null"> + group_id, + </if> + <if test="sort != null"> + sort, + </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="groupId != null"> + #{groupId,jdbcType=BIGINT}, + </if> + <if test="sort != null"> + #{sort,jdbcType=INTEGER}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProjectGroup"> + <!--@mbg.generated--> + update ir_project_group + <set> + <if test="projectId != null"> + project_id = #{projectId,jdbcType=BIGINT}, + </if> + <if test="groupId != null"> + group_id = #{groupId,jdbcType=BIGINT}, + </if> + <if test="sort != null"> + sort = #{sort,jdbcType=INTEGER}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProjectGroup"> + <!--@mbg.generated--> + update ir_project_group + set project_id = #{projectId,jdbcType=BIGINT}, + group_id = #{groupId,jdbcType=BIGINT}, + sort = #{sort,jdbcType=INTEGER} + where id = #{id,jdbcType=BIGINT} + </update> +</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 daeda58..050c788 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml @@ -1,232 +1,311 @@ <?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.IrProjectMapper"> - <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrProject"> - <!--@mbg.generated--> - <!--@Table ir_project--> - <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="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_name, province_id, city_id, county_id, town_id, `village_id`, project_state, remarks, `operator`, - operate_time, deleted - </sql> - <!--娣诲姞--> - <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProject"> - <!--@mbg.generated--> - insert into ir_project - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null"> - id, - </if> - <if test="projectName != null"> - project_name, - </if> - <if test="provinceId != null"> - province_id, - </if> - <if test="cityId != null"> - city_id, - </if> - <if test="countyId != null"> - county_id, - </if> - <if test="townId != null"> - town_id, - </if> - <if test="villageId != null"> - village_id, - </if> - <if test="projectState != null"> - project_state, - </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="projectName != null"> - #{projectName,jdbcType=VARCHAR}, - </if> - <if test="provinceId != null"> - #{provinceId,jdbcType=BIGINT}, - </if> - <if test="cityId != null"> - #{cityId,jdbcType=BIGINT}, - </if> - <if test="countyId != null"> - #{countyId,jdbcType=BIGINT}, - </if> - <if test="townId != null"> - #{townId,jdbcType=BIGINT}, - </if> - <if test="villageId != null"> - #{villageId,jdbcType=BIGINT}, - </if> - <if test="projectState != null"> - #{projectState,jdbcType=TINYINT}, - </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> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrProject"> + <!--@mbg.generated--> + <!--@Table ir_project--> + <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="remarks" jdbcType="VARCHAR" property="remarks" /> + <result column="operator" jdbcType="BIGINT" property="operator" /> + <result column="operate_time" jdbcType="TIMESTAMP" property="operateTime" /> + <result column="deleted" jdbcType="TINYINT" property="deleted" /> + </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`, operate_time, deleted + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ir_project + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ir_project + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProject"> + <!--@mbg.generated--> + insert into ir_project (id, project_name, province_id, + city_id, county_id, town_id, + village_id, project_state, remarks, + `operator`, operate_time, deleted + ) + values (#{id,jdbcType=BIGINT}, #{projectName,jdbcType=VARCHAR}, #{provinceId,jdbcType=BIGINT}, + #{cityId,jdbcType=BIGINT}, #{countyId,jdbcType=BIGINT}, #{townId,jdbcType=BIGINT}, + #{villageId,jdbcType=BIGINT}, #{projectState,jdbcType=TINYINT}, #{remarks,jdbcType=VARCHAR}, + #{operator,jdbcType=BIGINT}, #{operateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT} + ) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProject"> + <!--@mbg.generated--> + insert into ir_project + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="projectName != null"> + project_name, + </if> + <if test="provinceId != null"> + province_id, + </if> + <if test="cityId != null"> + city_id, + </if> + <if test="countyId != null"> + county_id, + </if> + <if test="townId != null"> + town_id, + </if> + <if test="villageId != null"> + village_id, + </if> + <if test="projectState != null"> + project_state, + </if> + <if test="remarks != null"> + remarks, + </if> + <if test="operator != null"> + `operator`, + </if> + <if test="operateTime != 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="projectName != null"> + #{projectName,jdbcType=VARCHAR}, + </if> + <if test="provinceId != null"> + #{provinceId,jdbcType=BIGINT}, + </if> + <if test="cityId != null"> + #{cityId,jdbcType=BIGINT}, + </if> + <if test="countyId != null"> + #{countyId,jdbcType=BIGINT}, + </if> + <if test="townId != null"> + #{townId,jdbcType=BIGINT}, + </if> + <if test="villageId != null"> + #{villageId,jdbcType=BIGINT}, + </if> + <if test="projectState != null"> + #{projectState,jdbcType=TINYINT}, + </if> + <if test="remarks != null"> + #{remarks,jdbcType=VARCHAR}, + </if> + <if test="operator != null"> + #{operator,jdbcType=BIGINT}, + </if> + <if test="operateTime != null"> + #{operateTime,jdbcType=TIMESTAMP}, + </if> + <if test="deleted != null"> + #{deleted,jdbcType=TINYINT}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProject"> + <!--@mbg.generated--> + update ir_project + <set> + <if test="projectName != null"> + project_name = #{projectName,jdbcType=VARCHAR}, + </if> + <if test="provinceId != null"> + province_id = #{provinceId,jdbcType=BIGINT}, + </if> + <if test="cityId != null"> + city_id = #{cityId,jdbcType=BIGINT}, + </if> + <if test="countyId != null"> + county_id = #{countyId,jdbcType=BIGINT}, + </if> + <if test="townId != null"> + town_id = #{townId,jdbcType=BIGINT}, + </if> + <if test="villageId != null"> + village_id = #{villageId,jdbcType=BIGINT}, + </if> + <if test="projectState != null"> + project_state = #{projectState,jdbcType=TINYINT}, + </if> + <if test="remarks != null"> + remarks = #{remarks,jdbcType=VARCHAR}, + </if> + <if test="operator != null"> + `operator` = #{operator,jdbcType=BIGINT}, + </if> + <if test="operateTime != null"> + operate_time = #{operateTime,jdbcType=TIMESTAMP}, + </if> + <if test="deleted != null"> + deleted = #{deleted,jdbcType=TINYINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProject"> + <!--@mbg.generated--> + update ir_project + set project_name = #{projectName,jdbcType=VARCHAR}, + province_id = #{provinceId,jdbcType=BIGINT}, + city_id = #{cityId,jdbcType=BIGINT}, + county_id = #{countyId,jdbcType=BIGINT}, + town_id = #{townId,jdbcType=BIGINT}, + village_id = #{villageId,jdbcType=BIGINT}, + project_state = #{projectState,jdbcType=TINYINT}, + remarks = #{remarks,jdbcType=VARCHAR}, + `operator` = #{operator,jdbcType=BIGINT}, + operate_time = #{operateTime,jdbcType=TIMESTAMP}, + deleted = #{deleted,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + </update> - <!--鏍规嵁涓嬬骇鑾峰彇涓婁竴绾у湴鍧�--> - <select id="getSupperByVillageId" parameterType="_long" resultType="java.lang.Long"> - select dis_tow.* - from ba_district dis_vil - inner join - ba_district dis_tow - on dis_vil.supperId = dis_tow.id - where dis_vil.id = #{vaId,jdbcType=BIGINT} - </select> - <!--閫昏緫鍒犻櫎--> - <delete id="deleteLogicById" parameterType="java.lang.Long"> - <!--@mbg.generated--> - update ir_project - set deleted = 1 - where id = #{id,jdbcType=BIGINT} - </delete> - <!--淇敼淇℃伅--> - <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProject"> - update ir_project - <set> - <if test="projectName != null"> - project_name = #{projectName,jdbcType=VARCHAR}, - </if> - <if test="provinceId != null"> - province_id = #{provinceId,jdbcType=BIGINT}, - </if> - <if test="cityId != null"> - city_id = #{cityId,jdbcType=BIGINT}, - </if> - <if test="countyId != null"> - county_id = #{countyId,jdbcType=BIGINT}, - </if> - <if test="townId != null"> - town_id = #{townId,jdbcType=BIGINT}, - </if> - <if test="villageId != null"> - village_id = #{villageId,jdbcType=BIGINT}, - </if> - <if test="projectState != null"> - project_state = #{projectState,jdbcType=TINYINT}, - </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> - <!--淇敼鐘舵��--> - <update id="updateProjectState"> - update ir_project - set project_state = #{projectState,jdbcType=TINYINT}, - operator = #{operator,jdbcType=BIGINT}, - operate_time = #{operateDt,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} - </update> - <!--鏌ヨ涓�涓俊鎭�--> - <select id="selectById" resultType="com.dy.pipIrrGlobal.voIr.VoProjectOne"> - select - 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, - CAST(pro.town_id AS char)AS townId, - CAST(pro.village_id AS char)AS villageId, - pro.project_name AS projectName, - pro.project_state AS projectState, - cli.name AS operatorName, - pro.remarks, - pro.operate_time AS operateDt - from ir_project pro - left join se_client cli on cli.id = pro.operator - where pro.id = #{id,jdbcType=BIGINT} and pro.deleted = 0 - </select> - <!--鍒嗛〉鏌ヨ鏁伴噺--> - <select id="getRecordCount" resultType="java.lang.Long"> - SELECT COUNT(*) AS recordCount - FROM ir_project pro - <where> - pro.deleted = 0 - <if test="projectName != null and projectName != ''"> - AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') - </if> - <if test = "projectState != null and projectState != ''"> - AND pro.project_state = #{projectState} - </if> - </where> - </select> - <!--鍒嗛〉鏌ヨ鏁版嵁--> - <select id="getProjects" resultType="com.dy.pipIrrGlobal.voIr.VoProject"> - SELECT - CAST(pro.id AS char)AS projectId, - pro.project_name AS projectName, - pro.project_state AS projectState, - CONCAT(province.`name`,city.`name`,country.`name`, town.`name`, village.`name`) AS address, - pro.remarks, - pro.operate_time AS operateDt - FROM ir_project pro - LEFT JOIN ba_district province ON pro.province_id = province.id - LEFT JOIN ba_district city ON pro.city_id = city.id - LEFT JOIN ba_district country ON pro.county_id = country.id - LEFT JOIN ba_district town ON pro.town_id = town.id - LEFT JOIN ba_district village ON pro.village_id = village.id - <where> - pro.deleted = 0 - <if test="projectName != null and projectName != ''"> - AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') - </if> - <if test = "projectState != null and projectState != ''"> - AND pro.project_state = #{projectState} - </if> - </where> - ORDER BY pro.operate_time DESC - <if test="pageCurr != null and pageSize != null"> - LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} - </if> - </select> + <!--鏍规嵁涓嬬骇鑾峰彇涓婁竴绾у湴鍧�--> + <select id="getSupperByVillageId" parameterType="_long" resultType="java.lang.Long"> + select dis_tow.* + from ba_district dis_vil + inner join + ba_district dis_tow + on dis_vil.supperId = dis_tow.id + where dis_vil.id = #{vaId,jdbcType=BIGINT} + </select> + <!--閫昏緫鍒犻櫎--> + <delete id="deleteLogicById" parameterType="java.lang.Long"> + <!--@mbg.generated--> + update ir_project + set deleted = 1 + where id = #{id,jdbcType=BIGINT} + </delete> + + <!--淇敼鐘舵��--> + <update id="updateProjectState"> + update ir_project + set project_state = #{projectState,jdbcType=TINYINT}, + operator = #{operator,jdbcType=BIGINT}, + operate_time = #{operateTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + </update> + + <!--鏌ヨ涓�涓俊鎭�--> + <select id="selectById" resultType="com.dy.pipIrrGlobal.voIr.VoProjectOne"> + select + 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, + CAST(pro.town_id AS char)AS townId, + CAST(pro.village_id AS char)AS villageId, + pro.project_name AS projectName, + pro.project_state AS projectState, + cli.name AS operatorName, + pro.remarks, + pro.operate_time AS operateDt + from ir_project pro + left join se_client cli on cli.id = pro.operator + where pro.id = #{id,jdbcType=BIGINT} and pro.deleted = 0 + </select> + + <!--鍒嗛〉鏌ヨ鏁伴噺--> + <select id="getRecordCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM ir_project pro + <where> + pro.deleted = 0 + <if test="projectName != null and projectName != ''"> + AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') + </if> + <if test = "projectState != null and projectState != ''"> + AND pro.project_state = #{projectState} + </if> + </where> + </select> + + <!--鍒嗛〉鏌ヨ鏁版嵁--> + <select id="getProjects" resultType="com.dy.pipIrrGlobal.voIr.VoProject"> + SELECT + CAST(pro.id AS char)AS projectId, + pro.project_name AS projectName, + pro.project_state AS projectState, + CONCAT(province.`name`,city.`name`,country.`name`, town.`name`, village.`name`) AS address, + pro.remarks, + pro.operate_time AS operateDt + FROM ir_project pro + LEFT JOIN ba_district province ON pro.province_id = province.id + LEFT JOIN ba_district city ON pro.city_id = city.id + LEFT JOIN ba_district country ON pro.county_id = country.id + LEFT JOIN ba_district town ON pro.town_id = town.id + LEFT JOIN ba_district village ON pro.village_id = village.id + <where> + pro.deleted = 0 + <if test="projectName != null and projectName != ''"> + AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') + </if> + <if test = "projectState != null and projectState != ''"> + AND pro.project_state = #{projectState} + </if> + </where> + ORDER BY pro.operate_time DESC + <if test="pageCurr != null and pageSize != null"> + LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} + </if> + </select> + + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇椤圭洰璁板綍(绮剧畝)鏁伴噺--> + <select id="getSimpleProjectsCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM ir_project pr + <where> + AND pr.project_state = 1 + AND pr.deleted = 0 + <if test="projectName != null and projectName != ''"> + AND pr.project_name LIKE CONCAT('%', #{projectName}, '%') + </if> + </where> + </select> + + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇椤圭洰璁板綍(绮剧畝)--> + <select id="getSimpleProjects" resultType="com.dy.pipIrrGlobal.voIr.VoProjectSimple"> + SELECT + pr.id AS projectId, + pr.project_name AS projectName, + (SELECT COUNT(*) FROM ir_project_group pg WHERE pg.project_id = pr.id) AS groupCount + FROM ir_project pr + <where> + AND pr.project_state = 1 + AND pr.deleted = 0 + <if test="projectName != null and projectName != ''"> + AND pr.project_name LIKE CONCAT('%', #{projectName}, '%') + </if> + </where> + ORDER BY pr.operate_time DESC + <trim prefix="limit "> + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/crop/CropCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/crop/CropCtrl.java index 9bffcda..a3b5ec8 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/crop/CropCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/crop/CropCtrl.java @@ -9,10 +9,7 @@ import com.dy.pipIrrGlobal.pojoIr.IrProject; import com.dy.pipIrrGlobal.voIr.VoCrop; import com.dy.pipIrrGlobal.voIr.VoCropOne; -import com.dy.pipIrrGlobal.voIr.VoProject; -import com.dy.pipIrrGlobal.voIr.VoProjectOne; import com.dy.pipIrrGlobal.voSe.VoActiveCard; -import com.dy.pipIrrIrrigate.crop.QueryVo; import com.dy.pipIrrIrrigate.result.IrrigateResultCode; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; 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 index 76dd797..90cb545 100644 --- 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 @@ -42,7 +42,7 @@ * @return */ public Integer addIrrigateGroup(IrIrrigateGroup po) { - po.setOperateDt(new Date()); + po.setOperateTime(new Date()); po.setDeleted((byte) 0); int rows = irIrrigateGroupMapper.insertSelective(po); if (rows == 0) { @@ -71,7 +71,7 @@ * @return */ public Integer updateIrrigateGroup(IrIrrigateGroup po){ - po.setOperateDt(new Date()); + po.setOperateTime(new Date()); int rows = irIrrigateGroupMapper.updateByPrimaryKeySelective(po); if (rows == 0){ return 0; 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 6f46207..973bccf 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 @@ -6,10 +6,8 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; import com.dy.pipIrrGlobal.pojoIr.IrProject; -import com.dy.pipIrrGlobal.pojoPr.PrIntake; import com.dy.pipIrrGlobal.voIr.VoProject; import com.dy.pipIrrGlobal.voIr.VoProjectOne; -import com.dy.pipIrrGlobal.voPr.VoIntake; import com.dy.pipIrrGlobal.voSe.VoActiveCard; import com.dy.pipIrrIrrigate.result.IrrigateResultCode; import io.swagger.v3.oas.annotations.Operation; @@ -21,14 +19,15 @@ import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.ibatis.annotations.Param; import org.springframework.http.MediaType; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; -import java.lang.reflect.Array; -import java.util.*; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; /** * @author :WuZeYu diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java index 4683b2d..adad9dc 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java @@ -6,7 +6,6 @@ import com.dy.pipIrrGlobal.pojoIr.IrProject; import com.dy.pipIrrGlobal.voIr.VoProject; import com.dy.pipIrrGlobal.voIr.VoProjectOne; -import com.dy.pipIrrGlobal.voPr.VoIntake; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -35,7 +34,7 @@ * @return */ public Integer addProject(IrProject po) { - po.setOperateDt(new Date()); + po.setOperateTime(new Date()); po.setDeleted((byte) 0); if (po.getVillageId() != null) { po.setTownId(irProjectMapper.getSupperByVillageId(po.getVillageId())); @@ -81,7 +80,7 @@ * @return */ public Integer updateProject(IrProject po){ - po.setOperateDt(new Date()); + po.setOperateTime(new Date()); if (po.getVillageId() != null) { po.setTownId(irProjectMapper.getSupperByVillageId(po.getVillageId())); po.setCountyId(irProjectMapper.getSupperByVillageId(po.getTownId())); @@ -113,7 +112,7 @@ * @return */ public Integer updateProjectState(IrProject po){ - po.setOperateDt(new Date()); + po.setOperateTime(new Date()); int rows = irProjectMapper.updateProjectState(po); if (rows == 0){ return 0; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java index 2ce8770..38b60b2 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java @@ -5,8 +5,17 @@ import com.alibaba.fastjson2.JSONObject; import com.dy.common.multiDataSource.DataSourceContext; import com.dy.common.mw.protocol.Command; +import com.dy.common.mw.protocol.p206V1.CodeV1; +import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1; +import com.dy.common.mw.protocol.p206V1.downVos.ComA1Vo; +import com.dy.common.mw.protocol.p206V2.ProtocolConstantV206V2; +import com.dy.common.mw.protocol.p206V202404.ProtocolConstantV206V202404; +import com.dy.common.util.IDLongGenerator; +import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.command.ComSupport; +import com.dy.pipIrrGlobal.command.dto.Param; +import com.dy.pipIrrGlobal.daoIr.IrIntakeOperateMapper; import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper; import com.dy.pipIrrGlobal.daoPr.PrIntakeVcMapper; import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper; @@ -15,20 +24,23 @@ import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveLastMapper; import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; +import com.dy.pipIrrGlobal.pojoIr.IrIntakeOperate; import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; import com.dy.pipIrrGlobal.pojoSe.SeClientCard; import com.dy.pipIrrGlobal.voRm.VoIrrigaterProfile; import com.dy.pipIrrGlobal.voRm.VoRtuAndVc; import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; import com.dy.pipIrrGlobal.voSe.VoVirtualCard; +import com.dy.pipIrrWechat.command.dto.AutomaticClose; +import com.dy.pipIrrWechat.result.WechatResultCode; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.core.env.Environment; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.List; +import java.util.*; /** * @author ZhuBaoMin @@ -50,6 +62,10 @@ private final RmIrrigateProfileMapper rmIrrigateProfileMapper; private final RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper; //private final PrCommonIntakesMapper prCommonIntakesMapper; + private final IrIntakeOperateMapper irIntakeOperateMapper; + + @Value("${mw.rtuCallbackUrl_wx}") + private String rtuCallbackUrl_wx; /** * pro_mw锛氬睘鎬� @@ -60,7 +76,7 @@ private String pro_mw = "mw"; private String key_mw = "comSendUrl"; @Autowired - public CommandSv(RmCommandHistoryMapper rmCommandHistoryMapper,RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper, SeVirtualCardMapper seVirtualCardMapper, PrIntakeMapper prIntakeMapper, PrWaterPriceMapper prWaterPriceMapper, PrIntakeVcMapper prIntakeVcMapper, SeClientCardMapper seClientCardMapper, RmIrrigateProfileMapper rmIrrigateProfileMapper, Environment env) { + public CommandSv(RmCommandHistoryMapper rmCommandHistoryMapper,RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper, SeVirtualCardMapper seVirtualCardMapper, PrIntakeMapper prIntakeMapper, PrWaterPriceMapper prWaterPriceMapper, PrIntakeVcMapper prIntakeVcMapper, SeClientCardMapper seClientCardMapper, RmIrrigateProfileMapper rmIrrigateProfileMapper, Environment env, IrIntakeOperateMapper irIntakeOperateMapper) { this.rmCommandHistoryMapper = rmCommandHistoryMapper; this.rmOpenCloseValveLastMapper = rmOpenCloseValveLastMapper; //this.prCommonIntakesMapper = prCommonIntakesMapper; @@ -71,6 +87,7 @@ this.seClientCardMapper = seClientCardMapper; this.rmIrrigateProfileMapper = rmIrrigateProfileMapper; this.env = env; + this.irIntakeOperateMapper = irIntakeOperateMapper; } /** * 铏氭嫙鍗D鎹㈣櫄鎷熷崱瀵硅薄 @@ -207,4 +224,192 @@ rsVo.obj = rmIrrigateProfileMapper.getIrrPro(type); return rsVo ; } + + /** + * 娣诲姞鍙栨按鍙f搷浣滆褰曪紝杞亴杩囩▼鍛戒护涓嬪彂鏃朵娇鐢� + * @param po + * @return + */ + public Long addIntakeOperate(IrIntakeOperate po) { + irIntakeOperateMapper.insert(po); + return po.getId(); + } + + ///** + // * 鏍规嵁鍛戒护ID鏇存柊鍙栨按鍙f搷浣滆褰� + // * @param commandId + // * @param commandResult + // * @return + // */ + //public Integer updateByCommandId(Long commandId, Byte commandResult) { + // return irIntakeOperateMapper.updateByCommandId(commandId, commandResult); + //} + + /** + * 瀹氭椂鍏抽榾寮忚鍒掑紑闃� + * @param automaticClose + * @return + */ + public Map planedOpenTimedClose(AutomaticClose automaticClose, Date startTime, Integer duration) { + Long intakeId = automaticClose.getIntakeId(); + Long vcId = automaticClose.getVcId(); + Date plannedOpenTime = automaticClose.getPlannedOpenTime(); + Integer minutes = automaticClose.getMinutes(); + Long operator = automaticClose.getOperator(); + Byte openType = automaticClose.getOpenType(); + Long comId = new IDLongGenerator().generate(); + + if(openType == 1) { + IrIntakeOperate irIntakeOperate = new IrIntakeOperate(); + irIntakeOperate.setCommandId(comId); + irIntakeOperate.setIntakeId(intakeId); + irIntakeOperate.setStartTime(startTime); + irIntakeOperate.setDuration(duration); + + Long id = addIntakeOperate(irIntakeOperate); + if(id == null) { + Map map = new HashMap<>(); + map.put("success", false); + map.put("msg", "娣诲姞鍙栨按鍙f搷浣滆褰曞け璐�"); + map.put("content", null); + return map; + } + } + + Integer year = Integer.parseInt(String.format("%tY", plannedOpenTime)); + Integer month = Integer.parseInt(String.format("%tm", plannedOpenTime)); + Integer day = Integer.parseInt(String.format("%td", plannedOpenTime)); + Integer hour = Integer.parseInt(String.format("%tH", plannedOpenTime)); + Integer minute = Integer.parseInt(String.format("%tM", plannedOpenTime)); + + /** + * 濡傛灉鍐滄埛閫夋嫨浜嗚櫄鎷熷崱锛屽垯浣跨敤璇ヨ櫄鎷熷崱 + * 濡傛灉鍐滄埛鏈�夋嫨铏氭嫙鍗★紝鍒欐牴鎹彇姘村彛ID鑾峰彇涓庝箣缁戝畾鐨勮櫄鎷熷崱 + * 濡傛灉鍙栨按鍙f病鏈変笌涔嬬粦瀹氱殑铏氭嫙鍗★紝鍒欐彁绀哄啘鎴烽�夋嫨涓�寮犺櫄鎷熷崱 + */ + if(vcId == null) { + vcId = getVcIdByIntakeId(intakeId); + if(vcId == null) { + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, WechatResultCode.PLEASE_SELECT_A_VC.getMessage() + "(" + intakeId + ")"); + + Map map = new HashMap<>(); + map.put("success", false); + map.put("msg", WechatResultCode.PLEASE_SELECT_A_VC.getMessage() + "(" + intakeId + ")"); + map.put("content", null); + return map; + } + } + + // 铏氭嫙鍗D鎹㈣櫄鎷熷崱瀵硅薄 + VoVirtualCard vc = getVcById(vcId); + if(vc == null) { + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, WechatResultCode.PLEASE_SELECT_A_VC.getMessage() + "(" + intakeId + ")"); + + Map map = new HashMap<>(); + map.put("success", false); + map.put("msg", WechatResultCode.PLEASE_SELECT_A_VC.getMessage() + "(" + intakeId + ")"); + map.put("content", null); + return map; + } + String vcNum = vc.getVcNum().toString(); + Double moneyRemain = vc.getMoney(); + + // 鑾峰彇姘翠环 + Double waterPrice = getPrice(); + if(waterPrice == null) { + Map map = new HashMap<>(); + map.put("success", false); + map.put("msg", WechatResultCode.NO_WATER_PRICE.getMessage()); + map.put("content", null); + return map; + } + + // 鍙栨按鍙D鎹㈤榾鎺у櫒鍦板潃鍙婇�氳鍗忚 + JSONObject job_rtu = getRtu(intakeId, null); + if(job_rtu == null) { + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, WechatResultCode.RTU_NOT_EXIST.getMessage() + "(" + intakeId + ")"); + + Map map = new HashMap<>(); + map.put("success", false); + map.put("msg", WechatResultCode.RTU_NOT_EXIST.getMessage()); + map.put("content", null); + return map; + } + String rtuAddr = job_rtu.getString("rtuAddr"); + String protocol = job_rtu.getString("protocol"); + + comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); + + // 鐢熸垚璁㈠崟鍙� + String orderNo = generateOrderNo(); + if(orderNo == null) { + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, WechatResultCode.NO_ORDER_NUMBER.getMessage() + "(" + intakeId + ")"); + + Map map = new HashMap<>(); + map.put("success", false); + map.put("msg", WechatResultCode.NO_ORDER_NUMBER.getMessage()); + map.put("content", null); + return map; + } + + String commandCode = null; + if(protocol.equals(ProtocolConstantV206V202404.protocolName)) { + Map map = new HashMap<>(); + map.put("success", true); + map.put("msg", "寮�闃�鎴愬姛"); + map.put("content", null); + return map; + } else if(protocol.equals(ProtocolConstantV206V1.protocolName) || protocol.equals(ProtocolConstantV206V2.protocolName)) { + // 鑾峰彇鍔熻兘鐮� + commandCode = CodeV1.cd_A1; + + // 鍒涘缓瑙嗗浘 + ComA1Vo param = new ComA1Vo(); + param.setIcCardNo(vcNum); + param.setMoneyRemain(moneyRemain); + param.setWaterPrice(waterPrice); + param.setMinutes(minutes); + param.setYear(year); + param.setMonth(month); + param.setDay(day); + param.setHour(hour); + param.setMinute(minute); + param.setOrderNo(orderNo); + + /** + * 鏋勯�犲懡浠ゃ�佸彂閫佸懡浠ゅ苟澶勭悊璇锋眰缁撴灉鍙婃墽琛岀粨鏋� + * 1 鍑嗗鍙傛暟 + * 2 璋冪敤鍏叡鏂规硶 + */ + Param myParam = new Param(); + myParam.setComId(comId); + myParam.setComType((byte)1); + myParam.setCommandCode(commandCode); + myParam.setCommandName(CodeV1.getCodeName(commandCode)); + myParam.setIntakeId(intakeId); + myParam.setRtuAddr(rtuAddr); + myParam.setProtocol(protocol); + myParam.setVcId(vcId); + myParam.setParam(param); + myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx); + myParam.setOperator(operator); + myParam.setOpenType(openType); + + BaseResponse<Boolean> result = dealWithCommandResult(myParam); + + Map map = new HashMap<>(); + map.put("success", result.isSuccess()); + map.put("msg", result.getMsg()); + map.put("content", result.getContent()); + return map; + } else { + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, "绯荤粺鏆備笉鏀寔璇ュ崗璁�" + "(" + intakeId + ")"); + + Map map = new HashMap<>(); + map.put("success", false); + map.put("msg", "绯荤粺鏆備笉鏀寔璇ュ崗璁�"); + map.put("content", null); + return map; + } + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java index 4d03330..2dc85c6 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java @@ -36,10 +36,7 @@ import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; -import java.util.Date; -import java.util.List; -import java.util.Objects; -import java.util.Optional; +import java.util.*; /** * @author ZhuBaoMin @@ -541,106 +538,123 @@ return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } - Long intakeId = automaticClose.getIntakeId(); - Long vcId = automaticClose.getVcId(); - Date plannedOpenTime = automaticClose.getPlannedOpenTime(); - Integer minutes = automaticClose.getMinutes(); - Long operator = automaticClose.getOperator(); - Long comId = new IDLongGenerator().generate(); - - Integer year = Integer.parseInt(String.format("%tY", plannedOpenTime)); - Integer month = Integer.parseInt(String.format("%tm", plannedOpenTime)); - Integer day = Integer.parseInt(String.format("%td", plannedOpenTime)); - Integer hour = Integer.parseInt(String.format("%tH", plannedOpenTime)); - Integer minute = Integer.parseInt(String.format("%tM", plannedOpenTime)); - - /** - * 濡傛灉鍐滄埛閫夋嫨浜嗚櫄鎷熷崱锛屽垯浣跨敤璇ヨ櫄鎷熷崱 - * 濡傛灉鍐滄埛鏈�夋嫨铏氭嫙鍗★紝鍒欐牴鎹彇姘村彛ID鑾峰彇涓庝箣缁戝畾鐨勮櫄鎷熷崱 - * 濡傛灉鍙栨按鍙f病鏈変笌涔嬬粦瀹氱殑铏氭嫙鍗★紝鍒欐彁绀哄啘鎴烽�夋嫨涓�寮犺櫄鎷熷崱 - */ - if(vcId == null) { - vcId = commandSv.getVcIdByIntakeId(intakeId); - if(vcId == null) { - return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_VC.getMessage()); - } + Map map_result = commandSv.planedOpenTimedClose(automaticClose, null,null); + if(map_result.get("success").equals(false)) { + return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); } + return BaseResponseUtils.buildSuccess(map_result.get("content")) ; - // 铏氭嫙鍗D鎹㈣櫄鎷熷崱瀵硅薄 - VoVirtualCard vc = commandSv.getVcById(vcId); - if(vc == null) { - return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_VC.getMessage()); - } - String vcNum = vc.getVcNum().toString(); - Double moneyRemain = vc.getMoney(); - // 鑾峰彇姘翠环 - Double waterPrice = commandSv.getPrice(); - if(waterPrice == null) { - return BaseResponseUtils.buildErrorMsg(WechatResultCode.NO_WATER_PRICE.getMessage()); - } - - // 鍙栨按鍙D鎹㈤榾鎺у櫒鍦板潃鍙婇�氳鍗忚 - JSONObject job_rtu = getRtu(intakeId, null); - if(job_rtu == null) { - return BaseResponseUtils.buildErrorMsg(WechatResultCode.RTU_NOT_EXIST.getMessage()); - } - String rtuAddr = job_rtu.getString("rtuAddr"); - String protocol = job_rtu.getString("protocol"); - //String orgTag = job_rtu.getString("orgTag"); - //if(orgTag == null) { - // return BaseResponseUtils.buildErrorMsg(WechatResultCode.RTU_NOT_SET_DATA_SOURCE.getMessage()); + //Long intakeId = automaticClose.getIntakeId(); + //Long vcId = automaticClose.getVcId(); + //Date plannedOpenTime = automaticClose.getPlannedOpenTime(); + //Integer minutes = automaticClose.getMinutes(); + //Long operator = automaticClose.getOperator(); + //Long openingId = automaticClose.getOpeningId(); + //Long comId = new IDLongGenerator().generate(); + // + //if(openingId != null) { + // IrIntakeOperate irIntakeOperate = new IrIntakeOperate(); + // irIntakeOperate.setOpeningId(openingId); + // irIntakeOperate.setCommandId(comId); + // System.out.println("------------------------------------------------comId: " + comId); + // irIntakeOperate.setIntakeId(intakeId); + // Long id = commandSv.addIntakeOperate(irIntakeOperate); + // if(id == null) { + // return BaseResponseUtils.buildErrorMsg("娣诲姞鍙栨按鍙f搷浣滆褰曞け璐�"); + // } //} - //comSendUrl = env.getProperty(pro_mw + "." + orgTag + "." + key_mw); - comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); - - // 鐢熸垚璁㈠崟鍙� - String orderNo = generateOrderNo(); - if(orderNo == null) { - return BaseResponseUtils.buildErrorMsg(WechatResultCode.NO_ORDER_NUMBER.getMessage()); - } - - String commandCode = null; - if(protocol.equals(ProtocolConstantV206V202404.protocolName)) { - return BaseResponseUtils.buildSuccess(); - } else if(protocol.equals(ProtocolConstantV206V1.protocolName) || protocol.equals(ProtocolConstantV206V2.protocolName)) { - // 鑾峰彇鍔熻兘鐮� - commandCode = CodeV1.cd_A1; - - // 鍒涘缓瑙嗗浘 - ComA1Vo param = new ComA1Vo(); - param.setIcCardNo(vcNum); - param.setMoneyRemain(moneyRemain); - param.setWaterPrice(waterPrice); - param.setMinutes(minutes); - param.setYear(year); - param.setMonth(month); - param.setDay(day); - param.setHour(hour); - param.setMinute(minute); - param.setOrderNo(orderNo); - - /** - * 鏋勯�犲懡浠ゃ�佸彂閫佸懡浠ゅ苟澶勭悊璇锋眰缁撴灉鍙婃墽琛岀粨鏋� - * 1 鍑嗗鍙傛暟 - * 2 璋冪敤鍏叡鏂规硶 - */ - Param myParam = new Param(); - myParam.setComId(comId); - myParam.setComType((byte)1); - myParam.setCommandCode(commandCode); - myParam.setCommandName(CodeV1.getCodeName(commandCode)); - myParam.setIntakeId(intakeId); - myParam.setRtuAddr(rtuAddr); - myParam.setProtocol(protocol); - myParam.setVcId(vcId); - myParam.setParam(param); - myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx); - myParam.setOperator(operator); - return dealWithCommandResult(myParam); - } else { - return BaseResponseUtils.buildErrorMsg("绯荤粺鏆備笉鏀寔璇ュ崗璁�"); - } + // + //Integer year = Integer.parseInt(String.format("%tY", plannedOpenTime)); + //Integer month = Integer.parseInt(String.format("%tm", plannedOpenTime)); + //Integer day = Integer.parseInt(String.format("%td", plannedOpenTime)); + //Integer hour = Integer.parseInt(String.format("%tH", plannedOpenTime)); + //Integer minute = Integer.parseInt(String.format("%tM", plannedOpenTime)); + // + ///** + // * 濡傛灉鍐滄埛閫夋嫨浜嗚櫄鎷熷崱锛屽垯浣跨敤璇ヨ櫄鎷熷崱 + // * 濡傛灉鍐滄埛鏈�夋嫨铏氭嫙鍗★紝鍒欐牴鎹彇姘村彛ID鑾峰彇涓庝箣缁戝畾鐨勮櫄鎷熷崱 + // * 濡傛灉鍙栨按鍙f病鏈変笌涔嬬粦瀹氱殑铏氭嫙鍗★紝鍒欐彁绀哄啘鎴烽�夋嫨涓�寮犺櫄鎷熷崱 + // */ + //if(vcId == null) { + // vcId = commandSv.getVcIdByIntakeId(intakeId); + // if(vcId == null) { + // return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_VC.getMessage()); + // } + //} + // + //// 铏氭嫙鍗D鎹㈣櫄鎷熷崱瀵硅薄 + //VoVirtualCard vc = commandSv.getVcById(vcId); + //if(vc == null) { + // return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_VC.getMessage()); + //} + //String vcNum = vc.getVcNum().toString(); + //Double moneyRemain = vc.getMoney(); + // + //// 鑾峰彇姘翠环 + //Double waterPrice = commandSv.getPrice(); + //if(waterPrice == null) { + // return BaseResponseUtils.buildErrorMsg(WechatResultCode.NO_WATER_PRICE.getMessage()); + //} + // + //// 鍙栨按鍙D鎹㈤榾鎺у櫒鍦板潃鍙婇�氳鍗忚 + //JSONObject job_rtu = getRtu(intakeId, null); + //if(job_rtu == null) { + // return BaseResponseUtils.buildErrorMsg(WechatResultCode.RTU_NOT_EXIST.getMessage()); + //} + //String rtuAddr = job_rtu.getString("rtuAddr"); + //String protocol = job_rtu.getString("protocol"); + // + //comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); + // + //// 鐢熸垚璁㈠崟鍙� + //String orderNo = generateOrderNo(); + //if(orderNo == null) { + // return BaseResponseUtils.buildErrorMsg(WechatResultCode.NO_ORDER_NUMBER.getMessage()); + //} + // + //String commandCode = null; + //if(protocol.equals(ProtocolConstantV206V202404.protocolName)) { + // return BaseResponseUtils.buildSuccess(); + //} else if(protocol.equals(ProtocolConstantV206V1.protocolName) || protocol.equals(ProtocolConstantV206V2.protocolName)) { + // // 鑾峰彇鍔熻兘鐮� + // commandCode = CodeV1.cd_A1; + // + // // 鍒涘缓瑙嗗浘 + // ComA1Vo param = new ComA1Vo(); + // param.setIcCardNo(vcNum); + // param.setMoneyRemain(moneyRemain); + // param.setWaterPrice(waterPrice); + // param.setMinutes(minutes); + // param.setYear(year); + // param.setMonth(month); + // param.setDay(day); + // param.setHour(hour); + // param.setMinute(minute); + // param.setOrderNo(orderNo); + // + // /** + // * 鏋勯�犲懡浠ゃ�佸彂閫佸懡浠ゅ苟澶勭悊璇锋眰缁撴灉鍙婃墽琛岀粨鏋� + // * 1 鍑嗗鍙傛暟 + // * 2 璋冪敤鍏叡鏂规硶 + // */ + // Param myParam = new Param(); + // myParam.setComId(comId); + // myParam.setComType((byte)1); + // myParam.setCommandCode(commandCode); + // myParam.setCommandName(CodeV1.getCodeName(commandCode)); + // myParam.setIntakeId(intakeId); + // myParam.setRtuAddr(rtuAddr); + // myParam.setProtocol(protocol); + // myParam.setVcId(vcId); + // myParam.setParam(param); + // myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx); + // myParam.setOperator(operator); + // myParam.setOpeningId(openingId); + // return dealWithCommandResult(myParam); + //} else { + // return BaseResponseUtils.buildErrorMsg("绯荤粺鏆備笉鏀寔璇ュ崗璁�"); + //} } /** diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/dto/AutomaticClose.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/dto/AutomaticClose.java index e2fa0b1..9ea6ecd 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/dto/AutomaticClose.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/dto/AutomaticClose.java @@ -37,4 +37,9 @@ * 棰勭敤姘撮噺锛屾嫢鏈夊畾閲忓叧闃� */ private Integer waterAmount; + + /** + * 寮�闃�绫诲瀷锛�1-杞亴 + */ + private Byte openType; } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/dto/DtoBase.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/dto/DtoBase.java index e63cc1c..5692365 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/dto/DtoBase.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/dto/DtoBase.java @@ -1,6 +1,5 @@ package com.dy.pipIrrWechat.command.dto; -import jakarta.validation.constraints.NotNull; import lombok.Data; /** @@ -27,6 +26,6 @@ /** * 鎿嶄綔浜� */ - @NotNull(message = "鎿嶄綔浜轰笉鑳戒负绌�") + //@NotNull(message = "鎿嶄綔浜轰笉鑳戒负绌�") private Long operator; } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java index e2ef8ec..4ef7508 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java @@ -2,26 +2,28 @@ import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; -import com.dy.common.webUtil.QueryResultVo; -import com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan; -import com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule; -import com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule; -import com.dy.pipIrrGlobal.pojoIr.IrPlanOperate; -import com.dy.pipIrrGlobal.voIr.VoIrrigatePlan; +import com.dy.pipIrrGlobal.pojoIr.*; import com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule; +import com.dy.pipIrrGlobal.voIr.VoPlanSimple; +import com.dy.pipIrrWechat.command.CommandSv; +import com.dy.pipIrrWechat.command.dto.AutomaticClose; import com.dy.pipIrrWechat.irrigatePlan.dto.IrrigatePlan; import com.dy.pipIrrWechat.irrigatePlan.dto.IrrigateSchedule; import com.dy.pipIrrWechat.irrigatePlan.dto.PlanSimple; import com.dy.pipIrrWechat.irrigatePlan.enums.OperateTypeENUM; -import com.dy.pipIrrWechat.irrigatePlan.qo.QoIrrigatePlan; 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 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.time.LocalDateTime; +import java.time.ZoneId; import java.util.Date; import java.util.List; import java.util.Objects; @@ -39,6 +41,7 @@ @RequiredArgsConstructor public class IrrigatePlanCtrl { private final IrrigatePlanSv irrigatePlanSv; + private final CommandSv commandSv; /** * 鍒涘缓鐏屾簤璁″垝 @@ -57,19 +60,30 @@ } Long operatorId = planAndSchedule.getOperatorId(); - - // 娣诲姞鐏屾簤璁″垝 - IrIrrigatePlan plan = new IrIrrigatePlan(); - plan.setProjectId(planAndSchedule.getProjectId()); - plan.setPlanName(planAndSchedule.getPlanName()); Byte startupMode = planAndSchedule.getStartupMode(); - plan.setStartupMode(startupMode); - if(startupMode == 1){ - plan.setDuration(planAndSchedule.getDuration()); - }else if(startupMode == 2){ - plan.setPlanStartTime(planAndSchedule.getPlanStartTime()); - plan.setPlanStopTime(planAndSchedule.getPlanStopTime()); + Date planStartTime = planAndSchedule.getPlanStartTime();; + Date planStopTime = null; + + Integer duration = 0; + for(IrrigateSchedule schedule : planAndSchedule.getSchedules()){ + duration = duration + schedule.getDuration(); } + + //if(startupMode == 1){ + // planStartTime = new Date(); + //} + //LocalDateTime startTime = planStartTime.toInstant().atZone(ZoneId.systemDefault()) .toLocalDateTime(); + //startTime = startTime.plusMinutes(5); + //planStartTime = Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()); + //LocalDateTime stopTime = startTime.plusMinutes(duration); + //planStopTime = Date.from(stopTime.atZone(ZoneId.systemDefault()).toInstant()); + + IrIrrigatePlan plan = new IrIrrigatePlan(); + plan.setPlanName(planAndSchedule.getPlanName()); + plan.setStartupMode(startupMode); + plan.setPlanStartTime(planStartTime); + //plan.setPlanStopTime(planStopTime); + plan.setDuration(duration); plan.setPlanState((byte)1); plan.setExecutingState((byte)1); plan.setDeleted(0L); @@ -79,32 +93,38 @@ return BaseResponseUtils.buildErrorMsg("鍒涘缓鐏屾簤璁″垝澶辫触"); } - // 娣诲姞鐏屾簤娆″簭 - if(planId != null){ - for(IrrigateSchedule schedule : planAndSchedule.getSchedules()){ - IrIrrigateSchedule po = new IrIrrigateSchedule(); - po.setPlanId(planId); - po.setGroupId(schedule.getGroupId()); - if(startupMode == 1){ - po.setDuration(schedule.getDuration()); - }else if(startupMode == 2){ - po.setStartTime(schedule.getStartTime()); - po.setStopTime(schedule.getStopTime()); - } - po.setCurrentState((byte)1); - List<Long> intakesData = irrigatePlanSv.getIntakesByGroupId(schedule.getGroupId()); - if(intakesData != null && intakesData.size() > 0){ - String intakeIds = ""; - for(Long intakeId : intakesData){ - intakeIds += intakeId + ","; - } - po.setIntakeIds(intakeIds.substring(0, intakeIds.length() - 1)); - } - Long scheduleId = irrigatePlanSv.addIrrigateSchedule(po); - if(scheduleId == null) { - return BaseResponseUtils.buildErrorMsg("鍒涘缓鐏屾簤璁″垝澶辫触"); - } + // 娣诲姞鐏屾簤娆″簭鍙婅鍒掓搴忓叧鑱旇〃 + //Date scheduleStartTime = null; + Integer sort = 0; + for(IrrigateSchedule schedule : planAndSchedule.getSchedules()){ + IrIrrigateSchedule po = new IrIrrigateSchedule(); + po.setGroupId(schedule.getGroupId()); + + //if(scheduleStartTime == null) { + // scheduleStartTime = planStartTime; + //} + //po.setStartTime(scheduleStartTime); + //// 璁$畻涓嬩竴缁勭殑寮�濮嬫椂闂� + //LocalDateTime LocalscheduleStartTime = scheduleStartTime.toInstant().atZone(ZoneId.systemDefault()) .toLocalDateTime(); + //LocalscheduleStartTime = LocalscheduleStartTime.plusMinutes(schedule.getDuration()); + //scheduleStartTime = Date.from(LocalscheduleStartTime.atZone(ZoneId.systemDefault()).toInstant()); + + po.setDuration(schedule.getDuration()); + po.setCurrentState((byte)1); + Long scheduleId = irrigatePlanSv.addIrrigateSchedule(po); + if(scheduleId == null) { + return BaseResponseUtils.buildErrorMsg("鍒涘缓鐏屾簤璁″垝澶辫触"); } + + IrPlanSchedule planSchedule = new IrPlanSchedule(); + planSchedule.setPlanId(planId); + planSchedule.setScheduleId(scheduleId); + planSchedule.setSort(sort++); + Long planScheduleId = irrigatePlanSv.addPlanSchedule(planSchedule); + if(planScheduleId == null) { + return BaseResponseUtils.buildErrorMsg("鍒涘缓鐏屾簤璁″垝澶辫触"); + } + } // 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍 @@ -135,16 +155,51 @@ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } + Long planId = planSimple.getPlanId(); Long operatorId = planSimple.getOperatorId(); - if(irrigatePlanSv.getPublishedCount(planId) > 0){ - return BaseResponseUtils.buildErrorMsg("璇ョ亴婧夎鍒掑凡鍙戝竷"); + /** + * 鑾峰彇鐏屾簤璁″垝淇℃伅 + * 鏇存柊鐏屾簤璁″垝璧锋鏃堕棿鍙婅鍒掔姸鎬� + */ + VoPlanSimple plan = irrigatePlanSv.getPlanSimple(planId); + if(plan == null){ + return BaseResponseUtils.buildErrorMsg("鎮ㄨ鍙戝竷鐨勮鍒掍笉瀛樺湪锛屾垨璇ヨ鍒掑凡鍙戝竷"); } - // 淇敼鐏屾簤璁″垝鐘舵�佷负鍙戝竷鐘舵�� - if(irrigatePlanSv.publishIrrigatePlan(planId) == 0){ - return BaseResponseUtils.buildErrorMsg("淇敼鐏屾簤璁″垝鐘舵�佸け璐�"); + Byte startupMode = plan.getStartupMode(); + Integer duration = plan.getDuration(); + Date planStartTime = plan.getPlanStartTime(); + Date planStopTime = null; + + if(startupMode == 1){ + planStartTime = new Date(); + } + LocalDateTime startTime = planStartTime.toInstant().atZone(ZoneId.systemDefault()) .toLocalDateTime(); + startTime = startTime.plusMinutes(5); + planStartTime = Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()); + LocalDateTime stopTime = startTime.plusMinutes(duration); + planStopTime = Date.from(stopTime.atZone(ZoneId.systemDefault()).toInstant()); + + if(irrigatePlanSv.updatePlanTimes(planStartTime, planStopTime, planId) == 0) { + return BaseResponseUtils.buildErrorMsg("璁″垝淇℃伅鏇存柊澶辫触"); + } + + // 鏇存柊姣忎釜鐏屾簤娆″簭鐨勫紑濮嬫椂闂� + List<VoIrrigateSchedule> schedules = irrigatePlanSv.getSchedulesByPlanId(planId); + Date scheduleStartTime = null; + Integer sort = 0; + for(VoIrrigateSchedule schedule : schedules){ + if(scheduleStartTime == null) { + scheduleStartTime = planStartTime; + } + irrigatePlanSv.updateScheduleStartTime(schedule.getScheduleId(), scheduleStartTime); + + // 璁$畻涓嬩竴缁勭殑寮�濮嬫椂闂� + LocalDateTime LocalscheduleStartTime = scheduleStartTime.toInstant().atZone(ZoneId.systemDefault()) .toLocalDateTime(); + LocalscheduleStartTime = LocalscheduleStartTime.plusMinutes(schedule.getDuration()); + scheduleStartTime = Date.from(LocalscheduleStartTime.atZone(ZoneId.systemDefault()).toInstant()); } // 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍 @@ -157,30 +212,22 @@ return BaseResponseUtils.buildErrorMsg("娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍澶辫触"); } - /** - * 鐢熸垚寮�闃�璁″垝 - * 璐ф湡璁″垝鍚姩妯″紡 - */ - // 鑾峰彇鐏屾簤璁″垝鍚姩妯″紡 - Byte startupMode = irrigatePlanSv.getStartupMode(planId); - List<VoIrrigateSchedule> schedules = irrigatePlanSv.getIrrigateSchedules(startupMode, planId); - if(schedules == null || schedules.size() == 0) { - return BaseResponseUtils.buildErrorMsg("鏃犲彇姘村彛锛岀敓鎴愬紑闃�璁″垝澶辫触"); - } + schedules = irrigatePlanSv.getSchedulesByPlanId(planId); + for(VoIrrigateSchedule schedule : schedules) { + Long groupId = schedule.getGroupId(); + List<Long> intakeIds = irrigatePlanSv.getIntakeIdsByGroupId(groupId); + for(Long intakeId : intakeIds) { + AutomaticClose automaticClose = new AutomaticClose(); + automaticClose.setIntakeId(intakeId); + automaticClose.setPlannedOpenTime(schedule.getStartTime()); + automaticClose.setMinutes(schedule.getDuration()); + automaticClose.setOperator(operatorId); + automaticClose.setOpenType(Byte.valueOf("1")); - for (VoIrrigateSchedule schedule : schedules) { - for(String intakeId : schedule.getIntakeIds().split(",")){ - // 娣诲姞鐏屾簤璁″垝寮�鍚褰� - IrOpeningSchedule openingSchedule = new IrOpeningSchedule(); - openingSchedule.setScheduleId(schedule.getScheduleId()); - openingSchedule.setIntakeId(Long.parseLong(intakeId)); - openingSchedule.setStartTime(schedule.getStartTime()); - openingSchedule.setDuration(schedule.getDuration()); - if(irrigatePlanSv.addOpeningSchedule(openingSchedule) == 0){ - return BaseResponseUtils.buildErrorMsg("娣诲姞寮�闃�璁″垝澶辫触"); - } + commandSv.planedOpenTimedClose(automaticClose, schedule.getStartTime(), schedule.getDuration()); } } + return BaseResponseUtils.buildSuccess(); } @@ -189,14 +236,14 @@ * @param vo * @return */ - @GetMapping(path = "/getIrrigatePlans") - public BaseResponse<QueryResultVo<List<VoIrrigatePlan>>> getIrrigatePlans(QoIrrigatePlan vo) { - try { - QueryResultVo<List<VoIrrigatePlan>> res = irrigatePlanSv.getIrrigatePlans(vo); - return BaseResponseUtils.buildSuccess(res); - } catch (Exception e) { - log.error("鑾峰彇杞亴缁勮褰曞紓甯�", e); - return BaseResponseUtils.buildException(e.getMessage()); - } - } + //@GetMapping(path = "/getIrrigatePlans") + //public BaseResponse<QueryResultVo<List<VoIrrigatePlan>>> getIrrigatePlans(QoIrrigatePlan vo) { + // try { + // QueryResultVo<List<VoIrrigatePlan>> res = irrigatePlanSv.getIrrigatePlans(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-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java index daa4efb..6367ea5 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java @@ -1,21 +1,18 @@ package com.dy.pipIrrWechat.irrigatePlan; -import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoIr.*; import com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan; import com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule; -import com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule; import com.dy.pipIrrGlobal.pojoIr.IrPlanOperate; -import com.dy.pipIrrGlobal.voIr.VoIrrigatePlan; +import com.dy.pipIrrGlobal.pojoIr.IrPlanSchedule; import com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule; -import com.dy.pipIrrWechat.irrigatePlan.qo.QoIrrigatePlan; +import com.dy.pipIrrGlobal.voIr.VoPlanSimple; 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 ZhuBaoMin @@ -45,6 +42,12 @@ @Autowired private IrIrrigateUnitMapper irIrrigateUnitMapper; + @Autowired + private IrPlanScheduleMapper irPlanScheduleMapper; + + @Autowired + private IrGroupIntakeMapper irGroupIntakeMapper; + /** * 娣诲姞鐏屾簤璁″垝 * @param po @@ -69,37 +72,19 @@ * @param queryVo * @return */ - public QueryResultVo<List<VoIrrigatePlan>> getIrrigatePlans(QoIrrigatePlan queryVo) { - Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); - - Long itemTotal = irrigatePlanMapper.getIrrigatePlanCount(params); - - QueryResultVo<List<VoIrrigatePlan>> rsVo = new QueryResultVo<>(); - rsVo.pageSize = queryVo.pageSize; - rsVo.pageCurr = queryVo.pageCurr; - - rsVo.calculateAndSet(itemTotal, params); - rsVo.obj = irrigatePlanMapper.getIrrigatePlans(params); - return rsVo; - } - - /** - * 鏍规嵁鎸囧畾鐨勮鍒扞D鑾峰彇宸插彂甯冪殑鐏屾簤璁″垝鏁伴噺 - * @param planId - * @return - */ - public Integer getPublishedCount(Long planId) { - return irrigatePlanMapper.getPublishedCount(planId); - } - - /** - * 鍙戝竷鎸囧畾鐨勭亴婧夎鍒� - * @param planId - * @return - */ - public Integer publishIrrigatePlan(Long planId) { - return irrigatePlanMapper.publishIrrigatePlan(planId); - } + //public QueryResultVo<List<VoIrrigatePlan>> getIrrigatePlans(QoIrrigatePlan queryVo) { + // Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + // + // Long itemTotal = irrigatePlanMapper.getIrrigatePlanCount(params); + // + // QueryResultVo<List<VoIrrigatePlan>> rsVo = new QueryResultVo<>(); + // rsVo.pageSize = queryVo.pageSize; + // rsVo.pageCurr = queryVo.pageCurr; + // + // rsVo.calculateAndSet(itemTotal, params); + // rsVo.obj = irrigatePlanMapper.getIrrigatePlans(params); + // return rsVo; + //} /** * 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍 @@ -122,34 +107,74 @@ } /** - * 鏍规嵁璁″垝ID鑾峰彇鐏屾簤娆″簭 + * 鏍规嵁璁″垝ID鑾峰彇鐏屾簤娆″簭璁板綍 * @param planId * @return */ - public List<VoIrrigateSchedule> getIrrigateSchedules(Byte startupMode, Long planId) { - return irIrrigateScheduleMapper.getIrrigateSchedules(startupMode, planId); + public List<VoIrrigateSchedule> getSchedulesByPlanId(Long planId) { + return irIrrigateScheduleMapper.getSchedulesByPlanId(planId); } /** - * 娣诲姞寮�闃�璁″垝 + * 鏍规嵁缁処D鑾峰彇鍙栨按鍙D闆嗗悎 + * @param groupId + * @return + */ + public List<Long> getIntakeIdsByGroupId(Long groupId) { + return irGroupIntakeMapper.getIntakeIdsByGroupId(groupId); + } + + /** + * 娣诲姞璁″垝娆″簭鍏宠仈璁板綍 * @param po * @return */ - public Long addOpeningSchedule(IrOpeningSchedule po) { - irOpeningScheduleMapper.insert(po); + public Long addPlanSchedule(IrPlanSchedule po) { + irPlanScheduleMapper.insert(po); return po.getId(); } /** - * 鏍规嵁杞亴缁処D鑾峰彇鍙栨按鍙D鍒楄〃 - * @param groupId + * 鏍规嵁璁″垝ID鑾峰彇璁″垝绠�鍗曚俊鎭垪琛� + * @param planId * @return */ - public List<Long> getIntakesByGroupId(Long groupId) { - return irIrrigateGroupMapper.getIntakesByGroupId(groupId); + public VoPlanSimple getPlanSimple(Long planId) { + return irrigatePlanMapper.getPlanSimple(planId); } /** + * 鏍规嵁璁″垝ID鏇存柊璁″垝淇℃伅锛堣捣姝㈡椂闂淬�佽鍒掔姸鎬侊級 + * @param planStartTime + * @param planEndTime + * @param planId + * @return + */ + public Integer updatePlanTimes(Date planStartTime, Date planEndTime, Long planId) { + return irrigatePlanMapper.updatePlanTimes(planStartTime, planEndTime, planId); + } + + /** + * 鏍规嵁鐏屾簤娆″簭ID鏇存柊娆″簭寮�濮嬫椂闂� + * @param scheduleId + * @param startTime + * @return + */ + public Integer updateScheduleStartTime(Long scheduleId, Date startTime) { + return irIrrigateScheduleMapper.updateScheduleStartTime(scheduleId, startTime); + } + + ///** + // * 娣诲姞寮�闃�璁″垝 + // * @param po + // * @return + // */ + //public Long addOpeningSchedule(IrOpeningSchedule po) { + // irOpeningScheduleMapper.insert(po); + // return po.getId(); + //} + + /** * 鏍规嵁鐏屾簤鍗曞厓ID鑾峰彇鍙栨按鍙D * @param unitId * @return diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java index c24d70d..7327f5b 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java @@ -1,8 +1,6 @@ package com.dy.pipIrrWechat.irrigatePlan.dto; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.*; import lombok.Data; import java.util.Date; @@ -20,11 +18,6 @@ public static final long serialVersionUID = 202502201511001L; /** - * 椤圭洰ID - */ - private Long projectId; - - /** * 璁″垝鍚嶇О */ @NotBlank(message = "璁″垝鍚嶇О涓嶈兘涓虹┖") @@ -34,22 +27,14 @@ * 璁″垝鍚姩妯″紡锛�1-鎵嬪伐鍚姩锛�2-鑷姩鍚姩 */ @NotNull(message = "璁″垝鍚姩妯″紡涓嶈兘涓虹┖") + @Min(value = 1, message = "璁″垝鍚姩妯″紡涓嶈兘灏忎簬1") + @Max(value = 2, message = "璁″垝鍚姩妯″紡涓嶈兘澶т簬2") private Byte startupMode; /** * 璁″垝鍚姩鏃堕棿 */ private Date planStartTime; - - /** - * 璁″垝鍋滄鏃堕棿 - */ - private Date planStopTime; - - /** - * 璁″垝鎸佺画鏃堕棿 - */ - private Integer duration; /** * 鎿嶄綔浜篒D @@ -60,7 +45,7 @@ /** * 鐏屾簤娆″簭 */ - @NotEmpty(message = "宸℃杞ㄨ抗涓嶈兘涓虹┖") + @NotEmpty(message = "鐏屾簤娆″簭涓嶈兘涓虹┖") private List<IrrigateSchedule> schedules; } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigateSchedule.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigateSchedule.java index 775bcaa..a78e57c 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigateSchedule.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigateSchedule.java @@ -21,14 +21,9 @@ private Long groupId; /** - * 璇ヨ疆鐏岀粍寮�濮嬬亴婧夋椂闂� + * 鐏屾簤寮�濮嬫椂闂� */ private Date startTime; - - /** - * 璇ヨ疆鐏岀粍缁撴潫鐏屾簤鏃堕棿 - */ - private Date stopTime; /** * 璇ヨ疆鐏岀粍鐏屾簤鏃堕暱 diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationCtrl.java index e2ffc0d..474bb55 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationCtrl.java @@ -4,8 +4,9 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.voIr.VoGroupSimple; -import com.dy.pipIrrGlobal.voIr.VoUnitSimple; -import com.dy.pipIrrWechat.irrigation.qo.QoClient; +import com.dy.pipIrrGlobal.voIr.VoProjectSimple; +import com.dy.pipIrrWechat.irrigation.qo.QoGroup; +import com.dy.pipIrrWechat.irrigation.qo.QoProject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; @@ -28,34 +29,35 @@ public class IrrigationCtrl { private final IrrigationSv irrigationSv; + /** - * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛� - * @param vo + * 鏍规嵁鍐滄埛缂栧彿鑾峰彇鐏屾簤鍗曞厓鍒楄〃 + * @param qo * @return */ - @GetMapping(path = "/getGroups") - public BaseResponse<QueryResultVo<List<VoGroupSimple>>> getGroups(QoClient vo) { + @GetMapping(path = "/getSimpleProjects") + public BaseResponse<QueryResultVo<List<VoProjectSimple>>> getSimpleProjects(QoProject qo) { try { - QueryResultVo<List<VoGroupSimple>> res = irrigationSv.getGroupsByClientId(vo); + QueryResultVo<List<VoProjectSimple>> res = irrigationSv.getSimpleProjects(qo); return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { - log.error("鑾峰彇杞亴缁勮褰曞紓甯�", e); + log.error("鑾峰彇椤圭洰璁板綍寮傚父", e); return BaseResponseUtils.buildException(e.getMessage()); } } - /** - * 鏍规嵁鍐滄埛缂栧彿鑾峰彇鐏屾簤鍗曞厓鍒楄〃 - * @param vo - * @return - */ - @GetMapping(path = "/getUnits") - public BaseResponse<QueryResultVo<List<VoUnitSimple>>> getUnits(QoClient vo) { + @GetMapping(path = "/getSimpleGroups") + public BaseResponse<QueryResultVo<List<VoGroupSimple>>> getSimpleGroups(QoGroup qo) { + if(qo.getProjectId() == null) { + return BaseResponseUtils.buildErrorMsg("璇烽�夋嫨椤圭洰"); + } + + try { - QueryResultVo<List<VoUnitSimple>> res = irrigationSv.getUnitsByClientId(vo); + QueryResultVo<List<VoGroupSimple>> res = irrigationSv.getSimpleGroups(qo); return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { - log.error("鑾峰彇鐏屾簤鍗曞厓璁板綍寮傚父", e); + log.error("鑾峰彇杞亴缁勮褰曞紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()); } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java index 55c979c..27e1ccc 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java @@ -1,11 +1,12 @@ package com.dy.pipIrrWechat.irrigation; import com.dy.common.webUtil.QueryResultVo; -import com.dy.pipIrrGlobal.daoIr.IrGroupClientMapper; -import com.dy.pipIrrGlobal.daoIr.IrUnitClientMapper; +import com.dy.pipIrrGlobal.daoIr.IrIrrigateGroupMapper; +import com.dy.pipIrrGlobal.daoIr.IrProjectMapper; import com.dy.pipIrrGlobal.voIr.VoGroupSimple; -import com.dy.pipIrrGlobal.voIr.VoUnitSimple; -import com.dy.pipIrrWechat.irrigation.qo.QoClient; +import com.dy.pipIrrGlobal.voIr.VoProjectSimple; +import com.dy.pipIrrWechat.irrigation.qo.QoGroup; +import com.dy.pipIrrWechat.irrigation.qo.QoProject; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -25,46 +26,41 @@ @Service public class IrrigationSv { @Autowired - private IrGroupClientMapper irGroupClientMapper; + private IrProjectMapper irProjectMapper; @Autowired - private IrUnitClientMapper irUnitClientMapper; + private IrIrrigateGroupMapper irIrrigateGroupMapper; /** - * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛� + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇椤圭洰璁板綍(绮剧畝) * @param queryVo * @return */ - public QueryResultVo<List<VoGroupSimple>> getGroupsByClientId(QoClient queryVo) { + public QueryResultVo<List<VoProjectSimple>> getSimpleProjects(QoProject queryVo) { Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + Long itemTotal = irProjectMapper.getSimpleProjectsCount(params); - Long itemTotal = irGroupClientMapper.getGroupCountByClientId(params); + QueryResultVo<List<VoProjectSimple>> rsVo = new QueryResultVo<>(); + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = irProjectMapper.getSimpleProjects(params); + return rsVo; + } + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇杞亴缁勫垪琛� + * @param queryVo + * @return + */ + public QueryResultVo<List<VoGroupSimple>> getSimpleGroups(QoGroup queryVo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + Long itemTotal = irIrrigateGroupMapper.getSimpleGroupCount(params); QueryResultVo<List<VoGroupSimple>> rsVo = new QueryResultVo<>(); - rsVo.pageSize = queryVo.pageSize; - rsVo.pageCurr = queryVo.pageCurr; rsVo.calculateAndSet(itemTotal, params); - rsVo.obj = irGroupClientMapper.getGroupsByClientId(params); + rsVo.obj = irIrrigateGroupMapper.getSimpleGroups(params); return rsVo; } - /** - * 鏍规嵁鍐滄埛缂栧彿鑾峰彇鐏屾簤鍗曞厓鍒楄〃 - * @param queryVo - * @return - */ - public QueryResultVo<List<VoUnitSimple>> getUnitsByClientId(QoClient queryVo) { - Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); - - Long itemTotal = irUnitClientMapper.getUnitCountByClientId(params); - - QueryResultVo<List<VoUnitSimple>> rsVo = new QueryResultVo<>(); - rsVo.pageSize = queryVo.pageSize; - rsVo.pageCurr = queryVo.pageCurr; - - rsVo.calculateAndSet(itemTotal, params); - rsVo.obj = irUnitClientMapper.getUnitsByClientId(params); - return rsVo; - } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoGroup.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoGroup.java new file mode 100644 index 0000000..8f36321 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoGroup.java @@ -0,0 +1,26 @@ +package com.dy.pipIrrWechat.irrigation.qo; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author ZhuBaoMin + * @date 2025-03-21 9:52 + * @LastEditTime 2025-03-21 9:52 + * @Description 杞亴缁勬煡璇㈠璞★紝鑾峰彇杞亴缁勫垪琛ㄤ娇鐢� + */ + +@Data +@EqualsAndHashCode(callSuper = false) +public class QoGroup { + + /** + * 椤圭洰ID + */ + private Long projectId; + + /** + * 杞亴缁勫悕绉� + */ + private String groupCode; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoProject.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoProject.java new file mode 100644 index 0000000..6d1f026 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/qo/QoProject.java @@ -0,0 +1,17 @@ +package com.dy.pipIrrWechat.irrigation.qo; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author ZhuBaoMin + * @date 2025-03-20 19:48 + * @LastEditTime 2025-03-20 19:48 + * @Description 椤圭洰鏌ヨ瀵硅薄锛岃幏鍙栭」鐩垪琛ㄤ娇鐢� + */ + +@Data +@EqualsAndHashCode(callSuper = false) +public class QoProject { + private String projectName; +} -- Gitblit v1.8.0