| | |
| | | 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 { |
| | | callApiLogSaveMat(mat,kingDeeUtilType, "商品编号重复:"+mat.getMatnr(), false); |
| | | log.info("同步新物料[商品编号:{}],商品编号重复!!!", mat.getMatnr()); |
| | | 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; |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.erp.kingdee.entity.param.LoginParam; |
| | | import com.zy.erp.kingdee.enums.KingDeeUtilType; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | if (Cools.isEmpty(jsonObject.getString("Message"))) { |
| | | success = true; |
| | | } else { |
| | | callApiLogSaveLog(JSON.toJSONString(loginParam),false); |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", URL+loginaddress, JSON.toJSONString(loginParam), response); |
| | | throw new CoolException("登录金蝶失败"); |
| | | // throw new CoolException("登录金蝶失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | callApiLogSaveLog(JSON.toJSONString(loginParam),false); |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", URL+loginaddress, JSON.toJSONString(loginParam), response); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "登录金蝶", |
| | | URL + loginaddress, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(loginParam), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { log.error("", e); } |
| | | // try { |
| | | // // 保存接口日志 |
| | | // apiLogService.save( |
| | | // "登录金蝶", |
| | | // URL + loginaddress, |
| | | // null, |
| | | // "127.0.0.1", |
| | | // JSON.toJSONString(loginParam), |
| | | // response, |
| | | // success |
| | | // ); |
| | | // } catch (Exception e) { log.error("", e); } |
| | | } |
| | | return SUCCESS.setContent(cookie); |
| | | } |
| | | |
| | | |
| | | public static Object findValueByKey(JSONObject json, String key) { |
| | | Set<String> keySet = json.keySet(); |
| | | for (String k : keySet) { |
| | | Object v = json.get(k); |
| | | if (k.equals(key)) { |
| | | return v; |
| | | } else if (v instanceof JSONArray) { |
| | | int size = ((JSONArray) v).size(); |
| | | for (int i = 0; i <= size - 1; i++) { |
| | | Object result = findValueByKey((JSONObject) ((JSONArray) v).get(i), key); |
| | | if (result != null){ |
| | | return result; |
| | | } |
| | | } |
| | | } else if (v instanceof JSONObject){ |
| | | Object result = findValueByKey((JSONObject) v, key); |
| | | public static Object findValueByKey(JSONObject json, String key) { |
| | | Set<String> keySet = json.keySet(); |
| | | for (String k : keySet) { |
| | | Object v = json.get(k); |
| | | if (k.equals(key)) { |
| | | return v; |
| | | } else if (v instanceof JSONArray) { |
| | | int size = ((JSONArray) v).size(); |
| | | for (int i = 0; i <= size - 1; i++) { |
| | | Object result = findValueByKey((JSONObject) ((JSONArray) v).get(i), key); |
| | | if (result != null){ |
| | | return result; |
| | | } |
| | | } |
| | | } else if (v instanceof JSONObject){ |
| | | Object result = findValueByKey((JSONObject) v, key); |
| | | if (result != null){ |
| | | return result; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void callApiLogSaveLog(String response, Boolean bool) { |
| | | apiLogService.save("登录金蝶失败", URL, "null", loginaddress, |
| | | "套账ID:"+acctID+"、账号:"+username+"、密码:"+password, |
| | | response, bool); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | ReviewOrderSwitch: false |
| | | # 地址 |
| | | address: |
| | | URL: http://ht01.wlgear.com:16001 |
| | | URL: http://58.210.10.90:28090 |
| | | #登录地址 |
| | | loginaddress: K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc |
| | | #单据,商品档案地址 |
| | |
| | | outaddress: K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc |
| | | # 登录账号管理 |
| | | login : |
| | | acctID: "64c7666b20caf2" |
| | | username: "cs" |
| | | password: "123456" |
| | | acctID: "647e849ab6fa0f" |
| | | username: "llw" |
| | | password: "666666" |
| | | lcid: 2052 |
| | |
| | | // ,{field: 'id', align: 'center',title: 'ID'} |
| | | // ,{field: 'uuid', align: 'center',title: '日志编号'} |
| | | ,{field: 'namespace', align: 'center',title: '名称空间'} |
| | | ,{field: 'url', align: 'center',title: '表名'} |
| | | ,{field: 'url', align: 'center',title: '表单ID'} |
| | | ,{field: 'appkey', align: 'center',title: '平台密钥',hide: true} |
| | | // ,{field: 'timestamp', align: 'center',title: '时间戳'} |
| | | ,{field: 'clientIp', align: 'center',title: '中间表IP'} |
| | | ,{field: 'clientIp', align: 'center',title: 'URL',hide: true} |
| | | ,{field: 'request', align: 'center',title: '请求内容'} |
| | | ,{field: 'response', align: 'center',title: '操作内容'} |
| | | // ,{field: 'err', align: 'center',title: '异常内容'} |