| package com.fzzy.async.fzzy35.impl; | 
|   | 
| import com.fzzy.api.Constant; | 
| import com.fzzy.api.entity.Api1102; | 
| import com.fzzy.api.entity.ApiLog; | 
| import com.fzzy.api.utils.ContextUtil; | 
| import com.fzzy.api.view.repository.Api1102Rep; | 
| import com.fzzy.api.view.repository.ApiLogRep; | 
| import com.fzzy.async.fzzy35.entity.Fz35DefaultDept; | 
| import com.fzzy.async.fzzy35.repository.Fzzy35Sync1101Rep; | 
| import com.fzzy.async.fzzy35.repository.Fzzy35Sync1102Rep; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.stereotype.Component; | 
| import java.util.Date; | 
| import java.util.List; | 
|   | 
| /** | 
|  * 库区信息 | 
|  */ | 
| @Slf4j | 
| @Component | 
| public class Fzzy35Sync1102 { | 
|   | 
|     @Autowired | 
|     private Fzzy35Sync1102Rep fzzy35Sync1102Rep; | 
|     @Autowired | 
|     private Api1102Rep api1102Rep; | 
|     @Autowired | 
|     private ApiLogRep apiLogRep; | 
|   | 
|     /** | 
|      * 同步单位信息 | 
|      * | 
|      * @param deptId | 
|      * @param start | 
|      * @param end | 
|      */ | 
|     public void syncData(String kqdm, String deptId, Date start, Date end) { | 
|   | 
|         log.info("-------------1102接口数据开始同步------------------"); | 
|   | 
|         //同步数据,只记录失败的信息 | 
|         ApiLog apiLog = new ApiLog(); | 
|         apiLog.setType(ApiLog.TYPE_SYNC); | 
|         apiLog.setKqdm(deptId); | 
|         apiLog.setUploadTime(new Date()); | 
|         apiLog.setInteId(Constant.API_CODE_1111); | 
|         apiLog.setStatus(99); | 
|         apiLog.setId(ContextUtil.getUUID()); | 
|         try { | 
|             List<Fz35DefaultDept> list = fzzy35Sync1102Rep.listApi1102(deptId); | 
|   | 
|             if (null == list || list.isEmpty()) { | 
|                 log.info("-------------没有获取到库区信息------------------"); | 
|                 return; | 
|             } | 
|             Api1102 apiData; | 
|             for (Fz35DefaultDept sysData : list) { | 
|   | 
|                 //TODO | 
| //                apiData = new Api1101(); | 
| // | 
| //                api1102Rep.save(apiData); | 
| //                log.info("1111---同步数据:{}", apiData.toString()); | 
|             } | 
|         } catch (Exception e) { | 
|             log.error("---库区同步执行失败----{}", e); | 
|             apiLog.setResult("同步库区信息失败:" + e.getMessage()); | 
|             apiLogRep.save(apiLog); | 
|         } | 
|     } | 
| } |