From 1eedb8a57c2eb5c9953dcf058184ebdc6987fbf5 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 24 May 2022 15:14:21 +0800
Subject: [PATCH] Merge branch 'feature/订单服务单代码改造' into alpha
---
zq-erp/src/main/java/com/matrix/system/hive/action/ProjUseController.java | 89 ++++++++++++++++++--------------------------
1 files changed, 37 insertions(+), 52 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 3385f1e..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,12 +18,12 @@
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;
import com.matrix.system.hive.service.SysProjuseFreezeService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -68,6 +69,13 @@
@Autowired
MoneyCardUseDao moneyCardUseDao;
+
+ @Value("${default.vip.photo.woman}")
+ String defaultWoman;
+
+ @Value("${default.vip.photo.man}")
+ String defaultman;
+
public static final String fnCode = "projUse";
@@ -160,21 +168,7 @@
return new AjaxResult(AjaxResult.STATUS_FAIL, "项目转让失败");
}
- @RequestMapping(value = "/returnProj")
- public @ResponseBody
- AjaxResult returnTc(SysProjUse sysProjUse, Long moneyCardUseId, String tcRemark, Long shopId, Double money, String tcName) {
- MoneyCardUse card = null;
- if (moneyCardUseId != null) {
- card = moneyCardUseService.findById(moneyCardUseId);
- }
- int i = projUseService.returnMoneyProj(sysProjUse, card, moneyCardUseId);
- if (i > 0) {
-
- return new AjaxResult(AjaxResult.STATUS_SUCCESS, "退款成功");
- }
- return new AjaxResult(AjaxResult.STATUS_FAIL, "退款失败");
- }
/**
@@ -195,31 +189,6 @@
}
- /**
- * 退款
- *
- * @return
- */
- @RequestMapping(value = "/getEffectCard")
- public @ResponseBody
- AjaxResult getEffectCard(SysProjUse sysProjUse) {
- MoneyCardUse cardUse = moneyCardUseService.findByVipId(sysProjUse.getVipId());
- double money = projUseService.getTotalMoneyProj(sysProjUse);
- if (cardUse != null) {
- cardUse.setRealMoney(money);
- List<MoneyCardUse> list = new ArrayList<MoneyCardUse>();
- list.add(cardUse);
- return new AjaxResult(AjaxResult.STATUS_SUCCESS, null, "有有效会籍卡", list, null);
- } else {
- //无会员卡则new一个,为了把钱传递到前台
- cardUse = new MoneyCardUse();
- cardUse.setRealMoney(money);
- List<MoneyCardUse> list = new ArrayList<MoneyCardUse>();
- list.add(cardUse);
- return new AjaxResult(AjaxResult.STATUS_SUCCESS, null, "无有效会籍卡", list, null);
- }
-
- }
/**
* 冻结会员项目
@@ -268,6 +237,8 @@
}
+ @Value("${file_storage_path}")
+ private String fileStoragePath;
@@ -277,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<>();
@@ -312,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))) {
//切换下一个套餐
@@ -331,7 +309,6 @@
//套餐资料导入=======end===
-*/
//充值卡资料导入
List<List<Object>> cardList = excelSheetPOList.get(2).getDataList();
List<MoneyCardUse> cardUseArrayList = new ArrayList<>();
@@ -354,12 +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);
}
@@ -410,19 +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