删除cust_org相关

This commit is contained in:
sxu 2025-04-01 14:20:44 +08:00
parent f36b656c0f
commit c487cf5f44
7 changed files with 0 additions and 821 deletions

View File

@ -1,9 +1,6 @@
package com.bonus.canteen.core.customer.device.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bonus.canteen.core.common.utils.AesEncryptUtil;
import com.bonus.canteen.core.common.utils.SpringContextHolder;
@ -20,7 +17,6 @@ import com.bonus.canteen.core.customer.model.CustInfo;
import com.bonus.canteen.core.customer.service.CustAccTempService;
import com.bonus.canteen.core.customer.service.CustAddrService;
import com.bonus.canteen.core.customer.service.CustInfoService;
import com.bonus.canteen.core.customer.service.CustOrgService;
import com.bonus.canteen.core.customer.v4.mobile.service.CustPhotoService;
import com.bonus.canteen.core.nutrition.api.NutritionApi;
import com.bonus.common.core.exception.ServiceException;
@ -37,7 +33,6 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.invoke.SerializedLambda;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@ -134,11 +129,6 @@ public class CustDeviceService {
throw new ServiceException(I18n.getMessage("customer.customer.inExists"));
} else {
CustInfo custInfo = (CustInfo)infoOptional.get();
CustOrgService orgService = (CustOrgService)SpringContextHolder.getBean(CustOrgService.class);
// Optional<CustOrg> orgOptional = Optional.ofNullable((CustOrg)orgService.getOne((Wrapper)Wrappers.lambdaQuery(CustOrg.class).eq(CustOrg::getOrgId, custInfo.getOrgId())));
// orgOptional.ifPresent((custOrg) -> {
// custInfo.setOrgFullName(custOrg.getOrgFullName());
// });
return CustInfoDeviceVO.of(custInfo);
}
}

View File

@ -1,43 +0,0 @@
package com.bonus.canteen.core.customer.mapper;
import com.bonus.canteen.core.customer.po.QueryOrgsBasicInfoPO;
import com.bonus.canteen.core.customer.vo.OrgBasicInfoVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface CustOrgMapper {
// void updateChildOrg(@Param("params") UpdateChildOrgPO updateChildOrgPO);
// List<CustOrgTreeDTO> getOrgLazyTree(@Param("superId") Long superId, @Param("effId") Long effId);
// List<CustOrgTreeDTO> listAllOrg();
// @LeNiuDataPermission(
// alias = "org",
// permissionType = DataPermissionTypeEnum.PERMISSION_ORG
// )
// Page<CustOrgVO> pageCustOrgByParams(Page<CustOrg> page, @Param("custOrg") CustOrgPageDTO content);
// Page<CustOrgVO> queryPageCustOrg(Page<CustOrg> page, @Param("custOrg") CustOrgPageDTO content, @Param("userId") Long userId);
// @Select({"SELECT a.org_id, a.org_num, a.org_name, a.org_full_name, a.org_level, b.org_num superNum, a.super_id, a.org_head, a.org_tel, a.remarks, a.if_del, a.uptime from cust_org a LEFT JOIN cust_org b ON a.super_id = b.org_id ${ew.customSqlSegment} "})
// List<OrgQueryVO> queryOrgsForOpen(@Param("ew") QueryWrapper<CustOrg> queryWrapper);
// boolean superInDescendantNode(@Param("orgFullId") String orgFullId, @Param("superId") Long superId);
// List<CustOrgVO> queryCustOrgVOList(@Param("orgIdList") List<Long> orgIdList);
// List<Long> listDescendantOrgIdByOrgFullId(String orgFullId);
// List<Long> listChildOrgIdByOrgId(Long orgId);
List<OrgBasicInfoVO> listOrgBasicInfoByParams(@Param("params") QueryOrgsBasicInfoPO params);
// @Select({"SELECT t.* FROM cust_org t WHERE t.if_del = 2 and t.super_id = #{superId} order by t.sort"})
// List<CustOrgVO> getCustOrgLazyTree(Long parentId);
// CustOrg getOrgByCustId(@Param("custId") Long custId);
}

View File

