lyyb2001

          只是為方便自己找記錄而已
          posts - 57, comments - 27, trackbacks - 0, articles - 5
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 ::  :: 管理

          2015年3月27日

          表單里面先對某一個控件有效性驗證(如手機號碼,當手機號碼輸入正確,才發送驗證碼,最后才是對表單驗證)

          <input type="text" id="mobile" name="mobile" placeholder="請輸入您的手機號碼" class="easyui-validatebox form-control" data-options="required:true,validType:'mobile'" />

          validateType自己擴展規則

          對單個輸入框的驗證為:$("#mobile").validatebox('isValid') 通過返回true

          posted @ 2017-09-19 15:59 skycity 閱讀(840) | 評論 (0)編輯 收藏

              public enum Section {
          KITTING(1),
          LABELKITTING(2),
          PACKING(3);

          private final int code;

          private Section(int code)
          {
          this.code=code;
          }
          public int getCode()
          {
          return this.code;
          }
          }

          Map<Integer,Section> MAP=Arrays.stream(Section.values()).collect(Collectors.toMap(s->s.code, section->section));

          posted @ 2017-07-11 11:40 skycity 閱讀(2767) | 評論 (0)編輯 收藏

          Optional<MaterialPaneModel> maxMaterial = list.stream().max(Comparator.comparingInt(MaterialPaneModel::getMaterialQty));

          posted @ 2017-07-06 15:43 skycity 閱讀(4021) | 評論 (0)編輯 收藏

          try{

          JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();

          factoryBean.getInInterceptors().add(new LoggingInInterceptor());

          factoryBean.getOutInterceptors().add(new LoggingOutInterceptor());

          factoryBean.setServiceClass(AutoPackServiceIntf.class);

          factoryBean.setAddress("http://10.241.0.105:17000/TEST");

          AutoPackServiceIntf factory = (AutoPackServiceIntf) factoryBean.create();

          Client client = ClientProxy.getClient(factory);

          HTTPConduit conduit = (HTTPConduit) client.getConduit();

          HTTPClientPolicy policy = new HTTPClientPolicy();

          policy.setConnectionTimeout(30000); //連接超時時間

          policy.setReceiveTimeout(120000); //請求超時時間.

          conduit.setClient(policy);

          System.out.println(factory.getFirstUnitCramp("1"));

          }catch(WebServiceException ex){

          long l2 = System.currentTimeMillis();

          System.out.println((l2-l1)+"ms");

          System.out.println("連接異常");

          }

          posted @ 2016-12-08 14:19 skycity 閱讀(297) | 評論 (0)編輯 收藏

          通過Application

          ApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext();

               classPath = classPathXmlApplicationContext.getResource("classpath:config.properties").getFile().getPath();

                  if(classPath.indexOf("WEB-INF")>0){

                      classPath = classPath.substring(0,classPath.indexOf("WEB-INF")+7)+"/classes/"+xmlFile;

                  }

           

          posted @ 2016-11-03 18:17 skycity 閱讀(248) | 評論 (0)編輯 收藏

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

          Map<Integer,Map<String,List<DocLotDetail>>> amp                            docLotDetailLists.parallelStream().collect(Collectors.groupingBy(DocLotDetail::getGroupOrder,Collectors.groupingBy(DocLotDetail::getBaseValueName)));





          amp.forEach((key,value)->{

                  System.out.println(key);

                   value.forEach((key2,value2)->{

                      System.out.println(key2);

                  });

          });

          最終返回的結果

          2

          隨機光盤

          3

          資料袋附件

          4

          資料盒附件

          5

          包裝輔料

          8

          前工序物料






          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

          posted @ 2016-03-22 16:14 skycity 閱讀(11376) | 評論 (0)編輯 收藏

          cxf webservice客戶端程序在eclipse里面運行的好好的,但是一旦用mvn assembly:assembly將依賴和主代碼打成一個可運行的jar時,調用就會出現如下錯誤:


          Exception in thread "main" org.apache.cxf.service.factory.ServiceConstructionException: Could not resolve a binding for null

          at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:352)

          at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:259)

          at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:144)

          at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)

          at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157)

          at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)

          at com.nabf.start.NABFClient.main(NABFClient.java:30)

          Caused by: org.apache.cxf.BusException: No binding factory for namespace http://schemas.xmlsoap.org/soap/ registered.

          at org.apache.cxf.bus.managers.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:93)

          at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:339)

          ... 6 more

          而用mV clean package dependency:copy-dependencies -DoutputDirectory=target/lib啟動的時候加載lib包下所有的文件也不會出現錯誤

          解決辦法:在pom.xml的build中添加如下,然后執行mV clean package,打出來的包就含有依賴包,且問題解決。原因?

                                      <plugin>

          <groupId>org.apache.maven.plugins</groupId>

          <artifactId>maven-shade-plugin</artifactId>

          <version>1.6</version>

          <configuration>

          <archive>

          <manifest>

          <addClasspath>true</addClasspath>

          <mainClass>com.nabf.start.NABFClient</mainClass>

          </manifest>

          </archive>

          </configuration>

          <executions>

          <execution>

          <phase>package</phase>

          <goals>

          <goal>shade</goal>

          </goals>

          <configuration>

          <transformers>

          <transformer

          implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">

          <resource>META-INF/cxf/bus-extensions.txt</resource>

          </transformer>

          </transformers>

          </configuration>

          </execution>

          </executions>

          </plugin> 




          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

          posted @ 2016-03-04 15:02 skycity 閱讀(2634) | 評論 (0)編輯 收藏

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

          MessageFormat.format(str,str1,str2,str3)

          用于替換str中{0},{1},{2}這樣的結構

          String.format(str,str1,str2,str3)

          用于匹配str中%s的結構

          posted @ 2015-06-11 16:10 skycity 閱讀(201) | 評論 (0)編輯 收藏

          package com.skycity.framework.utility;
          import javax.crypto.Cipher;
          import javax.crypto.KeyGenerator;
          import javax.crypto.SecretKey;
          import javax.crypto.spec.SecretKeySpec;

          import sun.misc.BASE64Decoder;
          import sun.misc.BASE64Encoder;

          import com.skycity.framework.Constant;

          public class EncryptUtil {
              // 加密字符串
              public static String encryptMode(String keybyte, String src) {
                  try { // 生成密鑰
                      SecretKey deskey = new SecretKeySpec(new BASE64Decoder().decodeBuffer(keybyte), Constant.ALGORITHM); // 加密
                      Cipher c1 = Cipher.getInstance(Constant.ALGORITHM);
                      c1.init(Cipher.ENCRYPT_MODE, deskey);
                      byte[] result = c1.doFinal(src.getBytes());
                      return new BASE64Encoder().encode(result);
                  } catch (java.security.NoSuchAlgorithmException e1) {
                      e1.printStackTrace();
                  } catch (javax.crypto.NoSuchPaddingException e2) {
                      e2.printStackTrace();
                  } catch (java.lang.Exception e3) {
                      e3.printStackTrace();
                  }
                  return null;
              }
           
              // 解密字符串
              public static String decryptMode(String keybyte, String encryStr) {
                  try { // 生成密鑰
                      SecretKey deskey = new SecretKeySpec(new BASE64Decoder().decodeBuffer(keybyte), Constant.ALGORITHM); // 解密
                      Cipher c1 = Cipher.getInstance(Constant.ALGORITHM);
                      c1.init(Cipher.DECRYPT_MODE, deskey);
                      byte[] result = c1.doFinal(new BASE64Decoder().decodeBuffer(encryStr));
                      return new String(result);
                  } catch (java.security.NoSuchAlgorithmException e1) {
                      e1.printStackTrace();
                  } catch (javax.crypto.NoSuchPaddingException e2) {
                      e2.printStackTrace();
                  } catch (java.lang.Exception e3) {
                      e3.printStackTrace();
                  }
                  return null;
              }
              //創建一個密鑰
              public static byte[] createSecretKey() {
          KeyGenerator keygen = null;
          try {
          keygen = KeyGenerator.getInstance(Constant.ALGORITHM);
          SecretKey deskey = keygen.generateKey();
          return deskey.getEncoded();
          } catch (Exception e) {
          LogUtil.error("NoSuchAlgorithmException!");
          }
          return null;
          }
              
              public static void main(String[] args){ 
                  final byte[] keyBytes = createSecretKey();    
                  String key= new BASE64Encoder().encode(keyBytes);
                  String szSrc = "admin";
                  System.out.println("加密前的字符串:" + szSrc);
                  String password = encryptMode(key,szSrc);
                  System.out.println("加密后的字符串:" + password);
          String result = decryptMode(key, password);
                  System.out.println("解密后的字符串:" + result);
              }
          }

          數據庫表中有一個字段用于保存Key,一個字段用于保存password,更改密碼的時候,重新生成一個KEY,然后生成一個PASSWORD,匹配保存到數據庫中。
          當登陸時,用數據庫保存的KEY和password進行解密,然后與登陸時輸入的password進行比較,如果相等,則成功。
          算法支持AES,DES,DESede,Blowfish等算法

          posted @ 2015-03-27 10:50 skycity 閱讀(210) | 評論 (0)編輯 收藏

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

          public static String readString = "Print([QDT],[Read([SQLServer#10.176.1.178#Mas2006],[select top 1 print_model + '.jasper' as reportname from tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])],[Read([SQLServer#10.176.1.178#Mas2006],[select  Machine_No, Check_Code, Model_Packing, Start_Date, Material_Name, Material_No, IIPC_part_code, Material_Qty, Print_Order, Machine_Product_No, print_model, SoftWareName, SoftWare_No, SoftWareQty from dbo.tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])])";


          public static void splitScriptWithMethod(String script) {

          // check if args

          String subMethodReg = "";

          if(script.indexOf("Read([") !=script.lastIndexOf("Read([")){

          subMethodReg = "(.+)\\(\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\],\\[(.+\\(\\[.+\\]\\))\\]";

          }else{

          subMethodReg = "(.+)\\(\\[(.+)\\],\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\]";

          }

          Pattern p = Pattern.compile(subMethodReg);

          Matcher matcher = p.matcher(readString);

          while (matcher.find()) {

          for (int i = 1; i <= matcher.groupCount(); i++) {  

                      System.out.println("grp " + i + " :" + matcher.group(i));  

                  } 

          }

          }



          grp 1 :Print

          grp 2 :QDT

          grp 3 :Read([SQLServer#10.176.1.178#Mas2006],[select top 1 print_model + '.jasper' as reportname from tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])

          grp 4 :Read([SQLServer#10.176.1.178#Mas2006],[select  Machine_No, Check_Code, Model_Packing, Start_Date, Material_Name, Material_No, IIPC_part_code, Material_Qty, Print_Order, Machine_Product_No, print_model, SoftWareName, SoftWare_No, SoftWareQty from dbo.tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])


          其中,用于匹配(.+)\\(\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\],\\[(.+\\(\\[.+\\]\\))\\],print([],[Read([],[],[])],[Read([],[],[])])這樣的結構
          而(.+)\\(\\[(.+)\\],\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\],用于匹配print([],[],[Read([],[],[])]這樣的結構

          posted @ 2015-03-27 10:41 skycity 閱讀(218) | 評論 (0)編輯 收藏

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); 在/Library/LaunchDaemons下
          新建svn.sh,內容如下

          /usr/bin/svnserve -d -r /Users/YingBo/svn/repository


          chmod +x svn.sh


          新建com.skycity.svn.plist,內容如下

          <?xml version="1.0" encoding="UTF-8"?>  

          <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

          <plist version="1.0">

            <dict>

              <key>KeepAlive</key>

              <true/>

              <key>Label</key>

              <string>com.skycity.svn</string>

              <key>ProgramArguments</key>

              <array>

              <string>/Library/LaunchDaemons/svn.sh</string>

              </array>

            </dict>

          </plist>


          設置開機自動啟動

           sudo launchctl load -w /Library/LaunchDaemons/com.skycity.svn.plist


          設置開機不自動啟動

           sudo launchctl unload -w /Library/LaunchDaemons/com.skycity.svn.plist

          posted @ 2015-03-27 10:36 skycity 閱讀(172) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 石狮市| 平邑县| 军事| 西丰县| 屏边| 泰宁县| 玉环县| 防城港市| 宁南县| 石棉县| 灵宝市| 荔浦县| 通榆县| 河东区| 徐闻县| 清徐县| 凤冈县| 南汇区| 贡嘎县| 客服| 徐闻县| 丁青县| 松原市| 山东省| 托克逊县| 陆丰市| 永善县| 师宗县| 奎屯市| 沙田区| 徐汇区| 珠海市| 乐至县| 禄丰县| 剑河县| 白玉县| 万安县| 苍南县| 龙江县| 都兰县| 绵竹市|