|
@@ -51,13 +51,11 @@ import com.fs.store.constants.StoreConstants;
|
|
|
import com.fs.store.domain.*;
|
|
|
import com.fs.store.dto.*;
|
|
|
import com.fs.store.enums.*;
|
|
|
-import com.fs.store.mapper.FsStoreCartMapper;
|
|
|
-import com.fs.store.mapper.FsStoreOrderItemMapper;
|
|
|
-import com.fs.store.mapper.FsStoreOrderMapper;
|
|
|
-import com.fs.store.mapper.FsUserAddressMapper;
|
|
|
+import com.fs.store.mapper.*;
|
|
|
import com.fs.store.param.*;
|
|
|
import com.fs.store.service.*;
|
|
|
import com.fs.store.vo.*;
|
|
|
+import com.fs.system.mapper.SysDictDataMapper;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.fs.wx.pay.config.WxPayProperties;
|
|
|
import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
|
|
@@ -223,6 +221,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
private CompanyMapper companyMapper;
|
|
|
@Autowired
|
|
|
private CompanyDeptMapper companyDeptMapper;
|
|
|
+ @Autowired
|
|
|
+ private FsStoreProductMapper fsStoreProductMapper;
|
|
|
|
|
|
/**
|
|
|
* 查询订单
|
|
@@ -1028,7 +1028,12 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public R createUserOrder(FsStoreOrderCreateUserParam param) {
|
|
|
-
|
|
|
+ String json=configService.selectConfigByKey("store.config");
|
|
|
+ StoreConfig config= JSONUtil.toBean(json,StoreConfig.class);
|
|
|
+ Integer createSalesOrderType = config.getCreateSalesOrderType();
|
|
|
+ if (createSalesOrderType == null) {
|
|
|
+ return R.error("请在后台设置制单类型;");
|
|
|
+ }
|
|
|
List<String> cartIds=new ArrayList<>();
|
|
|
for(FsStoreProductAttrValueVO productAttrValue:param.getProducts()){
|
|
|
FsStoreCart storeCart = FsStoreCart.builder()
|
|
@@ -1040,6 +1045,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
.isDel(0)
|
|
|
.isBuy(0)
|
|
|
.build();
|
|
|
+ if (createSalesOrderType == 1){
|
|
|
+ storeCart.setChangePrice(productAttrValue.getPrice());
|
|
|
+ }
|
|
|
storeCart.setCreateTime(new Date());
|
|
|
cartService.checkProductStock(productAttrValue.getProductId(),storeCart.getProductAttrValueId());
|
|
|
cartService.insertFsStoreCart(storeCart);
|
|
@@ -2797,6 +2805,34 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<FsStoreProductCountsVO> selectFsStoreProductCountsByDept(Map<String, Object> map, Long deptId) {
|
|
|
+ //查询所有产品
|
|
|
+ List<FsStoreProduct> products = fsStoreProductMapper.selectFsStoreProductList(null);
|
|
|
+ List<FsStoreProductCountsVO> vos = new ArrayList<>();
|
|
|
+ if (!products.isEmpty()) {
|
|
|
+ for (FsStoreProduct product : products) {
|
|
|
+ FsStoreProductCountsVO vo = new FsStoreProductCountsVO();
|
|
|
+ vo.setName(product.getProductName());
|
|
|
+ map.put("productId",product.getProductId());
|
|
|
+ //查询该产品销售数量 和金额
|
|
|
+ List<Map<String,Object>> temp = fsStoreOrderMapper.selectFsStoreProductCountsByDept(map);
|
|
|
+ HashMap<String, Object> productMap = new HashMap<>();
|
|
|
+ if (!temp.isEmpty()){
|
|
|
+ for (Map<String, Object> stringMap : temp) {
|
|
|
+ String orderType = stringMap.get("orderType").toString();
|
|
|
+ stringMap.remove("orderType");
|
|
|
+ productMap.put(orderType,stringMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ vo.setProductCounts(productMap);
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return vos;
|
|
|
+ }
|
|
|
+
|
|
|
private FsStoreOrderCountsVO addTotal(CompanyDept companyDept, List<FsStoreOrderCountsVO> vos,boolean isEmpty) {
|
|
|
FsStoreOrderCountsVO vo = new FsStoreOrderCountsVO();
|
|
|
Long totalCalls = 0L;
|