Merge remote-tracking branch 'origin/master'
| | |
| | | public class CodeV1_0_1 { |
| | | //功能码为字符串,十六进制数据 |
| | | public static final String cd_02 = "02" ;//遥测站链路检测 |
| | | public static final String cd_10 = "10" ;//设置遥测站终端地址 |
| | | public static final String cd_21 = "21" ;//设置服务端IP和端口 |
| | | public static final String cd_50 = "50" ;//查询遥测站终端地址 |
| | | public static final String cd_66 = "66" ;//查询阀门状态(靳总把该命令设计成召测83功能码数据的命令了,因为这个命令回执没有阀门状态数据域,所以这个命令只能作为召测命令用了) |
| | | public static final String cd_71 = "71" ;//设置工作模式(李天赐制定的协议,当前未实现) |
| | | public static final String cd_83 = "83" ;//遥测站开关阀自报 |
| | | public static final String cd_84 = "84" ;//开阀工作报 |
| | | public static final String cd_92 = "92" ;//遥控启动阀门 |
| | | public static final String cd_93 = "93" ;//遥控关闭阀门 |
| | | public static final String cd_C0 = "C0" ;//遥测站自报实时数据 |
| | | |
| | | public static String getCodeName(String code) { |
| | | String name = (code.equals(cd_02) ? "链路检测" : |
| | | (code.equals(cd_71) ? "查询阀门状态" : |
| | | (code.equals(cd_10) ? "设置遥测站终端地址" : |
| | | (code.equals(cd_21) ? "设置IP和端口" : |
| | | (code.equals(cd_50) ? "查询遥测站终端地址" : |
| | | (code.equals(cd_66) ? "查询阀门状态" : |
| | | (code.equals(cd_71) ? "设置工作模式" : |
| | | (code.equals(cd_83) ? "开关阀自报" : |
| | | (code.equals(cd_84) ? "开阀工作报" : |
| | | (code.equals(cd_92) ? "遥控启动阀门" : |
| | | (code.equals(cd_93) ? "遥控关闭阀门" : |
| | | (code.equals(cd_C0) ? "自报实时数据" : |
| | | ""))))) ; |
| | | ""))))))))))) ; |
| | | return name ; |
| | | } |
| | | |
| | |
| | | return rtuAddrBCD + rtuAddrStr ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分析Rtu地址 |
| | | * @param bs 上行字节数组 |
| | | * @param index 启始位 |
| | | * @return 控制器地址 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public String parseRtuAddr(byte[] bs, int index)throws Exception{ |
| | | String rtuAddrBCD = "" + ByteUtil.BCD2Long_BE(bs, index, index + 2) ; |
| | | String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_BE(bs, index + 3) ; |
| | | while(rtuAddrStr.length() < 4){ |
| | | rtuAddrStr = "0" + rtuAddrStr ; |
| | | } |
| | | return rtuAddrBCD + rtuAddrStr ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分析功能码 |
| | | * @param bs 上行字节数组 |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/25 11:28 |
| | | * @LastEditTime 2023/12/25 11:28 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class DataCd10Vo { |
| | | public String newRtuAddr ; |
| | | |
| | | public String toString(){ |
| | | StringBuilder sb = new StringBuilder() ; |
| | | sb.append(" 设备RTU地址应答:\n"); |
| | | sb.append(" 新地址:"); |
| | | sb.append(newRtuAddr); |
| | | sb.append("\n"); |
| | | |
| | | return sb.toString() ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/25 21:14 |
| | | * @LastEditTime 2023/12/25 21:14 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class DataCd21Vo { |
| | | public String ip ; |
| | | public Integer port ; |
| | | |
| | | public String toString(){ |
| | | StringBuilder sb = new StringBuilder() ; |
| | | sb.append(" 设置IP应答:\n"); |
| | | sb.append(" IP:"); |
| | | sb.append(ip); |
| | | sb.append(" 端口:"); |
| | | sb.append(port); |
| | | sb.append("\n"); |
| | | |
| | | return sb.toString() ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/25 21:14 |
| | | * @LastEditTime 2023/12/25 21:14 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class DataCd92Vo { |
| | | public boolean success; |
| | | |
| | | public String toString(){ |
| | | StringBuilder sb = new StringBuilder() ; |
| | | sb.append(" 开阀应答:\n"); |
| | | sb.append(" 结果:"); |
| | | sb.append(success?"执行":"失败"); |
| | | sb.append("\n"); |
| | | |
| | | return sb.toString() ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/25 21:14 |
| | | * @LastEditTime 2023/12/25 21:14 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class DataCd93Vo { |
| | | public boolean success; |
| | | |
| | | public String toString(){ |
| | | StringBuilder sb = new StringBuilder() ; |
| | | sb.append(" 关阀应答:\n"); |
| | | sb.append(" 结果:"); |
| | | sb.append(success?"执行":"失败"); |
| | | sb.append("\n"); |
| | | |
| | | return sb.toString() ; |
| | | } |
| | | } |
| | |
| | | public String rtuAddr ;//RtuAddr |
| | | |
| | | public DataCd02Vo dataCd02Vo;//链路检测 |
| | | public DataCdC0Vo dataCdC0Vo;//终端自报实时数据 |
| | | public DataCd10Vo dataCd10Vo;//设置RTU地址 |
| | | public DataCd21Vo dataCd21Vo;//设置IP地址 |
| | | public DataCd71Vo dataCd71Vo;//查询阀门状态 |
| | | public DataCd83OpenVo dataCd83OpenVo;//开阀自报 |
| | | public DataCd83CloseVo dataCd83CloseVo;//关阀自报 |
| | | public DataCd84Vo dataCd84Vo;//开阀工作报 |
| | | public DataCd71Vo dataCd71Vo;//查询阀门状态 |
| | | public DataCd92Vo dataCd92Vo;//开阀应答 |
| | | public DataCd93Vo dataCd93Vo;//关阀应答 |
| | | public DataCdC0Vo dataCdC0Vo;//终端自报实时数据 |
| | | |
| | | public String dt ;//通信中间件产生发报时间(yyyy-MM-dd hh:mm:ss) |
| | | |
| | |
| | | if(dataCd02Vo != null){ |
| | | sb.append(dataCd02Vo.toString()) ; |
| | | } |
| | | if(dataCdC0Vo != null){ |
| | | sb.append(dataCdC0Vo.toString()) ; |
| | | if(dataCd10Vo != null){ |
| | | sb.append(dataCd10Vo.toString()) ; |
| | | } |
| | | if(dataCd21Vo != null){ |
| | | sb.append(dataCd21Vo.toString()) ; |
| | | } |
| | | if(dataCd71Vo != null){ |
| | | sb.append(dataCd71Vo.toString()) ; |
| | | } |
| | | if(dataCd83OpenVo != null){ |
| | | sb.append(dataCd83OpenVo.toString()) ; |
| | |
| | | if(dataCd84Vo != null){ |
| | | sb.append(dataCd84Vo.toString()) ; |
| | | } |
| | | if(dataCd71Vo != null){ |
| | | sb.append(dataCd71Vo.toString()) ; |
| | | if(dataCd92Vo != null){ |
| | | sb.append(dataCd92Vo.toString()) ; |
| | | } |
| | | if(dataCd93Vo != null){ |
| | | sb.append(dataCd93Vo.toString()) ; |
| | | } |
| | | if(dataCdC0Vo != null){ |
| | | sb.append(dataCdC0Vo.toString()) ; |
| | | } |
| | | return sb.toString() ; |
| | | } |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.parse; |
| | | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CommonV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ParseParamsForDownV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/25 11:11 |
| | | * @LastEditTime 2023/12/25 11:11 |
| | | * @Description |
| | | */ |
| | | @AnnotationCodeDown(ifAny={ |
| | | CodeV1_0_1.cd_10 |
| | | }) |
| | | public class Cd_10_Down implements CodeParse { |
| | | |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { |
| | | ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; |
| | | byte[] bs = this.doParse(para) ; |
| | | |
| | | MidResultToRtu midRs = new MidResultToRtu() ; |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址(电信平台设备IMEI) |
| | | midRs.commandId = para.commandId ;//命令ID,发起命令的客户端(web端)生成,以匹配命令结果 |
| | | midRs.downCode = para.commandCode ;//下行命令功能码; |
| | | midRs.downBuffer = bs ;//下行命令数据 |
| | | midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//下行命令数据十六进制形式 |
| | | midRs.hasResponse = true ;//是否有应答 |
| | | midRs.maxSendTimes = null ;//命令最大发送次数(当收不到应答时,将重发),如果不设置,命令缓存器进行补充设置 |
| | | midRs.isCachForOffLine = false ;//RTU不在线,命令是否缓存,低功耗时为true |
| | | |
| | | if(isLowPower != null && isLowPower.booleanValue()){ |
| | | //低功耗时,尽快发送 |
| | | midRs.isQuickSend = true ; |
| | | } |
| | | |
| | | return new MidResult[]{midRs} ; |
| | | } |
| | | |
| | | /** |
| | | * 构造下行数据 |
| | | * @param para 参数 |
| | | * @return 字节数组 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public byte[] doParse(ParseParamsForDownV1_0_1 para) throws Exception { |
| | | CommonV1_0_1 commonV1_0_1 = new CommonV1_0_1() ; |
| | | byte[] bytes ; |
| | | byte[] bsHead = new byte[ProtocolConstantV206V1_0_0.lenHead2Code] ; |
| | | byte index = 0 ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = 0 ;//帧长度 |
| | | |
| | | index++ ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = commonV1_0_1.createCtrl((byte)0, (byte)0) ; |
| | | |
| | | index++ ; |
| | | GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); |
| | | index += 5 ; |
| | | |
| | | ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; |
| | | |
| | | if(para.param == null){ |
| | | throw new Exception("未提供命令参数数据,不能构造功能码为" + CodeV1_0_1.cd_10 + "的下行命令") ; |
| | | }else{ |
| | | index = 0 ; |
| | | byte[] bs = new byte[12] ; |
| | | String newRtuAddr = (String)para.param ; |
| | | GlCreate.createRtuAddr(newRtuAddr, bs, index); |
| | | index += 5 ; |
| | | GlCreate.createPw(bs, index); |
| | | index += 2 ; |
| | | GlCreate.createTp(bs, index); |
| | | bytes = ByteUtil.bytesMerge(bsHead, bs) ; |
| | | } |
| | | |
| | | GlCreate.createLen(bytes);//长度放字节数组中 |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC和尾叠加字节数组中 |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail) ; |
| | | |
| | | return bytes ; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.parse; |
| | | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.*; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/25 11:27 |
| | | * @LastEditTime 2023/12/25 11:27 |
| | | * @Description |
| | | */ |
| | | @AnnotationCodeUp(ifAny={ |
| | | CodeV1_0_1.cd_10 |
| | | }) |
| | | public class Cd_10_Up implements CodeParse { |
| | | |
| | | private static final Logger log = LogManager.getLogger(Cd_10_Up.class); |
| | | |
| | | /** |
| | | * 分析上行数据 |
| | | */ |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { |
| | | ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; |
| | | int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; |
| | | if(bsLen > 0){ |
| | | this.doParse(para.upBuffer, |
| | | bsLen, |
| | | para.upCode, |
| | | para.data) ; |
| | | } |
| | | log.info("分析命令应答数据<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU地址=" + para.rtuAddr + ">:\n" + para.data.toString()); |
| | | |
| | | MidResultFromRtu midRs = new MidResultFromRtu() ; |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址 |
| | | midRs.upCode = para.upCode ;//上行数据中的功能码 |
| | | midRs.upHex = para.upHex ;//上行数据十六进制形式 |
| | | midRs.upBuffer = para.upBuffer ;//上行数据字节数组 |
| | | midRs.data = para.data ;//解析后的数据 |
| | | |
| | | midRs.reportOrResponse_trueOrFalse = false ;//命令应答 |
| | | |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse); |
| | | return new MidResult[]{midRs} ; |
| | | } |
| | | /** |
| | | * 执行分析 |
| | | * @param bs 字节数组 |
| | | * @param bsLen 字节长度(总包长,包括包头和包尾) |
| | | * @param dataCode 功能码 |
| | | * @param data 数据 |
| | | * @throws Exception 异常 |
| | | */ |
| | | protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { |
| | | DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; |
| | | DataCd10Vo cdData = new DataCd10Vo() ; |
| | | dV1.dataCd10Vo = cdData ; |
| | | cdData.newRtuAddr = new CommonV1_0_1().parseRtuAddr(bs, ProtocolConstantV206V1_0_0.dataIndex) ; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.parse; |
| | | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CommonV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ParseParamsForDownV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.common.util.ByteUtilUnsigned; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/25 11:37 |
| | | * @LastEditTime 2023/12/25 11:37 |
| | | * @Description |
| | | */ |
| | | @AnnotationCodeDown(ifAny={ |
| | | CodeV1_0_1.cd_21 |
| | | }) |
| | | public class Cd_21_Down implements CodeParse { |
| | | |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { |
| | | ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; |
| | | byte[] bs = this.doParse(para) ; |
| | | |
| | | MidResultToRtu midRs = new MidResultToRtu() ; |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址(电信平台设备IMEI) |
| | | midRs.commandId = para.commandId ;//命令ID,发起命令的客户端(web端)生成,以匹配命令结果 |
| | | midRs.downCode = para.commandCode ;//下行命令功能码; |
| | | midRs.downBuffer = bs ;//下行命令数据 |
| | | midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//下行命令数据十六进制形式 |
| | | midRs.hasResponse = true ;//是否有应答 |
| | | midRs.maxSendTimes = null ;//命令最大发送次数(当收不到应答时,将重发),如果不设置,命令缓存器进行补充设置 |
| | | midRs.isCachForOffLine = false ;//RTU不在线,命令是否缓存,低功耗时为true |
| | | |
| | | if(isLowPower != null && isLowPower.booleanValue()){ |
| | | //低功耗时,尽快发送 |
| | | midRs.isQuickSend = true ; |
| | | } |
| | | |
| | | return new MidResult[]{midRs} ; |
| | | } |
| | | |
| | | /** |
| | | * 构造下行数据 |
| | | * @param para 参数 |
| | | * @return 字节数组 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public byte[] doParse(ParseParamsForDownV1_0_1 para) throws Exception { |
| | | CommonV1_0_1 commonV1_0_1 = new CommonV1_0_1() ; |
| | | byte[] bytes ; |
| | | byte[] bsHead = new byte[ProtocolConstantV206V1_0_0.lenHead2Code] ; |
| | | byte index = 0 ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = 0 ;//帧长度 |
| | | |
| | | index++ ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = commonV1_0_1.createCtrl((byte)0, (byte)0) ; |
| | | |
| | | index++ ; |
| | | GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); |
| | | index += 5 ; |
| | | |
| | | ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; |
| | | |
| | | if(para.param == null){ |
| | | throw new Exception("未提供命令参数数据,不能构造功能码为" + CodeV1_0_1.cd_21 + "的下行命令") ; |
| | | }else{ |
| | | index = 0 ; |
| | | byte[] bs = new byte[14] ; |
| | | String ipPort = (String)para.param ; |
| | | String[] ipPorts = ipPort.split(",") ; |
| | | ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[0]), index++); |
| | | ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[1]), index++); |
| | | ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[2]), index++); |
| | | ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[3]), index++); |
| | | ByteUtilUnsigned.short2Bytes_LE(bs, Integer.parseInt(ipPorts[4]), index); |
| | | index += 2 ; |
| | | GlCreate.createPw(bs, index); |
| | | index += 2 ; |
| | | GlCreate.createTp(bs, index); |
| | | |
| | | bytes = ByteUtil.bytesMerge(bsHead, bs) ; |
| | | } |
| | | |
| | | GlCreate.createLen(bytes);//长度放字节数组中 |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC和尾叠加字节数组中 |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail) ; |
| | | |
| | | return bytes ; |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.parse; |
| | | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.*; |
| | | import com.dy.common.util.ByteUtilUnsigned; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/25 13:40 |
| | | * @LastEditTime 2023/12/25 13:40 |
| | | * @Description |
| | | */ |
| | | @AnnotationCodeUp(ifAny={ |
| | | CodeV1_0_1.cd_21 |
| | | }) |
| | | @SuppressWarnings("unused") |
| | | public class Cd_21_Up implements CodeParse { |
| | | |
| | | private static final Logger log = LogManager.getLogger(Cd_21_Up.class); |
| | | |
| | | /** |
| | | * 分析上行数据 |
| | | */ |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { |
| | | ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; |
| | | int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; |
| | | if(bsLen > 0){ |
| | | this.doParse(para.upBuffer, |
| | | bsLen, |
| | | para.upCode, |
| | | para.data) ; |
| | | } |
| | | log.info("分析命令应答数据<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU地址=" + para.rtuAddr + ">:\n" + para.data.toString()); |
| | | |
| | | MidResultFromRtu midRs = new MidResultFromRtu() ; |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址 |
| | | midRs.upCode = para.upCode ;//上行数据中的功能码 |
| | | midRs.upHex = para.upHex ;//上行数据十六进制形式 |
| | | midRs.upBuffer = para.upBuffer ;//上行数据字节数组 |
| | | midRs.data = para.data ;//解析后的数据 |
| | | |
| | | midRs.reportOrResponse_trueOrFalse = false ;//命令应答 |
| | | |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse); |
| | | return new MidResult[]{midRs} ; |
| | | } |
| | | /** |
| | | * 执行分析 |
| | | * @param bs 字节数组 |
| | | * @param bsLen 字节长度(总包长,包括包头和包尾) |
| | | * @param dataCode 功能码 |
| | | * @param data 数据 |
| | | * @throws Exception 异常 |
| | | */ |
| | | protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { |
| | | DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; |
| | | DataCd21Vo cdData = new DataCd21Vo() ; |
| | | dV1.dataCd21Vo = cdData ; |
| | | short index = ProtocolConstantV206V1_0_0.dataIndex ; |
| | | String ip1 = "" +ByteUtilUnsigned.byte2Byte(bs, index++) ; |
| | | String ip2 = "" +ByteUtilUnsigned.byte2Byte(bs, index++) ; |
| | | String ip3 = "" +ByteUtilUnsigned.byte2Byte(bs, index++) ; |
| | | String ip4 = "" +ByteUtilUnsigned.byte2Byte(bs, index++) ; |
| | | |
| | | cdData.ip = ip1 + "." + ip2 + "." + ip3 + "." + ip4 ; |
| | | |
| | | String port = "" +ByteUtilUnsigned.bytes2Short_LE(bs, index++) ; |
| | | cdData.port = Integer.parseInt(port) ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.parse; |
| | | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CommonV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ParseParamsForDownV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/23 9:35 |
| | | * @LastEditTime 2023/12/23 9:35 |
| | | * @Description |
| | | */ |
| | | @AnnotationCodeDown(ifAny={ |
| | | CodeV1_0_1.cd_66 |
| | | }) |
| | | public class Cd_66_Down implements CodeParse { |
| | | |
| | | //private static Logger log = LogManager.getLogger(Cd_66_Down.class); |
| | | |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { |
| | | ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; |
| | | byte[] bs = this.doParse(para) ; |
| | | |
| | | MidResultToRtu midRs = new MidResultToRtu() ; |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址(电信平台设备IMEI) |
| | | midRs.commandId = para.commandId ;//命令ID,发起命令的客户端(web端)生成,以匹配命令结果 |
| | | midRs.downCode = para.commandCode ;//下行命令功能码; |
| | | midRs.downBuffer = bs ;//下行命令数据 |
| | | midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//下行命令数据十六进制形式 |
| | | midRs.hasResponse = true ;//是否有应答 |
| | | midRs.maxSendTimes = null ;//命令最大发送次数(当收不到应答时,将重发),如果不设置,命令缓存器进行补充设置 |
| | | midRs.isCachForOffLine = false ;//RTU不在线,命令是否缓存,低功耗时为true |
| | | |
| | | if(isLowPower != null && isLowPower.booleanValue()){ |
| | | //低功耗时,尽快发送 |
| | | midRs.isQuickSend = true ; |
| | | } |
| | | |
| | | return new MidResult[]{midRs} ; |
| | | } |
| | | |
| | | /** |
| | | * 构造下行数据 |
| | | * @param para 参数 |
| | | * @return 字节数组 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public byte[] doParse(ParseParamsForDownV1_0_1 para) throws Exception { |
| | | CommonV1_0_1 commonV1_0_1 = new CommonV1_0_1() ; |
| | | byte[] bytes ; |
| | | byte[] bsHead = new byte[ProtocolConstantV206V1_0_0.lenHead2Code] ; |
| | | byte index = 0 ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = 0 ;//帧长度 |
| | | |
| | | index++ ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = commonV1_0_1.createCtrl((byte)0, (byte)0) ; |
| | | |
| | | index++ ; |
| | | GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); |
| | | index += 5 ; |
| | | |
| | | ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; |
| | | |
| | | if(para.param == null){ |
| | | throw new Exception("未提供命令参数数据,不能构造功能码为" + CodeV1_0_1.cd_66 + "的下行命令") ; |
| | | }else{ |
| | | byte flag = ((Integer)para.param).byteValue() ; |
| | | byte[] bs = new byte[]{flag} ; |
| | | bytes = ByteUtil.bytesMerge(bsHead, bs) ; |
| | | } |
| | | |
| | | GlCreate.createLen(bytes);//长度放字节数组中 |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC和尾叠加字节数组中 |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail) ; |
| | | |
| | | return bytes ; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.parse; |
| | | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.*; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/23 9:48 |
| | | * @LastEditTime 2023/12/23 9:48 |
| | | * @Description |
| | | */ |
| | | @AnnotationCodeUp(ifAny={ |
| | | CodeV1_0_1.cd_66 |
| | | }) |
| | | @SuppressWarnings("unused") |
| | | public class Cd_66_Up implements CodeParse { |
| | | |
| | | private static final Logger log = LogManager.getLogger(Cd_66_Up.class); |
| | | |
| | | /** |
| | | * 分析上行数据 |
| | | */ |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { |
| | | ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; |
| | | int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; |
| | | if(bsLen > 0){ |
| | | this.doParse(para.upBuffer, |
| | | bsLen, |
| | | para.upCode, |
| | | para.data) ; |
| | | } |
| | | log.info("分析命令应答数据<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU地址=" + para.rtuAddr + ">:\n" + para.data.toString()); |
| | | |
| | | MidResultFromRtu midRs = new MidResultFromRtu() ; |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址 |
| | | midRs.upCode = para.upCode ;//上行数据中的功能码 |
| | | midRs.upHex = para.upHex ;//上行数据十六进制形式 |
| | | midRs.upBuffer = para.upBuffer ;//上行数据字节数组 |
| | | midRs.data = para.data ;//解析后的数据 |
| | | |
| | | midRs.reportOrResponse_trueOrFalse = false ;//命令应答 |
| | | |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse); |
| | | return new MidResult[]{midRs} ; |
| | | } |
| | | /** |
| | | * 执行分析 |
| | | * @param bs 字节数组 |
| | | * @param bsLen 字节长度(总包长,包括包头和包尾) |
| | | * @param dataCode 功能码 |
| | | * @param data 数据 |
| | | * @throws Exception 异常 |
| | | */ |
| | | protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { |
| | | } |
| | | |
| | | } |
| | |
| | | byte[] bs = this.doParse(para) ; |
| | | |
| | | MidResultToRtu midRs = new MidResultToRtu() ; |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;////rtu返回命令结果 发向目的地web URL |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址(电信平台设备IMEI) |
| | | midRs.commandId = para.commandId ;//命令ID,发起命令的客户端(web端)生成,以匹配命令结果 |
| | |
| | | byte[] bs = this.doParse(para) ; |
| | | |
| | | MidResultToRtu midRs = new MidResultToRtu() ; |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;////rtu返回命令结果 发向目的地web URL |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址(电信平台设备IMEI) |
| | | midRs.commandId = para.commandId ;//命令ID,发起命令的客户端(web端)生成,以匹配命令结果 |
| | |
| | | * @throws Exception 异常 |
| | | */ |
| | | protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { |
| | | short index = ProtocolConstantV206V1_0_0.dataIndex ; |
| | | byte opType = bs[ProtocolConstantV206V1_0_0.dataIndex]; |
| | | if(opType == 1 || opType == 3 || opType == 8){ |
| | | this.doParseOpen(opType, bs, bsLen, dataCode, data); |
| | |
| | | byte[] bs = this.doParse(para) ; |
| | | |
| | | MidResultToRtu midRs = new MidResultToRtu() ; |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;////rtu返回命令结果 发向目的地web URL |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址(电信平台设备IMEI) |
| | | midRs.commandId = para.commandId ;//命令ID,发起命令的客户端(web端)生成,以匹配命令结果 |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.parse; |
| | | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CommonV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ParseParamsForDownV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/26 8:49 |
| | | * @LastEditTime 2023/12/26 8:49 |
| | | * @Description |
| | | */ |
| | | @AnnotationCodeDown(ifAny={ |
| | | CodeV1_0_1.cd_92 |
| | | }) |
| | | public class Cd_92_Down implements CodeParse { |
| | | |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { |
| | | ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; |
| | | byte[] bs = this.doParse(para) ; |
| | | |
| | | MidResultToRtu midRs = new MidResultToRtu() ; |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址(电信平台设备IMEI) |
| | | midRs.commandId = para.commandId ;//命令ID,发起命令的客户端(web端)生成,以匹配命令结果 |
| | | midRs.downCode = para.commandCode ;//下行命令功能码; |
| | | midRs.downBuffer = bs ;//下行命令数据 |
| | | midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//下行命令数据十六进制形式 |
| | | midRs.hasResponse = true ;//是否有应答 |
| | | midRs.maxSendTimes = null ;//命令最大发送次数(当收不到应答时,将重发),如果不设置,命令缓存器进行补充设置 |
| | | midRs.isCachForOffLine = false ;//RTU不在线,命令是否缓存,低功耗时为true |
| | | |
| | | if(isLowPower != null && isLowPower.booleanValue()){ |
| | | //低功耗时,尽快发送 |
| | | midRs.isQuickSend = true ; |
| | | } |
| | | |
| | | return new MidResult[]{midRs} ; |
| | | } |
| | | |
| | | /** |
| | | * 构造下行数据 |
| | | * @param para 参数 |
| | | * @return 字节数组 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public byte[] doParse(ParseParamsForDownV1_0_1 para) throws Exception { |
| | | CommonV1_0_1 commonV1_0_1 = new CommonV1_0_1() ; |
| | | byte[] bytes ; |
| | | byte[] bsHead = new byte[ProtocolConstantV206V1_0_0.lenHead2Code] ; |
| | | byte index = 0 ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = 0 ;//帧长度 |
| | | |
| | | index++ ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = commonV1_0_1.createCtrl((byte)0, (byte)0) ; |
| | | |
| | | index++ ; |
| | | GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); |
| | | index += 5 ; |
| | | |
| | | ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; |
| | | |
| | | if(para.param == null){ |
| | | throw new Exception("未提供命令参数数据,不能构造功能码为" + CodeV1_0_1.cd_92 + "的下行命令") ; |
| | | }else{ |
| | | index = 0 ; |
| | | byte[] bs = new byte[9] ; |
| | | bs[index++] = (byte)0xF0 ; |
| | | GlCreate.createPw(bs, index); |
| | | index += 2 ; |
| | | GlCreate.createTp(bs, index); |
| | | |
| | | bytes = ByteUtil.bytesMerge(bsHead, bs) ; |
| | | } |
| | | |
| | | GlCreate.createLen(bytes);//长度放字节数组中 |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC和尾叠加字节数组中 |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail) ; |
| | | |
| | | return bytes ; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.parse; |
| | | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.*; |
| | | import com.dy.common.util.ByteUtil; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/26 8:49 |
| | | * @LastEditTime 2023/12/26 8:49 |
| | | * @Description |
| | | */ |
| | | @AnnotationCodeUp(ifAny={ |
| | | CodeV1_0_1.cd_92 |
| | | }) |
| | | @SuppressWarnings("unused") |
| | | public class Cd_92_Up implements CodeParse { |
| | | |
| | | private static final Logger log = LogManager.getLogger(Cd_92_Up.class); |
| | | |
| | | /** |
| | | * 分析上行数据 |
| | | */ |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { |
| | | ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; |
| | | int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; |
| | | if(bsLen > 0){ |
| | | this.doParse(para.upBuffer, |
| | | bsLen, |
| | | para.upCode, |
| | | para.data) ; |
| | | } |
| | | log.info("分析上行数据<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU地址=" + para.rtuAddr + ">:\n" + para.data.toString()); |
| | | |
| | | MidResultFromRtu midRs = new MidResultFromRtu() ; |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址 |
| | | midRs.upCode = para.upCode ;//上行数据中的功能码 |
| | | midRs.upHex = para.upHex ;//上行数据十六进制形式 |
| | | midRs.upBuffer = para.upBuffer ;//上行数据字节数组 |
| | | midRs.data = para.data ;//解析后的数据 |
| | | |
| | | midRs.reportOrResponse_trueOrFalse = false ;//主动上报 |
| | | |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse); |
| | | return new MidResult[]{midRs} ; |
| | | } |
| | | /** |
| | | * 执行分析 |
| | | * @param bs 字节数组 |
| | | * @param bsLen 字节长度(总包长,包括包头和包尾) |
| | | * @param dataCode 功能码 |
| | | * @param data 数据 |
| | | * @throws Exception 异常 |
| | | */ |
| | | protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { |
| | | DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; |
| | | DataCd92Vo cdData = new DataCd92Vo() ; |
| | | dV1.dataCd92Vo = cdData ; |
| | | String bin = ByteUtil.byte2Binary(bs[ProtocolConstantV206V1_0_0.dataIndex]); |
| | | if(bin.startsWith("1010")){ |
| | | cdData.success = true ; |
| | | }else{ |
| | | cdData.success = false ; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.parse; |
| | | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.CommonV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ParseParamsForDownV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/26 8:50 |
| | | * @LastEditTime 2023/12/26 8:50 |
| | | * @Description |
| | | */ |
| | | @AnnotationCodeDown(ifAny={ |
| | | CodeV1_0_1.cd_93 |
| | | }) |
| | | public class Cd_93_Down implements CodeParse { |
| | | |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { |
| | | ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; |
| | | byte[] bs = this.doParse(para) ; |
| | | |
| | | MidResultToRtu midRs = new MidResultToRtu() ; |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址(电信平台设备IMEI) |
| | | midRs.commandId = para.commandId ;//命令ID,发起命令的客户端(web端)生成,以匹配命令结果 |
| | | midRs.downCode = para.commandCode ;//下行命令功能码; |
| | | midRs.downBuffer = bs ;//下行命令数据 |
| | | midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//下行命令数据十六进制形式 |
| | | midRs.hasResponse = true ;//是否有应答 |
| | | midRs.maxSendTimes = null ;//命令最大发送次数(当收不到应答时,将重发),如果不设置,命令缓存器进行补充设置 |
| | | midRs.isCachForOffLine = false ;//RTU不在线,命令是否缓存,低功耗时为true |
| | | |
| | | if(isLowPower != null && isLowPower.booleanValue()){ |
| | | //低功耗时,尽快发送 |
| | | midRs.isQuickSend = true ; |
| | | } |
| | | |
| | | return new MidResult[]{midRs} ; |
| | | } |
| | | |
| | | /** |
| | | * 构造下行数据 |
| | | * @param para 参数 |
| | | * @return 字节数组 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public byte[] doParse(ParseParamsForDownV1_0_1 para) throws Exception { |
| | | CommonV1_0_1 commonV1_0_1 = new CommonV1_0_1() ; |
| | | byte[] bytes ; |
| | | byte[] bsHead = new byte[ProtocolConstantV206V1_0_0.lenHead2Code] ; |
| | | byte index = 0 ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = 0 ;//帧长度 |
| | | |
| | | index++ ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = commonV1_0_1.createCtrl((byte)0, (byte)0) ; |
| | | |
| | | index++ ; |
| | | GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); |
| | | index += 5 ; |
| | | |
| | | ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; |
| | | |
| | | if(para.param == null){ |
| | | throw new Exception("未提供命令参数数据,不能构造功能码为" + CodeV1_0_1.cd_93 + "的下行命令") ; |
| | | }else{ |
| | | index = 0 ; |
| | | byte[] bs = new byte[9] ; |
| | | bs[index++] = (byte)0xF0 ; |
| | | GlCreate.createPw(bs, index); |
| | | index += 2 ; |
| | | GlCreate.createTp(bs, index); |
| | | |
| | | bytes = ByteUtil.bytesMerge(bsHead, bs) ; |
| | | } |
| | | |
| | | GlCreate.createLen(bytes);//长度放字节数组中 |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC和尾叠加字节数组中 |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail) ; |
| | | |
| | | return bytes ; |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.dy.common.mw.protocol.p206V1_0_0.parse; |
| | | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.*; |
| | | import com.dy.common.util.ByteUtil; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/26 8:49 |
| | | * @LastEditTime 2023/12/26 8:49 |
| | | * @Description |
| | | */ |
| | | @AnnotationCodeUp(ifAny={ |
| | | CodeV1_0_1.cd_93 |
| | | }) |
| | | @SuppressWarnings("unused") |
| | | public class Cd_93_Up implements CodeParse { |
| | | |
| | | private static final Logger log = LogManager.getLogger(Cd_93_Up.class); |
| | | |
| | | /** |
| | | * 分析上行数据 |
| | | */ |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { |
| | | ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; |
| | | int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; |
| | | if(bsLen > 0){ |
| | | this.doParse(para.upBuffer, |
| | | bsLen, |
| | | para.upCode, |
| | | para.data) ; |
| | | } |
| | | log.info("分析上行数据<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU地址=" + para.rtuAddr + ">:\n" + para.data.toString()); |
| | | |
| | | MidResultFromRtu midRs = new MidResultFromRtu() ; |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址 |
| | | midRs.upCode = para.upCode ;//上行数据中的功能码 |
| | | midRs.upHex = para.upHex ;//上行数据十六进制形式 |
| | | midRs.upBuffer = para.upBuffer ;//上行数据字节数组 |
| | | midRs.data = para.data ;//解析后的数据 |
| | | |
| | | midRs.reportOrResponse_trueOrFalse = false ;//主动上报 |
| | | |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse); |
| | | return new MidResult[]{midRs} ; |
| | | } |
| | | /** |
| | | * 执行分析 |
| | | * @param bs 字节数组 |
| | | * @param bsLen 字节长度(总包长,包括包头和包尾) |
| | | * @param dataCode 功能码 |
| | | * @param data 数据 |
| | | * @throws Exception 异常 |
| | | */ |
| | | protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { |
| | | DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; |
| | | DataCd93Vo cdData = new DataCd93Vo() ; |
| | | dV1.dataCd93Vo = cdData ; |
| | | String bin = ByteUtil.byte2Binary(bs[ProtocolConstantV206V1_0_0.dataIndex]); |
| | | if(bin.startsWith("1010")){ |
| | | cdData.success = true ; |
| | | }else{ |
| | | cdData.success = false ; |
| | | } |
| | | } |
| | | } |
| | |
| | | byte[] bs = this.doParse(para) ; |
| | | |
| | | MidResultToRtu midRs = new MidResultToRtu() ; |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;////rtu返回命令结果 发向目的地web URL |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址(电信平台设备IMEI) |
| | | midRs.commandId = para.commandId ;//命令ID,发起命令的客户端(web端)生成,以匹配命令结果 |
| | |
| | | ByteUtilUnsigned.short2Bytes_BE(bs, rtuAddr2Int.shortValue(), index); |
| | | } |
| | | |
| | | public static void createPw(byte[] bs, int index) throws Exception { |
| | | bs[index] = 0; |
| | | bs[index + 1] = 0; |
| | | } |
| | | |
| | | public static void createTp(byte[] bs, int index) throws Exception { |
| | | ByteUtil.string2BCD_LE(bs, DateTime.yyMMddhhmmss(), index) ; |
| | | } |
| | |
| | | * @param index 下标位 |
| | | * @param len 长度 |
| | | * @return 返回 返回 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static boolean bytesIsAll0xFF(byte[] bs, int index, int len)throws Exception { |
| | | public static boolean bytesIsAll0xFF(byte[] bs, int index, int len){ |
| | | int count = 0 ; |
| | | for(int i = index; i < index + len; i++){ |
| | | if(bs[i] == (byte)0xFF){ |
| | |
| | | |
| | | /** |
| | | * 二进制转十进制数 |
| | | * @param str |
| | | * @param str 二进制字符串 |
| | | * @return 返回 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static int binary2Int(String str) throws Exception { |
| | | int cnt=0; |
| | | int sum=0; |
| | | str=new StringBuilder(str).reverse().toString();//反转字符串 |
| | | for(int i=0;i<str.length();i++){ |
| | | cnt++; |
| | | if (str.charAt(i)=='1'){ |
| | | int mul=1; |
| | | for (int j=1;j<cnt;j++){ |
| | | mul*=2; |
| | | } |
| | | sum+=mul; |
| | | } |
| | | else continue; |
| | | } |
| | | return sum; |
| | | public static int binary2Int(String str) { |
| | | return Integer.parseInt(str, 2); |
| | | } |
| | | |
| | | |
| | |
| | | * 字节转存二进制 |
| | | * |
| | | * @param b byte |
| | | * @throws Exception 异常 |
| | | * @return 返回 String |
| | | */ |
| | | public static String byte2Binary(byte b) throws Exception { |
| | | int n = (b + 256) % 256 + 256; |
| | | try { |
| | | return Integer.toBinaryString(n).substring(1); |
| | | } catch (Exception e) { |
| | | throw new Exception("字节转换成二进制的字符串出错!", null); |
| | | } |
| | | public static String byte2Binary(byte b) { |
| | | return Integer.toBinaryString(b & 0xFF) ; |
| | | } |
| | | /** |
| | | * 字节转存8位二进制 |
| | | * |
| | | * @param b |
| | | * byte |
| | | * @throws Exception 异常 |
| | | * @param b byte |
| | | * @return 返回 String |
| | | */ |
| | | public static String byte2bit8Binary(byte b) throws Exception { |
| | | public static String byte2bit8Binary(byte b) { |
| | | String s = byte2Binary(b); |
| | | int len = s.length(); |
| | | for (int i = 0; i < 8 - len; i++) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 字节取bit |
| | | * @param b |
| | | * @param b |
| | | * @throws Exception 异常 |
| | | * 字节数 取出8个bit |
| | | * @param b 字节数 |
| | | * @return 返回 String |
| | | */ |
| | | public static byte[] getBit(byte b) throws Exception { |
| | | public static byte[] getBit(byte b) { |
| | | byte[] bs = new byte[8] ; |
| | | bs[0] = (byte)(b & 1) ; |
| | | bs[1] = (byte)((b & 2) >> 1) ; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 字节取bit |
| | | * @param b |
| | | * 字节数 取出bit |
| | | * @param b 字节数 |
| | | * @param index 下标位 |
| | | * @throws Exception 异常 |
| | | * @return 返回 String |
| | |
| | | public static void double2Bytes_BE(byte[] bs, double value, int from)throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); |
| | | if (b) { |
| | | Long l = Double.doubleToLongBits(value); |
| | | long2Bytes_BE(bs, l, from); |
| | | long2Bytes_BE(bs, Double.doubleToLongBits(value), from); |
| | | } else { |
| | | throw new Exception("double2Bytes时数组越界"); |
| | | } |
| | |
| | | public static void double2Bytes_LE(byte[] bs, double value, int from)throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); |
| | | if (b) { |
| | | Long l = Double.doubleToLongBits(value); |
| | | long2Bytes_LE(bs, l, from); |
| | | long2Bytes_LE(bs, Double.doubleToLongBits(value), from); |
| | | } else { |
| | | throw new Exception("double2Bytes时数组越界"); |
| | | } |
| | |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); |
| | | if (b) { |
| | | long s = 0; |
| | | long s0 = bs[from + 0] ;// 最低位 |
| | | long s0 = bs[from] ;// 最低位 |
| | | long s1 = bs[from + 1] ; |
| | | long s2 = bs[from + 2] ; |
| | | long s3 = bs[from + 3] ; |
| | |
| | | */ |
| | | Map getDistrictsByVillageId(@Param("villageId") Long villageId); |
| | | |
| | | /** |
| | | * 根据级别获取行政区划列表 |
| | | * @param level 行政区划层级 |
| | | * @return 行政区划列表 |
| | | */ |
| | | List<Map<String, Object>> getDistrictgsByLevel(@Param("level") Integer level); |
| | | |
| | | /** |
| | | * 根据父ID获取行政区划列表 |
| | | * @param supperId 行政区划父级ID |
| | | * @return 行政区划列表 |
| | | */ |
| | | List<Map<String, Object>> getDistrictsBySupperId(@Param("supperId") Long supperId); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-29 9:59 |
| | | * @LastEditTime 2023-12-29 9:59 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface PrControllerMapper extends BaseMapper<PrController> { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(PrController record); |
| | | |
| | | int insertSelective(PrController record); |
| | | |
| | | PrController selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(PrController record); |
| | | |
| | | int updateByPrimaryKey(PrController record); |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrDivide; |
| | | import com.dy.pipIrrGlobal.voPr.VoDivide; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @LastEditTime 2023/12/21 9:16 |
| | | * @Description |
| | | */ |
| | | public interface PrDivideMapper { |
| | | @Mapper |
| | | public interface PrDivideMapper extends BaseMapper<PrDivide> { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(PrDivide record); |
| | |
| | | * @return |
| | | */ |
| | | List<VoDivide> getDivides(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据分水房ID逻辑删除分水房 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | Integer deleteDivideById(@Param("id") Long id); |
| | | |
| | | /** |
| | | * 根据分水房编号获取所属片区编号 |
| | | * @param divideId |
| | | * @return |
| | | */ |
| | | Long getBlockIdById(@Param("divideId") Long divideId); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoCardInfo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | */ |
| | | Map getCardIdAndClientNum(@Param("cardNum") String cardNum); |
| | | |
| | | /** |
| | | * 根据农户主键获取水卡列表 |
| | | * @param clientId |
| | | * @return |
| | | */ |
| | | List<VoCardInfo> getCardInfoByClientId(@Param("clientId") Long clientId); |
| | | |
| | | /** |
| | | * 根据水卡编号获取操作记录列表 |
| | | * @param cardNum 水卡编号 |
| | | * @return 水卡操作记录列表 |
| | | */ |
| | | List<Map<String, Object>> getOperateRecordsByCardNum(@Param("cardNum") Long cardNum); |
| | | |
| | | /** |
| | | * 根据水卡编号获取余额 |
| | | * @param cardNum 水卡编号 |
| | | * @return 余额 |
| | | */ |
| | | Float getMoneyByCardNum(@Param("cardNum") Long cardNum); |
| | | |
| | | /** |
| | | * 根据水卡编号获取充值总额 |
| | | * @param cardNum |
| | | * @return |
| | | */ |
| | | Float sumRechargeByCardNum(@Param("cardNum") Long cardNum); |
| | | |
| | | /** |
| | | * 根据水卡编号获取卡片状态 |
| | | * @param cardNum |
| | | * @return |
| | | */ |
| | | String getCardStateByCardNum(@Param("cardNum") Long cardNum); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoOperate; |
| | | import com.dy.pipIrrGlobal.voSe.VoStatistics; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/22 9:50 |
| | | * @LastEditTime 2023/12/22 9:50 |
| | | * @date 2023-12-26 10:32 |
| | | * @LastEditTime 2023-12-26 10:32 |
| | | * @Description |
| | | */ |
| | | |
| | |
| | | * @return 村主键 |
| | | */ |
| | | Long getVillageIdById(@Param("id") Long id); |
| | | |
| | | /** |
| | | * 获取虚拟卡号最大值 |
| | | * @return |
| | | */ |
| | | Long getMa1xVirtualId(); |
| | | |
| | | /** |
| | | * 获取用水方式列表 |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getWaterTypes(); |
| | | |
| | | /** |
| | | * 根据指定条件获取购水汇总和购卡汇总 |
| | | * @param params 统计条件 |
| | | * @return 购水金额、购卡金额 |
| | | */ |
| | | Map getSums(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取操作记录数 |
| | | * @param params 查询条件 |
| | | * @return 符合条件的记录数 |
| | | */ |
| | | Long getOperateRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取操作记录 |
| | | * @param params 查询条件 |
| | | * @return 符合条件的交易记录 |
| | | */ |
| | | List<VoOperate> getOperates(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取交易笔数汇总和交易金额汇总 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Map getStatisticSums(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取汇总记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getStatisticRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取统计记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoStatistics> getStatistics(Map<?, ?> params); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoPr; |
| | | |
| | | 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 lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-29 9:59 |
| | | * @LastEditTime 2023-12-29 9:59 |
| | | * @Description |
| | | */ |
| | | |
| | | /** |
| | | * 控制器表 |
| | | */ |
| | | |
| | | @TableName(value="pr_controller", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "控制器实体") |
| | | public class PrController implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @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 = 25) |
| | | private String code; |
| | | |
| | | /** |
| | | * 通讯协议 |
| | | */ |
| | | @Schema(description = "通讯协议", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "通讯协议不能为空") |
| | | @Length(message = "通讯协议不大于{max}字",max = 25) |
| | | private String protocol; |
| | | |
| | | /** |
| | | * 添加方式;1-系统自动,2-手动 |
| | | */ |
| | | @Schema(description = "添加方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Byte addways; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | 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; |
| | | } |
| | |
| | | private String name; |
| | | |
| | | /** |
| | | * 虚拟卡号;10位,从1000000000开始 |
| | | */ |
| | | @Schema(description = "虚拟卡号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "虚拟卡号不能为空") |
| | | private Long virtualid; |
| | | |
| | | /** |
| | | * 农户编号;6位区划 + 4为顺序号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | |
| | | private Double area; |
| | | |
| | | /** |
| | | * 用水类型ID |
| | | */ |
| | | @Schema(description = "用水类型ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long typeid; |
| | | |
| | | /** |
| | | * 街道及门牌号 |
| | | */ |
| | | @Schema(description = "街道+门牌号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | |
| | | * 余额 |
| | | */ |
| | | @Schema(description = "余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Double money; |
| | | private Float money; |
| | | |
| | | /** |
| | | * 卡片状态;1-正常,2-已注销,3-已挂失 |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voPr; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-29 10:27 |
| | | * @LastEditTime 2023-12-29 10:27 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "控制器视图对象") |
| | | public class VoController implements BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(title = "ID") |
| | | @ExcelProperty("ID") |
| | | @ColumnWidth(10) |
| | | private Long id; |
| | | |
| | | @Schema(title = "控制器编号") |
| | | @ExcelProperty("控制器编号") |
| | | @ColumnWidth(15) |
| | | private String code; |
| | | |
| | | @Schema(title = "在线状态") |
| | | @ExcelProperty("在线状态") |
| | | @ColumnWidth(15) |
| | | private String state; |
| | | |
| | | @Schema(title = "绑定取水口") |
| | | @ExcelProperty("绑定取水口") |
| | | @ColumnWidth(10) |
| | | private String intakeName; |
| | | |
| | | @Schema(title = "绑定次数") |
| | | @ExcelProperty("绑定次数") |
| | | @ColumnWidth(10) |
| | | private Integer bindings; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "最近上报时间") |
| | | @ExcelProperty("最近上报时间") |
| | | @ColumnWidth(30) |
| | | private Date operateDt; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-27 19:22 |
| | | * @LastEditTime 2023-12-27 19:22 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "IC卡视图对象") |
| | | public class VoCardInfo implements BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(title = "水卡编号") |
| | | private Long cardNum; |
| | | |
| | | @Schema(title = "卡片类型") |
| | | private String cardType; |
| | | |
| | | @Schema(title = "余额") |
| | | private Float money; |
| | | |
| | | @Schema(title = "水卡状态") |
| | | private String state; |
| | | |
| | | } |
| | |
| | | @Schema(title = "ID") |
| | | private Long id; |
| | | |
| | | @Schema(title = "县ID") |
| | | private String countyId; |
| | | @Schema(title = "县名称") |
| | | private String countryName; |
| | | |
| | | @Schema(title = "镇ID") |
| | | private String townId; |
| | | @Schema(title = "镇名称") |
| | | private String townName; |
| | | |
| | | @Schema(title = "村ID") |
| | | private String villageId; |
| | | @Schema(title = "村名称") |
| | | private String villageName; |
| | | |
| | | @Schema(title = "片区ID") |
| | | private String blockId; |
| | | @Schema(title = "片区名称") |
| | | private String bolckName; |
| | | |
| | | @Schema(title = "分水房ID") |
| | | private String divideId; |
| | | @Schema(title = "分水房名称") |
| | | private String divideName; |
| | | |
| | | @Schema(title = "用户类型ID") |
| | | private String waterTypeId; |
| | | @Schema(title = "用户类型名称") |
| | | private String waterTypeName; |
| | | |
| | | @Schema(title = "农户ID") |
| | | private String clientId; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String name; |
| | | |
| | |
| | | private String phone; |
| | | |
| | | @Schema(title = "身份证号") |
| | | private String idCard; |
| | | private String idcard; |
| | | |
| | | @Schema(title = "种植面积") |
| | | private Double area; |
| | | |
| | | @Schema(title = "卡片数量") |
| | | private Integer cardCount; |
| | |
| | | @Schema(title = "地址") |
| | | private String address; |
| | | |
| | | @Schema(title = "备注") |
| | | private String remarks; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "注册时间") |
| | | private Date operateDt; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-26 20:44 |
| | | * @LastEditTime 2023-12-26 20:44 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "操作记录视图对象") |
| | | public class VoOperate implements BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(title = "村ID") |
| | | private Long villageId; |
| | | |
| | | @Schema(title = "区划名称串") |
| | | private String districtTitle; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String name; |
| | | |
| | | @Schema(title = "水卡编号") |
| | | private Long cardNum; |
| | | |
| | | @Schema(title = "身份证号") |
| | | private String idCard; |
| | | |
| | | @Schema(title = "手机号") |
| | | private String phone; |
| | | |
| | | @Schema(title = "充值金额") |
| | | private Float money; |
| | | |
| | | @Schema(title = "购卡金额") |
| | | private Integer cardCost; |
| | | |
| | | @Schema(title = "支付方式编号") |
| | | private Long paymentId; |
| | | |
| | | @Schema(title = "支付方式名称") |
| | | private String paymentMethod; |
| | | |
| | | @Schema(title = "业务类型") |
| | | private String operateType; |
| | | |
| | | @Schema(title = "交易时间") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date operateDt; |
| | | |
| | | @Schema(title = "操作员") |
| | | private String operatorName; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-27 15:01 |
| | | * @LastEditTime 2023-12-27 15:01 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "交易汇总视图对象") |
| | | public class VoStatistics implements BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(title = "村庄ID") |
| | | private Long villageId; |
| | | |
| | | @Schema(title = "村庄") |
| | | private String districtTitle; |
| | | |
| | | @Schema(title = "业务类型") |
| | | private String operateType; |
| | | |
| | | @Schema(title = "交易日期") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date operateDt; |
| | | |
| | | @Schema(title = "交易笔数") |
| | | private Integer count; |
| | | |
| | | @Schema(title = "交易金额") |
| | | private Float money; |
| | | } |
| | |
| | | project: |
| | | webPort: 8085 |
| | | actutorPort: 9085 |
| | | idSuffix: 7 |
| | | idSuffix: 7 |
| | | |
| | | #项目编号 |
| | | projectCode: |
| | | ym: 100 |
| | | pj: 101 |
| | | |
| | | #通讯协议 |
| | | protocol: DYJS_2023,DYJS_2024 |
| | |
| | | INNER JOIN ba_district pro ON cit.supperId = pro.id |
| | | WHERE vil.id = ${villageId} |
| | | </select> |
| | | |
| | | <!--根据级别获取行政区划列表--> |
| | | <select id="getDistrictgsByLevel" resultType="java.util.Map"> |
| | | SELECT |
| | | CAST(id AS char) AS id, |
| | | name |
| | | FROM ba_district WHERE `level` = ${level} |
| | | </select> |
| | | |
| | | <!--根据父ID获取行政区划列表--> |
| | | <select id="getDistrictsBySupperId" resultType="java.util.Map"> |
| | | SELECT |
| | | CAST(id AS char) AS id, |
| | | name |
| | | FROM ba_district WHERE supperId = ${supperId} |
| | | </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.daoPr.PrControllerMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrController"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_controller--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="code" jdbcType="VARCHAR" property="code" /> |
| | | <result column="protocol" jdbcType="VARCHAR" property="protocol" /> |
| | | <result column="addWays" jdbcType="TINYINT" property="addways" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, code, protocol, addWays, `operator`, operateDt, deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from pr_controller |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from pr_controller |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrController"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_controller (id, code, protocol, |
| | | addWays, `operator`, operateDt, |
| | | deleted) |
| | | values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, |
| | | #{addways,jdbcType=TINYINT}, #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}, |
| | | #{deleted,jdbcType=TINYINT}) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrController"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_controller |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="code != null"> |
| | | code, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | protocol, |
| | | </if> |
| | | <if test="addways != null"> |
| | | addWays, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="code != null"> |
| | | #{code,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | #{protocol,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="addways != null"> |
| | | #{addways,jdbcType=TINYINT}, |
| | | </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> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrController"> |
| | | <!--@mbg.generated--> |
| | | update pr_controller |
| | | <set> |
| | | <if test="code != null"> |
| | | code = #{code,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="addways != null"> |
| | | addWays = #{addways,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operatedt != null"> |
| | | operateDt = #{operatedt,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.pojoPr.PrController"> |
| | | <!--@mbg.generated--> |
| | | update pr_controller |
| | | set code = #{code,jdbcType=VARCHAR}, |
| | | protocol = #{protocol,jdbcType=VARCHAR}, |
| | | addWays = #{addways,jdbcType=TINYINT}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | lat = #{lat,jdbcType=DOUBLE}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP} |
| | | <!-- ,--> |
| | | <!-- deleted = #{deleted,jdbcType=TINYINT}--> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | |
| | | INNER JOIN ba_district village ON divi.villageid = village.id |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | AND divi. deleted = 0 |
| | | <if test = "divideName != null and divideName !=''"> |
| | | AND divi.name LIKE CONCAT('%',#{divideName},'%') |
| | | </if> |
| | |
| | | INNER JOIN ba_district village ON divi.villageid = village.id |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | AND divi. deleted = 0 |
| | | <if test = "divideName != null and divideName !=''"> |
| | | AND divi.name LIKE CONCAT('%',#{divideName},'%') |
| | | </if> |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <!--根据分水房ID逻辑删除分水房--> |
| | | <update id="deleteDivideById" parameterType="java.lang.Long"> |
| | | update pr_divide set deleted = 1 |
| | | <where> |
| | | <if test = "id != null and id > 0"> |
| | | AND id = ${id} |
| | | </if> |
| | | </where> |
| | | </update> |
| | | |
| | | <!--根据分水房编号获取所属片区编号--> |
| | | <select id="getBlockIdById" resultType="java.lang.Long"> |
| | | SELECT blockId FROM pr_divide WHERE id = ${divideId}} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | remarks = #{remarks,jdbcType=VARCHAR} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据农户主键获取水卡列表--> |
| | | <select id="getCardInfoByClientId" resultType="com.dy.pipIrrGlobal.voSe.VoCardInfo"> |
| | | SELECT |
| | | cardNum, |
| | | '用户卡' AS cardType, |
| | | money, |
| | | (CASE |
| | | WHEN state = 1 THEN "正常" |
| | | WHEN state = 2 THEN "已注销" |
| | | ELSE "已挂失" |
| | | END) AS state |
| | | FROM se_client_card |
| | | WHERE clientId = ${clientId} |
| | | </select> |
| | | |
| | | <!--根据水卡编号获取操作记录列表--> |
| | | <select id="getOperateRecordsByCardNum" resultType="java.util.HashMap"> |
| | | SELECT * FROM v_operate WHERE cardNum = ${cardNum} |
| | | </select> |
| | | |
| | | <!--根据水卡编号获取余额--> |
| | | <select id="getMoneyByCardNum" resultType="java.lang.Float"> |
| | | SELECT money FROM se_client_card WHERE cardNum = ${cardNum} |
| | | </select> |
| | | |
| | | <!--根据水卡编号获取充值总额--> |
| | | <select id="sumRechargeByCardNum" resultType="java.lang.Float"> |
| | | SELECT |
| | | SUM(his.amount) AS amount |
| | | FROM se_recharge_history his |
| | | INNER JOIN se_client_card card ON his.cardId = card.id |
| | | WHERE card.cardNum = ${cardNum} |
| | | </select> |
| | | |
| | | <!--根据水卡编号获取卡片状态:1-开卡,2-补卡,3-充值,4-挂失,5-注销,6-解锁,7-冲正,8-消费--> |
| | | <select id="getCardStateByCardNum" resultType="java.lang.String"> |
| | | SELECT |
| | | (CASE |
| | | WHEN lastOper = 1 THEN "开卡" |
| | | WHEN lastOper = 2 THEN "补卡" |
| | | WHEN lastOper = 3 THEN "充值" |
| | | WHEN lastOper = 4 THEN "挂失" |
| | | WHEN lastOper = 5 THEN "注销" |
| | | WHEN lastOper = 6 THEN "解锁" |
| | | WHEN lastOper = 7 THEN "冲正" |
| | | WHEN lastOper = 8 THEN "消费" |
| | | END) AS stateName |
| | | FROM se_client_card |
| | | WHERE cardNum = ${cardNum} |
| | | </select> |
| | | </mapper> |
| | |
| | | <result column="blockId" jdbcType="BIGINT" property="blockid" /> |
| | | <result column="divideId" jdbcType="BIGINT" property="divideid" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="virtualId" jdbcType="BIGINT" property="virtualid" /> |
| | | <result column="clientNum" jdbcType="VARCHAR" property="clientnum" /> |
| | | <result column="districtNum" jdbcType="BIGINT" property="districtnum" /> |
| | | <result column="districtTitle" jdbcType="VARCHAR" property="districttitle" /> |
| | | <result column="phone" jdbcType="VARCHAR" property="phone" /> |
| | | <result column="idCard" jdbcType="VARCHAR" property="idcard" /> |
| | | <result column="area" jdbcType="DOUBLE" property="area" /> |
| | | <result column="typeId" jdbcType="BIGINT" property="typeid" /> |
| | | <result column="address" jdbcType="VARCHAR" property="address" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, countyId, townId, villageId, blockId, divideId, `name`, clientNum, districtNum, |
| | | districtTitle, phone, idCard, area, address, remarks, `operator`, operateDt, disabled, |
| | | deleted |
| | | id, countyId, townId, villageId, blockId, divideId, `name`, virtualId, clientNum, |
| | | districtNum, districtTitle, phone, idCard, area, typeId, address, remarks, `operator`, |
| | | operateDt, disabled, deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | delete from se_client |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClient"> |
| | | <!--@mbg.generated--> |
| | | insert into se_client (id, countyId, townId, |
| | | villageId, blockId, divideId, |
| | | `name`, clientNum, districtNum, |
| | | districtTitle, phone, idCard, |
| | | area, address, remarks, |
| | | `operator`, operateDt, disabled, |
| | | deleted) |
| | | `name`, virtualId, clientNum, |
| | | districtNum, districtTitle, phone, |
| | | idCard, area, typeId, |
| | | address, remarks, `operator`, |
| | | operateDt, disabled, deleted |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{countyid,jdbcType=BIGINT}, #{townid,jdbcType=BIGINT}, |
| | | #{villageid,jdbcType=BIGINT}, #{blockid,jdbcType=BIGINT}, #{divideid,jdbcType=BIGINT}, |
| | | #{name,jdbcType=VARCHAR}, #{clientnum,jdbcType=VARCHAR}, #{districtnum,jdbcType=BIGINT}, |
| | | #{districttitle,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{idcard,jdbcType=VARCHAR}, |
| | | #{area,jdbcType=DOUBLE}, #{address,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, |
| | | #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}, #{disabled,jdbcType=TINYINT}, |
| | | #{deleted,jdbcType=TINYINT}) |
| | | #{name,jdbcType=VARCHAR}, #{virtualid,jdbcType=BIGINT}, #{clientnum,jdbcType=VARCHAR}, |
| | | #{districtnum,jdbcType=BIGINT}, #{districttitle,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, |
| | | #{idcard,jdbcType=VARCHAR}, #{area,jdbcType=DOUBLE}, #{typeid,jdbcType=BIGINT}, |
| | | #{address,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, |
| | | #{operatedt,jdbcType=TIMESTAMP}, #{disabled,jdbcType=TINYINT}, #{deleted,jdbcType=TINYINT} |
| | | ) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClient"> |
| | | <!--@mbg.generated--> |
| | | insert into se_client |
| | |
| | | <if test="name != null"> |
| | | `name`, |
| | | </if> |
| | | <if test="virtualid != null"> |
| | | virtualId, |
| | | </if> |
| | | <if test="clientnum != null"> |
| | | clientNum, |
| | | </if> |
| | |
| | | </if> |
| | | <if test="area != null"> |
| | | area, |
| | | </if> |
| | | <if test="typeid != null"> |
| | | typeId, |
| | | </if> |
| | | <if test="address != null"> |
| | | address, |
| | |
| | | <if test="name != null"> |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="virtualid != null"> |
| | | #{virtualid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientnum != null"> |
| | | #{clientnum,jdbcType=VARCHAR}, |
| | | </if> |
| | |
| | | </if> |
| | | <if test="area != null"> |
| | | #{area,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="typeid != null"> |
| | | #{typeid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="address != null"> |
| | | #{address,jdbcType=VARCHAR}, |
| | |
| | | <if test="name != null"> |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="virtualid != null"> |
| | | virtualId = #{virtualid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="clientnum != null"> |
| | | clientNum = #{clientnum,jdbcType=VARCHAR}, |
| | | </if> |
| | |
| | | </if> |
| | | <if test="area != null"> |
| | | area = #{area,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="typeid != null"> |
| | | typeId = #{typeid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="address != null"> |
| | | address = #{address,jdbcType=VARCHAR}, |
| | |
| | | blockId = #{blockid,jdbcType=BIGINT}, |
| | | divideId = #{divideid,jdbcType=BIGINT}, |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | <!-- virtualId = #{virtualid,jdbcType=BIGINT},--> |
| | | clientNum = #{clientnum,jdbcType=VARCHAR}, |
| | | districtNum = #{districtnum,jdbcType=BIGINT}, |
| | | districtTitle = #{districttitle,jdbcType=VARCHAR}, |
| | | phone = #{phone,jdbcType=VARCHAR}, |
| | | idCard = #{idcard,jdbcType=VARCHAR}, |
| | | area = #{area,jdbcType=DOUBLE}, |
| | | typeId = #{typeid,jdbcType=BIGINT}, |
| | | address = #{address,jdbcType=VARCHAR}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP} |
| | | <!-- ,--> |
| | | operateDt = #{operatedt,jdbcType=TIMESTAMP}, |
| | | <!-- disabled = #{disabled,jdbcType=TINYINT},--> |
| | | <!-- deleted = #{deleted,jdbcType=TINYINT}--> |
| | | where id = #{id,jdbcType=BIGINT} |
| | |
| | | FROM se_client cli |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | AND disabled = 0 |
| | | AND deleted = 0 |
| | | AND cli.disabled = 0 |
| | | AND cli.deleted = 0 |
| | | <if test = "name != null and name !=''"> |
| | | AND name like CONCAT('%',#{name},'%') |
| | | AND cli.name like CONCAT('%',#{name},'%') |
| | | </if> |
| | | |
| | | <if test = "num != null and num !=''"> |
| | | AND clientNum like CONCAT('%',#{num},'%') |
| | | <if test = "clientNum != null and clientNum !=''"> |
| | | AND cli.clientNum like CONCAT('%',#{clientNum},'%') |
| | | </if> |
| | | |
| | | <if test = "phone != null and phone !=''"> |
| | | AND phone like CONCAT('%',#{phone},'%') |
| | | AND cli.phone like CONCAT('%',#{phone},'%') |
| | | </if> |
| | | |
| | | <if test = "address != null and address !=''"> |
| | | AND cli.address like CONCAT('%',#{address},'%') |
| | | </if> |
| | | </where> |
| | | |
| | |
| | | <select id="getClients" resultType="com.dy.pipIrrGlobal.voSe.VoClient"> |
| | | SELECT |
| | | (@i:=@i+1) AS id, |
| | | name, |
| | | clientNum, |
| | | phone, |
| | | idCard, |
| | | (SELECT COUNT(*) FROM se_client_card WHERE clientNum = cli.clientNum) AS cardCount, |
| | | address, |
| | | operateDt |
| | | CAST(cli.countyId AS char) AS countyId, |
| | | dis_con.name AS countryName, |
| | | CAST(cli.townId AS char) AS townId, |
| | | dis_town.name AS townName, |
| | | CAST(cli.villageId AS char) AS villageId, |
| | | dis_village.name AS villageName, |
| | | CAST(cli.blockId AS char) AS blockId, |
| | | blo.name AS bolckName, |
| | | CAST(cli.divideId AS char) AS divideId, |
| | | divi.name AS divideName, |
| | | CAST(cli.typeId AS char) AS waterTypeId, |
| | | wat.typeName AS waterTypeName, |
| | | CAST(cli.id AS char) AS clientId, |
| | | cli.name, |
| | | cli.clientNum, |
| | | cli.phone, |
| | | cli.idCard, |
| | | cli.area, |
| | | (SELECT COUNT(*) FROM se_client_card WHERE clientId = cli.id) AS cardCount, |
| | | cli.address, |
| | | cli.remarks, |
| | | cli.operateDt |
| | | FROM se_client cli |
| | | , (SELECT @i:=0) AS itable |
| | | LEFT JOIN ba_district dis_con ON cli.countyId = dis_con.id |
| | | LEFT JOIN ba_district dis_town ON cli.townId = dis_town.id |
| | | LEFT JOIN ba_district dis_village ON cli.villageId = dis_village.id |
| | | LEFT JOIN ba_block blo ON cli.blockId = blo.id |
| | | LEFT JOIN pr_divide divi ON cli.divideId = divi.id |
| | | LEFT JOIN se_water_type wat ON cli.typeId = wat.id |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | AND disabled = 0 |
| | | AND deleted = 0 |
| | | AND cli.disabled = 0 |
| | | AND cli.deleted = 0 |
| | | <if test = "name != null and name !=''"> |
| | | AND name like CONCAT('%',#{name},'%') |
| | | AND cli.name like CONCAT('%',#{name},'%') |
| | | </if> |
| | | |
| | | <if test = "clientNum != null and clientNum !=''"> |
| | | AND clientNum like CONCAT('%',#{clientNum},'%') |
| | | AND cli.clientNum like CONCAT('%',#{clientNum},'%') |
| | | </if> |
| | | |
| | | <if test = "phone != null and phone !=''"> |
| | | AND phone like CONCAT('%',#{phone},'%') |
| | | AND cli.phone like CONCAT('%',#{phone},'%') |
| | | </if> |
| | | |
| | | <if test = "address != null and address !=''"> |
| | | AND address like CONCAT('%',#{address},'%') |
| | | AND cli.address like CONCAT('%',#{address},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY operateDt DESC |
| | | ORDER BY cli.operateDt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | |
| | | <select id="getVillageIdById" parameterType="java.lang.Long" resultType="java.lang.Long"> |
| | | SELECT villageId FROM se_client WHERE id = ${id} |
| | | </select> |
| | | |
| | | <!--获取虚拟卡号最大值--> |
| | | <select id="getMa1xVirtualId" resultType="java.lang.Long"> |
| | | SELECT virtualId FROM se_client ORDER BY id DESC LIMIT 0,1 |
| | | </select> |
| | | |
| | | <!--获取用水方式列表--> |
| | | <select id="getWaterTypes" resultType="java.util.Map"> |
| | | SELECT id, typeName from se_water_type |
| | | </select> |
| | | |
| | | <!-- 下列内容为交易明细查询 --> |
| | | <!--根据指定条件获取购水汇总和购卡汇总--> |
| | | <select id="getSums" resultType="java.util.Map"> |
| | | SELECT |
| | | SUM(money) AS money, |
| | | SUM(cardCost) AS cardCost |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId >0"> |
| | | AND paymentId = ${paymentId} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取交易记录数--> |
| | | <select id="getOperateRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId >0"> |
| | | AND paymentId = ${paymentId} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取交易记录--> |
| | | <select id="getOperates" resultType="com.dy.pipIrrGlobal.voSe.VoOperate"> |
| | | SELECT |
| | | villageId, |
| | | districtTitle, |
| | | clientNum, |
| | | `name`, |
| | | cardNum, |
| | | idCard, |
| | | phone, |
| | | money, |
| | | cardCost, |
| | | paymentId, |
| | | paymentMethod, |
| | | operateType, |
| | | operateDt, |
| | | operatorName |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId >0"> |
| | | AND paymentId = ${paymentId} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY operateDt |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- 下列内容为交易统计查询 --> |
| | | <!--根据指定条件获取交易笔数汇总和交易金额汇总--> |
| | | <select id="getStatisticSums" resultType="java.util.Map"> |
| | | SELECT |
| | | SUM(count) AS count, |
| | | SUM(money) AS money |
| | | FROM |
| | | ( |
| | | SELECT |
| | | villageId, |
| | | districtTitle, |
| | | operateType, |
| | | operateDt, |
| | | count(*) AS count, |
| | | (sum(money) + sum(cardCost)) AS money |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <!-- <if test = "paymentId != null and paymentId >0">--> |
| | | <!-- AND paymentId = ${paymentId}--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | GROUP BY villageId, districtTitle, operateType, operateDt |
| | | ) temp |
| | | </select> |
| | | |
| | | <!--根据指定条件获取汇总记录数--> |
| | | <select id="getStatisticRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM |
| | | ( |
| | | SELECT |
| | | villageId, |
| | | districtTitle, |
| | | operateType, |
| | | operateDt, |
| | | count(*) AS count, |
| | | (sum(money) + sum(cardCost)) AS money |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <!-- <if test = "paymentId != null and paymentId >0">--> |
| | | <!-- AND paymentId = ${paymentId}--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | GROUP BY villageId, districtTitle, operateType, operateDt |
| | | ) temp |
| | | </select> |
| | | |
| | | <!--根据指定条件获取统计记录--> |
| | | <select id="getStatistics" resultType="com.dy.pipIrrGlobal.voSe.VoStatistics"> |
| | | SELECT |
| | | villageId, |
| | | districtTitle, |
| | | operateType, |
| | | operateDt, |
| | | count(*) AS count, |
| | | (sum(money) + sum(cardCost)) AS money |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <!-- <if test = "paymentId != null and paymentId >0">--> |
| | | <!-- AND paymentId = ${paymentId}--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | GROUP BY villageId, districtTitle, operateType, operateDt |
| | | ORDER BY operateDt |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | package com.dy.aceMw.web.com; |
| | | |
| | | import com.dy.aceMw.server.ServerProperties; |
| | | import com.dy.aceMw.server.forTcp.TcpSessionCache; |
| | | import com.dy.aceMw.server.local.CommandInnerDeaLer; |
| | | import com.dy.aceMw.server.local.ReturnCommand; |
| | |
| | | if(onLine == null){ |
| | | return BaseResponseUtils.buildError(ReturnCommand.errored("出错,RTU(地址=" + rtuAddr + ")未上线!", command.getId(), command.getCode())) ; |
| | | }else if(!onLine.booleanValue()){ |
| | | return BaseResponseUtils.buildError(ReturnCommand.errored("出错,RTU(地址=" + rtuAddr + ")离线!", command.getId(), command.getCode())) ; |
| | | if(!ServerProperties.isLowPower){ |
| | | return BaseResponseUtils.buildError(ReturnCommand.errored("出错,RTU(地址=" + rtuAddr + ")离线!", command.getId(), command.getCode())) ; |
| | | } |
| | | } |
| | | |
| | | //生成异步任务 |
| | |
| | | return BaseResponseUtils.buildSuccess(ReturnCommand.successed("命令已接受,即将构造并下发命令。", command.getId(), command.getCode())); |
| | | } |
| | | |
| | | /** |
| | | * 收到命令结果 |
| | | * @param command |
| | | private void dealCommandResult(String jgSenderName, Command command){ |
| | | Object obj = command.getParam() ; |
| | | if(obj != null){ |
| | | CommandBackParam p = (CommandBackParam)obj ; |
| | | if(p.getSuccess()){ |
| | | log.info("命令" + (command.getId().equals(Command.defaultId)?"":("(id=" + command.getId() + ")")) + "执行成功" |
| | | + (p.getMessage() == null?"":(p.getMessage().equals("")?"":("," + p.getMessage())))); |
| | | }else{ |
| | | log.error("命令" + (command.getId().equals(Command.defaultId)?"":("(id=" + command.getId() + ")")) + "执行失败" |
| | | + (p.getMessage() == null?"":(p.getMessage().equals("")?"":("," + p.getMessage())))); |
| | | } |
| | | } |
| | | } |
| | | */ |
| | | } |
| | |
| | | this.restTemplate = restTemplate ; |
| | | } |
| | | |
| | | |
| | | public void deal(Data data) { |
| | | if (data.rtuResultSendWebUrl != null && data.rtuResultSendWebUrl.trim().equals("")) { |
| | | String url = UriComponentsBuilder.fromUriString(data.rtuResultSendWebUrl) |
| | |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaBlock; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaBlock>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<BaBlock>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaBlock>> res = this.sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaBlock> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaBlock> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaBlock po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaBlock po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaBlock po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaBlock po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaClient>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<BaClient>>> some(@RequestBody QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaClient>> res = this.sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaClient> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaClient> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClient po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaClient po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClient po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaClient po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | import com.dy.pipIrrBase.user.QueryVo; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClientType; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaClientType>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) @Valid QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<BaClientType>>> some(@RequestBody @Valid QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaClientType>> res = this.sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaClientType> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaClientType> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaClientType po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaClientType po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | import com.dy.common.mybatis.envm.Deleted; |
| | | 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.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaDistrict; |
| | | import com.dy.pipIrrGlobal.util.DistrictLevel; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | 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 org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @Tag(name = "行政区划管理", description = "行政区划增删改查等操作") |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaDistrict> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaDistrict> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DistrictVo vo, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid DistrictVo vo, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DistrictVo vo, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid DistrictVo vo, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据级别获取行政区划列表 |
| | | * @param id |
| | | * @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 = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/level/{id}") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getDistrictgsByLevel(@PathVariable("id") Integer id){ |
| | | if(id == null || id <= 0){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | | |
| | | List<Map<String, Object>> map_Districts = Optional.ofNullable(sv.getDistrictgsByLevel(id)).orElse(new ArrayList<>()); |
| | | if(map_Districts == null || map_Districts.size() == 0) { |
| | | return BaseResponseUtils.buildFail("您输入的层级有误") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(map_Districts); |
| | | } |
| | | |
| | | /** |
| | | * 根据父ID获取行政区划列表 |
| | | * @param supperId |
| | | * @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 = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/supperid/{supperId}") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getDistrictsBySupperId(@PathVariable("supperId") Long supperId){ |
| | | if(supperId == null || supperId <= 0){ |
| | | return BaseResponseUtils.buildFail("父ID不能为空") ; |
| | | } |
| | | |
| | | List<Map<String, Object>> map_Districts = Optional.ofNullable(sv.getDistrictsBySupperId(supperId)).orElse(new ArrayList<>()); |
| | | if(map_Districts == null || map_Districts.size() == 0) { |
| | | return BaseResponseUtils.buildFail("您输入的父级ID有误") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(map_Districts); |
| | | } |
| | | } |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据级别获取行政区划列表 |
| | | * @param level |
| | | * @return |
| | | */ |
| | | public List<Map<String, Object>> getDistrictgsByLevel(Integer level) { |
| | | return dao.getDistrictgsByLevel(level); |
| | | } |
| | | |
| | | /** |
| | | * 根据父ID获取行政区划列表 |
| | | * @param supperId |
| | | * @return |
| | | */ |
| | | public List<Map<String, Object>> getDistrictsBySupperId(Long supperId) { |
| | | return dao.getDistrictsBySupperId(supperId); |
| | | } |
| | | } |
| | |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaDivide; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaDivide> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaDivide> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | /** |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaDivide>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) DivideVo vo){ |
| | | public BaseResponse<QueryResultVo<List<BaDivide>>> some(@RequestBody DivideVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaDivide>> res = this.sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaDivide po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaDivide po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaDivide po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaDivide po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.pojoBa.BaRole; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaRolePermissions; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | 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 org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | @Slf4j |
| | | @Tag(name = "角色管理", description = "角色增删改查等操作") |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaRole>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) @Valid QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<BaRole>>> some(@RequestBody @Valid QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaRole>> res = this.sv.selectSome(vo) ; |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaRole> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<BaRole> one(Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaRole po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaRole po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaRole po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaRole po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "setPrivs", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> setPrivileges(@Parameter(description = "实体id", required = true) Long id, |
| | | @Parameter(description = "权限id数组") Long[] privIds){ |
| | | public BaseResponse<Boolean> setPrivileges(Long id, Long[] privIds){ |
| | | Long[] privIds_lg = null ; |
| | | if(privIds != null && privIds.length > 0){ |
| | | privIds_lg = new Long[privIds.length] ; |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | } |
| | |
| | | @PostMapping(path = "addPermissions", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> permission(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaRolePermissions po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> permission(@RequestBody @Valid BaRolePermissions po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.voBa.VoUserInfo; |
| | | import com.mysql.cj.util.StringUtils; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaUser>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) @Valid QueryVo vo) { |
| | | public BaseResponse<QueryResultVo<List<BaUser>>> some(@RequestBody @Valid QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<BaUser>> res = this.sv.selectSome(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<BaUser> one(@Parameter(description = "实体id", required = true) String id) { |
| | | public BaseResponse<BaUser> one(String id) { |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(Long.parseLong(id))); |
| | | } |
| | | |
| | |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaUser po, @Parameter(hidden = true) BindingResult bindingResult) { |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaUser po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaUser po, @Parameter(hidden = true) BindingResult bindingResult) { |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaUser po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "changePassword", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> changePassword(@Parameter(description = "实体id", required = true) String id, |
| | | @Parameter(description = "旧密码", required = true) String oldPassword, |
| | | @Parameter(description = "新密码", required = true) String newPassword) throws Exception { |
| | | public BaseResponse<Boolean> changePassword(String id, String oldPassword, String newPassword) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | }) |
| | | @PostMapping(path = "resetPassword", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> resetPassword(@RequestBody @Parameter(description = "form表单json数据", required = true) ResetPasswordVo vo) throws Exception { |
| | | public BaseResponse<Boolean> resetPassword(@RequestBody ResetPasswordVo vo) throws Exception { |
| | | if (vo.id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "resetPasswordByDefault", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> resetPasswordByDefault(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | public BaseResponse<Boolean> resetPasswordByDefault(String id) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "resetPasswordByRandom", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<String> resetPasswordByRandom(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | public BaseResponse<String> resetPasswordByRandom(String id) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | }) |
| | | @GetMapping(path = "setRoles", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> setRoles(@Parameter(description = "实体id", required = true) String id, |
| | | public BaseResponse<Boolean> setRoles(String id, |
| | | @Parameter(description = "角色id数组") String[] roleIds) { |
| | | Long[] roleId_lg = null; |
| | | if (roleIds != null && roleIds.length > 0) { |
| | |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) String id) { |
| | | public BaseResponse<Boolean> delete(String id) { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | |
| | | @EnableAspectJAutoProxy |
| | | @EnableMultiDataSource |
| | | @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipIrrProject"}) |
| | | @MapperScan({"com.dy.pipIrrGlobal.daoPr"}) |
| | | @MapperScan({"com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoBa"}) |
| | | public class PipIrrProjectApplication { |
| | | |
| | | public static void main(String[] args) { |
New file |
| | |
| | | package com.dy.pipIrrProject.controller; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | 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.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-29 10:06 |
| | | * @LastEditTime 2023-12-29 10:06 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "控制器管理", description = "控制器操作") |
| | | @RestController |
| | | @RequestMapping(path="controller") |
| | | @RequiredArgsConstructor |
| | | public class ControllerCtrl { |
| | | private final ControllerSv controllerSv; |
| | | |
| | | @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 PrController po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Date operateTime = new Date(); |
| | | po.setOperatedt(operateTime); |
| | | po.setDeleted((byte)0); |
| | | Integer rec = Optional.ofNullable(controllerSv.addController(po)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.CONTROLLER_FAIL.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrProject.controller; |
| | | |
| | | import com.dy.pipIrrGlobal.daoPr.PrControllerMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-29 10:06 |
| | | * @LastEditTime 2023-12-29 10:06 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class ControllerSv { |
| | | @Autowired |
| | | private PrControllerMapper prControllerMapper; |
| | | |
| | | /** |
| | | * 添加控制器 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer addController(PrController po) { |
| | | return prControllerMapper.insert(po); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrProject.controller; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-29 10:07 |
| | | * @LastEditTime 2023-12-29 10:07 |
| | | * @Description |
| | | */ |
| | | public class QueryVo { |
| | | } |
| | |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrDivide; |
| | | import com.dy.pipIrrGlobal.voPr.VoDivide; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | 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 java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | public class DivideCtrl { |
| | | private final DivideSv divideSv; |
| | | |
| | | /** |
| | | * 分页获取分水房记录 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得一页分水房记录", description = "返回一页分水房数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getDivides", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @GetMapping(path = "/getDivides") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoDivide>>> getDivides(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<VoDivide>>> getDivides(QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoDivide>> res = divideSv.getDivides(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据分水房主键获取分水房对象 |
| | | * @param id |
| | | * @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 = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getone/{id}") |
| | | @SsoAop() |
| | | public BaseResponse<PrDivide> getOneDivide(@PathVariable("id") Long id){ |
| | | try { |
| | | PrDivide res = divideSv.getOneDivide(id); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询农户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 添加分水房记录 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "添加分水房记录", description = "添加分水房记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrDivide po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid PrDivide po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | // 接收村编号(主键) |
| | | Long villageId = po.getVillageid(); |
| | | |
| | | /** |
| | | * 获取5级行政区划信息 |
| | | */ |
| | | Map map_districts = Optional.ofNullable(divideSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); |
| | | if(map_districts.size() <= 0) { |
| | | return BaseResponseUtils.buildFail("区划信息有误"); |
| | | } |
| | | |
| | | Long countryId = Long.parseLong(map_districts.get("countryId").toString()); |
| | | Long townId = Long.parseLong(map_districts.get("townId").toString()); |
| | | po.setCountyid(countryId); |
| | | po.setTownid(townId); |
| | | |
| | | Date operateTime = new Date(); |
| | | po.setOperatedt(operateTime); |
| | | po.setDeleted((byte)0); |
| | | Integer rec = Optional.ofNullable(divideSv.addDivide(po)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.DIVIDE_FAIL.getMessage()); |
| | |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 根据分水房ID逻辑删除分水房 |
| | | * @param id |
| | | * @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 = BaClient.class))} |
| | | ) |
| | | }) |
| | | |
| | | @GetMapping(path = "/delone/{id}") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> deleteDivideById(@PathVariable("id") Long id){ |
| | | try { |
| | | Integer res = Optional.ofNullable(divideSv.deleteDivideById(id)).orElse(0); |
| | | if(res == 0) { |
| | | return BaseResponseUtils.buildFail("分水房删除失败"); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } catch (Exception e) { |
| | | log.error("删除分水房异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改分水房 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "修改分水房记录", description = "修改分水房记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid PrDivide po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | // 接收村编号(主键) |
| | | Long villageId = po.getVillageid(); |
| | | |
| | | /** |
| | | * 获取5级行政区划信息 |
| | | */ |
| | | Map map_districts = Optional.ofNullable(divideSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); |
| | | if(map_districts.size() <= 0) { |
| | | return BaseResponseUtils.buildFail("区划信息有误"); |
| | | } |
| | | |
| | | Long countryId = Long.parseLong(map_districts.get("countryId").toString()); |
| | | Long townId = Long.parseLong(map_districts.get("townId").toString()); |
| | | |
| | | po.setCountyid(countryId); |
| | | po.setTownid(townId); |
| | | |
| | | Date operateTime = new Date(); |
| | | po.setOperatedt(operateTime); |
| | | |
| | | Integer rec = Optional.ofNullable(divideSv.updateByPrimaryKey(po)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail("分水房修改失败"); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 导出分水房列表 |
| | |
| | | package com.dy.pipIrrProject.divide; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrDivideMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrDivide; |
| | | import com.dy.pipIrrGlobal.voPr.VoDivide; |
| | |
| | | @Autowired |
| | | private PrDivideMapper prDivideMapper; |
| | | |
| | | @Autowired |
| | | private BaDistrictMapper baDistrictMapper; |
| | | |
| | | /** |
| | | * 添加分水房 |
| | | * @param po |
| | |
| | | public QueryResultVo<List<VoDivide>> getDivides(QueryVo queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | // 计算符合条件的记录数 |
| | | Long itemTotal = prDivideMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoDivide>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = prDivideMapper.getDivides(params); |
| | | return rsVo ; |
| | |
| | | rsVo = prDivideMapper.getDivides(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据分水房主键获取分水房对象 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public PrDivide getOneDivide(Long id) { |
| | | return prDivideMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | /** |
| | | * 根据主键逻辑删除一个分水房 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public Integer deleteDivideById(Long id) { |
| | | return prDivideMapper.deleteDivideById(id); |
| | | } |
| | | |
| | | /** |
| | | * 根据村编号获取5级区划信息 |
| | | * @param villageId 村编号(主键) |
| | | * @return 5级行政区划信息 |
| | | */ |
| | | public Map getDistrictsByVillageId(Long villageId) { |
| | | return baDistrictMapper.getDistrictsByVillageId(villageId); |
| | | } |
| | | |
| | | /** |
| | | * 修改分水房对象 |
| | | * @param po 农户对象 |
| | | * @return 修改记录条数 |
| | | */ |
| | | public Integer updateByPrimaryKey(PrDivide po) { |
| | | return prDivideMapper.updateByPrimaryKey(po); |
| | | } |
| | | |
| | | /** |
| | | * 根据分水房编号获取所属片区编号 |
| | | * @param divideId 分水房ID |
| | | * @return 所属片区ID |
| | | */ |
| | | public Long getBlockIdById(Long divideId) { |
| | | return prDivideMapper.getBlockIdById(divideId); |
| | | } |
| | | } |
| | |
| | | @Schema(description = "农户姓名") |
| | | public String divideName; |
| | | |
| | | @Schema(description = "IC卡号") |
| | | @Schema(description = "片区名称") |
| | | public String blockName; |
| | | } |
| | |
| | | /** |
| | | * 分水房 |
| | | */ |
| | | DIVIDE_FAIL(10001, "分水房添加失败"); |
| | | DIVIDE_FAIL(10001, "分水房添加失败"), |
| | | |
| | | /** |
| | | * 取水口 |
| | | */ |
| | | |
| | | /** |
| | | * 控制器 |
| | | */ |
| | | CONTROLLER_FAIL(30001, "控制器添加失败"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | |
| | | import com.dy.pipIrrSell.recharge.RechargeCtrl; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | 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 jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | |
| | | private final ClientCardSv clientCardSv; |
| | | private final RechargeCtrl rechargeCtrl; |
| | | |
| | | @Value("${projectCode.ym}") |
| | | private Integer projectCode; |
| | | |
| | | /** |
| | | * 获取开卡记录 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得一页开卡记录", description = "返回一页开卡数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | //@GetMapping(path = "/getActiveCards", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @GetMapping(path = "/getActiveCards") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoActiveCard>>> getActiveCards(QueryVo vo){ |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 开卡操作 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "开卡", description = "新开农户卡") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | |
| | | @PostMapping(path = "add_active", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add_active(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add_active(@RequestBody @Valid DtoActiveCard po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | seClientCard.setCardnum(cardNum); |
| | | //seClientCard.setClientnum(clientNum); |
| | | seClientCard.setClientid(clientId); |
| | | seClientCard.setMoney(0.0); |
| | | seClientCard.setMoney(0f); |
| | | seClientCard.setState(CardStateENUM.NORMAL.getCode()); |
| | | seClientCard.setCreatedt(createTime); |
| | | seClientCard.setLastoper(LastOperateENUM.ACTIVE.getCode()); |
| | |
| | | } |
| | | } |
| | | |
| | | return BaseResponseUtils.buildSuccess(cardNum) ; |
| | | Map map = new HashMap(); |
| | | map.put("projectCode", projectCode); |
| | | map.put("cardNum", cardNum); |
| | | return BaseResponseUtils.buildSuccess(map) ; |
| | | } |
| | | |
| | | @Operation(summary = "补卡", description = "补卡") |
| | |
| | | @PostMapping(path = "add_reissue", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add_reissue(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add_reissue(@RequestBody @Valid DtoActiveCard po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | public QueryResultVo<List<VoActiveCard>> getActiveCards(QueryVo queryVo) { |
| | | //完善查询开卡记录的起止时间 |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | |
| | | //LocalDateTime activeTimeStart = queryVo.activeTimeStart; |
| | | //LocalDateTime activeTimeStop = queryVo.activeTimeStop; |
| | | |
| | | //if(activeTimeStart != null) { |
| | | // activeTimeStart = LocalDateTime.parse(df.format(activeTimeStart) + " 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | // queryVo.setActiveTimeStart(activeTimeStart); |
| | | //} |
| | | |
| | | //if(activeTimeStop != null) { |
| | | // activeTimeStop = LocalDateTime.parse(df.format(activeTimeStop) + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | // queryVo.setActiveTimeStop(activeTimeStop); |
| | | //} |
| | | |
| | | String activeTimeStart = queryVo.activeTimeStart; |
| | | String activeTimeStop = queryVo.activeTimeStop; |
| | | |
| | | if(activeTimeStart != null) { |
| | | activeTimeStart = activeTimeStart + " 00:00:00"; |
| | | queryVo.setActiveTimeStart(activeTimeStart); |
| | | } |
| | | |
| | | if(activeTimeStop != null) { |
| | | activeTimeStop = activeTimeStop + " 23:59:59"; |
| | | queryVo.setActiveTimeStop(activeTimeStop); |
| | |
| | | Long itemTotal = seActiveCardMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoActiveCard>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seActiveCardMapper.getActiveCards(params); |
| | | return rsVo ; |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeCancel; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoCancel; |
| | | import com.dy.pipIrrSell.clientCard.CardStateENUM; |
| | | import com.dy.pipIrrSell.clientCard.ClientCardSv; |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | schema = @Schema(implementation = VoCancel.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getCancels", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @GetMapping(path = "/getCancels") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoCancel>>> getCancels(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<VoCancel>>> getCancels(QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoCancel>> res = cancelSv.getCancels(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoCancel po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoCancel po, BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | |
| | | /** |
| | | * 修改农户卡信息: |
| | | * 挂失时间 |
| | | * 注销时间 |
| | | * 最后操作类型-4 |
| | | */ |
| | | SeClientCard seClientCard = new SeClientCard(); |
| | | seClientCard.setId(cardId); |
| | | seClientCard.setCanceldt(cancelTime); |
| | | seClientCard.setMoney(0f); |
| | | seClientCard.setState(CardStateENUM.CANCELLED.getCode()); |
| | | seClientCard.setLastoper(LastOperateENUM.CANCEL.getCode()); |
| | | Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); |
| | | if(rec_updateClientCard == 0) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 添加挂失记录 |
| | | * 添加注销记录 |
| | | */ |
| | | SeCancel seCancel = new SeCancel(); |
| | | //seCancel.setCardnum(cardNum); |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | public QueryResultVo<List<VoCancel>> getCancels(QueryVo queryVo) { |
| | | //完善查询注销记录的起止时间 |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | |
| | | LocalDateTime cancelTimeStart = queryVo.cancelTimeStart; |
| | | LocalDateTime cancelTimeStop = queryVo.cancelTimeStop; |
| | | String cancelTimeStart = queryVo.cancelTimeStart; |
| | | String cancelTimeStop = queryVo.cancelTimeStop; |
| | | if(cancelTimeStart != null) { |
| | | cancelTimeStart = LocalDateTime.parse(df.format(cancelTimeStart) + " 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | cancelTimeStart = cancelTimeStart + " 00:00:00"; |
| | | queryVo.setCancelTimeStart(cancelTimeStart); |
| | | } |
| | | |
| | | if(cancelTimeStop != null) { |
| | | cancelTimeStop = LocalDateTime.parse(df.format(cancelTimeStop) + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | cancelTimeStop = cancelTimeStop + " 23:59:59"; |
| | | queryVo.setCancelTimeStop(cancelTimeStop); |
| | | } |
| | | |
| | |
| | | Long itemTotal = seCancelMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoCancel>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seCancelMapper.getCancels(params); |
| | | return rsVo ; |
| | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/6 14:18 |
| | |
| | | |
| | | |
| | | @Schema(description = "注销时间_开始") |
| | | public LocalDateTime cancelTimeStart; |
| | | public String cancelTimeStart; |
| | | |
| | | @Schema(description = "注销时间_结束") |
| | | public LocalDateTime cancelTimeStop; |
| | | public String cancelTimeStop; |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoClient; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | public class ClientCtrl { |
| | | private final ClientSv clientSv; |
| | | |
| | | /** |
| | | * 获取农户列表 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得一页农户", description = "返回一页农户数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取交易记录 |
| | | * @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 = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getOperates") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getOperates(QueryOperate vo){ |
| | | try { |
| | | Map res = clientSv.getOperates(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询交易记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取交易汇总记录 |
| | | * @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 = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getStatistics") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getStatistics(QueryStatistic vo){ |
| | | try { |
| | | Map res = clientSv.getStatistics(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询交易汇总记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据主键获取一个农户对象 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得一个农户", description = "返回一个农户数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加一个农户对象 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @Operation(summary = "添加农户记录", description = "添加农户记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoClient po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoClient po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | // 接收村编号(主键) |
| | | Long villageId = po.getVillageid(); |
| | | Long villageId = po.getVillageId(); |
| | | |
| | | /** |
| | | * 获取5级行政区划信息 |
| | |
| | | Long districtNum = Long.parseLong(provinceNum + cityNum + district8); |
| | | String districtTitle = countryName + townName + villageName; |
| | | |
| | | // 生成虚拟卡号 |
| | | Long virtualId = Optional.ofNullable(clientSv.getMa1xVirtualId()).orElse(0L); |
| | | if(virtualId == 0) { |
| | | virtualId = 1000000000L; |
| | | }else { |
| | | virtualId = virtualId + 1; |
| | | if(virtualId > 10000000000L) { |
| | | return BaseResponseUtils.buildFail("虚拟卡号超限"); |
| | | } |
| | | } |
| | | |
| | | SeClient seClient = DtoClientToSeClient.INSTANCT.po2vo(po); |
| | | seClient.setCountyid(countryId); |
| | | seClient.setTownid(townId); |
| | | seClient.setVirtualid(virtualId); |
| | | seClient.setClientnum(clientNum); |
| | | seClient.setDistrictnum(districtNum); |
| | | seClient.setDistricttitle(districtTitle); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 修改农户对象 |
| | | * 修改农户对象(虚拟卡号、禁止标志、逻辑删除标识不参与修改) |
| | | * @param po 农户对象 |
| | | * @param bindingResult |
| | | * @return |
| | |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoClient po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid DtoClient po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | // 接收村编号(主键) |
| | | Long villageId = po.getVillageid(); |
| | | Long villageId = po.getVillageId(); |
| | | |
| | | /** |
| | | * 获取5级行政区划信息 |
| | |
| | | seClient.setDistricttitle(districtTitle); |
| | | Date operateTime = new Date(); |
| | | seClient.setOperatedt(operateTime); |
| | | // |
| | | //seClient.setDisabled((byte)0); |
| | | //seClient.setDeleted((byte)0); |
| | | |
| | | Integer rec = Optional.ofNullable(clientSv.updateByPrimaryKey(seClient)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail("添加农户失败"); |
| | | return BaseResponseUtils.buildFail("农户修改失败"); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取用水方式列表 |
| | | * @param |
| | | * @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 = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/watertypes") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getWaterTypes(){ |
| | | List<Map<String, Object>> map_WaterTypes = Optional.ofNullable(clientSv.getWaterTypes()).orElse(new ArrayList<>()); |
| | | if(map_WaterTypes == null || map_WaterTypes.size() == 0) { |
| | | return BaseResponseUtils.buildFail("没有用水方式") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(map_WaterTypes); |
| | | } |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoOperate; |
| | | import com.dy.pipIrrGlobal.voSe.VoStatistics; |
| | | 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.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | |
| | | /** |
| | | * 根据指定条件获取农户数据 |
| | | * @param vo |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoClient>> getClients(QueryVo vo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | public QueryResultVo<List<VoClient>> getClients(QueryVo queryVo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; |
| | | Long itemTotal = seClientMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = vo.pageSize ; |
| | | rsVo.pageCurr = vo.pageCurr ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seClientMapper.getClients(params); |
| | | |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取交易记录 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | public Map getOperates(QueryOperate vo){ |
| | | // 补齐查询时间 |
| | | String operateTimeStart = vo.operateTimeStart; |
| | | String operateTimeStop = vo.operateTimeStop; |
| | | if(operateTimeStart != null) { |
| | | operateTimeStart = operateTimeStart + " 00:00:00"; |
| | | vo.setOperateTimeStart(operateTimeStart); |
| | | } |
| | | if(operateTimeStop != null) { |
| | | operateTimeStop = operateTimeStop + " 23:59:59"; |
| | | vo.setOperateTimeStop(operateTimeStop); |
| | | } |
| | | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | |
| | | // 获取汇总的购水金额、购卡金额 |
| | | Float money = 0f; |
| | | Float cardCost = 0f; |
| | | Map map_sum = Optional.ofNullable(seClientMapper.getSums(params)).orElse(new HashMap()); |
| | | if(map_sum.size() > 0) { |
| | | money = Float.parseFloat(map_sum.get("money").toString()); |
| | | cardCost = Float.parseFloat(map_sum.get("cardCost").toString()); |
| | | } |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = seClientMapper.getOperateRecordCount(params); |
| | | |
| | | Integer pageSize = vo.getPageSize(); |
| | | // 计算总页数 |
| | | Integer pageTotal ; |
| | | pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize); |
| | | |
| | | // 根据当前页码及每页数量计算偏移量 |
| | | Integer pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | params.put("pageCurr", pageCurr); |
| | | |
| | | List<VoOperate> lit = seClientMapper.getOperates(params); |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", itemTotal); |
| | | map_record.put("pageCurr", vo.pageCurr); |
| | | map_record.put("pageSize", pageSize); |
| | | map_record.put("pageTotal", pageTotal); |
| | | map_record.put("list", lit); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("money", money); |
| | | map_result.put("cardCost", cardCost); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取统计记录 |
| | | * @param vo 交易汇总查询条件 |
| | | * @return 交易汇总记录 |
| | | */ |
| | | public Map getStatistics(QueryStatistic vo){ |
| | | // 补齐查询时间 |
| | | String operateTimeStart = vo.operateTimeStart; |
| | | String operateTimeStop = vo.operateTimeStop; |
| | | if(operateTimeStart != null) { |
| | | operateTimeStart = operateTimeStart + " 00:00:00"; |
| | | vo.setOperateTimeStart(operateTimeStart); |
| | | } |
| | | if(operateTimeStop != null) { |
| | | operateTimeStop = operateTimeStop + " 23:59:59"; |
| | | vo.setOperateTimeStop(operateTimeStop); |
| | | } |
| | | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | |
| | | // 获取汇总的交易笔数、交易金额 |
| | | Integer count = 0; |
| | | Float money = 0f; |
| | | Map map_sum = Optional.ofNullable(seClientMapper.getStatisticSums(params)).orElse(new HashMap()); |
| | | if(map_sum.size() > 0) { |
| | | count = Integer.parseInt(map_sum.get("count").toString()); |
| | | money = Float.parseFloat(map_sum.get("money").toString()); |
| | | } |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = seClientMapper.getStatisticRecordCount(params); |
| | | |
| | | Integer pageSize = vo.getPageSize(); |
| | | // 计算总页数 |
| | | Integer pageTotal ; |
| | | pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize); |
| | | |
| | | // 根据当前页码及每页数量计算偏移量 |
| | | Integer pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | params.put("pageCurr", pageCurr); |
| | | |
| | | List<VoStatistics> lit = seClientMapper.getStatistics(params); |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", itemTotal); |
| | | map_record.put("pageCurr", vo.pageCurr); |
| | | map_record.put("pageSize", pageSize); |
| | | map_record.put("pageTotal", pageTotal); |
| | | map_record.put("list", lit); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("count", count); |
| | | map_result.put("money", money); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | } |
| | | |
| | | /** |
| | |
| | | return seClientMapper.getVillageIdById(id); |
| | | } |
| | | |
| | | /** |
| | | * 获取虚拟卡号最大值 |
| | | * @return |
| | | */ |
| | | public Long getMa1xVirtualId() { |
| | | return seClientMapper.getMa1xVirtualId(); |
| | | } |
| | | |
| | | /** |
| | | * 获取用水方式列表 |
| | | * @return |
| | | */ |
| | | public List<Map<String, Object>> getWaterTypes() { |
| | | return seClientMapper.getWaterTypes(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Schema(description = "所在村ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在村不能为空") |
| | | private Long villageid; |
| | | private Long villageId; |
| | | |
| | | /** |
| | | * 片区ID |
| | | */ |
| | | @Schema(description = "所在片区ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在片区不能为空") |
| | | private Long blockid; |
| | | private Long blockId; |
| | | |
| | | /** |
| | | * 分水房ID |
| | | */ |
| | | @Schema(description = "所在分水房ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在分水房不能为空") |
| | | private Long divideid; |
| | | private Long divideId; |
| | | |
| | | /** |
| | | * 农户姓名 |
| | |
| | | @Schema(description = "农户身份证号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotBlank(message = "农户身份证号不能为空") //不能为空也不能为null |
| | | @Length(message = "农户身份证号必须{max}位数据", min = 18, max = 18) |
| | | private String idcard; |
| | | private String idCard; |
| | | |
| | | /** |
| | | * 种植面积 |
| | |
| | | private Double area; |
| | | |
| | | /** |
| | | * 用水方式 |
| | | */ |
| | | @Schema(description = "用水方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long typeId; |
| | | |
| | | /** |
| | | * 街道及门牌号 |
| | | */ |
| | | @Schema(description = "街道+门牌号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | |
| | | public interface DtoClientToSeClient { |
| | | DtoClientToSeClient INSTANCT = Mappers.getMapper(DtoClientToSeClient.class); |
| | | |
| | | @Mapping(target = "villageid", source = "villageid") |
| | | @Mapping(target = "blockid", source = "blockid") |
| | | @Mapping(target = "divideid", source = "divideid") |
| | | @Mapping(target = "villageid", source = "villageId") |
| | | @Mapping(target = "blockid", source = "blockId") |
| | | @Mapping(target = "divideid", source = "divideId") |
| | | @Mapping(target = "name", source = "name") |
| | | @Mapping(target = "phone", source = "phone") |
| | | @Mapping(target = "idcard", source = "idcard") |
| | | @Mapping(target = "idcard", source = "idCard") |
| | | @Mapping(target = "area", source = "area") |
| | | @Mapping(target = "typeid", source = "typeId") |
| | | @Mapping(target = "address", source = "address") |
| | | @Mapping(target = "remarks", source = "remarks") |
| | | @Mapping(target = "operator", source = "operator") |
| | | |
| | | @Mapping(target = "disabled", ignore=true) |
| | | @Mapping(target = "deleted", ignore=true) |
| | | SeClient po2vo(DtoClient po); |
New file |
| | |
| | | package com.dy.pipIrrSell.client; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-26 21:00 |
| | | * @LastEditTime 2023-12-26 21:00 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "交易查询条件") |
| | | public class QueryOperate extends QueryConditionVo { |
| | | |
| | | @Schema(description = "村ID") |
| | | public Long villageId; |
| | | |
| | | @Schema(description = "支付方式编号") |
| | | public Long paymentId; |
| | | |
| | | @Schema(description = "交易查询起始时间") |
| | | public String operateTimeStart; |
| | | |
| | | @Schema(description = "交易查询截止时间") |
| | | public String operateTimeStop; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrSell.client; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-27 15:33 |
| | | * @LastEditTime 2023-12-27 15:33 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "交易汇总查询条件") |
| | | public class QueryStatistic extends QueryConditionVo { |
| | | @Schema(description = "村ID") |
| | | public Long villageId; |
| | | |
| | | //@Schema(description = "支付方式编号") |
| | | //public Long paymentId; |
| | | |
| | | @Schema(description = "交易查询起始时间") |
| | | public String operateTimeStart; |
| | | |
| | | @Schema(description = "交易查询截止时间") |
| | | public String operateTimeStop; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrSell.clientCard; |
| | | |
| | | 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.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoCardInfo; |
| | | 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 lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-27 19:36 |
| | | * @LastEditTime 2023-12-27 19:36 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "农户水卡", description = "农户水卡") |
| | | @RestController |
| | | @RequestMapping(path="clientcard") |
| | | @RequiredArgsConstructor |
| | | public class ClientCardCtrl { |
| | | private final ClientCardSv clientCardSv; |
| | | |
| | | /** |
| | | * 获取指定用户名下全部水卡 |
| | | * @param clientId |
| | | * @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 = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "clientcard/{clientId}") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoCardInfo>>> get(@PathVariable("clientId") Long clientId){ |
| | | try { |
| | | List<VoCardInfo> list = clientCardSv.getCardInfoByClientId(clientId); |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | } catch (Exception e) { |
| | | log.error("查询农户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据水卡编号获取操作记录及余额 |
| | | * @param cardNum 水卡编号 |
| | | * @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 = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getoperaterecords") |
| | | @SsoAop() |
| | | public BaseResponse<List<Map<String, Object>>> getOperateRecordsAndMoney(@RequestParam("cardNum") Long cardNum){ |
| | | try { |
| | | Map map = clientCardSv.getOperateRecordsAndMoney(cardNum); |
| | | return BaseResponseUtils.buildSuccess(map); |
| | | } catch (Exception e) { |
| | | log.error("查询操作记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据水卡编号获取卡片状态 |
| | | * @param cardNum |
| | | * @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 = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/cardstate") |
| | | @SsoAop() |
| | | public BaseResponse<String> getCardStateByCardNum(@RequestParam("cardNum") Long cardNum){ |
| | | try { |
| | | String stateName = clientCardSv.getCardStateByCardNum(cardNum); |
| | | return BaseResponseUtils.buildSuccess(stateName); |
| | | } catch (Exception e) { |
| | | log.error("查询操作记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoCardInfo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | public Integer UpdateClientCard(SeClientCard po) { |
| | | return seClientCardMapper.updateByPrimaryKeySelective(po); |
| | | } |
| | | |
| | | /** |
| | | * 根据农户主键获取水卡列表 |
| | | * @param clientId |
| | | * @return |
| | | */ |
| | | public List<VoCardInfo> getCardInfoByClientId(Long clientId){ |
| | | List<VoCardInfo> list = Optional.ofNullable(seClientCardMapper.getCardInfoByClientId(clientId)).orElse(new ArrayList<>()); |
| | | if(list.size() > 0) { |
| | | return list; |
| | | }else { |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据水卡编号获取操作记录及余额 |
| | | * @param cardNum |
| | | * @return |
| | | */ |
| | | public Map getOperateRecordsAndMoney(Long cardNum) { |
| | | List<Map<String, Object>> list = Optional.ofNullable(seClientCardMapper.getOperateRecordsByCardNum(cardNum)).orElse(new ArrayList<>()); |
| | | Float mondy = Optional.ofNullable(seClientCardMapper.getMoneyByCardNum(cardNum)).orElse(0f); |
| | | Float amount = Optional.ofNullable(seClientCardMapper.sumRechargeByCardNum(cardNum)).orElse(0f); |
| | | |
| | | Map map = new HashMap(); |
| | | map.put("mondy", mondy); |
| | | map.put("amount", amount); |
| | | map.put("list", list); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 根据水卡编号获取卡片状态 |
| | | * @param cardNum |
| | | * @return |
| | | */ |
| | | public String getCardStateByCardNum(Long cardNum) { |
| | | String stateName = Optional.ofNullable(seClientCardMapper.getCardStateByCardNum(cardNum)).orElse(""); |
| | | return stateName; |
| | | } |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeLoss; |
| | | import com.dy.pipIrrGlobal.voSe.VoLoss; |
| | | import com.dy.pipIrrSell.clientCard.CardStateENUM; |
| | | import com.dy.pipIrrSell.clientCard.ClientCardSv; |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoLoss po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoLoss po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | */ |
| | | SeClientCard seClientCard = new SeClientCard(); |
| | | seClientCard.setId(cardId); |
| | | seClientCard.setMoney(money); |
| | | seClientCard.setLossdtdt(lossTime); |
| | | seClientCard.setState(CardStateENUM.LOSS.getCode()); |
| | | seClientCard.setLastoper(LastOperateENUM.LOSS.getCode()); |
| | | Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); |
| | | if(rec_updateClientCard == 0) { |
| | |
| | | Long itemTotal = seLossMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoLoss>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seLossMapper.getLosses(params); |
| | | return rsVo ; |
| | |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoRecharge po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoRecharge po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | */ |
| | | SeClientCard seClientCard = new SeClientCard(); |
| | | seClientCard.setId(cardId); |
| | | seClientCard.setMoney(afterRecharge); |
| | | seClientCard.setRechargedt(rechargeTime); |
| | | seClientCard.setLastoper(LastOperateENUM.RECHARGE.getCode ()); |
| | | Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | public QueryResultVo<List<VoRecharge>> getRecharges(QueryVo queryVo) { |
| | | //完善查询充值记录的起止时间 |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | |
| | | //LocalDateTime rechargeTimeStart = queryVo.rechargeTimeStart; |
| | | //LocalDateTime rechargeTimeStop = queryVo.rechargeTimeStop; |
| | | //if(rechargeTimeStart != null) { |
| | | // rechargeTimeStart = LocalDateTime.parse(df.format(rechargeTimeStart) + " 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | // queryVo.setRechargeTimeStart(rechargeTimeStart); |
| | | //} |
| | | // |
| | | //if(rechargeTimeStop != null) { |
| | | // rechargeTimeStop = LocalDateTime.parse(df.format(rechargeTimeStop) + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | // queryVo.setRechargeTimeStop(rechargeTimeStop); |
| | | //} |
| | | |
| | | String rechargeTimeStart = queryVo.rechargeTimeStart; |
| | | String rechargeTimeStop = queryVo.rechargeTimeStop; |
| | | if(rechargeTimeStart != null) { |
| | | rechargeTimeStart = rechargeTimeStart + " 00:00:00"; |
| | | queryVo.setRechargeTimeStart(rechargeTimeStart); |
| | | } |
| | | |
| | | if(rechargeTimeStop != null) { |
| | | rechargeTimeStop = rechargeTimeStop + " 23:59:59"; |
| | | queryVo.setRechargeTimeStop(rechargeTimeStop); |
| | | } |
| | | |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seRechargeMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoRecharge>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seRechargeMapper.getRecharges(params); |
| | | return rsVo ; |
| | |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoReversal po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoReversal po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | SeClientCard seClientCard = new SeClientCard(); |
| | | seClientCard.setId(cardId); |
| | | seClientCard.setReversaldt(reversalTime); |
| | | seClientCard.setMoney(cardBalance); |
| | | seClientCard.setLastoper(LastOperateENUM.REVERSAL.getCode()); |
| | | Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); |
| | | if(rec_updateClientCard == 0) { |
| | |
| | | Long itemTotal = seReversalMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoReversal>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seReversalMapper.getReversals(params); |
| | | return rsVo ; |
| | |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoUnlock po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add(@RequestBody @Valid DtoUnlock po, BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | SeClientCard seClientCard = new SeClientCard(); |
| | | seClientCard.setId(cardId); |
| | | seClientCard.setUnlockdt(unlockTime); |
| | | seClientCard.setMoney(money); |
| | | seClientCard.setLastoper(LastOperateENUM.UNLOCK.getCode()); |
| | | Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); |
| | | if(rec_updateClientCard == 0) { |
| | |
| | | Long itemTotal = seUnlockMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoUnlock>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seUnlockMapper.getUnlocks(params); |
| | | return rsVo ; |
| | |
| | | //@PostMapping(path = "addRecharge") |
| | | //@Transactional(rollbackFor = Exception.class) |
| | | //@SsoAop() |
| | | //public BaseResponse<Boolean> addRecharge(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoWalletRecharge po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | //public BaseResponse<Boolean> addRecharge(@RequestBody @Valid DtoWalletRecharge po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | // DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | // if(bindingResult != null && bindingResult.hasErrors()){ |
| | | // return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |