From e67870fff62635cd14beb0d5988f08aeef4b22fa Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期一, 07 四月 2025 21:27:06 +0800 Subject: [PATCH] 添加远程关阀式终止灌溉计划,未测试 --- pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFileSvConf.java | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 155 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFileSvConf.java b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFileSvConf.java new file mode 100644 index 0000000..57e54b5 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFileSvConf.java @@ -0,0 +1,155 @@ +package com.dy.pipIrrWebFile.fm; + +import java.util.ArrayList; +import java.util.List; + +public class DyFileSvConf { + + public static class Group{ + public List<Vo> list ; + public Group(){ + this.list = new ArrayList<Vo>() ; + } + public void add(Vo vo)throws Exception{ + if(vo == null){ + throw new Exception("鍑洪敊锛岄鍔犲叆闆嗗悎Vo涓虹┖浜嗭紒") ; + } + if(list.size() > 0){ + for(Vo lvo : list){ + lvo.checkEqual(vo) ; + } + this.list.add(vo) ; + }else{ + this.list.add(vo) ; + } + } + public void check() throws Exception{ + Integer startV = 0 ; + doCheck(startV) ; + } + private void doCheck(Integer startV) throws Exception{ + boolean find = false ; + for(Vo vo : list){ + if(vo.hashStart.intValue() == startV.intValue()){ + startV = vo.hashEnd + 1; + find = true ; + break ; + } + } + if(!find){ + throw new Exception("涓ラ噸閿欒锛屾湭鍙戠幇鍝堝笇鍊间负" + startV + "鏂囦欢鏈嶅姟鍣紒") ; + } + if(startV.intValue() <= 65535){ + doCheck(startV) ; + } + } + } + + public static class Vo{ + public String id ;//id鎴栧悕绉� + public String fileSysAbsolutePath; //鏂囦欢鍚嶇О鐨勫搱甯屽�煎搴旂殑鏂囦欢鏈�缁堝瓨鍌ㄧ粷瀵硅矾寰勪腑鐨勬牴鐩綍锛屽湪閰嶇疆鏂囦欢涓厤缃� + public String fileSysRelativePath; //鏂囦欢鍚嶇О鐨勫搱甯屽�煎搴旂殑鏂囦欢鏈�缁堝瓨鍌ㄧ浉瀵硅矾寰勭殑鐩綍锛屽湪閰嶇疆鏂囦欢涓厤缃� + public String restUrl;//鏂囦欢绯荤粺璺緞 + public String webUrl ;//涓嬭浇鏂囨。鐨剋eb璺緞 + public String webDownloadPath ;//涓嬭浇鏂囨。鐨凜ontroller鐨勭浉瀵硅矾寰� + public Integer hashStart ;//鍝堝笇鍊煎惎濮嬪�硷紙鍖呭惈锛� + public Integer hashEnd ;//鍝堝笇鍊兼埅姝㈠�硷紙鍖呭惈锛� + + public Vo(){} + public Vo(String id, + String fileSysAbsolutePath, + String fileSysBasePath, + String restUrl, + String webUrl, + String webDownloadPath, + Integer hashStart, + Integer hashEnd)throws Exception{ + this.id = id ; + this.fileSysAbsolutePath = fileSysAbsolutePath ; + this.fileSysRelativePath = fileSysBasePath ; + this.restUrl = restUrl ; + this.webUrl = webUrl ; + this.webDownloadPath = webDownloadPath ; + this.hashStart = hashStart ; + this.hashEnd = hashEnd ; + if(this.id == null || this.id.trim().equals("")){ + throw new Exception("鍑洪敊锛宨d涓虹┖浜嗭紒") ; + }else{ + this.id = this.id.trim() ; + } + if(this.fileSysAbsolutePath == null || this.fileSysAbsolutePath.trim().equals("")){ + throw new Exception("鍑洪敊锛宖ileSysAbsolutePath涓虹┖浜嗭紒") ; + }else{ + this.fileSysAbsolutePath = this.fileSysAbsolutePath.trim() ; + this.fileSysAbsolutePath = this.fileSysAbsolutePath.replaceAll("\\\\", "/") ; + if(!this.fileSysAbsolutePath.endsWith("/")){ + this.fileSysAbsolutePath = this.fileSysAbsolutePath + "/" ; + } + } + if(this.fileSysRelativePath == null || this.fileSysRelativePath.trim().equals("")){ + throw new Exception("鍑洪敊锛宖ileSysBasePath涓虹┖浜嗭紒") ; + }else{ + this.fileSysRelativePath = this.fileSysRelativePath.trim() ; + } + if(this.webUrl == null || this.webUrl.trim().equals("")){ + throw new Exception("鍑洪敊锛寃ebUrl涓虹┖浜嗭紒") ; + }else{ + this.webUrl = this.webUrl.trim() ; + if(!this.webUrl.endsWith("/") && !this.webUrl.endsWith("\\")){ + this.webUrl += "/" ; + } + } + if(this.webDownloadPath == null || this.webDownloadPath.trim().equals("")){ + throw new Exception("鍑洪敊锛寃ebDownloadPath锛�") ; + } + + if(this.hashStart == null){ + throw new Exception("鍑洪敊锛宧ashStart涓虹┖浜嗭紒") ; + }else if(this.hashStart.intValue() < 0){ + throw new Exception("鍑洪敊锛宧ashStart灏忎簬0浜嗭紒") ; + }else if(this.hashStart.intValue() > 65535){ + throw new Exception("鍑洪敊锛宧ashStart澶т簬65535浜嗭紒") ; + } + if(this.hashEnd == null){ + throw new Exception("鍑洪敊锛宧ashEnd涓虹┖浜嗭紒") ; + }else if(this.hashEnd.intValue() < 0){ + throw new Exception("鍑洪敊锛宧ashEnd灏忎簬0浜嗭紒") ; + }else if(this.hashEnd.intValue() > 65535){ + throw new Exception("鍑洪敊锛宧ashEnd澶т簬65535浜嗭紒") ; + } + if(this.hashEnd < this.hashStart){ + throw new Exception("鍑洪敊锛宧ashEnd灏忎簬hashStart浜嗭紒") ; + } + } + public String toString(){ + return "id=" + id + "\n" + + "fileSysAbsolutePath=" + fileSysAbsolutePath + "\n" + + "fileSysBasePath=" + fileSysRelativePath + "\n" + + "restUrl=" + restUrl + "\n" + + "webUrl=" + webUrl + "\n" + + "webDownloadPath=" + webDownloadPath + "\n" + + "hashStart=" + hashStart + "\n" + + "hashEnd=" + hashEnd ; + } + + + private boolean checkEqual(Vo vo)throws Exception{ + if(this.id.equalsIgnoreCase(vo.id)){ + throw new Exception("鍑洪敊锛宨d鏈夐噸澶嶏紒") ; + } + if(this.hashStart.intValue() == vo.hashStart.intValue()){ + throw new Exception("鍑洪敊锛宧ashStart鏈夐噸澶嶏紒") ; + } + if(this.hashEnd.intValue() == vo.hashEnd.intValue()){ + throw new Exception("鍑洪敊锛宧ashEnd鏈夐噸澶嶏紒") ; + } + if(this.hashStart.intValue() == vo.hashEnd.intValue()){ + throw new Exception("鍑洪敊锛宧ashStart涓巋ashEnd鏈夐噸澶嶏紒") ; + } + if(this.hashEnd.intValue() == vo.hashStart.intValue()){ + throw new Exception("鍑洪敊锛宧ashEnd涓巋ashStart鏈夐噸澶嶏紒") ; + } + return true ; + } + } +} -- Gitblit v1.8.0