Browse Source

Merge remote-tracking branch 'origin/dev_ic_platform' into dev_ic_platform

dev_shibei_match
yinzuomei 4 years ago
parent
commit
956a1932e6
  1. 162
      epmet-auth/src/main/java/com/epmet/controller/IcLoinController.java
  2. 24
      epmet-auth/src/main/java/com/epmet/controller/LoginController.java
  3. 32
      epmet-auth/src/main/java/com/epmet/dto/form/LoginByPassWordFormDTO.java
  4. 25
      epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java
  5. 9
      epmet-auth/src/main/java/com/epmet/redis/IcLoginTicketCacheBean.java
  6. 10
      epmet-auth/src/main/java/com/epmet/service/CaptchaService.java
  7. 9
      epmet-auth/src/main/java/com/epmet/service/IcLoginService.java
  8. 12
      epmet-auth/src/main/java/com/epmet/service/impl/CaptchaServiceImpl.java
  9. 177
      epmet-auth/src/main/java/com/epmet/service/impl/IcLoginServiceImpl.java
  10. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java
  11. 19
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java
  12. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  13. 20
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  14. 81
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/IcTokenDto.java
  15. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyIdFormDTO.java
  16. 17
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseFormDTO.java
  17. 19
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RootOrgListByStaffIdFormDTO.java
  18. 19
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingDTO.java
  19. 19
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridTreeResultDTO.java
  20. 17
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseResultDTO.java
  21. 19
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodDTO.java
  22. 18
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitDTO.java
  23. 11
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  24. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  25. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  26. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  27. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
  28. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcBuildingController.java
  29. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcBuildingUnitController.java
  30. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java
  31. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java
  32. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  33. 36
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  34. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  35. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  36. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingService.java
  37. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingUnitService.java
  38. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java
  39. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java
  40. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  41. 41
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  42. 36
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingServiceImpl.java
  43. 36
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingUnitServiceImpl.java
  44. 35
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java
  45. 36
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java
  46. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  47. 18
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml.rej
  48. 63
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  49. 23
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffBasicInfoByMobileFromDTO.java

162
epmet-auth/src/main/java/com/epmet/controller/IcLoinController.java

