Browse Source

20210426v1.4

recovery
zy_Java 4 years ago
parent
commit
db55a6372c
  1. 9
      tall/src/main/java/com/ccsens/tall/bean/dto/RoleDto.java
  2. 11
      tall/src/main/java/com/ccsens/tall/bean/po/ProShow.java
  3. 60
      tall/src/main/java/com/ccsens/tall/bean/po/ProShowExample.java
  4. 10
      tall/src/main/java/com/ccsens/tall/bean/vo/ProjectVo.java
  5. 2
      tall/src/main/java/com/ccsens/tall/bean/vo/UserVo.java
  6. 7
      tall/src/main/java/com/ccsens/tall/persist/dao/ProRoleDao.java
  7. 7
      tall/src/main/java/com/ccsens/tall/persist/dao/SysUserDao.java
  8. 7
      tall/src/main/java/com/ccsens/tall/service/IProRoleService.java
  9. 62
      tall/src/main/java/com/ccsens/tall/service/ProRoleService.java
  10. 15
      tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java
  11. 4
      tall/src/main/java/com/ccsens/tall/service/UserInfoService.java
  12. 9
      tall/src/main/java/com/ccsens/tall/web/RoleController.java
  13. 4
      tall/src/main/resources/application.yml
  14. 23
      tall/src/main/resources/mapper_dao/ProRoleDao.xml
  15. 15
      tall/src/main/resources/mapper_dao/SysUserDao.xml
  16. 25
      tall/src/main/resources/mapper_raw/ProShowMapper.xml

9
tall/src/main/java/com/ccsens/tall/bean/dto/RoleDto.java

@ -105,4 +105,13 @@ public class RoleDto {
@ApiModelProperty("角色id")
private Long roleId;
}
@Data
@ApiModel("对谁不可见")
public static class RoleOfNoLook {
@ApiModelProperty("角色id")
private Long roleId;
@ApiModelProperty("不可见角色id(数组)")
private List<Long> noRoleId;
}
}

11
tall/src/main/java/com/ccsens/tall/bean/po/ProShow.java

