| | |
| | | package com.fzzy.async.fzzy40.impl; |
| | | |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.entity.Api1105; |
| | | import com.fzzy.api.entity.Api1205; |
| | | import com.fzzy.api.entity.ApiLog; |
| | | import com.fzzy.api.entity.*; |
| | | import com.fzzy.api.service.ApiCommonService; |
| | | import com.fzzy.api.service.ApiTriggerService; |
| | | import com.fzzy.api.utils.ContextUtil; |
| | | import com.fzzy.api.utils.DateUtil; |
| | | import com.fzzy.api.view.repository.Api1205Rep; |
| | | import com.fzzy.api.view.repository.ApiLogRep; |
| | | import com.fzzy.api.view.repository.*; |
| | | import com.fzzy.async.fzzy40.entity.Fz40InoutNoticeOut; |
| | | import com.fzzy.async.fzzy40.entity.Fz40InoutRecord; |
| | | import com.fzzy.async.fzzy40.entity.Fz40InoutRecordItem; |
| | |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private ApiTriggerService apiTriggerService; |
| | | @Autowired |
| | | private Api1201Rep api1201Rep; |
| | | @Autowired |
| | | private Api1205Rep api1205Rep; |
| | | @Autowired |
| | | private Api1404Rep api1404Rep; |
| | | @Autowired |
| | | private ApiCommonService commonService; |
| | | @Autowired |
| | |
| | | * @param start |
| | | * @param end |
| | | */ |
| | | public void syncData(String kqdm, String deptId, Date start, Date end) { |
| | | public void syncData(String kqdm, String deptId, Date start, Date end) { |
| | | |
| | | log.info("-------------1205接口数据开始同步------------------"); |
| | | |
| | |
| | | |
| | | //获取合同号 |
| | | listInoutNotice = fzzySyncNoticeOutRep.listInoutNoticeOutById(sysData.getNoticeId()); |
| | | if(null != listInoutNotice && listInoutNotice.size() >0){ |
| | | if(StringUtils.isNotEmpty(listInoutNotice.get(0).getContractId())){ |
| | | apiData.setHth(api1105.getHwdm().substring(0,18) + listInoutNotice.get(0).getContractId()); |
| | | if (null != listInoutNotice && listInoutNotice.size() > 0) { |
| | | //合同号 |
| | | if (StringUtils.isNotEmpty(listInoutNotice.get(0).getContractId())) { |
| | | List<Api1201> api1201List = api1201Rep.getDataByBizId(listInoutNotice.get(0).getContractId()); |
| | | if(null != api1201List && api1201List.size() > 0){ |
| | | apiData.setHth(api1201List.get(0).getHth()); |
| | | } |
| | | } |
| | | if(StringUtils.isNotEmpty(listInoutNotice.get(0).getPlanId())){ |
| | | apiData.setJhmxh(listInoutNotice.get(0).getPlanId()); |
| | | if (StringUtils.isNotEmpty(listInoutNotice.get(0).getPlanId())) { |
| | | List<Api1404> api1404List = api1404Rep.getDataByBizId(listInoutNotice.get(0).getPlanId()); |
| | | if(null != api1404List && api1404List.size() > 0){ |
| | | apiData.setJhmxh(api1404List.get(0).getJhmxdh()); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | //皮重信息 |
| | | apiData.setPz(sysData.getEmptyWeight()); |
| | | if (null == sysData.getEmptyWeightTime()) { |
| | | sysData.setEmptyWeightTime(DateUtils.addMinutes(sysData.getRegisterTime(), 25)); |
| | | } |
| | | if(!sysData.getEmptyWeightTime().after(sysData.getRegisterTime())){ |
| | | sysData.setEmptyWeightTime(DateUtils.addMinutes(sysData.getRegisterTime(), 25)); |
| | | } |
| | |
| | | |
| | | //毛重信息 |
| | | apiData.setMz(sysData.getFullWeight()); |
| | | if (null == sysData.getFullWeightTime()) { |
| | | sysData.setFullWeightTime(DateUtils.addMinutes(sysData.getEmptyWeightTime(), 60)); |
| | | } |
| | | if(!sysData.getFullWeightTime().after(sysData.getEmptyWeightTime())){ |
| | | sysData.setFullWeightTime(DateUtils.addMinutes(sysData.getEmptyWeightTime(), 60)); |
| | | } |
| | |
| | | sysData.setCompleteTime(DateUtils.addMinutes(sysData.getFullWeightTime(), 10)); |
| | | } |
| | | apiData.setCmsj(sysData.getCompleteTime()); |
| | | if(StringUtils.isNotEmpty(sysData.getSettleId())){ |
| | | apiData.setCkjsdh(kqdm + sysData.getSettleId()); |
| | | } |
| | | |
| | | //操作标志及最后更新时间 |
| | | apiData.setZhgxsj(sysData.getUpdateTime()); |
| | |
| | | apiData.setSyncTime(new Date()); |
| | | log.info("1201---同步数据:{}",apiData.toString()); |
| | | |
| | | api1205List = api1205Rep.getDataById(apiData.getCkywdh()); |
| | | if(null == api1205List || api1205List.isEmpty()){ |
| | | apiData.setCzbz(Constant.CZBZ_I); |
| | | }else { |
| | | apiData.setCzbz(api1205List.get(0).getCzbz()); |
| | | } |
| | | //判断是否为船运 |
| | | if(StringUtils.isNotEmpty(sysData.getTransType()) && sysData.getTransType().equals("3")){ |
| | | listInoutRecordItem = fzzy40SyncInoutRecordItemRep.findDataByRecordId(sysData.getId()); |
| | |
| | | apiData.setMz(fz40InoutRecordItem.getFullWeight()); |
| | | apiData.setPz(fz40InoutRecordItem.getEmptyWeight()); |
| | | apiData.setJz(fz40InoutRecordItem.getSettleWeight()); |
| | | |
| | | api1205List = api1205Rep.getDataById(apiData.getCkywdh()); |
| | | if(null == api1205List || api1205List.isEmpty()){ |
| | | apiData.setCzbz(Constant.CZBZ_I); |
| | | }else { |
| | | apiData.setCzbz(api1205List.get(0).getCzbz()); |
| | | } |
| | | api1205Rep.save(apiData); |
| | | idNum ++; |
| | | } |
| | | }else { |
| | | api1205List = api1205Rep.getDataById(apiData.getCkywdh()); |
| | | if(null == api1205List || api1205List.isEmpty()){ |
| | | apiData.setCzbz(Constant.CZBZ_I); |
| | | }else { |
| | | apiData.setCzbz(api1205List.get(0).getCzbz()); |
| | | } |
| | | //保存数据 |
| | | api1205Rep.save(apiData); |
| | | } |