增加接口
This commit is contained in:
parent
58ad25b524
commit
d688b8338e
@ -1,5 +1,7 @@
|
||||
package cn.com.tenlion.usercenter.controller.app.api.userexpand;
|
||||
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.CountAreaGridMemberDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.CountGridMemberDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.OnlineGridMemberDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.vos.userexpand.UserExpandVO;
|
||||
@ -10,11 +12,13 @@ import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: UserExpandController
|
||||
@ -83,4 +87,42 @@ public class UserExpandAppController extends DefaultBaseController {
|
||||
return userExpandService.listOnlineGridMemberReleaseByAreaCode(areaCode);
|
||||
}
|
||||
|
||||
@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 = "areaCode", value = "地区编码", paramType = "path", required = true)
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("count-grid-member/area-code-like/{areaCode}")
|
||||
public SuccessResultData<CountGridMemberDTO> countGridMemberByAreaCode(@RequestHeader("token") String token,
|
||||
@PathVariable("areaCode") String areaCode) {
|
||||
CountGridMemberDTO countGridMemberDTO = userExpandService.countGridMemberUserByAreaCode(areaCode);
|
||||
return new SuccessResultData<>(countGridMemberDTO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过区域编码统计下级区域网格员角色用户", notes = "通过区域编码统计网格员角色用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true)
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("count-sub-area-grid-member/area-code/{areaCode}")
|
||||
public SuccessResultData<List<CountAreaGridMemberDTO>> countSubAreaGridMemberByAreaCode(@RequestHeader("token") String token,
|
||||
@PathVariable("areaCode") String areaCode) {
|
||||
List<CountAreaGridMemberDTO> countSubAreaGridMemberByAreaCodes = userExpandService.listCountSubAreaGridMemberByAreaCode(areaCode);
|
||||
return new SuccessResultData<>(countSubAreaGridMemberByAreaCodes);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package cn.com.tenlion.usercenter.pojo.dtos.userexpand;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.poi.ss.formula.functions.Count;
|
||||
|
||||
@ApiModel
|
||||
public class CountAreaGridMemberDTO implements Comparable<CountAreaGridMemberDTO> {
|
||||
|
||||
@ApiModelProperty(name = "areaId", value = "区域ID")
|
||||
private String areaId;
|
||||
@ApiModelProperty(name = "areaCode", value = "区域编码")
|
||||
private String areaCode;
|
||||
@ApiModelProperty(name = "areaName", value = "区域名")
|
||||
private String areaName;
|
||||
@ApiModelProperty(name = "total", value = "总数")
|
||||
private Integer total;
|
||||
|
||||
public CountAreaGridMemberDTO() {
|
||||
}
|
||||
|
||||
public CountAreaGridMemberDTO(String areaId, String areaCode, String areaName, Integer total) {
|
||||
this.areaId = areaId;
|
||||
this.areaCode = areaCode;
|
||||
this.areaName = areaName;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public String getAreaId() {
|
||||
return areaId;
|
||||
}
|
||||
|
||||
public void setAreaId(String areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public String getAreaCode() {
|
||||
return areaCode;
|
||||
}
|
||||
|
||||
public void setAreaCode(String areaCode) {
|
||||
this.areaCode = areaCode;
|
||||
}
|
||||
|
||||
public String getAreaName() {
|
||||
return areaName;
|
||||
}
|
||||
|
||||
public void setAreaName(String areaName) {
|
||||
this.areaName = areaName;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Integer total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(CountAreaGridMemberDTO o) {
|
||||
if (this.getTotal().compareTo(o.getTotal()) > 0) {
|
||||
return -1;
|
||||
}
|
||||
if (this.getTotal().compareTo(o.getTotal()) < 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.com.tenlion.usercenter.pojo.dtos.userexpand;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel
|
||||
public class CountGridMemberDTO {
|
||||
|
||||
@ApiModelProperty(name = "count", value = "数量")
|
||||
private Integer count;
|
||||
@ApiModelProperty(name = "total;", value = "总数")
|
||||
private Integer total;
|
||||
|
||||
public CountGridMemberDTO() {
|
||||
}
|
||||
|
||||
public CountGridMemberDTO(Integer count, Integer total) {
|
||||
this.count = count;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Integer getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Integer count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Integer total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
}
|
@ -1,18 +1,16 @@
|
||||
package cn.com.tenlion.usercenter.service.userexpand;
|
||||
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.GridUserAuthBindDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.OnlineGridMemberDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.*;
|
||||
import cn.com.tenlion.usercenter.pojo.pos.userexpand.UserExpandPO;
|
||||
import cn.com.tenlion.usercenter.pojo.vos.userexpand.GridUserAuthBindVO;
|
||||
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;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IUserExpandService
|
||||
@ -118,4 +116,7 @@ public interface IUserExpandService extends IUserExpandBaseService<UserExpandDTO
|
||||
|
||||
Integer countByRoleIdAndGridCode(String roleId, String gridCode);
|
||||
|
||||
CountGridMemberDTO countGridMemberUserByAreaCode(String areaCodeLike);
|
||||
|
||||
List<CountAreaGridMemberDTO> listCountSubAreaGridMemberByAreaCode(String areaCode);
|
||||
}
|
||||
|
@ -5,9 +5,7 @@ import cn.com.tenlion.usercenter.consts.ISmartCityUserCenterConsts;
|
||||
import cn.com.tenlion.usercenter.dao.userexpand.IUserExpandDao;
|
||||
import cn.com.tenlion.usercenter.manager.HuaWeiSMCManager;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.remote.huawei.SMCMeetingDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.GridUserAuthBindDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.OnlineGridMemberDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.*;
|
||||
import cn.com.tenlion.usercenter.pojo.pos.userexpand.UserExpandPO;
|
||||
import cn.com.tenlion.usercenter.pojo.vos.userexpand.GridUserAuthBindVO;
|
||||
import cn.com.tenlion.usercenter.pojo.vos.userexpand.UserExpandVO;
|
||||
@ -21,11 +19,13 @@ import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.department.IDepartmentBaseService;
|
||||
import ink.wgink.interfaces.department.IDepartmentUserBaseService;
|
||||
import ink.wgink.interfaces.role.IRoleUserBaseService;
|
||||
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
||||
import ink.wgink.module.dictionary.pojo.dtos.DataDTO;
|
||||
import ink.wgink.module.instantmessage.websocket.manager.WebSocketChannelManager;
|
||||
import ink.wgink.module.map.pojo.dtos.grid.GridDTO;
|
||||
import ink.wgink.module.map.service.grid.IGridRelationService;
|
||||
import ink.wgink.module.map.service.grid.IGridService;
|
||||
import ink.wgink.mongo.module.dictionary.service.IMongoAreaService;
|
||||
import ink.wgink.mongo.module.dictionary.service.IMongoDataService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||
@ -45,10 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -78,6 +75,8 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
@Autowired
|
||||
private IGridService gridService;
|
||||
@Autowired
|
||||
private IMongoAreaService mongoAreaService;
|
||||
@Autowired
|
||||
private IMongoDataService mongoDataService;
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
@ -493,6 +492,28 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
return count == null ? 0 : count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CountGridMemberDTO countGridMemberUserByAreaCode(String areaCode) {
|
||||
String areaCodeLike = WStringUtil.cutContinuityRepeatCharDesc(areaCode, '0', 3);
|
||||
Integer gridMember = countByRoleIdAndAreaCode(paramsConfigProperties.getRoleGridMember(), areaCodeLike);
|
||||
Integer totalGridMember = countByRoleIdAndGridCode(paramsConfigProperties.getRoleGridMember(), null);
|
||||
return new CountGridMemberDTO(gridMember, totalGridMember);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CountAreaGridMemberDTO> listCountSubAreaGridMemberByAreaCode(String areaCode) {
|
||||
AreaDTO areaDTO = mongoAreaService.getByCode(areaCode);
|
||||
if (areaDTO == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<AreaDTO> areaDTOS = mongoAreaService.listByParentId(areaDTO.getAreaId());
|
||||
return areaDTOS.parallelStream().map(subArea -> {
|
||||
String areaCodeLike = WStringUtil.cutContinuityRepeatCharDesc(subArea.getAreaCode(), '0', 3);
|
||||
Integer gridMember = countByRoleIdAndAreaCode(paramsConfigProperties.getRoleGridMember(), areaCodeLike);
|
||||
return new CountAreaGridMemberDTO(subArea.getAreaId(), subArea.getAreaCode(), subArea.getAreaName(), gridMember);
|
||||
}).sorted().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户
|
||||
*
|
||||
|
@ -327,9 +327,9 @@
|
||||
sue.user_id = su.user_id
|
||||
<where>
|
||||
su.is_delete = 0
|
||||
<if test="areaCodeLike != null and areaCodeLike != ''">
|
||||
<if test="areaCode != null and areaCode != ''">
|
||||
AND
|
||||
area_code LIKE CONCAT(#{areaCodeLike}, '%')
|
||||
area_code = #{areaCode}
|
||||
</if>
|
||||
<if test="areaCodeLike != null and areaCodeLike != ''">
|
||||
AND
|
||||
|
Loading…
Reference in New Issue
Block a user