bug优化

This commit is contained in:
mashuai 2024-10-15 17:08:23 +08:00
parent f5bb426c37
commit 0d5fc40c5f
4 changed files with 56 additions and 2 deletions

View File

@ -15,6 +15,8 @@ public enum ExceptionEnum {
TO_PARAM_NULL(1007, "参数为空"),
NAME_DUPLICATE(1002, "名称重复,请重新输入"),
ID_CARD_DUPLICATE(1009, "身份证号码重复,请重新输入"),
INVALID_LONGITUDE_FORMAT(1113, "经度格式不正确"),
INVALID_LATITUDE_FORMAT(1114, "纬度格式不正确"),
IMPORT_TO_DATABASE(1003, "该表单中存在相同名称的数据,请修改后重新提交"),
SUCCESS(200, "操作成功"),
EXISTENCE_OF_TEAM(1112, "该人员还绑定相关班组,无法删除"),

View File

@ -136,10 +136,10 @@ public class TbBdRecordServiceImpl implements TbBdRecordService{
List<TbBdDeviceRecord> tbBdDeviceRecord = tbBdDeviceRecordMapper.selectByName(deviceRecord);
if (CollectionUtils.isNotEmpty(tbBdDeviceRecord)) {
if (tbBdDeviceRecord.size() > 1) {
return AjaxResult.error(1114,"设备名称或编码与库中重复,请勿重复添加");
return AjaxResult.error(1115,"设备名称或编码与库中重复,请勿重复添加");
}
if (tbBdDeviceRecord.size() == 1 && !deviceRecord.getId().equals(tbBdDeviceRecord.get(0).getId())) {
return AjaxResult.error(1115,"提交的数据中设备名称或编码与库中重复,请勿重复添加");
return AjaxResult.error(1115,"设备名称或编码与库中重复,请勿重复添加");
}
}
}

View File

@ -86,6 +86,19 @@ public class TbProPowerServiceImpl implements TbProPowerService {
if (power != null) {
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
}
//校验输入的经纬度是否合规
if (tbProPower.getLon() != null) {
boolean b = tbProPower.getLon().matches(Constants.LONGITUDE_PATTERN);
if (!b) {
return AjaxResult.error(ExceptionEnum.INVALID_LONGITUDE_FORMAT.getCode(), ExceptionEnum.INVALID_LONGITUDE_FORMAT.getMsg());
}
}
if (tbProPower.getLat() != null) {
boolean b = tbProPower.getLat().matches(Constants.LATITUDE_PATTERN);
if (!b) {
return AjaxResult.error(ExceptionEnum.INVALID_LATITUDE_FORMAT.getCode(), ExceptionEnum.INVALID_LATITUDE_FORMAT.getMsg());
}
}
int result = tbProPowerDao.insert(tbProPower);
if (result > 0) {
return AjaxResult.success(ExceptionEnum.SUCCESS);
@ -111,6 +124,19 @@ public class TbProPowerServiceImpl implements TbProPowerService {
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
}
}
//校验输入的经纬度是否合规
if (tbProPower.getLon() != null) {
boolean b = tbProPower.getLon().matches(Constants.LONGITUDE_PATTERN);
if (!b) {
return AjaxResult.error(ExceptionEnum.INVALID_LONGITUDE_FORMAT.getCode(), ExceptionEnum.INVALID_LONGITUDE_FORMAT.getMsg());
}
}
if (tbProPower.getLat() != null) {
boolean b = tbProPower.getLat().matches(Constants.LATITUDE_PATTERN);
if (!b) {
return AjaxResult.error(ExceptionEnum.INVALID_LATITUDE_FORMAT.getCode(), ExceptionEnum.INVALID_LATITUDE_FORMAT.getMsg());
}
}
int result = tbProPowerDao.update(tbProPower);
if (result > 0) {
return AjaxResult.success(ExceptionEnum.SUCCESS);

View File

@ -79,6 +79,19 @@ public class TbProjectServiceImpl implements TbProjectService {
if (project != null) {
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
}
//校验输入的经纬度是否合规
if (tbProject.getLon() != null) {
boolean b = tbProject.getLon().matches(Constants.LONGITUDE_PATTERN);
if (!b) {
return AjaxResult.error(ExceptionEnum.INVALID_LONGITUDE_FORMAT.getCode(), ExceptionEnum.INVALID_LONGITUDE_FORMAT.getMsg());
}
}
if (tbProject.getLat() != null) {
boolean b = tbProject.getLat().matches(Constants.LATITUDE_PATTERN);
if (!b) {
return AjaxResult.error(ExceptionEnum.INVALID_LATITUDE_FORMAT.getCode(), ExceptionEnum.INVALID_LATITUDE_FORMAT.getMsg());
}
}
tbProject.setCreateUser(SecurityUtils.getUserId());
int result = tbProjectDao.insert(tbProject);
if (result > 0) {
@ -105,6 +118,19 @@ public class TbProjectServiceImpl implements TbProjectService {
return AjaxResult.error(ExceptionEnum.NAME_DUPLICATE.getCode(), ExceptionEnum.NAME_DUPLICATE.getMsg());
}
}
//校验输入的经纬度是否合规
if (tbProject.getLon() != null) {
boolean b = tbProject.getLon().matches(Constants.LONGITUDE_PATTERN);
if (!b) {
return AjaxResult.error(ExceptionEnum.INVALID_LONGITUDE_FORMAT.getCode(), ExceptionEnum.INVALID_LONGITUDE_FORMAT.getMsg());
}
}
if (tbProject.getLat() != null) {
boolean b = tbProject.getLat().matches(Constants.LATITUDE_PATTERN);
if (!b) {
return AjaxResult.error(ExceptionEnum.INVALID_LATITUDE_FORMAT.getCode(), ExceptionEnum.INVALID_LATITUDE_FORMAT.getMsg());
}
}
tbProject.setUpdateUser(SecurityUtils.getUserId());
int result = tbProjectDao.update(tbProject);
//根据工程id改变班组表中的项目信息