|  |  |  | 
|---|
|  |  |  | import com.fzzy.api.view.repository.ApiInfoDataRep; | 
|---|
|  |  |  | import com.fzzy.api.view.repository.ApiLogRep; | 
|---|
|  |  |  | import com.fzzy.async.whhpjl.entity.Fz40WhjlDefaultGranary; | 
|---|
|  |  |  | import com.fzzy.async.whhpjl.repository.Fz40ToWhjlSync1106Rep; | 
|---|
|  |  |  | import com.fzzy.async.whhpjl.repository.Fz40ToWhjlSync1107Rep; | 
|---|
|  |  |  | import com.fzzy.otherview.whhpjl.WhjlConstant; | 
|---|
|  |  |  | import com.fzzy.otherview.whhpjl.dto.WhjlApi1107; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Component | 
|---|
|  |  |  | public class Fz40ToWhjlSync1107 { | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private Fz40ToWhjlSync1106Rep fz40ToWhjlSync1106Rep; | 
|---|
|  |  |  | private Fz40ToWhjlSync1107Rep fz40ToWhjlSync1107Rep; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApiLogRep apiLogRep; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param end | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void syncData(String kqdm, String deptId, Date start, Date end) { | 
|---|
|  |  |  | log.info("-------------1106接口数据开始同步------------------"); | 
|---|
|  |  |  | log.info("-------------1107接口数据开始同步------------------"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //同步数据,只记录失败的信息 | 
|---|
|  |  |  | ApiLog apiLog = new ApiLog(); | 
|---|
|  |  |  | apiLog.setType(ApiLog.TYPE_SYNC); | 
|---|
|  |  |  | apiLog.setKqdm(deptId); | 
|---|
|  |  |  | apiLog.setUploadTime(new Date()); | 
|---|
|  |  |  | apiLog.setInteId(Constant.API_CODE_1106); | 
|---|
|  |  |  | apiLog.setInteId(Constant.API_CODE_1107); | 
|---|
|  |  |  | apiLog.setStatus(99); | 
|---|
|  |  |  | apiLog.setId(ContextUtil.getUUID()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | List<Fz40WhjlDefaultGranary> list = fz40ToWhjlSync1106Rep.listApi1106(deptId.substring(0, 4)); | 
|---|
|  |  |  | List<Fz40WhjlDefaultGranary> list = fz40ToWhjlSync1107Rep.listApi1107(deptId.substring(0, 4)); | 
|---|
|  |  |  | if (null == list || list.isEmpty()) { | 
|---|
|  |  |  | log.info("-------------没有获取到单位信息------------------"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | 
|---|
|  |  |  | infoData.setId(sysData.getAjdh()); | 
|---|
|  |  |  | infoData.setKqdm(kqdm); | 
|---|
|  |  |  | infoData.setInteType(WhjlConstant.API_CATEGORY_11); | 
|---|
|  |  |  | infoData.setInteId(WhjlConstant.API_CODE_1106); | 
|---|
|  |  |  | infoData.setInteId(WhjlConstant.API_CODE_1107); | 
|---|
|  |  |  | infoData.setUpdateTime(new Date()); | 
|---|
|  |  |  | infoData.setDataId(sysData.getAjdh()); | 
|---|
|  |  |  | infoData.setRemarks("备注信息"); | 
|---|
|  |  |  | 
|---|
|  |  |  | apiInfoDataRep.save(infoData); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | log.info("1106---廒间-同步数据:{}", apiData.toString()); | 
|---|
|  |  |  | log.info("1107---廒间-同步数据:{}", apiData.toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("---1106廒间-同步数据执行失败----{}", e.getMessage()); | 
|---|
|  |  |  | apiLog.setResult("1106廒间信息同步失败:" + e.getMessage()); | 
|---|
|  |  |  | log.error("---1107廒间-同步数据执行失败----{}", e.getMessage()); | 
|---|
|  |  |  | apiLog.setResult("1107廒间信息同步失败:" + e.getMessage()); | 
|---|
|  |  |  | apiLogRep.save(apiLog); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|