@ -0,0 +1,162 @@
package com.epmet.controller;
import cn.hutool.core.bean.BeanUtil;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.LoginByPassWordFormDTO;
import com.epmet.dto.form.RootOrgListByStaffIdFormDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.redis.CaptchaRedis;
import com.epmet.redis.IcLoginTicketCacheBean;
import com.epmet.service.IcLoginService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
@RestController
@RequestMapping("ic")
public class IcLoinController implements ResultDataResolver {
public static final long IC_LOGIN_TICKET_EXPIRE_SECONDS = 2 * 60l;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private CaptchaRedis captchaRedis;
@Autowired
private IcLoginService icLoginService;
@Autowired
private RedisUtils redisUtils;
/**
* @description 基层治理赋能平台-根据手机号密码获取组织列表
*
* @param input
* @return
* @author wxz
* @date 2021.10.25 09:56:33
*/
@PostMapping("getmyorgsbypassword")
public Result<HashMap<String, Object>> getMyOrgsByPassword(@RequestBody LoginByPassWordFormDTO input) {
ValidatorUtils.validateEntity(input, LoginByPassWordFormDTO.IcGetOrgsByPwdGroup.class);
String captcha = input.getCaptcha();
String mobile = input.getMobile();
String password = input.getPassword();
String uuid = input.getUuid();
// 图片验证码
String captchaInCache = captchaRedis.getIcLoginCaptcha(uuid);
if (StringUtils.isBlank(captchaInCache) || !captcha.equals(captchaInCache)) {
throw new RenException(EpmetErrorCode.ERR10019.getCode());
}
// 获取用户信息
Result<List<CustomerStaffDTO>> staffResult = epmetUserFeignClient.checkCustomerStaff(mobile);
List<CustomerStaffDTO> staffList = getResultDataOrThrowsException(staffResult, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【基层治理平台登录】获取用户信息失败");
if (CollectionUtils.isEmpty(staffList)) {
throw new RenException(EpmetErrorCode.ERR10003.getCode());
}
CustomerStaffDTO staffInfo = staffList.get(0);
if (!PasswordUtils.matches(password, staffInfo.getPassword())) {
throw new RenException(EpmetErrorCode.ERR10004.getCode());
}
String staffId = staffInfo.getUserId();
// 查询跟组织列表
RootOrgListByStaffIdFormDTO orgListForm = new RootOrgListByStaffIdFormDTO();
orgListForm.setStaffId(staffId);
Result<List<StaffOrgsResultDTO>> orgListResult = govOrgOpenFeignClient.getStaffOrgListByStaffId(orgListForm);
List<StaffOrgsResultDTO> orgs = getResultDataOrThrowsException(orgListResult, ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【基层治理平台登录】根据staffId查询所属客户跟组织列表失败");
// 生成登录票据
String ticket = UUID.randomUUID().toString().replace("-", "");
IcLoginTicketCacheBean ticketCacheBean = new IcLoginTicketCacheBean();
ticketCacheBean.setMobile(mobile);
ticketCacheBean.setStaffId(staffId);
cacheTicket(ticket, ticketCacheBean);
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("staffId", staffId);
resultMap.put("ticket", ticket);
resultMap.put("orgs", orgs);
return new Result<HashMap<String, Object>>().ok(resultMap);
}
/**
* @description IC登录
*
* @param input
* @return
* @author wxz
* @date 2021.10.25 21:14:22
*/
@PostMapping("login")
public Result<UserTokenResultDTO> login(@RequestBody LoginByPassWordFormDTO input) {
ValidatorUtils.validateEntity(input, LoginByPassWordFormDTO.IcLoginGroup.class);
String ticket = input.getTicket();
String orgId = input.getRootAgencyId();
String staffId = input.getStaffId();
// ticket校验
IcLoginTicketCacheBean ticketCache = getTicketCache(ticket);
if (ticketCache == null || !ticketCache.getStaffId().equals(staffId)) {
// ticket&userId不对应
throw new RenException(EpmetErrorCode.ERR10008.getCode());
}
UserTokenResultDTO tokenInfo = icLoginService.login(staffId, orgId);
return new Result<UserTokenResultDTO>().ok(tokenInfo);
}
private void cacheTicket(String ticket, IcLoginTicketCacheBean cacheBean) {
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(cacheBean, false, true);
redisUtils.hMSet(RedisKeys.loginTicket(AppClientConstant.APP_IC, ticket), stringObjectMap, IC_LOGIN_TICKET_EXPIRE_SECONDS);
}
/**
* @description 从缓存中取出ticket并删除
*
* @param ticket
* @return
* @author wxz
* @date 2021.10.26 08:58:27
*/
private IcLoginTicketCacheBean getTicketCache(String ticket) {
String key = RedisKeys.loginTicket(AppClientConstant.APP_IC, ticket);
Map<String, Object> map = redisUtils.hGetAll(key);
if (CollectionUtils.sizeIsEmpty(map)) {
return null;
}
redisUtils.expire(key, 0);
return BeanUtil.mapToBean(map, IcLoginTicketCacheBean.class, false);
}
}

24
epmet-auth/src/main/java/com/epmet/controller/LoginController.java

@ -65,6 +65,30 @@ public class LoginController {
}
}
/**
* @description 基层治理平台登录验证码
*
* @param response
* @return
* @author wxz
* @date 2021.10.25 14:19:40
*/
@GetMapping("ic-login-captcha")
public void icLoginCaptcha(HttpServletResponse response, String uuid) throws IOException {
try {
//生成图片验证码
BufferedImage image = captchaService.createIcLoginCaptcha(uuid);
response.reset();
response.setHeader("Cache-Control", "no-store, no-cache");
response.setContentType("image/jpeg");
ServletOutputStream out = response.getOutputStream();
ImageIO.write(image, "jpg", out);
out.close();
} catch (IOException e) {
log.error("获取登陆验证码异常", e);
}
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.lang.String>

32
epmet-auth/src/main/java/com/epmet/dto/form/LoginByPassWordFormDTO.java

@ -14,27 +14,53 @@ import java.io.Serializable;
public class LoginByPassWordFormDTO extends LoginCommonFormDTO implements Serializable {
private static final long serialVersionUID = -7507437651048051183L;
// 基层治理平台账号密码获取组织列表分组
public interface IcGetOrgsByPwdGroup {}
// 基层治理平台登录分组
public interface IcLoginGroup {}
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空",groups = {AddUserShowGroup.class})
private String phone;
@NotBlank(message = "手机号不能为空",groups = {IcGetOrgsByPwdGroup.class})
private String mobile;
/**
* 密码
*/
@NotBlank(message = "密码不能为空",groups = {AddUserShowGroup.class})
@NotBlank(message = "密码不能为空",groups = {AddUserShowGroup.class, IcGetOrgsByPwdGroup.class})
private String password;
/**
* 验证码
*/
@NotBlank(message="验证码不能为空",groups = {AddUserShowGroup.class})
@NotBlank(message="验证码不能为空",groups = {AddUserShowGroup.class, IcGetOrgsByPwdGroup.class})
private String captcha;
/**
* 唯一标识
*/
@NotBlank(message="唯一标识不能为空",groups = {AddUserInternalGroup.class})
@NotBlank(message="唯一标识不能为空",groups = {AddUserInternalGroup.class, IcGetOrgsByPwdGroup.class})
private String uuid;
/**
* 登录票据目前ic基层治理平台用到了
*/
@NotBlank(message="登录票据ticket不能为空", groups = {IcLoginGroup.class})
private String ticket;
/**
* 所选的要登录的组织id
*/
@NotBlank(message = "要登录的orgId不能为空", groups = { IcLoginGroup.class })
private String rootAgencyId;
/**
* 工作人员id
*/
@NotBlank(message = "人员Id不能为空", groups = { IcLoginGroup.class })
private String staffId;
}

25
epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java

@ -45,6 +45,12 @@ public class CaptchaRedis {
redisUtils.set(key, captcha, EXPIRE);
}
public void setIcLoginCaptcha(String uuid, String captcha) {
String key = RedisKeys.getIcLoginCaptchaKey(uuid);
logger.info("保存验证码key=["+key+"]");
redisUtils.set(key, captcha, EXPIRE);
}
public String get(String uuid){
String key = RedisKeys.getLoginCaptchaKey(uuid);
String captcha = (String)redisUtils.get(key);
@ -57,6 +63,25 @@ public class CaptchaRedis {
return captcha;
}
/**
* @description 基层治理平台登录验证码查询
*
* @param uuid
* @return
* @author wxz
* @date 2021.10.25 14:28:28
*/
public String getIcLoginCaptcha(String uuid) {
String key = RedisKeys.getIcLoginCaptchaKey(uuid);
String captcha = (String)redisUtils.get(key);
//删除验证码
if(captcha != null){
redisUtils.delete(key);
}
return captcha;
}
/**
* @param sendSmsCodeFormDTO appclientphone
* @param smsCode 验证码

9
epmet-auth/src/main/java/com/epmet/redis/IcLoginTicketCacheBean.java

@ -0,0 +1,9 @@
package com.epmet.redis;
import lombok.Data;
@Data
public class IcLoginTicketCacheBean {
private String staffId;
private String mobile;
}

10
epmet-auth/src/main/java/com/epmet/service/CaptchaService.java

@ -23,6 +23,16 @@ public interface CaptchaService {
*/
BufferedImage create(String uuid);
/**
* @description 基层治理平台登录验证码
*
* @param
* @return
* @author wxz
* @date 2021.10.25 14:15:30
*/
BufferedImage createIcLoginCaptcha(String uuid);
/**
* 验证码效验
* @param uuid uuid

9
epmet-auth/src/main/java/com/epmet/service/IcLoginService.java

@ -0,0 +1,9 @@
package com.epmet.service;
import com.epmet.dto.result.UserTokenResultDTO;
public interface IcLoginService {
UserTokenResultDTO login(String staffId, String orgId);
}

12
epmet-auth/src/main/java/com/epmet/service/impl/CaptchaServiceImpl.java

@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.awt.image.BufferedImage;
import java.util.UUID;
/**
* 验证码
@ -43,6 +44,17 @@ public class CaptchaServiceImpl implements CaptchaService {
return producer.createImage(captcha);
}
@Override
public BufferedImage createIcLoginCaptcha(String uuid) {
//生成验证码
String captchaText = producer.createText();
//logger.info("uuid:"+uuid+",生成的验证码:"+captcha);
//保存验证码
captchaRedis.setIcLoginCaptcha(uuid, captchaText);
return producer.createImage(captchaText);
}
@Override
public boolean validate(String uuid, String code) {
String captcha = captchaRedis.get(uuid);

177
epmet-auth/src/main/java/com/epmet/service/impl/IcLoginServiceImpl.java

@ -0,0 +1,177 @@
package com.epmet.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.epmet.auth.constants.AuthOperationConstants;
import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.security.dto.IcTokenDto;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.IpUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.jwt.JwtTokenProperties;
import com.epmet.jwt.JwtTokenUtils;
import com.epmet.service.IcLoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Service
@Slf4j
public class IcLoginServiceImpl implements IcLoginService, ResultDataResolver {
@Autowired
private JwtTokenUtils jwtTokenUtils;
@Autowired
private RedisUtils redisUtils;
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
@Autowired
private JwtTokenProperties jwtTokenProperties;
@Autowired
private EpmetMessageOpenFeignClient messageOpenFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private ThirdLoginServiceImpl thirdLoginService;
@Override
public UserTokenResultDTO login(String staffId, String orgId) {
String app = AppClientConstant.APP_IC;
String client = AppClientConstant.CLIENT_WEB;
// 1.获取用户token
String token = this.generateIcToken(staffId, app, client);
Result<CustomerAgencyDTO> agencyResult = govOrgOpenFeignClient.getAgencyById(orgId);
CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(agencyResult, ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【IC平台登录】获取组织信息失败");
// 2.缓存token
cacheToken(app, client, staffId, token, orgId, agencyInfo.getCustomerId());
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
userTokenResultDTO.setCustomerId(agencyInfo.getCustomerId());
//7.发送登录事件
try {
sendLoginEvent(staffId, app, client);
} catch (RenException e) {
log.error(e.getInternalMsg());
} catch (Exception e) {
log.error("【工作端workLogin登录】发送登录事件失败,程序继续执行。");
}
return userTokenResultDTO;
}
/**
* @param staffId
* @return
* @description 生成Ic平台的Token
* @author wxz
* @date 2021.10.26 13:42:36
*/
private String generateIcToken(String staffId, String app, String client) {
Map<String, Object> map = new HashMap<>();
map.put("app", app);
map.put("client", client);
map.put("userId", staffId);
String token = jwtTokenUtils.createToken(map);
return token;
}
/**
* @param userId
* @param fromApp
* @param fromClient
* @return
* @description 发布登录时间
* @author wxz
* @date 2021.10.26 13:45:59
*/
private void sendLoginEvent(String userId, String fromApp, String fromClient) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
LoginMQMsg loginMQMsg = new LoginMQMsg();
loginMQMsg.setUserId(userId);
loginMQMsg.setLoginTime(new Date());
loginMQMsg.setIp(IpUtils.getIpAddr(request));
loginMQMsg.setFromApp(fromApp);
loginMQMsg.setFromClient(fromClient);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(AuthOperationConstants.LOGIN);
form.setContent(loginMQMsg);
messageOpenFeignClient.sendSystemMsgByMQ(form);
}
/**
* @description 缓存token到redis
*
* @param app
* @param client
* @param userId
* @param token
* @param rootAgencyId
* @return
* @author wxz
* @date 2021.10.26 14:19:07
*/
private void cacheToken(String app,
String client,
String userId,
String token,
String rootAgencyId,
String customerId) {
IcTokenDto tokenDto = new IcTokenDto();
int expire = jwtTokenProperties.getExpire();
long expireTime = jwtTokenUtils.getExpiration(token).getTime();
tokenDto.setApp(app);
tokenDto.setClient(client);
tokenDto.setUserId(userId);
tokenDto.setToken(token);
tokenDto.setExpireTime(expireTime);
tokenDto.setRootAgencyId(rootAgencyId);
tokenDto.setCustomerId(customerId);
//设置部门,网格,角色列表
tokenDto.setDeptIdList(thirdLoginService.getDeptartmentIdList(userId));
tokenDto.setGridIdList(thirdLoginService.getGridIdList(userId));
CustomerAgencyDTO agency = thirdLoginService.getAgencyByStaffId(userId);
if (agency != null) {
tokenDto.setAgencyId(agency.getId());
tokenDto.setRoleList(thirdLoginService.queryGovStaffRoles(userId, agency.getId()));
}
tokenDto.setOrgIdPath(thirdLoginService.getOrgIdPath(userId));
String key = RedisKeys.getCpUserKey(app, client, userId);
Map<String, Object> map = BeanUtil.beanToMap(tokenDto, false, true);
redisUtils.hMSet(key, map, expire);
}
}

6
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java

@ -17,6 +17,12 @@ public interface AppClientConstant {
* app类型-运营端
*/
String APP_OPER = "oper";
/**
* 基层治理平台端
*/
String APP_IC = "ic";
/**
* PC端:web
*/

19
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.commons.tools.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/26 13:53
*/
@Data
public class OptionResultDTO implements Serializable {
private static final long serialVersionUID = 8618231166600518980L;
private String label;
private String value;
private List<OptionResultDTO> children;
}

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -19,6 +19,7 @@ public enum EpmetErrorCode {
ERR10005(10005, "token不能为空"),
ERR10006(10006, "登录超时,请重新登录"),
ERR10007(10007, "当前帐号已在别处登录"),
ERR10008(10008, "Ticket错误"),
ERR10019(10019, "验证码不正确"),
SYSTEM_MQ_MSG_SEND_FAIL(10020, "MQ消息发送失败"),
ERR401(401, "未授权"),

20
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -38,6 +38,13 @@ public class RedisKeys {
return rootPrefix.concat("sys:captcha:").concat(uuid);
}
/**
* 登录验证码Key
*/
public static String getIcLoginCaptchaKey(String uuid) {
return rootPrefix.concat("sys:captcha:iclogin:").concat(uuid);
}
/**
* 登录用户Key
*/
@ -559,4 +566,17 @@ public class RedisKeys {
public static String blockedMqMsgKey(String blockedMsgLabel) {
return rootPrefix.concat("message:mq:blocked:").concat(blockedMsgLabel);
}
/**
* @description 登录票据目前只有IC基层治理平台用到
*
* @param app
* @param ticket
* @return
* @author wxz
* @date 2021.10.25 17:49:43
*/
public static String loginTicket(String app, String ticket) {
return rootPrefix.concat("sys:security:ticket:").concat(app).concat(":").concat(ticket);
}
}

81
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/IcTokenDto.java

@ -0,0 +1,81 @@
package com.epmet.commons.tools.security.dto;
import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Set;
/**
* @Description ic平台token
* @author wxz
* @date 2021.10.26 13:58:03
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IcTokenDto extends BaseTokenDto {
/**
* 当前登录的组织id(顶级)
*/
private String rootAgencyId;
/**
* 当前用户所属的机关单位id
*/
private String agencyId;
/**
* 当前网格对应的组织结构id的全路径用:隔开
*/
private String orgIdPath;
/**
* 当前所在网格id
*/
private String gridId;
/***
* 所在网格列表
*/
private Set<String> gridIdList;
/**
* 部门id列表
*/
private Set<String> deptIdList;
/**
* 功能权限列表实际上是gov_staff => staff_role => role_operation查询到的operationKey
*/
private Set<String> permissions;
/**
* 角色ID列表
*/
private List<GovTokenDto.Role> roleList;
/**
* 过期时间戳
*/
private Long expireTime;
@Data
public static class Role {
private String id;
private String roleKey;
private String roleName;
public Role() {
}
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyIdFormDTO.java

@ -2,6 +2,7 @@ package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
@ -16,5 +17,6 @@ public class AgencyIdFormDTO implements Serializable {
/**
* 部门Id
*/
@NotBlank(message = "组织机构ID不能为空")
private String agencyId;
}

17
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseFormDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/25 17:03
*/
@Data
public class HouseFormDTO implements Serializable {
private static final long serialVersionUID = 2636608477324780974L;
private String buildingId;
private String unitId;
}

19
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RootOrgListByStaffIdFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description 客户id查询跟组织列表
* @author wxz
* @date 2021.10.25 14:53:09
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RootOrgListByStaffIdFormDTO {
private String staffId;
}

19
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/25 15:03
*/
@Data
public class BuildingDTO implements Serializable {
private static final long serialVersionUID = -2129418426919785999L;
private String buildingId;
private String buildingName;
private List<UnitDTO> unitList;
}

19
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridTreeResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/25 15:08
*/
@Data
public class GridTreeResultDTO implements Serializable {
private static final long serialVersionUID = -6506457371074529990L;
private String gridId;
private String gridName;
private List<NeighborHoodDTO> neighborHoodList;
}

17
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseResultDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/25 16:58
*/
@Data
public class HouseResultDTO implements Serializable {
private static final long serialVersionUID = 8054109017922254586L;
private String houseId;
private String houseName;
}

19
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/25 15:06
*/
@Data
public class NeighborHoodDTO implements Serializable {
private static final long serialVersionUID = 1644088283259175745L;
private String neighborHoodId;
private String neighborHoodName;
private List<BuildingDTO> buildingList;
}

18
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitDTO.java

@ -0,0 +1,18 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/25 15:04
*/
@Data
public class UnitDTO implements Serializable {
private static final long serialVersionUID = -919268879670510057L;
private String unitId;
private String unitName;
}

11
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -187,6 +187,17 @@ public interface GovOrgOpenFeignClient {
@PostMapping(value = "/gov/org/customeragency/getStaffOrgList",consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<StaffOrgsResultDTO>> getStaffOrgList(StaffOrgFormDTO staffOrgFormDTO);
/**
* @description 通过staffId查询跟组织列表
*
* @param input
* @return
* @author wxz
* @date 2021.10.25 14:53:53
*/
@PostMapping("/gov/org/customeragency/root-orglist-by-staffid")
Result<List<StaffOrgsResultDTO>> getStaffOrgListByStaffId(@RequestBody RootOrgListByStaffIdFormDTO input);
/**
* @Description 查询一个网格下的所有工作人员
* @param gridIdFormDTO

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -113,6 +113,11 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffOrgList", staffOrgFormDTO);
}
@Override
public Result<List<StaffOrgsResultDTO>> getStaffOrgListByStaffId(RootOrgListByStaffIdFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffOrgListByStaffId", input);
}
@Override
public Result<List<String>> getGridStaffs(CommonGridIdFormDTO gridIdFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridStaffs", gridIdFormDTO);

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -339,4 +339,22 @@ public class CustomerAgencyController {
return new Result<AgencyTreeResultDTO>().ok(customerAgencyService.getAgencyList(formDTO));
}
/**
* @description 通过staffId查询跟组织列表
*
* @param input
* @return
* @author wxz
* @date 2021.10.25 14:53:53
*/
@PostMapping("root-orglist-by-staffid")
public Result<List<StaffOrgsResultDTO>> getStaffOrgListByStaffId(@RequestBody RootOrgListByStaffIdFormDTO input) {
ValidatorUtils.validateEntity(input);
String staffId = input.getStaffId();
List<StaffOrgsResultDTO> orgList = customerAgencyService.getStaffOrgListByStaffId(staffId);
return new Result<List<StaffOrgsResultDTO>>().ok(orgList);
}
}

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java

@ -17,6 +17,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
@ -286,4 +287,17 @@ public class CustomerGridController {
return new Result<List<String>>().ok(customerGridService.selectOrgsByUserId(userId));
}
/**
* @Description 获取组织下网格选项
* @Param formDTO
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:02
*/
@PostMapping("gridoption")
public Result<List<OptionResultDTO>> getGridOption(@RequestBody AgencyIdFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
return new Result<List<OptionResultDTO>>().ok(customerGridService.getGridOption(formDTO.getAgencyId()));
}
}

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java

@ -184,4 +184,10 @@ public class GridController {
CustomerGridDTO gridInfo = customerGridService.getBaseInfo(customerGridFormDTO);
return new Result<CustomerGridDTO>().ok(gridInfo);
}
@PostMapping("gridtree")
public Result<List<GridTreeResultDTO>> getGridTree(@RequestBody AgencyIdFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<GridTreeResultDTO>>().ok(customerGridService.getGridTree(formDTO));
}
}

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcBuildingController.java

@ -17,6 +17,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -29,6 +30,7 @@ import com.epmet.service.IcBuildingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -81,5 +83,15 @@ public class IcBuildingController {
return new Result();
}
/**
* @Description 获取小区内的楼栋
* @Param dto
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:46
*/
@PostMapping("buildingoption")
public Result<List<OptionResultDTO>> getBuildingOptions(IcBuildingDTO dto) {
return new Result<List<OptionResultDTO>>().ok(icBuildingService.getBuildingOptions(dto.getNeighborHoodId()));
}
}

17
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcBuildingUnitController.java

@ -17,20 +17,19 @@
package com.epmet.controller;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcBuildingUnitDTO;
import com.epmet.service.IcBuildingUnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@ -83,5 +82,15 @@ public class IcBuildingUnitController {
icBuildingUnitService.delete(ids);
return new Result();
}
/**
* @Description 获取楼栋内单元
* @Param dto
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:46
*/
@PostMapping("unitoption")
public Result<List<OptionResultDTO>> getUnitOptions(IcBuildingUnitDTO dto) {
return new Result<List<OptionResultDTO>>().ok(icBuildingUnitService.getUnitOptions(dto.getBuildingId()));
}
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java

@ -17,6 +17,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -25,10 +26,12 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.service.IcHouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -80,6 +83,9 @@ public class IcHouseController {
icHouseService.delete(ids);
return new Result();
}
@PostMapping("houseoption")
public Result<List<OptionResultDTO>> getHouseOption(@RequestBody HouseFormDTO formDTO){
return new Result<List<OptionResultDTO>>().ok(icHouseService.getHouseOption(formDTO));
}
}

17
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java

@ -17,20 +17,19 @@
package com.epmet.controller;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.service.IcNeighborHoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@ -84,4 +83,16 @@ public class IcNeighborHoodController {
return new Result();
}
/**
* @Description 获取网格下小区列表
* @Param dto
* @Return {@link Result< List< OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:38
*/
@PostMapping("neighborhoodoption")
public Result<List<OptionResultDTO>> getNeighborHoodOptions(IcNeighborHoodDTO dto) {
return new Result<List<OptionResultDTO>>().ok(icNeighborHoodService.getNeighborHoodOptions(dto.getGridId()));
}
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -244,6 +244,8 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<AgencyTreeResultDTO> getSubAgencyList(@Param("pid") String pid);
List<StaffOrgsResultDTO> getStaffOrgListByStaffId(@Param("staffId") String staffId);
/**
* @Description 地图配置删除
* @param orgId

36
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -300,4 +300,40 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @date 2021/8/5 10:08 上午
*/
List<String> selectOrgsByUserId(@Param("userId") String userId);
/**
* @Description 查询组织下的网格及网格下的小区单元楼栋
* @Param agencyId
* @Return {@link List< GridTreeResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/25 15:19
*/
List<GridTreeResultDTO> selectGridTree(@Param("agencyId") String agencyId);
/**
* @Description 网格下小区列表
* @Param gridId
* @Return {@link List< NeighborHoodDTO>}
* @Author zhaoqifeng
* @Date 2021/10/25 16:04
*/
List<NeighborHoodDTO> selectNeighborHoodList(@Param("gridId") String gridId);
/**
* @Description 小区下楼栋列表
* @Param neighborHoodId
* @Return {@link List< BuildingDTO>}
* @Author zhaoqifeng
* @Date 2021/10/25 16:04
*/
List<BuildingDTO> selectBuildingList(@Param("neighborHoodId") String neighborHoodId);
/**
* @Description 楼栋下单元列表
* @Param buildingId
* @Return {@link List< UnitDTO>}
* @Author zhaoqifeng
* @Date 2021/10/25 16:04
*/
List<UnitDTO> selectUnitList(@Param("buildingId") String buildingId);
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -255,4 +255,6 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @Date 2021/9/8 15:21
*/
AgencyTreeResultDTO getAgencyList(GetAgencyListFormDTO formDTO);
List<StaffOrgsResultDTO> getStaffOrgListByStaffId(String staffId);
}

