forked from gzzfw/backEnd/gz-dyh

dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java
@@ -8,7 +8,7 @@
import cn.huge.module.client.api.CustClient;
import cn.huge.module.cust.dto.CtUserDTO;
import cn.huge.module.cust.dto.PaUserDTO;
import cn.huge.module.mediate.dto.WechatBindCaseDTO;
import cn.huge.module.sync.domain.target.TargetCtAccount;
import cn.huge.module.sync.domain.target.TargetCtUnit;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -46,23 +46,44 @@
    private ObjectMapper objectMapper = new ObjectMapper();
    /**
     * 内部用户-获取登录用户
     * @param userId 用户编号
     * @return CtUserDTO
     * 微服务调用-数据迁移-批量新增
     * @param targetTableList 批量数据
     * @return
     */
    public CtUserDTO clientGetUser(List<TargetCtUnit> targetCtUnitList){
    public CtUserDTO saveTableList(List<TargetCtUnit> targetTableList){
        try{
            ReturnBO returnBo = custClient.saveCtUnitList(targetCtUnitList);
            ReturnBO returnBo = custClient.saveTableList(targetTableList);
            if (ReturnConsts.OK == returnBo.getCode()){
                CtUserDTO loginUser = objectMapper.convertValue(returnBo.getData(), CtUserDTO.class);
                return loginUser;
            }else{
                log.error("Client外服务接口[CustClientImpl.clientGetUser]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("CustClientImpl.clientGetUser", returnBo.getMsg());
                log.error("Client外服务接口[CustClientImpl.saveTableList]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("CustClientImpl.saveTableList", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[CustClientImpl.clientGetUser]调用异常:"+e, e);
            throw new ServiceException("CustClientImpl.clientGetUser", e);
            log.error("service方法[CustClientImpl.saveTableList]调用异常:"+e, e);
            throw new ServiceException("CustClientImpl.saveTableList", e);
        }
    }
    /**
     * 微服务调用-数据迁移-批量新增
     * @param targetTableList 批量数据
     * @return
     */
    public CtUserDTO saveTableList1(List<TargetCtAccount> targetTableList){
        try{
            ReturnBO returnBo = custClient.saveTableList1(targetTableList);
            if (ReturnConsts.OK == returnBo.getCode()){
                CtUserDTO loginUser = objectMapper.convertValue(returnBo.getData(), CtUserDTO.class);
                return loginUser;
            }else{
                log.error("Client外服务接口[CustClientImpl.saveTableList1]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("CustClientImpl.saveTableList1", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[CustClientImpl.saveTableList1]调用异常:"+e, e);
            throw new ServiceException("CustClientImpl.saveTableList1", e);
        }
    }
}