|  |  |  | 
|---|
|  |  |  | package com.fzzy.async.whhpjl.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.fzzy.api.Constant; | 
|---|
|  |  |  | import com.fzzy.api.entity.ApiInfoData; | 
|---|
|  |  |  | import com.fzzy.api.entity.ApiLog; | 
|---|
|  |  |  | import com.fzzy.api.utils.ContextUtil; | 
|---|
|  |  |  | import com.fzzy.api.view.repository.ApiInfoDataRep; | 
|---|
|  |  |  | import com.fzzy.api.view.repository.ApiLogRep; | 
|---|
|  |  |  | import com.fzzy.async.whhpjl.entity.Fz40WhjlDefaultBuilding; | 
|---|
|  |  |  | import com.fzzy.async.whhpjl.entity.Fz40WhjlDefaultUser; | 
|---|
|  |  |  | import com.fzzy.async.whhpjl.repository.Fz40ToWhjlSync1103Rep; | 
|---|
|  |  |  | import com.fzzy.async.whhpjl.entity.Fz40WhjlDefaultBuild; | 
|---|
|  |  |  | import com.fzzy.async.whhpjl.repository.Fz40ToWhjlSync1105Rep; | 
|---|
|  |  |  | import com.fzzy.whjl.dto.WhjlApi1105; | 
|---|
|  |  |  | import com.fzzy.otherview.whhpjl.WhjlConstant; | 
|---|
|  |  |  | import com.fzzy.otherview.whhpjl.dto.WhjlApi1105; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  | 
|---|
|  |  |  | private Fz40ToWhjlSync1105Rep fz40ToWhjlSync1105Rep; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApiLogRep apiLogRep; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApiInfoDataRep apiInfoDataRep; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 仓房信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | apiLog.setId(ContextUtil.getUUID()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | List<Fz40WhjlDefaultBuilding> list = fz40ToWhjlSync1105Rep.listApi1105(deptId.substring(0, 4)); | 
|---|
|  |  |  | List<Fz40WhjlDefaultBuild> list = fz40ToWhjlSync1105Rep.listApi1105(deptId.substring(0, 4)); | 
|---|
|  |  |  | if (null == list || list.isEmpty()) { | 
|---|
|  |  |  | log.info("-------------没有获取到单位信息------------------"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<ApiInfoData> apiInfoDataList; | 
|---|
|  |  |  | WhjlApi1105 apiData; | 
|---|
|  |  |  | for (Fz40WhjlDefaultBuilding sysData : list) { | 
|---|
|  |  |  | for (Fz40WhjlDefaultBuild sysData : list) { | 
|---|
|  |  |  | apiData = new WhjlApi1105(); | 
|---|
|  |  |  | apiData.setCfbh(sysData.getId());  //仓房编号 | 
|---|
|  |  |  | apiData.setJlqybh("");  //军粮企业编号 | 
|---|
|  |  |  | 
|---|
|  |  |  | apiData.setZp(null);  //罩棚 | 
|---|
|  |  |  | apiData.setJyd(null);  //简易囤 | 
|---|
|  |  |  | apiData.setJyc(null);  //简易仓 | 
|---|
|  |  |  | apiData.setSfyx("是");  //是否有效 | 
|---|
|  |  |  | apiData.setSfyx("");  //是否有效 | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | apiData.setBizId(sysData.getId()); | 
|---|
|  |  |  | apiData.setUpdateTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //TODO 持久化保存待实现 | 
|---|
|  |  |  | //持久化保存,单独存入非国标接口表 | 
|---|
|  |  |  | ApiInfoData infoData = new ApiInfoData(); | 
|---|
|  |  |  | infoData.setId(sysData.getId()); | 
|---|
|  |  |  | infoData.setKqdm(kqdm); | 
|---|
|  |  |  | infoData.setInteType(WhjlConstant.API_CATEGORY_11); | 
|---|
|  |  |  | infoData.setInteId(WhjlConstant.API_CODE_1105); | 
|---|
|  |  |  | infoData.setUpdateTime(new Date()); | 
|---|
|  |  |  | infoData.setDataId(sysData.getId()); | 
|---|
|  |  |  | infoData.setRemarks("备注信息"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //设置操作标志 | 
|---|
|  |  |  | apiInfoDataList = apiInfoDataRep.getDataByDataId(infoData.getDataId()); | 
|---|
|  |  |  | if (null == apiInfoDataList || apiInfoDataList.isEmpty()) { | 
|---|
|  |  |  | apiData.setCzbz(Constant.CZBZ_I); | 
|---|
|  |  |  | infoData.setCzbz(Constant.CZBZ_I); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | apiData.setCzbz(apiInfoDataList.get(0).getCzbz()); | 
|---|
|  |  |  | infoData.setCzbz(apiInfoDataList.get(0).getCzbz()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | infoData.setData(JSON.toJSONString(apiData)); | 
|---|
|  |  |  | apiInfoDataRep.save(infoData); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | log.info("1105---仓房-同步数据:{}", apiData.toString()); | 
|---|