From bca1afd3b4174a74b3419d3d9bf9b27e5311799a Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Wed, 8 May 2019 18:35:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?-=20=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=E5=91=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/OrderRefunds/OrderRefundsList.js | 12 +++-- .../src/pages/OrderRefunds/TableSearch.js | 46 +++++++++++++++++-- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/admin-web/src/pages/OrderRefunds/OrderRefundsList.js b/admin-web/src/pages/OrderRefunds/OrderRefundsList.js index b9e97e283..8230041a2 100644 --- a/admin-web/src/pages/OrderRefunds/OrderRefundsList.js +++ b/admin-web/src/pages/OrderRefunds/OrderRefundsList.js @@ -19,9 +19,15 @@ import dictionary from '../../utils/dictionary'; class OrderRefundsList extends PureComponent { componentDidMount() { // 查询 list - this.queryList({ index: 1 }); + this.queryList({ index: 1 }, {}); } + handleSearch = searchParams => { + const { orderRefunds } = this.props; + const { index, pageSize } = orderRefunds; + this.queryList({ index, pageSize }, searchParams); + }; + queryList = ({ index = 0, pageSize = 10 }, searchParams) => { const { dispatch } = this.props; dispatch({ @@ -40,7 +46,7 @@ class OrderRefundsList extends PureComponent { handleTableChange = pagination => { const { pageSize, current } = pagination; - this.queryList({ pageSize, index: current }); + this.queryList({ pageSize, index: current }, {}); }; render() { @@ -125,7 +131,7 @@ class OrderRefundsList extends PureComponent {
- +
diff --git a/admin-web/src/pages/OrderRefunds/TableSearch.js b/admin-web/src/pages/OrderRefunds/TableSearch.js index 07aec863a..81b2f9ed2 100644 --- a/admin-web/src/pages/OrderRefunds/TableSearch.js +++ b/admin-web/src/pages/OrderRefunds/TableSearch.js @@ -9,11 +9,51 @@ const FormItem = Form.Item; * @type {React.ComponentClass>} */ const TableSearch = Form.create()(props => { - const { getFieldDecorator } = props.form; + const { getFieldDecorator, form, handleSearch } = props.form; - function onSubmit() {} + function onSubmit(e) { + e.preventDefault(); - function handleFormReset() {} + form.validateFields((err, fields) => { + const buildTime = (fieldValue, key) => { + const res = {}; + if (fieldValue && fieldValue.length >= 2) { + const keySuffix = key.substring(0, 1).toUpperCase() + key.substring(1); + res[`start${keySuffix}`] = fieldValue[0].format('YYYY-MM-DD HH:mm:ss'); + res[`end${keySuffix}`] = fieldValue[1].format('YYYY-MM-DD HH:mm:ss'); + } + return res; + }; + + const timeFields = ['createTime']; + const buildSearchParams = fields2 => { + let res = {}; + Object.keys(fields).map(objectKey => { + const fieldValue = fields2[objectKey]; + if (timeFields.indexOf(objectKey) !== -1) { + // 处理时间 + res = { + ...res, + ...buildTime(fieldValue, objectKey), + }; + } else if (fieldValue !== undefined) { + res[objectKey] = fieldValue; + } + return true; + }); + return res; + }; + + const searchParams = buildSearchParams(fields); + if (handleSearch) { + handleSearch(searchParams); + } + }); + } + + function handleFormReset() { + form.resetFields(); + } return (
From b5078b3ffe55b15c02f60266bc1de44ee9d37aab Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Wed, 8 May 2019 18:45:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?-=20=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=E5=91=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admins/AdminOrderReturnController.java | 11 +++++++---- .../exception/OrderReturnNonExistentException.java | 10 ++++++++++ .../iocoder/mall/order/biz/dao/OrderReturnMapper.java | 8 ++++++++ .../order/biz/service/OrderReturnServiceImpl.java | 9 +++++++++ .../src/main/resources/mapper/OrderReturnMapper.xml | 10 ++++++++++ 5 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 order/order-service-api/src/main/java/cn/iocoder/mall/order/api/exception/OrderReturnNonExistentException.java diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java index fd4bd286a..625b341fe 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java @@ -10,10 +10,7 @@ import io.swagger.annotations.Api; import org.apache.dubbo.config.annotation.Reference; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * 订单退货 @@ -35,4 +32,10 @@ public class AdminOrderReturnController { OrderReturnQueryDTO queryDTO = OrderReturnConvert.INSTANCE.convert(queryPO); return orderReturnService.orderReturnList(queryDTO); } + + @PostMapping("agree") + public CommonResult agree(@RequestParam("id") Integer id) { + CommonResult commonResult = orderReturnService.agree(id); + return commonResult; + } } diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/exception/OrderReturnNonExistentException.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/exception/OrderReturnNonExistentException.java new file mode 100644 index 000000000..b07ff29e6 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/exception/OrderReturnNonExistentException.java @@ -0,0 +1,10 @@ +package cn.iocoder.mall.order.api.exception; + +/** + * 订单退回 - 不存在 + * + * @author Sin + * @time 2019/5/8 6:17 PM + */ +public class OrderReturnNonExistentException { +} diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderReturnMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderReturnMapper.java index 5efbf3c62..ea25d903e 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderReturnMapper.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderReturnMapper.java @@ -57,4 +57,12 @@ public interface OrderReturnMapper { * @return */ List selectList(OrderReturnQueryDTO queryDTO); + + /** + * 查询 - 根据 id 查询 + * + * @param id + * @return + */ + OrderReturnDO selectById(Integer id); } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java index b723581fe..4e354e14c 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java @@ -140,4 +140,13 @@ public class OrderReturnServiceImpl implements OrderReturnService { .setTotalCount(totalCount) ); } + + @Override + public CommonResult agree(Integer id) { + OrderReturnDO orderReturnDO = orderReturnMapper.selectById(id); + if (orderReturnDO == null) { + + } + return null; + } } diff --git a/order/order-service-impl/src/main/resources/mapper/OrderReturnMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderReturnMapper.xml index d7c92bb6b..d760bf025 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderReturnMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderReturnMapper.xml @@ -145,4 +145,14 @@ LIMIT #{limitIndex}, #{pageSize} + + +