19
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -18,6 +18,7 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
@ -319,4 +320,22 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @date 2021/8/5 10:08 上午
*/
List<String> selectOrgsByUserId(String userId);
/**
* @Description 获取组织下网格树
* @Param formDTO
* @Return {@link List<GridTreeResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/25 16:28
*/
List<GridTreeResultDTO> getGridTree(AgencyIdFormDTO formDTO);
/**
* @Description 获取组织下网格选项
* @Param agencyId
* @Return {@link List< OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:01
*/
List<OptionResultDTO> getGridOption(String agencyId);
}

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingService.java

@ -18,6 +18,7 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcBuildingDTO;
import com.epmet.entity.IcBuildingEntity;
@ -92,4 +93,13 @@ public interface IcBuildingService extends BaseService<IcBuildingEntity> {
* @date 2021-10-25
*/
void delete(String[] ids);
/**
* @Description 获取小区内的楼栋
* @Param neighborHoodId
* @Return {@link List< OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:43
*/
List<OptionResultDTO> getBuildingOptions(String neighborHoodId);
}

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingUnitService.java

@ -18,6 +18,7 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcBuildingUnitDTO;
import com.epmet.entity.IcBuildingUnitEntity;
@ -92,4 +93,13 @@ public interface IcBuildingUnitService extends BaseService<IcBuildingUnitEntity>
* @date 2021-10-25
*/
void delete(String[] ids);
/**
* @Description 获取楼栋内单元
* @Param buildingId
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:49
*/
List<OptionResultDTO> getUnitOptions(String buildingId);
}

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java

