|
|
|
|
@ -41,15 +41,45 @@ public class WhiteCarnoDicSeviceImpl implements IWhiteCarnoDicService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public int insertData(WhiteCarnoDic whiteAccountText) throws Exception {
|
|
|
|
|
public int insertData(Map<String, Object> params) throws Exception {
|
|
|
|
|
int ret=-1;
|
|
|
|
|
try{
|
|
|
|
|
//先根据车牌号与颜色判断是否已经存在
|
|
|
|
|
Map<String,Object> params=new HashMap<String,Object>();
|
|
|
|
|
params.put("id",whiteAccountText.getMemo());
|
|
|
|
|
List<WhiteCarnoDic> whiteCarnoList1 = whiteCarnoDicMapper.getWhiteCarnoDicList(params);
|
|
|
|
|
WhiteCarnoDic whiteAccountText=new WhiteCarnoDic();
|
|
|
|
|
String memo=params.get("memo").toString();//免费路段的值
|
|
|
|
|
String memoSS=params.get("memoSS").toString();//站站免费中的路段值
|
|
|
|
|
String memoDb="";
|
|
|
|
|
if (!PubTools.isNull(memo)){
|
|
|
|
|
String[] ckgFree=memo.split(",");
|
|
|
|
|
for (int i = 0; i < ckgFree.length; i++){
|
|
|
|
|
String r = ckgFree[i]+"";
|
|
|
|
|
if (!PubTools.isNull(ckgFree[i]+"")){
|
|
|
|
|
//不足两位补0,
|
|
|
|
|
if (Integer.parseInt(ckgFree[i]+"") < 10){
|
|
|
|
|
memoDb += GetHex("0" + ckgFree[i]+"" + "0" + ckgFree[i]+"" + "00" + "0" + ckgFree[i]+"" + "00");
|
|
|
|
|
}else if(Integer.parseInt(ckgFree[i]+"") < 100 && Integer.parseInt(ckgFree[i]+"")>=10){//两位的
|
|
|
|
|
memoDb += GetHex(ckgFree[i]+"" + ckgFree[i]+"" + "00" + ckgFree[i]+"" + "00");
|
|
|
|
|
}else{
|
|
|
|
|
memoDb += GetHex(ckgFree[i].substring(0,2)+ ckgFree[i].substring(0,2)+ ckgFree[i].substring(0,2)+ ckgFree[i].substring(0,2)+ ckgFree[i].substring(0,2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!PubTools.isNull(memoSS)){
|
|
|
|
|
String[] ckgFree=memoSS.split(",");
|
|
|
|
|
for (int i = 0; i < ckgFree.length; i++){
|
|
|
|
|
String r = ckgFree[i]+"";
|
|
|
|
|
memoDb += GetHex(r);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
whiteAccountText.setDicname(params.get("dicname").toString());
|
|
|
|
|
whiteAccountText.setDiscrp(params.get("discrp").toString());
|
|
|
|
|
whiteAccountText.setMemo(memoDb);
|
|
|
|
|
Map<String,Object> paramsQuery=new HashMap<String,Object>();
|
|
|
|
|
paramsQuery.put("memo",whiteAccountText.getMemo());
|
|
|
|
|
List<WhiteCarnoDic> whiteCarnoList1 = whiteCarnoDicMapper.getWhiteCarnoDicList(paramsQuery);
|
|
|
|
|
if(whiteCarnoList1.size()>0){
|
|
|
|
|
return -2;//白名单存在该信息!
|
|
|
|
|
return -2;//字典表中存在该信息!
|
|
|
|
|
}
|
|
|
|
|
ret= whiteCarnoDicMapper.insert(whiteAccountText);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
@ -98,4 +128,21 @@ public class WhiteCarnoDicSeviceImpl implements IWhiteCarnoDicService {
|
|
|
|
|
List<WhiteCarnoDic> records = whiteCarnoDicMapper.getWhiteCarnoDicList(params);
|
|
|
|
|
return records;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String GetHex(Object o)
|
|
|
|
|
{
|
|
|
|
|
String r = "", s1 = "", s2 = "";
|
|
|
|
|
String s = o.toString();
|
|
|
|
|
if (s.length() >= 10)
|
|
|
|
|
{
|
|
|
|
|
r = "00" + Integer.toHexString(Integer.parseInt(s.substring(0, 2)));
|
|
|
|
|
s1 = "0000" + Integer.toHexString(Integer.parseInt(s.substring(2, 6)));
|
|
|
|
|
s2 = "0000" + Integer.toHexString(Integer.parseInt(s.substring(6, 10)));
|
|
|
|
|
|
|
|
|
|
r = r.substring(r.length() - 2, r.length());
|
|
|
|
|
s1 = s1.substring(s1.length() - 4, s1.length());
|
|
|
|
|
s2 = s2.substring(s2.length() - 4, s2.length());
|
|
|
|
|
}
|
|
|
|
|
return r + s1 + s2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|