| | |
| | | @Service |
| | | public class ErpTool { |
| | | |
| | | @Autowired |
| | | private InterfaceLogService interfaceLogService; |
| | | @Autowired |
| | | private SqlSessionFactory sqlSessionFactory; |
| | | public static InterfaceLogService interfaceLogService; |
| | | public void saveInterfaceLog(Object param, String path,String result,Integer type) { |
| | | SqlSession sqlSession2 = sqlSessionFactory.openSession(true); |
| | | InterfaceLogMapper mapper2 = sqlSession2.getMapper(InterfaceLogMapper.class); |
| | | |
| | | InterfaceLog interfaceLog=new InterfaceLog(); |
| | | interfaceLog.setType(type); |
| | | interfaceLog.setCreateDate(new Date()); |
| | | interfaceLog.setIsdeleted(Constants.ZERO); |
| | | if(param!=null){ |
| | | interfaceLog.setRequest(JSONObject.toJSONString(param)); |
| | | try { |
| | | if(interfaceLogService !=null) { |
| | | InterfaceLog interfaceLog = new InterfaceLog(); |
| | | interfaceLog.setType(type); |
| | | interfaceLog.setCreateDate(new Date()); |
| | | interfaceLog.setIsdeleted(Constants.ZERO); |
| | | if (param != null) { |
| | | interfaceLog.setRequest(JSONObject.toJSONString(param)); |
| | | } |
| | | interfaceLog.setPlat(Constants.ONE); |
| | | interfaceLog.setRepose(result); |
| | | interfaceLog.setName(path); |
| | | interfaceLog.setUrl(path); |
| | | interfaceLogService.create(interfaceLog); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | interfaceLog.setPlat(Constants.ONE); |
| | | interfaceLog.setRepose(result); |
| | | interfaceLog.setName(path); |
| | | interfaceLog.setUrl(path); |
| | | mapper2.insert(interfaceLog); |
| | | sqlSession2.commit(); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | throw e; |
| | | e.printStackTrace(); |
| | | }finally { |
| | | saveInterfaceLog(param,url,JSONArray.toJSONString(list),Constants.ZERO); |
| | | } |
| | |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | throw e; |
| | | e.printStackTrace(); |
| | | }finally { |
| | | saveInterfaceLog(param,url, JSONArray.toJSONString(list),Constants.ZERO); |
| | | } |
| | |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | throw e; |
| | | e.printStackTrace(); |
| | | }finally { |
| | | saveInterfaceLog(param,url,JSONObject.toJSONString(result),Constants.ZERO); |
| | | } |
| | |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | throw e; |
| | | e.printStackTrace(); |
| | | }finally { |
| | | saveInterfaceLog(param,url,JSONObject.toJSONString(result),Constants.ZERO); |
| | | } |