forked from rongchao/epmet-cloud-rizhao
31 changed files with 981 additions and 6 deletions
@ -0,0 +1,41 @@ |
|||
package com.epmet.dto.result.heart; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description 描述 |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/10 4:24 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
@Data |
|||
public class VolunteerDemandServiceStatsResultDTO { |
|||
|
|||
private String customerId; |
|||
private String dateId; |
|||
/** |
|||
* 客户下志愿者总数 |
|||
*/ |
|||
private Integer volunteerTotal; |
|||
/** |
|||
* 客户下志愿者中,党员数量 |
|||
*/ |
|||
private Integer partyTotal; |
|||
/** |
|||
* 客户下志愿者中,居民数量 |
|||
*/ |
|||
private Integer resiTotal; |
|||
/** |
|||
* 客户下志愿者服务总次数 |
|||
*/ |
|||
private Integer serviceTotal; |
|||
/** |
|||
* 客户下党员志愿者服务次数 |
|||
*/ |
|||
private Integer partyServiceTotal; |
|||
/** |
|||
* 客户下居民志愿者服务次数 |
|||
*/ |
|||
private Integer resiServiceTotal; |
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.epmet.datareport.controller.heart; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.datareport.service.heart.DemandService; |
|||
import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @Description 描述 |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/10 3:55 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("heart/demand") |
|||
public class DataReportHeartDemandController { |
|||
|
|||
@Autowired |
|||
private DemandService demandService; |
|||
|
|||
/** |
|||
* 查询志愿者需求服务统计信息 |
|||
* @param loginUser |
|||
* @return |
|||
*/ |
|||
@PostMapping("volunteer/service") |
|||
public Result<VolunteerDemandServiceStatsResultDTO> getVolunteerServiceStats(@LoginUser TokenDto loginUser) { |
|||
String customerId = loginUser.getCustomerId(); |
|||
VolunteerDemandServiceStatsResultDTO r = demandService.getVolunteerServiceStats(customerId); |
|||
return new Result<VolunteerDemandServiceStatsResultDTO>().ok(r); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,43 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.datareport.dao.fact; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.datareport.entity.heart.FactVolunteerServiceDailyEntity; |
|||
import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 志愿者服务情况统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-08 |
|||
*/ |
|||
@Mapper |
|||
public interface FactVolunteerServiceDailyDao extends BaseDao<FactVolunteerServiceDailyEntity> { |
|||
|
|||
/** |
|||
* 查询最新一条"志愿者需求服务统计信息" |
|||
* @param customerId |
|||
* @return |
|||
*/ |
|||
VolunteerDemandServiceStatsResultDTO getLatestVolunteerDemandServiceStats(@Param("customerId") String customerId); |
|||
} |
@ -0,0 +1,83 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.datareport.entity.heart; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 志愿者服务情况统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-08 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("fact_volunteer_service_daily") |
|||
public class FactVolunteerServiceDailyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* yyyyMMdd |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* yyyyMM |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 截止到当前dateId,当前客户下,共有多少个爱心互助的志愿者 |
|||
*/ |
|||
private Integer volunteerTotal; |
|||
|
|||
/** |
|||
* 截止到当前dateId,当前客户下,XX个爱心互助志愿者中,党员有多少个 |
|||
*/ |
|||
private Integer partyTotal; |
|||
|
|||
/** |
|||
* 截止到当前dateId,当前客户下,XX个爱心互助志愿者中,居民有多少个 |
|||
*/ |
|||
private Integer resiTotal; |
|||
|
|||
/** |
|||
* 服务总次数 |
|||
*/ |
|||
private Integer serviceTotal; |
|||
|
|||
/** |
|||
* 党员服务总次数 |
|||
*/ |
|||
private Integer partyServiceTotal; |
|||
|
|||
/** |
|||
* 居民服务总次数 |
|||
*/ |
|||
private Integer resiServiceTotal; |
|||
|
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.epmet.datareport.service.heart; |
|||
|
|||
import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO; |
|||
|
|||
/** |
|||
* @Description 需求服务 |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/10 4:18 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
public interface DemandService { |
|||
VolunteerDemandServiceStatsResultDTO getVolunteerServiceStats(String customerId); |
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.epmet.datareport.service.heart.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|||
import com.epmet.constant.DataSourceConstant; |
|||
import com.epmet.datareport.dao.fact.FactVolunteerServiceDailyDao; |
|||
import com.epmet.datareport.entity.heart.FactVolunteerServiceDailyEntity; |
|||
import com.epmet.datareport.service.heart.DemandService; |
|||
import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @Description 需求服务 |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/10 4:20 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
@Service |
|||
public class DemandServiceImpl implements DemandService { |
|||
|
|||
@Autowired |
|||
private FactVolunteerServiceDailyDao factVolunteerServiceDailyDao; |
|||
|
|||
@Override |
|||
public VolunteerDemandServiceStatsResultDTO getVolunteerServiceStats(String customerId) { |
|||
return factVolunteerServiceDailyDao.getLatestVolunteerDemandServiceStats(customerId); |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.datareport.dao.fact.FactVolunteerServiceDailyDao"> |
|||
|
|||
<resultMap type="com.epmet.datareport.entity.heart.FactVolunteerServiceDailyEntity" id="factVolunteerServiceDailyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="dateId" column="DATE_ID"/> |
|||
<result property="monthId" column="MONTH_ID"/> |
|||
<result property="volunteerTotal" column="VOLUNTEER_TOTAL"/> |
|||
<result property="partyTotal" column="PARTY_TOTAL"/> |
|||
<result property="resiTotal" column="RESI_TOTAL"/> |
|||
<result property="serviceTotal" column="SERVICE_TOTAL"/> |
|||
<result property="partyServiceTotal" column="PARTY_SERVICE_TOTAL"/> |
|||
<result property="resiServiceTotal" column="RESI_SERVICE_TOTAL"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
<select id="getLatestVolunteerDemandServiceStats" |
|||
resultType="com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO"> |
|||
select * |
|||
from fact_volunteer_service_daily |
|||
where DEL_FLAG = 0 |
|||
and CUSTOMER_ID = #{customerId} |
|||
order by DATE_ID desc |
|||
limit 1 |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.form.resi; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/10 6:10 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
@Data |
|||
public class VolunteerCommonFormDTO { |
|||
|
|||
public interface VolunteerPage { |
|||
} |
|||
|
|||
@NotBlank(message = "客户ID不能为空", groups = {VolunteerPage.class}) |
|||
private String customerId; |
|||
|
|||
private Integer pageNo = 0; |
|||
|
|||
private Integer pageSize = 20; |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.epmet.dto.result.resi; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description 志愿者信息分页查询结果 |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/10 6:17 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
@Data |
|||
public class PageVolunteerInfoResultDTO { |
|||
private String userId; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @Description ic 表单options查询通用dto |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/12 1:07 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
@Data |
|||
public class IcFormOptionsQueryFormDTO { |
|||
|
|||
public interface QueryByLabelAndCustomerIdForForm {} |
|||
|
|||
@NotBlank(message = "客户ID必填", groups = { QueryByLabelAndCustomerIdForForm.class }) |
|||
private String customerId; |
|||
|
|||
@NotBlank(message = "FormCode必填", groups = { QueryByLabelAndCustomerIdForForm.class }) |
|||
private String formCode; |
|||
|
|||
@NotBlank(message = "OptionsLabel必填", groups = { QueryByLabelAndCustomerIdForForm.class }) |
|||
private String label; |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
import lombok.Value; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/10 5:47 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
@Data |
|||
public class VolunteerCommonFormDTO { |
|||
|
|||
/** |
|||
* 查询志愿者分布 |
|||
*/ |
|||
public interface GetVolunteerDistribution { |
|||
} |
|||
|
|||
@NotBlank(message = "客户ID不能为空", groups = {GetVolunteerDistribution.class}) |
|||
private String customerId; |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/10 5:49 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
@Data |
|||
public class VolunteerDistributionResultDTO { |
|||
|
|||
private List<Legend> legends = new ArrayList<>(); |
|||
|
|||
private List<Distribution> distributions = new ArrayList<>(); |
|||
|
|||
@Data |
|||
public static class Legend { |
|||
private String optionLabel; |
|||
private String optionValue; |
|||
} |
|||
|
|||
@Data |
|||
public static class Distribution { |
|||
private Set<String> volunteerTypes; |
|||
private String epmetUserId; |
|||
private String icResiUserId; |
|||
private String longitude; |
|||
private String latitude; |
|||
} |
|||
} |
@ -0,0 +1,55 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dao.IcResiUserDao; |
|||
import com.epmet.dto.form.VolunteerCommonFormDTO; |
|||
import com.epmet.dto.result.VolunteerDistributionResultDTO; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.service.VolunteerService; |
|||
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; |
|||
|
|||
/** |
|||
* @Description 志愿者controller |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/10 5:45 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("volunteer") |
|||
public class VolunteerController { |
|||
|
|||
/** |
|||
* 不知道为何用注解 注入不进来,暂时用构造方法注入 |
|||
*/ |
|||
@Autowired |
|||
private VolunteerService volunteerService; |
|||
|
|||
//public VolunteerController(VolunteerService volunteerService, IcResiUserDao icResiUserDao, GovOrgOpenFeignClient govOrgOpenFeignClient) {
|
|||
// this.volunteerService = volunteerService;
|
|||
// System.out.println(this);
|
|||
//}
|
|||
|
|||
/** |
|||
* 志愿者分布查询 |
|||
* |
|||
* @param input |
|||
* @return |
|||
*/ |
|||
@PostMapping("distribution") |
|||
public Result<VolunteerDistributionResultDTO> getVolunteerDistribution(@RequestBody VolunteerCommonFormDTO input) { |
|||
System.out.println(this); |
|||
ValidatorUtils.validateEntity(input, VolunteerCommonFormDTO.GetVolunteerDistribution.class); |
|||
|
|||
String customerId = input.getCustomerId(); |
|||
|
|||
VolunteerDistributionResultDTO r = volunteerService.getVolunteerDistributionAndLegends(customerId); |
|||
|
|||
return new Result<VolunteerDistributionResultDTO>().ok(r); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.result.VolunteerDistributionResultDTO; |
|||
|
|||
/** |
|||
* @Description 志愿者service |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/10 5:48 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
public interface VolunteerService { |
|||
|
|||
VolunteerDistributionResultDTO getVolunteerDistributionAndLegends(String customerId); |
|||
|
|||
} |
@ -0,0 +1,179 @@ |
|||
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.dao.IcResiUserDao; |
|||
import com.epmet.dao.UserBaseInfoDao; |
|||
import com.epmet.dto.IcBuildingDTO; |
|||
import com.epmet.dto.IcFormItemOptionsDTO; |
|||
import com.epmet.dto.IcResiUserDTO; |
|||
import com.epmet.dto.form.IcFormOptionsQueryFormDTO; |
|||
import com.epmet.dto.form.resi.VolunteerCommonFormDTO; |
|||
import com.epmet.dto.result.ResiUserBaseInfoResultDTO; |
|||
import com.epmet.dto.result.VolunteerDistributionResultDTO; |
|||
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; |
|||
import com.epmet.feign.EpmetHeartOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.feign.OperCustomizeOpenFeignClient; |
|||
import com.epmet.service.VolunteerService; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author wangxianzhang |
|||
* @Date 2021/12/10 5:48 下午 |
|||
* @Version 1.0 |
|||
*/ |
|||
@Service |
|||
public class VolunteerServiceImpl implements VolunteerService, ResultDataResolver { |
|||
|
|||
@Autowired |
|||
private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private UserBaseInfoDao userBaseInfoDao; |
|||
|
|||
@Autowired |
|||
private IcResiUserDao icResiUserDao; |
|||
|
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; |
|||
|
|||
/** |
|||
* 查询志愿者分布以及志愿者图例 |
|||
* |
|||
* @param customerId |
|||
* @return |
|||
*/ |
|||
public VolunteerDistributionResultDTO getVolunteerDistributionAndLegends(String customerId) { |
|||
|
|||
// 1.查询分布
|
|||
VolunteerDistributionResultDTO volunteerDistribution = getVolunteerDistribution(customerId); |
|||
|
|||
// 2.补充图例
|
|||
IcFormOptionsQueryFormDTO optionsForm = new IcFormOptionsQueryFormDTO(); |
|||
optionsForm.setCustomerId(customerId); |
|||
optionsForm.setFormCode("resi_base_info"); |
|||
optionsForm.setLabel("志愿者类别"); |
|||
|
|||
String errorMsg = "【志愿者分布】查询志愿者图例失败"; |
|||
List<IcFormItemOptionsDTO> options = getResultDataOrThrowsException(operCustomizeOpenFeignClient.listOptionsByItemConditions(optionsForm), |
|||
ServiceConstant.OPER_CUSTOMIZE_SERVER, |
|||
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), |
|||
errorMsg, |
|||
errorMsg); |
|||
|
|||
List<VolunteerDistributionResultDTO.Legend> legends = options.stream().map(o -> { |
|||
VolunteerDistributionResultDTO.Legend legend = new VolunteerDistributionResultDTO.Legend(); |
|||
legend.setOptionLabel(o.getOptionLabel()); |
|||
legend.setOptionValue(o.getOptionValue()); |
|||
return legend; |
|||
}).collect(Collectors.toList()); |
|||
|
|||
volunteerDistribution.setLegends(legends); |
|||
return volunteerDistribution; |
|||
} |
|||
|
|||
/** |
|||
* 查询志愿者分布 |
|||
* |
|||
* @param customerId |
|||
* @return |
|||
*/ |
|||
public VolunteerDistributionResultDTO getVolunteerDistribution(String customerId) { |
|||
//epmetHeartOpenFeignClient.queryVolunteerPage()
|
|||
|
|||
// 1.分页查询出所有志愿者列表
|
|||
int pageNo = 1; |
|||
int pageSize = 100; |
|||
|
|||
// 志愿者epmet user id
|
|||
Set<String> volunteerEpmetUserIds = new HashSet<>(); |
|||
|
|||
// 分页查询志愿者的epmet user id
|
|||
while (true) { |
|||
|
|||
VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO(); |
|||
volunteerForm.setCustomerId(customerId); |
|||
volunteerForm.setPageNo(pageNo); |
|||
volunteerForm.setPageSize(pageSize); |
|||
|
|||
String errorMsg = "【志愿者分布】分页查询志愿者列表失败"; |
|||
List<PageVolunteerInfoResultDTO> volunteerPage = getResultDataOrThrowsException(epmetHeartOpenFeignClient.queryVolunteerPage(volunteerForm), |
|||
ServiceConstant.EPMET_HEART_SERVER, |
|||
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), |
|||
errorMsg, |
|||
errorMsg); |
|||
|
|||
// 将本页userId添加到总集中去
|
|||
volunteerEpmetUserIds.addAll(volunteerPage.stream().map(v -> v.getUserId()).collect(Collectors.toSet())); |
|||
|
|||
if (volunteerPage.size() < pageSize) { |
|||
// 说明是最后一页了
|
|||
break; |
|||
} |
|||
|
|||
pageNo++; |
|||
} |
|||
|
|||
|
|||
VolunteerDistributionResultDTO r = new VolunteerDistributionResultDTO(); |
|||
|
|||
// 2.填充ic居民信息
|
|||
for (String volunteerEpmetUserId : volunteerEpmetUserIds) { |
|||
|
|||
VolunteerDistributionResultDTO.Distribution distribution = new VolunteerDistributionResultDTO.Distribution(); |
|||
|
|||
ResiUserBaseInfoResultDTO userBaseInfo = userBaseInfoDao.selecUserBaseInfoByUserId(volunteerEpmetUserId); |
|||
|
|||
//使用身份证号查询ic resi信息
|
|||
IcResiUserDTO icResiUserInfo = icResiUserDao.selectIdByIdCard(customerId, userBaseInfo.getIdNum(), null); |
|||
if (icResiUserInfo == null) { |
|||
continue; |
|||
} |
|||
|
|||
List<String> volunteer = icResiUserDao.selectVolunteerByUserId(icResiUserInfo.getId()); |
|||
if (CollectionUtils.isEmpty(volunteer)) { |
|||
// 此人没有志愿者信息
|
|||
continue; |
|||
} |
|||
|
|||
// 将志愿者类型列表字符串,切割放到set中
|
|||
Set<String> volunteerTypes = new HashSet(); |
|||
for (String vTypesString : volunteer) { |
|||
String[] vTypes = vTypesString.split(","); |
|||
if (vTypes != null && vTypes.length > 0) { |
|||
volunteerTypes.addAll(Arrays.asList(vTypes)); |
|||
} |
|||
} |
|||
|
|||
|
|||
String msg = "【志愿者分布】查询楼栋信息失败"; |
|||
IcBuildingDTO building = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingById(icResiUserInfo.getBuildId()), |
|||
ServiceConstant.GOV_ORG_SERVER, |
|||
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); |
|||
|
|||
distribution.setVolunteerTypes(volunteerTypes); |
|||
distribution.setEpmetUserId(userBaseInfo.getUserId()); |
|||
distribution.setIcResiUserId(icResiUserInfo.getId()); |
|||
Optional.of(building).ifPresent(b -> { |
|||
distribution.setLongitude(b.getLongitude()); |
|||
distribution.setLatitude(b.getLatitude()); |
|||
}); |
|||
|
|||
r.getDistributions().add(distribution); |
|||
} |
|||
|
|||
return r; |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue