From 9f3aadfb13fb730d1d16df6c86df43ab00ddff1c Mon Sep 17 00:00:00 2001 From: songyunpeng Date: Wed, 9 Dec 2020 17:43:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=BC=E5=9B=A2=E8=B4=AD=20=E9=A1=BA?= =?UTF-8?q?=E9=81=93=E6=8D=8E=20bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epdc/controller/ApiAppUserController.java | 18 +++++++++++++++++- .../esua/epdc/service/AppUserService.java | 9 +++++++++ .../epdc/service/impl/AppUserServiceImpl.java | 6 +++++- .../epdc/service/impl/CustomServiceImpl.java | 14 ++++++++++++++ .../dto/form/EpdcAddGroupBuyInfoFormDTO.java | 2 +- 5 files changed, 46 insertions(+), 3 deletions(-) diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAppUserController.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAppUserController.java index 8e66a4e6..067d4f9f 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAppUserController.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAppUserController.java @@ -5,11 +5,12 @@ import com.elink.esua.epdc.commons.tools.annotation.LoginUser; import com.elink.esua.epdc.commons.tools.enums.BehaviorEnum; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.dto.VolunteerInfoDTO; import com.elink.esua.epdc.dto.epdc.form.*; import com.elink.esua.epdc.dto.epdc.result.*; import com.elink.esua.epdc.dto.form.*; -import com.elink.esua.epdc.dto.result.EpdcAppRegisterCallbackDTO; import com.elink.esua.epdc.dto.result.EpdcAppAuthorizationDTO; +import com.elink.esua.epdc.dto.result.EpdcAppRegisterCallbackDTO; import com.elink.esua.epdc.dto.result.EpdcCompleteUserInfoDTO; import com.elink.esua.epdc.pointcommons.tools.annotation.RecordUserBehavior; import com.elink.esua.epdc.service.AppUserService; @@ -384,4 +385,19 @@ public class ApiAppUserController { } return appUserService.userSign(userDetail); } + /** + * @Description 验证是否是志愿者 + * @Author songyunpeng + * @Date 2020/12/9 + * @Param [userDetail] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @GetMapping("user/volunteerVerify") + public Result volunteerVerify(@LoginUser TokenDto userDetail){ + if(userDetail==null){ + return new Result().error("用户未登录"); + } + return appUserService.volunteerVerify(userDetail); + } + } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppUserService.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppUserService.java index 0db9f9d1..3ce253dd 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppUserService.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppUserService.java @@ -4,6 +4,7 @@ import com.elink.esua.epdc.common.token.dto.TokenDto; import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.dto.DeptOption; +import com.elink.esua.epdc.dto.VolunteerInfoDTO; import com.elink.esua.epdc.dto.epdc.form.*; import com.elink.esua.epdc.dto.epdc.form.v2.EpdcCompleteVolunteerInfoV2FormDTO; import com.elink.esua.epdc.dto.epdc.result.*; @@ -384,4 +385,12 @@ public interface AppUserService { * @return com.elink.esua.epdc.commons.tools.utils.Result> **/ Result> selectPeopleByCurrentAddress(EpdcScreenResidentInfoByCurrentAddressFormDTO dto); + /** + * @Description + * @Author songyunpeng + * @Date 2020/12/9 + * @Param [userDetail] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + Result volunteerVerify(TokenDto userDetail); } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java index 0d97aa74..f86078f4 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java @@ -60,7 +60,6 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.util.ArrayList; -import java.util.Collections; import java.util.Date; import java.util.List; @@ -1626,4 +1625,9 @@ public class AppUserServiceImpl implements AppUserService { return userFeignClient.selectPeopleByCurrentAddress(dto); } + @Override + public Result volunteerVerify(TokenDto userDetail) { + return userFeignClient.selectUserVolunteerInfo(userDetail.getUserId()); + } + } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/CustomServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/CustomServiceImpl.java index da393035..5be721c7 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/CustomServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/CustomServiceImpl.java @@ -7,10 +7,12 @@ import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.dto.DeptOption; import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; +import com.elink.esua.epdc.dto.VolunteerInfoDTO; import com.elink.esua.epdc.dto.form.*; import com.elink.esua.epdc.dto.result.*; import com.elink.esua.epdc.feign.AdminFeignClient; import com.elink.esua.epdc.feign.CustomFeignClient; +import com.elink.esua.epdc.feign.UserFeignClient; import com.elink.esua.epdc.redis.AppUserRedis; import com.elink.esua.epdc.service.CustomService; import org.apache.commons.lang3.StringUtils; @@ -32,6 +34,8 @@ public class CustomServiceImpl implements CustomService { @Autowired private CustomFeignClient customFeignClient; @Autowired + private UserFeignClient userFeignClient; + @Autowired private AppUserRedis appUserRedis; /** @@ -197,6 +201,11 @@ public class CustomServiceImpl implements CustomService { if(StringUtils.isBlank(tokenDto.getUserId())){ return new Result>().error("无效的token"); } + //验证是否是志愿者 + Result volunteerInfoDTOResult = userFeignClient.selectUserVolunteerInfo(tokenDto.getUserId()); + if(volunteerInfoDTOResult==null || volunteerInfoDTOResult.getData()==null || StringUtils.isBlank(volunteerInfoDTOResult.getData().getId())){ + return new Result().error("未查到该用户志愿者信息!"); + } formDTO.setUserId(tokenDto.getUserId()); formDTO.setFaceImg(tokenDto.getFaceImg()); formDTO.setRealName(tokenDto.getRealName()); @@ -247,6 +256,11 @@ public class CustomServiceImpl implements CustomService { if(StringUtils.isBlank(tokenDto.getUserId())){ return new Result>().error("无效的token"); } + //验证是否是志愿者 + Result volunteerInfoDTOResult = userFeignClient.selectUserVolunteerInfo(tokenDto.getUserId()); + if(volunteerInfoDTOResult==null || volunteerInfoDTOResult.getData()==null || StringUtils.isBlank(volunteerInfoDTOResult.getData().getId())){ + return new Result().error("未查到该用户志愿者信息!"); + } formDTO.setUserId(tokenDto.getUserId()); formDTO.setFaceImg(tokenDto.getFaceImg()); formDTO.setRealName(tokenDto.getRealName()); diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EpdcAddGroupBuyInfoFormDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EpdcAddGroupBuyInfoFormDTO.java index a376ef02..b50a3733 100644 --- a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EpdcAddGroupBuyInfoFormDTO.java +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EpdcAddGroupBuyInfoFormDTO.java @@ -46,7 +46,7 @@ public class EpdcAddGroupBuyInfoFormDTO implements Serializable { * 标题 */ @NotBlank(message = "标题不能为空") - @Size(min = 1,max = 16,message = "标题在16字以内") + @Size(min = 1,max = 50,message = "标题在50字以内") private String groupBuyTitle; /**