public Object addPd(NutMap map) {
SysUser user = (SysUser)Mvcs.getHttpSession().getAttribute(Globals.SESSION_USER_CODE);
System.out.println(map);
ProblemDemand pd = new ProblemDemand();
ProblemDemand pd_return = new ProblemDemand();
pd = (ProblemDemand)map.get("pd");
pd.setPdId(comServiceBo.getNextId("PROBLEMDEMAND","PDID"));
pd.setCreater(user.getUserId());
pd.setCreateTime(new Date());
pd.setPdState("1");
pd.setCurrentOperator(user.getUserId());
pd.setIsTest("0");
pd.setIsFinish("0");
pd_return = dao.insert(pd);
//pd_return.setPdTypeText(getCodeTextByValue("PDTYPE",pd.getPdType()));
problemDemandServiceBo.addPdEvent(pd_return,Globals.EVENT_TYPE_ADD);
return pd_return;
}
public void addPdEvent(ProblemDemand pd,String eventType){
SysUser user = (SysUser)Mvcs.getHttpSession().getAttribute(Globals.SESSION_USER_CODE);
String temp1 = pd.getPdId();
String temp2 = pd.getPdType();
String pdType_text = getCodeTextByValue("PDTYPE",temp2);
Event event = new Event();
List<Event> oldEvents = new ArrayList<Event>();
oldEvents = dao.query(Event.class, Cnd.where("pdId","=",pd.getPdId()));
//新增事件
if(eventType.equals(Globals.EVENT_TYPE_ADD) && oldEvents.size() == 0){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String str_curDate = sdf.format(new Date());
event.setPdId(pd.getPdId());
event.setEventId(1);
event.setEventType(eventType);
event.setOperator(user.getUserId());
event.setOperateTime(new Date());
//经办说明为空
//event.setExplain(explain);
event.setEventResult(user.getDisplayName()+"在"+str_curDate + "新增了一条编号为"+pd.getPdId()+"的"+pdType_text);
dao.insert(event);
}
}
protected String getCodeTextByValue(String codeType,String codeValue) {
List<CodeMng> CodeMngList = new ArrayList<CodeMng>();
CodeMngList = dao.query(CodeMng.class, Cnd.where("CODETYPE","=",codeType).and("CODE","",codeValue));
String returnText = "";
if(CodeMngList.size() != 0){
returnText = CodeMngList.get(0).getCodeName();
}
returnText = codeValue;
return returnText;
}
2017-07-16 18:59:46,151 com.shlx.blood.service.ComServices.ExcuteServices(ComServices.java:198) DEBUG - Fail to invoke [com.shlx.blood.service.business.ProblemDemandService].addPd() by args:
{pd=com.shlx.blood.entity.ProblemDemand@18792fe}
For the reason: null
org.nutz.lang.InvokingException: Fail to invoke [com.shlx.blood.service.business.ProblemDemandService].addPd() by args:
{pd=com.shlx.blood.entity.ProblemDemand@18792fe}
For the reason: null
at org.nutz.lang.Invoking.invoke(Invoking.java:195)
at org.nutz.lang.Mirror.invoke(Mirror.java:1100)
at com.shlx.blood.service.ComServices.ExcuteServices(ComServices.java:194)
at com.shlx.blood.action.ProblemDemandAction.addPd(ProblemDemandAction.java:93)
at com.shlx.blood.action.ProblemDemandAction$$FASTCLASS._invoke(ProblemDemandAction.java:1)
at org.nutz.lang.reflect.AbstractFastClass.invoke(AbstractFastClass.java:143)
at org.nutz.lang.reflect.FastClassFactory.invoke(FastClassFactory.java:67)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:27)
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:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
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:474)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.shlx.blood.framework.BaseServiceBo.getCodeTextByValue(BaseServiceBo.java:40)
at com.shlx.blood.service.bo.ProblemDemandServiceBo.addPdEvent(ProblemDemandServiceBo.java:99)
at com.shlx.blood.service.business.ProblemDemandService.addPd(ProblemDemandService.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.nutz.lang.Invoking$DefaultInvoker.invoke(Invoking.java:47)
at org.nutz.lang.Invoking.invoke(Invoking.java:192)
... 40 more