需求修改及bug修复
This commit is contained in:
parent
d0ac33d5e3
commit
89dfaa9e8f
|
|
@ -141,4 +141,9 @@ public class Constants {
|
|||
*/
|
||||
public static final Integer PARTICULATE_KEY = 119;
|
||||
|
||||
/**
|
||||
* 禁止特殊字符正则表达式
|
||||
*/
|
||||
public static final String DISALLOWED_REGEX = ".*[!~`@#$%^&*()-_,.?\":{}|<>+\\\\/\\%].*";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public enum ExceptionEnum {
|
|||
IMPORT_TO_DATABASE(1003, "该表单中存在相同名称的数据,请修改后重新提交"),
|
||||
SUCCESS(200, "操作成功"),
|
||||
FAIL(400, "操作失败"),
|
||||
DISALLOWED_CHARACTERS(1008, "输入字段含有非法特殊字符,请修改后重新提交"),
|
||||
EXISTENCE_OF_TEAM(1112, "该人员还绑定相关班组,无法删除"),
|
||||
SAVE_TO_DATABASE(500, "新增保存失败,请联系管理员"),
|
||||
DELETE_TO_DATABASE(500, "删除失败,请联系管理员"),
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class TbProDepartController extends BaseController {
|
|||
* @return 新增结果
|
||||
*/
|
||||
@ApiOperation(value = "新增项目部数据")
|
||||
@RequiresPermissions("base:depart:add")
|
||||
//@RequiresPermissions("base:depart:add")
|
||||
@PostMapping
|
||||
public AjaxResult add(@Valid @RequestBody TbProDepart tbProDepart) {
|
||||
return tbProDepartService.insert(tbProDepart);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.base.basic.controller;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.base.basic.config.Constants;
|
||||
import com.bonus.base.basic.domain.TbWarnConfig;
|
||||
import com.bonus.base.basic.service.TbWarnConfigService;
|
||||
|
|
@ -65,6 +66,38 @@ public class TbWarnConfigController extends BaseController {
|
|||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询设备预警配置数据")
|
||||
//@RequiresPermissions("base:warn:list")
|
||||
@GetMapping("/getList")
|
||||
public AjaxResult getList(TbWarnConfig tbWarnConfig) {
|
||||
if (tbWarnConfig.getConfiguType().equals(Constants.TEMP_KEY)) {
|
||||
List<TempVo> list = tbWarnConfigService.queryTempVoByPage(tbWarnConfig);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return AjaxResult.success(list.get(0));
|
||||
}
|
||||
}
|
||||
if (tbWarnConfig.getConfiguType().equals(Constants.HUM_KEY)) {
|
||||
List<InclVo> list = tbWarnConfigService.queryInclVoByPage(tbWarnConfig);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return AjaxResult.success(list.get(0));
|
||||
}
|
||||
}
|
||||
if (tbWarnConfig.getConfiguType().equals(Constants.NOISE_KEY)) {
|
||||
List<TensVo> list = tbWarnConfigService.queryTensVoByPage(tbWarnConfig);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return AjaxResult.success(list.get(0));
|
||||
}
|
||||
}
|
||||
if (tbWarnConfig.getConfiguType().equals(Constants.PARTICULATE_KEY)) {
|
||||
List<ExcavationVo> list = tbWarnConfigService.queryExcavationVoByPage(tbWarnConfig);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return AjaxResult.success(list.get(0));
|
||||
}
|
||||
|
||||
}
|
||||
return AjaxResult.success("暂无数据");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public class TbProDepart implements Serializable {
|
|||
/**
|
||||
* 项目部类型(字典表)
|
||||
*/
|
||||
@NotNull(message = "项目部类型不能为空")
|
||||
private Integer departType;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ public class TbWarnConfig implements Serializable {
|
|||
*/
|
||||
private Integer isAll;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
private Long devId;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -63,6 +63,36 @@ public class TbBdRecordServiceImpl implements TbBdRecordService {
|
|||
if (record == null || CollectionUtils.isEmpty(record.getRecordList())) {
|
||||
return AjaxResult.error(1112, "申请边带数量不能为空");
|
||||
}
|
||||
if (!PhoneUtil.isMobile(record.getRelPhone())) {
|
||||
return AjaxResult.error(ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getCode(), ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getMsg());
|
||||
}
|
||||
//对输入框进行特殊字符校验
|
||||
AjaxResult data = validateInput(record.getRelUser());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
for (TbBdDeviceRecord tbBdDeviceRecord : record.getRecordList()) {
|
||||
data = validateInput(tbBdDeviceRecord.getDevName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
data = validateInput(tbBdDeviceRecord.getDevCode());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
data = validateInput(tbBdDeviceRecord.getUnitName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
data = validateInput(tbBdDeviceRecord.getAreaName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
data = validateInput(tbBdDeviceRecord.getDevUser());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
int result = 0;
|
||||
//插入设备记录
|
||||
if (record.getRecordList() != null && record.getRecordList().size() > 0) {
|
||||
|
|
@ -108,6 +138,19 @@ public class TbBdRecordServiceImpl implements TbBdRecordService {
|
|||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证输入框是否包含特殊字符
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult validateInput(String input) {
|
||||
if (StringUtils.isNotBlank(input) && input.matches(Constants.DISALLOWED_REGEX)) {
|
||||
return AjaxResult.error(ExceptionEnum.DISALLOWED_CHARACTERS.getCode(), ExceptionEnum.DISALLOWED_CHARACTERS.getMsg());
|
||||
}
|
||||
// 如果输入合法,返回 null
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbBdRecord selectByPrimaryKey(Long id) {
|
||||
TbBdRecord tbBdRecord = tbBdRecordMapper.selectByPrimaryKey(id);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.bonus.base.basic.service.impl;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.base.basic.config.Constants;
|
||||
import com.bonus.base.basic.domain.TbDevice;
|
||||
import com.bonus.base.basic.mapper.TbDeviceMapper;
|
||||
import com.bonus.base.basic.service.TbDeviceService;
|
||||
import com.bonus.base.basic.config.ExceptionEnum;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -47,6 +49,15 @@ public class TbDeviceServiceImpl implements TbDeviceService {
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult insertSelective(TbDevice record) {
|
||||
//对设备名称和设备编码进行特殊字符校验
|
||||
AjaxResult data = validateInput(record.getDevName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
data = validateInput(record.getDevCode());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
//根据传入的名称和编码判重,确保唯一性,同类型下名称或编码均不得重复
|
||||
List<TbDevice> tbDevice = tbDeviceMapper.selectByDevCode(record);
|
||||
if (CollectionUtils.isNotEmpty(tbDevice)) {
|
||||
|
|
@ -59,6 +70,19 @@ public class TbDeviceServiceImpl implements TbDeviceService {
|
|||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证输入框是否包含特殊字符
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult validateInput(String input) {
|
||||
if (StringUtils.isNotBlank(input) && input.matches(Constants.DISALLOWED_REGEX)) {
|
||||
return AjaxResult.error(ExceptionEnum.DISALLOWED_CHARACTERS.getCode(), ExceptionEnum.DISALLOWED_CHARACTERS.getMsg());
|
||||
}
|
||||
// 如果输入合法,返回 null
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键查询数据
|
||||
* @param id
|
||||
|
|
@ -76,6 +100,15 @@ public class TbDeviceServiceImpl implements TbDeviceService {
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult updateByPrimaryKeySelective(TbDevice record) {
|
||||
//对设备名称和设备编码进行特殊字符校验
|
||||
AjaxResult data = validateInput(record.getDevName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
data = validateInput(record.getDevCode());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
//根据传入的名称和编码判重,确保唯一性,同类型下名称或编码均不得重复
|
||||
List<TbDevice> tbDevice = tbDeviceMapper.selectByDevCode(record);
|
||||
if (tbDevice != null) {
|
||||
|
|
|
|||
|
|
@ -101,6 +101,11 @@ public class TbPeopleServiceImpl implements TbPeopleService {
|
|||
if (tbPeople == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//对姓名进行特殊字符检验
|
||||
AjaxResult data = validateInput(tbPeople.getRelName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
//校验前端传的手机号
|
||||
if (getObjectResultBean(tbPeople)) {
|
||||
return AjaxResult.error(ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getCode(), ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getMsg());
|
||||
|
|
@ -125,6 +130,19 @@ public class TbPeopleServiceImpl implements TbPeopleService {
|
|||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证输入框是否包含特殊字符
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult validateInput(String input) {
|
||||
if (StringUtils.isNotBlank(input) && input.matches(Constants.DISALLOWED_REGEX)) {
|
||||
return AjaxResult.error(ExceptionEnum.DISALLOWED_CHARACTERS.getCode(), ExceptionEnum.DISALLOWED_CHARACTERS.getMsg());
|
||||
}
|
||||
// 如果输入合法,返回 null
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号校验方法抽取
|
||||
* @param tbPeople
|
||||
|
|
@ -149,6 +167,11 @@ public class TbPeopleServiceImpl implements TbPeopleService {
|
|||
if (tbPeople == null || tbPeople.getId() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//对姓名进行特殊字符检验
|
||||
AjaxResult data = validateInput(tbPeople.getRelName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
//校验前端传的手机号
|
||||
if (getObjectResultBean(tbPeople)) {
|
||||
return AjaxResult.error(ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getCode(), ExceptionEnum.INVALID_PHONE_NUMBER_FORMAT.getMsg());
|
||||
|
|
@ -406,6 +429,7 @@ public class TbPeopleServiceImpl implements TbPeopleService {
|
|||
switch (c) {
|
||||
case 0:
|
||||
checkBlank(cellValue, r, c);
|
||||
checkName(cellValue, r, c);
|
||||
break;
|
||||
case 1:
|
||||
checkBlank(cellValue, r, c);
|
||||
|
|
@ -431,6 +455,25 @@ public class TbPeopleServiceImpl implements TbPeopleService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对姓名进行特殊字符检验
|
||||
* @param cellValue
|
||||
* @param r
|
||||
* @param c
|
||||
*/
|
||||
private void checkName(String cellValue, int r, int c) {
|
||||
try {
|
||||
boolean b = cellValue.matches(Constants.DISALLOWED_REGEX);
|
||||
if (b) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列字段含有非法特殊字符,请检查后重新导入", r + 1, c + 1));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列字段含有非法特殊字符,请检查后重新导入", r + 1, c + 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取Excel表头模板方法抽取,检验岗位编码
|
||||
* @param cellValue
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.base.basic.service.impl;
|
|||
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.base.basic.config.Constants;
|
||||
import com.bonus.base.basic.domain.TbArea;
|
||||
import com.bonus.base.basic.domain.TbData;
|
||||
import com.bonus.base.basic.domain.TbProDepart;
|
||||
|
|
@ -83,6 +84,22 @@ public class TbProDepartServiceImpl implements TbProDepartService {
|
|||
if (tbProDepart == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//对输入框进行特殊字符检验
|
||||
// 检查 DepartName
|
||||
AjaxResult data = validateInput(tbProDepart.getDepartName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
// 检查 HeadUser
|
||||
data = validateInput(tbProDepart.getHeadUser());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
// 检查 Remarks
|
||||
data = validateInput(tbProDepart.getRemarks());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
//名称重复性校验
|
||||
TbProDepart depart = tbProDepartDao.selectByName(tbProDepart);
|
||||
if (depart != null) {
|
||||
|
|
@ -102,6 +119,19 @@ public class TbProDepartServiceImpl implements TbProDepartService {
|
|||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证输入框是否包含特殊字符
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult validateInput(String input) {
|
||||
if (StringUtils.isNotBlank(input) && input.matches(Constants.DISALLOWED_REGEX)) {
|
||||
return AjaxResult.error(ExceptionEnum.DISALLOWED_CHARACTERS.getCode(), ExceptionEnum.DISALLOWED_CHARACTERS.getMsg());
|
||||
}
|
||||
// 如果输入合法,返回 null
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号校验方法抽取
|
||||
* @param tbProDepart
|
||||
|
|
@ -127,6 +157,22 @@ public class TbProDepartServiceImpl implements TbProDepartService {
|
|||
if (tbProDepart == null || tbProDepart.getId() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//对输入框进行特殊字符检验
|
||||
// 检查 DepartName
|
||||
AjaxResult data = validateInput(tbProDepart.getDepartName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
// 检查 HeadUser
|
||||
data = validateInput(tbProDepart.getHeadUser());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
// 检查 Remarks
|
||||
data = validateInput(tbProDepart.getRemarks());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
//名称重复性校验,一个地区内不能重复
|
||||
TbProDepart depart = tbProDepartDao.selectByName(tbProDepart);
|
||||
if (depart != null) {
|
||||
|
|
|
|||
|
|
@ -80,6 +80,11 @@ public class TbProPowerServiceImpl implements TbProPowerService {
|
|||
if (tbProPower == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//对杆塔名称进行特殊字符校验
|
||||
AjaxResult data = validateInput(tbProPower.getGtName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
//根据名称判重
|
||||
TbProPower power = tbProPowerDao.selectByName(tbProPower);
|
||||
if (power != null) {
|
||||
|
|
@ -105,6 +110,19 @@ public class TbProPowerServiceImpl implements TbProPowerService {
|
|||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入校验
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult validateInput(String input) {
|
||||
if (StringUtils.isNotBlank(input) && input.matches(Constants.DISALLOWED_REGEX)) {
|
||||
return AjaxResult.error(ExceptionEnum.DISALLOWED_CHARACTERS.getCode(), ExceptionEnum.DISALLOWED_CHARACTERS.getMsg());
|
||||
}
|
||||
// 如果输入合法,返回 null
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
|
|
@ -116,6 +134,10 @@ public class TbProPowerServiceImpl implements TbProPowerService {
|
|||
if (tbProPower == null || tbProPower.getId() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
AjaxResult data = validateInput(tbProPower.getGtName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
//根据名称判重
|
||||
TbProPower power = tbProPowerDao.selectByName(tbProPower);
|
||||
if (power != null) {
|
||||
|
|
@ -235,6 +257,7 @@ public class TbProPowerServiceImpl implements TbProPowerService {
|
|||
switch (c) {
|
||||
case 0:
|
||||
checkCellNotEmpty(cellValue, r, c);
|
||||
checkName(cellValue, r, c);
|
||||
break;
|
||||
case 1:
|
||||
checkCellNotEmpty(cellValue, r, c);
|
||||
|
|
@ -242,7 +265,7 @@ public class TbProPowerServiceImpl implements TbProPowerService {
|
|||
break;
|
||||
case 2:
|
||||
checkCellNotEmpty(cellValue, r, c);
|
||||
checklAT(cellValue, r, c);
|
||||
checkLAT(cellValue, r, c);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
|
|
@ -275,13 +298,32 @@ public class TbProPowerServiceImpl implements TbProPowerService {
|
|||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查名称是否包含特殊字符
|
||||
* @param cellValue
|
||||
* @param r
|
||||
* @param c
|
||||
*/
|
||||
private void checkName(String cellValue, int r, int c) {
|
||||
try {
|
||||
boolean b = cellValue.matches(Constants.DISALLOWED_REGEX);
|
||||
if (b) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列字段含有非法特殊字符,请检查后重新导入", r + 1, c + 1));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列字段含有非法特殊字符,请检查后重新导入", r + 1, c + 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查纬度格式
|
||||
* @param cellValue
|
||||
* @param r
|
||||
* @param c
|
||||
*/
|
||||
private void checklAT(String cellValue, int r, int c) {
|
||||
private void checkLAT(String cellValue, int r, int c) {
|
||||
try {
|
||||
boolean b = cellValue.matches(Constants.LATITUDE_PATTERN);
|
||||
if (!b) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.bonus.base.basic.config.ExceptionEnum;
|
|||
import com.bonus.base.basic.service.TbProjectService;
|
||||
import com.bonus.base.basic.vo.TbProjectPowerVo;
|
||||
import com.bonus.base.basic.vo.TbProjectVo;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -71,6 +72,11 @@ public class TbProjectServiceImpl implements TbProjectService {
|
|||
if (tbProject == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//对工程名称进行特殊字符校验
|
||||
AjaxResult data = validateInput(tbProject.getProName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
//工程名称判重
|
||||
TbProjectVo project = tbProjectDao.selectByName(tbProject);
|
||||
if (project != null) {
|
||||
|
|
@ -97,6 +103,19 @@ public class TbProjectServiceImpl implements TbProjectService {
|
|||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入校验
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult validateInput(String input) {
|
||||
if (StringUtils.isNotBlank(input) && input.matches(Constants.DISALLOWED_REGEX)) {
|
||||
return AjaxResult.error(ExceptionEnum.DISALLOWED_CHARACTERS.getCode(), ExceptionEnum.DISALLOWED_CHARACTERS.getMsg());
|
||||
}
|
||||
// 如果输入合法,返回 null
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
|
|
@ -108,6 +127,11 @@ public class TbProjectServiceImpl implements TbProjectService {
|
|||
if (tbProject == null || tbProject.getId() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//对工程名称进行特殊字符校验
|
||||
AjaxResult data = validateInput(tbProject.getProName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
//工程名称判重
|
||||
TbProjectVo project = tbProjectDao.selectByName(tbProject);
|
||||
if (project != null) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.base.basic.service.impl;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.base.basic.config.Constants;
|
||||
import com.bonus.base.basic.domain.TbPeople;
|
||||
import com.bonus.base.basic.domain.TbTeam;
|
||||
import com.bonus.base.basic.mapper.TbPeopleMapper;
|
||||
|
|
@ -107,6 +108,11 @@ public class TbTeamServiceImpl implements TbTeamService {
|
|||
if (tbTeam == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//对班组名称进行特殊字符校验
|
||||
AjaxResult data = validateInput(tbTeam.getTeamName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
// 名称重复性校验
|
||||
TbTeam team = tbTeamDao.selectByName(tbTeam);
|
||||
if (team != null) {
|
||||
|
|
@ -139,6 +145,19 @@ public class TbTeamServiceImpl implements TbTeamService {
|
|||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证输入框是否包含特殊字符
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult validateInput(String input) {
|
||||
if (StringUtils.isNotBlank(input) && input.matches(Constants.DISALLOWED_REGEX)) {
|
||||
return AjaxResult.error(ExceptionEnum.DISALLOWED_CHARACTERS.getCode(), ExceptionEnum.DISALLOWED_CHARACTERS.getMsg());
|
||||
}
|
||||
// 如果输入合法,返回 null
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
|
|
@ -151,6 +170,11 @@ public class TbTeamServiceImpl implements TbTeamService {
|
|||
if (tbTeam == null || tbTeam.getId() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//对班组名称进行特殊字符校验
|
||||
AjaxResult data = validateInput(tbTeam.getTeamName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
// 名称重复性校验
|
||||
TbTeam team = tbTeamDao.selectByName(tbTeam);
|
||||
if (team != null) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.base.basic.service.impl;
|
||||
|
||||
import com.bonus.base.basic.config.Constants;
|
||||
import com.bonus.base.basic.domain.TbWarnConfig;
|
||||
import com.bonus.base.basic.mapper.TbWarnConfigMapper;
|
||||
import com.bonus.base.basic.service.TbWarnConfigService;
|
||||
|
|
@ -8,6 +9,7 @@ import com.bonus.base.basic.vo.ExcavationVo;
|
|||
import com.bonus.base.basic.vo.InclVo;
|
||||
import com.bonus.base.basic.vo.TempVo;
|
||||
import com.bonus.base.basic.vo.TensVo;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -58,6 +60,11 @@ public class TbWarnConfigServiceImpl implements TbWarnConfigService {
|
|||
if (record == null || record.getConfigName() == null || record.getConfiguType() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.TO_PARAM_NULL.getCode(), ExceptionEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//对配置名称进行特殊字符校验
|
||||
AjaxResult data = validateInput(record.getConfigName());
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
//根据同类型,同名称规则判重
|
||||
TbWarnConfig tbWarnConfig = tbWarnConfigMapper.selectByName(record);
|
||||
if (tbWarnConfig != null) {
|
||||
|
|
@ -71,6 +78,19 @@ public class TbWarnConfigServiceImpl implements TbWarnConfigService {
|
|||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证输入框是否包含特殊字符
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult validateInput(String input) {
|
||||
if (StringUtils.isNotBlank(input) && input.matches(Constants.DISALLOWED_REGEX)) {
|
||||
return AjaxResult.error(ExceptionEnum.DISALLOWED_CHARACTERS.getCode(), ExceptionEnum.DISALLOWED_CHARACTERS.getMsg());
|
||||
}
|
||||
// 如果输入合法,返回 null
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbWarnConfig selectByPrimaryKey(Long id) {
|
||||
return tbWarnConfigMapper.selectByPrimaryKey(id);
|
||||
|
|
@ -131,11 +151,13 @@ public class TbWarnConfigServiceImpl implements TbWarnConfigService {
|
|||
setConfigStr(tbWarnConfig);
|
||||
TempVo tempVo = new TempVo();
|
||||
tempVo.setConfigName(tbWarnConfig.getConfigName());
|
||||
tempVo.setDevId(tbWarnConfig.getDevId());
|
||||
tempVo.setTempThreshold(tbWarnConfig.getConfigVal1Str());
|
||||
tempVo.setHumThreshold(tbWarnConfig.getConfigVal2Str());
|
||||
tempVo.setNoise(tbWarnConfig.getConfigVal3Str());
|
||||
tempVo.setParticulate(tbWarnConfig.getConfigVal4Str());
|
||||
tempVo.setParticulateMatter(tbWarnConfig.getConfigVal5Str());
|
||||
tempVo.setWindSpeed(tbWarnConfig.getConfigVal6Str());
|
||||
tempVos.add(tempVo);
|
||||
}
|
||||
}
|
||||
|
|
@ -156,6 +178,7 @@ public class TbWarnConfigServiceImpl implements TbWarnConfigService {
|
|||
setConfigStr(tbWarnConfig);
|
||||
InclVo inclVo = new InclVo();
|
||||
inclVo.setConfigName(tbWarnConfig.getConfigName());
|
||||
inclVo.setDevId(tbWarnConfig.getDevId());
|
||||
inclVo.setInclThreshold(tbWarnConfig.getConfigVal1Str());
|
||||
inclVos.add(inclVo);
|
||||
}
|
||||
|
|
@ -177,7 +200,9 @@ public class TbWarnConfigServiceImpl implements TbWarnConfigService {
|
|||
setConfigStr(tbWarnConfig);
|
||||
TensVo tensVo = new TensVo();
|
||||
tensVo.setConfigName(tbWarnConfig.getConfigName());
|
||||
tensVo.setDevId(tbWarnConfig.getDevId());
|
||||
tensVo.setTensThreshold(tbWarnConfig.getConfigVal1Str());
|
||||
tensVos.add(tensVo);
|
||||
}
|
||||
}
|
||||
return tensVos;
|
||||
|
|
@ -197,10 +222,12 @@ public class TbWarnConfigServiceImpl implements TbWarnConfigService {
|
|||
setConfigStr(tbWarnConfig);
|
||||
ExcavationVo excavationVo = new ExcavationVo();
|
||||
excavationVo.setConfigName(tbWarnConfig.getConfigName());
|
||||
excavationVo.setDevId(tbWarnConfig.getDevId());
|
||||
excavationVo.setOxyThreshold(tbWarnConfig.getConfigVal1Str());
|
||||
excavationVo.setCOThreshold(tbWarnConfig.getConfigVal2Str());
|
||||
excavationVo.setFlamGasThreshold(tbWarnConfig.getConfigVal3Str());
|
||||
excavationVo.setH2SThreshold(tbWarnConfig.getConfigVal4Str());
|
||||
excavationVos.add(excavationVo);
|
||||
}
|
||||
}
|
||||
return excavationVos;
|
||||
|
|
|
|||
|
|
@ -32,4 +32,8 @@ public class TempVo extends TbWarnConfig {
|
|||
@ApiModelProperty(value="pm10")
|
||||
@Excel(name = "PM10")
|
||||
private String particulateMatter;
|
||||
|
||||
@ApiModelProperty(value="风速")
|
||||
@Excel(name = "风速")
|
||||
private String windSpeed;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -386,6 +386,7 @@
|
|||
<select id="getAll" resultType="com.bonus.base.basic.domain.TbWarnConfig">
|
||||
select
|
||||
twc.id as id,
|
||||
td.id as devId,
|
||||
twc.configu_type as configuType,
|
||||
sda.dict_label as typeName,
|
||||
twc.config_name as configName,
|
||||
|
|
@ -403,6 +404,7 @@
|
|||
twc.config_val6_min as configVal6Min
|
||||
from tb_warn_config twc
|
||||
left join sys_dict_data sda on twc.configu_type = sda.dict_code
|
||||
LEFT JOIN tb_device td on td.config_id = twc.id
|
||||
where twc.del_flag = 0
|
||||
<if test="configuType != null and configuType != ''">
|
||||
and twc.configu_type = #{configuType}
|
||||
|
|
@ -410,6 +412,9 @@
|
|||
<if test="configName != null and configName != ''">
|
||||
and twc.config_name like concat('%',#{configName},'%')
|
||||
</if>
|
||||
<if test="devId != null">
|
||||
and td.id = #{devId}
|
||||
</if>
|
||||
ORDER BY twc.create_time DESC
|
||||
</select>
|
||||
<select id="queryByDeviceId" resultType="java.lang.Integer">
|
||||
|
|
|
|||
Loading…
Reference in New Issue