| | |
| | | import com.fzzy.async.fzzy35.repository.Fzzy35Sync1310Rep; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | Api1105 api1105; |
| | | List<Fz35CheckItem> fz35CheckItems; |
| | | List<GbCheckItem> gbCheckList; |
| | | String jyxm; |
| | | String jyxmz; |
| | | StringBuilder jyxm; |
| | | StringBuilder jyxmz; |
| | | List<Api1310> api1310List; |
| | | int index = 10001; |
| | | for (Fz35Quality fz35Quality : list) { |
| | | api1105 = commonService.getApi1105Cache(fz35Quality.getDepotId()); |
| | | if (null == api1105) { |
| | | continue; |
| | | } |
| | | api1310 = new Api1310(); |
| | | api1310.setZjbgdh(fz35Quality.getId()); |
| | | api1310.setZjbgdh(fz35Quality.getType() + DateFormatUtils.format(fz35Quality.getTime(), "yyyyMMdd") + String.valueOf(index).substring(1)); |
| | | api1310.setHwdm(api1105.getHwdm()); |
| | | api1310.setKqdm(kqdm); |
| | | api1310.setLspzdm(fz35Quality.getFoodVariety()); |
| | |
| | | api1310.setJyyj(fz35Quality.getStandard()); |
| | | api1310.setZblb("2"); |
| | | //检测项,检测值 |
| | | jyxm = ""; |
| | | jyxmz = ""; |
| | | jyxm = new StringBuilder(); |
| | | jyxmz = new StringBuilder(); |
| | | fz35CheckItems = fzzySync1203Rep.listInoutCheckItem(fz35Quality.getId(), deptId.substring(0, 4)); |
| | | if (null != fz35CheckItems && fz35CheckItems.size() > 0) { |
| | | |
| | | for (Fz35CheckItem fz35CheckItem : fz35CheckItems) { |
| | | if(StringUtils.isEmpty(fz35CheckItem.getValue())){ |
| | | continue; |
| | | } |
| | | gbCheckList = gbCheckItemRep.findByBizCode(fz35CheckItem.getStandardId()); |
| | | |
| | | if (gbCheckList == null || gbCheckList.isEmpty()) { |
| | | continue; |
| | | } |
| | | jyxm += gbCheckList.get(0).getCode() + ","; |
| | | jyxmz += fz35CheckItem.getValue() + ","; |
| | | jyxm.append(",").append(gbCheckList.get(0).getCode()); |
| | | jyxmz.append(",").append(fz35CheckItem.getValue()); |
| | | } |
| | | } |
| | | api1310.setJyxm(jyxm); |
| | | api1310.setJyxmz(jyxmz); |
| | | api1310.setJyxm(jyxm.toString().substring(1)); |
| | | api1310.setJyxmz(jyxmz.toString().substring(1)); |
| | | |
| | | api1310.setZbjgpd(fz35Quality.getResult()); |
| | | api1310.setQfrq(fz35Quality.getTime()); |
| | |
| | | } |
| | | |
| | | api1310Rep.save(api1310); |
| | | index ++; |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("---同步失败----{}", e); |