@ -18,8 +18,10 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.entity.IcHouseEntity;
import java.util.List;
@ -92,4 +94,13 @@ public interface IcHouseService extends BaseService<IcHouseEntity> {
* @date 2021-10-25
*/
void delete(String[] ids);
/**
* @Description 获取楼栋房屋列表
* @Param formDTO
* @Return {@link List<HouseFormDTO>}
* @Author zhaoqifeng
* @Date 2021/10/25 17:04
*/
List<OptionResultDTO> getHouseOption(HouseFormDTO formDTO);
}

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java

@ -18,6 +18,7 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.entity.IcNeighborHoodEntity;
@ -92,4 +93,13 @@ public interface IcNeighborHoodService extends BaseService<IcNeighborHoodEntity>
* @date 2021-10-25
*/
void delete(String[] ids);
/**
* @Description 获取网格下小区列表
* @Param gridId
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:32
*/
List<OptionResultDTO> getNeighborHoodOptions(String gridId);
}

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -1124,4 +1124,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
}
}
@Override
public List<StaffOrgsResultDTO> getStaffOrgListByStaffId(String staffId) {
return baseDao.getStaffOrgListByStaffId(staffId);
}
}

41
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -18,6 +18,7 @@
package com.epmet.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -25,6 +26,7 @@ import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
@ -50,6 +52,7 @@ import com.epmet.service.CustomerAgencyService;
import com.epmet.service.CustomerGridService;
import com.epmet.util.ModuleConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -818,4 +821,42 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
public List<String> selectOrgsByUserId(String userId) {
return baseDao.selectOrgsByUserId(userId);
}
/**
* @param formDTO
* @Description 获取组织下网格树
* @Param formDTO
* @Return {@link List<GridTreeResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/25 16:28
*/
@Override
public List<GridTreeResultDTO> getGridTree(AgencyIdFormDTO formDTO) {
return baseDao.selectGridTree(formDTO.getAgencyId());
}
/**
* @param agencyId
* @Description 获取组织下网格选项
* @Param agencyId
* @Return {@link List< OptionResultDTO >}
* @Author zhaoqifeng
* @Date 2021/10/26 14:01
*/
@Override
public List<OptionResultDTO> getGridOption(String agencyId) {
LambdaQueryWrapper<CustomerGridEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CustomerGridEntity::getPid, agencyId);
wrapper.last("ORDER BY CONVERT ( GRID_NAME USING gbk ) ASC");
List<CustomerGridEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
OptionResultDTO dto = new OptionResultDTO();
dto.setLabel(item.getGridName());
dto.setValue(item.getId());
return dto;
}).collect(Collectors.toList());
}
}

