diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/CommonCustomerFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/CommonCustomerFormDTO.java new file mode 100644 index 0000000000..42daeb6be4 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/CommonCustomerFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @ClassName CommonCustomerFormDTO + * @Auth wangc + * @Date 2020-08-13 10:03 + */ +@Data +public class CommonCustomerFormDTO implements Serializable { + + private static final long serialVersionUID = -8141450443229290083L; + + public interface CustomerIdGroup extends CustomerClientShowGroup{} + + /** + * 客户Id + * */ + @NotBlank(message = "客户Id不能为空" , groups = CustomerIdGroup.class) + private String customerId; +} 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 85a0f088e0..acfd546f9f 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 @@ -1,8 +1,14 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.feign.fallback.EpmetHeartOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -12,4 +18,14 @@ import org.springframework.cloud.openfeign.FeignClient; */ @FeignClient(name = ServiceConstant.EPMET_POINT_SERVER, fallback = EpmetHeartOpenFeignClientFallback.class) public interface EpmetHeartOpenFeignClient { + + /** + * @Description 根据客户Id查询志愿者用户Id集合 + * @param customerFormDTO + * @return + * @author wangc + * @date 2020.08.13 10:22 + **/ + @PostMapping("/heart/resi/volunteer/volunteeruserids") + Result> volunteerUserIds(@RequestBody CommonCustomerFormDTO customerFormDTO); } 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 0dc4701b4b..7208b30d92 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 @@ -1,8 +1,14 @@ package com.epmet.feign.fallback; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.feign.EpmetHeartOpenFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 * @@ -11,4 +17,16 @@ import org.springframework.stereotype.Component; */ @Component public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignClient { + + /** + * @Description 根据客户Id查询志愿者用户Id集合 + * @param customerFormDTO + * @return + * @author wangc + * @date 2020.08.13 10:22 + **/ + @Override + public Result> volunteerUserIds(CommonCustomerFormDTO customerFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "volunteerUserIds", customerFormDTO); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml index b06037a0ba..40f1e509f5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-heart-server: container_name: epmet-heart-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-heart-server:0.0.48 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-heart-server:0.0.49 ports: - "8111:8111" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-heart/epmet-heart-server/pom.xml b/epmet-module/epmet-heart/epmet-heart-server/pom.xml index 9a7c7f559c..a2185d6b09 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/pom.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.48 + 0.0.49 com.epmet epmet-heart 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 d1f471a31a..4f31298977 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 @@ -21,6 +21,7 @@ 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.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; @@ -31,6 +32,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 居民端-志愿者相关api @@ -86,4 +89,17 @@ public class ResiVolunteerController { volunteerInfoService.sendSmsCode(formDTO); return new Result(); } + + /** + * @Description 根据客户Id查询志愿者用户Id集合 + * @param customerFormDTO + * @return + * @author wangc + * @date 2020.08.13 10:22 + **/ + @PostMapping("volunteeruserids") + public Result> volunteerUserIds(@RequestBody CommonCustomerFormDTO customerFormDTO){ + ValidatorUtils.validateEntity(customerFormDTO,CommonCustomerFormDTO.CustomerIdGroup.class); + return new Result>().ok(volunteerInfoService.getVolunteerIds(customerFormDTO)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java index 7b557dbaa1..ab0b65bf9c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java @@ -23,6 +23,8 @@ import com.epmet.entity.VolunteerInfoEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 志愿者信息 * @@ -63,4 +65,13 @@ public interface VolunteerInfoDao extends BaseDao { * @Date 14:33 2020-07-23l **/ VolunteerInfoDTO selectVolunteerInfoByUserId(@Param("userId") String userId); + + /** + * @Description 查询一个客户下的所有志愿者 + * @param customerId + * @return + * @author wangc + * @date 2020.08.13 10:06 + **/ + List selectVolunteerIds(@Param("customerId")String customerId); } 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 ede27b72a8..398d48aa5b 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 @@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.VolunteerInfoDTO; +import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; @@ -68,4 +69,13 @@ public interface VolunteerInfoService extends BaseService { * @Date 09:19 2020-08-10 **/ void sendSmsCode(ResiSendSmsCodeFormDTO formDTO); + + /** + * @Description 根据客户Id查询志愿者用户Id集合 + * @param customerFormDTO + * @return + * @author wangc + * @date 2020.08.13 10:22 + **/ + List getVolunteerIds(CommonCustomerFormDTO customerFormDTO); } 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 3f4574cacd..ef2da6193b 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 @@ -36,6 +36,7 @@ import com.epmet.constant.SmsTemplateConstant; import com.epmet.dao.VolunteerInfoDao; import com.epmet.dto.HeartUserInfoDTO; import com.epmet.dto.VolunteerInfoDTO; +import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.SendVerificationCodeFormDTO; import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; @@ -178,6 +179,18 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl getVolunteerIds(CommonCustomerFormDTO customerFormDTO) { + return baseDao.selectVolunteerIds(customerFormDTO.getCustomerId()); + } + /** * 保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis) * 过期时长为30分钟 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml index 9f9f3ae44e..e98b820d72 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml @@ -64,4 +64,13 @@ WHERE DEL_FLAG = '0' AND USER_ID = #{userId} + + + diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index 100b22ed13..614297ad11 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.114 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.115 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index cf9a483277..c97c10d46f 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.114 + 0.3.115 com.epmet epmet-user @@ -94,6 +94,12 @@ 2.0.0 compile + + com.epmet + epmet-heart-client + 2.0.0 + compile + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java index fbeac02c2b..051666a7cc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java @@ -29,6 +29,7 @@ import com.epmet.dao.GridLatestDao; import com.epmet.dao.UserWechatDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.GridLatestDTO; +import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.CustomerUserFormDTO; import com.epmet.dto.form.LatestGridInfoFormDTO; import com.epmet.dto.form.VisitedFormDTO; @@ -36,6 +37,7 @@ import com.epmet.dto.result.CustomerUser4PointResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.entity.GridLatestEntity; +import com.epmet.feign.EpmetHeartOpenFeignClient; import com.epmet.redis.GridLatestRedis; import com.epmet.redis.UserBaseInfoRedis; import com.epmet.service.GridLatestService; @@ -49,6 +51,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; /** * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 @@ -67,6 +70,9 @@ public class GridLatestServiceImpl extends BaseServiceImpl page(Map params) { @@ -184,11 +190,19 @@ public class GridLatestServiceImpl extends BaseServiceImpl getCustomerUsers(CustomerUserFormDTO customerUserFormDTO) { + List userIds = baseDao.selectAllUserByCustomerId(customerUserFormDTO.getCustomerId()); List allData = new LinkedList<>(); if(null == userIds || userIds.isEmpty()){ return allData; } + CommonCustomerFormDTO customerParam = new CommonCustomerFormDTO(); + customerParam.setCustomerId(customerUserFormDTO.getCustomerId()); + Result> volunteer = epmetHeartOpenFeignClient.volunteerUserIds(customerParam); + if(volunteer.success() && null != volunteer.getData() && !volunteer.getData().isEmpty()){ + userIds.addAll(volunteer.getData()); + userIds = userIds.stream().distinct().collect(Collectors.toList()); + } PageHelper.startPage(customerUserFormDTO.getPageNo(),customerUserFormDTO.getPageSize()); allData = userWechatDao.selectResiAndStrangerInfo(userIds,customerUserFormDTO.getName()); if(null == allData || allData.isEmpty()){ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml index 9a628f87f9..a649f1b540 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml @@ -85,13 +85,14 @@ +