Authored by tanling

接口

  1 +package com.yohoufo.order.controller;
  2 +
  3 +
  4 +import com.yohoufo.order.request.ShoppingRequest;
  5 +import com.yohoufo.order.response.ShoppingPaymentResponse;
  6 +import com.yohoufo.order.service.IShoppingService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Controller;
  9 +import org.springframework.web.bind.annotation.RequestBody;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.ResponseBody;
  12 +
  13 +@Controller
  14 +@RequestMapping(value = "/shopping")
  15 +public class ShoppingController {
  16 +
  17 +
  18 + @Autowired
  19 + IShoppingService shoppingService;
  20 +
  21 +
  22 + @RequestMapping("/payment")
  23 + @ResponseBody
  24 + public ShoppingPaymentResponse payment(@RequestBody ShoppingRequest shoppingRequest){
  25 +
  26 + return null;
  27 + }
  28 +}
  1 +package com.yohoufo.order.request;
  2 +
  3 +import lombok.Data;
  4 +
  5 +@Data
  6 +public class ShoppingRequest {
  7 +
  8 + private String skup;
  9 +
  10 + private String uid;
  11 +}
  1 +package com.yohoufo.order.response;
  2 +
  3 +import lombok.Data;
  4 +
  5 +@Data
  6 +public class ShoppingPaymentResponse {
  7 +}
  1 +package com.yohoufo.order.service;
  2 +
  3 +
  4 +public interface IShoppingService {
  5 +}
  1 +package com.yohoufo.order.service.impl;
  2 +
  3 +import com.yoho.error.ServiceError;
  4 +import com.yoho.error.exception.ServiceException;
  5 +import com.yohoufo.order.request.ShoppingRequest;
  6 +import com.yohoufo.order.response.ShoppingPaymentResponse;
  7 +import com.yohoufo.order.service.IShoppingService;
  8 +import org.apache.commons.lang3.StringUtils;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +
  12 +public class ShoppingServiceImpl implements IShoppingService{
  13 +
  14 + private final Logger logger = LoggerFactory.getLogger(getClass());
  15 +
  16 + public ShoppingPaymentResponse payment(ShoppingRequest shoppingRequest){
  17 +
  18 + // 入口参数检查
  19 + if (StringUtils.isEmpty(shoppingRequest.getUid())
  20 + || StringUtils.isEmpty(shoppingRequest.getSkup())){
  21 + logger.warn("payment uid or skup is null");
  22 + // TODO
  23 + throw new ServiceException(ServiceError.ORDER_REQUEST_ERROR);
  24 + }
  25 +
  26 + // skup是否是可售状态
  27 +
  28 +
  29 +
  30 + return null;
  31 + }
  32 +}
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <parent> 6 <parent>
7 <groupId>com.yoho</groupId> 7 <groupId>com.yoho</groupId>
8 <artifactId>parent</artifactId> 8 <artifactId>parent</artifactId>
9 - <version>1.4.4-SNAPSHOT</version> 9 + <version>1.4.5-SNAPSHOT</version>
10 </parent> 10 </parent>
11 11
12 <groupId>com.yohoufo.fore</groupId> 12 <groupId>com.yohoufo.fore</groupId>
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> 2 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3 - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> 3 + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4 <output url="file://$MODULE_DIR$/target/classes" /> 4 <output url="file://$MODULE_DIR$/target/classes" />
5 <output-test url="file://$MODULE_DIR$/target/test-classes" /> 5 <output-test url="file://$MODULE_DIR$/target/test-classes" />
6 <content url="file://$MODULE_DIR$"> 6 <content url="file://$MODULE_DIR$">