| | |
| | | package com.fzzy.async.fzzy40.impl; |
| | | |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.entity.Api1105; |
| | | import com.fzzy.api.entity.Api1202; |
| | | 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.Api1201Rep; |
| | | import com.fzzy.api.view.repository.Api1202Rep; |
| | | import com.fzzy.api.view.repository.Api1404Rep; |
| | | import com.fzzy.api.view.repository.ApiLogRep; |
| | | import com.fzzy.async.fzzy40.entity.Fz40InoutNoticeIn; |
| | | import com.fzzy.async.fzzy40.entity.Fz40InoutRecord; |
| | |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private ApiTriggerService apiTriggerService; |
| | | @Autowired |
| | | private Api1201Rep api1201Rep; |
| | | @Autowired |
| | | private Api1202Rep api1202Rep; |
| | | @Autowired |
| | | private Api1404Rep api1404Rep; |
| | | @Autowired |
| | | private ApiCommonService commonService; |
| | | @Autowired |
| | |
| | | List<Fz40InoutNoticeIn> listInoutNotice; |
| | | List<Api1202> api1202List; |
| | | List<Fz40InoutRecordItem> listInoutRecordItem; |
| | | List<Api1201> api1201List; |
| | | List<Api1404> api1404List; |
| | | for (Fz40InoutRecord sysData : list) { |
| | | if (sysData.getRecordStatus().equals("DEL") || sysData.getRecordStatus().equals("ERROR")) { |
| | | continue; |
| | |
| | | //默认一个随便值 |
| | | apiData.setLxdh(StringUtils.isEmpty(sysData.getUserContact()) ? "13012345678" : sysData.getUserContact().trim()); |
| | | |
| | | apiData.setSfzh(null == sysData.getUserId() ? "410183200010100000" : sysData.getUserId().trim()); |
| | | if(StringUtils.isEmpty(sysData.getUserId()) || sysData.getUserId().length() != 18){ |
| | | sysData.setUserId("410183199003187055"); |
| | | } |
| | | |
| | | //获取合同号 |
| | | //获取通知单信息,查询合同号和计划明细号 |
| | | listInoutNotice = fzzySyncNoticeInRep.listInoutNoticeInById(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()); |
| | | 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()); |
| | | api1404List = api1404Rep.getDataByBizIdAndKqdm(listInoutNotice.get(0).getPlanId(), kqdm); |
| | | if(null != api1404List && api1404List.size() > 0){ |
| | | apiData.setJhmxh(api1404List.get(0).getJhmxdh()); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | //毛重信息 |
| | | apiData.setMz(sysData.getFullWeight()); |
| | | if (null == sysData.getFullWeightTime()) { |
| | | sysData.setFullWeightTime(DateUtils.addMinutes(sysData.getRegisterTime(), 25)); |
| | | } |
| | | if (!sysData.getFullWeightTime().after(sysData.getRegisterTime())) { |
| | | sysData.setFullWeightTime(DateUtils.addMinutes(sysData.getRegisterTime(), 25)); |
| | | } |
| | |
| | | |
| | | //皮重信息 |
| | | apiData.setPz(sysData.getEmptyWeight()); |
| | | if (null == sysData.getEmptyWeightTime()) { |
| | | sysData.setEmptyWeightTime(DateUtils.addMinutes(sysData.getFullWeightTime(), 60)); |
| | | } |
| | | if (!sysData.getEmptyWeightTime().after(sysData.getFullWeightTime())) { |
| | | sysData.setEmptyWeightTime(DateUtils.addMinutes(sysData.getFullWeightTime(), 60)); |
| | | } |
| | |
| | | |
| | | apiData.setBzwkl(0 - sysData.getDePackage()); |
| | | apiData.setBzbjs(sysData.getBzbjs()); |
| | | |
| | | apiData.setCmsj(sysData.getCompleteTime()); |
| | | if(StringUtils.isNotEmpty(sysData.getSettleId())){ |
| | | apiData.setRkjsdh(kqdm + sysData.getSettleId()); |
| | | } |
| | | //其它 |
| | | apiData.setQtkl(0 - sysData.getDeOther()); |
| | | //值仓 现场扣重 |
| | |
| | | apiData.setBizId(sysData.getId()); |
| | | apiData.setKqdm(kqdm); |
| | | apiData.setSyncTime(new Date()); |
| | | api1202List = api1202Rep.getDataById(apiData.getRkywdh()); |
| | | if (null == api1202List || api1202List.isEmpty()) { |
| | | apiData.setCzbz(Constant.CZBZ_I); |
| | | } else { |
| | | apiData.setCzbz(api1202List.get(0).getCzbz()); |
| | | } |
| | | |
| | | //判断是否为船运 |
| | | if (StringUtils.isNotEmpty(sysData.getTransType()) && sysData.getTransType().equals("3")) { |
| | | listInoutRecordItem = fzzy40SyncInoutRecordItemRep.findDataByRecordId(sysData.getId()); |
| | |
| | | |
| | | int idNum = Integer.valueOf(sysData.getId().substring(12)) * 100 + 10001; |
| | | for (Fz40InoutRecordItem fz40InoutRecordItem : listInoutRecordItem) { |
| | | if ("DEL".equals(fz40InoutRecordItem.getRecordStatus())) { |
| | | continue; |
| | | } |
| | | if (fz40InoutRecordItem.getSettleWeight() <= 0) { |
| | | continue; |
| | | } |
| | |
| | | apiData.setMz(fz40InoutRecordItem.getFullWeight()); |
| | | apiData.setPz(fz40InoutRecordItem.getEmptyWeight()); |
| | | apiData.setJz(fz40InoutRecordItem.getSettleWeight()); |
| | | |
| | | apiData.setMzjlsj(fz40InoutRecordItem.getFullWeightTime()); |
| | | apiData.setPzjlsj(fz40InoutRecordItem.getEmptyWeightTime()); |
| | | api1202List = api1202Rep.getDataById(apiData.getRkywdh()); |
| | | if (null == api1202List || api1202List.isEmpty()) { |
| | | apiData.setCzbz(Constant.CZBZ_I); |
| | | } else { |
| | | apiData.setCzbz(api1202List.get(0).getCzbz()); |
| | | } |
| | | api1202Rep.save(apiData); |
| | | idNum++; |
| | | } |
| | | } else { |
| | | api1202List = api1202Rep.getDataById(apiData.getRkywdh()); |
| | | if (null == api1202List || api1202List.isEmpty()) { |
| | | apiData.setCzbz(Constant.CZBZ_I); |
| | | } else { |
| | | apiData.setCzbz(api1202List.get(0).getCzbz()); |
| | | } |
| | | //保存数据 |
| | | api1202Rep.save(apiData); |
| | | } |