package cn.huge.module.syncbydyh.client.api.impl;
|
|
import cn.huge.base.common.bo.ReturnBO;
|
import cn.huge.base.common.constant.ReturnConsts;
|
import cn.huge.base.common.exception.ClientException;
|
import cn.huge.base.common.utils.ObjectUtils;
|
import cn.huge.module.syncbydyh.client.api.SyncBydyhClient;
|
import cn.huge.module.syncbydyh.domain.dto.GZCaseDTO;
|
import com.alibaba.fastjson.JSON;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import java.util.ArrayList;
|
import java.util.LinkedHashMap;
|
import java.util.List;
|
|
|
/**
|
* @title: 白云区矛盾纠纷多元化解平台同步微服务调用接口
|
* @description: 白云区矛盾纠纷多元化解平台同步微服务调用接口
|
* @company: hugeinfo
|
* @author: liyj
|
* @time: 2021-11-05 16:51:48
|
* @version: 1.0.0
|
*/
|
@Slf4j
|
@Component
|
public class SyncBydyhClientImpl {
|
|
private SyncBydyhClient syncBydyhClient;
|
|
/**
|
* ObjectMapper工具类
|
*/
|
private ObjectMapper objectMapper = new ObjectMapper();
|
|
@Autowired
|
public SyncBydyhClientImpl(SyncBydyhClient syncBydyhClient) {
|
this.syncBydyhClient = syncBydyhClient;
|
}
|
|
/**
|
* 数据割接-已结束的纠纷案件信息
|
* @url {ctx}/api/client/syncCust/byToGzCtUnit
|
* @return Object
|
*/
|
public List<GZCaseDTO> byToGzEndCase(int page, int size){
|
List<GZCaseDTO> resultList = new ArrayList<>();
|
try{
|
ReturnBO returnBo = syncBydyhClient.byToGzEndCase(page, size);
|
if (ReturnConsts.OK == returnBo.getCode()){
|
if (ObjectUtils.isNotEmpty(returnBo.getData())){
|
List<LinkedHashMap> list = (List<LinkedHashMap>) returnBo.getData();
|
for (LinkedHashMap map : list) {
|
GZCaseDTO result = JSON.parseObject(JSON.toJSONString(map), GZCaseDTO.class);
|
resultList.add(result);
|
}
|
}
|
}else{
|
log.error("Client外服务接口[SyncBydyhClient.byToGzEndCase]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
|
throw new ClientException("SyncBydyhClient.byToGzEndCase", returnBo.getMsg());
|
}
|
}catch (Exception e){
|
log.error("service方法[SyncBydyhClient.byToGzEndCase]调用异常:"+e, e);
|
}
|
return resultList;
|
}
|
|
/**
|
* 数据割接-统计已结束的纠纷案件信息
|
* @url {ctx}/api/client/syncCust/countEndCase
|
* @return Object
|
*/
|
public int countEndCase(){
|
try{
|
ReturnBO returnBo = syncBydyhClient.countEndCase();
|
if (ReturnConsts.OK == returnBo.getCode()) {
|
if (ObjectUtils.isNotEmpty(returnBo.getData())){
|
return (Integer) returnBo.getData();
|
}else {
|
return 0;
|
}
|
} else {
|
log.error("Client外服务接口[SyncBydyhClient.countEndCase]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
|
throw new ClientException("SyncBydyhClient.countEndCase", returnBo.getMsg());
|
}
|
}catch (Exception e){
|
log.error("service方法[SyncBydyhClient.countEndCase]调用异常:"+e, e);
|
}
|
return 0;
|
}
|
|
}
|