|
@ -10,12 +10,15 @@ import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO; |
|
|
import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
|
|
import com.epmet.commons.tools.enums.IcFormCodeEnum; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; |
|
|
import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.dao.IcResiUserDao; |
|
|
import com.epmet.dao.IcResiUserDao; |
|
|
import com.epmet.dao.IcVolunteerPolyCategoryDao; |
|
|
import com.epmet.dao.IcVolunteerPolyCategoryDao; |
|
@ -23,17 +26,21 @@ import com.epmet.dao.IcVolunteerPolyDao; |
|
|
import com.epmet.dao.UserBaseInfoDao; |
|
|
import com.epmet.dao.UserBaseInfoDao; |
|
|
import com.epmet.dto.IcVolunteerPolyDTO; |
|
|
import com.epmet.dto.IcVolunteerPolyDTO; |
|
|
import com.epmet.dto.VolunteerInfoDTO; |
|
|
import com.epmet.dto.VolunteerInfoDTO; |
|
|
|
|
|
import com.epmet.dto.form.IcFormOptionsQueryFormDTO; |
|
|
import com.epmet.dto.form.VolunteerPolyListFormDTO; |
|
|
import com.epmet.dto.form.VolunteerPolyListFormDTO; |
|
|
import com.epmet.dto.form.VolunteerPolyMapDataFormDTO; |
|
|
import com.epmet.dto.form.VolunteerPolyMapDataFormDTO; |
|
|
import com.epmet.dto.result.ResiUserBaseInfoResultDTO; |
|
|
import com.epmet.dto.result.ResiUserBaseInfoResultDTO; |
|
|
import com.epmet.dto.result.VolunteerPolyListResultDTO; |
|
|
import com.epmet.dto.result.VolunteerPolyListResultDTO; |
|
|
import com.epmet.dto.result.VolunteerPolyMapDataResultDTO; |
|
|
import com.epmet.dto.result.VolunteerPolyMapDataResultDTO; |
|
|
import com.epmet.entity.IcResiUserEntity; |
|
|
import com.epmet.entity.IcResiUserEntity; |
|
|
|
|
|
import com.epmet.dto.form.VolunteerPolyPieFormDTO; |
|
|
|
|
|
import com.epmet.dto.result.*; |
|
|
import com.epmet.entity.IcVolunteerPolyCategoryEntity; |
|
|
import com.epmet.entity.IcVolunteerPolyCategoryEntity; |
|
|
import com.epmet.entity.IcVolunteerPolyEntity; |
|
|
import com.epmet.entity.IcVolunteerPolyEntity; |
|
|
import com.epmet.entity.UserBaseInfoEntity; |
|
|
import com.epmet.entity.UserBaseInfoEntity; |
|
|
import com.epmet.feign.EpmetHeartOpenFeignClient; |
|
|
import com.epmet.feign.EpmetHeartOpenFeignClient; |
|
|
import com.epmet.service.IcVolunteerPolyCategoryService; |
|
|
import com.epmet.service.IcVolunteerPolyCategoryService; |
|
|
|
|
|
import com.epmet.feign.OperCustomizeOpenFeignClient; |
|
|
import com.epmet.service.IcVolunteerPolyService; |
|
|
import com.epmet.service.IcVolunteerPolyService; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
@ -45,10 +52,8 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.util.ArrayList; |
|
|
import javax.annotation.Resource; |
|
|
import java.util.Arrays; |
|
|
import java.util.*; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -61,6 +66,8 @@ import java.util.stream.Collectors; |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyDao, IcVolunteerPolyEntity> implements IcVolunteerPolyService { |
|
|
public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyDao, IcVolunteerPolyEntity> implements IcVolunteerPolyService { |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; |
|
|
@Resource |
|
|
@Resource |
|
|
private IcResiUserDao icResiUserDao; |
|
|
private IcResiUserDao icResiUserDao; |
|
|
@Resource |
|
|
@Resource |
|
@ -88,8 +95,8 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD |
|
|
return ConvertUtils.sourceToTarget(entityList, IcVolunteerPolyDTO.class); |
|
|
return ConvertUtils.sourceToTarget(entityList, IcVolunteerPolyDTO.class); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private QueryWrapper<IcVolunteerPolyEntity> getWrapper(Map<String, Object> params){ |
|
|
private QueryWrapper<IcVolunteerPolyEntity> getWrapper(Map<String, Object> params) { |
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
|
QueryWrapper<IcVolunteerPolyEntity> wrapper = new QueryWrapper<>(); |
|
|
QueryWrapper<IcVolunteerPolyEntity> wrapper = new QueryWrapper<>(); |
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
@ -134,7 +141,7 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public List<VolunteerPolyMapDataResultDTO> getMapData(VolunteerPolyMapDataFormDTO form) { |
|
|
public List<VolunteerPolyMapDataResultDTO> getMapData(VolunteerPolyMapDataFormDTO form) { |
|
|
List<VolunteerPolyMapDataResultDTO> dto = baseDao.getMapData(form.getCode(),form.getCustomerId()); |
|
|
List<VolunteerPolyMapDataResultDTO> dto = baseDao.getMapData(form.getCode(), form.getCustomerId()); |
|
|
// 获取gridName
|
|
|
// 获取gridName
|
|
|
for (VolunteerPolyMapDataResultDTO item : dto) { |
|
|
for (VolunteerPolyMapDataResultDTO item : dto) { |
|
|
if (StringUtils.isNotEmpty(item.getGridId())) { |
|
|
if (StringUtils.isNotEmpty(item.getGridId())) { |
|
@ -144,9 +151,9 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// 获取houseName
|
|
|
// 获取houseName
|
|
|
if(StringUtils.isNotEmpty(item.getHomeId())) { |
|
|
if (StringUtils.isNotEmpty(item.getHomeId())) { |
|
|
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(form.getCustomerId(), item.getHomeId()); |
|
|
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(form.getCustomerId(), item.getHomeId()); |
|
|
if(null != houseInfo) { |
|
|
if (null != houseInfo) { |
|
|
item.setHouseName(houseInfo.getHouseName()); |
|
|
item.setHouseName(houseInfo.getHouseName()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -164,8 +171,8 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public PageData getList(VolunteerPolyListFormDTO form) { |
|
|
public PageData getList(VolunteerPolyListFormDTO form) { |
|
|
PageHelper.startPage(form.getPageNo(),form.getPageSize()); |
|
|
PageHelper.startPage(form.getPageNo(), form.getPageSize()); |
|
|
List<VolunteerPolyListResultDTO> result = baseDao.getList(form.getCode(),form.getCustomerId()); |
|
|
List<VolunteerPolyListResultDTO> result = baseDao.getList(form.getCode(), form.getCustomerId()); |
|
|
PageInfo<VolunteerPolyListResultDTO> info = new PageInfo<>(result); |
|
|
PageInfo<VolunteerPolyListResultDTO> info = new PageInfo<>(result); |
|
|
return new PageData<>(result, info.getTotal()); |
|
|
return new PageData<>(result, info.getTotal()); |
|
|
} |
|
|
} |
|
@ -206,7 +213,7 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD |
|
|
partition.forEach(part -> userList.addAll(getUserInfoList(part))); |
|
|
partition.forEach(part -> userList.addAll(getUserInfoList(part))); |
|
|
Map<String, UserBaseInfoEntity> userMap = userList.stream().collect(Collectors.toMap(UserBaseInfoEntity::getUserId, a -> a, (o, n) -> o)); |
|
|
Map<String, UserBaseInfoEntity> userMap = userList.stream().collect(Collectors.toMap(UserBaseInfoEntity::getUserId, a -> a, (o, n) -> o)); |
|
|
//将居民志愿者转成map
|
|
|
//将居民志愿者转成map
|
|
|
Map<String, IcVolunteerPolyDTO> volunteerMap = volunteerList.stream().collect(Collectors.toMap(IcVolunteerPolyDTO::getIdCard,a -> a, (o, n) -> o)); |
|
|
Map<String, IcVolunteerPolyDTO> volunteerMap = volunteerList.stream().collect(Collectors.toMap(IcVolunteerPolyDTO::getIdCard, a -> a, (o, n) -> o)); |
|
|
//小程序与居民信息匹配不上的志愿者
|
|
|
//小程序与居民信息匹配不上的志愿者
|
|
|
List<IcVolunteerPolyDTO> notInList = new ArrayList<>(); |
|
|
List<IcVolunteerPolyDTO> notInList = new ArrayList<>(); |
|
|
appVolunteerList.forEach(item -> { |
|
|
appVolunteerList.forEach(item -> { |
|
@ -224,7 +231,7 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
//将小程序的志愿者列表转成map
|
|
|
//将小程序的志愿者列表转成map
|
|
|
Map<String, IcVolunteerPolyDTO> appVolunteerMap = appVolunteerList.stream().collect(Collectors.toMap(IcVolunteerPolyDTO::getIdCard,a -> a, (o, n) -> o)); |
|
|
Map<String, IcVolunteerPolyDTO> appVolunteerMap = appVolunteerList.stream().collect(Collectors.toMap(IcVolunteerPolyDTO::getIdCard, a -> a, (o, n) -> o)); |
|
|
////小程序与居民信息匹配上的志愿者userId更新到居民志愿者列表
|
|
|
////小程序与居民信息匹配上的志愿者userId更新到居民志愿者列表
|
|
|
volunteerList.forEach(item -> { |
|
|
volunteerList.forEach(item -> { |
|
|
if (appVolunteerMap.containsKey(item.getIdCard())) { |
|
|
if (appVolunteerMap.containsKey(item.getIdCard())) { |
|
@ -354,7 +361,7 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD |
|
|
ResiUserBaseInfoResultDTO user = userBaseInfoDao.selecUserBaseInfoByUserId(userId); |
|
|
ResiUserBaseInfoResultDTO user = userBaseInfoDao.selecUserBaseInfoByUserId(userId); |
|
|
if (null != user) { |
|
|
if (null != user) { |
|
|
//获取志愿者信息
|
|
|
//获取志愿者信息
|
|
|
Result<VolunteerInfoDTO> volunteerResult = epmetHeartOpenFeignClient.queryUserVolunteerInfo(userId); |
|
|
Result<VolunteerInfoDTO> volunteerResult = epmetHeartOpenFeignClient.queryUserVolunteerInfo(userId); |
|
|
if (!volunteerResult.success()) { |
|
|
if (!volunteerResult.success()) { |
|
|
log.error("志愿者变更-获取小程序志愿者失败"); |
|
|
log.error("志愿者变更-获取小程序志愿者失败"); |
|
|
} |
|
|
} |
|
@ -431,4 +438,36 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD |
|
|
return userBaseInfoDao.selectList(userInfoWrapper); |
|
|
return userBaseInfoDao.selectList(userInfoWrapper); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 【网格党建平面图】饼图 |
|
|
|
|
|
* |
|
|
|
|
|
* @param form |
|
|
|
|
|
* @return com.epmet.dto.result.VolunteerPolyPieResultDTO |
|
|
|
|
|
* @author LZN |
|
|
|
|
|
* @date 2022/5/19 17:21 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<VolunteerPolyPieResultDTO> getStatistics(VolunteerPolyPieFormDTO form) { |
|
|
|
|
|
|
|
|
|
|
|
List<VolunteerPolyPieResultDTO> list = baseDao.getStatistics(form); |
|
|
|
|
|
Map<String, String> map = list.stream().collect(Collectors.toMap(VolunteerPolyPieResultDTO::getCode, VolunteerPolyPieResultDTO::getValue)); |
|
|
|
|
|
|
|
|
|
|
|
//获取志愿者类别
|
|
|
|
|
|
IcFormOptionsQueryFormDTO optionsForm = new IcFormOptionsQueryFormDTO(); |
|
|
|
|
|
optionsForm.setCustomerId(form.getCustomerId()); |
|
|
|
|
|
optionsForm.setFormCode(IcFormCodeEnum.RESI_BASE_INFO.getCode()); |
|
|
|
|
|
optionsForm.setColumnName("VOLUNTEER_CATEGORY"); |
|
|
|
|
|
Result<Map<String, String>> volunteerMap = operCustomizeOpenFeignClient.getOptionsMap(optionsForm); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> data = volunteerMap.getData(); |
|
|
|
|
|
|
|
|
|
|
|
return list.stream().map(item -> { |
|
|
|
|
|
VolunteerPolyPieResultDTO dto = new VolunteerPolyPieResultDTO(); |
|
|
|
|
|
dto.setCode(item.getCode()); |
|
|
|
|
|
dto.setValue(item.getValue()); |
|
|
|
|
|
dto.setLabel(data.get(item.getValue())); |
|
|
|
|
|
return dto; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |