文件导入正则表达式检验
This commit is contained in:
parent
77e7c3b414
commit
ba6c9da52b
|
|
@ -4,6 +4,10 @@ import com.bonus.common.core.annotation.Excel;
|
|||
import com.bonus.common.core.annotation.Excel.ColumnType;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* 工程杆塔表 tb_project_power
|
||||
|
|
@ -30,14 +34,20 @@ public class GtVo
|
|||
|
||||
/** 杆塔编号 */
|
||||
@Excel(name = "杆塔编号")
|
||||
@NotBlank(message = "杆塔编号不能为空", groups = {GtVo.Query.class})
|
||||
@Length(max = 20, message = "杆塔编号长度不能超过20", groups = {GtVo.Query.class})
|
||||
private String gtCode;
|
||||
|
||||
/** 经度 */
|
||||
@Excel(name = "经度")
|
||||
@NotBlank(message = "经度不能为空", groups = {GtVo.Query.class})
|
||||
@Length(max = 32, message = "经度长度不能超过32", groups = {GtVo.Query.class})
|
||||
@Pattern(regexp = "^-?((\\d{1,2}|1[0-7]\\d|180)(\\.\\d{1,6})?)$", message = "经度格式不正确", groups = {GtVo.Query.class})
|
||||
private String lon;
|
||||
|
||||
/** 纬度 */
|
||||
@Excel(name = "纬度")
|
||||
@NotBlank(message = "纬度不能为空", groups = {GtVo.Query.class})
|
||||
@Length(max = 32, message = "纬度长度不能超过32", groups = {GtVo.Query.class})
|
||||
@Pattern(regexp = "^-?([0-8]?\\d(\\.\\d{1,6})?|90(\\.0{1,6})?)$", message = "纬度格式不正确", groups = {GtVo.Query.class})
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ public class EngineeringServiceImpl implements IEngineeringService {
|
|||
BeanUtils.copyProperties(vo, gtVo);
|
||||
String validResult = validatorsUtils.valid(gtVo, GtVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
return AjaxResult.error("第"+ obj.getString("rowNo") +"行" + validResult);
|
||||
}
|
||||
gtVo.setProId(proId);
|
||||
list.add(gtVo);
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<where>
|
||||
a.del_flag = 0
|
||||
<if test="projectDepartName != null and projectDepartName != ''">
|
||||
and depart_name = #{projectDepartName}
|
||||
and INSTR(depart_name,#{projectDepartName}) > 0
|
||||
</if>
|
||||
<if test="projectHeadName != null and projectHeadName != ''">
|
||||
and head_name = #{projectHeadName}
|
||||
and INSTR(head_name,#{projectHeadName}) > 0
|
||||
</if>
|
||||
</where>
|
||||
group by a.id
|
||||
|
|
|
|||
Loading…
Reference in New Issue