Commit 37d4dcbe by 陶光胜

门店品牌变更

parent 4817d2a3
......@@ -109,10 +109,11 @@ public interface StoreRegionApiService {
* @param ownerEnterpriseId 原商户
* @param unionEnterpriseId 被授权商户
* @param storeRegionIdList
* @param authType 1表示重新授权 0正常授权
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<Integer> authorizeRegionToOther(Integer ownerEnterpriseId, Integer unionEnterpriseId, List<Integer> storeRegionIdList);
ServiceResponse<Integer> authorizeRegionToOther(Integer ownerEnterpriseId, Integer unionEnterpriseId, List<Integer> storeRegionIdList, Integer authType);
/**
* 收回授权
......
......@@ -85,7 +85,7 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
} else {
this.unionEnterpriseAuthResDetailApiService.unionForStore(UnionEnterpriseAuthDetailStatusEnum.RESOURCE_DEALING.getCode(), ownEnterpriseId, unionEnterpriseId, key, "资源授权中");
}
this.queryStoreByPage(count, storeSearchDTO, unionEnterpriseId, ownEnterpriseId, key);
this.queryStoreByPage(count, storeSearchDTO, unionEnterpriseId, ownEnterpriseId, key, 0);
return ServiceResponse.success();
}
......@@ -102,7 +102,7 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(toEnterpriseId);
storeSearchDTO.setStoreInfoIds(storeInfoIds.toString());
this.queryStoreByPage(Long.valueOf(list.size()+""), storeSearchDTO, toEnterpriseId, fromEnterpriseId, key);
this.queryStoreByPage(Long.valueOf(list.size()+""), storeSearchDTO, toEnterpriseId, fromEnterpriseId, key, 1);
}
return ServiceResponse.success();
}
......@@ -176,7 +176,7 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
return ServiceResponse.success();
}
private void queryStoreByPage(Long count, StoreSearchDTO storeSearchDTO, Integer unionEnterpriseId, Integer ownEnterpriseId, String key){
private void queryStoreByPage(Long count, StoreSearchDTO storeSearchDTO, Integer unionEnterpriseId, Integer ownEnterpriseId, String key, Integer authType){
int pages = count/ PAGE_SIZE + count % PAGE_SIZE >0 ? 1 : 0;
/**需要共享的域*/
Set<Integer> regionSet = new HashSet<>();
......@@ -217,7 +217,7 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
}
}
}
this.authRegionStatusStoreType(regionSet, storeStatusSet, storeTypeSet, storeInfoIdSet, storeBrandIdSet, ownEnterpriseId, unionEnterpriseId);
this.authRegionStatusStoreType(regionSet, storeStatusSet, storeTypeSet, storeInfoIdSet, storeBrandIdSet, ownEnterpriseId, unionEnterpriseId, authType);
}
private void sendDataToMq(StoreDTO storeDTO, Integer toEnterpriseId, int isEnd, String key, int total){
......@@ -237,8 +237,8 @@ public class StoreAuthorizationApiServiceImpl implements StoreAuthorizationApiSe
}
private void authRegionStatusStoreType(Set<Integer> regionSet, Set<String> statusSet, Set<String> storeTypeSet,
Set<Integer> storeInfoIdSet, Set<Integer> storeBrandIdSet, Integer enterpriseId, Integer toEnterpriseId){
this.storeRegionApiService.authorizeRegionToOther(enterpriseId, toEnterpriseId, new ArrayList<>(regionSet));
Set<Integer> storeInfoIdSet, Set<Integer> storeBrandIdSet, Integer enterpriseId, Integer toEnterpriseId, Integer authType){
this.storeRegionApiService.authorizeRegionToOther(enterpriseId, toEnterpriseId, new ArrayList<>(regionSet), authType);
this.storeDictApiService.saveStoreStatusAndStoreType(enterpriseId, statusSet.toArray(new String[0]), storeTypeSet.toArray(new String[0]));
this.storeBrandService.saveStoreBrandRef(toEnterpriseId, new ArrayList<>(storeBrandIdSet), 2);
if(CollectionUtils.isNotEmpty(storeInfoIdSet)){
......
......@@ -132,7 +132,8 @@ public class StoreRegionApiServiceImpl implements StoreRegionApiService {
}
@Override
public ServiceResponse<Integer> authorizeRegionToOther(Integer ownerEnterpriseId, Integer unionEnterpriseId, List<Integer> newStoreRegionIdList) {
public ServiceResponse<Integer> authorizeRegionToOther(Integer ownerEnterpriseId, Integer unionEnterpriseId,
List<Integer> newStoreRegionIdList, Integer authType) {
if (newStoreRegionIdList == null) {
newStoreRegionIdList = Collections.emptyList();
}
......@@ -148,7 +149,7 @@ public class StoreRegionApiServiceImpl implements StoreRegionApiService {
Set<Integer> newRelSet = new HashSet<>(newStoreRegionIdList);
// 要删除的关联
List<Integer> delRelList = oldRelIdList.stream().filter(e -> !newRelSet.contains(e)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(delRelList)) {
if (CollectionUtils.isNotEmpty(delRelList) && authType != 1) { //重新授权时不需要删除门店域
storeRegionRelService.delByRegionIds(unionEnterpriseId, delRelList, StoreOwnTypeEnum.OTHER.getCode());
}
for (Integer regionId : newStoreRegionIdList) {
......
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