diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index 6677f738f6..e87c9f78f8 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java @@ -9,6 +9,7 @@ import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; +import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; @@ -119,4 +120,14 @@ public interface EpmetHeartOpenFeignClient { */ @PostMapping("/heart/resi/volunteer/getVolunteerList/{customerId}") Result> getVolunteerList(@PathVariable("customerId") String customerId); + + /** + * 添加志愿者 + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/5/30 11:10 + */ + @PostMapping("/heart/resi/volunteer/addVolunteer") + Result addVolunteer(@RequestBody ResiVolunteerAuthenticateFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java index d96476f4cf..bdf7bee595 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java @@ -10,6 +10,7 @@ import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; +import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; @@ -123,4 +124,18 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli public Result> getVolunteerList(String customerId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "getVolunteerList", customerId); } + + /** + * 添加志愿者 + * + * @param formDTO + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/5/30 11:10 + */ + @Override + public Result addVolunteer(ResiVolunteerAuthenticateFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "addVolunteer", formDTO); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java index 5aee9461b7..b54acc67ec 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -18,9 +18,13 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constant.SystemMessageType; import com.epmet.dto.IcVolunteerPolyDTO; import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.CommonCustomerFormDTO; @@ -31,6 +35,8 @@ import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.send.SendMqMsgUtil; import com.epmet.service.VolunteerInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -50,6 +56,8 @@ public class ResiVolunteerController { @Autowired private VolunteerInfoService volunteerInfoService; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; /** * 志愿者认证 @@ -65,6 +73,19 @@ public class ResiVolunteerController { formDTO.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(formDTO, ResiVolunteerAuthenticateFormDTO.AddUserShowGroup.class, ResiVolunteerAuthenticateFormDTO.AddUserInternalGroup.class); volunteerInfoService.authenticate(formDTO); + + //发送志愿者人员消息变动 + boolean flag = SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendRocketMqMsg(SystemMessageType.VOLUNTEER_CHANGED, new MqBaseFormDTO(tokenDto.getCustomerId(), tokenDto.getUserId())); + if (!flag){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"发送志愿者变动消息失败","发送志愿者变动消息失败"); + } + + return new Result(); + } + + @PostMapping("addVolunteer") + public Result addVolunteer(@RequestBody ResiVolunteerAuthenticateFormDTO formDTO) { + volunteerInfoService.addVolunteer(formDTO); return new Result(); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java index 0c0c0e7b5e..fefbde5c95 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java @@ -49,7 +49,7 @@ public interface VolunteerInfoService extends BaseService { * @Date 10:09 2020-07-23 **/ void authenticate(ResiVolunteerAuthenticateFormDTO formDTO); - + void addVolunteer(ResiVolunteerAuthenticateFormDTO formDTO); /** * 志愿者认证界面,获取用户基础信息+志愿者信息 * diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java index 6acc0c4e3d..b5aab903d0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java @@ -186,6 +186,33 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl gridInfoRes = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); + if (!gridInfoRes.success() || null == gridInfoRes.getData()) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询网格信息失败"); + } + insertVolunteer.setGridName(gridInfoRes.getData().getGridName()); + insertVolunteer.setPid(gridInfoRes.getData().getPid()); + insertVolunteer.setPids(gridInfoRes.getData().getPids()); + baseDao.insert(insertVolunteer); + + //更新用户信息表的 是否是志愿者标识 + HeartUserInfoDTO userInfoDTO = new HeartUserInfoDTO(); + userInfoDTO.setUserId(formDTO.getUserId()); + userInfoDTO.setVolunteerFlag(true); + heartUserInfoService.updateHeartUserInfoByUserId(userInfoDTO); + } + } + private void grantActPoints(ResiVolunteerAuthenticateFormDTO formDTO){ //MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); //mq的事件类型 diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml index db95e948a8..d71cdbd883 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml @@ -59,7 +59,17 @@ a.REMARK FROM ic_party_member a - LEFT JOIN ( SELECT CUSTOMER_ID,PARTY_MEMBER_ID,PAY_DATE FROM ( SELECT CUSTOMER_ID,PARTY_MEMBER_ID,PAY_DATE FROM ic_party_member_pay_record WHERE DEL_FLAG = 0 ORDER BY PAY_DATE DESC LIMIT 1) record GROUP BY record.PARTY_MEMBER_ID ) b ON a.ID = b.PARTY_MEMBER_ID + LEFT JOIN ( + SELECT + CUSTOMER_ID, + PARTY_MEMBER_ID, + MAX(PAY_DATE) AS PAY_DATE + FROM + ic_party_member_pay_record + WHERE + DEL_FLAG = 0 + GROUP BY + PARTY_MEMBER_ID ) b ON a.ID = b.PARTY_MEMBER_ID AND b.CUSTOMER_ID = #{customerId} INNER JOIN ic_party_org d ON a.SSZB = d.ID AND d.DEL_FLAG = 0 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVolunteerPolyServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVolunteerPolyServiceImpl.java index 9fc50600a3..320031bbf6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVolunteerPolyServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVolunteerPolyServiceImpl.java @@ -23,15 +23,12 @@ import com.epmet.dao.*; import com.epmet.dto.IcVolunteerPolyDTO; import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.*; +import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.dto.result.ResiUserBaseInfoResultDTO; import com.epmet.dto.result.VolunteerPolyListResultDTO; import com.epmet.dto.result.VolunteerPolyMapDataResultDTO; import com.epmet.dto.result.VolunteerPolyPieResultDTO; import com.epmet.entity.*; -import com.epmet.entity.IcResiUserEntity; -import com.epmet.entity.IcVolunteerPolyCategoryEntity; -import com.epmet.entity.IcVolunteerPolyEntity; -import com.epmet.entity.UserBaseInfoEntity; import com.epmet.enums.CustomizeEnum; import com.epmet.feign.EpmetHeartOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; @@ -49,7 +46,10 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -356,6 +356,19 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl baseInfoWrapper = new LambdaQueryWrapper<>(); + baseInfoWrapper.eq(UserBaseInfoEntity::getCustomerId, customerId); + baseInfoWrapper.eq(UserBaseInfoEntity::getIdNum, icUser.getIdCard()); + UserBaseInfoEntity baseInfo = userBaseInfoDao.selectOne(baseInfoWrapper); + if (null != baseInfo) { + ResiVolunteerAuthenticateFormDTO formDTO = new ResiVolunteerAuthenticateFormDTO(); + formDTO.setCustomerId(customerId); + formDTO.setUserId(baseInfo.getUserId()); + formDTO.setGridId(icUser.getGridId()); + epmetHeartOpenFeignClient.addVolunteer(formDTO); + } } else { if (!isDyzxh) { //删除志愿者信息 @@ -438,12 +451,24 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl