feat:所属大区

This commit is contained in:
苏竹红
2025-10-08 09:51:00 +08:00
parent 740f365a18
commit 4b9e546ffb
4 changed files with 28 additions and 6 deletions

View File

@@ -49,6 +49,7 @@
<result column="addressee_mobile" property="addresseeMobile" jdbcType="VARCHAR"/>
<result column="addressee_area" property="addresseeArea" jdbcType="VARCHAR"/>
<result column="addressee_address" property="addresseeAddress" jdbcType="VARCHAR"/>
<result column="branch" property="branch" jdbcType="TINYINT"/>
</resultMap>
<select id="getByStoreId" resultMap="BaseResultMap">

View File

@@ -52,4 +52,8 @@ public class StoreDTO {
private String addresseeArea;
@ApiModelProperty("订货地址")
private String addresseeAddress;
@ApiModelProperty("管理督导-crm系统的regionId")
private String managerSupervisionName;
@ApiModelProperty("所属大区/分部")
private String branchName;
}

View File

@@ -262,4 +262,7 @@ public class StoreDO {
* 收件详细地址
*/
private String addresseeAddress;
private Long branch;
}

View File

@@ -16,10 +16,7 @@ import com.cool.store.dto.StoreDTO;
import com.cool.store.dto.store.StoreAreaDTO;
import com.cool.store.dto.store.StoreUserDTO;
import com.cool.store.dto.store.StoreUserPositionDTO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.entity.StoreDO;
import com.cool.store.entity.SysRoleDO;
import com.cool.store.entity.UserAuthMappingDO;
import com.cool.store.entity.*;
import com.cool.store.entity.store.StoreMasterSignerInfoDO;
import com.cool.store.enums.*;
import com.cool.store.exception.ServiceException;
@@ -43,6 +40,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @Author suzhuhong
@@ -89,7 +87,17 @@ public class StoreServiceImpl implements StoreService {
if (CollectionUtils.isEmpty(list)){
return info;
}
List<StoreDTO> storeDTOS = processStores(list);
//使用regionId与branch 合并的集合
Set<Long> regionIds = list.stream()
.filter(Objects::nonNull)
.flatMap(store -> Stream.of(store.getBranch(), store.getRegionId()))
.filter(Objects::nonNull)
.collect(Collectors.toSet());
List<RegionDO> regionList = regionMapper.getByIds(new ArrayList<>(regionIds));
Map<Long, String> regionNameMap = regionList.stream().collect(Collectors.toMap(RegionDO::getId, RegionDO::getName));
List<StoreDTO> storeDTOS = processStores(list, regionNameMap);
info.setList(storeDTOS);
return info;
}
@@ -381,7 +389,7 @@ public class StoreServiceImpl implements StoreService {
}
public static List<StoreDTO> processStores(List<StoreDO> stores) {
public static List<StoreDTO> processStores(List<StoreDO> stores,Map<Long, String> regionMap) {
// 处理每个门店
return stores.stream().map(store -> {
StoreDTO dto = BeanUtil.toBean(store, StoreDTO.class);
@@ -391,6 +399,12 @@ public class StoreServiceImpl implements StoreService {
dto.setJoinMode(JoinModeEnum.getByCode(store.getJoinModel()));
dto.setBrand(FranchiseBrandEnum.getDescByCode(store.getJoinBrand()));
dto.setOrderMiniProgramName(store.getMiniProgramOrderStoreName());
if (store.getRegionId() != null){
dto.setManagerSupervisionName(regionMap.get(store.getRegionId()));
}
if (store.getBranch()!=null){
dto.setBranchName(regionMap.get(store.getBranch()));
}
return dto;
}).collect(Collectors.toList());
}