Commit 4b14509a441cfaff2f17c8d0b2d9d57de12985b1

Authored by jiangchengyong
1 parent 5e1d1d34

schema update

Showing 44 changed files with 2029 additions and 343 deletions
myapp-common/src/main/java/com/b2c/myapp/common/utils/BaseOutput.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.b2c.myapp.common.utils;
  6 +
  7 +/**
  8 + * 基础输出对象
  9 + *
  10 + * @author dev-center
  11 + * @since 2014-05-10
  12 + */
  13 +public class BaseOutput<T> {
  14 +
  15 + /**
  16 + * 业务状态码 <br/>
  17 + * 200代表成功,其它表示失败,具体失败原因请查看ResultCode属性
  18 + */
  19 + private String code;//
  20 + /**
  21 + * 业务状态说明 <br/>
  22 + * 200时返回OK,code!=200时表示具体失败原因
  23 + */
  24 + private String result;
  25 + /**
  26 + * 返回业务数据 <br/>
  27 + * 根据接口泛型指定
  28 + */
  29 + private T data;// 数据
  30 +
  31 + /**
  32 + * 非业务数据,api调用业务状态码不为200时的错误数据,具体数据是否有值,查看ResultCode,根据状态码确定
  33 + */
  34 + private String errorData;
  35 +
  36 + public BaseOutput() {
  37 + }
  38 +
  39 + public BaseOutput(String code, String result) {
  40 + this.code = code;
  41 + this.result = result;
  42 + }
  43 +
  44 + public String getCode() {
  45 + return code;
  46 + }
  47 +
  48 + public void setCode(String code) {
  49 + this.code = code;
  50 + }
  51 +
  52 + public String getResult() {
  53 + return result;
  54 + }
  55 +
  56 + public void setResult(String result) {
  57 + this.result = result;
  58 + }
  59 +
  60 + public T getData() {
  61 + return (T) data;
  62 + }
  63 +
  64 + public void setData(T data) {
  65 + this.data = data;
  66 + }
  67 +
  68 + public static <T> BaseOutput<T> create(String code, String result) {
  69 + return new BaseOutput<T>(code, result);
  70 + }
  71 +
  72 + public static <T> BaseOutput<T> success() {
  73 + return success("OK");
  74 + }
  75 +
  76 + public static <T> BaseOutput<T> success(String msg) {
  77 + return create(ResultCode.OK, msg);
  78 + }
  79 +
  80 + public static <T> BaseOutput<T> failure() {
  81 + return failure("操作失败!");
  82 + }
  83 +
  84 + public static <T> BaseOutput<T> failure(String msg) {
  85 + return create(ResultCode.APP_ERROR, msg);
  86 + }
  87 +
  88 +
  89 + public String getErrorData() {
  90 + return errorData;
  91 + }
  92 +
  93 + public void setErrorData(String errorData) {
  94 + this.errorData = errorData;
  95 + }
  96 +}
myapp-common/src/main/java/com/b2c/myapp/common/utils/CommonUtils.java 0 → 100644
  1 +package com.b2c.myapp.common.utils;
  2 +
  3 +import com.b2c.myapp.common.utils.exception.*;
  4 +import org.springframework.web.context.ContextLoader;
  5 +import org.springframework.web.context.WebApplicationContext;
  6 +
  7 +public class CommonUtils {
  8 +
  9 + public static void throwAppException(boolean expect,String msg) throws AppException {
  10 + if (expect) {
  11 + throw new AppException(msg);
  12 + }
  13 + }
  14 +
  15 + public static void throwAppException(Exception e) throws AppException {
  16 + throw new AppException(e);
  17 + }
  18 + /**
  19 + * expect=true时抛出DataErrorException异常
  20 + * @param expect
  21 + * @param msg
  22 + */
  23 + public static void throwDataError(boolean expect, String msg) throws DataErrorException {
  24 + if (expect) {
  25 + throw new DataErrorException(msg);
  26 + }
  27 + }
  28 +
  29 + public static void throwDataError(boolean expect,String code,String data, String msg) throws DataErrorException {
  30 + if (expect) {
  31 + throw new DataErrorException(code,data,msg);
  32 + }
  33 + }
  34 +
  35 + /**
  36 + * expect=true时抛出NotAuthException异常
  37 + * @param expect
  38 + * @param msg
  39 + */
  40 + public static void throwNotAuth(boolean expect, String msg) throws NotAuthException {
  41 + if (expect) {
  42 + throw new NotAuthException(msg);
  43 + }
  44 + }
  45 +
  46 + /**
  47 + * expect=true时抛出ParamErrorException异常
  48 + * @param expect
  49 + * @param msg
  50 + */
  51 + public static void throwParamError(boolean expect, String msg) throws ParamErrorException {
  52 + if (expect) {
  53 + throw new ParamErrorException(msg);
  54 + }
  55 + }
  56 +
  57 + public static void throwParamError(boolean expect,String code,String data, String msg) throws ParamErrorException {
  58 + if (expect) {
  59 + throw new ParamErrorException(code,data,msg);
  60 + }
  61 + }
  62 +
  63 + public static void throwParamError(boolean expect,String code, String msg) throws ParamErrorException {
  64 + if (expect) {
  65 + throw new ParamErrorException(code,msg);
  66 + }
  67 + }
  68 +
  69 + /**
  70 + * expect=true时抛出RpcConnectException异常
  71 + * @param expect
  72 + * @param msg
  73 + */
  74 + public static void throwRpcConnect(boolean expect, String msg) throws RpcConnectException {
  75 + if (expect) {
  76 + throw new RpcConnectException(msg);
  77 + }
  78 + }
  79 + /**
  80 + * 抛出RpcConnectException异常
  81 + * @param e
  82 + */
  83 + public static void throwRpcConnect(Exception e) throws RpcConnectException {
  84 + throw new RpcConnectException(e);
  85 + }
  86 + /**
  87 + * 抛出RpcConnectException异常
  88 + * @param msg
  89 + * @param e
  90 + */
  91 + public static void throwRpcConnect(String msg,Exception e) throws RpcConnectException {
  92 + throw new RpcConnectException(msg,e);
  93 + }
  94 +
  95 + public static void throwRpcConnect(String code,String message) throws RpcConnectException {
  96 + throw new RpcConnectException(code,message);
  97 + }
  98 +
  99 + public static void throwRpcConnect(String msg) throws RpcConnectException {
  100 + throw new RpcConnectException(msg);
  101 + }
  102 +
  103 + public static void throwRpcPayment(boolean expect, String msg) throws RpcPaymentException {
  104 + if (expect) {
  105 + throw new RpcPaymentException(msg);
  106 + }
  107 + }
  108 +
  109 + public static void throwRpcPayment(String code,String message) throws RpcPaymentException {
  110 + throw new RpcPaymentException(code,message);
  111 + }
  112 +
  113 + public static void throwRpcPayment(String msg,Exception e) throws RpcPaymentException {
  114 + throw new RpcPaymentException(msg,e);
  115 + }
  116 +
  117 + public static void throwRpcPayment(String msg) throws RpcPaymentException {
  118 + throw new RpcPaymentException(msg);
  119 + }
  120 +
  121 + public static void throwRpcGuard(boolean expect, String msg) throws RpcGuardException {
  122 + if (expect) {
  123 + throw new RpcGuardException(msg);
  124 + }
  125 + }
  126 +
  127 + public static void throwRpcGuard(String code,String message) throws RpcGuardException {
  128 + throw new RpcGuardException(code,message);
  129 + }
  130 +
  131 + public static void throwRpcGuard(String msg,Exception e) throws RpcGuardException {
  132 + throw new RpcGuardException(msg,e);
  133 + }
  134 +
  135 + public static void throwRpcGuard(String msg) throws RpcGuardException {
  136 + throw new RpcGuardException(msg);
  137 + }
  138 +
  139 + public static WebApplicationContext getWebApplicationContext() {
  140 + return ContextLoader.getCurrentWebApplicationContext();
  141 + }
  142 +}
myapp-common/src/main/java/com/b2c/myapp/common/utils/ResultCode.java 0 → 100644
  1 +package com.b2c.myapp.common.utils;
  2 +
  3 +public class ResultCode {
  4 +
  5 + /**200:成功
  6 + * <li>前端是否可直接显示后台返回的message:是</li>
  7 + * <li>是否有出现错误的数据返回给前端:无</li>
  8 + */
  9 + public static final String OK="200";
  10 +
  11 + /**
  12 + * 500:数据参数异常,业务系统可以直接展示提示信息
  13 + */
  14 + public static final String DATA_PARAM_ERROR = "500";
  15 +
  16 +
  17 + /**1000:输入参数错误(输入参数类型、值、null等错误) <br/>
  18 + * <li>前端是否可直接显示后台返回的message:是</li>
  19 + * <li>是否有出现错误的数据返回给前端:无</li>
  20 + */
  21 + public static final String PARAMS_ERROR="1000";
  22 +
  23 + /**1001:输入参数错误,存在SKU重复的商品。 <br/>
  24 + * <li>前端是否可直接显示后台返回的message:否</li>
  25 + * <li>是否有出现错误的数据返回给前端:有</li>
  26 + * <li>返回错误数据:单个重复商品的SKU</li>
  27 + */
  28 + public static final String DUPLICATED_SKU="1001";
  29 +
  30 + /**1002:输入数据错误,提交的所有商品不存在 <br/>
  31 + * <li>前端是否可直接显示后台返回的message:是</li>
  32 + * <li>是否有出现错误的数据返回给前端:无</li>
  33 + */
  34 + public static final String ALL_PRODUCTS_NOT_EXISTS="1002";
  35 +
  36 +
  37 + /**1003:输入参数错误,SKU对应的商品在系统中不存在 <br/>
  38 + * <li>前端是否可直接显示后台返回的message:否</li>
  39 + * <li>是否有出现错误的数据返回给前端:有</li>
  40 + * <li>返回错误数据:单个不存在的商品的SKU</li>
  41 + */
  42 + public static final String PRODUCT_NOT_EXIST="1003";
  43 +
  44 +
  45 + /**1004:输入参数错误,SKU对应的商品不在售 <br/>
  46 + * <li>前端是否可直接显示后台返回的message:是</li>
  47 + * <li>是否有出现错误的数据返回给前端:有</li>
  48 + * <li>返回错误数据:不在售商品的SKU</li>
  49 + */
  50 + public static final String PRODUCT_NOT_SALE="1004";
  51 +
  52 + /**1005:输入参数错误,SKU对应的商品库存不足 <br/>
  53 + * <li>前端是否可直接显示后台返回的message:是</li>
  54 + * <li>是否有出现错误的数据返回给前端:有</li>
  55 + * <li>返回错误数据:库存不足商品的SKU</li>
  56 + */
  57 + public static final String PRODUCT_STOCK_SMALL="1005";
  58 +
  59 +
  60 + /**1006:输入参数错误,SKU对应的商品不属于当前店铺 <br/>
  61 + * <li>前端是否可直接显示后台返回的message:是</li>
  62 + * <li>是否有出现错误的数据返回给前端:有</li>
  63 + * <li>返回错误数据:商品的SKU</li>
  64 + */
  65 + public static final String PRODUCT_NOT_BGLONG_SHOP="1006";
  66 +
  67 + /**1007:输入参数错误,SKU对应的商品价格发生变化 <br/>
  68 + * <li>前端是否可直接显示后台返回的message:是</li>
  69 + * <li>是否有出现错误的数据返回给前端:有</li>
  70 + * <li>返回错误数据:商品的SKU</li>
  71 + */
  72 + public static final String PRODUCT_PRICE_CHANGED="1007";
  73 +
  74 + /**1008:店铺状态不正确 <br/>
  75 + */
  76 + public static final String SHOP_STATE_ERROR="1008";
  77 +
  78 +
  79 + /**1008:输入参数错误,SKU对应的商品购买量小于起批量 <br/>
  80 + * <li>前端是否可直接显示后台返回的message:否</li>
  81 + * <li>是否有出现错误的数据返回给前端:有</li>
  82 + * <li>返回错误数据:商品的SKU</li>
  83 + */
  84 + public static final String PRODUCT_PURCHASE_AMOUNT_LESS_THAN_MIN_AMOUNT="1008";
  85 +
  86 + /**1009:商品交割方式数据错误 <br/>
  87 + * 即:1.如果联系人选的是“市场内交割-合作市场“,则所有购买的商品都满足条件,可以进行订单提交
  88 + 2.如果联系人选的是“市场内交割-非合作市场”,则购买的商品中有交割市场是合作市场的商品都不满足条件,需要将其删除,只留下交割市场是全国交割的商品。
  89 + 3.如果联系人选的是“市场外交割”,则购买的商品中有交割市场是合作市场的商品都不满足条件,需要将其删除。
  90 + */
  91 + public static final String MARKET_DELIVERY_ERROR="1009";
  92 +
  93 + /**2000:权限错误(未登录,数据权限不满足,功能权限不满足等错误)<br/>
  94 + * <li>前端是否可直接显示后台返回的message:是</li>
  95 + * <li>是否有出现错误的数据返回给前端:无</li>
  96 + */
  97 + public static final String NOT_AUTH_ERROR="2000";
  98 +
  99 + /**3000:业务逻辑或数据错误(未查询到数据,数据验证不通过,数据发生变化等错误)<br/>
  100 + * <li>前端是否可直接显示后台返回的message:是</li>
  101 + * <li>是否有出现错误的数据返回给前端:无</li>
  102 + */
  103 + public static final String DATA_ERROR="3000";
  104 +
  105 + /** 4000:支付异常
  106 + * <li>前端是否可直接显示后台返回的message:是</li>
  107 + * <li>是否有出现错误的数据返回给前端:无</li>
  108 + */
  109 + public static final String PAYMENT_ERROR="4000";
  110 +
  111 + /**5000:服务器内部错误(系统错误,代码BUG,系统间调用超时等错误)
  112 + * <li>前端是否可直接显示后台返回的message:是。此消息内部已做过处理</li>
  113 + * <li>是否有出现错误的数据返回给前端:无</li>
  114 + */
  115 + public static final String APP_ERROR="5000";
  116 +}
