| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasArmRules; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.ArmPrecomputeParam; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.BasArmRulesService; |
| | |
| | | throw new CoolException("获取码垛数量失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | try{ |
| | | log.error("fail==>获取码垛数量:"+e.getLocalizedMessage()); |
| | | } catch (Exception e1){ |
| | | |
| | | } |
| | | // return FAIL.setMsg(e.getLocalizedMessage()); |
| | | return FAIL; |
| | | // log.error("fail", e); |
| | | // return FAIL.setMsg(e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "获取码垛数量", |
| | | URL + QuantityOfPalletizing, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(armPrecomputeParam), |
| | | response, |
| | | success |
| | | ); |
| | | |
| | | if (success){ |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "获取码垛数量", |
| | | URL +"/"+ QuantityOfPalletizing, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(armPrecomputeParam), |
| | | response, |
| | | success |
| | | ); |
| | | } else { |
| | | beforeBodyWriteCallApiLogSave( |
| | | "获取码垛数量", |
| | | URL +"/"+ QuantityOfPalletizing, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(armPrecomputeParam), |
| | | response, |
| | | success |
| | | ); |
| | | } |
| | | } catch (Exception e) { log.error("", e); } |
| | | } |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | public void beforeBodyWriteCallApiLogSave(String name, String url, String appkey, String ip, String request, String response, boolean success) { |
| | | ApiLog apiLog = apiLogService.selectOne(new EntityWrapper<ApiLog>() |
| | | .eq("namespace", name) |
| | | .eq("request", request) |
| | | .eq("response", response) |
| | | .eq("result", success? 1:0) |
| | | .orderBy("create_time", false) |
| | | ); |
| | | |
| | | if (!Cools.isEmpty(apiLog)){ |
| | | long parseLong = Long.parseLong(apiLog.getTimestamp()); |
| | | if (new Date().getTime()-parseLong<5*1000*60){ |
| | | return; |
| | | } |
| | | } |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | name, |
| | | url, |
| | | appkey, |
| | | ip, |
| | | request, |
| | | response, |
| | | success |
| | | ); |
| | | } |
| | | } |