| | |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.converter.HttpMessageConverter; |
| | | //import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Configuration |
| | | public class FastJsonConfig { |
| | | public class FastJsonConfig implements WebMvcConfigurer { |
| | | /** |
| | | * é
ç½®fastjsonè¾åºæ ¼å¼ |
| | | **/ |
| | | @SuppressWarnings("unused") |
| | | @Override |
| | | public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
| | | // 1. é
ç½®fastjson |
| | | com.alibaba.fastjson2.support.config.FastJsonConfig config = new com.alibaba.fastjson2.support.config.FastJsonConfig(); |
| | |
| | | */ |
| | | public class TcpIoSessionAttrIdIsRtuAddr { |
| | | |
| | | public static final String sessionArrIdKey = "key_rtuAddr" ; //è¿ä¸ªkeyåå¨çæ¯Rtuå°å |
| | | public static final String sessionArrIdKey = "key_rtuAddr" ; //è¿ä¸ªkeyåå¨çæ¯IMEIå· |
| | | } |
| | |
| | | |
| | | private static CoreThread instance = new CoreThread() ; |
| | | |
| | | private static Long sleepBigBusy = 100L ;//å¤§å¿æ¶ï¼é¤äºæä¹
ä»»å¡ï¼è¿æå
¶ä»ä»»å¡ï¼ï¼æ ¸å¿çº¿ç¨æåé´é |
| | | private static Long sleepBigBusy = 100L ;//å¤§å¿æ¶ï¼é¤äºæä¹
ä»»å¡ï¼è¿æ¯å
¶ä»ä»»å¡ï¼ï¼æ ¸å¿çº¿ç¨æåé´é |
| | | private static Long sleepSmallBusy = 500L ;//å°å¿æ¶ï¼åªææä¹
ä»»å¡ï¼æ å
¶ä»ä»»å¡ï¼ï¼æ ¸å¿çº¿ç¨æåé´é |
| | | |
| | | private CoreThread(){ |
| | |
| | | |
| | | /** |
| | | * 设置æåæ¶é¿ |
| | | * @param sleepBigBusy å¤§å¿æ¶ï¼é¤äºæä¹
ä»»å¡ï¼è¿æå
¶ä»ä»»å¡ï¼ï¼æ ¸å¿çº¿ç¨æåé´é |
| | | * @param sleepSmallBusy å°å¿æ¶ï¼åªææä¹
ä»»å¡ï¼æ å
¶ä»ä»»å¡ï¼ï¼æ ¸å¿çº¿ç¨æåé´é |
| | | * @param sleepWorking |
| | | * @param sleepIdel |
| | | */ |
| | | public void setSleep(Long sleepBigBusy, Long sleepSmallBusy){ |
| | | CoreThread.sleepBigBusy = sleepBigBusy ; |
| | |
| | | int onLineDataMinLength; |
| | | int headMinLength ; |
| | | |
| | | HashMap<String, AnnotationDriverVo> driverMap = ProtocolCache.getDriverMap() ; |
| | | HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ; |
| | | HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCache.getOnLineMap() ; |
| | | HashMap<String, AnnotationDriverVo> driverMap = ProtocolCach.getDriverMap() ; |
| | | HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ; |
| | | HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCach.getOnLineMap() ; |
| | | |
| | | for(String cName : classNames){ |
| | | String className = cName.substring(0, cName.lastIndexOf('.')) ; |
| | |
| | | * RTU å°å |
| | | */ |
| | | public String rtuAddr ; |
| | | |
| | | |
| | | /** |
| | | * æ°´è¡¨å· |
| | | * åºç¨çµä¿¡å¹³å°æ¶ææ |
| | | */ |
| | | public String meterNo ; |
| | | |
| | | /** |
| | | * çµä¿¡å¹³å°ä¸ç产åIDï¼å½ä¸å¨çµä¿¡å¹³å°ä¸è¿è¡æ¶ï¼ä¸ºnull |
| | | * åºç¨çµä¿¡å¹³å°æ¶ææ |
| | | */ |
| | | public Integer productId ; |
| | | |
| | | /** |
| | | * çµä¿¡å¹³å°ä¸ç设å¤IDï¼å½ä¸å¨çµä¿¡å¹³å°ä¸è¿è¡æ¶ï¼ä¸ºnull |
| | | * åºç¨çµä¿¡å¹³å°æ¶ææ |
| | | */ |
| | | public String deviceId ; |
| | | |
| | | /** |
| | | * å½ä»¤ç±»å:Rtuå½ä»¤ãéå¯¹çæ§ä¸é´ä»¶çå½ä»¤ |
| | | * ç±com.dy.common.mw.protocol.CommandTypeç±»å®ä¹ |
| | |
| | | public String toString(){ |
| | | String s = "å½ä»¤id=" + id + "\n" ; |
| | | s += (protocol == null ? "" : ("åè®®=" + protocol + "\n")); |
| | | s += (rtuAddr == null ? "" : ("Rtuå°å=" + rtuAddr + "\n")); |
| | | s += (rtuAddr == null ? "" : ("IMEIå·=" + rtuAddr + "\n")); |
| | | s += (meterNo == null ? "" : ("水表å·=" + meterNo + "\n")); |
| | | if(productId != null){ |
| | | s += "çµä¿¡å¹³å°äº§åID=" + productId + "\n" ; |
| | | } |
| | | if(deviceId != null && !deviceId.trim().equals("")){ |
| | | s += "çµä¿¡å¹³å°è®¾å¤ID=" + deviceId + "\n" ; |
| | | } |
| | | s += "å½ä»¤ç±»å=" + (type.equals(CommandType.innerCommand)?"å
é¨å½ä»¤":"ç»ç«¯å½ä»¤") + "\n" ; |
| | | s += (code == null ? "" : ("åè½ç =" + code + "\n")) ; |
| | | s += "è¿åä¸é´ä»¶å¯¹å½ä»¤å¤çç»æ=" + (noRtMwDealRes == null?"è¿å":(noRtMwDealRes?"ä¸è¿å":"è¿å") + "\n") ; |
| | |
| | | public void setProtocol(String protocol) { |
| | | this.protocol = protocol; |
| | | } |
| | | public String getMeterNo() { |
| | | return meterNo; |
| | | } |
| | | public void setMeterNo(String meterNo) { |
| | | this.meterNo = meterNo; |
| | | } |
| | | public Integer getProductId() { |
| | | return productId; |
| | | } |
| | | public void setProductId(Integer productId) { |
| | | this.productId = productId; |
| | | } |
| | | public String getDeviceId() { |
| | | return deviceId; |
| | | } |
| | | public void setDeviceId(String deviceId) { |
| | | this.deviceId = deviceId; |
| | | } |
| | | public String getType() { |
| | | return type; |
| | | } |
| | |
| | | |
| | | /** |
| | | * æ°æ®æ ¹ |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class Data implements java.io.Serializable{ |
| | |
| | | |
| | | private String commandId ;//å½ä»¤IDï¼å¯è½ä¸ºnull |
| | | private String rtuAddr ;//ç»ç«¯å°å |
| | | private String meterNo ;//æ°´è¡¨å· |
| | | private String protocol ;//æ°æ®æå¯¹åºçåè®®åç§° |
| | | private String code ;//æ°æ®æå¯¹åºçåè½ç : |
| | | private Object subData ;//对åºå个åè½ç çå
·ä½æ°æ® |
| | |
| | | public String toString() { |
| | | StringBuilder sb = new StringBuilder() ; |
| | | sb.append("ä¸è¡æ¥æ(åå
è¿å¶): ").append((hex == null?"":hex)).append("\n") ; // |
| | | sb.append("Rtuå°å : ").append((rtuAddr==null?"":rtuAddr)).append("\n") ; |
| | | sb.append("IMEIå· : ").append((rtuAddr==null?"":rtuAddr)).append("\n") ; |
| | | sb.append("æ°´è¡¨å· : ").append((meterNo==null?"":meterNo)).append("\n") ; |
| | | if(commandId != null){ |
| | | sb.append("å½ä»¤ID : ").append(commandId).append("\n") ; //å½ä»¤ID |
| | | } |
| | |
| | | this.rtuAddr = rtuAddr; |
| | | } |
| | | |
| | | public String getMeterNo() { |
| | | return meterNo; |
| | | } |
| | | public void setMeterNo(String meterNo) { |
| | | this.meterNo = meterNo; |
| | | } |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | |
| | | return codeParse ; |
| | | } |
| | | /** |
| | | * è§£æçµä¿¡å¹³å°ä¸è¡æ°æ® |
| | | * è§£æä¸è¡æ°æ® |
| | | * @param isLowPower æ¯å¦å¨ä½åèç¯å¢ä¸è¿è¡ |
| | | * @param rtuAddr æ§å¶å¨å°å |
| | | * @param upBuffer åèæ°ç» |
| | |
| | | * @return MidResult[] |
| | | */ |
| | | public abstract MidResult[] parseData(Boolean isLowPower, String rtuAddr, byte[] upBuffer, String upHex, DriverParserDataCallback callback, Object... params) ; |
| | | /** |
| | | * è§£æçµä¿¡å¹³å°ä¸è¡æ°æ® |
| | | * @param isLowPower æ¯å¦å¨ä½åèç¯å¢ä¸è¿è¡ |
| | | * @param rtuAddr æ§å¶å¨å°å |
| | | * @param productId çµä¿¡å¹³å°äº§åIDï¼å½ä¸å¨çµä¿¡å¹³å°ä¸è¿è¡æ¶ï¼ä¸ºnull |
| | | * @param deviceId çµä¿¡å¹³å°è®¾å¤IDï¼å½ä¸å¨çµä¿¡å¹³å°ä¸è¿è¡æ¶ï¼ä¸ºnull |
| | | * @param upBuffer åèæ°ç» |
| | | * @param upHex åèæ°ç»16è¿å¶å½¢å¼ |
| | | * @param callback åè° |
| | | * @return MidResult[] |
| | | */ |
| | | public abstract MidResult[] parseData(Boolean isLowPower, String rtuAddr, Integer productId, String deviceId, byte[] upBuffer, String upHex, DriverParserDataCallback callback, Object... params) ; |
| | | |
| | | /** |
| | | * æé ä¸è¡æ°æ®ï¼å½ä»¤ï¼ |
| | |
| | | |
| | | /** |
| | | * è§£æä¸è¡æ°æ®ååè° |
| | | * @param rtuAddr ä¸è¡æ°æ®å议头ä¸RtuAddr |
| | | * @param rtuAddr ä¸è¡æ°æ®å议头ä¸çIMEIå· |
| | | * @param meterNo ä¸è¡æ°æ®å议头ä¸çæ°´è¡¨å· |
| | | * @param code ä¸è¡æ°æ® åè½ç |
| | | * @param upHex ä¸è¡æ°æ® |
| | | * @param reportOrResponse_trueOrFalse ä¸è¡æ°æ®æ¯ä¸»å¨ä¸æ¥è¿æ¯å½ä»¤ç»æ |
| | | * @param parseFail ä¸è¡æ°æ®è§£ææ¯å¦å¤±è´¥ |
| | | * @param rtuAddrInData ä¸è¡æ°æ®ä¸å¨åè®®æ°æ®ä¸çRtuå°åï¼ |
| | | * âä¿®æ¹RTUç»ç«¯ç®¡çé
ç½®åæ°âå½ä»¤çè¿åæ°æ®ï¼å
¶å议头ä¸çRtuå°å䏿°æ®ä¸çRtuå°åä¸ä¸æ ·ï¼ |
| | | * 妿RTUä¸è½å
³éç½ç»ï¼é£ä¹sessionCachä¸çRtuå°åæ»æ¯ç¨ä¿®æ¹åçRtuå°åï¼ä½¿å¾ä»¥åä¸è¡æ°æ®çä¸è½æ¾å°ç¼åä¸çSession |
| | | * @param rtuAddrInData ä¸è¡æ°æ®ä¸å¨åè®®æ°æ®ä¸çIMEIå·ï¼ |
| | | * @param meterNoInData ä¸è¡æ°æ®ä¸å¨åè®®æ°æ®ä¸ç水表å·ï¼ |
| | | * âä¿®æ¹RTUç»ç«¯ç®¡çé
ç½®åæ°âå½ä»¤çè¿åæ°æ®ï¼å
¶å议头ä¸çIMEIå·ä¸æ°æ®ä¸çIMEIå·ä¸ä¸æ ·ï¼ |
| | | * 妿RTUä¸è½å
³éç½ç»ï¼é£ä¹sessionCachä¸çIMEIå·æ»æ¯ç¨ä¿®æ¹åçIMEIå·ï¼ä½¿å¾ä»¥åä¸è¡æ°æ®çä¸è½æ¾å°ç¼åä¸çSession |
| | | */ |
| | | void callback(String rtuAddr, |
| | | String code, |
| | | String meterNo, |
| | | String code, |
| | | String upHex, |
| | | Boolean reportOrResponse_trueOrFalse, |
| | | boolean parseFail, |
| | | String rtuAddrInData) ; |
| | | String rtuAddrInData, |
| | | String meterNoInData) ; |
| | | } |
| | |
| | | } |
| | | |
| | | public String protocolName ;//åè®®åç§° |
| | | public String rtuAddr ;//Rtuå°åï¼æ³¨ærtuAddrå¯è½ä¸ºnull |
| | | public String rtuAddr ;//IMEIå·ï¼æ³¨ærtuAddrå¯è½ä¸ºnull |
| | | public String meterNo ;//水表å·ï¼æ³¨æmeterNoå¯è½ä¸ºnull |
| | | public String message ;//åºéæ¶æ¯ |
| | | public Exception e ;//å¼å¸¸ |
| | | |
| | | public MidResultError(String protocolName, String rtuAddr, String message, Exception e){ |
| | | public MidResultError(String protocolName, String rtuAddr, String meterNo, String message, Exception e){ |
| | | this.protocolName = protocolName ; |
| | | this.rtuAddr = rtuAddr ; |
| | | this.meterNo = meterNo ; |
| | | this.message = message ; |
| | | this.e = e ; |
| | | } |
| | |
| | | public String commandId ;//åéå½ä»¤çIDï¼å¦ææ¯å½ä»¤ç»æï¼å¹¶ä¸å¹é
äºä¸åå½ä»¤ï¼æ¤å¼ä¸ä¸ºç©º |
| | | |
| | | public String protocolName ;//åè®®åç§° |
| | | public String rtuAddr ;//Rtuå°å |
| | | public String rtuAddr ;//IMEIå· |
| | | public String meterNo ;//æ°´è¡¨å· |
| | | public Integer productId ;//çµä¿¡å¹³å°äº§åIDï¼å½ä¸å¨çµä¿¡å¹³å°è¿è¡æ¶ï¼ä¸ºnull |
| | | public String deviceId ;//çµä¿¡å¹³å°è®¾å¤IDï¼å½ä¸å¨çµä¿¡å¹³å°è¿è¡æ¶ï¼ä¸ºnull |
| | | public String upCode ;//ä¸è¡æ°æ®ä¸çåè½ç |
| | | public String upHex ;//ä¸è¡æ°æ®åå
è¿å¶å½¢å¼ |
| | | public byte[] upBuffer ;//ä¸è¡æ°æ®åèæ°ç» |
| | |
| | | } |
| | | |
| | | public String protocolName ;//åè®®åç§° |
| | | public String rtuAddr ;//Rtuå°å |
| | | public String rtuAddr ;//IMEIå·(çµä¿¡å¹³å°IMEI) |
| | | public String meterNo ;//æ°´è¡¨å· |
| | | public Integer productId ;//çµä¿¡å¹³å°äº§åID |
| | | public String deviceId ;//çµä¿¡å¹³å°è®¾å¤ID |
| | | public String commandId ;//å½ä»¤IDï¼åèµ·å½ä»¤ç客æ·ç«¯(web端)çæï¼ä»¥å¹é
å½ä»¤ç»æ |
| | | public String downCode ;//ä¸è¡å½ä»¤åè½ç ; |
| | | public byte[] downBuffer ;//ä¸è¡å½ä»¤æ°æ® |
| | |
| | | class OnLineResult{ |
| | | public int result ;//åæç»æ |
| | | public String protocolName ;//åè®®åç§° |
| | | public String rtuAddr ;//Rtuå°å |
| | | public String rtuAddr ;//IMEIå· |
| | | public String meterNo ;//æ°´è¡¨å· |
| | | public byte[] remoteData;//éè¦åRtuååçæ°æ® |
| | | public OnLineResult(){ |
| | | result = OnLineAction_fail ; |
| | | rtuAddr = null ; |
| | | meterNo = null ; |
| | | remoteData = null ; |
| | | } |
| | | } |
| | | |
| | | int OnLineAction_fail = 0; //åæä¸çº¿æ°æ®å¤±è´¥ï¼å¦æä¾çæ°æ®ä¸ºnullçåå |
| | | int OnLineAction_success = 1; //åæä¸çº¿æ°æ®æåï¼å¹¶è½å¾å°Rtuå°å |
| | | int OnLineAction_success = 1; //åæä¸çº¿æ°æ®æåï¼å¹¶è½å¾å°IMEIå· |
| | | int OnLineAction_success_noMe = 2; //åæä¸çº¿æ°æ®æåï¼è¯å«åºä¸æ¯æ¬åè®®æ°æ® |
| | | int OnLineAction_success_response = 3; //åæä¸çº¿æ°æ®æåï¼å¹¶éè¦åRtuååæ°æ® |
| | | |
| | |
| | | public class OnLineHandle { |
| | | |
| | | /** |
| | | * è§£æä¸çº¿æ°æ®ï¼å¾å°RtuAddr |
| | | * è§£æä¸çº¿æ°æ®ï¼å¾å°IMEIå· |
| | | * @param bs åèæ°ç» |
| | | * @return OnLine.OnLineResult |
| | | */ |
| | | public OnLine.OnLineResult parse(byte[] bs)throws Exception{ |
| | | OnLine.OnLineResult rs = null ; |
| | | HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCache.getOnLineMap() ; |
| | | HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCach.getOnLineMap() ; |
| | | Collection<AnnotationOnLineVo> set = onLineMap.values() ; |
| | | if(set.size() == 0){ |
| | | throw new Exception("å¤çä¸çº¿æ¶ï¼å¾å°çåè®®éå为空ã") ; |
| | |
| | | } |
| | | } |
| | | if(rs == null){ |
| | | throw new Exception("å¤çä¸çº¿æ¶åºéï¼æªè½æååæåºRtuå°åï¼") ; |
| | | throw new Exception("å¤çä¸çº¿æ¶åºéï¼æªè½æååæåºIMEIå·ï¼") ; |
| | | } |
| | | return rs ; |
| | | } |
| | |
| | | try{ |
| | | PrefixedDataAvailableStatus pds = null ; |
| | | |
| | | HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ; |
| | | HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ; |
| | | Collection<AnnotationPrefixedDataAvailableVo> set = prefixedDataAvailableMap.values() ; |
| | | if(set.size() == 0){ |
| | | throw new Exception("ä¸çº¿æ°æ®å®æ´æ§æ£æ¥æ¶ï¼å¾å°çåè®®å®æ´æ§æ£æ¥ç±»éå为空ã") ; |
| | | } |
| | | int priority = ProtocolConstant.firstPriority ; |
| | | int prority = ProtocolConstant.firstPriority ; |
| | | |
| | | while(true){ |
| | | Object[] objs = this.getClassObjAndAnnotationVo(priority, set) ; |
| | | Object[] objs = this.getClassObjAndAnnotationVo(prority, set) ; |
| | | PrefixedDataAvailable pda = (PrefixedDataAvailable)objs[0] ; |
| | | if(pda == null && priority == ProtocolConstant.firstPriority){ |
| | | throw new Exception("ä¸çº¿æ°æ®å®æ´æ§æ£æ¥æ¶ï¼æªå¾å°ä¼å
级为" + priority + "ä¸çº¿æ°æ®å®æ´æ§æ£æ¥ç±»ï¼") ; |
| | | if(pda == null && prority == ProtocolConstant.firstPriority){ |
| | | throw new Exception("ä¸çº¿æ°æ®å®æ´æ§æ£æ¥æ¶ï¼æªå¾å°ä¼å
级为" + prority + "ä¸çº¿æ°æ®å®æ´æ§æ£æ¥ç±»ï¼") ; |
| | | }else if(pda == null){ |
| | | //说æä¸çº¿æ°æ®å®æ´æ§æ£æ¥ç±»éåå·²ç»éåå®äºã |
| | | break ; |
| | |
| | | if(pds == null){ |
| | | //说æä¸æ¯å¯¹åºçåè®®æ°æ®ï¼éè¦å¦å¤çåè®®æ¥å¤çä¸çº¿ |
| | | //循ç¯ç»§ç» |
| | | priority++ ; |
| | | prority++ ; |
| | | }else{ |
| | | //åæ¢å¾ªç¯ï¼è¿åç»æ |
| | | break ; |
| | |
| | | try{ |
| | | PrefixedDataAvailableStatus pds = null ; |
| | | |
| | | HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ; |
| | | HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ; |
| | | Collection<AnnotationPrefixedDataAvailableVo> set = prefixedDataAvailableMap.values() ; |
| | | if(set.size() == 0){ |
| | | throw new Exception("ä¸çº¿æ°æ®å®æ´æ§æ£æ¥æ¶ï¼å¾å°çåè®®éå为空ã") ; |
| | |
| | | AnnotationScan.getIntance() ; |
| | | |
| | | //å个å议驱å¨ç±»æ«æèªå·±çåè½ç 注解 |
| | | HashMap<String, AnnotationDriverVo> drivers = ProtocolCache.getDriverMap() ; |
| | | HashMap<String, AnnotationDriverVo> drivers = ProtocolCach.getDriverMap() ; |
| | | Collection<String> colDrivers = drivers.keySet() ; |
| | | StringBuilder totalProtocols = new StringBuilder() ; |
| | | for(String protocolName : colDrivers){ |
| | |
| | | totalProtocols.append("ï¼") ; |
| | | } |
| | | totalProtocols.append(protocolName) ; |
| | | Driver dri = ProtocolCache.getDriver(protocolName) ; |
| | | Driver dri = ProtocolCach.getDriver(protocolName) ; |
| | | if(dri != null){ |
| | | dri.scanAnnotationCode(); |
| | | } |
| | |
| | | */ |
| | | @SuppressWarnings("unused") |
| | | public boolean isOnlyOneProtocol(){ |
| | | HashMap<String, AnnotationDriverVo> drivers = ProtocolCache.getDriverMap() ; |
| | | HashMap<String, AnnotationDriverVo> drivers = ProtocolCach.getDriverMap() ; |
| | | return drivers.size() == 1 ; |
| | | } |
| | | |
| | |
| | | public void start(UnitStartedCallbackInterface callback) throws Exception { |
| | | if(!started){ |
| | | started = true ; |
| | | if(confVo.enableShortThreadPool) { |
| | | TreadPoolFactory.initThreadPoolShort("çä»»å¡å·¥ä½çº¿ç¨æ± ", |
| | | this.confVo.short_maxThread, |
| | | this.confVo.short_minThread, |
| | | this.confVo.short_freeTimeout, |
| | | if(confVo.enableThreadPool){ |
| | | TreadPoolFactory.initThreadPoolShort("çä»»å¡å·¥ä½çº¿ç¨æ± ", |
| | | this.confVo.short_maxThread, |
| | | this.confVo.short_minThread, |
| | | this.confVo.short_freeTimeout, |
| | | this.confVo.short_busyTimeout); |
| | | }else{ |
| | | System.out.println("ççº¿ç¨æ± é
ç½®ä¸å¯å¨"); |
| | | } |
| | | if(confVo.enableLongThreadPool) { |
| | | TreadPoolFactory.initThreadPoolLong("é¿ä»»å¡å·¥ä½çº¿ç¨æ± ", |
| | | this.confVo.long_maxThread, |
| | | this.confVo.long_minThread, |
| | | this.confVo.long_freeTimeout, |
| | | TreadPoolFactory.initThreadPoolLong("é¿ä»»å¡å·¥ä½çº¿ç¨æ± ", |
| | | this.confVo.long_maxThread, |
| | | this.confVo.long_minThread, |
| | | this.confVo.long_freeTimeout, |
| | | this.confVo.long_busyTimeout); |
| | | }else{ |
| | | System.out.println("é¿çº¿ç¨æ± é
ç½®ä¸å¯å¨"); |
| | | |
| | | if(this.confVo.showStartInfo){ |
| | | System.out.println("çº¿ç¨æ± 模åæåå¯å¨"); |
| | | } |
| | | } |
| | | if(this.confVo.showStartInfo){ |
| | | System.out.println("çº¿ç¨æ± 模åæåå¯å¨"); |
| | | } |
| | | callback.call(null); |
| | | } |
| | | callback.call(null); |
| | | } |
| | | |
| | | @Override |
| | | public void stop(UnitStartedCallbackInterface callback) { |
| | | public void stop(UnitStartedCallbackInterface callback) throws Exception { |
| | | } |
| | | |
| | | /* |
| | | |
| | | public static void main(String[] args) throws Exception{ |
| | | SupportUnitConfigVo supVo = new SupportUnitConfigVo() ; |
| | | //ç工使¶é¿çº¿ç¨æ± ï¼çº¿ç¨è´è´£ç¨æ¶è¾ççå·¥ä½ä»»å¡ |
| | |
| | | supVo.long_busyTimeout = -1 ; |
| | | } |
| | | |
| | | supVo.enableShortThreadPool = true ; |
| | | supVo.enableLongThreadPool = true ; |
| | | |
| | | supVo.enableThreadPool = true ; |
| | | |
| | | supVo.showStartInfo = true ; |
| | | |
| | | SupportUnit supUnit = SupportUnit.getInstance() ; |
| | |
| | | supUnit.start(obj -> { |
| | | }); |
| | | } |
| | | |
| | | private static class AdapterImp_SupportUnit implements SupportUnitAdapter { |
| | | |
| | | private SupportUnitConfigVo configVo = null ; |
| | |
| | | public void setConfig(SupportUnitConfigVo configVo) { |
| | | this.configVo = configVo; |
| | | } |
| | | |
| | | |
| | | } |
| | | */ |
| | | } |
| | |
| | | package com.dy.common.mw.support; |
| | | |
| | | public class SupportUnitConfigVo { |
| | | |
| | | public boolean enableShortThreadPool ; |
| | | |
| | | public boolean enableLongThreadPool ; |
| | | |
| | | public boolean enableThreadPool ; |
| | | |
| | | //çä»»å¡çº¿ç¨æ± |
| | | public int short_maxThread ; |
| | |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * éåï¼å
è¿å
åºï¼é线ç¨å®å
¨ |
| | | * éåï¼å
è¿å
åº |
| | | */ |
| | | public class Queue { |
| | | @SuppressWarnings("unfinal") |
| | |
| | | */ |
| | | @SuppressWarnings("unused") |
| | | public void pushHead(NodeObj obj)throws Exception{ |
| | | //两个线ç¨ç¯å¢ï¼éè¦åæ¥é |
| | | synchronized(synObj){ |
| | | if(obj == null){ |
| | | return ; |
| | |
| | | * @param obj å
¥åç对象 |
| | | */ |
| | | public void pushTail(NodeObj obj)throws Exception{ |
| | | //两个线ç¨ç¯å¢ï¼éè¦åæ¥é |
| | | synchronized(synObj){ |
| | | if(obj == null){ |
| | | return ; |
| | |
| | | * @return åºå对象 |
| | | */ |
| | | public NodeObj pop(){ |
| | | //两个线ç¨ç¯å¢ï¼éè¦åæ¥é |
| | | synchronized(synObj){ |
| | | NodeObj obj = null ; |
| | | if(this.size > 0){ |
| | |
| | | */ |
| | | @SuppressWarnings("unused") |
| | | public Node getFirstNode(){ |
| | | //两个线ç¨ç¯å¢ï¼éè¦åæ¥é |
| | | synchronized(synObj) { |
| | | Node node = this.head.next; |
| | | if (node != this.tail) { |
| | | return node; |
| | | } |
| | | return null; |
| | | Node node = this.head.next ; |
| | | if(node != this.tail){ |
| | | return node ; |
| | | } |
| | | return null ; |
| | | } |
| | | /** |
| | | * å¾å°æåä¸ä¸ªèç¹ï¼ä½ä¸æèç¹ä»éå䏿¸
é¤ |
| | |
| | | */ |
| | | @SuppressWarnings("unused") |
| | | public Node getLastNode(){ |
| | | //两个线ç¨ç¯å¢ï¼éè¦åæ¥é |
| | | synchronized(synObj) { |
| | | Node node = this.tail.pre; |
| | | if (node != this.head) { |
| | | return node; |
| | | } |
| | | return null; |
| | | Node node = this.tail.pre ; |
| | | if(node != this.head){ |
| | | return node ; |
| | | } |
| | | return null ; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Logger log = LogManager.getLogger(MonitorThread.class.getName()); |
| | | |
| | | /** |
| | | * å¾å°é»è®¤å¯ä¸å®ä¾ |
| | | * @return |
| | | */ |
| | | // public MyThreadPool getDefaultInstance(){ |
| | | // if(myPool == null){ |
| | | // myPool = new MyThreadPool(null, null, null, null, null) ; |
| | | // } |
| | | // return myPool ; |
| | | // } |
| | | /** |
| | | * å¾å°å¯ä¸å®ä¾ |
| | | * @param poolName |
| | | * @param maxNum |
| | | * @param minNum |
| | | * @param freeTimeout |
| | | * @param busyTimeout |
| | | * @return |
| | | */ |
| | | // public MyThreadPool getInstance( |
| | | // String poolName , |
| | | // Integer maxNum , |
| | | // Integer minNum , |
| | | // Long freeTimeout , |
| | | // Long busyTimeout){ |
| | | // if(myPool == null){ |
| | | // myPool = new MyThreadPool(poolName, maxNum, minNum, freeTimeout, busyTimeout) ; |
| | | // } |
| | | // return myPool ; |
| | | // } |
| | | |
| | | /** |
| | | * çº¿ç¨æ± æé æ¹æ³ |
| | |
| | | } |
| | | this.poolName = poolName ; |
| | | |
| | | if(maxNum == null || maxNum.intValue() < 0){ |
| | | maxNum = 65535 ; |
| | | if(maxNum == null || maxNum.intValue() <= 0){ |
| | | maxNum = -1 ; |
| | | } |
| | | if(minNum == null || minNum.intValue() < 0){ |
| | | minNum = 0 ; |
| | |
| | | }else{ |
| | | this.busyTimeout = busyTimeout ; |
| | | } |
| | | if(maxNum != 0){ |
| | | this.busiThreads = new ArrayList<>(); |
| | | this.freeThreads = new ArrayList<>(); |
| | | //æå°åçº¿ç¨æ± |
| | | for (int i = 0; i < this.minNum ; i++) { |
| | | MyThread t = new MyThread(this); |
| | | t.start(); |
| | | this.freeThreads.add(t); |
| | | this.currNum++; |
| | | } |
| | | this.monitorThread = new MonitorThread(this) ; |
| | | this.monitorThread.start() ; |
| | | |
| | | this.busiThreads = new ArrayList<MyThread>(); |
| | | this.freeThreads = new ArrayList<MyThread>(); |
| | | |
| | | //æå°åçº¿ç¨æ± |
| | | for (int i = 0; i < this.minNum ; i++) { |
| | | MyThread t = new MyThread(this); |
| | | t.start(); |
| | | this.freeThreads.add(t); |
| | | this.currNum++; |
| | | } |
| | | |
| | | this.monitorThread = new MonitorThread(this) ; |
| | | this.monitorThread.start() ; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void putJob(Job job) throws Exception { |
| | | if(this.busiThreads == null || this.freeThreads == null){ |
| | | throw new Exception("çº¿ç¨æ± æªå¯å¨") ; |
| | | } |
| | | synchronized(this.synObj) { |
| | | //log.debug("å·¥ä½ä»»å¡åé
å°çº¿ç¨æ± ä¸ã") ; |
| | | MyThread t = null ; |
| | |
| | | /** |
| | | * 线ç¨å·¥ä½å®æï¼ä»busiThreadsåå½freeThreads |
| | | */ |
| | | protected void freeThread(MyThread t) throws Exception { |
| | | if(this.busiThreads == null || this.freeThreads == null){ |
| | | throw new Exception("çº¿ç¨æ± æªå¯å¨") ; |
| | | } |
| | | protected void freeThread(MyThread t) { |
| | | synchronized (synObj) { |
| | | busiThreads.remove(t); |
| | | freeThreads.add(t); |
| | |
| | | |
| | | /** |
| | | * |
| | | * @param pool æ± |
| | | * @param pool |
| | | */ |
| | | public MonitorThread(MyThreadPool pool){ |
| | | this.pool = pool ; |
| | |
| | | } |
| | | }//end synchronized (pool.synObj) |
| | | }catch(Exception e){ |
| | | e.printStackTrace(); |
| | | }finally{ |
| | | continue ; |
| | | } |
| | |
| | | |
| | | /** |
| | | * 设置线ç¨å·¥ä½å¯¹è±¡ |
| | | * @param job å·¥ä½ |
| | | * @param job |
| | | */ |
| | | protected void putJob(Job job) throws Exception { |
| | | if(job == null){ |
| | |
| | | } |
| | | |
| | | public void free(){ |
| | | try{ |
| | | //使æ¬çº¿ç¨åå½ç©ºé²çº¿ç¨æ± |
| | | pool.freeThread(this); |
| | | //空é²å¼å§è®°æ¶ |
| | | this.time = System.currentTimeMillis() ; |
| | | // 没æå¯åçäº |
| | | this.canJob = false; |
| | | log.debug("çº¿ç¨æ± (" + this.pool.poolName + ")ä¸ç线ç¨åå½ç©ºé²éåã"); |
| | | }catch (Exception e){ |
| | | log.error("çº¿ç¨æ± (" + pool.poolName + ")çå·¥ä½çº¿ç¨éæ¾å彿¶åçå¼å¸¸:\n" + e.getMessage(), e); |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | //使æ¬çº¿ç¨åå½ç©ºé²çº¿ç¨æ± |
| | | pool.freeThread(this); |
| | | //空é²å¼å§è®°æ¶ |
| | | this.time = System.currentTimeMillis() ; |
| | | // 没æå¯åçäº |
| | | this.canJob = false; |
| | | log.debug("çº¿ç¨æ± (" + this.pool.poolName + ")ä¸ç线ç¨åå½ç©ºé²éåã"); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * åå§åçº¿ç¨æ± |
| | | * @param poolName çº¿ç¨æ± å线ç¨åç§° |
| | | * @param maxNum çº¿ç¨æ± æå¤§çº¿ç¨æ° ï¼è¥ä¸º-1ï¼ä¸åéå¶ |
| | | * @param minNum çº¿ç¨æ± æå°çº¿ç¨æ°ï¼æåå§çº¿ç¨æ° |
| | | * @param threadPoolName çº¿ç¨æ± å线ç¨åç§° |
| | | * @param maxThreadNum çº¿ç¨æ± æå¤§çº¿ç¨æ° ï¼è¥ä¸º-1ï¼ä¸åéå¶ |
| | | * @param minThreadNum çº¿ç¨æ± æå°çº¿ç¨æ°ï¼æåå§çº¿ç¨æ° |
| | | * @param freeTimeout 空é²çº¿ç¨è¶
æ¶æ¶é¿(ç§) |
| | | * @param busyTimeout å¿ç¢çº¿ç¨è¶
æ¶æ¶é¿(ç§)ï¼è¥ä¸º-1ï¼ä¸åéå¶ |
| | | * @return çº¿ç¨æ± å®ä¾ |
| | |
| | | |
| | | /** |
| | | * åå§åçº¿ç¨æ± |
| | | * @param poolName çº¿ç¨æ± å线ç¨åç§° |
| | | * @param maxNum çº¿ç¨æ± æå¤§çº¿ç¨æ°ï¼è¥ä¸º-1ï¼ä¸åéå¶ |
| | | * @param minNum çº¿ç¨æ± æå°çº¿ç¨æ°ï¼æåå§çº¿ç¨æ° |
| | | * @param threadPoolName çº¿ç¨æ± å线ç¨åç§° |
| | | * @param maxThreadNum çº¿ç¨æ± æå¤§çº¿ç¨æ°ï¼è¥ä¸º-1ï¼ä¸åéå¶ |
| | | * @param minThreadNum çº¿ç¨æ± æå°çº¿ç¨æ°ï¼æåå§çº¿ç¨æ° |
| | | * @param freeTimeout 空é²çº¿ç¨è¶
æ¶æ¶é¿(ç§) |
| | | * @param busyTimeout å¿ç¢çº¿ç¨è¶
æ¶æ¶é¿(ç§)ï¼è¥ä¸º-1ï¼ä¸åéå¶ |
| | | * @return çº¿ç¨æ± å®ä¾ |
| | |
| | | } |
| | | /** |
| | | * å¾å°å¯ä¸çº¿ç¨æ± å®ä¾ |
| | | * @param dataSourceName |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public final static ThreadPool.Pool getThreadPoolShort() |
| | |
| | | } |
| | | /** |
| | | * å¾å°å¯ä¸çº¿ç¨æ± å®ä¾ |
| | | * @param dataSourceName |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public final static ThreadPool.Pool getThreadPoolLong() |
| | | throws Exception { |
| | |
| | | } |
| | | } |
| | | |
| | | /* |
| | | public static void main(final String[] args) { |
| | | try { |
| | | AsciiPic.createAsciiPic(toBufferedImage(creatImage("DY.png"))); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | */ |
| | | } |
| | |
| | | * å°åèæ°ç»åå¹¶å°åèæ°ç»ä¸ |
| | | * @param bGroup1 被åå¹¶æ°ç» |
| | | * @param bGroup2 åå¹¶æ°ç» |
| | | * @return è¿å åå¹¶åæ°ç» |
| | | * @return åå¹¶åæ°ç» |
| | | */ |
| | | public static byte[] bytesMerge(byte[] bGroup1, byte[] bGroup2){ |
| | | if(bGroup1 == null && bGroup2 == null){ |
| | |
| | | |
| | | /** |
| | | * 夿ææåèæ¯å¦ä¸º0xFF |
| | | * @param bs åèæ°ç» |
| | | * @param index 䏿 ä½ |
| | | * @param len é¿åº¦ |
| | | * @return è¿å è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @param bs |
| | | * @param index |
| | | * @param len |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static boolean bytesIsAll0xFF(byte[] bs, int index, int len)throws Exception { |
| | | int count = 0 ; |
| | |
| | | count++ ; |
| | | } |
| | | } |
| | | return count == len; |
| | | return count==len?true:false ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * äºè¿å¶è½¬åè¿å¶æ° |
| | | * @param str |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static int binary2Int(String str) throws Exception { |
| | | int cnt=0; |
| | |
| | | return sum; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * åè转åäºè¿å¶ |
| | | * |
| | | * |
| | | * @param b byte |
| | | * @throws Exception å¼å¸¸ |
| | | * @return è¿å String |
| | | * @throws Exception |
| | | * @return String |
| | | */ |
| | | public static String byte2Binary(byte b) throws Exception { |
| | | int n = (b + 256) % 256 + 256; |
| | |
| | | } |
| | | /** |
| | | * åè转å8ä½äºè¿å¶ |
| | | * |
| | | * |
| | | * @param b |
| | | * byte |
| | | * @throws Exception å¼å¸¸ |
| | | * @return è¿å String |
| | | * @throws Exception |
| | | * @return String |
| | | */ |
| | | public static String byte2bit8Binary(byte b) throws Exception { |
| | | String s = byte2Binary(b); |
| | |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åèåbit |
| | | * @param b |
| | | * @param b |
| | | * @throws Exception å¼å¸¸ |
| | | * @return è¿å String |
| | | * @param index |
| | | * @throws Exception |
| | | * @return String |
| | | */ |
| | | public static byte[] getBit(byte b) throws Exception { |
| | | byte[] bs = new byte[8] ; |
| | |
| | | /** |
| | | * åèåbit |
| | | * @param b |
| | | * @param index 䏿 ä½ |
| | | * @throws Exception å¼å¸¸ |
| | | * @return è¿å String |
| | | * @param index |
| | | * @throws Exception |
| | | * @return String |
| | | */ |
| | | public static byte getBit(byte b, byte index) throws Exception { |
| | | if(index == 0){ |
| | |
| | | |
| | | /** |
| | | * ä¸ä¸ªåèè½¬æ£æ´æ° |
| | | * |
| | | * |
| | | * @param b |
| | | * byte |
| | | * @throws Exception å¼å¸¸ |
| | | * @return è¿å String |
| | | * @throws Exception |
| | | * @return String |
| | | */ |
| | | public static Short byte2PlusInt(byte b) throws Exception { |
| | | short v = b ; |
| | |
| | | return v ; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * double转æ¢byte |
| | | * @param bs åèæ°ç» byte[] |
| | | * @param bs byte[] |
| | | * @param value double doubleç±»åçåæ° |
| | | * @param from å¼å§ä½ int |
| | | * @param from int |
| | | */ |
| | | public static void double2Bytes_BE(byte[] bs, double value, int from)throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); |
| | |
| | | /** |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * double转æ¢byteï¼åèé¡ºåºæ¯åç |
| | | * @param bs åèæ°ç» byte[] |
| | | * @param bs byte[] |
| | | * @param value double doubleç±»åçåæ° |
| | | * @param from å¼å§ä½ int |
| | | * @param from int |
| | | */ |
| | | public static void double2Bytes_LE(byte[] bs, double value, int from)throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); |
| | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * byte转æ¢double |
| | | * @param bs åèæ°ç» byte[] |
| | | * @param from å¼å§ä½ int |
| | | * @param bs byte[] |
| | | * @param from int |
| | | */ |
| | | public static double bytes2Double_BE(byte[] bs, int from) throws Exception { |
| | | long l = bytes2Long_BE(bs, from); |
| | |
| | | /** |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * byte转æ¢doubleï¼åèé¡ºåºæ¯åç |
| | | * @param bs åèæ°ç» byte[] |
| | | * @param from å¼å§ä½ int |
| | | * @param bs byte[] |
| | | * @param from int |
| | | */ |
| | | public static double bytes2Double_LE(byte[] bs, int from) throws Exception { |
| | | long l = bytes2Long_LE(bs, from); |
| | |
| | | |
| | | /** |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * 转æ¢longå为byteæ°ç» |
| | | * 转æ¢longå为byteæ°ç» |
| | | * @value bs byte[] |
| | | * @value value long |
| | | * @value from int |
| | |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); |
| | | if (b) { |
| | | for (int i = 0; i < 8; i++) { |
| | | bs[from + i] = Long.valueOf(value & 0xff).byteValue(); |
| | | value = value >> 8; |
| | | bs[from + i] = Long.valueOf(value & 0xff).byteValue(); |
| | | value = value >> 8; |
| | | if(value == 0){ |
| | | break ; |
| | | } |
| | |
| | | throw new Exception("long2Bytesæ¶æ°ç»è¶ç"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * 8ä½åèæ°ç»è½¬æ¢ä¸ºé¿æ´å |
| | | * @param bs åèæ°ç» byte[] |
| | | * @return è¿å |
| | | * @param bs byte[] |
| | | * @return |
| | | */ |
| | | public static long bytes2Long_BE(byte[] bs) { |
| | | int len = bs.length ; |
| | |
| | | l = l | ls[i] ; |
| | | } |
| | | return l; |
| | | } |
| | | } |
| | | return 0L ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * 8ä½åèæ°ç»è½¬æ¢ä¸ºé¿æ´å |
| | | * @param bs åèæ°ç» byte[] |
| | | * @param from å¼å§ä½ int |
| | | * @return è¿å |
| | | * @param bs byte[] |
| | | * @param from int |
| | | * @return |
| | | */ |
| | | public static long bytes2Long_BE(byte[] bs, int from) throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); |
| | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * 8ä½åèæ°ç»è½¬æ¢ä¸ºé¿æ´å |
| | | * @param bs åèæ°ç» byte[] |
| | | * @param from å¼å§ä½ int |
| | | * @param bs byte[] |
| | | * @param from int |
| | | * @param end int |
| | | * @return è¿å |
| | | * @return |
| | | */ |
| | | public static long bytes2Long_BE(byte[] bs, int from, int end) throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, end); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * 8ä½åèæ°ç»è½¬æ¢ä¸ºé¿æ´å |
| | | * @param bs åèæ°ç» byte[] |
| | | * @return è¿å |
| | | * @param bs byte[] |
| | | * @return |
| | | */ |
| | | public static long bytes2Long_LE(byte[] bs) { |
| | | int len = bs.length ; |
| | |
| | | l = l | ls[i] ; |
| | | } |
| | | return l; |
| | | } |
| | | } |
| | | return 0L ; |
| | | } |
| | | |
| | | /** |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * 8ä½åèæ°ç»è½¬æ¢ä¸ºé¿æ´å |
| | | * @param bs åèæ°ç» byte[] |
| | | * @param from å¼å§ä½ int |
| | | * @return è¿å |
| | | * 8ä½åèæ°ç»è½¬æ¢ä¸ºé¿æ´å |
| | | * @param bs byte[] |
| | | * @param from int |
| | | * @return |
| | | */ |
| | | public static long bytes2Long_LE(byte[] bs, int from) throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); |
| | |
| | | /** |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * 8ä½åèæ°ç»è½¬æ¢ä¸ºé¿æ´å |
| | | * @param bs åèæ°ç» byte[] |
| | | * @param from å¼å§ä½ int |
| | | * @param bs byte[] |
| | | * @param from int |
| | | * @param end int |
| | | * @return è¿å |
| | | * @return |
| | | */ |
| | | public static long bytes2Long_LE(byte[] bs, int from, int end) throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, end); |
| | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * 4ä½åèæ°ç»è½¬æ¢ä¸ºæ´å |
| | | * @param bs åèæ°ç» |
| | | * @param from å¼å§ä½ |
| | | * @return è¿å |
| | | * @param b |
| | | * @return |
| | | */ |
| | | public static int bytes2Int_BE(byte[] bs, int from) throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 4); |
| | |
| | | throw new Exception("byte2Intæ¶æ°ç»è¶ç"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * 4ä½åèæ°ç»è½¬æ¢ä¸ºæ´åï¼åèé¡ºåºæ¯åç |
| | | * @param bs åèæ°ç» åèæ°ç» |
| | | * @return è¿å |
| | | * @param b |
| | | * @return |
| | | */ |
| | | public static int bytes2Int_LE(byte[] bs, int from) throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 4); |
| | |
| | | throw new Exception("byte2Intæ¶æ°ç»è¶ç"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * 2ä½åèæ°ç»è½¬æ¢ä¸ºçæ´å |
| | | * @param bs åèæ°ç» åèæ°ç» |
| | | * @return è¿å |
| | | * @param b |
| | | * @return |
| | | */ |
| | | public static short bytes2Short_BE(byte[] bs, int from) throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 2); |
| | | if (b) { |
| | | int s = 0; |
| | | int s0 = bs[from + 0] ; |
| | | int s0 = bs[from + 0] ; |
| | | int s1 = bs[from + 1] ; |
| | | |
| | | // s1ä¸å |
| | |
| | | /** |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * 2ä½åèæ°ç»è½¬æ¢ä¸ºçæ´åï¼åèé¡ºåºæ¯åç |
| | | * @param bs åèæ°ç» åèæ°ç» |
| | | * @return è¿å |
| | | * @param b |
| | | * @return |
| | | */ |
| | | public static short bytes2Short_LE(byte[] bs, int from) throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + 2); |
| | | if (b) { |
| | | int s = 0; |
| | | int s0 = bs[from + 0] ; |
| | | int s0 = bs[from + 0] ; |
| | | int s1 = bs[from + 1] ; |
| | | |
| | | // s0ä¸å |
| | |
| | | } |
| | | /** |
| | | * å符å°ä¸åèè½¬æ¢ |
| | | * |
| | | * |
| | | * @value bs byte[] |
| | | * @value ch char charç±»åçåæ° |
| | | * @value index int |
| | | * @return è¿å |
| | | * @return |
| | | */ |
| | | public static void char2Bytes(byte[] bs, char ch, int index)throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, index); |
| | |
| | | |
| | | /** |
| | | * ä¸åè转æ¢ä¸ºå符 |
| | | * @param bs åèæ°ç» åèæ°ç» |
| | | * |
| | | * @param b |
| | | * @value index int |
| | | * @return è¿å |
| | | * @return |
| | | */ |
| | | public static char bytes2Char(byte[] bs, int index) throws Exception { |
| | | boolean b = isOutOfArrLength(bs.length, index); |
| | |
| | | |
| | | /** |
| | | * åç¬¦ä¸²åæ°å转æbyte |
| | | * |
| | | * |
| | | * @param s |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static byte string2byte(String s) throws Exception { |
| | | int n ; |
| | | int n = 0; |
| | | try { |
| | | n = Integer.parseInt(s); |
| | | } catch (Exception e) { |
| | |
| | | * @value bs byte[] |
| | | * @value str String |
| | | * @value from int |
| | | * @return è¿å |
| | | * @return |
| | | * @throws java.io.UnsupportedEncodingException |
| | | */ |
| | | public static int string2Bytes_BE(byte[] bs, String str, int from, int end)throws Exception { |
| | |
| | | * @value bs byte[] |
| | | * @value str String |
| | | * @value from int |
| | | * @return è¿å |
| | | * @return |
| | | * @throws java.io.UnsupportedEncodingException |
| | | */ |
| | | public static int string2Bytes_LE(byte[] bs, String str, int from, int end)throws Exception { |
| | |
| | | * @value bs byte[] |
| | | * @value str String |
| | | * @value from int |
| | | * @return è¿å |
| | | * @return |
| | | * @throws java.io.UnsupportedEncodingException |
| | | */ |
| | | public static int string2Bytes_BE(byte[] bs, String str, int from)throws Exception { |
| | |
| | | * @value bs byte[] |
| | | * @value str String |
| | | * @value from int |
| | | * @return è¿å |
| | | * @return |
| | | * @throws java.io.UnsupportedEncodingException |
| | | */ |
| | | public static int string2Bytes_LE(byte[] bs, String str, int from)throws Exception { |
| | |
| | | |
| | | /** |
| | | * 夿æ°ç»ä¸æ æ¯å¦è¶ç |
| | | * |
| | | * |
| | | * @value bsLength æ°ç»æ»é¿åº¦ |
| | | * @value toSite æ°ç»åç§»é |
| | | * @return è¿å |
| | | * @return |
| | | */ |
| | | private static boolean isOutOfArrLength(int bsLength, int toSite) { |
| | | if (bsLength > toSite) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * åèæ°ç»è½¬æ¢æåå
è¿å¶çå符串 |
| | | * |
| | | * @param src byte[] |
| | | * åèæ°ç»è½¬æ¢æåå
è¿å¶çå符串 |
| | | * |
| | | * @param b byte[] |
| | | * @param hasBlank 16è¿å¶æ¯å¦ç¨ç©ºæ ¼åé |
| | | * @return è¿å String |
| | | * @return String |
| | | */ |
| | | public static String bytes2Hex(byte[] src, boolean hasBlank){ |
| | | StringBuilder stringBuilder = new StringBuilder(""); |
| | | if (src == null || src.length <= 0) { |
| | | return null; |
| | | } |
| | | for (int i = 0; i < src.length; i++) { |
| | | int v = src[i] & 0xFF; |
| | | String str = Integer.toHexString(v); |
| | | if (str.length() < 2) { |
| | | public static String bytes2Hex(byte[] src, boolean hasBlank){ |
| | | StringBuilder stringBuilder = new StringBuilder(""); |
| | | if (src == null || src.length <= 0) { |
| | | return null; |
| | | } |
| | | for (int i = 0; i < src.length; i++) { |
| | | int v = src[i] & 0xFF; |
| | | String str = Integer.toHexString(v); |
| | | if (str.length() < 2) { |
| | | str = "0" + str; |
| | | } |
| | | } |
| | | if (hasBlank) { |
| | | if (i == 0) { |
| | | stringBuilder.append(str); |
| | | stringBuilder.append(str); |
| | | } else { |
| | | stringBuilder.append(" " + str); |
| | | stringBuilder.append(" " + str); |
| | | } |
| | | } else { |
| | | stringBuilder.append(str); |
| | | stringBuilder.append(str); |
| | | } |
| | | } |
| | | } |
| | | return stringBuilder.toString().toUpperCase(Locale.US); |
| | | } |
| | | } |
| | | /** |
| | | * åèæ°ç»è½¬æ¢æåå
è¿å¶çå符串 |
| | | * |
| | | * @param src byte[] |
| | | * åèæ°ç»è½¬æ¢æåå
è¿å¶çå符串 |
| | | * |
| | | * @param b byte[] |
| | | * @param hasBlank 16è¿å¶æ¯å¦ç¨ç©ºæ ¼åé |
| | | * @param from å¼å§ä½ |
| | | * @param len é¿åº¦ |
| | | * @return è¿å String |
| | | * @param from |
| | | * @param len |
| | | * @return String |
| | | */ |
| | | public static String bytes2Hex(byte[] src, boolean hasBlank, int from, int len){ |
| | | if (src == null || src.length <= 0 || src.length < from + len) { |
| | | return null; |
| | | } |
| | | public static String bytes2Hex(byte[] src, boolean hasBlank, int from, int len){ |
| | | if (src == null || src.length <= 0 || src.length < from + len) { |
| | | return null; |
| | | } |
| | | byte[] bb = new byte[len]; |
| | | for (int i = 0 ; i < len; i++) { |
| | | bb[i] = src[from + i]; |
| | | } |
| | | return bytes2Hex(bb, hasBlank) ; |
| | | } |
| | | /** |
| | | } |
| | | /** |
| | | * åå
è¿å¶è½¬åèæ°ç» |
| | | * @param hex the hex string |
| | | * @return è¿å byte[] |
| | | */ |
| | | public static byte[] hex2Bytes(String hex) { |
| | | if (hex == null || hex.equals("")) { |
| | | return null; |
| | | } |
| | | hex = hex.toUpperCase(Locale.ENGLISH); |
| | | int length = hex.length() / 2; |
| | | char[] hexChars = hex.toCharArray(); |
| | | byte[] d = new byte[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | int pos = i * 2; |
| | | d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); |
| | | } |
| | | return d; |
| | | } |
| | | /** |
| | | * @param hexString the hex string |
| | | * @return byte[] |
| | | */ |
| | | public static byte[] hex2Bytes(String hex) { |
| | | if (hex == null || hex.equals("")) { |
| | | return null; |
| | | } |
| | | hex = hex.toUpperCase(Locale.ENGLISH); |
| | | int length = hex.length() / 2; |
| | | char[] hexChars = hex.toCharArray(); |
| | | byte[] d = new byte[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | int pos = i * 2; |
| | | d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); |
| | | } |
| | | return d; |
| | | } |
| | | /** |
| | | * åå
è¿å¶è½¬åèæ°ç» |
| | | * @param hex the hex string |
| | | * @return è¿å byte[] |
| | | */ |
| | | public static int hex2Bytes(String hex, byte[] bs, int fromIndex) { |
| | | if (hex == null || hex.equals("")) { |
| | | return fromIndex; |
| | | } |
| | | hex = hex.toUpperCase(Locale.ENGLISH); |
| | | int length = hex.length() / 2; |
| | | char[] hexChars = hex.toCharArray(); |
| | | byte[] d = new byte[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | int pos = i * 2; |
| | | d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); |
| | | * @param hexString the hex string |
| | | * @return byte[] |
| | | */ |
| | | public static int hex2Bytes(String hex, byte[] bs, int fromIndex) { |
| | | if (hex == null || hex.equals("")) { |
| | | return fromIndex; |
| | | } |
| | | hex = hex.toUpperCase(Locale.ENGLISH); |
| | | int length = hex.length() / 2; |
| | | char[] hexChars = hex.toCharArray(); |
| | | byte[] d = new byte[length]; |
| | | for (int i = 0; i < length; i++) { |
| | | int pos = i * 2; |
| | | d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); |
| | | } |
| | | for(int i = 0 ; i < d.length; i++){ |
| | | bs[fromIndex++] = d[i] ; |
| | | } |
| | | return fromIndex ; |
| | | } |
| | | return fromIndex ; |
| | | } |
| | | |
| | | private static final char[] HEX_CHAR = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; |
| | | /** |
| | | * å°byte[]转æ¢ä¸º16è¿å¶å符串 |
| | | * |
| | | * @param bytes å¾
转æ¢byte[] |
| | | * @return è¿å 转æ¢åçå符串 |
| | | * @return 转æ¢åçå符串 |
| | | */ |
| | | public static String bytesToHex(byte[] bytes) { |
| | | //ä¸ä¸ªbyte为8ä½ï¼å¯ç¨ä¸¤ä¸ªåå
è¿å¶ä½æ è¯ |
| | |
| | | } |
| | | return new String(buf); |
| | | } |
| | | /** |
| | | * å°byte[]转æ¢ä¸º16è¿å¶å符串 |
| | | * |
| | | * @param bytes å¾
转æ¢byte[] |
| | | * @return è¿å 转æ¢åçå符串 |
| | | */ |
| | | public static String bytesToHex(byte[] bytes, int startIndex, int endIndex) { |
| | | byte[] bs = new byte[endIndex - startIndex + 1] ; |
| | | byte j = 0 ; |
| | | for(int i = startIndex; i <= endIndex; i++){ |
| | | bs[j++] = bytes[i] ; |
| | | } |
| | | //ä¸ä¸ªbyte为8ä½ï¼å¯ç¨ä¸¤ä¸ªåå
è¿å¶ä½æ è¯ |
| | | char[] buf = new char[bs.length * 2]; |
| | | int a = 0; |
| | | int index = 0; |
| | | for (byte b : bs) { // 使ç¨é¤ä¸åä½è¿è¡è½¬æ¢ |
| | | if (b < 0) { |
| | | a = 256 + b; |
| | | } else { |
| | | a = b; |
| | | } |
| | | |
| | | buf[index++] = HEX_CHAR[a / 16]; |
| | | buf[index++] = HEX_CHAR[a % 16]; |
| | | } |
| | | return new String(buf); |
| | | } |
| | | |
| | | /** |
| | | * å°16è¿å¶å符串转æ¢ä¸ºbyte[] |
| | | * |
| | | * @param str å¾
转æ¢å符串 |
| | | * @return è¿å 转æ¢åçbyte[] |
| | | * @return 转æ¢åçbyte[] |
| | | */ |
| | | public static byte[] hexToBytes(String str) { |
| | | if (str == null || "".equals(str.trim())) { |
| | |
| | | /** |
| | | * Convert char to byte |
| | | * @param c char |
| | | * @return è¿å byte |
| | | * @return byte |
| | | */ |
| | | private static byte charToByte(char c) { |
| | | return (byte) "0123456789ABCDEF".indexOf(c); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * æ´å½¢è½¬æBCDç¼ç |
| | | * @param i |
| | | * @return è¿å |
| | | * @param l |
| | | * @return |
| | | */ |
| | | public static byte[] int2BCD_BE(int i)throws Exception { |
| | | String str = "" + i; |
| | |
| | | /** |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * æ´å½¢è½¬æBCDç¼ç ï¼åèé¡ºåºæ¯åç |
| | | * @param i |
| | | * @return è¿å |
| | | * @param l |
| | | * @return |
| | | */ |
| | | public static byte[] int2BCD_LE(int i)throws Exception { |
| | | String str = "" + i; |
| | |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * é¿æ´å½¢è½¬æBCDç¼ç |
| | | * @param l |
| | | * @return è¿å |
| | | * @return |
| | | */ |
| | | public static byte[] long2BCD_BE(long l)throws Exception { |
| | | String str = "" + l; |
| | |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * é¿æ´å½¢è½¬æBCDç¼ç ï¼åèé¡ºåºæ¯åç |
| | | * @param l |
| | | * @return è¿å |
| | | * @return |
| | | */ |
| | | public static byte[] long2BCD_LE(long l) throws Exception { |
| | | String str = "" + l; |
| | |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * åç¬¦ä¸²åæ°å转æBCDç¼ç |
| | | * @param s |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static byte[] string2BCD_BE(String s) throws Exception { |
| | | byte[] b ; |
| | | byte[] b = null; |
| | | if (s.length() % 2 == 0) { |
| | | b = new byte[s.length() / 2]; |
| | | } else { |
| | | b = new byte[(s.length() / 2) + 1]; |
| | | } |
| | | |
| | | |
| | | encodeBCD_BE(s, b, 0, b.length); |
| | | |
| | | return b ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * åç¬¦ä¸²è½¬æ¢æbyteæ°ç» |
| | | * @value bs byte[] |
| | | * @value str String |
| | | * @value fromIndex int |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ å¼å¸¸ |
| | | * @return |
| | | * @throws java.io.Exception |
| | | */ |
| | | public static int string2BCD_BE(byte[] bs, String str, int fromIndex)throws Exception { |
| | | byte[] bb = string2BCD_BE(str); |
| | |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * åç¬¦ä¸²åæ°å转æBCDç¼ç ï¼åèé¡ºåºæ¯åç |
| | | * @param s |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static byte[] string2BCD_LE(String s) throws Exception { |
| | | byte[] b = null; |
| | |
| | | |
| | | return b; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * åç¬¦ä¸²è½¬æ¢æbyteæ°ç» |
| | | * @value bs byte[] |
| | | * @value str String |
| | | * @value fromIndex int |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ å¼å¸¸ |
| | | * @return |
| | | * @throws java.io.Exception |
| | | */ |
| | | public static int string2BCD_LE(byte[] bs, String str, int fromIndex)throws Exception { |
| | | byte[] bb = string2BCD_LE(str); |
| | |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * BCDç¼ç è½¬ææ´å |
| | | * @param b |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @param startIndex |
| | | * @param endIndex |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static int BCD2Int_BE(byte b) throws Exception { |
| | | String str = ""; |
| | |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * BCDç¼ç è½¬ææ´åï¼åèé¡ºåºæ¯åç |
| | | * @param b |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @param startIndex |
| | | * @param endIndex |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static int BCD2Int_LE(byte b) throws Exception { |
| | | String str = ""; |
| | |
| | | * @param b |
| | | * @param startIndex |
| | | * @param endIndex |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static int BCD2Int_BE(byte[] b, int startIndex, int endIndex)throws Exception { |
| | | String str = ""; |
| | |
| | | * @param b |
| | | * @param startIndex |
| | | * @param endIndex |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static int BCD2Int_LE(byte[] b, int startIndex, int endIndex)throws Exception { |
| | | String str = ""; |
| | |
| | | * @param b |
| | | * @param startIndex |
| | | * @param endIndex |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static long BCD2Long_BE(byte[] b, int startIndex, int endIndex)throws Exception { |
| | | String str = ""; |
| | |
| | | * @param b |
| | | * @param startIndex |
| | | * @param endIndex |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static long BCD2Long_LE(byte[] b, int startIndex, int endIndex)throws Exception { |
| | | String str = ""; |
| | |
| | | * @param b |
| | | * @param startIndex |
| | | * @param endIndex |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String BCD2String_BE(byte[] b, int startIndex, int endIndex) throws Exception { |
| | | return decodeBCD_BE(b, startIndex, endIndex - startIndex + 1); |
| | |
| | | * @param b |
| | | * @param startIndex |
| | | * @param endIndex |
| | | * @return è¿å |
| | | * @throws Exception å¼å¸¸ |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String BCD2String_LE(byte[] b, int startIndex, int endIndex) throws Exception { |
| | | return decodeBCD_LE(b, startIndex, endIndex - startIndex + 1); |
| | |
| | | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * ç¼ç BCDï¼ä¾å¦1387ç¼ç æ 13 87ï¼é¡ºåºæ¯æ£ç |
| | | * ç¼ç BCDï¼ä¾å¦1387ç¼ç æ 13 87ï¼é¡ºåºæ¯æ£ç |
| | | * @param value |
| | | * @param dest |
| | | * @param startIndex |
| | | * @param length é¿åº¦ |
| | | * @param length |
| | | */ |
| | | private static void encodeBCD_BE(String value, byte[] dest, int startIndex, int length)throws Exception { |
| | | if (value == null || !value.matches("\\d*")) { |
| | | throw new Exception("æ°å转æBCDç¼ç æ¶åºéï¼ä¸æ¯åæ³æ°å:" + value, null); |
| | | } |
| | | |
| | | |
| | | int[] tmpInts = new int[2 * length]; |
| | | int index = value.length() - 1; |
| | | for (int i = tmpInts.length - 1; i >= 0 && index >= 0; i--, index--) { |
| | |
| | | dest[i] = (byte) (tmpInts[2 * j] * 16 + tmpInts[2 * j + 1]); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * ç¼ç BCDï¼ä¾å¦1387ç¼ç æ 87 13ï¼é¡ºåºæ¯åç |
| | | * ç¼ç BCDï¼ä¾å¦1387ç¼ç æ 87 13ï¼é¡ºåºæ¯åç |
| | | * @param value |
| | | * @param dest |
| | | * @param startIndex |
| | | * @param length é¿åº¦ |
| | | * @param length |
| | | */ |
| | | private static void encodeBCD_LE(String value, byte[] dest, int startIndex, int length)throws Exception { |
| | | if (value == null || !value.matches("\\d*")) { |
| | | throw new Exception("æ°å转æBCDç¼ç æ¶åºéï¼ä¸æ¯åæ³æ°å:" + value, null); |
| | | } |
| | | |
| | | |
| | | int[] tmpInts = new int[2 * length]; |
| | | int index = value.length() - 1; |
| | | for (int i = 0; i <= tmpInts.length - 1 && index >= 0; i++, index--) { |
| | |
| | | * è§£ç BCDï¼é¡ºåºæ¯æ£ç |
| | | * @param src |
| | | * @param startIndex |
| | | * @param length é¿åº¦ |
| | | * @return è¿å |
| | | * @param length |
| | | * @return |
| | | */ |
| | | private static String decodeBCD_BE(byte[] src, int startIndex, int length)throws Exception { |
| | | StringBuilder sb = new StringBuilder(); |
| | |
| | | * ç¼ç BCDï¼é¡ºåºæ¯åç |
| | | * @param src |
| | | * @param startIndex |
| | | * @param length é¿åº¦ |
| | | * @return è¿å |
| | | * @param length |
| | | * @return |
| | | */ |
| | | private static String decodeBCD_LE(byte[] src, int startIndex, int length)throws Exception { |
| | | StringBuilder sb = new StringBuilder(); |
| | |
| | | // System.out.println(v5); |
| | | // |
| | | // } |
| | | /* |
| | | public static void main(String[] args) throws Exception { |
| | | byte[] bs = new byte[]{0x38, 0x36, 0x39, 0x31} ; |
| | | String s = bytes2String_BE(bs, 0, 3) ; |
| | |
| | | } |
| | | System.out.println(v); |
| | | } |
| | | */ |
| | | |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | /* |
| | | |
| | | public static void main(String[] args){ |
| | | Long now = getTime() ; |
| | | System.out.println(now); |
| | |
| | | String s = yyyy_MM_dd_HH_mm_ss(dt); |
| | | System.out.println(s); |
| | | } |
| | | */ |
| | | |
| | | |
| | | } |
| | |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | <version>1.0.0</version> |
| | | <scope>provided</scope> |
| | | <!-- optional=trueï¼ä¸ä¼ éä¾èµï¼å³pipIrr-web-baseä¾èµpipIrr-globalï¼ä½ä¸ä¼ä¼ éä¾èµå°pipIrr-common --> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | <version>3.1.3</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <!-- æé¤æpipIrr-commonçææä¾èµï¼æ¬æ¨¡åèªå·±å®ä¹ä¾èµ --> |
| | | <groupId>*</groupId> |
| | | <artifactId>*</artifactId> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-json</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-logging</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | |
| | | <!-- è¾å
¥åæ°æ®éªè¯ --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | |
| | | <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <version>3.1.3</version> |
| | | <scope>runtime</scope> |
| | | </dependency> |
| | | <!-- lombok --> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>1.18.28</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.aspectj</groupId> |
| | | <artifactId>aspectjweaver</artifactId> |
| | | <version>1.9.20</version> |
| | | </dependency> |
| | | <!--log4j2æ¥å¿--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-log4j2</artifactId> |
| | | <version>2.7.9</version> |
| | | </dependency> |
| | | <!-- ç¨äºè¾¨è®¤log4j2.ymlæä»¶ --> |
| | | <dependency> |
| | | <groupId>com.fasterxml.jackson.dataformat</groupId> |
| | | <artifactId>jackson-dataformat-yaml</artifactId> |
| | | <version>2.15.2</version> |
| | | </dependency> |
| | | <!--mybatis-plus-spring-boot--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>3.5.3.2</version> |
| | | </dependency> |
| | | <!-- é¿éfastjson --> |
| | | <dependency> |
| | | <groupId>cglib</groupId> |
| | | <artifactId>cglib</artifactId> |
| | | <version>3.3.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba.fastjson2</groupId> |
| | | <artifactId>fastjson2</artifactId> |
| | |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <!-- 该æä»¶ä¸ä¼å°é¡¹ç®ä¸å¼å
¥çä¾èµæè¿æç»ç Jar æä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-jar-plugin</artifactId> |
| | | <!-- spring bootæä¾çmavenæå
æä»¶ --> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <configuration> |
| | | <archive> |
| | | <!-- çæçjarä¸ï¼ä¸è¦å
å«pom.xmlåpom.propertiesè¿ä¸¤ä¸ªæä»¶ --> |
| | | <addMavenDescriptor>false</addMavenDescriptor> |
| | | <!-- è¿é¨å坿坿 ,å ä¸çè¯åç´æ¥çæå¯è¿è¡jarå
|
| | | <manifest> |
| | | <mainClass>com.dy.Main</mainClass> |
| | | <useUniqueVersions>false</useUniqueVersions> |
| | | <addClasspath>true</addClasspath> |
| | | <classpathPrefix>lib/</classpathPrefix> |
| | | </manifest> |
| | | --> |
| | | <!-- manifestEntriesçä½ç¨æ¯æå®æ¬å°ï¼èªå·±ä¸è½½çlibä¸çï¼jarå
æ·»å å°MANIFEST.MFæä»¶ä¸å» |
| | | <manifestEntries> |
| | | <Class-Path>.lib/alipay-sdk.java.jar</Class-Path> |
| | | </manifestEntries> |
| | | --> |
| | | </archive> |
| | | <!-- æé¤æä¸ªæä»¶ |
| | | <excludes> |
| | | <exclude>com/dy/App.class</exclude> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | --> |
| | | <!-- 坿§è¡jarè¿è¡å½åãè¿æ ·ä¼æå
æä¸¤ä¸ªjarå
ï¼ä¸ä¼å¯¹æ®éjaréæ°å½åã |
| | | <classifier>exec</classifier> |
| | | --> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- å½é¡¹ç®ä¸ä¾èµæ¯è¾å¤æ¶ï¼æä»¬å¯ä»¥åå© maven-dependency-plugin æä»¶èªå¨å¸®æä»¬ä¸è½½ä¾èµç Jar æä»¶ï¼æ¨èå°è¯¥æä»¶ç»å®å°packageçå½å¨æä¸ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-dependency-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <!-- ç»å®çå½å¨æ --> |
| | | <phase>package</phase> |
| | | <goals> |
| | | <goal>copy-dependencies</goal> |
| | | </goals> |
| | | <!-- 设置ä¾èµçåæ¾è·¯å¾ --> |
| | | <configuration> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 设置javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <!-- sourceï¼ æºä»£ç ç¼è¯çæ¬ï¼targetï¼ ç®æ å¹³å°ç¼è¯çæ¬ï¼encodingï¼ å符éç¼ç ã --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- è§£å³èµæºæä»¶çç¼ç é®é¢ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- mavenéæ§è¡æµè¯ç¨ä¾çæä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- 强å¶è®¾å® javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | </project> |
| | |
| | | * ç¼å· |
| | | */ |
| | | @Schema(description = "åæ·ç¼å·(ç³»ç»èªå¨çæ)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public String num ; |
| | | public Integer num; |
| | | |
| | | /** |
| | | * ææºå· |
| | |
| | | /** |
| | | * è¡æ¿åºç¼å· |
| | | */ |
| | | @Schema(description = "è¡æ¿åºç¼å·(çå¸å¿2ä½ï¼éæ3ä½)", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @Schema(description = "è¡æ¿åºç¼å·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "è¡æ¿åºç¼å·ä¸è½ä¸ºç©º") //ä¸è½ä¸ºç©ºä¹ä¸è½ä¸ºnull |
| | | @Max(message = "è¡æ¿åºç¼å·ä¸å¤§äº99", value = 999) |
| | | @Max(message = "è¡æ¿åºç¼å·ä¸å¤§äº99", value = 99) |
| | | @Min(message = "è¡æ¿åºç¼å·ä¸å°äº0",value = 0) |
| | | public String num; |
| | | |
| | |
| | | */ |
| | | public enum DistrictLevel implements IEnum { |
| | | |
| | | Province((byte)0, "ç"), |
| | | City((byte)1, "å¸"), |
| | | County((byte)2, "å¿"), |
| | | Town((byte)3, "é"), |
| | |
| | | } |
| | | |
| | | public static DistrictLevel get(Byte code){ |
| | | if(code.byteValue() == Province.code.byteValue()){ |
| | | return Province ; |
| | | }if(code.byteValue() == City.code.byteValue()){ |
| | | if(code.byteValue() == City.code.byteValue()){ |
| | | return City ; |
| | | }else if(code.byteValue() == County.code.byteValue()){ |
| | | return County ; |
| | |
| | | commandCallback: http://127.0.0.1:8079/remote/rtu/comCallback |
| | | webPort: 8070 |
| | | actutorPort: 9070 |
| | | idSuffix: 0 #æ¤å¤åªæ¯å ä½ï¼å
·ä½è®¾ç½®å¨éä¿¡ä¸é´ä»¶çconfig.xmlä¸è®¾ç½® |
| | | idSuffix: 0 |
| | | sso: |
| | | checkUrl: http://127.0.0.1:8079/sso/sso/ssoCheck |
| | | webPort: 8079 |
| | |
| | | <!-- å¤ä¸ªç»ç»ï¼ç¨ç¼å·åºåï¼ç¼å·ä»1å¼å§ --> |
| | | <org1 name="ym"> |
| | | <districts> |
| | | <!-- ççº§è¡æ¿åºå¨ä¸å¡éæ±ä¸æ²¡æä½ç°ï¼åªå¨çæ±æµ·ICå¡è®¾è®¡ä¸ç¨å°ï¼æä»¥è¿éæå
¶level设置为0 --> |
| | | <province name="äºåç" num="53" level="0"> |
| | | <city name="æ¥éå½æèªæ²»å·" num="23" level="1"> |
| | | <country name="å
è°å¿" num="28" level="2" /> |
| | | </city> |
| | | </province> |
| | | <city name="æ¥éå½æèªæ²»å·" num="23" level="1"> |
| | | <country name="å
è°å¿" num="28" level="2" /> |
| | | </city> |
| | | </districts> |
| | | <user name="è¶
级管çå" phone="admin" password="admin" supperAdmin="1" /> |
| | | </org1> |
| | |
| | | <result column="divideId" jdbcType="BIGINT" property="divideId" /> |
| | | <result column="typeId" jdbcType="BIGINT" property="typeId" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="num" jdbcType="VARCHAR" property="num" /> |
| | | <result column="num" jdbcType="INTEGER" property="num" /> |
| | | <result column="phone" jdbcType="VARCHAR" property="phone" /> |
| | | <result column="idCard" jdbcType="VARCHAR" property="idcard" /> |
| | | <result column="area" jdbcType="FLOAT" property="area" /> |
| | |
| | | </sql> |
| | | <sql id="part_Column_List"> |
| | | <!--@mbg.generated--> |
| | | ${alias}.id, ${alias}.countyId, ${alias}.townId, ${alias}.villageId, ${alias}.blockId, ${alias}.divideId, ${alias}.typeId, |
| | | ${alias}.`name`, ${alias}.num, ${alias}.phone, ${alias}.idCard, ${alias}.area, ${alias}.district,${alias}.address, |
| | | ${alias}.remark, ${alias}.disabled |
| | | ${alias}.id, ${alias}.countyId, ${alias}.townId, ${alias}.villageId, ${alias}.blockId, ${alias}.divideId, ${alias}.typeId, ${alias}.name, ${alias}.num, ${alias}.phone, ${alias}.idCard, ${alias}.area, ${alias}.district,${alias}.address, ${alias}.remark, |
| | | ${alias}.disabled |
| | | </sql> |
| | | |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | |
| | | values (#{id,jdbcType=BIGINT}, #{countyId,jdbcType=BIGINT}, |
| | | #{townId,jdbcType=BIGINT}, #{villageId,jdbcType=BIGINT}, |
| | | #{blockId,jdbcType=BIGINT}, #{divideId,jdbcType=BIGINT}, #{typeId,jdbcType=BIGINT}, |
| | | #{name,jdbcType=VARCHAR}, #{num,jdbcType=VARCHAR}, |
| | | #{name,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER}, |
| | | #{phone,jdbcType=VARCHAR}, #{idcard,jdbcType=VARCHAR}, |
| | | #{area,jdbcType=FLOAT}, #{district,jdbcType=VARCHAR}, |
| | | #{address,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR}, |
| | |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="num != null"> |
| | | #{num,jdbcType=VARCHAR}, |
| | | #{num,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="phone != null"> |
| | | #{phone,jdbcType=VARCHAR}, |
| | |
| | | 'name' = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="num != null"> |
| | | num = #{num,jdbcType=VARCHAR}, |
| | | num = #{num,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="phone != null"> |
| | | phone = #{phone,jdbcType=VARCHAR}, |
| | |
| | | blockId = #{blockId,jdbcType=BIGINT}, |
| | | typeId = #{typeId,jdbcType=BIGINT}, |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | num = #{num,jdbcType=VARCHAR}, |
| | | num = #{num,jdbcType=INTEGER}, |
| | | phone = #{phone,jdbcType=VARCHAR}, |
| | | idcard = #{idcard,jdbcType=VARCHAR}, |
| | | area = #{area,jdbcType=FLOAT}, |
| | |
| | | |
| | | <packaging>jar</packaging> |
| | | <artifactId>pipIrr-mw-accept</artifactId> |
| | | <version>1.0.0</version> |
| | | <name>pipIrr-mw-accept</name> |
| | | <description>éä¿¡ä¸é´ä»¶</description> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-json</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-logging</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <!-- ç³»ç»ç管 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- apiå¨çº¿ææ¡£ https://springdoc.org/#modules--> |
| | | <dependency> |
| | | <groupId>org.springdoc</groupId> |
| | | <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springdoc</groupId> |
| | | <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springdoc</groupId> |
| | | <artifactId>springdoc-openapi-security</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 卿å è½½æ°ç¼è¯çç±» --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <scope>runtime</scope> |
| | | </dependency> |
| | | |
| | | <!--mysql驱å¨--> |
| | | <dependency> |
| | | <groupId>com.mysql</groupId> |
| | | <artifactId>mysql-connector-j</artifactId> |
| | | <version>8.0.33</version> |
| | | </dependency> |
| | | <!--druid-spring-bootè¿æ¥æ± --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid-spring-boot-starter</artifactId> |
| | | <version>1.2.20</version> |
| | | </dependency> |
| | | <!--mybatis-plus-spring-boot--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>3.5.3.2</version> |
| | | </dependency> |
| | | |
| | | <!-- beanåmapäºè½¬æ¢ --> |
| | | <dependency> |
| | | <groupId>org.apache.dubbo</groupId> |
| | | <artifactId>dubbo</artifactId> |
| | | <version>3.2.7</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>io.netty</groupId> |
| | | <artifactId>netty-all</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.yaml</groupId> |
| | | <artifactId>snakeyaml</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-context</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.alibaba.spring</groupId> |
| | | <artifactId>spring-context-support</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.alibaba.fastjson2</groupId> |
| | | <artifactId>fastjson2</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>hessian-lite</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.javassist</groupId> |
| | | <artifactId>javassist</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!-- apache mina --> |
| | | <dependency> |
| | | <groupId>org.apache.mina</groupId> |
| | | <artifactId>mina-core</artifactId> |
| | | <version>2.2.2</version> |
| | | <version>2.2.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.mina</groupId> |
| | | <artifactId>mina-filter-compression</artifactId> |
| | | <version>2.2.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <version>2.0.7</version> |
| | | </dependency> |
| | | |
| | | <!-- æµè¯ --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | </project> |
| | |
| | | import org.springframework.boot.CommandLineRunner; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import org.springframework.context.annotation.EnableAspectJAutoProxy; |
| | | |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import com.dy.aceMw.server.tasks.BusiConstantTask; |
| | | import com.dy.common.mw.UnitInterface; |
| | | import com.dy.common.mw.UnitStartedCallbackInterface; |
| | | import com.dy.common.mw.channel.rmi.RmiConfigVo; |
| | |
| | | ServerProperties.lastUpDataTimeLive = conf.getSetAttrPlusInt(doc, "config.base", "lastUpDataTimeLive", null, 0, 5, null) * 1000L ; |
| | | //æ°æ®åºæ°æ®idçæå¨çidåç¼ï¼0æ¯é»è®¤çåç¼ï¼ä¸è¬webç³»ç»åºç¨ï¼æ°æ®ä¸é´ä»¶idåç¼å¤§äºçäº1 |
| | | ServerProperties.dbDataIdSuffix = conf.getSetAttrInt(doc, "config.base", "dbDataIdSuffix", null, 1, 9, null); |
| | | //ä¸ä¸è¡æ°æ®ç¼åéåä¸ç¼åæ°æ®ä¸ªæ°çæ¥è¦éï¼è¿ä¸ªä¸ç°å®é¡¹ç®ææ¥æ°´è¡¨æ°ç¸å
³ |
| | | ServerProperties.cacheUpDownDataWarnCount = conf.getSetAttrPlusInt(doc, "config.base", "cacheUpDownDataWarnCount", null, 1, null, null) ; |
| | | //ä¸ä¸è¡æ°æ®ç¼åéåä¸ç¼åæ°æ®ä¸ªæ°çæå¤§å¼ï¼è¿ä¸ªä¸ç°å®é¡¹ç®ææ¥æ°´è¡¨æ°ç¸å
³ |
| | | ServerProperties.cacheUpDownDataMaxCount = conf.getSetAttrPlusInt(doc, "config.base", "cacheUpDownDataMaxCount", null, 1, null, null) ; |
| | | if(ServerProperties.cacheUpDownDataMaxCount <= ServerProperties.cacheUpDownDataWarnCount){ |
| | | throw new Exception("cacheUpDownDataMaxCountå¿
须大äºcacheUpDownDataWarnCount") ; |
| | | } |
| | | |
| | | |
| | | //设置IDçæå¨çåç¼ |
| | | IDLongGenerator.setSuffix(ServerProperties.dbDataIdSuffix.intValue()); |
| | | |
| | |
| | | //æ¯ææ¨¡åï¼ springHibernateå çº¿ç¨æ± |
| | | SupportUnitConfigVo supVo = new SupportUnitConfigVo() ; |
| | | //ç工使¶é¿çº¿ç¨æ± ï¼çº¿ç¨è´è´£ç¨æ¶è¾ççå·¥ä½ä»»å¡ |
| | | supVo.short_maxThread = conf.getSetAttrPlusInt(doc, "config.support", "short_maxThread", null, -1, 1000, null) ;//æ± ä¸æå¤§çº¿ç¨æ°ä¸ºææCPUæ ¸æ°+1 |
| | | if(supVo.short_maxThread < 0){ |
| | | supVo.short_maxThread = -1 ; |
| | | } |
| | | supVo.short_minThread = conf.getSetAttrPlusInt(doc, "config.support", "short_minThread", null, -1, 100, null) ;//æ± ä¸æå°çº¿ç¨æ° |
| | | if(supVo.short_minThread < 0){ |
| | | supVo.short_minThread = -1 ; |
| | | } |
| | | supVo.short_maxThread = conf.getSetAttrPlusInt(doc, "config.support", "short_maxThread", null, 1, 1000, null) ;//æ± ä¸æå¤§çº¿ç¨æ°ä¸ºææCPUæ ¸æ°+1 |
| | | supVo.short_minThread = conf.getSetAttrPlusInt(doc, "config.support", "short_minThread", null, 1, 5, null) ;//æ± ä¸æå°çº¿ç¨æ° |
| | | supVo.short_freeTimeout = conf.getSetAttrPlusInt(doc, "config.support", "short_freeTimeout", null, 1, 90, null) * 1000 ;//çº¿ç¨æ°ç©ºé²æ¶é¿ï¼è¥æ± ä¸çº¿ç¨æ°é大äºminThreadï¼ä¸æç线ç¨ç©ºé²æ¶é¿è¶
è¿freeTimeoutï¼åæ¸
é¤è¯¥çº¿ç¨ï¼ä¸ºäºä¸æ¸
é¤ï¼æminThreadä¸maxThread设置ç¸ç |
| | | supVo.short_busyTimeout = conf.getSetAttrPlusInt(doc, "config.support", "short_busyTimeout", null, 1, 10, null) * 1000 ;//线ç¨ä¸é´æå·¥ä½æ¶é¿ï¼åä½ä¸ºç§)è¶
æ¶éï¼è®¤ä¸ºçº¿ç¨å·²ç»äºå´©æºï¼å°å¼ºå¶æ¸
é¤ï¼ç工使¶é¿è®¾ç½®ä¸º5ç§ |
| | | if(supVo.short_maxThread == 0 || supVo.short_minThread == 0){ |
| | | supVo.enableShortThreadPool = false ; |
| | | }else{ |
| | | supVo.enableShortThreadPool = true ; |
| | | } |
| | | |
| | | //é¿å·¥ä½æ¶é¿çº¿ç¨æ± ï¼çº¿ç¨è´è´£ç¨æ¶è¾é¿çå·¥ä½ä»»å¡ |
| | | supVo.long_maxThread = conf.getSetAttrInt(doc, "config.support", "long_maxThread", null, -1, 1000, null) ;//æ± ä¸æå¤§çº¿ç¨æ°,è¥ä¸º-1ï¼ä¸åéå¶ |
| | | if(supVo.long_maxThread < 0){ |
| | | supVo.long_maxThread = -1 ; |
| | | } |
| | | supVo.long_minThread = conf.getSetAttrPlusInt(doc, "config.support", "long_minThread", null, -1, 100, null) ;//æ± ä¸æå°çº¿ç¨æ° |
| | | if(supVo.long_minThread < 0){ |
| | | supVo.long_minThread = -1 ; |
| | | } |
| | | supVo.long_minThread = conf.getSetAttrPlusInt(doc, "config.support", "long_minThread", null, 0, 5, null) ;//æ± ä¸æå°çº¿ç¨æ° |
| | | supVo.long_freeTimeout = conf.getSetAttrPlusInt(doc, "config.support", "long_freeTimeout", null, 1, 90, null) * 1000 ;//çº¿ç¨æ°ç©ºé²æ¶é¿ï¼è¥æ± ä¸çº¿ç¨æ°é大äºminThreadï¼ä¸æç线ç¨ç©ºé²æ¶é¿è¶
è¿freeTimeoutï¼åæ¸
é¤è¯¥çº¿ç¨ |
| | | supVo.long_busyTimeout = conf.getSetAttrInt(doc, "config.support", "long_busyTimeout", null, -1, 10, null) ;//线ç¨ä¸é´æå·¥ä½æ¶é¿ï¼åä½ä¸ºç§)è¶
æ¶éï¼è¥ä¸º-1ï¼ä¸åéå¶ |
| | | if(supVo.long_busyTimeout < 0){ |
| | | supVo.long_busyTimeout = -1 ; |
| | | } |
| | | if(supVo.long_maxThread == 0 || supVo.long_minThread == 0){ |
| | | supVo.enableLongThreadPool = false ; |
| | | }else{ |
| | | supVo.enableLongThreadPool = true ; |
| | | } |
| | | |
| | | |
| | | supVo.enableThreadPool = conf.getSetAttrBoolean(doc, "config.support", "enableThreadPool", null, null) ; |
| | | |
| | | // supVo.enableSpringHibernate = conf.getSetAttrBoolean(doc, "config.support", "enableSpringHibernate", null, null) ; |
| | | // if(supVo.enableSpringHibernate){ |
| | | // supVo.springXmlFile = conf.getSetAttrTxt(doc, "config.support", "springXmlFile", null, false, null) ; |
| | | // } |
| | | |
| | | supVo.showStartInfo = showStartInfo ; |
| | | |
| | | AdapterImp_SupportUnit supAdap = new AdapterImp_SupportUnit() ; |
| | |
| | | CoreUnitConfigVo coreConfVo = new CoreUnitConfigVo(); |
| | | coreConfVo.sleepBigBusy = conf.getSetAttrPlusInt(doc, "config.core", "sleepBigBusy", null, 1, 200, null).longValue() ; |
| | | coreConfVo.sleepSmallBusy = conf.getSetAttrPlusInt(doc, "config.core", "sleepSmallBusy", null, 2, 1000, null).longValue(); |
| | | coreConfVo.queueWarnSize = ServerProperties.cacheUpDownDataWarnCount ; |
| | | coreConfVo.queueMaxSize = ServerProperties.cacheUpDownDataMaxCount ; |
| | | coreConfVo.queueWarnSize = conf.getSetAttrPlusInt(doc, "config.core", "queueWarnSize", null, 500, 1000000, null) ; |
| | | coreConfVo.queueMaxSize = conf.getSetAttrPlusInt(doc, "config.core", "queueMaxSize", null, 5000, 3000000, null) ; |
| | | coreConfVo.showStartInfo = showStartInfo ; |
| | | AdapterImp_CoreUnit coreAdap = new AdapterImp_CoreUnit(); |
| | | coreAdap.setConfig(coreConfVo); |
| | | CoreUnit coreUnit = CoreUnit.getInstance(); |
| | | coreUnit.setAdapter(coreAdap); |
| | | CoreUnit.addConstantTask(new ToRtuConstantTask()); |
| | | CoreUnit.addConstantTask(new BusiConstantTask()); |
| | | coreUnit.start(new UnitStartedCallbackInterface(){ |
| | | @Override |
| | | public void call(Object obj) { |
| | |
| | | public static Long lastUpDataTimeLive = 1000L ; |
| | | |
| | | //æ°æ®åºæ°æ®idçæå¨çidåç¼ï¼0æ¯é»è®¤çåç¼ï¼ä¸è¬webç³»ç»åºç¨ï¼æ°æ®ä¸é´ä»¶idåç¼å¤§äºçäº1 |
| | | public static Integer dbDataIdSuffix = 1 ; |
| | | |
| | | //ä¸ä¸è¡æ°æ®ç¼åéåä¸ç¼åæ°æ®ä¸ªæ°çæ¥è¦éï¼è¿ä¸ªä¸å®ä½é¡¹ç®ææ¥æ°´è¡¨æ°ç¸å
³ |
| | | public static Integer cacheUpDownDataWarnCount = 1000000 ; |
| | | |
| | | //ä¸ä¸è¡æ°æ®ç¼åéåä¸ç¼åæ°æ®ä¸ªæ°çæå¤§å¼ï¼è¿ä¸ªä¸å®ä½é¡¹ç®ææ¥æ°´è¡¨æ°ç¸å
³ |
| | | public static Integer cacheUpDownDataMaxCount = 1100000 ; |
| | | public static Integer dbDataIdSuffix = 1 ; |
| | | |
| | | } |
| | |
| | | package com.dy.aceMw.server.forTcp; |
| | | |
| | | import com.dy.aceMw.server.busi.AboutRtuNode; |
| | | import com.dy.aceMw.server.busi.TcpUpDataCache; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | |
| | | //æ¤å¤å®ç°ï¼ä¸ä»¥åä¸ä¸æ ·ï¼ |
| | | //以åå®ç°ï¼å¹é
å½ä»¤æ¯ä»åååå¹é
ï¼ |
| | | //å½åå®ç°ï¼å¹é
å½ä»¤æ¯ä»åååå¹é
ï¼åå ï¼ä¸¾ä¾ï¼å½æ¹éä¸åè¡¥å¬å½ä»¤ï¼å¦æä»åå¹é
ï¼ååé¢å½ä»¤ä¼ä¸å夿¬¡ï¼å³ä¸ä¸ªä¸æ¥æ¬¡æ°æ®ä¼è¡¥å¬å¤æ¬¡ |
| | | MidResultToRtu resToRtu = TcpDownCommandCache.matchFromHead(resFromRtu) ; |
| | | MidResultToRtu resToRtu = TcpDownCommandCach.matchFromHead(resFromRtu) ; |
| | | if(resToRtu != null){ |
| | | //å¹é
å°ä¸åçå½ä»¤ |
| | | resFromRtu.setCommandId(resToRtu.commandId) ; |
| | | this.nextDeal(false, resFromRtu); |
| | | this.sendResult(false, resFromRtu); |
| | | }else{ |
| | | this.nextDeal(false, resFromRtu); |
| | | this.sendResult(false, resFromRtu); |
| | | //æªå¹é
å°ä¸åçå½ä»¤ï¼å½ä»¤å¨ç¼åå è¶
æ¶è¢«æ¸
é¤äº |
| | | RtuStatusDealer.commandFail2Success(resFromRtu.rtuAddr) ; |
| | | } |
| | | }else{ |
| | | //主å¨ä¸æ¥æ°æ® |
| | | this.nextDeal(true, resFromRtu); |
| | | this.sendResult(true, resFromRtu); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è¿å
¥å¤çº¿ç¨ç¯å¢ä¸è¿è¡ |
| | | * @param reportOrResponse_trueOrFalse |
| | | * @param resFromRtu |
| | | */ |
| | | private void nextDeal(boolean reportOrResponse_trueOrFalse, MidResultFromRtu resFromRtu){ |
| | | private void sendResult(boolean reportOrResponse_trueOrFalse, MidResultFromRtu resFromRtu){ |
| | | try{ |
| | | TcpUpDataCache.cacheRtuUpData(reportOrResponse_trueOrFalse, new AboutRtuNode(resFromRtu.data)); |
| | | String json = resFromRtu.data.toJson() ; |
| | | // if(reportOrResponse_trueOrFalse){ |
| | | // ToMqMessageCach.cachObj(MessageType.RtuAutoReport, json); |
| | | // }else{ |
| | | // ToMqMessageCach.cachObj(MessageType.RtuCmdResponse, json); |
| | | // } |
| | | }catch(Exception e){ |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | if(result != null && result instanceof MidResultToRtu){ |
| | | try { |
| | | MidResultToRtu resToRtu = (MidResultToRtu)result ; |
| | | TcpDownCommandCache.cacheCommand(resToRtu); |
| | | TcpDownCommandCach.cachCommand(resToRtu); |
| | | log.info("ä¸è¡å½ä»¤(toRtu)" + resToRtu.downCode + "ä¸é´ç»æå·²ç»æ¾å
¥ä¸è¡å½ä»¤ç¼åä¸"); |
| | | } catch (Exception e) { |
| | | log.error(e); |
| | |
| | | } |
| | | |
| | | Long lastSendStamp = tcpSe.lastDownComTime ; |
| | | if(this.result.isQuickSend || lastSendStamp == null || (now - lastSendStamp >= ServerProperties.commandSendInterval)){ |
| | | //æªæ¶å°å½ä»¤ç»æï¼æªè¾¾å°æå¤§å鿬¡æ°ï¼RTUå¨çº¿ï¼éåå½ä»¤æè¶
è¿å½ä»¤ä¸åé´éï¼ä»¥ä¸æ»¡è¶³åéå½ä»¤æ¡ä»¶ï¼æ§è¡åéå½ä»¤ |
| | | if(lastSendStamp == null || (now - lastSendStamp >= ServerProperties.commandSendInterval)){ |
| | | //æªæ¶å°å½ä»¤ç»æï¼æªè¾¾å°æå¤§å鿬¡æ°ï¼RTUå¨çº¿ï¼è¶
è¿å½ä»¤é´ä¸åé´éï¼ä»¥ä¸æ»¡è¶³åéå½ä»¤æ¡ä»¶ï¼æ§è¡åéå½ä»¤ |
| | | tcpSe.ioSession.write(this.result.downBuffer) ; |
| | | tcpSe.lastDownComTime = now ; |
| | | if(!this.result.hasResponse){ |
| | |
| | | import com.dy.common.mw.protocol.MidResult; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.Driver; |
| | | import com.dy.common.mw.protocol.ProtocolCache; |
| | | import com.dy.common.mw.protocol.ProtocolCach; |
| | | import com.dy.aceMw.server.ServerProperties; |
| | | import com.dy.aceMw.server.forTcp.TcpSessionCach; |
| | | |
| | |
| | | |
| | | /** |
| | | * å¤çå½ä»¤ |
| | | * @param com å½ä»¤ |
| | | * @param webJgroupName |
| | | * @param com |
| | | * @throws Exception |
| | | */ |
| | | private void deal(Command com) throws Exception{ |
| | |
| | | String protocolName = TcpSessionCach.getTcpProtocolName(rtuAddr) ; |
| | | if(protocolName == null){ |
| | | //RTUæªæ¾ä¸çº¿ |
| | | int count = ProtocolCache.driverCount() ; |
| | | int count = ProtocolCach.driverCount() ; |
| | | if(count == 1){ |
| | | //åªæä¸ä¸ªåè®® |
| | | dri = ProtocolCache.getFirstDriver() ; |
| | | dri = ProtocolCach.getFirstDriver() ; |
| | | } |
| | | }else{ |
| | | dri = ProtocolCache.getDriver(protocolName) ; |
| | | dri = ProtocolCach.getDriver(protocolName) ; |
| | | } |
| | | if(dri == null){ |
| | | log.error("严ééè¯¯ï¼æªè½å¾å°åè®®" + protocolName + "驱å¨ç±»å®ä¾ï¼"); |
| | |
| | | import com.dy.common.mw.protocol.Driver; |
| | | import com.dy.common.mw.protocol.OnLine; |
| | | import com.dy.common.mw.protocol.OnLineHandle; |
| | | import com.dy.common.mw.protocol.ProtocolCache; |
| | | import com.dy.common.mw.protocol.ProtocolCach; |
| | | import com.dy.aceMw.server.ServerProperties; |
| | | import com.dy.aceMw.server.forTcp.RtuLogDealer; |
| | | import com.dy.aceMw.server.forTcp.RtuStatusDealer; |
| | |
| | | * @throws Exception å¼å¸¸ |
| | | */ |
| | | private void dealUpData(IoSession session, String rtuAddrAtHead, String protocolName, boolean isOnLine, byte[] upBuf, String upHex) throws Exception{ |
| | | Driver dri = ProtocolCache.getDriver(protocolName) ; |
| | | Driver dri = ProtocolCach.getDriver(protocolName) ; |
| | | if(dri == null){ |
| | | log.error("严ééè¯¯ï¼æªè½å¾å°åè®®" + protocolName + "驱å¨ç±»å®ä¾ï¼"); |
| | | }else{ |
| | | MidResult[] midRs = dri.parseData(ServerProperties.isLowPower, rtuAddrAtHead, upBuf, upHex, new DriverParserDataCallback(){ |
| | | @Override |
| | | public void callback(String rtuAddrAtHead, String code, String upHex, Boolean reportOrResponse_trueOrFalse, boolean parseFail, String rtuAddrInData) { |
| | | public void callback(String rtuAddrAtHead, String meterNoAtHead, String code, String upHex, Boolean reportOrResponse_trueOrFalse, boolean parseFail, String rtuAddrInData, String meterNoInData) { |
| | | //æ´æ°ç»ç«¯ç¶æ |
| | | if(rtuAddrInData != null && !rtuAddrInData.equals(rtuAddrAtHead)){ |
| | | //æ°æ®å¤´ä¸çRTUå°å䏿°æ®ä¸çRTUå°åä¸ä¸è´ï¼æ´æ¢ææ°æ®ä¸çRTUå°å |
| | |
| | | |
| | | import com.dy.common.queue.Node; |
| | | import com.dy.common.mw.core.CoreTask; |
| | | import com.dy.aceMw.server.forTcp.TcpDownCommandCache; |
| | | import com.dy.aceMw.server.forTcp.TcpDownCommandCach; |
| | | import com.dy.aceMw.server.forTcp.TcpDownCommandObj; |
| | | import com.dy.aceMw.server.forTcp.TcpSessionCach; |
| | | |
| | |
| | | * å¤çä¸è¡å½ä»¤ |
| | | */ |
| | | public Integer dealDownCommand(Long now) { |
| | | Node first = TcpDownCommandCache.getFirstQueueNode() ; |
| | | if(first != null){ |
| | | Integer count = TcpDownCommandCache.size() ; |
| | | Node last = TcpDownCommandCache.getLastQueueNode() ; |
| | | this.doDealDownCommand(now, first, last); |
| | | return count ; |
| | | try{ |
| | | Node first = TcpDownCommandCach.getFirstQueueNode() ; |
| | | if(first != null){ |
| | | Integer count = TcpDownCommandCach.size() ; |
| | | Node last = TcpDownCommandCach.getLastQueueNode() ; |
| | | this.doDealDownCommand(now, first, last); |
| | | return count ; |
| | | } |
| | | }catch(Exception e){ |
| | | log.error(e); |
| | | } |
| | | return null ; |
| | | } |
| | |
| | | * å¤çç¼åçä¸è¡å½ä»¤èç¹ |
| | | * @param now å½åæ¶å» |
| | | * @param first 第ä¸ä¸ªèç¹ |
| | | * @param last æåä¸ä¸ªèç¹ |
| | | * @param last æ¯åä¸ä¸ªèç¹ |
| | | */ |
| | | private void doDealDownCommand1(Long now, Node first, Node last){ |
| | | private void doDealDownCommand(Long now, Node first, Node last){ |
| | | if(first != null){ |
| | | //å¨dealNodeæ¹æ³ä¸ï¼å¯è½è¦æfirstä»éåä¸ç§»é¤ï¼è¿æ¶first.nextä¸ºç©ºï¼æä»¥æåæfirst.nextååºæ¥ |
| | | Node next = first.next ; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å¤çç¼åçä¸è¡å½ä»¤èç¹ |
| | | * @param now å½åæ¶å» |
| | | * @param first 第ä¸ä¸ªèç¹ |
| | | * @param last æåä¸ä¸ªèç¹ |
| | | */ |
| | | private void doDealDownCommand(Long now, Node first, Node last){ |
| | | if(last != null){ |
| | | //å¨dealNodeæ¹æ³ä¸ï¼å¯è½è¦ælastä»éåä¸ç§»é¤ï¼è¿æ¶last.preä¸ºç©ºï¼æä»¥æåælast.preååºæ¥ |
| | | Node pre = last.pre ; |
| | | dealNode(now, last) ; |
| | | if(first != null && first != last){ |
| | | doDealDownCommand(now, first, pre) ; |
| | | }else if(first != null && first == last){ |
| | | //忢 |
| | | }else if(first == null){ |
| | | //è¿ç§æ
åµä¸ä¼åå¨ |
| | | doDealDownCommand(now, null, pre) ; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å¤çä¸ä¸ªèç¹ |
| | |
| | | TcpDownCommandObj obj = (TcpDownCommandObj)node.obj ; |
| | | boolean removeNode = obj.dealSelf(now) ; |
| | | if(removeNode){ |
| | | TcpDownCommandCache.removeNode(node); |
| | | TcpDownCommandCach.removeNode(node); |
| | | } |
| | | } |
| | | |
| | |
| | | offLineCachTimeout: ä¸å¨çº¿ç¼åçå½ä»¤æå¤§ç¼åæ¶é¿(ç§) |
| | | lastUpDataTimeLive: TCPä¸è¡æ°æ®æ¶å»ç¼åæ¶é¿(ç§)ï¼å½è¾¾å°æ¶é¿æ¶ï¼TCPä¸è¡æ°æ®æ¶å»è¢«æ¸
空ï¼éç¨TCPä¸è¡æ°æ®æ¶å»ç®çæ¯ï¼é»æ¢ä¸è¡æ°æ®åæ¶ä¸åæ°æ®ï¼å 为RTUå¤çä¸è¿æ¥(ç»å次å®éªï¼1ç§è¿æ¯æé®é¢ï¼2ç§æ é®é¢) |
| | | dbDataIdSuffixï¼æ°æ®åºæ°æ®idçæå¨çidåç¼ï¼0æ¯é»è®¤çåç¼ï¼ä¸è¬webç³»ç»åºç¨ï¼æ°æ®ä¸é´ä»¶idåç¼å¤§äºçäº1 |
| | | cacheUpDownDataWarnCountï¼ä¸ä¸è¡æ°æ®ç¼åéåä¸ç¼åæ°æ®ä¸ªæ°çæ¥è¦éï¼è¿ä¸ªä¸ç°å®é¡¹ç®ææ¥æ°´è¡¨æ°ç¸å
³ |
| | | cacheUpDownDataMaxCountï¼ä¸ä¸è¡æ°æ®ç¼åéåä¸ç¼åæ°æ®ä¸ªæ°çæå¤§å¼ï¼è¿ä¸ªä¸ç°å®é¡¹ç®ææ¥æ°´è¡¨æ°ç¸å
³ |
| | | --> |
| | | <base |
| | | isLowPower="false" |
| | | onlyOneProtocol="true" |
| | | downComandMaxResendTimes="3" |
| | | downComandMaxResendTimes="1" |
| | | commandSendInterval="3" |
| | | cachWaitResultTimeout="60" |
| | | offLineCachTimeout="86400" |
| | | lastUpDataTimeLive="1" |
| | | dbDataIdSuffix="0" |
| | | cacheUpDownDataWarnCount="100000" |
| | | cacheUpDownDataMaxCount="110000" |
| | | dbDataIdSuffix="1" |
| | | /> |
| | | |
| | | <!-- |
| | | centerAddr: ä¸å¿å°åï¼å½åï¼centerAddræªç¨å° |
| | | centerAddr: ä¸å¿å°åï¼å½åï¼å¨æ·è¡¨ç³»ç»ä¸çï¼centerAddræªç¨å° |
| | | synchroRtuClock: æ¯å¦å¯¹RTUæ ¡æ¶ |
| | | synchroRtuClockTimepiecesï¼å½RTU䏿å¡å¨æ¶éç¸å·®ä¸å®æ¯«ç§ï¼é
ç½®æä»¶æ¯ç§éï¼åï¼è¿è¡æ ¡æ¶ |
| | | --> |
| | |
| | | <!-- 软件å级 --> |
| | | <updateRtuSoft enable="true"> |
| | | <soft1 enable="true" oldVersionName="meter_v2_0,meter_v1_0" > |
| | | <newVersion newVersionName="meter_v3_0" file="rtuSoft/meter_v3_0.txt"> </newVersion> |
| | | <newVersion newVersionName="meter_v3_0" file="rtuSoft/meter_v3_0.txt"></newVersion> |
| | | </soft1> |
| | | <!-- |
| | | <soft2 enable="false" oldVersionName="rtu_v1_0,rtu_v2_0,rtu_v3_0" > |
| | |
| | | <!-- |
| | | æ¯ææ¨¡å |
| | | ç工使¶é¿çº¿ç¨æ± ï¼çº¿ç¨è´è´£ç¨æ¶è¾ççå·¥ä½ä»»å¡ |
| | | short_maxThreadï¼ æ± ä¸æå¤§çº¿ç¨æ°ä¸ºææCPUæ ¸æ°+1ï¼shortæ± ä¸longæ± ååä¸åï¼ï¼è¥ä¸º-1ï¼ä¸åéå¶ ï¼è®¾ç½®ä¸º0ï¼è¡¨ç¤ºä¸å¯å¨çº¿ç¨æ± |
| | | short_minThreadï¼ æ± ä¸æå°çº¿ç¨æ°ï¼è¥ä¸º-1ï¼ä¸åéå¶ï¼è®¾ç½®ä¸º0ï¼è¡¨ç¤ºä¸å¯å¨çº¿ç¨æ± |
| | | short_maxThreadï¼ æ± ä¸æå¤§çº¿ç¨æ°ä¸ºææCPUæ ¸æ°+1 |
| | | short_minThreadï¼ æ± ä¸æå°çº¿ç¨æ° |
| | | short_freeTimeoutï¼ çº¿ç¨æ°ç©ºé²æ¶é¿ï¼è¥æ± ä¸çº¿ç¨æ°é大äºminThreadï¼ä¸æç线ç¨ç©ºé²æ¶é¿è¶
è¿freeTimeoutï¼åæ¸
é¤è¯¥çº¿ç¨ï¼ä¸ºäºä¸æ¸
é¤ï¼æminThreadä¸maxThread设置ç¸ç |
| | | short_busyTimeoutï¼çº¿ç¨ä¸é´æå·¥ä½æ¶é¿ï¼åä½ä¸ºç§)è¶
æ¶éï¼è®¤ä¸ºçº¿ç¨å·²ç»äºå´©æºï¼å°å¼ºå¶æ¸
é¤ï¼ç工使¶é¿è®¾ç½®ä¸º5ç§ |
| | | é¿å·¥ä½æ¶é¿çº¿ç¨æ± ï¼çº¿ç¨è´è´£ç¨æ¶è¾é¿çå·¥ä½ä»»å¡ï¼ä¾å¦æ°æ®åºååæä½ |
| | | long_maxThreadï¼ æ± ä¸æå¤§çº¿ç¨æ°ä¸ºææCPUæ ¸æ°+1ï¼shortæ± ä¸longæ± ååä¸åï¼ï¼è¥ä¸º-1ï¼ä¸åéå¶ï¼è®¾ç½®ä¸º0ï¼è¡¨ç¤ºä¸å¯å¨çº¿ç¨æ± |
| | | long_minThreadï¼ æ± ä¸æå°çº¿ç¨æ°ï¼è¥ä¸º-1ï¼ä¸åéå¶ï¼è®¾ç½®ä¸º0ï¼è¡¨ç¤ºä¸å¯å¨çº¿ç¨æ± |
| | | é¿å·¥ä½æ¶é¿çº¿ç¨æ± ï¼çº¿ç¨è´è´£ç¨æ¶è¾é¿çå·¥ä½ä»»å¡ï¼ä¾å¦ä»Redisä¸åç¼åçRTUä¸è¡æ°æ® |
| | | long_maxThreadï¼ æ± ä¸æå¤§çº¿ç¨æ°,è¥ä¸º-1ï¼ä¸åéå¶ |
| | | long_minThreadï¼ æ± ä¸æå°çº¿ç¨æ° |
| | | long_freeTimeoutï¼ çº¿ç¨æ°ç©ºé²æ¶é¿ï¼è¥æ± ä¸çº¿ç¨æ°é大äºminThreadï¼ä¸æç线ç¨ç©ºé²æ¶é¿è¶
è¿freeTimeoutï¼åæ¸
é¤è¯¥çº¿ç¨ |
| | | long_busyTimeoutï¼çº¿ç¨ä¸é´æå·¥ä½æ¶é¿ï¼åä½ä¸ºç§)è¶
æ¶éï¼è¥ä¸º-1ï¼ä¸åéå¶ |
| | | enableThreadPoolï¼æ¯å¦å¯ç¨çº¿ç¨æ± |
| | | --> |
| | | <!-- å½åå®ç°ï¼årtuæ¥å¿ãRMIæ°æ®å¤çç¨å°äºççº¿ç¨æ± --> |
| | | <!-- å½åå®ç°ï¼rtuä¸è¡æ°æ®å¤çï¼è¯»åæ°æ®ï¼ç¨å°äºç¬¬çº¿ç¨æ± --> |
| | | <support |
| | | short_maxThread="6" |
| | | short_minThread="6" |
| | | short_maxThread="100" |
| | | short_minThread="5" |
| | | short_freeTimeout="60" |
| | | short_busyTimeout="5" |
| | | long_maxThread="6" |
| | | long_minThread="6" |
| | | long_maxThread="200" |
| | | long_minThread="0" |
| | | long_freeTimeout="60" |
| | | long_busyTimeout="-1" |
| | | enableThreadPool="true" |
| | | /> |
| | | |
| | | <!-- |
| | |
| | | <!-- |
| | | sleepBigBusyï¼ä¸»çº¿ç¨å¤§å¿æ¶æ¯æ¬¡æ§è¡é´éæ¶é¿ï¼æ¯«ç§ï¼ |
| | | sleepSmallBusyï¼ä¸»çº¿ç¨å°å¿æ¶æ¯æ¬¡æ§è¡é´éæ¶é¿ï¼æ¯«ç§ï¼ |
| | | queueWarnSize: ç¼åéåèç¹æ°è¦åæ°é |
| | | queueMaxSize: ç¼åéåèç¹æ°æå¤§æ°é |
| | | --> |
| | | <core |
| | | sleepBigBusy="100" |
| | | sleepSmallBusy="500" |
| | | queueWarnSize="100000" |
| | | queueMaxSize="300000" |
| | | /> |
| | | |
| | | <!-- |
| | |
| | | |
| | | <modules> |
| | | <module>pipIrr-mw-accept</module> |
| | | <module>pipIrr-mwTest-server</module> |
| | | </modules> |
| | | |
| | | <dependencies> |
| | |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | <version>1.0.0</version> |
| | | <scope>provided</scope> |
| | | <optional>true</optional> |
| | | <exclusions> |
| | | <exclusion> |
| | | <!-- æé¤æpipIrr-commonçææä¾èµï¼æ¬æ¨¡åèªå·±å®ä¹ä¾èµ --> |
| | | <groupId>*</groupId> |
| | | <artifactId>*</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | <version>1.0.0</version> |
| | | <scope>provided</scope> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <!-- æé¤æpipIrr-commonçææä¾èµï¼æ¬æ¨¡åèªå·±å®ä¹ä¾èµ --> |
| | | <groupId>*</groupId> |
| | | <artifactId>*</artifactId> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-json</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-logging</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <scope>runtime</scope> |
| | | </dependency> |
| | | <!-- lombok --> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </dependency> |
| | | <!-- @Aspect @Pointcut @Aroundçåºç¨ --> |
| | | <dependency> |
| | | <groupId>org.aspectj</groupId> |
| | | <artifactId>aspectjweaver</artifactId> |
| | | </dependency> |
| | | <!--log4j2æ¥å¿--> |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <version>2.0.7</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-log4j2</artifactId> |
| | |
| | | <dependency> |
| | | <groupId>com.fasterxml.jackson.dataformat</groupId> |
| | | <artifactId>jackson-dataformat-yaml</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <!-- æé¤æä¾èµ --> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | <artifactId>jackson-databind</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!-- ç³»ç»ç管 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- apiå¨çº¿ææ¡£ https://springdoc.org/#modules--> |
| | | <dependency> |
| | | <groupId>org.springdoc</groupId> |
| | | <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springdoc</groupId> |
| | | <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springdoc</groupId> |
| | | <artifactId>springdoc-openapi-security</artifactId> |
| | | </dependency> |
| | | |
| | | |
| | | <!--mysql驱å¨--> |
| | | <dependency> |
| | | <groupId>com.mysql</groupId> |
| | | <artifactId>mysql-connector-j</artifactId> |
| | | <version>8.0.33</version> |
| | | </dependency> |
| | | <!--druid-spring-bootè¿æ¥æ± --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid-spring-boot-starter</artifactId> |
| | | <version>1.2.20</version> |
| | | </dependency> |
| | | <!--mybatis-plus-spring-boot--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>3.5.3.2</version> |
| | | </dependency> |
| | | |
| | | <!-- é¿éfastjson --> |
| | | <dependency> |
| | | <groupId>cglib</groupId> |
| | | <artifactId>cglib</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba.fastjson2</groupId> |
| | | <artifactId>fastjson2</artifactId> |
| | |
| | | <artifactId>jdom2</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- beanåmapäºè½¬æ¢ --> |
| | | <dependency> |
| | | <groupId>org.apache.dubbo</groupId> |
| | | <artifactId>dubbo</artifactId> |
| | | <version>3.2.7</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>io.netty</groupId> |
| | | <artifactId>netty-all</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.yaml</groupId> |
| | | <artifactId>snakeyaml</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-context</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.alibaba.spring</groupId> |
| | | <artifactId>spring-context-support</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.alibaba.fastjson2</groupId> |
| | | <artifactId>fastjson2</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>hessian-lite</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.javassist</groupId> |
| | | <artifactId>javassist</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!-- æµè¯ --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <scope>test</scope> |
| | |
| | | <name>pipIrr-web-base</name> |
| | | <description>webåºç¡ä¿¡æ¯ç³»ç»</description> |
| | | |
| | | |
| | | <build> |
| | | <plugins> |
| | | <!-- çæä¸å
å«ä¾èµjarç坿§è¡jarå
|
| | | <plugin> |
| | | !- spring bootæä¾çmavenæå
æä»¶ - |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | !- |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | - |
| | | <configuration> |
| | | !- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar - |
| | | <classifier>execute</classifier> |
| | | !- 䏿å®çæè·¯å¾çè¯, é»è®¤ä¿åå¨ ${build.directory} ä¸ - |
| | | <outputDirectory>${project.build.directory}/execute</outputDirectory> |
| | | <finalName>${artifactId}-${version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | |
| | | </plugin> |
| | | --> |
| | | <!-- æ·è´ä¾èµçjarå
å°libç®å½--> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <configuration> |
| | | <!-- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar |
| | | <classifier>execute</classifier> |
| | | --> |
| | | <!-- ${project.build.directory}æ¯mavenåéï¼å
ç½®çï¼è¡¨ç¤ºtargetç®å½,妿ä¸åï¼å°å¨æ ¹ç®å½ä¸å建/lib --> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | <!-- excludeTransitive:æ¯å¦ä¸å
å«é´æ¥ä¾èµå
ï¼æ¯å¦æä»¬ä¾èµAï¼ä½æ¯Aåä¾èµäºBï¼æä»¬æ¯å¦ä¹è¦æBæè¿å» é»è®¤ä¸æ--> |
| | | <excludeTransitive>false</excludeTransitive> |
| | | <!-- å¤å¶çjaræä»¶å»æçæ¬ä¿¡æ¯ --> |
| | | <stripVersion>false</stripVersion> |
| | | <finalName>${project.artifactId}-${project.version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- 设置javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <!-- sourceï¼ æºä»£ç ç¼è¯çæ¬ï¼targetï¼ ç®æ å¹³å°ç¼è¯çæ¬ï¼encodingï¼ å符éç¼ç ã --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- è§£å³èµæºæä»¶çç¼ç é®é¢ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- mavenéæ§è¡æµè¯ç¨ä¾çæä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- ä¸é¢è§£å³ï¼å½è¿è¡Maven Lifecycle packageæ¶æ¥éï¼Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <extensions>true</extensions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | </project> |
| | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoBa.BaBlockMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaBlock; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClientType; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Length(message = "è¡æ¿åºåç§°å°äº{max}å", min = 1, max = 25) |
| | | public String name ; |
| | | |
| | | @Schema(description = "è¡æ¿åºç¼å·(çå¸å¿2ä½ï¼éæ3ä½)", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @Schema(description = "è¡æ¿åºç¼å·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "è¡æ¿åºç¼å·ä¸è½ä¸ºç©º") //ä¸è½ä¸ºç©ºä¹ä¸è½ä¸ºnull |
| | | @Length(message = "è¡æ¿åºç¼å·æ¯ä¸ä½æä¸¤ä½æ°", min = 2, max = 3) |
| | | @Length(message = "è¡æ¿åºç¼å·æ¯ä¸ä½æä¸¤ä½æ°", min = 1, max = 2) |
| | | public String num ; |
| | | |
| | | @Schema(description = "è¡æ¿åºçº§å«", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | |
| | | //è®¾ç½®æ°æ®æº |
| | | DataSourceContext.set(orgTag); |
| | | if(!this.existDistricts()){ |
| | | if(configXml.existElement(doc, "config.orgs.org" + num + ".districts.province")){ |
| | | String distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province","name", null, false, null) ; |
| | | String distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province","num", null, false, null) ; |
| | | Integer distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province","level", null, 0, 99,null) ; |
| | | Long supperId = this.saveDistrict(null, distriName, distriNum, distriLevel); |
| | | if(supperId != null && configXml.existElement(doc, "config.orgs.org" + num + ".districts.province.city")){ |
| | | if(configXml.existElement(doc, "config.orgs.org" + num + ".districts.province.city")){ |
| | | distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city","name", null, false, null) ; |
| | | distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city","num", null, false, null) ; |
| | | distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province.city","level", null, 1, 99,null) ; |
| | | supperId = this.saveDistrict(supperId, distriName, distriNum, distriLevel); |
| | | if(supperId != null && configXml.existElement(doc, "config.orgs.org" + num + ".districts.province.city.country")){ |
| | | distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city.country","name", null, false, null) ; |
| | | distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city.country","num", null, false, null) ; |
| | | distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province.city.country","level", null, 1, 99,null) ; |
| | | this.saveDistrict(supperId, distriName, distriNum, distriLevel); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | /* 2023-11-23 ä¸é¢æ¯æåå®ç°ï¼å满足ICå¡ä¸åå¨ççè¦æ±ï¼å¢å ççº§è¡æ¿åºå |
| | | if(configXml.existElement(doc, "config.orgs.org" + num + ".districts.city")){ |
| | | String distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.city","name", null, false, null) ; |
| | | String distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.city","num", null, false, null) ; |
| | |
| | | this.saveDistrict(supperId, distriName, distriNum, distriLevel); |
| | | } |
| | | } |
| | | */ |
| | | } |
| | | if(!this.existUsers()){ |
| | | if(configXml.existElement(doc, "config.orgs.org" + num + ".user")){ |
| | |
| | | <name>pipIrr-web-demo</name> |
| | | <description>webå¼åæ¼ç¤ºç³»ç»ï¼æ¼ç¤ºç¤ºä¾</description> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <!-- çæä¸å
å«ä¾èµjarç坿§è¡jarå
|
| | | <plugin> |
| | | !- spring bootæä¾çmavenæå
æä»¶ - |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | !- |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | - |
| | | <configuration> |
| | | !- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar - |
| | | <classifier>execute</classifier> |
| | | !- 䏿å®çæè·¯å¾çè¯, é»è®¤ä¿åå¨ ${build.directory} ä¸ - |
| | | <outputDirectory>${project.build.directory}/execute</outputDirectory> |
| | | <finalName>${artifactId}-${version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | |
| | | </plugin> |
| | | --> |
| | | <!-- æ·è´ä¾èµçjarå
å°libç®å½--> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <configuration> |
| | | <!-- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar |
| | | <classifier>execute</classifier> |
| | | --> |
| | | <!-- ${project.build.directory}æ¯mavenåéï¼å
ç½®çï¼è¡¨ç¤ºtargetç®å½,妿ä¸åï¼å°å¨æ ¹ç®å½ä¸å建/lib --> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | <!-- excludeTransitive:æ¯å¦ä¸å
å«é´æ¥ä¾èµå
ï¼æ¯å¦æä»¬ä¾èµAï¼ä½æ¯Aåä¾èµäºBï¼æä»¬æ¯å¦ä¹è¦æBæè¿å» é»è®¤ä¸æ--> |
| | | <excludeTransitive>false</excludeTransitive> |
| | | <!-- å¤å¶çjaræä»¶å»æçæ¬ä¿¡æ¯ --> |
| | | <stripVersion>false</stripVersion> |
| | | <finalName>${project.artifactId}-${project.version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrDemo.PipIrrDemoApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- 设置javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <!-- sourceï¼ æºä»£ç ç¼è¯çæ¬ï¼targetï¼ ç®æ å¹³å°ç¼è¯çæ¬ï¼encodingï¼ å符éç¼ç ã --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- è§£å³èµæºæä»¶çç¼ç é®é¢ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- mavenéæ§è¡æµè¯ç¨ä¾çæä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- ä¸é¢è§£å³ï¼å½è¿è¡Maven Lifecycle packageæ¶æ¥éï¼Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <extensions>true</extensions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | </project> |
| | |
| | | spring: |
| | | profiles: |
| | | include: global, database, database-ym, database-pj |
| | | include: global, database |
| | | |
| | | #actutorçwebç«¯å£ |
| | | management: |
| | |
| | | <name>pipIrr-web-gis</name> |
| | | <description>webçµåå°å¾ç³»ç»</description> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <!-- çæä¸å
å«ä¾èµjarç坿§è¡jarå
|
| | | <plugin> |
| | | !- spring bootæä¾çmavenæå
æä»¶ - |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | !- |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | - |
| | | <configuration> |
| | | !- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar - |
| | | <classifier>execute</classifier> |
| | | !- 䏿å®çæè·¯å¾çè¯, é»è®¤ä¿åå¨ ${build.directory} ä¸ - |
| | | <outputDirectory>${project.build.directory}/execute</outputDirectory> |
| | | <finalName>${artifactId}-${version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | |
| | | </plugin> |
| | | --> |
| | | <!-- æ·è´ä¾èµçjarå
å°libç®å½--> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <configuration> |
| | | <!-- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar |
| | | <classifier>execute</classifier> |
| | | --> |
| | | <!-- ${project.build.directory}æ¯mavenåéï¼å
ç½®çï¼è¡¨ç¤ºtargetç®å½,妿ä¸åï¼å°å¨æ ¹ç®å½ä¸å建/lib --> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | <!-- excludeTransitive:æ¯å¦ä¸å
å«é´æ¥ä¾èµå
ï¼æ¯å¦æä»¬ä¾èµAï¼ä½æ¯Aåä¾èµäºBï¼æä»¬æ¯å¦ä¹è¦æBæè¿å» é»è®¤ä¸æ--> |
| | | <excludeTransitive>false</excludeTransitive> |
| | | <!-- å¤å¶çjaræä»¶å»æçæ¬ä¿¡æ¯ --> |
| | | <stripVersion>false</stripVersion> |
| | | <finalName>${project.artifactId}-${project.version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrGis.PipIrrGisApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- 设置javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <!-- sourceï¼ æºä»£ç ç¼è¯çæ¬ï¼targetï¼ ç®æ å¹³å°ç¼è¯çæ¬ï¼encodingï¼ å符éç¼ç ã --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- è§£å³èµæºæä»¶çç¼ç é®é¢ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- mavenéæ§è¡æµè¯ç¨ä¾çæä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- ä¸é¢è§£å³ï¼å½è¿è¡Maven Lifecycle packageæ¶æ¥éï¼Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <extensions>true</extensions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | </project> |
| | |
| | | spring: |
| | | profiles: |
| | | include: global, database, database-ym, database-pj |
| | | include: global, database |
| | | |
| | | #actutorçwebç«¯å£ |
| | | management: |
| | |
| | | <name>pipIrr-web-remote</name> |
| | | <description>webè¿ç¨æä½ä¿¡æ¯ç³»ç»</description> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <!-- çæä¸å
å«ä¾èµjarç坿§è¡jarå
|
| | | <plugin> |
| | | !- spring bootæä¾çmavenæå
æä»¶ - |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | !- |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | - |
| | | <configuration> |
| | | !- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar - |
| | | <classifier>execute</classifier> |
| | | !- 䏿å®çæè·¯å¾çè¯, é»è®¤ä¿åå¨ ${build.directory} ä¸ - |
| | | <outputDirectory>${project.build.directory}/execute</outputDirectory> |
| | | <finalName>${artifactId}-${version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | |
| | | </plugin> |
| | | --> |
| | | <!-- æ·è´ä¾èµçjarå
å°libç®å½--> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <configuration> |
| | | <!-- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar |
| | | <classifier>execute</classifier> |
| | | --> |
| | | <!-- ${project.build.directory}æ¯mavenåéï¼å
ç½®çï¼è¡¨ç¤ºtargetç®å½,妿ä¸åï¼å°å¨æ ¹ç®å½ä¸å建/lib --> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | <!-- excludeTransitive:æ¯å¦ä¸å
å«é´æ¥ä¾èµå
ï¼æ¯å¦æä»¬ä¾èµAï¼ä½æ¯Aåä¾èµäºBï¼æä»¬æ¯å¦ä¹è¦æBæè¿å» é»è®¤ä¸æ--> |
| | | <excludeTransitive>false</excludeTransitive> |
| | | <!-- å¤å¶çjaræä»¶å»æçæ¬ä¿¡æ¯ --> |
| | | <stripVersion>false</stripVersion> |
| | | <finalName>${project.artifactId}-${project.version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrRemote.PipIrrRemoteApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- 设置javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <!-- sourceï¼ æºä»£ç ç¼è¯çæ¬ï¼targetï¼ ç®æ å¹³å°ç¼è¯çæ¬ï¼encodingï¼ å符éç¼ç ã --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- è§£å³èµæºæä»¶çç¼ç é®é¢ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- mavenéæ§è¡æµè¯ç¨ä¾çæä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- ä¸é¢è§£å³ï¼å½è¿è¡Maven Lifecycle packageæ¶æ¥éï¼Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <extensions>true</extensions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | </project> |
| | |
| | | spring: |
| | | profiles: |
| | | include: global, database, database-ym, database-pj |
| | | include: global, database |
| | | |
| | | #actutorçwebç«¯å£ |
| | | management: |
| | |
| | | <!-- èªå¨å¤æä½¿ç¨ä¸spring bootå
¼å®¹ççæ¬ --> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <!-- çæä¸å
å«ä¾èµjarç坿§è¡jarå
|
| | | <plugin> |
| | | !- spring bootæä¾çmavenæå
æä»¶ - |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | !- |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | - |
| | | <configuration> |
| | | !- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar - |
| | | <classifier>execute</classifier> |
| | | !- 䏿å®çæè·¯å¾çè¯, é»è®¤ä¿åå¨ ${build.directory} ä¸ - |
| | | <outputDirectory>${project.build.directory}/execute</outputDirectory> |
| | | <finalName>${artifactId}-${version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | |
| | | </plugin> |
| | | --> |
| | | <!-- æ·è´ä¾èµçjarå
å°libç®å½--> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <configuration> |
| | | <!-- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar |
| | | <classifier>execute</classifier> |
| | | --> |
| | | <!-- ${project.build.directory}æ¯mavenåéï¼å
ç½®çï¼è¡¨ç¤ºtargetç®å½,妿ä¸åï¼å°å¨æ ¹ç®å½ä¸å建/lib --> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | <!-- excludeTransitive:æ¯å¦ä¸å
å«é´æ¥ä¾èµå
ï¼æ¯å¦æä»¬ä¾èµAï¼ä½æ¯Aåä¾èµäºBï¼æä»¬æ¯å¦ä¹è¦æBæè¿å» é»è®¤ä¸æ--> |
| | | <excludeTransitive>false</excludeTransitive> |
| | | <!-- å¤å¶çjaræä»¶å»æçæ¬ä¿¡æ¯ --> |
| | | <stripVersion>false</stripVersion> |
| | | <finalName>${project.artifactId}-${project.version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.sso.PipIrrSsoApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- 设置javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <!-- sourceï¼ æºä»£ç ç¼è¯çæ¬ï¼targetï¼ ç®æ å¹³å°ç¼è¯çæ¬ï¼encodingï¼ å符éç¼ç ã --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- è§£å³èµæºæä»¶çç¼ç é®é¢ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- mavenéæ§è¡æµè¯ç¨ä¾çæä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- ä¸é¢è§£å³ï¼å½è¿è¡Maven Lifecycle packageæ¶æ¥éï¼Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <extensions>true</extensions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | </project> |
| | |
| | | spring: |
| | | profiles: |
| | | include: global, database, database-ym, database-pj |
| | | include: global, database |
| | | |
| | | #actutorçwebç«¯å£ |
| | | management: |
| | |
| | | <name>pipIrr-web-statistics</name> |
| | | <description>webç»è®¡åæç³»ç»</description> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <!-- çæä¸å
å«ä¾èµjarç坿§è¡jarå
|
| | | <plugin> |
| | | !- spring bootæä¾çmavenæå
æä»¶ - |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | !- |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | - |
| | | <configuration> |
| | | !- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar - |
| | | <classifier>execute</classifier> |
| | | !- 䏿å®çæè·¯å¾çè¯, é»è®¤ä¿åå¨ ${build.directory} ä¸ - |
| | | <outputDirectory>${project.build.directory}/execute</outputDirectory> |
| | | <finalName>${artifactId}-${version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | |
| | | </plugin> |
| | | --> |
| | | <!-- æ·è´ä¾èµçjarå
å°libç®å½--> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <configuration> |
| | | <!-- ä¸å çè¯æç»å
å为: ${artifactId}-${version}.jar, å äºçè¯æç»å
å: ${artifactId}-${version}-${classifier}.jar |
| | | <classifier>execute</classifier> |
| | | --> |
| | | <!-- ${project.build.directory}æ¯mavenåéï¼å
ç½®çï¼è¡¨ç¤ºtargetç®å½,妿ä¸åï¼å°å¨æ ¹ç®å½ä¸å建/lib --> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | <!-- excludeTransitive:æ¯å¦ä¸å
å«é´æ¥ä¾èµå
ï¼æ¯å¦æä»¬ä¾èµAï¼ä½æ¯Aåä¾èµäºBï¼æä»¬æ¯å¦ä¹è¦æBæè¿å» é»è®¤ä¸æ--> |
| | | <excludeTransitive>false</excludeTransitive> |
| | | <!-- å¤å¶çjaræä»¶å»æçæ¬ä¿¡æ¯ --> |
| | | <stripVersion>false</stripVersion> |
| | | <finalName>${project.artifactId}-${project.version}</finalName> |
| | | <layout>ZIP</layout> |
| | | <mainClass>com.dy.pipIrrStatistics.PipIrrStatisticsApplication</mainClass> |
| | | <includes> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-common</artifactId> |
| | | </include> |
| | | <include> |
| | | <groupId>com.dy</groupId> |
| | | <artifactId>pipIrr-global</artifactId> |
| | | </include> |
| | | </includes> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <!-- 设置javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <!-- sourceï¼ æºä»£ç ç¼è¯çæ¬ï¼targetï¼ ç®æ å¹³å°ç¼è¯çæ¬ï¼encodingï¼ å符éç¼ç ã --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- è§£å³èµæºæä»¶çç¼ç é®é¢ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- mavenéæ§è¡æµè¯ç¨ä¾çæä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- ä¸é¢è§£å³ï¼å½è¿è¡Maven Lifecycle packageæ¶æ¥éï¼Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <extensions>true</extensions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | </project> |
| | |
| | | spring: |
| | | profiles: |
| | | include: global, database, database-ym, database-pj |
| | | include: global, database |
| | | |
| | | #actutorçwebç«¯å£ |
| | | management: |
| | |
| | | <artifactId>junit</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | | <!-- <!– å
¨å±æé¤–>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.springframework.boot</groupId>--> |
| | | <!-- <artifactId>spring-boot-starter-json</artifactId>--> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>*</groupId>--> |
| | | <!-- <artifactId>*</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.springframework.boot</groupId>--> |
| | | <!-- <artifactId>spring-boot-starter-logging</artifactId>--> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>*</groupId>--> |
| | | <!-- <artifactId>*</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | <!-- </dependency>--> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <!-- spring bootæä¾çmavenæå
æä»¶ --> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <configuration> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- mavenéæ§è¡æµè¯ç¨ä¾çæä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 强å¶è®¾å® javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | </project> |
| | |
| | | <mapstruct.version>1.5.5.Final</mapstruct.version> |
| | | <hutool-all.version>5.8.22</hutool-all.version> |
| | | <org-jdom2.version>2.0.6.1</org-jdom2.version> |
| | | |
| | | <spring-boot-maven-plugin.version>3.2.0</spring-boot-maven-plugin.version> |
| | | <maven-jar-plugin-plugin.version>3.3.0</maven-jar-plugin-plugin.version> |
| | | <maven-dependency-plugin.version>3.5.0</maven-dependency-plugin.version> |
| | | <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version> |
| | | <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version> |
| | | <maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version> |
| | | <maven-bundle-plugin.version>5.1.9</maven-bundle-plugin.version> |
| | | <encoding>UTF-8</encoding> |
| | | <compiler-plugin.version>3.11.0</compiler-plugin.version> |
| | | <surefire-plugin.version>3.0.0</surefire-plugin.version> |
| | | </properties> |
| | | |
| | | |
| | |
| | | <dependency> |
| | | <groupId>org.apache.mina</groupId> |
| | | <artifactId>mina-core</artifactId> |
| | | <version>2.2.2</version> |
| | | <version>2.2.1</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.mina</groupId> |
| | | <artifactId>mina-filter-compression</artifactId> |
| | | <version>2.2.1</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | |
| | | <!-- spring bootæä¾çmavenæå
æä»¶ --> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <version>${spring-boot-maven-plugin.version}</version> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 该æä»¶ä¸ä¼å°é¡¹ç®ä¸å¼å
¥çä¾èµæè¿æç»ç Jar æä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-jar-plugin</artifactId> |
| | | <version>${maven-jar-plugin-plugin.version}</version> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- å½é¡¹ç®ä¸ä¾èµæ¯è¾å¤æ¶ï¼æä»¬å¯ä»¥åå© maven-dependency-plugin æä»¶èªå¨å¸®æä»¬ä¸è½½ä¾èµç Jar æä»¶ï¼æ¨èå°è¯¥æä»¶ç»å®å°packageçå½å¨æä¸ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-dependency-plugin</artifactId> |
| | | <version>${maven-dependency-plugin.version}</version> |
| | | <executions> |
| | | <execution> |
| | | <!-- ç»å®çå½å¨æ --> |
| | | <phase>package</phase> |
| | | <goals> |
| | | <goal>copy-dependencies</goal> |
| | | </goals> |
| | | <!-- 设置ä¾èµçåæ¾è·¯å¾ --> |
| | | <configuration> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 设置javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>${maven-compiler-plugin.version}</version> |
| | | <!-- sourceï¼ æºä»£ç ç¼è¯çæ¬ï¼targetï¼ ç®æ å¹³å°ç¼è¯çæ¬ï¼encodingï¼ å符éç¼ç ã --> |
| | | <version>3.1.3</version> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- è§£å³èµæºæä»¶çç¼ç é®é¢ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <version>${maven-resources-plugin.version}</version> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- mavenéæ§è¡æµè¯ç¨ä¾çæä»¶ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <version>${maven-surefire-plugin.version}</version> |
| | | <version>3.0.0</version> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- ä¸é¢è§£å³ï¼å½è¿è¡Maven Lifecycle packageæ¶æ¥éï¼Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <version>${maven-bundle-plugin.version}</version> |
| | | <extensions>true</extensions> |
| | | <!-- 强å¶è®¾å® javaç¼è¯çæ¬ï¼è¿è¡ç¯å¢çæ¬ --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>${compiler-plugin.version}</version> |
| | | <configuration> |
| | | <source>20</source> |
| | | <target>20</target> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </pluginManagement> |
| | |
| | | https://docs.qq.com/desktop |
| | | https://lanhuapp.com/link/#/invite?sid=lX0nqhHU |
| | | https://docs.qq.com/doc/DRHBkeVlCekp1d1RU |