Commit b9ee895e by 何文超

enterpriseId去掉写死

parent d86c7024
package com.gic.plug.web.controller;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.plug.web.vo.StoreResourceVO;
import com.gic.store.dto.StoreWidgetDTO;
import com.gic.store.service.StoreWidgetApiService;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.constants.Constants;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.goods.api.util.Constant;
import com.gic.plug.web.strategy.init.StrategyInit;
import com.gic.plug.web.vo.StoreResourceVO;
import com.gic.search.business.api.constant.enums.OperateEnum;
import com.gic.store.dto.StoreWidgetDTO;
import com.gic.store.service.StoreWidgetApiService;
import com.gic.widget.screening.api.dto.EsScreeningChainDetailDTO;
import com.gic.widget.screening.api.dto.EsScreeningEnterpriseCategorySceneInfoDTO;
import com.gic.widget.screening.api.dto.EsScreeningTemplateDTO;
import com.gic.widget.screening.api.service.EsScreeningInitService;
import com.gic.widget.screening.api.service.EsScreeningTemplateService;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
*
......@@ -80,7 +79,8 @@ public class ScreeningController {
enterpriseId = Constants.INDEX_ENTERPRISEID;
}
if (Constant.ERP_GOODS_SCREEN.equals(sceneCode) || Constant.WEIMOB_GOODS_SCREEN.equals(sceneCode)) {
enterpriseId = "goods-test-" + Constant.TEST_ENTERPRISE_ID ;
//TODO
enterpriseId = "goods-test-1129";
}
List<EsScreeningEnterpriseCategorySceneInfoDTO> list = this.esScreeningInitService
.queryEsScreeningByEnterpriseAndScene(enterpriseId, sceneCode);
......
package com.gic.plug.web.controller.goods;
import com.gic.enterprise.base.EnterpriseInfo;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.mall.base.api.exception.GicMallException;
public class BaseController {
EnterpriseInfo getLoginEnterpriseInfo() {
EnterpriseInfo enterpriseInfo = UserDetailUtils.getUserDetail().getEnterpriseInfo();
if (enterpriseInfo == null) {
throw new GicMallException("未登录");
}
return enterpriseInfo;
}
Integer getEnterpriseId() {
return getLoginEnterpriseInfo().getEnterpriseId();
}
}
package com.gic.plug.web.controller.goods;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
......@@ -23,9 +14,17 @@ import com.gic.goods.api.service.BrandApiService;
import com.gic.goods.api.service.GoodsRightsSelectorApiService;
import com.gic.goods.api.util.Constant;
import com.gic.plug.web.vo.goods.GoodsBrandVO;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@RestController
public class GoodsBrandController {
public class GoodsBrandController extends BaseController {
@Autowired
private BrandApiService brandApiService;
......@@ -37,8 +36,9 @@ public class GoodsBrandController {
public RestResponse goodsBrandList(int pageSize, int currentPage, String search, Long goodsDomainId, String channelCode) {
Long resourceId = UserDetailUtils.getUserDetail().getUserResourceInfo() == null ? null :
UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId();
ServiceResponse<GoodsRightsSelectorDTO> selectorDTOServiceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(resourceId,
Constant.TEST_ENTERPRISE_ID, UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
ServiceResponse<GoodsRightsSelectorDTO> selectorDTOServiceResponse = goodsRightsSelectorApiService
.getGoodsRightsSelector(resourceId, getEnterpriseId()
, UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
if (!selectorDTOServiceResponse.isSuccess() || selectorDTOServiceResponse.getResult() == null ||
selectorDTOServiceResponse.getResult().getHasRights() == Constant.NO) {
return RestResponse.success(Collections.EMPTY_LIST);
......@@ -60,7 +60,7 @@ public class GoodsBrandController {
}
}
}
return findBrandListByParams(currentPage, pageSize,goodsDomainId, search, Constant.TEST_ENTERPRISE_ID);
return findBrandListByParams(currentPage, pageSize,goodsDomainId, search, getEnterpriseId());
}
......@@ -74,7 +74,7 @@ public class GoodsBrandController {
*/
@RequestMapping("/goods-brand-list-for-rights")
public RestResponse goodsBrandListForRights(int pageSize, int currentPage, String search, Long goodsDomainId) {
return findBrandListByParams(currentPage, pageSize,goodsDomainId, search, Constant.TEST_ENTERPRISE_ID);
return findBrandListByParams(currentPage, pageSize,goodsDomainId, search, getEnterpriseId());
}
private RestResponse findBrandListByParams(int currentPage, int pageSize, Long goodsDomainId, String search, Integer enterpriseId) {
......
package com.gic.plug.web.controller.goods;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.goods.api.dto.CategoryDTO;
import com.gic.goods.api.dto.ErrorCode;
import com.gic.goods.api.service.CategoryApiService;
import com.gic.goods.api.util.Constant;
import com.gic.plug.web.vo.goods.CategoryVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class GoodsCategoryController {
public class GoodsCategoryController extends BaseController {
@Autowired
private CategoryApiService categoryApiSerivce;
......@@ -33,7 +31,7 @@ public class GoodsCategoryController {
if (goodsDomainId == null || StringUtils.isBlank(channelCode)) {
return RestResponse.failure(ErrorCode.UNKNOW_ERROR.getCode(), "参数不全");
}
ServiceResponse<List<CategoryDTO>> serviceResponse = categoryApiSerivce.listParentAll(channelCode, goodsDomainId, null, Constant.TEST_ENTERPRISE_ID);
ServiceResponse<List<CategoryDTO>> serviceResponse = categoryApiSerivce.listParentAll(channelCode, goodsDomainId, null, getEnterpriseId());
List<CategoryDTO> result = serviceResponse.getResult();
if (CollectionUtils.isEmpty(result)) {
return RestResponse.success();
......@@ -52,7 +50,7 @@ public class GoodsCategoryController {
if (specParentId == null || StringUtils.isBlank(channelCode)) {
return RestResponse.failure(ErrorCode.UNKNOW_ERROR.getCode(), "参数不全");
}
ServiceResponse<List<CategoryDTO>> serviceResponse = categoryApiSerivce.listChildAll(channelCode, specParentId, null, Constant.TEST_ENTERPRISE_ID);
ServiceResponse<List<CategoryDTO>> serviceResponse = categoryApiSerivce.listChildAll(channelCode, specParentId, null, getEnterpriseId());
List<CategoryDTO> result = serviceResponse.getResult();
if (CollectionUtils.isEmpty(result)) {
return RestResponse.success();
......
package com.gic.plug.web.controller.goods;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.curator.shaded.com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.goods.api.dto.GoodsSkuDTO;
import com.gic.goods.api.service.GoodsApiService;
import com.gic.goods.api.util.Constant;
import com.gic.plug.web.vo.goods.GoodsVO;
import com.gic.search.business.api.constant.enums.OperateEnum;
import com.gic.search.business.api.dto.DynamicSearchDTO;
......@@ -25,6 +13,16 @@ import com.gic.search.business.api.dto.ESResponseQueryBatchDTO;
import com.gic.search.business.api.service.EsBusinessOperaApiService;
import com.gic.search.business.api.utils.QueryConditionAssemblyUtil;
import com.gic.widget.screening.api.service.EsScreeningSearchService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.curator.shaded.com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @ClassName: GoodsTagController
......@@ -33,7 +31,7 @@ import com.gic.widget.screening.api.service.EsScreeningSearchService;
* @date 2019/8/29 上午10:03
*/
@RestController
public class GoodsController {
public class GoodsController extends BaseController {
@Autowired
private EsBusinessOperaApiService esBusinessOperaApiService;
......@@ -87,7 +85,7 @@ public class GoodsController {
}
//2、获取商品ID信息
List<Long> goodsIds = goodsVOS.stream().mapToLong(GoodsVO::getGoodsId).boxed().collect(Collectors.toList());
ServiceResponse<List<GoodsSkuDTO>> skuResponse = goodsApiService.listSku(goodsIds, channelCode, Constant.TEST_ENTERPRISE_ID);
ServiceResponse<List<GoodsSkuDTO>> skuResponse = goodsApiService.listSku(goodsIds, channelCode, getEnterpriseId());
if (!skuResponse.isSuccess()) {
return RestResponse.failure(skuResponse.getCode(), skuResponse.getMessage());
......
package com.gic.plug.web.controller.goods;
import java.util.*;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse;
......@@ -19,9 +12,15 @@ import com.gic.goods.api.service.GoodsRightsSelectorApiService;
import com.gic.goods.api.util.Constant;
import com.gic.plug.web.vo.goods.GoodsChannelVO;
import com.gic.plug.web.vo.goods.GoodsDomainVO;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
@RestController
public class GoodsDomainController {
public class GoodsDomainController extends BaseController {
@Autowired
private GoodsDomainApiService goodsDomainApiService;
......@@ -38,7 +37,7 @@ public class GoodsDomainController {
*/
@RequestMapping("/get-all-goods-domain-list-for-rights")
public RestResponse getAllGoodsDomainListForRights() {
ServiceResponse<List<GoodsDomainDTO>> serviceResponse = goodsDomainApiService.listAll(Constant.TEST_ENTERPRISE_ID, null);
ServiceResponse<List<GoodsDomainDTO>> serviceResponse = goodsDomainApiService.listAll(getEnterpriseId(), null);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
......@@ -57,12 +56,12 @@ public class GoodsDomainController {
Long resourceId = UserDetailUtils.getUserDetail().getUserResourceInfo() == null ? null :
UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId();
ServiceResponse<GoodsRightsSelectorDTO> selectorDTOServiceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(resourceId,
Constant.TEST_ENTERPRISE_ID, UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
getEnterpriseId(), UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
if (!selectorDTOServiceResponse.isSuccess() || selectorDTOServiceResponse.getResult() == null ||
selectorDTOServiceResponse.getResult().getHasRights() == Constant.NO) {
return RestResponse.success(Collections.EMPTY_LIST);
}
ServiceResponse<List<GoodsDomainDTO>> serviceResponse = goodsDomainApiService.listAll(Constant.TEST_ENTERPRISE_ID, null);
ServiceResponse<List<GoodsDomainDTO>> serviceResponse = goodsDomainApiService.listAll(getEnterpriseId(), null);
// 是否最高权限
boolean isHighestRights = true;
JSONObject json = null;
......
package com.gic.plug.web.controller.goods;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.contants.SortType;
......@@ -19,9 +12,15 @@ import com.gic.goods.api.service.PropertyValueApiService;
import com.gic.goods.api.util.Constant;
import com.gic.plug.web.vo.goods.GoodsPropertyVO;
import com.gic.plug.web.vo.goods.GoodsPropertyValueVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@RestController
public class GoodsPropertyController {
public class GoodsPropertyController extends BaseController {
@Autowired
private PropertyApiService propertyApiService;
......@@ -38,7 +37,7 @@ public class GoodsPropertyController {
arrayList.add(Constant.PROPERTY_TYPE_PERCENT);
arrayList.add(Constant.PROPERTY_TYPE_NUM);
arrayList.add(Constant.PROPERTY_TYPE_REAL_NUM);
ServiceResponse<Page<FullPropertyDTO>> serviceResponse = propertyApiService.findPropertyExceptType(currentPage, pageSize, goodsDomainId, arrayList,search, Constant.TEST_ENTERPRISE_ID);
ServiceResponse<Page<FullPropertyDTO>> serviceResponse = propertyApiService.findPropertyExceptType(currentPage, pageSize, goodsDomainId, arrayList,search, getEnterpriseId());
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
......@@ -49,7 +48,7 @@ public class GoodsPropertyController {
@RequestMapping("/property-value-list")
public RestResponse propertyValueList(int pageSize, int currentPage, String search, Long specPropertyId) {
ServiceResponse<Page<PropertyValueDTO>> serviceResponse = propertyValueApiService
.pagePropertyValue(currentPage, pageSize, specPropertyId, search, SortType.sortDescType, Constant.TEST_ENTERPRISE_ID);
.pagePropertyValue(currentPage, pageSize, specPropertyId, search, SortType.sortDescType, getEnterpriseId());
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
......
package com.gic.plug.web.controller.goods;
import com.gic.enterprise.utils.UserDetailUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.goods.api.dto.GoodsRightsSelectorDTO;
import com.gic.goods.api.service.GoodsRightsSelectorApiService;
import com.gic.goods.api.util.Constant;
import com.gic.plug.web.qo.goods.GoodsRightsSelectorSaveQO;
import com.gic.plug.web.qo.goods.GoodsRightsSelectorUpdateQO;
import com.gic.plug.web.vo.goods.GoodsRightsSelectorVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GoodsRightsSelectorController {
public class GoodsRightsSelectorController extends BaseController {
@Autowired
private GoodsRightsSelectorApiService goodsRightsSelectorApiService;
......@@ -35,7 +34,7 @@ public class GoodsRightsSelectorController {
if (goodsRightsSelectorDTO.getHasRights() == null) {
goodsRightsSelectorDTO.setHasRights(Constant.NO);
}
goodsRightsSelectorDTO.setEnterpriseId(Constant.TEST_ENTERPRISE_ID);
goodsRightsSelectorDTO.setEnterpriseId(getEnterpriseId());
ServiceResponse<GoodsRightsSelectorDTO> serviceResponse = goodsRightsSelectorApiService.saveGoodsRightsSelector(goodsRightsSelectorDTO);
if (serviceResponse.isSuccess()) {
goodsRightsSelectorDTO = serviceResponse.getResult();
......@@ -58,7 +57,7 @@ public class GoodsRightsSelectorController {
if (goodsRightsSelectorDTO.getHasRights() == null) {
goodsRightsSelectorDTO.setHasRights(Constant.NO);
}
goodsRightsSelectorDTO.setEnterpriseId(Constant.TEST_ENTERPRISE_ID);
goodsRightsSelectorDTO.setEnterpriseId(getEnterpriseId());
ServiceResponse<GoodsRightsSelectorDTO> serviceResponse = goodsRightsSelectorApiService.showGoodsRightsSelectorResult(goodsRightsSelectorDTO);
if (serviceResponse.isSuccess()) {
goodsRightsSelectorDTO = serviceResponse.getResult();
......@@ -70,7 +69,7 @@ public class GoodsRightsSelectorController {
@RequestMapping("/goods-rights-selector-update")
public RestResponse goodsRightsSelectorSave(GoodsRightsSelectorUpdateQO goodsRightsSelectorUpdateQO) {
GoodsRightsSelectorDTO goodsRightsSelectorDTO = EntityUtil.changeEntityByOrika(GoodsRightsSelectorDTO.class, goodsRightsSelectorUpdateQO);
goodsRightsSelectorDTO.setEnterpriseId(Constant.TEST_ENTERPRISE_ID);
goodsRightsSelectorDTO.setEnterpriseId(getEnterpriseId());
ServiceResponse<GoodsRightsSelectorDTO> serviceResponse = goodsRightsSelectorApiService.updateGoodsRightsSelector(goodsRightsSelectorDTO);
if (serviceResponse.isSuccess()) {
goodsRightsSelectorDTO = serviceResponse.getResult();
......@@ -82,7 +81,7 @@ public class GoodsRightsSelectorController {
@RequestMapping("/get-goods-rights-selector")
public RestResponse getGoodsRightsSelector(Long goodsRightsSelectorId) {
ServiceResponse<GoodsRightsSelectorDTO> serviceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(goodsRightsSelectorId,
Constant.TEST_ENTERPRISE_ID, UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
getEnterpriseId(), UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
if (serviceResponse.isSuccess()) {
GoodsRightsSelectorDTO goodsRightsSelectorDTO = serviceResponse.getResult();
return RestResponse.success(EntityUtil.changeEntityByOrika(GoodsRightsSelectorVO.class, goodsRightsSelectorDTO));
......
package com.gic.plug.web.controller.goods;
import com.alibaba.fastjson.JSONObject;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
......@@ -15,14 +8,18 @@ import com.gic.goods.api.dto.GoodsRightsSelectorDTO;
import com.gic.goods.api.dto.GoodsSelectorDTO;
import com.gic.goods.api.service.GoodsRightsSelectorApiService;
import com.gic.goods.api.service.GoodsSelectorApiService;
import com.gic.goods.api.util.Constant;
import com.gic.mall.base.api.enums.ErrorCodeEnums;
import com.gic.plug.web.qo.goods.GoodsSelectorSaveQO;
import com.gic.plug.web.qo.goods.GoodsSelectorUpdateQO;
import com.gic.plug.web.vo.goods.GoodsSelectorVO;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GoodsSelectorController {
public class GoodsSelectorController extends BaseController {
@Autowired
private GoodsSelectorApiService goodsSelectorApiService;
......@@ -34,7 +31,7 @@ public class GoodsSelectorController {
@RequestMapping("goods-selector-show-back")
public RestResponse goodsSelectorShowBack(Long goodsSelectorId) {
ServiceResponse<GoodsSelectorDTO> serviceResponse = goodsSelectorApiService.getGoodsSelector(goodsSelectorId, Constant.TEST_ENTERPRISE_ID);
ServiceResponse<GoodsSelectorDTO> serviceResponse = goodsSelectorApiService.getGoodsSelector(goodsSelectorId, getEnterpriseId());
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult().getGoodsSearchValue());
}
......@@ -43,7 +40,7 @@ public class GoodsSelectorController {
@RequestMapping("get-goods-selector")
public RestResponse getGoodsSelector(Long goodsSelectorId) {
ServiceResponse<GoodsSelectorDTO> serviceResponse = goodsSelectorApiService.getGoodsSelector(goodsSelectorId, Constant.TEST_ENTERPRISE_ID);
ServiceResponse<GoodsSelectorDTO> serviceResponse = goodsSelectorApiService.getGoodsSelector(goodsSelectorId, getEnterpriseId());
if (serviceResponse.isSuccess()) {
GoodsSelectorVO goodsSelectorVO = EntityUtil.changeEntityByOrika(GoodsSelectorVO.class, serviceResponse.getResult());
return RestResponse.success(goodsSelectorVO);
......@@ -54,7 +51,7 @@ public class GoodsSelectorController {
@RequestMapping("goods-selector-edit-show-back")
public RestResponse goodsSelectorEditShowBack(Long goodsSelectorId) {
ServiceResponse<GoodsSelectorDTO> serviceResponse = goodsSelectorApiService.getGoodsSelector(goodsSelectorId, Constant.TEST_ENTERPRISE_ID);
ServiceResponse<GoodsSelectorDTO> serviceResponse = goodsSelectorApiService.getGoodsSelector(goodsSelectorId, getEnterpriseId());
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult().getGoodsSearchEdit());
}
......@@ -64,11 +61,11 @@ public class GoodsSelectorController {
@RequestMapping("goods-selector-save")
public RestResponse goodsSelectorSave(GoodsSelectorSaveQO goodsSelectorSaveQO) {
GoodsSelectorDTO goodsSelectorDTO = EntityUtil.changeEntityByOrika(GoodsSelectorDTO.class, goodsSelectorSaveQO);
goodsSelectorDTO.setEnterpriseId(Constant.TEST_ENTERPRISE_ID);
goodsSelectorDTO.setEnterpriseId(getEnterpriseId());
Long resourceId = UserDetailUtils.getUserDetail().getUserResourceInfo() == null ? null :
UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId();
ServiceResponse<GoodsRightsSelectorDTO> goodsRightsSelectorDTOServiceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(resourceId,
Constant.TEST_ENTERPRISE_ID, UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
getEnterpriseId(), UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
if (!goodsRightsSelectorDTOServiceResponse.isSuccess()) {
return RestResponse.failure(goodsRightsSelectorDTOServiceResponse.getCode(), goodsRightsSelectorDTOServiceResponse.getMessage());
}
......@@ -88,11 +85,11 @@ public class GoodsSelectorController {
@RequestMapping("goods-selector-show")
public RestResponse goodsSelectorShow(GoodsSelectorSaveQO goodsSelectorSaveQO) {
GoodsSelectorDTO goodsSelectorDTO = EntityUtil.changeEntityByOrika(GoodsSelectorDTO.class, goodsSelectorSaveQO);
goodsSelectorDTO.setEnterpriseId(Constant.TEST_ENTERPRISE_ID);
goodsSelectorDTO.setEnterpriseId(getEnterpriseId());
Long resourceId = UserDetailUtils.getUserDetail().getUserResourceInfo() == null ? null :
UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId();
ServiceResponse<GoodsRightsSelectorDTO> goodsRightsSelectorDTOServiceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(resourceId,
Constant.TEST_ENTERPRISE_ID, UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
getEnterpriseId(), UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
if (!goodsRightsSelectorDTOServiceResponse.isSuccess()) {
return RestResponse.failure(goodsRightsSelectorDTOServiceResponse.getCode(), goodsRightsSelectorDTOServiceResponse.getMessage());
}
......@@ -115,7 +112,7 @@ public class GoodsSelectorController {
if (goodsSelectorId == null) {
Long resourceId = UserDetailUtils.getUserDetail().getUserResourceInfo() == null ? null:UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId();
ServiceResponse<GoodsRightsSelectorDTO> serviceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(resourceId,
Constant.TEST_ENTERPRISE_ID, UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
getEnterpriseId(), UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
if (serviceResponse.getResult() == null) {
return RestResponse.failure(ErrorCodeEnums.MAll_ERR.getCode(), "没有权限");
}
......@@ -128,7 +125,7 @@ public class GoodsSelectorController {
Long resourceId = UserDetailUtils.getUserDetail().getUserResourceInfo() == null ? null :
UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId();
ServiceResponse<GoodsRightsSelectorDTO> goodsRightsSelectorDTOServiceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(resourceId,
Constant.TEST_ENTERPRISE_ID, UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
getEnterpriseId(), UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin());
if (!goodsRightsSelectorDTOServiceResponse.isSuccess()) {
return RestResponse.failure(goodsRightsSelectorDTOServiceResponse.getCode(), goodsRightsSelectorDTOServiceResponse.getMessage());
}
......@@ -141,7 +138,7 @@ public class GoodsSelectorController {
}
GoodsRightsSelectorDTO goodsRightsSelectorDTO = goodsRightsSelectorDTOServiceResponse.getResult();
ServiceResponse<GoodsSelectorDTO> serviceResponse = goodsSelectorApiService.updateGoodsSelectorRights(goodsSelectorId,
goodsRightsSelectorDTO.getGoodsRightsSearchText(), goodsRightsSelectorDTO.getGoodsRightsSearchValue(), goodsRightsSelectorDTO.getHasRights(), Constant.TEST_ENTERPRISE_ID);
goodsRightsSelectorDTO.getGoodsRightsSearchText(), goodsRightsSelectorDTO.getGoodsRightsSearchValue(), goodsRightsSelectorDTO.getHasRights(), getEnterpriseId());
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
......@@ -153,7 +150,7 @@ public class GoodsSelectorController {
@RequestMapping("goods-selector-update")
public RestResponse goodsSelectorUpdate(GoodsSelectorUpdateQO goodsSelectorUpdateQO) {
GoodsSelectorDTO goodsSelectorDTO = EntityUtil.changeEntityByOrika(GoodsSelectorDTO.class, goodsSelectorUpdateQO);
goodsSelectorDTO.setEnterpriseId(Constant.TEST_ENTERPRISE_ID);
goodsSelectorDTO.setEnterpriseId(getEnterpriseId());
ServiceResponse<GoodsSelectorDTO> serviceResponse = goodsSelectorApiService.updateGoodsSelector(goodsSelectorDTO);
if (serviceResponse.isSuccess()) {
goodsSelectorDTO = serviceResponse.getResult();
......
package com.gic.plug.web.controller.goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.contants.SortType;
......@@ -15,13 +11,15 @@ import com.gic.goods.api.dto.StandardValueGroupDTO;
import com.gic.goods.api.service.StandardApiService;
import com.gic.goods.api.service.StandardValueApiService;
import com.gic.goods.api.service.StandardValueGroupApiService;
import com.gic.goods.api.util.Constant;
import com.gic.plug.web.vo.goods.GoodsStandardVO;
import com.gic.plug.web.vo.goods.GoodsStandardValueGroupVO;
import com.gic.plug.web.vo.goods.GoodsStandardValueVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GoodsStandardController {
public class GoodsStandardController extends BaseController {
@Autowired
private StandardApiService standardApiService;
......@@ -34,7 +32,7 @@ public class GoodsStandardController {
@RequestMapping("/list-standard")
public RestResponse listStandard(int currentPage, int pageSize, String search, Long goodsDomainId) {
ServiceResponse<Page<StandardDTO>> serviceResponse = standardApiService.listByPage(currentPage, pageSize, goodsDomainId, search, Constant.TEST_ENTERPRISE_ID);
ServiceResponse<Page<StandardDTO>> serviceResponse = standardApiService.listByPage(currentPage, pageSize, goodsDomainId, search, getEnterpriseId());
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
......@@ -46,7 +44,7 @@ public class GoodsStandardController {
@RequestMapping("/list-standard-value-group")
public RestResponse listStandardValueGroup(int currentPage, int pageSize, Long specStandardId, String search) {
ServiceResponse<Page<StandardValueGroupDTO>> serviceResponse =
standardValueGroupApiService.listByPage(currentPage, pageSize, specStandardId, search, SortType.sortDescType, Constant.TEST_ENTERPRISE_ID);
standardValueGroupApiService.listByPage(currentPage, pageSize, specStandardId, search, SortType.sortDescType, getEnterpriseId());
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
......@@ -57,7 +55,7 @@ public class GoodsStandardController {
@RequestMapping("/list-standard-value")
public RestResponse listStandardValue(int currentPage, int pageSize, Long specStandardId, String search, Long specStandardValueGroupId) {
ServiceResponse<Page<StandardValueDTO>> serviceResponse =
standardValueApiService.listByPage(currentPage, pageSize, specStandardId, search, SortType.sortDescType, specStandardValueGroupId, Constant.TEST_ENTERPRISE_ID);
standardValueApiService.listByPage(currentPage, pageSize, specStandardId, search, SortType.sortDescType, specStandardValueGroupId, getEnterpriseId());
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
......
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