PC下单接口
This commit is contained in:
parent
f574bfed24
commit
7caf7eae18
|
|
@ -43,6 +43,7 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
|
@ -146,7 +147,7 @@ public class OrderController extends BaseController {
|
|||
|
||||
// 判断是否有客户
|
||||
SysUser sysUser = getSysUser();
|
||||
Long deptId = sysUser.getDeptId();
|
||||
Long deptId = sysUser.getDept().getParentId();
|
||||
String loginName = sysUser.getLoginName();
|
||||
Customer customer = customerService.selectByAccount("sys_" + loginName);
|
||||
if (customer == null) {
|
||||
|
|
@ -157,18 +158,18 @@ public class OrderController extends BaseController {
|
|||
}
|
||||
|
||||
// 判断是否有客户地址
|
||||
if (request.getProvinceId() == null || request.getCityId() == null || request.getCountryId() == null || StringUtils.isBlank(request.getAddress())) {
|
||||
if (request.getProvinceId() == null || request.getCityId() == null || request.getDistrictId() == null || StringUtils.isBlank(request.getFullAddress())) {
|
||||
return AjaxResult.error("请填写地址");
|
||||
}
|
||||
CustomerAddress customerAddress = customerAddressService.selectByCustomerAndAddress(customer.getCustomerId(),
|
||||
request.getProvinceId(), request.getCityId(), request.getCountryId(), request.getAddress());
|
||||
request.getProvinceId(), request.getCityId(), request.getDistrictId(), request.getFullAddress());
|
||||
if (customerAddress == null) {
|
||||
customerAddress = new CustomerAddress();
|
||||
customerAddress.setCustomerId(customer.getCustomerId());
|
||||
customerAddress.setProvinceId(request.getProvinceId());
|
||||
customerAddress.setCityId(request.getCityId());
|
||||
customerAddress.setCountryId(request.getCountryId());
|
||||
customerAddress.setAddress(request.getAddress());
|
||||
customerAddress.setCountryId(request.getDistrictId());
|
||||
customerAddress.setAddress(request.getFullAddress());
|
||||
customerAddress.setIsDefault(0);
|
||||
customerAddressService.insertCustomerAddress(customerAddress);
|
||||
}
|
||||
|
|
@ -189,14 +190,14 @@ public class OrderController extends BaseController {
|
|||
goods.setGoodsName(request.getGoodsBrand());
|
||||
goods.setGoodsImgUrl(request.getImageUrl());
|
||||
goods.setGoodsVideoUrl(request.getVideoUrl());
|
||||
goods.setDeptGoodsCategoryId(request.getCategory2());
|
||||
goods.setDeptGoodsCategoryId(request.getCategoryId3());
|
||||
goods.setStatus(1);
|
||||
goodsService.insertGoods(goods);
|
||||
|
||||
List<GoodsStandard> goodsStandards = new ArrayList<>();
|
||||
// 生成规格
|
||||
request.getOrderGoodsStandards().forEach(list->{
|
||||
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.selectOneByGoodsCategoryId(list.getDeptCategoryId());
|
||||
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(list.getDeptCategoryId());
|
||||
GoodsStandard standard = new GoodsStandard();
|
||||
standard.setGoodsStandardName(deptGoodsCategory.getGoodsCategoryName());
|
||||
standard.setDeptGoodsCategoryId(deptGoodsCategory.getDeptGoodsCategoryId());
|
||||
|
|
@ -208,6 +209,8 @@ public class OrderController extends BaseController {
|
|||
standard.setSaleNum(0);
|
||||
goodsStandards.add(standard);
|
||||
});
|
||||
|
||||
goodsStandardService.batchInsert(goodsStandards);
|
||||
|
||||
// 生成主单
|
||||
OrderMaster orderMaster = new OrderMaster();
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ import java.util.List;
|
|||
@Data
|
||||
public class SysOrderAssignRequest {
|
||||
|
||||
private Long category1;
|
||||
private Long category2;
|
||||
private Long category3;
|
||||
private Long categoryId1;
|
||||
private Long categoryId2;
|
||||
private Long categoryId3;
|
||||
|
||||
private List<SysOrderGoodsStandards> orderGoodsStandards;
|
||||
|
||||
|
|
@ -35,8 +35,8 @@ public class SysOrderAssignRequest {
|
|||
|
||||
private Long cityId;
|
||||
|
||||
private Long countryId;
|
||||
private Long districtId;
|
||||
|
||||
// 详细地址
|
||||
private String address;
|
||||
private String fullAddress;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue