Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private PrCommonIntakesMapper prCommonIntakesMapper; |
| | | |
| | | @Autowired |
| | | private IrIntakeOperateMapper irIntakeOperateMapper; |
| | | |
| | | public static ComSupport comSupport; |
| | | |
| | |
| | | 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); |
| | |
| | | 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()); |
| | | } |
| | | |
| | |
| | | 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()); |
| | | } |
| | | |
| | |
| | | rmCommandHistory.setResult((byte) 0); |
| | | rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); |
| | | |
| | | if(openType == 1 ) { |
| | | irIntakeOperateMapper.updateByCommandId(comId, (byte)2, "开阀失败"); |
| | | } |
| | | |
| | | // 开阀失败则解除占用,关阀失败则占用 |
| | | if (comType != null) { |
| | | SeVirtualCard virtualCard = new SeVirtualCard(); |
| | |
| | | rmCommandHistory.setResult((byte) 1); |
| | | rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); |
| | | |
| | | if(openType == 1) { |
| | | irIntakeOperateMapper.updateByCommandId(comId, (byte)1, null); |
| | | } |
| | | |
| | | // 开阀成功则占用,关阀成功不占用 |
| | | if (comType != null) { |
| | | SeVirtualCard virtualCard = new SeVirtualCard(); |
| | |
| | | private Long comId; |
| | | |
| | | /** |
| | | * 命令类型,1-开发,2-关阀 |
| | | * 命令类型,1-开阀,2-关阀 |
| | | */ |
| | | private Byte comType; |
| | | |
| | |
| | | |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 开阀类型;1-轮灌 |
| | | */ |
| | | private Byte openType; |
| | | |
| | | } |
| | |
| | | |
| | | 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; |
| | |
| | | |
| | | int updateByPrimaryKey(IrGroupClient record); |
| | | |
| | | /** |
| | | * 根据农户编号获取轮灌组数量 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getGroupCountByClientId(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据农户编号获取轮灌组列表 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoGroupSimple> getGroupsByClientId(Map<?, ?> params); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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); |
| | | |
| | | /** |
| | | * 根据组ID获取取水口ID集合 |
| | | * @param groupId |
| | | * @return |
| | | */ |
| | | List<Long> getIntakeIdsByGroupId(Long groupId); |
| | | } |
| | |
| | | |
| | | 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; |
New file |
| | |
| | | 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更新取水口操作记录 |
| | | * @param commandId |
| | | * @param commandResult |
| | | * @return |
| | | */ |
| | | int updateByCommandId(@Param("commandId") Long commandId, @Param("commandResult") Byte commandResult, @Param("failureFactors") String failureFactors); |
| | | } |
| | |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | 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 |
| | |
| | | Byte getStartupMode(Long planId); |
| | | |
| | | /** |
| | | * 根据指定的计划ID获取已发布的灌溉计划数量 |
| | | * @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); |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | 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); |
| | | |
| | | } |
| | |
| | | int updateByPrimaryKeySelective(IrOpeningSchedule record); |
| | | |
| | | int updateByPrimaryKey(IrOpeningSchedule record); |
| | | |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
New file |
| | |
| | | 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); |
| | | |
| | | } |
| | |
| | | |
| | | 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); |
| | | |
| | | /** |
| | | * 修改项目状态 |
| | |
| | | * @return |
| | | */ |
| | | List<VoProject> getProjects(Map<?, ?> params); |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取项目记录(精简)数量 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getSimpleProjectsCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取项目记录(精简) |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoProjectSimple> getSimpleProjects(Map<?, ?> params); |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 轮灌组ID |
| | | */ |
| | | @NotNull(message = "轮灌组ID不能为空") |
| | | private Long groupId; |
| | | |
| | | /** |
| | | * 取水口ID |
| | | */ |
| | | @NotNull(message = "取水口ID不能为空") |
| | | private Long intakeId; |
| | | |
| | | } |
New file |
| | |
| | | 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 取水口操作实体类 |
| | | */ |
| | | |
| | | @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; |
| | | |
| | | /** |
| | | * 取水口ID |
| | | */ |
| | | @NotNull(message = "取水口ID不能为空") |
| | | private Long intakeId; |
| | | |
| | | /** |
| | | * 灌溉开始时间 |
| | | */ |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * 灌溉时长 |
| | | */ |
| | | private Integer duration; |
| | | |
| | | /** |
| | | * 命令下发结果;1-成功,2-失败 |
| | | */ |
| | | private Byte commandResult; |
| | | |
| | | /** |
| | | * 失败因素 |
| | | */ |
| | | private String failureFactors; |
| | | |
| | | } |
| | |
| | | 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) |
| | |
| | | @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; |
| | | |
| | | /** |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人ID不能为空") |
| | | * 操作人 |
| | | */ |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date operateDt; |
| | | |
| | | * 操作时间 |
| | | */ |
| | | @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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 项目ID |
| | | */ |
| | | private Long projectId; |
| | | |
| | | /** |
| | | * 计划名称 |
| | | */ |
| | | @NotBlank(message = "计划名称不能为空") |
| | |
| | | /** |
| | | * 计划启动模式;1-手动启动,2-自动启动 |
| | | */ |
| | | @NotNull(message = "计划启动模式不能为空") |
| | | private Byte startupMode; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 灌溉计划ID |
| | | */ |
| | | @NotNull(message = "灌溉计划ID不能为空") |
| | | private Long planId; |
| | | //@NotNull(message = "灌溉计划ID不能为空") |
| | | //private Long planId; |
| | | |
| | | /** |
| | | * 轮灌组ID |
| | |
| | | @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; |
| | | |
| | | /** |
| | | * 灌溉时长;分钟 |
| | |
| | | /** |
| | | * 取水口ID列表 |
| | | */ |
| | | private String intakeIds; |
| | | //private String intakeIds; |
| | | |
| | | /** |
| | | * 当前状态;1-正常,2-暂停,3-终止 |
New file |
| | |
| | | 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; |
| | | } |
| | |
| | | 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) |
| | |
| | | @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; |
| | | |
| | | /** |
| | | * 省ID |
| | | */ |
| | | @Schema(description = "省ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | * 省ID |
| | | */ |
| | | private Long provinceId; |
| | | |
| | | /** |
| | | * 市ID |
| | | */ |
| | | @Schema(description = "市ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | * 市ID |
| | | */ |
| | | private Long cityId; |
| | | |
| | | /** |
| | | * 县ID |
| | | */ |
| | | @Schema(description = "县ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | * 县ID |
| | | */ |
| | | private Long countyId; |
| | | |
| | | /** |
| | | * 镇ID |
| | | */ |
| | | @Schema(description = "镇ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | * 镇ID |
| | | */ |
| | | private Long townId; |
| | | |
| | | /** |
| | | * 村ID |
| | | */ |
| | | @Schema(description = "村ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | * 村ID |
| | | */ |
| | | private Long villageId; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 项目状态;1-启动,2-停止 |
| | | */ |
| | | @Schema(description = "项目状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | * 项目状态;1-启用,2-废弃 |
| | | */ |
| | | private Byte projectState; |
| | | |
| | | /** |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人ID", 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; |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 轮灌组ID |
| | | */ |
| | | @NotNull(message = "轮灌组ID不能为空") |
| | | private Long groupId; |
| | | |
| | | /** |
| | | * 排序 |
| | | */ |
| | | private Integer sort; |
| | | |
| | | } |
| | |
| | | * 轮灌组编码 |
| | | */ |
| | | private String groupCode; |
| | | |
| | | /** |
| | | * 灌溉单元数量 |
| | | */ |
| | | private Integer intakeCount; |
| | | |
| | | /** |
| | | * 默认灌溉时长 |
| | | */ |
| | | private Integer defaultDuration; |
| | | |
| | | /** |
| | | * 排序 |
| | | */ |
| | | private Integer sort; |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | * @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; |
| | | |
| | | /** |
| | | * 轮灌组ID |
| | | */ |
| | | private Long groupId; |
| | | |
| | | /** |
| | | * 灌溉开始时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date startTime; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Integer duration; |
| | | |
| | | /** |
| | | * 取水口ID,多个用逗号隔开 |
| | | */ |
| | | private String intakeIds; |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | |
| | | 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> |
New file |
| | |
| | | <?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> |
| | | |
| | | <!--根据组ID获取取水口ID集合--> |
| | | <select id="getIntakeIdsByGroupId" resultType="java.lang.Long"> |
| | | SELECT |
| | | intake_id AS intakeId |
| | | FROM ir_group_intake |
| | | WHERE group_id = #{groupId} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?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更新取水口操作记录--> |
| | | <update id="updateByCommandId" > |
| | | update ir_intake_operate |
| | | set command_result = #{commandResult}, failure_factors = #{failureFactors} |
| | | where command_id = #{commandId} |
| | | </update> |
| | | </mapper> |
| | |
| | | <?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> |
| | |
| | | <!--@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" /> |
| | |
| | | </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"> |
| | |
| | | </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}) |
| | |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="projectId != null"> |
| | | project_id, |
| | | </if> |
| | | <if test="planName != null"> |
| | | plan_name, |
| | |
| | | <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}, |
| | |
| | | <!--@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> |
| | |
| | | <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}, |
| | |
| | | WHERE id = #{planId} |
| | | </select> |
| | | |
| | | <!--根据指定的计划ID获取已发布的灌溉计划数量--> |
| | | <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> |
| | |
| | | <!--@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--> |
| | |
| | | </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--> |
| | |
| | | <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, |
| | |
| | | <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}, |
| | |
| | | <!--@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}, |
| | |
| | | <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> |
New file |
| | |
| | | <?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> |
New file |
| | |
| | | <?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> |
| | |
| | | <?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> |
| | |
| | | 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; |
| | |
| | | * @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) { |
| | |
| | | * @return |
| | | */ |
| | | public Integer updateIrrigateGroup(IrIrrigateGroup po){ |
| | | po.setOperateDt(new Date()); |
| | | po.setOperateTime(new Date()); |
| | | int rows = irIrrigateGroupMapper.updateByPrimaryKeySelective(po); |
| | | if (rows == 0){ |
| | | return 0; |
| | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | 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; |
| | |
| | | * @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())); |
| | |
| | | * @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())); |
| | |
| | | * @return |
| | | */ |
| | | public Integer updateProjectState(IrProject po){ |
| | | po.setOperateDt(new Date()); |
| | | po.setOperateTime(new Date()); |
| | | int rows = irProjectMapper.updateProjectState(po); |
| | | if (rows == 0){ |
| | | return 0; |
| | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | 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:属性 |
| | |
| | | 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; |
| | |
| | | this.seClientCardMapper = seClientCardMapper; |
| | | this.rmIrrigateProfileMapper = rmIrrigateProfileMapper; |
| | | this.env = env; |
| | | this.irIntakeOperateMapper = irIntakeOperateMapper; |
| | | } |
| | | /** |
| | | * 虚拟卡ID换虚拟卡对象 |
| | |
| | | rsVo.obj = rmIrrigateProfileMapper.getIrrPro(type); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 添加取水口操作记录,轮灌过程命令下发时使用 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Long addIntakeOperate(IrIntakeOperate po) { |
| | | irIntakeOperateMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | ///** |
| | | // * 根据命令ID更新取水口操作记录 |
| | | // * @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", "添加取水口操作记录失败"); |
| | | 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获取与之绑定的虚拟卡 |
| | | * 如果取水口没有与之绑定的虚拟卡,则提示农户选择一张虚拟卡 |
| | | */ |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | // 虚拟卡ID换虚拟卡对象 |
| | | 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; |
| | | } |
| | | |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | 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 |
| | |
| | | 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获取与之绑定的虚拟卡 |
| | | * 如果取水口没有与之绑定的虚拟卡,则提示农户选择一张虚拟卡 |
| | | */ |
| | | 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")) ; |
| | | |
| | | // 虚拟卡ID换虚拟卡对象 |
| | | 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()); |
| | | } |
| | | |
| | | // 取水口ID换阀控器地址及通讯协议 |
| | | 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("添加取水口操作记录失败"); |
| | | // } |
| | | //} |
| | | //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获取与之绑定的虚拟卡 |
| | | // * 如果取水口没有与之绑定的虚拟卡,则提示农户选择一张虚拟卡 |
| | | // */ |
| | | //if(vcId == null) { |
| | | // vcId = commandSv.getVcIdByIntakeId(intakeId); |
| | | // if(vcId == null) { |
| | | // return BaseResponseUtils.buildErrorMsg(WechatResultCode.PLEASE_SELECT_A_VC.getMessage()); |
| | | // } |
| | | //} |
| | | // |
| | | //// 虚拟卡ID换虚拟卡对象 |
| | | //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()); |
| | | //} |
| | | // |
| | | //// 取水口ID换阀控器地址及通讯协议 |
| | | //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("系统暂不支持该协议"); |
| | | //} |
| | | } |
| | | |
| | | /** |
| | |
| | | * 预用水量,拥有定量关阀 |
| | | */ |
| | | private Integer waterAmount; |
| | | |
| | | /** |
| | | * 开阀类型;1-轮灌 |
| | | */ |
| | | private Byte openType; |
| | | } |
| | |
| | | package com.dy.pipIrrWechat.command.dto; |
| | | |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 操作人 |
| | | */ |
| | | @NotNull(message = "操作人不能为空") |
| | | //@NotNull(message = "操作人不能为空") |
| | | private Long operator; |
| | | } |
| | |
| | | |
| | | 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; |
| | |
| | | @RequiredArgsConstructor |
| | | public class IrrigatePlanCtrl { |
| | | private final IrrigatePlanSv irrigatePlanSv; |
| | | private final CommandSv commandSv; |
| | | |
| | | /** |
| | | * 创建灌溉计划 |
| | |
| | | } |
| | | |
| | | 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); |
| | |
| | | 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("创建灌溉计划失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 添加灌溉计划操作记录 |
| | |
| | | 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()); |
| | | } |
| | | |
| | | // 添加灌溉计划操作记录 |
| | |
| | | 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(); |
| | | } |
| | | |
| | |
| | | * @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()); |
| | | // } |
| | | //} |
| | | } |
| | |
| | | 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 |
| | |
| | | @Autowired |
| | | private IrIrrigateUnitMapper irIrrigateUnitMapper; |
| | | |
| | | @Autowired |
| | | private IrPlanScheduleMapper irPlanScheduleMapper; |
| | | |
| | | @Autowired |
| | | private IrGroupIntakeMapper irGroupIntakeMapper; |
| | | |
| | | /** |
| | | * 添加灌溉计划 |
| | | * @param po |
| | |
| | | * @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; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定的计划ID获取已发布的灌溉计划数量 |
| | | * @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; |
| | | //} |
| | | |
| | | /** |
| | | * 添加灌溉计划操作记录 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据计划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); |
| | | } |
| | | |
| | | /** |
| | | * 添加开阀计划 |
| | | * 根据组ID获取取水口ID集合 |
| | | * @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(); |
| | | } |
| | | |
| | | /** |
| | | * 根据轮灌组ID获取取水口ID列表 |
| | | * @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获取取水口ID |
| | | * @param unitId |
| | | * @return |
| | |
| | | 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; |
| | |
| | | public static final long serialVersionUID = 202502201511001L; |
| | | |
| | | /** |
| | | * 项目ID |
| | | */ |
| | | private Long projectId; |
| | | |
| | | /** |
| | | * 计划名称 |
| | | */ |
| | | @NotBlank(message = "计划名称不能为空") |
| | |
| | | * 计划启动模式;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; |
| | | |
| | | /** |
| | | * 操作人ID |
| | |
| | | /** |
| | | * 灌溉次序 |
| | | */ |
| | | @NotEmpty(message = "巡检轨迹不能为空") |
| | | @NotEmpty(message = "灌溉次序不能为空") |
| | | private List<IrrigateSchedule> schedules; |
| | | |
| | | } |
| | |
| | | private Long groupId; |
| | | |
| | | /** |
| | | * 该轮灌组开始灌溉时间 |
| | | * 灌溉开始时间 |
| | | */ |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * 该轮灌组结束灌溉时间 |
| | | */ |
| | | private Date stopTime; |
| | | |
| | | /** |
| | | * 该轮灌组灌溉时长 |
| | |
| | | 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; |
| | |
| | | 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()); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | @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; |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
New file |
| | |
| | | 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; |
| | | } |