专栏电商日志财经减肥爱情
投稿投诉
爱情常识
搭配分娩
减肥两性
孕期塑形
财经教案
论文美文
日志体育
养生学堂
电商科学
头戴业界
专栏星座
用品音乐

SpringBoot利用AOP写一个日志管理

  1。需求
  目前有这么个问题,有两个系统CSP和OMS,这俩系统共用的是同一套日志操作:Log;目前想区分下这俩系统的日志操作,那没办法了,只能重写一份Log的日志操作;
  你也可以参照若依框架的日志系统实现。2。新建一张日志表
  sysopercsplogNavicatPremiumDataTransferSourceServer:jpcscadminSourceServerType:MySQLSourceServerVersion:50728SourceHost:rmuf6miy84gu8u433x9。mysql。rds。aliyuncs。com:3306SourceSchema:jpomsTargetServerType:MySQLTargetServerVersion:50728FileEncoding:65001Date:0809202209:21:45SETNAMESutf8mb4;SETFOREIGNKEYCHECKS0;TablestructureforsysopercsplogDROPTABLEIFEXISTSsysopercsplog;CREATETABLEsysopercsplog(operidbigint(20)NOTNULLAUTOINCREMENTCOMMENT日志主键,titlevarchar(50)CHARACTERSETutf8mb4COLLATEutf8mb4generalciNULLDEFAULTCOMMENT模块标题,businesstypeint(2)NULLDEFAULT0COMMENT业务类型(0其它,1新增,2修改,3删除,4授权,5导出,6导入,7强退,8生成代码,9清空数据),methodvarchar(100)CHARACTERSETutf8mb4COLLATEutf8mb4generalciNULLDEFAULTCOMMENT方法名称,requestmethodvarchar(10)CHARACTERSETutf8mb4COLLATEutf8mb4generalciNULLDEFAULTCOMMENT请求方式,operatortypeint(1)NULLDEFAULT0COMMENT操作类别(0其它1后台用户2手机端用户),opernamevarchar(50)CHARACTERSETutf8mb4COLLATEutf8mb4generalciNULLDEFAULTCOMMENT操作人员,deptnamevarchar(50)CHARACTERSETutf8mb4COLLATEutf8mb4generalciNULLDEFAULTCOMMENT部门名称,operurlvarchar(255)CHARACTERSETutf8mb4COLLATEutf8mb4generalciNULLDEFAULTCOMMENT请求URL,operipvarchar(128)CHARACTERSETutf8mb4COLLATEutf8mb4generalciNULLDEFAULTCOMMENT主机地址,operlocationvarchar(255)CHARACTERSETutf8mb4COLLATEutf8mb4generalciNULLDEFAULTCOMMENT操作地点,operparamvarchar(2000)CHARACTERSETutf8mb4COLLATEutf8mb4generalciNULLDEFAULTCOMMENT请求参数,jsonresulttextCHARACTERSETutf8mb4COLLATEutf8mb4generalciNULLCOMMENT返回参数,statusint(1)NULLDEFAULT0COMMENT操作状态(0正常1异常),errormsgvarchar(2000)CHARACTERSETutf8mb4COLLATEutf8mb4generalciNULLDEFAULTCOMMENT错误消息,opertimedatetimeNULLDEFAULTNULLCOMMENT操作时间,PRIMARYKEY(operid)USINGBTREE,INDEXidxtime(opertime,title,opername)USINGBTREE)ENGINEInnoDCHARACTERSETutf8mb4COLLATEutf8mb4generalciCOMMENTCSP系统操作日志记录;3。写相应的Controller层packagecom。juepeiscm。csp。controller。csplog;importcom。juepeiscm。admin。api。domain。SysOperLog;importcom。juepeiscm。common。core。controller。BaseController;importcom。juepeiscm。common。core。domain。AjaxResult;importcom。juepeiscm。common。core。page。TableDataInfo;importcom。juepeiscm。common。enums。BusinessType;importcom。juepeiscm。common。utils。poi。ExcelUtil;importcom。juepeiscm。csp。annotation。CspLog;importcom。juepeiscm。csp。domain。csplog。SysOperCspLog;importcom。juepeiscm。csp。service。csplog。ISysOperCspLogService;importorg。springframework。beans。factory。annotation。Autowired;importorg。springframework。security。access。prepost。PreAuthorize;importorg。springframework。web。bind。annotation。;importjava。util。List;操作CSP系统日志Author:py。sunDate:20229714:51RestControllerRequestMapping({csplogopercsplog})publicclassSysOperCsplogControllerextendsBaseController{AutowiredprivateISysOperCspLogServiceoperCspLogService;publicSysOperCsplogController(){}查询操作日志列表paramsysOperCspLogreturnPreAuthorize(ss。hasPermi(monitor:operlog:list))GetMapping({list})publicTableDataInfolist(SysOperCspLogsysOperCspLog){this。startPage();ListSysOperCspLoglistthis。operCspLogService。selectOperLogList(sysOperCspLog);returnthis。getDataTable(list);}查询系统模块的分类paramreturnGetMapping({listTitle})publicTableDataInfolistTitle(){this。startPage();ListStringlistthis。operCspLogService。selectOperLogListTitle();returnthis。getDataTable(list);}CspLog(title导出CSP系统日志,businessTypeBusinessType。EXPORT)PreAuthorize(ss。hasPermi(monitor:operlog:export))GetMapping({export})publicAjaxResultexport(SysOperCspLogoperLog){ListSysOperCspLoglistthis。operCspLogService。selectOperLogList(operLog);ExcelUtilSysOperCspLogutilnewExcelUtil(SysOperLog。class);returnutil。exportExcel(list,操作CSP系统日志);}CspLog(title操作CSP系统日志,businessTypeBusinessType。DELETE)PreAuthorize(ss。hasPermi(monitor:operlog:remove))DeleteMapping({{operIds}})publicAjaxResultremove(PathVariableLong〔〕operIds){returnthis。toAjax(this。operCspLogService。deleteOperLogByIds(operIds));}CspLog(title清除CSP系统日志,businessTypeBusinessType。CLEAN)PreAuthorize(ss。hasPermi(monitor:operlog:remove))DeleteMapping({clean})publicAjaxResultclean(){this。operCspLogService。cleanOperLog();returnAjaxResult。success();}}Service接口层packagecom。juepeiscm。csp。service。csplog;importcom。juepeiscm。admin。api。domain。SysOperLog;importcom。juepeiscm。csp。domain。csplog。SysOperCspLog;importjava。util。List;Author:py。sunDate:20229715:02publicinterfaceISysOperCspLogService{voidinsertOperlog(SysOperCspLogvar1);ListSysOperCspLogselectOperLogList(SysOperCspLogvar1);ListStringselectOperLogListTitle();intdeleteOperLogByIds(Long〔〕var1);SysOperLogselectOperLogById(Longvar1);voidcleanOperLog();}Service实现packagecom。juepeiscm。csp。service。impl。csplog;importcom。juepeiscm。admin。api。domain。SysOperLog;importcom。juepeiscm。common。core。domain。AjaxResult;importcom。juepeiscm。common。core。domain。entity。SysDept;importcom。juepeiscm。common。core。domain。entity。SysUser;importcom。juepeiscm。common。core。domain。model。LoginUser;importcom。juepeiscm。common。exception。CustomException;importcom。juepeiscm。common。utils。SecurityUtils;importcom。juepeiscm。common。utils。ServletUtils;importcom。juepeiscm。common。utils。StringUtils;importcom。juepeiscm。csp。domain。csplog。SysOperCspLog;importcom。juepeiscm。csp。mapper。csplog。SysOperCspLogMapper;importcom。juepeiscm。csp。service。csplog。ISysOperCspLogService;importcom。juepeiscm。framework。web。service。TokenService;importcom。juepeiscm。uam。service。ISysDeptService;importcom。juepeiscm。uam。version。UamVersion;importorg。apache。dubbo。config。annotation。Reference;importorg。springframework。beans。factory。annotation。Autowired;importorg。springframework。stereotype。Service;importjava。util。List;Author:py。sunDate:20229715:03ServicepublicclassSysOperCspLogServiceImplimplementsISysOperCspLogService{AutowiredprivateSysOperCspLogMapperoperLogMapper;AutowiredprivateTokenServicetokenService;Reference(versionUamVersion。idV)publicISysDeptServicedeptService;OverridepublicvoidinsertOperlog(SysOperCspLogsysOperCspLog){try{this。operLogMapper。insertOperlog(sysOperCspLog);}catch(Exceptione){e。printStackTrace();thrownewCustomException(CSP系统日志插入失败,请联系管理员!!!);}}OverridepublicListSysOperCspLogselectOperLogList(SysOperCspLogsysOperCspLog){returnthis。operLogMapper。selectOperLogList(sysOperCspLog);}OverridepublicListStringselectOperLogListTitle(){returnthis。operLogMapper。selectOperLogListTitle();}OverridepublicintdeleteOperLogByIds(Long〔〕operIds){returnthis。operLogMapper。deleteOperLogByIds(operIds);}OverridepublicSysOperLogselectOperLogById(LongoperId){returnthis。operLogMapper。selectOperLogById(operId);}OverridepublicvoidcleanOperLog(){this。operLogMapper。cleanOperLog();}}Mapper接口packagecom。juepeiscm。csp。mapper。csplog;importcom。juepeiscm。admin。api。domain。SysOperLog;importcom。juepeiscm。csp。domain。csplog。SysOperCspLog;importjava。util。List;Author:py。sunDate:20229715:06publicinterfaceSysOperCspLogMapper{voidinsertOperlog(SysOperCspLogvar1);ListSysOperCspLogselectOperLogList(SysOperCspLogsysOperCspLog);ListStringselectOperLogListTitle();intdeleteOperLogByIds(Long〔〕var1);SysOperLogselectOperLogById(Longvar1);voidcleanOperLog();}Mapper。xml(我用的是Mybatis)lt;?xmlversion1。0encodingUTF8?!DOCTYPEmapperPUBLICmybatis。orgDTDMapper3。0ENhttp:mybatis。orgdtdmybatis3mapper。dtdmappernamespacecom。juepeiscm。csp。mapper。csplog。SysOperCspLogMapperresultMaptypeSysOperCspLogidSysOperLogResultidpropertyoperIdcolumnoperidresultpropertytitlecolumntitleresultpropertybusinessTypecolumnbusinesstyperesultpropertymethodcolumnmethodresultpropertyrequestMethodcolumnrequestmethodresultpropertyoperatorTypecolumnoperatortyperesultpropertyoperNamecolumnopernameresultpropertydeptNamecolumndeptnameresultpropertyoperUrlcolumnoperurlresultpropertyoperIpcolumnoperipresultpropertyoperLocationcolumnoperlocationresultpropertyoperParamcolumnoperparamresultpropertyjsonResultcolumnjsonresultresultpropertystatuscolumnstatusresultpropertyerrorMsgcolumnerrormsgresultpropertyoperTimecolumnopertimeresultMapsqlidselectOperLogVoselectoperid,title,businesstype,method,requestmethod,operatortype,opername,deptname,operurl,operip,operlocation,operparam,jsonresult,status,errormsg,opertimefromsysopercsplogsqlinsertidinsertOperlogparameterTypeSysOperCspLoginsertintosysopercsplog(title,businesstype,method,requestmethod,operatortype,opername,deptname,operurl,operip,operlocation,operparam,jsonresult,status,errormsg,opertime)values({title},{businessType},{method},{requestMethod},{operatorType},{operName},{deptName},{operUrl},{operIp},{operLocation},{operParam},{jsonResult},{status},{errorMsg},sysdate())insertselectidselectOperLogListparameterTypeSysOperCspLogresultMapSysOperLogResultincluderefidselectOperLogVowhereiftesttitle!nullandtitle!ANDtitlelikeconcat(,{title},)ififtestbusinessType!nullandbusinessType!ANDbusinesstype{businessType}ififtestbusinessTypes!nullandbusinessTypes。length0ANDbusinesstypeinforeachcollectionbusinessTypesitembusinessTypeopen(separator,close){businessType}foreachififteststatus!nullANDstatus{status}ififtestoperName!nullandoperName!ANDopernamelikeconcat(,{operName},)ififtestparams。beginTime!nullandparams。beginTime!!开始时间检索anddateformat(opertime,ymd)dateformat({params。beginTime},ymd)ififtestparams。endTime!nullandparams。endTime!!结束时间检索anddateformat(opertime,ymd)dateformat({params。endTime},ymd)ifwhereorderbyoperiddescselectdeleteiddeleteOperLogByIdsparameterTypeLongdeletefromsysopercsplogwhereoperidinforeachcollectionarrayitemoperIdopen(separator,close){operId}foreachdeleteselectidselectOperLogByIdparameterTypeLongresultMapSysOperLogResultincluderefidselectOperLogVowhereoperid{operId}selectselectidselectOperLogListTitleresultTypejava。lang。Stringselectdistinct(title)fromsysopercsplogselectupdateidcleanOperLogtruncatetablesysopercsplogupdatemapper
  定义一个日志管理的名称:CspLogpackagecom。juepeiscm。csp。annotation;importcom。juepeiscm。common。enums。BusinessType;importcom。juepeiscm。common。enums。OperatorType;importjava。lang。annotation。;CSP系统的日志管理Author:py。sunDate:20229714:42Target表示注解可以使用到哪些地方,可以是类,方法,或者是属性上,定义在ElementType枚举中:Retention作用是定义被它所注解的注解保留多久,一共有三种策略,定义在RetentionPolicy枚举中:我们的CspLog注解,可以作用在方法和参数上,将由编译器记录在类文件中,并在运行时由VM保留,因此可以反射性地读取。该注解是通过AOP进行解析的Target({ElementType。PARAMETER,ElementType。METHOD})Retention(RetentionPolicy。RUNTIME)DocumentedpublicinterfaceCspLog{模块returnStringtitle()default;功能returnBusinessTypebusinessType()defaultBusinessType。OTHER;操作人类别returnOperatorTypeoperatorType()defaultOperatorType。MANAGE;是否保存请求的参数returnbooleanisSaveRequestData()defaulttrue;}实体类SysOperCspLogpackagecom。juepeiscm。csp。domain。csplog;importcom。fasterxml。jackson。annotation。JsonFormat;importcom。juepeiscm。common。annotation。Excel;importcom。juepeiscm。common。core。domain。BaseEntity;importjava。util。Date;Author:py。sunDate:20229715:04publicclassSysOperCspLogextendsBaseEntity{privatestaticfinallongserialVersionUID1L;Excel(name操作序号,cellTypeExcel。ColumnType。NUMERIC)privateLongoperId;Excel(name操作模块)privateStringtitle;Excel(name业务类型,readConverterExp0其它,1新增,2修改,3删除,4授权,5导出,6导入,7强退,8生成代码,9清空数据)privateIntegerbusinessType;privateInteger〔〕businessTypes;Excel(name请求方法)privateStringmethod;Excel(name请求方式)privateStringrequestMethod;Excel(name操作类别,readConverterExp0其它,1后台用户,2手机端用户)privateIntegeroperatorType;Excel(name操作人员)privateStringoperName;Excel(name部门名称)privateStringdeptName;Excel(name请求地址)privateStringoperUrl;Excel(name操作地址)privateStringoperIp;Excel(name操作地点)privateStringoperLocation;Excel(name请求参数)privateStringoperParam;Excel(name返回参数)privateStringjsonResult;Excel(name状态,readConverterExp0正常,1异常)privateIntegerstatus;Excel(name错误消息)privateStringerrorMsg;JsonFormat(patternyyyyMMddHH:mm:ss)Excel(name操作时间,width30。0D,dateFormatyyyyMMddHH:mm:ss)privateDateoperTime;publicSysOperCspLog(){}publicLonggetOperId(){returnthis。operId;}publicvoidsetOperId(LongoperId){this。operIdoperId;}publicStringgetTitle(){returnthis。title;}publicvoidsetTitle(Stringtitle){this。titletitle;}publicIntegergetBusinessType(){returnthis。businessType;}publicvoidsetBusinessType(IntegerbusinessType){this。businessTypebusinessType;}publicInteger〔〕getBusinessTypes(){returnthis。businessTypes;}publicvoidsetBusinessTypes(Integer〔〕businessTypes){this。businessTypesbusinessTypes;}publicStringgetMethod(){returnthis。method;}publicvoidsetMethod(Stringmethod){this。methodmethod;}publicStringgetRequestMethod(){returnthis。requestMethod;}publicvoidsetRequestMethod(StringrequestMethod){this。requestMethodrequestMethod;}publicIntegergetOperatorType(){returnthis。operatorType;}publicvoidsetOperatorType(IntegeroperatorType){this。operatorTypeoperatorType;}publicStringgetOperName(){returnthis。operName;}publicvoidsetOperName(StringoperName){this。operNameoperName;}publicStringgetDeptName(){returnthis。deptName;}publicvoidsetDeptName(StringdeptName){this。deptNamedeptName;}publicStringgetOperUrl(){returnthis。operUrl;}publicvoidsetOperUrl(StringoperUrl){this。operUrloperUrl;}publicStringgetOperIp(){returnthis。operIp;}publicvoidsetOperIp(StringoperIp){this。operIpoperIp;}publicStringgetOperLocation(){returnthis。operLocation;}publicvoidsetOperLocation(StringoperLocation){this。operLocationoperLocation;}publicStringgetOperParam(){returnthis。operParam;}publicvoidsetOperParam(StringoperParam){this。operParamoperParam;}publicStringgetJsonResult(){returnthis。jsonResult;}publicvoidsetJsonResult(StringjsonResult){this。jsonResultjsonResult;}publicIntegergetStatus(){returnthis。status;}publicvoidsetStatus(Integerstatus){this。statusstatus;}publicStringgetErrorMsg(){returnthis。errorMsg;}publicvoidsetErrorMsg(StringerrorMsg){this。errorMsgerrorMsg;}publicDategetOperTime(){returnthis。operTime;}publicvoidsetOperTime(DateoperTime){this。operTimeoperTime;}}10。定义日志管理的切面
  大家一定要记住哈,所有针对实体的SysOperCspLog赋值操作必须在这里main执行。packagecom。juepeiscm。csp。controller。utils;importcom。alibaba。fastjson。JSON;importcom。juepeiscm。common。core。domain。entity。SysDept;importcom。juepeiscm。common。core。domain。model。LoginUser;importcom。juepeiscm。common。enums。BusinessStatus;importcom。juepeiscm。common。enums。HttpMethod;importcom。juepeiscm。common。utils。ServletUtils;importcom。juepeiscm。common。utils。StringUtils;importcom。juepeiscm。common。utils。ip。IpUtils;importcom。juepeiscm。common。utils。spring。SpringUtils;importcom。juepeiscm。csp。annotation。CspLog;importcom。juepeiscm。csp。domain。csplog。SysOperCspLog;importcom。juepeiscm。framework。aspectj。LogAspect;importcom。juepeiscm。framework。manager。AsyncManager;importcom。juepeiscm。framework。web。service。TokenService;importcom。juepeiscm。uam。service。ISysDeptService;importcom。juepeiscm。uam。version。UamVersion;importorg。apache。dubbo。config。annotation。Reference;importorg。aspectj。lang。JoinPoint;importorg。aspectj。lang。Signature;importorg。aspectj。lang。annotation。AfterReturning;importorg。aspectj。lang。annotation。AfterThrowing;importorg。aspectj。lang。annotation。Aspect;importorg。aspectj。lang。annotation。Pointcut;importorg。aspectj。lang。reflect。MethodSignature;importorg。slf4j。Logger;importorg。slf4j。LoggerFactory;importorg。springframework。stereotype。Component;importorg。springframework。validation。BindingResult;importorg。springframework。web。multipart。MultipartFile;importorg。springframework。web。servlet。HandlerMapping;importjavax。servlet。http。HttpServletRequest;importjavax。servlet。http。HttpServletResponse;importjava。lang。reflect。Method;importjava。util。Collection;importjava。util。Iterator;importjava。util。Map;Author:py。sunDate:20229716:31操作日志记录处理AspectComponentpublicclassCspLogAspect{privatestaticfinalLoggerlogLoggerFactory。getLogger(CspLog。class);Reference(versionUamVersion。idV)publicISysDeptServicedeptService;publicCspLogAspect(){}把CspLog配置为切入点。配置织入点Pointcut(annotation(com。juepeiscm。csp。annotation。CspLog))publicvoidlogPointCut(){}拦截异常操作处理完请求后执行该方法。也就是用CspLog注解的方法,执行完后,调用handleLog方法,处理返回结果。AfterReturning(pointcutlogPointCut(),returningjsonResult)publicvoiddoAfterReturning(JoinPointjoinPoint,ObjectjsonResult){this。handleLog(joinPoint,(Exception)null,jsonResult);}AfterThrowing(valuelogPointCut(),throwinge)publicvoiddoAfterThrowing(JoinPointjoinPoint,Exceptione){this。handleLog(joinPoint,e,(Object)null);}如果函数抛出了异常,也是执行handleLog方法,不过和正常返回的参数不一样,此处是为了处理异常。protectedvoidhandleLog(JoinPointjoinPoint,Exceptione,ObjectjsonResult){try{获得注解CspLogcontrollerLogthis。getAnnotationLog(joinPoint);if(controllerLognull){return;}获取当前的用户LoginUserloginUser((TokenService)SpringUtils。getBean(TokenService。class))。getLoginUser(ServletUtils。getRequest());数据库日志SysOperCspLogoperLognewSysOperCspLog();operLog。setStatus(BusinessStatus。SUCCESS。ordinal());请求的地址StringipIpUtils。getIpAddr(ServletUtils。getRequest());operLog。setOperIp(ip);返回参数operLog。setJsonResult(JSON。toJSONString(jsonResult));operLog。setOperUrl(ServletUtils。getRequest()。getRequestURI());if(loginUser!null){operLog。setOperName(loginUser。getUsername());}获取当前登录用户的部门名称SysDeptsysDeptdeptService。selectDeptIdByUserIdAndAppId(loginUser。getUser()。getUserId(),oms);if(sysDept!nullStringUtils。isNotEmpty(sysDept。getDeptName())){operLog。setDeptName(sysDept。getDeptName());}if(e!null){operLog。setStatus(BusinessStatus。FAIL。ordinal());operLog。setErrorMsg(StringUtils。substring(e。getMessage(),0,2000));}设置方法名称StringclassNamejoinPoint。getTarget()。getClass()。getName();StringmethodNamejoinPoint。getSignature()。getName();operLog。setMethod(className。methodName());设置请求方式operLog。setRequestMethod(ServletUtils。getRequest()。getMethod());处理设置注解上的参数this。getControllerMethodDescription(joinPoint,controllerLog,operLog);保存数据库AsyncManager。me()。execute(AsyncFactoryCsp。recordOper(operLog));}catch(Exceptionvar10){记录本地异常日志log。error(前置通知异常);log。error(异常信息:{},var10。getMessage());var10。printStackTrace();}}publicvoidgetControllerMethodDescription(JoinPointjoinPoint,CspLoglog,SysOperCspLogoperLog)throwsException{operLog。setBusinessType(log。businessType()。ordinal());operLog。setTitle(log。title());operLog。setOperatorType(log。operatorType()。ordinal());if(log。isSaveRequestData()){this。setRequestValue(joinPoint,operLog);}}privatevoidsetRequestValue(JoinPointjoinPoint,SysOperCspLogoperLog)throwsException{StringrequestMethodoperLog。getRequestMethod();if(!HttpMethod。PUT。name()。equals(requestMethod)!HttpMethod。POST。name()。equals(requestMethod)){Maplt;?,?paramsMap(Map)ServletUtils。getRequest()。getAttribute(HandlerMapping。URITEMPLATEVARIABLESATTRIBUTE);operLog。setOperParam(StringUtils。substring(paramsMap。toString(),0,2000));}else{Stringparamsthis。argsArrayToString(joinPoint。getArgs());operLog。setOperParam(StringUtils。substring(params,0,2000));}}privateCspLoggetAnnotationLog(JoinPointjoinPoint)throwsException{SignaturesignaturejoinPoint。getSignature();MethodSignaturemethodSignature(MethodSignature)signature;MethodmethodmethodSignature。getMethod();returnmethod!null?(CspLog)method。getAnnotation(CspLog。class):null;}privateStringargsArrayToString(Object〔〕paramsArray){Stringparams;if(paramsArray!nullparamsArray。length0){for(inti0;iparamsArray。length;i){if(StringUtils。isNotNull(paramsArray〔i〕)!this。isFilterObject(paramsArray〔i〕)){ObjectjsonObjJSON。toJSON(paramsArray〔i〕);paramsparamsjsonObj。toString();}}}returnparams。trim();}publicbooleanisFilterObject(Objecto){Classlt;?clazzo。getClass();if(clazz。isArray()){returnclazz。getComponentType()。isAssignableFrom(MultipartFile。class);}else{Iteratoriter;if(Collection。class。isAssignableFrom(clazz)){Collectioncollection(Collection)o;itercollection。iterator();if(iter。hasNext()){returniter。next()instanceofMultipartFile;}}elseif(Map。class。isAssignableFrom(clazz)){Mapmap(Map)o;itermap。entrySet()。iterator();if(iter。hasNext()){Map。Entryentry(Map。Entry)iter。next();returnentry。getValue()instanceofMultipartFile;}}returnoinstanceofMultipartFileoinstanceofHttpServletRequestoinstanceofHttpServletResponseoinstanceofBindingResult;}}}AsyncFactoryCsppackagecom。juepeiscm。csp。controller。utils;importcom。juepeiscm。common。utils。ip。AddressUtils;importcom。juepeiscm。common。utils。spring。SpringUtils;importcom。juepeiscm。csp。domain。csplog。SysOperCspLog;importcom。juepeiscm。csp。service。csplog。ISysOperCspLogService;importorg。slf4j。Logger;importorg。slf4j。LoggerFactory;importjava。util。TimerTask;Author:py。sunDate:20229716:47publicclassAsyncFactoryCsp{privatestaticfinalLoggersysuserloggerLoggerFactory。getLogger(sysuser);publicAsyncFactoryCsp(){}publicstaticTimerTaskrecordOper(finalSysOperCspLogoperLog){returnnewTimerTask(){publicvoidrun(){operLog。setOperLocation(AddressUtils。getRealAddressByIP(operLog。getOperIp()));((ISysOperCspLogService)SpringUtils。getBean(ISysOperCspLogService。class))。insertOperlog(operLog);}};}}12。写一个Controller的Demo来执行一条日志试试在这里插入代码片packagecom。juepeiscm。csp。controller。order;importcom。alibaba。fastjson。JSON;importcom。juepeiscm。admin。api。service。ISysDictDataService;importcom。juepeiscm。common。annotation。RepeatSubmit;importcom。juepeiscm。common。core。controller。BaseController;importcom。juepeiscm。common。core。domain。AjaxResult;importcom。juepeiscm。common。core。domain。entity。SysDictData;importcom。juepeiscm。common。core。page。TableDataInfo;importcom。juepeiscm。common。enums。BusinessType;importcom。juepeiscm。common。exception。BaseException;importcom。juepeiscm。common。utils。StringUtils;importcom。juepeiscm。common。utils。poi。ExcelUtil;importcom。juepeiscm。csp。annotation。CspLog;importcom。juepeiscm。csp。domain。order。CspGodownEntry;importcom。juepeiscm。csp。domain。order。CspGodownEntryDetails;importcom。juepeiscm。csp。service。common。MenuLogService;importcom。juepeiscm。csp。service。data。ICspGoodsdataService;importcom。juepeiscm。csp。service。order。ICspGodownEntryService;importcom。juepeiscm。csp。vo。GodownEntryExcel;importcom。juepeiscm。csp。vo。GoodsDataForGodownEntryDetails;importio。swagger。annotations。Api;importio。swagger。annotations。ApiOperation;importorg。slf4j。Logger;importorg。slf4j。LoggerFactory;importorg。springframework。beans。factory。annotation。Autowired;importorg。springframework。security。access。prepost。PreAuthorize;importorg。springframework。util。CollectionUtils;importorg。springframework。web。bind。annotation。;importorg。springframework。web。multipart。MultipartFile;importjavax。validation。Valid;importjava。math。BigDecimal;importjava。math。RoundingMode;importjava。util。;importjava。util。stream。Collectors;入库订单Controllerauthorjuepeiscmdate20210723Api(tags入库订单接口)RestControllerRequestMapping(ordergodownEntry)publicclassCspGodownEntryControllerextendsBaseController{privatestaticfinalLoggerloggerLoggerFactory。getLogger(CspGodownEntryController。class);AutowiredprivateICspGodownEntryServicecspGodownEntryService;AutowiredprivateICspGoodsdataServicegoodsDataService;AutowiredprivateMenuLogServicemenuLogService;AutowiredprivateISysDictDataServicesysDictDataService;新增入库订单DemoPreAuthorize(ss。hasPermi(order:godownEntry:add))ApiOperation(value新增入库订单)CspLog(title入库订单demo4,businessTypeBusinessType。INSERT)PostMapping(addOrder)RepeatSubmitpublicAjaxResultaddDemo(RequestBodyValidCspGodownEntrygodownEntry){try{returntoAjax(cspGodownEntryService。insertOmsGodownEntry(godownEntry));}catch(Exceptione){e。printStackTrace();returnAjaxResult。error(新增失败,请联系管理员);}}}测试下,看看数据库内容

