Browse Source

Merge branch 'master' of http://101.37.21.97:3000/wash/wash_server_v2

# Conflicts:
#	admin-ui/src/utils/index.js
lhch2015 2 months ago
parent
commit
10367bb411
26 changed files with 292 additions and 79 deletions
  1. 11 0
      admin-ui/src/api/settlement/statistics.js
  2. 23 7
      admin-ui/src/components/payStatusPopup/index.vue
  3. 1 1
      admin-ui/src/layout/components/Sidebar/SidebarItem.vue
  4. 5 6
      admin-ui/src/layout/components/Sidebar/index.vue
  5. 4 4
      admin-ui/src/utils/index.js
  6. 1 11
      admin-ui/src/views/order/cloth/collectCloth.vue
  7. 11 0
      admin-ui/src/views/order/cloth/component/cashCloth.vue
  8. 37 17
      admin-ui/src/views/order/cloth/orderList.vue
  9. 10 2
      admin-ui/src/views/order/statistics/bystore.vue
  10. 0 1
      yiqi-admin/src/main/java/com/yiqi/admin/controller/core/GoodsInfoController.java
  11. 1 3
      yiqi-admin/src/main/java/com/yiqi/admin/controller/order/OrderClothController.java
  12. 2 0
      yiqi-admin/src/main/java/com/yiqi/admin/controller/order/OrderClothItemController.java
  13. 0 2
      yiqi-admin/src/main/java/com/yiqi/admin/controller/order/OrderRechargeController.java
  14. 14 0
      yiqi-admin/src/main/java/com/yiqi/admin/controller/settlement/SettlementStoreStatisticsController.java
  15. 53 0
      yiqi-admin/src/main/java/com/yiqi/task/ClothOrderStatusChangeTask.java
  16. 4 0
      yiqi-common/src/main/java/com/yiqi/common/enums/ClothOrderStatusType.java
  17. 0 2
      yiqi-common/src/main/java/com/yiqi/order/domain/OrderGoods.java
  18. 7 0
      yiqi-common/src/main/java/com/yiqi/order/service/IOrderClothItemService.java
  19. 4 1
      yiqi-common/src/main/java/com/yiqi/order/service/IOrderClothService.java
  20. 2 12
      yiqi-core/src/main/java/com/yiqi/core/service/impl/ClothHangerDetailServiceImpl.java
  21. 17 7
      yiqi-core/src/main/java/com/yiqi/core/service/impl/SettlementManageBillServiceImpl.java
  22. 9 0
      yiqi-core/src/main/java/com/yiqi/order/mapper/OrderClothItemMapper.java
  23. 13 1
      yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothItemServiceImpl.java
  24. 57 2
      yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothServiceImpl.java
  25. 3 0
      yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderGoodsServiceImpl.java
  26. 3 0
      yiqi-core/src/main/resources/mapper/order/OrderClothItemMapper.xml

+ 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'
+  })
+}
 
 
 // 查询门店统计详细

+ 23 - 7
admin-ui/src/components/payStatusPopup/index.vue

@@ -100,10 +100,17 @@
         <div class="icon">
           <i class="el-icon-success success"></i>
         </div>
-        <div class="message">定价成功</div>
-        <div class="btn_box">
+        <div class="message">下单成功</div>
+        <div class="btn_box" v-if="hidePointer">
           <div class="btn" @click="confirm">确认</div>
         </div>
+        <div class="btn_box" v-else>
+          <div class="btn" @click="setPointer(0)">打印小票</div>
+          <div class="line"></div>
+          <div class="btn" @click="setPointer(1)">打印条码</div>
+          <div class="line"></div>
+          <div class="btn" @click="close">关闭</div>
+        </div>
       </div>
     </el-dialog>
   </div>
@@ -242,12 +249,12 @@ export default {
     close() {
       const _ = this
       if (this.type == 1) {
-        this.$confirm('是否关闭打印操作?')
-          .then(() => {
+        // this.$confirm('是否关闭打印操作?')
+        //   .then(() => {
             _.show = false
             _.$emit('close')
-          })
-          .catch(() => { })
+          // })
+          // .catch(() => { })
       }
       if (this.type == 2) {
         this.$confirm('是否取消支付操作?')
@@ -269,7 +276,16 @@ export default {
         _.show = false
       }
       if (this.type == 6) {
-        _.show = false
+        // if (!this.hidePointer) {
+        //   this.$confirm('是否关闭打印操作?')
+        //   .then(() => {
+            _.show = false
+            _.$emit('close')
+          // })
+        //   .catch(() => { })
+        // } else {
+        //   _.show = false
+        // }
       }
     },
 

+ 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;
     }

+ 4 - 4
admin-ui/src/utils/index.js

@@ -723,10 +723,10 @@ export function labelPrinter(LODOP, data, lodopName) {
     _flaws += item_n.clothFlawName+';'
   })
 
