From 2881ddf3a26f00537f40103e6131a3915e66c5c1 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 25 Jan 2021 15:41:56 +0800
Subject: [PATCH] modify
---
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java | 66 ++++++++++++++++++++++----------
1 files changed, 45 insertions(+), 21 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
index 2860589..645d0a1 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
@@ -13,7 +13,6 @@
import com.matrix.system.app.vo.VipInfoListVo;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.tools.DataAuthUtil;
-import com.matrix.system.common.tools.PasswordUtil;
import com.matrix.system.common.tools.ServiceUtil;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.constance.TableMapping;
@@ -24,6 +23,7 @@
import com.matrix.system.hive.pojo.VipInfoVo;
import com.matrix.system.hive.service.SysVipInfoService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -59,6 +59,14 @@
@Autowired
private SysVipLabelDao sysVipLabelDao;
+
+ @Value("${default.vip.photo.woman}")
+ String defaultWoman;
+
+ @Value("${default.vip.photo.man}")
+ String defaultMan;
+
+
/**
* 新增会员储值卡
@@ -106,6 +114,11 @@
sysVipInfo.setPointAll(0);
sysVipInfo.setIsDeal(SysVipInfo.UNDEAL_VIP);
sysVipInfo.setZjm(StringUtils.toHanyuPinyin(sysVipInfo.getVipName())+","+StringUtils.toHeadWordHanyuPinyin(sysVipInfo.getVipName()));
+ if(sysVipInfo.getSex().equals(Dictionary.SEX_MAN)){
+ sysVipInfo.setPhoto(defaultMan);
+ }else{
+ sysVipInfo.setPhoto(defaultWoman);
+ }
int i=sysVipInfoDao.insert(sysVipInfo);
modifyVipWithOtherInfo(sysVipInfo);
//创建用户默认储值卡
@@ -338,6 +351,11 @@
SysUsers users = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
sysVipInfo.setCompanyId(users.getCompanyId());
sysVipInfo.setShopId(users.getShopId());
+ if(sysVipInfo.getSex().equals(Dictionary.SEX_MAN)){
+ sysVipInfo.setPhoto(defaultMan);
+ }else{
+ sysVipInfo.setPhoto(defaultWoman);
+ }
int i=sysVipInfoDao.insert(sysVipInfo);
modifyVipWithOtherInfo(sysVipInfo);
return i;
@@ -426,7 +444,7 @@
if (!DataAuthUtil.hasAllShopAuth()) {
vipInfoListDto.setShopId(sysUsers.getShopId());
}
- QueryUtil.setQueryLimitCom(sysUsers.getCompanyId());
+ QueryUtil.setQueryLimitCom(vipInfoListDto);
return sysVipInfoDao.selectVipAddressBookByList(vipInfoListDto);
}
@@ -439,9 +457,11 @@
public int apiAddVip(AddVipDto addVipDto) {
SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
- if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "VIP_NO", addVipDto.getVipNo(),
- "company_id",user.getCompanyId())) {
- throw new GlobleException("编号已存在!");
+ if (StringUtils.isNotBlank(addVipDto.getVipNo())) {
+ if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "VIP_NO", addVipDto.getVipNo(),
+ "company_id", user.getCompanyId())) {
+ throw new GlobleException("编号已存在!");
+ }
}
if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "PHONE", addVipDto.getPhone(),
@@ -482,10 +502,15 @@
vipInfo.setPointAll(0);
vipInfo.setIsDeal(SysVipInfo.UNDEAL_VIP);
vipInfo.setZjm(StringUtils.toHanyuPinyin(vipInfo.getVipName())+","+StringUtils.toHeadWordHanyuPinyin(vipInfo.getVipName()));
+ if(vipInfo.getSex().equals(Dictionary.SEX_MAN)){
+ vipInfo.setPhoto(defaultMan);
+ }else{
+ vipInfo.setPhoto(defaultWoman);
+ }
int i=sysVipInfoDao.insert(vipInfo);
if (CollectionUtils.isNotEmpty(addVipDto.getLabels())) {
- batchInsertLabel(addVipDto.getLabels(), user.getSuName(), vipInfo.getId());
+ batchInsertLabel(addVipDto.getLabels(), vipInfo.getId());
}
//创建用户默认储值卡
@@ -502,10 +527,12 @@
throw new GlobleException("用户不存在");
}
- if (!modifyVipDto.getVipNo().equals(vipInfo.getVipNo())) {
- if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "VIP_NO", modifyVipDto.getVipNo(),
- "company_id",user.getCompanyId())) {
- throw new GlobleException("编号已存在!");
+ if (StringUtils.isNotBlank(modifyVipDto.getVipNo())) {
+ if (!modifyVipDto.getVipNo().equals(vipInfo.getVipNo())) {
+ if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "VIP_NO", modifyVipDto.getVipNo(),
+ "company_id", user.getCompanyId())) {
+ throw new GlobleException("编号已存在!");
+ }
}
}
@@ -536,23 +563,20 @@
int i = sysVipInfoDao.update(vipInfo);
if (CollectionUtils.isNotEmpty(modifyVipDto.getLabels())) {
- sysVipLabelDao.deleteByVipId(modifyVipDto.getVipId());
-
- batchInsertLabel(modifyVipDto.getLabels(), user.getSuName(), vipInfo.getId());
+ sysVipLabelDao.deleteRelateByVipId(modifyVipDto.getVipId());
+ batchInsertLabel(modifyVipDto.getLabels(), vipInfo.getId());
}
return i;
}
- private void batchInsertLabel(List<String> labelList, String suName, Long id) {
+ private void batchInsertLabel(List<String> labelList, Long id) {
Set<String> labels = new HashSet<>(labelList);
Iterator<String> iterator = labels.iterator();
- if (iterator.hasNext()) {
- SysVipLabel sysVipLabel = new SysVipLabel();
- sysVipLabel.setCreateTime(new Date());
- sysVipLabel.setCreateBy(suName);
- sysVipLabel.setLabel(iterator.next());
- sysVipLabel.setVipId(id);
- sysVipLabelDao.insert(sysVipLabel);
+ while (iterator.hasNext()) {
+ SysVipLabelRelate relate = new SysVipLabelRelate();
+ relate.setLabelId(Long.parseLong(iterator.next()));
+ relate.setVipId(id);
+ sysVipLabelDao.insertRelate(relate);
}
}
--
Gitblit v1.9.1