| | |
| | | private ConvenientElevatingPointDAO convenientElevatingPointDAO; |
| | | @Resource |
| | | private ComShopFlowerEvaluateDAO comShopFlowerEvaluateDAO; |
| | | @Resource |
| | | private ComShopFlowerRefundOrderDAO comShopFlowerRefundOrderDAO; |
| | | |
| | | |
| | | @Value("${hcMin.app.isTest}") |
| | |
| | | // 生成订单号 |
| | | String orderNo = OrderNoUtils.NextOrderNo(userId); |
| | | // 配送方式 |
| | | Integer deliveryType = 0; |
| | | Integer deliveryType = 1; |
| | | // 订单总金额 |
| | | BigDecimal orderTotal = BigDecimal.ZERO; |
| | | // 创建订单商品信息 |
| | |
| | | continue; |
| | | } |
| | | storeId = goodsDO.getStoreId(); |
| | | deliveryType = goodsDO.getDeliveryType(); |
| | | deliveryType = orderCreateDTO.getDeliveryType(); |
| | | ComShopFlowerOrderGoodsDO orderGoodsDO = new ComShopFlowerOrderGoodsDO(); |
| | | orderGoodsDO.setGoodsId(goodsDO.getId()); |
| | | orderGoodsDO.setGoodsName(goodsDO.getName()); |
| | |
| | | shopOrderDO.setOrderNo(orderNo); |
| | | shopOrderDO.setStoreId(storeId); |
| | | shopOrderDO.setUserId(userId); |
| | | //TODO |
| | | shopOrderDO.setStatus(ComShopFlowerOrderDO.status.dfk); |
| | | shopOrderDO.setPayStatus(ComShopFlowerOrderDO.payStatus.no); |
| | | shopOrderDO.setReceiverId(orderCreateDTO.getReceiverId()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R selectCountByDeliveryType(Integer deliveryType) { |
| | | List<ComShopOrderCountVO> comShopOrderCountVOS = this.baseMapper.selectCountByDeliveryType(deliveryType); |
| | | public R selectCountByDeliveryType(Integer deliveryType,Long userId) { |
| | | //1.等待配送 2.配送中 3.待收货 4.待评价 5.已完成 6.已取消 7.已退款 8.总订单 |
| | | String[] statusStr = {"ddps","psz","dsh","dpj","ywc","yqx","ytk"}; |
| | | ConvenientMerchantVO convenientMerchantVO = convenientMerchantDAO.selectMerchantByUserId(userId); |
| | | List<ComShopOrderCountVO> comShopOrderCountVOS = this.baseMapper.selectCountByDeliveryType(deliveryType,convenientMerchantVO.getId()); |
| | | Map<Integer, Integer> collect = comShopOrderCountVOS.stream().collect(Collectors.toMap(ComShopOrderCountVO::getStatus, ComShopOrderCountVO::getAmount)); |
| | | ComShopOrderCountVO comShopOrderCountVO = new ComShopOrderCountVO(); |
| | | comShopOrderCountVO.setStatus(8); |
| | | comShopOrderCountVO.setAmount(0); |
| | | for (int i = 1; i < 8; i++) { |
| | | Map<String,Integer> retMap = new HashMap<>(); |
| | | int amountTotal = 0; |
| | | for (int i = 0; i < statusStr.length; i++) { |
| | | if (collect.containsKey(i)) { |
| | | Integer amount = collect.get(i); |
| | | comShopOrderCountVO.setAmount(amount + comShopOrderCountVO.getAmount()); |
| | | amountTotal = amountTotal + amount; |
| | | retMap.put(statusStr[i],amount); |
| | | }else { |
| | | collect.put(i,0); |
| | | retMap.put(statusStr[i],0); |
| | | } |
| | | } |
| | | collect.put(comShopOrderCountVO.getStatus(),comShopOrderCountVO.getAmount()); |
| | | retMap.put("zdd",amountTotal); |
| | | |
| | | return R.ok(collect); |
| | | return R.ok(retMap); |
| | | } |
| | | |
| | | @Override |
| | | public R selectCountByUserId(Long userId){ |
| | | ConvenientMerchantVO convenientMerchantVO = convenientMerchantDAO.selectMerchantByUserId(userId); |
| | | Long storeId = convenientMerchantVO.getId(); |
| | | Map<String,Object> retMap = new HashMap<>(); |
| | | //查询我的店铺订单量 |
| | | List<ComShopOrderStoreIdCountVO> comShopOrderStoreIdCountVOS = this.baseMapper.selectCountByStoreId(storeId, null); |
| | | Map<String, Integer> zddlMap = comShopOrderStoreIdCountVOS.stream().collect(Collectors.toMap(ComShopOrderStoreIdCountVO::getCountName, ComShopOrderStoreIdCountVO::getCount)); |
| | | retMap.put("zddl",zddlMap); |
| | | //查询我的店铺拼单订单 |
| | | List<ComShopOrderStoreIdCountVO> comShopOrderStoreIdCountVOS1 = this.baseMapper.selectCountByStoreId(storeId, ComShopFlowerOrderDO.deliveryType.store); |
| | | Map<String, Integer> pdddMap = comShopOrderStoreIdCountVOS1.stream().collect(Collectors.toMap(ComShopOrderStoreIdCountVO::getCountName, ComShopOrderStoreIdCountVO::getCount)); |
| | | retMap.put("pddd",pdddMap); |
| | | //查询我的店铺快递订单 |
| | | List<ComShopOrderStoreIdCountVO> comShopOrderStoreIdCountVOS2 = this.baseMapper.selectCountByStoreId(storeId, ComShopFlowerOrderDO.deliveryType.express); |
| | | Map<String, Integer> kdddMap = comShopOrderStoreIdCountVOS2.stream().collect(Collectors.toMap(ComShopOrderStoreIdCountVO::getCountName, ComShopOrderStoreIdCountVO::getCount)); |
| | | retMap.put("kddd",kdddMap); |
| | | |
| | | //拼单订单各状态 |
| | | R r = this.selectCountByDeliveryType(ComShopFlowerOrderDO.deliveryType.store,userId); |
| | | retMap.put("pdddStatus",r.getData()); |
| | | |
| | | //快递订单各状态 |
| | | R r1 = this.selectCountByDeliveryType(ComShopFlowerOrderDO.deliveryType.express,userId); |
| | | retMap.put("kdddStatus",r1.getData()); |
| | | //营业额 |
| | | List<ComShopOrderStoreIdCountVO> comShopOrderStoreIdCountVOS3 = this.baseMapper.selectSumAmountByStoreId(storeId); |
| | | Map<String, Integer> yyeMap = comShopOrderStoreIdCountVOS3.stream().collect(Collectors.toMap(ComShopOrderStoreIdCountVO::getCountName, ComShopOrderStoreIdCountVO::getCount)); |
| | | retMap.put("yye",yyeMap); |
| | | //在售商品 |
| | | Integer countSale = comShopFlowerGoodsDAO.selectCountSaleByStoreId(storeId); |
| | | retMap.put("countSale",countSale); |
| | | //退款申请 |
| | | Integer refundOrder = comShopFlowerRefundOrderDAO.selectCountByStoreId(storeId); |
| | | retMap.put("refundOrder",refundOrder); |
| | | |
| | | return R.ok(retMap); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取商家的营业额和可结算金额 |
| | | * @param storeId |
| | | * @return |
| | | */ |
| | | public R getQuota(Long storeId){ |
| | | //营业额 |
| | | BigDecimal turnover = this.baseMapper.selectTurnover(storeId); |
| | | //可结算 |
| | | BigDecimal settlement = this.baseMapper.selectSettlement(storeId); |
| | | |
| | | Map<String,Object> retMap = new HashMap<>(); |
| | | retMap.put("turnover",turnover); |
| | | retMap.put("settlement",settlement); |
| | | return R.ok(retMap); |
| | | |
| | | } |
| | | |
| | | |