36
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingServiceImpl.java

@ -17,24 +17,28 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.IcBuildingDao;
import com.epmet.dto.IcBuildingDTO;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.service.IcBuildingService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 楼栋信息
@ -98,4 +102,32 @@ public class IcBuildingServiceImpl extends BaseServiceImpl<IcBuildingDao, IcBuil
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param neighborHoodId
* @Description 获取小区内的楼栋
* @Param neighborHoodId
* @Return {@link List< OptionResultDTO >}
* @Author zhaoqifeng
* @Date 2021/10/26 14:43
*/
@Override
public List<OptionResultDTO> getBuildingOptions(String neighborHoodId) {
if (StringUtils.isBlank(neighborHoodId)) {
return Collections.emptyList();
}
LambdaQueryWrapper<IcBuildingEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcBuildingEntity::getNeighborHoodId, neighborHoodId);
wrapper.last("ORDER BY CONVERT ( BUILDING_NAME USING gbk ) ASC");
List<IcBuildingEntity> list = baseDao.selectList(wrapper);
if(CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
OptionResultDTO dto = new OptionResultDTO();
dto.setValue(item.getId());
dto.setLabel(item.getBuildingName());
return dto;
}).collect(Collectors.toList());
}
}

36
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingUnitServiceImpl.java

