Commit 6c83feb8 by guojuxing

门店分组是否是叶子结点修改

parent 4df87325
......@@ -77,7 +77,7 @@ public class StoreGroupApiServiceImpl implements StoreGroupApiService {
storeGroupChain.setStoreGroupId(storeGroupId);
storeGroupChain.setStoreGroupChain(getStoreGroupChain(storeGroupId));
storeGroupService.update(storeGroupChain);
boolean needTransferStore = isNeedTransferStore(storeGroupDTO.getParentStoreGroupId());
boolean needTransferStore = isNeedTransferStoreWhenNew(storeGroupDTO.getParentStoreGroupId());
logger.info("needTransferStore:{}", needTransferStore);
if (needTransferStore) {
//转移门店
......@@ -188,7 +188,7 @@ public class StoreGroupApiServiceImpl implements StoreGroupApiService {
} else {
return ServiceResponse.failure(parentIdWhenNew.getCode(), parentIdWhenNew.getMessage());
}
return ServiceResponse.success(isNeedTransferStore(parentStoreGroupId));
return ServiceResponse.success(isNeedTransferStoreWhenNew(parentStoreGroupId));
}
@Override
......@@ -419,7 +419,7 @@ public class StoreGroupApiServiceImpl implements StoreGroupApiService {
* @param parentStoreGroupId
* @return
*/
private boolean isNeedTransferStore(Integer parentStoreGroupId) {
private boolean isNeedTransferStoreWhenNew(Integer parentStoreGroupId) {
if (storeGroupService.isLeafNodeWhenNewStoreGroup(parentStoreGroupId)
&& isContainStore(parentStoreGroupId)) {
return true;
......@@ -428,6 +428,20 @@ public class StoreGroupApiServiceImpl implements StoreGroupApiService {
}
}
/**
* 是否需要转移门店 判断上级门店是否是子节点,并且是否有门店
* @param parentStoreGroupId
* @return
*/
private boolean isNeedTransferStore(Integer parentStoreGroupId) {
if (storeGroupService.isLeafNode(parentStoreGroupId)
&& isContainStore(parentStoreGroupId)) {
return true;
} else {
return false;
}
}
private boolean isContainStore(int storeGroupId) {
Integer result = storeService.countByGroupId(storeGroupId);
if (result == null || result < 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