You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.9 KiB
Java

10 months ago
package v_score;
import java.util.List;
import java.util.Map;
public class CommonHelp {
public synchronized static int GetFeeunitLength(List<Map<String, Object>> feeunit_list, String id){
int result=0;
for (Map<String, Object> map : feeunit_list) {
if (map.get("ID").toString().equals(id)){
result=Integer.valueOf(map.get("LENGTH").toString());
break;
}
}
return result;
}
public synchronized static String GetFeeunitNameById(List<Map<String, Object>> feeunit_list,String id){
String result="";
for (Map<String, Object> map : feeunit_list) {
if (map.get("ID").toString().equals(id)){
result=map.get("NAME").toString();
break;
}
}
return result;
}
//获取数组之和
public static int GetArrSum(String[] strGroup) {
int result = 0;
if (strGroup.length > 0) {
for (int i = 0; i < strGroup.length; i++) {
result += Integer.valueOf(strGroup[i]);
}
return result;
} else {
return result;
}
}
//根据车型距离,计算里程积分
public static int getVehicleScoreByType(int vehicletype,int length,List<Map<String, Object>> score_value_list){
int score=0;
for (Map<String, Object> map : score_value_list) {
int type=Integer.valueOf(map.get("TYPE").toString());
if (vehicletype==type){
int minlength=Integer.valueOf(map.get("MINLENGTH").toString());
int maxlength=Integer.valueOf(map.get("MAXLENGTH").toString());
if (length>=minlength && length<maxlength){
score=Integer.valueOf(map.get("SCORE").toString());
break;
}
}
}
return score;
}
}