Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | public static final String cd_83 = "83" ; //遥测终端定点上报 |
| | | public static final String cd_84 = "84" ; //刷卡开泵/阀上报 |
| | | public static final String cd_85 = "85" ; //刷卡关泵/阀上报 |
| | | public static final String cd_9A = "9A" ; //清除年用水量和年用电量 |
| | | public static final String cd_9A = "9A" ; //查询年用水量 |
| | | public static final String cd_26 = "26" ; //设置设备终端年用水量 |
| | | public static final String cd_21 = "21" ; //设置设备终端IP地址 |
| | | public static final String cd_86 = "86" ; //查询设备终端IP地址 |
| | |
| | | (code.equals(cd_83) ? "遥测终端定点上报" : |
| | | (code.equals(cd_84) ? "刷卡开泵/阀上报" : |
| | | (code.equals(cd_85) ? "刷卡关泵/阀上报" : |
| | | (code.equals(cd_9A) ? "清除年用水量和年用电量" : |
| | | (code.equals(cd_9A) ? "查询年用水量" : |
| | | (code.equals(cd_26) ? "设置设备终端年用水量" : |
| | | (code.equals(cd_21) ? "设置设备终端IP地址" : |
| | | (code.equals(cd_86) ? "查询设备终端IP地址" : |
| | |
| | | public class ComCd26Vo { |
| | | public String controllerType;//控制器类型 01(0x01):测控一体阀;57(0x57):井电控制器 |
| | | public Integer projectNo ;//控制器类型 0x01:测控一体阀;0x57:井电控制器 |
| | | public Integer ipChannel ;//IP通道号 0x01:1通道 0x02:2通道. |
| | | public Integer maxAmountYear ;//设备终端年用水量 单位:m3 整数,取值范围0~99999999 |
| | | } |
| | |
| | | |
| | | |
| | | byte[] bs1 = new byte[7] ; |
| | | index ++ ; |
| | | index = 0; |
| | | GlCreate.createPw(bs1, index); |
| | | |
| | | index += 2 ; |
| | |
| | | |
| | | |
| | | byte[] bs1 = new byte[7] ; |
| | | index ++ ; |
| | | index = 0 ; |
| | | GlCreate.createPw(bs1, index); |
| | | |
| | | index += 2 ; |
| | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsRg) ; |
| | | |
| | | byte[] bs1 = new byte[7] ; |
| | | index ++ ; |
| | | index = 0 ; |
| | | GlCreate.createPw(bs1, index); |
| | | |
| | | index += 2 ; |
| | |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd22Vo为null") ; |
| | | } |
| | | if(cvo.ipChannel != 1 && cvo.ipChannel !=2){ |
| | | throw new Exception("IP通道号只能是1或2") ; |
| | | } |
| | | |
| | | if(cvo.maxAmountYear < 0 || cvo.maxAmountYear > 99999999){ |
| | | throw new Exception("设备终端年用水量必须是0~99999999范围内的整数") ; |
| | | } |
| | | |
| | | byte[] bs = new byte[15] ; |
| | | byte[] bs = new byte[14] ; |
| | | int index = 0 ; |
| | | bs[index] = (byte)(Integer.parseInt(cvo.controllerType, 16)); |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.projectNo.byteValue() ; |
| | | |
| | | index ++ ; |
| | | bs[index] = cvo.ipChannel.byteValue() ; |
| | | |
| | | index ++ ; |
| | | String strTemp = "" + cvo.maxAmountYear ; |
| | |
| | | cdData.ip = ByteUtil.bytes2String_BE(bs, index, index + ipLen - 1) ; |
| | | |
| | | index += ipLen ; |
| | | cdData.port = Integer.parseInt(ByteUtil.bytes2String_LE(bs, index, index + portLen - 1)) ; |
| | | cdData.port = Integer.parseInt(ByteUtil.bytes2String_BE(bs, index, index + portLen - 1)) ; |
| | | } |
| | | |
| | | } |
| | |
| | | short portLen = ByteUtilUnsigned.byte2Byte(bs, index) ; |
| | | |
| | | index++ ; |
| | | cdData.domain = ByteUtil.bytes2String_LE(bs, index, index + domainLen - 1) ; |
| | | cdData.domain = ByteUtil.bytes2String_BE(bs, index, index + domainLen - 1) ; |
| | | |
| | | index += domainLen ; |
| | | cdData.port = Integer.parseInt(ByteUtil.bytes2String_LE(bs, index, index + portLen - 1)) ; |
| | | cdData.port = Integer.parseInt(ByteUtil.bytes2String_BE(bs, index, index + portLen - 1)) ; |
| | | } |
| | | |
| | | } |
| | |
| | | for(int i = 0 ; i < bTempLen; i++){ |
| | | bs[index++] = bTemp[i] ; |
| | | count ++ ; |
| | | if(count >= 4){ |
| | | if(count >= 5){ |
| | | break ; |
| | | } |
| | | } |
| | | for(; count < 4; count++){ |
| | | for(; count < 5; count++){ |
| | | bs[index++] = 0 ; |
| | | } |
| | | |
| | |
| | | cdData.orderNo = ByteUtil.BCD2String_BE(bs, index, index + 7) ; |
| | | |
| | | index += 8 ; |
| | | cdData.opDt = GlParse.parseRtuDt(bs, index) ; |
| | | |
| | | index += 6 ; |
| | | cdData.opType = bs[index]; |
| | | |
| | | index ++ ; |
| | |
| | | if(!NumUtil.isPlusIntNumber(cvo.orderNo)){ |
| | | throw new Exception("订单号必须是16位数字") ; |
| | | } |
| | | if(cvo.orderNo.length() != 12){ |
| | | if(cvo.orderNo.length() != 16){ |
| | | throw new Exception("订单号必须是16位数字") ; |
| | | } |
| | | |
| | |
| | | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.*; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd9AVo; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCdXyVo; |
| | | import com.dy.common.util.ByteUtil; |
| | | import org.apache.logging.log4j.LogManager; |
| | |
| | | */ |
| | | protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { |
| | | DataV202404 dV1 = (DataV202404)data.getSubData() ; |
| | | DataCdXyVo cdData = new DataCdXyVo(CodeV202404.getCodeName(dataCode)) ; |
| | | DataCd9AVo cdData = new DataCd9AVo(CodeV202404.getCodeName(dataCode)) ; |
| | | dV1.subData = cdData ; |
| | | int index = ProtocolConstantV206V202404.dataIndex ; |
| | | cdData.controllerType = ByteUtil.bytes2Hex(bs, false, index, 1) ; |
| | |
| | | cdData.projectNo = (int)bs[index]; |
| | | |
| | | index++ ; |
| | | byte result = bs[index]; |
| | | if(result == 1){ |
| | | cdData.success = true ; |
| | | }else{ |
| | | cdData.success = false ; |
| | | } |
| | | cdData.maxAmountYear = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; |
| | | } |
| | | |
| | | } |
| | |
| | | cdData.success = false ; |
| | | } |
| | | |
| | | if(!cdData.success){ |
| | | return ; |
| | | } |
| | | |
| | | index++ ; |
| | | GlParse.parseRtuDt(bs, index); |
| | | |
| | |
| | | index += 8 ; |
| | | cdData.startDt = GlParse.parseRtuDt(bs, index) ; |
| | | |
| | | if(cdData.opResult == (byte)0x81){ |
| | | //失败了,下面就没有数据了 |
| | | return ; |
| | | } |
| | | |
| | | index += 6 ; |
| | | cdData.endDt = GlParse.parseRtuDt(bs, index) ; |
| | | |
| | |
| | | sb.append(" 水表工作电压 : ") ; |
| | | sb.append(waterMeterWorkVolt == null?"未知":waterMeterWorkVolt) ; |
| | | sb.append("\n") ; |
| | | sb.append(" 信号强度 : ") ; |
| | | sb.append(csq == null?"未知":csq) ; |
| | | sb.append("\n") ; |
| | | return sb.toString() + super.toString() ; |
| | | } |
| | | |
| | |
| | | public Integer projectNo ;//控制器类型 0x01:测控一体阀;0x57:井电控制器 |
| | | public String icCardNo ;//IC卡编号(17位数字) |
| | | public String orderNo ;//订单号(16位数字) |
| | | public String opDt ;//开泵/阀时间(yyyy-mm-dd HH:MM:SS) |
| | | public Byte opType ;//开阀类型: 01:平台开泵/阀 02:用户开泵/阀 |
| | | public Byte opResult ;//开启泵/阀结果: 0x00:成功 0x81:失败 |
| | | |
| | |
| | | sb.append(" 订单号 : ") ; |
| | | sb.append(orderNo == null?"未知":orderNo) ; |
| | | sb.append("\n") ; |
| | | sb.append(" 开泵/阀时间 : ") ; |
| | | sb.append(opDt == null?"未知":opDt) ; |
| | | sb.append("\n") ; |
| | | sb.append(" 开启泵/阀类型 : ") ; |
| | | sb.append(opType == null?"未知":(opType.byteValue() == 0x01 ? "平台":"用户")) ; |
| | | sb.append("\n") ; |
| | | sb.append(" 开启泵/阀结果 : ") ; |
| | | sb.append(opResult == null?"未知":(opResult.byteValue() == 0x00 ? "成功":"失败")) ; |
| | | sb.append(opResult == null?"未知":(opResult.byteValue() == 0x01 ? "成功":"失败")) ; |
| | | sb.append("\n") ; |
| | | return sb.toString() ; |
| | | } |
| | |
| | | sb.append(opType == null?"未知":(opType.byteValue() == 0x00 ? "刷卡":(opType.byteValue() == 0x01 ? "平台":(opType.byteValue() == 0x02 ? "APP":(opType.byteValue() == 0x03 ? "非法卡":(opType.byteValue() == 0x04 ? "水表异常":(opType.byteValue() == 0x05 ? "电表异常":(opType.byteValue() == 0x06 ? "剩余水量不足":(opType.byteValue() == 0x07 ? "剩余金额不足":(opType.byteValue() == 0x08 ? "无流量":(opType.byteValue() == 0x09 ? "掉电再上电":"未知"))))))))))) ; |
| | | sb.append("\n") ; |
| | | sb.append(" 关启泵/阀结果 : ") ; |
| | | sb.append(opResult == null?"未知":(opResult.byteValue() == 0x00 ? "成功":"失败")) ; |
| | | sb.append(opResult == null?"未知":(opResult.byteValue() == 0x01 ? "成功":"失败")) ; |
| | | sb.append("\n") ; |
| | | sb.append(" IC卡地址 : ") ; |
| | | sb.append(icCardAddr == null?"未知":icCardAddr) ; |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V202404.upVos; |
| | | |
| | | import lombok.Data; |
| | | |
| | | //查询设备年用水量 |
| | | @Data |
| | | public class DataCd9AVo { |
| | | |
| | | public String controllerType;//控制器类型 01(0x01):测控一体阀;57(0x57):井电控制器 |
| | | public Integer projectNo ;//控制器类型 0x01:测控一体阀;0x57:井电控制器 |
| | | public Integer maxAmountYear ;//设备终端年用水量 单位:m3 整数,取值范围0~99999999 |
| | | |
| | | public String comName ;//命令名称 |
| | | |
| | | public DataCd9AVo(String comName){ |
| | | this.comName = comName ; |
| | | } |
| | | |
| | | public String toString(){ |
| | | StringBuffer sb = new StringBuffer() ; |
| | | sb.append(" " + comName + " : \n") ; |
| | | sb.append(" 控制器类型 : ") ; |
| | | sb.append(controllerType == null?"未知":(controllerType.equals("01")?"测控一体阀":(controllerType.equals("57")?"井电控制器":"未知"))) ; |
| | | sb.append("\n") ; |
| | | sb.append(" 项目编号 : ") ; |
| | | sb.append(projectNo == null?"未知":projectNo) ; |
| | | sb.append("\n") ; |
| | | sb.append(" 年用水量 : ") ; |
| | | sb.append(maxAmountYear == null?"未知":maxAmountYear) ; |
| | | sb.append("\n") ; |
| | | return sb.toString() ; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.daoIr; |
| | | |
| | | 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; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/24 13:55 |
| | | * @LastEditTime :2024/5/24 13:55 |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface IrCropMapper extends BaseMapper<IrCrop> { |
| | | //增 |
| | | int insertSelective(IrCrop record); |
| | | |
| | | //删 |
| | | int deleteLogicById(Long id); |
| | | |
| | | //改 |
| | | int updateByPrimaryKeySelective(IrCrop record); |
| | | /** |
| | | * 根据指定条件获取项目记录数 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取项目记录 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoCrop> getCrops(Map<?, ?> params); |
| | | |
| | | //查一个 |
| | | VoCropOne selectById(Long id); |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/22 13:41 |
| | |
| | | //增 |
| | | int insertSelective(IrGroupUnit record); |
| | | |
| | | //删 |
| | | int deleteLogicById(Long id); |
| | | |
| | | //删by unitId groupId |
| | | int deleteByUnitIdGroupId(IrGroupUnit record); |
| | |
| | | int deleteByUnitId(Long unitId); |
| | | //删by groupId |
| | | int deleteByGroupId(Long groupId); |
| | | |
| | | //查一个轮灌组绑定的灌溉单元id |
| | | List<Long> getGroupBindUnits(Long groupId); |
| | | //查未绑定轮灌组的灌溉单元id |
| | | List<Long> getNotBindUnits(); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.daoIr; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoIr.IrIrrigateScheduling; |
| | | import com.dy.pipIrrGlobal.voIr.VoScheduling; |
| | | import com.dy.pipIrrGlobal.voIr.VoSchedulingOne; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/27 10:46 |
| | | * @LastEditTime :2024/5/27 10:46 |
| | | * @Description |
| | | */ |
| | | @Mapper |
| | | public interface IrIrrigateSchedulingMapper extends BaseMapper<IrIrrigateScheduling> { |
| | | |
| | | //增 |
| | | int insertSelective(IrIrrigateScheduling record); |
| | | |
| | | //删 |
| | | int deleteLogicById(Long id); |
| | | |
| | | //改 |
| | | int updateByPrimaryKeySelective(IrIrrigateScheduling record); |
| | | |
| | | //查一个 |
| | | VoSchedulingOne selectById(Long id); |
| | | |
| | | /** |
| | | * 根据指定条件获取作物灌溉制度数 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取作物灌溉制度记录 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoScheduling> getSchedulings(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 io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/24 9:43 |
| | | * @LastEditTime :2024/5/24 9:43 |
| | | * @Description |
| | | */ |
| | | |
| | | /** |
| | | * 作物表 |
| | | */ |
| | | @TableName(value="ir_crop", autoResultMap = true) |
| | | @Data |
| | | @ToString |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "作物实体") |
| | | public class IrCrop implements BaseEntity { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 作物名称 |
| | | */ |
| | | @Schema(description = "作物名称", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "作物名称不能为空") |
| | | private String cropName; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 逻辑删除标识;0-未删除,1-删除 |
| | | */ |
| | | @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte deleted; |
| | | } |
| | |
| | | private Date operateDt; |
| | | |
| | | |
| | | /** |
| | | * 逻辑删除标识;0-未删除,1-删除 |
| | | */ |
| | | @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | 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 io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/25 9:41 |
| | | * @LastEditTime :2024/5/25 9:41 |
| | | * @Description |
| | | */ |
| | | /** |
| | | * 灌溉制度表 |
| | | */ |
| | | |
| | | @TableName(value="ir_irrigate_scheduling", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "项目实体") |
| | | public class IrIrrigateScheduling implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202405270901001L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 作物id |
| | | */ |
| | | @Schema(description = "作物id", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "作物id不能为空") |
| | | private Long cropId; |
| | | |
| | | /** |
| | | * 作物生长期 |
| | | */ |
| | | @Schema(description = "作物生长期", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @Length(message = "作物生长期不大于{max}字",max = 10) |
| | | private String growthPeriod; |
| | | |
| | | /** |
| | | * 灌水周期 |
| | | */ |
| | | @Schema(description = "灌水周期", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "灌水周期不能为空") |
| | | private Integer irrigateCycle; |
| | | |
| | | /** |
| | | * 灌水延续时间 |
| | | */ |
| | | @Schema(description = "灌水延续时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "灌水延续时间不能为空") |
| | | private Integer duration; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人ID不能为空") |
| | | private Long operator; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date operateDt; |
| | | |
| | | /** |
| | | * 逻辑删除标识;0-未删除,1-删除 |
| | | */ |
| | | @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte deleted; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voIr; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/25 9:29 |
| | | * @LastEditTime :2024/5/25 9:29 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @Schema(name = "作物视图") |
| | | public class VoCrop implements BaseEntity { |
| | | @Schema(description = "实体id") |
| | | private Long id; |
| | | |
| | | @Schema(description = "作物名称") |
| | | private String cropName; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voIr; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/25 10:00 |
| | | * @LastEditTime :2024/5/25 10:00 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @Schema(name = "作物视图") |
| | | public class VoCropOne implements BaseEntity { |
| | | |
| | | @Schema(description = "实体id") |
| | | private Long id; |
| | | |
| | | @Schema(description = "作物名称") |
| | | private String cropName; |
| | | |
| | | @Schema(description = "备注") |
| | | private String remarks; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voIr; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/27 10:34 |
| | | * @LastEditTime :2024/5/27 10:34 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @Schema(name = "作物灌溉制度视图") |
| | | public class VoScheduling implements BaseEntity { |
| | | |
| | | @Schema(description = "灌溉制度实体id") |
| | | private String id; |
| | | |
| | | @Schema(description = "作物名称") |
| | | private String cropName; |
| | | |
| | | @Schema(description = "作物生长期") |
| | | private String growthPeriod; |
| | | |
| | | @Schema(description = "作物生长期") |
| | | private int irrigateCycle; |
| | | |
| | | @Schema(description = "作物生长期") |
| | | private int duration; |
| | | |
| | | @Schema(description = "备注") |
| | | private String remarks; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voIr; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/27 13:59 |
| | | * @LastEditTime :2024/5/27 13:59 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @Schema(name = "作物灌溉制度视图") |
| | | public class VoSchedulingOne implements BaseEntity { |
| | | |
| | | @Schema(description = "灌溉制度实体id") |
| | | private String id; |
| | | |
| | | @Schema(description = "作物id") |
| | | private String cropId; |
| | | |
| | | @Schema(description = "作物名称") |
| | | private String cropName; |
| | | |
| | | @Schema(description = "作物生长期") |
| | | private String growthPeriod; |
| | | |
| | | @Schema(description = "作物生长期") |
| | | private int irrigateCycle; |
| | | |
| | | @Schema(description = "作物生长期") |
| | | private int duration; |
| | | |
| | | @Schema(description = "备注") |
| | | private String remarks; |
| | | |
| | | @Schema(description = "操作人ID") |
| | | private String operator; |
| | | |
| | | @Schema(description = "操作人名字") |
| | | private String operatorName; |
| | | |
| | | @Schema(description = "操作时间") |
| | | private Date operateDt; |
| | | } |
| | |
| | | public String projectName; |
| | | |
| | | @Schema(description = "轮灌组编码") |
| | | private int groupCode; |
| | | private String groupCode; |
| | | |
| | | @Schema(description = "灌溉单元ID") |
| | | private String unitId; |
| | |
| | | public String projectName; |
| | | |
| | | @Schema(description = "轮灌组编码") |
| | | private int groupCode; |
| | | private String groupCode; |
| | | |
| | | @Schema(description = "灌溉单元ID") |
| | | private String id; |
| | |
| | | username: root |
| | | password: dysql,;.abc!@# |
| | | druid: |
| | | # 数据源名称:当存在多个数据源时,设置名字可以很方便的来进行区分,默认自动生成名称,格式是:"DataSource-" + System.identityHashCode(this) |
| | | name: druid-mysql-pj |
| | | #配置初始化大小、最小、最大 |
| | | initialSize: 1 |
| | | minIdle: 1 |
| | |
| | | username: root |
| | | password: dysql,;.abc!@# |
| | | druid: |
| | | # 数据源名称:当存在多个数据源时,设置名字可以很方便的来进行区分,默认自动生成名称,格式是:"DataSource-" + System.identityHashCode(this) |
| | | name: druid-mysql-ym |
| | | #配置初始化大小、最小、最大 |
| | | initialSize: 1 |
| | | minIdle: 1 |
| | | maxActive: 100 |
| | | #配置获取连接等待超时的时间,单位是毫秒 |
| | | maxWait: 6000 |
| | | initialSize: 10 |
| | | minIdle: 10 |
| | | maxActive: 200 |
| | | # 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁 |
| | | maxWait: 60000 |
| | | #配置间隔多久进行一次检测,检测需要关闭的空闲连接,单位毫秒。 默认是60s,太长可能会导致无法及时检测到连接中断 |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | #配置一个连接在连接池中的最小生存时间、最大生存时间,超过最大生存时间会被移除,单位毫秒。 |
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.IrCropMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrCrop"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ir_crop--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="crop_name" jdbcType="VARCHAR" property="cropName" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, crop_name, remarks, deleted |
| | | </sql> |
| | | <!--添加--> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrCrop"> |
| | | insert into ir_crop |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="cropName != null"> |
| | | crop_name, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="cropName != null"> |
| | | #{cropName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <!--逻辑删除--> |
| | | <delete id="deleteLogicById" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | update ir_crop |
| | | set deleted = 1 |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <!--修改信息--> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrCrop"> |
| | | update ir_crop |
| | | <set> |
| | | <if test="cropName != null"> |
| | | crop_name = #{cropName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="getRecordCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM ir_crop cro |
| | | <where> |
| | | cro.deleted = 0 |
| | | <if test="cropName != null and cropName != ''"> |
| | | AND cro.crop_name LIKE CONCAT('%', #{cropName}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="getCrops" resultType="com.dy.pipIrrGlobal.voIr.VoCrop"> |
| | | SELECT |
| | | CAST(cro.id AS char)AS id, |
| | | cro.crop_name AS cropName |
| | | FROM ir_crop cro |
| | | <where> |
| | | cro.deleted = 0 |
| | | <if test="cropName != null and cropName != ''"> |
| | | AND cro.crop_name LIKE CONCAT('%', #{cropName}, '%') |
| | | </if> |
| | | </where> |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectById" resultType="com.dy.pipIrrGlobal.voIr.VoCropOne"> |
| | | select |
| | | CAST(cro.id AS char)AS id, |
| | | cro.crop_name AS cropName, |
| | | cro.remarks |
| | | from ir_crop cro |
| | | where cro.id = #{id,jdbcType=BIGINT} and cro.deleted = 0 |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | <result column="unit_id" jdbcType="BIGINT" property="unitId" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operate_time" jdbcType="TIMESTAMP" property="operateDt" /> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, group_id, unit_id, `operator`, |
| | | operate_time, deleted |
| | | operate_time |
| | | </sql> |
| | | |
| | | <!--添加--> |
| | |
| | | <if test="operateDt != null"> |
| | | operate_time, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | |
| | | <if test="operateDt != null"> |
| | | #{operateDt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | |
| | | </trim> |
| | | </insert> |
| | | |
| | | <!--逻辑删除--> |
| | | <delete id="deleteLogicById" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | update ir_group_unit |
| | | set deleted = 1 |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | |
| | | <delete id="deleteByUnitIdGroupId" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit"> |
| | | update ir_group_unit |
| | | set deleted = 1,operator = #{operator,jdbcType=BIGINT},operate_time = #{operateDt,jdbcType=TIMESTAMP} |
| | | delete from ir_group_unit |
| | | where group_id = #{groupId,jdbcType=BIGINT} and unit_id = #{unitId,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <delete id="deleteByUnitId"> |
| | | update ir_group_unit |
| | | set deleted = 1 |
| | | delete from ir_group_unit |
| | | where unit_id = #{unitId,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <delete id="deleteByGroupId"> |
| | | update ir_group_unit |
| | | set deleted = 1 |
| | | delete from ir_group_unit |
| | | where group_id = #{groupId,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <!-- //查一个轮灌组绑定的灌溉单元id--> |
| | | <select id="getGroupBindUnits" parameterType="Long" resultType="java.lang.Long"> |
| | | SELECT unit_id AS unitId FROM `ir_group_unit`WHERE group_id = #{groupId,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="getNotBindUnits" resultType="java.lang.Long"> |
| | | SELECT id FROM ir_irrigate_unit WHERE id NOT IN (SELECT unit_id FROM ir_group_unit) |
| | | </select> |
| | | </mapper> |
| | |
| | | left join ir_project pro on pro.id = gro.project_id |
| | | left join se_client cli on cli.id = gro.operator |
| | | left join ir_group_unit gu on gu.group_id = gro.id |
| | | where gro.id = #{id,jdbcType=BIGINT} and gro.deleted = 0 and gu.deleted = 0 and pro.deleted = 0 |
| | | where gro.id = #{id,jdbcType=BIGINT} and gro.deleted = 0 and pro.deleted != 1 |
| | | </select> |
| | | |
| | | <!--分页查轮灌组--> |
| | |
| | | left join se_client cli on cli.id = gro.operator |
| | | left join ir_group_unit gu on gu.group_id = gro.id |
| | | <where> |
| | | gro.deleted = 0 and gu.deleted = 0 and pro.deleted = 0 |
| | | gro.deleted = 0 and pro.deleted != 1 |
| | | <if test="projectName != null and projectName != ''"> |
| | | AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') |
| | | </if> |
| | |
| | | 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} |
| | |
| | | </select> |
| | | <!--分页查轮灌组记录数--> |
| | | <select id="getRecordCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | 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 gu.deleted = 0 and pro.deleted = 0 |
| | | gro.deleted = 0 and pro.deleted != 1 |
| | | <if test="projectName != null and projectName != ''"> |
| | | AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') |
| | | </if> |
| | |
| | | AND gro.group_code = #{groupCode} |
| | | </if> |
| | | </where> |
| | | GROUP BY gro.id |
| | | ) a |
| | | </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.IrIrrigateSchedulingMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrIrrigateScheduling"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ir_irrigate_scheduling--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="crop_id" jdbcType="BIGINT" property="cropId" /> |
| | | <result column="growth_period" jdbcType="VARCHAR" property="growthPeriod" /> |
| | | <result column="irrigate_cycle" jdbcType="INTEGER" property="irrigateCycle" /> |
| | | <result column="duration" jdbcType="INTEGER" property="duration" /> |
| | | <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, crop_id,growth_period,irrigate_cycle,duration, remarks,operator,operate_time, deleted |
| | | </sql> |
| | | <!--添加--> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateScheduling"> |
| | | insert into ir_irrigate_scheduling |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="cropId != null"> |
| | | crop_id, |
| | | </if> |
| | | <if test="growthPeriod != null"> |
| | | growth_period, |
| | | </if> |
| | | <if test="irrigateCycle != null"> |
| | | irrigate_cycle, |
| | | </if> |
| | | <if test="duration != null"> |
| | | duration, |
| | | </if> |
| | | <if test="operator != null"> |
| | | operator, |
| | | </if> |
| | | <if test="operateDt != null"> |
| | | operate_time, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="cropId != null"> |
| | | #{cropId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="growthPeriod != null"> |
| | | #{growthPeriod,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="irrigateCycle != null"> |
| | | #{irrigateCycle,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="duration != null"> |
| | | #{duration,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operateDt != null"> |
| | | #{operateDt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <!--逻辑删除--> |
| | | <delete id="deleteLogicById" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | update ir_irrigate_scheduling |
| | | set deleted = 1 |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <!--修改信息--> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateScheduling"> |
| | | update ir_irrigate_scheduling |
| | | <set> |
| | | <if test="cropId != null"> |
| | | crop_id = #{cropId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="growthPeriod != null"> |
| | | growth_period = #{growthPeriod,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="irrigateCycle != null"> |
| | | irrigate_cycle = #{irrigateCycle,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="duration != null"> |
| | | duration = #{duration,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | operator = #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operateDt != null"> |
| | | operate_time = #{operateDt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="getRecordCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | from ir_irrigate_scheduling sch |
| | | left join ir_crop cro on cro.id = sch.crop_id |
| | | <where> |
| | | sch.deleted = 0 |
| | | <if test="cropName != null and cropName != ''"> |
| | | AND cro.crop_name LIKE CONCAT('%', #{cropName}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="getSchedulings" resultType="com.dy.pipIrrGlobal.voIr.VoScheduling"> |
| | | SELECT |
| | | CAST(sch.id AS char)AS id, |
| | | cro.crop_name AS cropName, |
| | | sch.growth_period AS growthPeriod, |
| | | sch.irrigate_cycle AS irrigateCycle, |
| | | sch.remarks AS remarks, |
| | | sch.duration AS duration |
| | | from ir_irrigate_scheduling sch |
| | | left join ir_crop cro on cro.id = sch.crop_id |
| | | <where> |
| | | sch.deleted = 0 |
| | | <if test="cropName != null and cropName != ''"> |
| | | AND cro.crop_name LIKE CONCAT('%', #{cropName}, '%') |
| | | </if> |
| | | </where> |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectById" resultType="com.dy.pipIrrGlobal.voIr.VoSchedulingOne"> |
| | | select |
| | | CAST(sch.id AS char)AS id, |
| | | CAST(cro.id AS char)AS cropId, |
| | | cro.crop_name AS cropName, |
| | | sch.growth_period AS growthPeriod, |
| | | sch.irrigate_cycle AS irrigateCycle, |
| | | sch.duration AS duration, |
| | | sch.remarks AS remarks, |
| | | CAST(sch.operator AS char)AS operator, |
| | | cli.name AS operatorName, |
| | | sch.operate_time AS operateDt |
| | | from ir_irrigate_scheduling sch |
| | | left join ir_crop cro on cro.id = sch.crop_id |
| | | left join se_client cli on cli.id = sch.operator |
| | | where sch.id = #{id,jdbcType=BIGINT} and sch.deleted = 0 |
| | | </select> |
| | | </mapper> |
| | |
| | | CAST(uni.id AS char)AS id, |
| | | CAST(uni.operator AS char)AS operator, |
| | | cli.name AS operatorName, |
| | | gru.group_code AS groupCode, |
| | | uni.area, |
| | | uni.remarks, |
| | | uni.operate_time AS operateDt |
| | | from ir_irrigate_unit uni |
| | | left join ir_project pro on pro.id = uni.project_id |
| | | left join se_client cli on cli.id = uni.operator |
| | | left join ir_group_unit gu on gu.unit_id = uni.id |
| | | left join ir_irrigate_group gru on gru.id = gu.group_id |
| | | where uni.id = #{id,jdbcType=BIGINT} and uni.deleted = 0 |
| | | </select> |
| | | <!--分页查灌溉单元--> |
| | |
| | | CAST(uni.id AS char)AS unitId, |
| | | CAST(uni.operator AS char)AS operator, |
| | | cli.name AS operatorName, |
| | | gru.group_code AS groupCode, |
| | | uni.area, |
| | | uni.remarks, |
| | | uni.operate_time AS operateDt |
| | | FROM ir_irrigate_unit uni |
| | | left join ir_project pro on pro.id = uni.project_id |
| | | left join se_client cli on cli.id = uni.operator |
| | | left join ir_group_unit gu on gu.unit_id = uni.id |
| | | left join ir_irrigate_group gru on gru.id = gu.group_id |
| | | <where> |
| | | uni.deleted = 0 |
| | | <if test="projectName != null and projectName != ''"> |
| | | AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') |
| | | </if> |
| | | <!-- <if test = "groupCode != null and groupCode != ''">--> |
| | | <!-- AND pro.project_state = #{groupCode}--> |
| | | <!-- </if>--> |
| | | <if test = "groupCode != null and groupCode != ''"> |
| | | AND gru.group_code = #{groupCode} |
| | | </if> |
| | | </where> |
| | | ORDER BY uni.operate_time DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | |
| | | FROM ir_irrigate_unit uni |
| | | left join ir_project pro on pro.id = uni.project_id |
| | | left join se_client cli on cli.id = uni.operator |
| | | left join ir_group_unit gu on gu.unit_id = uni.id |
| | | left join ir_irrigate_group gru on gru.id = gu.group_id |
| | | <where> |
| | | uni.deleted = 0 |
| | | <if test="projectName != null and projectName != ''"> |
| | | AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') |
| | | </if> |
| | | <!-- <if test = "groupCode != null and groupCode != ''">--> |
| | | <!-- AND pro.project_state = #{groupCode}--> |
| | | <!-- </if>--> |
| | | <if test = "groupCode != null and groupCode != ''"> |
| | | AND gru.group_code = #{groupCode} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | username: root |
| | | password: dysql,;.abc!@# |
| | | druid: |
| | | # 说明: 如果你没有指定useSSL=true ,启动项目会报红警告, 环境的问题,要灵活处理 |
| | | #数据源名称:当存在多个数据源时,设置名字可以很方便的来进行区分,默认自动生成名称,格式是:"DataSource-" + System.identityHashCode(this) |
| | | #name: name: druid-mysql-mw-rtu 单数据源不起作用,所以注释掉 |
| | | #配置初始化大小、最小、最大 |
| | | initialSize: 10 |
| | | minIdle: 10 |
| | | maxActive: 200 |
| | | # 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁 |
| | | maxWait: 60000 |
| | |
| | | AppenderRef: #Root的子节点,用来指定该日志输出到哪个Appender. |
| | | - ref: CONSOLE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.Console.ThresholdFilter.level判断是否输出 |
| | | - ref: ROLLING_FILE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.RollingFile.ThresholdFilter.level判断是否输出 |
| | | # 为包配置特殊的Log级别,方便调试, |
| | | # 为类包路径配置特殊的Log级别,方便调试, |
| | | # 不受Loggers.Root.level限制 |
| | | Logger: |
| | | - name: com.dy.pipIrrGlobal.daoBa |
| | |
| | | package com.dy.pipIrrMwTestWeb; |
| | | |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.pipIrrMwTestWeb.test.CommandCtrl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.CommandLineRunner; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | |
| | | @GetMapping(path = "test") |
| | | public BaseResponse<String> test() { |
| | | //return this.connect() ;//连接通信中间件测试 |
| | | //return this.cdXY(CodeV202404.cd_30) ;//发送固定参数XY的命令 |
| | | //return this.cdXY(CodeV202404.cd_9C) ;//发送固定参数XY的命令 |
| | | //return this.cd55(1) ; |
| | | //return this.cd15() ; |
| | | //return this.cd16() ; |
| | | //return this.cd21() ; |
| | | //return this.cd22() ; |
| | | //return this.cd23() ; |
| | | //return this.cd24() ; |
| | | //return this.cd26() ; |
| | | //return this.cd31() ; |
| | | return this.cd92() ; |
| | | //return this.cd86() ; |
| | | //return this.cd87() ; |
| | | //return this.cd92() ; |
| | | //return this.cd93() ; |
| | | return this.cd9C() ; |
| | | } |
| | | |
| | | /** |
| | |
| | | comVo.controllerType = CommandCtrl.controllerType ; |
| | | comVo.projectNo = CommandCtrl.projectNo ; |
| | | comVo.channel = 1 ;//IP通道号(取值范围 1、2). |
| | | comVo.ip = "111.222.123.321" ;//IP(例如 125.235.35.89) |
| | | comVo.port = 60000 ;///端口号(0~65536) |
| | | comVo.ip = "8.140.180.59" ;//IP(例如 125.235.35.89) |
| | | comVo.port = 6001 ;///端口号(0~65536) |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_21, comVo, null)) ; |
| | | } |
| | |
| | | ComCd22Vo comVo = new ComCd22Vo() ; |
| | | comVo.controllerType = CommandCtrl.controllerType ; |
| | | comVo.projectNo = CommandCtrl.projectNo ; |
| | | comVo.maxAmountYear = 12345 ;//机井年最大用水量单位:m3 整数,取值范围0~99999999 |
| | | comVo.limitLevel = 123.4; //水位下限 单位:m 取值范围:0~9999.99 |
| | | comVo.maxAmountYear = 99998888 ;//机井年最大用水量单位:m3 整数,取值范围0~99999999 |
| | | comVo.limitLevel = 9978.60; //水位下限 单位:m 取值范围:0~9999.99 |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_22, comVo, null)) ; |
| | | } |
| | |
| | | comVo.controllerType = CommandCtrl.controllerType ; |
| | | comVo.projectNo = CommandCtrl.projectNo ; |
| | | comVo.channel = 1 ;//IP通道号(取值范围 1、2). |
| | | comVo.domain = "www.baidu.com" ;//域名(例如 dayuyanjiuyuan.to),最大长度42字符 |
| | | comVo.port = 60000 ;///端口号(0~65536) |
| | | comVo.domain = "dayuyanjiuyuan.top" ;//域名(例如 dayuyanjiuyuan.top),最大长度42字符 |
| | | comVo.port = 6001 ;///端口号(0~65536) |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_23, comVo, null)) ; |
| | | } |
| | |
| | | ComCd24Vo comVo = new ComCd24Vo() ; |
| | | comVo.controllerType = CommandCtrl.controllerType ; |
| | | comVo.projectNo = CommandCtrl.projectNo ; |
| | | comVo.registerNo = "102030405060708090" ;//域名(例如 dayuyanjiuyuan.to),最大长度42字符 |
| | | comVo.registerNo = "10203040506070809000" ;// |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_24, comVo, null)) ; |
| | | } |
| | |
| | | ComCd26Vo comVo = new ComCd26Vo() ; |
| | | comVo.controllerType = CommandCtrl.controllerType ; |
| | | comVo.projectNo = CommandCtrl.projectNo ; |
| | | comVo.ipChannel = 1 ;//IP通道号 0x01:1通道 0x02:2通道. |
| | | comVo.maxAmountYear = 123456 ;//设备终端年用水量 单位:m3 整数,取值范围0~99999999 |
| | | comVo.maxAmountYear = 200 ;//设备终端年用水量 单位:m3 整数,取值范围0~99999999 |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_26, comVo, null)) ; |
| | | } |
| | |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_93, comVo, null)) ; |
| | | } |
| | | |
| | | //平台/APP远程关闭水泵/阀门(AFN=0x93H/AFN=0xA3H) |
| | | private BaseResponse cd9C(){ |
| | | ComCd9CVo comVo = new ComCd9CVo() ; |
| | | comVo.controllerType = CommandCtrl.controllerType ; |
| | | comVo.projectNo = CommandCtrl.projectNo ; |
| | | comVo.icCardAddr = "04BEA5BB" ;// |
| | | |
| | | return this.sendCom2Mw(this.command(CodeV202404.cd_9C, comVo, null)) ; |
| | | } |
| | | //平台/APP远程关闭水泵/阀门(AFN=0x93H/AFN=0xA3H) |
| | | private BaseResponse cdA3(){ |
| | | ComCd93_A3Vo comVo = new ComCd93_A3Vo() ; |
New file |
| | |
| | | package com.dy.pipIrrIrrigate.crop; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoIr.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 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; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/24 19:38 |
| | | * @LastEditTime :2024/5/24 19:38 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "作物管理", description = "作物操作") |
| | | @RestController |
| | | @RequestMapping(path = "crop") |
| | | @RequiredArgsConstructor |
| | | public class CropCtrl { |
| | | |
| | | private final CropSv cropSv; |
| | | |
| | | /** |
| | | * 添加作物 |
| | | * |
| | | * @param po 作物实体对象 |
| | | * @param bindingResult |
| | | * @return 添加是否成功 |
| | | */ |
| | | @Operation(summary = "添加作物记录", description = "添加作物记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid IrCrop po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | try { |
| | | Integer rec = Optional.ofNullable(cropSv.addCrop(po)).orElse(0); |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("添加作物异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 逻辑删除作物 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @Operation(summary = "逻辑删除作物", description = "逻辑删除作物") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "delete", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@RequestBody Map map) { |
| | | if (map == null || map.size() <= 0) { |
| | | BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage()); |
| | | } |
| | | Long cropId = Long.parseLong(map.get("id").toString()); |
| | | try { |
| | | Integer rows = cropSv.deleteCrop(cropId); |
| | | if (rows == 0) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("删除作物异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改作物信息 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "修改作物信息", description = "修改作物信息") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid IrCrop po, BindingResult bindingResult){ |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | try { |
| | | Integer rec = Optional.ofNullable(cropSv.updateCrop(po)).orElse(0); |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("修改作物异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得一页作物记录", description = "获得一页作物记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "获得一页作物记录(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "some") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoCrop>>> getCrops(QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoCrop>> res = cropSv.getCrops(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取作物记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取一个作物数据 |
| | | * |
| | | * @return 获取一个作物数据 |
| | | */ |
| | | @Operation(summary = "获取一个作物数据", description = "获取一个作物数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "获取一个作物数据(BaseResponse.content:{})", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = IrProject.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one") |
| | | @SsoAop() |
| | | public BaseResponse<VoCropOne> one(@RequestParam Long id) { |
| | | VoCropOne irCrop = this.cropSv.selectById(id); |
| | | |
| | | return BaseResponseUtils.buildSuccess(irCrop); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrIrrigate.crop; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoIr.IrCropMapper; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoIr.IrCrop; |
| | | import com.dy.pipIrrGlobal.voIr.VoCrop; |
| | | import com.dy.pipIrrGlobal.voIr.VoCropOne; |
| | | import com.dy.pipIrrGlobal.voIr.VoProjectOne; |
| | | import com.dy.pipIrrIrrigate.crop.QueryVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/24 19:38 |
| | | * @LastEditTime :2024/5/24 19:38 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class CropSv { |
| | | |
| | | @Autowired |
| | | private IrCropMapper irCropMapper; |
| | | |
| | | /** |
| | | * 添加项目 |
| | | * |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer addCrop(IrCrop po) { |
| | | po.setDeleted((byte) 0); |
| | | int rows = irCropMapper.insertSelective(po); |
| | | if (rows == 0) { |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | /** |
| | | * 删除项目 |
| | | * |
| | | * @param id |
| | | */ |
| | | public Integer deleteCrop(Long id) { |
| | | int rows = irCropMapper.deleteLogicById(id); |
| | | if (rows == 0) { |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * 修改项目信息 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer updateCrop(IrCrop po){ |
| | | int rows = irCropMapper.updateByPrimaryKeySelective(po); |
| | | if (rows == 0){ |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * 分页查询项目 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoCrop>> getCrops(QueryVo queryVo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | Long itemTotal = irCropMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoCrop>> rsVo = new QueryResultVo<>(); |
| | | rsVo.pageSize = queryVo.pageSize; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = irCropMapper.getCrops(params); |
| | | return rsVo; |
| | | } |
| | | |
| | | /** |
| | | * 获取一个作物数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public VoCropOne selectById(Long id){ |
| | | VoCropOne irCrop = irCropMapper.selectById(id); |
| | | return irCrop; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrIrrigate.crop; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/24 19:53 |
| | | * @LastEditTime :2024/5/24 19:53 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "作物查询条件") |
| | | public class QueryVo extends QueryConditionVo { |
| | | @Schema(description = "作物名称") |
| | | public String cropName; |
| | | } |
| | |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "delete") |
| | | @PostMapping(path = "delete") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete( Long id) { |
| | | if (id == null ) { |
| | | public BaseResponse<Boolean> delete(@RequestBody Map map) { |
| | | if (map == null || map.size() <= 0) { |
| | | BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage()); |
| | | } |
| | | // Long groupId = Long.parseLong(map.get("id").toString()); |
| | | Long groupId = Long.parseLong(map.get("id").toString()); |
| | | try { |
| | | Integer rows = irrigateGroupSv.deleteIrrigateGroup(id); |
| | | Integer rows = irrigateGroupSv.deleteIrrigateGroup(groupId); |
| | | if (rows == 0) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage()); |
| | | } |
| | |
| | | @PostMapping(path = "add_unit", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> addGroupUnit(@RequestBody @Valid IrGroupUnit po, BindingResult bindingResult) { |
| | | public BaseResponse<Boolean> addGroupUnit(@RequestBody @Valid Map<String,Object> po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | Long groupId = Long.parseLong(po.get("groupId").toString()); |
| | | Long operator = Long.parseLong(po.get("operator").toString()); |
| | | List<Long> unitIds = (List<Long>) po.get("unitIds"); |
| | | try { |
| | | Integer rec = Optional.ofNullable(irrigateGroupSv.addGroupUnit(po)).orElse(0); |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); |
| | | for (int i = 0; i < unitIds.size(); i++) { |
| | | Long unitId = unitIds.get(i); |
| | | IrGroupUnit irGroupUnit = new IrGroupUnit(); |
| | | irGroupUnit.setGroupId(groupId); |
| | | irGroupUnit.setUnitId(unitId); |
| | | irGroupUnit.setOperator(operator); |
| | | Integer rec = Optional.ofNullable(irrigateGroupSv.addGroupUnit(irGroupUnit)).orElse(0); |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("轮灌组添加灌溉单元异常", e); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 逻辑删除 轮灌组移除灌溉单元 |
| | | * 轮灌组移除灌溉单元 |
| | | * @param |
| | | * @return |
| | | */ |
| | |
| | | @PostMapping(path = "remove_unit") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> deleteGroupUnit(@RequestBody @Valid IrGroupUnit po, BindingResult bindingResult) { |
| | | public BaseResponse<Boolean> deleteGroupUnit(@RequestBody @Valid Map<String,Object> po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | Long groupId = Long.parseLong(po.get("groupId").toString()); |
| | | Long operator = Long.parseLong(po.get("operator").toString()); |
| | | List<Long> unitIds = (List<Long>) po.get("unitIds"); |
| | | try { |
| | | Integer rec = Optional.ofNullable(irrigateGroupSv.deleteGroupUnit(po)).orElse(0); |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage()); |
| | | for (int i = 0; i < unitIds.size(); i++) { |
| | | Long unitId = unitIds.get(i); |
| | | IrGroupUnit irGroupUnit = new IrGroupUnit(); |
| | | irGroupUnit.setGroupId(groupId); |
| | | irGroupUnit.setUnitId(unitId); |
| | | irGroupUnit.setOperator(operator); |
| | | Integer rec = Optional.ofNullable(irrigateGroupSv.deleteGroupUnit(irGroupUnit)).orElse(0); |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("轮灌组移除灌溉单元异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | @GetMapping(path = "bind_units") |
| | | @SsoAop() |
| | | public BaseResponse<List<Long>> getGroupBindUnits(Long id) { |
| | | try { |
| | | List<Long> res = irrigateGroupSv.getGroupBindUnits(id); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取一个轮灌组绑定灌溉单元记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @GetMapping(path = "notBind_units") |
| | | @SsoAop() |
| | | public BaseResponse<List<Long>> getNotBindUnits() { |
| | | try { |
| | | List<Long> res = irrigateGroupSv.getNotBindUnits(); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取未绑定轮灌组的灌溉单元id记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public Integer addGroupUnit(IrGroupUnit po) { |
| | | po.setOperateDt(new Date()); |
| | | po.setDeleted((byte) 0); |
| | | int rows = irGroupUnitMapper.insertSelective(po); |
| | | if (rows == 0) { |
| | | return 0; |
| | |
| | | * @return |
| | | */ |
| | | public Integer deleteGroupUnit(IrGroupUnit po) { |
| | | po.setOperateDt(new Date()); |
| | | int rows = irGroupUnitMapper.deleteByUnitIdGroupId(po); |
| | | if (rows == 0) { |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * 查一个轮灌组绑定的灌溉单元id |
| | | * @param groupId |
| | | * @return |
| | | */ |
| | | public List<Long> getGroupBindUnits(Long groupId) { |
| | | List<Long> groupBindUnits = irGroupUnitMapper.getGroupBindUnits(groupId); |
| | | return groupBindUnits; |
| | | } |
| | | |
| | | /** |
| | | * //查未绑定轮灌组的灌溉单元id |
| | | * @return |
| | | */ |
| | | public List<Long> getNotBindUnits() { |
| | | List<Long> notBindUnits = irGroupUnitMapper.getNotBindUnits(); |
| | | return notBindUnits; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrIrrigate.irrigateScheduling; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoIr.IrIrrigateSchedulingMapper; |
| | | import com.dy.pipIrrGlobal.pojoIr.IrIrrigateScheduling; |
| | | import com.dy.pipIrrGlobal.voIr.VoScheduling; |
| | | import com.dy.pipIrrGlobal.voIr.VoSchedulingOne; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/27 10:12 |
| | | * @LastEditTime :2024/5/27 10:12 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class IrIrrigateSchedulingSv { |
| | | |
| | | @Autowired |
| | | private IrIrrigateSchedulingMapper irIrrigateSchedulingMapper; |
| | | |
| | | /** |
| | | * 添加作物灌溉制度 |
| | | * |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer addScheduling(IrIrrigateScheduling po) { |
| | | po.setDeleted((byte) 0); |
| | | po.setOperateDt(new Date()); |
| | | int rows = irIrrigateSchedulingMapper.insertSelective(po); |
| | | if (rows == 0) { |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | /** |
| | | * 删除作物灌溉制度 |
| | | * |
| | | * @param id |
| | | */ |
| | | public Integer deleteScheduling(Long id) { |
| | | int rows = irIrrigateSchedulingMapper.deleteLogicById(id); |
| | | if (rows == 0) { |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * 修改作物灌溉制度 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer updateScheduling(IrIrrigateScheduling po){ |
| | | int rows = irIrrigateSchedulingMapper.updateByPrimaryKeySelective(po); |
| | | if (rows == 0){ |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * 分页查询作物灌溉制度 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoScheduling>> getSchedulings(QueryVo queryVo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | Long itemTotal = irIrrigateSchedulingMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoScheduling>> rsVo = new QueryResultVo<>(); |
| | | rsVo.pageSize = queryVo.pageSize; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = irIrrigateSchedulingMapper.getSchedulings(params); |
| | | return rsVo; |
| | | } |
| | | |
| | | /** |
| | | * 获取一个作物灌溉制度数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public VoSchedulingOne selectById(Long id){ |
| | | VoSchedulingOne irCrop = irIrrigateSchedulingMapper.selectById(id); |
| | | return irCrop; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrIrrigate.irrigateScheduling; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoIr.IrIrrigateScheduling; |
| | | import com.dy.pipIrrGlobal.pojoIr.IrProject; |
| | | import com.dy.pipIrrGlobal.voIr.VoScheduling; |
| | | import com.dy.pipIrrGlobal.voIr.VoSchedulingOne; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrIrrigate.result.IrrigateResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/27 10:12 |
| | | * @LastEditTime :2024/5/27 10:12 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "作物灌溉制度管理", description = "作物灌溉制度操作") |
| | | @RestController |
| | | @RequestMapping(path = "scheduling") |
| | | @RequiredArgsConstructor |
| | | public class IrrigateSchedulingCtrl { |
| | | |
| | | private final IrIrrigateSchedulingSv irIrrigateSchedulingSv; |
| | | |
| | | /** |
| | | * 添加作物灌溉制度 |
| | | * |
| | | * @param po 作物灌溉制度实体对象 |
| | | * @param bindingResult |
| | | * @return 添加是否成功 |
| | | */ |
| | | @Operation(summary = "添加作物灌溉制度记录", description = "添加作物灌溉制度记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid IrIrrigateScheduling po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | try { |
| | | Integer rec = Optional.ofNullable(irIrrigateSchedulingSv.addScheduling(po)).orElse(0); |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("添加作物灌溉制度异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | /** |
| | | * 逻辑删除作物灌溉制度 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @Operation(summary = "逻辑删除作物灌溉制度", description = "逻辑删除作物灌溉制度") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "delete", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@RequestBody Map map) { |
| | | if (map == null || map.size() <= 0) { |
| | | BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage()); |
| | | } |
| | | Long schedulingId = Long.parseLong(map.get("id").toString()); |
| | | try { |
| | | Integer rows = irIrrigateSchedulingSv.deleteScheduling(schedulingId); |
| | | if (rows == 0) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("删除作物灌溉制度异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改作物灌溉制度 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "修改作物灌溉制度", description = "修改作物灌溉制度") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid IrIrrigateScheduling po, BindingResult bindingResult){ |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | try { |
| | | Integer rec = Optional.ofNullable(irIrrigateSchedulingSv.updateScheduling(po)).orElse(0); |
| | | if (rec == 0) { |
| | | return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("修改作物灌溉制度异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得一页作物灌溉制度记录", description = "获得一页作物灌溉制度记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "获得一页作物记录(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "some") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoScheduling>>> getSchedulings(QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoScheduling>> res = irIrrigateSchedulingSv.getSchedulings(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取作物灌溉制度记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取一个作物灌溉制度数据 |
| | | * |
| | | * @return 获取一个作物灌溉制度数据 |
| | | */ |
| | | @Operation(summary = "获取一个作物灌溉制度数据", description = "获取一个作物灌溉制度数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "获取一个作物灌溉制度数据(BaseResponse.content:{})", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = IrProject.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one") |
| | | @SsoAop() |
| | | public BaseResponse<VoSchedulingOne> one(@RequestParam Long id) { |
| | | VoSchedulingOne irScheduling = this.irIrrigateSchedulingSv.selectById(id); |
| | | |
| | | return BaseResponseUtils.buildSuccess(irScheduling); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrIrrigate.irrigateScheduling; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/5/27 10:29 |
| | | * @LastEditTime :2024/5/27 10:29 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "作物灌溉制度查询条件") |
| | | public class QueryVo extends QueryConditionVo { |
| | | |
| | | @Schema(description = "作物名称") |
| | | public String cropName; |
| | | } |
| | |
| | | package com.dy.pipIrrIrrigate.irrigateUnit; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoIr.IrGroupUnitMapper; |
| | | import com.dy.pipIrrGlobal.daoIr.IrIrrigateUnitMapper; |
| | | import com.dy.pipIrrGlobal.daoIr.IrProjectMapper; |
| | | import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit; |
| | |
| | | |
| | | @Autowired |
| | | private IrIrrigateUnitMapper irIrrigateUnitMapper; |
| | | @Autowired |
| | | private IrGroupUnitMapper irGroupUnitMapper; |
| | | |
| | | /** |
| | | * 创建灌溉单元 |
| | |
| | | */ |
| | | public Integer deleteUnit(Long id) { |
| | | int rows = irIrrigateUnitMapper.deleteLogicById(id); |
| | | irGroupUnitMapper.deleteByUnitId(id); |
| | | if (rows == 0) { |
| | | return 0; |
| | | } |