From 593057ae8f4944ab049fcca1fa47fcacf372f7b4 Mon Sep 17 00:00:00 2001
From: jyy <jyy>
Date: Sat, 31 Jul 2021 17:38:52 +0800
Subject: [PATCH] 修复导入bug

---
 zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java |   73 +++++++++++++++++++++++++++++-------
 1 files changed, 58 insertions(+), 15 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java
index 155bb91..20ffba2 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java
@@ -1,6 +1,7 @@
 package com.matrix.system.hive.action;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import com.matrix.core.anotations.RemoveRequestToken;
 import com.matrix.core.constance.MatrixConstance;
 import com.matrix.core.exception.GlobleException;
@@ -14,7 +15,9 @@
 import com.matrix.core.tools.excl.ExcelUtil;
 import com.matrix.core.tools.excl.ExcelVersion;
 import com.matrix.system.common.bean.SysUsers;
+import com.matrix.system.common.dao.SysCompanyDao;
 import com.matrix.system.common.service.SysUsersService;
+import com.matrix.system.common.tools.DataAuthUtil;
 import com.matrix.system.common.tools.ResponseHeadUtil;
 import com.matrix.system.constance.Dictionary;
 import com.matrix.system.hive.bean.*;
@@ -27,6 +30,7 @@
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.ModelAndView;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
@@ -34,7 +38,9 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URLEncoder;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 
 /**
@@ -146,7 +152,9 @@
         if (StringUtils.isBlank(pageVo.getOrder())) {
             pageVo.setOrder("desc");
         }
-        projService.setShopId(getMe().getShopId());
+        if (!DataAuthUtil.hasAllShopAuth()) {
+            projService.setShopId(getMe().getShopId());
+        }
         List<SysProjServices> dataList = projServicesSerivce.findInPage(projService, pageVo);
         AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, projServicesSerivce.findTotal(projService));
         return result;
@@ -186,17 +194,10 @@
         AjaxResult result = AjaxResult.buildSuccessInstance("查询成功");
 
         SysProjUse queryUse = new SysProjUse();
-        if(Objects.nonNull(vipId)){
-            queryUse.setVipId(vipId);
-        }else{
-            SysVipInfo vipInfo = getCurrentVioInfo();
-            queryUse.setVipId(vipInfo.getId());
-        }
-
+        queryUse.setVipId(vipId);
         queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM);
         queryUse.setTaocanId(-1L);
         queryUse.setStatus(Dictionary.TAOCAN_STATUS_YX);
-        queryUse.setIsOver(Dictionary.FLAG_NO_N);
         List<SysProjUse> projList = projUseService.findInPage(queryUse, null);
         //切换到套餐查询条件
         queryUse.setTaocanId(null);
@@ -281,6 +282,7 @@
         // 显示当前查询的服务订单的项目信息
         return "admin/hive/beautySalon/yypb-form";
     }
+
 
     /**
      * 进入预约排班详情
@@ -441,6 +443,25 @@
         return new AjaxResult(AjaxResult.STATUS_SUCCESS, "成功");
     }
 
+    @Autowired
+    private SysCompanyDao sysCompanyDao;
+
+    /**
+     * 服务单打印
+     */
+    @RequestMapping(value = "/printOrder")
+    public @ResponseBody
+    ModelAndView printOrder() throws GlobleException {
+        ModelAndView mv = new ModelAndView("admin/hive/beautySalon/print-service");
+        SysUsers user=(SysUsers)WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
+        String comRegisterCode = sysCompanyDao.selectById(user.getCompanyId()).getComRegisterCode();
+        if(StringUtils.isNotBlank(comRegisterCode)){
+            mv.addObject("page",comRegisterCode);
+        }else {
+            mv.addObject("page","taiyan");
+        }
+        return mv;
+    }
 
     /**
      * 根据id对服务单进行派单
@@ -456,6 +477,7 @@
             return new AjaxResult(AjaxResult.STATUS_FAIL, "派单失败");
         }
     }
+
 
     /**
      * 根据id取消预约
@@ -495,8 +517,7 @@
     @RequestMapping(value = "/addService")
     public @ResponseBody
     AjaxResult servicceAdd(@RequestBody SysProjServices sysProjServices) {
-        SysVipInfo vipInfo = getCurrentVioInfo();
-        sysProjServices.setVipId(vipInfo.getId());
+
 
         if (CollectionUtils.isEmpty(sysProjServices.getServiceItems())) {
             return new AjaxResult(AjaxResult.STATUS_FAIL, "没有选中可消耗的项目");
@@ -511,7 +532,9 @@
         if (balanceverifyResult.isError()) {
             return new AjaxResult(AjaxResult.STATUS_FAIL, balanceverifyResult.getMsg());
         }
-        sysProjServices.setState(Dictionary.SERVICE_STATU_DYY);
+        if (StrUtil.isEmpty(sysProjServices.getState())) {
+            sysProjServices.setState(Dictionary.SERVICE_STATU_DYY);
+        }
         SysProjServices newSysProjServices = sysProjServicesService.addSysProjServices(sysProjServices);
         if (newSysProjServices != null) {
             return AjaxResult.buildSuccessInstance(Arrays.asList(newSysProjServices));
@@ -526,8 +549,8 @@
     @RequestMapping(value = "/addServiceForForm")
     public @ResponseBody
     AjaxResult servicceAddForForm(SysProjServices sysProjServices) {
-        SysVipInfo vipInfo = getCurrentVioInfo();
-        sysProjServices.setVipId(vipInfo.getId());
+
+
 
         if (CollectionUtils.isEmpty(sysProjServices.getServiceItems())) {
             return new AjaxResult(AjaxResult.STATUS_FAIL, "没有选中可消耗的项目");
@@ -566,6 +589,26 @@
     }
 
 
+    @RequestMapping(value = "/addServiceProj")
+    @ResponseBody
+    public AjaxResult addServiceProj(SysProjServices sysProjServices) {
+
+        return AjaxResult.buildSuccessInstance("保存成功");
+    }
+
+    /**
+     * 删除服务单项目/套餐
+     * @param id
+     * @return
+     */
+    @RequestMapping(value = "/delServiceOrderItems")
+    @ResponseBody
+    public AjaxResult delServiceOrderItems(Long id) {
+        sysProjServicesService.deleteProjServiceItemById(id);
+        return AjaxResult.buildSuccessInstance("删除成功");
+    }
+
+
     // 准备页面数据
     private void  pageDate() {
         // 根据岗位名称查询员工

--
Gitblit v1.9.1