调整KAFKA数据全量统计代码
This commit is contained in:
parent
6d259ced22
commit
780598ee03
@ -120,4 +120,9 @@ public class AreaUserController extends DefaultBaseController {
|
||||
return areaUserService.listPageAreaUser(page);
|
||||
}
|
||||
|
||||
// 当前区域下的所有网格员总数
|
||||
|
||||
|
||||
// 当前网格下的网格员总数
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.pojo.vos.IdsVO;
|
||||
import io.swagger.annotations.*;
|
||||
@ -40,6 +41,7 @@ public class UserExpandResourceController extends DefaultBaseController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path")
|
||||
})
|
||||
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update/{userId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
@ -105,4 +107,45 @@ public class UserExpandResourceController extends DefaultBaseController {
|
||||
return userExpandService.listPageByRoleIdAndAreaCode(roleId, areaCode, page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过角色和区域编码获取拓展属性完整分页列表", notes = "通过角色和区域编码获取拓展属性完整分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path", required = true),
|
||||
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true)
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage/role-id/{roleId}/area-code-like/{areaCodeLike}")
|
||||
public SuccessResultList<List<UserExpandDTO>> listPageByRoleIdAndAreaCodeLike(@PathVariable("roleId") String roleId,
|
||||
@PathVariable("areaCodeLike") String areaCodeLike,
|
||||
ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return userExpandService.listPageByRoleIdAndAreaCodeLike(roleId, areaCodeLike, page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过角色ID和区域编码统计用户", notes = "通过角色ID和区域编码统计用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path", required = true),
|
||||
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true)
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("count/role-id/{roleId}/area-code-like/{areaCodeLike}")
|
||||
public SuccessResultData<Integer> countByRoleIdAndAreaCode(@PathVariable("roleId") String roleId,
|
||||
@PathVariable("areaCodeLike") String areaCodeLike) {
|
||||
Integer count = userExpandService.countByRoleIdAndAreaCode(roleId, areaCodeLike);
|
||||
return new SuccessResultData<>(count);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过网格编码和角色查询", notes = "通过网格编码和角色查询用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path", required = true),
|
||||
@ApiImplicitParam(name = "gridCode", value = "网格编码", paramType = "path", required = true),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("count/role-id/{roleId}/grid-code/{gridCode}")
|
||||
public SuccessResultData<Integer> countByRoleIdAndGridCode(@PathVariable("roleId") String roleId,
|
||||
@PathVariable("gridCode") String gridCode) {
|
||||
Integer count = userExpandService.countByRoleIdAndGridCode(roleId, gridCode);
|
||||
return new SuccessResultData<>(count);
|
||||
}
|
||||
|
||||
}
|
@ -3,6 +3,9 @@ package cn.com.tenlion.usercenter.kafka;
|
||||
import cn.com.tenlion.usercenter.config.ParamsConfigProperties;
|
||||
import cn.com.tenlion.usercenter.consts.ISmartCityUserCenterConsts;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.pos.area.user.GridUserPO;
|
||||
import cn.com.tenlion.usercenter.service.area.user.IAreaUserService;
|
||||
import cn.com.tenlion.usercenter.service.userexpand.IUserExpandService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import ink.wgink.interfaces.department.IDepartmentDeleteAfterHandler;
|
||||
import ink.wgink.interfaces.department.IDepartmentSaveAfterHandler;
|
||||
@ -13,9 +16,11 @@ import ink.wgink.interfaces.role.IRoleUserSaveAfterHandler;
|
||||
import ink.wgink.interfaces.user.IUserUpdateAfterHandler;
|
||||
import ink.wgink.module.map.pojo.dtos.grid.GridDTO;
|
||||
import ink.wgink.module.map.pojo.dtos.grid.GridRelationDTO;
|
||||
import ink.wgink.module.map.pojo.dtos.grid.GridUserDTO;
|
||||
import ink.wgink.module.map.service.grid.IGridPointService;
|
||||
import ink.wgink.module.map.service.grid.IGridRelationService;
|
||||
import ink.wgink.module.map.service.grid.IGridService;
|
||||
import ink.wgink.module.map.service.grid.IGridUserService;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.pos.DepartmentPO;
|
||||
import ink.wgink.service.department.service.IDepartmentService;
|
||||
@ -24,6 +29,7 @@ import ink.wgink.service.user.service.IUserService;
|
||||
import ink.wgink.util.ArrayListUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -36,6 +42,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @ClassName: KafKaPublishConsumer
|
||||
@ -89,6 +96,12 @@ public class KafKaSyncTableConsumer implements ApplicationEventPublisherAware {
|
||||
private IRoleUserService roleUserService;
|
||||
@Autowired
|
||||
private ParamsConfigProperties paramsConfigProperties;
|
||||
@Autowired
|
||||
private IUserExpandService userExpandService;
|
||||
@Autowired
|
||||
private IAreaUserService areaUserService;
|
||||
@Autowired
|
||||
private IGridUserService gridUserService;
|
||||
|
||||
|
||||
public KafKaSyncTableConsumer() {
|
||||
@ -137,13 +150,14 @@ public class KafKaSyncTableConsumer implements ApplicationEventPublisherAware {
|
||||
@KafkaListener(id = ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_GRID_RELATION + "FullSync", topics = ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_GRID_RELATION + "FullSync")
|
||||
public void gridRelationFullSync(ConsumerRecord<?, ?> record) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
List<GridRelationDTO> gridRelationDTOs = gridRelationService.list(params);
|
||||
if (gridRelationDTOs.isEmpty()) {
|
||||
LOG.error("Grid Relation Full Sync(" + ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_GRID_RELATION + "FullSync) error, gridRelationDTOs is empty");
|
||||
List<UserDTO> userDTOS = gridUserService.listUser(params);
|
||||
if (userDTOS.isEmpty()) {
|
||||
LOG.error("Grid Relation Full Sync(" + ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_GRID_RELATION + "FullSync) error, userDTOS is empty");
|
||||
return;
|
||||
}
|
||||
List<String> relationIds = ArrayListUtil.listBeanStringIdValue(gridRelationDTOs, "relationId", GridRelationDTO.class);
|
||||
gridRelationSaveAfterHandler.handle(relationIds);
|
||||
userDTOS.forEach(userDTO -> {
|
||||
gridRelationSaveAfterHandler.handle(userDTO);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -251,9 +265,9 @@ public class KafKaSyncTableConsumer implements ApplicationEventPublisherAware {
|
||||
LOG.error("Grid Point Full Sync(" + ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_GRID_POINT + "FullSync) error, gridDTOs is empty");
|
||||
return;
|
||||
}
|
||||
gridDTOs.forEach(gridDTO -> {
|
||||
gridPointSaveAfterHandler.handle(gridDTO.getGridId());
|
||||
});
|
||||
for(GridDTO gridDTO : gridDTOs) {
|
||||
gridPointSaveAfterHandler.handle(gridDTO.getGridId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -368,12 +382,14 @@ public class KafKaSyncTableConsumer implements ApplicationEventPublisherAware {
|
||||
*/
|
||||
@KafkaListener(id = ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_SPECIALIZED_PERSON + "FullSync", topics = ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_SPECIALIZED_PERSON + "FullSync")
|
||||
public void specializedPersonFullSync(ConsumerRecord<?, ?> record) {
|
||||
List<String> userIds = roleUserService.listUserId(paramsConfigProperties.getRoleSpecializedPerson());
|
||||
if (userIds.isEmpty()) {
|
||||
LOG.error("Specialized Person Full Sync(" + ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_SPECIALIZED_PERSON + "FullSync) error, userIds is empty");
|
||||
List<UserDTO> userDTOS = roleUserService.listUserByRoleId(paramsConfigProperties.getRoleSpecializedPerson());
|
||||
if (userDTOS.isEmpty()) {
|
||||
LOG.error("Specialized Person Full Sync(" + ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_SPECIALIZED_PERSON + "FullSync) error, userDTOS is empty");
|
||||
return;
|
||||
}
|
||||
roleUserSaveAfterHandler.handle(paramsConfigProperties.getRoleSpecializedPerson(), userIds);
|
||||
userDTOS.forEach(userDTO -> {
|
||||
roleUserSaveAfterHandler.handle(paramsConfigProperties.getRoleSpecializedPerson(), userDTO);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -411,12 +427,14 @@ public class KafKaSyncTableConsumer implements ApplicationEventPublisherAware {
|
||||
*/
|
||||
@KafkaListener(id = ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_GRID_MEMBER + "FullSync", topics = ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_GRID_MEMBER + "FullSync")
|
||||
public void gridMemberFullSync(ConsumerRecord<?, ?> record) {
|
||||
List<String> userIds = roleUserService.listUserId(paramsConfigProperties.getRoleGridMember());
|
||||
if (userIds.isEmpty()) {
|
||||
LOG.error("Grid Member Full Sync(" + ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_GRID_MEMBER + "FullSync) error, userIds is empty");
|
||||
List<UserDTO> userDTOS = roleUserService.listUserByRoleId(paramsConfigProperties.getRoleGridMember());
|
||||
if (userDTOS.isEmpty()) {
|
||||
LOG.error("Grid Member Full Sync(" + ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_GRID_MEMBER + "FullSync) error, userDTOS is empty");
|
||||
return;
|
||||
}
|
||||
roleUserSaveAfterHandler.handle(paramsConfigProperties.getRoleGridMember(), userIds);
|
||||
userDTOS.forEach(userDTO -> {
|
||||
roleUserSaveAfterHandler.handle(paramsConfigProperties.getRoleGridMember(), userDTO);
|
||||
});
|
||||
}
|
||||
|
||||
private SyncDataDTO<Map<String, Object>> getSyncData(String msg) {
|
||||
|
@ -2,14 +2,18 @@ package cn.com.tenlion.usercenter.service.area.user;
|
||||
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.area.user.AreaUserCountDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.area.user.AreaUserDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.vos.area.user.AreaUserVO;
|
||||
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.core.pojo.vos.manage.CoreManageUserVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IAreaUserService {
|
||||
|
||||
@ -36,5 +40,4 @@ public interface IAreaUserService {
|
||||
SuccessResultList<List<AreaUserDTO>> listPageAreaUser(ListPage page);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import ink.wgink.interfaces.user.mongo.IMongoLoginUserService;
|
||||
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
||||
import ink.wgink.module.dictionary.service.IAreaService;
|
||||
import ink.wgink.module.map.pojo.dtos.grid.GridDTO;
|
||||
import ink.wgink.module.map.pojo.dtos.grid.GridUserDTO;
|
||||
import ink.wgink.module.map.service.grid.IGridRelationService;
|
||||
import ink.wgink.module.map.service.grid.IGridService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
@ -31,6 +32,7 @@ import ink.wgink.pojo.pos.DepartmentPO;
|
||||
import ink.wgink.pojo.pos.GroupPO;
|
||||
import ink.wgink.pojo.pos.PositionPO;
|
||||
import ink.wgink.pojo.pos.RolePO;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.department.service.IDepartmentService;
|
||||
import ink.wgink.service.department.service.IDepartmentUserService;
|
||||
|
@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @ClassName: GridPointSaveAfterHandlerImpl
|
||||
@ -44,7 +45,7 @@ public class GridPointSaveAfterHandlerImpl implements IGridPointSaveAfterHandler
|
||||
return;
|
||||
}
|
||||
List<GridPointDTO> gridPointDTOs = gridPointService.list(gridId);
|
||||
gridPointDTOs.forEach(gridPointDTO -> {
|
||||
for (GridPointDTO gridPointDTO : gridPointDTOs) {
|
||||
Map<String, Object> data = new HashMap<>(6);
|
||||
data.put("grid_id", gridId);
|
||||
data.put("lng", gridPointDTO.getLng());
|
||||
@ -55,7 +56,7 @@ public class GridPointSaveAfterHandlerImpl implements IGridPointSaveAfterHandler
|
||||
syncDataDTO.setData(data);
|
||||
syncDataDTO.setTableNumber(ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_GRID_POINT);
|
||||
kafkaTemplate.send(ISmartCityUserCenterConsts.KAFKA_TOPIC_TABLE_SYNC, JSONObject.toJSONString(syncDataDTO));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,6 +3,9 @@ package cn.com.tenlion.usercenter.service.kafka.impl;
|
||||
import cn.com.tenlion.usercenter.config.ParamsConfigProperties;
|
||||
import cn.com.tenlion.usercenter.consts.ISmartCityUserCenterConsts;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.pos.userexpand.UserExpandPO;
|
||||
import cn.com.tenlion.usercenter.service.userexpand.IUserExpandService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import ink.wgink.exceptions.base.SystemException;
|
||||
import ink.wgink.interfaces.map.IGridRelationSaveAfterHandler;
|
||||
@ -38,6 +41,8 @@ public class GridRelationSaveAfterHandlerImpl implements IGridRelationSaveAfterH
|
||||
private IGridService gridService;
|
||||
@Autowired
|
||||
private ParamsConfigProperties paramsConfigProperties;
|
||||
@Autowired
|
||||
private IUserExpandService userExpandService;
|
||||
|
||||
@Override
|
||||
public void handle(List<String> relationIds) throws SystemException {
|
||||
@ -62,6 +67,7 @@ public class GridRelationSaveAfterHandlerImpl implements IGridRelationSaveAfterH
|
||||
if (!paramsConfigProperties.getKafkaActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<GridDTO> gridDTOs = gridService.listByRelationId(userDTO.getUserId());
|
||||
if (gridDTOs.isEmpty()) {
|
||||
return;
|
||||
@ -75,9 +81,21 @@ public class GridRelationSaveAfterHandlerImpl implements IGridRelationSaveAfterH
|
||||
});
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("user_id", userDTO.getUserId());
|
||||
data.put("user_username", userDTO.getUserUsername());
|
||||
data.put("user_avatar", userDTO.getUserAvatar());
|
||||
data.put("user_name", userDTO.getUserName());
|
||||
data.put("user_phone", userDTO.getUserPhone());
|
||||
data.put("user_email", userDTO.getUserEmail());
|
||||
data.put("grid_code", WStringUtil.listToStr(gridCodes, ","));
|
||||
data.put("grid_name", WStringUtil.listToStr(gridNames, ","));
|
||||
|
||||
UserExpandPO userExpandPO = userExpandService.getPO(userDTO.getUserId());
|
||||
if(userExpandPO != null) {
|
||||
data.put("area_code", userExpandPO.getAreaCode());
|
||||
data.put("area_name", userExpandPO.getAreaName());
|
||||
}
|
||||
|
||||
SyncDataDTO<Map> syncDataDTO = new SyncDataDTO<>();
|
||||
syncDataDTO.setUid(userDTO.getUserId());
|
||||
syncDataDTO.setData(data);
|
||||
|
@ -4,10 +4,12 @@ import cn.com.tenlion.usercenter.config.ParamsConfigProperties;
|
||||
import cn.com.tenlion.usercenter.consts.ISmartCityUserCenterConsts;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.kafka.SyncDataDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.pos.userexpand.UserExpandPO;
|
||||
import cn.com.tenlion.usercenter.service.userexpand.IUserExpandService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import ink.wgink.exceptions.base.SystemException;
|
||||
import ink.wgink.interfaces.role.IRoleUserSaveAfterHandler;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.service.role.service.IRoleUserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -81,4 +83,37 @@ public class RoleUserSaveAfterHandlerImpl implements IRoleUserSaveAfterHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(String roleId, UserDTO userDTO) throws SystemException {
|
||||
if (!paramsConfigProperties.getKafkaActive()) {
|
||||
return;
|
||||
}
|
||||
String tableNumber;
|
||||
if (StringUtils.equals(paramsConfigProperties.getRoleSpecializedPerson(), roleId)) {
|
||||
// 专管员
|
||||
tableNumber = ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_SPECIALIZED_PERSON;
|
||||
} else if (StringUtils.equals(paramsConfigProperties.getRoleGridMember(), roleId)) {
|
||||
// 网格员
|
||||
tableNumber = ISmartCityUserCenterConsts.KAFKA_TABLE_SYNC_GRID_MEMBER;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
UserExpandPO userExpandPO = userExpandService.getPO(userDTO.getUserId());
|
||||
SyncDataDTO<Map> syncDataDTO = new SyncDataDTO<>();
|
||||
syncDataDTO.setAction(ISmartCityUserCenterConsts.KAFKA_DATA_SAVE);
|
||||
syncDataDTO.setTableNumber(tableNumber);
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
syncDataDTO.setUid(userDTO.getUserId());
|
||||
dataMap.put("user_name", userDTO.getUserName());
|
||||
dataMap.put("user_username", userDTO.getUserUsername());
|
||||
dataMap.put("user_phone", userDTO.getUserPhone());
|
||||
dataMap.put("user_avatar", userDTO.getUserAvatar());
|
||||
if (userExpandPO != null) {
|
||||
dataMap.put("area_name", userExpandPO.getAreaName());
|
||||
dataMap.put("area_code", userExpandPO.getAreaCode());
|
||||
}
|
||||
syncDataDTO.setData(dataMap);
|
||||
kafkaTemplate.send(ISmartCityUserCenterConsts.KAFKA_TOPIC_TABLE_SYNC, JSONObject.toJSONString(syncDataDTO));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import cn.com.tenlion.usercenter.pojo.vos.userexpand.UserExpandVO;
|
||||
import ink.wgink.interfaces.user.IUserExpandBaseService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
@ -109,5 +110,12 @@ public interface IUserExpandService extends IUserExpandBaseService<UserExpandDTO
|
||||
*/
|
||||
SuccessResultList<List<UserExpandDTO>> listPageByRoleIdAndAreaCode(String roleId, String areaCode, ListPage page);
|
||||
|
||||
SuccessResultList<List<UserExpandDTO>> listPageByRoleIdAndAreaCodeLike(String roleId, String areaCodeLike, ListPage page);
|
||||
|
||||
Integer countByAreaCode(String areaCode, boolean isLike);
|
||||
|
||||
Integer countByRoleIdAndAreaCode(String roleId, String areaCodeLike);
|
||||
|
||||
Integer countByRoleIdAndGridCode(String roleId, String gridCode);
|
||||
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.pos.DepartmentPO;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.pojo.session.WebSocketSession;
|
||||
import ink.wgink.service.user.pojo.pos.UserPO;
|
||||
@ -441,6 +442,21 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
return new SuccessResultList<>(userExpandDTOS, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserExpandDTO>> listPageByRoleIdAndAreaCodeLike(String roleId, String areaCodeLike, ListPage page) {
|
||||
page.getParams().put("roleId", roleId);
|
||||
page.getParams().put("areaCodeLike", areaCodeLike);
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<UserExpandDTO> userExpandDTOS = userExpandDao.list(page.getParams());
|
||||
if (userExpandDTOS.size() > 0) {
|
||||
List<String> userIds = userExpandDTOS.stream().map(UserExpandDTO::getUserId).collect(Collectors.toList());
|
||||
List<UserDTO> userDTOs = userService.listByUserIds(userIds);
|
||||
setUser(userDTOs, userExpandDTOS);
|
||||
}
|
||||
PageInfo<UserExpandDTO> pageInfo = new PageInfo<>(userExpandDTOS);
|
||||
return new SuccessResultList<>(userExpandDTOS, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer countByAreaCode(String areaCode, boolean isLike) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
@ -453,6 +469,24 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
return count == null ? 0 : count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer countByRoleIdAndAreaCode(String roleId, String areaCodeLike) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("roleId", roleId);
|
||||
params.put("areaCodeLike", areaCodeLike);
|
||||
Integer count = userExpandDao.count(params);
|
||||
return count == null ? 0 : count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer countByRoleIdAndGridCode(String roleId, String gridCode) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("roleId", roleId);
|
||||
params.put("gridCode", gridCode);
|
||||
Integer count = userExpandDao.count(params);
|
||||
return count == null ? 0 : count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户
|
||||
*
|
||||
|
@ -335,6 +335,35 @@
|
||||
AND
|
||||
area_code LIKE CONCAT(#{areaCodeLike}, '%')
|
||||
</if>
|
||||
<if test="roleId != null and roleId != ''">
|
||||
AND
|
||||
su.user_id IN (
|
||||
SELECT
|
||||
sru.user_id
|
||||
FROM
|
||||
sys_role_user sru
|
||||
WHERE
|
||||
sru.role_id = #{roleId}
|
||||
)
|
||||
</if>
|
||||
<if test="gridCode != null and gridCode != ''">
|
||||
AND
|
||||
su.user_id IN (
|
||||
SELECT
|
||||
mgr.relation_id
|
||||
FROM
|
||||
map_grid_relation mgr
|
||||
WHERE
|
||||
mgr.grid_id IN (
|
||||
SELECT
|
||||
mg.grid_id
|
||||
FROM
|
||||
map_grid mg
|
||||
WHERE
|
||||
mg.grid_code = #{gridCode}
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
@ -205,7 +205,7 @@ function initMultiSelectInputTree($, treeselect) {
|
||||
top.dialog.dialogData.oldSelectedGridList = oldGrids;
|
||||
top.dialog.open({
|
||||
title: '选择网格',
|
||||
url: top.restAjax.path('route/grid/list-select?selectType=checkbox&areaCode={areaCode}', [areaCode]),
|
||||
url: top.restAjax.path('route/grid/list-select?selectType=checkbox', []),
|
||||
width: '800px',
|
||||
height: '80%',
|
||||
onClose: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user