Browse Source

bug修改

master
zhaoqifeng 3 years ago
parent
commit
a49401ab96
  1. 52
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  2. 51
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  3. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml
  4. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  5. 11
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  6. 27
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  7. 22
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  8. 60
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  9. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/IcVolunteerPolyDao.xml

52
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java

@ -44,9 +44,9 @@ import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -83,6 +83,7 @@ public class IcUserDemandRecController implements ResultDataResolver {
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
/**
* 根据服务方类型查询 下拉框
* 服务方类型志愿者volunteer社会组织social_org社区自组织community_org区域党建单位party_unit
@ -219,28 +220,33 @@ public class IcUserDemandRecController implements ResultDataResolver {
&& null != finishResultDTO.getAwardPoint()
&& finishResultDTO.getAwardPoint() > NumConstant.ZERO
&& UserDemandConstant.RESOLVED.equals(finishResultDTO.getFinishResult())) {
// 志愿者发放积分
List<BasePointEventMsg> actPointEventMsgList = new ArrayList<>();
BasePointEventMsg actPointEventMsg = new BasePointEventMsg();
actPointEventMsg.setCustomerId(formDTO.getCustomerId());
actPointEventMsg.setSourceType(MqConstant.SOURCE_TYPE_DEMAND);
actPointEventMsg.setSourceId(formDTO.getDemandRecId());
actPointEventMsg.setUserId(finishResultDTO.getServerId());
actPointEventMsg.setActionFlag(MqConstant.PLUS);
actPointEventMsg.setIsCommon(false);
actPointEventMsg.setRemark(finishResultDTO.getRemark());
actPointEventMsg.setEventTag(EventEnum.FINISH_USER_DEMAND.getEventTag());
actPointEventMsg.setEventClass(EventEnum.FINISH_USER_DEMAND.getEventClass());
actPointEventMsg.setEventName(finishResultDTO.getFirstCategoryName());
actPointEventMsg.setObjectId(finishResultDTO.getCategoryCode());
actPointEventMsg.setPoint(finishResultDTO.getAwardPoint());
actPointEventMsgList.add(actPointEventMsg);
SystemMsgFormDTO sendMsgForm = new SystemMsgFormDTO();
sendMsgForm.setContent(actPointEventMsgList);
sendMsgForm.setMessageType(SystemMessageType.FINISH_USER_DEMAND);
Result mqResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(sendMsgForm);
if (!mqResult.success()) {
log.error(String.format("demandRecId:%s,给志愿者发放积分失败", formDTO.getDemandRecId()));
Result<List<String>> userIdRes = userOpenFeignClient.getUserId(finishResultDTO.getServerId());
if (userIdRes.success() && CollectionUtils.isNotEmpty(userIdRes.getData())) {
userIdRes.getData().forEach(userId -> {
// 志愿者发放积分
List<BasePointEventMsg> actPointEventMsgList = new ArrayList<>();
BasePointEventMsg actPointEventMsg = new BasePointEventMsg();
actPointEventMsg.setCustomerId(formDTO.getCustomerId());
actPointEventMsg.setSourceType(MqConstant.SOURCE_TYPE_DEMAND);
actPointEventMsg.setSourceId(formDTO.getDemandRecId());
actPointEventMsg.setUserId(userId);
actPointEventMsg.setActionFlag(MqConstant.PLUS);
actPointEventMsg.setIsCommon(false);
actPointEventMsg.setRemark(finishResultDTO.getRemark());
actPointEventMsg.setEventTag(EventEnum.FINISH_USER_DEMAND.getEventTag());
actPointEventMsg.setEventClass(EventEnum.FINISH_USER_DEMAND.getEventClass());
actPointEventMsg.setEventName(finishResultDTO.getFirstCategoryName());
actPointEventMsg.setObjectId(finishResultDTO.getCategoryCode());
actPointEventMsg.setPoint(finishResultDTO.getAwardPoint());
actPointEventMsgList.add(actPointEventMsg);
SystemMsgFormDTO sendMsgForm = new SystemMsgFormDTO();
sendMsgForm.setContent(actPointEventMsgList);
sendMsgForm.setMessageType(SystemMessageType.FINISH_USER_DEMAND);
Result mqResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(sendMsgForm);
if (!mqResult.success()) {
log.error(String.format("demandRecId:%s,给志愿者发放积分失败", formDTO.getDemandRecId()));
}
});
}
}
}

51
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java

@ -21,11 +21,10 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.MqConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
@ -45,7 +44,6 @@ import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.SendVerificationCodeResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
@ -64,8 +62,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.Collator;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -337,43 +335,16 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
if (null == staffInfo) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询工作人员信息异常");
}
// 如果是根级组织的工作人员,agencyPids="";正常是以英文冒号隔开
String pids="";
if(StringUtils.isBlank(staffInfo.getAgencyPIds())||NumConstant.ZERO_STR.equals(staffInfo.getAgencyPIds())){
pids=staffInfo.getAgencyId();
}else{
pids=staffInfo.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfo.getAgencyId());
}
LambdaQueryWrapper<VolunteerInfoEntity> query=new LambdaQueryWrapper<>();
query.eq(VolunteerInfoEntity::getCustomerId,customerId);
query.likeRight(VolunteerInfoEntity::getPids,pids);
query.select(VolunteerInfoEntity::getUserId);
query.orderByAsc(VolunteerInfoEntity::getCreatedTime);
Set<String> userIds = baseDao.selectObjs(query).stream().map(o->o.toString()).collect(Collectors.toSet());
List<OptionDTO> resultList = new ArrayList<>();
if (CollectionUtils.isEmpty(userIds)) {
return resultList;
}
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIds));
if (userInfoRes.success() && CollectionUtils.isNotEmpty(userInfoRes.getData())) {
Map<String, UserBaseInfoResultDTO> userMap = userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, Function.identity()));
for (String userId : userIds) {
if (userMap.containsKey(userId)) {
if (StringUtils.isNoneBlank(userRealName)) {
if (userMap.get(userId).getRealName().contains(userRealName)) {
OptionDTO optionDTO = new OptionDTO();
optionDTO.setLabel(userMap.get(userId).getRealName().concat("(").concat(userMap.get(userId).getMobile().concat(")")));
optionDTO.setValue(userId);
resultList.add(optionDTO);
}
} else {
OptionDTO optionDTO = new OptionDTO();
optionDTO.setLabel(userMap.get(userId).getRealName().concat("(").concat(userMap.get(userId).getMobile().concat(")")));
optionDTO.setValue(userId);
resultList.add(optionDTO);
}
}
}
IcResiUserDTO icUser = new IcResiUserDTO();
icUser.setCustomerId(customerId);
icUser.setAgencyId(staffInfo.getAgencyId());
Result<List<OptionDataResultDTO>> volunteerRes = epmetUserOpenFeignClient.getVolunteerList(icUser);
if (volunteerRes.success() && CollectionUtils.isNotEmpty(volunteerRes.getData())) {
resultList = ConvertUtils.sourceToTarget(volunteerRes.getData(), OptionDTO.class);
resultList = resultList.stream().sorted((o1, o2) ->
Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLabel(),o2.getLabel()))
.collect(Collectors.toList());
}
return resultList;
}

1
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml

@ -166,6 +166,7 @@
<if test='null != startTime and null != endTime'>
AND ACTIVITY_TIME BETWEEN #{startTime} AND #{endTime}
</if>
ORDER BY ACTIVITY_TIME DESC
</select>

7
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -2,6 +2,7 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.*;
@ -806,4 +807,10 @@ public interface EpmetUserOpenFeignClient {
@PostMapping("/epmetuser/icVolunteerPoly/volunteerDataExtraction/{customerId}")
Result volunteerDataExtraction(@PathVariable("customerId") String customerId);
@PostMapping("/epmetuser/icresiuser/getVolunteerList")
Result<List<OptionDataResultDTO>> getVolunteerList(@RequestBody IcResiUserDTO formDTO);
@PostMapping("/epmetuser/icresiuser/getUserId/{icUserId}")
Result<List<String>> getUserId(@PathVariable("icUserId") String icUserId);
}

11
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -1,6 +1,7 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
@ -595,4 +596,14 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "volunteerDataExtraction", customerId);
}
@Override
public Result<List<OptionDataResultDTO>> getVolunteerList(IcResiUserDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getVolunteerList", formDTO);
}
@Override
public Result<List<String>> getUserId(String icUserId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserId", icUserId);
}
}

27
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -53,6 +53,7 @@ import com.epmet.constants.ImportTaskConstants;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.enums.IcResiUserTableEnum;
import com.epmet.excel.PartyMemberAgeExportExcel;
import com.epmet.excel.PartyMemberEducationExportExcel;
@ -1161,4 +1162,30 @@ public class IcResiUserController implements ResultDataResolver {
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<IcUserRoleResultDTO>().ok(icResiUserService.getUserRoleByIdCard(formDTO));
}
/**
* 获取组织下的志愿者
*
* @Param formDTO
* @Return {@link Result<List<OptionDTO>>}
* @Author zhaoqifeng
* @Date 2022/6/16 15:22
*/
@PostMapping("getVolunteerList")
public Result<List<OptionDataResultDTO>> getVolunteerList(@RequestBody IcResiUserDTO formDTO) {
return new Result<List<OptionDataResultDTO>>().ok(icResiUserService.getVolunteerList(formDTO.getCustomerId(), formDTO.getAgencyId()));
}
/**
* 获取居民信息对应的居民用户ID
*
* @Param icUserId
* @Return {@link Result<List<String>>}
* @Author zhaoqifeng
* @Date 2022/6/16 15:40
*/
@PostMapping("getUserId/{icUserId}")
public Result<List<String>> getUserId(@PathVariable("icUserId") String icUserId) {
return new Result<List<String>>().ok(icResiUserService.getUserId(icUserId));
}
}

