Commit e9bfa290 by guojuxing

门店分组如果上级分组是子节点且下面有门店,则提示

parent 2341841d
......@@ -35,6 +35,28 @@ public interface StoreGroupApiService {
ServiceResponse<String> update(StoreGroupDTO storeGroupDTO);
/**
* 修改上级分组之前验证,上级分组ID是否是子节点且有门店
* @Title: tipWhenUpdateParentId

* @Description:

* @author guojuxing
* @param parentStoreGroupId

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Boolean>


*/
ServiceResponse<Boolean> tipWhenUpdateParentId(Integer parentStoreGroupId);
/**
* 新增子分组验证,是否是子节点且有门店
* @Title: tipWhenSaveStoreGroup

* @Description:

* @author guojuxing
* @param groupLevel
* @param enterpriseId
* @param parentStoreGroupId

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Boolean>


*/
ServiceResponse<Boolean> tipWhenSaveStoreGroup(Integer groupLevel, Integer enterpriseId, Integer parentStoreGroupId);
/**
* 编辑名称
* @Title: updateStoreGroupName

* @Description:
......
......@@ -73,7 +73,7 @@ public class StoreGroupApiServiceImpl implements StoreGroupApiService {
storeGroupChain.setStoreGroupChain(getStoreGroupChain(storeGroupId));
storeGroupService.update(storeGroupChain);
if (isNeedTransferStore(storeGroupDTO)) {
if (isNeedTransferStore(storeGroupDTO.getParentStoreGroupId())) {
//转移门店
storeService.updateGroupId(storeGroupDTO.getParentStoreGroupId(), storeGroupId);
}
......@@ -143,7 +143,7 @@ public class StoreGroupApiServiceImpl implements StoreGroupApiService {
storeGroupService.update(tabStoreGroup);
//如果上级分组有门店,则新建一个未分组数据,然后把所有门店放进去
if (isNeedTransferStore(storeGroupDTO)) {
if (isNeedTransferStore(storeGroupParentId)) {
StoreGroupDTO noStoreGroup = new StoreGroupDTO();
noStoreGroup.setEnterpriseId(storeGroupDTO.getEnterpriseId());
noStoreGroup.setGroupLevel(oldStoreGroup.getGroupLevel());
......@@ -164,6 +164,23 @@ public class StoreGroupApiServiceImpl implements StoreGroupApiService {
}
@Override
public ServiceResponse<Boolean> tipWhenUpdateParentId(Integer parentStoreGroupId) {
return ServiceResponse.success(isNeedTransferStore(parentStoreGroupId));
}
@Override
public ServiceResponse<Boolean> tipWhenSaveStoreGroup(Integer groupLevel, Integer enterpriseId, Integer parentStoreGroupId) {
//父级ID
ServiceResponse<Integer> parentIdWhenNew = getParentIdWhenNew(groupLevel, enterpriseId, parentStoreGroupId);
if (parentIdWhenNew.isSuccess()) {
parentStoreGroupId = parentIdWhenNew.getResult();
} else {
return ServiceResponse.failure(parentIdWhenNew.getCode(), parentIdWhenNew.getMessage());
}
return ServiceResponse.success(isNeedTransferStore(parentStoreGroupId));
}
@Override
public ServiceResponse<Integer> updateStoreGroupName(StoreGroupDTO storeGroupDTO) {
if (storeGroupDTO.getStoreGroupId() == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "主键不能为空");
......@@ -366,12 +383,12 @@ public class StoreGroupApiServiceImpl implements StoreGroupApiService {
/**
* 是否需要转移门店,新增门店,判断上级门店是否是子节点,并且是否有门店
* @param storeGroupDTO
* @param parentStoreGroupId
* @return
*/
private boolean isNeedTransferStore(StoreGroupDTO storeGroupDTO) {
if (storeGroupService.isLeafNode(storeGroupDTO.getParentStoreGroupId())
&& isContainStore(storeGroupDTO.getStoreGroupId())) {
private boolean isNeedTransferStore(Integer parentStoreGroupId) {
if (storeGroupService.isLeafNode(parentStoreGroupId)
&& isContainStore(parentStoreGroupId)) {
return true;
} else {
return false;
......
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