Browse Source

积分调整可选用户列表,跨客户、单客户

dev
wangchao 5 years ago
parent
commit
1ba2504daa
  1. 27
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/CommonCustomerFormDTO.java
  2. 16
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  3. 18
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
  4. 16
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  5. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java
  6. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  7. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  8. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml
  9. 6
      epmet-user/epmet-user-server/pom.xml
  10. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java
  11. 11
      epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml
  12. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml

27
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;
}

16
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<List<String>> volunteerUserIds(@RequestBody CommonCustomerFormDTO customerFormDTO);
}

18
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<List<String>> volunteerUserIds(CommonCustomerFormDTO customerFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "volunteerUserIds", customerFormDTO);
}
}

16
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<List<String>> volunteerUserIds(@RequestBody CommonCustomerFormDTO customerFormDTO){
ValidatorUtils.validateEntity(customerFormDTO,CommonCustomerFormDTO.CustomerIdGroup.class);
return new Result<List<String>>().ok(volunteerInfoService.selectVolunteerIds(customerFormDTO));
}
}

11
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<VolunteerInfoEntity> {
* @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<String> selectVolunteerIds(@Param("customerId")String customerId);
}

10
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<VolunteerInfoEntity> {
* @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<String> selectVolunteerIds(CommonCustomerFormDTO customerFormDTO);
}

13
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<VolunteerInfoDao,
logger.info(String.format("发送短信验证码成功,手机号[%s]", formDTO.getMobile()));
}
/**
* @Description 根据客户Id查询志愿者用户Id集合
* @param customerFormDTO
* @return
* @author wangc
* @date 2020.08.13 10:22
**/
@Override
public List<String> selectVolunteerIds(CommonCustomerFormDTO customerFormDTO) {
return baseDao.selectVolunteerIds(customerFormDTO.getCustomerId());
}
/**
* 保存短信验证码(删除现有短信验证码将新的短信验证码存入Redis)
* 过期时长为30分钟

9
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}
</select>
<!-- 查询一个客户下的所有志愿者用户Id -->
<select id="selectVolunteerIds" resultType="java.util.List">
SELECT
USER_ID
FROM volunteer_info
WHERE DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
</select>
</mapper>

6
epmet-user/epmet-user-server/pom.xml

@ -94,6 +94,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-heart-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

14
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<GridLatestDao, GridLa
private UserBaseInfoRedis userBaseInfoRedis;
@Autowired
private UserWechatDao userWechatDao;
@Autowired
private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient;
@Override
public PageData<GridLatestDTO> page(Map<String, Object> params) {
@ -184,11 +190,19 @@ public class GridLatestServiceImpl extends BaseServiceImpl<GridLatestDao, GridLa
**/
@Override
public List<CustomerUser4PointResultDTO> getCustomerUsers(CustomerUserFormDTO customerUserFormDTO) {
List<String> userIds = baseDao.selectAllUserByCustomerId(customerUserFormDTO.getCustomerId());
List<CustomerUser4PointResultDTO> allData = new LinkedList<>();
if(null == userIds || userIds.isEmpty()){
return allData;
}
CommonCustomerFormDTO customerParam = new CommonCustomerFormDTO();
customerParam.setCustomerId(customerUserFormDTO.getCustomerId());
Result<List<String>> 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()){

11
epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml

@ -85,13 +85,14 @@
<!-- 查询一个客户下的居民和陌生人 传参 : 客户Id -->
<select id="selectAllUserByCustomerId" resultType="string">
SELECT DISTINCT
customer_user_id
SELECT
*
FROM
grid_latest
USER_CUSTOMER
WHERE
del_flag = '0'
AND customer_id = #{customerId}
DEL_FLAG = '0'
AND IS_REGISTER = '1'
AND CUSTOMER_ID = #{customerId}
</select>
<select id="selectLatestGridInfo" resultType="com.epmet.dto.result.LatestGridInfoResultDTO">

2
epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml

@ -34,6 +34,8 @@
ur.DEL_FLAG = 0
AND
ur.USER_ID = #{userId}
AND
ur.CUSTOMER_ID = #{customerId}
<if test='null != gridId and "" != gridId'>
AND( ur.GRID_ID = #{gridId} OR ur.GRID_ID = 'all' )
</if>

Loading…
Cancel
Save