@ -17,24 +17,28 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.IcBuildingUnitDao;
import com.epmet.dto.IcBuildingUnitDTO;
import com.epmet.entity.IcBuildingUnitEntity;
import com.epmet.service.IcBuildingUnitService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 楼栋单元信息
@ -98,4 +102,32 @@ public class IcBuildingUnitServiceImpl extends BaseServiceImpl<IcBuildingUnitDao
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param buildingId
* @Description 获取楼栋内单元
* @Param buildingId
* @Return {@link List<OptionResultDTO >}
* @Author zhaoqifeng
* @Date 2021/10/26 14:49
*/
@Override
public List<OptionResultDTO> getUnitOptions(String buildingId) {
if (StringUtils.isBlank(buildingId)) {
return Collections.emptyList();
}
LambdaQueryWrapper<IcBuildingUnitEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcBuildingUnitEntity::getBuildingId, buildingId);
wrapper.last("ORDER BY CONVERT ( UNIT_NAME USING gbk ) ASC");
List<IcBuildingUnitEntity> list = baseDao.selectList(wrapper);
if(CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
OptionResultDTO dto = new OptionResultDTO();
dto.setValue(item.getId());
dto.setLabel(item.getUnitName());
return dto;
}).collect(Collectors.toList());
}
}

35
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java

