From f0c3e6ad8a79cb471dc93003df899942d24560ad Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 22 Aug 2019 11:12:40 +0800 Subject: [PATCH] =?UTF-8?q?[POS][=E4=BF=AE=E6=94=B9]:POS=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8F=8APOS=E6=94=AF=E4=BB=98=E8=AE=A2=E5=8D=95=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V201908221020__POS_ORDER.sql | 4 +- .../controller/PosOrderController.java | 48 ++++++++++++------- .../controller/PosPayOrderController.java | 33 +++++++------ .../service/impl/PosOrderServiceImpl.java | 2 - 4 files changed, 50 insertions(+), 37 deletions(-) diff --git a/mallinkAdmin/src/main/resources/db/migration/V201908221020__POS_ORDER.sql b/mallinkAdmin/src/main/resources/db/migration/V201908221020__POS_ORDER.sql index d85becbaa..3fe0edf87 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V201908221020__POS_ORDER.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V201908221020__POS_ORDER.sql @@ -3,8 +3,10 @@ create table `pos_order` ( `tenant_id` varchar(10) NOT NULL COMMENT '租户ID', `pos_order_no` varchar(20) NULL COMMENT 'POS订单ID', `type` tinyint(6) NOT NULL DEFAULT 0 COMMENT '支付类型(1: 独立核销, 2:支付)', - `order_status` tinyint(6) NOT NULL DEFAULT '0' COMMENT '订单状态:0-待付款;1-已支付;2-已取消(限定时间内未付款);3-待退款;4-已退款;5-退款失败', + `order_status` tinyint(6) NOT NULL DEFAULT '0' COMMENT '订单状态:0-待付款/待核销;1-已支付;2-已取消(限定时间内未付款);3-待退款;4-已退款;5-退款失败', `bu_user_id` bigint(20) DEFAULT NULL COMMENT 'b端用户', + `payment_type` smallint(2) NOT NULL COMMENT '0: 付款 1: 退款 2:自动退款 3:A端退款 10:独立核销', + `payment` int(11) default NULL COMMENT '支付金额:允许有负数,退款时为负值。核销时,金额可以不填写', `create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/PosOrderController.java b/mallinkBApi/src/main/java/com/iformall/controller/PosOrderController.java index 5b6695529..d63db0f8d 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/PosOrderController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/PosOrderController.java @@ -1,5 +1,7 @@ package com.iformall.controller; +import com.iformall.common.ErrorCode; +import com.iformall.enums.EnumPosOrderType; import io.swagger.annotations.Api; import lombok.AllArgsConstructor; import org.slf4j.Logger; @@ -25,21 +27,34 @@ public class PosOrderController extends BaseController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final PosOrderService posOrderService; - - @ApiOperation("分页列表接口") + + @ApiOperation("分页列表接口") @GetMapping("list") - @ApiImplicitParams({ - @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), - @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) - public ResultData list(@ModelAttribute PosOrder posOrder,Integer pageNum, Integer pageSize) { - if (null == posOrder) posOrder = new PosOrder(); + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), + @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) + public ResultData list(@ModelAttribute PosOrder posOrder, Integer pageNum, Integer pageSize) { + if (null == posOrder) posOrder = new PosOrder(); final PageInfo page = posOrderService.listAsPage(posOrder, pageNum, pageSize); return new ResultData(page); } - @ApiOperation("新增POS订单接口") + @ApiOperation("新增POS订单接口") @PostMapping("add") public ResultData add(@RequestBody PosOrder posOrder) { + if (posOrder == null) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); + } + if (posOrder.getType() == null) { + String errMessage = "订单类型为空"; + logger.error(errMessage); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); + } + if (posOrder.getBuUserId() == null) { + String errMessage = "操作员为空"; + logger.error(errMessage); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); + } posOrderService.saveOrUpdate(posOrder); return new ResultData(); } @@ -53,19 +68,18 @@ public class PosOrderController extends BaseController { @ApiOperation("根据id删除接口") @GetMapping("/del") - @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) public ResultData delete(Long id) { posOrderService.deleteById(id); return new ResultData(Result.SUCCESS, "删除成功", null); } - - @ApiOperation("根据id查询接口") - @GetMapping("/findById") - @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + + @ApiOperation("根据id查询接口") + @GetMapping("/findById") + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) public ResultData findById(Long id) { - return new ResultData(Result.SUCCESS,"查询成功",posOrderService.getById(id)); + return new ResultData(Result.SUCCESS, "查询成功", posOrderService.getById(id)); } - - - + + } diff --git a/mallinkBApi/src/main/java/com/iformall/controller/PosPayOrderController.java b/mallinkBApi/src/main/java/com/iformall/controller/PosPayOrderController.java index cd7805928..d4c40aac4 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/PosPayOrderController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/PosPayOrderController.java @@ -25,19 +25,19 @@ public class PosPayOrderController extends BaseController { private final PosPayOrderService posPayOrderService; - - @ApiOperation("分页列表接口") + + @ApiOperation("分页列表接口") @GetMapping("list") - @ApiImplicitParams({ - @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), - @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) - public ResultData list(@ModelAttribute PosPayOrder posPayOrder,Integer pageNum, Integer pageSize) { - if (null == posPayOrder) posPayOrder = new PosPayOrder(); + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), + @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) + public ResultData list(@ModelAttribute PosPayOrder posPayOrder, Integer pageNum, Integer pageSize) { + if (null == posPayOrder) posPayOrder = new PosPayOrder(); final PageInfo page = posPayOrderService.listAsPage(posPayOrder, pageNum, pageSize); return new ResultData(page); } - @ApiOperation("新增POS订单接口") + @ApiOperation("新增POS订单接口") @PostMapping("add") public ResultData add(@RequestBody PosPayOrder posPayOrder) { //Assert.notNull(posPayOrder.getName(), "角色名不能为空"); @@ -55,19 +55,18 @@ public class PosPayOrderController extends BaseController { @ApiOperation("根据id删除接口") @GetMapping("/del") - @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) public ResultData delete(Long id) { posPayOrderService.deleteById(id); return new ResultData(Result.SUCCESS, "删除成功", null); } - - @ApiOperation("根据id查询接口") - @GetMapping("/findById") - @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + + @ApiOperation("根据id查询接口") + @GetMapping("/findById") + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) public ResultData findById(Long id) { - return new ResultData(Result.SUCCESS,"查询成功",posPayOrderService.getById(id)); + return new ResultData(Result.SUCCESS, "查询成功", posPayOrderService.getById(id)); } - - - + + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java index 18d0393f2..33d526251 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java @@ -1,6 +1,5 @@ package com.iformall.service.impl; -import java.util.*; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.domain.po.PosOrder; @@ -30,7 +29,6 @@ public class PosOrderServiceImpl implements PosOrderService { @Override public void saveOrUpdate(PosOrder record) { if (record.getId() == null) { - //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); final IdWorker idWorker = IdWorker.get(); record.setId(idWorker.nextId()); posOrderMapper.insertSelective(record);