@ -42,6 +42,8 @@ public class ProShow implements Serializable {
private Byte roleBelong;
private Byte milestoneSubtask;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -196,6 +198,14 @@ public class ProShow implements Serializable {
this.roleBelong = roleBelong;
}
public Byte getMilestoneSubtask() {
return milestoneSubtask;
}
public void setMilestoneSubtask(Byte milestoneSubtask) {
this.milestoneSubtask = milestoneSubtask;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -221,6 +231,7 @@ public class ProShow implements Serializable {
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append(", roleBelong=").append(roleBelong);
sb.append(", milestoneSubtask=").append(milestoneSubtask);
sb.append("]");
return sb.toString();
}

60
tall/src/main/java/com/ccsens/tall/bean/po/ProShowExample.java

@ -1274,6 +1274,66 @@ public class ProShowExample {
addCriterion("role_belong not between", value1, value2, "roleBelong");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskIsNull() {
addCriterion("milestone_subtask is null");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskIsNotNull() {
addCriterion("milestone_subtask is not null");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskEqualTo(Byte value) {
addCriterion("milestone_subtask =", value, "milestoneSubtask");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskNotEqualTo(Byte value) {
addCriterion("milestone_subtask <>", value, "milestoneSubtask");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskGreaterThan(Byte value) {
addCriterion("milestone_subtask >", value, "milestoneSubtask");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskGreaterThanOrEqualTo(Byte value) {
addCriterion("milestone_subtask >=", value, "milestoneSubtask");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskLessThan(Byte value) {
addCriterion("milestone_subtask <", value, "milestoneSubtask");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskLessThanOrEqualTo(Byte value) {
addCriterion("milestone_subtask <=", value, "milestoneSubtask");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskIn(List<Byte> values) {
addCriterion("milestone_subtask in", values, "milestoneSubtask");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskNotIn(List<Byte> values) {
addCriterion("milestone_subtask not in", values, "milestoneSubtask");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskBetween(Byte value1, Byte value2) {
addCriterion("milestone_subtask between", value1, value2, "milestoneSubtask");
return (Criteria) this;
}
public Criteria andMilestoneSubtaskNotBetween(Byte value1, Byte value2) {
addCriterion("milestone_subtask not between", value1, value2, "milestoneSubtask");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

10
tall/src/main/java/com/ccsens/tall/bean/vo/ProjectVo.java

@ -185,6 +185,8 @@ public class ProjectVo {
private String relevanceProjectName;
@ApiModelProperty("成员信息")
private List<ProMemberVo> members;
@ApiModelProperty("对谁不可见")
private List<RolesOfNoLook> roleOfNoLook = new ArrayList<>();
@JsonIgnore
private Long parentId; //一级角色Id
@JsonIgnore
@ -194,6 +196,14 @@ public class ProjectVo {
}
@ApiModel
@Data
public static class RolesOfNoLook{
@ApiModelProperty("不可见角色id")
private Long id;
@ApiModelProperty("不可见角色名称")
private String name;
}
@ApiModel
@Data
public static class ProMemberVo{
@JsonIgnore
private Long mUserId;//成员的userId

2
tall/src/main/java/com/ccsens/tall/bean/vo/UserVo.java

@ -144,6 +144,8 @@ public class UserVo {
private Date createdAt;
@ApiModelProperty("空间使用情况")
private Interspace interspace;
@ApiModelProperty("WxInfo")
private WxInfo wxInfo;
@ApiModelProperty("标签信息")
private List<LabelVo.SelectLabel> labelList;
}

7
tall/src/main/java/com/ccsens/tall/persist/dao/ProRoleDao.java

@ -121,6 +121,13 @@ public interface ProRoleDao extends ProRoleMapper{
*/
List<ProjectVo.ProMemberVo> selectMemberOfRole(Long roleId);
/**
* 根据角色id查询不可见角色列表
* @param roleId 二级角色id
* @return 不可见角色list
*/
List<ProjectVo.RolesOfNoLook> selectRoleOfNoLook(Long roleId);

7
tall/src/main/java/com/ccsens/tall/persist/dao/SysUserDao.java

@ -61,4 +61,11 @@ public interface SysUserDao extends SysUserMapper {
* @return
*/
UserVo.TokenBean getTokenBeanByUserId(Long userId);
/**
* 查找用户wxInfo中的信息
* @param currentUserId 当前用户id
* @return UserVo.WxInfo
*/
UserVo.WxInfo selectWxInfo(@Param("userId") Long currentUserId);
}

7
tall/src/main/java/com/ccsens/tall/service/IProRoleService.java

@ -79,4 +79,11 @@ public interface IProRoleService {
void queryRoleIsShows(QueryDto<RoleDto.QueryRoleIsShows> param);
void upRoleShowsOrder(QueryDto<RoleDto.UpRoleShowsOrder> param);
/**
* 角色管理:修改对谁不可见
* @param param 参数
* @param userId 当前用户id
*/
void upRoleWhoNoLook(RoleDto.RoleOfNoLook param, Long userId);
}

62
tall/src/main/java/com/ccsens/tall/service/ProRoleService.java

@ -251,6 +251,14 @@ public class ProRoleService implements IProRoleService {
private List<ProjectVo.RoleInfo> getRealMemberRolesShowByProjectIdAll(Long projectId, Long currentUserId) {
List<ProjectVo.RoleInfo> memberRoleList;
memberRoleList = proRoleDao.selectSecondRolesByProjectId(projectId);
//查找对谁不可见
for (ProjectVo.RoleInfo roleInfo : memberRoleList) {
List<ProjectVo.RolesOfNoLook> noLookList = proRoleDao.selectRoleOfNoLook(roleInfo.getId());
if (CollectionUtil.isNotEmpty(noLookList)){
roleInfo.getRoleOfNoLook().addAll(noLookList);
}
}
return memberRoleList;
}
@ -773,6 +781,16 @@ public class ProRoleService implements IProRoleService {
if (ObjectUtil.isNull(project)) {
throw new BaseException(CodeEnum.NOT_PROJECT);
}
//查找项目配置
String milestone = "";
ProShowExample proShowExample = new ProShowExample();
proShowExample.createCriteria().andProjectIdEqualTo(projectId.getProjectId());
List<ProShow> proShows = proShowDao.selectByExample(proShowExample);
if (CollectionUtil.isNotEmpty(proShows)){
Byte milestoneSubtask = proShows.get(0).getMilestoneSubtask();
milestone = milestoneSubtask == 0 ? "里程碑":null;
}
long beginTime = projectId.getStartTime() == null ? project.getBeginTime() : projectId.getStartTime();
long endTime = projectId.getEndTime() == null ? project.getEndTime() : projectId.getEndTime();
//1、查找一级任务
@ -783,6 +801,7 @@ public class ProRoleService implements IProRoleService {
List<ProTaskDetail> firstTaskDetailList = taskDetailDao.selectByExample(proTaskDetailExample);
log.info("查找到一级任务:{}", firstTaskDetailList);
if (CollectionUtil.isNotEmpty(firstTaskDetailList)) {
String finalMilestone = milestone;
firstTaskDetailList.forEach(firstTaskDetail -> {
int sequence = 1;
TaskVo.NormalTask normalTask = new TaskVo.NormalTask();
@ -790,7 +809,7 @@ public class ProRoleService implements IProRoleService {
normalTask.setDetailId(firstTaskDetail.getId());
normalTask.setSequence(sequence);
List<TaskVo.TaskListByProjectId> secondTaskList = taskDetailDao.getTaskByParentId(firstTaskDetail.getId(), "里程碑",beginTime,endTime);
List<TaskVo.TaskListByProjectId> secondTaskList = taskDetailDao.getTaskByParentId(firstTaskDetail.getId(), finalMilestone,beginTime,endTime);
List<TaskVo.NormalTask> secondList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(secondTaskList)) {
secondTaskList.forEach(secondTask -> {
@ -1116,4 +1135,45 @@ public class ProRoleService implements IProRoleService {
}
return memberId;
}
/**
* 修改对谁不可见
* @param param 参数
* @param userId 当前用户id
*/
@Override
public void upRoleWhoNoLook(RoleDto.RoleOfNoLook param, Long userId) {
ProRole proRole = proRoleDao.selectByPrimaryKey(param.getRoleId());
if (ObjectUtil.isNotNull(proRole)){
//用户在项目中的最高权限
int power = selectPowerByRoleName(userId, proRole.getProjectId());
if (2 < power){
//删除之前的记录
ProRoleExcludeExample excludeExample = new ProRoleExcludeExample();
excludeExample.createCriteria().andRoleIdEqualTo(param.getRoleId()).andRecStatusEqualTo((byte)0);
List<ProRoleExclude> proRoleExcludes = proRoleExcludeMapper.selectByExample(excludeExample);
if (CollectionUtil.isNotEmpty(proRoleExcludes)){
for (ProRoleExclude proRoleExclude : proRoleExcludes) {
ProRoleExclude oldExclude = new ProRoleExclude();
oldExclude.setId(proRoleExclude.getId());
oldExclude.setRecStatus((byte)2);
proRoleExcludeMapper.updateByExampleSelective(oldExclude,excludeExample);
}
}
//添加新数据
for (Long noRoleId : param.getNoRoleId()) {
ProRoleExclude roleExclude = new ProRoleExclude();
roleExclude.setId(snowflake.nextId());
roleExclude.setRoleId(param.getRoleId());
roleExclude.setOtherRoleId(noRoleId);
proRoleExcludeMapper.insertSelective(roleExclude);
}
}else{
throw new BaseException(CodeEnum.NOT_POWER);
}
}
}
}

15
tall/src/main/java/com/ccsens/tall/service/ProTaskDetailService.java

@ -348,6 +348,19 @@ public class ProTaskDetailService implements IProTaskDetailService {
if (CollectionUtil.isNotEmpty(secondTaskVoList)) {
for (TaskVo.NormalTask normalTask : secondTaskVoList) {
//通过角色id查找 负责人名称 检查人名称
Long executorRole = normalTask.getExecutorRole();
ProRole executor = proRoleDao.selectByPrimaryKey(executorRole);
if(ObjectUtil.isNotNull(executor)){
normalTask.setExecutorRoleName(executor.getName());
}
Long checkerRole = normalTask.getCheckerRole();
ProRole checker = proRoleDao.selectByPrimaryKey(checkerRole);
if(ObjectUtil.isNotNull(checker)){
normalTask.setCheckerRoleName(checker.getName());
}
//处理插件
managePlugin(currentUserId, roleId, normalTask, imitation);
//任务完成状态
@ -424,12 +437,14 @@ public class ProTaskDetailService implements IProTaskDetailService {
if(ObjectUtil.isNotNull(executor)){
normalTask.setExecutorRoleName(executor.getName());
}
Long checkerRole = normalTask.getCheckerRole();
ProRole checker = proRoleDao.selectByPrimaryKey(checkerRole);
if(ObjectUtil.isNotNull(checker)) {
normalTask.setExecutorRoleName(checker.getName());
}
//处理插件
managePlugin(currentUserId, roleId, normalTask, imitation);
//任务完成状态

4
tall/src/main/java/com/ccsens/tall/service/UserInfoService.java

@ -126,6 +126,7 @@ public class UserInfoService implements IUserInfoService{
sysUserExample.createCriteria().andNicknameEqualTo(updateNickname.getNickname());
List<SysUser> userList = sysUserDao.selectByExample(sysUserExample);
if(CollectionUtil.isNotEmpty(userList)){
redisUtil.del(nicknameKey);
throw new BaseException(CodeEnum.NICKNAME_REPEAT);
}
SysUser user = sysUserDao.selectByPrimaryKey(userId);
@ -194,6 +195,9 @@ public class UserInfoService implements IUserInfoService{
//获取空间使用信息
UserVo.Interspace interspace = sysUserDao.selectInterspace(currentUserId);
selectUserInfo.setInterspace(interspace);
//封装wxInfo
UserVo.WxInfo wxInfo = sysUserDao.selectWxInfo(currentUserId);
selectUserInfo.setWxInfo(wxInfo);
}
return selectUserInfo;

9
tall/src/main/java/com/ccsens/tall/web/RoleController.java

@ -163,4 +163,13 @@ public class RoleController {
List<ProjectVo.RoleInfo> roleInfoList = proRoleService.getRolesByProjectIdAndUserId(projectId, currentUserId,imitation,queryType);
return JsonResponse.newInstance().ok(roleInfoList);
}
@MustLoginTall
@ApiOperation(value = "角色管理:修改对谁不可见",notes = "")
@RequestMapping(value = "/upRoleWhoNoLook", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse upRoleWhoNoLook(@ApiParam @Validated @RequestBody QueryDto<RoleDto.RoleOfNoLook> params){
log.info("传入参数:{}", params);
proRoleService.upRoleWhoNoLook(params.getParam(),params.getUserId());
return JsonResponse.newInstance().ok();
}
}

4
tall/src/main/resources/application.yml

@ -1,5 +1,5 @@
spring:
profiles:
active: test
include: util-test,common
active: dev
include: util-dev,common

23
tall/src/main/resources/mapper_dao/ProRoleDao.xml

@ -81,8 +81,8 @@
if((SELECT `name` FROM t_pro_role WHERE id = pr.parent_id) = 'ProjectVirtualRole',1,0) as projectRole,
pr.relevance_project_id as relevanceProjectId,
(SELECT `name` FROM t_sys_project WHERE id = pr.relevance_project_id) as relevanceProjectName
from
t_pro_role pr LEFT JOIN t_pro_member_role mr ON mr.role_id = pr.id
from t_pro_role pr
LEFT JOIN t_pro_member_role mr ON mr.role_id = pr.id
LEFT JOIN t_pro_member m ON mr.member_id = m.id
where
pr.project_id = #{projectId}
@ -445,4 +445,23 @@
pmr.role_id = #{roleId}
AND pmr.rec_status = 0
</select>
<select id="selectRoleOfNoLook" resultType="com.ccsens.tall.bean.vo.ProjectVo$RolesOfNoLook">
SELECT
r.id,r.`name`
FROM
t_pro_role AS r
RIGHT JOIN (
SELECT
ree.other_role_id AS id
FROM
t_pro_role AS rr
LEFT JOIN t_pro_role_execlude AS ree ON rr.id = ree.other_role_id
WHERE
ree.rec_status = 0
AND ree.role_id = #{roleId}
) AS nolook ON r.id = nolook.id
WHERE
r.rec_status = 0
</select>
</mapper>

15
tall/src/main/resources/mapper_dao/SysUserDao.xml

@ -198,4 +198,19 @@
AND
rec_status = 0
</select>
<select id="selectWxInfo" resultType="com.ccsens.tall.bean.vo.UserVo$WxInfo">
SELECT
u.city As city,
u.country AS country,
u.avatar_url As headImgUrl,
u.`language` As `language`,
u.nickname AS nickname,
u.province AS province,
u.gender AS sex
FROM
t_sys_user AS u
WHERE
id = #{userId}
</select>
</mapper>

25
tall/src/main/resources/mapper_raw/ProShowMapper.xml

@ -21,6 +21,7 @@
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
<result column="role_belong" jdbcType="TINYINT" property="roleBelong" />
<result column="milestone_subtask" jdbcType="TINYINT" property="milestoneSubtask" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -83,7 +84,7 @@
<sql id="Base_Column_List">
id, project_id, slide, filter, is_show_mvp, style, create_task, time_show, duration,
show_shortcuts, select_task_type, detail_path, pims_nav_type, share_change, share_change_code,
created_at, updated_at, rec_status, role_belong
created_at, updated_at, rec_status, role_belong, milestone_subtask
</sql>
<select id="selectByExample" parameterType="com.ccsens.tall.bean.po.ProShowExample" resultMap="BaseResultMap">
select
@ -122,14 +123,14 @@
show_shortcuts, select_task_type, detail_path,
pims_nav_type, share_change, share_change_code,
created_at, updated_at, rec_status,
role_belong)
role_belong, milestone_subtask)
values (#{id,jdbcType=BIGINT}, #{projectId,jdbcType=BIGINT}, #{slide,jdbcType=TINYINT},
#{filter,jdbcType=TINYINT}, #{isShowMvp,jdbcType=TINYINT}, #{style,jdbcType=TINYINT},
#{createTask,jdbcType=TINYINT}, #{timeShow,jdbcType=VARCHAR}, #{duration,jdbcType=TINYINT},
#{showShortcuts,jdbcType=TINYINT}, #{selectTaskType,jdbcType=TINYINT}, #{detailPath,jdbcType=VARCHAR},
#{pimsNavType,jdbcType=TINYINT}, #{shareChange,jdbcType=TINYINT}, #{shareChangeCode,jdbcType=VARCHAR},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT},
#{roleBelong,jdbcType=TINYINT})
#{roleBelong,jdbcType=TINYINT}, #{milestoneSubtask,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.tall.bean.po.ProShow">
insert into t_pro_show
@ -191,6 +192,9 @@
<if test="roleBelong != null">
role_belong,
</if>
<if test="milestoneSubtask != null">
milestone_subtask,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -250,6 +254,9 @@
<if test="roleBelong != null">
#{roleBelong,jdbcType=TINYINT},
</if>
<if test="milestoneSubtask != null">
#{milestoneSubtask,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.tall.bean.po.ProShowExample" resultType="java.lang.Long">
@ -318,6 +325,9 @@
<if test="record.roleBelong != null">
role_belong = #{record.roleBelong,jdbcType=TINYINT},
</if>
<if test="record.milestoneSubtask != null">
milestone_subtask = #{record.milestoneSubtask,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -343,7 +353,8 @@
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT},
role_belong = #{record.roleBelong,jdbcType=TINYINT}
role_belong = #{record.roleBelong,jdbcType=TINYINT},
milestone_subtask = #{record.milestoneSubtask,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -405,6 +416,9 @@
<if test="roleBelong != null">
role_belong = #{roleBelong,jdbcType=TINYINT},
</if>
<if test="milestoneSubtask != null">
milestone_subtask = #{milestoneSubtask,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -427,7 +441,8 @@
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT},
role_belong = #{roleBelong,jdbcType=TINYINT}
role_belong = #{roleBelong,jdbcType=TINYINT},
milestone_subtask = #{milestoneSubtask,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
Loading…
Cancel
Save