测试问题项修改

This commit is contained in:
csyue 2024-05-30 13:57:07 +08:00
parent 66fc5505eb
commit f1584484ee
3 changed files with 26 additions and 21 deletions

View File

@ -226,7 +226,7 @@ public class BackApplyServiceImpl implements BackApplyService {
Long companyId = null; Long companyId = null;
try { try {
roles = SecurityUtils.getLoginUser().getRoles(); roles = SecurityUtils.getLoginUser().getRoles();
userid = SecurityUtils.getLoginUser().getUserid(); userid = SecurityUtils.getLoginUser().getSysUser().getUserId();
companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId(); companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
} catch (NullPointerException e) { } catch (NullPointerException e) {
e.printStackTrace(); e.printStackTrace();
@ -249,10 +249,8 @@ public class BackApplyServiceImpl implements BackApplyService {
return AjaxResult.error("审核失败"); return AjaxResult.error("审核失败");
} }
} }
if ((roles != null && roles.contains("jjfgs")) || (companyId != null && companyId.equals(101L))) { if (companyId != null && companyId.equals(101L)) {
if (companyId != null) { bean.setCompanyId(companyId.toString());
bean.setCompanyId(companyId.toString());
}
if (userid != null) { if (userid != null) {
bean.setCreateBy(userid.toString()); bean.setCreateBy(userid.toString());
} }
@ -262,10 +260,8 @@ public class BackApplyServiceImpl implements BackApplyService {
return AjaxResult.error("审核失败"); return AjaxResult.error("审核失败");
} }
} }
if ((roles != null && roles.contains("tsfgs")) || (companyId != null && companyId.equals(102L))) { if (companyId != null && companyId.equals(102L)) {
if (companyId != null) { bean.setCompanyId(companyId.toString());
bean.setCompanyId(companyId.toString());
}
if (userid != null) { if (userid != null) {
bean.setCreateBy(userid.toString()); bean.setCreateBy(userid.toString());
} }
@ -320,7 +316,7 @@ public class BackApplyServiceImpl implements BackApplyService {
for (int i = 0; i < ids.length; i++) { for (int i = 0; i < ids.length; i++) {
String id = ids[i]; String id = ids[i];
bean.setId(Long.valueOf(id)); bean.setId(Long.valueOf(id));
if (userId == 1) { if (roles.contains("admin")) {
bean.setCreateBy(userId.toString()); bean.setCreateBy(userId.toString());
bean.setStatus("2"); bean.setStatus("2");
int re = backApplyMapper.refuse(bean); int re = backApplyMapper.refuse(bean);
@ -328,7 +324,7 @@ public class BackApplyServiceImpl implements BackApplyService {
return AjaxResult.error("驳回失败"); return AjaxResult.error("驳回失败");
} }
} }
if (roles.contains("jjfgs")) { if (companyId != null && companyId.equals(101L)) {
bean.setCompanyId(companyId.toString()); bean.setCompanyId(companyId.toString());
bean.setCreateBy(userId.toString()); bean.setCreateBy(userId.toString());
bean.setStatus("2"); bean.setStatus("2");
@ -337,7 +333,7 @@ public class BackApplyServiceImpl implements BackApplyService {
return AjaxResult.error("驳回失败"); return AjaxResult.error("驳回失败");
} }
} }
if (roles.contains("tsfgs")) { if (companyId != null && companyId.equals(102L)) {
bean.setCompanyId(companyId.toString()); bean.setCompanyId(companyId.toString());
bean.setCreateBy(userId.toString()); bean.setCreateBy(userId.toString());
bean.setStatus("4"); bean.setStatus("4");
@ -426,7 +422,7 @@ public class BackApplyServiceImpl implements BackApplyService {
Long companyId = null; Long companyId = null;
try { try {
roles = SecurityUtils.getLoginUser().getRoles(); roles = SecurityUtils.getLoginUser().getRoles();
userid = SecurityUtils.getLoginUser().getUserid(); userid = SecurityUtils.getLoginUser().getSysUser().getUserId();
companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId(); companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
} catch (NullPointerException e) { } catch (NullPointerException e) {
e.printStackTrace(); e.printStackTrace();
@ -447,10 +443,8 @@ public class BackApplyServiceImpl implements BackApplyService {
return AjaxResult.error("审核失败"); return AjaxResult.error("审核失败");
} }
} }
if (roles != null && roles.contains("jjfgs")) { if (companyId != null && companyId.equals(101L)) {
if (companyId != null) { dto.setCompanyId(companyId.toString());
dto.setCompanyId(companyId.toString());
}
if (userid != null) { if (userid != null) {
dto.setCreateBy(userid.toString()); dto.setCreateBy(userid.toString());
} }
@ -460,10 +454,8 @@ public class BackApplyServiceImpl implements BackApplyService {
return AjaxResult.error("审核失败"); return AjaxResult.error("审核失败");
} }
} }
if (roles != null && roles.contains("tsfgs")) { if (companyId != null && companyId.equals(102L)) {
if (companyId != null) { dto.setCompanyId(companyId.toString());
dto.setCompanyId(companyId.toString());
}
if (userid != null) { if (userid != null) {
dto.setCreateBy(userid.toString()); dto.setCreateBy(userid.toString());
} }

View File

@ -309,6 +309,18 @@ public class SysUserServiceImpl implements ISysUserService {
userPostMapper.deleteUserPostByUserId(userId); userPostMapper.deleteUserPostByUserId(userId);
// 新增用户与岗位管理 // 新增用户与岗位管理
insertUserPost(user); insertUserPost(user);
Long deptId = user.getDeptId();
SysDept sysDept = deptMapper.selectDeptById(deptId);
String ancestors = sysDept.getAncestors();
String[] split = ancestors.split(",");
if (split.length == 2) {
//表示属于分公司
user.setCompanyId(sysDept.getDeptId());
}
if (split.length >= 3) {
//表示属于分公司下的某个部门
user.setCompanyId(Long.parseLong(split[2]));
}
return userMapper.updateUser(user); return userMapper.updateUser(user);
} }

View File

@ -195,6 +195,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="loginDate != null">login_date = #{loginDate},</if> <if test="loginDate != null">login_date = #{loginDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="companyId != null">company_id = #{companyId},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where user_id = #{userId} where user_id = #{userId}