Commit c2a78484 by 李小惠

修改应用模块bug

parent c1549f9e
...@@ -40,6 +40,7 @@ public class UpdatePolicemanReq extends BaseRequest { ...@@ -40,6 +40,7 @@ public class UpdatePolicemanReq extends BaseRequest {
/** /**
* 用户名 * 用户名
*/ */
@NotBlank(message = "用户名不能为空",groups = {add.class,edit.class})
private String account; private String account;
private String password; private String password;
...@@ -66,6 +67,7 @@ public class UpdatePolicemanReq extends BaseRequest { ...@@ -66,6 +67,7 @@ public class UpdatePolicemanReq extends BaseRequest {
/** /**
* 0警员,1辅警 * 0警员,1辅警
*/ */
@NotBlank(message = "警员类型不能为空",groups = {add.class,edit.class})
private Integer identity; private Integer identity;
/** /**
...@@ -75,10 +77,6 @@ public class UpdatePolicemanReq extends BaseRequest { ...@@ -75,10 +77,6 @@ public class UpdatePolicemanReq extends BaseRequest {
//当前登录人的id //当前登录人的id
private Long createUser; private Long createUser;
// /**
// * 人脸照片list
// */
// private List<String> faceInfoList;
/** /**
* 指纹照片list * 指纹照片list
*/ */
......
...@@ -12,7 +12,8 @@ public enum PublicExceptionEnum implements IExceptionEnum { ...@@ -12,7 +12,8 @@ public enum PublicExceptionEnum implements IExceptionEnum {
//设备编号重复 //设备编号重复
APP_CODE_IS_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE,"应用代码已存在"), APP_CODE_IS_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE,"应用代码已存在"),
APP_NAME_IS_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE,"应用名称已存在") APP_NAME_IS_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE,"应用名称已存在"),
APP_IS_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE,"应用不存在,请检查应用id是否存在"),
; ;
/** /**
......
...@@ -53,8 +53,12 @@ public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Appli ...@@ -53,8 +53,12 @@ public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Appli
public String AddOrUpdateCfg(ApplicationReq req) { public String AddOrUpdateCfg(ApplicationReq req) {
Application application = new Application(); Application application = new Application();
BeanPlusUtil.copyProperties(req,application); BeanPlusUtil.copyProperties(req,application);
List<Application> list = list(new LambdaQueryWrapper<Application>() List<Application> list = list(new LambdaQueryWrapper<Application>()
.eq(Application::getAppCode, req.getAppCode()).or().eq(Application::getName,req.getName())); .eq(Application::getAppCode, req.getAppCode()).or().eq(Application::getName,req.getName()));
//判断id是否传递,如果传递则默认他是修改,根据数据库对比id,判断是否id传递错误;如果不传递默认新增
if (req.getId()==null || req.getId().trim().isEmpty()){
//判断应用代码和应用名称是否重复,如果重复直接抛出异常 //判断应用代码和应用名称是否重复,如果重复直接抛出异常
if (CollectionUtil.isNotEmpty(list)){ if (CollectionUtil.isNotEmpty(list)){
for (Application app:list) { for (Application app:list) {
...@@ -66,15 +70,20 @@ public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Appli ...@@ -66,15 +70,20 @@ public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Appli
} }
} }
} }
//判断id是否传递,如果传递则默认他是修改,根据数据库对比id,判断是否id传递错误;如果不传递默认新增
if (req.getId()==null || req.getId().trim().isEmpty()){
application.setCreateTime(DateTimeUtil.getCurrentDateTime()); application.setCreateTime(DateTimeUtil.getCurrentDateTime());
save(application); save(application);
return application.getId(); return application.getId();
}else { }else {
Application app = getById(req);
if (ObjectUtil.isNull(app)){ for (Application app:list) {
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR); if (!req.getId().equals(app.getId())){
if (app.getName().equals(req.getName())){
throw new ServiceException(PublicExceptionEnum.APP_NAME_IS_EXIST);
}
if (app.getAppCode().equals(req.getAppCode())){
throw new ServiceException(PublicExceptionEnum.APP_CODE_IS_EXIST);
}
}
} }
application.setUpdateTime(DateTimeUtil.getCurrentDateTime()); application.setUpdateTime(DateTimeUtil.getCurrentDateTime());
updateById(application); updateById(application);
......
...@@ -194,6 +194,8 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -194,6 +194,8 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
policeman.setPassword(sysUser.getPassword()); policeman.setPassword(sysUser.getPassword());
policeman.setState(1); policeman.setState(1);
policeman.setUserId(sysUser.getUserId()); policeman.setUserId(sysUser.getUserId());
//如果有照片,将警员照片直接复制一下以防万一
policeman.setPhoto(req.getFaceInfo());
policeman.setCreateTime(DateTimeUtil.getCurrentDateTime()); policeman.setCreateTime(DateTimeUtil.getCurrentDateTime());
policeman.setUpdateTime(DateTimeUtil.getCurrentDateTime()); policeman.setUpdateTime(DateTimeUtil.getCurrentDateTime());
save(policeman); save(policeman);
...@@ -524,6 +526,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -524,6 +526,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS); throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS);
} }
} }
one.setPhoto(req.getFaceInfo());
one.setUpdateTime(DateTimeUtil.getCurrentDateTime()); one.setUpdateTime(DateTimeUtil.getCurrentDateTime());
//修改角色 //修改角色
if (req.getRolesList().size()>0){ if (req.getRolesList().size()>0){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论