@ -1,130 +0,0 @@
package com.bonus.canteen.core.customer.service;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.canteen.core.customer.constants.PersonalStatusEnum;
import com.bonus.common.houqin.i18n.I18n;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.lang.invoke.SerializedLambda;
import java.util.Collection;
import java.util.Collections;
@Component
public class CustOrgCheckService {
@Autowired
@Lazy
private CustOrgService custOrgService;
// @Autowired
// @Lazy
// private CustOrgMapper custOrgMapper;
@Autowired
@Lazy
private CustInfoService custInfoService;
// public void addCheck(CustOrg custOrg) {
// this.checkOrgChildNameExist((Long)null, custOrg.getSuperId(), custOrg.getOrgName());
// this.checkOrgNumExist((Long)null, custOrg.getOrgNum());
// }
// public void updateCheck(CustOrg custOrg) {
// this.checkOrgChildNameExist(custOrg.getOrgId(), custOrg.getSuperId(), custOrg.getOrgName());
// this.checkOrgNumExist(custOrg.getOrgId(), custOrg.getOrgNum());
// this.checkSuperOrgNotUnderDescendantNode(custOrg.getSuperId(), custOrg.getOrgFullId());
// }
// public void deleteCheck(Collection<Long> orgIds) {
// this.checkTopOrgCannotDelete(orgIds);
// this.checkExistCustomer(orgIds);
// }
// protected void checkTopOrgCannotDelete(Collection<Long> orgIds) {
// CustOrg topOrg = this.custOrgService.getTopOrg();
// if (orgIds.contains(topOrg.getOrgId())) {
// throw new ServiceException(I18n.getMessage("customer.org.top.cannotDelete", new Object[0]));
// }
// }
protected void checkExistCustomer(Collection<Long> orgIds) {
Long count = this.custInfoService.customerCountByParams(Collections.singleton(PersonalStatusEnum.NORMAL.getKey()), orgIds);
if (count > 0L) {
throw new ServiceException(I18n.getMessage("customer.org.haveCustomer", new Object[0]));
}
}
// protected void checkOrgNumExist(Long orgId, String orgNum) {
// if (!CharSequenceUtil.isBlank(orgNum)) {
// // boolean exists = this.custOrgMapper.exists((Wrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery().ne(ObjectUtil.isNotNull(orgId), CustOrg::getOrgId, orgId)).eq(CustOrg::getOrgNum, orgNum)).eq(CustOrg::getIfDel, LeConstants.COMMON_NO));
// boolean exists = this.custOrgMapper.exists(Wrappers.lambdaQuery(CustOrg.class)
// .ne(ObjectUtil.isNotNull(orgId), CustOrg::getOrgId, orgId)
// .eq(CustOrg::getOrgNum, orgNum)
// .eq(CustOrg::getIfDel, LeConstants.COMMON_NO));
// if (exists) {
// String var10002 = I18n.getMessage("customer.org.num.exists", new Object[0]);
// throw new ServiceException(var10002 + "[" + orgNum + "]");
// }
// }
// }
// protected void checkOrgChildNameExist(Long orgId, Long superId, String orgName) {
// // boolean exists = this.custOrgMapper.exists((Wrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery().ne(ObjectUtil.isNotNull(orgId), CustOrg::getOrgId, orgId)).eq(CustOrg::getSuperId, superId)).eq(CustOrg::getOrgName, orgName)).eq(CustOrg::getIfDel, LeConstants.COMMON_NO));
// boolean exists = this.custOrgMapper.exists(Wrappers.lambdaQuery(CustOrg.class)
// .ne(ObjectUtil.isNotNull(orgId), CustOrg::getOrgId, orgId)
// .eq(CustOrg::getSuperId, superId)
// .eq(CustOrg::getOrgName, orgName)
// .eq(CustOrg::getIfDel, LeConstants.COMMON_NO));
// if (exists) {
// String var10002 = I18n.getMessage("customer.org.sameLevel.name.exists", new Object[0]);
// throw new ServiceException(var10002 + "[" + orgName + "]");
// }
// }
// protected void checkSuperOrgNotUnderDescendantNode(Long superId, String orgFullId) {
// if (!ObjectUtil.isNull(superId) && !CharSequenceUtil.isBlank(orgFullId)) {
// if (this.custOrgMapper.superInDescendantNode(orgFullId, superId)) {
// throw new ServiceException(I18n.getMessage("customer.org.superInChild", new Object[0]));
// }
// }
// }
// $FF: synthetic method
// private static Object $deserializeLambda$(SerializedLambda lambda) {
// switch (lambda.getImplMethodName()) {
// case "getOrgName":
// if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/customer/model/CustOrg") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
// return CustOrg::getOrgName;
// }
// break;
// case "getOrgId":
// if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/customer/model/CustOrg") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
// return CustOrg::getOrgId;
// }
//
// if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/customer/model/CustOrg") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
// return CustOrg::getOrgId;
// }
// break;
// case "getSuperId":
// if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/customer/model/CustOrg") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
// return CustOrg::getSuperId;
// }
// break;
// case "getIfDel":
// if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/customer/model/CustOrg") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
// return CustOrg::getIfDel;
// }
//
// if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/customer/model/CustOrg") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
// return CustOrg::getIfDel;
// }
// break;
// case "getOrgNum":
// if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("net/xnzn/core/customer/model/CustOrg") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
// return CustOrg::getOrgNum;
// }
// }
//
// throw new IllegalArgumentException("Invalid lambda deserialization");
// }
}

View File

@ -1,51 +0,0 @@
package com.bonus.canteen.core.customer.service;
import com.bonus.canteen.core.customer.po.QueryOrgsBasicInfoPO;
import com.bonus.canteen.core.customer.vo.OrgBasicInfoVO;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.List;
public interface CustOrgService {
// Page<CustOrgVO> pageCustOrgByParams(Page<CustOrg> page, CustOrgPageDTO content);
// CustOrg getCustOrg(Long id);
// CustOrg getCustOrgByOrgId(Long orgId);
// CustOrg getTopOrg();
// List<Long> queryChildCustOrgId(CustOrg superOrg);
// void addCustOrg(CustOrg custOrg);
// void updateOrg(CustOrg custOrg);
// void deleteByOrdId(Long orgId);
// List<Tree<Long>> getSystemOrgTree();
// List<Tree<Long>> getTenantOrgTree();
// List<CustOrgVO> queryCustOrgList(List<Long> orgIdList);
// JsonNode queryDiningPlaceByOrgId(Long orgId);
// CustOrg initTopCustOrg(String merchantName);
// CustOrg initTempCustOrg(CustOrg superOrg);
// CustOrg getTempCustOrg();
List<OrgBasicInfoVO> listOrgBasicInfoByParams(QueryOrgsBasicInfoPO queryOrgsBasicInfoPO);
// List<CustOrg> listOrgByLevel(Integer orgLeave);
// void batchAddCustOrgAndSerOrgIdNotCheck(List<CustAccExcelModel> custAccExcelModelList);
// boolean isTopOrg(Long orgId);
// List<CustOrgVO> getOrgLazyTree(CustOrgTreeDTO content);
// void dragOrgSort(CustOrgTreeDTO content);
}

