0325-北仑:客群修改+pad走访

This commit is contained in:
2026-03-25 14:14:32 +08:00
parent 7f5a045cab
commit 59e05e85b1
17 changed files with 492 additions and 126 deletions

View File

@@ -39,6 +39,12 @@ public class CustGroupQueryDTO implements Serializable {
@ApiModelProperty(value = "客群状态", name = "groupStatus")
private String groupStatus;
/**
* 视图类型mine=我创建的sharedToMe=下发给我的
*/
@ApiModelProperty(value = "视图类型", name = "viewType")
private String viewType;
/**
* 页码
*/
@@ -50,4 +56,4 @@ public class CustGroupQueryDTO implements Serializable {
*/
@ApiModelProperty(value = "每页大小", name = "pageSize")
private Integer pageSize = 10;
}
}

View File

@@ -32,7 +32,9 @@ public interface CustGroupMapper extends BaseMapper<CustGroup> {
* @param dto 查询条件
* @return 客群VO列表
*/
List<CustGroupVO> selectCustGroupList(@Param("dto") CustGroupQueryDTO dto);
List<CustGroupVO> selectCustGroupList(@Param("dto") CustGroupQueryDTO dto,
@Param("userName") String userName,
@Param("deptId") String deptId);
/**
* 根据ID查询客群详情
@@ -40,5 +42,19 @@ public interface CustGroupMapper extends BaseMapper<CustGroup> {
* @param id 客群ID
* @return 客群VO
*/
CustGroupVO selectCustGroupById(@Param("id") Long id);
}
CustGroupVO selectCustGroupById(@Param("id") Long id,
@Param("userName") String userName,
@Param("deptId") String deptId);
/**
* 校验当前用户是否有客群查看权限
*
* @param id 客群ID
* @param userName 当前用户名
* @param deptId 当前部门ID
* @return 可查看数量
*/
Long countVisibleCustGroup(@Param("id") Long id,
@Param("userName") String userName,
@Param("deptId") String deptId);
}

View File

@@ -31,6 +31,13 @@ public interface ICustGroupService {
*/
CustGroupVO getCustGroup(Long id);
/**
* 校验当前用户是否有客群查看权限
*
* @param id 客群ID
*/
void checkCustGroupViewPermission(Long id);
/**
* 异步创建客群(模板导入)
*
@@ -100,4 +107,4 @@ public interface ICustGroupService {
*/
void checkAndDisableExpiredGroups();
}
}

View File

@@ -6,6 +6,7 @@ import com.ruoyi.group.domain.entity.CustGroupMember;
import com.ruoyi.group.domain.vo.CustGroupMemberVO;
import com.ruoyi.group.mapper.CustGroupMapper;
import com.ruoyi.group.mapper.CustGroupMemberMapper;
import com.ruoyi.group.service.ICustGroupService;
import com.ruoyi.group.service.ICustGroupMemberService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -27,8 +28,12 @@ public class CustGroupMemberServiceImpl implements ICustGroupMemberService {
@Resource
private CustGroupMapper custGroupMapper;
@Resource
private ICustGroupService custGroupService;
@Override
public List<CustGroupMemberVO> listCustGroupMembers(Long groupId, CustGroupMemberQueryDTO dto) {
custGroupService.checkCustGroupViewPermission(groupId);
return custGroupMemberMapper.selectCustGroupMemberList(groupId, dto);
}

View File

@@ -66,18 +66,26 @@ public class CustGroupServiceImpl implements ICustGroupService {
@Override
public List<CustGroupVO> listCustGroup(CustGroupQueryDTO dto) {
return custGroupMapper.selectCustGroupList(dto);
return custGroupMapper.selectCustGroupList(dto, SecurityUtils.getUsername(), String.valueOf(SecurityUtils.getDeptId()));
}
@Override
public CustGroupVO getCustGroup(Long id) {
CustGroupVO custGroup = custGroupMapper.selectCustGroupById(id);
CustGroupVO custGroup = custGroupMapper.selectCustGroupById(id, SecurityUtils.getUsername(), String.valueOf(SecurityUtils.getDeptId()));
if (custGroup == null) {
throw new ServiceException("客群不存在");
}
return custGroup;
}
@Override
public void checkCustGroupViewPermission(Long id) {
Long count = custGroupMapper.countVisibleCustGroup(id, SecurityUtils.getUsername(), String.valueOf(SecurityUtils.getDeptId()));
if (count == null || count <= 0) {
throw new ServiceException("客群不存在或无查看权限");
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public String createCustGroupByTemplate(CustGroup custGroup, MultipartFile file) {
@@ -914,4 +922,4 @@ public class CustGroupServiceImpl implements ICustGroupService {
}
return memberList;
}
}
}

View File

@@ -4,6 +4,37 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.group.mapper.CustGroupMapper">
<sql id="custGroupVisibleBaseCondition">
AND (
cg.user_name = #{userName}
OR (
cg.share_enabled = 1
AND cg.group_status = '0'
AND cg.share_dept_ids IS NOT NULL
AND cg.share_dept_ids != ''
AND find_in_set(#{deptId}, cg.share_dept_ids)
)
)
</sql>
<sql id="custGroupVisibleCondition">
<choose>
<when test="dto != null and dto.viewType == 'mine'">
AND cg.user_name = #{userName}
</when>
<when test="dto != null and dto.viewType == 'sharedToMe'">
AND cg.share_enabled = 1
AND cg.group_status = '0'
AND cg.share_dept_ids IS NOT NULL
AND cg.share_dept_ids != ''
AND find_in_set(#{deptId}, cg.share_dept_ids)
</when>
<otherwise>
<include refid="custGroupVisibleBaseCondition"/>
</otherwise>
</choose>
</sql>
<select id="selectCustGroupList" resultType="CustGroupVO">
SELECT
cg.id,
@@ -26,7 +57,8 @@
FROM ibs_cust_group cg
<where>
cg.del_flag = '0'
and create_status = '1'
AND cg.create_status = '1'
<include refid="custGroupVisibleCondition"/>
<if test="dto.groupName != null and dto.groupName != ''">
AND cg.group_name LIKE CONCAT('%', #{dto.groupName}, '%')
</if>
@@ -69,7 +101,19 @@
cg.draw_grid_ids,
(SELECT COUNT(*) FROM ibs_cust_group_member cgm WHERE cgm.group_id = cg.id AND cgm.del_flag = '0') AS cust_count
FROM ibs_cust_group cg
WHERE cg.id = #{id} AND cg.del_flag = '0'
WHERE cg.id = #{id}
AND cg.del_flag = '0'
AND cg.create_status = '1'
<include refid="custGroupVisibleBaseCondition"/>
</select>
<select id="countVisibleCustGroup" resultType="java.lang.Long">
SELECT COUNT(1)
FROM ibs_cust_group cg
WHERE cg.id = #{id}
AND cg.del_flag = '0'
AND cg.create_status = '1'
<include refid="custGroupVisibleBaseCondition"/>
</select>
</mapper>