Commit 4b6640df authored by caotao's avatar caotao

1.新增场站导入时手机号、邮箱格式校验。

parent a2235aa8
...@@ -58,8 +58,12 @@ public class ExcelServiceImpl { ...@@ -58,8 +58,12 @@ public class ExcelServiceImpl {
PersonSkillEducationServiceImpl personSkillEducationService; PersonSkillEducationServiceImpl personSkillEducationService;
@Autowired @Autowired
PersonAccountServiceImpl personAccountServiceImpl; PersonAccountServiceImpl personAccountServiceImpl;
// 邮箱校验正则
static final String EMAIL = "^([a-zA-Z\\d][\\w-]{2,})@(\\w{2,})\\.([a-z]{2,})(\\.[a-z]{2,})?$";
/**
* 电话校验正则
*/
static final String PHONE = "^1((3|4|5|6|7|8|9){1}\\d{1}|70)\\d{8}$";
public void templateExport(HttpServletResponse response, ExcelDto excelDto, Map par) throws ClassNotFoundException { public void templateExport(HttpServletResponse response, ExcelDto excelDto, Map par) throws ClassNotFoundException {
String url = excelDto.getClassUrl(); String url = excelDto.getClassUrl();
...@@ -149,6 +153,7 @@ public class ExcelServiceImpl { ...@@ -149,6 +153,7 @@ public class ExcelServiceImpl {
this.yanzheng(exStationBasicDto.getStationType(),"场站类型", i); this.yanzheng(exStationBasicDto.getStationType(),"场站类型", i);
this.yanzheng(exStationBasicDto.getStationMasterName(),"站长", i); this.yanzheng(exStationBasicDto.getStationMasterName(),"站长", i);
this.yanzheng(exStationBasicDto.getMobilePhone(),"手机号码", i); this.yanzheng(exStationBasicDto.getMobilePhone(),"手机号码", i);
this.yanzheng(exStationBasicDto.getEmail(),"邮箱", i);
this.yanzheng(exStationBasicDto.getDevopsTime(),"运维时间", i); this.yanzheng(exStationBasicDto.getDevopsTime(),"运维时间", i);
this.yanzheng(exStationBasicDto.getOwnerUnit(),"运维单位", i); this.yanzheng(exStationBasicDto.getOwnerUnit(),"运维单位", i);
this.yanzheng(exStationBasicDto.getAddress(),"场站地址", i); this.yanzheng(exStationBasicDto.getAddress(),"场站地址", i);
...@@ -207,7 +212,12 @@ public class ExcelServiceImpl { ...@@ -207,7 +212,12 @@ public class ExcelServiceImpl {
if(obj==null){ if(obj==null){
throw new InnerInvokException("第" + (i + 2) + "行,"+name+"数据不能空", "403", "第" + (i + 2) + "行,"+name+"数据不能空", 403); throw new InnerInvokException("第" + (i + 2) + "行,"+name+"数据不能空", "403", "第" + (i + 2) + "行,"+name+"数据不能空", 403);
} }
if(obj!=null && name.equals("手机号码")&&String.valueOf(obj).matches(PHONE)) {
throw new InnerInvokException("第" + (i + 2) + "行," + name + "手机号码填写错误", "403", "第" + (i + 2) + "行," + name + "手机号码填写错误", 403);
}
if(obj!=null && name.equals("邮箱")&&String.valueOf(obj).matches(EMAIL)) {
throw new InnerInvokException("第" + (i + 2) + "行," + name + "邮箱填写错误", "403", "第" + (i + 2) + "行," + name + "邮箱填写错误", 403);
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment