Commit b5823719 by fudahua

刷新绑定门店

parent b6789a5a
......@@ -285,7 +285,7 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
// 获取所有门店信息
List<StoreSimpleDTO> storeDtos = storeService.listSimpleStore(enterpriseId, null, null);
Map<String, List<String>> storeMapByGroupId = storeDtos.stream().collect(Collectors.groupingBy(dto -> dto.getStoreGroupId(), Collectors.mapping(dto -> dto.getStoreId(), Collectors.toList())));
Map<String, String> storeIdMap = storeDtos.stream().collect(Collectors.toMap(dto -> dto.getStoreId(), dto -> dto.getStoreGroupId()));
Map<String, StoreSimpleDTO> storeIdMap = storeDtos.stream().collect(Collectors.toMap(dto -> dto.getStoreId(), dto -> dto));
//获取所有门店分组
List<PowerStoreGroupDTO> storeGroupList = storeGroupService.getStoreGroupList(enterpriseId, null);
......@@ -313,16 +313,17 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
//组装门店的id
List<TabStoreRelation> ret = new ArrayList<>();
relationMapByWxEid.forEach((wxEid, groupIds) -> {
List<TabStoreRelation> midRelations = groupIds.stream().filter(mid -> storeGroupChainMap.containsKey(mid))
.flatMap(midGid -> storeGroupChainMap.get(midGid).stream())
.map(storeId -> {
//todo 销售线索 门店名称 企业id
TabStoreRelation tabStoreRelation = new TabStoreRelation();
List<TabStoreRelation> midRelations = groupIds.stream().filter(mid -> storeMapByGroupId.containsKey(mid))
.flatMap(midGid -> storeMapByGroupId.get(midGid).stream())
.map(storeId -> {
StoreSimpleDTO simpleDTO = storeIdMap.get(storeId);
TabStoreRelation tabStoreRelation = new TabStoreRelation();
tabStoreRelation.setWxEnterpriseId(wxEid);
tabStoreRelation.setStoreGroupId(storeIdMap.get(storeId));
tabStoreRelation.setStatusFlag(1);
tabStoreRelation.setStoreRelationId(ToolUtil.randomUUID());
tabStoreRelation.setStoreGroupId(simpleDTO.getStoreGroupId());
tabStoreRelation.setStatusFlag(1);
tabStoreRelation.setStoreName(simpleDTO.getStoreName());
tabStoreRelation.setEnterpriseId(simpleDTO.getEnterpriseId());
tabStoreRelation.setStoreRelationId(ToolUtil.randomUUID());
tabStoreRelation.setCreateTime(new Date());
tabStoreRelation.setUpdateTime(new Date());
return tabStoreRelation;
......
......@@ -609,4 +609,19 @@ public class WxEnterpriseController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1, retPage);
}
/**
* 绑定门店列表
*
* @param enterpriseId
* @return
*/
@IgnoreLogin
@RequestMapping("flush-bind-store-list")
public HaobanResponse flushBindStoreList(String enterpriseId) {
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
wxEnterpriseRelatedApiService.flushBindStoreByEnterpriseId(enterpriseId, wxEnterpriseId, login.getStaffDTO().getStaffId());
return resultResponse(HaoBanErrCode.ERR_1);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment