@At
@Filters
@Ok("json")
public String saveIssuedDefine(@Param("..")DfjgQutotaAllotVO dfjgQutotaAllotVO){
String result = ssProjectManage.saveIssuedDefine(dfjgQutotaAllotVO);
return result;
}
问答
大佬快来快来,为啥存到数据库的数据有多条,打断点方法多次执行是为啥,不是jsp的问题。
标签:
无
31 回复
public String saveIssuedDefine(DfjgQutotaAllotVO dfjgQutotaAllotVO){
dfjgQutotaAllotVO.setIsValid("1");
dfjgQutotaAllotVO.setCreateDate(new Date());
dfjgQutotaAllotVO.setCreateUserId("1");
dfjgQutotaAllotVO.setQuotaId("2");
dfjgQutotaAllotVO.setYear("2018");
dfjgQutotaAllotVO.setQuotaNum(Integer.parseInt(dfjgQutotaAllotVO.getQuotaNumS()));
DfjgQuotaAllotDO dfjgQuotaAllotDO = new DfjgQuotaAllotDO();
try {
BeanUtils.copyProperties(dfjgQuotaAllotDO,dfjgQutotaAllotVO);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
// 存关系型数据库
dfjgQuotaAllotDO = dao.insert(dfjgQuotaAllotDO);
//存MongoDB
// mongoDBService.insert(dfjgQuotaAllotDO);
return "success";
}
日志上有这么一句
WARN - !! Calling Method more than once! Method --> public java.lang.String com.wonders.biz.fl.fljg.xmgl.ssxm.manage.SsProjectManage.saveIssuedDefine(com.wonders.biz.fl.fljg.xmgl.ssxm.model.DfjgQutotaAllotVO)
也就是说At执行了两次,manage执行了两次
WARN - !! Calling Method more than once! Method --> public java.lang.String com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt.saveIssuedDefine(com.wonders.biz.fl.fljg.xmgl.ssxm.model.DfjgQutotaAllotVO)
@wendal 确实没有 不过我手动传参也是一样啊 而且接收不到返回值。
$("#add_btn").click(function () {
$.ajax({
url:base + "/ssProjectAt/saveIssuedDefine",
data:$("#ss_add").serialize(),
dataType:"json",
success:function (data) {
result =data;
console.log(data);
// alert(data);
}
});
console.log("end")
});
@wendal 其他人的好好的 应该不是吧
var ioc = {
$aop : {
type : 'org.nutz.ioc.aop.config.impl.ComboAopConfigration',
fields : {
aopConfigrations : [{
type : 'org.nutz.ioc.aop.config.impl.JsonAopConfigration',
fields : {
itemList : [
["com.wonders.","^.*[Manage]$","ioc:logger"],
["com.wonders..+Manage$", "(add|insert).+", "ioc:txREAD_COMMITTED"],
["com.wonders..+Manage$", "(save|update|delete|remove|clear).", "ioc:txSERIALIZABLE"],
// ["com.wonders..+Manage$", "(get|query|find|fetch|list|load).+", "ioc:txNONE"],
["com.wonders..+Module$", ".+", "txREAD_COMMITTED"],
]
}
}, {
type : 'org.nutz.ioc.aop.config.impl.AnnotationAopConfigration'
}]
}
},
txNONE : {
type : 'org.nutz.aop.interceptor.TransactionInterceptor',
args : [ 0 ]
},
txREAD_UNCOMMITTED : {
type : 'org.nutz.aop.interceptor.TransactionInterceptor',
args : [ 1 ]
},
txREAD_COMMITTED : {
type : 'org.nutz.aop.interceptor.TransactionInterceptor',
args : [ 2 ]
},
txREPEATABLE_READ : {
type : 'org.nutz.aop.interceptor.TransactionInterceptor',
args : [ 4 ]
},
txSERIALIZABLE : {
type : 'org.nutz.aop.interceptor.TransactionInterceptor',
args : [ 8 ]
},
log : {
type : 'org.nutz.aop.interceptor.LoggingMethodInterceptor'
}
};
@wendal return false;不行 还是4条。我url手动传数据也是这样。而且,后台返回的success只到AT,前面拿不到。
@wendal 大佬 听不懂,有具体操作吗,社区不可以截图吗
@wendal 导包之后报这个啊。:)
Error:(67, 13) java: 对于getLog(), 找不到合适的方法
方法 org.nutz.log.Logs.getLog(java.lang.String)不适用
(实际参数列表和形式参数列表长度不同)
方法 org.nutz.log.Logs.getLog(java.lang.Class<?>)不适用
(实际参数列表和形式参数列表长度不同)
@wendal 大佬,刚才临时开会,抱歉啊!再来帮忙看下
2018-06-22 18:04:39,757 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [GET] path=/ssProjectAt/saveIssuedDefine : SsProjectAt.saveIssuedDefine(SsProjectAt.java:66)
2018-06-22 18:04:39,757 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'ssProjectAt'<class com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt>
2018-06-22 18:04:39,758 org.apache.commons.beanutils.BeanUtilsBean.copyProperties(BeanUtilsBean.java:242) DEBUG - BeanUtils.copyProperties(com.wonders.biz.fl.fljg.xmgl.ssxm.entity.DfjgQuotaAllotDO@4c6a3e4a, com.wonders.biz.fl.fljg.xmgl.ssxm.model.DfjgQutotaAllotVO@531f9377)
2018-06-22 18:04:39,758 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '徐汇区' to type 'String'
2018-06-22 18:04:39,759 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '2' to type 'String'
2018-06-22 18:04:39,759 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '长者照护之家' to type 'String'
2018-06-22 18:04:39,759 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '2018' to type 'String'
2018-06-22 18:04:39,760 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'Date' value 'Fri Jun 22 18:04:39 CST 2018' to type 'Date'
2018-06-22 18:04:39,760 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:162) DEBUG - No conversion required, value is already a Date
2018-06-22 18:04:39,760 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '1' to type 'String'
2018-06-22 18:04:39,761 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '1' to type 'String'
2018-06-22 18:04:39,764 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - // NOT SQL // ElFieldMacro=uuid()
2018-06-22 18:04:39,765 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - INSERT INTO DFJG_QUOTA_ALLOT(ID,QUOTA_ID,BSHX0002,BSHA0003,BSHX0042,BSHX0043,IS_VALID,CREATE_DATE,CREATE_USER_ID,UPDATE_TIME,UPDATE_USER_ID) VALUES(?,?,?,?,?,?,?,?,?,?,?)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
|----------------------------------|---|--------|-----|------|----|---|---------------------|---|------|------|
| 7d7eb0fa508e4508a61b34de37240d57 | 2 | 长者照护之家 | 徐汇区 | 2018 | 55 | 1 | 2018-06-22 18:04:39 | 1 | NULL | NULL |
For example:> "INSERT INTO DFJG_QUOTA_ALLOT(ID,QUOTA_ID,BSHX0002,BSHA0003,BSHX0042,BSHX0043,IS_VALID,CREATE_DATE,CREATE_USER_ID,UPDATE_TIME,UPDATE_USER_ID) VALUES('7d7eb0fa508e4508a61b34de37240d57','2','长者照护之家','徐汇区','2018',55,'1','2018-06-22 18:04:39','1','NULL','NULL') "
2018-06-22 18:04:39,815 com.wonders.framework.common.interceptor.LoggerInterceptor.filter(LoggerInterceptor.java:48) INFO - [2018-06-22 18:04:39]-[35][null(null)]/ssProjectAt/saveIssuedDefine(class:com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$$NUTZAOP)
2018-06-22 18:04:39,815 org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:74) WARN - !! Calling Method more than once! Method --> public java.lang.String com.wonders.biz.fl.fljg.xmgl.ssxm.manage.SsProjectManage.saveIssuedDefine(com.wonders.biz.fl.fljg.xmgl.ssxm.model.DfjgQutotaAllotVO)
2018-06-22 18:04:39,816 org.apache.commons.beanutils.BeanUtilsBean.copyProperties(BeanUtilsBean.java:242) DEBUG - BeanUtils.copyProperties(com.wonders.biz.fl.fljg.xmgl.ssxm.entity.DfjgQuotaAllotDO@3e0a9443, com.wonders.biz.fl.fljg.xmgl.ssxm.model.DfjgQutotaAllotVO@531f9377)
2018-06-22 18:04:39,816 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '徐汇区' to type 'String'
2018-06-22 18:04:39,817 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '2' to type 'String'
2018-06-22 18:04:39,817 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '长者照护之家' to type 'String'
2018-06-22 18:04:39,818 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '2018' to type 'String'
2018-06-22 18:04:39,818 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'Date' value 'Fri Jun 22 18:04:39 CST 2018' to type 'Date'
2018-06-22 18:04:39,818 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:162) DEBUG - No conversion required, value is already a Date
2018-06-22 18:04:39,818 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '1' to type 'String'
2018-06-22 18:04:39,819 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '1' to type 'String'
2018-06-22 18:04:39,819 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - // NOT SQL // ElFieldMacro=uuid()
2018-06-22 18:04:39,820 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - INSERT INTO DFJG_QUOTA_ALLOT(ID,QUOTA_ID,BSHX0002,BSHA0003,BSHX0042,BSHX0043,IS_VALID,CREATE_DATE,CREATE_USER_ID,UPDATE_TIME,UPDATE_USER_ID) VALUES(?,?,?,?,?,?,?,?,?,?,?)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
|----------------------------------|---|--------|-----|------|----|---|---------------------|---|------|------|
| 991537fff1fe4d8e948c9d8e0147c927 | 2 | 长者照护之家 | 徐汇区 | 2018 | 55 | 1 | 2018-06-22 18:04:39 | 1 | NULL | NULL |
For example:> "INSERT INTO DFJG_QUOTA_ALLOT(ID,QUOTA_ID,BSHX0002,BSHA0003,BSHX0042,BSHX0043,IS_VALID,CREATE_DATE,CREATE_USER_ID,UPDATE_TIME,UPDATE_USER_ID) VALUES('991537fff1fe4d8e948c9d8e0147c927','2','长者照护之家','徐汇区','2018',55,'1','2018-06-22 18:04:39','1','NULL','NULL') "
2018-06-22 18:04:39,844 com.wonders.framework.common.interceptor.LoggerInterceptor.filter(LoggerInterceptor.java:87) INFO - [2018-06-22 18:04:39]-[86ms][35][null(null)]/ssProjectAt/saveIssuedDefine(class:com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$$NUTZAOP)
2018-06-22 18:04:39,845 com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt.saveIssuedDefine(SsProjectAt.java:67) ERROR - abc
java.lang.Throwable
at com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt.saveIssuedDefine(SsProjectAt.java:67)
at com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$$NUTZAOP._aop_invoke(SsProjectAt.java:2)
at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
at com.wonders.framework.common.interceptor.LoggerInterceptor.filter(LoggerInterceptor.java:40)
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
at com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$$NUTZAOP.saveIssuedDefine(SsProjectAt.java:1)
at com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$FM$saveIssuedDefine$9114718610540602c267d30c66c5590b.invoke(SsProjectAt.java)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
2018-06-22 18:04:39,846 com.wonders.framework.common.interceptor.LoggerInterceptor.filter(LoggerInterceptor.java:48) INFO - [2018-06-22 18:04:39]-[35][null(null)]/ssProjectAt/saveIssuedDefine(class:com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$$NUTZAOP)
2018-06-22 18:04:39,847 org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:74) WARN - !! Calling Method more than once! Method --> public java.lang.String com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt.saveIssuedDefine(com.wonders.biz.fl.fljg.xmgl.ssxm.model.DfjgQutotaAllotVO)
2018-06-22 18:04:39,848 org.apache.commons.beanutils.BeanUtilsBean.copyProperties(BeanUtilsBean.java:242) DEBUG - BeanUtils.copyProperties(com.wonders.biz.fl.fljg.xmgl.ssxm.entity.DfjgQuotaAllotDO@75b7e9dc, com.wonders.biz.fl.fljg.xmgl.ssxm.model.DfjgQutotaAllotVO@531f9377)
2018-06-22 18:04:39,849 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '徐汇区' to type 'String'
2018-06-22 18:04:39,850 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '2' to type 'String'
2018-06-22 18:04:39,850 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '长者照护之家' to type 'String'
2018-06-22 18:04:39,850 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '2018' to type 'String'
2018-06-22 18:04:39,851 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'Date' value 'Fri Jun 22 18:04:39 CST 2018' to type 'Date'
2018-06-22 18:04:39,851 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:162) DEBUG - No conversion required, value is already a Date
2018-06-22 18:04:39,851 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '1' to type 'String'
2018-06-22 18:04:39,852 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '1' to type 'String'
2018-06-22 18:04:39,854 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - // NOT SQL // ElFieldMacro=uuid()
2018-06-22 18:04:39,855 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - INSERT INTO DFJG_QUOTA_ALLOT(ID,QUOTA_ID,BSHX0002,BSHA0003,BSHX0042,BSHX0043,IS_VALID,CREATE_DATE,CREATE_USER_ID,UPDATE_TIME,UPDATE_USER_ID) VALUES(?,?,?,?,?,?,?,?,?,?,?)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
|----------------------------------|---|--------|-----|------|----|---|---------------------|---|------|------|
| f2106ceb9dfe42eb92e0c4c3939833b9 | 2 | 长者照护之家 | 徐汇区 | 2018 | 55 | 1 | 2018-06-22 18:04:39 | 1 | NULL | NULL |
For example:> "INSERT INTO DFJG_QUOTA_ALLOT(ID,QUOTA_ID,BSHX0002,BSHA0003,BSHX0042,BSHX0043,IS_VALID,CREATE_DATE,CREATE_USER_ID,UPDATE_TIME,UPDATE_USER_ID) VALUES('f2106ceb9dfe42eb92e0c4c3939833b9','2','长者照护之家','徐汇区','2018',55,'1','2018-06-22 18:04:39','1','NULL','NULL') "
2018-06-22 18:04:39,890 com.wonders.framework.common.interceptor.LoggerInterceptor.filter(LoggerInterceptor.java:48) INFO - [2018-06-22 18:04:39]-[35][null(null)]/ssProjectAt/saveIssuedDefine(class:com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$$NUTZAOP)
2018-06-22 18:04:39,891 org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:74) WARN - !! Calling Method more than once! Method --> public java.lang.String com.wonders.biz.fl.fljg.xmgl.ssxm.manage.SsProjectManage.saveIssuedDefine(com.wonders.biz.fl.fljg.xmgl.ssxm.model.DfjgQutotaAllotVO)
2018-06-22 18:04:39,891 org.apache.commons.beanutils.BeanUtilsBean.copyProperties(BeanUtilsBean.java:242) DEBUG - BeanUtils.copyProperties(com.wonders.biz.fl.fljg.xmgl.ssxm.entity.DfjgQuotaAllotDO@7d5aa6e4, com.wonders.biz.fl.fljg.xmgl.ssxm.model.DfjgQutotaAllotVO@531f9377)
2018-06-22 18:04:39,891 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '徐汇区' to type 'String'
2018-06-22 18:04:39,892 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '2' to type 'String'
2018-06-22 18:04:39,892 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '长者照护之家' to type 'String'
2018-06-22 18:04:39,893 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '2018' to type 'String'
2018-06-22 18:04:39,893 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'Date' value 'Fri Jun 22 18:04:39 CST 2018' to type 'Date'
2018-06-22 18:04:39,893 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:162) DEBUG - No conversion required, value is already a Date
2018-06-22 18:04:39,893 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '1' to type 'String'
2018-06-22 18:04:39,894 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:140) DEBUG - Converting 'String' value '1' to type 'String'
2018-06-22 18:04:39,894 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - // NOT SQL // ElFieldMacro=uuid()
2018-06-22 18:04:39,895 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - INSERT INTO DFJG_QUOTA_ALLOT(ID,QUOTA_ID,BSHX0002,BSHA0003,BSHX0042,BSHX0043,IS_VALID,CREATE_DATE,CREATE_USER_ID,UPDATE_TIME,UPDATE_USER_ID) VALUES(?,?,?,?,?,?,?,?,?,?,?)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
|----------------------------------|---|--------|-----|------|----|---|---------------------|---|------|------|
| ac54b7db796c4a4c9a9a3f51ed8c948a | 2 | 长者照护之家 | 徐汇区 | 2018 | 55 | 1 | 2018-06-22 18:04:39 | 1 | NULL | NULL |
For example:> "INSERT INTO DFJG_QUOTA_ALLOT(ID,QUOTA_ID,BSHX0002,BSHA0003,BSHX0042,BSHX0043,IS_VALID,CREATE_DATE,CREATE_USER_ID,UPDATE_TIME,UPDATE_USER_ID) VALUES('ac54b7db796c4a4c9a9a3f51ed8c948a','2','长者照护之家','徐汇区','2018',55,'1','2018-06-22 18:04:39','1','NULL','NULL') "
2018-06-22 18:04:39,988 com.wonders.framework.common.interceptor.LoggerInterceptor.filter(LoggerInterceptor.java:87) INFO - [2018-06-22 18:04:39]-[139ms][35][null(null)]/ssProjectAt/saveIssuedDefine(class:com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$$NUTZAOP)
2018-06-22 18:04:39,988 com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt.saveIssuedDefine(SsProjectAt.java:67) ERROR - abc
java.lang.Throwable
at com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt.saveIssuedDefine(SsProjectAt.java:67)
at com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$$NUTZAOP._aop_invoke(SsProjectAt.java:2)
at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
at com.wonders.framework.common.interceptor.LoggerInterceptor.filter(LoggerInterceptor.java:57)
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
at com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$$NUTZAOP.saveIssuedDefine(SsProjectAt.java:1)
at com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$FM$saveIssuedDefine$9114718610540602c267d30c66c5590b.invoke(SsProjectAt.java)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
2018-06-22 18:04:39,990 com.wonders.framework.common.interceptor.LoggerInterceptor.filter(LoggerInterceptor.java:87) INFO - [2018-06-22 18:04:39]-[232ms][35][null(null)]/ssProjectAt/saveIssuedDefine(class:com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$$NUTZAOP)
@wendal 兽总,兽总,还在不,打扰了
@wendal 这个吗
package com.wonders.framework.common.interceptor;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpSession;
import org.nutz.aop.InterceptorChain;
import org.nutz.aop.MethodInterceptor;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.Stopwatch;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.ActionContext;
import org.nutz.mvc.Mvcs;
import com.wonders.MainConstants;
import com.wonders.framework.common.authority.entity.UserDTO;
@IocBean(fields = "dao")
public class LoggerInterceptor implements MethodInterceptor{
private static final Log LOG = Logs.get();
/**
* 拦截器记录日志(操作员,操作时间,请求路径,类名),并且区分抛出异常以及未抛出异常时的日志级别
*/
@Override
public void filter(InterceptorChain chain) throws Throwable {
Stopwatch sw = Stopwatch.begin();
HttpSession session = Mvcs.getHttpSession(false);
if (Lang.isEmpty(session)) {
sw.stop();
chain.doChain();
}
ActionContext actionContext = Mvcs.getActionContext();
UserDTO user = (UserDTO) session.getAttribute(MainConstants.SESSION_USER);
if (Lang.isEmpty(user)) {
sw.stop();
chain.doChain();
}
String operatorName = (user==null?null:user.getName());
String operatorId = (user==null?null:user.getUserId());
String path = actionContext.getPath();
String classname = actionContext.getModule().getClass().getName();
try {
if(LOG.isInfoEnabled()) {
LOG.infof("[%s]-[%d][%s(%s)]%s(class:%s)", new Object[] {
(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date()),
Long.valueOf(Thread.currentThread().getId()),
operatorName,
operatorId,
path,
classname
});
}
chain.doChain();
}catch (Exception e) {
e.printStackTrace();
if(LOG.isErrorEnabled()) {
LOG.infof("[%s]-[%d][%s(%s)]%s(class:%s)", new Object[] {
(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date()),
Long.valueOf(Thread.currentThread().getId()),
operatorName,
operatorId,
path,
classname
});
}
throw Lang.wrapThrow(e);
}catch (Throwable e) {
e.printStackTrace();
if(LOG.isErrorEnabled()) {
LOG.infof("[%s]-[%d][%s(%s)]%s(class:%s)", new Object[] {
(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date()),
Long.valueOf(Thread.currentThread().getId()),
operatorName,
operatorId,
path,
classname
});
}
throw Lang.wrapThrow(e);
}finally {
if(LOG.isInfoEnabled()) {
sw.stop();
LOG.infof("[%s]-[%dms][%d][%s(%s)]%s(class:%s)", new Object[] {
(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date()),
sw.getDuration(),
Long.valueOf(Thread.currentThread().getId()),
operatorName,
operatorId,
path,
classname
});
}
}
}
}
每次调用 chain.doChain() 都相当于把方法执行一次.
按代码里面的逻辑, 如果session为空,执行一次方法,如果user为空,又执行一次方法,然后记录日志之后,又支持一次方法
前两个doChain, 后面应该加个return才对.
@wendal 也就是说这个LoggerInterceptor 类有问题?
@wendal 有解决方法吗?不改这个类的话,为啥项目组其他人没有这个问题啊
@wendal 兽总 可以的,哈哈 请问有解决方法吗
@wendal 好的好的,感谢兽总的耐心解答!!!我向框架组反映下
@wendal 方法注释掉可以了
添加回复
请先登陆