提交 9a7816d1 编写于 作者: wenhao.qin's avatar wenhao.qin

fix --all(自测优化)

上级 149e149b
流水线 #43017 已取消 于阶段
...@@ -52,7 +52,7 @@ public class HospitalSaasUserController extends AccountBaseController { ...@@ -52,7 +52,7 @@ public class HospitalSaasUserController extends AccountBaseController {
return PicaResponse.toResponse(hospitalSaasUserService.listByPage(req)); return PicaResponse.toResponse(hospitalSaasUserService.listByPage(req));
} }
@ApiOperation("机构saas平台人员详情查询") @ApiOperation("机构saas平台人员详情更改查询")
@GetMapping(value = "/hospital/edit/{id}") @GetMapping(value = "/hospital/edit/{id}")
@EnabledLoginValidate @EnabledLoginValidate
public PicaResponse<HospitalSaasUserEditResp> edit(@PathVariable("id") Long id) { public PicaResponse<HospitalSaasUserEditResp> edit(@PathVariable("id") Long id) {
...@@ -66,17 +66,17 @@ public class HospitalSaasUserController extends AccountBaseController { ...@@ -66,17 +66,17 @@ public class HospitalSaasUserController extends AccountBaseController {
return PicaResponse.toResponse(hospitalSaasUserService.delete(id)); return PicaResponse.toResponse(hospitalSaasUserService.delete(id));
} }
@ApiOperation("机构saas平台人员详情") @ApiOperation("机构saas人员详情")
@GetMapping(value = "/hospital/userDetail") @GetMapping(value = "/hospital/userDetail")
@EnabledLoginValidate @EnabledLoginValidate
public PicaResponse<HospitalSaasUserDetailResp> userDetail(@RequestHeader("token") String token) { public PicaResponse<HospitalSaasUserDetailResp> userDetail(@RequestHeader("token") String token) {
return PicaResponse.toResponse(hospitalSaasUserService.userDetail(fetchPicaUser())); return PicaResponse.toResponse(hospitalSaasUserService.userDetail(fetchPicaUser()));
} }
@ApiOperation("机构saas平台人员-角色列表") @ApiOperation("机构saas人员-角色列表")
@GetMapping(value = "/hospital/listByPage") @GetMapping(value = "/hospital/listByPage")
@EnabledLoginValidate @EnabledLoginValidate
public PicaResponse<HospitalRoleResp> listByPage() { public PicaResponse<HospitalRoleResp> roleList() {
return PicaResponse.toResponse(hospitalSaasRoleService.querySaasRoles()); return PicaResponse.toResponse(hospitalSaasRoleService.querySaasRoles());
} }
......
...@@ -17,9 +17,9 @@ public class HospitalRoleListReq { ...@@ -17,9 +17,9 @@ public class HospitalRoleListReq {
private String name; private String name;
@ApiModelProperty("每页显示记录数") @ApiModelProperty("每页显示记录数")
private Integer pageSize; private Integer pageSize = 10;
@ApiModelProperty("页码") @ApiModelProperty("页码")
private Integer pageNo; private Integer pageNo = 1;
} }
...@@ -52,6 +52,9 @@ public class HospitalSaasUserReq { ...@@ -52,6 +52,9 @@ public class HospitalSaasUserReq {
if (StringUtils.isBlank(this.mobile)) { if (StringUtils.isBlank(this.mobile)) {
throw new PicaWarnException(AccountExceptionEnum.PICA_NOT_EMPTY.getCode(), "手机号不能为空"); throw new PicaWarnException(AccountExceptionEnum.PICA_NOT_EMPTY.getCode(), "手机号不能为空");
} }
if (Objects.isNull(this.hospitalId)) {
throw new PicaWarnException(AccountExceptionEnum.PICA_NOT_EMPTY.getCode(), "机构id不能为空");
}
if (StringUtils.isBlank(this.name)) { if (StringUtils.isBlank(this.name)) {
throw new PicaWarnException(AccountExceptionEnum.PICA_NOT_EMPTY.getCode(), "姓名不能为空"); throw new PicaWarnException(AccountExceptionEnum.PICA_NOT_EMPTY.getCode(), "姓名不能为空");
} }
......
...@@ -86,27 +86,20 @@ public class HospitalSaasRoleServiceImpl implements HospitalSaasRoleService { ...@@ -86,27 +86,20 @@ public class HospitalSaasRoleServiceImpl implements HospitalSaasRoleService {
map.put("pageNo", (req.getPageNo() - 1) * req.getPageSize()); map.put("pageNo", (req.getPageNo() - 1) * req.getPageSize());
map.put("pageSize", req.getPageSize()); map.put("pageSize", req.getPageSize());
List<HospitalRoleDto> roleDtos = permissionRoleMapper.listByPage(map); List<HospitalRoleDto> roleDtos = permissionRoleMapper.listByPage(map);
for (HospitalRoleDto roleDto : roleDtos) { for (HospitalRoleDto roleDto : roleDtos) {
if (Objects.equals(roleDto.getRoleId(), SaasRoleEnum.SAAS_MAIN_ADMIN.getCode())) { if (Objects.equals(roleDto.getRoleId(), SaasRoleEnum.SAAS_MAIN_ADMIN.getCode())) {
roleDto.setAdminSaasFlag(1); roleDto.setAdminSaasFlag(1);
} }
} }
return new HospitalRoleResp(roleDtos, count); return new HospitalRoleResp(roleDtos, count);
} }
@Override @Override
@Transactional @Transactional
public int delete(Long id, PicaUser user) { public int delete(Long id, PicaUser user) {
if (id == null || id == 0L) {
throw new PicaWarnException(AccountExceptionEnum.PAT_ACCT_HAS_EXIST.getCode(), "请输入角色id");
}
if (id <= SaasRoleEnum.SAAS_DOCTOR.getCode()) { if (id <= SaasRoleEnum.SAAS_DOCTOR.getCode()) {
throw new PicaWarnException(AccountExceptionEnum.PAT_ACCT_HAS_EXIST.getCode(), "该角色无法删除"); throw new PicaWarnException(AccountExceptionEnum.PAT_ACCT_HAS_EXIST.getCode(), "该角色无法删除");
} }
Map<String, Object> map = new HashMap<>(3); Map<String, Object> map = new HashMap<>(3);
map.put("id", id); map.put("id", id);
map.put("modifiedId", user.getId()); map.put("modifiedId", user.getId());
......
...@@ -72,10 +72,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -72,10 +72,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
@Transactional @Transactional
public int register(HospitalSaasUserReq req, Long doctorId) { public int register(HospitalSaasUserReq req, Long doctorId) {
req.checkInsertParams(); req.checkInsertParams();
int count = accountMapper.adminRoleCountByhospitalId(req.getHospitalId().longValue()); validatorAdminRole(req.getRoleId(), req.getHospitalId().longValue());
if (count >= 1 && null != req.getRoleId() && 3 == req.getRoleId()) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "当前已存在系统管理员,请勿重复设置");
}
//得到手机号 //得到手机号
String mobile = req.getMobile(); String mobile = req.getMobile();
//幂等校验 //幂等校验
...@@ -156,7 +153,6 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -156,7 +153,6 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
@Override @Override
public HospitalSaasUserResp listByPage(HospitalSaasUserListReq req) { public HospitalSaasUserResp listByPage(HospitalSaasUserListReq req) {
String mobileEncrypt = AESUtil.encryptV0(req.getMobile()); String mobileEncrypt = AESUtil.encryptV0(req.getMobile());
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("hospitalId", req.getHospitalId()); map.put("hospitalId", req.getHospitalId());
map.put("name", req.getName()); map.put("name", req.getName());
...@@ -165,9 +161,9 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -165,9 +161,9 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
if (count < 1) { if (count < 1) {
return new HospitalSaasUserResp(Collections.emptyList(), 0); return new HospitalSaasUserResp(Collections.emptyList(), 0);
} }
map.put("pageNo", (req.getPageNo() - 1) * req.getPageSize()); map.put("pageNo", (req.getPageNo() - 1) * req.getPageSize());
map.put("pageSize", req.getPageSize()); map.put("pageSize", req.getPageSize());
List<HospitalSaasUserDto> lists = accountMapper.listByPage(map); List<HospitalSaasUserDto> lists = accountMapper.listByPage(map);
//手机号 解密脱敏 //手机号 解密脱敏
lists.stream().forEach(t -> { lists.stream().forEach(t -> {
...@@ -179,22 +175,24 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -179,22 +175,24 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
} }
}); });
return new HospitalSaasUserResp(lists, count); return new HospitalSaasUserResp(lists, count);
}
private void validatorAdminRole(Long roleId, Long hospitalId) {
int count = accountMapper.adminRoleCountByhospitalId(hospitalId);
if (count >= 1 && null != roleId && Objects.equals(roleId, SaasRoleEnum.SAAS_MAIN_ADMIN.getCode())) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "当前已存在系统管理员,请勿重复设置");
}
} }
@Override @Override
public int upsert(HospitalSaasUserReq req, Long doctorId) { public int upsert(HospitalSaasUserReq req, Long doctorId) {
//走更新的逻辑,只可以更新角色和备注 if (Objects.isNull(req) || Objects.isNull(req.getHospitalId())) {
String mobileEncrypt = AESUtil.encryptV0(req.getMobile());
Account accountExist = accountMapper.getByMobilePhone(mobileEncrypt);
if (Objects.isNull(req) || null == req.getHospitalId()) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "参数错误"); throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "参数错误");
} }
int count = accountMapper.adminRoleCountByhospitalId(req.getHospitalId().longValue()); validatorAdminRole(req.getRoleId(), req.getHospitalId().longValue());
if (count >= 1 && null != req.getRoleId() && Objects.equals(req.getRoleId(),SaasRoleEnum.SAAS_MAIN_ADMIN.getCode())) { String mobileEncrypt = AESUtil.encryptV0(req.getMobile());
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "当前已存在系统管理员,请勿重复设置"); Account accountExist = accountMapper.getByMobilePhone(mobileEncrypt);
}
if (accountExist == null) { if (accountExist == null) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "当前用户不存在"); throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "当前用户不存在");
} }
...@@ -212,7 +210,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -212,7 +210,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
passwordService.modifyPassword(mobileEncrypt, accountExist.getPassword(), StringUtils.upperCase(MD5Util.MD5(req.getPassword())), true); passwordService.modifyPassword(mobileEncrypt, accountExist.getPassword(), StringUtils.upperCase(MD5Util.MD5(req.getPassword())), true);
} }
Map map = new HashMap(3); Map<String, Object> map = new HashMap(3);
map.put("id", req.getId()); map.put("id", req.getId());
map.put("modifiedId", doctorId); map.put("modifiedId", doctorId);
map.put("modifiedTime", new Date()); map.put("modifiedTime", new Date());
...@@ -222,6 +220,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -222,6 +220,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
} }
@Override @Override
@Deprecated
public int delete(Long id) { public int delete(Long id) {
//删除本身信息,删除人员的权限关联信息,删除人员的协议信息 //删除本身信息,删除人员的权限关联信息,删除人员的协议信息
// todo // todo
...@@ -254,16 +253,14 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -254,16 +253,14 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
return resp; return resp;
} }
resp.setName(pDoctor.getName()); resp.setName(pDoctor.getName());
resp.setMobile(EncryptUtils.decryptContent(pDoctor.getMobilePhone() resp.setMobile(EncryptUtils.decryptContent(pDoctor.getMobilePhone(), EncryptConstants.ENCRYPT_TYPE_MOBILE, EncryptConstants.ENCRYPT_DECRYPT_KEY));
, EncryptConstants.ENCRYPT_TYPE_MOBILE, EncryptConstants.ENCRYPT_DECRYPT_KEY));
// saas角色获取 // saas角色获取
Map<String, Long> map = new HashMap<>(); Map<String, Long> map = new HashMap<>();
map.put("doctorId", pDoctor.getId()); map.put("doctorId", pDoctor.getId());
map.put("hospitalId", pDoctor.getHospitalId().longValue()); map.put("hospitalId", pDoctor.getHospitalId().longValue());
List<PermissionRole> roles = permissionRoleMapper.selectByDoctorId(map); List<PermissionRole> roles = permissionRoleMapper.selectByDoctorId(map);
String join = roles.stream().map(t -> t.getRoleName()).collect(Collectors.joining()); String roleName = roles.stream().map(t -> t.getRoleName()).distinct().collect(Collectors.joining());
resp.setRoleName(join); resp.setRoleName(roleName);
// 获取批发资质 // 获取批发资质
StoreCertifyStatus storeCertifyStatus = null; StoreCertifyStatus storeCertifyStatus = null;
try { try {
...@@ -271,9 +268,8 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -271,9 +268,8 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
resp.setStatusStr(storeCertifyStatus.getCertifyStatusStr()); resp.setStatusStr(storeCertifyStatus.getCertifyStatusStr());
resp.setStatus(storeCertifyStatus.getCertifyStatus()); resp.setStatus(storeCertifyStatus.getCertifyStatus());
} catch (Exception e) { } catch (Exception e) {
logger.error("userDetail storeCertifyServiceClient.statusByDoctorId error {}", e); logger.error("userDetail storeCertifyServiceClient.statusByDoctorId error: {}==doctorId: {}", e, pDoctor.getId());
} }
return resp; return resp;
} }
...@@ -283,7 +279,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService { ...@@ -283,7 +279,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
if (null == resp) { if (null == resp) {
return new HospitalSaasUserEditResp(); return new HospitalSaasUserEditResp();
} }
//手机号 解密脱敏 //手机号 不为空 解密脱敏
if (StringUtils.isNotBlank(resp.getMobile())) { if (StringUtils.isNotBlank(resp.getMobile())) {
String phone = EncryptUtils.decryptContent(resp.getMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE, EncryptConstants.ENCRYPT_DECRYPT_KEY); String phone = EncryptUtils.decryptContent(resp.getMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE, EncryptConstants.ENCRYPT_DECRYPT_KEY);
resp.setMobile(phone); resp.setMobile(phone);
......
...@@ -407,8 +407,10 @@ ...@@ -407,8 +407,10 @@
</select> </select>
<select id="adminRoleCountByhospitalId" resultType="java.lang.Integer"> <select id="adminRoleCountByhospitalId" resultType="java.lang.Integer">
select count(*) select count(*)
from p_doctor as pd join p_user_role_mapping as purm on pd.id = purm.user_id and purm.user_role_id = 3 from p_doctor as pd
join p_user_role_mapping as purm on pd.id = purm.user_id and purm.user_role_id = 3
where pd.hospital_id = #{hospitalId} where pd.hospital_id = #{hospitalId}
limit 1
</select> </select>
</mapper> </mapper>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from permission_role from permission_role
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT} and delete_flag = 1
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册