下单并生成主单

This commit is contained in:
clunt 2022-05-12 10:28:29 +08:00
parent 2f08e0be4d
commit 20a02c586b
3 changed files with 8 additions and 7 deletions

View File

@ -15,6 +15,7 @@ import com.ghy.payment.service.FinancialMasterService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@ -50,7 +51,7 @@ public class OrderController extends BaseController {
@PostMapping("/server/app") @PostMapping("/server/app")
@ResponseBody @ResponseBody
public AjaxResult appOrder(AppOrderRequest appOrderRequest){ public AjaxResult appOrder(@RequestBody AppOrderRequest appOrderRequest){
// 校验用户信息 // 校验用户信息
Customer customer = customerService.selectByCustomerId(appOrderRequest.getCustomerId()); Customer customer = customerService.selectByCustomerId(appOrderRequest.getCustomerId());
if(StringUtils.isNull(customer)){ if(StringUtils.isNull(customer)){
@ -63,7 +64,7 @@ public class OrderController extends BaseController {
} }
// 计算商品费用 // 计算商品费用
BigDecimal totalPay = goodsService.calculate(appOrderRequest.getGoodsList()); BigDecimal totalPay = goodsService.calculate(appOrderRequest.getGoodsList());
// TODO 生成细 // 生成主
OrderMaster orderMaster = new OrderMaster(); OrderMaster orderMaster = new OrderMaster();
orderMaster.setCode(orderMasterService.createOrderCode()); orderMaster.setCode(orderMasterService.createOrderCode());
orderMaster.setOrderType(1); orderMaster.setOrderType(1);
@ -72,10 +73,10 @@ public class OrderController extends BaseController {
orderMaster.setPayStatus(0); orderMaster.setPayStatus(0);
orderMaster.setCreateTime(new Date()); orderMaster.setCreateTime(new Date());
orderMasterService.insertOrderMaster(orderMaster); orderMasterService.insertOrderMaster(orderMaster);
//TODO 生成细单
//TODO 生成财务主单 //TODO 生成财务主单
//TODO 生成细单
//TODO 生成财务细单(含分销等.) //TODO 生成财务细单(含分销等.)
return AjaxResult.success(orderMaster); return AjaxResult.success(orderMaster);

View File

@ -16,7 +16,7 @@ public interface GoodsMapper {
* @param goods 商品信息 * @param goods 商品信息
* @return 校验是否满足库存 * @return 校验是否满足库存
*/ */
int checkAGoodsStore(AppGoodsRequest goods); List<Goods> checkAGoodsStore(AppGoodsRequest goods);
/** /**
* @param goods 商品属性 * @param goods 商品属性

View File

@ -30,8 +30,8 @@ public class GoodsServiceImpl implements GoodsService {
@Override @Override
public boolean checkStore(List<AppGoodsRequest> goodsList) { public boolean checkStore(List<AppGoodsRequest> goodsList) {
for (AppGoodsRequest goods : goodsList) { for (AppGoodsRequest goods : goodsList) {
int num = goodsMapper.checkAGoodsStore(goods); List<Goods> list = goodsMapper.checkAGoodsStore(goods);
if (num == 0) { if (list.size() == 0) {
return false; return false;
} }
} }