乳腺癌已超过肺癌成为全球第一大癌症,快看看怎样防护!今天世界癌症日。世卫组织国际癌症研究机构最新发布的数据显示,乳腺癌已经取代肺癌,成为全球第一大癌症。在我国,每年新发乳腺癌病例约为42万例,发病高峰在4555岁。在这样生活环境下,喝茶和喝咖啡,到底哪一个更顾健康?本文为你分析真相众所周知,西方的咖啡和东方的茶是当代最风行的饮料,上班族人手一杯咖啡一杯茶的景象随处可见。咖啡和茶不只有提振精神帮助专注力之功效,亦有研究指称能降低癌症糖尿病等益处。咖啡和茶中含有豪斯欧文刚打完湖人就申请交易不是巧合詹姆斯绝对招募了他直播吧2月4日讯今天欧文向篮网提出交易申请。对此,凯尔特人评论员埃迪豪斯表示篮网最近好得令人难以置信,欧文打得很好。他很安静,布鲁克林一切都很顺利。然后突然间,噪音就来了。具有讽刺没对比就没伤害,强森在我们眼里很魁梧在NBA球星眼里就是细狗强森是谁,估计很多朋友都认识,他是运动员也是演员,他属于跨界很成功的艺人。他的身材令人印象深刻,身高1米9一身腱子肉,常年都在健身房塑造身材。就是因为肌肉强悍身材魁梧,他才能饰演那慧抖销产品管理及操作步骤在慧抖销添加的产品主要用于新建自动发布任务,同时可用于发布视频时的标题自动生成注意慧抖销产品管理中的产品一旦删除,其对应的任务视频关键词以及排名将会全部清除,发布到短视频平台的视频多动症的孩子吃什么药?小孩得了多动症能治好吗?当家长和老师怀疑孩子可能患有多动症时,家长应该选择发育行为科或儿科进行诊断和治疗。多动症的孩子吃什么药?小孩得了多动症能治好吗?今天,我将为家长和老师回答这些问题。老师怀疑孩子可能请关爱癫痫儿童,注重孩子的心理健康!一百多天来,我们每个人的心都被胡鑫宇事件牵动着,因为网上总有很多错综复杂各说其词的信息扑面而来,可真相只有一个呀!官方通报认定胡某宇系自缢死亡,根据目前的官方通报以及事实结果显示,带孩子要当心!3岁男童玩碰碰车撞致肝破裂家长们小心了,小朋友玩碰碰车也可能会出交通事故。近日,西安市儿童医院在多科室协作下成功抢救了一例肝破裂患儿。萌萌(化名)是个3岁男孩,在游乐场玩碰碰车时腹部不慎撞到栏杆上,出现剧烈3岁女孩刷牙时不慎摔倒,牙刷插入舌底!医生紧急提醒医生!医生!赶紧帮帮我!1月31日晚21时40分,一阵急促的求助声伴随着撕心裂肺的哭叫响彻长沙市中心医院(南华大学附属长沙中心医院)急诊科,一个嘴里含着牙刷的小女孩被家长抱着来到口飞鹤奶粉持续带动产业链升级,究竟带来什么好处?飞鹤乳业作为涵盖农牧业制造业服务业的民生产业,在享受自然馈赠的同时,也需要肩负起节能降碳的责任,用实际的行动探索绿色低碳的发展模式。飞鹤在2006年开始建设现代化规模化的万头牧场,在抢先机中开新局!浦东国际招商团出海招商马不停蹄招商推介马不停蹄对接合作热火朝天连日来,浦东新区科经委牵头组建的产业招商团队,会同张江集团在日本开启了开放向未来首次海外产业投资促进活动,日程表排得满满当当,积极推进产业投资合作,
驶入高速研发快车道,恒进感应科技选择华天软件PLM恒进感应科技(十堰)股份有限公司被称为感应热处理专家,是一家专业开发生产销售维修高中频感应加热设备的高新技术装备上市公司(证券代码838670),致力于感应处理成套设备设计制作全方何以引得海内外客商来?甘肃办云端秀自我推荐1月31日,中国甘肃省特色优势产业招商线上推介会(德国西班牙专场)在兰州举行。甘肃省商务厅供图中新网兰州1月31日电(记者丁思)历史沉淀深厚能源资源富集物流人流畅通优惠政策叠加31雪山评论火车站更名让回家的路更近了作者雪山网狐2022年4月,位于湖北巴东县境内的两座火车站同时更名,其中离县城80多公里山路的原巴东站,因设在野三关镇而更名为野三关站即将通车的郑(州)万(州)高铁原规划巴东北站,何以引得海内外客商来?甘肃办云端秀自我推荐1月31日,中国甘肃省特色优势产业招商线上推介会(德国西班牙专场)在兰州举行。甘肃省商务厅供图中新网兰州1月31日电(记者丁思)历史沉淀深厚能源资源富集物流人流畅通优惠政策叠加31国家级名单!甘肃1地入选!交通运输部关于公布十四五期国家公交都市建设示范工程创建城市名单的通知各省自治区直辖市新疆生产建设兵团交通运输厅(局委)为深入贯彻实施城市公共交通优先发展战略,推动城市公共交通高质量又是业绩造假,股价高台跳水,市值没了50亿,股民太坑了吧目前A股市场ST的股票数量依旧还有不少,其实,在笔者看来,ST股票所存在的风险还是较大,特别是最近几年,ST股票的股价都在下跌。更关键的是,大多数ST股票的价格都是在5元以下,超过最美九大峡谷,你去过几个?壮美险峻幽深浩大说到峡谷你很可能会想到这些形容词峡谷完美结合了自然与人文之美第1名雅鲁藏布江大峡谷(西藏)雅鲁藏布大峡谷,位于西藏雅鲁藏布江下游,是世界第一深度大峡谷。从空中或从西菲律宾洋葱价格屡创历史新高,农户提早收获卖高价视频加载中(央视财经经济信息联播)今年1月的前半个月,菲律宾的洋葱市场零售价屡创历史新高,在一些超市里,洋葱的售价最高一度达到每公斤800菲律宾比索约合人民币98元。近日,随着大量在夏威夷遇上全球最大的活火山爆发!还睡了最贵的四季酒店!话说我这次简直是人品大爆发,这刚来夏威夷大岛没多久,就碰到了一场百年不遇的火山大爆发!而且爆发的这座还是全世界最大的活火山MuanaLoa,看来真的要去买彩票了!刚到夏威夷的第二个我的2023年从一场说走就走的旅行开始(防城港大海篇)从今天起记录我的2023三年疫情,健康码行程码核酸封控几乎浇灭了我心中的诗和远方,最近的一次旅行已可追溯到2020年的新都桥自驾之旅,所有对祖国大好河山的向往只能是偶尔翻一翻曾经拍鹿晗撇女友现身酒吧,和辣妹同框玩很嗨,疑留关晓彤独在酒店头条创作挑战赛近日,鹿晗和关晓彤屡屡登上热搜,这对相恋5年的小情侣素来低调,新年却同游日本并频频被偶遇。在一系列的背影照后,网友晒出了两人的正面合影,还曝出鹿晗疑似成功求婚关晓彤。
友情链接:快好找快生活快百科快传网中准网文好找聚热点快软网