myapp-common/src/main/java/com/b2c/myapp/common/utils/exception/AppException.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.b2c.myapp.common.utils.exception;
  6 +
  7 +/**
  8 + * AppException
  9 + * @author dev-center
  10 + * @since 2014-05-15
  11 + */
  12 +public class AppException extends RuntimeException{
  13 + private static final long serialVersionUID = 1L;
  14 + public static final String CODE_NEGLECTABLE = "201";
  15 + private String code;
  16 + private String errorData;
  17 + public AppException() {
  18 + super();
  19 + }
  20 +
  21 + public AppException(String message) {
  22 + super(message);
  23 + }
  24 +
  25 + public AppException(String message, Throwable cause) {
  26 + super(message, cause);
  27 + }
  28 +
  29 + public AppException(Throwable cause) {
  30 + super(cause);
  31 + }
  32 +
  33 + public AppException(String code, String message) {
  34 + super(message);
  35 + this.code=code;
  36 + }
  37 +
  38 + public AppException(String code, String errorData,String message) {
  39 + super(message);
  40 + this.code=code;
  41 + this.errorData=errorData;
  42 + }
  43 +
  44 +
  45 + public String getCode() {
  46 + return code;
  47 + }
  48 +
  49 + public void setCode(String code) {
  50 + this.code = code;
  51 + }
  52 +
  53 +
  54 + public String getErrorData() {
  55 + return errorData;
  56 + }
  57 +
  58 +
  59 + public void setErrorData(String errorData) {
  60 + this.errorData = errorData;
  61 + }
  62 +
  63 + @Override
  64 + public String toString() {
  65 + return "AppException [code=" + getCode() + ", errorData="
  66 + + getErrorData() + ", message=" + getMessage()
  67 + + ", cause=" + getCause() + "]";
  68 + }
  69 +}
myapp-common/src/main/java/com/b2c/myapp/common/utils/exception/DataErrorException.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.b2c.myapp.common.utils.exception;
  6 +
  7 +
  8 +/**
  9 + * AppException
  10 + * @author dev-center
  11 + * @since 2014-05-15
  12 + */
  13 +public class DataErrorException extends AppException{
  14 + private static final long serialVersionUID = 1L;
  15 + public DataErrorException() {
  16 + super();
  17 + }
  18 +
  19 + public DataErrorException(String message) {
  20 + super(message);
  21 + }
  22 +
  23 + public DataErrorException(String message, Throwable cause) {
  24 + super(message, cause);
  25 + }
  26 +
  27 + public DataErrorException(Throwable cause) {
  28 + super(cause);
  29 + }
  30 +
  31 + public DataErrorException(String code, String errorData,String message) {
  32 + super(code,errorData,message);
  33 + }
  34 +
  35 + @Override
  36 + public String toString() {
  37 + return "DataErrorException [code=" + getCode() + ", errorData="
  38 + + getErrorData() + ", message=" + getMessage()
  39 + + ", cause=" + getCause() + "]";
  40 + }
  41 +}
myapp-common/src/main/java/com/b2c/myapp/common/utils/exception/DtmsException.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.b2c.myapp.common.utils.exception;
  6 +
  7 +/**
  8 + * AppException
  9 + * @author dev-center
  10 + * @since 2014-05-15
  11 + */
  12 +public class DtmsException extends RuntimeException{
  13 + private static final long serialVersionUID = 1L;
  14 + private String code;
  15 + public DtmsException() {
  16 + super();
  17 + }
  18 +
  19 + public DtmsException(String message) {
  20 + super(message);
  21 + }
  22 +
  23 + public DtmsException(String message, Throwable cause) {
  24 + super(message, cause);
  25 + }
  26 +
  27 + public DtmsException(Throwable cause) {
  28 + super(cause);
  29 + }
  30 +
  31 + public DtmsException(String code, String message) {
  32 + super(message);
  33 + this.code=code;
  34 + }
  35 +
  36 + public String getCode() {
  37 + return code;
  38 + }
  39 +
  40 + public void setCode(String code) {
  41 + this.code = code;
  42 + }
  43 +}
myapp-common/src/main/java/com/b2c/myapp/common/utils/exception/NotAuthException.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.b2c.myapp.common.utils.exception;
  6 +
  7 +/**
  8 + * AppException
  9 + * @author dev-center
  10 + * @since 2014-05-15
  11 + */
  12 +public class NotAuthException extends AppException{
  13 + private static final long serialVersionUID = 1L;
  14 + public NotAuthException() {
  15 + super();
  16 + }
  17 +
  18 + public NotAuthException(String message) {
  19 + super(message);
  20 + }
  21 +
  22 + public NotAuthException(String message, Throwable cause) {
  23 + super(message, cause);
  24 + }
  25 +
  26 + public NotAuthException(Throwable cause) {
  27 + super(cause);
  28 + }
  29 +
  30 + public NotAuthException(String code, String errorData,String message) {
  31 + super(code,errorData,message);
  32 + }
  33 +
  34 + @Override
  35 + public String toString() {
  36 + return "NotAuthException [code=" + getCode() + ", errorData="
  37 + + getErrorData() + ", message=" + getMessage()
  38 + + ", cause=" + getCause() + "]";
  39 + }
  40 +}
myapp-common/src/main/java/com/b2c/myapp/common/utils/exception/ParamErrorException.java 0 → 100644
  1 +/*
  2 + * Copyright (c) 2014 www.diligrp.com All rights reserved.
  3 + * 本软件源代码版权归----所有,未经许可不得任意复制与传播.
  4 + */
  5 +package com.b2c.myapp.common.utils.exception;
  6 +
  7 +/**
  8 + * AppException
  9 + * @author dev-center
  10 + * @since 2014-05-15
  11 + */
  12 +public class ParamErrorException extends AppException{
  13 + private static final long serialVersionUID = 1L;
  14 + public ParamErrorException() {
  15 + super();
  16 + }
  17 +
  18 + public ParamErrorException(String message) {
  19 + super(message);
  20 + }
  21 +
  22 + public ParamErrorException(String message, Throwable cause) {
  23 + super(message, cause);
  24 + }
  25 +
  26 + public ParamErrorException(Throwable cause) {
  27 + super(cause);
  28 + }
  29 +
  30 + public ParamErrorException(String code, String message) {
  31 + super(code,message);
  32 + }
  33 +
  34 + public ParamErrorException(String code, String errorData,String message) {
  35 + super(code,errorData,message);
  36 + }
  37 +
  38 + @Override
  39 + public String toString() {
  40 + return "ParamErrorException [code=" + getCode() + ", errorData="
  41 + + getErrorData() + ", message=" + getMessage()
  42 + + ", cause=" + getCause() + "]";
  43 + }
  44 +}
myapp-common/src/main/java/com/b2c/myapp/common/utils/exception/RpcConnectException.java 0 → 100644
  1 +package com.b2c.myapp.common.utils.exception;
  2 +
  3 +public class RpcConnectException extends AppException {
  4 +
  5 + /**
  6 + * 接口调用异常
  7 + */
  8 + private static final long serialVersionUID = 1L;
  9 + public RpcConnectException() {
  10 + super();
  11 + }
  12 +
  13 + public RpcConnectException(String message) {
  14 + super(message);
  15 + }
  16 +
  17 + public RpcConnectException(String message, Throwable cause) {
  18 + super(message, cause);
  19 + }
  20 +
  21 + public RpcConnectException(Throwable cause) {
  22 + super(cause);
  23 + }
  24 +
  25 +
  26 + public RpcConnectException(String code,String message) {
  27 + super(code,message);
  28 + }
  29 +
  30 + public RpcConnectException(String code, String errorData,String message) {
  31 + super(code,errorData,message);
  32 + }
  33 +
  34 + @Override
  35 + public String toString() {
  36 + return "RpcConnectException [code=" + getCode() + ", errorData="
  37 + + getErrorData() + ", message=" + getMessage()
  38 + + ", cause=" + getCause() + "]";
  39 + }
  40 +}
myapp-common/src/main/java/com/b2c/myapp/common/utils/exception/RpcGuardException.java 0 → 100644
  1 +package com.b2c.myapp.common.utils.exception;
  2 +
  3 +public class RpcGuardException extends RpcConnectException {
  4 +
  5 + private static final long serialVersionUID = 1L;
  6 +
  7 + public RpcGuardException() {
  8 + super();
  9 + }
  10 +
  11 + public RpcGuardException(String message) {
  12 + super(message);
  13 + }
  14 +
  15 + public RpcGuardException(String message, Throwable cause) {
  16 + super(message, cause);
  17 + }
  18 +
  19 + public RpcGuardException(Throwable cause) {
  20 + super(cause);
  21 + }
  22 +
  23 +
  24 + public RpcGuardException(String code,String message) {
  25 + super(code,message);
  26 + }
  27 +
  28 + public RpcGuardException(String code, String data,String message) {
  29 + super(code,data,message);
  30 + }
  31 +
  32 + @Override
  33 + public String toString() {
  34 + return "RpcGuardException [code=" + getCode() + ", errorData="
  35 + + getErrorData() + ", message=" + getMessage()
  36 + + ", cause=" + getCause() + "]";
  37 + }
  38 +}
myapp-common/src/main/java/com/b2c/myapp/common/utils/exception/RpcPaymentException.java 0 → 100644
  1 +package com.b2c.myapp.common.utils.exception;
  2 +
  3 +public class RpcPaymentException extends RpcConnectException {
  4 +
  5 + private static final long serialVersionUID = 1L;
  6 +
  7 + public RpcPaymentException() {
  8 + super();
  9 + }
  10 +
  11 + public RpcPaymentException(String message) {
  12 + super(message);
  13 + }
  14 +
  15 + public RpcPaymentException(String message, Throwable cause) {
  16 + super(message, cause);
  17 + }
  18 +
  19 + public RpcPaymentException(Throwable cause) {
  20 + super(cause);
  21 + }
  22 +
  23 +
  24 + public RpcPaymentException(String code,String message) {
  25 + super(code,message);
  26 + }
  27 +
  28 + public RpcPaymentException(String code, String data,String message) {
  29 + super(code,data,message);
  30 + }
  31 +
  32 + @Override
  33 + public String toString() {
  34 + return "RpcPaymentException [code=" + getCode() + ", errorData="
  35 + + getErrorData() + ", message=" + getMessage()
  36 + + ", cause=" + getCause() + "]";
  37 + }
  38 +}
myapp-common/src/main/java/com/b2c/myapp/common/utils/exception/WebException.java 0 → 100644
  1 +package com.b2c.myapp.common.utils.exception;
  2 +
  3 +public class WebException extends AppException{
  4 + private static final long serialVersionUID = -4573550295666184287L;
  5 +
  6 + public WebException(String msg){
  7 + super(msg);
  8 + }
  9 +
  10 + public WebException(Throwable cause){
  11 + super(cause);
  12 + }
  13 +
  14 + public WebException(String msg, Throwable cause){
  15 + super(msg, cause);
  16 + }
  17 +
  18 + public WebException(String code, String data,String message) {
  19 + super(code,data,message);
  20 + }
  21 +}
myapp-sdk/pom.xml
@@ -3,7 +3,19 @@ @@ -3,7 +3,19 @@
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5 <modelVersion>4.0.0</modelVersion> 5 <modelVersion>4.0.0</modelVersion>
6 - <parent> 6 + <build>
  7 + <plugins>
  8 + <plugin>
  9 + <groupId>org.apache.maven.plugins</groupId>
  10 + <artifactId>maven-compiler-plugin</artifactId>
  11 + <configuration>
  12 + <source>1.6</source>
  13 + <target>1.6</target>
  14 + </configuration>
  15 + </plugin>
  16 + </plugins>
  17 + </build>
  18 + <parent>
