mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-01-26 11:51:55 +08:00
2024-09-16 半流程
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.ruoyi.system.api;
|
||||
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.system.api.factory.RemoteChannelFallbackFactory;
|
||||
import com.ruoyi.system.api.factory.RemoteCustomerApplyLogFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 用户服务
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@FeignClient(contextId = "remoteChannelService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteChannelFallbackFactory.class)
|
||||
public interface RemoteChannelService
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -3,12 +3,12 @@ package com.ruoyi.system.api;
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
|
||||
import com.ruoyi.common.core.domain.http.Merchant;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.system.api.factory.RemoteCustomerApplyLogFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -31,4 +31,23 @@ public interface RemoteCustomerApplyLogService
|
||||
@GetMapping("/log/sum")
|
||||
public R<Integer> sum(@PathVariable("merchantId") Long merchantId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 获取用户今日是否是否已申请
|
||||
*
|
||||
*
|
||||
* @param customerID
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/log/customerApply")
|
||||
public R<Boolean> customerApply(@PathVariable("customerID") Long customerID,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
* @param customerApplyLog
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/log")
|
||||
public AjaxResult add(@RequestBody CustomerApplyLog customerApplyLog);
|
||||
|
||||
}
|
||||
|
||||
@@ -52,4 +52,11 @@ public interface RemoteCustomerService
|
||||
@PostMapping("/customer/addNewCustomer")
|
||||
public R add(@RequestBody Customer customer,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 获取用户token
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/customer/getCustomerToken")
|
||||
public String getCustomerToken(@RequestParam("phone") String phone);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ruoyi.system.api.factory;
|
||||
|
||||
|
||||
import com.ruoyi.system.api.RemoteChannelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class RemoteChannelFallbackFactory implements FallbackFactory<RemoteChannelService>
|
||||
{
|
||||
|
||||
@Override
|
||||
public RemoteChannelService create(Throwable throwable)
|
||||
{
|
||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteChannelService()
|
||||
{
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package com.ruoyi.system.api.factory;
|
||||
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
|
||||
import com.ruoyi.common.core.domain.http.Merchant;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.system.api.RemoteCustomerApplyLogService;
|
||||
import com.ruoyi.system.api.RemoteMerchantService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -35,7 +37,15 @@ public class RemoteCustomerApplyLogFallbackFactory implements FallbackFactory<Re
|
||||
return R.fail("获取商户已申请数失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> customerApply(Long customerID, String source) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult add(CustomerApplyLog customerApplyLog) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,11 @@ public class RemoteCustomerFallbackFactory implements FallbackFactory<RemoteCust
|
||||
log.info("新增用户失败:{}",throwable.getMessage());
|
||||
return R.fail("新增用户失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCustomerToken(String phone) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user