From 4351e71d782741143a98f86f6648acd16689165f Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 27 May 2022 19:48:02 +0800
Subject: [PATCH] Merge branch 'developer' into hive2.0

---
 zq-erp/src/main/java/com/matrix/system/hive/action/ProjUseController.java |   40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjUseController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjUseController.java
index 29c757c..2b8dd86 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjUseController.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjUseController.java
@@ -1,5 +1,6 @@
 package com.matrix.system.hive.action;
 
+import cn.hutool.core.util.StrUtil;
 import com.matrix.core.constance.MatrixConstance;
 import com.matrix.core.exception.GlobleException;
 import com.matrix.core.pojo.AjaxResult;
@@ -17,7 +18,6 @@
 import com.matrix.system.hive.dao.ShoppingGoodsDao;
 import com.matrix.system.hive.dao.SysProjUseDao;
 import com.matrix.system.hive.dao.SysVipInfoDao;
-import com.matrix.system.hive.plugin.message.StringUtil;
 import com.matrix.system.hive.plugin.util.CollectionUtils;
 import com.matrix.system.hive.service.MoneyCardUseService;
 import com.matrix.system.hive.service.SysProjUseService;
@@ -237,6 +237,8 @@
     }
 
 
+    @Value("${file_storage_path}")
+    private String fileStoragePath;
 
 
 
@@ -246,17 +248,24 @@
     public AjaxResult importVipInfo(HttpServletResponse response, HttpServletRequest request, @RequestParam(value = "file", required = false) MultipartFile file) throws IOException {
 
         String fileName = file.getOriginalFilename();
-        String dirPath = "E:";
-        //PropertiesUtil.getString(AppConstance.FILES_TORAGE_PATH);
+//       String dirPath = "E:";
+       String dirPath =  fileStoragePath;
 
-        File saveFile = new File(dirPath + "/" + fileName);
-        file.transferTo(saveFile);
+        File saveFile =new File (new File(dirPath).getAbsolutePath() + File.separator + fileName);
+        if (!saveFile.exists())
+        {
+            if (!saveFile.getParentFile().exists())
+            {
+                saveFile.getParentFile().mkdirs();
+            }
+        }
+        file.transferTo(saveFile.getAbsoluteFile());
 
         SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
 
         List<ExcelSheetPO> excelSheetPOList = ExcelUtil.readExcel(saveFile, null, null);
 
-/*
+
         //项目资料导入
         List<List<Object>> dataList = excelSheetPOList.get(0).getDataList();
         List<SysProjUse> projUseList = new ArrayList<>();
@@ -281,7 +290,7 @@
                 List<Object> objects = taocanDataList.get(j);
                 LogUtil.info("导入套餐第" + j + "行" + objects);
                 Object vipName = objects.get(0);
-                String vipNameStr = vipName.toString();
+                String vipNameStr = vipName==null?"":vipName.toString();
                 if (taocan == null
                         || (taocan != null && StringUtils.isNotBlank(vipNameStr))) {
                     //切换下一个套餐
@@ -300,7 +309,6 @@
         //套餐资料导入=======end===
 
 
-*/
         //充值卡资料导入
         List<List<Object>> cardList = excelSheetPOList.get(2).getDataList();
         List<MoneyCardUse> cardUseArrayList = new ArrayList<>();
@@ -323,13 +331,14 @@
         Object tel = objects.get(1);
         if (tel != null) {
             String telStr = tel.toString();
-            SysVipInfo vipInfo = vipInfoDao.selectByPhone(telStr);
+            SysVipInfo vipInfo = vipInfoDao.selectByPhone(StrUtil.trim(telStr),sysUsers.getCompanyId());
             if (vipInfo == null) {
                 vipInfo = new SysVipInfo();
                 vipInfo.setShopId(sysUsers.getShopId());
                 vipInfo.setPhone(telStr);
                 vipInfo.setPhoto(defaultWoman);
                 vipInfo.setName(objects.get(0).toString());
+                vipInfo.setIsDelete(Dictionary.DELETED_N);
                 vipInfoDao.insert(vipInfo);
             }
 
@@ -380,20 +389,25 @@
         Object tel = objects.get(1);
         if (tel != null) {
             String telStr = tel.toString();
-            SysVipInfo vipInfo = vipInfoDao.selectByPhone(telStr);
+            SysVipInfo vipInfo = vipInfoDao.selectByPhone(StrUtil.trim(telStr),sysUsers.getCompanyId());
             if (vipInfo == null) {
                 vipInfo = new SysVipInfo();
                 vipInfo.setShopId(sysUsers.getShopId());
                 vipInfo.setPhone(telStr);
                 vipInfo.setPhoto(defaultWoman);
                 vipInfo.setName(objects.get(0).toString());
+                vipInfo.setIsDelete(Dictionary.DELETED_N);
                 vipInfoDao.insert(vipInfo);
             }
             String goodNo = String.valueOf(objects.get(3));
-            String goodName = String.valueOf(objects.get(2)).trim();
-
-
             ShoppingGoods goods = shoppingGoodsDao.findByCode(goodNo);
+
+            String goodName = String.valueOf(objects.get(2)).trim();
+            if("储值卡".equals(goodName)){
+                goods= shoppingGoodsDao.selectVipCzGoods();
+            }
+
+
             if (goods != null || "储值卡".equals(goodName)) {
 
                 moneyCardUse.setVipId(vipInfo.getId());

--
Gitblit v1.9.1