Commit 80bd661b by zhouhb

[+]渠道添加

1 parent b0222d60
...@@ -6,6 +6,7 @@ import cn.com.glsx.merchants.request.DefaultRequest; ...@@ -6,6 +6,7 @@ import cn.com.glsx.merchants.request.DefaultRequest;
import cn.com.glsx.merchants.request.accounttype.AccountTypeSearchRequest; import cn.com.glsx.merchants.request.accounttype.AccountTypeSearchRequest;
import cn.com.glsx.merchants.response.AccountTypeResponse; import cn.com.glsx.merchants.response.AccountTypeResponse;
import cn.com.glsx.merchants.response.CarbrandResponse; import cn.com.glsx.merchants.response.CarbrandResponse;
import cn.com.glsx.merchants.response.ChannelResponse;
import cn.com.glsx.merchants.service.MerchantCommonService; import cn.com.glsx.merchants.service.MerchantCommonService;
import com.rop.AbstractRopRequest; import com.rop.AbstractRopRequest;
import com.rop.annotation.NeedInSessionType; import com.rop.annotation.NeedInSessionType;
...@@ -49,4 +50,21 @@ public class MerchantCommonController { ...@@ -49,4 +50,21 @@ public class MerchantCommonController {
return RopResponse.error(e.getErrId(),e.getMessage()); return RopResponse.error(e.getErrId(),e.getMessage());
} }
} }
/**
* 获取车辆品牌树
*
* @param abstractRopRequest
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.merchantCommon.findAllChannel", needInSession = NeedInSessionType.NO)
@ApiOperation("获取渠道列表")
public RopResponse<List<ChannelResponse>> findAllChannel(AbstractRopRequest abstractRopRequest) {
try {
return RopResponse.success(merchantCommonService.findAllChannel());
} catch (RpcServiceException e) {
log.info("=======MerchantCommonController__invoke__findAllChannel__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
} }
package cn.com.glsx.merchants.response;
import lombok.Data;
import java.io.Serializable;
@Data
public class ChannelResponse implements Serializable {
private int id;
private String channelName;
private String channelUrl;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.merchants.service; package cn.com.glsx.merchants.service;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.model.response.MerchantChannelResponse;
import cn.com.glsx.merchants.remote.MerchantRemote;
import cn.com.glsx.merchants.response.CarbrandResponse; import cn.com.glsx.merchants.response.CarbrandResponse;
import cn.com.glsx.merchants.response.ChannelResponse;
import cn.com.glsx.merchants.response.MerchantTreeRopResponse;
import com.glsx.biz.common.base.entity.Carbrand; import com.glsx.biz.common.base.entity.Carbrand;
import com.glsx.biz.common.base.service.CarbrandService; import com.glsx.biz.common.base.service.CarbrandService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -21,6 +28,9 @@ public class MerchantCommonService { ...@@ -21,6 +28,9 @@ public class MerchantCommonService {
@Autowired @Autowired
private CarbrandService carbrandService; private CarbrandService carbrandService;
@Autowired
private MerchantRemote merchantRemote;
public List<CarbrandResponse> getCarbrandTree() { public List<CarbrandResponse> getCarbrandTree() {
List<Carbrand> parentCarbrandList = carbrandService.getParentCarbrandList(); List<Carbrand> parentCarbrandList = carbrandService.getParentCarbrandList();
List<Carbrand> allList = carbrandService.getAllList(); List<Carbrand> allList = carbrandService.getAllList();
...@@ -39,4 +49,12 @@ public class MerchantCommonService { ...@@ -39,4 +49,12 @@ public class MerchantCommonService {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return collect; return collect;
} }
public List<ChannelResponse> findAllChannel() {
RpcResponse<List<MerchantChannelResponse>> allChannel = merchantRemote.findAllChannel();
if (allChannel.isSuccess()) {
return ConvertResponse.convertList(allChannel.getResult(), ChannelResponse.class);
}
throw new RpcServiceException(allChannel.getException().getErrId(), allChannel.getMessage());
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!