增加市域治理名片认证资源接口
This commit is contained in:
parent
b2200e5ccb
commit
6590546865
6
pom.xml
6
pom.xml
@ -104,6 +104,12 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ink.wgink</groupId>
|
||||
<artifactId>login-wechat</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ink.wgink</groupId>
|
||||
<artifactId>service-position</artifactId>
|
||||
|
@ -1,6 +1,8 @@
|
||||
package cn.com.tenlion.usercenter.controller.resource.userexpand;
|
||||
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.GridUserAuthBindDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.dtos.userexpand.UserExpandDTO;
|
||||
import cn.com.tenlion.usercenter.pojo.vos.userexpand.GridUserAuthBindVO;
|
||||
import cn.com.tenlion.usercenter.pojo.vos.userexpand.UserExpandVO;
|
||||
import cn.com.tenlion.usercenter.service.userexpand.IUserExpandService;
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
@ -43,6 +45,17 @@ public class UserExpandResourceController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "认证并绑定网格员", notes = "认证并绑定网格员接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "access_token", value = "token", paramType = "query")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping(name = "auth-and-bind")
|
||||
@CheckRequestBodyAnnotation
|
||||
public GridUserAuthBindDTO authAndBind(@RequestBody GridUserAuthBindVO gridUserAuthBindVO) {
|
||||
return userExpandService.getAuthAndBindResult(gridUserAuthBindVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "拓展属性详情", notes = "拓展属性详情接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path")
|
||||
|
@ -0,0 +1,59 @@
|
||||
package cn.com.tenlion.usercenter.pojo.dtos.userexpand;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: GridUserAuthBindDTO
|
||||
* @Description: 网格用户认证绑定
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/5/24 15:33
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@ApiModel
|
||||
public class GridUserAuthBindDTO {
|
||||
|
||||
@ApiModelProperty(name = "userId", value = "用户ID")
|
||||
private String userId;
|
||||
@ApiModelProperty(name = "areaCode", value = "区域编码")
|
||||
private String areaCode;
|
||||
@ApiModelProperty(name = "userLevel", value = "用户级别")
|
||||
private Integer userLevel;
|
||||
@ApiModelProperty(name = "areaCodes", value = "地区编码列表")
|
||||
private List<String> areaCodes;
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getAreaCode() {
|
||||
return areaCode == null ? "" : areaCode.trim();
|
||||
}
|
||||
|
||||
public void setAreaCode(String areaCode) {
|
||||
this.areaCode = areaCode;
|
||||
}
|
||||
|
||||
public Integer getUserLevel() {
|
||||
return userLevel == null ? 0 : userLevel;
|
||||
}
|
||||
|
||||
public void setUserLevel(Integer userLevel) {
|
||||
this.userLevel = userLevel;
|
||||
}
|
||||
|
||||
public List<String> getAreaCodes() {
|
||||
return areaCodes == null ? new ArrayList() : areaCodes;
|
||||
}
|
||||
|
||||
public void setAreaCodes(List<String> areaCodes) {
|
||||
this.areaCodes = areaCodes;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package cn.com.tenlion.usercenter.pojo.vos.userexpand;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @ClassName: GridUserAuthVO
|
||||
* @Description: 网格员认证+绑定
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/5/24 15:28
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@ApiModel
|
||||
public class GridUserAuthBindVO {
|
||||
|
||||
@ApiModelProperty(name = "userId", value = "需要绑定的用户ID")
|
||||
@CheckEmptyAnnotation(name = "用户ID")
|
||||
private String userId;
|
||||
@ApiModelProperty(name = "username", value = "用户名")
|
||||
@CheckEmptyAnnotation(name = "用户名")
|
||||
private String username;
|
||||
@ApiModelProperty(name = "password", value = "密码")
|
||||
@CheckEmptyAnnotation(name = "密码")
|
||||
private String password;
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username == null ? "" : username.trim();
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password == null ? "" : password.trim();
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
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.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.dtos.user.UserDTO;
|
||||
@ -84,4 +86,12 @@ public interface IUserExpandService extends IUserExpandBaseService<UserExpandDTO
|
||||
* @return
|
||||
*/
|
||||
List<OnlineGridMemberDTO> listOnlineGridMemberReleaseByAreaCode(String areaCode);
|
||||
|
||||
/**
|
||||
* 认证并绑定网格员
|
||||
*
|
||||
* @param gridUserAuthBindVO
|
||||
* @return
|
||||
*/
|
||||
GridUserAuthBindDTO getAuthAndBindResult(GridUserAuthBindVO gridUserAuthBindVO);
|
||||
}
|
||||
|
@ -5,19 +5,24 @@ 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.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.pos.userexpand.UserExpandPO;
|
||||
import cn.com.tenlion.usercenter.pojo.vos.userexpand.GridUserAuthBindVO;
|
||||
import cn.com.tenlion.usercenter.pojo.vos.userexpand.UserExpandVO;
|
||||
import cn.com.tenlion.usercenter.service.userexpand.IUserExpandService;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.exceptions.ParamsException;
|
||||
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.interfaces.user.IUserBaseService;
|
||||
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.IMongoDataService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||
@ -26,12 +31,15 @@ import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.pos.DepartmentPO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.pojo.session.WebSocketSession;
|
||||
import ink.wgink.service.user.pojo.pos.UserPO;
|
||||
import ink.wgink.service.user.service.IUserService;
|
||||
import ink.wgink.util.ArrayListUtil;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import ink.wgink.util.string.WStringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -52,7 +60,7 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
@Autowired
|
||||
private ParamsConfigProperties paramsConfigProperties;
|
||||
@Autowired
|
||||
private IUserBaseService userBaseService;
|
||||
private IUserService userService;
|
||||
@Autowired
|
||||
private IUserExpandDao userExpandDao;
|
||||
@Autowired
|
||||
@ -62,10 +70,17 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
@Autowired
|
||||
private IRoleUserBaseService roleUserBaseService;
|
||||
@Autowired
|
||||
private IGridRelationService gridRelationService;
|
||||
@Autowired
|
||||
private IGridService gridService;
|
||||
@Autowired
|
||||
private IMongoDataService mongoDataService;
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
private static final String SMC_STATE_DELETE = "delete";
|
||||
private static final String SMC_STATE_BIND = "bind";
|
||||
|
||||
|
||||
@Override
|
||||
public String getRoute() {
|
||||
return "route/user-expand/update";
|
||||
@ -73,7 +88,7 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
|
||||
@Override
|
||||
public UserExpandDTO get(String userId) {
|
||||
UserDTO userDTO = userBaseService.get(userId);
|
||||
UserDTO userDTO = userService.get(userId);
|
||||
if (userDTO == null) {
|
||||
throw new SearchException("用户不存在");
|
||||
}
|
||||
@ -94,7 +109,7 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
|
||||
@Override
|
||||
public List<UserExpandDTO> listByUserIds(List<String> userIds) {
|
||||
List<UserDTO> userDTOs = userBaseService.listByUserIds(userIds);
|
||||
List<UserDTO> userDTOs = userService.listByUserIds(userIds);
|
||||
if (userDTOs.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@ -106,7 +121,7 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
|
||||
@Override
|
||||
public List<UserExpandDTO> listByUsernames(List<String> usernames) {
|
||||
List<UserDTO> userDTOs = userBaseService.listByUsernames(usernames);
|
||||
List<UserDTO> userDTOs = userService.listByUsernames(usernames);
|
||||
if (userDTOs.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@ -217,7 +232,7 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
* @throws Exception
|
||||
*/
|
||||
private void setSMCMeeting(String userId, Map<String, Object> params) throws Exception {
|
||||
UserDTO userDTO = userBaseService.get(userId);
|
||||
UserDTO userDTO = userService.get(userId);
|
||||
SMCMeetingDTO meeting = HuaWeiSMCManager.createMeeting(userDTO.getUserName(), userDTO.getUserUsername());
|
||||
LOG.debug("meeting: {}", meeting);
|
||||
params.put("smcMeetingId", meeting.getMeetingId());
|
||||
@ -235,7 +250,7 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
|
||||
@Override
|
||||
public List<UserExpandDTO> listByUserIdsAndAreaCode(List<String> userIds, String areaCode) {
|
||||
List<UserDTO> userDTOs = userBaseService.listByUserIds(userIds);
|
||||
List<UserDTO> userDTOs = userService.listByUserIds(userIds);
|
||||
if (userDTOs.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@ -307,7 +322,7 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
onlineUserIds.add(webSocketSession.getUserId());
|
||||
});
|
||||
LOG.debug("area code: {}, user count: {}, online user count", areaCode, userExpandDTOs.size(), webSocketSessions.size());
|
||||
return userBaseService.listByUserIds(onlineUserIds);
|
||||
return userService.listByUserIds(onlineUserIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -334,7 +349,7 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
onlineUserIds.add(webSocketSession.getUserId());
|
||||
});
|
||||
// 在线用户列表
|
||||
List<UserDTO> userDTOs = userBaseService.listByUserIds(onlineUserIds);
|
||||
List<UserDTO> userDTOs = userService.listByUserIds(onlineUserIds);
|
||||
LOG.debug("build online grid member list");
|
||||
List<OnlineGridMemberDTO> gridMemberDTOs = new ArrayList<>();
|
||||
userDTOs.forEach(userDTO -> {
|
||||
@ -361,6 +376,31 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
||||
return gridMemberDTOs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GridUserAuthBindDTO getAuthAndBindResult(GridUserAuthBindVO gridUserAuthBindVO) {
|
||||
// 查询小程序端要绑定的网格员账号是否正确
|
||||
UserPO userPO = userService.getPOByUsername(gridUserAuthBindVO.getUsername());
|
||||
if (passwordEncoder.matches(userPO.getUserPassword(), gridUserAuthBindVO.getPassword())) {
|
||||
throw new ParamsException("用户名密码不匹配");
|
||||
}
|
||||
GridUserAuthBindDTO gridUserAuthBindDTO = new GridUserAuthBindDTO();
|
||||
gridUserAuthBindDTO.setUserId(userPO.getUserId());
|
||||
// 查询用户信息
|
||||
UserExpandPO userExpandPO = getPO(userPO.getUserId());
|
||||
if (userExpandPO != null) {
|
||||
gridUserAuthBindDTO.setAreaCode(userExpandPO.getAreaCode());
|
||||
gridUserAuthBindDTO.setUserLevel(userExpandPO.getUserLevel());
|
||||
}
|
||||
// 查询网格信息
|
||||
List<String> gridIds = gridRelationService.listGridId(userPO.getUserId());
|
||||
if (!gridIds.isEmpty()) {
|
||||
List<GridDTO> gridDTOS = gridService.list(gridIds);
|
||||
List<String> gridCodes = ArrayListUtil.listBeanStringIdValue(gridDTOS, "gridCode", GridDTO.class);
|
||||
gridUserAuthBindDTO.setAreaCodes(gridCodes);
|
||||
}
|
||||
return gridUserAuthBindDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user