xuhaifeng 2 сар өмнө
parent
commit
a68792518e

+ 11 - 0
admin-ui/src/api/settlement/statistics.js

@@ -17,6 +17,17 @@ export function listStatisticsByStore(query) {
   })
 }
 
+/**
+ * 当日订单统计同步
+ * @param query
+ * @returns {*}
+ */
+export function orderStaticsSync() {
+  return request({
+    url: '/mapi/settlement/store/statistics/sync',
+    method: 'get'
+  })
+}
 
 
 // 查询门店统计详细

+ 1 - 1
admin-ui/src/layout/components/Sidebar/SidebarItem.vue

@@ -83,7 +83,7 @@ export default {
 
       return false
     },
-    
+
     resolvePath(routePath, routeQuery) {
       if (isExternal(routePath)) {
         return routePath

+ 5 - 6
admin-ui/src/layout/components/Sidebar/index.vue

@@ -55,7 +55,6 @@ export default {
     },
 
     created() {
-        console.log(this.sidebarRouters)
     }
 };
 </script>
@@ -68,21 +67,21 @@ export default {
     .menu-wrapper {
         display: flex;
         height: 100%;
-        
+
         .menu-main {
             width: $base-sidebar-width;
             border-right: 1px solid #dcdfe6;
-            
+
             .el-menu {
                 border-right: none;
             }
         }
-        
+
         .menu-sub {
             width: $base-sidebar-width;
             border-right: 1px solid #dcdfe6;
             background-color: #fff;
-            
+
             .el-menu {
                 border-right: none;
             }
@@ -103,7 +102,7 @@ export default {
 .el-menu-item {
     display: flex;
     align-items: center;
-    
+
     .svg-icon {
         margin-right: 10px;
     }

+ 15 - 7
admin-ui/src/views/order/cloth/orderList.vue

@@ -17,6 +17,7 @@
                         <el-option key="8" label="待送衣" value="8" />
                         <el-option key="9" label="送衣中" value="9" />
                         <el-option key="11" label="已完成" value="11" />
+                      <el-option key="-1" label="已取消" value="-1" />
                     </el-select>
                 </el-form-item>
                 <el-form-item label="订单条码" prop="orderNo">
@@ -104,6 +105,13 @@
             </div>
           </template>
         </el-table-column>
+        <el-table-column label="退款状态" align="center" width="200">
+          <template slot-scope="scope">
+            <div class="status-group">
+              <dict-tag :options="dict.type.goods_order_refund_status" :value="scope.row.refundStatus" />
+            </div>
+          </template>
+        </el-table-column>
         <el-table-column label="下单时间" align="center" width="180">
           <template slot-scope="scope">
             <div class="time-info">
@@ -116,7 +124,7 @@
           <template slot-scope="scope">
             <el-button type="text" icon="el-icon-s-order" size="mini" @click="handleDetail(scope.row)"> 订单详情 </el-button>
             <el-button type="text" icon="el-icon-printer" size="mini" @click="btn_lodop(scope.row)" v-if="userInfoVO.userType != '00'"> 打印订单 </el-button>
-            <el-button type="text" icon="el-icon-close" size="mini" @click="handleClose(scope.row)" v-if="scope.row.orderStatus != '10' && scope.row.orderStatus != '11' && scope.row.orderStatus != '4'"> 撤销 </el-button>
+            <el-button type="text" icon="el-icon-close" size="mini" @click="handleClose(scope.row)" v-if="scope.row.refundStatus == '0' && scope.row.orderStatus != '10' && scope.row.orderStatus != '11' && scope.row.orderStatus != '4'"> 撤销 </el-button>
           </template>
         </el-table-column>
       </Page>
@@ -175,8 +183,8 @@
                         <el-table-column label="衣物照片" align="center" width="120">
                             <template slot-scope="scope">
                                 <div class="cloth-photos" v-if="scope.row.pics">
-                                    <el-image 
-                                        v-for="(pic, index) in scope.row.pics.split(',')" 
+                                    <el-image
+                                        v-for="(pic, index) in scope.row.pics.split(',')"
                                         :key="index"
                                         :src="pic"
                                         :preview-src-list="scope.row.pics.split(',')"
@@ -229,12 +237,12 @@
                             </template>
                         </el-table-column>
                         <el-table-column label="洗衣速度" align="center" prop="clothSpeedName" width="120" />
-    
+
                         <el-table-column label="备注" align="center" min-width="150">
                             <template slot-scope="scope">
-                                <el-tooltip 
-                                    :content="scope.row.remark" 
-                                    placement="top" 
+                                <el-tooltip
+                                    :content="scope.row.remark"
+                                    placement="top"
                                     :disabled="!scope.row.remark || scope.row.remark.length <= 20"
                                 >
                                     <span class="remark-text">{{ scope.row.remark || '暂无备注' }}</span>

+ 10 - 2
admin-ui/src/views/order/statistics/bystore.vue

@@ -12,6 +12,7 @@
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
+        <el-button type="warning" @click="handleSync"  v-if="userInfoVO.userType == '00'">同步当日统计</el-button>
       </el-form-item>
     </el-form>
 
@@ -117,13 +118,14 @@
 </template>
 
 <script>
-import { listStatistics, listStatisticsByStore, exportStatistics } from "@/api/settlement/statistics";
+import { listStatistics, listStatisticsByStore, exportStatistics, orderStaticsSync } from '@/api/settlement/statistics'
 
 export default {
   name: "StoreStatistics",
   data() {
     return {
       // 遮罩层
+      userInfoVO: {  },
       loading: false,
       // 显示搜索条件
       showSearch: true,
@@ -146,8 +148,9 @@ export default {
     // 设置默认日期范围为最近14天
     const end = new Date();
     const start = new Date();
-    start.setTime(start.getTime() - 3600 * 1000 * 24);
+    start.setTime(start.getTime());
     this.dateRange = this.parseTime(start, '{y}-{m}-{d}');
+    this.userInfoVO = this.getUserInfo()
     this.getList();
   },
   methods: {
@@ -176,6 +179,11 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
+    handleSync(){
+      orderStaticsSync().then(response => {
+        this.getList();
+      });
+    },
     /** 导出按钮操作 */
     handleExport() {
       const queryParams = { ...this.queryParams };

+ 1 - 2
yiqi-admin/src/main/java/com/yiqi/admin/controller/order/OrderClothController.java

@@ -497,8 +497,7 @@ public class OrderClothController extends BaseController {
     @ApiOperation(value = "查询洗衣订单列表")
     public R list(OrderClothQueryDTO orderClothQueryDTO) throws Exception {
         LambdaQueryWrapper<OrderCloth> queryWrapper = new QueryWrapper<OrderCloth>().lambda()
-                .eq(OrderCloth::getDelFlag, DeleteStatus.OK.getCode())
-                .ne(OrderCloth::getRefundStatus, OrderRefundStatus.REFUND_SUCCESS.getCode());
+                .eq(OrderCloth::getDelFlag, DeleteStatus.OK.getCode());
         if (SourceType.FACTORY.getCode().equals(SecurityUtils.getLoginUser().getSourceType())) {
             queryWrapper.eq(OrderCloth::getFactoryId, SecurityUtils.getLoginUser().getOrgId());
         }

+ 14 - 0
yiqi-admin/src/main/java/com/yiqi/admin/controller/settlement/SettlementStoreStatisticsController.java

@@ -62,6 +62,20 @@ public class SettlementStoreStatisticsController extends BaseController {
         return AjaxResult.success(result);
     }
 
+    /**
+     * 同步每日数据
+     */
+    @GetMapping("/sync")
+    public AjaxResult orderSync() {
+        Date queryDate = DateUtils.getNowDate();
+        Long storeId = getStoreId();
+        if (storeId != null) {
+        } else {
+            settlementStoreStatisticsService.generateDayStatistics(queryDate);
+        }
+        return AjaxResult.success();
+    }
+
     /**
      * 获取门店经营日报趋势数据
      */

+ 4 - 0
yiqi-common/src/main/java/com/yiqi/common/enums/ClothOrderStatusType.java

@@ -1,6 +1,10 @@
 package com.yiqi.common.enums;
 
 
+import cn.hutool.core.collection.CollUtil;
+
+import java.util.List;
+
 public enum ClothOrderStatusType implements CodeEnum{
 
      APPOINTMENT("0", "待接单")

+ 0 - 2
yiqi-common/src/main/java/com/yiqi/order/domain/OrderGoods.java

@@ -248,6 +248,4 @@ public class OrderGoods extends BaseEntity {
     @ApiModelProperty("现金抵扣金额")
     private BigDecimal cashDeductAmount;
 
-    @ApiModelProperty("APP用户扣款前余额")
-    private BigDecimal appUserBalanceAmount;
 }

+ 17 - 7
yiqi-core/src/main/java/com/yiqi/core/service/impl/SettlementManageBillServiceImpl.java

@@ -149,8 +149,18 @@ public class SettlementManageBillServiceImpl extends ServiceImpl<SettlementManag
     @Override
     public StoreBillStatistics storeBillSettlement(Long storeId, Date startTime, Date endTime) {
         // 1. 查询洗衣订单
+        List<String> orderStatuss = CollUtil.newArrayList(
+                ClothOrderStatusType.WAIT_FACTORY.getCode(),
+                ClothOrderStatusType.WASHING.getCode(),
+                ClothOrderStatusType.HAS_WASH.getCode(),
+                ClothOrderStatusType.WAITING_FOR_COMMENT.getCode(),
+                ClothOrderStatusType.WAITING_TO_SEND.getCode(),
+                ClothOrderStatusType.WAITING_FOR_HANG.getCode(),
+                ClothOrderStatusType.SENDING.getCode(),
+                ClothOrderStatusType.FINISH.getCode()
+        );
         List<OrderCloth> orderClothList = orderClothService.list(new QueryWrapper<OrderCloth>().lambda()
-                .ne(OrderCloth::getOrderStatus, ClothOrderStatusType.CANCEL.getCode())
+                .in(OrderCloth::getOrderStatus, orderStatuss)
                 .eq(OrderCloth::getSourceType, SourceType.STORE.getCode())
                 .eq(OrderCloth::getOrgId, storeId)
                 .between(OrderCloth::getCreateTime, startTime, endTime));
@@ -297,12 +307,12 @@ public class SettlementManageBillServiceImpl extends ServiceImpl<SettlementManag
         stats.setTransactionCount(orderList.stream()
                 .filter(order -> PayStatus.HAS_PAY.getCode().equals(order.getPayStatus()))
                 .count());
-//        stats.setGoodsCount(
-//                orderList.stream()
-//                        .map(OrderGoods::get)
-//                        .filter(Objects::nonNull)
-//                        .reduce(0, Integer::sum)
-//        );
+        stats.setGoodsCount(
+                orderList.stream()
+                        .map(OrderGoods::getGoodsCount)
+                        .filter(Objects::nonNull)
+                        .reduce(0, Integer::sum)
+        );
 
         // 2. 订单金额统计
         BigDecimal totalAmount = orderList.stream()

+ 4 - 2
yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothServiceImpl.java

@@ -221,7 +221,7 @@ public class OrderClothServiceImpl extends ServiceImpl<OrderClothMapper, OrderCl
             return R.ok();
         }
 
-
+        orderCloth.setOrderStatus(ClothOrderStatusType.CANCEL.getCode());
         orderCloth.setRefundTime(DateUtils.getNowDate());
         orderCloth.setRefundStatus(OrderRefundStatus.REFUND_SUCCESS.getCode());
         updateById(orderCloth);
@@ -420,6 +420,9 @@ public class OrderClothServiceImpl extends ServiceImpl<OrderClothMapper, OrderCl
         if (Integer.parseInt(orderCloth.getRefundStatus()) > 0) {
             throw new ServiceException("请勿重复申请");
         }
+        if (Integer.parseInt(orderCloth.getOrderStatus()) >= 6) {
+            throw new ServiceException("订单已入厂状态不允许退款");
+        }
         OrderClothRefund orderClothRefund = new OrderClothRefund();
         BeanUtils.copyProperties(orderCloth, orderClothRefund);
         orderClothRefund.setId(null);
@@ -467,7 +470,6 @@ public class OrderClothServiceImpl extends ServiceImpl<OrderClothMapper, OrderCl
                 orderClothRefund.setRefundStatus(OrderRefundStatus.ERROR.getCode());
                 orderClothRefund.setRemark(refundResponse.getPayMsg());
                 orderClothRefundService.updateById(orderClothRefund);
-
                 orderCloth.setRefundStatus(OrderRefundStatus.ERROR.getCode());
                 baseMapper.updateById(orderCloth);
             }

+ 3 - 0
yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderGoodsServiceImpl.java

@@ -218,6 +218,9 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
         orderGoods.setDelFlag(UserStatus.OK.getCode());
         // 生成订单编号
         orderGoods.setOrderNo(orderNoUtils.getGoodsOrderNo());
+        orderGoods.setGoodsCount(
+                orderGoodsSkuInfoVOS.stream().mapToInt(OrderGoodsSkuInfoVO::getBuyNum).sum()
+        );
         this.save(orderGoods);
 
         // 无法批量插入