Commit 9c2f045b by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-webapp-plug into developer
parents 6883bdac 6c076577
package com.gic.plug.web.controller.goods;
import java.util.ArrayList;
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;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.contants.SortType;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.goods.api.dto.BrandDTO;
import com.gic.goods.api.dto.GoodsRightsSelectorDTO;
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;
@RestController
......@@ -19,9 +28,30 @@ public class GoodsBrandController {
@Autowired
private BrandApiService brandApiService;
@Autowired
private GoodsRightsSelectorApiService goodsRightsSelectorApiService;
@RequestMapping("/goods-brand-list")
public RestResponse goodsBrandList(int pageSize, int currentPage, String search, Long goodsDomainId) {
ServiceResponse<Page<BrandDTO>> serviceResponse = brandApiService.findBrandPage(currentPage, pageSize, goodsDomainId, search, SortType.sortDescType);
public RestResponse goodsBrandList(int pageSize, int currentPage, String search, Long goodsDomainId, String channelCode) {
// 是否最高权限
List<Long> branIdList = new ArrayList<>();
if (Constant.TEST_GOODS_RIGHTS_SELECTOR_ID != null) {
ServiceResponse<GoodsRightsSelectorDTO> selectorDTOServiceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(Constant.TEST_GOODS_RIGHTS_SELECTOR_ID);
if (selectorDTOServiceResponse.isSuccess()) {
GoodsRightsSelectorDTO goodsRightsSelectorDTO = selectorDTOServiceResponse.getResult();
if (goodsRightsSelectorDTO != null) {
JSONObject brandRightsObject = JSONObject.parseObject(goodsRightsSelectorDTO.getGoodsRightsBrands());
JSONArray array = brandRightsObject.getJSONArray(channelCode + "_" + goodsDomainId);
if (CollectionUtils.isNotEmpty(array)) {
for (int i = 0; i < array.size(); i++) {
Long brandId = array.getLong(i);
branIdList.add(brandId);
}
}
}
}
}
ServiceResponse<Page<BrandDTO>> serviceResponse = brandApiService.findBrandPage(currentPage, pageSize, goodsDomainId, search, branIdList, SortType.sortDescType);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
......
......@@ -7,10 +7,14 @@ 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;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.goods.api.dto.GoodsDomainDTO;
import com.gic.goods.api.dto.GoodsRightsSelectorDTO;
import com.gic.goods.api.service.GoodsDomainApiService;
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;
......@@ -21,6 +25,9 @@ public class GoodsDomainController {
@Autowired
private GoodsDomainApiService goodsDomainApiService;
@Autowired
private GoodsRightsSelectorApiService goodsRightsSelectorApiService;
/**
* @Title: getAllGoodsDomianListWith
* @Description: 查询企业下所有的域,拼接成channelVO返回
......@@ -31,6 +38,19 @@ public class GoodsDomainController {
@RequestMapping("/get-all-goods-domain-list")
private RestResponse getAllGoodsDomianListWith() {
ServiceResponse<List<GoodsDomainDTO>> serviceResponse = goodsDomainApiService.listAll(Constant.TEST_ENTERPRISE_ID, null);
// 是否最高权限
boolean isHighestRights = true;
JSONObject json = null;
if (Constant.TEST_GOODS_RIGHTS_SELECTOR_ID != null) {
isHighestRights = false;
ServiceResponse<GoodsRightsSelectorDTO> selectorDTOServiceResponse = goodsRightsSelectorApiService.getGoodsRightsSelector(Constant.TEST_GOODS_RIGHTS_SELECTOR_ID);
if (selectorDTOServiceResponse.isSuccess()) {
GoodsRightsSelectorDTO goodsRightsSelectorDTO = selectorDTOServiceResponse.getResult();
if (goodsRightsSelectorDTO != null) {
json = JSONObject.parseObject(goodsRightsSelectorDTO.getGoodsRightsDomains());
}
}
}
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
......@@ -42,8 +62,19 @@ public class GoodsDomainController {
for (GoodsDomainDTO goodsDomainDTO : goodsDomainDTOList) {
if (CollectionUtils.isNotEmpty(goodsDomainDTO.getChannels())){
for (String channelCode : goodsDomainDTO.getChannels()) {
map.putIfAbsent(channelCode, new ArrayList<>());
map.get(channelCode).add(goodsDomainDTO);
if (isHighestRights) { // 最高权限所有都显示
map.putIfAbsent(channelCode, new ArrayList<>());
map.get(channelCode).add(goodsDomainDTO);
} else { //非最高权限按权限下有什么就刷什么来
if (json != null && json.containsKey(channelCode)) {
map.putIfAbsent(channelCode, new ArrayList<>());
JSONArray array = json.getJSONArray(channelCode);
if (CollectionUtils.isNotEmpty(array) && array.contains(goodsDomainDTO.getGoodsDomainId())) {
map.get(channelCode).add(goodsDomainDTO);
}
}
}
}
}
}
......
......@@ -33,6 +33,9 @@ public class GoodsPropertyController {
public RestResponse propertyList(int pageSize, int currentPage, String search, Long goodsDomainId) {
List<String> arrayList = new ArrayList<>();
arrayList.add(Constant.PROPERTY_TYPE_TEXT);
arrayList.add(Constant.PROPERTY_TYPE_TIME);
arrayList.add(Constant.PROPERTY_TYPE_CURRENCY);
arrayList.add(Constant.PROPERTY_TYPE_PERCENT);
ServiceResponse<Page<PropertyDTO>> serviceResponse = propertyApiService.findPropertyExceptType(currentPage, pageSize, goodsDomainId, arrayList,search);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
......
......@@ -11,12 +11,6 @@ public class GoodsSelectorSaveQO {
*/
private String useType;
/**
* 搜索类型
* 1 skuCode
* 2 skuId
*/
private Integer searchResultType;
public String getGoodsSearchValue() {
return goodsSearchValue;
......@@ -42,11 +36,4 @@ public class GoodsSelectorSaveQO {
this.useType = useType;
}
public Integer getSearchResultType() {
return searchResultType;
}
public void setSearchResultType(Integer searchResultType) {
this.searchResultType = searchResultType;
}
}
......@@ -8,13 +8,6 @@ public class GoodsSelectorUpdateQO {
private String goodsSearchEdit;
/**
* 搜索类型
* 1 skuCode
* 2 skuId
*/
private Integer searchResultType;
public Long getGoodsSelectorId() {
return goodsSelectorId;
}
......@@ -39,11 +32,4 @@ public class GoodsSelectorUpdateQO {
this.goodsSearchEdit = goodsSearchEdit;
}
public Integer getSearchResultType() {
return searchResultType;
}
public void setSearchResultType(Integer searchResultType) {
this.searchResultType = searchResultType;
}
}
package com.gic.plug.web.vo.goods;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
/**
......@@ -14,6 +16,7 @@ public class GoodsVO {
/**
* 商品ID
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long goodsId;
/**
* 商品名称
......@@ -26,6 +29,7 @@ public class GoodsVO {
/**
* 货号
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
private String goodsCode;
/**
......@@ -78,6 +82,7 @@ public class GoodsVO {
/**
* ID
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long goodsSkuId;
/**
* sku数据
......
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