|
@@ -6,8 +6,8 @@ import api.common.pojo.po.model.GpsPO;
|
|
import api.common.pojo.vo.model.GpsVO;
|
|
import api.common.pojo.vo.model.GpsVO;
|
|
import api.common.util.ObjectUtil;
|
|
import api.common.util.ObjectUtil;
|
|
import api.common.util.StringUtil;
|
|
import api.common.util.StringUtil;
|
|
-import api.common.util.TimeUtil;
|
|
|
|
import com.css.simulation.resource.common.utils.AuthUtil;
|
|
import com.css.simulation.resource.common.utils.AuthUtil;
|
|
|
|
+import com.css.simulation.resource.common.utils.PoUtil;
|
|
import com.css.simulation.resource.model.mapper.GpsMapper;
|
|
import com.css.simulation.resource.model.mapper.GpsMapper;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -41,13 +41,7 @@ public class GpsService {
|
|
|
|
|
|
public GpsPO saveGps(GpsPO gpsPO) {
|
|
public GpsPO saveGps(GpsPO gpsPO) {
|
|
//常规字段赋值
|
|
//常规字段赋值
|
|
- String currentUserId = AuthUtil.getCurrentUserId();
|
|
|
|
- Timestamp currentTime = TimeUtil.getNowForMysql();
|
|
|
|
- gpsPO.setCreateUserId(currentUserId);
|
|
|
|
- gpsPO.setCreateTime(currentTime);
|
|
|
|
- gpsPO.setModifyUserId(currentUserId);
|
|
|
|
- gpsPO.setModifyTime(currentTime);
|
|
|
|
- gpsPO.setIsDeleted(DictConstants.NO);
|
|
|
|
|
|
+ PoUtil.initAddPo(gpsPO);
|
|
gpsPO.setShare(DictConstants.NO);//私有
|
|
gpsPO.setShare(DictConstants.NO);//私有
|
|
//名称校验
|
|
//名称校验
|
|
List<GpsVO> list = gpsMapper.checkGpsName(gpsPO);
|
|
List<GpsVO> list = gpsMapper.checkGpsName(gpsPO);
|
|
@@ -58,7 +52,7 @@ public class GpsService {
|
|
String id = gpsPO.getId();
|
|
String id = gpsPO.getId();
|
|
if(ObjectUtil.isNull(id)){//新增
|
|
if(ObjectUtil.isNull(id)){//新增
|
|
gpsPO.setId(StringUtil.getRandomUUID());
|
|
gpsPO.setId(StringUtil.getRandomUUID());
|
|
- gpsPO.setSensorCode(StringUtil.getRandomUUID());
|
|
|
|
|
|
+ gpsPO.setSensorCode(StringUtil.getRandomCode());
|
|
gpsMapper.insert(gpsPO);
|
|
gpsMapper.insert(gpsPO);
|
|
}else{//修改
|
|
}else{//修改
|
|
gpsMapper.update(gpsPO);
|
|
gpsMapper.update(gpsPO);
|
|
@@ -78,13 +72,7 @@ public class GpsService {
|
|
return gpsPO;
|
|
return gpsPO;
|
|
}
|
|
}
|
|
//常规字段赋值
|
|
//常规字段赋值
|
|
- String currentUserId = AuthUtil.getCurrentUserId();
|
|
|
|
- Timestamp currentTime = TimeUtil.getNowForMysql();
|
|
|
|
- gpsPO.setCreateUserId(currentUserId);
|
|
|
|
- gpsPO.setCreateTime(currentTime);
|
|
|
|
- gpsPO.setModifyUserId(currentUserId);
|
|
|
|
- gpsPO.setModifyTime(currentTime);
|
|
|
|
- gpsPO.setIsDeleted(DictConstants.NO);
|
|
|
|
|
|
+ PoUtil.initAddPo(gpsPO);
|
|
gpsPO.setId(StringUtil.getRandomUUID());
|
|
gpsPO.setId(StringUtil.getRandomUUID());
|
|
gpsPO.setSensorCode(StringUtil.getRandomCode());
|
|
gpsPO.setSensorCode(StringUtil.getRandomCode());
|
|
gpsMapper.insert(gpsPO);
|
|
gpsMapper.insert(gpsPO);
|
|
@@ -92,9 +80,7 @@ public class GpsService {
|
|
}
|
|
}
|
|
|
|
|
|
public int delGpsById(GpsPO gpsPO) {
|
|
public int delGpsById(GpsPO gpsPO) {
|
|
- gpsPO.setIsDeleted(DictConstants.YES);
|
|
|
|
- gpsPO.setModifyUserId(AuthUtil.getCurrentUserId());
|
|
|
|
- gpsPO.setModifyTime(TimeUtil.getNowForMysql());
|
|
|
|
|
|
+ PoUtil.initDelPo(gpsPO);
|
|
int i = gpsMapper.delGpsById(gpsPO);
|
|
int i = gpsMapper.delGpsById(gpsPO);
|
|
return i;
|
|
return i;
|
|
}
|
|
}
|