25 changed files with 203 additions and 233 deletions
			
			
		| @ -1,116 +0,0 @@ | |||
| package com.epmet.feign; | |||
| 
 | |||
| import com.epmet.commons.tools.constant.ServiceConstant; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.dto.UserWechatDTO; | |||
| import com.epmet.dto.form.RegisterFormDTO; | |||
| import com.epmet.dto.form.SaveUserVisitedFormDTO; | |||
| import com.epmet.dto.form.WxLoginFormDTO; | |||
| import com.epmet.dto.result.*; | |||
| import com.epmet.feign.fallback.EpmetThirdFeignClientFallback; | |||
| import me.chanjar.weixin.mp.bean.result.WxMpUser; | |||
| import org.springframework.cloud.openfeign.FeignClient; | |||
| import org.springframework.http.MediaType; | |||
| import org.springframework.web.bind.annotation.PathVariable; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| 
 | |||
| /** | |||
|  * 本服务对外开放的API,其他服务通过引用此client调用该服务 | |||
|  * | |||
|  * @Author zxc | |||
|  * @CreateTime 2020/7/5 14:45 | |||
|  * ,url="localhost:8110" | |||
|  */ | |||
| @FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = EpmetThirdFeignClientFallback.class) | |||
| 
 | |||
| public interface EpmetThirdFeignClient { | |||
| 
 | |||
|     /** | |||
|      * @param wxMpUser | |||
|      * @return | |||
|      * @Author sun | |||
|      * @Description 根据openId新增或更新用户信息 | |||
|      **/ | |||
|     @PostMapping(value = "third/pauser/saveuser", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) | |||
|     Result<SaveUserResultDTO> saveUser(@RequestBody WxMpUser wxMpUser); | |||
| 
 | |||
|     /** | |||
|      * @param phone | |||
|      * @return | |||
|      * @Author sun | |||
|      * @Description 根据手机号查询公众号用户基本信息,校验用户是否存在 | |||
|      **/ | |||
|     @PostMapping(value = "third/pauser/checkpauser/{phone}") | |||
|     Result<CustomerUserResultDTO> checkPaUser(@PathVariable("phone") String phone); | |||
| 
 | |||
|     /** | |||
|      * @param visited | |||
|      * @return | |||
|      * @Author sun | |||
|      * @Description 用户登陆,新增访问记录数据 | |||
|      **/ | |||
|     @PostMapping(value = "third/pauservisited/saveuservisited") | |||
|     Result saveUserVisited(@RequestBody SaveUserVisitedFormDTO visited); | |||
| 
 | |||
|     /** | |||
|      * @param customerId | |||
|      * @return | |||
|      * @Author sun | |||
|      * @Description 根据客户Id查询各项注册信息 | |||
|      **/ | |||
|     @PostMapping(value = "third/pacustomer/getcustomeragencyuser/{customerId}") | |||
|     Result<InitCustomerResultDTO> getCustomerAgencyUser(@PathVariable("customerId") String customerId); | |||
| 
 | |||
|     /** | |||
|      * @param customerId | |||
|      * @return | |||
|      * @Author sun | |||
|      * @Description 修改客户数据状态为已完成初始化 | |||
|      **/ | |||
|     @PostMapping(value = "third/pacustomer/updatecustomer/{customerId}") | |||
|     Result updateCustomer(@PathVariable("customerId") String customerId); | |||
| 
 | |||
|     /** | |||
|      * @Description  获取【component_access_token】的定时任务 10min/次 | |||
|      * @param | |||
|      * @author zxc | |||
|      */ | |||
|     @PostMapping(value = "third/wechatthird/componentaccesstoken") | |||
|     Result getComponentAccessTokenJob(); | |||
| 
 | |||
|     /** | |||
|      * @Description  获取/刷新接口调用令牌  10min/次 | |||
|      * @param | |||
|      * @author zxc | |||
|      */ | |||
|     @PostMapping(value = "third/wechatthird/refreshtoken") | |||
|     Result refreshAuthorizerAccessTokenJob(); | |||
| 
 | |||
|     /** | |||
|      * @param formDTO | |||
|      * @return | |||
|      * @Author sun | |||
|      * @Description 校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息 | |||
|      **/ | |||
|     @PostMapping(value = "third/customermp/resiandworklogin") | |||
|     Result<UserWechatDTO> resiAndWorkLogin(@RequestBody WxLoginFormDTO formDTO); | |||
| 
 | |||
|     /** | |||
|      * @param appId | |||
|      * @return | |||
|      * @Author sun | |||
|      * @Description 根据appId查询公众号注册的客户信息 | |||
|      **/ | |||
|     @PostMapping(value = "third/customermp/getcustomermsg/{appId}") | |||
|     Result<PublicCustomerResultDTO> getCustomerMsg(@PathVariable("appId") String appId); | |||
| 
 | |||
|     /** | |||
|      * @param formDTO | |||
|      * @return | |||
|      * @Author sun | |||
|      * @Description 用户登陆,新增访问记录数据 | |||
|      **/ | |||
|     @PostMapping(value = "third/pacustomer/register") | |||
|     Result<RegisterResultDTO> register(@RequestBody RegisterFormDTO formDTO); | |||
| } | |||
| @ -1,71 +0,0 @@ | |||
| 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.UserWechatDTO; | |||
| import com.epmet.dto.form.RegisterFormDTO; | |||
| import com.epmet.dto.form.SaveUserVisitedFormDTO; | |||
| import com.epmet.dto.form.WxLoginFormDTO; | |||
| import com.epmet.dto.result.*; | |||
| import com.epmet.feign.EpmetThirdFeignClient; | |||
| import me.chanjar.weixin.mp.bean.result.WxMpUser; | |||
| import org.springframework.stereotype.Component; | |||
| 
 | |||
| /** | |||
|  * @Author zxc | |||
|  * @CreateTime 2020/7/5 14:46 | |||
|  */ | |||
| @Component | |||
| public class EpmetThirdFeignClientFallback implements EpmetThirdFeignClient { | |||
| 
 | |||
|     @Override | |||
|     public Result<SaveUserResultDTO> saveUser(WxMpUser wxMpUser) { | |||
|         return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveUser", wxMpUser); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public Result<CustomerUserResultDTO> checkPaUser(String phone) { | |||
|         return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "checkPaUser", phone); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public Result saveUserVisited(SaveUserVisitedFormDTO visited) { | |||
|         return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveUserVisited", visited); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public Result<InitCustomerResultDTO> getCustomerAgencyUser(String customerId) { | |||
|         return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "getCustomerAgencyUser", customerId); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public Result updateCustomer(String customerId) { | |||
|         return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "updateCustomer", customerId); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public Result getComponentAccessTokenJob() { | |||
|         return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "getComponentAccessTokenJob"); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public Result refreshAuthorizerAccessTokenJob() { | |||
|         return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "refreshAuthorizerAccessTokenJob"); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public Result<UserWechatDTO> resiAndWorkLogin(WxLoginFormDTO formDTO) { | |||
|         return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "resiAndWorkLogin", formDTO); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public Result<PublicCustomerResultDTO> getCustomerMsg(String appId) { | |||
|         return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "getCustomerMsg", appId); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public Result<RegisterResultDTO> register(RegisterFormDTO formDTO) { | |||
|         return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "register", formDTO); | |||
|     } | |||
| } | |||
					Loading…
					
					
				
		Reference in new issue