@ -17,23 +17,29 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcHouseDao;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.entity.IcHouseEntity;
import com.epmet.service.IcHouseService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 房屋信息
@ -97,4 +103,33 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param formDTO
* @Description 获取楼栋房屋列表
* @Param formDTO
* @Return {@link List<HouseFormDTO>}
* @Author zhaoqifeng
* @Date 2021/10/25 17:04
*/
@Override
public List<OptionResultDTO> getHouseOption(HouseFormDTO formDTO) {
if (StringUtils.isBlank(formDTO.getBuildingId()) && StringUtils.isBlank(formDTO.getUnitId())) {
return Collections.emptyList();
}
LambdaQueryWrapper<IcHouseEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(formDTO.getBuildingId()), IcHouseEntity::getBuildingId, formDTO.getBuildingId());
wrapper.eq(StringUtils.isNotBlank(formDTO.getUnitId()), IcHouseEntity::getBuildingUnitId, formDTO.getUnitId());
wrapper.last("ORDER BY CONVERT ( HOUSE_NAME USING gbk ) ASC");
List<IcHouseEntity> list = baseDao.selectList(wrapper);
if(CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
OptionResultDTO dto = new OptionResultDTO();
dto.setValue(item.getId());
dto.setLabel(item.getHouseName());
return dto;
}).collect(Collectors.toList());
}
}