7 <groupId>com.b2c.myapp</groupId> 19 <groupId>com.b2c.myapp</groupId>
8 <artifactId>myapp</artifactId> 20 <artifactId>myapp</artifactId>
9 <version>1.0-SNAPSHOT</version> 21 <version>1.0-SNAPSHOT</version>
@@ -15,6 +27,18 @@ @@ -15,6 +27,18 @@
15 27
16 <dependencies> 28 <dependencies>
17 <dependency> 29 <dependency>
  30 + <groupId>com.github.kevinsawicki</groupId>
  31 + <artifactId>http-request</artifactId>
  32 + <version>5.6</version>
  33 + </dependency>
  34 + <!-- 单元测试 -->
  35 + <dependency>
  36 + <groupId>junit</groupId>
  37 + <artifactId>junit</artifactId>
  38 + <version>4.5</version>
  39 + <scope>test</scope>
  40 + </dependency>
  41 + <dependency>
18 <groupId>com.b2c.myapp</groupId> 42 <groupId>com.b2c.myapp</groupId>
19 <artifactId>myapp-common</artifactId> 43 <artifactId>myapp-common</artifactId>
20 <version>1.0-SNAPSHOT</version> 44 <version>1.0-SNAPSHOT</version>
myapp-sdk/src/main/java/com/b2c/myapp/sdk/MyAppClient.java 0 → 100644
  1 +package com.b2c.myapp.sdk;
  2 +
  3 +
  4 +import com.b2c.myapp.sdk.service.BuyerInfoService;
  5 +import com.b2c.myapp.sdk.service.impl.BuyerInfoServiceImpl;
  6 +import com.b2c.myapp.sdk.utils.Constants;
  7 +
  8 +/**
  9 + * 咱的appAPI接口
  10 + */
  11 +public class MyAppClient {
  12 +
  13 +
  14 + private BuyerInfoService buyerInfoService;
  15 +
  16 + public MyAppClient(){
  17 + this("");
  18 + }
  19 + /**
  20 + * 获取一咱的appSDK实例
  21 + * @param token 会员token
  22 + */
  23 + public MyAppClient(String token){
  24 + this(token, Constants.MYAPP_BASE_URL);
  25 + }
  26 + /**
  27 + * 获取一咱的appSDK实例
  28 + * @param token 会员token
  29 + * @param baseUrl 咱的app中心http服务URL
  30 + */
  31 + public MyAppClient(String token, String baseUrl){
  32 + Constants.MYAPP_BASE_URL=baseUrl;
  33 + this.buyerInfoService = new BuyerInfoServiceImpl(token);
  34 + }
  35 + /**
  36 + * 获取咱的app服务实例
  37 + * @return OrderService
  38 + */
  39 + public BuyerInfoService getBuyerInfoService(){
  40 + return buyerInfoService;
  41 + }
  42 +}
myapp-sdk/src/main/java/com/b2c/myapp/sdk/service/BaseService.java 0 → 100644
  1 +package com.b2c.myapp.sdk.service;
  2 +
  3 +
  4 +
  5 +public interface BaseService {
  6 + /**
  7 + * 设置会员token
  8 + * @param token
  9 + */
  10 + public void setToken(String token);
  11 +}
myapp-sdk/src/main/java/com/b2c/myapp/sdk/service/BuyerInfoService.java 0 → 100644
  1 +package com.b2c.myapp.sdk.service;
  2 +
  3 +import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoListInput;
  4 +import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput;
  5 +import com.b2c.myapp.common.utils.BaseOutput;
  6 +import com.b2c.myapp.common.utils.base.Page;
  7 +/**
  8 + * 买家相关API接口.
  9 + */
  10 +public interface BuyerInfoService extends BaseService {
  11 + public BaseOutput<Page<BuyerInfoOutput>> list(BuyerInfoListInput input);
  12 +
  13 +}
myapp-sdk/src/main/java/com/b2c/myapp/sdk/service/impl/BaseServiceImpl.java 0 → 100644
  1 +package com.b2c.myapp.sdk.service.impl;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.TypeReference;
  5 +import com.b2c.myapp.common.utils.BaseOutput;
  6 +import com.b2c.myapp.common.utils.ResultCode;
  7 +import com.b2c.myapp.sdk.utils.Constants;
  8 +import com.github.kevinsawicki.http.HttpRequest;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import com.b2c.myapp.sdk.service.*;
  12 +
  13 +/**
  14 + * base
  15 + */
  16 + abstract class BaseServiceImpl implements BaseService {
  17 + protected static Logger LOGGER;
  18 + @SuppressWarnings("unused")
  19 + private String token="";
  20 +
  21 + public BaseServiceImpl(){
  22 + this("");
  23 + }
  24 + public BaseServiceImpl(String token){
  25 + this.token = token;
  26 + LOGGER = LoggerFactory.getLogger(this.getClass());
  27 + }
  28 + protected <T extends BaseOutput<?>> T httpGet(String url, Object paramObj, TypeReference<T> type){
  29 + return execute(url, paramObj, type, "GET");
  30 + }
  31 + protected <T extends BaseOutput<?>> T httpPost(String url, Object paramObj, TypeReference<T> type){
  32 + return execute(url, paramObj, type, "POST");
  33 + }
  34 +
  35 + @SuppressWarnings({ "unchecked", "rawtypes" })
  36 + private <T extends BaseOutput> T execute(String url, Object paramObj, TypeReference<T> type, String httpMethod){
  37 + T output= (T) new BaseOutput();
  38 + HttpRequest request = null;
  39 + if("POST".equalsIgnoreCase(httpMethod)){
  40 + request = HttpRequest.post(Constants.MYAPP_BASE_URL + url);
  41 + }else{
  42 + request = HttpRequest.get(Constants.MYAPP_BASE_URL + url);
  43 + }
  44 + request.connectTimeout(Constants.TIMEOUT);
  45 + request.readTimeout(Constants.TIMEOUT * 2);
  46 + request.header("Content-Type", "application/json;charset=utf-8");
  47 + String data= JSON.toJSONString(paramObj);
  48 + LOGGER.info("API调用请求数据详情:"+data);
  49 + request.send(data);
  50 + int code = request.code();
  51 + if (code != 200) {
  52 + output.setCode(ResultCode.APP_ERROR);
  53 + output.setResult("http code:"+code +";"+request.message());
  54 + //解决:java.lang.ClassCastException: com.diligrp.orders.client.domain.output.BaseOutput cannot be cast to com.diligrp.orders.client.domain.output.PageOutput
  55 + output = JSON.parseObject(JSON.toJSONString(output), type);
  56 + } else {
  57 + String result = request.body();
  58 + output = JSON.parseObject(result, type);
  59 + }
  60 +
  61 + return output;
  62 + }
  63 + @Override
  64 + public void setToken(String token) {
  65 + this.token = token;
  66 + }
  67 +}
myapp-sdk/src/main/java/com/b2c/myapp/sdk/service/impl/BuyerInfoServiceImpl.java 0 → 100644
  1 +package com.b2c.myapp.sdk.service.impl;
  2 +
  3 +import com.alibaba.fastjson.TypeReference;
  4 +import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoListInput;
  5 +import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput;
  6 +import com.b2c.myapp.common.utils.BaseOutput;
  7 +import com.b2c.myapp.common.utils.base.Page;
  8 +import com.b2c.myapp.sdk.service.BuyerInfoService;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * <B>Description</B> <br />
  14 + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
  15 + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
  16 + * <B>Company</B> 地利集团
  17 + *
  18 + * @author jiangchengyong
  19 + * @createTime 16/11/28 12:21
  20 + */
  21 +public class BuyerInfoServiceImpl extends BaseServiceImpl implements BuyerInfoService {
  22 +
  23 + public BuyerInfoServiceImpl(String token) {
  24 + super(token);
  25 + }
  26 +
  27 +
  28 + @Override
  29 + public BaseOutput<Page<BuyerInfoOutput>> list(BuyerInfoListInput input){
  30 + return super.httpGet("/buyerInfo/list", input, new TypeReference<BaseOutput<Page<BuyerInfoOutput>>>() {
  31 + });
  32 + }
  33 +
  34 +}
myapp-sdk/src/main/java/com/b2c/myapp/sdk/utils/Constants.java 0 → 100644
  1 +package com.b2c.myapp.sdk.utils;
  2 +
  3 +public class Constants {
  4 + public static int TIMEOUT=5000;//单位:毫秒
  5 + public static String MYAPP_BASE_URL = "http://www.myapp.com";//订单API-url
  6 +}
  7 +
myapp-sdk/src/test/java/com/b2c/myapp/sdk/test/BuyerInfoServiceTest.java 0 → 100644
  1 +package com.b2c.myapp.sdk.test;
  2 +
  3 +import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoInput;
  4 +import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoListInput;
  5 +import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput;
  6 +import com.b2c.myapp.common.utils.BaseOutput;
  7 +import com.b2c.myapp.common.utils.base.Page;
  8 +import com.b2c.myapp.sdk.service.BuyerInfoService;
  9 +import com.b2c.myapp.sdk.service.impl.BuyerInfoServiceImpl;
  10 +import org.junit.Test;
  11 +
  12 +/**
  13 + * Created by jiangchengyong on 2016/11/28.
  14 + */
  15 +public class BuyerInfoServiceTest {
  16 + private BuyerInfoService buyerInfoService = new BuyerInfoServiceImpl("TOKEN");
  17 +
  18 + @Test
  19 + public void list(){
  20 + BuyerInfoListInput buyerInfoInput = new BuyerInfoListInput();
  21 + buyerInfoInput.setId(1l);
  22 + BaseOutput<Page<BuyerInfoOutput>> output = buyerInfoService.list(buyerInfoInput);
  23 + System.out.println(output);
  24 + }
  25 +
  26 +
  27 +}
myapp-web/src/main/java/com/b2c/myapp/api/BaseRestFulApi.java 0 → 100644
  1 +package com.b2c.myapp.api;
  2 +
  3 +import com.b2c.myapp.common.utils.BaseOutput;
  4 +import com.b2c.myapp.common.utils.ResultCode;
  5 +import com.b2c.myapp.common.utils.exception.*;
  6 +import com.diligrp.website.util.web.BaseController;
  7 +import org.apache.commons.lang3.StringUtils;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +
  11 +
  12 +public class BaseRestFulApi extends BaseController {
  13 + protected static final Logger LOGGER = LoggerFactory.getLogger(BaseRestFulApi.class);
  14 +
  15 + protected void handleException(BaseOutput<?> out, Exception e){
  16 + if(out == null){
  17 + out = BaseOutput.failure();
  18 + }
  19 +
  20 + if(e instanceof ParamErrorException){
  21 + ParamErrorException exception=(ParamErrorException)e;
  22 + if(StringUtils.isNotBlank(exception.getCode())){
  23 + out.setCode(exception.getCode());
  24 + }else{
  25 + out.setCode(ResultCode.PARAMS_ERROR);
  26 + }
  27 + out.setResult(exception.getMessage());
  28 + out.setErrorData(exception.getErrorData());
  29 + LOGGER.error("失败:",e);
  30 + return;
  31 + }
  32 +
  33 + if(e instanceof IllegalArgumentException){
  34 + out.setCode(ResultCode.PARAMS_ERROR);
  35 + out.setResult(e.getMessage());
  36 + LOGGER.error("失败:",e);
  37 + return;
  38 + }
  39 +
  40 + if(e instanceof NotAuthException){
  41 +
  42 + NotAuthException exception=(NotAuthException)e;
  43 + if(StringUtils.isNotBlank(exception.getCode())){
  44 + out.setCode(exception.getCode());
  45 + }else{
  46 + out.setCode(ResultCode.NOT_AUTH_ERROR);
  47 + }
  48 + out.setResult(exception.getMessage());
  49 + out.setErrorData(exception.getErrorData());
  50 + LOGGER.error("失败:",e);
  51 + return;
  52 + }
  53 +
  54 + if(e instanceof DataErrorException){
  55 +
  56 + DataErrorException exception=(DataErrorException)e;
  57 + if(StringUtils.isNotBlank(exception.getCode())){
  58 + out.setCode(exception.getCode());
  59 + }else{
  60 + out.setCode(ResultCode.DATA_ERROR);
  61 + }
  62 + out.setResult(e.getMessage());
  63 + out.setErrorData(exception.getErrorData());
  64 + LOGGER.error("失败:",e);
  65 + return;
  66 + }
  67 +
  68 + if(e instanceof RpcPaymentException){
  69 +
  70 + RpcPaymentException exception=(RpcPaymentException)e;
  71 + if(StringUtils.isNotBlank(exception.getCode())){
  72 + out.setCode(exception.getCode());
  73 + }else{
  74 + out.setCode(ResultCode.PAYMENT_ERROR);
  75 + }
  76 + out.setResult(exception.getMessage());
  77 + out.setErrorData(exception.getErrorData());
  78 + LOGGER.error("失败:",e);
  79 + return;
  80 + }
  81 +
  82 + out.setCode(ResultCode.APP_ERROR);
  83 + //系统内部异常不直接抛到前端
  84 + out.setResult("系统处理发生异常");
  85 + LOGGER.error("失败:", e);
  86 + }
  87 +}
