diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/BuildInformationServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/BuildInformationServiceImpl.java index 4a9ca2637..29cfc0a68 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/BuildInformationServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/BuildInformationServiceImpl.java @@ -4,10 +4,7 @@ package com.cool.store.service.impl; import com.cool.store.constants.CommonConstants; import com.cool.store.dao.*; import com.cool.store.entity.*; -import com.cool.store.enums.ErrorCodeEnum; -import com.cool.store.enums.MessageEnum; -import com.cool.store.enums.OrderSysTypeEnum; -import com.cool.store.enums.UserRoleEnum; +import com.cool.store.enums.*; import com.cool.store.enums.point.ShopSubStageEnum; import com.cool.store.enums.point.ShopSubStageStatusEnum; import com.cool.store.exception.ServiceException; @@ -16,12 +13,14 @@ import com.cool.store.request.BuildInformationRequest; import com.cool.store.response.BuildInformationResponse; import com.cool.store.service.BuildInformationService; import com.cool.store.mapper.BuildInformationMapper; +import com.cool.store.service.EnumInfoService; import com.cool.store.service.PreparationService; import com.cool.store.service.UserAuthMappingService; import com.cool.store.utils.RedisConstantUtil; import com.cool.store.utils.RedisUtilPool; import com.cool.store.utils.poi.StringUtils; import io.lettuce.core.ZAddArgs; +import org.apache.commons.collections4.CollectionUtils; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * @author EDY @@ -38,7 +38,8 @@ import java.util.stream.Collectors; */ @Service public class BuildInformationServiceImpl implements BuildInformationService { - + @Resource + private EnumInfoService enumInfoService; @Resource private RedisConstantUtil redisConstantUtil; @Resource @@ -116,9 +117,17 @@ public class BuildInformationServiceImpl implements BuildInformationService { response.setDeclareGoodsType(orderSysInfoDO.getDeclareGoodsType()); } if (StringUtils.isBlank(response.getXgjVicePresident())) { - EnterpriseUserDO user = userAuthMappingService.getUserByRoleEnumAndRegionId(UserRoleEnum.VICE_PRESIDENT_IN_CHARGE, shopInfo.getRegionId()); - if (Objects.nonNull(user)) { - response.setXgjVicePresident(user.getName()); + List userList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.VICE_PRESIDENT_IN_CHARGE, shopInfo.getRegionId()); + if (CollectionUtils.isNotEmpty(userList)) { + List xgjVicePresidentList = enumInfoService.getByTypeCode(ZxjpEnum.XGJ_VICE_PRESIDENT.getCode()); + List userNameSet = userList.stream().map(EnterpriseUserDO::getName).collect(Collectors.toList()); + List xgjVicePresidentNameList = xgjVicePresidentList.stream().map(EnumInfoDO::getSysValue).collect(Collectors.toList()); + List resultUserNameList = userNameSet.stream() + .filter(xgjVicePresidentNameList::contains) + .collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(resultUserNameList)){ + response.setXgjVicePresident(resultUserNameList.get(0)); + } } } //根据映射关系默认带出新管家组织