36
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -17,24 +17,28 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.IcNeighborHoodDao;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.service.IcNeighborHoodService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 小区表
@ -98,4 +102,32 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param gridId
* @Description 获取网格下小区列表
* @Param gridId
* @Return {@link List< OptionResultDTO >}
* @Author zhaoqifeng
* @Date 2021/10/26 14:32
*/
@Override
public List<OptionResultDTO> getNeighborHoodOptions(String gridId) {
if (StringUtils.isBlank(gridId)) {
return Collections.emptyList();
}
LambdaQueryWrapper<IcNeighborHoodEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcNeighborHoodEntity::getGridId, gridId);
wrapper.last("ORDER BY CONVERT ( NEIGHBOR_HOOD_NAME USING gbk ) ASC");
List<IcNeighborHoodEntity> list = baseDao.selectList(wrapper);
if(CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
OptionResultDTO dto = new OptionResultDTO();
dto.setValue(item.getId());
dto.setLabel(item.getNeighborHoodName());
return dto;
}).collect(Collectors.toList());
}
}

11
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -577,6 +577,17 @@
AND CUSTOMER_ID = #{customerId}
</select>
<select id="getStaffOrgListByStaffId" resultType="com.epmet.dto.result.StaffOrgsResultDTO">
select ca.id AS rootAgencyId,
ca.ORGANIZATION_NAME AS rootAgencyName,
ca.CUSTOMER_ID AS customerId
from customer_staff_agency csa
inner join customer_agency ca
on (csa.DEL_FLAG = 0 and ca.DEL_FLAG = 0 and csa.AGENCY_ID = ca.ID)
inner join customer_agency root on (root.DEL_FLAG = 0 and ca.CUSTOMER_ID = root.CUSTOMER_ID and root.PID = '0')
where csa.USER_ID = #{staffId}
</select>
<!-- 地图查询下级组织 -->
<select id="selectSonOrg" resultType="com.epmet.dto.result.MapSonOrgResultDTO">
SELECT

18
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml.rej

@ -0,0 +1,18 @@
diff a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml (rejected hunks)
@@ -539,4 +539,15 @@
AND CUSTOMER_ID = #{customerId}
</select>
+ <select id="getStaffOrgListByStaffId" resultType="com.epmet.dto.result.StaffOrgsResultDTO">
+ select ca.id AS rootAgencyId,
+ ca.ORGANIZATION_NAME AS rootAgencyName,
+ ca.CUSTOMER_ID AS customerId
+ from customer_staff_agency csa
+ inner join customer_agency ca
+ on (csa.DEL_FLAG = 0 and ca.DEL_FLAG = 0 and csa.AGENCY_ID = ca.ID)
+ inner join customer_agency root on (root.DEL_FLAG = 0 and ca.CUSTOMER_ID = root.CUSTOMER_ID and root.PID = '0')
+ where csa.USER_ID = #{staffId}
+ </select>
+
</mapper>
\ No newline at end of file

63
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -618,4 +618,67 @@
union ALL
SELECT agency_id AS orgId FROM customer_staff_agency WHERE del_flag = '0' and USER_ID = #{userId}
</select>
<resultMap id="GridTreeResult" type="com.epmet.dto.result.GridTreeResultDTO">
<result column="gridId" property="gridId"/>
<result column="gridName" property="gridName"/>
<collection property="neighborHoodList" ofType="com.epmet.dto.result.NeighborHoodDTO"
select="selectNeighborHoodList" column="gridId">
</collection>
</resultMap>
<select id="selectGridTree" resultMap="GridTreeResult">
select
id as gridId,
grid_name as gridName
from
customer_grid
where del_flag = '0'
and PID = #{agencyId}
</select>
<resultMap id="NeighborHoodResult" type="com.epmet.dto.result.NeighborHoodDTO">
<result column="neighborHoodId" property="neighborHoodId"/>
<result column="neighborHoodName" property="neighborHoodName"/>
<collection property="buildingList" ofType="com.epmet.dto.result.BuildingDTO"
select="selectBuildingList" column="neighborHoodId">
</collection>
</resultMap>
<select id="selectNeighborHoodList" resultMap="NeighborHoodResult">
SELECT
ID AS neighborHoodId,
NEIGHBOR_HOOD_NAME AS neighborHoodName
FROM
ic_neighbor_hood
WHERE
DEL_FLAG = '0'
AND GRID_ID = #{gridId}
</select>
<resultMap id="BuildingResult" type="com.epmet.dto.result.BuildingDTO">
<result column="buildingId" property="buildingId"/>
<result column="buildingName" property="buildingName"/>
<collection property="unitList" ofType="com.epmet.dto.result.UnitDTO"
select="selectUnitList" column="buildingId">
</collection>
</resultMap>
<select id="selectBuildingList" resultMap="BuildingResult">
SELECT
ID AS buildingId,
BUILDING_NAME AS buildingName
FROM
ic_building
WHERE
DEL_FLAG = '0'
AND NEIGHBOR_HOOD_ID = #{neighborHoodId}
</select>
<select id="selectUnitList" resultType="com.epmet.dto.result.UnitDTO">
SELECT
ID AS unitId,
UNIT_NAME AS unitName
FROM
ic_building_unit
WHERE
DEL_FLAG = '0'
AND BUILDING_ID = #{buildingId}
</select>
</mapper>

23
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffBasicInfoByMobileFromDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description
* @author wxz
* @date 2021.10.25 14:00:11
*/
@Data
public class StaffBasicInfoByMobileFromDTO implements Serializable {
private static final long serialVersionUID = 1L;
@NotBlank(message = "缺少手机号码信息")
private String mobile;
@NotBlank(message = "缺少密码")
private String password;
}
Loading…
Cancel
Save