myapp-web/src/main/java/com/b2c/myapp/api/BuyerInfoApi.java 0 → 100644
  1 +
  2 +package com.b2c.myapp.api;
  3 +
  4 +import org.springframework.web.bind.annotation.ModelAttribute;
  5 +import javax.validation.Valid;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Controller;
  8 +import org.springframework.web.servlet.ModelAndView;
  9 +import org.springframework.web.bind.annotation.RequestBody;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +import com.b2c.myapp.common.utils.BaseOutput;
  14 +
  15 +import com.b2c.myapp.utils.*;
  16 +import com.b2c.myapp.common.utils.base.Page;
  17 +
  18 +import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoInput;
  19 +import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoListInput;
  20 +import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoSaveInput;
  21 +import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoUpdateInput;
  22 +import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput;
  23 +
  24 +import com.b2c.myapp.service.BuyerInfoService;
  25 +import com.b2c.myapp.domain.BuyerInfo;
  26 +import com.diligrp.website.util.web.BaseController;
  27 +
  28 +import io.swagger.annotations.Api;
  29 +import io.swagger.annotations.ApiOperation;
  30 +import io.swagger.annotations.ApiParam;
  31 +import org.slf4j.Logger;
  32 +import org.slf4j.LoggerFactory;
  33 +import java.util.HashMap;
  34 +import java.util.Map;
  35 +
  36 +/**
  37 + * <br />
  38 + * @createTime 2016-11-29 9:35:10
  39 + * @author template
  40 + */
  41 +@Controller
  42 +@RequestMapping(value = "/api/buyerInfo")
  43 +@Api(value = "BuyerInfo-api", description = "有关于BuyerInfo的CURD操作")
  44 +public class BuyerInfoApi extends BaseRestFulApi {
  45 + private final static Logger LOG = LoggerFactory.getLogger(BuyerInfoApi.class);
  46 +
  47 + @Autowired
  48 + private BuyerInfoService buyerInfoService;
  49 +
  50 +
  51 + @ApiOperation(value ="新增", notes = "新增BuyerInfo记录")
  52 + @RequestMapping(value = "/save", method = RequestMethod.POST)
  53 + @ResponseBody
  54 + public BaseOutput<Integer> save(@ModelAttribute @Valid BuyerInfoInput val){
  55 + BaseOutput<Integer> output = BaseOutput.success();
  56 + try {
  57 + int result = buyerInfoService.saveOrUpdate(BeanConver.copeBean(val,BuyerInfo.class));
  58 + output.setData(result);
  59 + } catch (Exception e) {
  60 + handleException(output, e);
  61 + }
  62 + return output;
  63 + }
  64 +
  65 + @ApiOperation(value ="查询", notes = "多条件查询BuyerInfo")
  66 + @RequestMapping(value="/list", method = RequestMethod.GET)
  67 + @ResponseBody
  68 + public BaseOutput<Page<BuyerInfoOutput>> list(@ModelAttribute @Valid BuyerInfoListInput input) {
  69 + Page<BuyerInfo> page = buyerInfoService.listPage(input);
  70 + BaseOutput<Page<BuyerInfoOutput>> output = BaseOutput.success();
  71 + try {
  72 + Page<BuyerInfoOutput> result = BeanConver.copePage(page, BuyerInfoOutput.class);
  73 + output.setData(result);
  74 + } catch (Exception e) {
  75 + handleException(output, e);
  76 + }
  77 + return output;
  78 + }
  79 +
  80 + @ApiOperation(value ="删除", notes = "按删除BuyerInfo")
  81 + @RequestMapping(value = "/del", method = RequestMethod.GET)
  82 + @ResponseBody
  83 + public BaseOutput<Integer> del(Long id){
  84 + BaseOutput<Integer> output = BaseOutput.success();
  85 + try {
  86 + int result = buyerInfoService.del(id);
  87 + output.setData(result);
  88 + } catch (Exception e) {
  89 + handleException(output, e);
  90 + }
  91 + return output;
  92 + }
  93 +
  94 + @ApiOperation(value ="详情", notes = "获取BuyerInfo详情")
  95 + @RequestMapping(value="/show", method = RequestMethod.GET)
  96 + @ResponseBody
  97 + public BaseOutput<BuyerInfo> show(Long id) {
  98 + BaseOutput<BuyerInfo> output = BaseOutput.success();
  99 + try {
  100 + BuyerInfo item = buyerInfoService.get(id);
  101 + output.setData(item);
  102 + } catch (Exception e) {
  103 + handleException(output, e);
  104 + }
  105 + return output;
  106 + }
  107 +}
myapp-web/src/main/java/com/b2c/myapp/api/DeliveryTimeApi.java 0 → 100644
  1 +
  2 +package com.b2c.myapp.api;
  3 +
  4 +import org.springframework.web.bind.annotation.ModelAttribute;
  5 +import javax.validation.Valid;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Controller;
  8 +import org.springframework.web.servlet.ModelAndView;
  9 +import org.springframework.web.bind.annotation.RequestBody;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +import com.b2c.myapp.common.utils.BaseOutput;
  14 +
  15 +import com.b2c.myapp.utils.*;
  16 +import com.b2c.myapp.common.utils.base.Page;
  17 +
  18 +import com.b2c.myapp.common.api.deliveryTime.input.DeliveryTimeInput;
  19 +import com.b2c.myapp.common.api.deliveryTime.input.DeliveryTimeListInput;
  20 +import com.b2c.myapp.common.api.deliveryTime.input.DeliveryTimeSaveInput;
  21 +import com.b2c.myapp.common.api.deliveryTime.input.DeliveryTimeUpdateInput;
  22 +import com.b2c.myapp.common.api.deliveryTime.output.DeliveryTimeOutput;
  23 +
  24 +import com.b2c.myapp.service.DeliveryTimeService;
  25 +import com.b2c.myapp.domain.DeliveryTime;
  26 +import com.diligrp.website.util.web.BaseController;
  27 +
  28 +import io.swagger.annotations.Api;
  29 +import io.swagger.annotations.ApiOperation;
  30 +import io.swagger.annotations.ApiParam;
  31 +import org.slf4j.Logger;
  32 +import org.slf4j.LoggerFactory;
  33 +import java.util.HashMap;
  34 +import java.util.Map;
  35 +
  36 +/**
  37 + * <br />
  38 + * @createTime 2016-11-29 9:35:12
  39 + * @author template
  40 + */
  41 +@Controller
  42 +@RequestMapping(value = "/api/deliveryTime")
  43 +@Api(value = "DeliveryTime-api", description = "有关于DeliveryTime的CURD操作")
  44 +public class DeliveryTimeApi extends BaseRestFulApi {
  45 + private final static Logger LOG = LoggerFactory.getLogger(DeliveryTimeApi.class);
  46 +
  47 + @Autowired
  48 + private DeliveryTimeService deliveryTimeService;
  49 +
  50 +
  51 + @ApiOperation(value ="新增", notes = "新增DeliveryTime记录")
  52 + @RequestMapping(value = "/save", method = RequestMethod.POST)
  53 + @ResponseBody
  54 + public BaseOutput<Integer> save(@ModelAttribute @Valid DeliveryTimeInput val){
  55 + BaseOutput<Integer> output = BaseOutput.success();
  56 + try {
  57 + int result = deliveryTimeService.saveOrUpdate(BeanConver.copeBean(val,DeliveryTime.class));
  58 + output.setData(result);
  59 + } catch (Exception e) {
  60 + handleException(output, e);
  61 + }
  62 + return output;
  63 + }
  64 +
  65 + @ApiOperation(value ="查询", notes = "多条件查询DeliveryTime")
  66 + @RequestMapping(value="/list", method = RequestMethod.GET)
  67 + @ResponseBody
  68 + public BaseOutput<Page<DeliveryTimeOutput>> list(@ModelAttribute @Valid DeliveryTimeListInput input) {
  69 + Page<DeliveryTime> page = deliveryTimeService.listPage(input);
  70 + BaseOutput<Page<DeliveryTimeOutput>> output = BaseOutput.success();
  71 + try {
  72 + Page<DeliveryTimeOutput> result = BeanConver.copePage(page, DeliveryTimeOutput.class);
  73 + output.setData(result);
  74 + } catch (Exception e) {
  75 + handleException(output, e);
  76 + }
  77 + return output;
  78 + }
  79 +
  80 + @ApiOperation(value ="删除", notes = "按删除DeliveryTime")
  81 + @RequestMapping(value = "/del", method = RequestMethod.GET)
  82 + @ResponseBody
  83 + public BaseOutput<Integer> del(Long id){
  84 + BaseOutput<Integer> output = BaseOutput.success();
  85 + try {
  86 + int result = deliveryTimeService.del(id);
  87 + output.setData(result);
  88 + } catch (Exception e) {
  89 + handleException(output, e);
  90 + }
  91 + return output;
  92 + }
  93 +
  94 + @ApiOperation(value ="详情", notes = "获取DeliveryTime详情")
  95 + @RequestMapping(value="/show", method = RequestMethod.GET)
  96 + @ResponseBody
  97 + public BaseOutput<DeliveryTime> show(Long id) {
  98 + BaseOutput<DeliveryTime> output = BaseOutput.success();
  99 + try {
  100 + DeliveryTime item = deliveryTimeService.get(id);
  101 + output.setData(item);
  102 + } catch (Exception e) {
  103 + handleException(output, e);
  104 + }
  105 + return output;
  106 + }
  107 +}
myapp-web/src/main/java/com/b2c/myapp/api/FoundTradeApi.java 0 → 100644
  1 +
  2 +package com.b2c.myapp.api;
  3 +
  4 +import org.springframework.web.bind.annotation.ModelAttribute;
  5 +import javax.validation.Valid;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Controller;
  8 +import org.springframework.web.servlet.ModelAndView;
  9 +import org.springframework.web.bind.annotation.RequestBody;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +import com.b2c.myapp.common.utils.BaseOutput;
  14 +
  15 +import com.b2c.myapp.utils.*;
  16 +import com.b2c.myapp.common.utils.base.Page;
  17 +
  18 +import com.b2c.myapp.common.api.foundTrade.input.FoundTradeInput;
  19 +import com.b2c.myapp.common.api.foundTrade.input.FoundTradeListInput;
  20 +import com.b2c.myapp.common.api.foundTrade.input.FoundTradeSaveInput;
  21 +import com.b2c.myapp.common.api.foundTrade.input.FoundTradeUpdateInput;
  22 +import com.b2c.myapp.common.api.foundTrade.output.FoundTradeOutput;
  23 +
  24 +import com.b2c.myapp.service.FoundTradeService;
  25 +import com.b2c.myapp.domain.FoundTrade;
  26 +import com.diligrp.website.util.web.BaseController;
  27 +
  28 +import io.swagger.annotations.Api;
  29 +import io.swagger.annotations.ApiOperation;
  30 +import io.swagger.annotations.ApiParam;
  31 +import org.slf4j.Logger;
  32 +import org.slf4j.LoggerFactory;
  33 +import java.util.HashMap;
  34 +import java.util.Map;
  35 +
  36 +/**
  37 + * <br />
  38 + * @createTime 2016-11-29 9:35:13
  39 + * @author template
  40 + */
  41 +@Controller
  42 +@RequestMapping(value = "/api/foundTrade")
  43 +@Api(value = "FoundTrade-api", description = "有关于FoundTrade的CURD操作")
  44 +public class FoundTradeApi extends BaseRestFulApi {
  45 + private final static Logger LOG = LoggerFactory.getLogger(FoundTradeApi.class);
  46 +
  47 + @Autowired
  48 + private FoundTradeService foundTradeService;
  49 +
  50 +
  51 + @ApiOperation(value ="新增", notes = "新增FoundTrade记录")
  52 + @RequestMapping(value = "/save", method = RequestMethod.POST)
  53 + @ResponseBody
  54 + public BaseOutput<Integer> save(@ModelAttribute @Valid FoundTradeInput val){
  55 + BaseOutput<Integer> output = BaseOutput.success();
  56 + try {
  57 + int result = foundTradeService.saveOrUpdate(BeanConver.copeBean(val,FoundTrade.class));
  58 + output.setData(result);
  59 + } catch (Exception e) {
  60 + handleException(output, e);
  61 + }
  62 + return output;
  63 + }
  64 +
  65 + @ApiOperation(value ="查询", notes = "多条件查询FoundTrade")
  66 + @RequestMapping(value="/list", method = RequestMethod.GET)
  67 + @ResponseBody
  68 + public BaseOutput<Page<FoundTradeOutput>> list(@ModelAttribute @Valid FoundTradeListInput input) {
  69 + Page<FoundTrade> page = foundTradeService.listPage(input);
  70 + BaseOutput<Page<FoundTradeOutput>> output = BaseOutput.success();
  71 + try {
  72 + Page<FoundTradeOutput> result = BeanConver.copePage(page, FoundTradeOutput.class);
  73 + output.setData(result);
  74 + } catch (Exception e) {
  75 + handleException(output, e);
  76 + }
  77 + return output;
  78 + }
  79 +
  80 + @ApiOperation(value ="删除", notes = "按删除FoundTrade")
  81 + @RequestMapping(value = "/del", method = RequestMethod.GET)
  82 + @ResponseBody
  83 + public BaseOutput<Integer> del(Long id){
  84 + BaseOutput<Integer> output = BaseOutput.success();
  85 + try {
  86 + int result = foundTradeService.del(id);
  87 + output.setData(result);
  88 + } catch (Exception e) {
  89 + handleException(output, e);
  90 + }
  91 + return output;
  92 + }
  93 +
  94 + @ApiOperation(value ="详情", notes = "获取FoundTrade详情")
  95 + @RequestMapping(value="/show", method = RequestMethod.GET)
  96 + @ResponseBody
  97 + public BaseOutput<FoundTrade> show(Long id) {
  98 + BaseOutput<FoundTrade> output = BaseOutput.success();
  99 + try {
  100 + FoundTrade item = foundTradeService.get(id);
  101 + output.setData(item);
  102 + } catch (Exception e) {
  103 + handleException(output, e);
  104 + }
  105 + return output;
  106 + }
  107 +}
