Commit f12759b2 by 陶光胜

删除域

parent 7aeb1118
......@@ -4,9 +4,13 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.download.utils.log.LogUtils;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.store.constant.StoreOwnTypeEnum;
import com.gic.store.dto.StoreDTO;
import com.gic.store.dto.StoreRegionDTO;
import com.gic.store.dto.StoreSearchDTO;
import com.gic.store.service.StoreApiService;
import com.gic.store.service.StoreRegionApiService;
import com.gic.store.web.qo.PageQO;
import com.gic.store.web.qo.region.StoreRegionQO;
......@@ -26,6 +30,8 @@ public class StoreRegionController {
@Autowired
private StoreRegionApiService storeRegionApiService;
@Autowired
private StoreApiService storeApiService;
@RequestMapping("/save-store-region")
public RestResponse saveStoreRegion(@Validated({StoreRegionQO.SaveValidView.class}) StoreRegionQO storeRegionQO) {
......@@ -64,6 +70,13 @@ public class StoreRegionController {
@RequestMapping("/del-region")
public RestResponse delRegion(Integer regionId){
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setRegionId(regionId);
Page<StoreDTO> result = this.storeApiService.listStore(storeSearchDTO, 1, 1).getResult();
if(result != null && result.getTotalCount() > 0){
return RestResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "门店域下存在门店,请先转移再删除");
}
ServiceResponse<Integer> response = this.storeRegionApiService.delRegion(enterpriseId, regionId);
return RestResponse.success(response.getResult());
}
......
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