|
@@ -76,7 +76,7 @@ public class PoliceServiceImpl extends BaseService implements PoliceService {
|
|
if (!CollectionUtils.isEmpty(collect)) {
|
|
if (!CollectionUtils.isEmpty(collect)) {
|
|
Account account = collect.get(p.getId() + "");
|
|
Account account = collect.get(p.getId() + "");
|
|
if (ObjectUtil.isNotEmpty(account)) {
|
|
if (ObjectUtil.isNotEmpty(account)) {
|
|
- q.setCreateTime(account.getCreateTime()).setAddress(account.getAddress()).setPhone(account.getPhone()).setUserName(account.getUserName());
|
|
|
|
|
|
+ q.setCreateTime(account.getCreateTime()).setAccount(account.getAccount()).setAddress(account.getAddress()).setPhone(account.getPhone()).setUserName(account.getUserName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}));
|
|
}));
|
|
@@ -121,7 +121,7 @@ public class PoliceServiceImpl extends BaseService implements PoliceService {
|
|
Company selectOne = companysMapper.selectOne(new LambdaQueryWrapper<Company>().eq(Company::getId, req.getId()));
|
|
Company selectOne = companysMapper.selectOne(new LambdaQueryWrapper<Company>().eq(Company::getId, req.getId()));
|
|
if (ObjectUtils.isEmpty(selectOne)) throw new BusinessException("未获取到派出所信息");
|
|
if (ObjectUtils.isEmpty(selectOne)) throw new BusinessException("未获取到派出所信息");
|
|
Police police = mapper.selectList(new LambdaQueryWrapper<Police>().eq(Police::getCompanyId, selectOne.getId()).eq(Police::getIsDelete, UserConstant.NOT_DELETE)).stream().findFirst().orElse(null);
|
|
Police police = mapper.selectList(new LambdaQueryWrapper<Police>().eq(Police::getCompanyId, selectOne.getId()).eq(Police::getIsDelete, UserConstant.NOT_DELETE)).stream().findFirst().orElse(null);
|
|
- return MapperManager.mapper(police, DetailPoliceResp.class, p -> p.setBranchName(ObjectUtil.isEmpty(selectOne.getBranchName()) ? null : selectOne.getBranchName()));
|
|
|
|
|
|
+ return MapperManager.mapper(police, DetailPoliceResp.class, p -> p.setId(selectOne.getId()).setBranchName(ObjectUtil.isEmpty(selectOne.getBranchName()) ? null : selectOne.getBranchName()));
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -132,12 +132,15 @@ public class PoliceServiceImpl extends BaseService implements PoliceService {
|
|
public UpdatePoliceResp update(UpdatePoliceReq req) {
|
|
public UpdatePoliceResp update(UpdatePoliceReq req) {
|
|
if (getAccountInfo().getType() != 2) throw new BusinessException("非分局管理员不能修改!");
|
|
if (getAccountInfo().getType() != 2) throw new BusinessException("非分局管理员不能修改!");
|
|
Police account = mapper.selectOne(new LambdaQueryWrapper<Police>().eq(Police::getAccount, req.getAccount()).eq(Police::getIsDelete, UserConstant.NOT_DELETE));
|
|
Police account = mapper.selectOne(new LambdaQueryWrapper<Police>().eq(Police::getAccount, req.getAccount()).eq(Police::getIsDelete, UserConstant.NOT_DELETE));
|
|
- if (ObjectUtil.isEmpty(account)) throw new BusinessException(account.getAccount() + "不存在!不能修改");
|
|
|
|
|
|
+ if (ObjectUtil.isEmpty(account)) throw new BusinessException(req.getAccount() + "已经停用或者不存在!不能修改");
|
|
int insert = mapper.update(MapperManager.mapper(req, Police.class, p -> p.setPassword(MD5UtilNew.string2MD5(req.getPassword())).setUpdateTime(LocalDateTime.now())), new LambdaQueryWrapper<Police>().eq(Police::getAccount, account.getAccount())
|
|
int insert = mapper.update(MapperManager.mapper(req, Police.class, p -> p.setPassword(MD5UtilNew.string2MD5(req.getPassword())).setUpdateTime(LocalDateTime.now())), new LambdaQueryWrapper<Police>().eq(Police::getAccount, account.getAccount())
|
|
.eq(Police::getIsDelete, UserConstant.NOT_DELETE));
|
|
.eq(Police::getIsDelete, UserConstant.NOT_DELETE));
|
|
if (insert == BigDecimal.ZERO.intValue()) throw new BusinessException("修改派出所管理员账号异常!");
|
|
if (insert == BigDecimal.ZERO.intValue()) throw new BusinessException("修改派出所管理员账号异常!");
|
|
- Company selectOne = companysMapper.selectOne(new LambdaQueryWrapper<Company>().eq(Company::getId, req.getId()).ne(Company::getBranchName, req.getBranchName()));
|
|
|
|
- if (ObjectUtils.isEmpty(selectOne)) throw new BusinessException("派出所已经存在,请重新填写派所名");
|
|
|
|
|
|
+ Company selectOne = companysMapper.selectOne(new LambdaQueryWrapper<Company>().eq(Company::getId, req.getId()));
|
|
|
|
+ if (ObjectUtils.isEmpty(selectOne)) throw new BusinessException("没有该派出所");
|
|
|
|
+ List<Company> companies = companysMapper.selectList(new LambdaQueryWrapper<Company>().eq(Company::getCompanyId, selectOne.getCompanyId()));
|
|
|
|
+ long count = companies.stream().filter(p -> !p.getBranchName().equals(selectOne.getBranchName())).filter(p -> p.getBranchName().equals(req.getBranchName())).count();
|
|
|
|
+ if(count != BigDecimal.ZERO.longValue()) throw new BusinessException("派出所名称已经存在!请更改");
|
|
int insert1 = companysMapper.updateById(new Company().setBranchName(req.getBranchName()).setId(req.getId()));
|
|
int insert1 = companysMapper.updateById(new Company().setBranchName(req.getBranchName()).setId(req.getId()));
|
|
if (insert1 == BigDecimal.ZERO.intValue()) throw new BusinessException("修改派出所失败!");
|
|
if (insert1 == BigDecimal.ZERO.intValue()) throw new BusinessException("修改派出所失败!");
|
|
return new UpdatePoliceResp().setCount(insert + insert1);
|
|
return new UpdatePoliceResp().setCount(insert + insert1);
|