myapp-web/src/main/java/com/b2c/myapp/api/PickingInfoApi.java 0 → 100644
  1 +
  2 +package com.b2c.myapp.api;
  3 +
  4 +import org.springframework.web.bind.annotation.ModelAttribute;
  5 +import javax.validation.Valid;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Controller;
  8 +import org.springframework.web.servlet.ModelAndView;
  9 +import org.springframework.web.bind.annotation.RequestBody;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +import com.b2c.myapp.common.utils.BaseOutput;
  14 +
  15 +import com.b2c.myapp.utils.*;
  16 +import com.b2c.myapp.common.utils.base.Page;
  17 +
  18 +import com.b2c.myapp.common.api.pickingInfo.input.PickingInfoInput;
  19 +import com.b2c.myapp.common.api.pickingInfo.input.PickingInfoListInput;
  20 +import com.b2c.myapp.common.api.pickingInfo.input.PickingInfoSaveInput;
  21 +import com.b2c.myapp.common.api.pickingInfo.input.PickingInfoUpdateInput;
  22 +import com.b2c.myapp.common.api.pickingInfo.output.PickingInfoOutput;
  23 +
  24 +import com.b2c.myapp.service.PickingInfoService;
  25 +import com.b2c.myapp.domain.PickingInfo;
  26 +import com.diligrp.website.util.web.BaseController;
  27 +
  28 +import io.swagger.annotations.Api;
  29 +import io.swagger.annotations.ApiOperation;
  30 +import io.swagger.annotations.ApiParam;
  31 +import org.slf4j.Logger;
  32 +import org.slf4j.LoggerFactory;
  33 +import java.util.HashMap;
  34 +import java.util.Map;
  35 +
  36 +/**
  37 + * <br />
  38 + * @createTime 2016-11-29 9:35:14
  39 + * @author template
  40 + */
  41 +@Controller
  42 +@RequestMapping(value = "/api/pickingInfo")
  43 +@Api(value = "PickingInfo-api", description = "有关于PickingInfo的CURD操作")
  44 +public class PickingInfoApi extends BaseRestFulApi {
  45 + private final static Logger LOG = LoggerFactory.getLogger(PickingInfoApi.class);
  46 +
  47 + @Autowired
  48 + private PickingInfoService pickingInfoService;
  49 +
  50 +
  51 + @ApiOperation(value ="新增", notes = "新增PickingInfo记录")
  52 + @RequestMapping(value = "/save", method = RequestMethod.POST)
  53 + @ResponseBody
  54 + public BaseOutput<Integer> save(@ModelAttribute @Valid PickingInfoInput val){
  55 + BaseOutput<Integer> output = BaseOutput.success();
  56 + try {
  57 + int result = pickingInfoService.saveOrUpdate(BeanConver.copeBean(val,PickingInfo.class));
  58 + output.setData(result);
  59 + } catch (Exception e) {
  60 + handleException(output, e);
  61 + }
  62 + return output;
  63 + }
  64 +
  65 + @ApiOperation(value ="查询", notes = "多条件查询PickingInfo")
  66 + @RequestMapping(value="/list", method = RequestMethod.GET)
  67 + @ResponseBody
  68 + public BaseOutput<Page<PickingInfoOutput>> list(@ModelAttribute @Valid PickingInfoListInput input) {
  69 + Page<PickingInfo> page = pickingInfoService.listPage(input);
  70 + BaseOutput<Page<PickingInfoOutput>> output = BaseOutput.success();
  71 + try {
  72 + Page<PickingInfoOutput> result = BeanConver.copePage(page, PickingInfoOutput.class);
  73 + output.setData(result);
  74 + } catch (Exception e) {
  75 + handleException(output, e);
  76 + }
  77 + return output;
  78 + }
  79 +
  80 + @ApiOperation(value ="删除", notes = "按删除PickingInfo")
  81 + @RequestMapping(value = "/del", method = RequestMethod.GET)
  82 + @ResponseBody
  83 + public BaseOutput<Integer> del(Long id){
  84 + BaseOutput<Integer> output = BaseOutput.success();
  85 + try {
  86 + int result = pickingInfoService.del(id);
  87 + output.setData(result);
  88 + } catch (Exception e) {
  89 + handleException(output, e);
  90 + }
  91 + return output;
  92 + }
  93 +
  94 + @ApiOperation(value ="详情", notes = "获取PickingInfo详情")
  95 + @RequestMapping(value="/show", method = RequestMethod.GET)
  96 + @ResponseBody
  97 + public BaseOutput<PickingInfo> show(Long id) {
  98 + BaseOutput<PickingInfo> output = BaseOutput.success();
  99 + try {
  100 + PickingInfo item = pickingInfoService.get(id);
  101 + output.setData(item);
  102 + } catch (Exception e) {
  103 + handleException(output, e);
  104 + }
  105 + return output;
  106 + }
  107 +}
myapp-web/src/main/java/com/b2c/myapp/api/SellerInfoApi.java 0 → 100644
  1 +
  2 +package com.b2c.myapp.api;
  3 +
  4 +import org.springframework.web.bind.annotation.ModelAttribute;
  5 +import javax.validation.Valid;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Controller;
  8 +import org.springframework.web.servlet.ModelAndView;
  9 +import org.springframework.web.bind.annotation.RequestBody;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +import com.b2c.myapp.common.utils.BaseOutput;
  14 +
  15 +import com.b2c.myapp.utils.*;
  16 +import com.b2c.myapp.common.utils.base.Page;
  17 +
  18 +import com.b2c.myapp.common.api.sellerInfo.input.SellerInfoInput;
  19 +import com.b2c.myapp.common.api.sellerInfo.input.SellerInfoListInput;
  20 +import com.b2c.myapp.common.api.sellerInfo.input.SellerInfoSaveInput;
  21 +import com.b2c.myapp.common.api.sellerInfo.input.SellerInfoUpdateInput;
  22 +import com.b2c.myapp.common.api.sellerInfo.output.SellerInfoOutput;
  23 +
  24 +import com.b2c.myapp.service.SellerInfoService;
  25 +import com.b2c.myapp.domain.SellerInfo;
  26 +import com.diligrp.website.util.web.BaseController;
  27 +
  28 +import io.swagger.annotations.Api;
  29 +import io.swagger.annotations.ApiOperation;
  30 +import io.swagger.annotations.ApiParam;
  31 +import org.slf4j.Logger;
  32 +import org.slf4j.LoggerFactory;
  33 +import java.util.HashMap;
  34 +import java.util.Map;
  35 +
  36 +/**
  37 + * <br />
  38 + * @createTime 2016-11-29 9:35:15
  39 + * @author template
  40 + */
  41 +@Controller
  42 +@RequestMapping(value = "/api/sellerInfo")
  43 +@Api(value = "SellerInfo-api", description = "有关于SellerInfo的CURD操作")
  44 +public class SellerInfoApi extends BaseRestFulApi {
  45 + private final static Logger LOG = LoggerFactory.getLogger(SellerInfoApi.class);
  46 +
  47 + @Autowired
  48 + private SellerInfoService sellerInfoService;
  49 +
  50 +
  51 + @ApiOperation(value ="新增", notes = "新增SellerInfo记录")
  52 + @RequestMapping(value = "/save", method = RequestMethod.POST)
  53 + @ResponseBody
  54 + public BaseOutput<Integer> save(@ModelAttribute @Valid SellerInfoInput val){
  55 + BaseOutput<Integer> output = BaseOutput.success();
  56 + try {
  57 + int result = sellerInfoService.saveOrUpdate(BeanConver.copeBean(val,SellerInfo.class));
  58 + output.setData(result);
  59 + } catch (Exception e) {
  60 + handleException(output, e);
  61 + }
  62 + return output;
  63 + }
  64 +
  65 + @ApiOperation(value ="查询", notes = "多条件查询SellerInfo")
  66 + @RequestMapping(value="/list", method = RequestMethod.GET)
  67 + @ResponseBody
  68 + public BaseOutput<Page<SellerInfoOutput>> list(@ModelAttribute @Valid SellerInfoListInput input) {
  69 + Page<SellerInfo> page = sellerInfoService.listPage(input);
  70 + BaseOutput<Page<SellerInfoOutput>> output = BaseOutput.success();
  71 + try {
  72 + Page<SellerInfoOutput> result = BeanConver.copePage(page, SellerInfoOutput.class);
  73 + output.setData(result);
  74 + } catch (Exception e) {
  75 + handleException(output, e);
  76 + }
  77 + return output;
  78 + }
  79 +
  80 + @ApiOperation(value ="删除", notes = "按删除SellerInfo")
  81 + @RequestMapping(value = "/del", method = RequestMethod.GET)
  82 + @ResponseBody
  83 + public BaseOutput<Integer> del(Long id){
  84 + BaseOutput<Integer> output = BaseOutput.success();
  85 + try {
  86 + int result = sellerInfoService.del(id);
  87 + output.setData(result);
  88 + } catch (Exception e) {
  89 + handleException(output, e);
  90 + }
  91 + return output;
  92 + }
  93 +
  94 + @ApiOperation(value ="详情", notes = "获取SellerInfo详情")
  95 + @RequestMapping(value="/show", method = RequestMethod.GET)
  96 + @ResponseBody
  97 + public BaseOutput<SellerInfo> show(Long id) {
  98 + BaseOutput<SellerInfo> output = BaseOutput.success();
  99 + try {
  100 + SellerInfo item = sellerInfoService.get(id);
  101 + output.setData(item);
  102 + } catch (Exception e) {
  103 + handleException(output, e);
  104 + }
  105 + return output;
  106 + }
  107 +}
