增加获取社区人员和B端人员列表的接口

This commit is contained in:
panshuling321 2022-03-23 14:16:13 +08:00
parent 0f7906605c
commit 0ef600d5f8
10 changed files with 163 additions and 6 deletions

View File

@ -1,5 +1,6 @@
package com.xhpc.user.controller;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
@ -27,6 +28,16 @@ public class XhpcCommunityController extends BaseController {
@Autowired
private IXhpcCommunityService xhpcCommunityService;
/**
* 社区组树列表
*/
@GetMapping("/userList")
public R userList(HttpServletRequest request, String name) {
return R.ok(xhpcCommunityService.userList(request,name));
}
/**
* 社区组树列表
*/

View File

@ -1,5 +1,6 @@
package com.xhpc.user.controller;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
@ -28,6 +29,14 @@ public class XhpcCustomersController extends BaseController {
@Autowired
private IXhpcCustomersService xhpcCustomersService;
@GetMapping("/userList")
public R userList(HttpServletRequest request, String name) {
List<Map<String, Object>> list = xhpcCustomersService.userList(request,name);
return R.ok(list);
}
/**
* 大客户组树列表
*/

View File

@ -22,6 +22,14 @@ public interface XhpcCommunityMapper {
*/
List<Map<String, Object>> list(@Param("name") String name,@Param("tenantId") String tenantId);
/**
* 社区组树列表
*
* @param name 桩名称
* @return
*/
List<Map<String, Object>> tree(@Param("name") String name,@Param("tenantId") String tenantId);
/**
* 添加社区组
* @param xhpcCommunity
@ -57,6 +65,8 @@ public interface XhpcCommunityMapper {
Map<String, Object> getCommunityById(@Param("communityId")Long communityId,@Param("name")String name,@Param("type")Integer type);
List<Map<String, Object>> communityPersonnelTree(@Param("communityId")String communityId);
/**
* 社区人员列表
* @return

View File

@ -19,6 +19,9 @@ public interface XhpcCustomersMapper {
*/
Map<String, Object> getLandUser(@Param("userId") Long userId);
List<Map<String, Object>> tree(@Param("name") String name,@Param("operatorId") Long operatorId,@Param("tenantId") String tenantId);
/**
* 大客户组树列表
*
@ -60,6 +63,9 @@ public interface XhpcCustomersMapper {
*/
int updateCustomers(XhpcCustomers xhpcCustomers);
List<Map<String, Object>> customersPersonnelTree(@Param("customersId")String customersId);
/**
* 大客户人员列表
* @return

View File

@ -16,6 +16,15 @@ import java.util.Map;
*/
public interface IXhpcCommunityService {
/**
* 社区组树列表
*
* @param name 桩名称
* @return
*/
List<Map<String, Object>> userList(HttpServletRequest request, String name);
/**
* 社区组树列表
*

View File

@ -15,6 +15,9 @@ import java.util.Map;
*/
public interface IXhpcCustomersService {
List<Map<String, Object>> userList(HttpServletRequest request,String name);
/**
* 大客户组列表
*

View File

@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
@ -33,15 +34,44 @@ import java.util.Map;
@Service
public class XhpcCommunityServiceImpl extends BaseService implements IXhpcCommunityService {
@Autowired
private XhpcCommunityMapper xhpcCommunityMapper;
@Autowired
private IMechanismService mechanismService;
@Autowired
private TokenService tokenService;
@Resource
XhpcCommunityMapper xhpcCommunityMapper;
@Resource
IMechanismService mechanismService;
@Resource
TokenService tokenService;
private static final Logger logger = LoggerFactory.getLogger(XhpcCommunityServiceImpl.class);
/**
* 社区组树列表
*
* @param name 桩名称
* @return
*/
@Override
public List<Map<String, Object>> userList(HttpServletRequest request, String name){
Long userId = SecurityUtils.getUserId();
List<Map<String, Object>> list =new ArrayList<>();
LoginUser loginUser = tokenService.getLoginUser(request);
if(userId !=null){
String userType = loginUser.getSysUser().getUserType();
if(UserTypeUtil.SYS_USER_TYPE_ZERO.equals(userType)){
list = xhpcCommunityMapper.tree(name, loginUser.getTenantId());
}
}
for (Map<String, Object> commMap: list){
List<Map<String, Object>> userMapList = xhpcCommunityMapper.communityPersonnelTree(commMap.get("id").toString().replaceAll("COMM_", ""));
if(userMapList.size() > 0){
commMap.put("children", userMapList);
}
}
return list;
}
@Override
public List<Map<String, Object>> list(HttpServletRequest request, String name) {
Long userId = SecurityUtils.getUserId();

View File

@ -35,6 +35,29 @@ public class XhpcCustomersServiceImpl extends BaseService implements IXhpcCustom
private IMechanismService mechanismService;
@Autowired
private TokenService tokenService;
@Override
public List<Map<String, Object>> userList(HttpServletRequest request,String name){
List<Map<String, Object>> list =new ArrayList<>();
LoginUser loginUser = tokenService.getLoginUser(request);
String userType = loginUser.getSysUser().getUserType();
if(UserTypeUtil.SYS_USER_TYPE_ZERO.equals(userType)){
list = xhpcCustomersMapper.tree(name,null,loginUser.getTenantId());
}else{
list = xhpcCustomersMapper.tree(name,loginUser.getSysUser().getOperatorId(),loginUser.getTenantId());
}
for(Map<String, Object> cusMap: list){
List<Map<String, Object>> userList = xhpcCustomersMapper.customersPersonnelTree(cusMap.get("id").toString().replaceAll("CUS_", ""));
if (userList.size() > 0){
cusMap.put("children", userList);
}
}
return list;
}
@Override
public List<Map<String, Object>> list(HttpServletRequest request,String name) {
List<Map<String, Object>> list =new ArrayList<>();

View File

@ -30,6 +30,22 @@
select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId}
</select>
<select id="tree" resultType="map">
select
concat('COMM_', community_id) as id,
name as name
from xhpc_community
where del_flag =0
<if test="name !=null and name !=''">
and name like CONCAT('%',#{name},'%')
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
order by create_time desc
</select>
<select id="list" resultType="map">
select
community_id as communityId,
@ -219,6 +235,16 @@
limit 1
</select>
<select id="communityPersonnelTree" resultType="map">
SELECT
community_personnel_id AS id,
name AS name
FROM
xhpc_community_personnel
where community_id=#{communityId} and del_flag=0 and status=0
order by create_time desc
</select>
<select id="communityPersonnelList" resultType="map">
SELECT
community_personnel_id AS communityPersonnelId,

View File

@ -28,6 +28,25 @@
select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId}
</select>
<select id="tree" resultType="map">
select
concat('CUS_', customers_id) as id,
name as name
from xhpc_customers
where del_flag =0
<if test="name !=null and name !=''">
and name like CONCAT('%',#{name},'%')
</if>
<if test="operatorId !=null">
and operator_id=#{operatorId}
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
order by create_time desc
</select>
<select id="list" resultType="map">
select
customers_id as customersId,
@ -212,6 +231,17 @@
limit 1
</select>
<select id="customersPersonnelTree" resultType="map">
SELECT
customers_personnel_id AS id,
name AS name
FROM
xhpc_customers_personnel
where customers_id=#{customersId} and del_flag=0 and status=0
order by create_time desc
</select>
<select id="customersPersonnelList" resultType="map">
SELECT
customers_personnel_id AS customersPersonnelId,