| | |
| | | Tag tag = tagService.selectByName("全部", 1); |
| | | //物料状态 FUseOrgId .FNumber |
| | | FDocumentStatus="C"; |
| | | jsonObject.put("FilterString", "FCreateDate>'"+sdf.format(tag.getUpdateTime())+"' and FDocumentStatus='"+FDocumentStatus+"' and FUseOrgId .FNumber='201'"); |
| | | jsonObject.put("FilterString", "FCreateDate>'"+sdf.format(tag.getUpdateTime())+"' and FDocumentStatus='"+FDocumentStatus+"' and FUseOrgId .FNumber='100'"); |
| | | jsonObject.put("FieldKeys", "FName,FNumber,FCreateDate,FSpecification,FDocumentStatus"); |
| | | // FName : 物料名称 ; |
| | | // FNumber :物料编号; |
| | |
| | | for (int j = 0; j < data.size(); j++) { |
| | | JSONArray jsonArray = data.getJSONArray(j); |
| | | //对美国时间进行转换 |
| | | Date date = KingDeeUtil.KingDeeDate(jsonArray.get(2).toString()); |
| | | Date jsonDate = KingDeeUtil.KingDeeDate(jsonArray.get(2).toString()); |
| | | //生成商品档案 |
| | | //商品编号 |
| | | Mat mat = matService.selectByMatnr(jsonArray.get(1).toString()); |
| | |
| | | mat.setMaktx(jsonArray.get(0).toString()); |
| | | mat.setSpecs(jsonArray.get(3).toString());//规格 |
| | | mat.setTagId(tag.getId()); |
| | | mat.setCreateTime(date);//商品创建时间 |
| | | mat.setCreateTime(jsonDate);//商品创建时间 |
| | | mat.setUpdateTime(new Date()); |
| | | mat.setStatus(1); |
| | | //最新抓取商品时间 |
| | |
| | | // log.info("同步新物料[商品编号:{}]", mat.getMatnr()); |
| | | } |
| | | }else { |
| | | if (!jsonDate.equals(tag.getUpdateTime())){ |
| | | callApiLogSaveMat(mat,kingDeeUtilType, "商品编号重复:"+mat.getMatnr(), false); |
| | | log.info("同步新物料[商品编号:{}],商品编号重复!!!", mat.getMatnr()); |
| | | } |
| | | tag.setUpdateTime(date); |
| | | } |
| | | tag.setUpdateTime(jsonDate); |
| | | } |
| | | tagService.updateById(tag); |
| | | } else { |
| | |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "轮询数据", |
| | | URL + inaddress, |
| | | null, |
| | | "127.0.0.1", |
| | | add, |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { |
| | | log.error("", e); |
| | | } |
| | | // try { |
| | | // // 保存接口日志 |
| | | // apiLogService.save( |
| | | // "轮询数据", |
| | | // URL + inaddress, |
| | | // null, |
| | | // "127.0.0.1", |
| | | // add, |
| | | // response, |
| | | // success |
| | | // ); |
| | | // } catch (Exception e) { |
| | | // log.error("", e); |
| | | // } |
| | | } |
| | | } |
| | | return SUCCESS; |