From b45739d1515ad213fadde13f36f8f316ab619f49 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Mon, 11 May 2020 21:45:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=A0=81=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=EF=BC=8C=E4=BB=A3=E7=A0=81=20REVIEW?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rest/request/users/OrderReturnApplyRequest.java | 9 ++++++--- .../system/biz/config/ServiceExceptionConfiguration.java | 1 + .../system/biz/dataobject/errorcode/ErrorCodeDO.java | 4 ++++ .../system/biz/dto/errorcode/ErrorCodeUpdateDTO.java | 1 + .../biz/service/errorcode/ErrorCodeServiceImpl.java | 7 ++++++- .../controller/errorCode/SystemErrorCodeController.java | 4 ++-- .../rest/request/errorcode/ErrorCodePageRequest.java | 3 +++ 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/users/OrderReturnApplyRequest.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/users/OrderReturnApplyRequest.java index a34c2455c..adbbf143c 100644 --- a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/users/OrderReturnApplyRequest.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/users/OrderReturnApplyRequest.java @@ -1,11 +1,12 @@ package cn.iocoder.mall.order.rest.request.users; -import java.io.Serializable; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import lombok.Data; import lombok.experimental.Accessors; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; + /** * 订单售后 * @@ -26,6 +27,8 @@ public class OrderReturnApplyRequest implements Serializable { * * - 1、退货退款 * - 2、退款 + * + * / TODO FROM 芋艿 to xiaofeng:可以瞅瞅 @InEnum 注解,直接校验退货类型 */ @NotNull(message = "退货类型不能为空!") private Integer returnType; diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/config/ServiceExceptionConfiguration.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/config/ServiceExceptionConfiguration.java index 7f1433e2f..50400ee5b 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/config/ServiceExceptionConfiguration.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/config/ServiceExceptionConfiguration.java @@ -14,6 +14,7 @@ import java.util.List; @Configuration public class ServiceExceptionConfiguration { + // TODO FROM 芋艿 to 鱿鱼须:这块的实现,微信一起沟通下哈。大体是说,要调用 RPC 接口,不然别的模块无法使用哟。最终,我们是要做成 starter,提供给各个模块用。 @Autowired private ErrorCodeService errorCodeService; diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/errorcode/ErrorCodeDO.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/errorcode/ErrorCodeDO.java index 055996696..0ce8e3ce7 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/errorcode/ErrorCodeDO.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/errorcode/ErrorCodeDO.java @@ -30,4 +30,8 @@ public class ErrorCodeDO extends DeletableDO { * 错误码类型 */ private Integer type; + + // TODO FROM 芋艿 to 鱿鱼丝:增加一个分组字段。方便做归类 + // TODO FROM 芋艿 to 鱿鱼丝:增加个备注字段,方便做备注哈。 + } diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/errorcode/ErrorCodeUpdateDTO.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/errorcode/ErrorCodeUpdateDTO.java index 9cca65e27..f26ee519b 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/errorcode/ErrorCodeUpdateDTO.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/errorcode/ErrorCodeUpdateDTO.java @@ -16,6 +16,7 @@ public class ErrorCodeUpdateDTO { /** * 错误码编号,内置错误码的id是没有的 */ + // TODO FROM 芋艿 to 鱿鱼丝:必要的参数校验噢 private Integer id; @NotNull(message = "错误码编码不能为空") diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/errorcode/ErrorCodeServiceImpl.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/errorcode/ErrorCodeServiceImpl.java index c30ff3c0a..192ea11ff 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/errorcode/ErrorCodeServiceImpl.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/errorcode/ErrorCodeServiceImpl.java @@ -37,6 +37,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService { @Override public List getErrorCodeList() { + // TODO FROM 芋艿 to 鱿鱼丝:QueryWrapperX 只存在 mapper 里,不直接体现在 Service List list = errorCodeMapper.selectList(new QueryWrapperX()); return ErrorCodeConvert.INSTANCE.convertList(list); } @@ -44,6 +45,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService { @Override public List getErrorCodeListAll() { List list = errorCodeMapper.selectList(new QueryWrapperX()); + // TODO FROM 芋艿 to 鱿鱼丝:这块微信交流一波哈。 for (SystemErrorCodeEnum item : SystemErrorCodeEnum.values()) { list.add(new ErrorCodeDO().setId(0).setCode(item.getCode()). setMessage(item.getMessage()).setType(ErrorCodeTypeEnum.SYSTEM.getType())); @@ -103,6 +105,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService { if (errorCodeDO == null) { throw ServiceExceptionUtil.exception(SystemErrorCodeEnum.ERROR_CODE_NOT_EXISTS); } + // TODO FROM 芋艿 to 鱿鱼丝:不能删除内置错误码 // 更新到数据库,标记删除 errorCodeMapper.deleteById(errorCodeDO.getId()); // TODO: 2020-05-10 刷新对外提供的错误码列表 @@ -125,13 +128,15 @@ public class ErrorCodeServiceImpl implements ErrorCodeService { } private PageResult listToPageList(int currentPage, int rows, List list){ + // TODO FROM 芋艿 to 鱿鱼须:可以直接使用数据库分页哇 currentPage = currentPage * rows; - Integer sum = list.size(); + Integer sum = list.size(); // TODO FROM 芋艿 to 鱿鱼须:这里 int 就可以啦。一般情况下,如果 IDEA 提示警告,要尽量去掉噢。 if (currentPage + rows > sum){ list = list.subList(currentPage, sum); }else { list = list.subList(currentPage, currentPage + rows); } + // TODO FROM 芋艿 to 鱿鱼丝:泛型噢 return new PageResult().setList(list).setTotal(sum); } } diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/errorCode/SystemErrorCodeController.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/errorCode/SystemErrorCodeController.java index 863b60fcf..4023f36b7 100644 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/errorCode/SystemErrorCodeController.java +++ b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/errorCode/SystemErrorCodeController.java @@ -27,9 +27,9 @@ import org.springframework.web.bind.annotation.*; * @author youyusi */ @RestController -@RequestMapping(MallConstants.ROOT_PATH_ADMIN + "/errorcode") +@RequestMapping(MallConstants.ROOT_PATH_ADMIN + "/errorcode") // TODO FROM 芋艿 to 鱿鱼须:error-code @Api("错误码") -public class SystemErrorCodeController { +public class SystemErrorCodeController { // TODO FROM 芋艿 to 鱿鱼须:变量要空行 @Autowired private ErrorCodeService errorCodeService; diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/errorcode/ErrorCodePageRequest.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/errorcode/ErrorCodePageRequest.java index 17ef20468..6383207e6 100644 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/errorcode/ErrorCodePageRequest.java +++ b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/errorcode/ErrorCodePageRequest.java @@ -12,4 +12,7 @@ import lombok.experimental.Accessors; @Data @Accessors(chain = true) public class ErrorCodePageRequest { + + // TODO FROM 芋艿 to 鱿鱼须:分页参数? + // TODO FROM 芋艿 to 鱿鱼须:对于 rest 的接口,要区分下是给 Admins 管理员还是 Users 用户的 }