| | |
| | | import com.fzzy.api.view.repository.GbCheckItemRep; |
| | | import com.fzzy.async.fzzy40.entity.Fz40CheckItem; |
| | | import com.fzzy.async.fzzy40.entity.Fz40InoutRecord; |
| | | import com.fzzy.async.fzzy40.entity.Fz40InoutRecordItem; |
| | | import com.fzzy.async.fzzy40.repository.Fzzy40Sync1202Rep; |
| | | import com.fzzy.async.fzzy40.repository.Fzzy40Sync1203Rep; |
| | | import com.fzzy.async.fzzy40.repository.Fzzy40SyncInoutRecordItemRep; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | |
| | | |
| | | @Autowired |
| | | private Fzzy40Sync1202Rep fzzySync1202Rep; |
| | | @Autowired |
| | | private Fzzy40SyncInoutRecordItemRep fzzy40SyncInoutRecordItemRep; |
| | | @Autowired |
| | | private Fzzy40Sync1203Rep fzzySync1203Rep; |
| | | @Autowired |
| | |
| | | String zkl; |
| | | List<Api1203> api1203List; |
| | | List<Api1202> api1102List; |
| | | List<Fz40InoutRecordItem> listInoutRecordItem; |
| | | List<String> listIds; |
| | | for (Fz40InoutRecord sysData : list) { |
| | | //查询粮食入库信息,若为空则不进行同步上传 |
| | | api1102List = api1202Rep.getDataByBizId(sysData.getId()); |
| | | if(null == api1102List || api1102List.isEmpty()){ |
| | | continue; |
| | | listIds = new ArrayList<>(); |
| | | //判断是否为船运 |
| | | if(StringUtils.isNotEmpty(sysData.getTransType()) && sysData.getTransType().equals("3")){ |
| | | listInoutRecordItem = fzzy40SyncInoutRecordItemRep.findDataByRecordId(sysData.getId()); |
| | | if(null != listInoutRecordItem && listInoutRecordItem.size() > 0){ |
| | | int idNum = Integer.valueOf(sysData.getId().substring(12))*100 + 10001; |
| | | |
| | | for (Fz40InoutRecordItem fz40InoutRecordItem : listInoutRecordItem) { |
| | | listIds.add(Constant.INOUT_TYPE_14 + sysData.getId().substring(4,10) + String.valueOf(idNum).substring(1)); |
| | | idNum ++; |
| | | } |
| | | }else { |
| | | listIds.add(Constant.INOUT_TYPE_14 + sysData.getId().substring(4)); |
| | | } |
| | | }else { |
| | | listIds.add(Constant.INOUT_TYPE_14 + sysData.getId().substring(4)); |
| | | } |
| | | |
| | | //获取入库质检信息 |
| | | fz40CheckItems = fzzySync1203Rep.listInoutCheckItem(sysData.getCheckId(), deptId.substring(0, 4)); |
| | | if (null == fz40CheckItems || fz40CheckItems.isEmpty()) { |
| | | log.info("-------------没有获取到当前入库质检信息--------------"); |
| | | continue; |
| | | } |
| | | |
| | | for (String listId : listIds) { |
| | | //查询粮食入库信息,若为空则不进行同步上传 |
| | | api1102List = api1202Rep.getDataById(listId); |
| | | if(null == api1102List || api1102List.isEmpty()){ |
| | | continue; |
| | | } |
| | | |
| | |
| | | |
| | | apiData.setJyxm(jyxm); |
| | | apiData.setJyz(jyz); |
| | | apiData.setZkj(zkj.substring(1)); |
| | | apiData.setZkl(zkl.substring(1)); |
| | | apiData.setZkj(StringUtils.isEmpty(zkj)?"":zkj.substring(1)); |
| | | apiData.setZkl(StringUtils.isEmpty(zkl)?"":zkl.substring(1)); |
| | | if("UNPASS".equals(sysData.getCheckStatus())){ |
| | | apiData.setJyjg("0"); |
| | | } |
| | |
| | | apiData.setJysj(DateUtils.addMinutes(sysData.getRegisterTime(), 30)); |
| | | |
| | | //粮食品种 |
| | | String mappingCode = apiTriggerService.getMappingCode(Constant.TRIGGER_P_LSPZ, sysData.getFoodVariety()); |
| | | String mappingCode = apiTriggerService.getMappingCode(Constant.TRIGGER_P_LSPZ, sysData.getFoodVariety().substring(0,3)); |
| | | apiData.setLspzdm(mappingCode); |
| | | |
| | | //保管员复核 |
| | |
| | | apiData.setCzbz(api1203List.get(0).getCzbz()); |
| | | } |
| | | |
| | | //保存数据 |
| | | api1203Rep.save(apiData); |
| | | log.info("1203---同步数据:{}", apiData.toString()); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("---同步失败----{}", e); |
| | | apiLog.setResult("同步失败:" + e.getMessage()); |