Browse Source

添加获取当前登录人的所属社区接口

dev
wanggongfeng 3 years ago
parent
commit
92da71db35
  1. 28
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CurrentUserCommunityInfoResultDTO.java
  2. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  3. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  4. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  5. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  6. 15
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

28
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CurrentUserCommunityInfoResultDTO.java

@ -0,0 +1,28 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 当前登陆人的所属社区
* @Author wgf
* @Date 2020/11/30 22:35
*/
@Data
public class CurrentUserCommunityInfoResultDTO implements Serializable {
private static final long serialVersionUID = 4360690752084258055L;
/**
* 组织ID
*/
private String orgId;
/**
* 名称
*/
private String orgName;
}

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

@ -505,5 +505,17 @@ public class CustomerAgencyController {
return customerAgencyService.getCommunityInfoByUserId(userId); return customerAgencyService.getCommunityInfoByUserId(userId);
} }
/**
* @param tokenDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.CommunityInfoResultDTO>
* @Author wgf
* @Description 获取当前登录人的所属社区
* @Date 2022/11/30 22:41
**/
@PostMapping("getCurrentUserCommunityInfo")
public Result<List<CurrentUserCommunityInfoResultDTO>> getCurrentUserCommunityInfo(@LoginUser TokenDto tokenDTO) {
return customerAgencyService.getCurrentUserCommunityInfo(tokenDTO);
}
} }

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

@ -398,5 +398,9 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<String> getUsingCommunityList(@Param("customerId") String customerId, @Param("agencyId") String agencyId, @Param("agencyOrgIdPath") String agencyOrgIdPath, @Param("endDate") Date endDate); List<String> getUsingCommunityList(@Param("customerId") String customerId, @Param("agencyId") String agencyId, @Param("agencyOrgIdPath") String agencyOrgIdPath, @Param("endDate") Date endDate);
List<String> getCommunitysByOrgIdPath(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("orgIdPath") String orgIdPath); List<String> getCommunitysByOrgIdPath(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("orgIdPath") String orgIdPath);
List<CurrentUserCommunityInfoResultDTO> getCurrentUserCommunityInfo(@Param("customerId") String customerId,@Param("staffAgencyId")String staffAgencyId);
} }

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

@ -18,7 +18,9 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
@ -344,4 +346,13 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @Date 2022/6/21 22:41 * @Date 2022/6/21 22:41
**/ **/
Result<CommunityInfoResultDTO> getCommunityInfoByUserId(String userId); Result<CommunityInfoResultDTO> getCommunityInfoByUserId(String userId);
/**
* @param tokenDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.CommunityInfoResultDTO>
* @Author wgf
* @Description 获取当前登录人的所属社区
* @Date 2022/11/30 22:41
**/
Result<List<CurrentUserCommunityInfoResultDTO>> getCurrentUserCommunityInfo(TokenDto tokenDTO);
} }

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

@ -35,6 +35,7 @@ import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerAgencyConstant; import com.epmet.constant.CustomerAgencyConstant;
@ -1594,4 +1595,16 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return new Result<CommunityInfoResultDTO>().ok(communityInfoResultDTO); return new Result<CommunityInfoResultDTO>().ok(communityInfoResultDTO);
} }
@Override
public Result<List<CurrentUserCommunityInfoResultDTO>> getCurrentUserCommunityInfo(TokenDto tokenDTO) {
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(tokenDTO.getCustomerId(), tokenDTO.getUserId());
if (null == staffInfoCacheResult || StringUtils.isBlank(staffInfoCacheResult.getAgencyId())) {
log.warn("com.epmet.service.impl.CustomerAgencyServiceImpl.getMySubAgencyList,没有找到工作人员所属的机关信息,用户Id:{}", tokenDTO.getUserId());
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取用户组织信息异常","获取用户组织信息异常");
}
List<CurrentUserCommunityInfoResultDTO> list = baseDao.getCurrentUserCommunityInfo(tokenDTO.getCustomerId(),staffInfoCacheResult.getAgencyId());
return new Result<List<CurrentUserCommunityInfoResultDTO>>().ok(list);
}
} }

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

@ -1040,4 +1040,19 @@
having community_count > 0 having community_count > 0
order by created_time desc) t order by created_time desc) t
</select> </select>
<select id="getCurrentUserCommunityInfo"
resultType="com.epmet.dto.result.CurrentUserCommunityInfoResultDTO">
select
ID AS orgId,
ORGANIZATION_NAME AS orgName
from customer_agency
where DEL_FLAG = 0
and LEVEL = 'community'
AND CUSTOMER_ID = #{customerId}
<if test="staffAgencyId != null and staffAgencyId != ''">
AND PIDS like concat('%',#{staffAgencyId},'%')
</if>
</select>
</mapper> </mapper>

Loading…
Cancel
Save