fs-danaus
2024-08-09 7204e3dff0490732e861ccd1338e3e3c31d768c6
提交 | 用户 | age
a6a76f 1 package com.yc.utils;
F 2 /**
3  * @author 沈奕洲
4  * 2011-11-16
5  * */
6 import java.text.DecimalFormat;
7 import java.util.Map;
8
9 public class MapSet {
10     public static String ck_select(String sValue,String sDefault)
11     {
12         //下拉
13         String str="";
14         if (sValue.equalsIgnoreCase(sDefault)){
15             str=" Selected ";
16         }
17         ////System.out.println(sValue+"="+sDefault+"?"); 
18         return str;
19     }
20
21     public static String cb_Check(String sA,String sB){
22         String sChecked="";
23         if(sA.equalsIgnoreCase(sB)){
24             sChecked=" Checked ";
25         }
26         return sChecked;
27     }
28     
29     /**
30      * 显示网页结果
31      * @param o Map
32      * @return 如果非null,则显示相应字符串,否则,""
33      */
34     public static String ShowMap(Object o){
35         String sDef="";
36         if(o!=null){
37             sDef=o.toString();
38         }
39         return sDef;
40     }
41     
42     public static String ShowMap(Map rowMap, String sKey){
43         String sDef="";
44         if((rowMap!=null)&&(sKey!=null)&&(!sKey.equals(""))){
45             if(rowMap.get(sKey)!=null){
46                 sDef=rowMap.get(sKey).toString().trim();
47                 //System.out.println("value:"+sDef);
48             }
49         }
50         return sDef;
51     }
52  
53     //格式化显示日期格式 bDate 为true:只显式年月日 else 显示全部
54     public static String ShowMap(Map rowMap, String sKey,int bDate){
55         String sDef="";
56         if((rowMap!=null)&&(sKey!=null)&&(!sKey.equals(""))){
57             if(rowMap.get(sKey)!=null){
58                 if(bDate==0){
59                     sDef=DateChange.formatDate(rowMap.get(sKey).toString());                   
60                 }
61                 else if(bDate==1)
62                 {
63                     sDef=DateChange.parseFormatDateTime_str(rowMap.get(sKey).toString()); 
64                 }
65                 else{
66                     sDef=rowMap.get(sKey).toString();
67                 }
68             }
69         }
70         return sDef;
71     }
72     //格式化显示数量格式 sType==Money显示货币格式 sType==SL 显示数量 
73     // if sType==sValue 不显示
74     public static String ShowMap(Map rowMap, String sKey,String sType){
75         String sDef="";
76         if((rowMap!=null)&&(sKey!=null)&&(!sKey.equals(""))){
77             if(rowMap.get(sKey)!=null){
78                 if(sType=="Money" || sType.equals("Money")){
79                     DecimalFormat format= new DecimalFormat("####.00");
80                     //DecimalFormat format=new DecimalFormat();
81                     //format.setMinimumFractionDigits(0);
82                     sDef=format.format(rowMap.get(sKey));
83 //                    System.out.println(sDef);
84                 }else{
85                     DecimalFormat format= new DecimalFormat("####.00");
86                     //DecimalFormat format=new DecimalFormat();
87                     //format.setMinimumFractionDigits(0);
88                     sDef=format.format(rowMap.get(sKey).toString());
89                 //    sDef=format.format(rowMap.get(sKey));
90 //                    System.out.println(sDef);
91                 }
92             }
93         }
94         return sDef;
95     }
96 }