From a672e4e8c05be9c763943a06cfe5220ef217934c Mon Sep 17 00:00:00 2001 From: wzy <wzy19931122ai@163.com> Date: Sat, 23 Jan 2021 20:07:44 +0800 Subject: [PATCH] modify --- zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java | 55 ++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 36 insertions(+), 19 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 63e7d10..026ef0b 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,9 +13,11 @@ 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; +import com.matrix.system.hive.action.util.QueryUtil; import com.matrix.system.hive.bean.*; import com.matrix.system.hive.dao.*; import com.matrix.system.hive.plugin.util.CollectionUtils; @@ -424,6 +426,7 @@ if (!DataAuthUtil.hasAllShopAuth()) { vipInfoListDto.setShopId(sysUsers.getShopId()); } + QueryUtil.setQueryLimitCom(vipInfoListDto); return sysVipInfoDao.selectVipAddressBookByList(vipInfoListDto); } @@ -447,6 +450,8 @@ } SysVipInfo vipInfo = new SysVipInfo(); + + vipInfo.setPhoto(addVipDto.getPhoto()); vipInfo.setVipName(addVipDto.getVipName()); vipInfo.setVipNo(addVipDto.getVipNo()); vipInfo.setSex(addVipDto.getSex()); @@ -455,10 +460,11 @@ vipInfo.setAddr(addVipDto.getAddress()); vipInfo.setRemark(addVipDto.getRemark()); vipInfo.setBirthday1(addVipDto.getBirthday()); + vipInfo.setPassWord(addVipDto.getPassword()); vipInfo.setRecommendId(addVipDto.getRecommendId()); if (StringUtils.isNotBlank(addVipDto.getAreas())) { - String[] areas = addVipDto.getAreas().split(","); + String[] areas = addVipDto.getAreas().split("-"); vipInfo.setProvince(areas[0]); vipInfo.setCity(areas[1]); vipInfo.setArea(areas[2]); @@ -479,7 +485,7 @@ int i=sysVipInfoDao.insert(vipInfo); if (CollectionUtils.isNotEmpty(addVipDto.getLabels())) { - batchInsertLabel(addVipDto.getLabels(), user.getSuName(), vipInfo.getId()); + batchInsertLabel(addVipDto.getLabels(), vipInfo.getId()); } //创建用户默认储值卡 @@ -491,18 +497,27 @@ public int apiModifyVip(ModifyVipDto modifyVipDto) { SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); - if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "PHONE", modifyVipDto.getPhone(), - "company_id",user.getCompanyId() )) { - throw new GlobleException("手机已被注册!"); - } - SysVipInfo vipInfo = sysVipInfoDao.selectById(modifyVipDto.getVipId()); if (vipInfo == null) { 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 (!vipInfo.getPhone().equals(modifyVipDto.getPhone())) { + if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "PHONE", modifyVipDto.getPhone(), + "company_id", user.getCompanyId())) { + throw new GlobleException("手机已被注册!"); + } + } + if (StringUtils.isNotBlank(modifyVipDto.getAreas())) { - String[] areas = modifyVipDto.getAreas().split(","); + String[] areas = modifyVipDto.getAreas().split("-"); vipInfo.setProvince(areas[0]); vipInfo.setCity(areas[1]); vipInfo.setArea(areas[2]); @@ -514,28 +529,27 @@ vipInfo.setPhone(modifyVipDto.getPhone()); vipInfo.setAddr(modifyVipDto.getAddress()); vipInfo.setRemark(modifyVipDto.getRemark()); + vipInfo.setPassWord(modifyVipDto.getPassword()); vipInfo.setBirthday1(modifyVipDto.getBirthday()); vipInfo.setRecommendId(modifyVipDto.getRecommendId()); + vipInfo.setPhoto(modifyVipDto.getPhoto()); 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); } } @@ -559,6 +573,9 @@ vipInfoDetailVo.setArea(sysVipInfo.getArea()); vipInfoDetailVo.setRemark(sysVipInfo.getRemark()); vipInfoDetailVo.setBirthday(sysVipInfo.getBirthday1()); + vipInfoDetailVo.setPassword(sysVipInfo.getPassWord()); + vipInfoDetailVo.setPhoto(sysVipInfo.getPhoto()); + vipInfoDetailVo.setVipNo(sysVipInfo.getVipNo()); List<SysVipLabel> labels = sysVipLabelDao.selectByVipId(sysVipInfo.getId()); vipInfoDetailVo.setLabels(labels); -- Gitblit v1.9.1