Commit a2508fd8 by 陶光胜

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-store into developer

parents f16b50bf a1b24491
......@@ -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;
......
......@@ -3,6 +3,7 @@ package com.gic.store.web.controller;
import java.util.List;
import com.gic.download.utils.OperationResultUtils;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -70,26 +71,49 @@ public class StoreGroupController {
return OperationResultUtils.operationResult(result, "修改上级分组", OperationResultUtils.getOperationObject(result));
}
/**
* 新增子分组验证,是否是子节点且有门店
* @param groupLevel
* @param parentStoreGroupId
* @return
*/
@RequestMapping("/has-parent-store-group-store-when-save")
public RestResponse hasParentStoreGroupStoreWhenSave(Integer groupLevel, Integer parentStoreGroupId) {
return ResultControllerUtils.commonResult(storeGroupApiService.tipWhenSaveStoreGroup(groupLevel,
UserDetailUtils.getUserDetail().getEnterpriseId(), parentStoreGroupId));
}
/**
* 修改上级分组之前验证,上级分组ID是否是子节点且有门店
* @param parentStoreGroupId
* @return
*/
@RequestMapping("/has-parent-store-group-store")
public RestResponse hasParentStoreGroupStore(Integer parentStoreGroupId) {
return ResultControllerUtils.commonResult(storeGroupApiService.tipWhenUpdateParentId(parentStoreGroupId));
}
@RequestMapping("/drag-sort")
public RestResponse dragSort(@Validated({ StoreGroupQO.RemoveValidView.class,
StoreGroupQO.SetSortValueValidView.class }) StoreGroupQO storeGroupQO) {
ServiceResponse<String> result = storeGroupApiService.dragSort(storeGroupQO.getStoreGroupId(), storeGroupQO.getSortValue());
return OperationResultUtils.operationResult(
result, "拖拽排序门店分组", OperationResultUtils.getOperationObject(result));
ServiceResponse<String> result = storeGroupApiService.dragSort(storeGroupQO.getStoreGroupId(),
storeGroupQO.getSortValue());
return OperationResultUtils.operationResult(result, "拖拽排序门店分组",
OperationResultUtils.getOperationObject(result));
}
@RequestMapping("/sort")
public RestResponse sort(@Validated({ StoreGroupQO.SortValidView.class }) StoreGroupQO storeGroupQO) {
ServiceResponse<String> result = storeGroupApiService.sort(transferQoToDTO(storeGroupQO), storeGroupQO.isUp());
return OperationResultUtils.operationResult(
result, "上下排序门店分组", OperationResultUtils.getOperationObject(result));
return OperationResultUtils.operationResult(result, "上下排序门店分组",
OperationResultUtils.getOperationObject(result));
}
@RequestMapping("/remove")
public RestResponse remove(@Validated({ StoreGroupQO.RemoveValidView.class }) StoreGroupQO storeGroupQO) {
ServiceResponse<String> result = storeGroupApiService.remove(storeGroupQO.getStoreGroupId());
return OperationResultUtils.operationResult(
result, OperationResultUtils.LOG_DELETE+ "门店分组", OperationResultUtils.getOperationObject(result));
return OperationResultUtils.operationResult(result, OperationResultUtils.LOG_DELETE + "门店分组",
OperationResultUtils.getOperationObject(result));
}
private StoreGroupDTO transferQoToDTO(StoreGroupQO storeGroupQO) {
......
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