| | |
| | | import com.fzzy.api.utils.ContextUtil; |
| | | import com.fzzy.api.view.repository.Api1303Rep; |
| | | import com.fzzy.api.view.repository.ApiLogRep; |
| | | import com.fzzy.async.fzzy35.entity.Pest; |
| | | import com.fzzy.async.fzzy35.entity.Fz35Pest; |
| | | import com.fzzy.async.fzzy35.repository.Fzzy35Sync1303Rep; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | |
| | | apiLog.setId(ContextUtil.getUUID()); |
| | | try { |
| | | |
| | | List<Pest> list = fzzy35Sync1303Rep.findPestByReceiveDate(start, end); |
| | | List<Fz35Pest> list = fzzy35Sync1303Rep.findPestByReceiveDate(start, end); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | |
| | | Date syncTime = new Date(); |
| | | Api1303 api1303; |
| | | Api1105 api1105; |
| | | |
| | | for (Pest pest : list) { |
| | | List<Api1303> api1303List; |
| | | for (Fz35Pest fz35Pest : list) { |
| | | //获取货位信息 |
| | | api1105 = commonService.getApi1105Cache(pest.getDepotId()); |
| | | api1105 = commonService.getApi1105Cache(fz35Pest.getDepotId()); |
| | | if (null == api1105) { |
| | | continue; |
| | | } |
| | | |
| | | api1303 = new Api1303(); |
| | | api1303.setHcjcdh(api1105.getHwdm() + pest.getBatchId()); |
| | | api1303.setJcsj(pest.getReceiveDate()); |
| | | api1303.setHcjcdh(api1105.getHwdm() + fz35Pest.getBatchId()); |
| | | api1303.setJcsj(fz35Pest.getReceiveDate()); |
| | | api1303.setHwdm(api1105.getHwdm()); |
| | | |
| | | //检查害虫方法,0-远程、1-人工、2-其他 |
| | |
| | | api1303.setHczl("21212"); |
| | | |
| | | //虫口密度值集合 |
| | | String ckmdzjh = this.geeCkmdzjh(pest.getPestMax(), pest.getPoints()); |
| | | String ckmdzjh = this.geeCkmdzjh(fz35Pest.getPestMax(), fz35Pest.getPoints()); |
| | | api1303.setCkmdzjh(ckmdzjh); |
| | | |
| | | //虫粮等级判定,531-基本无虫粮、532-一般虫粮、533严重虫粮、534危害虫粮 |
| | | api1303.setCldjpd("531"); |
| | | if (pest.getPestMax() > 5) { |
| | | if (fz35Pest.getPestMax() > 5) { |
| | | api1303.setCldjpd("532"); |
| | | } |
| | | if (pest.getPestMax() > 30) { |
| | | if (fz35Pest.getPestMax() > 30) { |
| | | api1303.setCldjpd("533"); |
| | | } |
| | | |
| | | api1303.setCzbz(Constant.CZBZ_I); |
| | | api1303.setZhgxsj(syncTime); |
| | | |
| | | api1303.setBizId(pest.getBatchId()); |
| | | api1303.setBizId(fz35Pest.getBatchId()); |
| | | api1303.setKqdm(api1105.getKqdm()); |
| | | api1303.setSyncTime(syncTime); |
| | | api1303List = api1303Rep.getDataByHcjcdh(api1303.getHcjcdh()); |
| | | if(null == api1303List || api1303List.isEmpty()){ |
| | | api1303.setCzbz(Constant.CZBZ_I); |
| | | }else { |
| | | api1303.setCzbz(api1303List.get(0).getCzbz()); |
| | | } |
| | | api1303Rep.save(api1303); |
| | | } |
| | | |