|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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()); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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.append(gbCheckList.get(0).getCode()).append(","); | 
|---|
|  |  |  | jyxmz.append(fz35CheckItem.getValue()).append(","); | 
|---|
|  |  |  | jyxm.append(",").append(gbCheckList.get(0).getCode()); | 
|---|
|  |  |  | jyxmz.append(",").append(fz35CheckItem.getValue()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | api1310.setJyxm(jyxm.toString()); | 
|---|
|  |  |  | api1310.setJyxmz(jyxmz.toString()); | 
|---|
|  |  |  | 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); | 
|---|