forked from rongchao/epmet-cloud-rizhao
17 changed files with 256 additions and 8 deletions
@ -0,0 +1,13 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description 我要报事人大代表列表 |
|||
* @author wxz |
|||
* @date 2021.08.03 09:16:59 |
|||
*/ |
|||
@Data |
|||
public class ResiEventNpcListFormDTO { |
|||
private String gridId; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @Description 我要报事-人大代表列表 |
|||
* @author wxz |
|||
* @date 2021.08.03 09:12:57 |
|||
*/ |
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class ResiEventNpcResultDTO { |
|||
|
|||
private String userId; |
|||
|
|||
private String gridId; |
|||
|
|||
private String displayName; |
|||
|
|||
private String headImgUrl; |
|||
|
|||
private String agencyId; |
|||
} |
@ -1,9 +1,20 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.result.ResiEventNpcResultDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description 报事service |
|||
* @author wxz |
|||
* @date 2021.08.02 09:59:16 |
|||
*/ |
|||
public interface ResiEventService { |
|||
/** |
|||
* @Description 查询网格的人大代表列表 |
|||
* @return |
|||
* @author wxz |
|||
* @date 2021.08.03 09:29 |
|||
*/ |
|||
List<ResiEventNpcResultDTO> listNpcByGrid(String gridId); |
|||
} |
|||
|
@ -1,13 +1,54 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.feign.ResultDataResolver; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.constant.BadgeConstant; |
|||
import com.epmet.dto.form.ListUserByBadgeFormDTO; |
|||
import com.epmet.dto.result.GridInfoResultDTO; |
|||
import com.epmet.dto.result.ListUserByBadgeResultDTO; |
|||
import com.epmet.dto.result.ResiEventNpcResultDTO; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.service.ResiEventService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Description 报事service |
|||
* @author wxz |
|||
* @Description 报事service |
|||
* @date 2021.08.02 09:59:36 |
|||
*/ |
|||
*/ |
|||
@Service |
|||
public class ResiEventServiceImpl implements ResiEventService { |
|||
public class ResiEventServiceImpl implements ResiEventService, ResultDataResolver { |
|||
|
|||
@Autowired |
|||
GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
|
|||
@Override |
|||
public List<ResiEventNpcResultDTO> listNpcByGrid(String gridId) { |
|||
|
|||
// 查询网格所属的组织信息
|
|||
Result<GridInfoResultDTO> gridInfoResult = govOrgOpenFeignClient.queryGridInfo(gridId); |
|||
GridInfoResultDTO gridInfoData = getResultDataOrThrowsException(gridInfoResult, ServiceConstant.GOV_ORG_SERVER, null, null); |
|||
String parentAgencyId = gridInfoData.getParentAgencyId(); |
|||
|
|||
//查询人大代表列表
|
|||
ListUserByBadgeFormDTO npcForm = new ListUserByBadgeFormDTO(gridId, BadgeConstant.BADGE_KEY_NPC); |
|||
Result<List<ListUserByBadgeResultDTO>> npcResult = epmetUserOpenFeignClient.listUsersByBadge(npcForm); |
|||
List<ListUserByBadgeResultDTO> npcData = getResultDataOrThrowsException(npcResult, ServiceConstant.EPMET_USER_SERVER, null, null); |
|||
|
|||
List<ResiEventNpcResultDTO> npcResultList = npcData.stream() |
|||
.map(npc -> new ResiEventNpcResultDTO(npc.getUserId(), gridId, "人大代表-".concat(npc.getRealName()), npc.getHeadImgUrl(), parentAgencyId)) |
|||
.collect(Collectors.toList()); |
|||
|
|||
return npcResultList; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,20 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class ListUserByBadgeFormDTO { |
|||
|
|||
@NotBlank(message = "网格ID不能为空") |
|||
private String gridId; |
|||
|
|||
@NotBlank(message = "徽章key不能为空") |
|||
private String badgeKey; |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
/** |
|||
* @author wxz |
|||
* @Description 根据徽章查询用户结果集 |
|||
* @date 2021.08.02 10:23:37 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class ListUserByBadgeResultDTO { |
|||
private String userId; |
|||
private String gridId; |
|||
private String realName; |
|||
private String headImgUrl; |
|||
} |
Loading…
Reference in new issue