Commit b98a396c by 陶光胜

Merge branch 'developer' of…

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

 Conflicts:
	src/main/java/com/gic/plug/web/controller/ScreeningController.java
parents 43292f96 48e709e1
......@@ -25,17 +25,34 @@ 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;
/**
*
......@@ -88,7 +105,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 java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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.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;
......@@ -37,12 +22,26 @@ 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 com.google.common.base.Joiner;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 商城装修选择器
*/
@RestController
public class AppletConfigGoodsController {
public class AppletConfigGoodsController extends BaseGoodsController {
@Autowired
private CordApiService cordApiService;
......@@ -85,7 +84,7 @@ public class AppletConfigGoodsController {
}
areaId = shopDTOServiceResponse.getResult().getAreaId();
}
ServiceResponse<List<SpecCordDTO>> listServiceResponse = cordApiService.listSpecCordDTO(areaId);
ServiceResponse<List<SpecCordDTO>> listServiceResponse = cordApiService.listSpecCordDTO(areaId, getEnterpriseId());
return RestResponse
.success(EntityUtil.changeEntityListByOrika(MallGoodsCordVO.class, listServiceResponse.getResult()));
}
......@@ -124,7 +123,7 @@ public class AppletConfigGoodsController {
}
JSONObject cordJSON = null;
if (cordId != null) {
ServiceResponse<List<GoodsCordDTO>> serviceResponse = cordApiService.listChildAll(cordId);
ServiceResponse<List<GoodsCordDTO>> serviceResponse = cordApiService.listChildAll(cordId, getEnterpriseId());
List<Long> cordList = new ArrayList<>();
for (GoodsCordDTO goodsCord : serviceResponse.getResult()) {
cordList.add(goodsCord.getSpecCordId());
......@@ -240,9 +239,12 @@ public class AppletConfigGoodsController {
OperateEnum.OPERATE_LIKE, search);
JSONObject goodsNameJson = QueryConditionAssemblyUtil.createSimpleQueryNode("goodsName",
OperateEnum.OPERATE_LIKE, search);
JSONObject goodsBarCodeJson = QueryConditionAssemblyUtil.createSimpleQueryNode("goodsBarCode",
OperateEnum.OPERATE_LIKE, search);
List<JSONObject> jsonArray = new ArrayList<>();
jsonArray.add(goodsCodeJson);
jsonArray.add(goodsNameJson);
jsonArray.add(goodsBarCodeJson);
JSONObject object = QueryConditionAssemblyUtil.createListQueryNode(jsonArray, OperateEnum.OPERATE_OR);
jsonObject = QueryConditionAssemblyUtil.addQueryNodeForSiblin(object, jsonObject, OperateEnum.OPERATE_AND);
}
......
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 BaseGoodsController {
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 BaseGoodsController {
@Autowired
private BrandApiService brandApiService;
......@@ -35,14 +34,19 @@ public class GoodsBrandController {
@RequestMapping("/goods-brand-list")
public RestResponse goodsBrandList(int pageSize, int currentPage, String search, Long goodsDomainId, String channelCode) {
ServiceResponse<GoodsRightsSelectorDTO> selectorDTOServiceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId(), Constant.TEST_ENTERPRISE_ID);
Long resourceId = UserDetailUtils.getUserDetail().getUserResourceInfo() == null ? null :
UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId();
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);
}
// 是否最高权限
List<Long> branIdList = new ArrayList<>();
if (UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId() != null) {
if (UserDetailUtils.getUserDetail().getUserResourceInfo() != null
&& UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId() != null) {
if (selectorDTOServiceResponse.isSuccess()) {
GoodsRightsSelectorDTO goodsRightsSelectorDTO = selectorDTOServiceResponse.getResult();
if (goodsRightsSelectorDTO != null) {
......@@ -57,7 +61,7 @@ public class GoodsBrandController {
}
}
}
return findBrandListByParams(currentPage, pageSize,goodsDomainId, search, Constant.TEST_ENTERPRISE_ID);
return findBrandListByParams(currentPage, pageSize,goodsDomainId, search, getEnterpriseId());
}
......@@ -71,7 +75,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 BaseGoodsController {
@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;
......@@ -25,6 +14,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 +32,7 @@ import com.gic.widget.screening.api.service.EsScreeningSearchService;
* @date 2019/8/29 上午10:03
*/
@RestController
public class GoodsController {
public class GoodsController extends BaseGoodsController {
@Autowired
private EsBusinessOperaApiService esBusinessOperaApiService;
......@@ -87,7 +86,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());
......@@ -113,16 +112,17 @@ public class GoodsController {
private ServiceResponse<ESResponseQueryBatchDTO> searchES( Integer currentPage,Integer pageSize, Long goodsDomainId,String search,String channelCode) {
DynamicSearchDTO searchDTO = new DynamicSearchDTO();
String esName = esScreeningSearchService.getCurrentEsName("goods-test-123456", "goods-search");
String columnCategoryCode = Constant.ES_CODES_MAP.get(channelCode);
String esName = esScreeningSearchService.getCurrentEsName(getEnterpriseId() + "", columnCategoryCode);
searchDTO.setIndexName(esName);
searchDTO.setColumnCategoryCode("goods-search");
searchDTO.setEnterpriseId("goods-test-123456");
searchDTO.setColumnCategoryCode(columnCategoryCode);
searchDTO.setEnterpriseId(getEnterpriseId() + "");
searchDTO.setType("mapper_type");
searchDTO.setBegin(currentPage);
searchDTO.setRecordNumber(pageSize);
JSONObject goodsCodeJson = QueryConditionAssemblyUtil.createSimpleQueryNode("goodsCode", OperateEnum.OPERATE_LIKE, search);
JSONObject goodsNameJson = QueryConditionAssemblyUtil.createSimpleQueryNode("goodsName", OperateEnum.OPERATE_LIKE, search);
JSONObject goodsDomainIdJson = QueryConditionAssemblyUtil.createSimpleQueryNode("channelCodeDomainId", OperateEnum.OPERATE_EQ, channelCode+"-"+goodsDomainId);
JSONObject goodsDomainIdJson = QueryConditionAssemblyUtil.createSimpleQueryNode("goodsDomainId", OperateEnum.OPERATE_EQ, goodsDomainId);
JSONObject nameAndCodeJson = QueryConditionAssemblyUtil.addQueryNodeForSiblin(goodsCodeJson, goodsNameJson, OperateEnum.OPERATE_OR);
JSONObject json = QueryConditionAssemblyUtil.addQueryNodeForSiblin(nameAndCodeJson, goodsDomainIdJson, OperateEnum.OPERATE_AND);
searchDTO.setSearchJson(json);
......
......@@ -20,7 +20,7 @@ import java.util.List;
* @date 2019/8/29 上午10:03
*/
@RestController
public class GoodsCordController {
public class GoodsCordController extends BaseGoodsController {
@Autowired
private CordApiService cordApiService;
......@@ -31,7 +31,7 @@ public class GoodsCordController {
*/
@GetMapping("list-parent-cord")
public RestResponse listParentCord(Long goodsDomainId) {
ServiceResponse<List<GoodsCordDTO>> serviceResponse = cordApiService.listParentAll(goodsDomainId);
ServiceResponse<List<GoodsCordDTO>> serviceResponse = cordApiService.listParentAll(goodsDomainId, getEnterpriseId());
List<GoodsCordDTO> result = serviceResponse.getResult();
if (CollectionUtils.isEmpty(result)) {
return RestResponse.success();
......@@ -49,7 +49,7 @@ public class GoodsCordController {
*/
@GetMapping("list-child-cord")
public RestResponse listChildAll(Long specParentId) {
ServiceResponse<List<GoodsCordDTO>> serviceResponse = cordApiService.listChildAll(specParentId);
ServiceResponse<List<GoodsCordDTO>> serviceResponse = cordApiService.listChildAll(specParentId, getEnterpriseId());
List<GoodsCordDTO> result = serviceResponse.getResult();
if (CollectionUtils.isEmpty(result)) {
return RestResponse.success();
......
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 BaseGoodsController {
@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());
}
......@@ -54,23 +53,30 @@ public class GoodsDomainController {
*/
@RequestMapping("/get-all-goods-domain-list")
public RestResponse getAllGoodsDomianList() {
ServiceResponse<GoodsRightsSelectorDTO> selectorDTOServiceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId(), Constant.TEST_ENTERPRISE_ID);
Long resourceId = UserDetailUtils.getUserDetail().getUserResourceInfo() == null ? null :
UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId();
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);
}
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;
if (UserDetailUtils.getUserDetail().getUserResourceInfo().getGoodsResourceId() != null) {
if (UserDetailUtils.getUserDetail().getUserInfo().getSuperAdmin() != 1) {
isHighestRights = false;
if (selectorDTOServiceResponse.isSuccess()) {
GoodsRightsSelectorDTO goodsRightsSelectorDTO = selectorDTOServiceResponse.getResult();
if (goodsRightsSelectorDTO != null) {
json = JSONObject.parseObject(goodsRightsSelectorDTO.getGoodsRightsDomains());
if (json.isEmpty()) {
isHighestRights = true;
if (goodsRightsSelectorDTO.getHasRights() == 0) {
json = JSONObject.parseObject(JSONObject.toJSONString(Collections.EMPTY_LIST));
} else {
json = JSONObject.parseObject(goodsRightsSelectorDTO.getGoodsRightsDomains());
if (json.isEmpty()) {
isHighestRights = true;
}
}
}
}
......
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 BaseGoodsController {
@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 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 BaseGoodsController {
@Autowired
private GoodsRightsSelectorApiService goodsRightsSelectorApiService;
/**
* @Title: goodsRightsSelectorSave
* @Title: BaseGoodsController
* @Description: 保存商品选择器权限版
* @author majia
* @param goodsRightsSelectorSaveQO
......@@ -34,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();
......@@ -57,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();
......@@ -69,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();
......@@ -80,7 +80,8 @@ public class GoodsRightsSelectorController {
@RequestMapping("/get-goods-rights-selector")
public RestResponse getGoodsRightsSelector(Long goodsRightsSelectorId) {
ServiceResponse<GoodsRightsSelectorDTO> serviceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(goodsRightsSelectorId, Constant.TEST_ENTERPRISE_ID);
ServiceResponse<GoodsRightsSelectorDTO> serviceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(goodsRightsSelectorId,
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 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 BaseGoodsController {
@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());
}
......
......@@ -2,22 +2,17 @@ package com.gic.plug.web.controller.goods;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.goods.api.dto.ErrorCode;
import com.gic.goods.api.dto.GoodsTagDTO;
import com.gic.goods.api.dto.StandardDTO;
import com.gic.goods.api.service.TagApiService;
import com.gic.plug.web.vo.goods.GoodsTagVO;
import org.apache.commons.collections.CollectionUtils;
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;
/**
* @ClassName: GoodsTagController
* @Description: 商品标签相关接口
......@@ -25,7 +20,7 @@ import java.util.List;
* @date 2019/8/29 上午10:03
*/
@RestController
public class GoodsTagController {
public class GoodsTagController extends BaseGoodsController {
@Autowired
private TagApiService tagApiService;
......@@ -42,7 +37,7 @@ public class GoodsTagController {
}
ServiceResponse<Page<GoodsTagDTO>> serviceResponse = tagApiService.listByPage(currentPage, pageSize,
goodsDomainId);
goodsDomainId, getEnterpriseId());
Page<GoodsTagVO> voPage = PageHelperUtils.changePageToCurrentPage(serviceResponse.getResult(),
GoodsTagVO.class);
return RestResponse.success(voPage);
......
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