CruiseService
package com.newglobal.dispense.service;
import com.newglobal.commun.DataPack;
import com.newglobal.dispense.DisMain;
import com.newglobal.util.Logging;
import com.newglobal.util.QueueBuffer;
import com.newglogal.commbase.CruiseDao;
import com.newglogal.commbase.DevSession;
import com.newglogal.commbase.Position;
import com.newglogal.commbase.util.Car;
import com.newglogal.commbase.util.Device;
public class CruiseService {
private static Logging log = DisMain.log;
private CruiseDao cd = CruiseDao.getInstance();
public void cmd_RDD(DataPack dp) {
QueueBuffer qbuf = dp.get_data();
int dlen = qbuf.size();
byte cmd[] = null;
String data[] = null;
cmd = qbuf.getBytes(0, 2);
data = (new String(qbuf.getBytes(2, dlen-2))).split(",");
DevSession devs = new DevSession();
Position pos = new Position();
Car car = new Car();
Device device = new Device();
if(cmd[0] == 'C' && cmd[1]== 'A'){//Car
cd.insertCar(data);
}else if(cmd[0] == 'C' && cmd[1]== 'G'){//CarGroup
cd.insertCarGroup(data);
}else if(cmd[0] == 'C' && cmd[1]== 'P'){//Company
cd.insertCompany(data);
}else if(cmd[0] == 'D' && cmd[1]== 'V'){//Device
cd.insertDevice(data);
}else if(cmd[0] == 'O' && cmd[1]== 'R'){//Organ 信息
cd.insertOrgan(data);
}else if(cmd[0] == 'S' && cmd[1]== 'C'){//sim card 信息
cd.insertSimCard(data);
}else if(cmd[0] == 'D' && cmd[1] == 'A'){ //报警日志
long carid = Long.parseLong(data[0]);
long deviceid = Long.parseLong(data[1]);
double posx = Double.parseDouble(data[2]);
double posy = Double.parseDouble(data[3]);
int status = Integer.parseInt(data[4]);
int speed = Integer.parseInt(data[5]);
String alarmType = data[6];
double speedLimit = Double.parseDouble(data[7]);
int path = Integer.parseInt(data[8]);
int region = Integer.parseInt(data[9]);
long rule = Long.parseLong(data[10]);
long time = Long.parseLong(data[11]);
car.setID(carid);
devs.setCar(car);
device.setDevice_id(deviceid);
devs.setDevice(device);
devs.setPosx(posx);
devs.setPosy(posy);
devs.setStatus(status);
devs.setSpeed(speed);
cd.insertAlarm_log(devs, alarmType, speedLimit, path, region, rule, time);
//devm.insertAlarm_log(carid, posx, posy, status, speed, alarmType, speedLimit, path, region, rule, time);
}else if(cmd[0] == 'D' && cmd[1] == 'C'){ //报警车辆轨迹
pos.action = Position.EITYPE_POSITION;
pos.carid = Long.parseLong(data[0]);
pos.devid = Long.parseLong(data[1]);
pos.direction = Integer.parseInt(data[2]);
pos.link_status = 1;
pos.posx = Double.parseDouble(data[3]);
pos.posy = Double.parseDouble(data[4]);
pos.speed = Integer.parseInt(data[5]);
pos.status = Integer.parseInt(data[6]);
pos.time = Long.parseLong(data[7]);
cd.putPos(pos);
}
}
}
浙公网安备 33010602011771号