myapp-web/src/main/java/com/b2c/myapp/api/ShopApi.java 0 → 100644
  1 +
  2 +package com.b2c.myapp.api;
  3 +
  4 +import org.springframework.web.bind.annotation.ModelAttribute;
  5 +import javax.validation.Valid;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Controller;
  8 +import org.springframework.web.servlet.ModelAndView;
  9 +import org.springframework.web.bind.annotation.RequestBody;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +import com.b2c.myapp.common.utils.BaseOutput;
  14 +
  15 +import com.b2c.myapp.utils.*;
  16 +import com.b2c.myapp.common.utils.base.Page;
  17 +
  18 +import com.b2c.myapp.common.api.shop.input.ShopInput;
  19 +import com.b2c.myapp.common.api.shop.input.ShopListInput;
  20 +import com.b2c.myapp.common.api.shop.input.ShopSaveInput;
  21 +import com.b2c.myapp.common.api.shop.input.ShopUpdateInput;
  22 +import com.b2c.myapp.common.api.shop.output.ShopOutput;
  23 +
  24 +import com.b2c.myapp.service.ShopService;
  25 +import com.b2c.myapp.domain.Shop;
  26 +import com.diligrp.website.util.web.BaseController;
  27 +
  28 +import io.swagger.annotations.Api;
  29 +import io.swagger.annotations.ApiOperation;
  30 +import io.swagger.annotations.ApiParam;
  31 +import org.slf4j.Logger;
  32 +import org.slf4j.LoggerFactory;
  33 +import java.util.HashMap;
  34 +import java.util.Map;
  35 +
  36 +/**
  37 + * <br />
  38 + * @createTime 2016-11-29 9:35:15
  39 + * @author template
  40 + */
  41 +@Controller
  42 +@RequestMapping(value = "/api/shop")
  43 +@Api(value = "Shop-api", description = "有关于Shop的CURD操作")
  44 +public class ShopApi extends BaseRestFulApi {
  45 + private final static Logger LOG = LoggerFactory.getLogger(ShopApi.class);
  46 +
  47 + @Autowired
  48 + private ShopService shopService;
  49 +
  50 +
  51 + @ApiOperation(value ="新增", notes = "新增Shop记录")
  52 + @RequestMapping(value = "/save", method = RequestMethod.POST)
  53 + @ResponseBody
  54 + public BaseOutput<Integer> save(@ModelAttribute @Valid ShopInput val){
  55 + BaseOutput<Integer> output = BaseOutput.success();
  56 + try {
  57 + int result = shopService.saveOrUpdate(BeanConver.copeBean(val,Shop.class));
  58 + output.setData(result);
  59 + } catch (Exception e) {
  60 + handleException(output, e);
  61 + }
  62 + return output;
  63 + }
  64 +
  65 + @ApiOperation(value ="查询", notes = "多条件查询Shop")
  66 + @RequestMapping(value="/list", method = RequestMethod.GET)
  67 + @ResponseBody
  68 + public BaseOutput<Page<ShopOutput>> list(@ModelAttribute @Valid ShopListInput input) {
  69 + Page<Shop> page = shopService.listPage(input);
  70 + BaseOutput<Page<ShopOutput>> output = BaseOutput.success();
  71 + try {
  72 + Page<ShopOutput> result = BeanConver.copePage(page, ShopOutput.class);
  73 + output.setData(result);
  74 + } catch (Exception e) {
  75 + handleException(output, e);
  76 + }
  77 + return output;
  78 + }
  79 +
  80 + @ApiOperation(value ="删除", notes = "按删除Shop")
  81 + @RequestMapping(value = "/del", method = RequestMethod.GET)
  82 + @ResponseBody
  83 + public BaseOutput<Integer> del(Long id){
  84 + BaseOutput<Integer> output = BaseOutput.success();
  85 + try {
  86 + int result = shopService.del(id);
  87 + output.setData(result);
  88 + } catch (Exception e) {
  89 + handleException(output, e);
  90 + }
  91 + return output;
  92 + }
  93 +
  94 + @ApiOperation(value ="详情", notes = "获取Shop详情")
  95 + @RequestMapping(value="/show", method = RequestMethod.GET)
  96 + @ResponseBody
  97 + public BaseOutput<Shop> show(Long id) {
  98 + BaseOutput<Shop> output = BaseOutput.success();
  99 + try {
  100 + Shop item = shopService.get(id);
  101 + output.setData(item);
  102 + } catch (Exception e) {
  103 + handleException(output, e);
  104 + }
  105 + return output;
  106 + }
  107 +}
myapp-web/src/main/java/com/b2c/myapp/api/ShopBuyerApi.java 0 → 100644
  1 +
  2 +package com.b2c.myapp.api;
  3 +
  4 +import org.springframework.web.bind.annotation.ModelAttribute;
  5 +import javax.validation.Valid;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Controller;
  8 +import org.springframework.web.servlet.ModelAndView;
  9 +import org.springframework.web.bind.annotation.RequestBody;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +import com.b2c.myapp.common.utils.BaseOutput;
  14 +
  15 +import com.b2c.myapp.utils.*;
  16 +import com.b2c.myapp.common.utils.base.Page;
  17 +
  18 +import com.b2c.myapp.common.api.shopBuyer.input.ShopBuyerInput;
  19 +import com.b2c.myapp.common.api.shopBuyer.input.ShopBuyerListInput;
  20 +import com.b2c.myapp.common.api.shopBuyer.input.ShopBuyerSaveInput;
  21 +import com.b2c.myapp.common.api.shopBuyer.input.ShopBuyerUpdateInput;
  22 +import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerOutput;
  23 +
  24 +import com.b2c.myapp.service.ShopBuyerService;
  25 +import com.b2c.myapp.domain.ShopBuyer;
  26 +import com.diligrp.website.util.web.BaseController;
  27 +
  28 +import io.swagger.annotations.Api;
  29 +import io.swagger.annotations.ApiOperation;
  30 +import io.swagger.annotations.ApiParam;
  31 +import org.slf4j.Logger;
  32 +import org.slf4j.LoggerFactory;
  33 +import java.util.HashMap;
  34 +import java.util.Map;
  35 +
  36 +/**
  37 + * <br />
  38 + * @createTime 2016-11-29 9:35:17
  39 + * @author template
  40 + */
  41 +@Controller
  42 +@RequestMapping(value = "/api/shopBuyer")
  43 +@Api(value = "ShopBuyer-api", description = "有关于ShopBuyer的CURD操作")
  44 +public class ShopBuyerApi extends BaseRestFulApi {
  45 + private final static Logger LOG = LoggerFactory.getLogger(ShopBuyerApi.class);
  46 +
  47 + @Autowired
  48 + private ShopBuyerService shopBuyerService;
  49 +
  50 +
  51 + @ApiOperation(value ="新增", notes = "新增ShopBuyer记录")
  52 + @RequestMapping(value = "/save", method = RequestMethod.POST)
  53 + @ResponseBody
  54 + public BaseOutput<Integer> save(@ModelAttribute @Valid ShopBuyerInput val){
  55 + BaseOutput<Integer> output = BaseOutput.success();
  56 + try {
  57 + int result = shopBuyerService.saveOrUpdate(BeanConver.copeBean(val,ShopBuyer.class));
  58 + output.setData(result);
  59 + } catch (Exception e) {
  60 + handleException(output, e);
  61 + }
  62 + return output;
  63 + }
  64 +
  65 + @ApiOperation(value ="查询", notes = "多条件查询ShopBuyer")
  66 + @RequestMapping(value="/list", method = RequestMethod.GET)
  67 + @ResponseBody
  68 + public BaseOutput<Page<ShopBuyerOutput>> list(@ModelAttribute @Valid ShopBuyerListInput input) {
  69 + Page<ShopBuyer> page = shopBuyerService.listPage(input);
  70 + BaseOutput<Page<ShopBuyerOutput>> output = BaseOutput.success();
  71 + try {
  72 + Page<ShopBuyerOutput> result = BeanConver.copePage(page, ShopBuyerOutput.class);
  73 + output.setData(result);
  74 + } catch (Exception e) {
  75 + handleException(output, e);
  76 + }
  77 + return output;
  78 + }
  79 +
  80 + @ApiOperation(value ="删除", notes = "按删除ShopBuyer")
  81 + @RequestMapping(value = "/del", method = RequestMethod.GET)
  82 + @ResponseBody
  83 + public BaseOutput<Integer> del(Long id){
  84 + BaseOutput<Integer> output = BaseOutput.success();
  85 + try {
  86 + int result = shopBuyerService.del(id);
  87 + output.setData(result);
  88 + } catch (Exception e) {
  89 + handleException(output, e);
  90 + }
  91 + return output;
  92 + }
  93 +
  94 + @ApiOperation(value ="详情", notes = "获取ShopBuyer详情")
  95 + @RequestMapping(value="/show", method = RequestMethod.GET)
  96 + @ResponseBody
  97 + public BaseOutput<ShopBuyer> show(Long id) {
  98 + BaseOutput<ShopBuyer> output = BaseOutput.success();
  99 + try {
  100 + ShopBuyer item = shopBuyerService.get(id);
  101 + output.setData(item);
  102 + } catch (Exception e) {
  103 + handleException(output, e);
  104 + }
  105 + return output;
  106 + }
  107 +}
myapp-web/src/main/java/com/b2c/myapp/api/ShopProductRecommendApi.java 0 → 100644
  1 +
  2 +package com.b2c.myapp.api;
  3 +
  4 +import org.springframework.web.bind.annotation.ModelAttribute;
  5 +import javax.validation.Valid;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Controller;
  8 +import org.springframework.web.servlet.ModelAndView;
  9 +import org.springframework.web.bind.annotation.RequestBody;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +import com.b2c.myapp.common.utils.BaseOutput;
  14 +
  15 +import com.b2c.myapp.utils.*;
  16 +import com.b2c.myapp.common.utils.base.Page;
  17 +
  18 +import com.b2c.myapp.common.api.shopProductRecommend.input.ShopProductRecommendInput;
  19 +import com.b2c.myapp.common.api.shopProductRecommend.input.ShopProductRecommendListInput;
  20 +import com.b2c.myapp.common.api.shopProductRecommend.input.ShopProductRecommendSaveInput;
  21 +import com.b2c.myapp.common.api.shopProductRecommend.input.ShopProductRecommendUpdateInput;
  22 +import com.b2c.myapp.common.api.shopProductRecommend.output.ShopProductRecommendOutput;
  23 +
  24 +import com.b2c.myapp.service.ShopProductRecommendService;
  25 +import com.b2c.myapp.domain.ShopProductRecommend;
  26 +import com.diligrp.website.util.web.BaseController;
  27 +
  28 +import io.swagger.annotations.Api;
  29 +import io.swagger.annotations.ApiOperation;
  30 +import io.swagger.annotations.ApiParam;
  31 +import org.slf4j.Logger;
  32 +import org.slf4j.LoggerFactory;
  33 +import java.util.HashMap;
  34 +import java.util.Map;
  35 +
  36 +/**
  37 + * <br />
  38 + * @createTime 2016-11-29 9:35:18
  39 + * @author template
  40 + */
  41 +@Controller
  42 +@RequestMapping(value = "/api/shopProductRecommend")
  43 +@Api(value = "ShopProductRecommend-api", description = "有关于ShopProductRecommend的CURD操作")
  44 +public class ShopProductRecommendApi extends BaseRestFulApi {
  45 + private final static Logger LOG = LoggerFactory.getLogger(ShopProductRecommendApi.class);
  46 +
  47 + @Autowired
  48 + private ShopProductRecommendService shopProductRecommendService;
  49 +
  50 +
  51 + @ApiOperation(value ="新增", notes = "新增ShopProductRecommend记录")
  52 + @RequestMapping(value = "/save", method = RequestMethod.POST)
  53 + @ResponseBody
  54 + public BaseOutput<Integer> save(@ModelAttribute @Valid ShopProductRecommendInput val){
  55 + BaseOutput<Integer> output = BaseOutput.success();
  56 + try {
  57 + int result = shopProductRecommendService.saveOrUpdate(BeanConver.copeBean(val,ShopProductRecommend.class));
  58 + output.setData(result);
  59 + } catch (Exception e) {
  60 + handleException(output, e);
  61 + }
  62 + return output;
  63 + }
  64 +
  65 + @ApiOperation(value ="查询", notes = "多条件查询ShopProductRecommend")
  66 + @RequestMapping(value="/list", method = RequestMethod.GET)
  67 + @ResponseBody
  68 + public BaseOutput<Page<ShopProductRecommendOutput>> list(@ModelAttribute @Valid ShopProductRecommendListInput input) {
  69 + Page<ShopProductRecommend> page = shopProductRecommendService.listPage(input);
  70 + BaseOutput<Page<ShopProductRecommendOutput>> output = BaseOutput.success();
  71 + try {
  72 + Page<ShopProductRecommendOutput> result = BeanConver.copePage(page, ShopProductRecommendOutput.class);
  73 + output.setData(result);
  74 + } catch (Exception e) {
  75 + handleException(output, e);
  76 + }
  77 + return output;
  78 + }
  79 +
  80 + @ApiOperation(value ="删除", notes = "按删除ShopProductRecommend")
  81 + @RequestMapping(value = "/del", method = RequestMethod.GET)
  82 + @ResponseBody
  83 + public BaseOutput<Integer> del(Long id){
  84 + BaseOutput<Integer> output = BaseOutput.success();
  85 + try {
  86 + int result = shopProductRecommendService.del(id);
  87 + output.setData(result);
  88 + } catch (Exception e) {
  89 + handleException(output, e);
  90 + }
  91 + return output;
  92 + }
  93 +
  94 + @ApiOperation(value ="详情", notes = "获取ShopProductRecommend详情")
  95 + @RequestMapping(value="/show", method = RequestMethod.GET)
  96 + @ResponseBody
  97 + public BaseOutput<ShopProductRecommend> show(Long id) {
  98 + BaseOutput<ShopProductRecommend> output = BaseOutput.success();
  99 + try {
  100 + ShopProductRecommend item = shopProductRecommendService.get(id);
  101 + output.setData(item);
  102 + } catch (Exception e) {
  103 + handleException(output, e);
  104 + }
  105 + return output;
  106 + }
  107 +}
