...
|
...
|
@@ -5,21 +5,16 @@ import java.util.List; |
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.yoho.core.rest.annotation.ServiceDesc;
|
|
|
import com.yoho.service.model.resource.request.ResourcesRequestBody;
|
|
|
import com.yohoufo.common.ApiResponse;
|
|
|
import com.yohoufo.resource.request.ResourcesRequest;
|
|
|
import com.yohoufo.resource.service.IResourcesService;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/resources")
|
|
|
@ServiceDesc(serviceName = "resources")
|
|
|
public class ResourcesController {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ResourcesController.class);
|
...
|
...
|
@@ -28,30 +23,20 @@ public class ResourcesController { |
|
|
private IResourcesService resourcesService;
|
|
|
|
|
|
/**
|
|
|
* 根据内容码,获取单个内容个体
|
|
|
*
|
|
|
* <p>根据contentCode返回资源结果</p>
|
|
|
*
|
|
|
* @param contentCode
|
|
|
* @param clientType
|
|
|
* @return
|
|
|
* @date: Created on 2018年9月18日 上午10:36:49
|
|
|
*/
|
|
|
@RequestMapping(value = "/get", method = RequestMethod.POST)
|
|
|
public @ResponseBody ApiResponse get(@RequestBody ResourcesRequestBody request) {
|
|
|
logger.info("Get resources by content code[{}] and client type [{}].", request.getContentCode(),
|
|
|
request.getClientType());
|
|
|
List<Object> data = resourcesService.get(request);
|
|
|
logger.info("Get resources by content code[{}] and client type [{}] success.", request.getContentCode(),
|
|
|
request.getClientType());
|
|
|
return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("resources data").build();
|
|
|
|
|
|
}
|
|
|
|
|
|
@RequestMapping(params = "method=ufo.resource.get")
|
|
|
public ApiResponse payment(@RequestParam(name = "contentCode") String contentCode,
|
|
|
@ResponseBody
|
|
|
public ApiResponse getResource(@RequestParam(name = "contentCode") String contentCode,
|
|
|
@RequestParam(name = "clientType") String clientType) {
|
|
|
|
|
|
ResourcesRequestBody request = new ResourcesRequestBody();
|
|
|
request.setClientType(clientType);
|
|
|
request.setContentCode(contentCode);
|
|
|
logger.info("Get resources by content code[{}] and client type [{}].", request.getContentCode(),
|
|
|
request.getClientType());
|
|
|
logger.info("Get resources by content code[{}] and client type [{}].", contentCode, clientType);
|
|
|
ResourcesRequest request = ResourcesRequest.builder().clientType(clientType).contentCode(contentCode).build();
|
|
|
List<Object> data = resourcesService.get(request);
|
|
|
logger.info("Get resources by content code[{}] and client type [{}] success.", request.getContentCode(),
|
|
|
request.getClientType());
|
...
|
...
|
|