|  |  |  | 
|---|
|  |  |  | import com.fzzy.async.fzzy35.repository.Fzzy35SyncDrugLogDtlRep; | 
|---|
|  |  |  | import com.fzzy.async.fzzy35.repository.Fzzy35SyncDrugLogPeopleRep; | 
|---|
|  |  |  | import com.fzzy.async.fzzy35.repository.Fzzy35SyncDrugLogWayRep; | 
|---|
|  |  |  | import com.fzzy.otherview.gd2022.dto.GdApi1023; | 
|---|
|  |  |  | import com.fzzy.otherview.gd2022.dto.GdApi1023Dtl; | 
|---|
|  |  |  | import com.fzzy.otherview.gd2022.dto.GdApi1023People; | 
|---|
|  |  |  | import com.fzzy.otherview.gd2022.dto.GdApi1023Way; | 
|---|
|  |  |  | import com.fzzy.push.gd2022.dto.Gd2022Api1023; | 
|---|
|  |  |  | import com.fzzy.push.gd2022.dto.Gd2022Api1023Dtl; | 
|---|
|  |  |  | import com.fzzy.push.gd2022.dto.Gd2022Api1023People; | 
|---|
|  |  |  | import com.fzzy.push.gd2022.dto.Gd2022Api1023Way; | 
|---|
|  |  |  | import com.fzzy.push.gd2022.ApiCodeConstant; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GdApi1023 gdApi1023; | 
|---|
|  |  |  | GdApi1023Way gdApi1023Way; | 
|---|
|  |  |  | GdApi1023People gdApi1023People; | 
|---|
|  |  |  | GdApi1023Dtl gdApi1023Dtl; | 
|---|
|  |  |  | Gd2022Api1023 GD2022Api1023; | 
|---|
|  |  |  | Gd2022Api1023Way gd2022Api1023Way; | 
|---|
|  |  |  | Gd2022Api1023People gd2022Api1023People; | 
|---|
|  |  |  | Gd2022Api1023Dtl gd2022Api1023Dtl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<GdApi1023Dtl> dtlList; | 
|---|
|  |  |  | List<GdApi1023Way> wayList; | 
|---|
|  |  |  | List<GdApi1023People> peopleList; | 
|---|
|  |  |  | List<Gd2022Api1023Dtl> dtlList; | 
|---|
|  |  |  | List<Gd2022Api1023Way> wayList; | 
|---|
|  |  |  | List<Gd2022Api1023People> peopleList; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ApiInfoData> apiInfoList; | 
|---|
|  |  |  | ApiInfoData infoData; | 
|---|
|  |  |  | Api1105 api1105; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (Fz35DrugLogApply data : list) { | 
|---|
|  |  |  | gdApi1023 = new GdApi1023(); | 
|---|
|  |  |  | BeanUtils.copyProperties(data, gdApi1023); | 
|---|
|  |  |  | gdApi1023.setXzbm(data.getXzbm().substring(7)); | 
|---|
|  |  |  | gdApi1023.setKqdm(kqdm); | 
|---|
|  |  |  | gdApi1023.setDwdm(kqdm.substring(0, 18)); | 
|---|
|  |  |  | gdApi1023.setYjmc(data.getDrugName()); | 
|---|
|  |  |  | gdApi1023.setYjlx(data.getDrugType()); | 
|---|
|  |  |  | gdApi1023.setZhgxsj(data.getUpdateTime()); | 
|---|
|  |  |  | GD2022Api1023 = new Gd2022Api1023(); | 
|---|
|  |  |  | BeanUtils.copyProperties(data, GD2022Api1023); | 
|---|
|  |  |  | GD2022Api1023.setXzbm(data.getXzbm().substring(7)); | 
|---|
|  |  |  | GD2022Api1023.setKqdm(kqdm); | 
|---|
|  |  |  | GD2022Api1023.setDwdm(kqdm.substring(0, 18)); | 
|---|
|  |  |  | GD2022Api1023.setYjmc(data.getDrugName()); | 
|---|
|  |  |  | GD2022Api1023.setYjlx(data.getDrugType()); | 
|---|
|  |  |  | GD2022Api1023.setZhgxsj(data.getUpdateTime()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //储粮粮情明细表 | 
|---|
|  |  |  | List<Fz35DrugLogDtl> dtls = drugLogDtlRep.listDrugLogDtl(data.getXzbm()); | 
|---|
|  |  |  | if (null != dtls && dtls.size() > 0) { | 
|---|
|  |  |  | dtlList = new ArrayList<>(); | 
|---|
|  |  |  | for (Fz35DrugLogDtl dtl : dtls) { | 
|---|
|  |  |  | gdApi1023Dtl = new GdApi1023Dtl(); | 
|---|
|  |  |  | BeanUtils.copyProperties(dtl, gdApi1023Dtl); | 
|---|
|  |  |  | gd2022Api1023Dtl = new Gd2022Api1023Dtl(); | 
|---|
|  |  |  | BeanUtils.copyProperties(dtl, gd2022Api1023Dtl); | 
|---|
|  |  |  | //获取货位信息 | 
|---|
|  |  |  | api1105 = commonService.getApi1105Cache(dtl.getDepotId()); | 
|---|
|  |  |  | if (null == api1105) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | gdApi1023Dtl.setCfdm(api1105.getHwdm().substring(0, 25)); | 
|---|
|  |  |  | gdApi1023Dtl.setLspzdm(dtl.getFoodVariety()); | 
|---|
|  |  |  | gdApi1023Dtl.setLsxzdm(dtl.getFoodType()); | 
|---|
|  |  |  | gdApi1023Dtl.setLsdjdm(dtl.getFoodLevel()); | 
|---|
|  |  |  | gdApi1023Dtl.setLssl(dtl.getNumber()); | 
|---|
|  |  |  | gdApi1023Dtl.setSf(dtl.getPerWet()); | 
|---|
|  |  |  | gdApi1023Dtl.setZz(dtl.getPerImpurity()); | 
|---|
|  |  |  | dtlList.add(gdApi1023Dtl); | 
|---|
|  |  |  | gd2022Api1023Dtl.setCfdm(api1105.getHwdm().substring(0, 25)); | 
|---|
|  |  |  | gd2022Api1023Dtl.setLspzdm(dtl.getFoodVariety()); | 
|---|
|  |  |  | gd2022Api1023Dtl.setLsxzdm(dtl.getFoodType()); | 
|---|
|  |  |  | gd2022Api1023Dtl.setLsdjdm(dtl.getFoodLevel()); | 
|---|
|  |  |  | gd2022Api1023Dtl.setLssl(dtl.getNumber()); | 
|---|
|  |  |  | gd2022Api1023Dtl.setSf(dtl.getPerWet()); | 
|---|
|  |  |  | gd2022Api1023Dtl.setZz(dtl.getPerImpurity()); | 
|---|
|  |  |  | dtlList.add(gd2022Api1023Dtl); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | gdApi1023.setDtls(dtlList); | 
|---|
|  |  |  | GD2022Api1023.setDtls(dtlList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Fz35DrugLogWay> ways = drugLogWayRep.listDrugLogWay(data.getXzbm()); | 
|---|
|  |  |  | if (null != ways && ways.size() > 0) { | 
|---|
|  |  |  | wayList = new ArrayList<>(); | 
|---|
|  |  |  | for (Fz35DrugLogWay way : ways) { | 
|---|
|  |  |  | gdApi1023Way = new GdApi1023Way(); | 
|---|
|  |  |  | BeanUtils.copyProperties(way, gdApi1023Way); | 
|---|
|  |  |  | wayList.add(gdApi1023Way); | 
|---|
|  |  |  | gd2022Api1023Way = new Gd2022Api1023Way(); | 
|---|
|  |  |  | BeanUtils.copyProperties(way, gd2022Api1023Way); | 
|---|
|  |  |  | wayList.add(gd2022Api1023Way); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | gdApi1023.setWays(wayList); | 
|---|
|  |  |  | GD2022Api1023.setWays(wayList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Fz35DrugLogPeople> peoples = drugLogPeopleRep.listDrugLogPeople(data.getXzbm()); | 
|---|
|  |  |  | if (null != peoples && peoples.size() > 0) { | 
|---|
|  |  |  | peopleList = new ArrayList<>(); | 
|---|
|  |  |  | for (Fz35DrugLogPeople people : peoples) { | 
|---|
|  |  |  | gdApi1023People = new GdApi1023People(); | 
|---|
|  |  |  | BeanUtils.copyProperties(people, gdApi1023People); | 
|---|
|  |  |  | peopleList.add(gdApi1023People); | 
|---|
|  |  |  | gd2022Api1023People = new Gd2022Api1023People(); | 
|---|
|  |  |  | BeanUtils.copyProperties(people, gd2022Api1023People); | 
|---|
|  |  |  | peopleList.add(gd2022Api1023People); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | gdApi1023.setPeoples(peopleList); | 
|---|
|  |  |  | GD2022Api1023.setPeoples(peopleList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //持久化保存,单独存入非国标接口表 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | apiInfoList = apiInfoDataRep.getDataByInteAndData(ApiCodeConstant.API_1023, data.getXzbm(), kqdm); | 
|---|
|  |  |  | if (null == apiInfoList || apiInfoList.isEmpty()) { | 
|---|
|  |  |  | gdApi1023.setCzbz(Constant.CZBZ_I); | 
|---|
|  |  |  | GD2022Api1023.setCzbz(Constant.CZBZ_I); | 
|---|
|  |  |  | infoData.setCzbz(Constant.CZBZ_I); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | gdApi1023.setCzbz(apiInfoList.get(0).getCzbz()); | 
|---|
|  |  |  | GD2022Api1023.setCzbz(apiInfoList.get(0).getCzbz()); | 
|---|
|  |  |  | infoData.setCzbz(apiInfoList.get(0).getCzbz()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | infoData.setData(JSON.toJSONString(gdApi1023)); | 
|---|
|  |  |  | infoData.setData(JSON.toJSONString(GD2022Api1023)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存数据 | 
|---|
|  |  |  | apiInfoDataRep.save(infoData); | 
|---|
|  |  |  | log.info("1023---同步数据:{}", gdApi1023.toString()); | 
|---|
|  |  |  | log.info("1023---同步数据:{}", GD2022Api1023.toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|