<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-71  評論-5  文章-0  trackbacks-0
     

    /Files/kokosang/html5拖拽上傳.zip

      前幾天想做個給安卓app升級做個上傳頁面,然后從網上down了個頁面下面(主要是嫌棄自己頁面整的太丑,見不了人),然后就一直在整后臺取值的辦法
      各種百度,值取出來了,但是,悲催的是總是亂碼,崩潰了,大神看了后,鄙視一番,給我整了下,簡直就是重寫了

      貼出來,先放張頁面效果
      


      賞心悅目的后臺來咯

    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.io.OutputStreamWriter;
    import java.util.List;

    import org.apache.log4j.Logger;
    import org.apache.tomcat.util.http.fileupload.FileItem;
    import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory;
    import org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload;

    import com.puff.framework.annotation.Controller;
    import com.puff.web.mvc.PuffContext;
    import com.puff.web.view.View;

    @Controller("/upload/android")
    public class AndroidVersionUploadController {

        private static final Logger logger = Logger.getLogger(UserImageController.class);
        
        private static final String FILE_PATH = "C:/Users/Administrator/Desktop";
        
        private static final String FILE_APK_NAME = "/nn.apk";
        private static final String FILE_VER_NAME = "/ver.txt";
        
        /**
         * 版本上傳
         * 
    @return
         * 
    @throws Exception 
         
    */
        public View update() throws Exception {
            DiskFileItemFactory factory = new DiskFileItemFactory(); 
            ServletFileUpload upload = new ServletFileUpload(factory); 
            List<FileItem> items = upload.parseRequest( PuffContext.getRequest()); 
            
            String ver = null;
            String info = null;
            String isFoucs = null;
            for(Object object : items) { 
                FileItem fileItem = (FileItem)object; 
                if(fileItem.isFormField()) { 
                    
                    String name = fileItem.getFieldName();
                    String value = fileItem.getString("utf-8");
                    
                    if("ver".equals(name)){
                        ver = value;
                    }else if("content".equals(name)){
                        info = value;
                    }else if("radio".equals(name)){
                        isFoucs = value;
                    }
                } else {
                    saveFileInfo(fileItem);
                }
            } 
            
            saveContentInfo(ver, info, isFoucs);
            
            return null;
        
        }

        private void saveFileInfo(FileItem fileItem) {
            
            InputStream is = null;
            OutputStream os = null;
            try {
                File file = new File(FILE_PATH);
                if(file.exists()) {
                    file.mkdirs();
                }
                
                is = fileItem.getInputStream();
                os = new FileOutputStream(FILE_PATH + FILE_APK_NAME);
                
                int len = 0;
                byte[] buffer = new byte[8 * 1024];
                while ((len = is.read(buffer, 0, 8 * 1024)) != -1) {
                    os.write(buffer, 0, len);
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                closeOutputStream(os);
                closeInputStream(is);
            }
        }
        
        public void saveContentInfo(String ver, String info, String isFoucs) {
            BufferedWriter br = null;
            try {
                File file = new File(FILE_PATH);
                if(file.exists()) {
                    file.mkdirs();
                }
                
                br = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(FILE_PATH + FILE_VER_NAME), "utf-8"));
                br.write("ver:" + ver + "\r\n");   //版本號
                br.write("update:" + isFoucs+ "\r\n");   //是否強制更新
                br.write("content:" + info );    //版本升級內容
                br.flush();
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                try {
                    if(br != null) {
                        br.close();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                    br = null;
                }
            }
        }


        private void closeOutputStream(OutputStream os) {
            if(os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                    os = null;
                }
            }
        }
        
        private void closeInputStream(InputStream is) {
            if(is != null) {
                try {
                    is.close();
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                    is = null;
                }
            }
        }
    }
    posted @ 2015-08-24 10:35 藤本薔薇 閱讀(261) | 評論 (0)編輯 收藏
    public static void main(String[] args) {

            String xml = "<?xml version=\"1.0\" encoding=\"gb2312\"?><p><seqid></seqid><code></code><msg>成功</msg>" +
                              "<node><ename>huoniu</ename><cname>火牛</cname><prefix>108</prefix><begin>20150603</begin><end>20160630</end><borr>1000000</borr><margin>100000</margin><usdborr>1000000</usdborr><usdmargin>100000</usdmargin><mainp>0.60</mainp><midp>0.60</midp><growp>0.60</growp><mainpt>0.60</mainpt><midpt>0.60</midpt><growpt>0.30</growpt><shcomm>0.000300</shcomm><szcomm>0.000300</szcomm><warn>1.000</warn><close>1.000</close><interest>200</interest><commf>13</commf><layout>p-huo01:1100000:574810</layout><unmoney>0</unmoney><tstatus>0</tstatus><cstatus>0</cstatus></node>" +
                              " <node><ename>nn</ename><cname>牛牛</cname><prefix>102</prefix><begin>20150615</begin><end>20151015</end><borr>10000000</borr><margin>8000000</margin><usdborr>10000000</usdborr><usdmargin>8000000</usdmargin><mainp>0.60</mainp><midp>0.60</midp><growp>0.30</growp><mainpt>0.60</mainpt><midpt>0.60</midpt><growpt>0.30</growpt><shcomm>0.003000</shcomm><szcomm>0.003000</szcomm><warn>0.800</warn><close>0.800</close><interest>0</interest><commf>0</commf><layout></layout><unmoney>18000000</unmoney><tstatus>0</tstatus><cstatus>0</cstatus></node>" +
                             "<node><ename>ag-huo</ename><cname>兜底代理商</cname><prefix>huo</prefix><begin>20150602</begin><end>20160630</end><borr>0</borr><margin>0</margin><usdborr>0</usdborr><usdmargin>0</usdmargin><mainp>0.60</mainp><midp>0.60</midp><growp>0.30</growp><mainpt>0.60</mainpt><midpt>0.60</midpt><growpt>0.30</growpt><shcomm>0.000300</shcomm><szcomm>0.000300</szcomm><warn>0.010</warn><close>0.010</close><interest>0</interest><commf>0</commf><layout></layout><unmoney>0</unmoney><tstatus>0</tstatus><cstatus>0</cstatus></node></p>";

            List<Map> nodeList = new ArrayList<Map>();
            Map<String, Object> sendMap = new HashMap<String, Object>();
            try {
                
                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                DocumentBuilder db = dbf.newDocumentBuilder();
                Document doc = db.parse(new InputSource(new StringReader(xml)));
                Element root = doc.getDocumentElement();// 根節點

                Node node = root.getFirstChild();
                while(node != null) {
                    String nodeName = node.getNodeName().trim();
                    String nodeValue = node.getTextContent().trim();
                    
                    if("node".equals(nodeName) && node.hasChildNodes()) {
                        
                        Map<String, Object> nodeMap = new HashMap<String, Object>();
                        
                        Node childNode = node.getFirstChild();
                        while(childNode != null) {
                            nodeMap.put(childNode.getNodeName(), childNode.getTextContent());
                            childNode = childNode.getNextSibling();
                        }
                        
                        nodeList.add(nodeMap);
                    } else {
                        sendMap.put(nodeName, nodeValue);
                    }
                    
                    node = node.getNextSibling();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            
            sendMap.put("node", nodeList);
            
            System.out.println(sendMap);
        }



    打印結果 :
    {node=[{warn=1.000, cstatus=0, tstatus=0, borr=1000000, growpt=0.30, unmoney=0, midpt=0.60, usdmargin=100000, commf=13, close=1.000, begin=20150603, shcomm=0.000300, usdborr=1000000, growp=0.60, interest=200, layout=p-huo01:1100000:574810, prefix=108, ename=huoniu, midp=0.60, mainpt=0.60, margin=100000, szcomm=0.000300, cname=火牛, end=20160630, mainp=0.60}, 
                {warn=0.800, cstatus=0, tstatus=0, borr=10000000, growpt=0.30, unmoney=18000000, midpt=0.60, usdmargin=8000000, commf=0, close=0.800, begin=20150615, shcomm=0.003000, usdborr=10000000, growp=0.30, interest=0, layout=, ename=nn, midp=0.60, mainpt=0.60, margin=8000000, szcomm=0.003000, end=20151015, mainp=0.60},
                {warn=0.010, cstatus=0, tstatus=0, borr=0, growpt=0.30, unmoney=0, midpt=0.60, usdmargin=0, commf=0, close=0.010, begin=20150602, shcomm=0.000300, usdborr=0, growp=0.30, interest=0, layout=, prefix=huo, ename=ag-huo, midp=0.60, mainpt=0.60, margin=0, szcomm=0.000300, end=20160630, mainp=0.60}], seqid=, code=, msg=成功}
    posted @ 2015-08-09 10:15 藤本薔薇 閱讀(267) | 評論 (0)編輯 收藏
          public static void main(String[] args) throws Exception {
                Map<String, Object> sendMap = new HashMap<String, Object>();
                String data = "<?xml version=\"1.0\" encoding=\"gb2312\"?><p><seqid></seqid><client>0BF3F2D9A01797BBF05D6BC89877DC91</client><ename>108-wc</ename><code>0</code><msg>成功</msg><totalm>12447.97</totalm><cash>5669.13</cash><stockm>6778.84</stockm><num>2</num><stock><node><market>0</market><symbol>600104</symbol><direct>1</direct><type>0</type><avgprice>21.010</avgprice><holdnum>299</holdnum></node><node><market>0</market><symbol>601818</symbol><direct>1</direct><type>0</type><avgprice>4.993</avgprice><holdnum>4</holdnum></node></stock></p>";

                List<Map> nodeList = new ArrayList<Map>();
                try {
                    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                    DocumentBuilder db = dbf.newDocumentBuilder();
                    Document doc = db.parse(new InputSource(new StringReader(data)));
                    Element root = doc.getDocumentElement();// 根節點
                    Node node = root.getFirstChild();
                    while(node != null) {
                        String nodeName = node.getNodeName().trim();
                        String nodeValue = node.getTextContent().trim();
                        if("stock".equals(nodeName) && node.hasChildNodes()) {
                            Node  nodeOne =  node.getFirstChild();
                            while(nodeOne != null) {
                             String nodeOneName = nodeOne.getNodeName().trim();
                             if("node".equals(nodeOneName) && nodeOne.hasChildNodes()){
                                 Map<String, Object> nodeMap = new HashMap<String, Object>();
                                  Node threeNode = nodeOne.getFirstChild();
                                    while(threeNode != null) {
                                        nodeMap.put(threeNode.getNodeName(), threeNode.getTextContent());
                                        threeNode = threeNode.getNextSibling();
                                    }
                                    nodeList.add(nodeMap);
                                  }
                               nodeOne = nodeOne.getNextSibling();
                               }
                            }else{
                                sendMap.put(nodeName, nodeValue);
                            }
                        node = node.getNextSibling();
                        }                    
                    sendMap.put("node", nodeList);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                System.out.println(sendMap);
          }  


    打印結果:{node=[{direct=1, market=0, symbol=600104, avgprice=21.010, holdnum=299, type=0},
                 {direct=1, market=0, symbol=601818, avgprice=4.993, holdnum=4, type=0}],
                  num=2, seqid=, client=0BF3F2D9A01797BBF05D6BC89877DC91, stockm=6778.84, cash=5669.13, ename=108-wc, code=0, totalm=12447.97, msg=成功}
    posted @ 2015-08-09 10:09 藤本薔薇 閱讀(476) | 評論 (0)編輯 收藏
    /Files/kokosang/DoubleUtil.txt



    package frameWork.util;
    import java.math.BigDecimal;
    import java.text.DecimalFormat;
    /**   
     * 由于Java的簡單類型不能夠精確的對浮點數進行運算,這個工具類提供精   
     * 確的浮點數運算,包括加減乘除和四舍五入。   
     */    
    public class DoubleUtil {
    //這個類不能實例化    
    private DoubleUtil(){    
    }  
    //默認除法運算精度    
    private static final int DEF_DIV_SCALE = 10;  
    //默認的保留位數
    private static DecimalFormat df=new DecimalFormat("0.00");  
    /**
    * 按照格式保留幾位
    * @param money  double數
    * @param format 格式
    * @return
    */
    public static double  format(double money,String format){
    if(format != null && format != ""){
    df=new DecimalFormat(format); 
    }
    double moneyformat=new Double(df.format(money).toString());  
    return moneyformat;
    }
    /**   
    * 提供精確的加法運算。   
    * @param v1 被加數   
    * @param v2 加數   
    * @return 兩個參數的和   
    */    
    public static double add(double v1,double v2){    
    BigDecimal b1 = new BigDecimal(Double.toString(v1));    
    BigDecimal b2 = new BigDecimal(Double.toString(v2));    
    return b1.add(b2).doubleValue();    
    }    
    /**   
    * 提供精確的減法運算。   
    * @param v1 被減數   
    * @param v2 減數   
    * @return 兩個參數的差   
    */    
    public static double sub(double v1,double v2){    
    BigDecimal b1 = new BigDecimal(Double.toString(v1));    
    BigDecimal b2 = new BigDecimal(Double.toString(v2));    
    return b1.subtract(b2).doubleValue();    
    }    
    /**   
    * 提供精確的乘法運算。   
    * @param v1 被乘數   
    * @param v2 乘數   
    * @return 兩個參數的積   
    */    
    public static double mul(double v1,double v2){    
    BigDecimal b1 = new BigDecimal(Double.toString(v1));    
    BigDecimal b2 = new BigDecimal(Double.toString(v2));    
    return b1.multiply(b2).doubleValue();    
    }    
    /**   
    * 提供(相對)精確的除法運算,當發生除不盡的情況時,精確到   
    * 小數點以后10位,以后的數字四舍五入。   
    * @param v1 被除數   
    * @param v2 除數   
    * @return 兩個參數的商   
    */    
    public static double div(double v1,double v2){    
    return div(v1,v2,DEF_DIV_SCALE);    
    }    
    /**   
    * 提供(相對)精確的除法運算。當發生除不盡的情況時,由scale參數指   
    * 定精度,以后的數字四舍五入。   
    * @param v1 被除數   
    * @param v2 除數   
    * @param scale 表示表示需要精確到小數點以后幾位。   
    * @return 兩個參數的商   
    */    
    public static double div(double v1,double v2,int scale){    
    if(scale<0){    
    throw new IllegalArgumentException("The scale must be a positive integer or zero");    
    }    
    BigDecimal b1 = new BigDecimal(Double.toString(v1));    
    BigDecimal b2 = new BigDecimal(Double.toString(v2));    
    return b1.divide(b2,scale,BigDecimal.ROUND_HALF_UP).doubleValue();    
    }    
    /**   
    * 提供精確的小數位四舍五入處理。   
    * @param v 需要四舍五入的數字   
    * @param scale 小數點后保留幾位   
    * @return 四舍五入后的結果   
    */    
    public static double round(double v,int scale){    
    if(scale<0){    
    throw new IllegalArgumentException("The scale must be a positive integer or zero");    
    }    
    BigDecimal b = new BigDecimal(Double.toString(v));    
    BigDecimal one = new BigDecimal("1");    
    return b.divide(one,scale,BigDecimal.ROUND_HALF_UP).doubleValue();    
    }    
    /**   
    * 提供精確的類型轉換(Float)   
    * @param v 需要被轉換的數字   
    * @return 返回轉換結果   
    */    
    public static float convertsToFloat(double v){    
    BigDecimal b = new BigDecimal(v);    
    return b.floatValue();    
    }    
    /**   
    * 提供精確的類型轉換(Int)不進行四舍五入   
    * @param v 需要被轉換的數字   
    * @return 返回轉換結果   
    */    
    public static int convertsToInt(double v){    
    BigDecimal b = new BigDecimal(v);    
    return b.intValue();    
    }    
    /**   
    * 提供精確的類型轉換(Long)   
    * @param v 需要被轉換的數字   
    * @return 返回轉換結果   
    */    
    public static long convertsToLong(double v){    
    BigDecimal b = new BigDecimal(v);    
    return b.longValue();    
    }    
    /**   
    * 返回兩個數中大的一個值   
    * @param v1 需要被對比的第一個數   
    * @param v2 需要被對比的第二個數   
    * @return 返回兩個數中大的一個值   
    */    
    public static double returnMax(double v1,double v2){    
    BigDecimal b1 = new BigDecimal(v1);    
    BigDecimal b2 = new BigDecimal(v2);    
    return b1.max(b2).doubleValue();    
    }    
    /**   
    * 返回兩個數中小的一個值   
    * @param v1 需要被對比的第一個數   
    * @param v2 需要被對比的第二個數   
    * @return 返回兩個數中小的一個值   
    */    
    public static double returnMin(double v1,double v2){    
    BigDecimal b1 = new BigDecimal(v1);    
    BigDecimal b2 = new BigDecimal(v2);    
    return b1.min(b2).doubleValue();    
    }    
    /**   
    * 精確對比兩個數字   
    * @param v1 需要被對比的第一個數   
    * @param v2 需要被對比的第二個數   
    * @return 如果兩個數一樣則返回0,如果第一個數比第二個數大則返回1,反之返回-1   
    */    
    public static int compareTo(double v1,double v2){    
    BigDecimal b1 = new BigDecimal(v1);    
    BigDecimal b2 = new BigDecimal(v2);    
    return b1.compareTo(b2);    
    }
    /**
    * 格式化double
    * @param arg0
    * @param num
    * @return
    */
    public static String doubleFormat(double arg0,Integer num){
    DecimalFormat df = new DecimalFormat("####.00"); 
    /*DecimalFormat df2 = new DecimalFormat("##.00%");  
    DecimalFormat df3 = new DecimalFormat("###,##0.00");*/
    if(num !=null){
    if(num == 1){
    df = new DecimalFormat("####.0"); 
    }else if(num == 2){
    df = new DecimalFormat("####.00"); 
    }else if(num == 3){
    df = new DecimalFormat("####.000"); 
    }else if(num == 4){
    df = new DecimalFormat("####.0000"); 
    }
    }else{
    df = new DecimalFormat("####"); 
    }
    if(df.format(arg0).contains(".")){
    if(df.format(arg0).substring(0, df.format(arg0).indexOf(".")).length()<=0){
    df = new DecimalFormat("0.00");
    if(num !=null){
    if(num == 1){
    df = new DecimalFormat("0.0"); 
    }else if(num == 2){
    df = new DecimalFormat("0.00"); 
    }else if(num == 3){
    df = new DecimalFormat("0.000"); 
    }else if(num == 4){
    df = new DecimalFormat("0.0000"); 
    }
    }else{
    df = new DecimalFormat("0"); 
    }
    }
    }
    return df.format(arg0);
    }
    /**
    * 百分比格式化
    * @param arg0
    * @param num
    * @return
    */
    public static String percentageFormat(double arg0,Integer num){
    DecimalFormat df = new DecimalFormat("##.00%");
    if(num !=null){
    if(num == 1){
    df = new DecimalFormat("####.0%"); 
    }else if(num == 2){
    df = new DecimalFormat("####.00%"); 
    }else if(num == 3){
    df = new DecimalFormat("####.000%"); 
    }else if(num == 4){
    df = new DecimalFormat("####.0000%"); 
    }
    }else{
    df = new DecimalFormat("####%"); 
    }
    if(df.format(arg0).contains(".")){
    if(df.format(arg0).substring(0, df.format(arg0).indexOf(".")).length()<=0){
    df = new DecimalFormat("0.00%");
    if(num !=null){
    if(num == 1){
    df = new DecimalFormat("0.0%"); 
    }else if(num == 2){
    df = new DecimalFormat("0.00%"); 
    }else if(num == 3){
    df = new DecimalFormat("0.000%"); 
    }else if(num == 4){
    df = new DecimalFormat("0.0000%"); 
    }
    }else{
    df = new DecimalFormat("0%"); 
    }
    }
    }
    return df.format(arg0);
    }
    /**
    * double每三位短號分割
    * @param arg0
    * @param num
    * @return
    */
    public static String splitNumberFormat(double arg0,Integer num){
    DecimalFormat df = new DecimalFormat("###,##0.00");
    if(num !=null){
    if(num == 1){
    df = new DecimalFormat("###,##0.0"); 
    }else if(num == 2){
    df = new DecimalFormat("###,##0.00"); 
    }else if(num == 3){
    df = new DecimalFormat("###,##0.000"); 
    }else if(num == 4){
    df = new DecimalFormat("###,##0.0000"); 
    }
    }else{
    df = new DecimalFormat("###,###"); 
    }
    return df.format(arg0);
    }
    }
    posted @ 2015-08-07 13:47 藤本薔薇 閱讀(587) | 評論 (0)編輯 收藏
    假如  redis  在/usr/local/bin

    配置文件在/usr/local/redis-2.8.21 

     root@iZ239bujfzrZ:    /usr/local/bin# ./redis-server redis.conf nohup 
    posted @ 2015-08-07 10:36 藤本薔薇 閱讀(213) | 評論 (0)編輯 收藏

          public static interface NUMBER{
    public static String STR_FORMAT = "00000"; 
            static String TOKEN = null; 
    }


    //配資單號格式
        public static String AddOne(String code){
       Integer intHao = Integer.parseInt(code);
       intHao++;
       DecimalFormat df = new DecimalFormat(NUMBER.STR_FORMAT);
       return df.format(intHao);
        }
        
        public static void main(String[] args) {
        String code = "ASD0034252345234500001";
           String  xlh = code.substring(code.length()-5, code.length());
           System.out.println("數據庫原有的最大序列號:"+xlh);
           if(xlh!=null){
          System.out.println("累加的新生成的序列號:"+AddOne(xlh));
           }else{
          System.out.println("最新的新生成的序列號:"+"00001"); //如果沒有手動生成一條最小的
           }
      }
        
    posted @ 2015-08-03 11:50 藤本薔薇 閱讀(451) | 評論 (0)編輯 收藏
        /**
         * 獲取股票板塊信息
         * 滬市A股 : 600、601、603 開頭
         * 深市A股 : 000開頭
         * 中小板 : 002開頭
         * 創業板 : 300開頭
         * 滬市新股申購:730
         * @param code
         * @return
         */
        public static int getPlateInfo(String code){
        if(code.startsWith("600") || code.startsWith("601") || code.startsWith("603")){
        return 0;
        }else if(code.startsWith("000")){
        return 1;
        }else if(code.startsWith("002")){
        return 2;
        }else if(code.startsWith("300")){
        return 3;
        }else if(code.startsWith("730")){
        return 4;
        }else {
        return 5;
        }
        }
    posted @ 2015-07-29 19:07 藤本薔薇 閱讀(373) | 評論 (0)編輯 收藏
     
                我想把String 類型 yyyy-MM-dd 格式的數據轉換成 String 類型  yyyyMMdd 格式,然后

    String end_date = "2015-09-07";
            SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); 
            Date date_2 = formatter.parse(end_date);
    String date_22 = formatter.format(date_2);
    System.out.println(date_2);
    System.out.println(date_22);

      
            打印出來結果是:
                    Tue Dec 09 00:00:00 CST 2014
                    20141209

           后來,吾家上神告知,不能直接轉
          
                    String end_date = "2015-09-07";
    DateFormat format =new SimpleDateFormat("yyyy-MM-dd");
    Date date_1 = format.parse(end_date);
    format = new SimpleDateFormat("yyyyMMdd");  
    String date_11 = format.format(date_1);
    System.out.println(date_1);
    System.out.println(date_11);


          打印出來結果是:

                   Mon Sep 07 00:00:00 CST 2015
                   20150907


        總結語: 吾家上神棒棒噠!!!

    posted @ 2015-07-27 16:27 藤本薔薇 閱讀(203) | 評論 (0)編輯 收藏
             
                 原本寫了 if  else  判斷股票所屬板塊的,覺得繁瑣,就去改了下面的

                      public static void main(String[] args) {
        String code ="002348";
        String stock = "002".equals(code.substring(0,3)) ? "002" : code.substring(0,1);
    System.out.println(stock);
    }

                   然后跑去得瑟,被鄙視了,然后  ↓↓↓↓

                     public static String getPlateInfo(String code){
        return code.startsWith("002") ? "002" : code.substring(0,1);
                      }

                還補了一刀,你看你寫的什么玩意兒,哼,好想讓他跪搓衣板
    posted @ 2015-07-02 00:26 藤本薔薇 閱讀(231) | 評論 (0)編輯 收藏
    Map<String, Object> userInfoMap = new HashMap<String, Object>();
    // String data = JsonUtil.toJson(infoMap);
    userInfoMap.put("agent", agent);
    userInfoMap.put("ename", ename);
    Map<String, Object> infoMap = SocketLogic.logic.userInfo(userInfoMap);
    JSONObject rootObj = (JSONObject)JSONObject.toJSON(infoMap);
    JSONArray nodeArr = rootObj.getJSONArray("node");
    for(int i = 0; i < nodeArr.size(); i ++) {
    authority = nodeArr.getJSONObject(i).get("authority").toString();          //交易權限
    margin = nodeArr.getJSONObject(i).getLongValue("margin");  //保證金
    warn = nodeArr.getJSONObject(i).getFloatValue("warn");      //警戒線
    close = nodeArr.getJSONObject(i).getFloatValue("close");    //平倉線
    end =  nodeArr.getJSONObject(i).getLongValue("end");       //結束時間
    mainp = nodeArr.getJSONObject(i).getFloatValue("mainp"); //主板單票比例
    midp = nodeArr.getJSONObject(i).getFloatValue("midp");   //中小板單票比例
    growp = nodeArr.getJSONObject(i).getFloatValue("growp"); //創業板單票比例
       
    }
    posted @ 2015-06-29 19:20 藤本薔薇 閱讀(336) | 評論 (1)編輯 收藏
    僅列出標題
    共8頁: 上一頁 1 2 3 4 5 6 7 8 下一頁 
    主站蜘蛛池模板: 亚洲视频免费在线看| 999zyz**站免费毛片| 国产成人精品免费视频网页大全| 国产亚洲精品观看91在线| 99麻豆久久久国产精品免费 | 亚洲AV日韩精品一区二区三区| 亚洲一区二区观看播放| A级毛片内射免费视频| 亚洲成av人在线观看网站| 小小影视日本动漫观看免费| 亚洲AV性色在线观看| 免费成人黄色大片| 五月天婷婷精品免费视频| 亚洲欧洲成人精品香蕉网| 久久久精品免费视频| 亚洲人成电影亚洲人成9999网| 69堂人成无码免费视频果冻传媒| 亚洲国产精品久久网午夜 | 国产成人自产拍免费视频| 狠狠亚洲婷婷综合色香五月排名| 成年免费a级毛片免费看无码| 久久青青草原亚洲AV无码麻豆| 99爱免费观看视频在线| 亚洲国产成人99精品激情在线| 国产成人免费网站在线观看| 国产A∨免费精品视频| 99久久精品国产亚洲| 免费无码又黄又爽又刺激| 国产精品自拍亚洲| 亚洲国产精品VA在线观看麻豆 | 免费无码成人AV片在线在线播放| 久久精品国产亚洲AV天海翼 | 亚洲精品乱码久久久久久蜜桃不卡 | 亚洲av无码专区在线| 国产jizzjizz免费看jizz| 日本黄色动图免费在线观看| 亚洲成_人网站图片| 丝袜熟女国偷自产中文字幕亚洲| 1000部拍拍拍18勿入免费视频下载| 亚洲av无码专区青青草原| 亚洲av之男人的天堂网站|