Просмотр исходного кода

[POS][修改]:POS订单及POS支付订单添加

release_toaliyun_real
Stormeye Wu 6 лет назад
Родитель
Сommit
f0c3e6ad8a
4 измененных файлов: 50 добавлений и 37 удалений
  1. +3
    -1
      mallinkAdmin/src/main/resources/db/migration/V201908221020__POS_ORDER.sql
  2. +31
    -17
      mallinkBApi/src/main/java/com/iformall/controller/PosOrderController.java
  3. +16
    -17
      mallinkBApi/src/main/java/com/iformall/controller/PosPayOrderController.java
  4. +0
    -2
      mallinkService/src/main/java/com/iformall/service/impl/PosOrderServiceImpl.java

+ 3
- 1
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`)


+ 31
- 17
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<PosOrder> 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));
}


}

+ 16
- 17
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<PosPayOrder> 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));
}


}

+ 0
- 2
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);


Загрузка…
Отмена
Сохранить