-  LODOP.ADD_PRINT_TEXT(35, 5, 150, 20, `${data.clothItemName}${_name?'-'+_name:''}${_flaws?'-'+_flaws:''}`);
-  LODOP.ADD_PRINT_TEXT(70, 5, 150, 20, '附件');
+  LODOP.ADD_PRINT_TEXT(25, 5, 150, 20, `${data.clothItemName}${_name?'-'+_name:''}${_flaws?'-'+_flaws:''}`);
+  LODOP.ADD_PRINT_TEXT(60, 5, 150, 20, '附件');
 
-  const top = 90;
+  const top = 80;
   if( data.orderClothAdjuncts ){
     for(var i = 0; i < data.orderClothAdjuncts.length; i++) {
       let item = data.orderClothAdjuncts[i];
@@ -739,7 +739,7 @@ export function labelPrinter(LODOP, data, lodopName) {
   }
 
   //  绘制条码
-  LODOP.ADD_PRINT_BARCODE(135, 8, 150, 80, '128Auto', data.washCode);
+  LODOP.ADD_PRINT_BARCODE(125, 8, 150, 80, '128Auto', data.washCode);
   LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
 
   // this.LODOP.PREVIEW(); //打印预览

+ 1 - 11
admin-ui/src/views/order/cloth/collectCloth.vue

@@ -543,15 +543,6 @@
                 </el-table-column>
             </el-table>
         </el-dialog>
-
-        <pay-status-popup
-                ref="payStatusPopup"
-                :hide-pointer="false"
-                :hide-user="false"
-                @pay-success="handlePaySuccess"
-                @confirm="handleConfirm"
-                @close="handleConfirm"
-            />
     </div>
 </template>
 
@@ -578,12 +569,11 @@ import { allBrand } from '../../../api/cloth/brand'
 import { getCouponItemlistByAppUserId, getDiscountByStoreId } from '../../../api/coupon/item'
 import { add, multi, minute, sub } from '../../../utils/math'
 import request from '@/utils/request'
-import PayStatusPopup from '@/components/payStatusPopup'
 
 
 export default {
     name: 'CollectCloth',
-    components: { CashCloth, payStatusPopup, PayStatusPopup },
+    components: { CashCloth, payStatusPopup },
     dicts: ['sys_yes_no', 'cloth_type', 'cloth_send_type'],
     data() {
         return {

+ 11 - 0
admin-ui/src/views/order/cloth/component/cashCloth.vue

@@ -735,6 +735,11 @@ export default {
                 return;
             }
 
+            if (!this.orderForm.payType && payTimeType == 0) {
+                this.$message.error('请选择收款方式');
+                return;
+            }
+
             this.$refs.payForm.validate(valid => {
                 if (valid) {
                     const params = { ...this.orderForm };
@@ -779,6 +784,7 @@ export default {
                             loading.close();
                             // 直接打开支付状态弹窗,不需要延时
                           //0=微信,1=支付宝,2=现金,3=余额
+                          if (payTimeType == 0) {
                             if (this.orderForm.payType === '0') {
                                 res.data.authCode = this.orderForm.authCode
                                 this.$refs.payStatusPopup.open(0, {...params, ...res.data}, this.appUserInfo);
@@ -787,6 +793,10 @@ export default {
                             } else if (this.orderForm.payType === '3') {
                               this.$refs.payStatusPopup.open(3, {...params, ...res.data}, this.appUserInfo);
                             }
+                          } else {
+                            this.$refs.payStatusPopup.open(6, {...params, ...res.data}, this.appUserInfo);
+                          }
+                           
                         })
                         .catch(e => {
                             console.log("下单异常",e);
@@ -919,6 +929,7 @@ export default {
         },
         // 处理确认
         handleConfirm(orderInfo) {
+            console.log("SAAAS")
             // 处理确认事件
             this.$emit('confirm', orderInfo);
         }

+ 37 - 17
admin-ui/src/views/order/cloth/orderList.vue

@@ -12,11 +12,13 @@
                 </el-form-item>
                 <el-form-item label="订单状态" prop="orderStatus">
                     <el-select v-model="queryParams.orderStatus" placeholder="请选择订单状态" clearable style="width: 180px">
+                        <el-option key="5" label="待入厂" value="5" />
                         <el-option key="6" label="清洗中" value="6" />
                         <el-option key="7" label="已上挂" value="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">
@@ -53,7 +55,7 @@
             {{ scope.row.orderNo  }}
           </template>
         </el-table-column>
-        <el-table-column label="衣服数量" align="center" width="150">
+        <el-table-column label="衣服数量" align="center" width="100">
           <template slot-scope="scope">
             {{ scope.row.orderClothCount }}件
           </template>
@@ -64,7 +66,7 @@
             {{ scope.row.sysOrg.name }}
           </template>
         </el-table-column>
-        <el-table-column label="客户姓名" align="center" width="150">
+        <el-table-column label="客户姓名" align="center" width="120">
           <template slot-scope="scope">
             <div class="customer-name">
               <i class="el-icon-user"></i>
@@ -80,30 +82,45 @@
             </div>
           </template>
         </el-table-column>
-        <el-table-column label="订单金额" align="center" width="120">
+        <el-table-column label="支付方式" align="center" width="100">
+          <template slot-scope="scope">
+            <span v-if=" scope.row.payType === '0'">微信</span>
+            <span v-if=" scope.row.payType === '1'">支付宝</span>
+            <span v-if=" scope.row.payType === '2'">现金</span>
+            <span v-if=" scope.row.payType === '3'">会员余额</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="订单金额" align="center" width="100">
           <template slot-scope="scope">
             <span class="value">¥{{ scope.row.payAmount }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="支付方式" align="center" width="200">
+        <el-table-column label="收款类型" align="center" width="100">
           <template slot-scope="scope">
             {{ scope.row.payTimeType === '0' ? '收衣付款' : '取衣付款' }}
           </template>
         </el-table-column>
-        <el-table-column label="订单状态" align="center" width="200">
+        <el-table-column label="订单状态" align="center" width="100">
           <template slot-scope="scope">
             <div class="status-group">
               <dict-tag :options="dict.type.cloth_order_status" :value="scope.row.orderStatus" />
             </div>
           </template>
         </el-table-column>
-        <el-table-column label="支付状态" align="center" width="200">
+        <el-table-column label="支付状态" align="center" width="100">
           <template slot-scope="scope">
             <div class="status-group">
               <dict-tag :options="dict.type.pay_status" :value="scope.row.payStatus" />
             </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">
@@ -112,11 +129,11 @@
             </div>
           </template>
         </el-table-column>
-        <el-table-column label="操作" align="center" min-width="180" fixed="right">
+        <el-table-column label="操作" align="center" min-width="240" fixed="right">
           <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 +192,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 +246,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>
@@ -473,12 +490,15 @@ export default {
             }
 
             this.pointerInfo = row
-
+            console.log()
+            const _ = this
             listOrderClothItem({ pageSize: 99999, pageNum: 1, orderNo: row.orderNo }).then((res) => {
-                this.pointerInfo.orderClothDetails = res.data.records
+                console.log("AAAAA", res)
+                this.pointerInfo.orderClothDetails = res.rows
+                this.pointerType = true
             })
 
-            this.pointerType = true
+            
         },
         setPointer(type) {
             if (!this.LODOP) {

+ 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 };

+ 0 - 1
yiqi-admin/src/main/java/com/yiqi/admin/controller/core/GoodsInfoController.java

@@ -64,7 +64,6 @@ public class GoodsInfoController extends BaseController {
     /**
      * 查询商品管理列表
      */
-    @PreAuthorize("@ss.hasPermi('goods:commonGoods:list')")
     @GetMapping("/list")
     @ApiOperation(value = "查询商品管理列表")
     public TableDataInfo list(GoodsInfoQueryVO goodsInfoQueryVO) {

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

@@ -300,7 +300,6 @@ public class OrderClothController extends BaseController {
         orderDelivery.setStoreId(orderCloth.getOrgId());
         orderDelivery.setDeliveryManId(deliveryManId);
         orderDeliveryService.save(orderDelivery);
-
         return R.ok();
     }
 
@@ -497,8 +496,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());
         }

+ 2 - 0
yiqi-admin/src/main/java/com/yiqi/admin/controller/order/OrderClothItemController.java

@@ -321,6 +321,8 @@ public class OrderClothItemController extends BaseController {
             orderClothItemVO.setOrderClothAdjuncts(Arrays.asList(orderClothAdjunct));
             orderClothItemVO.setFlowStatus(orderClothAdjunct.getFlowStatus());
         }
+        //判断所有衣服的状态,更新订单状态
+        orderClothService.checkAllOrderStatus(orderClothItem.getOrderId());
         orderClothItemVO.setOrgName(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
                 .eq(SysOrg::getId, orderClothItemVO.getOrgId())
                 .eq(SysOrg::getSourceType, orderClothItemVO.getSourceType()), false).getName());

+ 0 - 2
yiqi-admin/src/main/java/com/yiqi/admin/controller/order/OrderRechargeController.java

@@ -56,7 +56,6 @@ public class OrderRechargeController extends BaseController {
     /**
      * 查询充值订单列表
      */
-    @PreAuthorize("@ss.hasPermi('recharge:order:list')")
     @GetMapping("/list")
     @ApiOperation(value = "查询充值订单列表")
     public TableDataInfo list(OrderRechargeQueryDTO orderRechargeQueryDTO) {
@@ -83,7 +82,6 @@ public class OrderRechargeController extends BaseController {
     /**
      * 获取充值订单详细信息
      */
-    @PreAuthorize("@ss.hasPermi('recharge:order:query')")
     @GetMapping(value = "/{id}")
     @ApiOperation(value = "获取充值订单详细信息")
     public AjaxResult getInfo(@PathVariable("id") Long id) {

+ 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();
+    }
+
     /**
      * 获取门店经营日报趋势数据
      */

+ 53 - 0
yiqi-admin/src/main/java/com/yiqi/task/ClothOrderStatusChangeTask.java

@@ -0,0 +1,53 @@
+package com.yiqi.task;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUtil;
+import com.yiqi.common.core.redis.RedisUtils;
+import com.yiqi.common.utils.DateUtils;
+import com.yiqi.delay.DelayMessage;
+import com.yiqi.delay.DelayQueueCache;
+import com.yiqi.delay.impl.DelayTaskRunService;
+import com.yiqi.lock.RedisLockUtil;
+import com.yiqi.order.domain.OrderCloth;
+import com.yiqi.order.service.IOrderClothService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+
+/**
+ * @author douya
+ * @description 订单状态变更逻辑
+ * @date 2022/5/19
+ */
+@Component
+@Slf4j
+public class ClothOrderStatusChangeTask {
+
+    protected final Logger logger = LoggerFactory.getLogger(ClothOrderStatusChangeTask.class);
+
+    @Resource
+    private DelayQueueCache delayQueueCache;
+
+    @Resource
+    private RedisUtils redisUtils;
+
+    @Resource
+    private IOrderClothService orderClothService;
+
+    /**
+     * 订单状态变更逻辑,每5分钟执行一次,扫描任务,如果到期则执行任务
+     * 所有衣服 入厂 -> 变成清洗中
+     */
+    public void run() {
+        log.info("*****订单状态变更逻辑开始执行*****");
+        orderClothService.checkAllOrderStatus(null);
+    }
+}

+ 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;
 }

+ 7 - 0
yiqi-common/src/main/java/com/yiqi/order/service/IOrderClothItemService.java

@@ -119,4 +119,11 @@ public interface IOrderClothItemService extends IService<OrderClothItem> {
      * @param flawStatus
      */
     void updateAllClothItemStatusByOrderId(Long clothOrderId, String flawStatus);
+
+    /**
+     * 判断所有的衣服是否已经符合订单状态
+     * @param clothOrderId
+     * @return
+     */
+    Boolean checkClothItemStatus(Long clothOrderId, String flawStatus);
 }

+ 4 - 1
yiqi-common/src/main/java/com/yiqi/order/service/IOrderClothService.java

@@ -148,5 +148,8 @@ public interface IOrderClothService extends IService<OrderCloth> {
 
     OrderClothFactoryClothQueryVO listPayFinancialStatisticsByClothOrderFactory(OrderFinancialFactoryClothQueryDTO orderFinancialFactoryClothQueryDTO);
 
-
+    /**
+     * 检测订单状态 (对所有订单进行判断)
+     */
+    void checkAllOrderStatus(Long orderClothId);
 }

+ 2 - 12
yiqi-core/src/main/java/com/yiqi/core/service/impl/ClothHangerDetailServiceImpl.java

@@ -169,18 +169,8 @@ public class ClothHangerDetailServiceImpl extends ServiceImpl<ClothHangerDetailM
         orderClothItemService.updateById(orderClothItem);
 
         // 当衣服全部上挂后 是否需要自动更新订单状态= 7 待取衣
-        long countNOHanger = orderClothItemService.count(new QueryWrapper<OrderClothItem>().lambda()
-                        .eq(OrderClothItem::getOrderNo, orderClothItem.getOrderNo())
-                        .eq(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.outFactory.getCode()));
-        if (countNOHanger == 0){
-            orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
-                    .set(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_WASH.getCode())
-                    .set(OrderCloth::getUpdateById,SecurityUtils.getLoginUser().getUserId())
-                    .set(OrderCloth::getUpdateBy,SecurityUtils.getLoginUser().getUsername())
-                    .set(OrderCloth::getUpdateTime,DateUtils.getNowDate())
-                    .eq(OrderCloth::getOrderNo, orderClothItem.getOrderNo()));
-        }
-
+        //判断所有衣服的状态,更新订单状态
+        orderClothService.checkAllOrderStatus(orderClothItem.getOrderId());
         orderClothItemFlowRecordService.addRecord(orderClothItem, orderClothItem.getFlowStatus());
         return 1;
     }

+ 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()

+ 9 - 0
yiqi-core/src/main/java/com/yiqi/order/mapper/OrderClothItemMapper.java

@@ -115,4 +115,13 @@ public interface OrderClothItemMapper extends BaseMapper<OrderClothItem> {
      * @return
      */
     int updateAllClothItemStatusByOrderId(@Param("clothOrderId") Long clothOrderId, @Param("flawStatus") String flawStatus);
+
+    /**
+     * 检查订单 clothes item
+     *
+     * @param clothOrderId
+     * @param flawStatus
+     * @return
+     */
+    List<OrderClothItem> checkClothItemStatus(@Param("clothOrderId") Long clothOrderId, @Param("flawStatus") String flawStatus);
 }

+ 13 - 1
yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothItemServiceImpl.java

@@ -67,7 +67,7 @@ public class OrderClothItemServiceImpl extends ServiceImpl<OrderClothItemMapper,
 
     @Override
     public OrderClothItemCountStatisticVO getUnFinishedOrderClothCountGroupByStatus(Long factoryId, Long storeId) {
-        return baseMapper.getUnFinishedOrderClothCountGroupByStatus( factoryId,  storeId);
+        return baseMapper.getUnFinishedOrderClothCountGroupByStatus(factoryId, storeId);
     }
 
     @Override
@@ -348,5 +348,17 @@ public class OrderClothItemServiceImpl extends ServiceImpl<OrderClothItemMapper,
         baseMapper.updateAllClothItemStatusByOrderId(clothOrderId, flawStatus);
     }
 
+    @Override
+    public Boolean checkClothItemStatus(Long clothOrderId, String flawStatus) {
+        Boolean result = true;
+        List<OrderClothItem> orderClothItems = baseMapper.checkClothItemStatus(clothOrderId, flawStatus);
+        for (OrderClothItem orderClothItem : orderClothItems) {
+            if (Integer.valueOf(orderClothItem.getFlowStatus()) < Integer.valueOf(flawStatus)) {
+                result = false;
+            }
+        }
+        return result;
+    }
+
 
 }

+ 57 - 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);
             }
@@ -1311,6 +1313,59 @@ public class OrderClothServiceImpl extends ServiceImpl<OrderClothMapper, OrderCl
         return orderClothFactoryClothQueryVO;
     }
 
+    @Override
+    public void checkAllOrderStatus(Long orderClothId) {
+        LambdaQueryWrapper<OrderCloth> queryWrapper = new QueryWrapper<OrderCloth>().lambda()
+                .eq(OrderCloth::getDelFlag, DeleteStatus.OK.getCode())
+                .eq(orderClothId != null, OrderCloth::getId, orderClothId)
+                .ne(OrderCloth::getRefundStatus, OrderRefundStatus.REFUND_SUCCESS.getCode());
+        //查询一个月内的数据
+        queryWrapper.ge(BaseEntity::getCreateTime, DateUtils.addDays(new Date(), -20));
+        // 1. 查询洗衣订单
+        List<String> orderStatuss = CollUtil.newArrayList(
+                ClothOrderStatusType.WAIT_FACTORY.getCode(),
+                ClothOrderStatusType.WASHING.getCode(),
+                ClothOrderStatusType.HAS_WASH.getCode()
+        );
+        queryWrapper.in(OrderCloth::getOrderStatus, orderStatuss);
+        List<OrderCloth> orderCloths = baseMapper.selectList(queryWrapper);
+        for (OrderCloth orderCloth : orderCloths) {
+            if (orderCloth.getOrderStatus().equals(ClothOrderStatusType.WAIT_FACTORY.getCode())) {
+                //待入厂,判断所有的衣服和附件是否都已经入厂,如果都入厂,则改变状态
+                Boolean res = orderClothItemService.checkClothItemStatus(orderCloth.getId(), ClothOrderFlowStatus.inFactory.getCode());
+                if (res) {
+                    OrderCloth orderClothUpdate = new OrderCloth();
+                    orderClothUpdate.setId(orderCloth.getId());
+                    orderClothUpdate.setOrderStatus(ClothOrderStatusType.WASHING.getCode());
+                    orderClothUpdate.setUpdateTime(new Date());
+                    baseMapper.updateById(orderClothUpdate);
+                }
+            }
+            if (orderCloth.getOrderStatus().equals(ClothOrderStatusType.WASHING.getCode())) {
+                //待入厂,判断所有的衣服和附件是否都已经入厂,如果都入厂,则改变状态
+                Boolean res = orderClothItemService.checkClothItemStatus(orderCloth.getId(), ClothOrderFlowStatus.outFactory.getCode());
+                if (res) {
+                    OrderCloth orderClothUpdate = new OrderCloth();
+                    orderClothUpdate.setId(orderCloth.getId());
+                    orderClothUpdate.setOrderStatus(ClothOrderStatusType.HAS_WASH.getCode());
+                    orderClothUpdate.setUpdateTime(new Date());
+                    baseMapper.updateById(orderClothUpdate);
+                }
+            }
+            if (orderCloth.getOrderStatus().equals(ClothOrderStatusType.HAS_WASH.getCode())) {
+                //待入厂,判断所有的衣服和附件是否都已经入厂,如果都入厂,则改变状态
+                Boolean res = orderClothItemService.checkClothItemStatus(orderCloth.getId(), ClothOrderFlowStatus.hangering.getCode());
+                if (res) {
+                    OrderCloth orderClothUpdate = new OrderCloth();
+                    orderClothUpdate.setId(orderCloth.getId());
+                    orderClothUpdate.setOrderStatus(ClothOrderStatusType.WAITING_FOR_HANG.getCode());
+                    orderClothUpdate.setUpdateTime(new Date());
+                    baseMapper.updateById(orderClothUpdate);
+                }
+            }
+        }
+    }
+
     private void handleMtdDataByClothOrder(OrderFinancialQueryVO orderFinancialQueryVO) {
         List<OrderClothFinancialVO> MtdData = baseMapper.listFinancialStatisticsByClothOrderMTD(SecurityUtils.getLoginUser().getOrgId(), SecurityUtils.getLoginUser().getSourceType());
         this.buildClothData(orderFinancialQueryVO, MtdData);

+ 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);
 
         // 无法批量插入

+ 3 - 0
yiqi-core/src/main/resources/mapper/order/OrderClothItemMapper.xml

@@ -651,6 +651,9 @@
         -->
         order by item.id desc
     </select>
+    <select id="checkClothItemStatus" resultType="com.yiqi.order.domain.OrderClothItem">
+        select order_id, flow_status, order_no from order_cloth_item where order_id = #{orderId} and flow_status != #{flowStatus}
+    </select>
 
     <update id="updateAllClothItemStatusByOrderId">
         update order_cloth_item