myapp-web/src/main/java/com/b2c/myapp/api/ShoppingCartApi.java 0 → 100644
  1 +
  2 +package com.b2c.myapp.api;
  3 +
  4 +import org.springframework.web.bind.annotation.ModelAttribute;
  5 +import javax.validation.Valid;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Controller;
  8 +import org.springframework.web.servlet.ModelAndView;
  9 +import org.springframework.web.bind.annotation.RequestBody;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +import com.b2c.myapp.common.utils.BaseOutput;
  14 +
  15 +import com.b2c.myapp.utils.*;
  16 +import com.b2c.myapp.common.utils.base.Page;
  17 +
  18 +import com.b2c.myapp.common.api.shoppingCart.input.ShoppingCartInput;
  19 +import com.b2c.myapp.common.api.shoppingCart.input.ShoppingCartListInput;
  20 +import com.b2c.myapp.common.api.shoppingCart.input.ShoppingCartSaveInput;
  21 +import com.b2c.myapp.common.api.shoppingCart.input.ShoppingCartUpdateInput;
  22 +import com.b2c.myapp.common.api.shoppingCart.output.ShoppingCartOutput;
  23 +
  24 +import com.b2c.myapp.service.ShoppingCartService;
  25 +import com.b2c.myapp.domain.ShoppingCart;
  26 +import com.diligrp.website.util.web.BaseController;
  27 +
  28 +import io.swagger.annotations.Api;
  29 +import io.swagger.annotations.ApiOperation;
  30 +import io.swagger.annotations.ApiParam;
  31 +import org.slf4j.Logger;
  32 +import org.slf4j.LoggerFactory;
  33 +import java.util.HashMap;
  34 +import java.util.Map;
  35 +
  36 +/**
  37 + * <br />
  38 + * @createTime 2016-11-29 9:35:16
  39 + * @author template
  40 + */
  41 +@Controller
  42 +@RequestMapping(value = "/api/shoppingCart")
  43 +@Api(value = "ShoppingCart-api", description = "有关于ShoppingCart的CURD操作")
  44 +public class ShoppingCartApi extends BaseRestFulApi {
  45 + private final static Logger LOG = LoggerFactory.getLogger(ShoppingCartApi.class);
  46 +
  47 + @Autowired
  48 + private ShoppingCartService shoppingCartService;
  49 +
  50 +
  51 + @ApiOperation(value ="新增", notes = "新增ShoppingCart记录")
  52 + @RequestMapping(value = "/save", method = RequestMethod.POST)
  53 + @ResponseBody
  54 + public BaseOutput<Integer> save(@ModelAttribute @Valid ShoppingCartInput val){
  55 + BaseOutput<Integer> output = BaseOutput.success();
  56 + try {
  57 + int result = shoppingCartService.saveOrUpdate(BeanConver.copeBean(val,ShoppingCart.class));
  58 + output.setData(result);
  59 + } catch (Exception e) {
  60 + handleException(output, e);
  61 + }
  62 + return output;
  63 + }
  64 +
  65 + @ApiOperation(value ="查询", notes = "多条件查询ShoppingCart")
  66 + @RequestMapping(value="/list", method = RequestMethod.GET)
  67 + @ResponseBody
  68 + public BaseOutput<Page<ShoppingCartOutput>> list(@ModelAttribute @Valid ShoppingCartListInput input) {
  69 + Page<ShoppingCart> page = shoppingCartService.listPage(input);
  70 + BaseOutput<Page<ShoppingCartOutput>> output = BaseOutput.success();
  71 + try {
  72 + Page<ShoppingCartOutput> result = BeanConver.copePage(page, ShoppingCartOutput.class);
  73 + output.setData(result);
  74 + } catch (Exception e) {
  75 + handleException(output, e);
  76 + }
  77 + return output;
  78 + }
  79 +
  80 + @ApiOperation(value ="删除", notes = "按删除ShoppingCart")
  81 + @RequestMapping(value = "/del", method = RequestMethod.GET)
  82 + @ResponseBody
  83 + public BaseOutput<Integer> del(Long id){
  84 + BaseOutput<Integer> output = BaseOutput.success();
  85 + try {
  86 + int result = shoppingCartService.del(id);
  87 + output.setData(result);
  88 + } catch (Exception e) {
  89 + handleException(output, e);
  90 + }
  91 + return output;
  92 + }
  93 +
  94 + @ApiOperation(value ="详情", notes = "获取ShoppingCart详情")
  95 + @RequestMapping(value="/show", method = RequestMethod.GET)
  96 + @ResponseBody
  97 + public BaseOutput<ShoppingCart> show(Long id) {
  98 + BaseOutput<ShoppingCart> output = BaseOutput.success();
  99 + try {
  100 + ShoppingCart item = shoppingCartService.get(id);
  101 + output.setData(item);
  102 + } catch (Exception e) {
  103 + handleException(output, e);
  104 + }
  105 + return output;
  106 + }
  107 +}
myapp-web/src/main/java/com/b2c/myapp/utils/BindingResultHandler.java deleted 100644 → 0
1 -package com.b2c.myapp.utils;  
2 -  
3 -import org.aspectj.lang.ProceedingJoinPoint;  
4 -import org.aspectj.lang.reflect.MethodSignature;  
5 -  
6 -import javax.validation.ConstraintViolation;  
7 -import javax.validation.Validation;  
8 -import javax.validation.executable.ExecutableValidator;  
9 -import java.lang.reflect.Method;  
10 -import java.util.Set;  
11 -  
12 -public class BindingResultHandler {  
13 -  
14 - public Object validate(ProceedingJoinPoint pjp) throws Throwable {  
15 - Object target = pjp.getTarget();  
16 -  
17 - MethodSignature joinPointObject = (MethodSignature) pjp.getSignature();  
18 - Method method = joinPointObject.getMethod();  
19 -  
20 - ExecutableValidator ev = Validation.buildDefaultValidatorFactory().getValidator().forExecutables();  
21 - Set<ConstraintViolation<Object>> violations = ev.validateParameters(target, method, pjp.getArgs(), new Class[]{});  
22 - if (!violations.isEmpty()) {  
23 - StringBuilder sb = new StringBuilder(128);  
24 - for (ConstraintViolation<Object> violation : violations) {  
25 - sb.append(',').append(violation.getMessage());  
26 - }  
27 - throw new IllegalArgumentException(sb.substring(1));  
28 - }  
29 - return pjp.proceed();  
30 - }  
31 -}  
32 \ No newline at end of file 0 \ No newline at end of file
myapp-web/src/main/java/com/b2c/myapp/utils/Result.java deleted 100644 → 0
1 -package com.b2c.myapp.utils;  
2 -  
3 -import java.io.Serializable;  
4 -  
5 -/**  
6 - * 基本返回结果  
7 - */  
8 -public class Result<T> implements Serializable {  
9 - private static final long serialVersionUID = 5925101851082556646L;  
10 - private T content;  
11 - private String status;  
12 - private String errorCode;  
13 - private String errorMsg;  
14 -  
15 - public Result() {  
16 - this.status = Result.Status.SUCCESS.code();  
17 - }  
18 -  
19 - public Result(String errorCode, String errorMsg) {  
20 - this(errorCode, errorMsg, Result.Status.ERROR);  
21 - }  
22 -  
23 - public Result(String errorCode, String errorMsg, Result.Status status) {  
24 - this.errorCode = errorCode;  
25 - this.errorMsg = errorMsg;  
26 - this.status = status.code();  
27 - }  
28 -  
29 - public T getContent() {  
30 - return this.content;  
31 - }  
32 -  
33 - public Result<T> setContent(T content) {  
34 - this.content = content;  
35 - return this;  
36 - }  
37 -  
38 - public String getStatus() {  
39 - return this.status;  
40 - }  
41 -  
42 - public Result<T> setStatus(String status) {  
43 - this.status = status;  
44 - return this;  
45 - }  
46 -  
47 - public String getErrorCode() {  
48 - return this.errorCode;  
49 - }  
50 -  
51 - public Result<T> setErrorCode(String errorCode) {  
52 - this.errorCode = errorCode;  
53 - return this;  
54 - }  
55 -  
56 - public String getErrorMsg() {  
57 - return this.errorMsg;  
58 - }  
59 -  
60 - public Result<T> setErrorMsg(String errorMsg) {  
61 - this.errorMsg = errorMsg;  
62 - return this;  
63 - }  
64 -  
65 - public static enum Status {  
66 - SUCCESS("OK"),  
67 - ERROR("ERROR");  
68 -  
69 - private String code;  
70 -  
71 - private Status(String code) {  
72 - this.code = code;  
73 - }  
74 -  
75 - public String code() {  
76 - return this.code;  
77 - }  
78 - }  
79 -}  
80 \ No newline at end of file 0 \ No newline at end of file
myapp-web/src/main/java/com/b2c/myapp/utils/UniformHandlerExceptionResolver.java deleted 100644 → 0
1 -package com.b2c.myapp.utils;  
2 -  
3 -import com.b2c.myapp.utils.exception.BusinessException;  
4 - import com.alibaba.fastjson.JSONObject;  
5 - import org.apache.commons.collections.map.HashedMap;  
6 - import org.slf4j.Logger;  
7 - import org.slf4j.LoggerFactory;  
8 - import org.springframework.validation.BindException;  
9 - import org.springframework.validation.FieldError;  
10 - import org.springframework.web.bind.annotation.ResponseBody;  
11 - import org.springframework.web.bind.annotation.RestController;  
12 - import org.springframework.web.method.HandlerMethod;  
13 - import org.springframework.web.servlet.HandlerExceptionResolver;  
14 - import org.springframework.web.servlet.ModelAndView;  
15 -  
16 - import javax.servlet.http.HttpServletRequest;  
17 - import javax.servlet.http.HttpServletResponse;  
18 - import java.util.ArrayList;  
19 - import java.util.List;  
20 - import java.util.Map;  
21 -  
22 -//@Component("exceptionResolver")  
23 -public class UniformHandlerExceptionResolver implements HandlerExceptionResolver {  
24 - private final static Logger LOG = LoggerFactory.getLogger(BeanConver.class);  
25 -  
26 - public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {  
27 - Result result = null;  
28 - if(BusinessException.class.isAssignableFrom(ex.getClass())) {  
29 - BusinessException requestHeader = (BusinessException) ex;  
30 - result = new Result(requestHeader.getErrorCode(), requestHeader.getErrorMsg());  
31 - Map<String, Object> map = new HashedMap();  
32 - map.put("obj", result);  
33 - this.LOG.error(String.format("HandlerExceptionResolver catche the Business Exception -> %s", new Object[]{requestHeader.getErrorMsg()}), ex);  
34 - return new ModelAndView(WebContent.fetchReferer(), map);  
35 - }else if(ex instanceof BindException){  
36 - BindException be = ((BindException) ex);  
37 - List<String> list = new ArrayList<>();  
38 - StringBuffer sb = new StringBuffer();  
39 - for (FieldError fe : be.getFieldErrors()) {  
40 - list.add(fe.getDefaultMessage());  
41 - sb.append(",").append(fe.getDefaultMessage());  
42 - }  
43 - result = new Result("errList", sb.substring(1));  
44 - result.setContent(be.getBindingResult().getTarget());  
45 - this.LOG.error(String.format("参数校验错误 -> %s", new Object[]{sb.toString()}), ex);  
46 - Map<String, Object> map = new HashedMap();  
47 - map.put("obj", result);  
48 - return new ModelAndView("redirect:"+WebContent.fetchReferer(), map);  
49 - } else if(IllegalArgumentException.class.isAssignableFrom(ex.getClass())) {  
50 - IllegalArgumentException iae = (IllegalArgumentException)ex;  
51 - result = new Result("param", iae.getMessage());  
52 - this.LOG.error(String.format("HandlerExceptionResolver catche the InvalidParam Exception -> %s", new Object[]{iae.getMessage()}), ex);  
53 - } else {  
54 - result = new Result("000", "系统异常");  
55 - this.LOG.error("HandlerExceptionResolver catche the serious System Exception, ", ex);  
56 - }  
57 -  
58 - String requestHeader3 = request.getHeader("Accept");  
59 - response.setCharacterEncoding("UTF-8");  
60 - if(requestHeader3 != null && !this.isAjaxHandler(handler)) {  
61 - response.setContentType("text/html;charset=UTF-8");  
62 - request.setAttribute("errorCode", result.getErrorCode());  
63 - request.setAttribute("errorMsg", result.getErrorMsg());  
64 - return new ModelAndView("redirect:" + WebContent.fetchReferer());  
65 - } else {  
66 - try {  
67 - response.setContentType("application/json;charset=UTF-8");  
68 - StringBuffer e1 = new StringBuffer();  
69 - e1.append(JSONObject.toJSONString(result));  
70 - response.getWriter().println(e1.toString());  
71 - } catch (Exception var8) {  
72 - this.LOG.error("Response write exception", var8);  
73 - }  
74 - return new ModelAndView();  
75 - }  
76 - }  
77 - private boolean isAjaxHandler(Object handler) {  
78 - if(!(handler instanceof HandlerMethod)) {  
79 - return false;  
80 - } else {  
81 - HandlerMethod handlerMethod = (HandlerMethod)handler;  
82 - Class beanType = handlerMethod.getBeanType();  
83 - return beanType.getAnnotation(RestController.class) != null || beanType.getAnnotation(ResponseBody.class) != null || handlerMethod.getMethodAnnotation(ResponseBody.class) != null || handlerMethod.getMethod().getReturnType().isAssignableFrom(Result.class);  
84 - }  
85 - }  
86 -}  
87 \ No newline at end of file 0 \ No newline at end of file
myapp-web/src/main/java/com/b2c/myapp/utils/WebContentFilter.java deleted 100644 → 0
1 -package com.b2c.myapp.utils;  
2 -  
3 -import org.apache.commons.lang.StringUtils;  
4 -import javax.servlet.Filter;  
5 -import javax.servlet.FilterChain;  
6 -import javax.servlet.FilterConfig;  
7 -import javax.servlet.ServletException;  
8 -import javax.servlet.ServletRequest;  
9 -import javax.servlet.ServletResponse;  
10 -import javax.servlet.http.Cookie;  
11 -import javax.servlet.http.HttpServletRequest;  
12 -import javax.servlet.http.HttpServletResponse;  
13 -import java.io.IOException;  
14 -import java.util.HashMap;  
15 -import java.util.Map;  
16 -import java.util.regex.Pattern;  
17 -  
18 -/**  
19 - * User: juqkai (juqkai@gmail.com)  
20 - * Date: 13-9-25 上午11:23  
21 - */  
22 -public class WebContentFilter implements Filter {  
23 - private Pattern[] exclude;  
24 -  
25 - @Override  
26 - public void init(FilterConfig filterConfig) throws ServletException {  
27 - String excludeString = filterConfig.getInitParameter("exclude");  
28 - if (!StringUtils.isBlank(excludeString)) {  
29 - String[] excludeArray = excludeString.split(",");  
30 - exclude = new Pattern[excludeArray.length];  
31 - for (int i = 0; i < excludeArray.length; i++) {  
32 - exclude[i] = Pattern.compile(excludeArray[i]);  
33 - }  
34 - }  
35 - }  
36 -  
37 - @Override  
38 - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {  
39 - if (isExclude((HttpServletRequest) request)) {  
40 - chain.doFilter(request, response);  
41 - return;  
42 - }  
43 - try{  
44 - WebContent.put((HttpServletRequest) request);  
45 - WebContent.put((HttpServletResponse) response);  
46 - initParam((HttpServletRequest) request);  
47 - chain.doFilter(request, response);  
48 - }finally {  
49 - WebContent.clean();  
50 - }  
51 - }  
52 -  
53 - private void initParam(HttpServletRequest request){  
54 - //COOKIE  
55 - Map<String, Object> cookie = new HashMap<String, Object>();  
56 - if(null != request.getCookies()){  
57 - for (Cookie c : request.getCookies()) {  
58 - cookie.put(c.getName(), c.getValue());  
59 - }  
60 - }  
61 - request.setAttribute("c", cookie);  
62 - request.setAttribute("cookie", cookie);  
63 - }  
64 -  
65 - @Override  
66 - public void destroy() {  
67 - WebContent.clean();  
68 - }  
69 -  
70 -  
71 - private boolean isExclude(HttpServletRequest request) {  
72 - if (exclude == null || exclude.length == 0) {  
73 - return false;  
74 - }  
75 - String currentUri = fetchPath(request);  
76 - for (Pattern excludeUri : exclude) {  
77 - if (excludeUri.matcher(currentUri).find()) {  
78 - return true;  
79 - }  
80 - }  
81 - return false;  
82 - }  
83 -  
84 - /**  
85 - * 获取系统内的请求路径  
86 - * @param request  
87 - * @return  
88 - */  
89 - private String fetchPath(HttpServletRequest request){  
90 - String contextPath = request.getContextPath();  
91 - String currentUri = request.getRequestURI();  
92 - currentUri = currentUri.replaceAll("^" + contextPath, "");  
93 - return currentUri;  
94 - }  
95 -  
96 -}  
myapp-web/src/main/java/com/b2c/myapp/utils/exception/BusinessException.java deleted 100644 → 0
1 -package com.b2c.myapp.utils.exception;  
2 -  
3 -/**  
4 - * Created by Administrator on 2016/10/11.  
5 - */  
6 -public class BusinessException extends Exception {  
7 - private String errorCode;  
8 - private String errorMsg;  
9 -  
10 - public BusinessException(String errorCode, String errorMsg) {  
11 - super(String.format("BusinessException{errorCode:%s, errorMsg:%s}", new Object[]{errorCode, errorMsg}));  
12 - this.errorCode = errorCode;  
13 - this.errorMsg = errorMsg;  
14 - }  
15 -  
16 - public String getErrorCode() {  
17 - return this.errorCode;  
18 - }  
19 -  
20 - public String getErrorMsg() {  
21 - return this.errorMsg;  
22 - }  
23 -}  
24 -  
myapp-web/src/main/java/com/b2c/myapp/api/BuyerInfoController.java renamed to myapp-web/src/main/java/com/b2c/myapp/web/BuyerInfoController.java
1 1
2 -package com.b2c.myapp.api;  
3 -  
4 -import com.b2c.myapp.utils.BeanConver;  
5 -import com.b2c.myapp.utils.WebContent;  
6 -import org.springframework.web.bind.annotation.ModelAttribute;  
7 -import javax.validation.Valid;  
8 -import org.springframework.beans.factory.annotation.Autowired;  
9 -import org.springframework.stereotype.Controller;  
10 -import org.springframework.web.servlet.ModelAndView;  
11 -import org.springframework.web.bind.annotation.RequestMapping;  
12 -import org.springframework.web.bind.annotation.RequestMethod;  
13 -  
14 -import com.b2c.myapp.common.utils.base.Page;  
15 - 2 +package com.b2c.myapp.web;
16 3
  4 +import com.b2c.myapp.api.BaseRestFulApi;