View File

@ -19,7 +19,6 @@ import java.util.stream.Stream;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.houqin.constant.DelFlagEnum;
import com.bonus.canteen.core.account.v4.api.CardInfoServiceV4Api;
import com.bonus.canteen.core.account.vo.AccCardBaseInfoVO;
import com.bonus.canteen.core.customer.constants.CustConstant;
@ -32,7 +31,6 @@ import com.bonus.canteen.core.customer.model.CustInfo;
import com.bonus.canteen.core.customer.po.QueryOrgsBasicInfoPO;
import com.bonus.canteen.core.customer.service.CustInfoCheckService;
import com.bonus.canteen.core.customer.service.CustInfoService;
import com.bonus.canteen.core.customer.service.CustOrgService;
import com.bonus.canteen.core.customer.service.CustPsnTypeService;
import com.bonus.canteen.core.customer.vo.OrgBasicInfoVO;
import com.bonus.canteen.core.customer.vo.PsnTypeBacisInfoVO;
@ -53,10 +51,6 @@ public class CustInfoCheckServiceImpl implements CustInfoCheckService {
@Lazy
private CustInfoService custInfoService;
@Autowired
@Lazy
private CustOrgService custOrgService;
@Autowired
@Lazy
private CustPsnTypeService custPsnTypeService;
@ -68,7 +62,6 @@ public class CustInfoCheckServiceImpl implements CustInfoCheckService {
public void checkCustInfoOnlyAndSetRedundantData(CustInfoModel infoModel) {
this.checkCustNumUnique(infoModel.getCustNum(), infoModel.getCustId());
this.checkCusMobile(infoModel.getMobile(), infoModel.getCustId());
this.checkOrgAndSetNumAndFullName(infoModel.getOrgId(), infoModel);
this.checkPsnTypeAndSetPsnTypeName(infoModel.getPsnType(), infoModel);
this.checkIdCardAndSetBirthday(infoModel.getIdCard(), infoModel);
this.checkBirthday(infoModel.getBirthday());
@ -211,22 +204,6 @@ public class CustInfoCheckServiceImpl implements CustInfoCheckService {
}
}
protected void checkOrgAndSetNumAndFullName(Long orgId, CustInfoModel infoModel) {
QueryOrgsBasicInfoPO queryOrgsBasicInfoPO = (new QueryOrgsBasicInfoPO()).setOrgIds(Collections.singleton(orgId)).setDelFlags(Collections.singleton(OrgDelFlagEnum.DEL_FALSE.key()));
if (ObjectUtil.isNull(orgId)) {
queryOrgsBasicInfoPO.setSuperIds(Collections.singleton(CustConstant.DATA_DEFAULT_LONG));
}
List<OrgBasicInfoVO> orgBasicInfoVOList = this.custOrgService.listOrgBasicInfoByParams(queryOrgsBasicInfoPO);
if (CollUtil.isEmpty(orgBasicInfoVOList)) {
throw new ServiceException(RetCodeEnum.MKT_ERROR_PARAM+":"+ I18n.getMessage("customer.org.org.inexists", new Object[0]));
} else {
OrgBasicInfoVO orgBasicInfoVO = (OrgBasicInfoVO)orgBasicInfoVOList.get(0);
// infoModel.setOrgNum(orgBasicInfoVO.getOrgNum());
// infoModel.setOrgFullName(orgBasicInfoVO.getOrgFullName());
}
}
protected void checkPsnTypeAndSetPsnTypeName(Integer psnType, CustInfoModel infoModel) {
if (!ObjectUtil.isNull(psnType)) {
PsnTypeBacisInfoVO psnTypeBasicInfoVO = this.custPsnTypeService.getPsnTypeBasicInfoVO(psnType);

View File

@ -1,531 +0,0 @@
package com.bonus.canteen.core.customer.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.houqin.constant.DelFlagEnum;
import com.bonus.common.houqin.constant.LeConstants;
import com.bonus.canteen.core.auth.api.MgrAuthApi;
import com.bonus.canteen.core.common.constant.LeMqConstant;
import com.bonus.canteen.core.common.redis.RedisUtil;
import com.bonus.canteen.core.customer.api.CustInfoApi;
import com.bonus.canteen.core.customer.business.CustOrgPointBusiness;
import com.bonus.canteen.core.customer.constants.CustCacheKey;
import com.bonus.canteen.core.customer.constants.CustConstant;
import com.bonus.canteen.core.customer.dto.CustAccExcelModel;
import com.bonus.canteen.core.customer.dto.CustOrgPageDTO;
import com.bonus.canteen.core.customer.dto.CustOrgTreeDTO;
import com.bonus.canteen.core.customer.mapper.CustOrgMapper;
import com.bonus.canteen.core.customer.po.QueryOrgsBasicInfoPO;
import com.bonus.canteen.core.customer.po.UpdateChildOrgPO;
import com.bonus.canteen.core.customer.service.CustInfoService;
import com.bonus.canteen.core.customer.service.CustOrgCheckService;
import com.bonus.canteen.core.customer.service.CustOrgService;
import com.bonus.canteen.core.customer.utils.CommonConstants;
import com.bonus.canteen.core.customer.utils.CustomerCacheUtil;
import com.bonus.canteen.core.customer.vo.OrgBasicInfoVO;
import com.bonus.canteen.core.order.mq.MqUtil;
import com.bonus.common.houqin.utils.id.Id;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
public class CustOrgServiceImpl implements CustOrgService {
private static final Logger log = LoggerFactory.getLogger(CustOrgServiceImpl.class);
@Autowired
@Lazy
private CustInfoService custInfoService;
@Autowired
@Lazy
private CustInfoApi custInfoApi;
@Autowired
@Lazy
private MgrAuthApi mgrAuthApi;
@Autowired
@Lazy
CustOrgCheckService custOrgCheckService;
@Autowired
@Lazy
CustOrgMapper custOrgMapper;
@Autowired
@Lazy
CustOrgPointBusiness custOrgPointBusiness;
// public Page<CustOrgVO> pageCustOrgByParams(Page<CustOrg> page, CustOrgPageDTO content) {
// this.setOrgFullId(content);
// Page<CustOrgVO> recordPage = this.custOrgMapper.pageCustOrgByParams(page, content);
// this.setOrgInfo(recordPage.getRecords());
// this.custOrgPointBusiness.didPageCustOrg(content, recordPage);
// return recordPage;
// }
// public List<Long> queryChildCustOrgId(CustOrg superOrg) {
// List<Long> orgIdList = Lists.newArrayList();
// orgIdList.add(superOrg.getOrgId());
// List<CustOrg> allOrgList = this.list((Wrapper)Wrappers.lambdaQuery(CustOrg.class).eq(CustOrg::getIfDel, LeConstants.COMMON_NO));
// if (CollectionUtils.isEmpty(allOrgList)) {
// return orgIdList;
// } else {
// List<CustOrg> childrenOrgList = this.queryChildren(superOrg.getOrgId(), Lists.newArrayList(), allOrgList);
// Iterator var5 = childrenOrgList.iterator();
//
// while(var5.hasNext()) {
// CustOrg temp = (CustOrg)var5.next();
// orgIdList.add(temp.getOrgId());
// }
//
// return orgIdList;
// }
// }
// @Transactional(
// rollbackFor = {Exception.class}
// )
// public void addCustOrg(CustOrg custOrg) {
// this.custOrgCheckService.addCheck(custOrg);
// CustOrg superOrg = this.getCustOrgByOrgId(custOrg.getSuperId());
// custOrg.setOrgId(Id.next());
// setCustOrgInfo(custOrg, superOrg);
// this.insert(custOrg);
// this.custOrgPointBusiness.didAddCustOrg(custOrg);
// }
// public void batchAddCustOrgAndSerOrgIdNotCheck(List<CustAccExcelModel> custAccExcelModelList) {
// if (!CollUtil.isEmpty(custAccExcelModelList)) {
// Map<String, CustOrg> superIdAndName_org = (Map)this.listAllCustOrg().stream().collect(Collectors.toMap((e) -> {
// Long var10000 = e.getSuperId();
// return "" + var10000 + e.getOrgName();
// }, Function.identity(), (e1, e2) -> {
// return e1;
// }));
// List<CustOrg> addCustOrgList = new ArrayList();
// CustOrg topOrg = this.getTopOrg();
// Iterator var5 = custAccExcelModelList.iterator();
//
// while(var5.hasNext()) {
// CustAccExcelModel excelModel = (CustAccExcelModel)var5.next();
// CustOrg superOrg = topOrg;
//
// for(int i = 2; i <= 6; ++i) {
// String orgNameByLevel = excelModel.getOrgNameByLevel(i);
// if (CharSequenceUtil.isBlank(orgNameByLevel)) {
// break;
// }
//
// Long var10001 = superOrg.getOrgId();
// CustOrg existOrg = (CustOrg)superIdAndName_org.get("" + var10001 + orgNameByLevel);
// if (ObjectUtil.isNotNull(existOrg)) {
// superOrg = existOrg;
// excelModel.setOrgId(existOrg.getOrgId());
// } else {
// CustOrg custOrg = (new CustOrg()).setOrgId(Id.next()).setOrgName(orgNameByLevel).setSuperId(superOrg.getOrgId());
// setCustOrgInfo(custOrg, superOrg);
// addCustOrgList.add(custOrg);
// superIdAndName_org.put(custOrg.getSuperId() + custOrg.getOrgName(), custOrg);
// superOrg = custOrg;
// excelModel.setOrgId(custOrg.getOrgId());
// }
// }
// }
//
// log.info("新增组织数量={}", CollUtil.size(addCustOrgList));
// this.insertBatch(addCustOrgList);
// }
// }
// public boolean isTopOrg(Long orgId) {
// CustOrg topOrg = this.getTopOrg();
// return ObjectUtil.equal(topOrg.getOrgId(), orgId);
// }
// public List<CustOrgVO> getOrgLazyTree(CustOrgTreeDTO content) {
// if (ObjectUtil.isNull(content)) {
// throw new ServiceException("入参不能为空");
// } else {
// Long parentId = (Long)Optional.ofNullable(content.getSuperId()).orElse(CommonConstants.MENU_TREE_ROOT_ID);
// return this.custOrgMapper.getCustOrgLazyTree(parentId);
// }
// }
// @Transactional(
// rollbackFor = {Exception.class}
// )
// public void dragOrgSort(CustOrgTreeDTO content) {
// String dragSortKey = CustCacheKey.getTenantKey("org:drag:sort");
// if (!RedisUtil.setNx(dragSortKey, 0, 300)) {
// throw new ServiceException("正在执行排序,请稍后再试!");
// } else {
// try {
// Long orgId = content.getOrgId();
// Integer newSort = content.getSort();
// CustOrg oldOrg = (CustOrg)this.getOne((Wrapper)Wrappers.lambdaQuery(CustOrg.class).eq(CustOrg::getOrgId, orgId));
// if (ObjectUtil.isNull(oldOrg)) {
// throw new ServiceException("组织不存在");
// }
//
// Integer oldSort = oldOrg.getSort();
// List<CustOrg> siblings = this.list((Wrapper)Wrappers.lambdaQuery(CustOrg.class).eq(CustOrg::getSuperId, content.getSuperId()));
// Iterator var8 = siblings.iterator();
//
// while(var8.hasNext()) {
// CustOrg sibling = (CustOrg)var8.next();
// if (sibling.getOrgId().equals(orgId)) {
// this.updateSortByOrgId(orgId, newSort);
// } else if (oldSort < newSort && sibling.getSort() > oldSort && sibling.getSort() <= newSort) {
// this.updateSortByOrgId(sibling.getOrgId(), sibling.getSort() - 1);
// } else if (oldSort > newSort && sibling.getSort() >= newSort && sibling.getSort() < oldSort) {
// this.updateSortByOrgId(sibling.getOrgId(), sibling.getSort() + 1);
// }
// }
// } finally {
// RedisUtil.delete(dragSortKey);
// }
//
// }
// }
// @Transactional(
// rollbackFor = {Exception.class}
// )
// public void updateOrg(CustOrg custOrg) {
// CustOrg oldOrg = this.getCustOrgByOrgId(custOrg.getOrgId());
// if (ObjectUtil.isNull(custOrg.getOrgFullId())) {
// custOrg.setOrgFullId(oldOrg.getOrgFullId());
// }
//
// this.custOrgCheckService.updateCheck(custOrg);
// CustOrg superOrg = this.getCustOrgByOrgId(custOrg.getSuperId());
// setCustOrgInfo(custOrg, superOrg);
// this.updateByOrgId(custOrg);
// List<Long> childOrgIdList = this.custOrgMapper.listDescendantOrgIdByOrgFullId(oldOrg.getOrgFullId());
// if (CollUtil.isNotEmpty(childOrgIdList)) {
// UpdateChildOrgPO updateChildOrgPO = (new UpdateChildOrgPO()).setOldOrgFullName(oldOrg.getOrgFullName()).setOrgFullName(custOrg.getOrgFullName()).setOldOrgFullId(oldOrg.getOrgFullId()).setOrgFullId(custOrg.getOrgFullId()).setDiffLevel(calculateLeaveDiff(custOrg.getOrgLevel(), oldOrg.getOrgLevel())).setEndDate(custOrg.getEndDate()).setChildOrgIdList(childOrgIdList);
// this.custOrgMapper.updateChildOrg(updateChildOrgPO);
// }
//
// ArrayList<Long> orgIdList = CollUtil.newArrayList(childOrgIdList);
// orgIdList.add(custOrg.getOrgId());
// this.changeCustInfoRedundantFields(orgIdList);
// this.custOrgPointBusiness.didUpdateCustOrg(custOrg);
// }
// @Transactional(
// rollbackFor = {Exception.class}
// )
// public void deleteByOrdId(Long orgId) {
// List<Long> orgIdList = new ArrayList();
// orgIdList.add(orgId);
// List<Long> childOrgIdList = this.custOrgMapper.listChildOrgIdByOrgId(orgId);
// orgIdList.addAll(childOrgIdList);
// this.custOrgCheckService.deleteCheck(orgIdList);
// this.deleteByOrgId(orgIdList);
// this.custOrgPointBusiness.didDeleteCustOrg(orgId, orgIdList);
// }
// public List<CustOrgVO> queryCustOrgList(List<Long> orgIdList) {
// return this.custOrgMapper.queryCustOrgVOList(orgIdList);
// }
// public JsonNode queryDiningPlaceByOrgId(Long orgId) {
// //CustOrg custOrg = (CustOrg)this.custOrgMapper.selectOne((Wrapper)Wrappers.lambdaQuery(CustOrg.class).select(new SFunction[]{CustOrg::getDiningPlace}).eq(CustOrg::getOrgId, orgId));
// CustOrg custOrg = this.custOrgMapper.selectOne(Wrappers.lambdaQuery(CustOrg.class)
// .select(CustOrg::getDiningPlace)
// .eq(CustOrg::getOrgId, orgId));
// return ObjectUtil.isNull(custOrg) ? null : custOrg.getDiningPlace();
// }
// public CustOrg initTopCustOrg(String merchantName) {
// CustOrg custOrg = new CustOrg();
// custOrg.setOrgId(Id.next());
// String merchantDefault = merchantName + "(默认)";
// custOrg.setOrgName(merchantDefault);
// custOrg.setOrgNum("0");
// custOrg.setOrgFullName(merchantDefault);
// custOrg.setOrgFullId("/" + custOrg.getOrgId() + "/");
// custOrg.setOrgLevel(1);
// custOrg.setSuperId(CustConstant.DATA_DEFAULT_LONG);
// this.insert(custOrg);
// return custOrg;
// }
// public CustOrg initTempCustOrg(CustOrg superOrg) {
// CustOrg custOrg = new CustOrg();
// custOrg.setOrgId(CustConstant.TEMPORARY_ORG_ID);
// custOrg.setOrgFullId(assembleOrgFullId(custOrg.getOrgId(), superOrg.getOrgFullId()));
// custOrg.setOrgName("临时部门");
// custOrg.setOrgLevel(superOrg.getOrgLevel() + 1);
// custOrg.setOrgFullName(assembleOrgFullName("临时部门", superOrg.getOrgFullName()));
// custOrg.setOrgNum("letemporaryorg");
// custOrg.setSuperId(superOrg.getOrgId());
// custOrg.setEndDate(calculateEndDate((LocalDate)null, superOrg.getEndDate()));
// this.insert(custOrg);
// return custOrg;
// }
// public List<Tree<Long>> getSystemOrgTree() {
// return this.getOrgTree(this.custOrgMapper.listAllOrg());
// }
// protected List<Tree<Long>> getOrgTree(List<CustOrgTreeDTO> systemOrgTree) {
// TreeNodeConfig treeNodeConfig = getTreeNodeConfig();
// return TreeUtil.build(systemOrgTree, CustConstant.DATA_DEFAULT_LONG, treeNodeConfig, (org, treeNode) -> {
// treeNode.setId(org.getOrgId());
// treeNode.setParentId(org.getSuperId());
// treeNode.setName(org.getOrgName());
// treeNode.setWeight(org.getSort());
// treeNode.putExtra("orgFullName", org.getOrgFullName());
// treeNode.putExtra("orgNum", org.getOrgNum());
// treeNode.putExtra("orgLevel", org.getOrgLevel());
// treeNode.putExtra("halfSelect", ObjectUtil.isNull(org.getHalfSelect()) ? 1 : org.getHalfSelect());
// });
// }
// protected static TreeNodeConfig getTreeNodeConfig() {
// TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
// treeNodeConfig.setParentIdKey("superId");
// treeNodeConfig.setNameKey("text");
// treeNodeConfig.setWeightKey("sort");
// return treeNodeConfig;
// }
// public List<Tree<Long>> getTenantOrgTree() {
// List<CustOrgTreeDTO> tenantOrg = this.mgrAuthApi.getTenantOrg(LeConstants.COMMON_NO);
// return this.getOrgTree(tenantOrg);
// }
// protected void setOrgFullId(CustOrgPageDTO content) {
// if (!ObjectUtil.isEmpty(content.getOrgId())) {
// String orgFullId = this.getOrgFullIdByOrgId(content.getOrgId());
// content.setOrgFullId(orgFullId);
// }
// }
// protected String getOrgFullIdByOrgId(Long orgId) {
// //CustOrg custOrg = (CustOrg)this.custOrgMapper.selectOne((Wrapper)Wrappers.lambdaQuery(CustOrg.class).select(new SFunction[]{CustOrg::getOrgFullId}).eq(CustOrg::getOrgId, orgId));
// CustOrg custOrg = this.custOrgMapper.selectOne(Wrappers.lambdaQuery(CustOrg.class)
// .select(CustOrg::getOrgFullId)
// .eq(CustOrg::getOrgId, orgId));
// return null == custOrg ? null : custOrg.getOrgFullId();
// }
// protected void setOrgInfo(List<CustOrgVO> custOrgVOList) {
// Set<Long> custIdSet = (Set)custOrgVOList.stream().map(CustOrgVO::getOrgHeadId).filter(Objects::nonNull).collect(Collectors.toSet());
// Map<Long, CustInfo> custId_entity = new HashMap();
// if (CollUtil.isNotEmpty(custIdSet)) {
//// custId_entity = (Map)this.custInfoApi.selectCustBasicsInfoListByCustIds(custIdSet).stream().collect(Collectors.toMap(CustInfo::getCustId, Function.identity()));
// }
//
// Iterator var4 = custOrgVOList.iterator();
//
// while(var4.hasNext()) {
// CustOrgVO custOrgVO = (CustOrgVO)var4.next();
// custOrgVO.setExpires(!ObjectUtil.isNull(custOrgVO.getEndDate()) && LocalDate.now().isAfter(custOrgVO.getEndDate()));
// Map<Long, Integer> orgId_customerNum = this.getCustomerNumInOrg();
// if (custOrgVO.getOrgId() == CustConstant.TEMPORARY_ORG_ID) {
// custOrgVO.setCustomerNum((Integer)orgId_customerNum.getOrDefault(CustConstant.TEMPORARY_ORG_ID.intValue(), 0));
// } else {
// custOrgVO.setCustomerNum((Integer)orgId_customerNum.getOrDefault(custOrgVO.getOrgId(), 0));
// }
//
// CustInfo custInfo = (CustInfo)((Map)custId_entity).get(custOrgVO.getOrgHeadId());
// if (ObjectUtil.isNotEmpty(custInfo)) {
// custOrgVO.setCustNum(custInfo.getCustNum());
// custOrgVO.setCustName(custInfo.getCustName());
// }
// }
//
// }
// protected List<CustOrg> queryChildren(Long orgId, List<CustOrg> resultList, List<CustOrg> allOrgList) {
// Iterator var4 = allOrgList.iterator();
//
// while(var4.hasNext()) {
// CustOrg node = (CustOrg)var4.next();
// if (orgId.equals(node.getSuperId())) {
// resultList.add(node);
// this.queryChildren(node.getOrgId(), resultList, allOrgList);
// }
// }
//
// return resultList;
// }
// public Map<Long, Integer> getCustomerNumInOrg() {
// Map<Long, Integer> cacheOrgId_customerNum = (Map)Optional.ofNullable(CustomerCacheUtil.getCustomerNumBelongOrgMapCache()).orElse(new HashMap());
// if (CollUtil.isNotEmpty(cacheOrgId_customerNum)) {
// return cacheOrgId_customerNum;
// } else {
// LocalDateTime now1 = LocalDateTime.now();
// Map<Long, Integer> orgId_partCustomerNum = this.custInfoService.getCustomerNumBelongOrg();
// List<Tree<Long>> tenantOrgTree = this.getSystemOrgTree();
// if (CollUtil.isEmpty(tenantOrgTree)) {
// return MapUtil.empty();
// } else {
// getOrgCountRecursion(cacheOrgId_customerNum, tenantOrgTree, orgId_partCustomerNum);
// log.info("cacheOrgId_customerNum【{}】", cacheOrgId_customerNum);
// CustomerCacheUtil.insertCustomerNumBelongOrgMapCache(cacheOrgId_customerNum);
// LocalDateTime now2 = LocalDateTime.now();
// log.info("用时[{}]毫秒", now1.until(now2, ChronoUnit.MILLIS));
// return cacheOrgId_customerNum;
// }
// }
// }
// public static int getOrgCountRecursion(Map<Long, Integer> orgId_customerNum, List<Tree<Long>> orgTree, Map<Long, Integer> orgId_partCustomerNum) {
// int totalCustomerNum = 0;
// if (CollUtil.isEmpty(orgTree)) {
// return totalCustomerNum;
// } else {
// int customerNum;
// for(Iterator var4 = orgTree.iterator(); var4.hasNext(); totalCustomerNum += customerNum) {
// Tree<Long> tree = (Tree)var4.next();
// if (tree.hasChild()) {
// customerNum = (Integer)orgId_partCustomerNum.getOrDefault(tree.getId(), 0) + getOrgCountRecursion(orgId_customerNum, tree.getChildren(), orgId_partCustomerNum);
// } else {
// customerNum = (Integer)orgId_partCustomerNum.getOrDefault(tree.getId(), 0);
// }
//
// orgId_customerNum.put((Long)tree.getId(), customerNum);
// }
//
// return totalCustomerNum;
// }
// }
// protected static void setCustOrgInfo(CustOrg custOrg, CustOrg superOrg) {
// custOrg.setOrgFullName(assembleOrgFullName(custOrg.getOrgName(), superOrg.getOrgFullName()));
// custOrg.setOrgFullId(assembleOrgFullId(custOrg.getOrgId(), superOrg.getOrgFullId()));
// custOrg.setEndDate(calculateEndDate(custOrg.getEndDate(), superOrg.getEndDate()));
// int orgLevel = custOrg.getOrgFullName().split("/").length;
// custOrg.setOrgLevel(orgLevel);
// }
// protected static LocalDate calculateEndDate(LocalDate endDate, LocalDate superEndDate) {
// if (endDate == null) {
// return superEndDate;
// } else if (superEndDate == null) {
// return null;
// } else {
// return endDate.isAfter(superEndDate) ? superEndDate : endDate;
// }
// }
// protected static String assembleOrgFullName(String orgName, String superOrgFullName) {
// return superOrgFullName + "/" + orgName;
// }
// protected static String assembleOrgFullId(Long orgId, String superOrgFullId) {
// return superOrgFullId + orgId + "/";
// }
//
// protected static int calculateLeaveDiff(Integer newLeave, Integer oldLeave) {
// return newLeave - oldLeave;
// }
//
// protected void changeCustInfoRedundantFields(Collection<Long> orgIdList) {
// this.custInfoService.updateCustomersOrgNumAndOrgFullName(orgIdList);
// }
// protected void insert(CustOrg custOrg) {
// if (!ObjectUtil.isNull(custOrg)) {
// this.custOrgMapper.insert(custOrg);
// MqUtil.sendDataChange(custOrg, LeMqConstant.DataChangeType.ADD, LeMqConstant.Topic.DATA_CHANGE_ORG);
// }
// }
// protected void insertBatch(List<CustOrg> custOrgList) {
// if (!ObjectUtil.isNull(custOrgList)) {
// this.saveBatch(custOrgList);
// }
// }
// protected void deleteByOrgId(Collection<Long> orgIdList) {
// if (!CollUtil.isEmpty(orgIdList)) {
// // this.custOrgMapper.update((Object)null, (Wrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(CustOrg.class).in(CustOrg::getOrgId, orgIdList)).set(CustOrg::getIfDel, LeConstants.COMMON_YES));
// this.custOrgMapper.update(null, Wrappers.lambdaUpdate(CustOrg.class).in(CustOrg::getOrgId, orgIdList).set(CustOrg::getIfDel, LeConstants.COMMON_YES));
// Iterator var2 = orgIdList.iterator();
//
// while(var2.hasNext()) {
// Long orgId = (Long)var2.next();
// CustOrg custOrg = new CustOrg();
// custOrg.setOrgId(orgId);
// MqUtil.sendDataChange(custOrg, LeMqConstant.DataChangeType.REMOVE, LeMqConstant.Topic.DATA_CHANGE_ORG);
// }
//
// }
// }
// protected void updateByOrgId(CustOrg custOrg) {
// if (!ObjectUtil.isNull(custOrg)) {
// //this.update(custOrg, (Wrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(CustOrg.class).set(CustOrg::getOrgHeadId, custOrg.getOrgHeadId())).eq(CustOrg::getOrgId, custOrg.getOrgId()));
// this.update(custOrg, Wrappers.lambdaUpdate(CustOrg.class)
// .set(CustOrg::getOrgHeadId, custOrg.getOrgHeadId())
// .eq(CustOrg::getOrgId, custOrg.getOrgId()));
// CustomerCacheUtil.deleteCustomerNumBelongOrgMapCache();
// CustomerCacheUtil.deleteCustomerNumBelongOrgMapCache();
// MqUtil.sendDataChange(custOrg, LeMqConstant.DataChangeType.UPDATE, LeMqConstant.Topic.DATA_CHANGE_ORG);
// }
// }
// public CustOrg getCustOrg(Long id) {
// return (CustOrg)this.custOrgMapper.selectById(id);
// }
// protected List<CustOrg> listAllCustOrg() {
// return this.custOrgMapper.selectList((Wrapper)Wrappers.lambdaQuery(CustOrg.class).eq(CustOrg::getIfDel, DelFlagEnum.DEL_FALSE.key()));
// }
// public CustOrg getCustOrgByOrgId(@NotNull Long orgId) {
// return (CustOrg)this.custOrgMapper.selectOne((Wrapper)Wrappers.lambdaQuery(CustOrg.class).eq(CustOrg::getOrgId, orgId));
// }
// public CustOrg getTopOrg() {
// //return (CustOrg)this.custOrgMapper.selectOne((Wrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(CustOrg.class).eq(CustOrg::getIfDel, DelFlagEnum.DEL_FALSE.key())).eq(CustOrg::getOrgLevel, 1));
// return (CustOrg)this.custOrgMapper.selectOne((LambdaQueryWrapper)Wrappers.lambdaQuery(CustOrg.class).eq(CustOrg::getIfDel, DelFlagEnum.DEL_FALSE.key()).eq(CustOrg::getOrgLevel, 1));
// }
public List<OrgBasicInfoVO> listOrgBasicInfoByParams(QueryOrgsBasicInfoPO queryOrgsBasicInfoPO) {
return this.custOrgMapper.listOrgBasicInfoByParams(queryOrgsBasicInfoPO);
}
// public List<CustOrg> listOrgByLevel(Integer orgLeave) {
// // return this.custOrgMapper.selectList((Wrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(CustOrg.class).eq(CustOrg::getOrgLevel, orgLeave)).eq(CustOrg::getIfDel, DelFlagEnum.DEL_FALSE.key()));
// return this.custOrgMapper.selectList(Wrappers.lambdaQuery(CustOrg.class)
// .eq(CustOrg::getOrgLevel, orgLeave)
// .eq(CustOrg::getIfDel, DelFlagEnum.DEL_FALSE.key()));
// }
// public CustOrg getTempCustOrg() {
// return (CustOrg)this.custOrgMapper.selectOne((Wrapper)Wrappers.lambdaQuery(CustOrg.class).eq(CustOrg::getOrgNum, "letemporaryorg"));
// }
// public void updateSortByOrgId(Long orgId, Integer newSort) {
// // this.update((Wrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(CustOrg.class).set(CustOrg::getSort, newSort)).eq(CustOrg::getOrgId, orgId));
// this.update(Wrappers.lambdaUpdate(CustOrg.class).set(CustOrg::getSort, newSort).eq(CustOrg::getOrgId, orgId));
// }
}

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.bonus.canteen.core.customer.mapper.CustOrgMapper">
<select id="listOrgBasicInfoByParams" resultType="com.bonus.canteen.core.customer.vo.OrgBasicInfoVO">
SELECT dept_id as org_id, dept_name as org_name, parent_id as super_id, del_flag as if_del
FROM sys_dept
<where>
<if test="params.delFlags != null and params.delFlags.size() > 0">
del_flag IN
<foreach collection="params.delFlags" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="params.orgIds != null and params.orgIds.size() > 0">
AND dept_id IN
<foreach collection="params.orgIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="params.superIds != null and params.superIds.size() > 0">
AND parent_id IN
<foreach collection="params.superIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>