22
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -25,6 +25,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.excel.support.ExportResiUserItemDTO;
import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO;
@ -405,4 +406,25 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @params [dto]
*/
Result editMember(IcResiUserConfirmSubmitDTO dto);
/**
* 获取组织下志愿者列表
*
* @Param customerId 客户
* @Param agencyId 组织
* @Return {@link List<OptionDTO>}
* @Author zhaoqifeng
* @Date 2022/6/16 14:58
*/
List<OptionDataResultDTO> getVolunteerList(String customerId, String agencyId);
/**
* 获取居民信息对应的居民用户ID
*
* @Param icResiUserId
* @Return {@link String}
* @Author zhaoqifeng
* @Date 2022/6/16 15:30
*/
List<String> getUserId(String icResiUserId);
}

60
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -61,6 +61,7 @@ import com.epmet.excel.support.ExportResiUserItemDTO;
import com.epmet.feign.*;
import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient;
import com.epmet.service.*;
import com.epmet.dto.result.demand.OptionDTO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -2384,6 +2385,65 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
return new Result().ok("修改成功");
}
/**
* 获取组织下志愿者列表
*
* @param customerId
* @param agencyId
* @Param customerId
* @Param agencyId
* @Return {@link List<OptionDTO>}
* @Author zhaoqifeng
* @Date 2022/6/16 14:58
*/
@Override
public List<OptionDataResultDTO> getVolunteerList(String customerId, String agencyId) {
LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcResiUserEntity::getCustomerId, customerId);
wrapper.and(wq -> wq.eq(IcResiUserEntity::getAgencyId, agencyId).or().like(IcResiUserEntity::getPids, agencyId));
wrapper.eq(IcResiUserEntity::getIsVolunteer, NumConstant.ONE_STR);
List<IcResiUserEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
OptionDataResultDTO dto = new OptionDataResultDTO();
dto.setValue(item.getId());
if (StringUtils.isNotBlank(item.getMobile())) {
dto.setLabel(item.getName().concat("(").concat(item.getMobile().concat(")")));
} else {
dto.setLabel(item.getName());
}
return dto;
}).collect(Collectors.toList());
}
/**
* 获取居民信息对应的居民用户ID
*
* @param icResiUserId
* @Param icResiUserId
* @Return {@link String}
* @Author zhaoqifeng
* @Date 2022/6/16 15:30
*/
@Override
public List<String> getUserId(String icResiUserId) {
IcResiUserEntity entity = baseDao.selectById(icResiUserId);
if (null == entity) {
return null;
}
//根据身份证获取小程序端居民信息
LambdaQueryWrapper<UserBaseInfoEntity> baseInfoWrapper = new LambdaQueryWrapper<>();
baseInfoWrapper.eq(UserBaseInfoEntity::getCustomerId, entity.getCustomerId());
baseInfoWrapper.eq(UserBaseInfoEntity::getIdNum, entity.getIdCard());
List<UserBaseInfoEntity> baseInfoList = userBaseInfoDao.selectList(baseInfoWrapper);
if (CollectionUtils.isEmpty(baseInfoList)) {
return null;
}
return baseInfoList.stream().map(UserBaseInfoEntity::getUserId).collect(Collectors.toList());
}
/**
* 根据身份证获取居民角色目前只有是否是志愿者
*

8
epmet-user/epmet-user-server/src/main/resources/mapper/IcVolunteerPolyDao.xml

@ -61,7 +61,7 @@
</where>
</select>
<select id="getList" resultType="com.epmet.dto.result.VolunteerPolyListResultDTO">
SELECT
SELECT DISTINCT
p.id,
p.NAME,
p.mobile,
@ -70,8 +70,8 @@
p.ID_CARD
FROM
ic_volunteer_poly p
LEFT JOIN ic_volunteer_poly_category c ON p.ID_CARD = c.ID_CARD
AND c.del_flag = '0'
INNER JOIN ic_volunteer_poly_category c ON p.ID_CARD = c.ID_CARD
AND c.del_flag = '0' AND c.VOLUNTEER_CATEGORY NOT IN ("wenhuaduiwu","louweihui","laoyoujulebu")
<where>
p.del_flag = '0'
<if test="code != null and code != ''">
@ -81,7 +81,7 @@
AND c.CUSTOMER_ID = #{customerId}
</if>
<if test="agencyId != null and agencyId != ''">
AND p.AGENCY_ID = #{agencyId}
AND p.AGENCY_ID = #{agencyId} OR p.AGENCY_PIDS LIKE concat('%',#{agencyId}, '%' )
</if>
group by p.id
</where>

Loading…
Cancel
Save