17 import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoInput; 5 import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoInput;
18 import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoListInput; 6 import com.b2c.myapp.common.api.buyerInfo.input.BuyerInfoListInput;
19 import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; 7 import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput;
20 -  
21 -import com.b2c.myapp.service.BuyerInfoService; 8 +import com.b2c.myapp.common.utils.BaseOutput;
  9 +import com.b2c.myapp.common.utils.base.Page;
22 import com.b2c.myapp.domain.BuyerInfo; 10 import com.b2c.myapp.domain.BuyerInfo;
  11 +import com.b2c.myapp.service.BuyerInfoService;
  12 +import com.b2c.myapp.utils.BeanConver;
  13 +import com.b2c.myapp.utils.WebContent;
23 import com.diligrp.website.util.web.BaseController; 14 import com.diligrp.website.util.web.BaseController;
24 -  
25 import io.swagger.annotations.Api; 15 import io.swagger.annotations.Api;
26 import io.swagger.annotations.ApiOperation; 16 import io.swagger.annotations.ApiOperation;
27 import org.slf4j.Logger; 17 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory; 18 import org.slf4j.LoggerFactory;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.stereotype.Controller;
  21 +import org.springframework.web.bind.annotation.ModelAttribute;
  22 +import org.springframework.web.bind.annotation.RequestMapping;
  23 +import org.springframework.web.bind.annotation.RequestMethod;
  24 +import org.springframework.web.bind.annotation.ResponseBody;
  25 +import org.springframework.web.servlet.ModelAndView;
  26 +
  27 +import javax.validation.Valid;
29 import java.util.HashMap; 28 import java.util.HashMap;
30 import java.util.Map; 29 import java.util.Map;
31 30
@@ -37,7 +36,7 @@ import java.util.Map; @@ -37,7 +36,7 @@ import java.util.Map;
37 @Controller 36 @Controller
38 @RequestMapping(value = "/buyerInfo") 37 @RequestMapping(value = "/buyerInfo")
39 @Api(value = "BuyerInfo-api", description = "有关于BuyerInfo的CURD操作") 38 @Api(value = "BuyerInfo-api", description = "有关于BuyerInfo的CURD操作")
40 -public class BuyerInfoController extends BaseController { 39 +public class BuyerInfoController extends BaseController {
41 private final static Logger LOG = LoggerFactory.getLogger(BuyerInfoController.class); 40 private final static Logger LOG = LoggerFactory.getLogger(BuyerInfoController.class);
42 41
43 @Autowired 42 @Autowired
myapp-web/src/main/java/com/b2c/myapp/api/DeliveryTimeController.java renamed to myapp-web/src/main/java/com/b2c/myapp/web/DeliveryTimeController.java
1 1
2 -package com.b2c.myapp.api; 2 +package com.b2c.myapp.web;
3 3
4 import com.b2c.myapp.common.api.deliveryTime.output.DeliveryTimeOutput; 4 import com.b2c.myapp.common.api.deliveryTime.output.DeliveryTimeOutput;
5 import com.b2c.myapp.utils.BeanConver; 5 import com.b2c.myapp.utils.BeanConver;
myapp-web/src/main/java/com/b2c/myapp/api/FoundTradeController.java renamed to myapp-web/src/main/java/com/b2c/myapp/web/FoundTradeController.java
1 1
2 -package com.b2c.myapp.api; 2 +package com.b2c.myapp.web;
3 3
4 import com.b2c.myapp.common.api.foundTrade.input.FoundTradeInput; 4 import com.b2c.myapp.common.api.foundTrade.input.FoundTradeInput;
5 import com.b2c.myapp.common.api.foundTrade.input.FoundTradeListInput; 5 import com.b2c.myapp.common.api.foundTrade.input.FoundTradeListInput;
myapp-web/src/main/java/com/b2c/myapp/api/PickingInfoController.java renamed to myapp-web/src/main/java/com/b2c/myapp/web/PickingInfoController.java
1 1
2 -package com.b2c.myapp.api; 2 +package com.b2c.myapp.web;
3 3
4 import com.b2c.myapp.common.api.pickingInfo.output.PickingInfoOutput; 4 import com.b2c.myapp.common.api.pickingInfo.output.PickingInfoOutput;
5 import com.b2c.myapp.service.PickingInfoService; 5 import com.b2c.myapp.service.PickingInfoService;
myapp-web/src/main/java/com/b2c/myapp/api/SellerInfoController.java renamed to myapp-web/src/main/java/com/b2c/myapp/web/SellerInfoController.java
1 1
2 -package com.b2c.myapp.api; 2 +package com.b2c.myapp.web;
3 3
4 import com.b2c.myapp.common.api.sellerInfo.input.SellerInfoInput; 4 import com.b2c.myapp.common.api.sellerInfo.input.SellerInfoInput;
5 import com.b2c.myapp.common.api.sellerInfo.input.SellerInfoListInput; 5 import com.b2c.myapp.common.api.sellerInfo.input.SellerInfoListInput;
myapp-web/src/main/java/com/b2c/myapp/api/ShopBuyerController.java renamed to myapp-web/src/main/java/com/b2c/myapp/web/ShopBuyerController.java
1 1
2 -package com.b2c.myapp.api; 2 +package com.b2c.myapp.web;
3 3
4 import com.b2c.myapp.utils.BeanConver; 4 import com.b2c.myapp.utils.BeanConver;
5 import com.b2c.myapp.utils.WebContent; 5 import com.b2c.myapp.utils.WebContent;
myapp-web/src/main/java/com/b2c/myapp/api/ShopController.java renamed to myapp-web/src/main/java/com/b2c/myapp/web/ShopController.java
1 1
2 -package com.b2c.myapp.api; 2 +package com.b2c.myapp.web;
3 3
4 import com.b2c.myapp.common.api.shop.input.ShopInput; 4 import com.b2c.myapp.common.api.shop.input.ShopInput;
5 import com.b2c.myapp.common.api.shop.input.ShopListInput; 5 import com.b2c.myapp.common.api.shop.input.ShopListInput;
myapp-web/src/main/java/com/b2c/myapp/api/ShopProductRecommendController.java renamed to myapp-web/src/main/java/com/b2c/myapp/web/ShopProductRecommendController.java
1 1
2 -package com.b2c.myapp.api; 2 +package com.b2c.myapp.web;
3 3
4 import com.b2c.myapp.common.api.shopProductRecommend.input.ShopProductRecommendListInput; 4 import com.b2c.myapp.common.api.shopProductRecommend.input.ShopProductRecommendListInput;
5 import com.b2c.myapp.common.api.shopProductRecommend.output.ShopProductRecommendOutput; 5 import com.b2c.myapp.common.api.shopProductRecommend.output.ShopProductRecommendOutput;
myapp-web/src/main/java/com/b2c/myapp/api/ShoppingCartController.java renamed to myapp-web/src/main/java/com/b2c/myapp/web/ShoppingCartController.java
1 1
2 -package com.b2c.myapp.api; 2 +package com.b2c.myapp.web;
3 3
4 import com.b2c.myapp.common.api.shoppingCart.input.ShoppingCartInput; 4 import com.b2c.myapp.common.api.shoppingCart.input.ShoppingCartInput;
5 import com.b2c.myapp.common.api.shoppingCart.input.ShoppingCartListInput; 5 import com.b2c.myapp.common.api.shoppingCart.input.ShoppingCartListInput;