Commit 4da1009b by guojuxing

对外api资源授权清单:补齐商品资源

parent 90019666
package com.gic.auth.dto.open;
import java.io.Serializable;
public class GoodsResourceDTO implements Serializable{
private static final long serialVersionUID = 368101547153742819L;
/**
* 商品选择器ID
*/
private Long goodsResource;
private GoodsRightsAuthDTO goodsRightsAuth;
public Long getGoodsResource() {
return goodsResource;
}
public void setGoodsResource(Long goodsResource) {
this.goodsResource = goodsResource;
}
public GoodsRightsAuthDTO getGoodsRightsAuth() {
return goodsRightsAuth;
}
public void setGoodsRightsAuth(GoodsRightsAuthDTO goodsRightsAuth) {
this.goodsRightsAuth = goodsRightsAuth;
}
}
package com.gic.auth.dto.open;
import java.io.Serializable;
import java.util.List;
public class GoodsRightsAuthDTO implements Serializable{
private static final long serialVersionUID = 3365902031841545564L;
private List<GoodsRightsChannelDTO> goodsRightsChannelList;
public List<GoodsRightsChannelDTO> getGoodsRightsChannelList() {
return goodsRightsChannelList;
}
public void setGoodsRightsChannelList(List<GoodsRightsChannelDTO> goodsRightsChannelList) {
this.goodsRightsChannelList = goodsRightsChannelList;
}
}
package com.gic.auth.dto.open;
import java.io.Serializable;
public class GoodsRightsBrandDTO implements Serializable{
private static final long serialVersionUID = 2236740261653028520L;
private Long brandId;
private String brandCode;
private String brandName;
public Long getBrandId() {
return brandId;
}
public void setBrandId(Long brandId) {
this.brandId = brandId;
}
public String getBrandCode() {
return brandCode;
}
public void setBrandCode(String brandCode) {
this.brandCode = brandCode;
}
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
}
package com.gic.auth.dto.open;
import java.io.Serializable;
import java.util.List;
public class GoodsRightsChannelDTO implements Serializable{
private static final long serialVersionUID = -1343276116860387848L;
private String channelCode;
private String channelName;
private List<GoodsRightsDomainDTO> goodsRightsDomainList;
public String getChannelCode() {
return channelCode;
}
public void setChannelCode(String channelCode) {
this.channelCode = channelCode;
}
public String getChannelName() {
return channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public List<GoodsRightsDomainDTO> getGoodsRightsDomainList() {
return goodsRightsDomainList;
}
public void setGoodsRightsDomainList(List<GoodsRightsDomainDTO> goodsRightsDomainList) {
this.goodsRightsDomainList = goodsRightsDomainList;
}
}
package com.gic.auth.dto.open;
import java.io.Serializable;
import java.util.List;
public class GoodsRightsDomainDTO implements Serializable{
private static final long serialVersionUID = 6324205784953715323L;
private Long goodsDomainId;
private String goodsDomainCode;
private String goodsDomainName;
private List<GoodsRightsBrandDTO> goodsRightsBrandList;
public Long getGoodsDomainId() {
return goodsDomainId;
}
public void setGoodsDomainId(Long goodsDomainId) {
this.goodsDomainId = goodsDomainId;
}
public String getGoodsDomainCode() {
return goodsDomainCode;
}
public void setGoodsDomainCode(String goodsDomainCode) {
this.goodsDomainCode = goodsDomainCode;
}
public String getGoodsDomainName() {
return goodsDomainName;
}
public void setGoodsDomainName(String goodsDomainName) {
this.goodsDomainName = goodsDomainName;
}
public List<GoodsRightsBrandDTO> getGoodsRightsBrandList() {
return goodsRightsBrandList;
}
public void setGoodsRightsBrandList(List<GoodsRightsBrandDTO> goodsRightsBrandList) {
this.goodsRightsBrandList = goodsRightsBrandList;
}
}
package com.gic.auth.dto.open;
import java.io.Serializable;
import java.util.List;
/**
* 对第三方开发者资源授权清单
......@@ -29,6 +28,10 @@ public class ResourceOpenDTO implements Serializable{
* 订单资源
*/
private OrderResourceDTO orderResource;
/**
* 商品资源
*/
private GoodsResourceDTO goodsResource;
public StoreResourceDTO getStore() {
......@@ -62,4 +65,12 @@ public class ResourceOpenDTO implements Serializable{
public void setOrderResource(OrderResourceDTO orderResource) {
this.orderResource = orderResource;
}
public GoodsResourceDTO getGoodsResource() {
return goodsResource;
}
public void setGoodsResource(GoodsResourceDTO goodsResource) {
this.goodsResource = goodsResource;
}
}
......@@ -157,6 +157,11 @@
<artifactId>gic-member-filter-api</artifactId>
<version>${gic-member-filter-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-goods-api</artifactId>
<version>${gic-goods-api}</version>
</dependency>
</dependencies>
<build>
......
......@@ -7,6 +7,9 @@ import java.util.Map;
import com.gic.auth.constant.OrderOrAppEnum;
import com.gic.auth.dto.OrderResourceContentDTO;
import com.gic.commons.util.EntityUtil;
import com.gic.goods.api.dto.selector.GoodsRightsSelectorWithRightsDTO;
import com.gic.goods.api.service.GoodsRightsSelectorApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -63,6 +66,8 @@ public class ResourceOpenApiServiceImpl implements ResourceOpenApiService{
private ServiceConfigApiService serviceConfigApiService;
@Autowired
private AuthorizationEnterConfApiService authorizationEnterConfApiService;
@Autowired
private GoodsRightsSelectorApiService goodsRightsSelectorApiService;
@Override
@GatewayParams(query = {"appId", "enterpriseId"})
......@@ -77,10 +82,31 @@ public class ResourceOpenApiServiceImpl implements ResourceOpenApiService{
result.setChannelResource(getChannelResource(enterpriseId, resourceDTO));
//订单资源
result.setOrderResource(getOrderResource(enterpriseId, resourceDTO));
//todo 商品资源
//商品资源
result.setGoodsResource(getGoodsResource(enterpriseId, resourceDTO));
return ServiceResponse.success(result);
}
private GoodsResourceDTO getGoodsResource(Integer enterpriseId, ResourceDTO resourceDTO) {
if (resourceDTO != null) {
Long goodsResource = resourceDTO.getGoodsResourceId();
GoodsResourceDTO dto = new GoodsResourceDTO();
dto.setGoodsResource(goodsResource);
if (goodsResource != null) {
ServiceResponse<GoodsRightsSelectorWithRightsDTO> result = goodsRightsSelectorApiService
.getGoodsRightsSelectorWithRights(goodsResource, enterpriseId);
LOGGER.info("对外商品资源查询接口:{}", JSON.toJSONString(result));
if (result.isSuccess()) {
GoodsRightsSelectorWithRightsDTO goodsRightsSelectorWithRightsDTO = result.getResult();
GoodsRightsAuthDTO goodsRightsAuth = EntityUtil.changeEntityNew(GoodsRightsAuthDTO.class, goodsRightsSelectorWithRightsDTO);
dto.setGoodsRightsAuth(goodsRightsAuth);
return dto;
}
}
}
return null;
}
private OrderResourceDTO getOrderResource(Integer enterpriseId, ResourceDTO resourceDTO) {
if (resourceDTO != null) {
Integer orderResourceId = resourceDTO.getOrderResource();
......
......@@ -69,4 +69,6 @@
<dubbo:reference interface="com.gic.member.filter.api.service.CuIndexOperaApiService" id="cuIndexOperaApiService" timeout="6000" />
<dubbo:reference interface="com.gic.member.config.api.service.AuthorizationEnterConfApiService" id="authorizationEnterConfApiService" timeout="6000" />
<dubbo:reference interface="com.gic.goods.api.service.GoodsRightsSelectorApiService" id="goodsRightsSelectorApiService" timeout="6000" />
</beans>
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