diff --git a/.classpath b/.classpath deleted file mode 100644 index 1e93645e3..000000000 --- a/.classpath +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.tomcatplugin b/.tomcatplugin deleted file mode 100644 index 546ecaf04..000000000 --- a/.tomcatplugin +++ /dev/null @@ -1,11 +0,0 @@ - - - /WebContent - false - true - false - true - - - /apzl - diff --git a/WebContent/404.html b/WebContent/404.html new file mode 100644 index 000000000..04f59e365 --- /dev/null +++ b/WebContent/404.html @@ -0,0 +1,35 @@ + + + + + + + + +App应用下载 + + + + + + +
+

404

+
+ 下载文件不存在! +
+ +
+
+

微信扫描打开APP下载链接提示代码优化 +

+ + \ No newline at end of file diff --git a/WebContent/406.html b/WebContent/406.html new file mode 100644 index 000000000..e8a5ec03e --- /dev/null +++ b/WebContent/406.html @@ -0,0 +1,35 @@ + + + + + + + + +南方租赁 + + + + + + +
+

406

+
+ 当前为APP服务,WEB无效访问权限! +
+ +
+
+

微信扫描打开APP下载链接提示代码优化 +

+ + \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/a3web.xml b/WebContent/WEB-INF/etc/a3web.xml index cfbb717f9..c44c01b79 100644 --- a/WebContent/WEB-INF/etc/a3web.xml +++ b/WebContent/WEB-INF/etc/a3web.xml @@ -7,14 +7,14 @@ als als_rpt - + 1 1 2 - + 1 1000000 20 @@ -26,7 +26,7 @@ Development Disk - + d:/tmp/als/Upload @@ -36,7 +36,8 @@ Disk - /tmp/als/offlineworkdoc + /tmp/als/offlineworkdoc + /tmp/DownLoad @@ -48,10 +49,10 @@ SRC true - + /home/amarsoft/als/Download - + true @@ -68,35 +69,46 @@ Leasing Cloud 安硕 - + true - + BusinessDueBill http://localhost:8080/report http://localhost:8080/report - + true WZ5jwvsdAFzo+sDY7wrZgA== com.tenwa.sinopharmEleasing rfL+5IFP/fHrsIiCZlJu5Q== - - + + ee450692cbd24e8bacb27b6f46b4d752 - http://api.che300.com/service/getCarBrandList - http://api.che300.com/service/getCarSeriesList - http://api.che300.com/service/getCarModelList - http://api.che300.com/service/getNewCarPrice - http://api.che300.com/service/getUsedCarPrice - - - - http://111.205.51.131:27203/clms_proxy/remoting/api - + http://api.che300.com/service/getCarBrandList + http://api.che300.com/service/getCarSeriesList + + http://api.che300.com/service/getCarModelList + + http://api.che300.com/service/getNewCarPrice + + http://api.che300.com/service/getUsedCarPrice + + + + + http://111.205.51.131:27203/clms_proxy/remoting/api + + + + + + + + /etc/app_config.properties \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/app_config.properties b/WebContent/WEB-INF/etc/app_config.properties new file mode 100644 index 000000000..6d952ba65 --- /dev/null +++ b/WebContent/WEB-INF/etc/app_config.properties @@ -0,0 +1,69 @@ +############################################################################### +# APP_CONFIG properties +############################################################################### + +############################################################################### +# APP_BASE_CONFIG +############################################################################### +# base.data. +base.data.source=als +base.data.encoding=UTF-8 +base.data.fource.encoding=true + +# base.param.key. +base.param.key.hold.time=TokenHoldTime +base.param.key.encoding=encoding +base.param.key.no.check.uri=NoCheckURI + +# session check. +base.session.check.token=token +base.session.check.user.id=userid +base.session.check.dev.id=devid +base.session.check.dev.os=devos +base.session.check.expire=expire + +# session. +base.session.web.api.page=WebApiPage +base.session.req.uri=ReqURI + +# base.return. +base.return.code.500=500 +base.return.msg.500=\u540E\u53F0\u670D\u52A1\u51FA\u73B0\u5F02\u5E38! +base.return.code.404=404 +base.return.code.406=406 +base.return.msg.406=\u8BBF\u95EE\u670D\u52A1\u540E\u53F0\u6743\u9650\u65E0\u6548! +base.return.result.success.code=SUCCESS +base.return.result.fail.code=FAIL +base.return.msg.save.fail=\u4FDD\u5B58\u5931\u8D25 +base.return.msg.save.success=\u4FDD\u5B58\u6210\u529F +base.return.msg.edit.fail=\u7F16\u8F91\u5931\u8D25 +base.return.msg.edit.success=\u7F16\u8F91\u6210\u529F +base.return.msg.del.fail=\u5220\u9664\u5931\u8D25 +base.return.msg.del.success=\u5220\u9664\u6210\u529F +base.return.msg.init.display.fail=\u521D\u59CB\u5316\u9875\u9762\u5931\u8D25 +base.return.msg.init.display.success=\u521D\u59CB\u5316\u9875\u9762\u6210\u529F + +base.return.type.void=void +base.return.type.app.att=AppAtt + +# base pwd encryption des. +base.pwd.encryption.des.one=0123456789abc +base.pwd.encryption.des.two=1234567890abc +base.pwd.encryption.des.three=1234567890!@# + +# customer type +base.customer.type.company=01 +base.customer.type.person=03 + + +############################################################################### +# APP_PUSH_MESSAGE_CONFIG +############################################################################### +push.message.switch=true +push.message.secret.key.android=xpStkADS2IUJk10PejtJvQ== +push.message.secret.key.ios=WZ5jwvsdAFzo+sDY7wrZgA== +push.message.package.name=com.tenwa.test + + +#base.filter.user.role.id='800090001R00000004','800090001R00000005','099','299','399','800090001R00000010','800090002R00000001','800090002R00000003','800090002R00000045','800090001R00000006','800090001R00000007','800090001R00000008','800090001R00000009','800090001R00000013','800090001R00000014','800090001R00000022','800090001R00000019','800090001R00000020','800090001R00000015','800090001R00000025' +base.filter.user.role.id=none \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/are.xml b/WebContent/WEB-INF/etc/are.xml index 8f2221d23..40423d160 100644 --- a/WebContent/WEB-INF/etc/are.xml +++ b/WebContent/WEB-INF/etc/are.xml @@ -76,6 +76,7 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/jbo/jbo_app_fresh.xml b/WebContent/WEB-INF/etc/jbo/jbo_app_fresh.xml new file mode 100644 index 000000000..5f3f39b17 --- /dev/null +++ b/WebContent/WEB-INF/etc/jbo/jbo_app_fresh.xml @@ -0,0 +1,418 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index 2e4229f4e..232de0eb5 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -1,475 +1,445 @@ - - A3Web - - - JSPConfiguration - *.jsp - GBK - - - JSPConfiguration - *.jspf - GBK - - - - RunFilter - com.amarsoft.awe.control.RunFilter - - RunTimeDebug - true - - - ShowFramePage - true - - - DbLog - false - - - encoding - GBK - - - DataSource - als - - - ExcludedURLs - ^/.*Logon.jsp,^/.*SaveGraphAjax.jsp - - - - RunFilter - *.jsp - REQUEST - FORWARD - - - RunFilter - /servlet/view/* - - - InitAREServlet - com.amarsoft.are.InitAREServlet - - ConfigFile - /WEB-INF/etc/are.xml - - - AppHome - /WEB-INF - - 1 - - - InitAWEServlet - com.amarsoft.awe.control.InitAWEServlet - - ConfigFile - /WEB-INF/etc/a3web.xml - - - CacheFile - /WEB-INF/etc/cache.xml - - - SkinConfig - /WEB-INF/etc/skin.xml - - - ButtonConfig - /WEB-INF/etc/button.xml - - - DataSource - als - - 2 - - - RedirectorServlet - com.amarsoft.awe.control.RedirectorServlet - - encoding - GBK - - - - - RewriteRunJavaMethodServlet - com.tenwa.workflow.RewriteRunJavaMethodServlet - - DataSource - als - - - - - RedirectorDialogServlet - com.amarsoft.awe.control.RedirectorDialogServlet - - encoding - GBK - - - - ForwardServlet - com.amarsoft.awe.control.ForwardServlet - - encoding - GBK - - - - RunJavaMethodServlet - com.amarsoft.awe.control.RunJavaMethodServlet - - DataSource - als - - - - DisplayChart - org.jfree.chart.servlet.DisplayChart - - - MessageServlet - com.amarsoft.awe.message.MessageServlet - - - WorkDocFileServlet - com.amarsoft.awe.common.attachment.WorkDocFileServlet - - - AttachmentViewServlet - com.amarsoft.awe.common.attachment.AttachmentViewServlet - - - EditOfficeServlet - com.tenwa.onlineoperation.servlet.EditOfficeServlet - - - FileTemplateViewServlet - com.amarsoft.filetemplate.servlet.FileTemplateViewServlet - - - DocDownloadServlet - com.tenwa.doc.servlet.DocDownloadServlet - - - DocDownloadZipServlet - com.tenwa.doc.servlet.DocDownloadZipServlet - - - DocFlowDownloadZipServlet - com.tenwa.doc.servlet.DocFlowDownloadZipServlet - - - DownloadZipServlet - com.tenwa.officetempalte.controller.DownloadZipServlet - - - FileViewServlet - com.amarsoft.awe.common.attachment.FileViewServlet - - - ShowImageServlet - com.tenwa.doc.servlet.ShowImageServlet - - - ShowPDFServlet - com.tenwa.doc.servlet.ShowPDFServlet - - - StreamViewServlet - com.amarsoft.awe.common.attachment.StreamViewServlet - - - CheckCodeServlet - com.amarsoft.awe.control.CheckCodeServlet - - CodeLength - 5 - - - - MonitorSOAPServlet - com.amarsoft.awe.common.monitor.MonitorSOAPServlet - - - RedirectorServlet - /Redirector - - - RedirectorDialogServlet - /RedirectorDialog - - - RunJavaMethodServlet - /servlet/run - - - ForwardServlet - /ao - - - DisplayChart - /chartview - - - MessageServlet - /servlet/message - - - WorkDocFileServlet - /servlet/workdocfile/* - - - AttachmentViewServlet - /servlet/view/attachment - - - EditOfficeServlet - /servlet/view/editOffice - - - FileTemplateViewServlet - /servlet/view/fileTemplateView - - - DocDownloadServlet - /servlet/view/docDownloadServlet - - - - RewriteRunJavaMethodServlet - /servlet/runflow - - - - DocDownloadZipServlet - /servlet/view/docDownloadZipServlet - - - DocFlowDownloadZipServlet - /servlet/view/docFlowDownloadZipServlet - - - DownloadZipServlet - /servlet/view/DownloadZipServlet - - - AttachmentViewServlet - /servlet/pdf/* - - - FileViewServlet - /servlet/view/file - - - ShowImageServlet - /servlet/view/image - - - ShowPDFServlet - /servlet/view/pdf - - - FileViewServlet - /servlet/viewpic - - - StreamViewServlet - /servlet/view/stream - - - CheckCodeServlet - /servlet/checkcode - - - MonitorSOAPServlet - /servlet/monitor - - - QueryResultServlet - com.amarsoft.asquery.servlet.QueryResultServlet - - threadCount - 5 - - - - QueryResultServlet - /SynchResultQuery - - - InfoPageExportServlet - com.amarsoft.awe.dw.export.servlet.InfoExportServlet - - - ListPageExportServlet - com.amarsoft.awe.dw.export.servlet.ListExportServlet - - - InfoPageExportServlet - /EAS/PageExport/info - - - ListPageExportServlet - /EAS/PageExport/list - - - workflow_GetProcess - - com.amarsoft.biz.workflow.graph.web.GetProcess - - - - workflow_UpdateProcess - - com.amarsoft.biz.workflow.graph.web.UpdateProcess - - - - workflow_AddProcess - - com.amarsoft.biz.workflow.graph.web.AddProcess - - - - workflow_DeleteProcess - - com.amarsoft.biz.workflow.graph.web.DeleteProcess - - - - workflow_ListProcess - - com.amarsoft.biz.workflow.graph.web.ListProcess - - - - workflow_GetProcess - /getprocess.wf - - - workflow_UpdateProcess - /updateprocess.wf - - - workflow_AddProcess - /addprocess.wf - - - workflow_DeleteProcess - /deleteprocess.wf - - - workflow_ListProcess - /listprocess.wf - - - index.html - - - 404 - /Frame/page/sys/NoPageInfo.jsp - - - jdbc/als - javax.sql.DataSource - Application - Shareable - - - jdbc/report - javax.sql.DataSource - Application - Shareable - - - 240 - - - InitDBType - com.amarsoft.app.awe.config.InitDBType - - shutdown-on-unload - true - - 1 - - - QuartzInitializer - com.tenwa.quartz.MyQuartzInitializerServlet - - config-file - quartz.properties - - - shutdown-on-unload - true - - 5 - - - webAppRootKey - webapp.port - - - javax.servlet.jsp.jstl.fmt.localizationContext - ApplicationResources - - - log4jConfigLocation - /WEB-INF/classes/log4j.xml - - - 閰嶇疆鏂囦欢浣嶇疆 - contextConfigLocation - classpath:applicationContext*.xml - - - org.springframework.web.context.ContextLoaderListener - - - - - - - 閽堝ObjectWindow鐨勭晫闈㈡弿杩拌瑷 - XWRenderServlet - XWRenderServlet - cn.coyoteam.aweresf.web.servlet.XWRenderServlet + + A3Web + + + JSPConfiguration + *.jsp + GBK + + + JSPConfiguration + *.jspf + GBK + + + + RunFilter + com.amarsoft.awe.control.RunFilter - XWInterceptConfig - classpath:/com/amarsoft/aims/xwrender-intercept.properties + RunTimeDebug + true + + + ShowFramePage + true + + + DbLog + false + + + encoding + GBK + + + DataSource + als + + + ExcludedURLs + ^/.*Logon.jsp,^/.*SaveGraphAjax.jsp + + + + RunFilter + *.jsp + REQUEST + FORWARD + + + RunFilter + /servlet/view/* + + + InitAREServlet + com.amarsoft.are.InitAREServlet + + ConfigFile + /WEB-INF/etc/are.xml + + + AppHome + /WEB-INF 1 - - XWRenderServlet - /xwrender/* - - 閽堝澶栭儴鎻愪緵鎺ュ彛鐨剋ebapi - XWTransformServlet - XWTransformServlet - cn.coyoteam.aweresf.web.servlet.XWTransformServlet + InitAWEServlet + com.amarsoft.awe.control.InitAWEServlet + + ConfigFile + /WEB-INF/etc/a3web.xml + + + CacheFile + /WEB-INF/etc/cache.xml + + + SkinConfig + /WEB-INF/etc/skin.xml + + + ButtonConfig + /WEB-INF/etc/button.xml + + + DataSource + als + + 2 + + + RedirectorServlet + com.amarsoft.awe.control.RedirectorServlet + + encoding + GBK + + + + + RewriteRunJavaMethodServlet + com.tenwa.workflow.RewriteRunJavaMethodServlet + + DataSource + als + + + + + RedirectorDialogServlet + com.amarsoft.awe.control.RedirectorDialogServlet + + encoding + GBK + + + + ForwardServlet + com.amarsoft.awe.control.ForwardServlet + + encoding + GBK + + + + RunJavaMethodServlet + com.amarsoft.awe.control.RunJavaMethodServlet + + DataSource + als + + + + DisplayChart + org.jfree.chart.servlet.DisplayChart + + + MessageServlet + com.amarsoft.awe.message.MessageServlet + + + WorkDocFileServlet + com.amarsoft.awe.common.attachment.WorkDocFileServlet + + + AttachmentViewServlet + com.amarsoft.awe.common.attachment.AttachmentViewServlet + + + EditOfficeServlet + com.tenwa.onlineoperation.servlet.EditOfficeServlet + + + FileTemplateViewServlet + com.amarsoft.filetemplate.servlet.FileTemplateViewServlet + + + DocDownloadServlet + com.tenwa.doc.servlet.DocDownloadServlet + + + DocDownloadZipServlet + com.tenwa.doc.servlet.DocDownloadZipServlet + + + DocFlowDownloadZipServlet + com.tenwa.doc.servlet.DocFlowDownloadZipServlet + + + DownloadZipServlet + com.tenwa.officetempalte.controller.DownloadZipServlet + + + FileViewServlet + com.amarsoft.awe.common.attachment.FileViewServlet + + + ShowImageServlet + com.tenwa.doc.servlet.ShowImageServlet + + + ShowPDFServlet + com.tenwa.doc.servlet.ShowPDFServlet + + + StreamViewServlet + com.amarsoft.awe.common.attachment.StreamViewServlet + + + CheckCodeServlet + com.amarsoft.awe.control.CheckCodeServlet + + CodeLength + 5 + + + + MonitorSOAPServlet + com.amarsoft.awe.common.monitor.MonitorSOAPServlet - XWTransformServlet - /webapi/xw/* + RedirectorServlet + /Redirector + + RedirectorDialogServlet + /RedirectorDialog + + + RunJavaMethodServlet + /servlet/run + + + ForwardServlet + /ao + + + DisplayChart + /chartview + + + MessageServlet + /servlet/message + + + WorkDocFileServlet + /servlet/workdocfile/* + + + AttachmentViewServlet + /servlet/view/attachment + + + EditOfficeServlet + /servlet/view/editOffice + + + FileTemplateViewServlet + /servlet/view/fileTemplateView + + + DocDownloadServlet + /servlet/view/docDownloadServlet + + + + RewriteRunJavaMethodServlet + /servlet/runflow + + + + DocDownloadZipServlet + /servlet/view/docDownloadZipServlet + + + DocFlowDownloadZipServlet + /servlet/view/docFlowDownloadZipServlet + + + DownloadZipServlet + /servlet/view/DownloadZipServlet + + + AttachmentViewServlet + /servlet/pdf/* + + + FileViewServlet + /servlet/view/file + + + ShowImageServlet + /servlet/view/image + + + ShowPDFServlet + /servlet/view/pdf + + + FileViewServlet + /servlet/viewpic + + + StreamViewServlet + /servlet/view/stream + + + CheckCodeServlet + /servlet/checkcode + + + MonitorSOAPServlet + /servlet/monitor + + + QueryResultServlet + com.amarsoft.asquery.servlet.QueryResultServlet + + threadCount + 5 + + + + QueryResultServlet + /SynchResultQuery + + + InfoPageExportServlet + com.amarsoft.awe.dw.export.servlet.InfoExportServlet + + + ListPageExportServlet + com.amarsoft.awe.dw.export.servlet.ListExportServlet + + + InfoPageExportServlet + /EAS/PageExport/info + + + ListPageExportServlet + /EAS/PageExport/list + + + workflow_GetProcess + com.amarsoft.biz.workflow.graph.web.GetProcess + + + workflow_UpdateProcess + com.amarsoft.biz.workflow.graph.web.UpdateProcess + + + workflow_AddProcess + com.amarsoft.biz.workflow.graph.web.AddProcess + + + workflow_DeleteProcess + com.amarsoft.biz.workflow.graph.web.DeleteProcess + + + workflow_ListProcess + com.amarsoft.biz.workflow.graph.web.ListProcess + + + workflow_GetProcess + /getprocess.wf + + + workflow_UpdateProcess + /updateprocess.wf + + + workflow_AddProcess + /addprocess.wf + + + workflow_DeleteProcess + /deleteprocess.wf + + + workflow_ListProcess + /listprocess.wf + + + index.html + + + 404 + /Frame/page/sys/NoPageInfo.jsp + + + jdbc/als + javax.sql.DataSource + Application + Shareable + + + jdbc/report + javax.sql.DataSource + Application + Shareable + + + 240 + + + InitDBType + com.amarsoft.app.awe.config.InitDBType + + shutdown-on-unload + true + + 1 + + + QuartzInitializer + com.tenwa.quartz.MyQuartzInitializerServlet + + config-file + quartz.properties + + + shutdown-on-unload + true + + 5 + + + webAppRootKey + webapp.port + + + javax.servlet.jsp.jstl.fmt.localizationContext + ApplicationResources + + + log4jConfigLocation + /WEB-INF/classes/log4j.xml + + + 閰嶇疆鏂囦欢浣嶇疆 + contextConfigLocation + classpath:applicationContext*.xml + + + org.springframework.web.context.ContextLoaderListener + + + + + Restfull澶勭悊Servlet RestfullServlet RestfullServlet - cn.coyoteam.aweresf.web.servlet.RestfullServiceServlet + + cn.servlet.RestfullServiceServlet + 1 @@ -480,44 +450,58 @@ restfull鑷姩鎵弿璺緞璁剧疆 RestfullScanPackage - cn.coyoteam.aweresf.web.restfull.impl, - apx.com.amarsoft.apx.web.resf, - apx.com.amarsoft.aims.flow.bzsrv, - apx.com.amarsoft.als.chksce.bzsrv, - apx.com.amarsoft.aims.planteam.bzsrv, - apx.com.amarsoft.apx.web.als.user.resf, - apx.com.amarsoft.als.temp.bzsrv, - apx.com.amarsoft.als.customer.bzsrv, - apx.com.amarsoft.als.work.flow.bzsrv, - apx.com.amarsoft.als.user.center.bzsrv, - apx.com.amarsoft.als.user.logon.bzsrv + apx.com.amarsoft.als.user.logon.controller, + apx.com.amarsoft.als.user.pwd.controller, + apx.com.amarsoft.als.user.sys.controller, + apx.com.amarsoft.als.doc.controller, + apx.com.amarsoft.als.currency.select.controller, + apx.com.amarsoft.als.currency.select.contract.controller, + + + apx.com.amarsoft.als.apzl.apply.query, + + + + apx.com.amarsoft.als.business.opinion.sign.controller, + + apx.com.amarsoft.als.business.opinion.history.controller, + + + apx.com.amarsoft.als.business.attachment.controller, + + + apx.com.amarsoft.als.business.action.ready.controller, + apx.com.amarsoft.als.business.action.submit.controller, + apx.com.amarsoft.als.business.action.back.controller, + apx.com.amarsoft.als.business.comm.action.controller, + + + + apx.com.amarsoft.als.base.awe.controller, SessionAndContextFilter SessionAndContextFilter - cn.coyoteam.aweresf.web.filter.SessionAndContextFilter + + cn.filter.SessionAndContextFilter NoCheckURI - /api-doc-index, - /resf/LoginProc/Login, - /resf/LoginProc/Logout, - /resf/logon/manager/logon, - /resf/logon/manager/logout, - /resf/user/center/manager/detection/version, - /resf/user/center/manager/close/gesture, - /resf/user/center/manager/acquisition/gesture, - /resf/flow/work/manager/attachments/down/att, - /resf/flow/work/manager/attachments/down/att/6, - - /resf/flow/files/down/docById, - /resf/files/downloadApp, - /resf/files/downloadPlist, - /resf/files/down/flow/image, - /resf/files/show/image, - /resf/files/downloadAppById, + + /resf/logon/manager/logon, + /resf/logon/manager/logout, + + /resf/user/center/manager/acquisition/gesture, + /resf/user/center/manager/close/gesture, + + /resf/user/center/manager/detection/version, + + /resf/files/down/docById, + /resf/files/downloadPlist, + /resf/files/downloadApp, + /resf/files/downloadAppById, diff --git a/WebContent/WEB-INF/web_app.xml b/WebContent/WEB-INF/web_app.xml new file mode 100644 index 000000000..1e851bb4b --- /dev/null +++ b/WebContent/WEB-INF/web_app.xml @@ -0,0 +1,533 @@ + + + A3Web + + + JSPConfiguration + *.jsp + GBK + + + JSPConfiguration + *.jspf + GBK + + + + RunFilter + com.amarsoft.awe.control.RunFilter + + RunTimeDebug + true + + + ShowFramePage + true + + + DbLog + false + + + encoding + GBK + + + DataSource + als + + + ExcludedURLs + ^/.*Logon.jsp,^/.*SaveGraphAjax.jsp + + + + RunFilter + *.jsp + REQUEST + FORWARD + + + RunFilter + /servlet/view/* + + + InitAREServlet + com.amarsoft.are.InitAREServlet + + ConfigFile + /WEB-INF/etc/are.xml + + + AppHome + /WEB-INF + + 1 + + + InitAWEServlet + com.amarsoft.awe.control.InitAWEServlet + + ConfigFile + /WEB-INF/etc/a3web.xml + + + CacheFile + /WEB-INF/etc/cache.xml + + + SkinConfig + /WEB-INF/etc/skin.xml + + + ButtonConfig + /WEB-INF/etc/button.xml + + + DataSource + als + + 2 + + + RedirectorServlet + com.amarsoft.awe.control.RedirectorServlet + + encoding + GBK + + + + + RewriteRunJavaMethodServlet + com.tenwa.workflow.RewriteRunJavaMethodServlet + + DataSource + als + + + + + RedirectorDialogServlet + com.amarsoft.awe.control.RedirectorDialogServlet + + encoding + GBK + + + + ForwardServlet + com.amarsoft.awe.control.ForwardServlet + + encoding + GBK + + + + RunJavaMethodServlet + com.amarsoft.awe.control.RunJavaMethodServlet + + DataSource + als + + + + DisplayChart + org.jfree.chart.servlet.DisplayChart + + + MessageServlet + com.amarsoft.awe.message.MessageServlet + + + WorkDocFileServlet + com.amarsoft.awe.common.attachment.WorkDocFileServlet + + + AttachmentViewServlet + com.amarsoft.awe.common.attachment.AttachmentViewServlet + + + EditOfficeServlet + com.tenwa.onlineoperation.servlet.EditOfficeServlet + + + FileTemplateViewServlet + com.amarsoft.filetemplate.servlet.FileTemplateViewServlet + + + DocDownloadServlet + com.tenwa.doc.servlet.DocDownloadServlet + + + DocDownloadZipServlet + com.tenwa.doc.servlet.DocDownloadZipServlet + + + DocFlowDownloadZipServlet + com.tenwa.doc.servlet.DocFlowDownloadZipServlet + + + DownloadZipServlet + com.tenwa.officetempalte.controller.DownloadZipServlet + + + FileViewServlet + com.amarsoft.awe.common.attachment.FileViewServlet + + + ShowImageServlet + com.tenwa.doc.servlet.ShowImageServlet + + + ShowPDFServlet + com.tenwa.doc.servlet.ShowPDFServlet + + + StreamViewServlet + com.amarsoft.awe.common.attachment.StreamViewServlet + + + CheckCodeServlet + com.amarsoft.awe.control.CheckCodeServlet + + CodeLength + 5 + + + + MonitorSOAPServlet + com.amarsoft.awe.common.monitor.MonitorSOAPServlet + + + RedirectorServlet + /Redirector + + + RedirectorDialogServlet + /RedirectorDialog + + + RunJavaMethodServlet + /servlet/run + + + ForwardServlet + /ao + + + DisplayChart + /chartview + + + MessageServlet + /servlet/message + + + WorkDocFileServlet + /servlet/workdocfile/* + + + AttachmentViewServlet + /servlet/view/attachment + + + EditOfficeServlet + /servlet/view/editOffice + + + FileTemplateViewServlet + /servlet/view/fileTemplateView + + + DocDownloadServlet + /servlet/view/docDownloadServlet + + + + RewriteRunJavaMethodServlet + /servlet/runflow + + + + DocDownloadZipServlet + /servlet/view/docDownloadZipServlet + + + DocFlowDownloadZipServlet + /servlet/view/docFlowDownloadZipServlet + + + DownloadZipServlet + /servlet/view/DownloadZipServlet + + + AttachmentViewServlet + /servlet/pdf/* + + + FileViewServlet + /servlet/view/file + + + ShowImageServlet + /servlet/view/image + + + ShowPDFServlet + /servlet/view/pdf + + + FileViewServlet + /servlet/viewpic + + + StreamViewServlet + /servlet/view/stream + + + CheckCodeServlet + /servlet/checkcode + + + MonitorSOAPServlet + /servlet/monitor + + + QueryResultServlet + com.amarsoft.asquery.servlet.QueryResultServlet + + threadCount + 5 + + + + QueryResultServlet + /SynchResultQuery + + + InfoPageExportServlet + com.amarsoft.awe.dw.export.servlet.InfoExportServlet + + + ListPageExportServlet + com.amarsoft.awe.dw.export.servlet.ListExportServlet + + + InfoPageExportServlet + /EAS/PageExport/info + + + ListPageExportServlet + /EAS/PageExport/list + + + workflow_GetProcess + com.amarsoft.biz.workflow.graph.web.GetProcess + + + workflow_UpdateProcess + com.amarsoft.biz.workflow.graph.web.UpdateProcess + + + workflow_AddProcess + com.amarsoft.biz.workflow.graph.web.AddProcess + + + workflow_DeleteProcess + com.amarsoft.biz.workflow.graph.web.DeleteProcess + + + workflow_ListProcess + com.amarsoft.biz.workflow.graph.web.ListProcess + + + workflow_GetProcess + /getprocess.wf + + + workflow_UpdateProcess + /updateprocess.wf + + + workflow_AddProcess + /addprocess.wf + + + workflow_DeleteProcess + /deleteprocess.wf + + + workflow_ListProcess + /listprocess.wf + + + index.html + + + 404 + /Frame/page/sys/NoPageInfo.jsp + + + jdbc/als + javax.sql.DataSource + Application + Shareable + + + jdbc/report + javax.sql.DataSource + Application + Shareable + + + 240 + + + InitDBType + com.amarsoft.app.awe.config.InitDBType + + shutdown-on-unload + true + + 1 + + + QuartzInitializer + com.tenwa.quartz.MyQuartzInitializerServlet + + config-file + quartz.properties + + + shutdown-on-unload + true + + 5 + + + webAppRootKey + webapp.port + + + javax.servlet.jsp.jstl.fmt.localizationContext + ApplicationResources + + + log4jConfigLocation + /WEB-INF/classes/log4j.xml + + + 閰嶇疆鏂囦欢浣嶇疆 + contextConfigLocation + classpath:applicationContext*.xml + + + org.springframework.web.context.ContextLoaderListener + + + + + + + + Restfull澶勭悊Servlet + RestfullServlet + RestfullServlet + + cn.servlet.RestfullServiceServlet + + 1 + + + RestfullServlet + /webapi/resf/* + + + restfull鑷姩鎵弿璺緞璁剧疆 + RestfullScanPackage + + apx.com.amarsoft.als.user.logon.controller, + apx.com.amarsoft.als.user.pwd.controller, + apx.com.amarsoft.als.user.sys.controller, + apx.com.amarsoft.als.doc.controller, + apx.com.amarsoft.als.currency.select.controller, + apx.com.amarsoft.als.currency.select.contract.controller, + + + apx.com.amarsoft.als.business.work.to.controller, + + apx.com.amarsoft.als.business.work.has.controller, + + apx.com.amarsoft.als.business.work.circulate.pass.controller, + + apx.com.amarsoft.als.business.work.circulate.close.controller, + + + + apx.com.amarsoft.als.business.opinion.sign.controller, + + apx.com.amarsoft.als.business.opinion.history.controller, + + + apx.com.amarsoft.als.business.attachment.controller, + + + apx.com.amarsoft.als.business.action.ready.controller, + apx.com.amarsoft.als.business.action.submit.controller, + apx.com.amarsoft.als.business.action.back.controller, + apx.com.amarsoft.als.business.comm.action.controller, + + + + apx.com.amarsoft.als.base.awe.controller, + + + + + SessionAndContextFilter + SessionAndContextFilter + + cn.filter.SessionAndContextFilter + + NoCheckURI + + + /resf/logon/manager/logon, + /resf/logon/manager/logout, + + /resf/user/center/manager/acquisition/gesture, + /resf/user/center/manager/close/gesture, + + /resf/user/center/manager/detection/version, + + /resf/files/down/docById, + /resf/files/downloadPlist, + /resf/files/downloadApp, + /resf/files/downloadAppById, + + + + TokenHoldTime + 31536000 + + + dataSource + als + + + encoding + GBK + + + + SessionAndContextFilter + /webapi/* + + + + + \ No newline at end of file diff --git a/WebContent/appDownload.jsp b/WebContent/appDownload.jsp index b87512534..90e234215 100644 --- a/WebContent/appDownload.jsp +++ b/WebContent/appDownload.jsp @@ -1,81 +1,84 @@ -<%@ page contentType="text/html; charset=GBK" pageEncoding="GBK"%> - - - - - - - -App应用下载 - - - - - -<% - String devType="android"; - String userAgent = request.getHeader("user-agent"); - if(userAgent.toLowerCase().indexOf("iphone")>=0){ - devType="ios"; - } -%> - -
- -
- -
-
- -
-
-

微信扫描打开APP下载链接提示代码优化 -

- - - + + +<% + String devType="android"; + String userAgent = request.getHeader("user-agent"); + if(userAgent.toLowerCase().indexOf("iphone")>=0){ + devType="ios"; + } +%> + +
+
+
+
+ +
+ +
+
+ +
+
+

寰俊鎵弿鎵撳紑APP涓嬭浇閾炬帴鎻愮ず浠g爜浼樺寲 +

+ + + \ No newline at end of file diff --git a/WebContent/logon.html b/WebContent/logon.html index 7275048a6..3382f4b71 100644 --- a/WebContent/logon.html +++ b/WebContent/logon.html @@ -38,7 +38,7 @@
用户名ID:
-
密码:
+
密码:
diff --git a/sql/APP_INIT.sql b/sql/APP_INIT.sql new file mode 100644 index 000000000..7dfb400ce --- /dev/null +++ b/sql/APP_INIT.sql @@ -0,0 +1,151 @@ +-- app配置模板分组表 +DROP TABLE if EXISTS APP_BUSINESS_GROUP; +CREATE TABLE `APP_BUSINESS_GROUP` ( + `GROUP_CODE` VARCHAR(900) COLLATE utf8_unicode_ci NOT NULL, + `GROUP_NAME` VARCHAR(900) COLLATE utf8_unicode_ci DEFAULT NULL, + `ISLIST` VARCHAR(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `GROUP_POSITION` BIGINT COLLATE utf8_unicode_ci DEFAULT NULL, + `GROUP_ENABLE` VARCHAR(1) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`GROUP_CODE`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- app配置模板分组字段表 +DROP TABLE if EXISTS APP_BUSINESS_TEMPLATE; +CREATE TABLE `APP_BUSINESS_TEMPLATE` ( + `GROUP_CODE` VARCHAR(900) COLLATE utf8_unicode_ci NOT NULL, + `DONO` VARCHAR(96) COLLATE utf8_unicode_ci DEFAULT NULL, + `COLINDEX` VARCHAR(54) COLLATE utf8_unicode_ci DEFAULT NULL, + `SORTNO` VARCHAR(54) COLLATE utf8_unicode_ci DEFAULT NULL, + `COLNAME` VARCHAR(80) COLLATE utf8_unicode_ci DEFAULT NULL, + `DATA_NAME` VARCHAR(900) COLLATE utf8_unicode_ci DEFAULT NULL, + `DATA_CODE` VARCHAR(900) COLLATE utf8_unicode_ci DEFAULT NULL, + `ISLIST` VARCHAR(54) COLLATE utf8_unicode_ci DEFAULT NULL, + `ISSHOW` VARCHAR(54) COLLATE utf8_unicode_ci DEFAULT NULL, + `DATA_POSITION` BIGINT COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + +-- 流程阶段配置表 +DROP TABLE if EXISTS PRD_NODEINFO_CATALOG_APP; +CREATE TABLE `PRD_NODEINFO_CATALOG_APP` ( + `ID` VARCHAR(100) COLLATE utf8_unicode_ci NOT NULL, + `FLOWNO` VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `PHASENO` VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `CONFIG_TYPE` VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `CONFIG_DISPLAY` VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `ENABLE_OPERATION` VARCHAR(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `SORTNO` BIGINT COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- APP页签配置表 +DROP TABLE if EXISTS PRD_NODEINFO_LIBRARY_APP; +CREATE TABLE `PRD_NODEINFO_LIBRARY_APP` ( + `ID` VARCHAR(100) COLLATE utf8_unicode_ci NOT NULL, + `APP_BUSINESS_GROUP_CODE` VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `INITIAL_CONDITION` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + `AUXILIARY_CONDITION` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + `INTERFACE_DESC` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + `SORTNO` BIGINT COLLATE utf8_unicode_ci DEFAULT NULL, + `ATTRIBUTE1` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + `ATTRIBUTE2` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + `ATTRIBUTE3` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + `ATTRIBUTE4` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + `ATTRIBUTE5` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + `ATTRIBUTE6` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + `ATTRIBUTE7` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + `ATTRIBUTE8` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + `ATTRIBUTE9` VARCHAR(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- app 流程页签配置表 +DROP TABLE if EXISTS PRD_NODEINFO_MIDDLE_APP; +CREATE TABLE `PRD_NODEINFO_MIDDLE_APP` ( + `APP_NODE_LIBRARY_ID` VARCHAR(100) COLLATE utf8_unicode_ci NOT NULL, + `APP_NODE_CATALOG_ID` VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `APP_DISPLAY` VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `CONFIG_TYPE` VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `ENABLE_QUERY` VARCHAR(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `ENABLE_SAVE` VARCHAR(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `ENABLE_DELETE` VARCHAR(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `SORTNO` BIGINT COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- APP 访问令牌有效期表 +DROP TABLE if EXISTS TOKEN_SESSION; +CREATE TABLE `TOKEN_SESSION` ( + `TOKEN` VARCHAR(255) COLLATE utf8_unicode_ci NOT NULL, + `USER_ID` VARCHAR(32) COLLATE utf8_unicode_ci DEFAULT NULL, + `DEV_ID` VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `DEV_OS` VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `CREATED` VARCHAR(40) COLLATE utf8_unicode_ci DEFAULT 'N', + `EXPIRE_IN` VARCHAR(40) COLLATE utf8_unicode_ci DEFAULT 'N' +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- APP版本配置表 +DROP TABLE if EXISTS APP_VERSION; +CREATE TABLE `APP_VERSION` ( + `ID` VARCHAR(96) COLLATE utf8_unicode_ci NOT NULL, + `VERSION_DESC` VARCHAR(765) COLLATE utf8_unicode_ci DEFAULT NULL, + `UP_DATE` VARCHAR(60) COLLATE utf8_unicode_ci DEFAULT NULL, + `IMAGE_PATH` VARCHAR(1536) COLLATE utf8_unicode_ci DEFAULT NULL, + `IS_NEW` VARCHAR(30) COLLATE utf8_unicode_ci DEFAULT 'Y', + `PHONE_TYPE` VARCHAR(30) COLLATE utf8_unicode_ci DEFAULT NULL, + `CREATE_DATE` VARCHAR(60) COLLATE utf8_unicode_ci DEFAULT NULL, + `MODIFY_DATE` VARCHAR(60) COLLATE utf8_unicode_ci DEFAULT NULL, + `BASE_FILE_ID` VARCHAR(96) COLLATE utf8_unicode_ci DEFAULT NULL, + `CREATOR` VARCHAR(96) COLLATE utf8_unicode_ci DEFAULT NULL, + `MODIFICATOR` VARCHAR(96) COLLATE utf8_unicode_ci DEFAULT NULL, + `VERSION_CODE` VARCHAR(765) COLLATE utf8_unicode_ci DEFAULT NULL, + `VERSION_NAME` VARCHAR(765) COLLATE utf8_unicode_ci DEFAULT NULL, + `MUST_UPDATE` VARCHAR(30) COLLATE utf8_unicode_ci DEFAULT 'N', + `FILE_NAME` VARCHAR(765) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + +DROP TABLE IF EXISTS APP_BUSINESS_START; +CREATE TABLE `APP_BUSINESS_START` ( + `CARATTRIBUTES` VARCHAR(1000) COLLATE UTF8_UNICODE_CI NOT NULL, + `LEASEHOLD` VARCHAR(1000) COLLATE UTF8_UNICODE_CI DEFAULT NULL, + `PRODUCTMODEL` VARCHAR(1000) COLLATE UTF8_UNICODE_CI DEFAULT NULL, + `CARSERIES` VARCHAR(1000) COLLATE UTF8_UNICODE_CI DEFAULT NULL, + `CARSYSTEM` VARCHAR(1000) COLLATE UTF8_UNICODE_CI DEFAULT NULL, + +`PRODUCTID` VARCHAR(1000) COLLATE UTF8_UNICODE_CI DEFAULT NULL, +`PRODUCTNAME` VARCHAR(1000) COLLATE UTF8_UNICODE_CI DEFAULT NULL, +`CUSTOMERID` VARCHAR(1000) COLLATE UTF8_UNICODE_CI DEFAULT NULL, +`CUSTOMERNAME` VARCHAR(1000) COLLATE UTF8_UNICODE_CI DEFAULT NULL, +`CUSTOMER_TYPE` VARCHAR(1000) COLLATE UTF8_UNICODE_CI DEFAULT NULL, +`CERTTYPE` VARCHAR(1000) COLLATE UTF8_UNICODE_CI DEFAULT NULL, +`CERTID` VARCHAR(1000) COLLATE UTF8_UNICODE_CI DEFAULT NULL +) ENGINE=INNODB DEFAULT CHARSET=UTF8 COLLATE=UTF8_UNICODE_CI; + +-- user_info ALTER ADD/DROP column +ALTER TABLE USER_INFO ADD DEV_ID VARCHAR(100) not Null; +ALTER TABLE USER_INFO ADD DEV_OS VARCHAR(40) not Null; +ALTER TABLE USER_INFO ADD DEV_REG_ID VARCHAR(100) not Null; +ALTER TABLE USER_INFO ADD ENABLE_GESTURE VARCHAR(1) not Null; +ALTER TABLE USER_INFO ADD GESTURE_PASSWORD VARCHAR(100) not Null; +-- PRD_NODEINFO_LIBRARY_APP ALTER ADD/DROP column +ALTER TABLE PRD_NODEINFO_LIBRARY_APP DROP sortno; +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (REBUILD_JBO_CLASS VARCHAR(1000) DEFAULT NULL); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (FATHER_ID VARCHAR(100) DEFAULT NULL); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (DISPLAY_MANAGE_CLASS VARCHAR(1000) DEFAULT NULL); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (SAVE_MANAGE_CLASS VARCHAR(1000) DEFAULT NULL); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (DELETE_MANAGE_CLASS VARCHAR(1000) DEFAULT NULL); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (ENABLE_CONDITION VARCHAR(1) DEFAULT 'N'); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (OPEN_CONDITION VARCHAR(1000) DEFAULT NULL); +-- PRD_NODEINFO_MIDDLE_APP ALTER ADD/DROP column +ALTER TABLE PRD_NODEINFO_MIDDLE_APP DROP CONFIG_TYPE; +ALTER TABLE PRD_NODEINFO_MIDDLE_APP ADD (ISINUSE VARCHAR(1) DEFAULT 1); +ALTER TABLE PRD_NODEINFO_MIDDLE_APP ADD (DOWNLOAD_PARAM VARCHAR(2000) DEFAULT NULL); +ALTER TABLE PRD_NODEINFO_MIDDLE_APP ADD (ENABLE_DOWNLOAD VARCHAR(1) DEFAULT 'N'); + +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (REBUILD_JBO_CLASS VARCHAR(1000) DEFAULT NULL); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (FATHER_ID VARCHAR(100) DEFAULT NULL); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (DISPLAY_MANAGE_CLASS VARCHAR(1000) DEFAULT NULL); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (SAVE_MANAGE_CLASS VARCHAR(1000) DEFAULT NULL); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (DELETE_MANAGE_CLASS VARCHAR(1000) DEFAULT NULL); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (ENABLE_CONDITION VARCHAR(1) DEFAULT 'N'); +ALTER TABLE PRD_NODEINFO_LIBRARY_APP ADD (OPEN_CONDITION VARCHAR(1000) DEFAULT NULL); diff --git a/src/com/amarsoft/app/flow/FlowAction.java b/src/com/amarsoft/app/flow/FlowAction.java index fd4ecc404..748ed9b8a 100644 --- a/src/com/amarsoft/app/flow/FlowAction.java +++ b/src/com/amarsoft/app/flow/FlowAction.java @@ -21,8 +21,6 @@ import jbo.sys.FLOW_TASK_USER_HIS; import org.apache.commons.lang.StringUtils; -import apx.com.amarsoft.als.base.util.DateUtil; - import com.amarsoft.app.lc.util.DateAssistant; import com.amarsoft.are.ARE; import com.amarsoft.are.jbo.BizObject; @@ -46,6 +44,7 @@ import com.amarsoft.biz.workflow.FlowTask; import com.amarsoft.biz.workflow.TaskDataObject; import com.amarsoft.context.ASUser; import com.amarsoft.dict.als.manage.NameManager; +import com.base.util.DateUtil; import com.tenwa.app.manage.constant.PushMessageConstant; import com.tenwa.app.manage.util.PushMessageUtil; import com.tenwa.comm.util.jboutil.DataOperatorUtil; diff --git a/src_app/apx/com/amarsoft/aims/als/flow/model/CodeField.java b/src_app/apx/com/amarsoft/aims/als/flow/model/CodeField.java deleted file mode 100644 index d275514b2..000000000 --- a/src_app/apx/com/amarsoft/aims/als/flow/model/CodeField.java +++ /dev/null @@ -1,46 +0,0 @@ -package apx.com.amarsoft.aims.als.flow.model; - -import java.io.Serializable; - -/** - * 使用代码值的属性域 - * @author cytsir - * - */ -public class CodeField implements Serializable{ - private static final long serialVersionUID = -3149264268547511046L; - - private String value; - private String name; - private String code; - - public CodeField(){ - - } - - public CodeField(String value, String name, String code) { - this.value = value; - this.name = name; - this.code = code; - } - - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - -} diff --git a/src_app/apx/com/amarsoft/aims/als/flow/model/FlowDirection.java b/src_app/apx/com/amarsoft/aims/als/flow/model/FlowDirection.java deleted file mode 100644 index 7da7ecbcb..000000000 --- a/src_app/apx/com/amarsoft/aims/als/flow/model/FlowDirection.java +++ /dev/null @@ -1,13 +0,0 @@ -package apx.com.amarsoft.aims.als.flow.model; - -/** - * 指示流程方向的枚举类 - * @author cytsir - * - */ -public enum FlowDirection { - /** 意见方向:往前(下一步) */ - Forward, - /** 意见方向:往后(退回相关的操作) */ - Backward -} diff --git a/src_app/apx/com/amarsoft/aims/als/flow/model/SubmitActionInfoDescribe.java b/src_app/apx/com/amarsoft/aims/als/flow/model/SubmitActionInfoDescribe.java deleted file mode 100644 index e08df9974..000000000 --- a/src_app/apx/com/amarsoft/aims/als/flow/model/SubmitActionInfoDescribe.java +++ /dev/null @@ -1,50 +0,0 @@ -package apx.com.amarsoft.aims.als.flow.model; - -import java.io.Serializable; - -public class SubmitActionInfoDescribe implements Serializable{ - private static final long serialVersionUID = 3314996188573575668L; - - private String actionId; //此数据项的ID标识 - private String actionText; //动作文本信息 - - public String getActionId() { - return actionId; - } - public void setActionId(String actionId) { - this.actionId = actionId; - } - public String getActionText() { - return actionText; - } - public void setActionText(String actionText) { - this.actionText = actionText; - } - - /** - * 根据其ID和内容,判断数据是否相等 - * @param obj - * @return - */ - public boolean dataEquals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - SubmitActionInfoDescribe other = (SubmitActionInfoDescribe) obj; - if (actionText == null) { - if (other.actionText != null) - return false; - } else if (!actionText.equals(other.actionText)) - return false; - if (actionId == null) { - if (other.actionId != null) - return false; - } else if (!actionId.equals(other.actionId)) - return false; - return true; - } - -} diff --git a/src_app/apx/com/amarsoft/aims/als/flow/model/SubmitInfoDescribe.java b/src_app/apx/com/amarsoft/aims/als/flow/model/SubmitInfoDescribe.java deleted file mode 100644 index 86f21c4ea..000000000 --- a/src_app/apx/com/amarsoft/aims/als/flow/model/SubmitInfoDescribe.java +++ /dev/null @@ -1,82 +0,0 @@ -package apx.com.amarsoft.aims.als.flow.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * 流程提交信息描述 - * @author cytsir - * - */ -public class SubmitInfoDescribe implements Serializable{ - - - private static final long serialVersionUID = 7140742685924221388L; - - private String opinionId; - private String opinionText; - private String nextPhaseText; //下一阶段文本信息 - private List actionList; - - public SubmitInfoDescribe(){ - this.actionList = new ArrayList(); - } - - public String getOpinionId() { - return opinionId; - } - - public void setOpinionId(String opinionId) { - this.opinionId = opinionId; - } - - public String getOpinionText() { - return opinionText; - } - public void setOpinionText(String opinionText) { - this.opinionText = opinionText; - } - - public List getActionList() { - return actionList; - } - - public void setActionList(List actionList) { - this.actionList = actionList; - } - public String getNextPhaseText() { - return nextPhaseText; - } - public void setNextPhaseText(String nextPhaseText) { - this.nextPhaseText = nextPhaseText; - } - /** - * 根据其ID和内容,判断数据是否相等 - * @param obj - * @return - */ - public boolean dataEquals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - SubmitInfoDescribe other = (SubmitInfoDescribe) obj; - if (opinionId == null) { - if (other.opinionId != null) - return false; - } else if (!opinionId.equals(other.opinionId)) - return false; - if (opinionText == null) { - if (other.opinionText != null) - return false; - } else if (!opinionText.equals(other.opinionText)) - return false; - return true; - } - - - -} diff --git a/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/AnyBackAtStartOpinion.java b/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/AnyBackAtStartOpinion.java deleted file mode 100644 index 13992e64a..000000000 --- a/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/AnyBackAtStartOpinion.java +++ /dev/null @@ -1,39 +0,0 @@ -package apx.com.amarsoft.aims.als.flow.model.opinion; - -import apx.com.amarsoft.aims.als.flow.model.CodeField; - - -/** - * 投前初始提交时,被退回后再次提交意见信息 - * @author cytsir - * - */ -public class AnyBackAtStartOpinion extends Opinion{ - private static final long serialVersionUID = 5821608132725247504L; - - private CodeField choice; - private String specialContent; - - public AnyBackAtStartOpinion() { - super("AnyBackAtStart"); - } - - - - public CodeField getChoice() { - return choice; - } - - public void setChoice(CodeField choice) { - this.choice = choice; - } - - public String getSpecialContent() { - return specialContent; - } - - public void setSpecialContent(String specialContent) { - this.specialContent = specialContent; - } - -} diff --git a/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/BackOpinion.java b/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/BackOpinion.java deleted file mode 100644 index 305ad49b7..000000000 --- a/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/BackOpinion.java +++ /dev/null @@ -1,91 +0,0 @@ -package apx.com.amarsoft.aims.als.flow.model.opinion; - -import apx.com.amarsoft.aims.als.flow.model.CodeField; -import apx.com.amarsoft.aims.als.flow.model.FlowDirection; - - - -/** - * 回退类的意见 - * @author cytsir - * - */ -public class BackOpinion extends Opinion{ - - private static final long serialVersionUID = -6324729041817254073L; - - private CodeField backChoice; - private String backToUser; - private String backToUserName; - private CodeField reSubmitWay; - - public BackOpinion() { - super("Back"); - this.flowDirection = FlowDirection.Backward; - } - - /** - * 回退意见选择 - * @return - */ - public CodeField getBackChoice() { - return backChoice; - } - - /** - * 回退意见选择 - * @param backChoice - */ - public void setBackChoice(CodeField backChoice) { - this.backChoice = backChoice; - } - - /** - * 回退目标用户ID(当指定用户回退时,使用) - * @return - */ - public String getBackToUser() { - return backToUser; - } - - /** - * 回退目标用户ID(当指定用户回退时,使用) - * @param backUser - */ - public void setBackToUser(String backToUser) { - this.backToUser = backToUser; - } - - /** - * 回退目标用户名称(当指定用户回退时,使用) - * @return - */ - public String getBackToUserName() { - return backToUserName; - } - - /** - * 回退目标用户名称(当指定用户回退时,使用) - * @param backUserName - */ - public void setBackToUserName(String backToUserName) { - this.backToUserName = backToUserName; - } - - /** - * 重新提交方式 - * @return - */ - public CodeField getReSubmitWay() { - return reSubmitWay; - } - - /** - * 重新提交方式 - * @param reSubmitWay - */ - public void setReSubmitWay(CodeField reSubmitWay) { - this.reSubmitWay = reSubmitWay; - } - -} diff --git a/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/Opinion.java b/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/Opinion.java deleted file mode 100644 index 456ec4e46..000000000 --- a/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/Opinion.java +++ /dev/null @@ -1,154 +0,0 @@ -package apx.com.amarsoft.aims.als.flow.model.opinion; - -import java.io.Serializable; -import java.util.LinkedHashMap; -import java.util.Map; - -import apx.com.amarsoft.aims.als.flow.model.FlowDirection; - - -/** - * 基础意见类,是所有流程意见类的基础类 - * @author cytsir - * - */ -public abstract class Opinion implements Serializable{ - - private static final long serialVersionUID = -4189229135995879095L; - - protected String opinionNo; //意见编号 - protected String opinionType; //意见类型标识。标识普通意见还是回退意见还是其他类型的意见 - protected FlowDirection flowDirection; //意见方向 - protected String content; //意见内容 - protected String signOrg; //审批人所属部门 - protected String signer; //意见签署人编号 - protected String signerName; //意见签署人名称 - protected String signOrgName; //审批人所属部门名称 - protected String signTime; //意见签署时间 - private Map> codemap = new LinkedHashMap>(); - - /** - * - * @param opinionType 标识普通意见还是回退意见还是其他类型的意见 - */ - public Opinion(String opinionType){ - this.opinionType = opinionType; - flowDirection = FlowDirection.Forward; - } - - public String getSignOrg() { - return signOrg; - } - - public void setSignOrg(String signOrg) { - this.signOrg = signOrg; - } - - public String getSignOrgName() { - return signOrgName; - } - - public void setSignOrgName(String signOrgName) { - this.signOrgName = signOrgName; - } - - - public String getOpinionNo() { - return opinionNo; - } - public void setOpinionNo(String opinionNo) { - this.opinionNo = opinionNo; - } - - /** - * 获取意见方向 - * @return - */ - public FlowDirection getFlowDirection() { - return flowDirection; - } - - /** - * 设置意见方向 - * @param direction - */ - public void setFlowDirection(FlowDirection flowDirection) { - this.flowDirection = flowDirection; - } - - /** - * 获取意见签署人编号 - * @return - */ - public String getSigner() { - return signer; - } - /** - * 设置意见签署人编号 - * @param signer - */ - public void setSigner(String signer) { - this.signer = signer; - } - /** - * 获取意见签署人名称 - * @return - */ - public String getSignerName() { - return signerName; - } - /** - * 设置意见签署人名称 - * @param signerName - */ - public void setSignerName(String signerName) { - this.signerName = signerName; - } - /** - * 获取意见内容 - * @return - */ - public String getContent() { - return content; - } - /** - * 设置意见内容 - * @param content - */ - public void setContent(String content) { - this.content = content; - } - - /** - * 标识普通意见还是回退意见还是其他类型的意见 - * @return - */ - public String getOpinionType(){ - return this.opinionType; - } - - /** - * 意见签署时间 - * @return - */ - public String getSignTime() { - return signTime; - } - - /** - * 意见签署时间 - * @param signTime - */ - public void setSignTime(String signTime) { - this.signTime = signTime; - } - - public Map> getCodemap() { - return codemap; - } - - public void setCodemap(Map> codemap) { - this.codemap = codemap; - } - -} diff --git a/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/OpinionList.java b/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/OpinionList.java deleted file mode 100644 index 340f87efa..000000000 --- a/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/OpinionList.java +++ /dev/null @@ -1,40 +0,0 @@ -package apx.com.amarsoft.aims.als.flow.model.opinion; -//package com.amarsoft.apx.web.als.flow.model.opinion; -// -//import java.util.ArrayList; -//import java.util.LinkedHashMap; -//import java.util.List; -//import java.util.Map; -// -///** -// * 意见列表 -// * @author cytsir -// * -// */ -//public class OpinionList { -// -// private List opinions; -// private Map> codemap; -// -// public OpinionList(){ -// this.opinions = new ArrayList(); -// this.codemap = new LinkedHashMap>(); -// } -// -// public List getOpinions() { -// return opinions; -// } -// -// public void setOpinions(List opinions) { -// this.opinions = opinions; -// } -// -// public Map> getCodemap() { -// return codemap; -// } -// -// public void setCodemap(Map> codemap) { -// this.codemap = codemap; -// } -// -//} diff --git a/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/SimpleOpinion.java b/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/SimpleOpinion.java deleted file mode 100644 index 2d6338ab4..000000000 --- a/src_app/apx/com/amarsoft/aims/als/flow/model/opinion/SimpleOpinion.java +++ /dev/null @@ -1,29 +0,0 @@ -package apx.com.amarsoft.aims.als.flow.model.opinion; - -import apx.com.amarsoft.aims.als.flow.model.CodeField; - - -/** - * 简单意见,一般包含意见选项和内容 - * @author cytsir - * - */ -public class SimpleOpinion extends Opinion{ - - private static final long serialVersionUID = -3756513376484286130L; - - private CodeField choice; - - public SimpleOpinion() { - super("Simple"); - } - - public CodeField getChoice() { - return choice; - } - - public void setChoice(CodeField choice) { - this.choice = choice; - } - -} diff --git a/src_app/apx/com/amarsoft/aims/constants/CommonConst.java b/src_app/apx/com/amarsoft/aims/constants/CommonConst.java deleted file mode 100644 index f482296fb..000000000 --- a/src_app/apx/com/amarsoft/aims/constants/CommonConst.java +++ /dev/null @@ -1,407 +0,0 @@ -package apx.com.amarsoft.aims.constants; - -/** - * 维护通用常量 - * @author yangsong - * @since 2014/06/21 - */ -public class CommonConst { - - public static final String JBO_USER_INFO = "jbo.sys.USER_INFO"; - public static final String JBO_USER_ROLE = "jbo.sys.USER_ROLE"; - - /** - * 客户数据来源 - */ - public static final String CUSTOMER_SOURCE = "01"; - /** - * 返回状态为成功 - */ - public static final String STATUS_SUCCESS = "SUCCESS"; - /** - * 返回状态为失败 - */ - public static final String STATUS_FAIL = "FAIL"; - /** - * 返回状态为真 - */ - public static final String STATUS_TRUE = "TRUE"; - /** - * 返回状态为假 - */ - public static final String STATUS_FALSE = "FALSE"; - /** - * 状态为初始化 - */ - public static final String STATUS_INIT = "INIT"; - /** - * 状态为有效 - */ - public static final String STATUS_VALID = "VALID"; - /** - * 状态为失效 - */ - public static final String STATUS_INVALID = "INVALID"; - - /** - * 保存标志 :SaveFlag - * SAVETEMP 暂存 - * SAVE 保存 - */ - public static final String FLAG_SAVETEMP = "SAVETEMP"; - public static final String FLAG_SAVE = "SAVE"; - - /** - * 权限控制标志 :RightType - * All 读写 - * ReadOnly 只读 - */ - public static final String RightType_All = "All"; - public static final String RightType_ReadOnly = "ReadOnly"; - public static final String RIGHTTYPE_VIEWALL = "001"; - public static final String RIGHTTYPE_VIEWREADONLY = "002"; - /** - * 是否标志:是 - * Code:YesNo - */ - public static final String YESNO_YES = "1"; - /** - * 是否标志:否 - * Code:YesNo - */ - public static final String YESNO_NO = "2"; - - /** - * 是否标志:是 - * Code:YesNo - */ - public static final String YESORNO_YES = "YES"; - /** - * 是否标志:否 - * Code:YesNo - */ - public static final String YESORNO_NO = "NO"; - - /** - * 角色:直投业务经理 - */ - public static final String ROLE_2010 = "2010"; - /** - * 角色:产品负责人3 - */ - public static final String ROLE_2470 = "2470"; - /** - * 角色:直投团队长 - */ - public static final String ROLE_2020 = "2020"; - /** - * 角色:直投部门长 - */ - public static final String ROLE_2030 = "2030"; - /** - * 角色:销售负责人 - */ - public static final String ROLE_2070 = "2070"; - /** - * 角色:销售团队成员 - */ - public static final String ROLE_2050 = "2050"; - /** - * 角色:押品审核岗 - */ - public static final String ROLE_2720 = "2720"; - /** - * 角色:押品维护岗 - */ - public static final String ROLE_2710 = "2710";//已停用 - - /** - * 角色:系统数据岗 - */ - public static final String ROLE_SYSDATA = "000"; - /** - * 角色:数据管理专岗 - */ - public static final String ROLE_2810 = "2810"; - /** - * 角色:总部系统维护员 - */ - public static final String ROLE_SYSTEM = "099"; - /** - * 角色:业务系统管理员 - */ - public static final String ROLE_098 = "098"; - /** - * 角色:法律合规岗 - */ - public static final String ROLE_2520 = "2520"; - /** - * 合规监督岗 - */ - public static final String ROLE_2525 = "2525"; - /** - * 角色:投前风险经理 - */ - public static final String ROLE_2210 = "2210"; - /** - * 角色:投中风险经理 - */ - public static final String ROLE_2220 = "2220"; - /** - * 角色:投后风险经理 - */ - public static final String ROLE_2230 = "2230"; - /** - * 角色:投后室经理 - */ - public static final String ROLE_2240 = "2240"; - /** - * 角色:投后查看人 - */ - public static final String ROLE_2248 = "2248"; - /** - * 角色:投后业务经理 - */ - public static final String ROLE_2245 = "2245"; - /** - * 角色:风控部门长及其授权人 - */ - public static final String ROLE_2250 = "2250"; - /** - * 角色:信评部门长及其授权人 - */ - public static final String ROLE_2310 = "2310"; - /** - * 角色:信评经理 - */ - public static final String ROLE_2320 = "2320"; - /** - * 角色:法律合规部门长及其授权人 - */ - public static final String ROLE_2510 = "2510"; - /** - * 角色:产委会秘书岗 - */ - public static final String ROLE_2450 = "2450"; - /** - * 角色:秘书成员 - */ - public static final String ROLE_2460 = "2460"; - /** - * 角色:固定收益投资部投资经理 - */ - public static final String ROLE_2910 = "2910"; - /** - * 角色:固定收益投资部部门长 - */ - public static final String ROLE_2920 = "2920"; - /** - * 角色:固定收益资管部投资经理 - */ - public static final String ROLE_2912 = "2912"; - /** - * 角色:固定收益资管部部门长 - */ - public static final String ROLE_2922 = "2922"; - /** - * 角色:投决会秘书岗 - */ - public static final String ROLE_2930 = "2930"; - /** - * 角色:合作机构人员 - */ - public static final String ROLE_2950 = "2950"; - /** - * 角色:公司领导 - */ - public static final String ROLE_2990 = "2990"; - - /** - * 单位:万 - */ - public static final String UNIT_WAN = "万"; - - /** - * 规则库表中规则类型:流程任务数据 - */ - public static final String RULETYPE_TASK = "TASK"; - - /** - * 数据来源:AIMS - */ - public static final String DATA_SOURCE_AIMS = "01"; - /** - * 数据来源:CDMS - */ - public static final String DATA_SOURCE_CDMS = "02"; - /** - * 数据来源:RDM - */ - public static final String DATA_SOURCE_RDM = "03"; - /** - * 数据来源:资产产品注册系统 - */ - public static final String DATA_SOURCE_TA = "05"; - - /** - * 对象类型:Customer 客户 - */ - public static final String OBJECTTYPE_CUSTOMER = "Customer"; - /** - * 对象类型:Project 项目 - */ - public static final String OBJECTTYPE_PROJECT = "Project"; - /** - * 对象类型:ReApplyPlan 重批 - */ - public static final String OBJECTTYPE_REAPPLYPLAN = "ReApplyPlan"; - /** - * 对象类型:Plan 产品 - */ - public static final String OBJECTTYPE_PLAN = "Plan"; - /** - * 对象类型:MidPlan 投中产品(放款资料清单) - */ - public static final String OBJECTTYPE_MIDPLAN = "MidPlan"; - /** - * 对象类型:Guaranty 押品 - */ - public static final String OBJECTTYPE_GUARANTY = "Guaranty"; - /** - * 对象类型:ModelLibrary 业务模板库 - */ - public static final String OBJECTTYPE_MODEL = "ModelLibrary"; - - /** - * 对象类型:PolicyLibrary 政策法规库 - */ - public static final String OBJECTTYPE_POLICY = "PolicyLibrary"; - - /** - * 对象类型:RiskLibrary 风控模板库 - */ - public static final String OBJECTTYPE_RISK = "RiskLibrary"; - /** - * 对象类型:RiskLibrary 信评模板库 - */ - public static final String OBJECTTYPE_CREDIT = "CreditLibrary"; - /** - * 对象类型:RiskLibrary 合规模板库 - */ - public static final String OBJECTTYPE_COMPLIANCE = "ComplianceLibrary"; - /** - * 对象类型:RiskLibrary 直投模板库 - */ - public static final String OBJECTTYPE_DIRECT = "DirectLibrary"; - - /** - * 对象类型:RaistBatch 批次 - */ - public static final String OBJECTTYPE_RAISTBATCH = "RaiseBatch"; - /** - * 对象类型:RiskSignal 预警信号 - */ - public static final String OBJECTTYPE_RISKSIGNAL = "InitRiskSignal"; - /** - * 对象类型:CloseRiskSignal 关闭预警信号 - */ - public static final String OBJECTTYPE_CLOSERISKSIGNAL = "CloseRiskSignal"; - - /** - * 对象类型:DueBill 借据 - */ - public static final String OBJECTTYPE_DUEBILL = "DueBill"; - - /** - * 对象类型:AfterPlanTaskFlow - */ - public static final String OBJECTTYPE_AFTERPLANTASKFLOW = "AfterPlanTaskFlow"; - - /** - * 对象类型:RegularTask 跟踪管理 - */ - public static final String OBJECTTYPE_REGULARTASK = "RegularTask"; - /** - * 对象类型:RegularTaskForFile 跟踪管理关联的文档 - */ - public static final String OBJECTTYPE_REGULARTASKFORFILE = "RegularTaskForFile"; - /** - * 对象类型:RegularTaskOpinion 跟踪管理关联的意见 - */ - public static final String OBJECTTYPE_REGULARTASKOPINION = "RegularTaskOpinion"; - /** - * 对象类型:EmployRelOrgDoc 机构选聘关联文件 - */ - public static final String OBJECTTYPE_EMPLOYRELORGDOC = "EmployRelOrgDoc"; - /** - * 对象类型:AfterChangeApply - * 使用位置:投后变更 - */ - public static final String OBJECTTYPE_AFTERCHANGEAPPLY = "AfterChangeApply"; - /** - * 对象类型:AfterFinanApply - * 使用位置:投后财务指标调整 - */ - public static final String OBJECTTYPE_AFTERFINANAPPLY = "AfterFinanApply"; - /** - * 对象类型:TempAuthorize - * 使用位置:临时授权 - */ - public static final String OBJECTTYPE_TEMPAUTHORIZE = "TempAuthorize"; - /** - * 对象类型:TransGraph - * 使用位置:交易机构图(集合资金信托计划(嵌套结构)) - */ - public static final String OBJECTTYPE_TRANSGRAPH = "TransGraph"; - /** - * 数据有效 - */ - public static final String STATUS_01 = "01"; - /** - * 数据无效 - */ - public static final String STATUS_02 = "02"; - - /** - * 数据有效 - */ - public static final String DELETEFLAG_0 = "0"; - /** - * 数据无效 - */ - public static final String DELETEFLAG_1 = "1"; - - /** - * 处理方式 - */ - public static final String TYPE_PAGE = "PAGE"; - public static final String TYPE_RUNMETHOD = "RUNMETHOD"; - public static final String TYPE_RATEINFO = "RATEINFO"; - - /** - * 公式参数连接符(参数+连接符+生效日期) - */ - public static final String FORMULA_CONNECTOR = "@"; - - /** - * 客户编号连接参数 - */ - public static final String CONNECTOR_CUSTOMER = "@"; - /** - * 占用额度主体信息连接参数 - */ - public static final String CONNECTOR_LIMIT = "~"; - - /** - * 外源产品 - */ - public static final String ISINNER_0 = "0"; - /** - * 内源产品 - */ - public static final String ISINNER_1 = "1"; - /** - * 第三方合作产品 - */ - public static final String ISINNER_2 = "2"; -} diff --git a/src_app/apx/com/amarsoft/aims/planteam/bzsrv/PlanTeamAction.java b/src_app/apx/com/amarsoft/aims/planteam/bzsrv/PlanTeamAction.java deleted file mode 100644 index 29337e289..000000000 --- a/src_app/apx/com/amarsoft/aims/planteam/bzsrv/PlanTeamAction.java +++ /dev/null @@ -1,159 +0,0 @@ -package apx.com.amarsoft.aims.planteam.bzsrv; - -import java.util.ArrayList; -import java.util.List; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; - -import apx.com.amarsoft.aims.als.flow.model.CodeField; -import apx.com.amarsoft.als.base.model.RspObject; -import cn.coyoteam.aweresf.model.User; - -import com.amarsoft.aims.util.StringHelper; -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.dict.als.manage.CodeManager; -import com.amarsoft.dict.als.object.Item; - -/** - * 团队组建相关动作实现接口 - * @author oldbiao 2016年1月9日 - * - */ -@Path("/PlanTeamAction") -public class PlanTeamAction { - - @GET - @Path("/delPlanMemeber") - /** - * 团队成员删除 - * @param memberNo - * @param tx - * @return - */ - public RspObject delPlanMemeber(@QueryParam("memberNo") String memberNo,@Context JBOTransaction tx ) { - RspObject rspObject = null; - try{ - //--更新团队成员状态 - /*PlanManageAction pma = new PlanManageAction(); - pma.setMemberNo(memberNo); - pma.setMemberStatus(PlanConst.TEAMSTATUS_INVALID); - pma.updateTeamMStatus(tx);*/ - RspObject.build("SUCCESS",null,"删除成功!"); - }catch(Exception e){ - rspObject = RspObject.build(e); - } - return rspObject; - } - - @GET - @Path("/addPlanMemeber") - /** - * 新增团队成员 - * @param memberNo - * @param tx - * @return - */ - public RspObject addPlanMemeber( - @QueryParam("memberID") String memberID, - @QueryParam("memberRole") String memberRole, - @QueryParam("memberOrg") String memberOrg, - @QueryParam("objectNo") String objectNo, - @QueryParam("objectType") String objectType, - @QueryParam("orgGroupID") String orgGroupID, - @Context User curUser) { - RspObject rspObject = null; - try{ - /*BizObjectManager bm = JBOFactory.getBizObjectManager(PlanConst.JBO_TEAM_MEMBER); - BizObject bo = bm.newObject(); - bo.setAttributeValue("ObjectNo", objectNo); - bo.setAttributeValue("ObjectType", objectType); - bo.setAttributeValue("MemberType", "INNER"); - bo.setAttributeValue("MemberID", memberID); - bo.setAttributeValue("MemberRoleID", memberRole); - bo.setAttributeValue("MemberOrgID",memberOrg ); - bo.setAttributeValue("Status","INVALID" ); - bo.setAttributeValue("InputUserID",curUser.getUserId() ); - bo.setAttributeValue("InputOrgID",curUser.getOrg().getOrgId() ); - bo.setAttributeValue("InputDate",StringFunction.getToday()); - bo.setAttributeValue("UpdateUserID",curUser.getUserId() ); - bo.setAttributeValue("UpdateOrgID",curUser.getOrg().getOrgId() ); - bo.setAttributeValue("UpdateDate",StringFunction.getToday()); - bo.setAttributeValue("OrgGroupID",orgGroupID); - bm.saveObject(bo);*/ - - RspObject.build("SUCCESS",null,"新增成功!"); - }catch(Exception e){ - rspObject = RspObject.build(e); - } - return rspObject; - } - - @GET - @Path("/updateGroupStatus") - /** - * 确认完成团队组建 - * @param memberNo - * @param tx - * @return - */ - public RspObject updateGroupStatus(@QueryParam("orgGroupID") String orgGroupID,@Context JBOTransaction tx ) { - RspObject rspObject = null; - try{ - /*//---更改团队状态 - PlanManageAction pma = new PlanManageAction(); - pma.setGroupID(orgGroupID); - pma.setGroupStatus(PlanConst.TEAMSTATUS_VALID); - pma.updateTeamMStatus(tx);*/ - - RspObject.build("SUCCESS",null,"确认成功!"); - }catch(Exception e){ - rspObject = RspObject.build(e); - } - return rspObject; - } - - /** - * 岗位选择数据接口 - * @param groupType - * @param curUser - * @return - */ - @GET - @Path("/getRoleList") - public List getRoleList(@QueryParam("groupType") String groupType,@Context User curUser){ - String orgID = curUser.getOrg().getOrgId(); - groupType = StringHelper.nvl(groupType, "NOVALUE"); - ArrayList< CodeField> roleList = new ArrayList(); - try{ - Item teamRoleOrgRela = CodeManager.getItem("TeamRoleOrgRela",orgID); - if(teamRoleOrgRela != null){ - String roleRela = teamRoleOrgRela.getItemAttribute(); - String attribute5 = teamRoleOrgRela.getAttribute5(); - if(groupType.equalsIgnoreCase(attribute5)){ - roleRela = teamRoleOrgRela.getAttribute4(); - } - String[] s = roleRela.split(","); - boolean flag = true; - CodeField code =null; - for(String j:s){ - if(flag){ - code = new CodeField(); - code.setCode("RoleList"); - code.setValue(j); - }else{ - code.setName(j); - roleList.add(code); - } - flag =!flag; - } - } - }catch (Exception e){ - ARE.getLog().error("岗位数据获取出错:"+e.toString()); - } - return roleList; - } -} diff --git a/src_app/apx/com/amarsoft/aims/user/bzsrv/UserInfo.java b/src_app/apx/com/amarsoft/aims/user/bzsrv/UserInfo.java deleted file mode 100644 index 3cb282162..000000000 --- a/src_app/apx/com/amarsoft/aims/user/bzsrv/UserInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package apx.com.amarsoft.aims.user.bzsrv; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; - -import cn.coyoteam.aweresf.model.User; -/** - * 获取用户相关信息接口实现类 - * @author oldbiao 2016年1月11日11:02:03 - * - */ - -@Path("/UserInfo") -public class UserInfo { - - @GET - @Path("/getUserInfo") - public User getUserInfo(@QueryParam("userID" )String userID){ - return new User(userID); - } -} diff --git a/src_app/apx/com/amarsoft/aims/xw/intercept/PlanInfoIntercept.java b/src_app/apx/com/amarsoft/aims/xw/intercept/PlanInfoIntercept.java deleted file mode 100644 index 947e54655..000000000 --- a/src_app/apx/com/amarsoft/aims/xw/intercept/PlanInfoIntercept.java +++ /dev/null @@ -1,21 +0,0 @@ -package apx.com.amarsoft.aims.xw.intercept; - - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.amarsoft.awe.dw.ASObjectModel; -import com.amarsoft.awe.dw.ASObjectWindow; - -import cn.coyoteam.aweresf.web.xw.render.InterceptHelper; -import cn.coyoteam.aweresf.web.xw.render.XWRenderIntercept; -import cn.coyoteam.aweresf.web.xw.segment.model.Segment; - -public class PlanInfoIntercept implements XWRenderIntercept{ - - public void beforeRender(HttpServletRequest request, HttpServletResponse response, ASObjectModel doTemp, - ASObjectWindow dwTemp, Segment xwData) { - InterceptHelper.executeColSpan(xwData);//处理合并字段。 - } - -} diff --git a/src_app/apx/com/amarsoft/als/base/awe/AbstractAweDo.java b/src_app/apx/com/amarsoft/als/base/awe/AbstractAweDo.java deleted file mode 100644 index bc3e7ea38..000000000 --- a/src_app/apx/com/amarsoft/als/base/awe/AbstractAweDo.java +++ /dev/null @@ -1,897 +0,0 @@ -package apx.com.amarsoft.als.base.awe; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.lang.StringUtils; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.constant.cache.AppAweDoCache; -import apx.com.amarsoft.als.base.constant.cache.AppCodeCache; -import apx.com.amarsoft.als.base.util.BizObjectUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import cn.coyoteam.aweresf.util.RequestUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -public abstract class AbstractAweDo { - private static Log logger = ARE.getLog(); - private String otherWhere; - - private Map paramMap; // 参数 - private Map donoMap; // 获取AWE_DO_CATALOG MAP格式: - - private List> templateList; // 获取分组模板信息 - - // AWE_DO_CATALOG - private String sDoName; // 获取当前模板名称 - private String sDono; // 获取当前分组模板号 - private String sJboClass; // JBO对象名 - private String sJboFrom; // JBOFROM子句 - private String sJboWhere; // JBOWHERE子句 - private String sJboOrder; // JBOGROUP子句 - private String sJboGroup; // JBOORDER子句 - - // APP_GROUP - private String sGroupIsList; // Y表示列表 N表示表单 - - // APP_GROUP_TEMPLATE - private String sGroupCode; // 分组号 - private String sDataName; // APP显示表单元素名 - private String sDataCode; // 表单元素号 - private String sIsList; // 是否列表显示 - private String sIsShow; // 分是否表单显示 - private String sPosition; // 分组模板数据位置 - private String sIsConvert; // 预留字段 - - public Map getData(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - return getData(request, sqlca, tx, null, null); - } - - @SuppressWarnings("unchecked") - public Map getData(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx, String groupid, String sOtherWhere) - throws Exception { - if (sOtherWhere == null) sOtherWhere = ""; - this.otherWhere = sOtherWhere; - Map appResult = new HashMap(); - appResult = findGroupTemplate(request, sqlca, tx, groupid); - if (null != appResult) - return appResult; - // 获取AWE_DO_LIBRARY LIST格式: - List> donoLibrary = (List>) this.donoMap - .get("library"); - - List queryList = new ArrayList(); - List methodList = new ArrayList(); - List> library = new ArrayList>(); - - for (Map templateMap : this.templateList) { - // 模板library : - // 字段排序 SORTNO - String sDoSortno = templateMap.get("SORTNO".toLowerCase()) == null ? "" - : templateMap.get("SORTNO".toLowerCase()).toString(); - // 字段索引 COLINDEX - String sDoColIndex = templateMap.get("COLINDEX".toLowerCase()) == null ? "" - : templateMap.get("COLINDEX".toLowerCase()).toString(); - // 使用名称 COLNAME - String sDoColName = templateMap.get("COLNAME".toLowerCase()) == null ? "" - : templateMap.get("COLNAME".toLowerCase()).toString(); - for (Map doLibraryMap : donoLibrary) { - // APP分组: - // 字段排序 SORTNO - String sGroupSortno = doLibraryMap.get("sortno") == null ? "" - : doLibraryMap.get("sortno").toString(); - // 字段索引 COLINDEX - String sGroupColIndex = doLibraryMap.get("colindex") == null ? "" - : doLibraryMap.get("colindex").toString(); - // 使用名称 COLNAME - String sGroupColName = doLibraryMap.get("colname") == null ? "" - : doLibraryMap.get("colname").toString(); - // APP分组 和 AWE 模板library 中的(字段索引、字段排序、使用名称 绑定使用 - // 使用名称 不区分大小写 ) - if (!(sGroupSortno.equals(sDoSortno) - && sGroupColIndex.equals(sDoColIndex) && sGroupColName - .equalsIgnoreCase(sDoColName))) { - continue; - } - - // 数据库原名 - String sActualName = doLibraryMap.get("colactualname") == null ? "" - : doLibraryMap.get("colactualname").toString(); - // 数据表名 - String sTableName = doLibraryMap.get("coltablename") == null ? "" - : doLibraryMap.get("coltablename").toString(); - - // 数据库原名 v.''或'' 不是表中字段 - // 直接剔除 - if ("v.''".equals(sActualName) || "''".equals(sActualName)) { - continue; - } - - // 数据表名不为 空字符串 表示元素 肯定是表中字段 - if (sTableName.length() > 0) { - // 数据表名.数据库原名 as V.分组使用名称 - // O.CUSTOMERID AS V.CUSTOMERID - queryList.add(sTableName + "." + sActualName + " as v." - + sGroupColName); - } else { - // 数据表名为空字符串 需要特殊处理 1. SQL过程方法 2. 类方法 - - // SQL过程方法 数据库原名 以‘NameManager.’开头 - // NameManager.getProjectNameByID(PROJECT_ID) -> - // V.getProjectNameByID(V.PROJECT_ID) - if (sActualName.startsWith("NameManager.")) { - String sSqlProcess = sActualName; - sSqlProcess = sSqlProcess.replace("NameManager.", ""); - // NameManager.getItemName开头需要特殊处理 和 CodeManager.处理相同 - // NameManager.getItemName("IsInUse",RoleStatus) - if (sActualName.startsWith("NameManager.getItemName")) { - // 从 ‘,’ 开始分割 分割后长度应为2 - String[] aProcess = sSqlProcess.split(","); - if (aProcess.length != 2) { - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - "模板号:" - + this.sDono - + "中字段索引:" - + sDoColIndex - + "排序号:" - + sDoSortno - + "使用名称:" - + sDoColName - + " 的字段数据库原名:" - + sActualName - + "格式有问题" - + "\r\n" - + "格式应为:NameManager.getItemName(\"xxx\",yyy)"); - logger.debug("模板号:" - + this.sDono - + "中字段索引:" - + sDoColIndex - + "排序号:" - + sDoSortno - + "使用名称:" - + sDoColName - + " 的字段数据库原名:" - + sActualName - + "格式有问题" - + "\r\n" - + "格式应为:NameManager.getItemName(\"xxx\",yyy)"); - return ReturnMapUtil.getReturnMap(); - } - // getItemName("xxx",yyy) AS V.xxx - String sProcess = "v." + aProcess[0] + ", v." - + aProcess[1] + "as v." + sGroupColName; - queryList.add(sProcess); - } else { - // NameManager.getProjectNameByID,NameManager.getCustomerName,NameManager.getUserName,NameManager.getRoleName - // 开头 - // NameManager.getProjectNameByID(PROJECT_ID) - // 从 ‘(’ 开始分割 分割后长度应为2 - String[] aProcess = sSqlProcess.split("\\("); - if (aProcess.length != 2) { - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - "模板号:" - + this.sDono - + "中字段索引:" - + sDoColIndex - + "排序号:" - + sDoSortno - + "使用名称:" - + sDoColName - + " 的字段数据库原名:" - + sActualName - + "格式有问题" - + "\r\n" - + "格式应为:NameManager.getUserName(xxx)"); - logger.debug("模板号:" + this.sDono + "中字段索引:" - + sDoColIndex + "排序号:" + sDoSortno - + "使用名称:" + sDoColName + " 的字段数据库原名:" - + sActualName + "格式有问题" + "\r\n" - + "格式应为:NameManager.getUserName(xxx)"); - return ReturnMapUtil.getReturnMap(); - } - // getUserName(xxx) AS V.xxx - String sProcess = "v." + aProcess[0] + "(v." - + aProcess[1] + "as v." + sGroupColName; - queryList.add(sProcess); - } - } else if (sActualName.startsWith("CodeManager.")) { - // CodeManager.getItemName('CountryCode',issuecountry) - // -> V.getItemName('CountryCode', V.issuecountry) - String sSqlProcess = sActualName; - sSqlProcess = sSqlProcess.replace("CodeManager.", ""); - // 从 ‘,’ 开始分割 分割后长度应为2 - String[] aProcess = sSqlProcess.split(","); - if (aProcess.length != 2) { - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - "模板号:" - + this.sDono - + "中字段索引:" - + sDoColIndex - + "排序号:" - + sDoSortno - + "使用名称:" - + sDoColName - + " 的字段数据库原名:" - + sActualName - + "格式有问题" - + "\r\n" - + "格式应为:CodeManager.getItemName('CountryCode',issuecountry)"); - logger.debug("模板号:" - + this.sDono - + "中字段索引:" - + sDoColIndex - + "排序号:" - + sDoSortno - + "使用名称:" - + sDoColName - + " 的字段数据库原名:" - + sActualName - + "格式有问题" - + "\r\n" - + "格式应为:CodeManager.getItemName('CountryCode',issuecountry)"); - return ReturnMapUtil.getReturnMap(); - } - // getItemName('CountryCode',xxx) AS V.xxx - String sProcess = "v." + aProcess[0] + ", v." - + aProcess[1] + "as v." + sGroupColName; - queryList.add(sProcess); - queryList.add(sProcess); - } else { - methodList.add(doLibraryMap.get("colactualname") + ""); - } - } - this.sDataName = templateMap.get("DATA_NAME".toLowerCase()) == null ? "" - : templateMap.get("DATA_NAME".toLowerCase()).toString(); - this.sDataCode = templateMap.get("DATA_CODE".toLowerCase()) == null ? "" - : templateMap.get("DATA_CODE".toLowerCase()).toString(); - this.sIsList = templateMap.get("ISLIST".toLowerCase()) == null ? "" - : templateMap.get("ISLIST".toLowerCase()).toString(); - this.sIsShow = templateMap.get("ISSHOW".toLowerCase()) == null ? "" - : templateMap.get("ISSHOW".toLowerCase()).toString(); - this.sPosition = templateMap.get("DATA_POSITION".toLowerCase()) == null ? "" - : templateMap.get("DATA_POSITION".toLowerCase()) - .toString(); - this.sIsConvert = templateMap.get("ISCONVERT".toLowerCase()) == null ? "" - : templateMap.get("ISCONVERT".toLowerCase()).toString(); - doLibraryMap.put("display".toLowerCase(), this.sDataName); - doLibraryMap.put("code".toLowerCase(), this.sDataCode); - doLibraryMap.put("ISLIST".toLowerCase(), this.sIsList); - doLibraryMap.put("ISSHOW".toLowerCase(), this.sIsShow); - doLibraryMap.put("position".toLowerCase(), this.sPosition); - doLibraryMap.put("ISCONVERT".toLowerCase(), this.sIsConvert); - doLibraryMap.put("value", null); - doLibraryMap.put("itemno", null); - library.add(doLibraryMap); - } - } - if (queryList.size() == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "根据分组号:" + this.sGroupCode + "未找到所配置的查询字段!"); - logger.debug("根据分组号:" + this.sGroupCode + "未找到所配置的查询字段!"); - return ReturnMapUtil.getReturnMap(); - } - String sJboQuery = ""; - for (String str : queryList) { - sJboQuery += str + ","; - } - if (sJboQuery.endsWith(",")) - sJboQuery = sJboQuery.substring(0, sJboQuery.length() - 1); - this.sJboClass = donoMap.get("JBOCLASS".toLowerCase()) == null ? "" - : donoMap.get("JBOCLASS".toLowerCase()).toString(); - this.sJboFrom = donoMap.get("JBOFROM".toLowerCase()) == null ? "" - : donoMap.get("JBOFROM".toLowerCase()).toString(); - this.sJboWhere = donoMap.get("JBOWHERE".toLowerCase()) == null ? "" - : donoMap.get("JBOWHERE".toLowerCase()).toString(); - this.sJboOrder = donoMap.get("JBOORDER".toLowerCase()) == null ? "" - : donoMap.get("JBOORDER".toLowerCase()).toString(); - this.sJboGroup = donoMap.get("JBOGROUP".toLowerCase()) == null ? "" - : donoMap.get("JBOGROUP".toLowerCase()).toString(); - this.sJboWhere = whereHandle(sJboWhere, paramMap); - if (this.sJboOrder.length() > 0) { - this.sJboOrder = " ORDER BY " + this.sJboOrder; - } - if (this.sJboGroup.length() > 0) { - this.sJboGroup = " GROUP BY " + this.sJboGroup; - } - String sSql = "SELECT " + sJboQuery + " "; - sSql += "FROM " + sJboFrom + " WHERE " + sJboWhere + " " - + this.otherWhere + " " + this.sJboOrder + " " + this.sJboGroup; - logger.debug("sql:" + sSql); - BizObjectManager classManage = JBOFactory - .getBizObjectManager(this.sJboClass); - List rtBos = classManage.createQuery(sSql).getResultList( - false); - BizObjectManager bom1 = JBOFactory - .getBizObjectManager("jbo.app.APP_BUSINESS_GROUP"); - BizObject bo1 = bom1.createQuery("GROUP_CODE=:GROUP_CODE") - .setParameter("GROUP_CODE", sGroupCode).getSingleResult(false); - this.sGroupIsList = bo1.getAttribute("ISLIST") == null ? "N" : bo1 - .getAttribute("ISLIST").toString(); - appResult = new HashMap(); - // 查询数量 - appResult.put("record_num", rtBos.size()); - List> datas = new ArrayList>(); - if (rtBos == null || rtBos.size() < 1) { - Map data = new HashMap(); - List> cols = new ArrayList>(); - for (Map doLibraryMap : library) { - doLibraryMap.put("itemno", ""); - doLibraryMap.put("value", ""); - Map col = new HashMap(); - col.put("basetype", doLibraryMap.get("coltype")); - for (String key : doLibraryMap.keySet()) { - col.put(key, doLibraryMap.get(key)); - } - String sIsShow = doLibraryMap.get("ISSHOW".toLowerCase()) == null ? "" - : doLibraryMap.get("ISSHOW".toLowerCase()).toString(); - if ("y".equalsIgnoreCase(sIsShow)) { - cols.add(col); - } - } - data.put("detail_data", cols); - datas.add(data); - if ("y".equalsIgnoreCase(sGroupIsList)) { - datas = new ArrayList>(); - } - appResult.put("datas", datas); - ReturnMapUtil.setReturnMap(appResult, - ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - String sPageIndex = request.getParameter("pageIndex"); - String sLimit = request.getParameter("limit"); - if (sPageIndex == null) - sPageIndex = "1"; - if (sLimit == null) - sLimit = "10"; - int iPageIndex, iLimit; - iPageIndex = Integer.valueOf(sPageIndex); - iLimit = Integer.valueOf(sLimit); - iPageIndex = iPageIndex - 1; - - int pageIndexStart = (iPageIndex) * iLimit; - int pageIndexEnd = (iPageIndex + 1) * iLimit; - // 获取SQL查询value及item name 赋予library中 - for (int i = pageIndexStart; i < pageIndexEnd; i++) { - // 数据数量大于list数据 - if (i > (rtBos.size() - 1)) { - break; - } - // 页码小于1 - if (iPageIndex + 1 < 1) { - break; - } - if (rtBos.size() % iLimit == 0) { - if ((rtBos.size() / iLimit) < iPageIndex) { - break; - } - } else { - if ((rtBos.size() / iLimit) + 1 < iPageIndex) { - break; - } - } - BizObject rtBo = rtBos.get(i); - Map data = new HashMap(); - List> cols = new ArrayList>(); - List> colLists = new ArrayList>(); - for (Map doLibraryMap : library) { - // 模板library : - // 字段排序 SORTNO - String sDoSortno = doLibraryMap.get("SORTNO".toLowerCase()) == null ? "" - : doLibraryMap.get("SORTNO".toLowerCase()).toString(); - // 字段索引 COLINDEX - String sDoColIndex = doLibraryMap.get("COLINDEX".toLowerCase()) == null ? "" - : doLibraryMap.get("COLINDEX".toLowerCase()).toString(); - // 使用名称 COLNAME - String sDoColName = doLibraryMap.get("COLNAME".toLowerCase()) == null ? "" - : doLibraryMap.get("COLNAME".toLowerCase()).toString(); - // 数据库原名 - String sActualName = doLibraryMap.get("colactualname") == null ? "" - : doLibraryMap.get("colactualname").toString(); - // 数据表名 - String sTableName = doLibraryMap.get("coltablename") == null ? "" - : doLibraryMap.get("coltablename").toString(); - // 使用名称 - String sColName = doLibraryMap.get("colname") == null ? "" - : doLibraryMap.get("colname").toString(); - // 显示来源类型 - String sSourceType = doLibraryMap.get("coleditsourcetype") == null ? "" - : doLibraryMap.get("coleditsourcetype").toString(); - // 显示来源 - String sSource = doLibraryMap.get("coleditsource") == null ? "" - : doLibraryMap.get("coleditsource").toString(); - - // v.'' 或者 '' 直接剔除 - if ("v.''".equals(sActualName) || "''".equals(sActualName)) { - continue; - } - // SQL 查询 - if (sTableName.length() > 0) { - if (null != rtBo.getAttribute(sColName)) { - doLibraryMap.put("itemno", rtBo.getAttribute(sColName) - .getValue()); - doLibraryMap.put("value", rtBo.getAttribute(sColName) - .getValue()); - } else { - doLibraryMap.put("value", null); - doLibraryMap.put("itemno", null); - } - } - - if (sActualName.startsWith("NameManager.")) { - if (null != rtBo.getAttribute(sColName)) { - doLibraryMap.put("itemno", rtBo.getAttribute(sColName) - .getValue()); - doLibraryMap.put("value", rtBo.getAttribute(sColName) - .getValue()); - } else { - doLibraryMap.put("value", null); - doLibraryMap.put("itemno", null); - } - } - - if (sActualName.startsWith("CodeManager.")) { - if (null != rtBo.getAttribute(sColName)) { - doLibraryMap.put("itemno", rtBo.getAttribute(sColName) - .getValue()); - doLibraryMap.put("value", rtBo.getAttribute(sColName) - .getValue()); - } else { - doLibraryMap.put("value", null); - doLibraryMap.put("itemno", null); - } - } - - // 获取类方法值 - // 不是CodeManager开头, - // 并且不是NameManager开头, - // 并且包含'.'和'(' 如com.xxx.xx.class.method(params..) - if (!sActualName.startsWith("CodeManager.") - && !sActualName.startsWith("NameManager.") - && sActualName.contains(".") - && sActualName.contains("(")) { - String[] array = sActualName.split("\\("); - if (array.length != 2) { - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - "模板号:" - + this.sDono - + "中字段索引:" - + sDoColIndex - + "排序号:" - + sDoSortno - + "使用名称:" - + sDoColName - + " 的字段数据库原名:" - + sActualName - + "格式有问题" - + "\r\n" - + "格式应为:com.xxx.xx.class.method(params..)"); - logger.debug("模板号:" + this.sDono + "中字段索引:" - + sDoColIndex + "排序号:" + sDoSortno + "使用名称:" - + sDoColName + " 的字段数据库原名:" + sActualName - + "格式有问题" + "\r\n" - + "格式应为:com.xxx.xx.class.method(params..)"); - return ReturnMapUtil.getReturnMap(); - } - // 获取 类方法所有参数 - String sParams1 = array[1]; - // 如果结尾不是括号结尾 - if (!sParams1.endsWith(")")) { - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - "模板号:" - + this.sDono - + "中字段索引:" - + sDoColIndex - + "排序号:" - + sDoSortno - + "使用名称:" - + sDoColName - + " 的字段数据库原名:" - + sActualName - + "格式有问题" - + "\r\n" - + "格式应为:com.xxx.xx.class.method(params..)"); - logger.debug("模板号:" + this.sDono + "中字段索引:" - + sDoColIndex + "排序号:" + sDoSortno + "使用名称:" - + sDoColName + " 的字段数据库原名:" + sActualName - + "格式有问题" + "\r\n" - + "格式应为:com.xxx.xx.class.method(params..)"); - return ReturnMapUtil.getReturnMap(); - } - sParams1 = sParams1.substring(0, sParams1.length() - 1); - String[] aParam = sParams1.split(","); - String[] aSet = new String[aParam.length]; - for (int j = 0; j < aParam.length; j++) { - String sColName1 = sDoColName; - String sColName2 = aParam[j]; -// if (sColName1.equals(sColName2)) { - String sValue = rtBo.getAttribute(sColName2) == null ? "" - : rtBo.getAttribute(sColName2).toString(); - aSet[j] = sValue; -// } - } - String sValue = executeMethod(sActualName, aSet); - doLibraryMap.put("value", sValue); - doLibraryMap.put("itemno", sValue); - // SQL获取值 - } else if ("code".equalsIgnoreCase(sSourceType)) { - List> codeLibrary = null; - doLibraryMap.put("itemno", rtBo.getAttribute(sColName) - .getValue()); - try { - codeLibrary = (List>) ((Map) AppCodeCache - .getAppCodeCachePool().get(sSource)) - .get("library"); - } catch (Exception e) { - doLibraryMap.put("value", rtBo.getAttribute(sColName) - .getValue()); - } - if (codeLibrary == null) { - doLibraryMap.put("value", rtBo.getAttribute(sColName) - .getValue()); - } else { - for (Map code : codeLibrary) { - String sItemNo = code.get("ITEMNO".toLowerCase()) == null ? "" - : code.get("ITEMNO".toLowerCase()) - .toString(); - String sValue = rtBo.getAttribute(sColName) == null ? "" - : rtBo.getAttribute(sColName).toString(); - if (sItemNo.trim().toLowerCase() - .equals(sValue.trim().toLowerCase())) { - doLibraryMap - .put("value", - code.get("ITEMNAME" - .toLowerCase()) == null ? "" - : code.get( - "ITEMNAME" - .toLowerCase()) - .toString()); - break; - } - doLibraryMap.put("value", - rtBo.getAttribute(sColName).getValue()); - } - } - } else if ("jbo".equalsIgnoreCase(sSourceType)) { - // -- JBO - // jbo.sys.CODE_LIBRARY,itemno,itemname,codeno='IsInUse' - if (sSource.length() == 0) { - doLibraryMap.put("itemno", rtBo.getAttribute(sColName) - .getValue()); - doLibraryMap.put("value", rtBo.getAttribute(sColName) - .getValue()); - } - String[] aSrouce = sSource.split(","); - if (aSrouce.length != 4) { - doLibraryMap.put("itemno", rtBo.getAttribute(sColName) - .getValue()); - doLibraryMap.put("value", rtBo.getAttribute(sColName) - .getValue()); - } else { - try { - BizObjectManager sourceManager = JBOFactory - .getBizObjectManager(aSrouce[0]); - BizObjectQuery sourceQuery = sourceManager - .createQuery("SELECT " + aSrouce[1] + "," - + aSrouce[2] + " FROM O WHERE " - + aSrouce[3]); - BizObject sourceObject = sourceQuery - .getSingleResult(false); - if (null == sourceObject) { - doLibraryMap.put("itemno", rtBo.getAttribute(sColName) - .getValue()); - doLibraryMap.put("value", rtBo.getAttribute(sColName) - .getValue()); - } else { - doLibraryMap.put("itemno", sourceObject - .getAttribute(aSrouce[1]).getValue()); - doLibraryMap.put("value", sourceObject - .getAttribute(aSrouce[2]).getValue()); - } - } catch (Exception e) { - doLibraryMap.put("itemno", rtBo.getAttribute(sColName) - .getValue()); - doLibraryMap.put("value", rtBo.getAttribute(sColName) - .getValue()); - } - } - - } else if ("CodeTable".equalsIgnoreCase(sSourceType)) { - // -- CodeTable ACQUIRED,运行,PAUSED,暂停,WAITING,等待 - if (sSource.length() == 0) { - doLibraryMap.put("itemno", rtBo.getAttribute(sColName) - .getValue()); - doLibraryMap.put("value", rtBo.getAttribute(sColName) - .getValue()); - } - String[] aSource = sSource.split(","); - if (aSource.length % 2 == 0) { - for (int ai = 0; ai < aSource.length; ai++) { - if ((ai + 1) % 2 != 0 - && rtBo.getAttribute(sColName).getValue() - .equals(aSource[ai])) { - doLibraryMap.put("itemno", - rtBo.getAttribute(sColName).getValue()); - doLibraryMap.put("value", aSource[ai + 1]); - } - } - } - if (null == doLibraryMap.get("value")) { - doLibraryMap.put("itemno", rtBo.getAttribute(sColName) - .getValue()); - doLibraryMap.put("value", rtBo.getAttribute(sColName) - .getValue()); - } - } else if ("@MIN_MAX".equalsIgnoreCase(sSourceType)) { - - } else if ("SubPage".equalsIgnoreCase(sSourceType)) { - - } - Map col = new HashMap(); - Map colList = new HashMap(); - for (String key : doLibraryMap.keySet()) { - col.put(key, doLibraryMap.get(key)); - colList.put(key, doLibraryMap.get(key)); - } - col.put("basetype", col.get("coltype")); - String sIsShow = doLibraryMap.get("ISSHOW".toLowerCase()) == null ? "" - : doLibraryMap.get("ISSHOW".toLowerCase()).toString(); - if ("y".equalsIgnoreCase(sGroupIsList)) { - String sIsList = doLibraryMap.get("ISLIST".toLowerCase()) == null ? "" - : doLibraryMap.get("ISLIST".toLowerCase()) - .toString(); - if ("y".equalsIgnoreCase(sIsList)) { - colLists.add(colList); - } - } - if ("y".equalsIgnoreCase(sIsShow)) { - cols.add(col); - } - } - data.put("detail_data", cols); - if ("y".equalsIgnoreCase(sGroupIsList)) { - data.put("list_data", colLists); - } - datas.add(data); - } - - appResult.put("datas", datas); - ReturnMapUtil.setReturnMap(appResult, - ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - @SuppressWarnings({ "unchecked", "deprecation" }) - private Map findGroupTemplate(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx, String groupid) - throws Exception { - Map appResult = checkGroupCodeIsValid(request, groupid); - if (null != appResult) - return appResult; - try { - ARE.getLog().info("=========2.加载参数=========="); - Map paramMap1 = new HashMap(); - if (request.getMethod().equalsIgnoreCase("GET")) { - paramMap1 = RequestUtil.convertRequestToMap(request); - } else { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - for (FileItem item : list) { - if (item.isFormField()) { - paramMap1 - .put(item.getFieldName().toLowerCase(), URLDecoder - .decode(item.getString("UTF-8"), "UTF-8")); - } - } - } - - this.paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - } catch (Exception e) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "获取加载参数出现异常,请联系管理员!"); - logger.error("获取加载参数出现异常,请联系管理员! \r\n" + "error:" + e); - return ReturnMapUtil.getReturnMap(); - } - - return null; - } - - @SuppressWarnings("unchecked") - private Map checkGroupCodeIsValid( - HttpServletRequest request, String groupid) throws Exception { - try { - ARE.getLog().info("=========1.获取分组号=========="); - if (StringUtils.isNotBlank(groupid)) { - this.sGroupCode = groupid; - } else { - this.sGroupCode = request.getParameter("groupId"); - } - if (sGroupCode.length() == 0) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "分组号为空,无法查询具体模板数据!"); - logger.debug("分组号为空,无法查询具体模板数据!"); - return ReturnMapUtil.getReturnMap(); - } - ARE.getLog().info("=========获取分组号: " + sGroupCode + "=========="); - ARE.getLog().info("=========准备获取APP分组信息=========="); - // 获取APP分组信息 - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.app.APP_BUSINESS_TEMPLATE"); - BizObjectQuery boq = bom.createQuery( - "GROUP_CODE=:GROUP_CODE ORDER BY DATA_POSITION") - .setParameter("GROUP_CODE", sGroupCode); - - List bos = boq.getResultList(false); - if (bos == null || bos.size() < 1) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "分组号:" + sGroupCode - + " 未找到相应分组配置!"); - logger.debug("分组号:" + sGroupCode + " 未找到相应分组配置!"); - return ReturnMapUtil.getReturnMap(); - } - - this.templateList = new ArrayList>(); - for (BizObject template : bos) { - BizObjectUtil util = new BizObjectUtil(); - Map templateMap = util - .bizObject2MapValue(template); - templateList.add(templateMap); - } - BizObject bo = bos.get(0); - - this.sDono = bo.getAttribute("DONO") == null ? "" : bo - .getAttribute("DONO").toString(); - if (sDono.length() == 0) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "分组号:" + sGroupCode - + " 配置元素模板为空!"); - logger.debug("分组号:" + sGroupCode + " 配置元素模板为空!"); - return ReturnMapUtil.getReturnMap(); - } - - ARE.getLog().info("=========获取模板号:" + sDono + "=========="); - - // 获取AWE_DO_CATALOG MAP格式: - this.donoMap = new HashMap(); - this.donoMap = (Map) AppAweDoCache - .getAppAweDoCachePool().get(sDono); - if (donoMap.size() == 0) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "模板号:" + sDono - + "不存在!"); - logger.debug("模板号:" + sDono + "不存在!"); - return ReturnMapUtil.getReturnMap(); - } - this.sDoName = donoMap.get("DONAME".toLowerCase()) == null ? "" - : donoMap.get("DONAME".toLowerCase()).toString(); - logger.info("模板中文名:" + this.sDoName); - } catch (Exception e) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "获取分组信息出现异常,请联系管理员!"); - logger.error("获取分组信息出现异常,请联系管理员! \r\n" + "error:" + e); - return ReturnMapUtil.getReturnMap(); - } - return null; - } - - private String executeMethod(String colactualname, String... params) { - - String value = ""; - - try { - String classpath = colactualname.substring(0, - colactualname.lastIndexOf(".")); - String methodName = colactualname.substring( - colactualname.lastIndexOf(".") + 1, - colactualname.indexOf("(")); - String paramsname = colactualname.substring( - colactualname.indexOf("(") + 1, colactualname.indexOf(")")); - String[] vParams = paramsname.split(","); - if (vParams.length != params.length) { - return null; - } - List Lparam = new ArrayList(); - for (String param : params) { - Lparam.add(param); - } - @SuppressWarnings("rawtypes") - Class classPathClass = Class.forName(classpath); - Object obj = classPathClass.newInstance(); - Method targetMethod = null; - Method[] cls = classPathClass.getDeclaredMethods(); - for (int j = 0; j < cls.length; j++) { - if (cls[j].getName().equalsIgnoreCase(methodName)) { - targetMethod = cls[j]; - } - } - value = (String) targetMethod.invoke(obj, Lparam.toArray()); - if (value == null) { - value = ""; - } - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | SecurityException - | IllegalArgumentException | InvocationTargetException e) { - logger.error("executeMethod" + e); - return null; - } - return value; - } - - private static String whereHandle(String sJboWhere, - Map paramMap) { - String where = sJboWhere; - String[] array = where.split(" "); - for (String str : array) { - if (!str.contains("=:")) - continue; - String[] array1 = str.split("=:"); - if (array1.length < 2) - continue; - if (!array1[0].contains(".")) { - String newStr = array1[0] + "='" + paramMap.get(array1[0]) - + "'"; - sJboWhere = sJboWhere.replace(str, newStr); - continue; - } - String[] array2 = array1[0].split("\\."); - if (array2.length < 2) - continue; - String newStr = array1[0] + "='" - + paramMap.get(array2[1].toLowerCase()) + "'"; - if (array1[1].endsWith(")")) { - newStr += ")"; - } - sJboWhere = sJboWhere.replace(str, newStr); - } - return sJboWhere; - } -} diff --git a/src_app/apx/com/amarsoft/als/base/awe/service/ColSelectSourceService.java b/src_app/apx/com/amarsoft/als/base/awe/service/ColSelectSourceService.java deleted file mode 100644 index 59b0f4926..000000000 --- a/src_app/apx/com/amarsoft/als/base/awe/service/ColSelectSourceService.java +++ /dev/null @@ -1,170 +0,0 @@ -package apx.com.amarsoft.als.base.awe.service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; - -public class ColSelectSourceService { - public static final String CODE_TYPE = "CODE"; - public static final String JBO_TYPE = "JBO"; - public static final String CODE_TABLE_TYPE = "CODETABLE"; - public static final String SUB_PAGE_TYPE = "SUBPAGE"; - public static final String MIN_MAX_TYPE = "@MIN_MAX"; - - public static List> findSelectSource(String sType, - String sSource, String sOtherWhere) throws Exception { - if (null == sType) - sType = ""; - if (null == sSource) - sSource = ""; - if (sType.length() == 0 || sSource.length() == 0) - return new ArrayList>(); - sType = sType.toUpperCase(); - switch (sType) { - case CODE_TYPE: - return getCodeTypeSelect(sSource, sOtherWhere); - case JBO_TYPE: - return getJboTypeSelect(sSource, sOtherWhere); - case CODE_TABLE_TYPE: - return getCodeTableTypeSelect(sSource); - case MIN_MAX_TYPE: - return getMinMaxTypeSelect(sSource); - case SUB_PAGE_TYPE: - return new ArrayList>(); - default: - return new ArrayList>(); - } - } - - protected static List> getCodeTypeSelect( - String sSource, String sOtherWhere) { - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.sys.CODE_LIBRARY"); - BizObjectQuery boq = bom - .createQuery("1=1 AND isinuse='1' AND CODENO=:CODENO " + sOtherWhere - + " ORDER BY sortno"); - @SuppressWarnings("unchecked") - List bos = boq.setParameter("CODENO", sSource) - .getResultList(false); - if (bos == null) - bos = new ArrayList(); - List> list = new ArrayList>(); - for (BizObject bo : bos) { - Map map = new HashMap(); - map.put("itemno", bo.getAttribute("ITEMNO").getValue()); - map.put("itemname", bo.getAttribute("ITEMNAME").getValue()); - list.add(map); - } - return list; - } catch (JBOException e) { - ARE.getLog().error("ERROR : ", e); - return new ArrayList>(); - } - } - - protected static List> getJboTypeSelect(String sSource, - String sOtherWhere) { - if (null == sSource) - sSource = ""; - if (sSource.length() == 0 || !sSource.contains(",")) - return new ArrayList>(); - String[] array = sSource.split(","); - if (array.length != 4) - return new ArrayList>(); - String sClass = array[0]; - String sItemNo = array[1]; - String sItemName = array[2]; - String sWhere = array[3]; - - sWhere = sWhere.toUpperCase(); - if (sWhere.contains("ORDER BY")) - sOtherWhere = ""; - - try { - BizObjectManager bom = JBOFactory.getBizObjectManager(sClass); - BizObjectQuery boq = bom.createQuery("SELECT " + sItemNo + ", " - + sItemName + " FROM O WHERE " + sWhere + " " + sOtherWhere); - @SuppressWarnings("unchecked") - List bos = boq.getResultList(false); - if (null == bos) - bos = new ArrayList(); - List> list = new ArrayList>(); - for (BizObject bo : bos) { - Map map = new HashMap(); - map.put("itemno", bo.getAttribute(sItemNo).getValue()); - map.put("itemname", bo.getAttribute(sItemName).getValue()); - list.add(map); - } - return list; - } catch (JBOException e) { - ARE.getLog().error("ERROR : ", e); - return new ArrayList>(); - } - } - - protected static List> getCodeTableTypeSelect( - String sSource) { - if (null == sSource) sSource = ""; - if (sSource.length() == 0 || !sSource.contains(",")) - return new ArrayList>(); - String[] array = sSource.split(","); - if (array.length % 2 != 0) - return new ArrayList>(); - List> list = new ArrayList>(); - for (int i = 0; i < array.length - 1; i ++) { - if ((i + 1) % 2 != 0) { - Map map = new HashMap(); - map.put("itemno", array[i]); - map.put("itemname", array[i+1]); - list.add(map); - } - } - return list; - } - - protected static List> getMinMaxTypeSelect( - String sSource) { -// -- 6,8 - - if (null == sSource) sSource = ""; - if (sSource.length() == 0 || !sSource.contains(",")) - return new ArrayList>(); - String[] array = sSource.split(","); - if (array.length != 2) - return new ArrayList>(); - int iMin = Integer.valueOf(array[0]); - int iMax = Integer.valueOf(array[1]); - int iProvisional = 0; - if (iMin > iMax) { - iProvisional = iMin; - iMin = iMax; - iMax = iProvisional; - } - List> list = new ArrayList>(); - Map map = new HashMap(); - map.put("itemname", iMin); - map.put("itemno", "MIN"); - Map map1 = new HashMap(); - map1.put("itemname", iMax); - map1.put("itemno", "MAX"); - list.add(map); - list.add(map1); - return list; - } - - public static void main(String[] args) { - List> list = getMinMaxTypeSelect("16,88"); - for (Map map : list) { - System.out.println(map); - } - } -} diff --git a/src_app/apx/com/amarsoft/als/base/awe/util/AweDoCommUtil.java b/src_app/apx/com/amarsoft/als/base/awe/util/AweDoCommUtil.java deleted file mode 100644 index 1abdb7508..000000000 --- a/src_app/apx/com/amarsoft/als/base/awe/util/AweDoCommUtil.java +++ /dev/null @@ -1,34 +0,0 @@ -package apx.com.amarsoft.als.base.awe.util; - -import java.util.Map; - -public class AweDoCommUtil { - public static String whereHandle(String sJboWhere, - Map paramMap) { - String where = sJboWhere; - String[] array = where.split(" "); - for (String str : array) { - if (!str.contains("=:")) - continue; - String[] array1 = str.split("=:"); - if (array1.length < 2) - continue; - if (!array1[0].contains(".")) { - String newStr = array1[0] + "='" + paramMap.get(array1[0]) - + "'"; - sJboWhere = sJboWhere.replace(str, newStr); - continue; - } - String[] array2 = array1[0].split("\\."); - if (array2.length < 2) - continue; - String newStr = array1[0] + "='" - + paramMap.get(array2[1].toLowerCase()) + "'"; - if (array1[1].endsWith(")")) { - newStr += ")"; - } - sJboWhere = sJboWhere.replace(str, newStr); - } - return sJboWhere; - } -} diff --git a/src_app/apx/com/amarsoft/als/base/constant/ResultConstant.java b/src_app/apx/com/amarsoft/als/base/constant/ResultConstant.java deleted file mode 100644 index 0cab421fe..000000000 --- a/src_app/apx/com/amarsoft/als/base/constant/ResultConstant.java +++ /dev/null @@ -1,23 +0,0 @@ -package apx.com.amarsoft.als.base.constant; - -public class ResultConstant { - public static final String SUCCESS_RESULT_CODE = "SUCCESS"; - public static final String FAIL_RESULT_CODE = "FAIL"; - public static final String FAIL_ERROR_RESULT_CODE = "401"; - public static final String FAIL_TOKEN_INVALID_CODE = "406"; - - public static final String FAIL_ERROR_MESSAGE_1 = "非法请求,token不存在"; - public static final String FAIL_ERROR_MESSAGE_0 = "系统出现异常,请联系管理员"; - public static final String FAIL_RESULT_PARAM_LACK = "重要参数缺少!"; - public static final String FAIL_TOKEN_INVALID_MESSAGE = "非法请求,token不存在!"; - - public static final String FAIL_SAVE = "保存失败"; - public static final String FAIL_EDIT = "编辑失败"; - public static final String FAIL_DELETE = "删除失败"; - public static final String FAIL_INIT_DISPLAY = "初始化页面失败"; - - public static final String SUCCESS_SAVE = "保存成功"; - public static final String SUCCESS_EDIT = "编辑成功"; - public static final String SUCCESS_DELETE = "删除成功"; - public static final String SUCCESS_INIT_DISPLAY = "初始化页面成功"; -} diff --git a/src_app/apx/com/amarsoft/als/base/constant/cache/AppAweDoCache.java b/src_app/apx/com/amarsoft/als/base/constant/cache/AppAweDoCache.java deleted file mode 100644 index 05d62dd84..000000000 --- a/src_app/apx/com/amarsoft/als/base/constant/cache/AppAweDoCache.java +++ /dev/null @@ -1,80 +0,0 @@ -package apx.com.amarsoft.als.base.constant.cache; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import apx.com.amarsoft.als.base.util.BizObjectUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.dict.als.cache.AbstractCache; - -public class AppAweDoCache extends AbstractCache { - private static AppAweDoCache instance = null; - private static Map appAweDoCachePool = null; - - public static synchronized AppAweDoCache getInstance() { - if (instance == null) { - instance = new AppAweDoCache(); - } - return instance; - } - - public static synchronized Map getAppAweDoCachePool() { - if (null == appAweDoCachePool) - appAweDoCachePool = new HashMap(); - return appAweDoCachePool; - } - - @Override - public synchronized void clear() throws Exception { - getAppAweDoCachePool().clear(); - appAweDoCachePool = null; - } - - @Override - public synchronized boolean load(Transaction arg0) throws Exception { - ARE.getLog().info("[CACHE] AppAweDOCache bulid Begin ................."); - initAweDoCachePool(); - ARE.getLog().info("[CACHE] AppAweDOCache bulid End ..................."); - return true; - } - - @SuppressWarnings("unchecked") - private synchronized void initAweDoCachePool() throws JBOException { - // begin awe_do_catalog/awe_do_library in cache - appAweDoCachePool = new HashMap(); - BizObjectManager doCatalogBom = JBOFactory - .getBizObjectManager("jbo.awe.AWE_DO_CATALOG"); - BizObjectQuery doCatalogBoq = doCatalogBom - .createQuery("1=1 and isinuse ='1'"); - List doCatalogs = doCatalogBoq.getResultList(false); - for (BizObject doCatalog : doCatalogs) { - BizObjectUtil util = new BizObjectUtil(); - Map map = util.bizObject2MapValue(doCatalog); - String dono = map.get("dono").toString(); - BizObjectManager libraryBom = JBOFactory - .getBizObjectManager("jbo.app.AWE_DO_LIBRARY"); - BizObjectQuery libraryBqm = libraryBom - .createQuery("isinuse ='1' AND dono='" + dono - + "' ORDER BY SORTNO"); - List librarys = libraryBqm.getResultList(false); - List> list = new ArrayList>(); - for (BizObject library : librarys) { - Map libraryMap = util.bizObject2MapValue(library); - list.add(libraryMap); - } - map.put("library", list); - appAweDoCachePool.put(dono, map); - } - // end - } - -} diff --git a/src_app/apx/com/amarsoft/als/base/constant/cache/AppCodeCache.java b/src_app/apx/com/amarsoft/als/base/constant/cache/AppCodeCache.java deleted file mode 100644 index 3d83b29dd..000000000 --- a/src_app/apx/com/amarsoft/als/base/constant/cache/AppCodeCache.java +++ /dev/null @@ -1,94 +0,0 @@ -package apx.com.amarsoft.als.base.constant.cache; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import apx.com.amarsoft.als.base.util.BizObjectUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.dict.als.cache.AbstractCache; - -public class AppCodeCache extends AbstractCache { - private static Map appCodeCachePool = null; - private static AppCodeCache instance = null; - - public static synchronized AppCodeCache getInstance() { - if (instance == null) { - instance = new AppCodeCache(); - } - return instance; - } - - public static Map getAppCodeCachePool() { - return appCodeCachePool; - } - - public synchronized Map getCacheMapPool() { - if (appCodeCachePool == null) - appCodeCachePool = new HashMap(); - return appCodeCachePool; - } - - @Override - public synchronized void clear() throws Exception { - getCacheMapPool().clear(); - appCodeCachePool = null; - } - - @Override - public synchronized boolean load(Transaction arg0) throws Exception { - ARE.getLog().info("[APPKICKOFFLINE] Begin ................."); - kickOffline(); - ARE.getLog().info("[APPKICKOFFLINE] End................."); - ARE.getLog().info("[CACHE] AppCodeCache bulid Begin ................."); - initCodeCachePool(); - ARE.getLog().info("[CACHE] AppCodeCache bulid End ..................."); - return true; - } - - @SuppressWarnings("unchecked") - private synchronized void kickOffline() throws JBOException { - BizObjectManager bom = JBOFactory.getBizObjectManager("jbo.guaranty.TOKEN_SESSION"); - List bos = bom.createQuery("1=1").getResultList(false); - for (BizObject bo : bos) - bom.deleteObject(bo); - } - - @SuppressWarnings("unchecked") - private synchronized void initCodeCachePool() throws JBOException { - appCodeCachePool = new HashMap(); - // begin code_catalog/code_library in cache - BizObjectManager catalogBom = JBOFactory - .getBizObjectManager("jbo.sys.CODE_CATALOG"); - BizObjectQuery catalogBoq = catalogBom - .createQuery("1=1"); - List catalogs = catalogBoq.getResultList(false); - for (BizObject catalog : catalogs) { - BizObjectUtil util = new BizObjectUtil(); - Map map = util.bizObject2MapValue(catalog); - String codeno = map.get("codeno").toString(); - BizObjectManager libraryBom = JBOFactory - .getBizObjectManager("jbo.sys.CODE_LIBRARY"); - BizObjectQuery libraryBqm = libraryBom - .createQuery("isinuse ='1' AND CODENO='" + codeno - + "' ORDER BY SORTNO"); - List librarys = libraryBqm.getResultList(false); - List> list = new ArrayList>(); - for (BizObject library : librarys) { - Map libraryMap = util.bizObject2MapValue(library); - list.add(libraryMap); - } - map.put("library", list); - AppCodeCache.appCodeCachePool.put(codeno, map); - } - // end - } -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/AppConfigJbo.java b/src_app/apx/com/amarsoft/als/base/jbo/AppConfigJbo.java deleted file mode 100644 index e5a2111ea..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/AppConfigJbo.java +++ /dev/null @@ -1,25 +0,0 @@ -package apx.com.amarsoft.als.base.jbo; - -import java.util.List; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOTransaction; - -public interface AppConfigJbo { - /** - * 根据设备类型查询APP版本 - * - * @param tx - * @param devType - * @return - */ - List findNewAppVersion(JBOTransaction tx, String devType); - - /** - * 获取所有APP配置流程s - * - * @param tx - * @return - */ - List findAppFlow(JBOTransaction tx); -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/CustomerJbo.java b/src_app/apx/com/amarsoft/als/base/jbo/CustomerJbo.java deleted file mode 100644 index d431cd519..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/CustomerJbo.java +++ /dev/null @@ -1,124 +0,0 @@ -package apx.com.amarsoft.als.base.jbo; - -import java.util.List; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOTransaction; - -public interface CustomerJbo { - /** - * 根据客户类型(法人, 自然人)获取客户列表 - * - * @param tx - * @param custType - * @param sOtherWhere - * @return - */ - List customerList(JBOTransaction tx, String custType, - String sOtherWhere); - - /** - * 根据客户ID 获取客户基本信息 - * - * @param tx - * @param sCustomerId - * @return - */ - BizObject getCustomerById(JBOTransaction tx, String sCustomerId); - - /** - * 根据客户ID 获取客户个人信息 - * - * @param tx - * @param sCustomerId - * @return - */ - BizObject getPersonById(JBOTransaction tx, String sCustomerId); - - /** - * 根据客户ID 获取公司信息 - * - * @param tx - * @param sCustomerId - * @return - */ - BizObject getCompanyById(JBOTransaction tx, String sCustomerId); - - /** - * 根据客户ID 获取客户类型 - * - * @param tx - * @param sCustomerId - * @return - */ - BizObject getTypeById(JBOTransaction tx, String sCustomerId); - - /** - * 根据客户ID 获取客户绑定联系电话列表 - * - * @param tx - * @param sCustomerId - * @return - */ - List getCustomerBindingTelByCustomerId(JBOTransaction tx, - String sCustomerId); - - /** - * 根据客户ID 获取客户绑定联系地址列表 - * - * @param tx - * @param sCustomerId - * @return - */ - List getCustomerBindingAddressByCustomerId(JBOTransaction tx, - String sCustomerId); - - /** - * 根据客户ID 获取客户绑定证件列表 - * - * @param tx - * @param sCustomerId - * @return - */ - List getCustomerBindingCertByCustomerId(JBOTransaction tx, - String sCustomerId); - - /** - * 根据客户ID 获取客户绑定银行账户列表 - * - * @param tx - * @param sCustomerId - * @return - */ - List getCustomerBindingAccountByCustomerId(JBOTransaction tx, - String sCustomerId); - - /** - * 根据客户ID 获取客户拜访记录 - * - * @param tx - * @param sCustomerId - * @return - */ - List getCustomerVisitRecordListByCustomerId(JBOTransaction tx, - String sCustomerId); - - /** - * 根据客户ID 获取客户交易记录 - * - * @param tx - * @param sCustomerId - * @return - */ - List getCustomerHistoryRecordByCustomerId(JBOTransaction tx, - String sCustomerId); - /** - * 根据客户附件ID 获取客户拜访记录附件 - * - * @param tx - * @param sCustomerId - * @return - */ - List getCustomerVisitFileListByRelaid(JBOTransaction tx, - String sRelaid); -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/FlowInfoJbo.java b/src_app/apx/com/amarsoft/als/base/jbo/FlowInfoJbo.java deleted file mode 100644 index 02ef70137..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/FlowInfoJbo.java +++ /dev/null @@ -1,35 +0,0 @@ -package apx.com.amarsoft.als.base.jbo; - -import java.util.List; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOTransaction; - -public interface FlowInfoJbo { - /** - * 查找所有APP流程 - * - * @param tx - * @return - */ - List findAllAppFlow(JBOTransaction tx); - - /** - * 根据用户ID 找到用户角色绑定的流程号 - * @param tx - * @param sUserId - * @return - */ - List findAllAppFlowNo(JBOTransaction tx, String sUserId); - - /** - * 根据FLOWNO 获取流程信息 - * - * @param tx - * @param sFlowNo - * @return - */ - BizObject findFlowCatalogByFlowNo(JBOTransaction tx, String sFlowNo); - - List findAllAppFlow(JBOTransaction tx, String sWhere); -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/FlowObjectJbo.java b/src_app/apx/com/amarsoft/als/base/jbo/FlowObjectJbo.java deleted file mode 100644 index a84356aea..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/FlowObjectJbo.java +++ /dev/null @@ -1,42 +0,0 @@ -package apx.com.amarsoft.als.base.jbo; - -import java.util.List; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOTransaction; - -public interface FlowObjectJbo { - /** - * 根据用户获取代办列表 - * - * @param tx - * @param sUser - * @return - */ - List getCommissionList(JBOTransaction tx, String sUser); - - List getAppCommissionList(JBOTransaction tx, String sUser, - String sFlowNos, String sLimit); - - /** - * 根据用户获取已办列表 - * - * @param tx - * @param sUser - * @return - */ - List getDoneList(JBOTransaction tx, String sUser); - - List getDoneList(JBOTransaction tx, String sUser, - String sFlowNos, String sLimit); - - BizObject getFlowModel(JBOTransaction tx, String sFlowNo, String sPhaseNo); - - BizObject getFlowTask(JBOTransaction tx, String sUserId, String sObjectNo, - String sObjectType, String sFlowNo, String sPhaseNo); - - List getFlowTask(JBOTransaction tx, String sObjectNo, - String sObjectType, String sPhaseNo); - - BizObject getFlowOpinion(JBOTransaction tx, String sSerialNo, String sUserId); -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/LBDocLibraryService.java b/src_app/apx/com/amarsoft/als/base/jbo/LBDocLibraryService.java deleted file mode 100644 index 6cd1e20f4..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/LBDocLibraryService.java +++ /dev/null @@ -1,10 +0,0 @@ -package apx.com.amarsoft.als.base.jbo; - -import java.util.List; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOTransaction; - -public interface LBDocLibraryService { - List findDocList(JBOTransaction tx, String sql); -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/UserInfoJbo.java b/src_app/apx/com/amarsoft/als/base/jbo/UserInfoJbo.java deleted file mode 100644 index 922887868..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/UserInfoJbo.java +++ /dev/null @@ -1,46 +0,0 @@ -package apx.com.amarsoft.als.base.jbo; - -import java.util.List; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOTransaction; - -public interface UserInfoJbo { - /** - * 通过USERID找到用户 - * - * @param tx - * @param id - * @return - */ - BizObject findUserByUserId(JBOTransaction tx, String id); - - /** - * 通过登录名找到用户 - * - * @param tx - * @param loginName - * @return - */ - BizObject findUserByLoginName(JBOTransaction tx, String loginName); - - /** - * 通过USERID作为条件修改用户数据 - * - * @param tx - * @param condition - * @param userId - */ - void updateUserByUserId(JBOTransaction tx, String condition, String userId); - - /** - * 根据用户ID 找出角色匹配 APP流程角色 - * - * @param tx - * @param userId - * @return - */ - List findAppFlowRoleByUserId(JBOTransaction tx, String userId); - - List findRoleByUserId(JBOTransaction tx, String sUserId); -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/impl/AppConfigJboImpl.java b/src_app/apx/com/amarsoft/als/base/jbo/impl/AppConfigJboImpl.java deleted file mode 100644 index 07e2483b3..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/impl/AppConfigJboImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -package apx.com.amarsoft.als.base.jbo.impl; - -import java.util.ArrayList; -import java.util.List; - -import apx.com.amarsoft.als.base.jbo.AppConfigJbo; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; - -public class AppConfigJboImpl implements AppConfigJbo { - - // 日志对象 - private static Log logger = ARE.getLog(); - - @SuppressWarnings("unchecked") - public List findNewAppVersion(JBOTransaction tx, String devType) { - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory.getFactory().getManager( - "jbo.app.APP_VERSION"); - tx.join(bom); - BizObjectQuery boq = bom - .createQuery("PHONE_TYPE=:PHONE_TYPE AND IS_NEW=:IS_NEW ORDER BY UP_DATE DESC"); - bos = boq.setParameter("PHONE_TYPE", devType) - .setParameter("IS_NEW", "Y").getResultList(false); - } catch (JBOException e) { - logger.error(e); - e.printStackTrace(); - } - return bos; - } - - @SuppressWarnings("unchecked") - public List findAppFlow(JBOTransaction tx) { - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory.getFactory().getManager( - "jbo.app.APP_FLOW_SHOW"); - tx.join(bom); - BizObjectQuery boq = bom.createQuery("1=1 ORDER BY POSITION"); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - e.printStackTrace(); - } - return bos; - } -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/impl/CustomerJboImpl.java b/src_app/apx/com/amarsoft/als/base/jbo/impl/CustomerJboImpl.java deleted file mode 100644 index a78ba71d6..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/impl/CustomerJboImpl.java +++ /dev/null @@ -1,275 +0,0 @@ -package apx.com.amarsoft.als.base.jbo.impl; - -import java.util.ArrayList; -import java.util.List; - -import apx.com.amarsoft.als.base.jbo.CustomerJbo; -import apx.com.amarsoft.als.customer.constant.CustomerConstant; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; - -public class CustomerJboImpl implements CustomerJbo { - // 日志对象 - private static Log logger = ARE.getLog(); - - @SuppressWarnings("unchecked") - public List customerList(JBOTransaction tx, String custType, - String sOtherWhere) { - List bos = new ArrayList(); - try { - // 获得组件参数 :客户类型、客户显示模版号 - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_INFO.className); - StringBuffer bf = new StringBuffer("SELECT "); - bf.append("CP.province, CP.city, CP.CUSTSOURCE, ") - .append("O.CUSTOMERID,O.CUSTOMERNAME,O.NATIONCODE,O.CERTTYPE,O.CERTID,O.CUSTKIND,O.CUSTOMERTYPE,O.STATUS,") - .append("O.MFCUSTOMERID,O.BELONGGROUPID,O.CHANNEL,O.LOANCARDNO,O.CUSTOMERSCALE,O.REMARK,O.INPUTUSERID,") - .append("O.INPUTORGID,O.UPDATEUSERID,O.UPDATEORGID,O.INPUTTIME,O.UPDATETIME,") - .append("CT.CUSTSTATUS, CT.CUSTTYPE ") - .append("FROM O ") - .append("LEFT JOIN " - + CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_TYPE.className - + " CT ON O.CUSTOMERID=CT.CUSTOMERID ") - .append("LEFT JOIN " - + CustomerConstant.CUSTOMER_TABLE.TALBE_CUSTOMER_PERSON.className - + " CP ON O.CUSTOMERID=CP.CUSTOMERID ") - .append("WHERE ") - .append("O.CUSTOMERTYPE=:CUSTOMERTYPE ") - .append("AND CT.CUSTTYPE='cust_type.cust' AND CT.STATUS='valid' "); - bf.append(sOtherWhere).append(" ORDER BY O.INPUTTIME DESC"); - String sSql = bf.toString(); - tx.join(bom); - - BizObjectQuery boq = bom.createQuery(sSql).setParameter( - "CUSTOMERTYPE", custType); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bos; - } - - public BizObject getCustomerById(JBOTransaction tx, String sCustomerId) { - BizObject bo = null; - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_INFO.className); - BizObjectQuery boq = bom.createQuery("O.CUSTOMERID=:CUSTOMERID") - .setParameter("CUSTOMERID", sCustomerId); - bo = boq.getSingleResult(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bo; - } - - @SuppressWarnings("unchecked") - public List getCustomerBindingTelByCustomerId(JBOTransaction tx, - String sCustomerId) { - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_TEL.className); - BizObjectQuery boq = bom.createQuery("O.CUSTOMERID=:CUSTOMERID") - .setParameter("CUSTOMERID", sCustomerId); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - // TODO Auto-generated method stub - return bos; - } - - @SuppressWarnings("unchecked") - public List getCustomerBindingAddressByCustomerId( - JBOTransaction tx, String sCustomerId) { - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_ADDRESS.className); - BizObjectQuery boq = bom.createQuery("O.CUSTOMERID=:CUSTOMERID") - .setParameter("CUSTOMERID", sCustomerId); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - // TODO Auto-generated method stub - return bos; - } - - @SuppressWarnings("unchecked") - public List getCustomerBindingCertByCustomerId( - JBOTransaction tx, String sCustomerId) { - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_CERT.className); - BizObjectQuery boq = bom.createQuery("O.CUSTOMERID=:CUSTOMERID") - .setParameter("CUSTOMERID", sCustomerId); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - // TODO Auto-generated method stub - return bos; - } - - @SuppressWarnings("unchecked") - public List getCustomerBindingAccountByCustomerId( - JBOTransaction tx, String sCustomerId) { - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_ACCOUNT.className); - BizObjectQuery boq = bom.createQuery("O.CUSTOMERID=:CUSTOMERID") - .setParameter("CUSTOMERID", sCustomerId); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - // TODO Auto-generated method stub - return bos; - } - - @Override - public BizObject getCompanyById(JBOTransaction tx, String sCustomerId) { - BizObject bo = null; - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TALBE_CUSTOMER_COMPANY.className); - BizObjectQuery boq = bom.createQuery("O.CUSTOMERID=:CUSTOMERID") - .setParameter("CUSTOMERID", sCustomerId); - bo = boq.getSingleResult(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bo; - } - - @Override - public BizObject getPersonById(JBOTransaction tx, String sCustomerId) { - BizObject bo = null; - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TALBE_CUSTOMER_PERSON.className); - BizObjectQuery boq = bom.createQuery("O.CUSTOMERID=:CUSTOMERID") - .setParameter("CUSTOMERID", sCustomerId); - bo = boq.getSingleResult(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bo; - } - - @Override - public BizObject getTypeById(JBOTransaction tx, String sCustomerId) { - BizObject bo = null; - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_TYPE.className); - BizObjectQuery boq = bom.createQuery("O.CUSTOMERID=:CUSTOMERID") - .setParameter("CUSTOMERID", sCustomerId); - bo = boq.getSingleResult(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bo; - } - - @SuppressWarnings("unchecked") - @Override - public List getCustomerVisitRecordListByCustomerId( - JBOTransaction tx, String sCustomerId) { - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_VISIT_RECORD.className); - BizObjectQuery boq = bom.createQuery("O.CUSTOMERID=:CUSTOMERID ORDER BY contactdate desc") - .setParameter("CUSTOMERID", sCustomerId); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - // TODO Auto-generated method stub - return bos; - } - - @SuppressWarnings("unchecked") - @Override - public List getCustomerHistoryRecordByCustomerId( - JBOTransaction tx, String sCustomerId) { - List bos = new ArrayList(); - String sSql = "SELECT " - + "O.ID,O.CONTRACT_NUMBER,lcc.PAYMENT_NUMBER,lcc.CLEAN_LEASE_MONEY,O.PROJECT_MANAGE," - + "O.PROJECT_DEPT " - + "FROM O,jbo.app.tenwa.calc.LC_CALC_CONDITION lcc," - + "jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT lgu," - + "jbo.com.tenwa.lease.comm.LB_UNION_LESSEE lul " - + "WHERE O.id=lcc.contract_id and lgu.contract_id=O.id " - + "and lul.contract_id=O.id " - + "and (lul.customer_id=:customer_id or lgu.ASSUROR=:customer_id)"; - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO"); - BizObjectQuery boq = bom.createQuery(sSql) - .setParameter("customer_id", sCustomerId); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - // TODO Auto-generated method stub - return bos; - } - - @SuppressWarnings("unchecked") - @Override - public List getCustomerVisitFileListByRelaid(JBOTransaction tx, - String sRelaid) { - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); - BizObjectQuery boq = bom.createQuery("SELECT " - + "O.ID , O.FILENAME, O.FILESIZE, O.FILEPATH, O.FULLPATH, O.FILESIZE, O.CONTENT_TYPE, O.REMARK, O.LIBRARY_ID " - + "FROM O right join jbo.app.tenwa.doc.LB_DOCLIBRARY lib on o.library_id=lib.id WHERE lib.relative_id=:relaid") - .setParameter("relaid", sRelaid); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - // TODO Auto-generated method stub - return bos; - } - -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/impl/FlowInfoJboImpl.java b/src_app/apx/com/amarsoft/als/base/jbo/impl/FlowInfoJboImpl.java deleted file mode 100644 index 388d3068b..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/impl/FlowInfoJboImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -package apx.com.amarsoft.als.base.jbo.impl; - -import java.util.ArrayList; -import java.util.List; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; - -import apx.com.amarsoft.als.base.jbo.FlowInfoJbo; - -public class FlowInfoJboImpl implements FlowInfoJbo { - // 日志对象 - private static Log logger = ARE.getLog(); - - @SuppressWarnings("unchecked") - @Override - public List findAllAppFlow(JBOTransaction tx, String sWhere) { - List bos1 = new ArrayList(); - try { - BizObjectManager bom1 = JBOFactory - .getBizObjectManager("jbo.app.APP_FLOW_SHOW"); - tx.join(bom1); - BizObjectQuery boq1 = bom1.createQuery("1=1 AND FLOW_NO IN ("+sWhere+") ORDER BY POSITION"); - bos1 = boq1.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bos1; - } - - @SuppressWarnings("unchecked") - public List findAllAppFlow(JBOTransaction tx) { - List bos1 = new ArrayList(); - try { - BizObjectManager bom1 = JBOFactory - .getBizObjectManager("jbo.app.APP_FLOW_SHOW"); - tx.join(bom1); - BizObjectQuery boq1 = bom1.createQuery("1=1 ORDER BY POSITION"); - bos1 = boq1.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bos1; - } - - public BizObject findFlowCatalogByFlowNo(JBOTransaction tx, String sFlowNo) { - BizObject bo = null; - try { - BizObjectManager bom1 = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_CATALOG"); - tx.join(bom1); - BizObjectQuery boq1 = bom1.createQuery("FLOWNO=:FLOWNO"); - bo = boq1.setParameter("FLOWNO", sFlowNo).getSingleResult(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bo; - } - - @SuppressWarnings("unchecked") - @Override - public List findAllAppFlowNo(JBOTransaction tx, String sUserId) { - List bos1 = new ArrayList(); - try { - BizObjectManager bom1 = JBOFactory - .getBizObjectManager("jbo.app.role_flow"); - tx.join(bom1); - BizObjectQuery boq1 = bom1.createQuery("SELECT O.flowname " - + "FROM O, jbo.sys.USER_ROLE USER_ROLE WHERE O.roleid = USER_ROLE.ROLEID AND USER_ROLE.USERID=:USERID"); - bos1 = boq1.setParameter("USERID", sUserId).getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bos1; - } -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/impl/FlowObjectJboImpl.java b/src_app/apx/com/amarsoft/als/base/jbo/impl/FlowObjectJboImpl.java deleted file mode 100644 index fb2eb9145..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/impl/FlowObjectJboImpl.java +++ /dev/null @@ -1,278 +0,0 @@ -package apx.com.amarsoft.als.base.jbo.impl; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import apx.com.amarsoft.als.base.jbo.FlowObjectJbo; -import apx.com.amarsoft.als.base.util.DateUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; - -public class FlowObjectJboImpl implements FlowObjectJbo { - // 日志对象 - private static Log logger = ARE.getLog(); - - @SuppressWarnings("unchecked") - public List getAppCommissionList(JBOTransaction tx, - String sUser, String sFlowNos, String sLimit) { - sLimit = ""; - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_TASK"); - tx.join(bom); - String sSql = "SELECT " - + "O.SERIALNO,O.OBJECTNO,O.OBJECTTYPE,O.RELATIVESERIALNO,O.FLOWNO," - + "O.PHASENO,O.PHASETYPE,O.APPLYTYPE,O.USERID,O.USERNAME,O.ORGID,O.ORGNAME," - + "FLOW_BUSSINESS_OBJECT.flow_unid,FLOW_BUSSINESS_OBJECT.proj_id,FLOW_BUSSINESS_OBJECT.contract_id," - + "FLOW_BUSSINESS_OBJECT.flow_key,FLOW_BUSSINESS_OBJECT.proj_name," - + "O.FLOWNAME,O.PHASENAME,O.BEGINTIME," - + "FLOW_BUSSINESS_OBJECT.InputTime," - + "O.ENDTIME,O.FLOWSTATE,O.AGENTUSERNAME,O.ASSIGNSUBMITTYPE,O.ASSIGNFINISH,O.AGENTUSERID," - + "FLOW_MODEL.ATTRIBUTE1,FLOW_MODEL.ATTRIBUTE7,FLOW_MODEL.OPINIONSREQUIRED " - + "FROM O," - + "jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT FLOW_BUSSINESS_OBJECT," - + "jbo.sys.FLOW_MODEL FLOW_MODEL " - + "WHERE O.OBJECTNO=FLOW_BUSSINESS_OBJECT.flow_unid " - + "AND(O.endtime IS NULL OR O.endtime='') " - + "AND O.flowstate<>'START' " - + "AND( O.userid='" - + sUser - + "' or (O.agentuserid='" - + sUser - + "' and O.assignfinish='0') " - + "OR EXISTS( SELECT * FROM jbo.sys.FLOW_ENTRUSTED_USER tu WHERE O.userid=tu.SourceUser and tu.endtime>='" + DateUtil - .getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss") + "' " - + "AND tu.isVaild='0' AND (( tu.NewUser='" + sUser - + "' and v.length(tu.flowno)=0) or(tu.NewUser='" + sUser - + "' and tu.flowno=O.flowno))))" - + "AND FLOW_MODEL.FLOWNO=O.FLOWNO " - + "AND FLOW_MODEL.PHASENO=O.PHASENO " + "AND O.FLOWNO IN (" - + sFlowNos + ")" + "ORDER BY O.BEGINTIME desc " + sLimit; - BizObjectQuery boq = bom.createQuery(sSql); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bos; - } - - @SuppressWarnings("unchecked") - public List getCommissionList(JBOTransaction tx, String sUser) { - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_TASK"); - tx.join(bom); - // 2017/08/29 10:29:09 - BizObjectQuery boq = bom - .createQuery("SELECT " - + "O.SERIALNO,O.OBJECTNO,O.OBJECTTYPE,O.RELATIVESERIALNO,O.FLOWNO," - + "O.PHASENO,O.PHASETYPE,O.APPLYTYPE,O.USERID,O.USERNAME,O.ORGID,O.ORGNAME," - + "FLOW_BUSSINESS_OBJECT.flow_unid,FLOW_BUSSINESS_OBJECT.proj_id,FLOW_BUSSINESS_OBJECT.contract_id," - + "FLOW_BUSSINESS_OBJECT.flow_key,FLOW_BUSSINESS_OBJECT.proj_name," - + "O.FLOWNAME,O.PHASENAME,O.BEGINTIME," - + "FLOW_BUSSINESS_OBJECT.InputTime," - + "O.ENDTIME,O.FLOWSTATE,O.AGENTUSERNAME,O.ASSIGNSUBMITTYPE,O.ASSIGNFINISH,O.AGENTUSERID," - + "FLOW_MODEL.ATTRIBUTE1,FLOW_MODEL.ATTRIBUTE7,FLOW_MODEL.OPINIONSREQUIRED " - + "FROM O," - + "jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT FLOW_BUSSINESS_OBJECT," - + "jbo.sys.FLOW_MODEL FLOW_MODEL " - + "WHERE O.OBJECTNO=FLOW_BUSSINESS_OBJECT.flow_unid " - + "AND(O.endtime IS NULL OR O.endtime='') " - + "AND O.flowstate<>'START' " - + "AND( O.userid='" - + sUser - + "' or (O.agentuserid='" - + sUser - + "' and O.assignfinish='0') " - + "OR EXISTS( SELECT * FROM jbo.sys.FLOW_ENTRUSTED_USER tu WHERE O.userid=tu.SourceUser and tu.endtime>='" + DateUtil - .getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss") + "' " - - + "AND tu.isVaild='0' AND (( tu.NewUser='" + sUser - + "' and v.length(tu.flowno)=0) or(tu.NewUser='" - + sUser + "' and tu.flowno=O.flowno))))" - + "AND FLOW_MODEL.FLOWNO=O.FLOWNO " - + "AND FLOW_MODEL.PHASENO=O.PHASENO " - + "ORDER BY O.BEGINTIME desc"); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bos; - } - - @SuppressWarnings("unchecked") - public List getDoneList(JBOTransaction tx, String sUser, - String sFlowNos, String sLimit) { - sLimit = ""; - List bos = new ArrayList(); - String sql = "SELECT " - + "O.SERIALNO,O.OBJECTNO,O.OBJECTTYPE,O.RELATIVESERIALNO,O.FLOWNO,O.PHASENO,O.PHASETYPE," - + "O.APPLYTYPE,O.USERID,O.USERNAME,O.ORGID,O.ORGNAME,FLOW_BUSSINESS_OBJECT.flow_unid," - + "FLOW_BUSSINESS_OBJECT.proj_id,FLOW_BUSSINESS_OBJECT.contract_id,FLOW_BUSSINESS_OBJECT.flow_key,FLOW_BUSSINESS_OBJECT.proj_name," - + "O.FLOWNAME,O.PHASENAME,O.BEGINTIME," - + "FLOW_BUSSINESS_OBJECT.InputTime," - + "O.ENDTIME,O.AGENTUSERID,O.AGENTUSERNAME,O.ASSIGNSUBMITTYPE,O.ASSIGNFINISH," - + "FLOW_MODEL.ATTRIBUTE1,FLOW_MODEL.ATTRIBUTE7,FLOW_MODEL.OPINIONSREQUIRED " - + "FROM O,jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT FLOW_BUSSINESS_OBJECT, jbo.sys.FLOW_MODEL FLOW_MODEL " - + "WHERE O.OBJECTNO=FLOW_BUSSINESS_OBJECT.flow_unid " - + "AND FLOW_MODEL.FLOWNO=O.FLOWNO " - + "AND FLOW_MODEL.PHASENO=O.PHASENO " - + "AND ((O.endtime is not null and O.UserID='" + sUser - + "') or ( O.agentUserID='" + sUser - + "' and O.assignfinish='1' )) " + "AND O.FLOWNO IN (" - + sFlowNos + ")" + "ORDER BY O.ENDTIME desc " + sLimit; - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_TASK"); - tx.join(bom); - BizObjectQuery boq = bom.createQuery(sql); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bos; - } - - @SuppressWarnings("unchecked") - public List getDoneList(JBOTransaction tx, String sUser) { - List bos = new ArrayList(); - String sql = "SELECT " - + "O.SERIALNO,O.OBJECTNO,O.OBJECTTYPE,O.RELATIVESERIALNO,O.FLOWNO,O.PHASENO,O.PHASETYPE," - + "O.APPLYTYPE,O.USERID,O.USERNAME,O.ORGID,O.ORGNAME,FLOW_BUSSINESS_OBJECT.flow_unid," - + "FLOW_BUSSINESS_OBJECT.proj_id,FLOW_BUSSINESS_OBJECT.contract_id,FLOW_BUSSINESS_OBJECT.flow_key,FLOW_BUSSINESS_OBJECT.proj_name," - + "O.FLOWNAME,O.PHASENAME,O.BEGINTIME," - + "FLOW_BUSSINESS_OBJECT.InputTime," - + "O.ENDTIME,O.AGENTUSERID,O.AGENTUSERNAME,O.ASSIGNSUBMITTYPE,O.ASSIGNFINISH," - + "FLOW_MODEL.ATTRIBUTE1,FLOW_MODEL.ATTRIBUTE7,FLOW_MODEL.OPINIONSREQUIRED " - + "FROM O,jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT FLOW_BUSSINESS_OBJECT, jbo.sys.FLOW_MODEL FLOW_MODEL " - + "WHERE O.OBJECTNO=FLOW_BUSSINESS_OBJECT.flow_unid " - + "AND FLOW_MODEL.FLOWNO=O.FLOWNO " - + "AND FLOW_MODEL.PHASENO=O.PHASENO " - + "AND ((O.endtime is not null and O.UserID='" + sUser - + "') or ( O.agentUserID='" + sUser - + "' and O.assignfinish='1' )) " + "ORDER BY O.ENDTIME desc"; - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_TASK"); - tx.join(bom); - BizObjectQuery boq = bom.createQuery(sql); - bos = boq.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bos; - } - - @SuppressWarnings("unchecked") - public List getFlowTask(JBOTransaction tx, String sObjectNo, - String sObjectType, String sPhaseNo) { - List bos = new ArrayList(); - String sSql = " select O.serialno,O.FlowNo,O.PhaseNo,O.PhaseName,O.UserName,O.OrgName,O.PhaseAction,O.BeginTime, " - + " O.EndTime,O.PhaseChoice,FO.PhaseOpinion,FO.PhaseOpinion1,FO.PhaseOpinion2,FO.PhaseOpinion3, " - + " FM.Attribute3 as v.OpinionRightType,FM.Attribute4 as v.OpinionRightPhases,FM.Attribute5 as v.OpinionRightRoles " - + " ,v.getUserName(fo.inputuser) as v.optionUser,v.getOrgName(fo.inputorg) as v.optionOrg,fo.inputtime " - + "from O,jbo.sys.FLOW_OPINION FO,jbo.sys.FLOW_MODEL FM " - + " where O.Serialno=FO.SerialNo and O.FlowNo=FM.FlowNo and O.PhaseNo=FM.PhaseNo " - + " and (FO.PhaseOpinion is not null) and O.ObjectNo=:ObjectNo and O.ObjectType=:ObjectType "; - if (sPhaseNo.equals("")) { - sSql += " ORDER BY O.BeginTime desc, O.SerialNo "; - } else { - sSql += " and O.PhaseNo <> :PhaseNo ORDER BY O.BeginTime desc,O.SerialNo"; - } - try { - BizObjectManager bom1 = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_TASK"); - tx.join(bom1); - bos = bom1.createQuery(sSql).setParameter("ObjectNo", sObjectNo) - .setParameter("ObjectType", sObjectType) - .setParameter("PhaseNo", sPhaseNo).getResultList(false); - } catch (JBOException e) { - logger.error(e); - e.printStackTrace(); - } - return bos; - } - - public BizObject getFlowModel(JBOTransaction tx, String sFlowNo, - String sPhaseNo) { - BizObject bo = null; - try { - BizObjectManager bom1 = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_MODEL"); - tx.join(bom1); - BizObjectQuery boq1 = bom1 - .createQuery("FlowNo =:FlowNo and PhaseNo =:PhaseNo"); - bo = boq1.setParameter("FlowNo", sFlowNo) - .setParameter("PhaseNo", sPhaseNo).getSingleResult(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bo; - } - - public BizObject getFlowTask(JBOTransaction tx, String sUserId, - String sObjectNo, String sObjectType, String sFlowNo, - String sPhaseNo) { - BizObject bo = null; - String sSql = " select FO.PhaseOpinion,O.PhaseName,O.UserName, O.OrgName,O.BeginTime,O.EndTime " - + " from O,jbo.sys.FLOW_OPINION FO " - + " where O.Serialno=FO.SerialNo " - + " and (FO.PhaseOpinion is not null) and FO.InputUser =:InputUser " - + " and O.ObjectNo=:ObjectNo and O.ObjectType=:ObjectType" - + " and O.FlowNo =:FlowNo and O.PhaseNo=:PhaseNo order by O.BeginTime desc "; - try { - BizObjectManager bom1 = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_TASK"); - tx.join(bom1); - bo = bom1.createQuery(sSql).setParameter("InputUser", sUserId) - .setParameter("ObjectNo", sObjectNo) - .setParameter("ObjectType", sObjectType) - .setParameter("FlowNo", sFlowNo) - .setParameter("PhaseNo", sPhaseNo).getSingleResult(false); - } catch (JBOException e) { - logger.error(e); - e.printStackTrace(); - } - return bo; - } - - @Override - public BizObject getFlowOpinion(JBOTransaction tx, String sSerialNo, - String sUserId) { - BizObject bo = null; - try { - BizObjectManager bom1 = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_OPINION"); - tx.join(bom1); - bo = bom1.createQuery("SerialNo=:SerialNo and OpinionNo=:OpinionNo").setParameter("SerialNo", sSerialNo) - .setParameter("OpinionNo", sUserId).getSingleResult(false); - } catch (JBOException e) { - logger.error(e); - e.printStackTrace(); - } - return bo; - } - -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/impl/LBDocLibraryServiceImpl.java b/src_app/apx/com/amarsoft/als/base/jbo/impl/LBDocLibraryServiceImpl.java deleted file mode 100644 index 3288623ad..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/impl/LBDocLibraryServiceImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -package apx.com.amarsoft.als.base.jbo.impl; - -import java.util.ArrayList; -import java.util.List; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; - -import apx.com.amarsoft.als.base.jbo.LBDocLibraryService; - -public class LBDocLibraryServiceImpl implements LBDocLibraryService { - // 日志对象 - private static Log logger = ARE.getLog(); - - @SuppressWarnings("unchecked") - @Override - public List findDocList(JBOTransaction tx, String sql) { - List bos1 = new ArrayList(); - try { - BizObjectManager bom1 = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); - tx.join(bom1); - BizObjectQuery boq1 = bom1.createQuery(sql); - bos1 = boq1.getResultList(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bos1; - } - -} diff --git a/src_app/apx/com/amarsoft/als/base/jbo/impl/UserInfoJboImpl.java b/src_app/apx/com/amarsoft/als/base/jbo/impl/UserInfoJboImpl.java deleted file mode 100644 index 17bae51ab..000000000 --- a/src_app/apx/com/amarsoft/als/base/jbo/impl/UserInfoJboImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -package apx.com.amarsoft.als.base.jbo.impl; - -import java.util.ArrayList; -import java.util.List; - -import apx.com.amarsoft.als.base.jbo.UserInfoJbo; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; - -public class UserInfoJboImpl implements UserInfoJbo { - // 日志对象 - private static Log logger = ARE.getLog(); - - public BizObject findUserByUserId(JBOTransaction tx, String id) { - BizObject bo = null; - try { - BizObjectManager bm = JBOFactory.getFactory().getManager( - "jbo.sys.USER_INFO"); - tx.join(bm); - bo = bm.createQuery("USERID=:USERID").setParameter("USERID", id) - .getSingleResult(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bo; - } - - public BizObject findUserByLoginName(JBOTransaction tx, String loginName) { - BizObject bo = null; - try { - BizObjectManager bm = JBOFactory.getFactory().getManager( - "jbo.sys.USER_INFO"); - tx.join(bm); - bo = bm.createQuery("LOGINID=:LOGINID") - .setParameter("LOGINID", loginName).getSingleResult(false); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - return bo; - } - - public void updateUserByUserId(JBOTransaction tx, String condition, - String userId) { - try { - BizObjectManager bomcr = JBOFactory - .getBizObjectManager("jbo.sys.USER_INFO"); - tx.join(bomcr); - bomcr.createQuery(condition).setParameter("USERID", userId) - .executeUpdate(); - } catch (JBOException e) { - logger.error(e); - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - @SuppressWarnings("unchecked") - public List findAppFlowRoleByUserId(JBOTransaction tx, - String userId) { - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.app.role_flow"); - tx.join(bom); - BizObjectQuery boq = bom - .createQuery("SELECT O.flowname FROM O, jbo.sys.USER_ROLE U WHERE O.roleid=U.ROLEID AND U.USERID=:USERID"); - bos = boq.setParameter("USERID", userId).getResultList(false); - } catch (JBOException e) { - // TODO Auto-generated catch block - logger.error(e); - e.printStackTrace(); - } - - return bos; - } - - @SuppressWarnings("unchecked") - public List findRoleByUserId(JBOTransaction tx, String sUserId) { - List bos = new ArrayList(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.sys.USER_ROLE"); - tx.join(bom); - BizObjectQuery boq = bom - .createQuery("USERID=:USERID"); - bos = boq.setParameter("USERID", sUserId).getResultList(false); - } catch (JBOException e) { - // TODO Auto-generated catch block - logger.error(e); - e.printStackTrace(); - } - - return bos; - } -} diff --git a/src_app/apx/com/amarsoft/als/base/model/TokenSessionObject.java b/src_app/apx/com/amarsoft/als/base/model/TokenSessionObject.java deleted file mode 100644 index c440494cc..000000000 --- a/src_app/apx/com/amarsoft/als/base/model/TokenSessionObject.java +++ /dev/null @@ -1,29 +0,0 @@ -package apx.com.amarsoft.als.base.model; - -import javax.servlet.http.HttpServletRequest; - -import cn.coyoteam.aweresf.consts.SessionConst; -import cn.coyoteam.aweresf.web.als.TokenSession; -import cn.coyoteam.aweresf.web.als.TokenSessionManager; -import cn.coyoteam.aweresf.web.als.TokenSessionManagerFactory; - -import com.amarsoft.awe.util.Transaction; - -public class TokenSessionObject { - private TokenSession tokenSession; - private TokenSessionManager tokenSessionManager; - public TokenSession getTokenSession() { - return tokenSession; - } - public TokenSessionManager getTokenSessionManager() { - return tokenSessionManager; - } - public void setTokenSession(HttpServletRequest request) { - this.tokenSession = (TokenSession) request.getSession().getAttribute( - SessionConst.KEY_TOKEN_SESSION); - } - public void setTokenSessionManager(Transaction sqlca) { - this.tokenSessionManager = TokenSessionManagerFactory - .getALSTokenSessionManager(sqlca); - } -} diff --git a/src_app/apx/com/amarsoft/als/base/service/FundTokenSessionInfoService.java b/src_app/apx/com/amarsoft/als/base/service/FundTokenSessionInfoService.java deleted file mode 100644 index 3ea4da0b2..000000000 --- a/src_app/apx/com/amarsoft/als/base/service/FundTokenSessionInfoService.java +++ /dev/null @@ -1,15 +0,0 @@ -package apx.com.amarsoft.als.base.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.awe.util.Transaction; - -public interface FundTokenSessionInfoService { - Map fundTokenSessionInfo(String token, - HttpServletRequest request, Transaction sqlca); - - Map fundToken(HttpServletRequest request, Transaction sqlca); - Map fundSessionUser(HttpServletRequest request, Transaction sqlca); -} diff --git a/src_app/apx/com/amarsoft/als/base/service/impl/FundTokenSessionInfoServiceImpl.java b/src_app/apx/com/amarsoft/als/base/service/impl/FundTokenSessionInfoServiceImpl.java deleted file mode 100644 index b0aace9bb..000000000 --- a/src_app/apx/com/amarsoft/als/base/service/impl/FundTokenSessionInfoServiceImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -package apx.com.amarsoft.als.base.service.impl; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import apx.com.amarsoft.als.base.service.FundTokenSessionInfoService; -import cn.coyoteam.aweresf.consts.SessionConst; -import cn.coyoteam.aweresf.web.als.TokenSession; -import cn.coyoteam.aweresf.web.als.TokenSessionManagerFactory; - -import com.amarsoft.aims.util.StringHelper; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class FundTokenSessionInfoServiceImpl implements - FundTokenSessionInfoService { - - @Override - public Map fundTokenSessionInfo(String token, - HttpServletRequest request, Transaction sqlca) { - Map body = new HashMap(); - TokenSession tokenSession = (TokenSession) request.getSession() - .getAttribute(SessionConst.KEY_TOKEN_SESSION); - if (tokenSession == null) { - tokenSession = TokenSessionManagerFactory - .getALSTokenSessionManager(sqlca).getTokenSession(token); - } - body.put("tokenSession", tokenSession); - return body; - } - - @Override - public Map fundToken(HttpServletRequest request, - Transaction sqlca) { - Map body = new HashMap(); - String token = StringHelper.nvl( - request.getHeader(SessionConst.KEY_TOKEN), ""); - if (token.length() == 0) - token = StringHelper.nvl( - request.getParameter(SessionConst.KEY_TOKEN), ""); - body.put("token", token); - return body; - } - - @Override - public Map fundSessionUser(HttpServletRequest request, - Transaction sqlca) { - Map body = new HashMap(); -// RuntimeContext CurARC = new RuntimeContext(); - ASUser CurARC = (ASUser) request.getSession().getAttribute("ASUser"); - body.put("CurARC", CurARC); - return body; - } - -} diff --git a/src_app/apx/com/amarsoft/als/base/util/AweDoUtil.java b/src_app/apx/com/amarsoft/als/base/util/AweDoUtil.java deleted file mode 100644 index de074ace1..000000000 --- a/src_app/apx/com/amarsoft/als/base/util/AweDoUtil.java +++ /dev/null @@ -1,429 +0,0 @@ -package apx.com.amarsoft.als.base.util; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.StringUtils; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; - -public class AweDoUtil { - - public static void main(String[] args) { - String sJboWhere1 = "select 1 from jbo.app.tenwa.doc.LB_DOCATTRIBUTE attr where lib.id=attr.library_id"; - while (sJboWhere1.indexOf("jbo.") != -1) { -// select 1 from jbo.app.tenwa.doc.LB_DOCATTRIBUTE attr where lib.id=attr.library_id -// str1=str1.substring(str1.indexOf(str2)+str2.length()); - String str = sJboWhere1; - str = str.substring(str.indexOf("jbo.")); - str = str.substring(0, str.indexOf(" ")); - String [] arr2 = str.split("\\."); - sJboWhere1 = sJboWhere1.replace(str, arr2[arr2.length - 1]); - } - System.out.println(sJboWhere1); - } - private static Log logger = ARE.getLog(); - private String sJboClass; - private String sJboFrom; - private String sJboWhere; - /** - * 普通 模板查询 - * @param dono - * @param sqlca - * @param otherWhere - * @param orderby - * @return - * @throws Exception - */ - public Map getTemplateInfo(String dono, Transaction sqlca, String otherWhere) throws Exception { - return getTemplateInfo(dono, sqlca, otherWhere, null); - } - public Map getTemplateInfo(String dono, Transaction sqlca, String otherWhere, Map params1) throws Exception { - Map body = new HashMap(); - String sql = "SELECT O.JBOCLASS, O.JBOFROM, O.JBOWHERE FROM O WHERE DONO=:DONO"; - logger.info("获取模板主表 子表 条件信息 sql:{" + sql + "}{DONO=" +dono + "}"); - BizObjectManager bm = JBOFactory.getBizObjectManager("jbo.awe.AWE_DO_CATALOG"); - BizObject bo = bm.createQuery(sql).setParameter("DONO", dono).getSingleResult(false); - if (bo == null) { - body.put("error_message", "没有设置附件列表模板"); - return body; - } - this.sJboClass = bo.getAttribute("JBOCLASS") == null ? "" : bo.getAttribute("JBOCLASS").toString().trim(); - this.sJboFrom = bo.getAttribute("JBOFROM") == null ? "" : bo.getAttribute("JBOFROM").toString().trim(); - this.sJboWhere = bo.getAttribute("JBOWHERE") == null ? "" : bo.getAttribute("JBOWHERE").toString().trim(); - - sql = ""; - sql = "SELECT " - + "COLINDEX, SORTNO, COLACTUALNAME, COLNAME, COLTABLENAME, COLHEADER," - + " COLEDITSTYLE, COLEDITSOURCETYPE,COLEDITSOURCE, COLVISIBLE, COLREADONLY, COLREQUIRED " - + "FROM " - + "AWE_DO_LIBRARY " - + "WHERE " - + "DONO=:DONO " - + "ORDER BY " - + "SORTNO "; - sql = sql.toUpperCase(); - logger.info("获取模板模板字段信息 sql:{" + sql + "}{DONO=" +dono + "}"); - ASResultSet rs = null; - SqlObject sqlObject = new SqlObject(sql).setParameter("DONO", dono); - rs = sqlca.getResultSet(sqlObject); - List> list = new ArrayList>(); - String queryCol = ""; - while (rs.next()) { - if ("inputuserid".equals(rs.getString("COLNAME").toLowerCase()) - || "inputusername".equals(rs.getString("COLNAME").toLowerCase()) - || "inputuserorgid".equals(rs.getString("COLNAME").toLowerCase()) - || "inputuserorgname".equals(rs.getString("COLNAME").toLowerCase()) - || "updateuserid".equals(rs.getString("COLNAME").toLowerCase()) - || "updateusername".equals(rs.getString("COLNAME").toLowerCase()) - || "updateuserorgid".equals(rs.getString("COLNAME").toLowerCase()) - || "updateuserorgname".equals(rs.getString("COLNAME").toLowerCase())) { - continue; - } - if ("v.''".equals(rs.getString("COLACTUALNAME")) - || "''".equals(rs.getString("COLACTUALNAME"))) { - continue; - } - Map map = new HashMap(); - if (!"".equals(rs.getString("COLTABLENAME"))) { - queryCol += rs.getString("COLTABLENAME") + "." + rs.getString("COLACTUALNAME") + " as " + rs.getString("COLNAME") + ","; - map.put("sql_pro", "1"); - } else { - if (rs.getString("COLACTUALNAME").startsWith("NameManager")) { - queryCol += (rs.getString("COLACTUALNAME").replace("NameManager.", "")) + " as " + rs.getString("COLNAME") + ","; - map.put("sql_pro", "1"); - } else if (rs.getString("COLACTUALNAME").startsWith("CodeManager")) { - queryCol += (rs.getString("COLACTUALNAME").replace("CodeManager.", "")) + " as " + rs.getString("COLNAME") + ","; - map.put("sql_pro", "1"); - } else { - map.put("sql_pro", "0"); - } - } - map.put("col_index", rs.getString("COLINDEX")); - map.put("col_sortno", rs.getString("SORTNO")); - map.put("col_code", rs.getString("COLNAME")); - map.put("col_header", rs.getString("COLHEADER")); - map.put("col_actual", rs.getString("COLACTUALNAME")); - map.put("col_visible", rs.getString("COLVISIBLE")); - map.put("col_readonly", rs.getString("COLREADONLY")); - map.put("col_required", rs.getString("COLREQUIRED")); - map.put("col_style", rs.getString("COLEDITSTYLE")); - map.put("col_source_type", rs.getString("COLEDITSOURCETYPE")); - map.put("col_source", rs.getString("COLEDITSOURCE")); - list.add(map); - } - queryCol = queryCol.substring(0, queryCol.length() - 1); - String queryFrom = ""; - String sFrom = this.sJboFrom.toUpperCase(); - if (this.sJboFrom.indexOf(",") != -1) { - String [] arr = this.sJboFrom.split(","); - for (String str : arr) { - str = str.trim(); - if (queryFrom.length() > 0) { - queryFrom += ","; - } - if (str.equalsIgnoreCase("o")) { - String [] arr2 = this.sJboClass.split("\\."); - queryFrom += arr2[arr2.length - 1] + " " + str; - } else { - String [] arr2 = str.trim().split(" "); - String [] arr3 = arr2[0].split("\\."); - queryFrom += arr3[arr3.length - 1] + " " + arr2[1]; - } - } - } else if (sFrom.indexOf(" JOIN ") != -1 ) { - if (sFrom.startsWith("O ") ) { - String [] arr2 = this.sJboClass.split("\\."); - queryFrom = arr2[arr2.length - 1] ; -// queryFrom += " O "; - String [] att3 = this.sJboFrom.split("join "); - for (String str3 : att3) { - if (str3.indexOf("jbo.") != -1) { - str3 = str3.substring(0, str3.indexOf(" ")); - String [] arr4 = str3.split("\\."); - this.sJboFrom = this.sJboFrom.replace(str3, arr4[arr4.length - 1]); - } - } - queryFrom += " " + this.sJboFrom; - } - - - - } else { - String [] arr2 = this.sJboClass.split("\\."); - queryFrom = arr2[arr2.length - 1] ; - queryFrom += " O "; - } - String[] sArr = this.sJboWhere.split("ORDER BY"); - String order = ""; - String where = ""; - if (sArr.length > 1) { - where = sArr[0]; - order = sArr[1]; - } else { - where = this.sJboWhere; - } - while (where.indexOf("jbo.") != -1) { - String str = this.sJboWhere; - str = str.substring(str.indexOf("jbo.")); - str = str.substring(0, str.indexOf(" ")); - String [] arr2 = str.split("\\."); - where = where.replace(str, arr2[arr2.length - 1]); - } - if (params1 != null) { - while (where.indexOf(":") != -1) { - String str = where; - str = str.substring(str.indexOf(":")); - str = str.substring(0, str.indexOf(" ")); - String str1 = str.substring(1, str.length()); - where = where.replace(str, params1.get(str1).toString()); - } - } - if (StringUtils.isNotBlank(order)) { - where = where + " ORDER BY " + order; - } - this.sJboWhere = where; - if (StringUtils.isNotBlank(otherWhere)) { - while (otherWhere.indexOf("jbo.") != -1) { - String str = otherWhere; - str = str.substring(str.indexOf("jbo.")); - str = str.substring(0, str.indexOf(" ")); - String [] arr2 = str.split("\\."); - otherWhere = otherWhere.replace(str, arr2[arr2.length - 1]); - } - } - - sql = "SELECT " + queryCol + " FROM " + queryFrom + " WHERE " + this.sJboWhere + " " + otherWhere; - sql = sql.toUpperCase(); - rs = null; - sqlObject = new SqlObject(sql); - rs = sqlca.getResultSet(sqlObject); - List> list2 = new ArrayList>(); - while (rs.next()) { - List> list3 = new ArrayList>(); - Map map2 = new HashMap(); - for (Map map : list) { - Map map3 = new HashMap(); - String sCode = map.get("col_code").toString().toUpperCase(); - if ("0".equals(map.get("sql_pro"))) continue; - logger.info("code:" + sCode + ", value:" + rs.getString(sCode)); - map3.put("value", rs.getString(sCode)); - map3.put("col_index", map.get("col_index")); - map3.put("col_sortno", map.get("col_sortno")); - map3.put("col_code", map.get("col_code")); - map3.put("col_header", map.get("col_header")); - map3.put("col_visible", map.get("col_visible")); - map3.put("sql_pro", map.get("sql_pro")); - map3.put("col_readonly", map.get("col_readonly")); - map3.put("col_required", map.get("col_required")); - map3.put("col_style", map.get("col_style")); - map3.put("col_source_type", map.get("col_source_type")); - map3.put("col_source", map.get("col_source")); - list3.add(map3); - } - - for (Map map : list) { - if ("0".equals(map.get("sql_pro"))) { - String actual = map.get("col_actual").toString(); - String params = actual.substring(actual.indexOf("(") + 1, - actual.indexOf(")")); - String[] paramArr = params.split(","); - String[] paramArr1 = new String[paramArr.length]; - int i = 0; - for (String str : paramArr) { - for (Map map3 : list3) { - if (map3.get("col_code").toString().trim() - .equalsIgnoreCase(str.trim())) { - paramArr1[i] = map3.get("value") == null ? "" - : map3.get("value").toString(); - i ++; - break; - } - } - } - String str1 = executeMethod(actual, paramArr1); - logger.info("json:" + str1); - Map map3 = new HashMap(); - map3.put("value", str1); - map3.put("col_index", map.get("col_index")); - map3.put("col_sortno", map.get("col_sortno")); - map3.put("col_code", map.get("col_code")); - map3.put("col_header", map.get("col_header")); - map3.put("col_visible", map.get("col_visible")); - map3.put("sql_pro", map.get("sql_pro")); - map3.put("col_readonly", map.get("col_readonly")); - map3.put("col_required", map.get("col_required")); - map3.put("col_style", map.get("col_style")); - map3.put("col_source_type", map.get("col_source_type")); - map3.put("col_source", map.get("col_source")); - list3.add(map3); - } - } - - map2.put("info", list3); - list2.add(map2); - } - body.put("data", list2); - return body; - } - - /** - * 分组模板查询 - */ - public void getGroupInfo(){ - - } - - /** - * 执行类方法查询 - * @param colactualname - * @param params - * @return - */ - public String executeMethod(String colactualname, String... params) { - String value = ""; - try { - String classpath = colactualname.substring(0, - colactualname.lastIndexOf(".")); - String methodName = colactualname.substring( - colactualname.lastIndexOf(".") + 1, - colactualname.indexOf("(")); - String paramsname = colactualname.substring( - colactualname.indexOf("(") + 1, colactualname.indexOf(")")); - String[] vParams = paramsname.split(","); - if (vParams.length != params.length) { - return null; - } - List Lparam = new ArrayList(); - for (String param : params) { - Lparam.add(param); - } - @SuppressWarnings("rawtypes") - Class classPathClass = Class.forName(classpath); - Object obj = classPathClass.newInstance(); - Method targetMethod = null; - Method[] cls = classPathClass.getDeclaredMethods(); - for (int j = 0; j < cls.length; j++) { - if (cls[j].getName().equalsIgnoreCase(methodName)) { - targetMethod = cls[j]; - } - } - value = (String) targetMethod.invoke(obj, Lparam.toArray()); - if (value == null) { - value = ""; - } - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | SecurityException - | IllegalArgumentException | InvocationTargetException e) { - logger.error("executeMethod" + e); - return null; - } - return value; - } - - /** - * 执行sql查询 - * @param sqlca - * @param sql - * @param cols - * @param pagetype - * @return - * @throws Exception - */ - public List> executeSql(Transaction sqlca, String sql, - List> cols, String pagetype) throws Exception { - // this.datas = new ArrayList>>(); - List> datas = new ArrayList>(); - ASResultSet rs = null; - SqlObject sqlObject = new SqlObject(sql); - rs = sqlca.getResultSet(sqlObject); - if (rs != null) { - rs.last(); - if (rs.getRow() == 0) { - Map data = new HashMap(); - List> columns = new ArrayList>(); - if (pagetype.equalsIgnoreCase("list")) { - return datas; - } else { - for (Map col : cols) { - Map column = new HashMap(); - if (col.get("isshow").toString().trim() - .equalsIgnoreCase("y")) { - column.put("isconvert", col.get("isconvert")); - column.put("islist", col.get("islist")); - column.put("isshow", col.get("isshow")); - column.put("code", col.get("datacode")); - column.put("display", col.get("dataname")); - column.put("dataposition", col.get("dataposition")); - column.put("colname", col.get("colname")); - column.put("value", ""); - column.put("coleditsource", col.get("coleditsource")); - columns.add(column); - } - } - data.put("data", columns); - datas.add(data); - } - } else { - rs.beforeFirst(); - } - while (rs.next()) { - Map data = new HashMap(); - List> columns = new ArrayList>(); - for (Map col : cols) { - Map column = new HashMap(); - column.put("isconvert", col.get("isconvert")); - column.put("islist", col.get("islist")); - column.put("isshow", col.get("isshow")); - column.put("code", col.get("datacode")); - column.put("display", col.get("dataname")); - column.put("dataposition", col.get("dataposition")); - column.put("coleditsource", col.get("coleditsource")); - column.put("colname", col.get("colname")); - if (pagetype.equals("list")) { - col.put("value", - rs.getString(col.get("colname").toString())); - } else { - col.put("value", - rs.getString(col.get("colname").toString())); - } - column.put("value", col.get("value")); - columns.add(column); - } - data.put("data", columns); - datas.add(data); - } - } else { - Map data = new HashMap(); - List> columns = new ArrayList>(); - for (Map col : cols) { - Map column = new HashMap(); - if (col.get("isshow").toString().trim().equalsIgnoreCase("y")) { - column.put("islist", col.get("islist")); - column.put("isshow", col.get("isshow")); - column.put("code", col.get("datacode")); - column.put("display", col.get("dataname")); - column.put("dataposition", col.get("dataposition")); - column.put("colname", col.get("colname")); - column.put("coleditsource", col.get("coleditsource")); - column.put("value", ""); - columns.add(column); - } - } - data.put("data", columns); - datas.add(data); - } - return datas; - } -} diff --git a/src_app/apx/com/amarsoft/als/base/util/CheckTokenSessionUtil.java b/src_app/apx/com/amarsoft/als/base/util/CheckTokenSessionUtil.java deleted file mode 100644 index 1a7eb1b07..000000000 --- a/src_app/apx/com/amarsoft/als/base/util/CheckTokenSessionUtil.java +++ /dev/null @@ -1,82 +0,0 @@ -package apx.com.amarsoft.als.base.util; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import apx.com.amarsoft.als.base.model.TokenSessionObject; -import apx.com.amarsoft.als.base.service.FundTokenSessionInfoService; -import apx.com.amarsoft.als.base.service.impl.FundTokenSessionInfoServiceImpl; -import cn.coyoteam.aweresf.web.als.TokenSession; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class CheckTokenSessionUtil { - private FundTokenSessionInfoService service = new FundTokenSessionInfoServiceImpl(); - private TokenSessionObject tokenSessionObject; - - private String token; - private TokenSession tokenSession; - - public CheckTokenSessionUtil() { - this.tokenSessionObject = new TokenSessionObject(); - this.token = null; - this.tokenSession = null; - } - - public boolean validataToken(HttpServletRequest request, Transaction sqlca) { - - Map map = service.fundSessionUser(request, sqlca); - ASUser CurARC = (ASUser) map.get("CurARC"); - if (CurARC != null) { - String sUserId = CurARC.getUserID(); - try { - BizObjectManager bom = JBOFactory.getBizObjectManager("jbo.guaranty.TOKEN_SESSION"); - BizObjectQuery boq = bom.createQuery("USER_ID=:USER_ID"); - BizObject bo = boq.setParameter("USER_ID", sUserId).getSingleResult(false); - if (bo == null) return false; - } catch (JBOException e) { - return false; - } - } - -// this.token = service.fundToken(request, sqlca).get("token") == null ? null -// : service.fundToken(request, sqlca).get("token").toString(); -// if (this.token == null) -// return false; -// BizObject bo; -// try { -// BizObjectManager bom = JBOFactory.getBizObjectManager("jbo.guaranty.TOKEN_SESSION"); -// BizObjectQuery boq = bom.createQuery("TOKEN=:TOKEN"); -// bo = boq.setParameter("TOKEN", this.token).getSingleResult(false); -// } catch (JBOException e) { -// return false; -// } -// if (bo == null) return false; -// this.tokenSession = service.fundTokenSessionInfo(this.token, request, -// sqlca).get("tokenSession") == null ? null -// : (TokenSession) service.fundTokenSessionInfo(this.token, -// request, sqlca).get("tokenSession"); -// if (this.tokenSession == null) -// return false; - return true; - } - - public String getToken() { - return token; - } - - public TokenSession getTokenSession() { - return tokenSession; - } - - public TokenSessionObject getTokenSessionObject() { - return tokenSessionObject; - } -} diff --git a/src_app/apx/com/amarsoft/als/base/util/DES.java b/src_app/apx/com/amarsoft/als/base/util/DES.java deleted file mode 100644 index 4ecfcda8e..000000000 --- a/src_app/apx/com/amarsoft/als/base/util/DES.java +++ /dev/null @@ -1,1059 +0,0 @@ -package apx.com.amarsoft.als.base.util; - -import java.util.ArrayList; -import java.util.List; - -import apx.com.amarsoft.als.user.logon.constant.DESSecretKeyConstant; - -/** - * DES服务端的处理,和des.js配合使用 - * @author EX-YANGSONG001 - * - */ -@SuppressWarnings({"unused","unchecked","rawtypes"}) -public class DES { - public static void main(String[] args) { - System.out.println(encrypt("123456789", DESSecretKeyConstant.DES_SECRET_KEY_ONE, DESSecretKeyConstant.DES_SECRET_KEY_TWO, DESSecretKeyConstant.DES_SECRET_KEY_THREE)); - } - - /** - * 加密 - * @param data - * @param firstKey - * @param secondKey - * @param thirdKey - * @return - */ - public static String encrypt(String data, String firstKey, String secondKey, - String thirdKey) { - - int leng = data.length(); - String encData = ""; - List firstKeyBt = null, secondKeyBt = null, thirdKeyBt = null; - int firstLength = 0, secondLength = 0, thirdLength = 0; - if (firstKey != null && firstKey != "") { - firstKeyBt = getKeyBytes(firstKey); - firstLength = firstKeyBt.size(); - } - if (secondKey != null && secondKey != "") { - secondKeyBt = getKeyBytes(secondKey); - secondLength = secondKeyBt.size(); - } - if (thirdKey != null && thirdKey != "") { - thirdKeyBt = getKeyBytes(thirdKey); - thirdLength = thirdKeyBt.size(); - } - - if (leng > 0) { - if (leng < 4) { - int[] bt = strToBt(data); - int[] encByte = null; - if (firstKey != null && firstKey != "" && secondKey != null - && secondKey != "" && thirdKey != null - && thirdKey != "") { - int[] tempBt; - int x, y, z; - tempBt = bt; - for (x = 0; x < firstLength; x++) { - tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); - } - for (y = 0; y < secondLength; y++) { - tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); - } - for (z = 0; z < thirdLength; z++) { - tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z)); - } - encByte = tempBt; - } else { - if (firstKey != null && firstKey != "" && secondKey != null - && secondKey != "") { - int[] tempBt; - int x, y; - tempBt = bt; - for (x = 0; x < firstLength; x++) { - tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); - } - for (y = 0; y < secondLength; y++) { - tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); - } - encByte = tempBt; - } else { - if (firstKey != null && firstKey != "") { - int[] tempBt; - int x = 0; - tempBt = bt; - for (x = 0; x < firstLength; x++) { - tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); - } - encByte = tempBt; - } - } - } - encData = bt64ToHex(encByte); - } else { - int iterator = (leng / 4); - int remainder = leng % 4; - int i = 0; - for (i = 0; i < iterator; i++) { - String tempData = data.substring(i * 4 + 0, i * 4 + 4); - int[] tempByte = strToBt(tempData); - int[] encByte = null; - if (firstKey != null && firstKey != "" && secondKey != null - && secondKey != "" && thirdKey != null - && thirdKey != "") { - int[] tempBt; - int x, y, z; - tempBt = tempByte; - for (x = 0; x < firstLength; x++) { - tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); - } - for (y = 0; y < secondLength; y++) { - tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); - } - for (z = 0; z < thirdLength; z++) { - tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z)); - } - encByte = tempBt; - } else { - if (firstKey != null && firstKey != "" - && secondKey != null && secondKey != "") { - int[] tempBt; - int x, y; - tempBt = tempByte; - for (x = 0; x < firstLength; x++) { - tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); - } - for (y = 0; y < secondLength; y++) { - tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); - } - encByte = tempBt; - } else { - if (firstKey != null && firstKey != "") { - int[] tempBt; - int x; - tempBt = tempByte; - for (x = 0; x < firstLength; x++) { - tempBt = enc(tempBt, (int[]) firstKeyBt - .get(x)); - } - encByte = tempBt; - } - } - } - encData += bt64ToHex(encByte); - } - if (remainder > 0) { - String remainderData = data.substring(iterator * 4 + 0, - leng); - int[] tempByte = strToBt(remainderData); - int[] encByte = null; - if (firstKey != null && firstKey != "" && secondKey != null - && secondKey != "" && thirdKey != null - && thirdKey != "") { - int[] tempBt; - int x, y, z; - tempBt = tempByte; - for (x = 0; x < firstLength; x++) { - tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); - } - for (y = 0; y < secondLength; y++) { - tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); - } - for (z = 0; z < thirdLength; z++) { - tempBt = enc(tempBt, (int[]) thirdKeyBt.get(z)); - } - encByte = tempBt; - } else { - if (firstKey != null && firstKey != "" - && secondKey != null && secondKey != "") { - int[] tempBt; - int x, y; - tempBt = tempByte; - for (x = 0; x < firstLength; x++) { - tempBt = enc(tempBt, (int[]) firstKeyBt.get(x)); - } - for (y = 0; y < secondLength; y++) { - tempBt = enc(tempBt, (int[]) secondKeyBt.get(y)); - } - encByte = tempBt; - } else { - if (firstKey != null && firstKey != "") { - int[] tempBt; - int x; - tempBt = tempByte; - for (x = 0; x < firstLength; x++) { - tempBt = enc(tempBt, (int[]) firstKeyBt - .get(x)); - } - encByte = tempBt; - } - } - } - encData += bt64ToHex(encByte); - } - } - } - return encData; - } - - /* - * decrypt the encrypted string to the original string - * - * return the original string - */ - public static String decrypt(String data, String firstKey, String secondKey, - String thirdKey) { - int leng = data.length(); - String decStr = ""; - List firstKeyBt = null, secondKeyBt = null, thirdKeyBt = null; - int firstLength = 0, secondLength = 0, thirdLength = 0; - if (firstKey != null && firstKey != "") { - firstKeyBt = getKeyBytes(firstKey); - firstLength = firstKeyBt.size(); - } - if (secondKey != null && secondKey != "") { - secondKeyBt = getKeyBytes(secondKey); - secondLength = secondKeyBt.size(); - } - if (thirdKey != null && thirdKey != "") { - thirdKeyBt = getKeyBytes(thirdKey); - thirdLength = thirdKeyBt.size(); - } - - int iterator = leng / 16; - int i = 0; - for (i = 0; i < iterator; i++) { - String tempData = data.substring(i * 16 + 0, i * 16 + 16); - String strByte = hexToBt64(tempData); - int[] intByte = new int[64]; - int j = 0; - for (j = 0; j < 64; j++) { - intByte[j] = Integer.parseInt(strByte.substring(j, j + 1)); - } - int[] decByte = null; - if (firstKey != null && firstKey != "" && secondKey != null - && secondKey != "" && thirdKey != null && thirdKey != "") { - int[] tempBt; - int x, y, z; - tempBt = intByte; - for (x = thirdLength - 1; x >= 0; x--) { - tempBt = dec(tempBt, (int[]) thirdKeyBt.get(x)); - } - for (y = secondLength - 1; y >= 0; y--) { - tempBt = dec(tempBt, (int[]) secondKeyBt.get(y)); - } - for (z = firstLength - 1; z >= 0; z--) { - tempBt = dec(tempBt, (int[]) firstKeyBt.get(z)); - } - decByte = tempBt; - } else { - if (firstKey != null && firstKey != "" && secondKey != null - && secondKey != "") { - int[] tempBt; - int x, y, z; - tempBt = intByte; - for (x = secondLength - 1; x >= 0; x--) { - tempBt = dec(tempBt, (int[]) secondKeyBt.get(x)); - } - for (y = firstLength - 1; y >= 0; y--) { - tempBt = dec(tempBt, (int[]) firstKeyBt.get(y)); - } - decByte = tempBt; - } else { - if (firstKey != null && firstKey != "") { - int[] tempBt; - int x, y, z; - tempBt = intByte; - for (x = firstLength - 1; x >= 0; x--) { - tempBt = dec(tempBt, (int[]) firstKeyBt.get(x)); - } - decByte = tempBt; - } - } - } - decStr += byteToString(decByte); - } - return decStr; - } - - /* - * chang the string into the bit array - * - * return bit array(it's length % 64 = 0) - */ - - private static List getKeyBytes(String key) { - List keyBytes = new ArrayList(); - int leng = key.length(); - int iterator = (leng / 4); - int remainder = leng % 4; - int i = 0; - for (i = 0; i < iterator; i++) { - keyBytes.add(i, strToBt(key.substring(i * 4 + 0, i * 4 + 4))); - } - if (remainder > 0) { - // keyBytes[i] = strToBt(key.substring(i*4+0,leng)); - keyBytes.add(i, strToBt(key.substring(i * 4 + 0, leng))); - } - return keyBytes; - } - - /* - * chang the string(it's length <= 4) into the bit array - * - * return bit array(it's length = 64) - */ - private static int[] strToBt(String str) { - int leng = str.length(); - int[] bt = new int[64]; - if (leng < 4) { - int i = 0, j = 0, p = 0, q = 0; - for (i = 0; i < leng; i++) { - int k = str.charAt(i); - for (j = 0; j < 16; j++) { - int pow = 1, m = 0; - for (m = 15; m > j; m--) { - pow *= 2; - } - // bt.set(16*i+j,""+(k/pow)%2)); - bt[16 * i + j] = (k / pow) % 2; - } - } - for (p = leng; p < 4; p++) { - int k = 0; - for (q = 0; q < 16; q++) { - int pow = 1, m = 0; - for (m = 15; m > q; m--) { - pow *= 2; - } - // bt[16*p+q]=parseInt(k/pow)%2; - // bt.add(16*p+q,""+((k/pow)%2)); - bt[16 * p + q] = (k / pow) % 2; - } - } - } else { - for (int i = 0; i < 4; i++) { - int k = str.charAt(i); - for (int j = 0; j < 16; j++) { - int pow = 1; - for (int m = 15; m > j; m--) { - pow *= 2; - } - // bt[16*i+j]=parseInt(k/pow)%2; - // bt.add(16*i+j,""+((k/pow)%2)); - bt[16 * i + j] = (k / pow) % 2; - } - } - } - return bt; - } - - /* - * chang the bit(it's length = 4) into the hex - * - * return hex - */ - private static String bt4ToHex(String binary) { - String hex = ""; - if (binary.equalsIgnoreCase("0000")) { - hex = "0"; - } else if (binary.equalsIgnoreCase("0001")) { - hex = "1"; - } else if (binary.equalsIgnoreCase("0010")) { - hex = "2"; - } else if (binary.equalsIgnoreCase("0011")) { - hex = "3"; - } else if (binary.equalsIgnoreCase("0100")) { - hex = "4"; - } else if (binary.equalsIgnoreCase("0101")) { - hex = "5"; - } else if (binary.equalsIgnoreCase("0110")) { - hex = "6"; - } else if (binary.equalsIgnoreCase("0111")) { - hex = "7"; - } else if (binary.equalsIgnoreCase("1000")) { - hex = "8"; - } else if (binary.equalsIgnoreCase("1001")) { - hex = "9"; - } else if (binary.equalsIgnoreCase("1010")) { - hex = "A"; - } else if (binary.equalsIgnoreCase("1011")) { - hex = "B"; - } else if (binary.equalsIgnoreCase("1100")) { - hex = "C"; - } else if (binary.equalsIgnoreCase("1101")) { - hex = "D"; - } else if (binary.equalsIgnoreCase("1110")) { - hex = "E"; - } else if (binary.equalsIgnoreCase("1111")) { - hex = "F"; - } - - return hex; - } - - /* - * chang the hex into the bit(it's length = 4) - * - * return the bit(it's length = 4) - */ - private static String hexToBt4(String hex) { - String binary = ""; - if (hex.equalsIgnoreCase("0")) { - binary = "0000"; - } else if (hex.equalsIgnoreCase("1")) { - binary = "0001"; - } - if (hex.equalsIgnoreCase("2")) { - binary = "0010"; - } - if (hex.equalsIgnoreCase("3")) { - binary = "0011"; - } - if (hex.equalsIgnoreCase("4")) { - binary = "0100"; - } - if (hex.equalsIgnoreCase("5")) { - binary = "0101"; - } - if (hex.equalsIgnoreCase("6")) { - binary = "0110"; - } - if (hex.equalsIgnoreCase("7")) { - binary = "0111"; - } - if (hex.equalsIgnoreCase("8")) { - binary = "1000"; - } - if (hex.equalsIgnoreCase("9")) { - binary = "1001"; - } - if (hex.equalsIgnoreCase("A")) { - binary = "1010"; - } - if (hex.equalsIgnoreCase("B")) { - binary = "1011"; - } - if (hex.equalsIgnoreCase("C")) { - binary = "1100"; - } - if (hex.equalsIgnoreCase("D")) { - binary = "1101"; - } - if (hex.equalsIgnoreCase("E")) { - binary = "1110"; - } - if (hex.equalsIgnoreCase("F")) { - binary = "1111"; - } - return binary; - } - - /* - * chang the bit(it's length = 64) into the string - * - * return string - */ - private static String byteToString(int[] byteData) { - String str = ""; - for (int i = 0; i < 4; i++) { - int count = 0; - for (int j = 0; j < 16; j++) { - int pow = 1; - for (int m = 15; m > j; m--) { - pow *= 2; - } - count += byteData[16 * i + j] * pow; - } - if (count != 0) { - str += "" + (char) (count); - } - } - return str; - } - - private static String bt64ToHex(int[] byteData) { - String hex = ""; - for (int i = 0; i < 16; i++) { - String bt = ""; - for (int j = 0; j < 4; j++) { - bt += byteData[i * 4 + j]; - } - hex += bt4ToHex(bt); - } - return hex; - } - - private static String hexToBt64(String hex) { - String binary = ""; - for (int i = 0; i < 16; i++) { - binary += hexToBt4(hex.substring(i, i + 1)); - } - return binary; - } - - /* - * the 64 bit des core arithmetic - */ - - private static int[] enc(int[] dataByte, int[] keyByte) { - int[][] keys = generateKeys(keyByte); - int[] ipByte = initPermute(dataByte); - int[] ipLeft = new int[32]; - int[] ipRight = new int[32]; - int[] tempLeft = new int[32]; - int i = 0, j = 0, k = 0, m = 0, n = 0; - for (k = 0; k < 32; k++) { - ipLeft[k] = ipByte[k]; - ipRight[k] = ipByte[32 + k]; - } - for (i = 0; i < 16; i++) { - for (j = 0; j < 32; j++) { - tempLeft[j] = ipLeft[j]; - ipLeft[j] = ipRight[j]; - } - int[] key = new int[48]; - for (m = 0; m < 48; m++) { - key[m] = keys[i][m]; - } - int[] tempRight = xor(pPermute(sBoxPermute(xor( - expandPermute(ipRight), key))), tempLeft); - for (n = 0; n < 32; n++) { - ipRight[n] = tempRight[n]; - } - - } - - int[] finalData = new int[64]; - for (i = 0; i < 32; i++) { - finalData[i] = ipRight[i]; - finalData[32 + i] = ipLeft[i]; - } - return finallyPermute(finalData); - } - - private static int[] dec(int[] dataByte, int[] keyByte) { - int[][] keys = generateKeys(keyByte); - int[] ipByte = initPermute(dataByte); - int[] ipLeft = new int[32]; - int[] ipRight = new int[32]; - int[] tempLeft = new int[32]; - int i = 0, j = 0, k = 0, m = 0, n = 0; - for (k = 0; k < 32; k++) { - ipLeft[k] = ipByte[k]; - ipRight[k] = ipByte[32 + k]; - } - for (i = 15; i >= 0; i--) { - for (j = 0; j < 32; j++) { - tempLeft[j] = ipLeft[j]; - ipLeft[j] = ipRight[j]; - } - int[] key = new int[48]; - for (m = 0; m < 48; m++) { - key[m] = keys[i][m]; - } - - int[] tempRight = xor(pPermute(sBoxPermute(xor( - expandPermute(ipRight), key))), tempLeft); - for (n = 0; n < 32; n++) { - ipRight[n] = tempRight[n]; - } - } - - int[] finalData = new int[64]; - for (i = 0; i < 32; i++) { - finalData[i] = ipRight[i]; - finalData[32 + i] = ipLeft[i]; - } - return finallyPermute(finalData); - } - - private static int[] initPermute(int[] originalData) { - int[] ipByte = new int[64]; - int i = 0, m = 1, n = 0, j, k; - for (i = 0, m = 1, n = 0; i < 4; i++, m += 2, n += 2) { - for (j = 7, k = 0; j >= 0; j--, k++) { - ipByte[i * 8 + k] = originalData[j * 8 + m]; - ipByte[i * 8 + k + 32] = originalData[j * 8 + n]; - } - } - return ipByte; - } - - private static int[] expandPermute(int[] rightData) { - int[] epByte = new int[48]; - int i, j; - for (i = 0; i < 8; i++) { - if (i == 0) { - epByte[i * 6 + 0] = rightData[31]; - } else { - epByte[i * 6 + 0] = rightData[i * 4 - 1]; - } - epByte[i * 6 + 1] = rightData[i * 4 + 0]; - epByte[i * 6 + 2] = rightData[i * 4 + 1]; - epByte[i * 6 + 3] = rightData[i * 4 + 2]; - epByte[i * 6 + 4] = rightData[i * 4 + 3]; - if (i == 7) { - epByte[i * 6 + 5] = rightData[0]; - } else { - epByte[i * 6 + 5] = rightData[i * 4 + 4]; - } - } - return epByte; - } - - private static int[] xor(int[] byteOne, int[] byteTwo) { - // var xorByte = new Array(byteOne.length); - // for(int i = 0;i < byteOne.length; i ++){ - // xorByte[i] = byteOne[i] ^ byteTwo[i]; - // } - // return xorByte; - int[] xorByte = new int[byteOne.length]; - for (int i = 0; i < byteOne.length; i++) { - xorByte[i] = byteOne[i] ^ byteTwo[i]; - } - return xorByte; - } - - private static int[] sBoxPermute(int[] expandByte) { - - // var sBoxByte = new Array(32); - int[] sBoxByte = new int[32]; - String binary = ""; - int[][] s1 = { - { 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 }, - { 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8 }, - { 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0 }, - { 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 } }; - - /* Table - s2 */ - int[][] s2 = { - { 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10 }, - { 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5 }, - { 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15 }, - { 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9 } }; - - /* Table - s3 */ - int[][] s3 = { - { 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8 }, - { 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1 }, - { 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7 }, - { 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12 } }; - /* Table - s4 */ - int[][] s4 = { - { 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15 }, - { 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9 }, - { 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4 }, - { 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14 } }; - - /* Table - s5 */ - int[][] s5 = { - { 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9 }, - { 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6 }, - { 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14 }, - { 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 } }; - - /* Table - s6 */ - int[][] s6 = { - { 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11 }, - { 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8 }, - { 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6 }, - { 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13 } }; - - /* Table - s7 */ - int[][] s7 = { - { 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1 }, - { 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6 }, - { 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2 }, - { 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12 } }; - - /* Table - s8 */ - int[][] s8 = { - { 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7 }, - { 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2 }, - { 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8 }, - { 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 } }; - - for (int m = 0; m < 8; m++) { - int i = 0, j = 0; - i = expandByte[m * 6 + 0] * 2 + expandByte[m * 6 + 5]; - j = expandByte[m * 6 + 1] * 2 * 2 * 2 + expandByte[m * 6 + 2] * 2 - * 2 + expandByte[m * 6 + 3] * 2 + expandByte[m * 6 + 4]; - switch (m) { - case 0: - binary = getBoxBinary(s1[i][j]); - break; - case 1: - binary = getBoxBinary(s2[i][j]); - break; - case 2: - binary = getBoxBinary(s3[i][j]); - break; - case 3: - binary = getBoxBinary(s4[i][j]); - break; - case 4: - binary = getBoxBinary(s5[i][j]); - break; - case 5: - binary = getBoxBinary(s6[i][j]); - break; - case 6: - binary = getBoxBinary(s7[i][j]); - break; - case 7: - binary = getBoxBinary(s8[i][j]); - break; - } - sBoxByte[m * 4 + 0] = Integer.parseInt(binary.substring(0, 1)); - sBoxByte[m * 4 + 1] = Integer.parseInt(binary.substring(1, 2)); - sBoxByte[m * 4 + 2] = Integer.parseInt(binary.substring(2, 3)); - sBoxByte[m * 4 + 3] = Integer.parseInt(binary.substring(3, 4)); - } - return sBoxByte; - } - - private static int[] pPermute(int[] sBoxByte) { - int[] pBoxPermute = new int[32]; - pBoxPermute[0] = sBoxByte[15]; - pBoxPermute[1] = sBoxByte[6]; - pBoxPermute[2] = sBoxByte[19]; - pBoxPermute[3] = sBoxByte[20]; - pBoxPermute[4] = sBoxByte[28]; - pBoxPermute[5] = sBoxByte[11]; - pBoxPermute[6] = sBoxByte[27]; - pBoxPermute[7] = sBoxByte[16]; - pBoxPermute[8] = sBoxByte[0]; - pBoxPermute[9] = sBoxByte[14]; - pBoxPermute[10] = sBoxByte[22]; - pBoxPermute[11] = sBoxByte[25]; - pBoxPermute[12] = sBoxByte[4]; - pBoxPermute[13] = sBoxByte[17]; - pBoxPermute[14] = sBoxByte[30]; - pBoxPermute[15] = sBoxByte[9]; - pBoxPermute[16] = sBoxByte[1]; - pBoxPermute[17] = sBoxByte[7]; - pBoxPermute[18] = sBoxByte[23]; - pBoxPermute[19] = sBoxByte[13]; - pBoxPermute[20] = sBoxByte[31]; - pBoxPermute[21] = sBoxByte[26]; - pBoxPermute[22] = sBoxByte[2]; - pBoxPermute[23] = sBoxByte[8]; - pBoxPermute[24] = sBoxByte[18]; - pBoxPermute[25] = sBoxByte[12]; - pBoxPermute[26] = sBoxByte[29]; - pBoxPermute[27] = sBoxByte[5]; - pBoxPermute[28] = sBoxByte[21]; - pBoxPermute[29] = sBoxByte[10]; - pBoxPermute[30] = sBoxByte[3]; - pBoxPermute[31] = sBoxByte[24]; - return pBoxPermute; - } - - private static int[] finallyPermute(int[] endByte) { - int[] fpByte = new int[64]; - fpByte[0] = endByte[39]; - fpByte[1] = endByte[7]; - fpByte[2] = endByte[47]; - fpByte[3] = endByte[15]; - fpByte[4] = endByte[55]; - fpByte[5] = endByte[23]; - fpByte[6] = endByte[63]; - fpByte[7] = endByte[31]; - fpByte[8] = endByte[38]; - fpByte[9] = endByte[6]; - fpByte[10] = endByte[46]; - fpByte[11] = endByte[14]; - fpByte[12] = endByte[54]; - fpByte[13] = endByte[22]; - fpByte[14] = endByte[62]; - fpByte[15] = endByte[30]; - fpByte[16] = endByte[37]; - fpByte[17] = endByte[5]; - fpByte[18] = endByte[45]; - fpByte[19] = endByte[13]; - fpByte[20] = endByte[53]; - fpByte[21] = endByte[21]; - fpByte[22] = endByte[61]; - fpByte[23] = endByte[29]; - fpByte[24] = endByte[36]; - fpByte[25] = endByte[4]; - fpByte[26] = endByte[44]; - fpByte[27] = endByte[12]; - fpByte[28] = endByte[52]; - fpByte[29] = endByte[20]; - fpByte[30] = endByte[60]; - fpByte[31] = endByte[28]; - fpByte[32] = endByte[35]; - fpByte[33] = endByte[3]; - fpByte[34] = endByte[43]; - fpByte[35] = endByte[11]; - fpByte[36] = endByte[51]; - fpByte[37] = endByte[19]; - fpByte[38] = endByte[59]; - fpByte[39] = endByte[27]; - fpByte[40] = endByte[34]; - fpByte[41] = endByte[2]; - fpByte[42] = endByte[42]; - fpByte[43] = endByte[10]; - fpByte[44] = endByte[50]; - fpByte[45] = endByte[18]; - fpByte[46] = endByte[58]; - fpByte[47] = endByte[26]; - fpByte[48] = endByte[33]; - fpByte[49] = endByte[1]; - fpByte[50] = endByte[41]; - fpByte[51] = endByte[9]; - fpByte[52] = endByte[49]; - fpByte[53] = endByte[17]; - fpByte[54] = endByte[57]; - fpByte[55] = endByte[25]; - fpByte[56] = endByte[32]; - fpByte[57] = endByte[0]; - fpByte[58] = endByte[40]; - fpByte[59] = endByte[8]; - fpByte[60] = endByte[48]; - fpByte[61] = endByte[16]; - fpByte[62] = endByte[56]; - fpByte[63] = endByte[24]; - return fpByte; - } - - private static String getBoxBinary(int i) { - String binary = ""; - switch (i) { - case 0: - binary = "0000"; - break; - case 1: - binary = "0001"; - break; - case 2: - binary = "0010"; - break; - case 3: - binary = "0011"; - break; - case 4: - binary = "0100"; - break; - case 5: - binary = "0101"; - break; - case 6: - binary = "0110"; - break; - case 7: - binary = "0111"; - break; - case 8: - binary = "1000"; - break; - case 9: - binary = "1001"; - break; - case 10: - binary = "1010"; - break; - case 11: - binary = "1011"; - break; - case 12: - binary = "1100"; - break; - case 13: - binary = "1101"; - break; - case 14: - binary = "1110"; - break; - case 15: - binary = "1111"; - break; - } - return binary; - } - - /* - * generate 16 keys for xor - * - */ - private static int[][] generateKeys(int[] keyByte) { - int[] key = new int[56]; - int[][] keys = new int[16][48]; - - // keys[ 0] = new Array(); - // keys[ 1] = new Array(); - // keys[ 2] = new Array(); - // keys[ 3] = new Array(); - // keys[ 4] = new Array(); - // keys[ 5] = new Array(); - // keys[ 6] = new Array(); - // keys[ 7] = new Array(); - // keys[ 8] = new Array(); - // keys[ 9] = new Array(); - // keys[10] = new Array(); - // keys[11] = new Array(); - // keys[12] = new Array(); - // keys[13] = new Array(); - // keys[14] = new Array(); - // keys[15] = new Array(); - int[] loop = new int[] { 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 }; - - for (int i = 0; i < 7; i++) { - for (int j = 0, k = 7; j < 8; j++, k--) { - key[i * 8 + j] = keyByte[8 * k + i]; - } - } - - int i = 0; - for (i = 0; i < 16; i++) { - int tempLeft = 0; - int tempRight = 0; - for (int j = 0; j < loop[i]; j++) { - tempLeft = key[0]; - tempRight = key[28]; - for (int k = 0; k < 27; k++) { - key[k] = key[k + 1]; - key[28 + k] = key[29 + k]; - } - key[27] = tempLeft; - key[55] = tempRight; - } - // var tempKey = new Array(48); - int[] tempKey = new int[48]; - tempKey[0] = key[13]; - tempKey[1] = key[16]; - tempKey[2] = key[10]; - tempKey[3] = key[23]; - tempKey[4] = key[0]; - tempKey[5] = key[4]; - tempKey[6] = key[2]; - tempKey[7] = key[27]; - tempKey[8] = key[14]; - tempKey[9] = key[5]; - tempKey[10] = key[20]; - tempKey[11] = key[9]; - tempKey[12] = key[22]; - tempKey[13] = key[18]; - tempKey[14] = key[11]; - tempKey[15] = key[3]; - tempKey[16] = key[25]; - tempKey[17] = key[7]; - tempKey[18] = key[15]; - tempKey[19] = key[6]; - tempKey[20] = key[26]; - tempKey[21] = key[19]; - tempKey[22] = key[12]; - tempKey[23] = key[1]; - tempKey[24] = key[40]; - tempKey[25] = key[51]; - tempKey[26] = key[30]; - tempKey[27] = key[36]; - tempKey[28] = key[46]; - tempKey[29] = key[54]; - tempKey[30] = key[29]; - tempKey[31] = key[39]; - tempKey[32] = key[50]; - tempKey[33] = key[44]; - tempKey[34] = key[32]; - tempKey[35] = key[47]; - tempKey[36] = key[43]; - tempKey[37] = key[48]; - tempKey[38] = key[38]; - tempKey[39] = key[55]; - tempKey[40] = key[33]; - tempKey[41] = key[52]; - tempKey[42] = key[45]; - tempKey[43] = key[41]; - tempKey[44] = key[49]; - tempKey[45] = key[35]; - tempKey[46] = key[28]; - tempKey[47] = key[31]; - int m; - switch (i) { - case 0: - for (m = 0; m < 48; m++) { - keys[0][m] = tempKey[m]; - } - break; - case 1: - for (m = 0; m < 48; m++) { - keys[1][m] = tempKey[m]; - } - break; - case 2: - for (m = 0; m < 48; m++) { - keys[2][m] = tempKey[m]; - } - break; - case 3: - for (m = 0; m < 48; m++) { - keys[3][m] = tempKey[m]; - } - break; - case 4: - for (m = 0; m < 48; m++) { - keys[4][m] = tempKey[m]; - } - break; - case 5: - for (m = 0; m < 48; m++) { - keys[5][m] = tempKey[m]; - } - break; - case 6: - for (m = 0; m < 48; m++) { - keys[6][m] = tempKey[m]; - } - break; - case 7: - for (m = 0; m < 48; m++) { - keys[7][m] = tempKey[m]; - } - break; - case 8: - for (m = 0; m < 48; m++) { - keys[8][m] = tempKey[m]; - } - break; - case 9: - for (m = 0; m < 48; m++) { - keys[9][m] = tempKey[m]; - } - break; - case 10: - for (m = 0; m < 48; m++) { - keys[10][m] = tempKey[m]; - } - break; - case 11: - for (m = 0; m < 48; m++) { - keys[11][m] = tempKey[m]; - } - break; - case 12: - for (m = 0; m < 48; m++) { - keys[12][m] = tempKey[m]; - } - break; - case 13: - for (m = 0; m < 48; m++) { - keys[13][m] = tempKey[m]; - } - break; - case 14: - for (m = 0; m < 48; m++) { - keys[14][m] = tempKey[m]; - } - break; - case 15: - for (m = 0; m < 48; m++) { - keys[15][m] = tempKey[m]; - } - break; - } - } - return keys; - } -} diff --git a/src_app/apx/com/amarsoft/als/base/util/FileUtil.java b/src_app/apx/com/amarsoft/als/base/util/FileUtil.java deleted file mode 100644 index aa8548380..000000000 --- a/src_app/apx/com/amarsoft/als/base/util/FileUtil.java +++ /dev/null @@ -1,426 +0,0 @@ -package apx.com.amarsoft.als.base.util; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileFilter; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.net.JarURLConnection; -import java.net.URL; -import java.net.URLDecoder; -import java.text.NumberFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -public class FileUtil -{ - public static void deleteFile(File file) - { - if(file.exists()){ - if(file.isFile()){ - file.delete(); - }else if(file.isDirectory()){ - File files[] = file.listFiles(); - for(int i=0;i-1) - { - replaceStr ="\\\\"; - finalStr = str.replaceAll("(%5C)+", replaceStr).replaceAll("/+", replaceStr).replaceAll("(\\\\)+",replaceStr); - } - else - { - finalStr = str.replaceAll("(%5C)+", replaceStr).replaceAll("(\\\\)+",replaceStr).replaceAll("/+", replaceStr); - }*/ - String reg0 = "\\\\+"; - String reg = "\\\\+|/+"; - String temp = str.trim().replaceAll(reg0, "/"); - temp = temp.replaceAll(reg, "/"); - if (temp.length() > 1 && temp.endsWith("/")) { - temp = temp.substring(0, temp.length() - 1); - } - return temp; - } - public static void deleteFile(String filePath) - { - deleteFile(new File(getFilePathString(filePath))); - } - public static String getChildrenFileNameJson(String filepath) - { - filepath = getFilePathString(filepath); - StringBuffer json_sb = new StringBuffer("{"); - File f = new File(filepath); - File []files = f.listFiles(); - int index = 0; - for(File file : files) - { - if(file.isFile()) - { - if(file.getName().indexOf(".svn")>-1) - { - continue; - } - if(1!=(++index)) - { - json_sb.append(","); - } - json_sb.append("\"") - .append(file.getName()) - .append("\":") - .append("\"") - .append(file.getName()) - .append("\""); - } - } - json_sb.append("}"); - return json_sb.toString(); - } - public static String searchFileFromDirectory(File fileOrdirectory,String filename,AbstractFileSearchDeal adsd) - { - StringBuffer sb = new StringBuffer(""); - searchFileFromDirectory(sb,fileOrdirectory,filename,adsd); - return sb.toString(); - } - public static void searchFileFromDirectory(StringBuffer sb,File fileOrdirectory,String filename,AbstractFileSearchDeal adsd) - { - if(!fileOrdirectory.exists()) - { - return ; - } - if(sb.length()>=1) - { - return; - } - if(fileOrdirectory.isDirectory()) - { - if(adsd.fileSearchCallBack(fileOrdirectory)) - { - File[] files = fileOrdirectory.listFiles(); - for(int index=0;index allFileMap,File searchFile) - { - if(searchFile.exists()) - { - if(searchFile.isDirectory()) - { - File []files = searchFile.listFiles(); - for(int fIndex = 0 ; fIndex < files.length;fIndex++) - { - File file = files[fIndex]; - AllFileToMap(allFileMap,file); - } - } - else if(searchFile.isFile()) - { - allFileMap.put(searchFile.getName(), searchFile); - } - } - } - public static void saveAllFilePathToMap(File rootFile,Map filesMap) - { - if(rootFile.isFile()) - { - String fileName = rootFile.getName(); - String filePath = rootFile.getAbsolutePath(); - if(fileName.indexOf(".svn")>-1) - { - return; - } - filesMap.put(fileName, filePath); - } - else if(rootFile.isDirectory()) - { - File []files = rootFile.listFiles(); - for(int i=0;i-1) - { - continue; - } - saveAllFilePathToMap(file,filesMap); - } - } - } - abstract class AbstractFileSearchDeal - { - public abstract boolean fileSearchCallBack(File currentSearchingDirectory); - public abstract boolean fileSearchCallBack(File currentSearchingFile,String findFileName); - } - - - public static Set> getClasses(String pack) { - - Set> classes = new LinkedHashSet>(); - boolean recursive = true; - String packageName = pack; - String packageDirName = packageName.replace('.', '/'); - Enumeration dirs; - try { - dirs = Thread.currentThread().getContextClassLoader().getResources( - packageDirName); - while (dirs.hasMoreElements()) { - URL url = dirs.nextElement(); - String protocol = url.getProtocol(); - if ("file".equals(protocol)) { - String filePath = URLDecoder.decode(url.getFile(), "UTF-8"); - findAndAddClassesInPackageByFile(packageName, filePath, - recursive, classes); - } else if ("jar".equals(protocol)) { - JarFile jar; - try { - jar = ((JarURLConnection) url.openConnection()) - .getJarFile(); - Enumeration entries = jar.entries(); - while (entries.hasMoreElements()) { - JarEntry entry = entries.nextElement(); - String name = entry.getName(); - if (name.charAt(0) == '/') { - name = name.substring(1); - } - if (name.startsWith(packageDirName)) { - int idx = name.lastIndexOf('/'); - if (idx != -1) { - packageName = name.substring(0, idx) - .replace('/', '.'); - } - if ((idx != -1) || recursive) { - if (name.endsWith(".class") - && !entry.isDirectory()) { - String className = name.substring( - packageName.length() + 1, name - .length() - 6); - try { - classes.add(Class.forName(packageName + '.' - + className)); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - } - } - } - } catch (IOException e) { - e.printStackTrace(); - } - } - } - } catch (IOException e) { - e.printStackTrace(); - } - return classes; - } - /** - * - * @param packageName - * @param packagePath - * @param recursive - * @param classes - */ - public static void findAndAddClassesInPackageByFile(String packageName, - String packagePath, final boolean recursive, Set> classes) { - File dir = new File(packagePath); - if (!dir.exists() || !dir.isDirectory()) { - return; - } - File[] dirfiles = dir.listFiles(new FileFilter() { - public boolean accept(File file) { - return (recursive && file.isDirectory()) - || (file.getName().endsWith(".class")); - } - }); - for (File file : dirfiles) { - if (file.isDirectory()) { - findAndAddClassesInPackageByFile(packageName + "." - + file.getName(), file.getAbsolutePath(), recursive, - classes); - } else { - String className = file.getName().substring(0, - file.getName().length() - 6); - try { - //classes.add(Class.forName(packageName + '.' + className)); - classes.add(Thread.currentThread().getContextClassLoader().loadClass(packageName + '.' + className)); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - } - } - - @SuppressWarnings("unused") - public void saveFileFromInputStream(InputStream stream, String path, String filename) throws IOException { - FileOutputStream fs = new FileOutputStream(path + "/" + filename); - byte[] buffer = new byte[1024 * 1024]; - int bytesum = 0; - int byteread = 0; - while ((byteread = stream.read(buffer)) != -1) { - bytesum += byteread; - fs.write(buffer, 0, byteread); - fs.flush(); - } - fs.close(); - stream.close(); - } - - - @SuppressWarnings("unused") - public static String readFileByLines(String fileName, String encoding) throws IOException { - File file = new File(fileName); - BufferedReader reader = null; - String fileString = ""; - try { - InputStreamReader read = new InputStreamReader(new FileInputStream(file), encoding); - reader=new BufferedReader(read); - String tempString = null; - int line = 1; - while ((tempString = reader.readLine()) != null) { - //System.out.println("line " + line + ": " + tempString); - fileString += tempString; - line++; - } - reader.close(); - } catch (IOException e) { - throw e; - //e.printStackTrace(); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException e1) { - } - } - } - return fileString; - } - - - /** - * - * @param content - * String - * @param fileName - * String - * @param destEncoding - * String - * @throws FileNotFoundException - * @throws IOException - */ - public static void writeFile(String content, String fileName, String destEncoding) throws FileNotFoundException, IOException { - File file = null; - try { - file = new File(fileName); - if (!file.exists()) { - if (file.createNewFile() == false) { - throw new IOException("create file '" + fileName + "' failure."); - } - } - if (file.isFile() == false) { - throw new IOException("'" + fileName + "' is not a file."); - } - if (file.canWrite() == false) { - throw new IOException("'" + fileName + "' is a read-only file."); - } - } finally { - // we dont have to close File here - } - BufferedWriter out = null; - try { - FileOutputStream fos = new FileOutputStream(fileName); - out = new BufferedWriter(new OutputStreamWriter(fos, destEncoding)); - out.write(content); - out.flush(); - } catch (FileNotFoundException fe) { - throw fe; - } catch (IOException e) { - throw e; - } finally { - try { - if (out != null) - out.close(); - } catch (IOException ex) { - } - } - } - - public static Set getAllFiles(String path) { - Set set = new HashSet(); - readDirFile(path, set); - return set; - - } - - - public static Set readDirFile(String path, Set set) { - File file = new File(path); - if (!file.isDirectory()) { - set.add(file); - } else if (file.isDirectory()) { - String[] filelist = file.list(); - for (int i = 0; i < filelist.length; i++) { - File readfile = new File(path + "\\" + filelist[i]); - if (!readfile.isDirectory()) { - set.add(readfile); - } else if (readfile.isDirectory()) { - readDirFile(path + "\\" + filelist[i], set); - } - } - } - return set; - - } - public static String getYearMonthDayPathByString(String dateStr,String dateFormat){ - Date date = DateUtil.getTimeByFormat(dateStr, dateFormat); - Calendar currentDate = Calendar.getInstance(); - currentDate.setTime(date); - NumberFormat nf = NumberFormat.getInstance(); - nf.setMinimumIntegerDigits(2); - return currentDate.get(Calendar.YEAR)+"/"+nf.format(currentDate.get(Calendar.MONTH)+1)+"/"+nf.format(currentDate.get(Calendar.DAY_OF_MONTH)); - } - public static void main(String[] args){ - System.out.println(getYearMonthDayPathByString("2012-03-01","yyyy-MM-dd")); - } - -} diff --git a/src_app/apx/com/amarsoft/als/base/util/InfTool.java b/src_app/apx/com/amarsoft/als/base/util/InfTool.java deleted file mode 100644 index 75acd7f5c..000000000 --- a/src_app/apx/com/amarsoft/als/base/util/InfTool.java +++ /dev/null @@ -1,27 +0,0 @@ -package apx.com.amarsoft.als.base.util; - -import com.amarsoft.aims.util.JBOHelper; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.lang.StringX; - -/** - * 接口帮助类 - * @author EX-SHIGUANGHUA001 - * @since 2014/09/04 - */ -public class InfTool { - /** - * 获取JBO字符型字段 - * @param bo - * @param colName - * @return - */ - public static String getJBOString(BizObject bo, String colName){ - if(bo == null) return ""; - String val = JBOHelper.getAttribute(bo, colName).toString(); - if(StringX.isEmpty(val) || "NULL".equalsIgnoreCase(val)){ - val = ""; - } - return val; - } -} diff --git a/src_app/apx/com/amarsoft/als/base/util/NameManager.java b/src_app/apx/com/amarsoft/als/base/util/NameManager.java deleted file mode 100644 index 6fd75a1dd..000000000 --- a/src_app/apx/com/amarsoft/als/base/util/NameManager.java +++ /dev/null @@ -1,218 +0,0 @@ -package apx.com.amarsoft.als.base.util; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.awe.res.AppManager; -import com.amarsoft.awe.res.MenuManager; -import com.amarsoft.dict.als.cache.CodeCache; -import com.amarsoft.dict.als.cache.NameCache; -import com.amarsoft.dict.als.manage.ObjectTypeManager; -import com.amarsoft.dict.als.manage.RoleManager; - -public class NameManager -{ - public static String getItemName(String sCodeNo, String sItemNo) - throws Exception - { - return getItemName(sCodeNo, sItemNo, null); - } - - public static String getItemName(String sCodeNo, String sItemNo, String language) throws Exception { - return CodeCache.getItemName(sCodeNo, sItemNo, language); - } - - public static String getName(String sID, String sType) - throws Exception - { - if ("User".equalsIgnoreCase(sType)) { - return getUserName(sID); - } - if ("Org".equalsIgnoreCase(sType)) { - return getOrgName(sID); - } - if ("Business".equalsIgnoreCase(sType)) { - return getBusinessName(sID); - } - if ("App".equals(sType)) { - return getAppName(sID); - } - if ("Role".equals(sType)) { - return getRoleNames(sID); - } - if ("Customer".equalsIgnoreCase(sType)) { - return getCustomerName(sID); - } - - return sID; - } - - public static String getUserNames(String sUserIDs) - throws Exception - { - String[] userIDArray = sUserIDs.split("\\,"); - String sUserNames = ""; - for (int i = 0; i < userIDArray.length; ++i) { - if (i == 0) - sUserNames = getUserName(userIDArray[i]); - else { - sUserNames = sUserNames + "," + getUserName(userIDArray[i]); - } - } - - return sUserNames; - } - - public static String getCustManageName(String sCustomerID) throws Exception { - if ((sCustomerID == null) || ("".equals(sCustomerID))) return ""; - String sManagerUserID = getCustManageUserID(sCustomerID); - if ((sManagerUserID == null) || ("".equals(sManagerUserID))) return ""; - return getUserName(sManagerUserID); - } - - public static String getOrgNames(String sOrgIDs) - throws Exception - { - String[] orgIDArray = sOrgIDs.split("\\,"); - String sOrgNames = ""; - for (int i = 0; i < orgIDArray.length; ++i) { - if (i == 0) - sOrgNames = getOrgName(orgIDArray[i]); - else { - sOrgNames = sOrgNames + "," + getOrgName(orgIDArray[i]); - } - } - - return sOrgNames; - } - - public static String getCustManageOrgName(String sCustomerID) throws Exception { - if ((sCustomerID == null) || ("".equals(sCustomerID))) return ""; - String sManagerOrgID = getCustManageOrgID(sCustomerID); - if ((sManagerOrgID == null) || ("".equals(sManagerOrgID))) return ""; - return getOrgName(sManagerOrgID); - } - - public static String getObjectName(String sObjectType) - throws Exception - { - return ObjectTypeManager.getObjectTypeName(sObjectType); - } - - public static String getAppName(String sAppID) - throws Exception - { - return AppManager.getAppName(sAppID); - } - - public static String getMenuName(String sMenuID) - throws Exception - { - return MenuManager.getMenuName(sMenuID); - } - - public static String getRoleName(String sRoleID) - throws Exception - { - return RoleManager.getRoleName(sRoleID); - } - - public static String getRoleNames(String sRoleIDs) - throws Exception - { - String[] roleIDArray = sRoleIDs.split("\\,"); - String sRoleNames = ""; - for (int i = 0; i < roleIDArray.length; ++i) { - if (i == 0) - sRoleNames = getRoleName(roleIDArray[i]); - else { - sRoleNames = sRoleNames + "," + getRoleName(roleIDArray[i]); - } - } - - return sRoleNames; - } - - public static String getNames(String sType, String sIDs) - throws Exception - { - String sNames = null; - if ("Role".equals(sType)) - sNames = getRoleNames(sIDs); - else { - sNames = sIDs; - } - - return sNames.replaceAll(",", "\n"); - } - - public static String getLength(String str, String adjustLength) - { - return (str.length() / Integer.parseInt(adjustLength) - 1) + ""; - } - - public static String isNull1(String str) - { - if ((str == null) || (str.equals(""))) { - return "0"; - } - return "1"; - } - - public static String isNull2(String str1, String str2) - { - if (str1 == null) str1 = ""; - if (str2 == null) str2 = ""; - String str = str1 + str2; - return getLength(str, str2.length() + ""); - } - - public static String getUserName(String sUserID) - throws Exception - { - if ((sUserID == null) || ("".equals(sUserID))) return ""; - return NameCache.getName("jbo.sys.USER_INFO", "UserName", "UserID", sUserID); - } - - public static String getOrgName(String sOrgID) - throws Exception - { - if ((sOrgID == null) || ("".equals(sOrgID))) return ""; - return NameCache.getName("jbo.sys.ORG_INFO", "OrgName", "OrgID", sOrgID); - } - - public static String getCustomerName(String sCustomerID) - throws Exception - { - return NameCache.getName("jbo.app.CUSTOMER_INFO", "CustomerName", "CustomerID", sCustomerID); - } - - public static String getBusinessName(String sTypeNo) - throws Exception - { - return NameCache.getName("jbo.app.BUSINESS_TYPE", "TypeName", "TypeNo", sTypeNo); - } - - public static String getFomatDocType(String typeNo) - throws Exception - { - return NameCache.getName("jbo.app.FORMATDOC_TYPE", "TYPETITLE", "TYPENO", typeNo); - } - - public static String getCustManageUserID(String sCustomerID) - throws Exception - { - if ((sCustomerID == null) || ("".equals(sCustomerID))) return ""; - BizObjectQuery bq = JBOFactory.createBizObjectQuery("jbo.app.CUSTOMER_BELONG", "select UserID from O where BelongAttribute = '1' and CustomerID =:CustomerID"); - BizObject bo = bq.setParameter("CustomerID", sCustomerID).getSingleResult(false); - return ((bo == null) ? "" : bo.getAttribute("UserID").getString()); - } - - public static String getCustManageOrgID(String sCustomerID) - throws Exception - { - if ((sCustomerID == null) || ("".equals(sCustomerID))) return ""; - BizObjectQuery bq = JBOFactory.createBizObjectQuery("jbo.app.CUSTOMER_BELONG", "select OrgID from O where BelongAttribute = '1' and CustomerID =:CustomerID"); - BizObject bo = bq.setParameter("CustomerID", sCustomerID).getSingleResult(false); - return ((bo == null) ? "" : bo.getAttribute("OrgID").getString()); - } -} \ No newline at end of file diff --git a/src_app/apx/com/amarsoft/als/base/util/ReturnMapUtil.java b/src_app/apx/com/amarsoft/als/base/util/ReturnMapUtil.java deleted file mode 100644 index 6b304fe5e..000000000 --- a/src_app/apx/com/amarsoft/als/base/util/ReturnMapUtil.java +++ /dev/null @@ -1,23 +0,0 @@ -package apx.com.amarsoft.als.base.util; - -import java.util.HashMap; -import java.util.Map; - -public class ReturnMapUtil { - private static Map returnMap = new HashMap(); - public static void setReturnMap(Map body, String code, - String message) { - returnMap = new HashMap(); - Map header = new HashMap(); - header.put("code", code); - header.put("message", message); - returnMap.put("outline", header); - if (body != null) { - returnMap.put("content", body); - } - } - public static Map getReturnMap() { - return returnMap; - } - -} diff --git a/src_app/apx/com/amarsoft/als/base/util/TimeUtil.java b/src_app/apx/com/amarsoft/als/base/util/TimeUtil.java deleted file mode 100644 index 708e15f67..000000000 --- a/src_app/apx/com/amarsoft/als/base/util/TimeUtil.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * - */ -package apx.com.amarsoft.als.base.util; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import com.amarsoft.are.ARE; - -/** - * 时间工具 - * - * @author EX-MASAI001 - * @date 2015年6月10日 - */ -public class TimeUtil { - private static final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; - private static SimpleDateFormat dateFormat = new SimpleDateFormat(TIME_FORMAT); - - private TimeUtil() { - } - - /** - * 获取当前时间 - * @return - */ - public static String getCurTime() { - return dateFormat.format(new Date()); - } - - /** - * 获取当前时间 - * @return - */ - private static long getCurTimeInMills() { - return (new Date()).getTime(); - } - - /** - * 时间转换 - * @param time - * @return - */ - public static long convertTimeToMills(String time) { - long result = 0L; - try { - result = dateFormat.parse(time).getTime(); - } catch (ParseException e) { - ARE.getLog().error("时间转换失败!", e); - } - return result; - } - - /** - * 计算时间间隔 - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return - */ - public static long getTimeInterval(String beginTime, String endTime) { - return convertTimeToMills(endTime) - convertTimeToMills(beginTime); - } - - /** - * 计算指定时间到现在的时间间隔 - * @param lastTime - * @return - */ - public static long getDuraTime(String lastTime) { - return getCurTimeInMills() - convertTimeToMills(lastTime); - } -} diff --git a/src_app/apx/com/amarsoft/als/base/util/UserUtil.java b/src_app/apx/com/amarsoft/als/base/util/UserUtil.java deleted file mode 100644 index 9e2305ef9..000000000 --- a/src_app/apx/com/amarsoft/als/base/util/UserUtil.java +++ /dev/null @@ -1,22 +0,0 @@ -package apx.com.amarsoft.als.base.util; - -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class UserUtil { - - private ASUser user; - - public ASUser getUser() { - return user; - } - - public void setUser(ASUser user) { - this.user = user; - } - - public UserUtil(String sUserId, Transaction sqlca) throws Exception { - this.user = ASUser.getUser( SpecialTools.real2Amarsoft(sUserId), sqlca); - } -} diff --git a/src_app/apx/com/amarsoft/als/base/util/ValidateRestfulParamUtil.java b/src_app/apx/com/amarsoft/als/base/util/ValidateRestfulParamUtil.java deleted file mode 100644 index d53668463..000000000 --- a/src_app/apx/com/amarsoft/als/base/util/ValidateRestfulParamUtil.java +++ /dev/null @@ -1,78 +0,0 @@ -package apx.com.amarsoft.als.base.util; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; - -public class ValidateRestfulParamUtil { - - public static boolean validateParamNotBlank(String... paras) { - for (String para : paras) { - if (StringUtils.isBlank(para)) { - return false; - } - } - return true; - } - - public static boolean validateParamIsInt(String... paras) { - for (String para : paras) { - try { - Integer iCheckValue = Integer.parseInt(para); - if (iCheckValue instanceof Integer == false) { - return false; - } - } catch (NumberFormatException e) { - return false; - } - } - return true; - } - - public static boolean validateReqPara(HttpServletRequest request, - String methodName) { - switch (methodName) { - - // 获取意见接口 - case "acquisitionOpinion": - break; - // 获取详情数据接口 - case "searchBusinessDetailsProcess": - if (StringUtils.isBlank(request.getParameter("objno")) - || StringUtils.isBlank(request.getParameter("flowno")) - || StringUtils.isBlank(request.getParameter("phaseno")) - || StringUtils.isBlank(request.getParameter("groupid"))) { - return false; - } - break; - // 获取流程分组接口 - case "acquisitionGroupInfo": - if (StringUtils.isBlank(request.getParameter("flowno")) - || StringUtils.isBlank(request.getParameter("phaseno"))) { - return false; - } - break; - // 提交前 - case "submitBefore": - if (StringUtils.isBlank(request.getParameter("serialno"))) { - return false; - } - break; - // 流程退回接口 - case "backStep": - if (StringUtils.isBlank(request.getParameter("serialno"))) { - return false; - } - break; - // 流程退回接口 - case "dono": - if (StringUtils.isBlank(request.getParameter("tempindex"))) { - return false; - } - break; - default: - break; - } - return true; - } -} diff --git a/src_app/apx/com/amarsoft/als/chksce/bzsrv/ScenarioAlarmRunner.java b/src_app/apx/com/amarsoft/als/chksce/bzsrv/ScenarioAlarmRunner.java deleted file mode 100644 index 87b92bf19..000000000 --- a/src_app/apx/com/amarsoft/als/chksce/bzsrv/ScenarioAlarmRunner.java +++ /dev/null @@ -1,180 +0,0 @@ -package apx.com.amarsoft.als.chksce.bzsrv; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; - -import apx.com.amarsoft.als.chksce.model.CheckGroupResult; -import apx.com.amarsoft.als.chksce.model.CheckItemResult; -import apx.com.amarsoft.als.chksce.model.ScenarioCheckResult; -import cn.coyoteam.aweresf.model.User; - -import com.amarsoft.amarscript.AnyException; -import com.amarsoft.app.alarm.AlarmMessage; -import com.amarsoft.app.alarm.CheckItem; -import com.amarsoft.app.alarm.DefaultCheckItemRunner; -import com.amarsoft.app.alarm.DefaultScenarioContextLoader; -import com.amarsoft.app.alarm.ItemGroup; -import com.amarsoft.app.alarm.ScenarioContext; -import com.amarsoft.app.alarm.ScenarioContextLoader; -import com.amarsoft.app.alarm.StringTool; -import com.amarsoft.are.ARE; -import com.amarsoft.are.lang.StringX; -import com.amarsoft.awe.util.Transaction; - - -/** - * 风险探测,检查场景运行 - * @author cytsir - * - */ -@Path("/ScenarioAlarm") -public class ScenarioAlarmRunner { - - @GET - @Path("/run") - public ScenarioCheckResult runScenario( - @QueryParam("ScenarioNo") String scenarioNo, - @QueryParam("BizArg") String bizArg, - @QueryParam("SubTypeNo") String subTypeNo, - @Context Transaction Sqlca, - @Context User user, - @Context HttpServletRequest request) { - ScenarioCheckResult sceChkResult = new ScenarioCheckResult(); - - //加载器 - ScenarioContextLoader loader = new DefaultScenarioContextLoader(); - try { - if(StringX.isEmpty(bizArg)){ - throw new RuntimeException("自动风险探测出错,没有业务参数"); - } - bizArg += ",UserID="+user.getUserId(); - ((DefaultScenarioContextLoader)loader).init(Sqlca,scenarioNo,bizArg,subTypeNo); - } catch (Exception e) { - ARE.getLog().error("初始化风险探测场景参数出错",e); - sceChkResult.setMessage("初始化风险探测场景参数出错。"+e.getMessage()); - sceChkResult.setError(true); - return sceChkResult; - } - - ScenarioContext context = loader.getContext(); //获取下文容器 - context.setCheckItemRunner(new DefaultCheckItemRunner()); //模型运行器 - sceChkResult.setId(context.getScenario().getScenarioID()); - sceChkResult.setName(context.getScenario().getScenarioName()); - sceChkResult.setError(false); - - ARE.getLog().debug("业务场景:"+scenarioNo); - ARE.getLog().debug("传入业务参数:"+bizArg); - - List gList0 = context.getScenario().getGroupList(); - List gList = new ArrayList(); - - //根据运行条件进行预处理,分组下检查项检查条件均没通过,则不显示该分组 - for(int i=0;i ckList0 = group.getCheckItemList(); - List ckList1 = new ArrayList(); //存放检条件查通过的,允许运行的检查项 - for(int j=0;j0){ - boolean bCondition = false; - try { - bCondition = StringTool.runAmarScript(Sqlca, sCondition, context.getParameter()).booleanValue(); - } catch (AnyException e) { - String errMsg = "解析检查项["+ckItem.getItemID()+"]条件表达式["+sCondition+"]出错"; - ARE.getLog().error(errMsg,e); - sceChkResult.setMessage(errMsg); - sceChkResult.setError(true); - return sceChkResult; - } catch (Exception e) { - String errMsg = "运行检查项["+ckItem.getItemID()+"]条件表达式["+sCondition+"]出错"; - ARE.getLog().error(errMsg,e); - sceChkResult.setMessage(errMsg); - sceChkResult.setError(true); - return sceChkResult; - } - if(!bCondition)continue; - else ckList1.add(ckItem); - }else{ - ckList1.add(ckItem); - } - } - if(ckList1.size()>0){ //重组分组 - group.getCheckItemList().clear(); - group.getCheckItemList().addAll(ckList1); - gList.add(group); - } - - //运行每一个检查项 - for(CheckItem chkItem:ckList1){ - chkGrpResult.getItems().add(parseChkItem(context,chkItem,Sqlca)); - } - } - - return sceChkResult; - } - - private CheckItemResult parseChkItem(ScenarioContext context,CheckItem chkItem, Transaction Sqlca){ - CheckItemResult chkItemResult = new CheckItemResult(); - //构建检查结果项 - chkItemResult.setId(chkItem.getItemID()); - chkItemResult.setName(chkItem.getItemName()); - chkItemResult.setDescribe(chkItem.getItemDescribe()); - //运行检查项 - try { - String sPassMessage = chkItem.getPassMessage(); - String sNoPassMessage = chkItem.getNoPassMessage(); - if(sPassMessage == null) sPassMessage = ""; - if(sNoPassMessage == null) sNoPassMessage = ""; - AlarmMessage am = (AlarmMessage)context.getCheckItemRunner().run(Sqlca, chkItem); - StringBuffer sbMessage = new StringBuffer(); - String sMessage = ""; - for(int j=0;j 5){ - sMessage = sbMessage.substring(0,sbMessage.length()-5); - }else{ - sMessage = ""; - } - - //如果执行后,返回的消息为空 - // 1.如果通过,则消息取配置的通过的提示消息 - // 2.如果未通过,则取配置的未通过的提示消息 - if(sMessage.equals("")){ - if(am.isPass()) sMessage = sPassMessage; - else sMessage = sNoPassMessage; - } - chkItemResult.setMessage(sMessage); - chkItemResult.setPassed(am.isPass()); //设置本检查项是否通过 - //如果没有通过,且是禁止办理的情况,则设置不为合格 - //10 禁止办理,20 提示 - if(!am.isPass()&&"10".equals(chkItem.getNoPassDeal())){ - chkItemResult.setAccepted(false); - }else if(!am.isPass()&&"20".equals(chkItem.getNoPassDeal())){ - chkItemResult.setAccepted(true); - }else{ - chkItemResult.setAccepted(true); - } - } catch (Exception e) { - chkItemResult.setPassed(false); - chkItemResult.setAccepted(false); - chkItemResult.setMessage("运行出错。出错消息:"+e.getMessage()); - ARE.getLog().error("检查项["+chkItemResult.getId()+"]运行出错",e); - return chkItemResult; - } - return chkItemResult; - } -} diff --git a/src_app/apx/com/amarsoft/als/chksce/model/CheckGroupResult.java b/src_app/apx/com/amarsoft/als/chksce/model/CheckGroupResult.java deleted file mode 100644 index 131588987..000000000 --- a/src_app/apx/com/amarsoft/als/chksce/model/CheckGroupResult.java +++ /dev/null @@ -1,65 +0,0 @@ -package apx.com.amarsoft.als.chksce.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * 检查分组结果对象 - * @author EX-YANGSONG001 - * - */ -public class CheckGroupResult implements Serializable,Cloneable{ - - private static final long serialVersionUID = 8295511910293702439L; - - private String id; - private String name; - private List items; - - public CheckGroupResult(){ - items = new ArrayList(); - } - - /** - * @return 获取分组ID - */ - public String getId() { - return id; - } - /** - * @param 设置分组ID - */ - public void setId(String id) { - this.id = id; - } - /** - * @return 获取分组名称 - */ - public String getName() { - return name; - } - /** - * @param 设置分组名称 - */ - public void setName(String name) { - this.name = name; - } - /** - * @return 获取本分组内检查结果列表 - */ - public List getItems() { - return items; - } - - /** - * 本检查组是否合格 - * @return - */ - public boolean isAccepted(){ - for(CheckItemResult item:items){ - if(!item.isAccepted())return false;//只要有任意一项检查不合格,则判定为不合格 - } - return true; - } -} diff --git a/src_app/apx/com/amarsoft/als/chksce/model/CheckItemResult.java b/src_app/apx/com/amarsoft/als/chksce/model/CheckItemResult.java deleted file mode 100644 index b4becad56..000000000 --- a/src_app/apx/com/amarsoft/als/chksce/model/CheckItemResult.java +++ /dev/null @@ -1,93 +0,0 @@ -package apx.com.amarsoft.als.chksce.model; - -import java.io.Serializable; - -/** - * 检查项运行结果记录Bean - * @author EX-YANGSONG001 - * - */ -public class CheckItemResult implements Serializable,Cloneable{ - - private static final long serialVersionUID = 8295511910293702439L; - private String id; - private String name; - private String describe; - private String message; - private boolean passed; - private boolean accepted; - /** - * @return 检查项ID - */ - public String getId() { - return id; - } - /** - * @param 设置检查项ID - */ - public void setId(String id) { - this.id = id; - } - /** - * @return 检查项名称 - */ - public String getName() { - return name; - } - /** - * @param 设置检查项名称 - */ - public void setName(String name) { - this.name = name; - } - /** - * @return 检查返回消息 - */ - public String getMessage() { - return message; - } - /** - * @param 设置检查返回消息 - */ - public void setMessage(String message) { - this.message = message; - } - /** - * @return 检查项描述 - */ - public String getDescribe() { - return describe; - } - /** - * @param 设置检查项描述 - */ - public void setDescribe(String describe) { - this.describe = describe; - } - /** - * @return 本项检查是否通过 - */ - public boolean isPassed() { - return passed; - } - /** - * @param 设置本项检查是否通过 - */ - public void setPassed(boolean passed) { - this.passed = passed; - } - /** - * @return the accepted 检查项是否合格(检查不合格,允许放行的,算检查通过) - */ - public boolean isAccepted() { - return accepted; - } - /** - * @param 设置检查项是否合格(检查不合格,允许放行的,算检查通过) - */ - public void setAccepted(boolean accepted) { - this.accepted = accepted; - } - -} - diff --git a/src_app/apx/com/amarsoft/als/chksce/model/ScenarioCheckResult.java b/src_app/apx/com/amarsoft/als/chksce/model/ScenarioCheckResult.java deleted file mode 100644 index df3a0aaab..000000000 --- a/src_app/apx/com/amarsoft/als/chksce/model/ScenarioCheckResult.java +++ /dev/null @@ -1,86 +0,0 @@ -package apx.com.amarsoft.als.chksce.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author EX-YANGSONG001 - * 场景检查结果 - */ -public class ScenarioCheckResult { - private String id; - private String name; - private boolean error = false; - private String message; - private List groups; - - public ScenarioCheckResult(){ - groups = new ArrayList(); - } - - /** - * @return 获取场景ID - */ - public String getId() { - return id; - } - /** - * @param 设置检查场景ID - */ - public void setId(String id) { - this.id = id; - } - /** - * @return 场景名称 - */ - public String getName() { - return name; - } - /** - * @param 设置场景名称 - */ - public void setName(String name) { - this.name = name; - } - /** - * @return the 检查是否通过(根据全部检查结果进行判定) - */ - public boolean isAccepted() { - for(CheckGroupResult group:groups){ - if(!group.isAccepted())return false; - } - return true; - } - /** - * @return 是否发生异常情况 - */ - public boolean isError() { - return error; - } - /** - * @param 设置是否发生异常情况 - */ - public void setError(boolean error) { - this.error = error; - } - /** - * @return 消息 - */ - public String getMessage() { - return message; - } - /** - * @param 设置消息 - */ - public void setMessage(String message) { - this.message = message; - } - - /** - * @return 获取场景中的所有分组 - */ - public List getGroups() { - return groups; - } - -} diff --git a/src_app/apx/com/amarsoft/als/customer/bzsrv/CustomerManagerController.java b/src_app/apx/com/amarsoft/als/customer/bzsrv/CustomerManagerController.java deleted file mode 100644 index b09d49fce..000000000 --- a/src_app/apx/com/amarsoft/als/customer/bzsrv/CustomerManagerController.java +++ /dev/null @@ -1,205 +0,0 @@ -package apx.com.amarsoft.als.customer.bzsrv; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import apx.com.amarsoft.als.customer.service.CustomerMangerService; -import apx.com.amarsoft.als.customer.service.impl.CustomerMangerServiceImpl; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -@Path("/customer/manager") -public class CustomerManagerController { - // 日志对象 - private static Log logger = ARE.getLog(); - // 客户管理服务 - private CustomerMangerService service = new CustomerMangerServiceImpl(); - - @Path("/query/customer/list") - @POST - public Map searchCustomerList( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 客户列表查询接口"); - return service.searchCustomerList(request, sqlca, tx); - } - - @Path("/init/customer/data") - @GET - public Map initCustomerData( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 初始化添加页面元素数据接口"); - return service.initCustomerData(request, sqlca, tx); - } - - @Path("/load/nationcode") - @GET - public Map loadNationcode( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 加载证件国别接口"); - return service.loadNationcode(request, sqlca, tx); - } - - @Path("/load/province/city/area") - @GET - public Map getDowntown(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道: 客户管理 >> 加载所属省市区接口"); - return service.getDowntown(request, sqlca, tx); - } - - @Path("/load/unit/kind") - @GET - public Map getUnitKind(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道: 客户管理 >> 加载单位所属行业接口"); - return service.getUnitKind(request, sqlca, tx); - } - - @Path("/add/customer") - @POST - public Map addCustomer(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道: 客户管理 >> 添加客户接口"); - return service.addCustomer(request, sqlca, tx); - } - - @Path("/operation/customer") - @POST - public Map operationCustomer( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 操作CUSTOMER_PERSON接口"); - return service.operationCustomer(request, sqlca, tx); - } - - @Path("/operation/orther/cert") - @POST - public Map operationOtherCert( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 操作CUSTOMER_CERT接口"); - return service.operationOtherCert(request, sqlca, tx); - } - - @Path("/operation/address") - @POST - public Map operationAddress( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 操作CUSTOMER_ADDRESS接口"); - return service.operationAddress(request, sqlca, tx); - } - - @Path("/operation/telphone") - @POST - public Map operationTelphone( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 操作CUSTOMER_TEL接口"); - return service.operationTelphone(request, sqlca, tx); - } - - @Path("/operation/account") - @POST - public Map operationAccount( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 操作CUSTOMER_ACCOUNT接口"); - return service.operationAccount(request, sqlca, tx); - } - - @Path("/operation/family") - @POST - public Map operationFamily( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 操作CUSTOMER_FAMLIY接口"); - return service.operationFamily(request, sqlca, tx); - } - - @Path("/find/cert") - @GET - public Map findCert(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道: 客户管理 >> 查询证件接口"); - return service.findCert(request, sqlca, tx); - } - - @Path("/find/customer/base/info") - @GET - public Map findCustBaseInfo( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 查询客户基本信息接口"); - return service.findCustBaseInfo(request, sqlca, tx); - } - - @Path("/find/customer/doc") - @GET - public Map findCustomerDocList( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 查询客户文件清单列表接口"); - return service.findCustomerDocList(request, sqlca, tx); - } - - @Path("/upload/atts/customer/att") - @POST - public Map uploadCustomerAtt(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道: 客户管理 >> 上传接口 版本6"); - return service.uploadAtts6(request, sqlca, tx); - } - - @Path("/find/customer/visit/record") - @GET - public Map findCustomerVisitRecordList( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 客户拜访记录列表接口"); - return service.findCustomerVisitRecordList(request, sqlca, tx); - } - - @Path("/upload/atts/visit/att") - @POST - public Map uploadVisitAtt(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道: 客户管理 >> 上传接口 版本6"); - return service.uploadFile(request, sqlca, tx); - } - - @Path("/operation/visit/record") - @POST - public Map operationVisitRecord( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 操作CUSTOMER_VISIT_RECORD接口"); - return service.operationVisitRecord(request, sqlca, tx); - } - - @Path("/find/customer/history/record") - @GET - public Map findCustomerHistoryRecordList( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 客户管理 >> 客户 交易记录列表接口"); - return service.findCustomerHistoryRecordList(request, sqlca, tx); - } -} diff --git a/src_app/apx/com/amarsoft/als/customer/constant/CustomerConstant.java b/src_app/apx/com/amarsoft/als/customer/constant/CustomerConstant.java deleted file mode 100644 index ae15a5955..000000000 --- a/src_app/apx/com/amarsoft/als/customer/constant/CustomerConstant.java +++ /dev/null @@ -1,170 +0,0 @@ -package apx.com.amarsoft.als.customer.constant; - -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class CustomerConstant { - public final static String CUSTOMER_TYPE_PERSON = "person"; - public final static String CUSTOMER_TYPE_PARTNER_PERSON = "partnerPerson"; - - public final static String CUSTOMER_PAGE_TYPE_CUST = "addCust"; - public final static String CUSTOMER_PAGE_TYPE_CERT = "otherCert"; - public final static String CUSTOMER_PAGE_TYPE_ADDRESS = "CustomerAddress"; - public final static String CUSTOMER_PAGE_TYPE_TEL = "CustomerTelInfo"; - public final static String CUSTOMER_PAGE_TYPE_ACCOUNT = "CustomerAccount"; - public final static String CUSTOMER_PAGE_TYPE_FAMILY = "CustomerFamily"; - public final static String CUSTOMER_PAGE_TYPE_Visit_RECORD = "CustomerVisitRecord"; - /** - * 客户来源 - * - * @author jiaji.liu - * - */ - public static enum CUST_SOURCE { - custrecommend("custrecommend", "客户推荐"), selfdev("selfdev", "自行开发"), vndrrecommend( - "vndrrecommend", "供应商推荐"); - public String itemNo; - public String itemName; - - private CUST_SOURCE(String itemNo, String itemName) { - this.itemNo = itemNo; - this.itemName = itemName; - } - } - - /** - * 所属行业 - * - * @author jiaji.liu - * - */ - public static enum CUST_KIND { - Agriculture("Agriculture", "农业"), cateringindustry("cateringindustry", - "餐饮服务"), chemical("chemical", "化工"), Coalindustry( - "Coalindustry", "煤化工"), Coalmine("Coalmine", "煤矿"), communications( - "communications", "交通运输"), economize("economize", "节能减排"), Education( - "Education", "教育"), industry("industry", "工业装备"), Logistics( - "Logistics", "物流"), machinery("machinery", "工程机械"), medical( - "medical", "医疗"), newenergy("newenergy", "新能源"), other("other", - "其它"); - public String itemNo; - public String itemName; - - private CUST_KIND(String itemNo, String itemName) { - this.itemNo = itemNo; - this.itemName = itemName; - } - } - - /** - * 证件类型 - * - * @author jiaji.liu - * - */ - public static enum CERT_TYPE { - ENT01("Ent01", "社会统一信用代码"), ENT02("Ent02", "组织机构代码证"), ENT03("Ent03", - "其他证件"), IND01("Ind01", "身份证"), IND02("Ind02", "户口簿"), IND03( - "Ind03", "护照"), IND04("Ind04", "军官证"), IND05("Ind05", "士兵证"), IND06( - "Ind06", "港澳居民来往内地通行证"), IND07("Ind07", "台湾同胞来往内地通行证"), IND08( - "Ind08", "临时身份证"), IND09("Ind09", "外国人居留证"), IND10("Ind10", - "警官证"), IND11("Ind11", "其他个人证件"), IND12("Ind12", "香港身份证"), IND13( - "Ind13", "澳门身份证"), IND14("Ind14", "台湾身份证"); - public String itemNo; - public String itemName; - - private CERT_TYPE(String itemNo, String itemName) { - this.itemNo = itemNo; - this.itemName = itemName; - } - - private CERT_TYPE(String itemNo) { - this.itemNo = itemNo; - } - } - - /** - * 客户类型1 - * - * @author jiaji.liu - * - */ - public static enum CUST_TYPE { - legal("03", "自然人"), natural("01", "法人"); - public String itemNo; - public String itemName; - - private CUST_TYPE(String itemNo, String itemName) { - this.itemNo = itemNo; - this.itemName = itemName; - } - } - - /** - * 客户类型2 - * - * @author jiaji.liu - * - */ - public static enum CUSTOMER_TYPE { - assuror("cust_type.assuror", "担保人"), cust("cust_type.cust", "承租人"), guarantor( - "cust_type.guarantor", "抵押人"), manufacturer( - "cust_type.manufacturer", "制造商"), othertype( - "cust_type.othertype", "其他合作方"), vndr("cust_type.vndr", "供应商"); - public String itemNo; - public String itemName; - - private CUSTOMER_TYPE(String itemNo, String itemName) { - this.itemNo = itemNo; - this.itemName = itemName; - } - } - - /** - * 客户实体类 - * - * @author jiaji.liu - * - */ - public static enum CUSTOMER_TABLE { - TABLE_CUSTOMER_INFO("jbo.app.tenwa.customer.CUSTOMER_INFO"), TABLE_CUSTOMER_CERT( - "jbo.app.tenwa.customer.CUSTOMER_CERT"), TABLE_CUSTOMER_TYPE( - "jbo.app.tenwa.customer.CUSTOMER_TYPE"), TABLE_CUSTOMER_ATTRIBUTION( - "jbo.app.tenwa.customer.CUSTOMER_ATTRIBUTION"), TALBE_CUSTOMER_PERSON( - "jbo.app.tenwa.customer.CUSTOMER_PERSON"), TALBE_CUSTOMER_COMPANY( - "jbo.app.tenwa.customer.CUSTOMER_COMPANY"), TABLE_CUSTOMER_ADDRESS( - "jbo.app.tenwa.customer.CUSTOMER_ADDRESS"), TABLE_CUSTOMER_TEL( - "jbo.app.tenwa.customer.CUSTOMER_TEL"), TABLE_CUSTOMER_FAMILY( - "jbo.app.tenwa.customer.CUSTOMER_FAMILY"), TABLE_CUSTOMER_ACCOUNT( - "jbo.app.tenwa.customer.CUSTOMER_ACCOUNT"), TABLE_CUSTOMER_VISIT_RECORD( - "jbo.app.tenwa.customer.CUSTOMER_VISIT_RECORD"); - public String className; - - private CUSTOMER_TABLE(String className) { - this.className = className; - } - } - - /** - * 客户状态 - * - * @author jiaji.liu - * - */ - public static enum CUST_STATUS { - POTENTIAL("status01", "潜在"), NORMAL("status02", "正式"), ABANDONED( - "status03", "废弃"), DRAFT("status04", "草稿"); - public String itemNo; - public String itemName; - - private CUST_STATUS(String itemNo, String itemName) { - this.itemNo = itemNo; - this.itemName = itemName; - } - } - - public ASUser oCurUser(String sUserId, Transaction sqlca) throws Exception { - return ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), sqlca); - } -} diff --git a/src_app/apx/com/amarsoft/als/customer/model/GlobalModel.java b/src_app/apx/com/amarsoft/als/customer/model/GlobalModel.java deleted file mode 100644 index 700977ec4..000000000 --- a/src_app/apx/com/amarsoft/als/customer/model/GlobalModel.java +++ /dev/null @@ -1,64 +0,0 @@ -package apx.com.amarsoft.als.customer.model; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; - -import apx.com.amarsoft.als.base.util.CheckTokenSessionUtil; -import cn.coyoteam.aweresf.consts.SessionConst; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.RuntimeContext; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class GlobalModel { - // 日志对象 - private static Log logger = ARE.getLog(); - - private String globalSUserId; - private String globalSCustomerId; - - public GlobalModel() { - this.globalSCustomerId = null; - this.globalSUserId = null; - } - - public String getGlobalSUserId() { - return globalSUserId; - } - - public String getGlobalSCustomerId() { - return globalSCustomerId; - } - - public boolean checkSession(HttpServletRequest request, Transaction sqlca) { - this.globalSUserId = ""; - CheckTokenSessionUtil util = new CheckTokenSessionUtil(); - boolean flag = util.validataToken(request, sqlca); - if (!flag) { - request.getSession().setAttribute(SessionConst.KEY_TOKEN_SESSION, - null); - request.getSession().setAttribute(SessionConst.KEY_TOKEN, null); - request.getSession().setAttribute(SessionConst.KEY_CUR_ARC, null); - request.getSession().invalidate(); - logger.debug("CheckTokenSessionUtil >> validataToken >. token 失效"); - } else { - RuntimeContext CurARC = new RuntimeContext(); - CurARC = (RuntimeContext) request.getSession().getAttribute( - SessionConst.KEY_CUR_ARC); - ASUser curUser = CurARC.getUser(); - this.globalSUserId = curUser.getUserID(); - } - return flag; - } - - public boolean checkMainId(HttpServletRequest request) { - this.globalSCustomerId = ""; - this.globalSCustomerId = request.getParameter("customerid"); - if (StringUtils.isBlank(this.globalSCustomerId)) - return false; - return true; - } -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/CustomerAccountService.java b/src_app/apx/com/amarsoft/als/customer/service/CustomerAccountService.java deleted file mode 100644 index 642ec1629..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/CustomerAccountService.java +++ /dev/null @@ -1,22 +0,0 @@ -package apx.com.amarsoft.als.customer.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface CustomerAccountService { - /** - * 操作:(保存,更新)银行账户 CUSTOMER_ACCOUNT - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map operationAccount(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/CustomerAddressService.java b/src_app/apx/com/amarsoft/als/customer/service/CustomerAddressService.java deleted file mode 100644 index 73ca797b8..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/CustomerAddressService.java +++ /dev/null @@ -1,22 +0,0 @@ -package apx.com.amarsoft.als.customer.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface CustomerAddressService { - /** - * 操作: 联系地址操作 CUSTOMER_ADDRESS - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map operationAddress(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/CustomerBaseService.java b/src_app/apx/com/amarsoft/als/customer/service/CustomerBaseService.java deleted file mode 100644 index 2a54b337e..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/CustomerBaseService.java +++ /dev/null @@ -1,98 +0,0 @@ -package apx.com.amarsoft.als.customer.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface CustomerBaseService { - - /** - * 查询: 客户列表信息 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map searchCustomerList(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; - - /** - * 查询: 各洲 各国下拉选择 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map loadNationcode(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; - - /** - * 查询: 国内各省各市各区下拉选择 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map getDowntown(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; - - /** - * 查询:加载单位所属行业接口: CustomerBaseService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map getUnitKind(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 加载添加PAGE数据元素 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map initCustomerData(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 通过客户ID 找到证据 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map findCert(HttpServletRequest request, Transaction sqlca, - JBOTransaction tx) throws Exception; - - /** - * 通过客户ID 找到基本信息 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map findCustBaseInfo(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/CustomerCertService.java b/src_app/apx/com/amarsoft/als/customer/service/CustomerCertService.java deleted file mode 100644 index 95f71e153..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/CustomerCertService.java +++ /dev/null @@ -1,21 +0,0 @@ -package apx.com.amarsoft.als.customer.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface CustomerCertService { - /** - * 保存更新: 其他证件操作 - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map operationOtherCert(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/CustomerDocService.java b/src_app/apx/com/amarsoft/als/customer/service/CustomerDocService.java deleted file mode 100644 index 5cd08e337..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/CustomerDocService.java +++ /dev/null @@ -1,35 +0,0 @@ -package apx.com.amarsoft.als.customer.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface CustomerDocService { - /** - * 查询客户资料列表 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - public Map findCustomerDocList( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception; - - /** - * 上传客户资料 - * - * @param request - * @param sqlca - * @param tx - * @return - */ - public Map uploadAtts6(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/CustomerFamilyService.java b/src_app/apx/com/amarsoft/als/customer/service/CustomerFamilyService.java deleted file mode 100644 index c81c071ac..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/CustomerFamilyService.java +++ /dev/null @@ -1,22 +0,0 @@ -package apx.com.amarsoft.als.customer.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface CustomerFamilyService { - /** - * 操作(保存,更新)家庭成员 CUSTOMER_FAMLIY - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map operationFamily(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/CustomerHistoryRecordService.java b/src_app/apx/com/amarsoft/als/customer/service/CustomerHistoryRecordService.java deleted file mode 100644 index f2a398a76..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/CustomerHistoryRecordService.java +++ /dev/null @@ -1,23 +0,0 @@ -package apx.com.amarsoft.als.customer.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface CustomerHistoryRecordService { - /** - * 客户交易记录列表 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - public Map findCustomerHistoryRecordList( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/CustomerMangerService.java b/src_app/apx/com/amarsoft/als/customer/service/CustomerMangerService.java deleted file mode 100644 index 5f4378381..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/CustomerMangerService.java +++ /dev/null @@ -1,268 +0,0 @@ -package apx.com.amarsoft.als.customer.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface CustomerMangerService { - - /** - * 查询:客户主表列表查询: CustomerBaseService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map searchCustomerList(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 查询:初始化(添加页面)page元素接口: CustomerBaseService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map initCustomerData(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 操作:添加客户主表记录: CustomerBusinessService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map addCustomer(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 查询:加载 七大洲 洲内国家 接口: CustomerBaseService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map loadNationcode(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 查询:加载所属省市区接口: CustomerBaseService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map getDowntown(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; - - /** - * 查询:加载单位所属行业接口: CustomerBaseService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map getUnitKind(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 操作:(添加,更新)CUSTOMER_PERSON :CustomerBusinessService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map operationCustomer(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 操作:(添加,更新)CUSTOMER_CERT :CustomerCertService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map operationOtherCert(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 操作:(添加,更新)CUSTOMER_ADDRESS :CustomerCertService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map operationAddress(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 操作:(添加,更新)CUSTOMER_TEL :CustomerTelService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - public Map operationTelphone(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; - - /** - * 操作:(添加,更新)CUSTOMER_ACCOUNT :CustomerAccountService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - public Map operationAccount(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; - - /** - * 操作:(添加,更新)CUSTOMER_FAMILY :CustomerFamilyService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - public Map operationFamily( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception; - - /** - * 查询:通过客户ID查询证件信息:CustomerBaseService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map findCert(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 查询:通过客户ID查询基本信息:CustomerBaseService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map findCustBaseInfo(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 查询:客户文件清单列表:DoclibararyService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map findCustomerDocList( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception; - - /** - * 客户资料上传 - * - * @param request - * @param sqlca - * @param tx - * @return - */ - Map uploadAtts6(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 客户拜访记录列表 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map findCustomerVisitRecordList( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception; - - /** - * 操作:(添加,更新)CUSTOMER_VISIT_RECORD :CustomerVisitRecordService - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - public Map operationVisitRecord( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception; - - /** - * 上传文件 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map uploadFile(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 客户交易记录列表 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map findCustomerHistoryRecordList( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/CustomerPersonService.java b/src_app/apx/com/amarsoft/als/customer/service/CustomerPersonService.java deleted file mode 100644 index d3dc1ea93..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/CustomerPersonService.java +++ /dev/null @@ -1,33 +0,0 @@ -package apx.com.amarsoft.als.customer.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface CustomerPersonService { - - /** - * 添加: 客户 - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map addCustomer(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; - /** - * 保存/更新: 客户信息操作 - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map operationCustomer(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; - -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/CustomerTelService.java b/src_app/apx/com/amarsoft/als/customer/service/CustomerTelService.java deleted file mode 100644 index 7e9cba45c..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/CustomerTelService.java +++ /dev/null @@ -1,22 +0,0 @@ -package apx.com.amarsoft.als.customer.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface CustomerTelService { - /** - * 操作(保存,更新)联系电话 CUSTOMER_TEL - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map operationTelphone(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/CustomerVisitRecordService.java b/src_app/apx/com/amarsoft/als/customer/service/CustomerVisitRecordService.java deleted file mode 100644 index 8e8924ae5..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/CustomerVisitRecordService.java +++ /dev/null @@ -1,51 +0,0 @@ -package apx.com.amarsoft.als.customer.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface CustomerVisitRecordService { - - /** - * 客户拜访记录列表 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map findCustomerVisitRecordList( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception; - - /** - * 操作(保存,更新)拜访记录 CUSTOMER_VISIT_RECORD - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map operationVisitRecord( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception; - - /** - * 上传文件 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map uploadFile(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerAccountServiceImpl.java b/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerAccountServiceImpl.java deleted file mode 100644 index 958c19f56..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerAccountServiceImpl.java +++ /dev/null @@ -1,216 +0,0 @@ -package apx.com.amarsoft.als.customer.service.impl; - -import java.net.URLDecoder; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.DateUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.customer.constant.CustomerConstant; -import apx.com.amarsoft.als.customer.model.GlobalModel; -import apx.com.amarsoft.als.customer.service.CustomerAccountService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class CustomerAccountServiceImpl implements CustomerAccountService { - // 日志对象 - private static Log logger = ARE.getLog(); - - private GlobalModel GlobalModel; - - // begin 客户账户全局变量 - private String sCustomerId; - private String sId; - private String sAccount; - private String sIs_main; - private String sBank_name; - private String sAcc_number; - private String sAcc_info; - private String sInputtime; - private String sUpdatetime; - private String sType; - - // end - - private Map initCheck(HttpServletRequest request, - Transaction sqlca) { - this.GlobalModel = new GlobalModel(); - if (!this.GlobalModel.checkMainId(request)) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - return null; - } - - private void initGlobal(Map fieldMap) { - this.sCustomerId = this.GlobalModel.getGlobalSCustomerId(); - this.sId = fieldMap.get("id") == null ? "" : fieldMap.get("id") - .toString(); - this.sAccount = fieldMap.get("account") == null ? "" : fieldMap.get( - "account").toString(); - this.sIs_main = fieldMap.get("is_main") == null ? "" : fieldMap.get( - "is_main").toString(); - this.sBank_name = fieldMap.get("bank_name") == null ? "" : fieldMap - .get("bank_name").toString(); - this.sAcc_number = fieldMap.get("acc_number") == null ? "" : fieldMap - .get("acc_number").toString(); - this.sAcc_info = fieldMap.get("acc_info") == null ? "" : fieldMap.get( - "acc_info").toString(); - this.sInputtime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sUpdatetime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sType = fieldMap.get("type") == null ? "" : fieldMap.get("type") - .toString(); - this.sCustomerId = this.GlobalModel.getGlobalSCustomerId(); - } - - @SuppressWarnings({ "unchecked", "deprecation" }) - public Map operationAccount(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - String sUserId = (String) request.getSession().getAttribute("userid"); - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } - } - initGlobal(fieldMap); - switch (this.sType) { - case CustomerConstant.CUSTOMER_TYPE_PERSON: - return operationCustomerPersonAccount(request, sqlca, tx, fieldMap, - oCurUser); - } - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - private Map operationCustomerPersonAccount( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx, - Map fieldMap, ASUser oCurUser) throws Exception { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_ACCOUNT.className); - tx.join(bom); - if ("".equals(sId)) { - beforeInsert(tx, sIs_main, sCustomerId); - try { - BizObject bo = bom.newObject(); - bo.setAttributeValue("acc_number", sAcc_number); - bo.setAttributeValue("bank_name", sBank_name); - bo.setAttributeValue("account", sAccount); - bo.setAttributeValue("is_main", sIs_main); - bo.setAttributeValue("acc_info", sAcc_info); - bo.setAttributeValue("customerid", sCustomerId); - bo.setAttributeValue("inputtime", sInputtime); - bo.setAttributeValue("inputuserid", oCurUser.getUserID()); - bo.setAttributeValue("inputorgid", oCurUser.getOrgID()); - bom.saveObject(bo); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "保存成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "保存失败"); - return ReturnMapUtil.getReturnMap(); - } - } else { - beforeUpdate(tx, sId, sIs_main, sCustomerId); - try { - String sSql = "update o set o.updatetime=:updatetime, o.updateorgid=:updateorgid, o.updateuserid=:updateuserid, "; - sSql += "o.acc_number=:acc_number, o.bank_name=:bank_name, o.account=:account, o.is_main=:is_main, o.acc_info=:acc_info "; - sSql += "where o.id=:id"; - BizObjectQuery boq = bom.createQuery(sSql); - boq.setParameter("updatetime", sUpdatetime); - boq.setParameter("updateorgid", oCurUser.getOrgID()); - boq.setParameter("updateuserid", oCurUser.getUserID()); - boq.setParameter("acc_number", sAcc_number); - boq.setParameter("bank_name", sBank_name); - boq.setParameter("account", sAccount); - boq.setParameter("is_main", sIs_main); - boq.setParameter("acc_info", sAcc_info); - boq.setParameter("id", sId); - boq.executeUpdate(); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "编辑成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "编辑失败"); - return ReturnMapUtil.getReturnMap(); - } - } - } - - private void beforeInsert(JBOTransaction tx, String sIs_main, - String sCustomerid) throws Exception { - if ("yes".equals(sIs_main)) { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_ACCOUNT.className); - tx.join(bom); - // 将当前客户之前所有账户设置为非主账户 - BizObjectQuery boq = bom - .createQuery( - "update O set is_main = 'no' where customerid=:customerid ") - .setParameter("customerid", sCustomerid); - boq.executeUpdate(); - } - } - - private void beforeUpdate(JBOTransaction tx, String sId, String sIs_main, - String sCustomerid) throws Exception { - // 修改前判断是否主账户,若为主账户则其它账户都设为非主账户 - // 如果是否主账户为是 - if ("yes".equals(sIs_main)) { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_ACCOUNT.className); - tx.join(bom); - // 先将当前客户所有账户设置为非主账户 - BizObjectQuery boq = bom - .createQuery( - "update O set is_main = 'no' where customerid=:customerid ") - .setParameter("customerid", sCustomerid); - boq.executeUpdate(); - // 然后将当前账户设置为主账户 - BizObjectQuery boq1 = bom.createQuery( - "update O set is_main = 'yes' where id=:id ").setParameter( - "id", sId); - boq1.executeUpdate(); - } - } -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerAddressServiceImpl.java b/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerAddressServiceImpl.java deleted file mode 100644 index 061e20305..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerAddressServiceImpl.java +++ /dev/null @@ -1,215 +0,0 @@ -package apx.com.amarsoft.als.customer.service.impl; - -import java.net.URLDecoder; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.DateUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.customer.constant.CustomerConstant; -import apx.com.amarsoft.als.customer.model.GlobalModel; -import apx.com.amarsoft.als.customer.service.CustomerAddressService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class CustomerAddressServiceImpl implements CustomerAddressService { - // 日志对象 - private static Log logger = ARE.getLog(); - private GlobalModel GlobalModel; - - // begin 客户账户全局变量 - private String sCustomerId; - private String sId; - private String sAddtype; - private String sIsadd; - private String sIsnew; - private String sCountryname; - private String sProvincename; - private String sDressdetail; - private String sZipcode; - private String sInputtime; - private String sUpdatetime; - private String sType; - - // end - - private void initGlobal(Map fieldMap) { - - this.sCustomerId = this.GlobalModel.getGlobalSCustomerId(); - this.sId = fieldMap.get("id") == null ? "" : fieldMap.get("id") - .toString(); - this.sAddtype = fieldMap.get("addtype") == null ? "" : fieldMap.get( - "addtype").toString(); - this.sIsadd = fieldMap.get("isadd") == null ? "" : fieldMap - .get("isadd").toString(); - this.sIsnew = fieldMap.get("isnew") == null ? "" : fieldMap - .get("isnew").toString(); - this.sCountryname = fieldMap.get("countryname") == null ? "" : fieldMap - .get("countryname").toString(); - this.sProvincename = fieldMap.get("provincename") == null ? "" - : fieldMap.get("provincename").toString(); - this.sDressdetail = fieldMap.get("dressdetail") == null ? "" : fieldMap - .get("dressdetail").toString(); - this.sZipcode = fieldMap.get("zipcode") == null ? "" : fieldMap.get( - "zipcode").toString(); - this.sInputtime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sUpdatetime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sType = fieldMap.get("type") == null ? "" : fieldMap.get("type") - .toString(); - this.sCustomerId = this.GlobalModel.getGlobalSCustomerId(); - } - - private Map initCheck(HttpServletRequest request, - Transaction sqlca) { - this.GlobalModel = new GlobalModel(); - if (!this.GlobalModel.checkMainId(request)) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - return null; - } - - @SuppressWarnings({ "deprecation", "unchecked" }) - public Map operationAddress(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - String sUserId = (String) request.getSession().getAttribute("userid"); - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } - } - initGlobal(fieldMap); - switch (sType) { - case CustomerConstant.CUSTOMER_TYPE_PERSON: - return operationCustomerPersonAddress(request, sqlca, tx, fieldMap, - oCurUser); - } - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - private void beforeInsert(JBOTransaction tx, String sCustomerId, - String sAddtype, String sIsNew) throws Exception { - // 获取当前客户ID - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_ADDRESS.className); - tx.join(bom); - // 判断当前新增联系地址是否最新,是则把此类型其它联系地址都设为非最新 - if (sIsNew.toString().equals("yes")) { - BizObjectQuery boq = bom - .createQuery("update O set isnew = 'no' where customerid=:customerid and addtype=:addtype"); - boq.setParameter("customerid", sCustomerId).setParameter("addtype", - sAddtype); - boq.executeUpdate(); - } - } - - /** - * 自然人操作 - * - * @param request - * @param sqlca - * @param tx - * @param fieldMap - * @return - * @throws Exception - */ - private Map operationCustomerPersonAddress( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx, - Map fieldMap, ASUser oCurUser) throws Exception { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_ADDRESS.className); - tx.join(bom); - if ("".equals(sId)) { - beforeInsert(tx, sCustomerId, sAddtype, sIsnew); - try { - BizObject bo = bom.newObject(); - bo.setAttributeValue("customerid", sCustomerId); - bo.setAttributeValue("addtype", sAddtype); - bo.setAttributeValue("isadd", sIsadd); - bo.setAttributeValue("isnew", sIsnew); - bo.setAttributeValue("country", sCountryname); - bo.setAttributeValue("province", sProvincename); - bo.setAttributeValue("dressdetail", sDressdetail); - bo.setAttributeValue("zipcode", sZipcode); - bo.setAttributeValue("inputuserid", oCurUser.getUserID()); - bo.setAttributeValue("inputorgid", oCurUser.getOrgID()); - bo.setAttributeValue("inputtime", sInputtime); - bom.saveObject(bo); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "保存成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "保存失败"); - return ReturnMapUtil.getReturnMap(); - } - } else { - try { - String sSql = "update o set o.updatetime=:updatetime, o.updateorgid=:updateorgid, o.updateuserid=:updateuserid, "; - sSql += "o.zipcode=:zipcode, o.dressdetail=:dressdetail, o.province=:province, o.country=:country, o.isnew=:isnew, o.isadd=:isadd, "; - sSql += "o.addtype=:addtype "; - sSql += "where o.id=:id"; - BizObjectQuery boq = bom.createQuery(sSql); - boq.setParameter("updatetime", sUpdatetime); - boq.setParameter("updateorgid", oCurUser.getOrgID()); - boq.setParameter("updateuserid", oCurUser.getUserID()); - boq.setParameter("zipcode", sZipcode); - boq.setParameter("dressdetail", sDressdetail); - boq.setParameter("province", sProvincename); - boq.setParameter("country", sCountryname); - boq.setParameter("isnew", sIsnew); - boq.setParameter("isadd", sIsadd); - boq.setParameter("addtype", sAddtype); - boq.setParameter("id", sId); - boq.executeUpdate(); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "编辑成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "编辑失败"); - return ReturnMapUtil.getReturnMap(); - } - } - } -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerBaseServiceImpl.java b/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerBaseServiceImpl.java deleted file mode 100644 index 3fd81123c..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerBaseServiceImpl.java +++ /dev/null @@ -1,1034 +0,0 @@ -package apx.com.amarsoft.als.customer.service.impl; - -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.lang.StringUtils; - -import apx.com.amarsoft.als.base.constant.CacheConstant; -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.constant.cache.AppAweDoCache; -import apx.com.amarsoft.als.base.constant.cache.AppCodeCache; -import apx.com.amarsoft.als.base.jbo.CustomerJbo; -import apx.com.amarsoft.als.base.jbo.impl.CustomerJboImpl; -import apx.com.amarsoft.als.base.util.BizObjectUtil; -import apx.com.amarsoft.als.base.util.DateUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.customer.constant.CustomerConstant; -import apx.com.amarsoft.als.customer.model.GlobalModel; -import apx.com.amarsoft.als.customer.service.CustomerBaseService; -import apx.com.amarsoft.als.work.flow.service.impl.BusinessDetailsServiceImpl; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; -import com.tenwa.comm.dataRightmanager.DataRightManager; -import com.tenwa.customer.cache.CustomerInfoCache; -import com.tenwa.customer.controller.comm.FindCertPersonController; -import com.tenwa.customer.controller.person.CustomerPersonCommonAction; - -public class CustomerBaseServiceImpl implements CustomerBaseService { - // 日志对象 - private static Log logger = ARE.getLog(); - CustomerJbo jbo = new CustomerJboImpl(); - - private GlobalModel GlobalModel; - private String globalSUserId; - private String globalSCustomerId; - private String sType; - - private Map initCheckSession(HttpServletRequest request, - Transaction sqlca) { - this.GlobalModel = new GlobalModel(); - this.sType = request.getParameter("type"); - this.globalSUserId = (String) request.getSession().getAttribute("userid"); - return null; - } - - private Map checkCustomerId(HttpServletRequest request, - Transaction sqlca) { - if (!this.GlobalModel.checkMainId(request)) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - this.globalSCustomerId = this.GlobalModel.getGlobalSCustomerId(); - return null; - } - - public Map findCustBaseInfo(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map checkSession = initCheckSession(request, sqlca); - if (null != checkSession) - return checkSession; - Map checkCustomerId = checkCustomerId(request, sqlca); - if (null != checkCustomerId) - return checkCustomerId; - String sCustomerId = this.globalSCustomerId; - BizObjectUtil util = new BizObjectUtil(); - BizObject person = jbo.getPersonById(tx, sCustomerId); - Map personMap = util.bizObject2Map(person, "CustomerPerson"); - BizObject customer = jbo.getCustomerById(tx, sCustomerId); - Map customerMap = util.bizObject2Map(customer, "CustomerPersonList"); - BizObject type = jbo.getTypeById(tx, sCustomerId); - Map typeMap = util.bizObject2Map(type, "APP_CUSTOMER_TYPE"); - Map body = new HashMap(); - body.put("person", personMap); - body.put("info", customerMap); - body.put("type", typeMap); -// if (person == null) { -// if (customer == null) { -// body.put("message", "500"); -// body.put("customername", ""); -// body.put("status", ""); -// body.put("custkind", ""); -// ReturnMapUtil.setReturnMap(body, -// ResultConstant.SUCCESS_RESULT_CODE, ""); -// return ReturnMapUtil.getReturnMap(); -// } -// body.put("message", "300"); -// body.put("customername", customer.getAttribute("customername").getValue()); -// body.put("status", customer.getAttribute("status").getValue()); -// body.put("custkind", customer.getAttribute("custkind").getValue()); -// } else { -// body.put("message", "200"); -// body.put("customername", person.getAttribute("FULLNAME").getValue()); -// body.put("status", person.getAttribute("status").getValue()); -// body.put("custkind", person.getAttribute("CUSTKIND").getValue()); -// } - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - public Map findCert(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map checkSession = initCheckSession(request, sqlca); - if (null != checkSession) - return checkSession; - Map checkCustomerId = checkCustomerId(request, sqlca); - if (null != checkCustomerId) - return checkCustomerId; - String sCustId = this.globalSCustomerId; - FindCertPersonController findCert = new FindCertPersonController(); - findCert.setCustomerId(sCustId); - String msg = findCert.findCert(tx); - String sItemNo = ""; - String sCertId = ""; - String sItemName = ""; - if (!",".equals(msg)) { - String[] array = msg.split(","); - if (array.length > 0) { - sItemNo = array[0]; - if (array.length > 1) { - sCertId = array[1]; - } else { - sCertId = ""; - } - sItemName = sItemNo == null ? "" : CustomerConstant.CERT_TYPE - .valueOf(sItemNo.toUpperCase()).itemName; - } - } - Map body = new HashMap(); - body.put("itemno", sItemNo); - body.put("itemname", sItemName); - body.put("certid", sCertId); - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - public Map initCustomerData(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheckSession(request, sqlca); - if (initCheck != null) - return initCheck; - String sUserId = globalSUserId; - String sType = this.sType; - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - switch (sType) { - // 自然人信息列表 - case CustomerConstant.CUSTOMER_TYPE_PERSON: - logger.info("获取自然人信息列表"); - return initPersonCustomerData(oCurUser, request, sqlca, tx); - case CustomerConstant.CUSTOMER_TYPE_PARTNER_PERSON: - logger.info("获取合作方自然人信息列表"); - return initPersonCustomerData(oCurUser, request, sqlca, tx); - } - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - // begin 省市区 - public Map getDowntown(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheckSession(request, sqlca); - if (initCheck != null) - return initCheck; - Map body = CacheConstant.getDowntown(); - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - // end - - public Map loadNationcode(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheckSession(request, sqlca); - if (initCheck != null) - return initCheck; - Map body = CacheConstant.getNationcode(); - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - public Map getUnitKind(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheckSession(request, sqlca); - if (initCheck != null) - return initCheck; - Map body = CacheConstant.getUnitKind(); - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - public Map searchCustomerList(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheckSession(request, sqlca); - if (initCheck != null) - return initCheck; - String sUserId = this.globalSUserId; - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - String sType = this.sType; - switch (sType) { - // 自然人信息列表 - case "person": - logger.info("获取自然人信息列表"); - return getPersonCustomerList(oCurUser, request, sqlca, tx); - case "partnerPerson": - logger.info("获取合作方自然人信息列表"); - return getPartnerPersonCustomerList(oCurUser, request, sqlca, tx); - } - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - /** - * 根据客户类型获取自然人列表 - * - * @param oCurUser - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - @SuppressWarnings("static-access") - private Map getPersonCustomerList(ASUser oCurUser, - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - DataRightManager drm = new DataRightManager(); - String sOtherWhere = drm.getRightCondition(oCurUser, "O", "cust"); - - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "unchecked", "deprecation" }) - List listfile = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - for (FileItem item : listfile) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } - } - if (fieldMap.size() > 0) { - String sCustomerName = fieldMap.get("globalText") == null ? "" : fieldMap.get("globalText").toString(); - if (sCustomerName.length() > 0) sOtherWhere += " AND CUSTOMERNAME LIKE '%" + sCustomerName + "%' "; - } - - List customerList = jbo.customerList(tx, - CustomerConstant.CUST_TYPE.legal.itemNo, sOtherWhere); - tx.commit(); - // BizObjectUtil bizObjectUtil = new BizObjectUtil(); - String sPageIndex = request.getParameter("pageIndex"); - String sLimit = request.getParameter("limit"); - if (sPageIndex == null) - sPageIndex = "1"; - if (sLimit == null) - sLimit = "10"; - int iPageIndex, iLimit; - iPageIndex = Integer.valueOf(sPageIndex); - iLimit = Integer.valueOf(sLimit); - iPageIndex = iPageIndex - 1; - - int pageIndexStart = (iPageIndex) * iLimit; - int pageIndexEnd = (iPageIndex + 1) * iLimit; - - List> list = new ArrayList>(); - for (int i = pageIndexStart; i < pageIndexEnd; i++) { - // 数据数量大于list数据 - if (i > (customerList.size() - 1)) { - break; - } - // 页码小于1 - if (iPageIndex + 1 < 1) { - break; - } - if (customerList.size() % iLimit == 0) { - if ((customerList.size() / iLimit) < iPageIndex) { - break; - } - } else { - if ((customerList.size() / iLimit) + 1 < iPageIndex) { - break; - } - } - BizObject bo = customerList.get(i); - Map map = new HashMap(); - map.put("CUSTOMERID".toLowerCase(), bo.getAttribute("CUSTOMERID") - .getValue()); - map.put("CUSTOMERNAME".toLowerCase(), - bo.getAttribute("CUSTOMERNAME").getValue()); - map.put("CERTTYPE".toLowerCase(), - convert("CERTTYPE".toLowerCase(), bo - .getAttribute("CERTTYPE") == null ? "" : bo - .getAttribute("CERTTYPE").toString())); - map.put("CERTID".toLowerCase(), bo.getAttribute("CERTID") - .getValue()); - map.put("NATIONCODE".toLowerCase(), - convert("NATIONCODE".toLowerCase(), bo - .getAttribute("NATIONCODE") == null ? "" : bo - .getAttribute("NATIONCODE").toString())); - map.put("province".toLowerCase(), - convert("province".toLowerCase(), bo - .getAttribute("province") == null ? "" : bo - .getAttribute("province").toString())); - map.put("city".toLowerCase(), - convert("city".toLowerCase(), - bo.getAttribute("city") == null ? "" : bo - .getAttribute("city").toString())); - map.put("CUSTKIND".toLowerCase(), - convert("CUSTKIND".toLowerCase(), bo - .getAttribute("CUSTKIND") == null ? "" : bo - .getAttribute("CUSTKIND").toString())); - map.put("CUSTOMERTYPE".toLowerCase(), - convert("CUSTOMERTYPE".toLowerCase(), bo - .getAttribute("CUSTOMERTYPE") == null ? "" : bo - .getAttribute("CUSTOMERTYPE").toString())); - map.put("CUSTSTATUS".toLowerCase(), - convert("CUSTSTATUS".toLowerCase(), bo - .getAttribute("CUSTSTATUS") == null ? "" : bo - .getAttribute("CUSTSTATUS").toString())); - map.put("CUSTSOURCE".toLowerCase(), - convert("CUSTSOURCE".toLowerCase(), bo - .getAttribute("CUSTSOURCE") == null ? "" : bo - .getAttribute("CUSTSOURCE").toString())); - map.put("CUR_NUM", i + 1); - String sCustomerId = map.get("CUSTOMERID".toLowerCase()).toString(); - CustomerInfoCache info = new CustomerInfoCache(); - String sCustType = info.getCustType(sCustomerId); - map.put("CUSTTYPE".toLowerCase(), convert("", sCustType)); - String sUserId = oCurUser.getUserID(); - CustomerPersonCommonAction ca = new CustomerPersonCommonAction(); - ca.setCustomerid(sCustomerId); - ca.setUserId(sUserId); - String result = ca.checkAttribution(tx); - map.put("enable_modify", result); - list.add(map); - } - Map body = new HashMap(); - body.put("data", list); - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - /** - * 根据 客户类型 获取 担保自然人列表 - * - * @param oCurUser - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - private Map getPartnerPersonCustomerList(ASUser oCurUser, - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_INFO.className); - StringBuffer bf = new StringBuffer("SELECT "); - bf.append("CP.province, CP.city, CP.CUSTSOURCE, ") - .append("O.CUSTOMERID, O.CERTTYPE,O.CERTID,O.NATIONCODE,O.CUSTOMERNAME,O.CUSTKIND, O.CUSTOMERTYPE, ") - .append("CT.CUSTSTATUS, CT.CUSTTYPE ") - .append("FROM O ") - .append("LEFT JOIN " - + CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_TYPE.className - + " CT ON O.CUSTOMERID=CT.CUSTOMERID ") - .append("LEFT JOIN " - + CustomerConstant.CUSTOMER_TABLE.TALBE_CUSTOMER_PERSON.className - + " CP ON O.CUSTOMERID=CP.CUSTOMERID ") - .append("WHERE ").append("O.CUSTOMERTYPE=:CUSTOMERTYPE ") - .append("AND CT.CUSTTYPE=:CUSTTYPE AND CT.STATUS='VALID' "); - DataRightManager drm = new DataRightManager(); - @SuppressWarnings("static-access") - String sOtherWhere = drm.getRightCondition(oCurUser, "O", "cust"); - bf.append(sOtherWhere).append(" ORDER BY O.INPUTTIME DESC"); - String sSql = bf.toString(); - tx.join(bom); - @SuppressWarnings("unchecked") - List bos = bom - .createQuery(sSql) - .setParameter("CUSTOMERTYPE", - CustomerConstant.CUST_TYPE.legal.itemNo) - .setParameter("CUSTTYPE", - CustomerConstant.CUSTOMER_TYPE.assuror.itemNo) - .getResultList(false); - String sPageIndex = request.getParameter("pageIndex"); - String sLimit = request.getParameter("limit"); - if (sPageIndex == null) - sPageIndex = "1"; - if (sLimit == null) - sLimit = "10"; - int iPageIndex, iLimit; - iPageIndex = Integer.valueOf(sPageIndex); - iLimit = Integer.valueOf(sLimit); - iPageIndex = iPageIndex - 1; - - int pageIndexStart = (iPageIndex) * iLimit; - int pageIndexEnd = (iPageIndex + 1) * iLimit; - - List> list2 = new ArrayList>(); - for (int i = pageIndexStart; i < pageIndexEnd; i++) { - // 数据数量大于list数据 - if (i > (bos.size() - 1)) { - break; - } - // 页码小于1 - if (iPageIndex + 1 < 1) { - break; - } - if (bos.size() % iLimit == 0) { - if ((bos.size() / iLimit) < iPageIndex) { - break; - } - } else { - if ((bos.size() / iLimit) + 1 < iPageIndex) { - break; - } - } - BizObject bo = bos.get(i); - Map map = new HashMap(); - map.put("CUSTOMERID".toLowerCase(), bo.getAttribute("CUSTOMERID") - .getValue()); - map.put("CUSTOMERNAME".toLowerCase(), - bo.getAttribute("CUSTOMERNAME").getValue()); - map.put("CERTTYPE".toLowerCase(), - convert("CERTTYPE".toLowerCase(), bo - .getAttribute("CERTTYPE") == null ? "" : bo - .getAttribute("CERTTYPE").toString())); - map.put("CERTID".toLowerCase(), bo.getAttribute("CERTID") - .getValue()); - map.put("NATIONCODE".toLowerCase(), - convert("NATIONCODE".toLowerCase(), bo - .getAttribute("NATIONCODE") == null ? "" : bo - .getAttribute("NATIONCODE").toString())); - map.put("province".toLowerCase(), - convert("province".toLowerCase(), bo - .getAttribute("province") == null ? "" : bo - .getAttribute("province").toString())); - map.put("city".toLowerCase(), - convert("city".toLowerCase(), - bo.getAttribute("city") == null ? "" : bo - .getAttribute("city").toString())); - map.put("CUSTKIND".toLowerCase(), - convert("CUSTKIND".toLowerCase(), bo - .getAttribute("CUSTKIND") == null ? "" : bo - .getAttribute("CUSTKIND").toString())); - map.put("CUSTOMERTYPE".toLowerCase(), - convert("CUSTOMERTYPE".toLowerCase(), bo - .getAttribute("CUSTOMERTYPE") == null ? "" : bo - .getAttribute("CUSTOMERTYPE").toString())); - map.put("CUSTSTATUS".toLowerCase(), - convert("CUSTSTATUS".toLowerCase(), bo - .getAttribute("CUSTSTATUS") == null ? "" : bo - .getAttribute("CUSTSTATUS").toString())); - map.put("CUSTTYPE".toLowerCase(), - convert("CUSTTYPE".toLowerCase(), bo - .getAttribute("CUSTTYPE") == null ? "" : bo - .getAttribute("CUSTTYPE").toString())); - map.put("CUSTSOURCE".toLowerCase(), - convert("CUSTSOURCE".toLowerCase(), bo - .getAttribute("CUSTSOURCE") == null ? "" : bo - .getAttribute("CUSTSOURCE").toString())); - map.put("CUR_NUM", i + 1); - list2.add(map); - } - Map body = new HashMap(); - body.put("data", list2); - for (Map map2 : list2) { - String sCustomerId = map2.get("CUSTOMERID".toLowerCase()) - .toString(); - String sUserId = oCurUser.getUserID(); - CustomerPersonCommonAction ca = new CustomerPersonCommonAction(); - ca.setCustomerid(sCustomerId); - ca.setUserId(sUserId); - String result = ca.checkAttribution(tx); - map2.put("enable_modify", result); - } - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - /** - * 根据字段名 获取code属性 - * - * @param type - * column name > code no - * @param itemno - * @return - * @throws Exception - */ - @SuppressWarnings("unchecked") - private static Map convert(String type, String itemno) - throws Exception { - Map item = new HashMap(); - item.put("itemno", itemno); - String codeno = ""; - switch (type) { - case "nationcode": - codeno = "CountryCode"; - break; - case "certtype": - codeno = "CertType"; - break; - case "province": - codeno = "AreaCode"; - break; - case "city": - codeno = "AreaCode"; - break; - case "custkind": - codeno = "cust_kind"; - break; - case "customertype": - codeno = "end_ind"; - break; - case "custstatus": - codeno = "customer_status"; - break; - case "custtype": - codeno = "cust_type"; - break; - case "custsource": - codeno = "cust_personsource"; - break; - } - Map catalog = null; - if (!"".equals(codeno)) - catalog = (Map) AppCodeCache.getAppCodeCachePool().get(codeno); - if (catalog == null || catalog.size() < 1) { - item.put("value", itemno); - return item; - } - List> library = (List>) catalog.get("library"); - - for (Map codeData : library) { - String key = codeData.get("ITEMNO".toLowerCase()).toString(); - if (key.toUpperCase().equals(itemno.toUpperCase())) { - String value = codeData.get("ITEMNAME".toLowerCase()) == null ? "" - : codeData.get("ITEMNAME".toLowerCase()).toString(); - item.put("value", value); - return item; - } - } - item.put("value", itemno); - return item; - } - - /** - * 加载自然人 page - * - * @param oCurUser - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - private Map initPersonCustomerData(ASUser oCurUser, - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - - String sPageType = request.getParameter("pageType"); - switch (sPageType) { - case CustomerConstant.CUSTOMER_PAGE_TYPE_CUST: - return initAddPersonCustomerData(oCurUser, request, sqlca, tx); - case CustomerConstant.CUSTOMER_PAGE_TYPE_CERT: - return initOtherCertCustomerData(oCurUser, request, sqlca, tx); - case CustomerConstant.CUSTOMER_PAGE_TYPE_ADDRESS: - return initCustomerAddressCustomerData(oCurUser, request, sqlca, tx); - case CustomerConstant.CUSTOMER_PAGE_TYPE_TEL: - return initCustomerTelCustomerData(oCurUser, request, sqlca, tx); - case CustomerConstant.CUSTOMER_PAGE_TYPE_ACCOUNT: - return initCustomerAccountCustomerData(oCurUser, request, sqlca, tx); - case CustomerConstant.CUSTOMER_PAGE_TYPE_FAMILY: - return initCustomerFamilyCustomerData(oCurUser, request, sqlca, tx); - case CustomerConstant.CUSTOMER_PAGE_TYPE_Visit_RECORD: - return initCustomerVisitRecordCustomerData(oCurUser, request, sqlca, tx); - - } - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - /** - * 联系电话信息 - * - * @param oCurUser - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - private Map initCustomerTelCustomerData(ASUser oCurUser, - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - String sTemplateNo = "CustomerTelInfo"; - List> resultList = getInitData(sTemplateNo); - List> list = new ArrayList>(); - for (int i = 0; i < resultList.size(); i++) { - Map map = resultList.get(i); - if ("1".equals(map.get("col_visible"))) { - list.add(map); - } - } - Map map = new HashMap(); - map.put("data", list); - List> list2 = new ArrayList>(); - map.put("additional", list2); - Map map2 = new HashMap(); - getInitCodeLibrary("", "86", "intarea", map2, ""); - getInitCodeLibrary("yes_no", "yes", "isnew", map2, ""); - getInitCodeLibrary("TelType", "010", "teltype", map2, ""); - map.put("default", map2); - List> list3 = new ArrayList>(); - list3.add(initSelectData("teltype", "TelType", "code", "", sqlca)); - list3.add(initSelectData("isnew", "yes_no", "code", "", sqlca)); - map.put("select_source", list3); - ReturnMapUtil.setReturnMap(map, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - private Map initCustomerVisitRecordCustomerData(ASUser oCurUser, - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - String sTemplateNo = "CustomerVisitRecord"; - List> resultList = getInitData(sTemplateNo); - List> list = new ArrayList>(); - for (int i = 0; i < resultList.size(); i++) { - Map map = resultList.get(i); - if ("1".equals(map.get("col_visible"))) { - list.add(map); - } - } - Map map = new HashMap(); - map.put("data", list); - - List> list2 = new ArrayList>(); - map.put("additional", list2); - Map map2 = new HashMap(); - map.put("default", map2); - List> list3 = new ArrayList>(); - list3.add(initSelectData("contactway", "contact_way", "code", "", sqlca)); - map.put("select_source", list3); - ReturnMapUtil.setReturnMap(map, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - private Map initCustomerFamilyCustomerData(ASUser oCurUser, - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - String sTemplateNo = "CustomerFamily"; - List> resultList = getInitData(sTemplateNo); - List> list = new ArrayList>(); - for (int i = 0; i < resultList.size(); i++) { - Map map = resultList.get(i); - if ("1".equals(map.get("col_visible"))) { - list.add(map); - } - } - Map map = new HashMap(); - map.put("data", list); - - List> list2 = new ArrayList>(); - map.put("additional", list2); - Map map2 = new HashMap(); - getInitCodeLibrary("isValid", "valid", "status", map2, ""); - map.put("default", map2); - List> list3 = new ArrayList>(); - list3.add(initSelectData("certtype", "CertType", "code", - " and SortNo like 'Ind%' and IsInuse='1' ", sqlca)); - list3.add(initSelectData("relative", "familyrelative", "code", "", - sqlca)); - list3.add(initSelectData("status", "isValid", "code", "", sqlca)); - map.put("select_source", list3); - ReturnMapUtil.setReturnMap(map, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - /** - * 银行信息 - * - * @param oCurUser - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - private Map initCustomerAccountCustomerData( - ASUser oCurUser, HttpServletRequest request, Transaction sqlca, - JBOTransaction tx) throws Exception { - Map checkCustomerId = checkCustomerId(request, sqlca); - if (checkCustomerId != null) - return checkCustomerId; - String sTemplateNo = "CustomerAccount"; - List> resultList = getInitData(sTemplateNo); - List> list = new ArrayList>(); - for (int i = 0; i < resultList.size(); i++) { - Map map = resultList.get(i); - if ("1".equals(map.get("col_visible"))) { - list.add(map); - } - } - Map map = new HashMap(); - map.put("data", list); - - List> list2 = new ArrayList>(); - map.put("additional", list2); - - String sCustomerId = this.globalSCustomerId; - BizObject bo = jbo.getCustomerById(tx, sCustomerId); - if (bo == null) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "没有该客户"); - return ReturnMapUtil.getReturnMap(); - } - String sCustomerName = bo.getAttribute("CUSTOMERNAME") == null ? "" - : bo.getAttribute("CUSTOMERNAME").toString(); - String sInputUser = oCurUser.getUserName(); - String sCurDate = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - - Map map2 = new HashMap(); - getInitCodeLibrary("", sCurDate, "inputtime", map2, ""); - getInitCodeLibrary("", sCurDate, "updatetime", map2, ""); - getInitCodeLibrary("", sInputUser, "updateuseridname", map2, ""); - getInitCodeLibrary("", sInputUser, "inputuseridname", map2, ""); - getInitCodeLibrary("", sCustomerName, "customername", map2, ""); - map.put("default", map2); - List> list3 = new ArrayList>(); - list3.add(initSelectData("bank_name", "selectbank", "code", "", sqlca)); - list3.add(initSelectData("is_main", "yes_no", "code", "", sqlca)); - map.put("select_source", list3); - ReturnMapUtil.setReturnMap(map, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - /** - * 联系地址信息 - * - * @param oCurUser - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - private Map initCustomerAddressCustomerData( - ASUser oCurUser, HttpServletRequest request, Transaction sqlca, - JBOTransaction tx) throws Exception { - String sTemplateNo = "CustomerAddress"; - List> resultList = getInitData(sTemplateNo); - List> list = new ArrayList>(); - for (int i = 0; i < resultList.size(); i++) { - Map map = resultList.get(i); - if ("1".equals(map.get("col_visible"))) { - list.add(map); - } - } - Map map = new HashMap(); - map.put("data", list); - List> list2 = new ArrayList>(); - map.put("additional", list2); - Map map2 = new HashMap(); - getInitCodeLibrary("AddType", "0100", "addtype", map2, ""); - getInitCodeLibrary("yes_no", "yes", "isnew", map2, ""); - getInitCodeLibrary("CountryCode", "CHN", "countryname", map2, ""); - map.put("default", map2); - List> list3 = new ArrayList>(); - list3.add(initSelectData("addtype", "AddType", "code", "", sqlca)); - list3.add(initSelectData("isadd", "yes_no", "code", "", sqlca)); - list3.add(initSelectData("isnew", "yes_no", "code", "", sqlca)); - map.put("select_source", list3); - ReturnMapUtil.setReturnMap(map, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - /** - * 其他证件信息元素初始化 - * - * @param oCurUser - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - private Map initOtherCertCustomerData(ASUser oCurUser, - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - String sTempletNo = "CustomerPersonCertInfo"; - List> resultList = getInitData(sTempletNo); - List> list = new ArrayList>(); - for (int i = 0; i < resultList.size(); i++) { - Map map = resultList.get(i); - if ("1".equals(map.get("col_visible"))) { - list.add(map); - } - } - Map map = new HashMap(); - map.put("data", list); - Map map2 = new HashMap(); - getInitCodeLibrary("CountryCode", "CHN", "issuecountryname", map2, ""); - getInitCodeLibrary("CertType", "Ind01", "certtype", map2, ""); - getInitCodeLibrary("isValid", "valid", "status", map2, ""); - map.put("default", map2); - List> list2 = new ArrayList>(); - map.put("additional", list2); - List> list3 = new ArrayList>(); - list3.add(initSelectData("nationcodename", - "/customer/manager/load/nationcode", "service", "", sqlca)); - list3.add(initSelectData("status", "isValid", "code", "", sqlca)); - list3.add(initSelectData("certtype", "CertType", "code", - " and SortNo like 'Ind%' and IsInuse='1' ", sqlca)); - map.put("select_source", list3); - ReturnMapUtil.setReturnMap(map, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - - } - - /** - * 添加客户元素初始化 - * - * @param oCurUser - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - private Map initAddPersonCustomerData(ASUser oCurUser, - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - String sTempletNo = ""; - String sType = request.getParameter("type"); - // 取当前用户和机构,并将其放入 Session - switch (sType) { - // 自然人信息列表 - case "person": - sTempletNo = "CustomerPersonRegister"; - break; - case "partnerPerson": - sTempletNo = "PartnerPersonRegister"; - break; - } - List> resultList = getInitData(sTempletNo); - List> list = new ArrayList>(); - for (int i = 0; i < resultList.size(); i++) { - Map map = resultList.get(i); - if ("1".equals(map.get("col_visible"))) { - list.add(map); - } - } - Map map = new HashMap(); - map.put("data", list); - - Map map2 = new HashMap(); - - getInitCodeLibrary("CountryCode", "CHN", "nationcodename", map2, ""); - getInitCodeLibrary("CertType", "Ind01", "certtype", map2, ""); - map.put("default", map2); - List> list2 = new ArrayList>(); - list2.add(additionalData("birthDay", "生日", "1", "", "", "Date")); - list2.add(additionalData("sex", "性别", "", "", "", "text")); - list2.add(additionalData("addressDetail", "地址详情", "", "", "", - "textArea")); - map.put("additional", list2); - List> list3 = new ArrayList>(); - list3.add(initSelectData("status", "customer_status", "code", - " and itemno in('status01','status02') ", sqlca)); - list3.add(initSelectData("certtype", "CertType", "code", - " and SortNo like 'Ind%' and IsInuse='1' ", sqlca)); - list3.add(initSelectData("nationcodename", - "/customer/manager/load/nationcode", "service", "", sqlca)); - map.put("select_source", list3); - - ReturnMapUtil.setReturnMap(map, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - /** - * 根据模板号获取模板所有属性值 - * - * @param sTempletNo - * @return - * @throws Exception - */ - @SuppressWarnings("unchecked") - private List> getInitData(String sTempletNo) - throws Exception { - List> list = new ArrayList>(); - Map catalog = (Map) AppAweDoCache.getAppAweDoCachePool().get(sTempletNo); - List> library = (List>) catalog.get("library"); - for (Map doLibraryMap : library) { - Map map = new HashMap(); - map.put("col_index", doLibraryMap.get("COLINDEX".toLowerCase())); - map.put("col_sortno", doLibraryMap.get("SORTNO".toLowerCase())); - map.put("col_code", doLibraryMap.get("COLNAME".toLowerCase())); - map.put("col_header", doLibraryMap.get("COLHEADER".toLowerCase())); - map.put("col_actual", - doLibraryMap.get("COLACTUALNAME".toLowerCase())); - map.put("col_visible", doLibraryMap.get("COLVISIBLE".toLowerCase())); - map.put("col_readonly", - doLibraryMap.get("COLREADONLY".toLowerCase())); - map.put("col_required", - doLibraryMap.get("COLREQUIRED".toLowerCase())); - map.put("col_style", doLibraryMap.get("COLEDITSTYLE".toLowerCase())); - map.put("col_source_type", - doLibraryMap.get("COLEDITSOURCETYPE".toLowerCase())); - map.put("col_source", - doLibraryMap.get("COLEDITSOURCE".toLowerCase())); - list.add(map); - } - return list; - } - - /** - * 加载 :选择框 - * - * @param code - * @param source - * @param sourceType - * @param otherWhere - * @param sqlca - * @return - * @throws Exception - */ - private Map initSelectData(String code, String source, - String sourceType, String otherWhere, Transaction sqlca) - throws Exception { - Map map4 = new HashMap(); - map4.put("col_code", code); - map4.put("col_source_type", sourceType); - map4.put("col_source", source); - List> list = new ArrayList>(); - BusinessDetailsServiceImpl service = new BusinessDetailsServiceImpl(); - if (sourceType.equals("code")) - list = service.getItemName(source, sqlca, otherWhere); - map4.put("content", list); - return map4; - } - - /** - * 加载页面 附加元素 - * - * @param code - * @param header - * @param required - * @param sortno - * @param sourceType - * @param style - * @return - */ - private Map additionalData(String code, String header, - String required, String sortno, String sourceType, String style) { - Map map3 = new HashMap(); - map3.put("col_actual", ""); - map3.put("col_code", code); - map3.put("col_header", header); - map3.put("col_index", ""); - map3.put("col_readonly", "1"); - map3.put("col_required", required); - map3.put("col_sortno", ""); - map3.put("col_source", ""); - map3.put("col_source_type", ""); - map3.put("col_style", style); - map3.put("col_visible", "1"); - return map3; - } - - /** - * 根据值和来源 获取code属性 - * - * @param codeNo - * @param itemNo - * @param colCode - * @param map2 - * @param style - * @return - * @throws JBOException - */ - @SuppressWarnings("unchecked") - private Map getInitCodeLibrary(String codeNo, - String itemNo, String colCode, Map map2, - String style) throws JBOException { - if (StringUtils.isBlank(codeNo)) { - Map map1 = new HashMap(); - map1.put("itemno", itemNo); - map1.put("itemname", itemNo); - map2.put(colCode, map1); - } else { - Map catalog = (Map) AppCodeCache.getAppCodeCachePool().get(codeNo); - List> library = (List>) catalog.get("library"); - for (Map codeData : library) { - String key = codeData.get("ITEMNO".toLowerCase()).toString(); - if (itemNo.toUpperCase().equals(key.toUpperCase())) { - Map map1 = new HashMap(); - map1.put("itemno", codeData.get("ITEMNO".toLowerCase())); - map1.put("itemname", codeData.get("ITEMNAME".toLowerCase())); - map2.put(colCode, map1); - break; - } - } - } - return map2; - } -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerCertServiceImpl.java b/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerCertServiceImpl.java deleted file mode 100644 index 50af9c532..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerCertServiceImpl.java +++ /dev/null @@ -1,275 +0,0 @@ -package apx.com.amarsoft.als.customer.service.impl; - -import java.net.URLDecoder; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.DateUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.customer.constant.CustomerConstant; -import apx.com.amarsoft.als.customer.model.GlobalModel; -import apx.com.amarsoft.als.customer.service.CustomerCertService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class CustomerCertServiceImpl implements CustomerCertService { - // 日志对象 - private static Log logger = ARE.getLog(); - private GlobalModel GlobalModel; - - // begin 客户账户全局变量 - private String sCustomerId; - private String sId; - private String sInputtime; - private String sUpdatetime; - private String sType; - - private String sCustomerName; - private String sIssuecountryname; - private String sCerttype; - private String sCertid; - private String sIdexpiry; - private String sStatus; - // end - - - private void initGlobal(Map fieldMap) { - - this.sCustomerId = this.GlobalModel.getGlobalSCustomerId(); - this.sId = fieldMap.get("id") == null ? "" : fieldMap.get("id") - .toString(); - this.sCustomerName = fieldMap.get("customerName") == null ? "" : fieldMap.get( - "customerName").toString(); - this.sIssuecountryname = fieldMap.get("issuecountryname") == null ? "" : fieldMap - .get("issuecountryname").toString(); - this.sCerttype = fieldMap.get("certtype") == null ? "" : fieldMap - .get("certtype").toString(); - this.sCertid = fieldMap.get("certid") == null ? "" : fieldMap - .get("certid").toString(); - this.sIdexpiry = fieldMap.get("idexpiry") == null ? "" - : fieldMap.get("idexpiry").toString(); - this.sStatus = fieldMap.get("status") == null ? "" : fieldMap - .get("status").toString(); - this.sInputtime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sUpdatetime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sType = fieldMap.get("type") == null ? "" : fieldMap.get("type") - .toString(); - this.sCustomerId = this.GlobalModel.getGlobalSCustomerId(); - } - private Map initCheck(HttpServletRequest request, - Transaction sqlca) { - this.GlobalModel = new GlobalModel(); - if (!this.GlobalModel.checkMainId(request)) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - return null; - } - - @SuppressWarnings({ "unchecked", "deprecation" }) - @Override - public Map operationOtherCert(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - String sUserId = (String) request.getSession().getAttribute("userid"); - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } - } - initGlobal(fieldMap); - switch (sType) { - case CustomerConstant.CUSTOMER_TYPE_PERSON: - return operationCustomerPersonOtherCert(request, sqlca, tx, - fieldMap, oCurUser); - } - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - private boolean validityCheck(String sId, String sCertid, String sCerttype, - String sCustomerId) throws Exception { - String oldcerttype = ""; - String oldcertid = ""; - // 查询证件是否存在证件信息表中 - if (!("".equals(sId))) { - BizObjectManager oldbom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_CERT.className); - BizObject oldbo1 = oldbom.createQuery("id=:id") - .setParameter("id", sId).getSingleResult(false); - oldcerttype = oldbo1.getAttribute("certtype").toString(); - oldcertid = oldbo1.getAttribute("certid").toString(); - } - if (!(sCerttype.equals(oldcerttype) && sCertid.equals(oldcertid))) { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_CERT.className); - BizObject bo1 = bom - .createQuery("certtype=:certtype and certid=:certid") - .setParameter("certtype", sCerttype) - .setParameter("certid", sCertid).getSingleResult(false); - // 修改时无需判断是否存在 - if (bo1 != null) { - return false; - } - } - return true; - } - - private void beforeUpdate(JBOTransaction tx, String sId, String sCerttype, - String sCustomerId) throws Exception { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_CERT.className); - tx.join(bom); - // 先将其他同类证件设为无效 - BizObjectQuery boq1 = bom - .createQuery("update O set status = 'invalid' where id<>:id and certtype=:certtype and customerid=:customerid"); - boq1.setParameter("id", sId).setParameter("certtype", sCerttype) - .setParameter("customerid", sCustomerId); - // 将此证件设为生效 - BizObjectQuery boq2 = bom.createQuery( - "update O set status = 'valid' where id=:id ").setParameter( - "id", sId); - boq2.executeUpdate(); - boq1.executeUpdate(); - } - - private void beforeInsert(JBOTransaction tx, String sId, String sCerttype, - String sCustomerId, String sStatus, String sIsmainCert) - throws Exception { - // 获取当前客户ID - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_CERT.className); - tx.join(bom); - // 判断当前新增证件是否有效,是则把此类型其它证件都设为无效 - if (sStatus.toString().equals("valid")) { - BizObjectQuery boq = bom - .createQuery("update O set status = 'invalid' where customerid=:customerid and certtype=:certtype"); - boq.setParameter("customerid", sCustomerId).setParameter( - "certtype", sCerttype); - boq.executeUpdate(); - } - if (sIsmainCert.toString().equals("yes")) { - BizObjectQuery boq2 = bom - .createQuery("update O set ismaincert = 'no' where customerid=:customerid"); - boq2.setParameter("customerid", sCustomerId); - boq2.executeUpdate(); - } - } - - /** - * 自然人操作 - * - * @param request - * @param sqlca - * @param tx - * @param fieldMap - * @return - * @throws Exception - */ - private Map operationCustomerPersonOtherCert( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx, - Map fieldMap, ASUser oCurUser) throws Exception { - - if (!validityCheck(sId, sCertid, sCerttype, sCustomerId)) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "证件号:" + sCertid + "已存在"); - return ReturnMapUtil.getReturnMap(); - } - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_CERT.className); - tx.join(bom); - if ("".equals(sId)) { - beforeInsert(tx, sIdexpiry, sCerttype, sCustomerId, sStatus, ""); - // save - // 判断当前新增证件是否有效,是则把此类型其它证件都设为无效 - try { - BizObject bo = bom.newObject(); - bo.setAttributeValue("issuecountry", sIssuecountryname); - bo.setAttributeValue("certtype", sCerttype); - bo.setAttributeValue("certid", sCertid); - bo.setAttributeValue("idexpiry", sIdexpiry); - bo.setAttributeValue("status", sStatus); - bo.setAttributeValue("customerid", sCustomerId); - bo.setAttributeValue("ismaincert", "no"); - bo.setAttributeValue("customername", sCustomerName); - bo.setAttributeValue("inputorgid", oCurUser.getOrgID()); - bo.setAttributeValue("inputuserid", oCurUser.getUserID()); - bo.setAttributeValue("inputtime", sInputtime); - bom.saveObject(bo); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "保存成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "保存失败"); - return ReturnMapUtil.getReturnMap(); - } - } else { - beforeUpdate(tx, sId, sCerttype, sCustomerId); - // update - // 先将其他同类证件设为无效 - try { - // 将此证件设为生效 - BizObjectQuery boq = bom - .createQuery("update O set updateorgid=:updateorgid,updateuserid=:updateuserid,updatetime=:updatetime" - + ",issuecountry=:issuecountryname,certtype=:certtype,certid=:certid,idexpiry=:idexpiry" - + " where id=:id"); - boq.setParameter("updateorgid", oCurUser.getOrgID()); - boq.setParameter("updateuserid", oCurUser.getUserID()); - boq.setParameter("updatetime", sUpdatetime); - boq.setParameter("issuecountryname", sIssuecountryname); - boq.setParameter("certtype", sCerttype); - boq.setParameter("certid", sCertid); - boq.setParameter("idexpiry", sIdexpiry); - boq.setParameter("id", sId); - boq.executeUpdate(); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "编辑成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "编辑失败"); - return ReturnMapUtil.getReturnMap(); - } - } - } - -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerDocServiceImpl.java b/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerDocServiceImpl.java deleted file mode 100644 index 51f7fddf4..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerDocServiceImpl.java +++ /dev/null @@ -1,240 +0,0 @@ -package apx.com.amarsoft.als.customer.service.impl; - -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.jbo.CustomerJbo; -import apx.com.amarsoft.als.base.jbo.LBDocLibraryService; -import apx.com.amarsoft.als.base.jbo.impl.CustomerJboImpl; -import apx.com.amarsoft.als.base.jbo.impl.LBDocLibraryServiceImpl; -import apx.com.amarsoft.als.base.util.BizObjectUtil; -import apx.com.amarsoft.als.base.util.DateUtil; -import apx.com.amarsoft.als.base.util.JsonUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.customer.constant.CustomerConstant; -import apx.com.amarsoft.als.customer.model.GlobalModel; -import apx.com.amarsoft.als.customer.service.CustomerDocService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.Configure; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; -import com.tenwa.doc.action.DocListInitAction; -import com.tenwa.doc.cache.DocListCache; -import com.tenwa.officetempalte.util.FileOperatorUtil; - -public class CustomerDocServiceImpl implements CustomerDocService { - // 日志对象 - private static Log logger = ARE.getLog(); - - private GlobalModel GlobalModel; - - private CustomerJbo jbo = new CustomerJboImpl(); - - private LBDocLibraryService docJbo = new LBDocLibraryServiceImpl(); - - // begin 客户账户全局变量 - private String sCustType; - private String sRemark; - private String sLibraryId; - private String sInputTime; - private String sUpdateTime; - private List> fileList; - - // end - private void initGlobal(HttpServletRequest request) { - this.sCustType = request.getParameter("custtype"); - } - - @SuppressWarnings({ "unchecked", "deprecation" }) - private void initGlobalUpload(HttpServletRequest request) throws Exception { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - this.fileList = new ArrayList>(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - - } else { - Map fileMap = new HashMap(); - fileMap.put("fileSize", item.getInputStream().available()); - fileMap.put("fileContentType", item.getContentType()); - fileMap.put("fileName", item.getName()); - fileMap.put("file", item.getInputStream()); - fileList.add(fileMap); - } - } - this.sRemark = fieldMap.get("remark") == null ? "" : fieldMap.get( - "remark").toString(); - this.sLibraryId = fieldMap.get("id") == null ? "" : fieldMap.get("id") - .toString(); - this.sInputTime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sUpdateTime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - } - - private Map initCheck(HttpServletRequest request, - Transaction sqlca) { - this.GlobalModel = new GlobalModel(); - if (!this.GlobalModel.checkMainId(request)) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - return null; - } - - @SuppressWarnings({ "deprecation", "static-access", "unchecked" }) - public Map findCustomerDocList(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - initGlobal(request); - String docClassItemno = ""; - if (CustomerConstant.CUSTOMER_TYPE.assuror.itemNo - .equals(this.sCustType)) { - docClassItemno = "001002"; - } else if (CustomerConstant.CUSTOMER_TYPE.cust.itemNo - .equals(this.sCustType)) { - docClassItemno = "001001"; - } - BizObject company = jbo.getCompanyById(tx, - this.GlobalModel.getGlobalSCustomerId()); - BizObject person = jbo.getPersonById(tx, - this.GlobalModel.getGlobalSCustomerId()); - if (company != null) { - docClassItemno += "001"; - } else if (person != null) { - docClassItemno += "002"; - } - Map docParam = new HashMap(); - Map other = new HashMap(); - docParam.put("ObjectType", "Customer"); - docParam.put("cust_id", this.GlobalModel.getGlobalSCustomerId()); - // 判断是否存在,不存在就从配置表倒到临时表 - DocListInitAction.initDocList(docParam, other, docClassItemno, - Configure.getInstance()); - String sSql = "SELECT " - + "O.Serial_Num,O.Doc_Name,O.Doc_Nature,O.Doc_Type,O.One_Classify,O.Two_Classify,O.Id " - + "FROM O,jbo.app.tenwa.doc.LB_DOCRELATIVE rela " - + "where rela.id=O.relative_Id and O.doc_Class_Itemno='" - + docClassItemno + "' and rela.cust_id='" - + this.GlobalModel.getGlobalSCustomerId() - + "' and rela.ObjectType='Customer' ORDER BY Serial_Num"; - logger.info(sSql); - List docList = docJbo.findDocList(tx, sSql); - List> list = new ArrayList>(); - for (BizObject doc : docList) { - BizObjectUtil util = new BizObjectUtil(); - Map docMap = util.bizObject2Map(doc, - "CustomerDocList"); - Map sId = docMap.get("id") == null ? null - : (Map) docMap.get("id"); - String sJsonStr = DocListCache.getFile(sId.get("value").toString()); - JsonUtil oJsonUtil = new JsonUtil(); - logger.info(sJsonStr); - Map jsonMap = oJsonUtil.str2Map(sJsonStr); - docMap.put("filelist", jsonMap); - list.add(docMap); - } - Map body = new HashMap(); - body.put("data", list); - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - @SuppressWarnings("deprecation") - @Override - public Map uploadAtts6(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - initGlobalUpload(request); - String sUserId = (String) request.getSession().getAttribute("userid"); - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - BizObjectManager libBm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); - tx.join(libBm); - BizObject lib=libBm.createQuery("id=:id").setParameter("id", this.sLibraryId).getSingleResult(true); - lib.setAttributeValue("REMARK", this.sRemark); - lib.setAttributeValue("UPDATETIME", this.sUpdateTime); - lib.setAttributeValue("UPDATEUSERID", oCurUser.getUserID()); - lib.setAttributeValue("UPDATEORGID", oCurUser.getOrgID()); - libBm.saveObject(lib); - BizObjectManager attrBm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); - tx.join(attrBm); - for (Map fileMap : this.fileList) { - String sFileName, sFileSize, sFileContentType; - InputStream file = (InputStream) fileMap.get("file"); - sFileName = (String) fileMap.get("fileName"); - sFileContentType = (String) fileMap.get("fileContentType"); - sFileSize = fileMap.get("fileSize") + ""; - BizObject attr = attrBm.newObject(); - attr.setAttributeValue("Library_Id", this.sLibraryId); - attr.setAttributeValue("FileName", sFileName); - attr.setAttributeValue("InputUserId", oCurUser.getUserID()); - attr.setAttributeValue("InputOrgId", oCurUser.getOrgID()); - attr.setAttributeValue("InputTime", this.sInputTime); - // 获取配置文件的参数 - Configure CurConfig = Configure.getInstance(); - String sFileSavePath = CurConfig.getConfigure("FileSavePath"); - - String uuid = java.util.UUID.randomUUID().toString() - .replaceAll("-", ""); - String sFullPath = FileOperatorUtil.getuploadFileDir(sFileSavePath) - + uuid + "_" + sFileName; - String sFilePath = sFullPath.replace(sFileSavePath, ""); - attr.setAttributeValue("FilePath", sFilePath); - attr.setAttributeValue("FullPath", sFullPath); - attr.setAttributeValue("Content_Type", sFileContentType); - attr.setAttributeValue("FileSize", sFileSize); -// attr.setAttributeValue("Remark", sRemark); - attrBm.saveObject(attr); - - File f = new File(sFullPath); - DataOutputStream fileout = new DataOutputStream( - new FileOutputStream(f)); - byte b[] = new byte[Integer.valueOf(sFileSize)]; - @SuppressWarnings("unused") - int i = file.read(b, 0, Integer.valueOf(sFileSize) - 1); - fileout.write(b, 0, b.length); // 将文件数据存盘 - fileout.close(); - } - tx.commit(); - ReturnMapUtil.setReturnMap(null, ResultConstant.SUCCESS_RESULT_CODE, "上传成功!"); - return ReturnMapUtil.getReturnMap(); - } - -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerFamilyServiceImpl.java b/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerFamilyServiceImpl.java deleted file mode 100644 index 73f570608..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerFamilyServiceImpl.java +++ /dev/null @@ -1,245 +0,0 @@ -package apx.com.amarsoft.als.customer.service.impl; - -import java.net.URLDecoder; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import jbo.app.tenwa.customer.CUSTOMER_FAMILY; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.DateUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.customer.constant.CustomerConstant; -import apx.com.amarsoft.als.customer.model.GlobalModel; -import apx.com.amarsoft.als.customer.service.CustomerFamilyService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class CustomerFamilyServiceImpl implements CustomerFamilyService { - // 日志对象 - private static Log logger = ARE.getLog(); - private GlobalModel GlobalModel; - - // begin 客户账户全局变量 - private String sCustomerId; - private String sId; - private String sInputtime; - private String sUpdatetime; - private String sType; - - private String sCerttype; - private String sCertid; - private String sName; - private String sRelative; - private String sTel; - private String sWorkunit; - private String sStatus; - private String sRemark; - // end - - private void initGlobal(Map fieldMap) { - this.sCustomerId = this.GlobalModel.getGlobalSCustomerId(); - this.sId = fieldMap.get("id") == null ? "" : fieldMap.get("id") - .toString(); - this.sCerttype = fieldMap.get("certtype") == null ? "" : fieldMap - .get("certtype").toString(); - this.sCertid = fieldMap.get("certid") == null ? "" : fieldMap - .get("certid").toString(); - this.sName = fieldMap.get("name") == null ? "" : fieldMap.get( - "name").toString(); - this.sRelative = fieldMap.get("relative") == null ? "" : fieldMap - .get("relative").toString(); - this.sTel = fieldMap.get("tel") == null ? "" : fieldMap - .get("tel").toString(); - this.sWorkunit = fieldMap.get("workunit") == null ? "" : fieldMap - .get("workunit").toString(); - this.sRemark = fieldMap.get("remark") == null ? "" : fieldMap - .get("remark").toString(); - this.sStatus = fieldMap.get("status") == null ? "" : fieldMap.get( - "status").toString(); - this.sInputtime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sUpdatetime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sType = fieldMap.get("type") == null ? "" : fieldMap.get("type") - .toString(); - } - - private Map initCheck(HttpServletRequest request, - Transaction sqlca) { - this.GlobalModel = new GlobalModel(); - if (!this.GlobalModel.checkMainId(request)) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - return null; - } - - @Override - public Map operationFamily(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - String sUserId = (String) request.getSession().getAttribute("userid"); - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "unchecked", "deprecation" }) - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } - } - initGlobal(fieldMap); - switch (sType) { - case CustomerConstant.CUSTOMER_TYPE_PERSON: - return operationCustomerFamilyhone(request, sqlca, tx, fieldMap, - oCurUser); - } - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - /** - * 自然人操作 - * - * @param request - * @param sqlca - * @param tx - * @param fieldMap - * @return - * @throws Exception - */ - private Map operationCustomerFamilyhone( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx, - Map fieldMap, ASUser oCurUser) throws Exception { - - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_FAMILY.className); - tx.join(bom); - if ("".equals(sId)) { - try { - BizObject bo = bom.newObject(); - bo.setAttributeValue("customerid", sCustomerId); - bo.setAttributeValue("certtype", sCerttype); - bo.setAttributeValue("certid", sCertid); - bo.setAttributeValue("name", sName); - bo.setAttributeValue("relative", sRelative); - bo.setAttributeValue("tel", sTel); - bo.setAttributeValue("workunit", sWorkunit); - bo.setAttributeValue("status", sStatus); - bo.setAttributeValue("remark", sRemark); - bo.setAttributeValue("inputuserid", oCurUser.getUserID()); - bo.setAttributeValue("inputorgid", oCurUser.getOrgID()); - bo.setAttributeValue("inputtime", sInputtime); - if (!validityCheck(bo)) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "证件类型和证件号已经存在"); - return ReturnMapUtil.getReturnMap(); - } - bom.saveObject(bo); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "保存成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "保存失败"); - return ReturnMapUtil.getReturnMap(); - } - } else { - // update - try { - String sSql = "update o set o.updatetime=:updatetime, o.updateorgid=:updateorgid, o.updateuserid=:updateuserid, "; - sSql += "o.certtype=:certtype,o.certid=:certid,o.name=:name,o.relative=:relative,o.tel=:tel,o.workunit=:workunit," - + "o.status=:status,o.remark=:remark "; - sSql += "where o.id=:id"; - BizObjectQuery boq = bom.createQuery(sSql); - boq.setParameter("updatetime", sUpdatetime); - boq.setParameter("updateorgid", oCurUser.getOrgID()); - boq.setParameter("updateuserid", oCurUser.getUserID()); - boq.setParameter("certtype", sCerttype); - boq.setParameter("certid", sCertid); - boq.setParameter("name", sName); - boq.setParameter("relative", sRelative); - boq.setParameter("tel", sTel); - boq.setParameter("workunit", sWorkunit); - boq.setParameter("status", sStatus); - boq.setParameter("remark", sRemark); - boq.setParameter("id", sId); - boq.executeUpdate(); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "编辑成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "保存失败"); - return ReturnMapUtil.getReturnMap(); - } - } - } - - private boolean validityCheck(BizObject bo) { - try { - String oldcerttype = ""; - String oldcertid = ""; - // 查询证件是否存在股东信息表中 - String certtype = bo.getAttribute("CERTTYPE").toString(); - String id = bo.getAttribute("id").toString(); - String certid = bo.getAttribute("CERTID").toString(); - if (!("".equals(id))) { - BizObjectManager oldbom = JBOFactory - .getBizObjectManager(CUSTOMER_FAMILY.CLASS_NAME); - BizObject oldbo1 = oldbom.createQuery("id=:id") - .setParameter("id", id).getSingleResult(false); - oldcerttype = oldbo1.getAttribute("CERTTYPE").toString(); - oldcertid = oldbo1.getAttribute("certid").toString(); - } - if (!(certtype.equals(oldcerttype) && certid.equals(oldcertid))) { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CUSTOMER_FAMILY.CLASS_NAME); - BizObject bo1 = bom - .createQuery("CERTTYPE=:CERTTYPE and CERTID=:CERTID") - .setParameter("CERTTYPE", certtype) - .setParameter("CERTID", certid).getSingleResult(false); - - if (bo1 != null) { - // this.errors="证件类型和证件号已经存在"; - return false; - } - } - } catch (Exception e) { - // TODO: handle exception - } - return true; - } -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerHistoryRecordServiceImpl.java b/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerHistoryRecordServiceImpl.java deleted file mode 100644 index 75bf3ef1d..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerHistoryRecordServiceImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -package apx.com.amarsoft.als.customer.service.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.jbo.CustomerJbo; -import apx.com.amarsoft.als.base.jbo.impl.CustomerJboImpl; -import apx.com.amarsoft.als.base.util.NameManager; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.customer.model.GlobalModel; -import apx.com.amarsoft.als.customer.service.CustomerHistoryRecordService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; -import com.tenwa.flow.comm.handler.flowmanage.OverdueProjectCache; - -public class CustomerHistoryRecordServiceImpl implements - CustomerHistoryRecordService { - // 日志对象 - private static Log logger = ARE.getLog(); - CustomerJbo jbo = new CustomerJboImpl(); - private GlobalModel GlobalModel; - - private Map initCheck(HttpServletRequest request, - Transaction sqlca) { - this.GlobalModel = new GlobalModel(); - if (!this.GlobalModel.checkMainId(request)) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - return null; - } - - @Override - public Map findCustomerHistoryRecordList( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - BizObject customerBo = jbo.getCustomerById(tx, - this.GlobalModel.getGlobalSCustomerId()); - String sCustomerName = customerBo.getAttribute("CUSTOMERNAME") == null ? "" - : customerBo.getAttribute("CUSTOMERNAME").toString(); - List bos = jbo.getCustomerHistoryRecordByCustomerId(tx, - this.GlobalModel.getGlobalSCustomerId()); - List> list = new ArrayList>(); - for (BizObject bo : bos) { - Map map = new HashMap(); - map.put("ID".toLowerCase(), bo.getAttribute("ID").getValue()); - map.put("cust_id".toLowerCase(), - this.GlobalModel.getGlobalSCustomerId()); - map.put("cust_name".toLowerCase(), sCustomerName); - map.put("CONTRACT_NUMBER".toLowerCase(), - bo.getAttribute("CONTRACT_NUMBER").getValue()); - map.put("PAYMENT_NUMBER".toLowerCase(), - bo.getAttribute("PAYMENT_NUMBER").getValue()); - map.put("CLEAN_LEASE_MONEY".toLowerCase(), - bo.getAttribute("CLEAN_LEASE_MONEY").getValue()); - map.put("PROJECT_MANAGE".toLowerCase(), NameManager.getUserName(bo - .getAttribute("PROJECT_MANAGE") == null ? "" : bo - .getAttribute("PROJECT_MANAGE").toString())); - map.put("PROJECT_DEPT".toLowerCase(), - bo.getAttribute("PROJECT_DEPT").getValue()); - map.put("PROJECT_DEPT_NAME".toLowerCase(), NameManager - .getOrgName(bo.getAttribute("PROJECT_DEPT") == null ? "" - : bo.getAttribute("PROJECT_DEPT").toString())); - map.put("rent_over".toLowerCase(), OverdueProjectCache - .getSurplusRent(bo.getAttribute("ID") == null ? "" : bo - .getAttribute("ID").toString(), bo - .getAttribute("PAYMENT_NUMBER") == null ? "" : bo - .getAttribute("PAYMENT_NUMBER").toString())); - map.put("out_list".toLowerCase(), OverdueProjectCache.getOutList(bo - .getAttribute("ID") == null ? "" : bo.getAttribute("ID") - .toString(), bo.getAttribute("PAYMENT_NUMBER") == null ? "" - : bo.getAttribute("PAYMENT_NUMBER").toString())); - map.put("incrent".toLowerCase(), OverdueProjectCache.getIncrent(bo - .getAttribute("ID") == null ? "" : bo.getAttribute("ID") - .toString(), bo.getAttribute("PAYMENT_NUMBER") == null ? "" - : bo.getAttribute("PAYMENT_NUMBER").toString())); - map.put("penalty_over".toLowerCase(), OverdueProjectCache - .getPenalty(bo.getAttribute("ID") == null ? "" : bo - .getAttribute("ID").toString(), bo - .getAttribute("PAYMENT_NUMBER") == null ? "" : bo - .getAttribute("PAYMENT_NUMBER").toString())); - list.add(map); - } - String sPageIndex = request.getParameter("pageIndex"); - String sLimit = request.getParameter("limit"); - if (sPageIndex == null) - sPageIndex = "1"; - if (sLimit == null) - sLimit = "10"; - int iPageIndex, iLimit; - iPageIndex = Integer.valueOf(sPageIndex); - iLimit = Integer.valueOf(sLimit); - iPageIndex = iPageIndex - 1; - - int pageIndexStart = (iPageIndex) * iLimit; - int pageIndexEnd = (iPageIndex + 1) * iLimit; - - List> returnList = new ArrayList>(); - for (int i = pageIndexStart; i < pageIndexEnd; i++) { - // 数据数量大于list数据 - if (i > (list.size() - 1)) { - break; - } - // 页码小于1 - if (iPageIndex + 1 < 1) { - break; - } - if (list.size() % iLimit == 0) { - if ((list.size() / iLimit) < iPageIndex) { - break; - } - } else { - if ((list.size() / iLimit) + 1 < iPageIndex) { - break; - } - } - returnList.add(list.get(i)); - } - Map body = new HashMap(); - body.put("data", returnList); - logger.info("FIND > HistoryRecord >>. SUCCESS"); - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerMangerServiceImpl.java b/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerMangerServiceImpl.java deleted file mode 100644 index 7dc0ddbcb..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerMangerServiceImpl.java +++ /dev/null @@ -1,330 +0,0 @@ -package apx.com.amarsoft.als.customer.service.impl; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.customer.service.CustomerAccountService; -import apx.com.amarsoft.als.customer.service.CustomerAddressService; -import apx.com.amarsoft.als.customer.service.CustomerBaseService; -import apx.com.amarsoft.als.customer.service.CustomerCertService; -import apx.com.amarsoft.als.customer.service.CustomerDocService; -import apx.com.amarsoft.als.customer.service.CustomerFamilyService; -import apx.com.amarsoft.als.customer.service.CustomerHistoryRecordService; -import apx.com.amarsoft.als.customer.service.CustomerMangerService; -import apx.com.amarsoft.als.customer.service.CustomerPersonService; -import apx.com.amarsoft.als.customer.service.CustomerTelService; -import apx.com.amarsoft.als.customer.service.CustomerVisitRecordService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -public class CustomerMangerServiceImpl implements CustomerMangerService { - - // 日志对象 - private static Log logger = ARE.getLog(); - // begin 实例化服务 - // 客户基础服务 - private CustomerBaseService baseService = new CustomerBaseServiceImpl(); - // 客户自然人服务 - private CustomerPersonService personService = new CustomerPersonServiceImpl(); - // 客户证件服务 - private CustomerCertService certService = new CustomerCertServiceImpl(); - // 客户联系地址服务 - private CustomerAddressService addressService = new CustomerAddressServiceImpl(); - // 客户联系电话服务 - private CustomerTelService telService = new CustomerTelServiceImpl(); - // 客户银行账户服务 - private CustomerAccountService accountService = new CustomerAccountServiceImpl(); - // 客户配偶家属服务 - private CustomerFamilyService famliyService = new CustomerFamilyServiceImpl(); - // 客户文件服务 - private CustomerDocService docService = new CustomerDocServiceImpl(); - // 客户拜访服务 - private CustomerVisitRecordService visitRecordService = new CustomerVisitRecordServiceImpl(); - // 客户交易服务 - private CustomerHistoryRecordService hisRecordService = new CustomerHistoryRecordServiceImpl(); - - // end - - // begin CustomerBaseService:客户基础服务 - public Map searchCustomerList(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - - try { - return baseService.searchCustomerList(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map initCustomerData(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return baseService.initCustomerData(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map loadNationcode(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return baseService.loadNationcode(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map getDowntown(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return baseService.getDowntown(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map getUnitKind(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return baseService.getUnitKind(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map findCert(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return baseService.findCert(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map findCustBaseInfo(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return baseService.findCustBaseInfo(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - // end - - // begin CustomerBusinessService:客户业务服务 - public Map addCustomer(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return personService.addCustomer(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map operationCustomer(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return personService.operationCustomer(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - // end - - // begin CustomerCertService:客户证件服务 - public Map operationOtherCert(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return certService.operationOtherCert(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - // end - - // begin CustomerAddressService:客户联系地址服务 - public Map operationAddress(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return addressService.operationAddress(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - // end - - // begin CustomerTelService:客户联系电话服务 - public Map operationTelphone(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return telService.operationTelphone(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - // end - - // begin CustomerAccountService:客户银行账户服务 - public Map operationAccount(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return accountService.operationAccount(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - // end - - // begin CustomerFamilyService:家庭成员服务 - public Map operationFamily(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return famliyService.operationFamily(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - // end - - // begin CustomerDocService:客户文件服务 - public Map findCustomerDocList(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return docService.findCustomerDocList(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map uploadAtts6(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return docService.uploadAtts6(request, sqlca, tx); - } catch (Exception e) { - tx.rollback(); - logger.error(e); - Map body = new HashMap(); - body.put("message", "上传失败!"); - ReturnMapUtil.setReturnMap(body, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - // end - - // begin CustomerVisitRecordService:客户拜访服务 - public Map findCustomerVisitRecordList( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - try { - return visitRecordService.findCustomerVisitRecordList(request, - sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map operationVisitRecord(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return visitRecordService.operationVisitRecord(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - public Map uploadFile(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return visitRecordService.uploadFile(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - // end - - // begin CustomerHistoryRecordService:客户交易服务 - public Map findCustomerHistoryRecordList( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - try { - return hisRecordService.findCustomerHistoryRecordList(request, - sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - // end - -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerPersonServiceImpl.java b/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerPersonServiceImpl.java deleted file mode 100644 index dfbc122e7..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerPersonServiceImpl.java +++ /dev/null @@ -1,985 +0,0 @@ -package apx.com.amarsoft.als.customer.service.impl; - -import java.net.URLDecoder; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import jbo.app.tenwa.customer.CUSTOMER_ADDRESS; -import jbo.app.tenwa.customer.CUSTOMER_INFO; -import jbo.app.tenwa.customer.CUSTOMER_PERSON; -import jbo.sys.CODE_LIBRARY; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.DateUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.customer.constant.CustomerConstant; -import apx.com.amarsoft.als.customer.model.GlobalModel; -import apx.com.amarsoft.als.customer.service.CustomerPersonService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; -import com.tenwa.comm.util.date.DateAssistant; -import com.tenwa.customer.controller.partner.NewPartnerPersonController; -import com.tenwa.customer.controller.person.NewCustomerPersonController; - -public class CustomerPersonServiceImpl implements CustomerPersonService { - // 日志对象 - private static Log logger = ARE.getLog(); - private GlobalModel GlobalModel; - // begin 客户PERSON全局变量 - private String sFullname; - private String sSex; - private String sCustsource; - private String sCustkind; - private String sBirthday; - private String sNationality; - private String sMarriage; - private String sPoliticalface; - private String sCerttype; - private String sCertid; - private String sCounty; - private String sEduexperience; - private String sEdurecord; - private String sEdudegree; - private String sGraduateyear; - private String sSino; - private String sNativeplace; - private String sYearincome; - private String sFamilymonthincome; - private String sOccupation; - private String sWorkcorp; - private String sWorkadd; - private String sHeadship; - private String sWorktel; - private String sTitle; - private String sWorkzip; - private String sPayaccountbank; - private String sWorkbegindate; - private String sPayaccount; - private String sRemark; - private String sStatus; - private String sUnitKind; - - private String sInputtime; - private String sUpdatetime; - private String sCustomerId; - private String sId; - private String sType; - private String sProvince; - private String sCity; - private String sCountry; - - // end - - private void initGlobal(Map fieldMap) { - this.sCustomerId = this.GlobalModel.getGlobalSCustomerId(); - this.sId = fieldMap.get("id") == null ? "" : fieldMap.get("id") - .toString(); - this.sInputtime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sUpdatetime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sType = fieldMap.get("type") == null ? "" : fieldMap.get("type") - .toString(); - - this.sFullname = fieldMap.get("FULLNAME") == null ? null : fieldMap - .get("FULLNAME").toString(); - this.sSex = fieldMap.get("SEX") == null ? null : fieldMap.get("SEX") - .toString(); - this.sCustsource = fieldMap.get("CUSTSOURCE") == null ? null : fieldMap - .get("CUSTSOURCE").toString(); - this.sCustkind = fieldMap.get("CUSTKIND") == null ? null : fieldMap - .get("CUSTKIND").toString(); - this.sBirthday = fieldMap.get("BIRTHDAY") == null ? null : fieldMap - .get("BIRTHDAY").toString(); - this.sNationality = fieldMap.get("NATIONALITY") == null ? null - : fieldMap.get("NATIONALITY").toString(); - this.sMarriage = fieldMap.get("MARRIAGE") == null ? null : fieldMap - .get("MARRIAGE").toString(); - this.sPoliticalface = fieldMap.get("POLITICALFACE") == null ? null - : fieldMap.get("POLITICALFACE").toString(); - this.sCerttype = fieldMap.get("CERTTYPE") == null ? null : fieldMap - .get("CERTTYPE").toString(); - this.sCertid = fieldMap.get("CERTID") == null ? null : fieldMap.get( - "CERTID").toString(); - this.sCounty = fieldMap.get("county") == null ? null : fieldMap.get( - "county").toString(); - this.sCountry = fieldMap.get("COUNTRY") == null ? null : fieldMap.get( - "COUNTRY").toString(); - this.sEduexperience = fieldMap.get("EDUEXPERIENCE") == null ? null - : fieldMap.get("EDUEXPERIENCE").toString(); - this.sEdurecord = fieldMap.get("EDURECORD") == null ? null : fieldMap - .get("EDURECORD").toString(); - this.sEdudegree = fieldMap.get("EDUDEGREE") == null ? null : fieldMap - .get("EDUDEGREE").toString(); - this.sGraduateyear = fieldMap.get("GRADUATEYEAR") == null ? null - : fieldMap.get("GRADUATEYEAR").toString(); - this.sSino = fieldMap.get("SINO") == null ? null : fieldMap.get("SINO") - .toString(); - this.sNativeplace = fieldMap.get("NATIVEPLACE") == null ? null - : fieldMap.get("NATIVEPLACE").toString(); - this.sYearincome = fieldMap.get("YEARINCOME") == null ? null : fieldMap - .get("YEARINCOME").toString(); - this.sFamilymonthincome = fieldMap.get("FAMILYMONTHINCOME") == null ? null - : fieldMap.get("FAMILYMONTHINCOME").toString(); - this.sOccupation = fieldMap.get("OCCUPATION") == null ? null : fieldMap - .get("OCCUPATION").toString(); - this.sWorkcorp = fieldMap.get("WORKCORP") == null ? null : fieldMap - .get("WORKCORP").toString(); - this.sWorkadd = fieldMap.get("WORKADD") == null ? null : fieldMap.get( - "WORKADD").toString(); - this.sHeadship = fieldMap.get("HEADSHIP") == null ? null : fieldMap - .get("HEADSHIP").toString(); - this.sWorktel = fieldMap.get("WORKTEL") == null ? null : fieldMap.get( - "WORKTEL").toString(); - this.sTitle = fieldMap.get("title") == null ? null : fieldMap.get( - "title").toString(); - this.sWorkzip = fieldMap.get("WORKZIP") == null ? null : fieldMap.get( - "WORKZIP").toString(); - this.sPayaccountbank = fieldMap.get("PAYACCOUNTBANK") == null ? null - : fieldMap.get("PAYACCOUNTBANK").toString(); - this.sWorkbegindate = fieldMap.get("WORKBEGINDATE") == null ? null - : fieldMap.get("WORKBEGINDATE").toString(); - this.sPayaccount = fieldMap.get("PAYACCOUNT") == null ? null : fieldMap - .get("PAYACCOUNT").toString(); - this.sRemark = fieldMap.get("REMARK") == null ? null : fieldMap.get( - "REMARK").toString(); - this.sStatus = fieldMap.get("status") == null ? null : fieldMap.get( - "status").toString(); - this.sUnitKind = fieldMap.get("UNITKIND") == null ? null : fieldMap - .get("UNITKIND").toString(); - this.sProvince = fieldMap.get("province") == null ? null : fieldMap - .get("province").toString(); - this.sCity = fieldMap.get("city") == null ? null : fieldMap.get("city") - .toString(); - } - - private Map initCheck(HttpServletRequest request, - Transaction sqlca) { - this.GlobalModel = new GlobalModel(); - if (!this.GlobalModel.checkMainId(request)) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - return null; - } - - /** - * 自然人操作 - * - * @param request - * @param sqlca - * @param tx - * @param fieldMap - * @return - * @throws Exception - */ - private Map operationCustomer(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx, Map fieldMap, - ASUser oCurUser) throws Exception { - - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TALBE_CUSTOMER_PERSON.className); - tx.join(bom); - if ("".equals(sId)) { - try { - BizObject bo = bom.newObject(); - bo.setAttributeValue("customerid", sCustomerId); - bo.setAttributeValue("inputuserid", oCurUser.getUserID()); - bo.setAttributeValue("inputorgid", oCurUser.getOrgID()); - bo.setAttributeValue("inputtime", sInputtime); - - bo.setAttributeValue("FULLNAME", sFullname); - bo.setAttributeValue("SEX", sSex); - bo.setAttributeValue("CUSTSOURCE", sCustsource); - bo.setAttributeValue("CUSTKIND", sCustkind); - bo.setAttributeValue("BIRTHDAY", sBirthday); - bo.setAttributeValue("NATIONALITY", sNationality); - bo.setAttributeValue("MARRIAGE", sMarriage); - bo.setAttributeValue("POLITICALFACE", sPoliticalface); - bo.setAttributeValue("CERTTYPE", sCerttype); - bo.setAttributeValue("CERTID", sCertid); - bo.setAttributeValue("county", sCounty); - bo.setAttributeValue("EDUEXPERIENCE", sEduexperience); - bo.setAttributeValue("EDURECORD", sEdurecord); - bo.setAttributeValue("EDUDEGREE", sEdudegree); - bo.setAttributeValue("GRADUATEYEAR", sGraduateyear); - bo.setAttributeValue("SINO", sSino); - bo.setAttributeValue("NATIVEPLACE", sNativeplace); - bo.setAttributeValue("YEARINCOME", sYearincome); - bo.setAttributeValue("FAMILYMONTHINCOME", sFamilymonthincome); - bo.setAttributeValue("OCCUPATION", sOccupation); - bo.setAttributeValue("WORKCORP", sWorkcorp); - bo.setAttributeValue("WORKADD", sWorkadd); - bo.setAttributeValue("HEADSHIP", sHeadship); - bo.setAttributeValue("WORKTEL", sWorktel); - bo.setAttributeValue("title", sTitle); - bo.setAttributeValue("WORKZIP", sWorkzip); - bo.setAttributeValue("PAYACCOUNTBANK", sPayaccountbank); - bo.setAttributeValue("WORKBEGINDATE", sWorkbegindate); - bo.setAttributeValue("PAYACCOUNT", sPayaccount); - bo.setAttributeValue("REMARK", sRemark); - bo.setAttributeValue("UNITKIND", sUnitKind); - bo.setAttributeValue("province", sProvince); - bo.setAttributeValue("city", sCity); - bo.setAttributeValue("country", sCountry); - bo.setAttributeValue("status", sStatus); - bom.saveObject(bo); - tx.commit(); - afterInsert(tx, sCustkind, sCustomerId, sFullname, sStatus, - oCurUser); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "保存成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "保存失败"); - return ReturnMapUtil.getReturnMap(); - } - } else { - try { - String sSql = "update o set o.updatetime=:updatetime,o.updateorgid=:updateorgid,o.updateuserid=:updateuserid,"; - if (null != this.sUnitKind) - sSql += "o.UNITKIND=:UNITKIND,"; - if (null != this.sFullname) - sSql += "o.FULLNAME=:FULLNAME,"; - if (null != this.sSex) - sSql += "o.SEX=:SEX,"; - if (null != this.sCustsource) - sSql += "o.CUSTSOURCE=:CUSTSOURCE,"; - if (null != this.sCustkind) - sSql += "o.CUSTKIND=:CUSTKIND,"; - if (null != this.sBirthday) - sSql += "o.BIRTHDAY=:BIRTHDAY,"; - if (null != this.sNationality) - sSql += "o.NATIONALITY=:NATIONALITY,"; - if (null != this.sMarriage) - sSql += "o.MARRIAGE=:MARRIAGE,"; - if (null != this.sPoliticalface) - sSql += "o.POLITICALFACE=:POLITICALFACE,"; - if (null != this.sCerttype) - sSql += "o.CERTTYPE=:CERTTYPE,"; - if (null != this.sCertid) - sSql += "o.CERTID=:CERTID,"; - if (null != this.sCounty) - sSql += "o.county=:county,"; - if (null != this.sEduexperience) - sSql += "o.EDUEXPERIENCE=:EDUEXPERIENCE,"; - if (null != this.sEdurecord) - sSql += "o.EDURECORD=:EDURECORD,"; - if (null != this.sEdudegree) - sSql += "o.EDUDEGREE=:EDUDEGREE,"; - if (null != this.sGraduateyear) - sSql += "o.GRADUATEYEAR=:GRADUATEYEAR,"; - if (null != this.sSino) - sSql += "o.SINO=:SINO,"; - if (null != this.sNativeplace) - sSql += "o.NATIVEPLACE=:NATIVEPLACE,"; - if (null != this.sYearincome) - sSql += "o.YEARINCOME=:YEARINCOME,"; - if (null != this.sFamilymonthincome) - sSql += "o.FAMILYMONTHINCOME=:FAMILYMONTHINCOME,"; - if (null != this.sOccupation) - sSql += "o.OCCUPATION=:OCCUPATION,"; - if (null != this.sWorkcorp) - sSql += "o.WORKCORP=:WORKCORP,"; - if (null != this.sWorkadd) - sSql += "o.WORKADD=:WORKADD,"; - if (null != this.sHeadship) - sSql += "o.HEADSHIP=:HEADSHIP,"; - if (null != this.sWorktel) - sSql += "o.WORKTEL=:WORKTEL,"; - if (null != this.sTitle) - sSql += "o.title=:title,"; - if (null != this.sWorkzip) - sSql += "o.WORKZIP=:WORKZIP,"; - if (null != this.sPayaccountbank) - sSql += "o.PAYACCOUNTBANK=:PAYACCOUNTBANK,"; - if (null != this.sWorkbegindate) - sSql += "o.WORKBEGINDATE=:WORKBEGINDATE,"; - if (null != this.sPayaccount) - sSql += "o.PAYACCOUNT=:PAYACCOUNT,"; - if (null != this.sRemark) - sSql += "o.REMARK=:REMARK,"; - if (null != this.sStatus) - sSql += "o.STATUS=:STATUS,"; - if (null != this.sProvince) - sSql += "o.province=:province,"; - if (null != this.sCity) - sSql += "o.city=:city,"; - - sSql = sSql.substring(0, sSql.length() - 1); - sSql += " where o.id=:id"; - BizObjectQuery boq = bom.createQuery(sSql); - boq.setParameter("updatetime", sUpdatetime); - boq.setParameter("updateorgid", oCurUser.getOrgID()); - boq.setParameter("updateuserid", oCurUser.getUserID()); - - if (null != this.sUnitKind) - boq.setParameter("UNITKIND", - this.sUnitKind.equals("") ? null : this.sUnitKind); - if (null != this.sFullname) - boq.setParameter("FULLNAME", - this.sFullname.equals("") ? null : this.sFullname); - if (null != this.sSex) - boq.setParameter("SEX", this.sSex.equals("") ? null - : this.sSex); - if (null != this.sCustsource) - boq.setParameter("CUSTSOURCE", - this.sCustsource.equals("") ? null - : this.sCustsource); - if (null != this.sCustkind) - boq.setParameter("CUSTKIND", - this.sCustkind.equals("") ? null : this.sCustkind); - if (null != this.sBirthday) - boq.setParameter("BIRTHDAY", - this.sBirthday.equals("") ? null : this.sBirthday); - if (null != this.sNationality) - boq.setParameter("NATIONALITY", this.sNationality - .equals("") ? null : this.sNationality); - if (null != this.sMarriage) - boq.setParameter("MARRIAGE", - this.sMarriage.equals("") ? null : this.sMarriage); - if (null != this.sPoliticalface) - boq.setParameter("POLITICALFACE", this.sPoliticalface - .equals("") ? null : this.sPoliticalface); - if (null != this.sCerttype) - boq.setParameter("CERTTYPE", - this.sCerttype.equals("") ? null : this.sCerttype); - if (null != this.sCertid) - boq.setParameter("CERTID", this.sCertid.equals("") ? null - : this.sCertid); - if (null != this.sCounty) - boq.setParameter("county", this.sCounty.equals("") ? null - : this.sCounty); - if (null != this.sEduexperience) - boq.setParameter("EDUEXPERIENCE", this.sEduexperience - .equals("") ? null : this.sEduexperience); - if (null != this.sEdurecord) - boq.setParameter("EDURECORD", - this.sEdurecord.equals("") ? null : this.sEdurecord); - if (null != this.sEdudegree) - boq.setParameter("EDUDEGREE", - this.sEdudegree.equals("") ? null : this.sEdudegree); - if (null != this.sGraduateyear) - boq.setParameter("GRADUATEYEAR", this.sGraduateyear - .equals("") ? null : this.sGraduateyear); - if (null != this.sSino) - boq.setParameter("SINO", this.sSino.equals("") ? null - : this.sSino); - if (null != this.sNativeplace) - boq.setParameter("NATIVEPLACE", this.sNativeplace - .equals("") ? null : this.sNativeplace); - if (null != this.sYearincome) - boq.setParameter("YEARINCOME", - this.sYearincome.equals("") ? null - : this.sYearincome); - if (null != this.sFamilymonthincome) - boq.setParameter("FAMILYMONTHINCOME", - this.sFamilymonthincome.equals("") ? null - : this.sFamilymonthincome); - if (null != this.sOccupation) - boq.setParameter("OCCUPATION", - this.sOccupation.equals("") ? null - : this.sOccupation); - if (null != this.sWorkcorp) - boq.setParameter("WORKCORP", - this.sWorkcorp.equals("") ? null : this.sWorkcorp); - if (null != this.sWorkadd) - boq.setParameter("WORKADD", this.sWorkadd.equals("") ? null - : this.sWorkadd); - if (null != this.sHeadship) - boq.setParameter("HEADSHIP", - this.sHeadship.equals("") ? null : this.sHeadship); - if (null != this.sWorktel) - boq.setParameter("WORKTEL", this.sWorktel.equals("") ? null - : this.sWorktel); - if (null != this.sTitle) - boq.setParameter("title", this.sTitle.equals("") ? null - : this.sTitle); - if (null != this.sWorkzip) - boq.setParameter("WORKZIP", this.sWorkzip.equals("") ? null - : this.sWorkzip); - if (null != this.sPayaccountbank) - boq.setParameter("PAYACCOUNTBANK", this.sPayaccountbank - .equals("") ? null : this.sPayaccountbank); - if (null != this.sWorkbegindate) - boq.setParameter("WORKBEGINDATE", this.sWorkbegindate - .equals("") ? null : this.sWorkbegindate); - if (null != this.sPayaccount) - boq.setParameter("PAYACCOUNT", - this.sPayaccount.equals("") ? null - : this.sPayaccount); - if (null != this.sRemark) - boq.setParameter("REMARK", this.sRemark.equals("") ? null - : this.sRemark); - if (null != this.sStatus) - boq.setParameter("STATUS", this.sStatus.equals("") ? null - : this.sStatus); - if (null != this.sProvince) - boq.setParameter("province", - this.sProvince.equals("") ? null : this.sProvince); - if (null != this.sCity) - boq.setParameter("city", this.sCity.equals("") ? null - : this.sCity); - boq.setParameter("id", sId); - boq.executeUpdate(); - tx.commit(); - if (!(sCustkind == null || sCustomerId == null - || sFullname == null || sStatus == null)) { - afterUpdate(tx, sCustkind, sCustomerId, sFullname, sStatus, - oCurUser); - } - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "编辑成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "保存失败"); - return ReturnMapUtil.getReturnMap(); - } - } - - } - - @SuppressWarnings({ "unchecked", "deprecation" }) - public Map operationCustomer(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - String sUserId = (String) request.getSession().getAttribute("userid"); - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } - } - initGlobal(fieldMap); - switch (sType) { - case CustomerConstant.CUSTOMER_TYPE_PERSON: - return operationCustomer(request, sqlca, tx, fieldMap, oCurUser); - } - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - @SuppressWarnings({ "unchecked", "deprecation" }) - public Map addCustomer(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - String sUserId = (String) request.getSession().getAttribute("userid"); - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } - } - String sType = fieldMap.get("type").toString(); - String sCertId = ""; - String sValiArea = ""; - String sCertType = fieldMap.get("certtype").toString(); - String sNatonCode = fieldMap.get("nationcodename").toString(); // 国际item - - Map returnMap = new HashMap(); - String sAddressDetail = fieldMap.get("addressDetail") == null ? "" - : fieldMap.get("addressDetail").toString(); - if ("".equals(sAddressDetail)) { - returnMap = saveCust(sType, oCurUser, fieldMap, sqlca, tx); - if (!ResultConstant.SUCCESS_RESULT_CODE - .equals(((Map) returnMap.get("outline")) - .get("code"))) { - return returnMap; - } - } else { - sCertId = fieldMap.get("certid").toString(); - sValiArea = sCertId.substring(0, 6); - BizObject bo = null; - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CODE_LIBRARY.CLASS_NAME); - BizObjectQuery boq = bom - .createQuery("codeno=:codeno and itemno=itemno") - .setParameter("codeno", "AreaCode") - .setParameter("itemno", sValiArea); - bo = boq.getSingleResult(false); - } catch (JBOException e2) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - if (bo == null) { - Map body = new HashMap(); - body.put("code", 500); - ReturnMapUtil.setReturnMap(body, - ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - logger.info("获取自然人信息列表"); - - returnMap = saveCust(sType, oCurUser, fieldMap, sqlca, tx); - if (!ResultConstant.SUCCESS_RESULT_CODE - .equals(((Map) returnMap.get("outline")) - .get("code"))) { - return returnMap; - } - } - - if (!(("Ind01".equals(sCertType) || "Ind08".equals(sCertType)) && "CHN" - .equals(sNatonCode))) { - return returnMap; - } - sCertId = fieldMap.get("certid").toString(); - sValiArea = sCertId.substring(0, 6); - String sFullName = fieldMap.get("customername").toString(); - BizObject bo = null; - String sCustomerId = ""; - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CUSTOMER_INFO.CLASS_NAME); - BizObjectQuery boq = bom.createQuery("certid=:certid") - .setParameter("certid", sCertId); - bo = boq.getSingleResult(false); - sCustomerId = bo.getAttribute("customerid").toString(); - } catch (JBOException e2) { - return returnMap; - } - String sProvice = sValiArea.substring(0, 2); - String sCity = sValiArea.substring(0, 4); - sProvice += "0000"; - sCity += "00"; - String sStatus = fieldMap.get("status").toString(); // 状态 - - if (!"status01".equals(sStatus)) { - sStatus = "status04"; - } - - String sSex = ""; // 性别 - String sBirthDay = ""; // 生日 - Map map = certId2userInfo(sCertType, sCertId); - sSex = map.get("sex") == null ? "" : map.get("sex").toString(); - sBirthDay = map.get("birthDay") == null ? "" : map.get("birthDay") - .toString(); - // String sNatonCode = fieldMap.get("nationcodename").toString(); // - // 国际item - // no - String sOrgId = oCurUser.getOrgID(); // 部门ID - String curDate = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - String sArea = sValiArea; - bo = null; - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME); - tx = JBOFactory.createJBOTransaction(); - tx.join(bom); - bo = bom.newObject(); - bo.setAttributeValue("CUSTOMERID", sCustomerId); - bo.setAttributeValue("status", sStatus); - bo.setAttributeValue("CERTID", sCertId); - bo.setAttributeValue("SEX", sSex); - bo.setAttributeValue("BIRTHDAY", sBirthDay); - bo.setAttributeValue("CERTTYPE", - CustomerConstant.CERT_TYPE.IND01.itemNo); - bo.setAttributeValue("COUNTRY", sNatonCode); - bo.setAttributeValue("province", sProvice); - bo.setAttributeValue("city", sCity); - bo.setAttributeValue("FULLNAME", sFullName); - bo.setAttributeValue("INPUTUSERID", sUserId); - bo.setAttributeValue("UPDATEUSERID", sUserId); - bo.setAttributeValue("INPUTORGID", sOrgId); - bo.setAttributeValue("UPDATEORGID", sOrgId); - - bo.setAttributeValue("inputtime", curDate); - bo.setAttributeValue("updatetime", curDate); - bom.saveObject(bo); - tx.commit(); - } catch (JBOException e) { - try { - tx.rollback(); - return returnMap; - } catch (JBOException e1) { - return returnMap; - } - } - bo = null; - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CUSTOMER_ADDRESS.CLASS_NAME); - tx = JBOFactory.createJBOTransaction(); - tx.join(bom); - bo = bom.newObject(); - bo.setAttributeValue("customerid", sCustomerId); - bo.setAttributeValue("addtype", "0060"); - bo.setAttributeValue("isadd", "yes"); - bo.setAttributeValue("isnew", "yes"); - bo.setAttributeValue("country", sNatonCode); - bo.setAttributeValue("province", sArea); - bo.setAttributeValue("dressdetail", sAddressDetail); - - bo.setAttributeValue("inputuserid", sUserId); - bo.setAttributeValue("updateuserid", sUserId); - bo.setAttributeValue("inputorgid", sOrgId); - bo.setAttributeValue("updateorgid", sOrgId); - - bo.setAttributeValue("inputtime", curDate); - bo.setAttributeValue("updatetime", curDate); - bom.saveObject(bo); - tx.commit(); - } catch (JBOException e) { - try { - tx.rollback(); - return returnMap; - } catch (JBOException e1) { - return returnMap; - } - } - return returnMap; - } - - /** - * 身份证 计算生日和性别 - * - * @param certType - * @param certId - * @return - */ - private Map certId2userInfo(String certType, String certId) { - int sCert2Sex = 0; - String sCert2BirthDay = ""; - if ("Ind01".equals(certType) || "Ind08".equals(certType)) { - if (certId.length() == 15) { - sCert2Sex = Integer.valueOf(certId.substring(14)); - if (sCert2Sex % 2 == 0) { - sCert2Sex = 2; - } else { - sCert2Sex = 1; - } - - sCert2BirthDay = certId.substring(6, 12); - sCert2BirthDay = "19" + sCert2BirthDay.substring(0, 2) + "/" - + sCert2BirthDay.substring(2, 4) + "/" - + sCert2BirthDay.substring(4, 6); - } else if (certId.length() == 18) { - sCert2Sex = Integer.valueOf(certId.substring(16, 17)); - sCert2BirthDay = certId.substring(6, 14); - sCert2BirthDay = sCert2BirthDay.substring(0, 4) + "/" - + sCert2BirthDay.substring(4, 6) + "/" - + sCert2BirthDay.substring(6, 8); - if (sCert2Sex % 2 == 0) { - sCert2Sex = 2; - } else { - sCert2Sex = 1; - } - } - } - Map map = new HashMap(); - map.put("sex", sCert2Sex); - map.put("birthDay", sCert2BirthDay); - return map; - } - - /** - * 保存客户 - * - * @param sType - * @param oCurUser - * @param fieldMap - * @param sqlca - * @param tx - * @return - */ - private Map saveCust(String sType, ASUser oCurUser, - Map fieldMap, Transaction sqlca, JBOTransaction tx) { - switch (sType) { - // 自然人信息列表 - case CustomerConstant.CUSTOMER_TYPE_PERSON: - logger.info("获取自然人信息列表"); - try { - Map returnMap = addPersonCustomer(oCurUser, - fieldMap, sqlca, tx); - if (ResultConstant.SUCCESS_RESULT_CODE.equals(returnMap - .get("code"))) { - tx.commit(); - ReturnMapUtil.setReturnMap(returnMap, - ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } else { - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, returnMap - .get("result") == null ? "" : returnMap - .get("result").toString()); - return ReturnMapUtil.getReturnMap(); - } - } catch (Exception e) { - try { - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "添加失败"); - return ReturnMapUtil.getReturnMap(); - } catch (JBOException e1) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "添加失败"); - return ReturnMapUtil.getReturnMap(); - } - } - case CustomerConstant.CUSTOMER_TYPE_PARTNER_PERSON: - logger.info("获取担保自然人信息列表"); - try { - Map returnMap = addPartnerPersonCustomer( - oCurUser, fieldMap, sqlca, tx); - if (ResultConstant.SUCCESS_RESULT_CODE.equals(returnMap - .get("code"))) { - tx.commit(); - ReturnMapUtil.setReturnMap(returnMap, - ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - } catch (Exception e) { - try { - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } catch (JBOException e1) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - } - default: - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - /** - * 添加担保自然人客户 - * - * @param oCurUser - * @param fieldMap - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - private Map addPartnerPersonCustomer(ASUser oCurUser, - Map fieldMap, Transaction sqlca, JBOTransaction tx) - throws Exception { - - Map body = new HashMap(); - String sCertType = fieldMap.get("certtype").toString(); // 证件code - String sCertId = fieldMap.get("certid").toString(); // 证件号 - String sNatonCode = fieldMap.get("nationcodename").toString(); // 国际item - // no - String sCustomerType = CustomerConstant.CUST_TYPE.legal.itemNo; // - String sPartnerType = CustomerConstant.CUSTOMER_TYPE.assuror.itemNo; - String sCustomerName = fieldMap.get("customerName").toString(); // 客户名称 - String sUserId = oCurUser.getUserID(); - String sOrgId = oCurUser.getOrgID(); - NewPartnerPersonController oCp = new NewPartnerPersonController(); - oCp.setCertId(sCertId); - oCp.setCertType(sCertType); - oCp.setCustomerName(sCustomerName); - oCp.setCustomerType(sCustomerType); - oCp.setNationCode(sNatonCode); - oCp.setOrgId(sOrgId); - oCp.setUserId(sUserId); - oCp.setPartnerType(sPartnerType); - try { - String result = oCp.checkCustomer(tx); - if (result.startsWith(ResultConstant.SUCCESS_RESULT_CODE)) { - body.put("code", ResultConstant.SUCCESS_RESULT_CODE); - body.put("result", result); - } else { - body.put("code", ResultConstant.FAIL_RESULT_CODE); - body.put("result", result); - } - tx.commit(); - } catch (Exception e) { - body.put("code", ResultConstant.FAIL_RESULT_CODE); - body.put("result", "添加出现异常"); - tx.rollback(); - } - return body; - } - - /** - * 添加 :自然人客户 - * - * @param oCurUser - * @param fieldMap - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - private Map addPersonCustomer(ASUser oCurUser, - Map fieldMap, Transaction sqlca, JBOTransaction tx) - throws Exception { - Map body = new HashMap(); - String sCertType = fieldMap.get("certtype").toString(); // 证件code - String sCertId = fieldMap.get("certid").toString(); // 证件号 - String sNatonCode = fieldMap.get("nationcodename").toString(); // 国际item - // no - String sStatus = fieldMap.get("status").toString(); // 状态 - String sCustomerName = fieldMap.get("customername").toString(); // 客户名称 - String sCustomerType = CustomerConstant.CUST_TYPE.legal.itemNo; // - String sUserId = oCurUser.getUserID(); - String sOrgId = oCurUser.getOrgID(); - NewCustomerPersonController oCp = new NewCustomerPersonController(); - oCp.setCertId(sCertId); - oCp.setCertType(sCertType); - oCp.setCustomerName(sCustomerName); - oCp.setCustomerType(sCustomerType); - oCp.setNationCode(sNatonCode); - oCp.setStatus(sStatus); - oCp.setOrgId(sOrgId); - oCp.setUserId(sUserId); - try { - String result = oCp.checkCustomer(tx); - if (result.startsWith(ResultConstant.SUCCESS_RESULT_CODE)) { - body.put("code", ResultConstant.SUCCESS_RESULT_CODE); - body.put("result", result); - } else { - body.put("code", ResultConstant.FAIL_RESULT_CODE); - body.put("result", result); - } - tx.commit(); - } catch (Exception e) { - body.put("code", ResultConstant.FAIL_RESULT_CODE); - body.put("result", "添加出现异常"); - tx.rollback(); - } - return body; - } - - private void afterInsert(JBOTransaction tx, String sCustkind, - String sCustomerId, String sFullName, String sStatus, - ASUser oCurUser) throws Exception { - // 同步更新customer_info custkind字段和customer_type status字段 - BizObjectManager custManager = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_INFO.className); - BizObject cust = custManager.createQuery("customerid=:customerid ") - .setParameter("customerid", sCustomerId).getSingleResult(true); - BizObjectManager custtypeManager = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_TYPE.className); - BizObject custtype = custtypeManager - .createQuery( - "customerid=:customerid and custtype='cust_type.cust'") - .setParameter("customerid", sCustomerId).getSingleResult(true); - if (!custtype.getAttribute("custstatus").getString().equals(sStatus)) { - BizObjectQuery custtypebq = custtypeManager - .createQuery("update O set custstatus=:custstatus,updateuserid=:updateuserid," - + "updatetime=:updatetime,updateorgid=:updateorgid " - + "where customerid=:customerid and custtype='cust_type.cust'"); - custtypebq.setParameter("custstatus", sStatus); - custtypebq.setParameter("customerid", sCustomerId); - custtypebq.setParameter("updateuserid", oCurUser.getUserID()); - custtypebq.setParameter("updatetime", DateAssistant.getTodayNow()); - custtypebq.setParameter("updateorgid", oCurUser.getOrgID()); - custtypebq.executeUpdate(); - } - if (!cust.getAttribute("custkind").getString().equals(sCustkind)) { - BizObjectQuery custbq = custManager - .createQuery("update O set custkind=:custkind,updateuserid=:updateuserid," - + "updatetime=:updatetime,updateorgid=:updateorgid " - + "where customerid=:customerid "); - custbq.setParameter("customerid", sCustomerId); - custbq.setParameter("updateuserid", oCurUser.getUserID()); - custbq.setParameter("updatetime", DateAssistant.getTodayNow()); - custbq.setParameter("updateorgid", oCurUser.getOrgID()); - custbq.setParameter("custkind", sCustkind); - custbq.executeUpdate(); - } - - } - - private void afterUpdate(JBOTransaction tx, String sCustkind, - String sCustomerId, String sFullName, String sStatus, - ASUser oCurUser) throws Exception { - BizObjectManager custManager = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_INFO.className); - BizObject cust = custManager.createQuery("customerid=:customerid ") - .setParameter("customerid", sCustomerId).getSingleResult(true); - BizObjectManager custtypeManager = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_TYPE.className); - BizObject custtype = custtypeManager - .createQuery( - "customerid=:customerid and custtype='cust_type.cust'") - .setParameter("customerid", sCustomerId).getSingleResult(true); - if (!custtype.getAttribute("custstatus").getString().equals(sStatus)) { - BizObjectQuery custtypebq = custtypeManager - .createQuery("update O set custstatus=:custstatus,updateuserid=:updateuserid," - + "updatetime=:updatetime,updateorgid=:updateorgid " - + "where customerid=:customerid and custtype='cust_type.cust'"); - custtypebq.setParameter("custstatus", sStatus); - custtypebq.setParameter("customerid", sCustomerId); - custtypebq.setParameter("updateuserid", oCurUser.getUserID()); - custtypebq.setParameter("updatetime", DateAssistant.getTodayNow()); - custtypebq.setParameter("updateorgid", oCurUser.getOrgID()); - custtypebq.executeUpdate(); - } - if (!cust.getAttribute("custkind").getString().equals(sCustkind)) { - BizObjectQuery custbq = custManager - .createQuery("update O set custkind=:custkind,updateuserid=:updateuserid," - + "updatetime=:updatetime,updateorgid=:updateorgid " - + "where customerid=:customerid "); - custbq.setParameter("customerid", sCustomerId); - custbq.setParameter("updateuserid", oCurUser.getUserID()); - custbq.setParameter("updatetime", DateAssistant.getTodayNow()); - custbq.setParameter("updateorgid", oCurUser.getOrgID()); - custbq.setParameter("custkind", sCustkind); - custbq.executeUpdate(); - } - if (!cust.getAttribute("customername").getString().equals(sFullName)) { - BizObjectQuery custbq = custManager - .createQuery("update O set customername=:customername,updateuserid=:updateuserid," - + "updatetime=:updatetime,updateorgid=:updateorgid" - + " where customerid=:customerid "); - custbq.setParameter("customerid", sCustomerId); - custbq.setParameter("updateuserid", oCurUser.getUserID()); - custbq.setParameter("updatetime", DateAssistant.getTodayNow()); - custbq.setParameter("updateorgid", oCurUser.getOrgID()); - custbq.setParameter("customername", sFullName); - custbq.executeUpdate(); - } - } -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerTelServiceImpl.java b/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerTelServiceImpl.java deleted file mode 100644 index 079e6c1b5..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerTelServiceImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -package apx.com.amarsoft.als.customer.service.impl; - -import java.net.URLDecoder; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.DateUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.customer.constant.CustomerConstant; -import apx.com.amarsoft.als.customer.model.GlobalModel; -import apx.com.amarsoft.als.customer.service.CustomerTelService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class CustomerTelServiceImpl implements CustomerTelService { - // 日志对象 - private static Log logger = ARE.getLog(); - private GlobalModel GlobalModel; - - // begin 客户账户全局变量 - private String sCustomerId; - private String sId; - private String sType; - private String sInputtime; - private String sUpdatetime; - private String sTelType; - private String sIntarea; - private String sIsNew; - private String sArea; - private String sTelephone; - private String sExt; - - // end - - private void initGlobal(Map fieldMap) { - this.sCustomerId = this.GlobalModel.getGlobalSCustomerId(); - this.sId = fieldMap.get("id") == null ? "" : fieldMap.get("id") - .toString(); - this.sTelType = fieldMap.get("teltype") == null ? "" : fieldMap.get( - "teltype").toString(); - this.sIntarea = fieldMap.get("intarea") == null ? "" : fieldMap - .get("intarea").toString(); - this.sIsNew = fieldMap.get("isnew") == null ? "" : fieldMap - .get("isnew").toString(); - this.sArea = fieldMap.get("area") == null ? "" : fieldMap - .get("area").toString(); - this.sTelephone = fieldMap.get("telephone") == null ? "" - : fieldMap.get("telephone").toString(); - this.sExt = fieldMap.get("ext") == null ? "" : fieldMap - .get("ext").toString(); - this.sInputtime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sUpdatetime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sType = fieldMap.get("type") == null ? "" : fieldMap.get("type") - .toString(); - } - - private Map initCheck(HttpServletRequest request, - Transaction sqlca) { - this.GlobalModel = new GlobalModel(); - if (!this.GlobalModel.checkMainId(request)) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - return null; - } - - @SuppressWarnings({ "unchecked", "deprecation" }) - public Map operationTelphone(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - String sUserId = (String) request.getSession().getAttribute("userid"); - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } - } - initGlobal(fieldMap); - switch (sType) { - case CustomerConstant.CUSTOMER_TYPE_PERSON: - return operationCustomerPersonTelphone(request, sqlca, tx, - fieldMap, oCurUser); - } - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - private void beforeInsert(JBOTransaction tx, String sCustomerId, - String sTelType, String sIsNew) throws Exception { - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_TEL.className); - tx.join(bom); - // 判断当前新增联系电话是否最新,是则把其它电话都设为非最新 - if (sIsNew.toString().equals("yes")) { - BizObjectQuery boq = bom - .createQuery("update O set isnew = 'no' where customerid=:customerid and teltype=:teltype"); - boq.setParameter("customerid", sCustomerId).setParameter("teltype", - sTelType); - boq.executeUpdate(); - } - } - - /** - * 自然人操作 - * - * @param request - * @param sqlca - * @param tx - * @param fieldMap - * @return - * @throws Exception - */ - private Map operationCustomerPersonTelphone( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx, - Map fieldMap, ASUser oCurUser) throws Exception { - - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_TEL.className); - tx.join(bom); - if ("".equals(sId)) { - beforeInsert(tx, sCustomerId, sTelType, sIsNew); - // save - try { - BizObject bo = bom.newObject(); - bo.setAttributeValue("customerid", sCustomerId); - bo.setAttributeValue("teltype", sTelType); - bo.setAttributeValue("intarea", sIntarea); - bo.setAttributeValue("isnew", sIsNew); - bo.setAttributeValue("area", sArea); - bo.setAttributeValue("telephone", sTelephone); - bo.setAttributeValue("ext", sExt); - bo.setAttributeValue("inputuserid", oCurUser.getUserID()); - bo.setAttributeValue("inputorgid", oCurUser.getOrgID()); - bo.setAttributeValue("inputtime", sInputtime); - bom.saveObject(bo); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "保存成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "保存失败"); - return ReturnMapUtil.getReturnMap(); - } - } else { - // update - try { - String sSql = "update o set o.updatetime=:updatetime, o.updateorgid=:updateorgid, o.updateuserid=:updateuserid, "; - sSql += "o.ext=:ext, o.telephone=:telephone, o.area=:area, o.isnew=:isnew, o.intarea=:intarea,teltype=:teltype "; - sSql += "where o.id=:id"; - BizObjectQuery boq = bom.createQuery(sSql); - boq.setParameter("updatetime", sUpdatetime); - boq.setParameter("updateorgid", oCurUser.getOrgID()); - boq.setParameter("updateuserid", oCurUser.getUserID()); - - boq.setParameter("ext", sExt); - boq.setParameter("telephone", sTelephone); - boq.setParameter("area", sArea); - boq.setParameter("isnew", sIsNew); - boq.setParameter("intarea", sIntarea); - boq.setParameter("teltype", sTelType); - - boq.setParameter("id", sId); - boq.executeUpdate(); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "编辑成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "编辑失败"); - return ReturnMapUtil.getReturnMap(); - } - } - - } - -} diff --git a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerVisitRecordServiceImpl.java b/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerVisitRecordServiceImpl.java deleted file mode 100644 index 69a43bec9..000000000 --- a/src_app/apx/com/amarsoft/als/customer/service/impl/CustomerVisitRecordServiceImpl.java +++ /dev/null @@ -1,394 +0,0 @@ -package apx.com.amarsoft.als.customer.service.impl; - -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.jbo.CustomerJbo; -import apx.com.amarsoft.als.base.jbo.impl.CustomerJboImpl; -import apx.com.amarsoft.als.base.util.BizObjectUtil; -import apx.com.amarsoft.als.base.util.DateUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.customer.constant.CustomerConstant; -import apx.com.amarsoft.als.customer.model.GlobalModel; -import apx.com.amarsoft.als.customer.service.CustomerVisitRecordService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.are.util.StringFunction; -import com.amarsoft.awe.Configure; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; -import com.tenwa.officetempalte.util.FileOperatorUtil; - -public class CustomerVisitRecordServiceImpl implements - CustomerVisitRecordService { - // 日志对象 - private static Log logger = ARE.getLog(); - CustomerJbo jbo = new CustomerJboImpl(); - private GlobalModel GlobalModel; - // begin 客户账户全局变量 - private String sCustomerId; - private String sId; - private String sInputtime; - private String sUpdatetime; - - private String sContactdate; - private String sContactway; - private String sLinkman; - private String sContactnumber; - private String sContactaddr; - private String sRecordcontent; - private List> fileList; - - // end - - private void initGlobal(Map fieldMap) { - this.sCustomerId = this.GlobalModel.getGlobalSCustomerId(); - this.sId = fieldMap.get("id") == null ? "" : fieldMap.get("id") - .toString(); - this.sInputtime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sUpdatetime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - - this.sContactdate = fieldMap.get("contactdate") == null ? "" : fieldMap - .get("contactdate").toString(); - this.sContactway = fieldMap.get("contactway") == null ? "" : fieldMap - .get("contactway").toString(); - this.sLinkman = fieldMap.get("linkman") == null ? "" : fieldMap.get( - "linkman").toString(); - this.sContactnumber = fieldMap.get("contactnumber") == null ? "" - : fieldMap.get("contactnumber").toString(); - this.sContactaddr = fieldMap.get("contactaddr") == null ? "" : fieldMap - .get("contactaddr").toString(); - this.sRecordcontent = fieldMap.get("recordcontent") == null ? "" - : fieldMap.get("recordcontent").toString(); - } - - private Map initCheck(HttpServletRequest request, - Transaction sqlca) { - this.GlobalModel = new GlobalModel(); - if (!this.GlobalModel.checkMainId(request)) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - return null; - } - - @SuppressWarnings({ "unchecked", "deprecation" }) - private void initGlobalUpload(HttpServletRequest request) throws Exception { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - this.fileList = new ArrayList>(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - - } else { - Map fileMap = new HashMap(); - fileMap.put("fileSize", item.getInputStream().available()); - fileMap.put("fileContentType", item.getContentType()); - fileMap.put("fileName", item.getName()); - fileMap.put("file", item.getInputStream()); - fileList.add(fileMap); - } - } - this.sId = fieldMap.get("id") == null ? "" : fieldMap.get( - "id").toString(); - this.sInputtime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - this.sUpdatetime = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - } - - @SuppressWarnings("deprecation") - public Map uploadFile(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - initGlobalUpload(request); - String sUserId = (String) request.getSession().getAttribute("userid"); - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - BizObjectManager relaBm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCRELATIVE"); - BizObjectManager libBm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); - BizObjectManager attrBm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); - BizObjectManager visBm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.customer.CUSTOMER_VISIT_RECORD"); - tx.join(visBm); - tx.join(attrBm); - tx.join(libBm); - tx.join(relaBm); - BizObject visit = visBm.createQuery("id=:id") - .setParameter("id", this.sId).getSingleResult(true); - BizObject lib; - String relaid = ""; - if (visit != null) - relaid = visit.getAttribute("relativeid") == null ? "" : visit.getAttribute("relativeid").toString(); - if (relaid.length() > 0) { - lib = libBm.createQuery("RELATIVE_ID=:relaid") - .setParameter("relaid", relaid).getSingleResult(false); - } else { - BizObject rela = relaBm.newObject(); - rela.setAttributeValue("ObjectType", "CustomerVisit"); - rela.setAttributeValue("cust_id", visit.getAttribute("customerid") - .getString()); - rela.setAttributeValue("INPUTTIME", this.sInputtime); - rela.setAttributeValue("INPUTUSERID", oCurUser.getUserID()); - rela.setAttributeValue("INPUTORGID", oCurUser.getOrgID()); - relaBm.saveObject(rela); - relaid = rela.getAttribute("id").getString(); - lib = libBm.newObject(); - lib.setAttributeValue("INPUTTIME", this.sInputtime); - lib.setAttributeValue("INPUTUSERID", oCurUser.getUserID()); - lib.setAttributeValue("INPUTORGID", oCurUser.getOrgID()); - lib.setAttributeValue("RELATIVE_ID", relaid); - libBm.saveObject(lib); - visit.setAttributeValue("inputtime", this.sInputtime); - visit.setAttributeValue("inputuserid", oCurUser.getUserID()); - visit.setAttributeValue("inputorgid", oCurUser.getOrgID()); - visit.setAttributeValue("relativeid", relaid); - visBm.saveObject(visit); - } - String libraryId = lib.getAttribute("id").getString(); - for (Map fileMap : this.fileList) { - String sFileName, sFileSize, sFileContentType; - InputStream file = (InputStream) fileMap.get("file"); - sFileName = (String) fileMap.get("fileName"); - // 得到不带路径的文件名 - sFileName = StringFunction.getFileName(sFileName); - sFileName = URLDecoder.decode( - URLDecoder.decode(sFileName, "UTF-8"), "UTF-8"); - sFileContentType = (String) fileMap.get("fileContentType"); - sFileSize = fileMap.get("fileSize") + ""; - Configure CurConfig = Configure.getInstance(); - String sFileSavePath = CurConfig.getConfigure("FileSavePath"); - String uuid = java.util.UUID.randomUUID().toString() - .replaceAll("-", ""); - String sFullPath = FileOperatorUtil.getuploadFileDir(sFileSavePath) - + uuid + "_" + sFileName; - - BizObject attr = attrBm.newObject(); - attr.setAttributeValue("Library_Id", libraryId); - attr.setAttributeValue("FileName", sFileName); - attr.setAttributeValue("InputUserId", oCurUser.getUserID()); - attr.setAttributeValue("InputOrgId", oCurUser.getOrgID()); - attr.setAttributeValue("InputTime", this.sInputtime); - attr.setAttributeValue("objectType", "CustomerVisit"); - String sFilePath = sFullPath.replace(sFileSavePath, ""); - attr.setAttributeValue("FilePath", sFilePath); - attr.setAttributeValue("FullPath", sFullPath); - attr.setAttributeValue("Content_Type", sFileContentType); - attr.setAttributeValue("FileSize", sFileSize); - attrBm.saveObject(attr); - - File f = new File(sFullPath); - DataOutputStream fileout = new DataOutputStream( - new FileOutputStream(f)); - byte b[] = new byte[Integer.valueOf(sFileSize)]; - @SuppressWarnings("unused") - int i = file.read(b, 0, Integer.valueOf(sFileSize) - 1); - fileout.write(b, 0, b.length); // 将文件数据存盘 - fileout.close(); - } - tx.commit(); - ReturnMapUtil - .setReturnMap(null, ResultConstant.SUCCESS_RESULT_CODE, "上传成功"); - return ReturnMapUtil.getReturnMap(); - } - - @SuppressWarnings({ "deprecation", "unchecked" }) - public Map operationVisitRecord(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - String sUserId = (String) request.getSession().getAttribute("userid"); - ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), - sqlca); - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } - } - initGlobal(fieldMap); - return operationVisitRecord(request, sqlca, tx, fieldMap, oCurUser); - } - - @SuppressWarnings({ "unchecked" }) - public Map findCustomerVisitRecordList( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - Map initCheck = initCheck(request, sqlca); - if (initCheck != null) - return initCheck; - List bos = jbo.getCustomerVisitRecordListByCustomerId(tx, - this.GlobalModel.getGlobalSCustomerId()); - List> list = new ArrayList>(); - for (BizObject bo : bos) { - BizObjectUtil util = new BizObjectUtil(); - Map map = util.bizObject2Map(bo, - "CustomerVisitRecordList"); - list.add(map); - } - String sPageIndex = request.getParameter("pageIndex"); - String sLimit = request.getParameter("limit"); - if (sPageIndex == null) - sPageIndex = "1"; - if (sLimit == null) - sLimit = "10"; - int iPageIndex, iLimit; - iPageIndex = Integer.valueOf(sPageIndex); - iLimit = Integer.valueOf(sLimit); - iPageIndex = iPageIndex - 1; - - int pageIndexStart = (iPageIndex) * iLimit; - int pageIndexEnd = (iPageIndex + 1) * iLimit; - - List> returnList = new ArrayList>(); - for (int i = pageIndexStart; i < pageIndexEnd; i++) { - // 数据数量大于list数据 - if (i > (list.size() - 1)) { - break; - } - // 页码小于1 - if (iPageIndex + 1 < 1) { - break; - } - if (list.size() % iLimit == 0) { - if ((list.size() / iLimit) < iPageIndex) { - break; - } - } else { - if ((list.size() / iLimit) + 1 < iPageIndex) { - break; - } - } - Map map = list.get(i); - String sRelativeid = ((Map) map.get("relativeid")) - .get("value") == null ? "tenwa" : ((Map) map - .get("relativeid")).get("value").toString(); - List bos1 = jbo.getCustomerVisitFileListByRelaid(tx, - sRelativeid); - List> list1 = new ArrayList>(); - for (BizObject bo : bos1) { - BizObjectUtil util = new BizObjectUtil(); - Map bos1Map = util.bizObject2Map(bo, - "CustomerVisitFileList"); - list1.add(bos1Map); - } - map.put("filelist", list1); - returnList.add(map); - } - Map body = new HashMap(); - body.put("data", returnList); - - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - private Map operationVisitRecord( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx, - Map fieldMap, ASUser oCurUser) throws Exception { - - BizObjectManager bom = JBOFactory - .getBizObjectManager(CustomerConstant.CUSTOMER_TABLE.TABLE_CUSTOMER_VISIT_RECORD.className); - tx.join(bom); - if ("".equals(sId)) { - try { - BizObject bo = bom.newObject(); - bo.setAttributeValue("customerid", sCustomerId); - bo.setAttributeValue("recordcontent", sRecordcontent); - bo.setAttributeValue("contactaddr", sContactaddr); - bo.setAttributeValue("contactnumber", sContactnumber); - bo.setAttributeValue("linkman", sLinkman); - bo.setAttributeValue("contactway", sContactway); - bo.setAttributeValue("contactdate", sContactdate); - bo.setAttributeValue("inputuserid", oCurUser.getUserID()); - bo.setAttributeValue("inputorgid", oCurUser.getOrgID()); - bo.setAttributeValue("inputtime", sInputtime); - bom.saveObject(bo); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "保存成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "保存失败"); - return ReturnMapUtil.getReturnMap(); - } - } else { - // update - try { - String sSql = "update o set o.updatetime=:updatetime, o.updateorgid=:updateorgid, o.updateuserid=:updateuserid, "; - sSql += "o.recordcontent=:recordcontent, o.contactaddr=:contactaddr, o.contactnumber=:contactnumber, o.linkman=:linkman," - + " o.contactway=:contactway,contactdate=:contactdate "; - sSql += "where o.id=:id"; - BizObjectQuery boq = bom.createQuery(sSql); - boq.setParameter("updatetime", sUpdatetime); - boq.setParameter("updateorgid", oCurUser.getOrgID()); - boq.setParameter("updateuserid", oCurUser.getUserID()); - - boq.setParameter("recordcontent", sRecordcontent); - boq.setParameter("contactaddr", sContactaddr); - boq.setParameter("contactnumber", sContactnumber); - boq.setParameter("linkman", sLinkman); - boq.setParameter("contactway", sContactway); - boq.setParameter("contactdate", sContactdate); - - boq.setParameter("id", sId); - boq.executeUpdate(); - tx.commit(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, "编辑成功"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - tx.rollback(); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_RESULT_CODE, "编辑失败"); - return ReturnMapUtil.getReturnMap(); - } - } - - } - -} diff --git a/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoController.java b/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoController.java deleted file mode 100644 index 91f2f394a..000000000 --- a/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoController.java +++ /dev/null @@ -1,37 +0,0 @@ -package apx.com.amarsoft.als.temp.bzsrv; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import apx.com.amarsoft.als.base.awe.AbstractAweDo; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -@Path("/temp") -public class AweDoController extends AbstractAweDo { - private static Log logger = ARE.getLog(); - - @Path("/data") - @POST - public Map data(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道:模板信息查询POST管理 >> app获取模板信息接口"); - return getData(request, sqlca, tx); - } - - @Path("/data1") - @GET - public Map data1(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道:模板信息查询GET管理 >> app获取模板信息接口"); - return getData(request, sqlca, tx); - } -} diff --git a/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoDeleteController.java b/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoDeleteController.java deleted file mode 100644 index abd0758fe..000000000 --- a/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoDeleteController.java +++ /dev/null @@ -1,201 +0,0 @@ -package apx.com.amarsoft.als.temp.bzsrv; - -import java.net.URLDecoder; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.awe.AbstractAweDoDeleteManage; -import cn.coyoteam.aweresf.util.RequestUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -@Path("/temp") -public class AweDoDeleteController extends AbstractAweDoDeleteManage { - private static Log logger = ARE.getLog(); - - @Path("/group/delete") - @GET - public Map groupDeleteGET( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道:模板信息查询GET管理 >> 删除"); - String sOtherWhere = ""; - String sGroupCode = request.getParameter("groupId"); - Map paramMap1 = new HashMap(); - if (request.getMethod().equalsIgnoreCase("GET")) { - paramMap1 = RequestUtil.convertRequestToMap(request); - } else { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "deprecation", "unchecked" }) - List list = (List) fu.parseRequest(request); - for (FileItem item : list) { - if (item.isFormField()) { - paramMap1 - .put(item.getFieldName().toLowerCase(), URLDecoder - .decode(item.getString("UTF-8"), "UTF-8")); - } - } - } - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return removeGroupData(sqlca, tx, sGroupCode, paramMap, sOtherWhere); - } - - @Path("/group/delete") - @POST - public Map groupDeletePOST( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道:模板信息查询POST管理 >> 删除"); - String sOtherWhere = ""; - String sGroupCode = request.getParameter("groupId"); - Map paramMap1 = new HashMap(); - if (request.getMethod().equalsIgnoreCase("GET")) { - paramMap1 = RequestUtil.convertRequestToMap(request); - } else { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "deprecation", "unchecked" }) - List list = (List) fu.parseRequest(request); - for (FileItem item : list) { - if (item.isFormField()) { - paramMap1 - .put(item.getFieldName().toLowerCase(), URLDecoder - .decode(item.getString("UTF-8"), "UTF-8")); - } - } - } - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return removeGroupData(sqlca, tx, sGroupCode, paramMap, sOtherWhere); - } - - @Path("/do/delete") - @GET - public Map doDeleteGET(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道:模板信息查询GET管理 >> 删除"); - String sOtherWhere = ""; - String sDono = request.getParameter("dono"); - Map paramMap1 = new HashMap(); - if (request.getMethod().equalsIgnoreCase("GET")) { - paramMap1 = RequestUtil.convertRequestToMap(request); - } else { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "deprecation", "unchecked" }) - List list = (List) fu.parseRequest(request); - for (FileItem item : list) { - if (item.isFormField()) { - paramMap1 - .put(item.getFieldName().toLowerCase(), URLDecoder - .decode(item.getString("UTF-8"), "UTF-8")); - } - } - } - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return removeDonoData(sqlca, tx, sDono, paramMap, sOtherWhere); - } - - @Path("/do/delete") - @POST - public Map doDeletePOST( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道:模板信息查询POST管理 >> 删除"); - String sOtherWhere = ""; - String sDono = request.getParameter("dono"); - Map paramMap1 = new HashMap(); - if (request.getMethod().equalsIgnoreCase("GET")) { - paramMap1 = RequestUtil.convertRequestToMap(request); - } else { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "deprecation", "unchecked" }) - List list = (List) fu.parseRequest(request); - for (FileItem item : list) { - if (item.isFormField()) { - paramMap1 - .put(item.getFieldName().toLowerCase(), URLDecoder - .decode(item.getString("UTF-8"), "UTF-8")); - } - } - } - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return removeDonoData(sqlca, tx, sDono, paramMap, sOtherWhere); - } - - public void afterDelete(BizObject bo) { - ARE.getLog() - .info("======================================= this afterDelete: NOT default ======================================"); - } - - public void beforeDelete(BizObject bo) { - ARE.getLog() - .info("======================================= this beforeDelete: NOT default ======================================"); - } -} diff --git a/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoInitDisplayController.java b/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoInitDisplayController.java deleted file mode 100644 index 6fcf92f64..000000000 --- a/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoInitDisplayController.java +++ /dev/null @@ -1,166 +0,0 @@ -package apx.com.amarsoft.als.temp.bzsrv; - -import java.net.URLDecoder; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.awe.AbstractAweDoInitDisplayManage; -import cn.coyoteam.aweresf.util.RequestUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -@Path("/temp") -public class AweDoInitDisplayController extends AbstractAweDoInitDisplayManage { - private static Log logger = ARE.getLog(); - - @Path("/group/init/display") - @GET - public Map groupInitDisplayGET( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道:模板信息查询GET管理 >> 初始化元素"); - String sOtherWhere = ""; - String sGroupCode = request.getParameter("groupId"); - Map paramMap1 = RequestUtil - .convertRequestToMap(request); - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return loadGroupSavePage(sqlca, tx, sGroupCode, paramMap, sOtherWhere); - } - - @Path("/do/init/display") - @GET - public Map donoInitDisplayGET( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道:模板信息查询GET管理 >> 初始化元素"); - String sOtherWhere = ""; - String sDono = request.getParameter("dono"); - Map paramMap1 = RequestUtil - .convertRequestToMap(request); - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return loadDonoSavePage(sqlca, tx, sDono, paramMap, sOtherWhere); - } - - @Path("/group/init/display") - @POST - public Map groupInitDisplayPOST( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道:模板信息查询POST管理 >> 初始化元素"); - String sOtherWhere = ""; - String sGroupCode = request.getParameter("groupId"); - Map paramMap1 = new HashMap(); - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "deprecation", "unchecked" }) - List list = (List) fu.parseRequest(request); - for (FileItem item : list) { - if (item.isFormField()) { - paramMap1 - .put(item.getFieldName().toLowerCase(), URLDecoder - .decode(item.getString("UTF-8"), "UTF-8")); - } - } - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return loadGroupSavePage(sqlca, tx, sGroupCode, paramMap, sOtherWhere); - } - - @Path("/do/init/display") - @POST - public Map donoInitDisplayPOST( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道:模板信息查询POST管理 >> 初始化元素"); - String sOtherWhere = ""; - String sDono = request.getParameter("dono"); - Map paramMap1 = new HashMap(); - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "deprecation", "unchecked" }) - List list = (List) fu.parseRequest(request); - for (FileItem item : list) { - if (item.isFormField()) { - paramMap1 - .put(item.getFieldName().toLowerCase(), URLDecoder - .decode(item.getString("UTF-8"), "UTF-8")); - } - } - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return loadDonoSavePage(sqlca, tx, sDono, paramMap, sOtherWhere); - } - - - public void initDisplayForAdd(BizObject bo) { - ARE.getLog() - .info("======================================= this initDisplayForAdd: NOT default ======================================"); - } - - public void initDisplayForEdit(BizObject bo) { - ARE.getLog() - .info("======================================= this initDisplayForEdit: NOT default ======================================"); - } -} diff --git a/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoSaveController.java b/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoSaveController.java deleted file mode 100644 index bfda5a1bc..000000000 --- a/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoSaveController.java +++ /dev/null @@ -1,228 +0,0 @@ -package apx.com.amarsoft.als.temp.bzsrv; - -import java.net.URLDecoder; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.awe.AbstractAweDoSaveManage; -import cn.coyoteam.aweresf.util.RequestUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -@Path("/temp") -public class AweDoSaveController extends AbstractAweDoSaveManage { - private static Log logger = ARE.getLog(); - - @Path("/group/save") - @GET - public Map groupSaveGET(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道:模板信息查询GET管理 >> 保存"); - String sOtherWhere = ""; - String sGroupCode = request.getParameter("groupId"); - String sUserId = (String) request.getSession().getAttribute("userid"); - Map paramMap1 = new HashMap(); - if (request.getMethod().equalsIgnoreCase("GET")) { - paramMap1 = RequestUtil.convertRequestToMap(request); - } else { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "deprecation", "unchecked" }) - List list = (List) fu.parseRequest(request); - for (FileItem item : list) { - if (item.isFormField()) { - paramMap1 - .put(item.getFieldName().toLowerCase(), URLDecoder - .decode(item.getString("UTF-8"), "UTF-8")); - } - } - } - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return saveGroupData(sqlca, tx, sGroupCode, paramMap, sUserId, - sOtherWhere); - } - - @Path("/group/save") - @POST - public Map groupSavePOST(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道:模板信息查询POST管理 >> 保存"); - String sOtherWhere = ""; - String sGroupCode = request.getParameter("groupId"); - String sUserId = (String) request.getSession().getAttribute("userid"); - Map paramMap1 = new HashMap(); - if (request.getMethod().equalsIgnoreCase("GET")) { - paramMap1 = RequestUtil.convertRequestToMap(request); - } else { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "deprecation", "unchecked" }) - List list = (List) fu.parseRequest(request); - for (FileItem item : list) { - if (item.isFormField()) { - paramMap1 - .put(item.getFieldName().toLowerCase(), URLDecoder - .decode(item.getString("UTF-8"), "UTF-8")); - } - } - } - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return saveGroupData(sqlca, tx, sGroupCode, paramMap, sUserId, - sOtherWhere); - } - - - @Path("/do/save") - @GET - public Map doSaveGET(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道:模板信息查询GET管理 >> 保存"); - String sOtherWhere = ""; - String sDono = request.getParameter("dono"); - String sUserId = (String) request.getSession().getAttribute("userid"); - Map paramMap1 = new HashMap(); - if (request.getMethod().equalsIgnoreCase("GET")) { - paramMap1 = RequestUtil.convertRequestToMap(request); - } else { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "deprecation", "unchecked" }) - List list = (List) fu.parseRequest(request); - for (FileItem item : list) { - if (item.isFormField()) { - paramMap1 - .put(item.getFieldName().toLowerCase(), URLDecoder - .decode(item.getString("UTF-8"), "UTF-8")); - } - } - } - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return saveDonoData(sqlca, tx, sDono, paramMap, sUserId, - sOtherWhere); - } - - @Path("/do/save") - @POST - public Map doSavePOST(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道:模板信息查询POST管理 >> 保存"); - String sOtherWhere = ""; - String sDono = request.getParameter("dono"); - String sUserId = (String) request.getSession().getAttribute("userid"); - Map paramMap1 = new HashMap(); - if (request.getMethod().equalsIgnoreCase("GET")) { - paramMap1 = RequestUtil.convertRequestToMap(request); - } else { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - @SuppressWarnings({ "deprecation", "unchecked" }) - List list = (List) fu.parseRequest(request); - for (FileItem item : list) { - if (item.isFormField()) { - paramMap1 - .put(item.getFieldName().toLowerCase(), URLDecoder - .decode(item.getString("UTF-8"), "UTF-8")); - } - } - } - - Map paramMap = new HashMap(); - if (paramMap1.size() > 0) { - int i = 1; - for (String key : paramMap1.keySet()) { - ARE.getLog().info( - "========= " + i + ". " + "key= " + key - + " and value= " + paramMap1.get(key) - + "=========="); - paramMap.put(key.toLowerCase(), paramMap1.get(key)); - i++; - } - } - return saveDonoData(sqlca, tx, sDono, paramMap, sUserId, - sOtherWhere); - } - - - - public void afterInsert(BizObject bo) { - ARE.getLog() - .info("======================================= this afterInsert: NOT default dono ======================================"); - } - - public void afterUpdate(BizObject bo) { - ARE.getLog() - .info("======================================= this afterUpdate: NOT default dono ======================================"); - } - - public void beforeInsert(BizObject bo) { - ARE.getLog() - .info("======================================= this beforeInsert: NOT default dono ======================================"); - } - - public void beforeUpdate(BizObject bo) { - ARE.getLog() - .info("======================================= this beforeUpdate: NOT default dono ======================================"); - } - - public boolean validityCheck(BizObject bo, boolean isInsert) { - ARE.getLog() - .info("======================================= this validityCheck: NOT default/true ======================================"); - return isInsert; - } -} diff --git a/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoSelectController.java b/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoSelectController.java deleted file mode 100644 index ac72e925c..000000000 --- a/src_app/apx/com/amarsoft/als/temp/bzsrv/AweDoSelectController.java +++ /dev/null @@ -1,45 +0,0 @@ -package apx.com.amarsoft.als.temp.bzsrv; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import apx.com.amarsoft.als.base.awe.service.ColSelectSourceService; -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -@Path("/flow/temp") -public class AweDoSelectController { - - private static Log logger = ARE.getLog(); - - @Path("/query/source") - @GET - public Map querySource(@Context HttpServletRequest request, - @Context Transaction sqlca) { - logger.info("进入接口通道:分组模板管理 >> 字段来源下拉列表接口"); - Map body = new HashMap(); - try { - List> list = ColSelectSourceService - .findSelectSource(request.getParameter("type"), - request.getParameter("source"), ""); - body.put("datas", list); - ReturnMapUtil - .setReturnMap( body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - ReturnMapUtil - .setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, "获取出现异常!"); - return ReturnMapUtil.getReturnMap(); - } - } -} diff --git a/src_app/apx/com/amarsoft/als/temp/constant/TempConstant.java b/src_app/apx/com/amarsoft/als/temp/constant/TempConstant.java deleted file mode 100644 index 07c8ce3ae..000000000 --- a/src_app/apx/com/amarsoft/als/temp/constant/TempConstant.java +++ /dev/null @@ -1,63 +0,0 @@ -package apx.com.amarsoft.als.temp.constant; - -public class TempConstant { - public static void main(String[] args) { - System.out.println(GROUP.getName(17051102)); - } - public static enum GROUP { - WEEK_REPORT_LANDING_PRO_INFO("LANDING_PRO_INFO", 17051101), - WEEK_REPORT_LANDING_PRO_LIST("LANDING_PRO_LIST", 17051102), - WEEK_REPORT_LIST("WEEK_REPORT_LIST", 17051103), - WEEK_REPORT_LANDING_PLAN_INFO("NEXT_WEEK_PLAN_INFO", 17051201) - ; - // 成员变量 - private String name; - private int index; - // 构造方法 - private GROUP(String name, int index) { - this.name = name; - this.index = index; - } - // 普通方法 - public static String getName(int index) { - for (GROUP g : GROUP.values()) { - if (g.getIndex() == index) { - return g.name; - } - } - return null; - } - // get set 方法 - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public int getIndex() { - return index; - } - public void setIndex(int index) { - this.index = index; - } - } - - - private final static String SPLIT_COMMA = ","; - private final static String SPLIT_SPACE = " "; - private final static String SPLIT_SQL_STATION = "=:"; - // APP_BUSINESS_GROUP - public final static String APP_BUSINESS_GROUP = "APP_BUSINESS_GROUP"; - public final static String APP_BUSINESS_GROUP_CODE = "GROUP_CODE"; - public final static String APP_BUSINESS_GROUP_POSITION = "GROUP_POSITION"; - public final static String APP_BUSINESS_GROUP_NAME = "GROUP_NAME"; - public final static String APP_BUSINESS_GROUP_ISLIST = "ISLIST"; - public final static String APP_BUSINESS_GROUP_SQL = "SELECT" + SPLIT_SPACE - + APP_BUSINESS_GROUP_CODE + SPLIT_COMMA - + APP_BUSINESS_GROUP_POSITION + SPLIT_COMMA - + APP_BUSINESS_GROUP_NAME + SPLIT_COMMA + APP_BUSINESS_GROUP_ISLIST + SPLIT_SPACE - + "FROM" + SPLIT_SPACE + APP_BUSINESS_GROUP + SPLIT_SPACE - + "WHERE" + SPLIT_SPACE - + APP_BUSINESS_GROUP_CODE + SPLIT_SQL_STATION + APP_BUSINESS_GROUP_CODE + SPLIT_SPACE - + "ORDER BY" + SPLIT_SPACE + APP_BUSINESS_GROUP_POSITION; -} diff --git a/src_app/apx/com/amarsoft/als/temp/model/AppBusinessGroup.java b/src_app/apx/com/amarsoft/als/temp/model/AppBusinessGroup.java deleted file mode 100644 index 252df910e..000000000 --- a/src_app/apx/com/amarsoft/als/temp/model/AppBusinessGroup.java +++ /dev/null @@ -1,32 +0,0 @@ -package apx.com.amarsoft.als.temp.model; - -public class AppBusinessGroup { - private String groupid; - private String groupname; - private String grouppostion; - private String islist; - public String getGroupid() { - return groupid; - } - public String getGroupname() { - return groupname; - } - public String getGrouppostion() { - return grouppostion; - } - public void setGroupid(String groupid) { - this.groupid = groupid; - } - public void setGroupname(String groupname) { - this.groupname = groupname; - } - public void setGrouppostion(String grouppostion) { - this.grouppostion = grouppostion; - } - public String getIslist() { - return islist; - } - public void setIslist(String islist) { - this.islist = islist; - } -} diff --git a/src_app/apx/com/amarsoft/als/temp/service/AweDoFlowSaverOrModifyService.java b/src_app/apx/com/amarsoft/als/temp/service/AweDoFlowSaverOrModifyService.java deleted file mode 100644 index 6992f1ae2..000000000 --- a/src_app/apx/com/amarsoft/als/temp/service/AweDoFlowSaverOrModifyService.java +++ /dev/null @@ -1,13 +0,0 @@ -package apx.com.amarsoft.als.temp.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.awe.util.Transaction; - -public interface AweDoFlowSaverOrModifyService { - Map querySource(@Context HttpServletRequest request, - @Context Transaction sqlca); -} diff --git a/src_app/apx/com/amarsoft/als/temp/service/impl/AweDoFlowSaverOrModifyServiceImpl.java b/src_app/apx/com/amarsoft/als/temp/service/impl/AweDoFlowSaverOrModifyServiceImpl.java deleted file mode 100644 index ca9e726d1..000000000 --- a/src_app/apx/com/amarsoft/als/temp/service/impl/AweDoFlowSaverOrModifyServiceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -package apx.com.amarsoft.als.temp.service.impl; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import apx.com.amarsoft.als.base.awe.service.ColSelectSourceService; -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.temp.service.AweDoFlowSaverOrModifyService; - -import com.amarsoft.awe.util.Transaction; - -public class AweDoFlowSaverOrModifyServiceImpl implements - AweDoFlowSaverOrModifyService { - - public Map querySource(HttpServletRequest request, - Transaction sqlca) { - Map body = new HashMap(); - try { - List> list = ColSelectSourceService - .findSelectSource(request.getParameter("type"), - request.getParameter("source"), ""); - body.put("datas", list); - ReturnMapUtil - .setReturnMap( body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - ReturnMapUtil - .setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, "获取出现异常!"); - return ReturnMapUtil.getReturnMap(); - } - } -} diff --git a/src_app/apx/com/amarsoft/als/test/test.java b/src_app/apx/com/amarsoft/als/test/test.java deleted file mode 100644 index 467f25a04..000000000 --- a/src_app/apx/com/amarsoft/als/test/test.java +++ /dev/null @@ -1,8 +0,0 @@ -package apx.com.amarsoft.als.test; - -public class test { - public static void main(String[] args) { - testObject to = new testObject(); - System.out.println(to.getContent()); - } -} diff --git a/src_app/apx/com/amarsoft/als/test/testObject.java b/src_app/apx/com/amarsoft/als/test/testObject.java deleted file mode 100644 index eb084ab58..000000000 --- a/src_app/apx/com/amarsoft/als/test/testObject.java +++ /dev/null @@ -1,17 +0,0 @@ -package apx.com.amarsoft.als.test; - -public class testObject { - private String content; - - public void init() { - this.content = null; - System.out.println("abc"); - content = "abc"; - } - - public String getContent() { - return content; - } - - -} diff --git a/src_app/apx/com/amarsoft/als/user/center/bzsrv/AppApplicationDownloadController.java b/src_app/apx/com/amarsoft/als/user/center/bzsrv/AppApplicationDownloadController.java deleted file mode 100644 index e2263c94e..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/bzsrv/AppApplicationDownloadController.java +++ /dev/null @@ -1,278 +0,0 @@ -package apx.com.amarsoft.als.user.center.bzsrv; - -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URLEncoder; -import java.util.List; - -import javax.imageio.ImageIO; -import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.StringUtils; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.Configure; -import com.amarsoft.awe.util.Transaction; - -@Path(value = "/files") -public class AppApplicationDownloadController { - // 日志对象 - private static Log logger = ARE.getLog(); - - @Path("/downloadPlist") - @GET - public void downloadPlist(@Context HttpServletResponse response, - @Context HttpServletRequest request) throws IOException { - String fileName = "ios-com.sinopharmholding-fl.eleasing-app.plist"; - String path = request.getSession().getServletContext().getRealPath("/") - + "/plist/" + fileName; - - fileName = URLEncoder.encode(fileName, "GBK"); - response.reset(); - response.setHeader("Content-disposition", "attachment; filename=" - + fileName); - // response.setContentType("text/html; charset=GBK"); - fileName = new String(fileName.getBytes(), "ISO-8859-1"); - File file = new File(path); - response.setContentLength((int) file.length()); - - try (InputStream in = new FileInputStream(path)) { - FileUtils.copyFile(new File(path), response.getOutputStream()); - } catch (Exception e) { - logger.error(e); - e.printStackTrace(); - } - } - - @Path("/downloadApp") - @GET - public void downloadFileApp(@Context HttpServletRequest request, - @Context HttpServletResponse response, @Context Transaction sqlca) - throws IOException { - String devType = request.getParameter("devType"); - String fileName = ""; - String path = ""; - String sql = "SELECT O.IMAGE_PATH, O.FILE_NAME " - + "FROM O WHERE 1=1 AND PHONE_TYPE=" + "'" + devType - + "' AND IS_NEW='Y' ORDER BY UP_DATE DESC"; - try { - @SuppressWarnings("unchecked") - List bolist = JBOFactory.getFactory() - .getManager("jbo.app.APP_VERSION").createQuery(sql) - .getResultList(false); - if (bolist != null && bolist.size() > 0) { - BizObject bo = bolist.get(0); - path = bo.getAttribute("IMAGE_PATH") == null ? "" : bo - .getAttribute("IMAGE_PATH").toString().trim(); - fileName = bo.getAttribute("FILE_NAME") == null ? "" : bo - .getAttribute("FILE_NAME").toString().trim(); - } - - } catch (Exception e) { - logger.error(e); - e.printStackTrace(); - } - // fileName = URLEncoder.encode(fileName, "GBK"); - fileName = new String(fileName.getBytes(), "ISO-8859-1"); - response.reset(); - response.setHeader("Content-disposition", "attachment; filename=" - + fileName); - response.setContentType("text/html; charset=GBK"); - File file = new File(path); - response.setContentLength((int) file.length()); - - try (InputStream in = new FileInputStream(path)) { - FileUtils.copyFile(new File(path), response.getOutputStream()); - } catch (Exception e) { - logger.error(e); - e.printStackTrace(); - } - } - - @Path("/downloadAppById") - @GET - public void downloadAppApplication(@Context HttpServletRequest request, - @Context HttpServletResponse response, @Context Transaction sqlca) - throws Exception { - String id = request.getParameter("id"); - String path = ""; - String fileName = ""; - String sql = "SELECT O.IMAGE_PATH, O.FILE_NAME " - + "FROM O WHERE 1=1 AND id=" + "'" + id + "'"; - @SuppressWarnings("unchecked") - List bolist = JBOFactory.getFactory() - .getManager("jbo.app.APP_VERSION").createQuery(sql) - .getResultList(false); - if (bolist != null && bolist.size() > 0) { - BizObject bo = bolist.get(0); - path = bo.getAttribute("IMAGE_PATH") == null ? "" : bo - .getAttribute("IMAGE_PATH").toString().trim(); - fileName = bo.getAttribute("FILE_NAME") == null ? "" : bo - .getAttribute("FILE_NAME").toString().trim(); - } - // fileName = URLEncoder.encode(fileName, "GBK"); - fileName = new String(fileName.getBytes(), "ISO-8859-1"); - response.reset(); - response.setHeader("Content-disposition", "attachment; filename=" - + fileName); - response.setContentType("text/html; charset=UTF-8"); - File file = new File(path); - response.setContentLength((int) file.length()); - - try (InputStream in = new FileInputStream(path)) { - FileUtils.copyFile(new File(path), response.getOutputStream()); - } catch (Exception e) { - logger.error(e); - e.printStackTrace(); - } - } - -// @Path("/down/flow/image") -// @GET -// public void downloadCurFile(@Context HttpServletRequest request, -// @Context HttpServletResponse response, @Context Transaction sqlca) -// throws Exception { -// String id = request.getParameter("id"); -// String sql = "SELECT O.FILE_NAME, O.FILE_PATH, O.FILE_SIZE " -// + "FROM O WHERE 1=1 AND id=" + "'" + id + "'"; -// JBOFactory jbof = JBOFactory.getFactory(); -// BizObject bo = jbof.getManager("jbo.app.APP_FLOW_SHOW") -// .createQuery(sql).getSingleResult(false); -// String sfileName = bo.getAttribute("FILE_NAME") == null ? "" : bo -// .getAttribute("FILE_NAME").toString().trim(); -// String sfilePath = bo.getAttribute("FILE_PATH") == null ? "" : bo -// .getAttribute("FILE_PATH").toString().trim(); -// String sfileSize = bo.getAttribute("FILE_SIZE") == null ? "" : bo -// .getAttribute("FILE_SIZE").toString().trim(); -// downloadCur(sfileName, sfilePath, sfileSize, response, request); -// } - - @Path("/show/image") - @GET - public void showImage(@Context HttpServletRequest request, - @Context HttpServletResponse response, @Context Transaction sqlca) - throws Exception { - String type = request.getParameter("type"); - switch (type) { - case "flowimage": - String id = request.getParameter("id"); - String sql = "SELECT O.FILE_NAME, O.FILE_PATH, O.FILE_SIZE " - + "FROM O WHERE 1=1 AND id=" + "'" + id + "'"; - JBOFactory jbof = JBOFactory.getFactory(); - BizObject bo = jbof.getManager("jbo.app.APP_FLOW_SHOW") - .createQuery(sql).getSingleResult(false); - String sfileName = bo.getAttribute("FILE_NAME") == null ? "" : bo - .getAttribute("FILE_NAME").toString().trim(); - String sfilePath = bo.getAttribute("FILE_PATH") == null ? "" : bo - .getAttribute("FILE_PATH").toString().trim(); - String sfileSize = bo.getAttribute("FILE_SIZE") == null ? "" : bo - .getAttribute("FILE_SIZE").toString().trim(); - showCurImage(sfileName, sfilePath, sfileSize, response, request); - break; - default: - break; - } - } - - private String showCurImage(String fileName, String path, String fileSize, - HttpServletResponse response, HttpServletRequest request) - throws Exception { - HttpSession session; - Configure CurConfig; - session = request.getSession(true); - if ((session == null) || (session.getAttributeNames() == null)) - throw new Exception("------Timeout------"); - CurConfig = Configure.getInstance(session.getServletContext()); - if (CurConfig == null) - throw new ServletException("读取配置文件错误!请检查配置文件。"); - String path1 = CurConfig.getConfigure("FileSavePath"); - response.reset(); - if (StringUtils.isNotBlank(path)) { - path1 = path1 + "/" + path; - } else { - path1 = path1 + "/" + fileName; - } - BufferedImage buffImg = ImageIO.read(new FileInputStream(path1)); - response.setHeader("Pragma", "no-cache"); - response.setHeader("Cache-Control", "no-cache"); - response.setDateHeader("Expires", 0); - response.setContentType("image/png"); - ServletOutputStream sos = response.getOutputStream(); - ImageIO.write(buffImg, "png", sos); - sos.close(); - return fileName; - // if (fileSize != null && !"".equals(fileSize)) { - // response.setContentLength(Integer.valueOf(fileSize)); - // } else { - // File file = newFile(fileName, path, path1, response); - // response.setContentLength((int) file.length()); - // } - // copyFile(fileName, path, path1, response); - } - - private void downloadCur(String fileName, String path, String fileSize, - HttpServletResponse response, HttpServletRequest request) - throws Exception { - HttpSession session; - Configure CurConfig; - session = request.getSession(true); - if ((session == null) || (session.getAttributeNames() == null)) - throw new Exception("------Timeout------"); - - CurConfig = Configure.getInstance(session.getServletContext()); - if (CurConfig == null) - throw new ServletException("读取配置文件错误!请检查配置文件。"); - String path1 = CurConfig.getConfigure("FileSavePath"); - response.reset(); - response.setHeader("Content-disposition", "attachment; filename=" - + fileName); - response.setContentType("text/html; charset=UTF-8"); - if (fileSize != null && !"".equals(fileSize)) { - response.setContentLength(Integer.valueOf(fileSize)); - } else { - File file = newFile(fileName, path, path1, response); - response.setContentLength((int) file.length()); - } - copyFile(fileName, path, path1, response); - } - - private void copyFile(String fileName, String path, String path1, - HttpServletResponse response) throws IOException { - if (StringUtils.isNotBlank(path)) { - path1 = path1 + "/" + path; - } else { - path1 = path1 + "/" + fileName; - } - try (InputStream in = new FileInputStream(path1)) { - FileUtils.copyFile(new File(path1), response.getOutputStream()); - } catch (Exception e) { - logger.error(e); - response.sendError(404); - } - } - - private File newFile(String fileName, String path, String path1, - HttpServletResponse response) throws IOException { - if (StringUtils.isNotBlank(path)) { - path1 = path1 + "/" + path; - } else { - path1 = path1 + "/" + fileName; - } - File file = new File(path1); - return file; - } -} diff --git a/src_app/apx/com/amarsoft/als/user/center/bzsrv/DocManageController.java b/src_app/apx/com/amarsoft/als/user/center/bzsrv/DocManageController.java deleted file mode 100644 index 813bd9e90..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/bzsrv/DocManageController.java +++ /dev/null @@ -1,116 +0,0 @@ -package apx.com.amarsoft.als.user.center.bzsrv; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import org.apache.commons.io.FileUtils; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.Configure; -import com.amarsoft.awe.util.Transaction; - -@Path(value = "/files") -public class DocManageController { - // 日志对象 - private static Log logger = ARE.getLog(); - - @Path("/down/flow/image") - @GET - public AppAtt downloadCurFile(@Context HttpServletRequest request, - @Context HttpServletResponse response, @Context Transaction sqlca) - throws Exception { - String id = request.getParameter("id"); - String sql = "SELECT O.FILE_NAME, O.FILE_PATH, O.FILE_SIZE " - + "FROM O WHERE 1=1 AND id=" + "'" + id + "'"; - JBOFactory jbof = JBOFactory.getFactory(); - BizObject bo = jbof.getManager("jbo.app.APP_FLOW_SHOW") - .createQuery(sql).getSingleResult(false); - - if (bo != null) { - String sFileName = bo.getAttribute("FILE_NAME") == null ? "" : bo.getAttribute("FILE_NAME").toString(); - String sFilePath = bo.getAttribute("FILE_PATH") == null ? "" : bo.getAttribute("FILE_PATH").toString(); - String sFileSize = bo.getAttribute("FILE_SIZE") == null ? "" : bo.getAttribute("FILE_SIZE").toString(); - - try { - downloadAtt(sFileName, sFilePath, sFileSize, response, request); - } catch (Exception e) { - logger.error(e); - throw new Exception("------Timeout------"); - } - } - return null; - } - - @Path("/down/docById") - @GET - public AppAtt downloadAtt6(@Context HttpServletRequest request, - @Context HttpServletResponse response, @Context Transaction sqlca) - throws Exception { - String id = request.getParameter("id"); - BizObjectManager bm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); - BizObject bo = bm.createQuery("id=:id").setParameter("id", id) - .getSingleResult(false); - if (bo != null) { - String sFileName = bo.getAttribute("FILENAME").toString(); - String sFilePath = bo.getAttribute("FILEPATH").toString(); - String sFileSize = bo.getAttribute("FILESIZE").toString(); - - try { - downloadAtt(sFileName, sFilePath, sFileSize, response, request); - } catch (Exception e) { - logger.error(e); - throw new Exception("------Timeout------"); - } - } - return null; - } - - private void downloadAtt(String fileName, String path, String fileSize, - HttpServletResponse response, HttpServletRequest request) - throws Exception { - HttpSession session; - Configure CurConfig; - session = request.getSession(true); - if ((session == null) || (session.getAttributeNames() == null)) - throw new Exception("------Timeout------"); - - CurConfig = Configure.getInstance(session.getServletContext()); - if (CurConfig == null) - throw new ServletException("读取配置文件错误!请检查配置文件。"); - String path1 = CurConfig.getConfigure("FileSavePath"); - // fileName = URLEncoder.encode(fileName, "UTF-8"); - response.reset(); - response.setHeader("Content-disposition", "attachment; filename=" - + fileName); - response.setContentType("text/html; charset=UTF-8"); - if (fileSize != null && !"".equals(fileSize)) { - response.setContentLength(Integer.valueOf(fileSize)); - } else { - File file = new File(path1 + "/" + path); - response.setContentLength((int) file.length()); - } - try (InputStream in = new FileInputStream(path1 + "/" + path)) { - FileUtils.copyFile(new File(path1 + "/" + path), - response.getOutputStream()); - } catch (Exception e) { - response.sendError(404); - } - } - - private static class AppAtt { - } -} diff --git a/src_app/apx/com/amarsoft/als/user/center/bzsrv/UserCenterManagerController.java b/src_app/apx/com/amarsoft/als/user/center/bzsrv/UserCenterManagerController.java deleted file mode 100644 index 2f42029f2..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/bzsrv/UserCenterManagerController.java +++ /dev/null @@ -1,70 +0,0 @@ -package apx.com.amarsoft.als.user.center.bzsrv; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import apx.com.amarsoft.als.user.center.service.UserCenterManagerService; -import apx.com.amarsoft.als.user.center.service.impl.UserCenterManagerServiceImpl; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -@Path("/user/center/manager") -public class UserCenterManagerController { - // 日志对象 - private static Log logger = ARE.getLog(); - - UserCenterManagerService service = new UserCenterManagerServiceImpl(); - - @Path("/acquisition/gesture") - @GET - public Map acquisitionHandKeyInfo( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) { - logger.info("进入接口通道: 用户个人中心管理 >> app获取手密信息接口"); - return service.acquisitionHandKeyInfo(request, sqlca, tx); - } - - @Path("/setup/gesture") - @GET - public Map modilfGesturePwd( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws JBOException { - logger.info("进入接口通道: 用户个人中心管理 >> app设置或重设手密接口"); - return service.modilfGesturePwd(request, sqlca, tx); - } - - @Path("/close/gesture") - @GET - public Map closeGesture( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws JBOException { - logger.info("进入接口通道: 用户个人中心管理 >> app关闭设手密接口"); - return service.closeGesture(request, sqlca, tx); - } - - @Path("/detection/version") - @GET - public Map detectionVersion( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws JBOException { - logger.info("进入接口通道: 用户个人中心管理 >> app版本检测接口"); - return service.detectionVersion(request, sqlca, tx); - } - - @Path("/acquisition/pending/flow/catalog") - @GET - public Map acquisitionFlowCatalog( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws JBOException { - logger.info("进入接口通道: 用户个人中心管理 >> 获取九宫格接口"); - return service.acquisitionFlowCatalog(request, sqlca, tx); - } -} diff --git a/src_app/apx/com/amarsoft/als/user/center/constant/UserCenterManagerResultConstant.java b/src_app/apx/com/amarsoft/als/user/center/constant/UserCenterManagerResultConstant.java deleted file mode 100644 index 035436503..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/constant/UserCenterManagerResultConstant.java +++ /dev/null @@ -1,17 +0,0 @@ -package apx.com.amarsoft.als.user.center.constant; - -public class UserCenterManagerResultConstant { - - public static final String SUCCESS_RESULT_ACQUISITION_MSG = "获取信息成功!"; - public static final String SUCCESS_RESULT_MODILF_GESTURE = "成功设置或重设手钥密码!"; - public static final String SUCCESS_RESULT_CLOSE_GESTURE = "成功关闭手钥密码!"; - public static final String SUCCESS_RESULT_VALIDATE_VERSION = "检测APP版本号成功!"; - - public static final String FAIL_RESULT_NO_APP_FLOW = "您当前角色,未绑定任何APP流程!\r\n请联系管理绑定相应流程后再进行操作,给您带来的不便请谅解!"; - public static final String FAIL_RESULT_USER_NULL = "用户不存在!"; - public static final String FAIL_RESULT_APP_VERSION_NULL = "没有找到当做设备最新版本!"; - public static final String FAIL_RESULT_USER_LOCKING = "用户账户涨停被锁!"; - public static final String FAIL_RESULT_USER_EXPIRE = "用户已被停用!"; - public static final String FAIL_RESULT_MODILF_GESTURE_DB_ERROR = "设置手钥密码数据操作失败!"; - public static final String FAIL_RESULT_CLOSE_GESTURE_DB_ERROR = "关闭手钥密码数据操作失败!"; -} diff --git a/src_app/apx/com/amarsoft/als/user/center/constant/UserCenterMangerConstant.java b/src_app/apx/com/amarsoft/als/user/center/constant/UserCenterMangerConstant.java deleted file mode 100644 index 1d09d867e..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/constant/UserCenterMangerConstant.java +++ /dev/null @@ -1,7 +0,0 @@ -package apx.com.amarsoft.als.user.center.constant; - -public class UserCenterMangerConstant { - public static final String APP_GESTURE_USERID = "APP_GESTURE_USERID"; - public static final String APP_GESTURE_PWD = "APP_GESTURE_PWD"; - public static final String APP_CHECK_VERSION = "APP_CHECK_VERSION"; -} diff --git a/src_app/apx/com/amarsoft/als/user/center/model/AppVesionModel.java b/src_app/apx/com/amarsoft/als/user/center/model/AppVesionModel.java deleted file mode 100644 index ae23b04d2..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/model/AppVesionModel.java +++ /dev/null @@ -1,144 +0,0 @@ -package apx.com.amarsoft.als.user.center.model; - -import java.io.Serializable; -import java.util.List; - -import apx.com.amarsoft.als.base.jbo.AppConfigJbo; -import apx.com.amarsoft.als.base.jbo.impl.AppConfigJboImpl; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; - -public class AppVesionModel implements Serializable, Cloneable { - - private static final long serialVersionUID = -5143823948174842406L; - // 版本号 - private String versionCode; - // 版本名 - private String versionName; - // 是否强制更新 - private String isMustUpdate; - // 是否最新版本 - private String isNew; - // 下载路径 - private String downLoadPath; - - // 基本文件类型 - private String baseFileName; - private String baseFileId; - - private boolean pojoFalg; - - - // --------------------------CONSTANT------------------------------ - private static final String COLUMN_VERSION_CODE = "VERSION_CODE"; - private static final String COLUMN_VERSION_NAME = "VERSION_NAME"; - private static final String COLUMN_BASE_FILE_ID = "BASE_FILE_ID"; - private static final String COLUMN_MUST_UPDATE = "MUST_UPDATE"; - private static final String COLUMN_IS_NEW = "IS_NEW"; - private static final String COLUMN_IMAGE_PATH = "IMAGE_PATH"; - AppConfigJbo jbo = new AppConfigJboImpl(); - -// private static final String COLUMN_ID = "id"; -// -// private static final String COLUMN_FILE_NAME = "FILE_NAME"; - - public void loadAppVesionModel() { - this.versionCode = ""; - this.versionName = ""; - this.isMustUpdate = ""; - this.isNew = ""; - this.downLoadPath = ""; - this.baseFileName = ""; - this.pojoFalg = false; - } - - public AppVesionModel(JBOTransaction tx, String devType) { - try { - List avms = jbo.findNewAppVersion(tx, devType); - if (avms == null || avms.size() < 1) { - return ; - } - BizObject avm = avms.get(0); - if (avm == null) { - return ; - } - tx.commit(); - this.pojoFalg = true; - this.versionCode = avm.getAttribute(COLUMN_VERSION_CODE) == null ? "" : avm.getAttribute(COLUMN_VERSION_CODE).getString(); - this.versionName = avm.getAttribute(COLUMN_VERSION_NAME) == null ? "" : avm.getAttribute(COLUMN_VERSION_NAME).getString(); - this.isMustUpdate = avm.getAttribute(COLUMN_MUST_UPDATE) == null ? "" : avm.getAttribute(COLUMN_MUST_UPDATE).getString(); - this.isNew = avm.getAttribute(COLUMN_IS_NEW) == null ? "" : avm.getAttribute(COLUMN_IS_NEW).getString(); - this.baseFileId = avm.getAttribute(COLUMN_BASE_FILE_ID) == null ? "" : avm.getAttribute(COLUMN_BASE_FILE_ID).getString(); - this.downLoadPath = avm.getAttribute(COLUMN_IMAGE_PATH) == null ? "" : avm.getAttribute(COLUMN_IMAGE_PATH).getString(); - } catch (JBOException e) { - this.pojoFalg = false; - e.printStackTrace(); - } - } - - public String getVersionCode() { - return versionCode; - } - - public String getVersionName() { - return versionName; - } - - public String getIsMustUpdate() { - return isMustUpdate; - } - - public String getIsNew() { - return isNew; - } - - public String getDownLoadPath() { - return downLoadPath; - } - - public void setVersionCode(String versionCode) { - this.versionCode = versionCode; - } - - public void setVersionName(String versionName) { - this.versionName = versionName; - } - - public void setIsMustUpdate(String isMustUpdate) { - this.isMustUpdate = isMustUpdate; - } - - public void setIsNew(String isNew) { - this.isNew = isNew; - } - - public void setDownLoadPath(String downLoadPath) { - this.downLoadPath = downLoadPath; - } - - public String getBaseFileId() { - return baseFileId; - } - - public boolean isPojoFalg() { - return pojoFalg; - } - - public void setBaseFileId(String baseFileId) { - this.baseFileId = baseFileId; - } - - public void setPojoFalg(boolean pojoFalg) { - this.pojoFalg = pojoFalg; - } - - public String getBaseFileName() { - return baseFileName; - } - - public void setBaseFileName(String baseFileName) { - this.baseFileName = baseFileName; - } -} diff --git a/src_app/apx/com/amarsoft/als/user/center/model/UserCenterManagerModel.java b/src_app/apx/com/amarsoft/als/user/center/model/UserCenterManagerModel.java deleted file mode 100644 index 64dccd500..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/model/UserCenterManagerModel.java +++ /dev/null @@ -1,152 +0,0 @@ -package apx.com.amarsoft.als.user.center.model; - -import java.io.Serializable; - -import apx.com.amarsoft.als.base.jbo.UserInfoJbo; -import apx.com.amarsoft.als.base.jbo.impl.UserInfoJboImpl; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; - -public class UserCenterManagerModel implements Serializable, Cloneable { - private static final long serialVersionUID = -370233931128817784L; - // 用户识别ID - private String userId; - // 用户名 - private String userName; - // 登录ID - private String loginId; - // 是否启用手势密码 - private String enableGesture; - // 用户状态 - private String status; - // 手势密码 - private String gesturePwd; - - private boolean pojoFlag; - // --------------------------CONSTANT------------------------------ - private static final String COLUMN_USER_ID = "USERID"; - private static final String COLUMN_USER_NAME = "UserName"; - private static final String COLUMN_USER_LOGIN_ID = "LoginId"; - private static final String COLUMN_USER_STATUS = "STATUS"; - - private static final String COLUMN_USER_GESTURE_PWD = "GESTURE_PASSWORD"; - private static final String COLUMN_USER_ENABLE_GESTURE = "ENABLE_GESTURE"; - UserInfoJbo jbo = new UserInfoJboImpl(); - public void loadUserCenterManager() { - this.userId = ""; - this.userName = ""; - this.loginId = ""; - this.enableGesture = ""; - this.status = ""; - this.gesturePwd = ""; - this.pojoFlag = false; - } - - public UserCenterManagerModel() { - - } - - public UserCenterManagerModel(JBOTransaction tx, String loginName) { - loadUserCenterManager(); - try { - BizObject user = jbo.findUserByLoginName(tx, loginName); - if(user==null)return; - this.pojoFlag = true; - this.loginId = user.getAttribute(COLUMN_USER_LOGIN_ID) == null ? "" : user.getAttribute(COLUMN_USER_LOGIN_ID).getString(); - this.userId = user.getAttribute(COLUMN_USER_ID) == null ? "" : user.getAttribute(COLUMN_USER_ID).getString(); - this.userName = user.getAttribute(COLUMN_USER_NAME) == null ? "" : user.getAttribute(COLUMN_USER_NAME).getString(); - this.status = user.getAttribute(COLUMN_USER_STATUS) == null ? "" : user.getAttribute(COLUMN_USER_STATUS).getString(); - this.enableGesture = user.getAttribute(COLUMN_USER_ENABLE_GESTURE) == null ? "0" : - user.getAttribute(COLUMN_USER_ENABLE_GESTURE).toString(); - this.enableGesture = this.enableGesture == "" ? "0" : this.enableGesture; - this.gesturePwd = user.getAttribute(COLUMN_USER_GESTURE_PWD) == null ? "" : user.getAttribute(COLUMN_USER_GESTURE_PWD).toString(); - } catch (JBOException e) { - ARE.getLog().error("构造User对象出错!"); - e.printStackTrace(); - } - - } - - public UserCenterManagerModel(JBOTransaction tx, String loginName, String id) { - loadUserCenterManager(); - try { - BizObject user = jbo.findUserByUserId(tx, id); - if(user==null)return; - tx.commit(); - this.pojoFlag = true; - this.loginId = user.getAttribute(COLUMN_USER_LOGIN_ID) == null ? "" : user.getAttribute(COLUMN_USER_LOGIN_ID).getString(); - this.userId = user.getAttribute(COLUMN_USER_ID) == null ? "" : user.getAttribute(COLUMN_USER_ID).getString(); - this.userName = user.getAttribute(COLUMN_USER_NAME) == null ? "" : user.getAttribute(COLUMN_USER_NAME).getString(); - this.status = user.getAttribute(COLUMN_USER_STATUS) == null ? "" : user.getAttribute(COLUMN_USER_STATUS).getString(); - this.enableGesture = user.getAttribute(COLUMN_USER_ENABLE_GESTURE) == null ? "0" : - user.getAttribute(COLUMN_USER_ENABLE_GESTURE).toString(); - this.enableGesture = this.enableGesture == "" ? "0" : this.enableGesture; - this.gesturePwd = user.getAttribute(COLUMN_USER_GESTURE_PWD) == null ? "" : user.getAttribute(COLUMN_USER_GESTURE_PWD).toString(); - } catch (JBOException e) { - ARE.getLog().error("构造User对象出错!"); - e.printStackTrace(); - } - - } - - public String getUserId() { - return userId; - } - - public String getUserName() { - return userName; - } - - public String getLoginId() { - return loginId; - } - - public String getEnableGesture() { - return enableGesture; - } - - public String getStatus() { - return status; - } - - public String getGesturePwd() { - return gesturePwd; - } - - public boolean isPojoFlag() { - return pojoFlag; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public void setLoginId(String loginId) { - this.loginId = loginId; - } - - public void setEnableGesture(String enableGesture) { - this.enableGesture = enableGesture; - } - - public void setStatus(String status) { - this.status = status; - } - - public void setGesturePwd(String gesturePwd) { - this.gesturePwd = gesturePwd; - } - - public void setPojoFlag(boolean pojoFlag) { - this.pojoFlag = pojoFlag; - } - - -} diff --git a/src_app/apx/com/amarsoft/als/user/center/service/AppVersionService.java b/src_app/apx/com/amarsoft/als/user/center/service/AppVersionService.java deleted file mode 100644 index 82464da37..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/service/AppVersionService.java +++ /dev/null @@ -1,25 +0,0 @@ -package apx.com.amarsoft.als.user.center.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface AppVersionService { - /** - * 检测 app 版本及下载文件更新 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws JBOException - */ - Map detectionVersion(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/user/center/service/GestureManagerService.java b/src_app/apx/com/amarsoft/als/user/center/service/GestureManagerService.java deleted file mode 100644 index 28aa61fbd..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/service/GestureManagerService.java +++ /dev/null @@ -1,49 +0,0 @@ -package apx.com.amarsoft.als.user.center.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface GestureManagerService { - /** - * 检测手势密码 - * - * @param request - * @param sqlca - * @return - * @throws JBOException - */ - Map acquisitionHandKeyInfo( - @Context HttpServletRequest request, @Context Transaction sqlca, - JBOTransaction tx) throws JBOException; - - /** - * 修改手势密码 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws JBOException - */ - Map modilfGesturePwd(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws JBOException; - - /** - * 关闭手势密码 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws JBOException - */ - Map closeGesture(@Context HttpServletRequest request, - @Context Transaction sqlca, JBOTransaction tx) throws JBOException; -} diff --git a/src_app/apx/com/amarsoft/als/user/center/service/LoadHomePageService.java b/src_app/apx/com/amarsoft/als/user/center/service/LoadHomePageService.java deleted file mode 100644 index a4257b819..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/service/LoadHomePageService.java +++ /dev/null @@ -1,28 +0,0 @@ -package apx.com.amarsoft.als.user.center.service; - -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface LoadHomePageService { - /** - * 查询APP流程配置 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws JBOException - */ - Map acquisitionFlowCatalog( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws JBOException; - public List> getAppFlowShow(JBOTransaction tx, - String userId) throws JBOException; -} diff --git a/src_app/apx/com/amarsoft/als/user/center/service/UserCenterManagerService.java b/src_app/apx/com/amarsoft/als/user/center/service/UserCenterManagerService.java deleted file mode 100644 index f31ae169b..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/service/UserCenterManagerService.java +++ /dev/null @@ -1,32 +0,0 @@ -package apx.com.amarsoft.als.user.center.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface UserCenterManagerService { - Map acquisitionHandKeyInfo( - @Context HttpServletRequest request, @Context Transaction sqlca, - JBOTransaction tx); - - Map modilfGesturePwd(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws JBOException; - - Map closeGesture(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws JBOException; - - Map detectionVersion(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws JBOException; - - Map acquisitionFlowCatalog( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws JBOException; -} diff --git a/src_app/apx/com/amarsoft/als/user/center/service/impl/AppVersionServiceImpl.java b/src_app/apx/com/amarsoft/als/user/center/service/impl/AppVersionServiceImpl.java deleted file mode 100644 index 422c7de78..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/service/impl/AppVersionServiceImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -package apx.com.amarsoft.als.user.center.service.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import apx.com.amarsoft.als.base.constant.CacheConstant; -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.jbo.AppConfigJbo; -import apx.com.amarsoft.als.base.jbo.impl.AppConfigJboImpl; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.user.center.constant.UserCenterManagerResultConstant; -import apx.com.amarsoft.als.user.center.constant.UserCenterMangerConstant; -import apx.com.amarsoft.als.user.center.model.AppVesionModel; -import apx.com.amarsoft.als.user.center.service.AppVersionService; -import apx.com.amarsoft.als.user.center.util.ValidateRestfulParamUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -public class AppVersionServiceImpl implements AppVersionService { - // 日志对象 - private static Log logger = ARE.getLog(); - // app 设备类型 - private String devOs; - // app 当前版本号 - private String versionCode; - // 更新code - private int upgradeCode; - // 更新描述 - private String upgradeDesc; - - private AppVesionModel apvm; - - AppConfigJbo jbo = new AppConfigJboImpl(); - - private List> getAppFlowInfo(JBOTransaction tx) throws JBOException { - List> list = new ArrayList>(); - List bos1 = jbo.findAppFlow(tx); - if (bos1 != null && bos1.size() > 0) { - tx.commit(); - for (BizObject bo1 : bos1) { - Map map = new HashMap(); - map.put("id", bo1.getAttribute("ID").getValue()); - map.put("flowno", bo1.getAttribute("FLOW_NO").getValue()); - map.put("display", bo1.getAttribute("APP_FLOW_NAME").getValue()); - map.put("filename", bo1.getAttribute("FILE_NAME").getValue()); - map.put("filepath", bo1.getAttribute("FILE_PATH").getValue()); - map.put("filesize", bo1.getAttribute("FILE_SIZE").getValue()); - list.add(map); - } - } - return list; - } - - private void loadDetectionVersion(HttpServletRequest request, - Transaction sqlca) { - this.devOs = ""; - this.devOs = request.getParameter("devos").toString(); - this.versionCode = ""; - this.versionCode = request.getParameter("versioncode").toString(); - this.upgradeCode = 0; - this.upgradeDesc = "未找到升级版本或当前用户APP已是最新版本!"; - } - - private boolean appVersionValidate(JBOTransaction tx) { - this.apvm = new AppVesionModel(tx, this.devOs); - if (!this.apvm.isPojoFalg()) { - return false; - } - if (this.apvm.getVersionCode().trim().equals(this.versionCode.trim())) { - this.upgradeCode = 0; - } else { - if (this.apvm.getIsMustUpdate().trim().equalsIgnoreCase("N")) { - this.upgradeCode = 2; - this.upgradeDesc = "当前有更新的版本"; - } else { - this.upgradeCode = 1; - this.upgradeDesc = "当前有更新版本,需要用户强者更新"; - } - } - return true; - } - - @Override - public Map detectionVersion(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - boolean flag = ValidateRestfulParamUtil.validateReqPara(request, - UserCenterMangerConstant.APP_CHECK_VERSION); - if (!flag) { - logger.debug("AppVersionServiceImpl >> detectionVersion >." - + ResultConstant.FAIL_RESULT_PARAM_LACK); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - CacheConstant.getInstance(); - CacheConstant.load(sqlca); - Map body2 = new HashMap(); - Map body = new HashMap(); - List> list = getAppFlowInfo(tx); - loadDetectionVersion(request, sqlca); - if (!appVersionValidate(tx)) { - Map map = new HashMap(); - map.put("upgradedesc", this.upgradeDesc); - map.put("upgradecode", this.upgradeCode); - map.put("flowinit", list); - ReturnMapUtil - .setReturnMap( - map, - ResultConstant.SUCCESS_RESULT_CODE, - UserCenterManagerResultConstant.FAIL_RESULT_APP_VERSION_NULL); - return ReturnMapUtil.getReturnMap(); - } - body.put("versioncode", this.apvm.getVersionCode()); - body.put("versionname", this.apvm.getVersionName()); - body.put("mustupdate", this.apvm.getIsMustUpdate()); - String path = "api/files/downloadFile?path=" + "/wordFiles/" - + this.apvm.getDownLoadPath(); - body.put("path", path); - body.put("filename", this.apvm.getBaseFileName()); - body2.put("upgradecode", this.upgradeCode); - body2.put("upgradedesc", this.upgradeDesc); - body2.put("versionconstant", body); - body2.put("flowinit", list); - ReturnMapUtil - .setReturnMap( - body2, - ResultConstant.SUCCESS_RESULT_CODE, - UserCenterManagerResultConstant.SUCCESS_RESULT_VALIDATE_VERSION); - return ReturnMapUtil.getReturnMap(); - } - -} diff --git a/src_app/apx/com/amarsoft/als/user/center/service/impl/GestureManagerServiceImpl.java b/src_app/apx/com/amarsoft/als/user/center/service/impl/GestureManagerServiceImpl.java deleted file mode 100644 index d10a02db5..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/service/impl/GestureManagerServiceImpl.java +++ /dev/null @@ -1,209 +0,0 @@ -package apx.com.amarsoft.als.user.center.service.impl; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.jbo.UserInfoJbo; -import apx.com.amarsoft.als.base.jbo.impl.UserInfoJboImpl; -import apx.com.amarsoft.als.base.util.DES; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.user.center.constant.UserCenterManagerResultConstant; -import apx.com.amarsoft.als.user.center.constant.UserCenterMangerConstant; -import apx.com.amarsoft.als.user.center.model.UserCenterManagerModel; -import apx.com.amarsoft.als.user.center.service.GestureManagerService; -import apx.com.amarsoft.als.user.center.util.ValidateRestfulParamUtil; -import apx.com.amarsoft.als.user.logon.constant.DESSecretKeyConstant; -import apx.com.amarsoft.als.user.logon.constant.UserGestureStatus; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; -import com.tenwa.util.MD5Util; - -public class GestureManagerServiceImpl implements GestureManagerService { - - // 用户编号 - private String userId; - // APP前台手势密码 - private String pwd; - private UserCenterManagerModel user; - - // 日志对象 - private static Log logger = ARE.getLog(); - UserInfoJbo jbo = new UserInfoJboImpl(); - - private void loadAcquisitionHandKeyInfo(HttpServletRequest request, - Transaction sqlca) { - this.userId = request.getParameter("userid"); - this.user = null; - } - - private void loadModilfGesturePwd(HttpServletRequest request, - Transaction sqlca) { - this.pwd = DES.decrypt(request.getParameter("pwd"), - DESSecretKeyConstant.DES_SECRET_KEY_ONE, - DESSecretKeyConstant.DES_SECRET_KEY_TWO, - DESSecretKeyConstant.DES_SECRET_KEY_THREE); - this.user = null; - } - - /** - * 校验用户状态 - * - * @return - */ - private boolean userValidate(JBOTransaction tx) { - this.user = new UserCenterManagerModel(tx, "", this.userId); - // 检查用户是否存在 - if (!this.user.isPojoFlag()) { - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - UserCenterManagerResultConstant.FAIL_RESULT_USER_NULL); - return false; - // return this.returnMap; - } - // 检查用户状态是否正常 - switch (this.user.getStatus()) { - case "0": - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - UserCenterManagerResultConstant.FAIL_RESULT_USER_LOCKING); - return false; - // return this.returnMap; - case "2": - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, - UserCenterManagerResultConstant.FAIL_RESULT_USER_EXPIRE); - return false; - // return this.returnMap; - default: - break; - } - return true; - } - - @Override - public Map acquisitionHandKeyInfo( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws JBOException { - boolean flag = ValidateRestfulParamUtil.validateReqPara(request, - UserCenterMangerConstant.APP_GESTURE_USERID); - if (!flag) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - loadAcquisitionHandKeyInfo(request, sqlca); - // 校验用户 - if (!userValidate(tx)) { - return ReturnMapUtil.getReturnMap(); - } - - Map body = new HashMap(); - body.put("loginid", this.user.getLoginId()); - body.put("username", this.user.getUserName()); - body.put("userid", this.user.getUserId()); - body.put("enablegesture", this.user.getEnableGesture()); - switch (this.user.getEnableGesture()) { - case "1": - body.put("enableGestureName", UserGestureStatus.ENABLE.getName()); - break; - default: - body.put("enableGestureName", UserGestureStatus.UNENABLE.getName()); - break; - } - tx.commit(); - ReturnMapUtil.setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, - UserCenterManagerResultConstant.SUCCESS_RESULT_ACQUISITION_MSG); - return ReturnMapUtil.getReturnMap(); - } - - @Override - public Map modilfGesturePwd(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws JBOException { - this.userId = (String) request.getSession().getAttribute("userid"); - boolean flag = ValidateRestfulParamUtil.validateReqPara(request, - UserCenterMangerConstant.APP_GESTURE_PWD); - if (!flag) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - loadModilfGesturePwd(request, sqlca); - // 校验用户 - if (!userValidate(tx)) { - return ReturnMapUtil.getReturnMap(); - } - this.pwd = MD5Util.getMD5EncodedPassword(this.pwd); - - // 修改用户手密信息 - try { - - jbo.updateUserByUserId( - tx, - "UPDATE o SET ENABLE_GESTURE='1' , GESTURE_PASSWORD='" - + this.pwd + "' WHERE USERID=:USERID", - this.userId); - tx.commit(); - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.SUCCESS_RESULT_CODE, - UserCenterManagerResultConstant.SUCCESS_RESULT_MODILF_GESTURE); - } catch (JBOException e) { - logger.error("GestureManagerServiceImpl >> modilfGesturePwd >. " - + e); - tx.rollback(); - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - UserCenterManagerResultConstant.FAIL_RESULT_MODILF_GESTURE_DB_ERROR); - return ReturnMapUtil.getReturnMap(); - } - return ReturnMapUtil.getReturnMap(); - } - - @Override - public Map closeGesture(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws JBOException { - boolean flag = ValidateRestfulParamUtil.validateReqPara(request, - UserCenterMangerConstant.APP_GESTURE_USERID); - if (!flag) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - this.userId = request.getParameter("userid").toString(); - try { - jbo.updateUserByUserId( - tx, - "UPDATE o SET " - + "ENABLE_GESTURE='' , GESTURE_PASSWORD='' WHERE USERID=:USERID", - this.userId); - tx.commit(); - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.SUCCESS_RESULT_CODE, - UserCenterManagerResultConstant.SUCCESS_RESULT_CLOSE_GESTURE); - } catch (JBOException e) { - logger.error("GestureManagerServiceImpl >> modilfGesturePwd >. " - + e); - tx.rollback(); - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - UserCenterManagerResultConstant.FAIL_RESULT_CLOSE_GESTURE_DB_ERROR); - return ReturnMapUtil.getReturnMap(); - } - return ReturnMapUtil.getReturnMap(); - } - -} diff --git a/src_app/apx/com/amarsoft/als/user/center/service/impl/LoadHomePageServiceImpl.java b/src_app/apx/com/amarsoft/als/user/center/service/impl/LoadHomePageServiceImpl.java deleted file mode 100644 index e4bc78871..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/service/impl/LoadHomePageServiceImpl.java +++ /dev/null @@ -1,153 +0,0 @@ -package apx.com.amarsoft.als.user.center.service.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.jbo.FlowInfoJbo; -import apx.com.amarsoft.als.base.jbo.FlowObjectJbo; -import apx.com.amarsoft.als.base.jbo.UserInfoJbo; -import apx.com.amarsoft.als.base.jbo.impl.FlowInfoJboImpl; -import apx.com.amarsoft.als.base.jbo.impl.FlowObjectJboImpl; -import apx.com.amarsoft.als.base.jbo.impl.UserInfoJboImpl; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.user.center.constant.UserCenterManagerResultConstant; -import apx.com.amarsoft.als.user.center.service.LoadHomePageService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -public class LoadHomePageServiceImpl implements LoadHomePageService { - // 日志对象 - private static Log logger = ARE.getLog(); - // 用户编号 - private String userId; - - FlowInfoJbo flowJbo = new FlowInfoJboImpl(); - FlowObjectJbo flowObjectJbo = new FlowObjectJboImpl(); - UserInfoJbo userJbo = new UserInfoJboImpl(); - - private List> getAppFlowInfo(JBOTransaction tx, String sWhere) - throws JBOException { - List> list = new ArrayList>(); - List bos1 = flowJbo.findAllAppFlow(tx, sWhere); - if (bos1 != null && bos1.size() > 0) { - tx.commit(); - for (BizObject bo1 : bos1) { - Map map = new HashMap(); - map.put("id", bo1.getAttribute("ID").getValue()); - map.put("flowno", bo1.getAttribute("FLOW_NO").getValue()); - map.put("display", bo1.getAttribute("APP_FLOW_NAME").getValue()); - map.put("filename", bo1.getAttribute("FILE_NAME").getValue()); - map.put("filepath", bo1.getAttribute("FILE_PATH").getValue()); - map.put("filesize", bo1.getAttribute("FILE_SIZE").getValue()); - list.add(map); - } - } - return list; - } - - private List> getAppFLowRoleInfo(JBOTransaction tx, - String sUserId) throws JBOException { - List> list = new ArrayList>(); - List bos = userJbo.findAppFlowRoleByUserId(tx, sUserId); - if (bos != null && bos.size() > 0) { - tx.commit(); - for (BizObject bo : bos) { - Map map = new HashMap(); - map.put("roleid", bo.getAttribute("roleid")); - map.put("flowno", bo.getAttribute("flowname")); - list.add(map); - } - } - return list; - } - - private List> getCommissionList(JBOTransaction tx, - String userId) throws JBOException { - List commissionList = flowObjectJbo.getCommissionList(tx, userId); - List> list = new ArrayList>(); - for (BizObject bo : commissionList) { - Map map = new HashMap(); - map.put("flowno", bo.getAttribute("FLOWNO")); - map.put("flowname", bo.getAttribute("FLOWNAME")); - list.add(map); - } - return list; - } - - public List> getAppFlowShow(JBOTransaction tx, - String userId) throws JBOException { - - List> appFlowRoleList = getAppFLowRoleInfo(tx, - userId); - String sFlows = ""; - for (Map roleFlow : appFlowRoleList) { - String sFlowno = roleFlow.get("flowno") == null ? "" - : roleFlow.get("flowno").toString(); - if (sFlowno.contains(",")) { - String[] aFlows = sFlowno.split(","); - for (String str : aFlows) { - str = str.trim(); - str = "'" + str + "',"; - sFlows += str; - } - } else { - String str = sFlowno.trim(); - str = "'" + str + "',"; - sFlows += str; - } - } - if (sFlows.length() == 0) sFlows = "'',"; - sFlows = sFlows.substring(0, sFlows.length() - 1); - List> appFlowList = getAppFlowInfo(tx, sFlows); - List> commissionList = getCommissionList(tx, userId); - for (Map map : appFlowList) { - int i = 0; - String sAppFlowno = map.get("flowno") == null ? "" : map.get("flowno").toString(); - BizObject bo = flowJbo.findFlowCatalogByFlowNo(tx, sAppFlowno); - map.put("flowname", bo.getAttribute("FLOWNAME").getValue()); - for (Map commission : commissionList) { - String sCommissionFlowno = commission.get("flowno") == null ? "" : commission.get("flowno").toString(); - if (sAppFlowno.equals(sCommissionFlowno)) { - i++; - } - } - map.put("pendingnum", i); - } - - return appFlowList; - } - - @Override - public Map acquisitionFlowCatalog( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws JBOException { - this.userId = (String) request.getSession().getAttribute("userid"); - logger.debug(userId); - Map body = new HashMap(); - List> list = getAppFlowShow(tx, this.userId); - tx.commit(); - if (list != null) { - body.put("flowlist", list); - ReturnMapUtil - .setReturnMap( - body, - ResultConstant.SUCCESS_RESULT_CODE, - UserCenterManagerResultConstant.SUCCESS_RESULT_ACQUISITION_MSG); - } else { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - UserCenterManagerResultConstant.FAIL_RESULT_NO_APP_FLOW); - } - return ReturnMapUtil.getReturnMap(); - } - -} diff --git a/src_app/apx/com/amarsoft/als/user/center/service/impl/UserCenterManagerServiceImpl.java b/src_app/apx/com/amarsoft/als/user/center/service/impl/UserCenterManagerServiceImpl.java deleted file mode 100644 index 2e6eedd6c..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/service/impl/UserCenterManagerServiceImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -package apx.com.amarsoft.als.user.center.service.impl; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.user.center.service.AppVersionService; -import apx.com.amarsoft.als.user.center.service.GestureManagerService; -import apx.com.amarsoft.als.user.center.service.LoadHomePageService; -import apx.com.amarsoft.als.user.center.service.UserCenterManagerService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -public class UserCenterManagerServiceImpl implements UserCenterManagerService { - // 日志对象 - private static Log logger = ARE.getLog(); - // 手密服务 - GestureManagerService gestureManagerService = new GestureManagerServiceImpl(); - // APP版本服务 - AppVersionService appVersionService = new AppVersionServiceImpl(); - // 加载首页服务 - LoadHomePageService loadHomePageService = new LoadHomePageServiceImpl(); - - @Override - public Map acquisitionHandKeyInfo( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) { - try { - return gestureManagerService.acquisitionHandKeyInfo(request, sqlca, - tx); - } catch (JBOException e) { - logger.error("UserCenterManagerServiceImpl >> acquisitionHandKeyInfo >. " - + e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - @Override - public Map modilfGesturePwd(HttpServletRequest request, - Transaction sqlca, @Context JBOTransaction tx) throws JBOException { - try { - return gestureManagerService.modilfGesturePwd(request, sqlca, tx); - } catch (JBOException e) { - logger.error("UserCenterManagerServiceImpl >> modilfGesturePwd >. " - + e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - @Override - public Map closeGesture(HttpServletRequest request, - Transaction sqlca, @Context JBOTransaction tx) throws JBOException { - try { - return gestureManagerService.closeGesture(request, sqlca, tx); - } catch (JBOException e) { - logger.error("UserCenterManagerServiceImpl >> closeGesture >. " + e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - - } - - @Override - public Map detectionVersion(HttpServletRequest request, - Transaction sqlca, @Context JBOTransaction tx) throws JBOException { - try { - return appVersionService.detectionVersion(request, sqlca, tx); - } catch (Exception e) { - logger.error("UserCenterManagerServiceImpl >> detectionVersion >. " - + e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - @Override - public Map acquisitionFlowCatalog( - HttpServletRequest request, Transaction sqlca, - @Context JBOTransaction tx) throws JBOException { - try { - return loadHomePageService.acquisitionFlowCatalog(request, sqlca, - tx); - } catch (Exception e) { - logger.error("UserCenterManagerServiceImpl >> detectionVersion >. " - + e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - - } -} diff --git a/src_app/apx/com/amarsoft/als/user/center/util/ValidateRestfulParamUtil.java b/src_app/apx/com/amarsoft/als/user/center/util/ValidateRestfulParamUtil.java deleted file mode 100644 index 2ca2ff571..000000000 --- a/src_app/apx/com/amarsoft/als/user/center/util/ValidateRestfulParamUtil.java +++ /dev/null @@ -1,34 +0,0 @@ -package apx.com.amarsoft.als.user.center.util; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; - -import apx.com.amarsoft.als.user.center.constant.UserCenterMangerConstant; - -public class ValidateRestfulParamUtil { - public static boolean validateReqPara(HttpServletRequest request, - String apiType) { - switch (apiType) { - case UserCenterMangerConstant.APP_GESTURE_PWD: - if(StringUtils.isBlank(request.getParameter("pwd"))) { - return false; - } - break; - case UserCenterMangerConstant.APP_GESTURE_USERID: - if(StringUtils.isBlank(request.getParameter("userid"))) { - return false; - } - break; - case UserCenterMangerConstant.APP_CHECK_VERSION: - if(StringUtils.isBlank(request.getParameter("devos")) - || StringUtils.isBlank(request.getParameter("versioncode"))) { - return false; - } - break; - default: - break; - } - return true; - } -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/bzsrv/ALSLogonComparator.java b/src_app/apx/com/amarsoft/als/user/logon/bzsrv/ALSLogonComparator.java deleted file mode 100644 index 5bfa70c22..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/bzsrv/ALSLogonComparator.java +++ /dev/null @@ -1,25 +0,0 @@ -package apx.com.amarsoft.als.user.logon.bzsrv; - -import apx.com.amarsoft.als.base.util.DES; -import apx.com.amarsoft.als.user.logon.service.ADLdapService; - - -/** - * - * @author yangsong - * - */ -public class ALSLogonComparator implements LogonComparator{ - private static final String DES_KEY_FIRST = "4860B1E27"; - private static final String DES_KEY_SECOND = "7464DB1C804E"; - private static final String DES_KEY_THIRD = "426A2405196"; - /*private UmService umService = new UmService();*/ - private ADLdapService adservice = new ADLdapService(); - - public boolean compareUserPass(String uid, String pwd) { - String password = DES.decrypt(pwd, DES_KEY_FIRST, DES_KEY_SECOND, DES_KEY_THIRD); - Boolean loginFlag = adservice.authenricate(uid, password); - return loginFlag; - } - -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/bzsrv/LoginProc.java b/src_app/apx/com/amarsoft/als/user/logon/bzsrv/LoginProc.java deleted file mode 100644 index 4dec66316..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/bzsrv/LoginProc.java +++ /dev/null @@ -1,197 +0,0 @@ -package apx.com.amarsoft.als.user.logon.bzsrv; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import apx.com.amarsoft.als.base.model.RspObject; -import cn.coyoteam.aweresf.configure.GlobalConfigure; -import cn.coyoteam.aweresf.consts.SessionConst; -import cn.coyoteam.aweresf.model.Org; -import cn.coyoteam.aweresf.model.User; -import cn.coyoteam.aweresf.web.als.LogonUser; -import cn.coyoteam.aweresf.web.als.TokenSession; -import cn.coyoteam.aweresf.web.als.TokenSessionManager; -import cn.coyoteam.aweresf.web.als.TokenSessionManagerFactory; - -import com.amarsoft.aims.util.StringHelper; -import com.amarsoft.awe.RuntimeContext; -import com.amarsoft.awe.control.model.ComponentSession; -import com.amarsoft.awe.security.SecurityAudit; -import com.amarsoft.awe.security.SecurityOptionManager; -import com.amarsoft.awe.security.pwdrule.ALSPWDRules; -import com.amarsoft.awe.security.pwdrule.IsPasswordOverdueRule; -import com.amarsoft.awe.security.pwdrule.PasswordRuleManager; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASOrg; -import com.amarsoft.context.ASPreference; -import com.amarsoft.context.ASUser; -import com.amarsoft.dict.als.cache.CacheLoaderFactory; -import com.amarsoft.dict.als.manage.NameManager; - -@Path("/LoginProc") -public class LoginProc { - - private Map getParameterMap(HttpServletRequest request) { - // 参数Map - Map properties = request.getParameterMap(); - // 返回值Map - Map returnMap = new HashMap(); - Iterator> entries = properties.entrySet().iterator(); - Map.Entry entry; - String name = ""; - String value = ""; - while (entries.hasNext()) { - entry = (Map.Entry) entries.next(); - name = (String) entry.getKey(); - Object valueObj = entry.getValue(); - if(null == valueObj){ - value = ""; - }else if(valueObj instanceof String[]){ - String[] values = (String[])valueObj; - for(int i=0;i login(@Context HttpServletRequest request,@Context Transaction sqlca) { - logout(request,sqlca); - RspObject rspObject = null; - String uid = request.getParameter("uid"); - String pwd = request.getParameter("pwd"); - - - TokenSessionManager tokenSessionManager = TokenSessionManagerFactory.getALSTokenSessionManager(sqlca); - - TokenSession tokenSession = (TokenSession)request.getSession().getAttribute(SessionConst.KEY_TOKEN_SESSION); - if(tokenSession==null){ - Transaction Sqlca = null; - try{ - Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource()); - if(this.validUserPassword(request,Sqlca,uid, pwd)){ - tokenSession = tokenSessionManager.createTokenSession(uid,getParameterMap(request)); - request.getSession(true); - request.getSession().setAttribute(SessionConst.KEY_TOKEN_SESSION, tokenSession); - request.getSession().setAttribute(SessionConst.KEY_TOKEN, tokenSession.getToken()); - - //从这里登陆后,也要把session设置好 - ASUser curUser = ASUser.getUser(tokenSession.getUserId(), sqlca); - RuntimeContext CurARC = new RuntimeContext(); - CurARC.setUser(curUser); - CurARC.setPref(new ASPreference(curUser.getUserID())); - CurARC.setCompSession(new ComponentSession()); - request.getSession().setAttribute("CurARC", CurARC); - LogonUser luser = new LogonUser(); - User user = new User(); - user.setUserId(curUser.getUserID()); - user.setUserName(curUser.getUserName()); - user.setStatus(curUser.getStatus()); - ASOrg curOrg = curUser.getBelongOrg(); - Org org = new Org(); - org.setOrgId(curOrg.getOrgID()); - org.setOrgName(curOrg.getOrgName()); - org.setOrgLevel(curOrg.getOrgLevel()); - org.setStatus(curOrg.getStatus()); - org.setSortNo(curOrg.getSortNo()); - user.setOrg(org); - luser.setUser(user); - luser.setToken(tokenSession.getToken()); - - rspObject = createNormalRspObject(tokenSession.getToken(),request); - }else{ - rspObject = RspObject.build("password error"); - rspObject.getHeader().setCode("403"); - } - }catch(Exception e){ - e.printStackTrace(); - rspObject = RspObject.build(e); - } - }else{ - rspObject = createNormalRspObject(tokenSession.getToken(),request); - } - - return rspObject; - } - - public boolean validUserPassword(HttpServletRequest request, Transaction Sqlca,String sUserID,String sPWD) throws Exception { - String userName = NameManager.getUserName(sUserID); - - System.out.println(userName); - System.out.println(userName+":"+sUserID+":"+sPWD); - com.amarsoft.awe.security.LogonUser user = new com.amarsoft.awe.security.LogonUser(userName, sUserID, sPWD); - SecurityAudit securityAudit = new SecurityAudit(user); - String requestMessage = request.getRemoteAddr() + "," + request.getRemoteAddr() + "," + request.getServerName() + "," + request.getServerPort();//将request请求信息拼接一下,传进去 - if(securityAudit.isLogonSuccessful(Sqlca, null, requestMessage)){//目前这步不需要别的登录验证 - //登录成功,还需进一步进行密码验证 - PasswordRuleManager pwm = new PasswordRuleManager(); - IsPasswordOverdueRule isPWDOverdueRule = new IsPasswordOverdueRule(sUserID, SecurityOptionManager.getPWDLimitDays(Sqlca), Sqlca);//该规则只是验证性规则,不是登录成功失败的必要条件 - ALSPWDRules alsRules = new ALSPWDRules(SecurityOptionManager.getRules(Sqlca)); - pwm.addRule(isPWDOverdueRule);//该规则比ALSPWDRules更重要,先添加进去 - pwm.addRule(alsRules); - securityAudit.isValidateSuccessful(Sqlca, pwm); - return true; - } - else return false; - } - - private RspObject createNormalRspObject(String token,HttpServletRequest request){ - RspObject rspObject = RspObject.build(token); - - if("true".equals(GlobalConfigure.getInstance().getProperty(SessionConst.KEY_SMS_REQUIRE))){ - rspObject.getHeader().put(SessionConst.KEY_SMS_REQUIRE, true); - }else{ - rspObject.getHeader().put(SessionConst.KEY_SMS_REQUIRE, false); - } - - return rspObject; - } - - - private TokenSession lookupTokenSession(String token,HttpServletRequest request,Transaction sqlca){ - TokenSession tokenSession = (TokenSession)request.getSession().getAttribute(SessionConst.KEY_TOKEN_SESSION); - if(tokenSession==null){ - tokenSession = TokenSessionManagerFactory.getALSTokenSessionManager(sqlca).getTokenSession(token); - } - return tokenSession; - - } - - @GET - @Path("/Logout") - public RspObject logout(@Context HttpServletRequest request,@Context Transaction sqlca) { - RspObject rspObject = null; - String token = StringHelper.nvl(request.getHeader(SessionConst.KEY_TOKEN),""); - if(token.length()==0)token = StringHelper.nvl(request.getParameter(SessionConst.KEY_TOKEN),""); - - //根据token,把页面记录过期或删除掉 - if(token!=null){ - TokenSession tknSession = lookupTokenSession(token, request, sqlca); - if(tknSession!=null){ - TokenSessionManagerFactory.getALSTokenSessionManager(sqlca).dropTokenSession(tknSession); - } - request.getSession().removeAttribute(SessionConst.KEY_TOKEN_SESSION); - request.getSession().invalidate(); - rspObject = RspObject.build("OK"); - }else{ - rspObject = RspObject.build("OK"); - } - - return rspObject; - } - -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/bzsrv/LogonComparator.java b/src_app/apx/com/amarsoft/als/user/logon/bzsrv/LogonComparator.java deleted file mode 100644 index 56898df8e..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/bzsrv/LogonComparator.java +++ /dev/null @@ -1,17 +0,0 @@ -package apx.com.amarsoft.als.user.logon.bzsrv; - -/** - * 登录比较器,用于登录验证用户名密码
- * 考虑到不同客户场景登录验证使用不同的实现。因此,需要将比较功能独立为接口 - * @author yangsong - * - */ -public interface LogonComparator { - /** - * 用户密码比较 - * @param uid - * @param pwd - * @return - */ - public boolean compareUserPass(String uid,String pwd); -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/bzsrv/SMSProc.java b/src_app/apx/com/amarsoft/als/user/logon/bzsrv/SMSProc.java deleted file mode 100644 index 6f53e9beb..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/bzsrv/SMSProc.java +++ /dev/null @@ -1,26 +0,0 @@ -package apx.com.amarsoft.als.user.logon.bzsrv; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; - -@Path("/SMSProc") -public class SMSProc { - - @GET - @Path("/FetchSMSCode") - public String fetchSMSCode(@QueryParam("phoneNumber") String phoneNumber){ - if(phoneNumber.length()!=11){ - throw new RuntimeException("phone number incorrect"); - } - System.out.println("phoneNumber="+phoneNumber); - return phoneNumber.substring(0, 4); - } - - @GET - @Path("/ValidateSMSCode") - public boolean validateSMSCode(@QueryParam("phoneNumber") String phoneNumber,@QueryParam("checkCode") String checkCode){ - return phoneNumber.substring(0, 4).equals(checkCode); - } - -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/bzsrv/UserManagerController.java b/src_app/apx/com/amarsoft/als/user/logon/bzsrv/UserManagerController.java deleted file mode 100644 index 642e91088..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/bzsrv/UserManagerController.java +++ /dev/null @@ -1,53 +0,0 @@ -package apx.com.amarsoft.als.user.logon.bzsrv; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import apx.com.amarsoft.als.base.constant.cache.AppCodeCache; -import apx.com.amarsoft.als.user.logon.service.UserManagerService; -import apx.com.amarsoft.als.user.logon.service.impl.UserManagerServiceImpl; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -@Path("/logon/manager") -public class UserManagerController { - // 日志对象 - private static Log logger = ARE.getLog(); - - UserManagerService userservice = new UserManagerServiceImpl(); - - @SuppressWarnings("unchecked") - @Path("/test") - @GET - public Map test(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - return (Map) AppCodeCache.getAppCodeCachePool().get( - request.getParameter("no")); - } - - @Path("/logon") - @GET - public Map logon(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道: 用户登录管理 >> app用户登录接口"); - return this.userservice.logon(request, sqlca, tx); - } - - @Path("/logout") - @GET - public Map logout(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception { - logger.info("进入接口通道: 用户登录管理 >> app用户注销接口"); - return this.userservice.logout(request, sqlca, tx); - } -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/constant/DESSecretKeyConstant.java b/src_app/apx/com/amarsoft/als/user/logon/constant/DESSecretKeyConstant.java deleted file mode 100644 index 00abfc381..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/constant/DESSecretKeyConstant.java +++ /dev/null @@ -1,9 +0,0 @@ -package apx.com.amarsoft.als.user.logon.constant; - -public class DESSecretKeyConstant { - - // DES secret key - public static final String DES_SECRET_KEY_ONE = "0123456789abc"; - public static final String DES_SECRET_KEY_TWO = "1234567890abc"; - public static final String DES_SECRET_KEY_THREE = "1234567890!@#"; -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/constant/LoginManagerConstant.java b/src_app/apx/com/amarsoft/als/user/logon/constant/LoginManagerConstant.java deleted file mode 100644 index c853aabfa..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/constant/LoginManagerConstant.java +++ /dev/null @@ -1,5 +0,0 @@ -package apx.com.amarsoft.als.user.logon.constant; - -public class LoginManagerConstant { - public static final String APP_LOGIN_API = "APP_LOGIN_API"; -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/constant/UserGestureStatus.java b/src_app/apx/com/amarsoft/als/user/logon/constant/UserGestureStatus.java deleted file mode 100644 index 2576efd2f..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/constant/UserGestureStatus.java +++ /dev/null @@ -1,23 +0,0 @@ -package apx.com.amarsoft.als.user.logon.constant; - -public enum UserGestureStatus { - ENABLE("启用"), UNENABLE("禁用"); - - private String name; - - private UserGestureStatus(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public static void main(String[] args) { - System.out.println(UserGestureStatus.ENABLE.getName()); - } -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/constant/UserManagerResultConstant.java b/src_app/apx/com/amarsoft/als/user/logon/constant/UserManagerResultConstant.java deleted file mode 100644 index 5e41439ce..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/constant/UserManagerResultConstant.java +++ /dev/null @@ -1,33 +0,0 @@ -package apx.com.amarsoft.als.user.logon.constant; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class UserManagerResultConstant { - public static final String SUCCESS_RESULT_LOGIN_MSG = "登录成功"; - public static final String SUCCESS_RESULT_LOGOUT_MSG = "登出成功"; - public final static String FAIL_RESULT_ERR_MSG = "服务器繁忙!请联系系统管理员!"; - public final static String FAIL_RESULT_LOGIN_PARAM_UN_PWD_ERR_MSG = "用户名和密码不能为空"; - public final static String FAIL_RESULT_LOGIN_ERR_MSG = "用户名或者密码错误!"; - public final static String FAIL_RESULT_HAND_KEY_ERR_MSG_NUENABLE = "手势密码认证方式未开启!"; - public final static String FAIL_RESULT_LOGIN_DISABLE_ERR_MSG = "已离职!"; - public final static String FAIL_RESULT_LOGIN_STATUS_DISABLE = "该用户已停用状态,请联系管理员!"; - public final static String FAIL_RESULT_LOGIN_STATUS_LOCKING = "该用户账户状态被锁,请联系管理员!"; - public final static String FAIL_RESULT_LOGOUT_ERR_MSG = "登出失败!"; - public final static String FAIL_RESULT_LOGOUT_TOKEN_NULL_ERR_MSG = "已是登出状态!"; - public final static String FAIL_RESULT_LOGIN_FUND_FLOW = "用户没有具体绑定具体流程!"; - public final static String FAIL_RESULT_LOGIN_TOKE_ERROR = "session记录失败!"; - public final static String FAIL_RESULT_LOGIOUT_ERR_2_MSG = "主动踢下线失败!"; - private static Log logger = ARE.getLog(); - public static ASUser curUser; - public static void setCurUser(String sUserId, Transaction sqlca ) { - try { - curUser = ASUser.getUser( SpecialTools.real2Amarsoft(sUserId), sqlca); - } catch (Exception e) { - logger.error(e); - } - } -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/constant/UserStatus.java b/src_app/apx/com/amarsoft/als/user/logon/constant/UserStatus.java deleted file mode 100644 index b72bd2f0c..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/constant/UserStatus.java +++ /dev/null @@ -1,19 +0,0 @@ -package apx.com.amarsoft.als.user.logon.constant; - -public enum UserStatus { - LOCKING("用户被锁"), NORMAL("正常用户"), DISABLE("用户已停用"); - - private String name ; - - private UserStatus(String name){ - this.name = name ; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/model/LoginUser.java b/src_app/apx/com/amarsoft/als/user/logon/model/LoginUser.java deleted file mode 100644 index f9942d346..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/model/LoginUser.java +++ /dev/null @@ -1,246 +0,0 @@ -package apx.com.amarsoft.als.user.logon.model; - -import java.io.Serializable; - -import cn.coyoteam.aweresf.model.Org; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; - -/** - * 重新构建用户对象,区别于ASUser,该类仅仅是一个简单的POJO - * @author jiaji_liu - * @date 2017-04-05 - */ -public class LoginUser implements Serializable,Cloneable { - private static final long serialVersionUID = -5748136533782441233L; - // 用户识别ID - private String userId; - // 用户名 - private String userName; - // 登录ID - private String loginId; - // 所属机构 - private Org org; - // 是否启用手势密码 - private String enableGesture; - // 用户状态 - private String status; - // 用户密码 - private String userPwd; - // 所属部门名 - private String orgName; - // 手势密码 - private String gesturePwd; - // 设备ID - private String devId; - // 设备类型 - private String devOs; - // 设备注册ID - private String devRegId; - - - private boolean pojoFlag; - - // --------------------------CONSTANT------------------------------ - private static final String COLUMN_USER_ID = "USERID"; - private static final String COLUMN_USER_NAME = "UserName"; - private static final String COLUMN_USER_LOGIN_ID = "LoginId"; - private static final String COLUMN_USER_PWD = "PASSWORD"; - private static final String COLUMN_USER_STATUS = "STATUS"; - private static final String COLUMN_USER_BELONG_ORG = "BELONGORG"; - - private static final String COLUMN_USER_GESTURE_PWD = "GESTURE_PASSWORD"; - private static final String COLUMN_USER_ENABLE_GESTURE = "ENABLE_GESTURE"; - - private static final String COLUMN_USER_DEV_ID = "DEV_ID"; - private static final String COLUMN_USER_DEV_OS = "DEV_OS"; - private static final String COLUMN_USER_DEV_REG_ID = "DEV_REG_ID"; - - public void loadLoginUser() { - this.userId = ""; - this.userName = ""; - this.loginId = ""; - this.org = new Org(); - this.enableGesture = ""; - this.status = ""; - this.userPwd = ""; - this.orgName = ""; - this.gesturePwd = ""; - this.pojoFlag = false; - } - - public LoginUser() { - - } - - public LoginUser(String loginId) { - loadLoginUser(); - try { - BizObjectManager bm = JBOFactory.getFactory().getManager("jbo.sys.USER_INFO"); - BizObject user = bm.createQuery("LOGINID=:LOGINID").setParameter("LOGINID", loginId).getSingleResult(false); - if(user==null)return; - this.pojoFlag = true; - this.loginId = loginId; - this.userId = user.getAttribute(COLUMN_USER_ID) == null ? "" : user.getAttribute(COLUMN_USER_ID).getString(); - this.userName = user.getAttribute(COLUMN_USER_NAME) == null ? "" : user.getAttribute(COLUMN_USER_NAME).getString(); - this.userPwd = user.getAttribute(COLUMN_USER_PWD) == null ? "" : user.getAttribute(COLUMN_USER_PWD).getString(); - this.status = user.getAttribute(COLUMN_USER_STATUS) == null ? "" : user.getAttribute(COLUMN_USER_STATUS).getString(); - this.org = new Org(user.getAttribute(COLUMN_USER_BELONG_ORG).getString()); - this.enableGesture = user.getAttribute(COLUMN_USER_ENABLE_GESTURE) == null ? "0" - : user.getAttribute(COLUMN_USER_ENABLE_GESTURE).toString(); - this.enableGesture = this.enableGesture == "" ? "0" : this.enableGesture; - if (this.org != null) { - this.orgName = this.org.getOrgName(); - } else { - this.orgName = ""; - } - this.gesturePwd = user.getAttribute(COLUMN_USER_GESTURE_PWD) == null ? "" : user.getAttribute(COLUMN_USER_GESTURE_PWD).toString(); - this.devId = user.getAttribute(COLUMN_USER_DEV_ID) == null ? "" : user.getAttribute(COLUMN_USER_DEV_ID).toString(); - this.devOs = user.getAttribute(COLUMN_USER_DEV_OS) == null ? "" : user.getAttribute(COLUMN_USER_DEV_OS).toString(); - this.devRegId = user.getAttribute(COLUMN_USER_DEV_REG_ID) == null ? "" : user.getAttribute(COLUMN_USER_DEV_REG_ID).toString(); - } catch (JBOException e) { - ARE.getLog().error("构造User对象出错!"); - e.printStackTrace(); - } - } - - public LoginUser(String userId, String extension1) { - loadLoginUser(); - try { - BizObjectManager bm = JBOFactory.getFactory().getManager("jbo.sys.USER_INFO"); - BizObject user = bm.createQuery("USERID=:USERID").setParameter("USERID", userId).getSingleResult(false); - if(user==null)return; - this.pojoFlag = true; - this.userId = userId; - this.loginId = user.getAttribute(COLUMN_USER_LOGIN_ID) == null ? "" : user.getAttribute(COLUMN_USER_LOGIN_ID).getString(); - this.userName = user.getAttribute(COLUMN_USER_NAME) == null ? "" : user.getAttribute(COLUMN_USER_NAME).getString(); - this.userPwd = user.getAttribute(COLUMN_USER_PWD) == null ? "" : user.getAttribute(COLUMN_USER_PWD).getString(); - this.status = user.getAttribute(COLUMN_USER_STATUS) == null ? "" : user.getAttribute(COLUMN_USER_STATUS).getString(); - this.org = new Org(user.getAttribute(COLUMN_USER_BELONG_ORG).getString()); - this.enableGesture = user.getAttribute(COLUMN_USER_ENABLE_GESTURE) == null ? "0" - : user.getAttribute(COLUMN_USER_ENABLE_GESTURE).toString(); - this.enableGesture = this.enableGesture == "" ? "0" : this.enableGesture; - if (this.org != null) { - this.orgName = this.org.getOrgName(); - } else { - this.orgName = ""; - } - this.gesturePwd = user.getAttribute(COLUMN_USER_GESTURE_PWD) == null ? "" : user.getAttribute(COLUMN_USER_GESTURE_PWD).toString(); - this.devId = user.getAttribute(COLUMN_USER_DEV_ID) == null ? "" : user.getAttribute(COLUMN_USER_DEV_ID).toString(); - this.devOs = user.getAttribute(COLUMN_USER_DEV_OS) == null ? "" : user.getAttribute(COLUMN_USER_DEV_OS).toString(); - this.devRegId = user.getAttribute(COLUMN_USER_DEV_REG_ID) == null ? "" : user.getAttribute(COLUMN_USER_DEV_REG_ID).toString(); - } catch (JBOException e) { - ARE.getLog().error("构造User对象出错!"); - e.printStackTrace(); - } - } - - public String getUserId() { - return userId; - } - - public String getUserName() { - return userName; - } - - public String getLoginId() { - return loginId; - } - - public Org getOrg() { - return org; - } - - public String getEnableGesture() { - return enableGesture; - } - - public String getStatus() { - return status; - } - - public String getUserPwd() { - return userPwd; - } - - public String getOrgName() { - return orgName; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public void setLoginId(String loginId) { - this.loginId = loginId; - } - - public void setOrg(Org org) { - this.org = org; - } - - public void setEnableGesture(String enableGesture) { - this.enableGesture = enableGesture; - } - - public void setStatus(String status) { - this.status = status; - } - - public void setUserPwd(String userPwd) { - this.userPwd = userPwd; - } - - public void setOrgName(String orgName) { - this.orgName = orgName; - } - - public boolean isPojoFlag() { - return pojoFlag; - } - - public void setPojoFlag(boolean pojoFlag) { - this.pojoFlag = pojoFlag; - } - - public String getGesturePwd() { - return gesturePwd; - } - - public void setGesturePwd(String gesturePwd) { - this.gesturePwd = gesturePwd; - } - - public String getDevId() { - return devId; - } - - public String getDevOs() { - return devOs; - } - - public String getDevRegId() { - return devRegId; - } - - public void setDevId(String devId) { - this.devId = devId; - } - - public void setDevOs(String devOs) { - this.devOs = devOs; - } - - public void setDevRegId(String devRegId) { - this.devRegId = devRegId; - } - -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/service/ADLdapService.java b/src_app/apx/com/amarsoft/als/user/logon/service/ADLdapService.java deleted file mode 100644 index 5db593f9e..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/service/ADLdapService.java +++ /dev/null @@ -1,99 +0,0 @@ -package apx.com.amarsoft.als.user.logon.service; - -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; -import javax.naming.ldap.Control; -import javax.naming.ldap.InitialLdapContext; -import javax.naming.ldap.LdapContext; - -import com.amarsoft.are.ARE; - -import config.InterfaceConfigFromDB; - -/** - * AD ladp校验服务 - * @author LIGUOYING688 - * @date 2015年12月24日 - * - */ -public class ADLdapService { - private LdapContext ctx = null; - private Control[] connCtls = null; - private final String LDAP_BASE= InterfaceConfigFromDB.getAppConfigItem("app.adladp.base"); - private final String LDAP_URL = InterfaceConfigFromDB.getAppConfigItem("app.adladp.url"); - private final String LDAP_USERNMA = InterfaceConfigFromDB.getAppConfigItem("app.adladp.adminUserName"); - private final String LDAP_PWD = InterfaceConfigFromDB.getAppConfigItem("app.adladp.adminpwd"); - /** - * 初始化LADP连接AD服务器 - */ - private void init(){ - Properties env = new Properties(); - env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); - env.put(Context.SECURITY_AUTHENTICATION, "simple"); - env.put(Context.SECURITY_PRINCIPAL,LDAP_USERNMA); - env.put(Context.SECURITY_CREDENTIALS,LDAP_PWD); - env.put(Context.PROVIDER_URL,LDAP_URL); - try { - ctx = new InitialLdapContext(env, connCtls); - } catch (NamingException e) { - ARE.getLog().error("AD认证失败",e); - } - } - - /** - * 获取用户的DN - * @param userName 用户名 - * @return - */ - private String getUserDN(String userName){ - init(); - String userDN = ""; - String filter = "(sAMAccountName=" + userName +")"; - SearchControls constraints = new SearchControls(); - constraints.setSearchScope(SearchControls.SUBTREE_SCOPE); - try { - NamingEnumeration en = ctx.search(LDAP_BASE,filter,constraints); - if(en == null){ - ARE.getLog().error("No NamingEnumeration"); - } - if(!en.hasMoreElements()){ - ARE.getLog().error("No element"); - } - while(en != null && en.hasMoreElements()){ - Object obj = en.nextElement(); - if (obj instanceof SearchResult){ - SearchResult si = (SearchResult) obj; - userDN += si.getName(); - userDN += "," + LDAP_BASE; - } - } - } catch (NamingException e) { - ARE.getLog().error("获取用户DN异常", e); - } - return userDN; - } - - /** - * 域账号认证 - * @param ID 用户ID - * @param password 用户密码 - * @return - */ - public boolean authenricate(String ID, String password){ - String userDN = getUserDN(ID); - try { - ctx.addToEnvironment(Context.SECURITY_PRINCIPAL,userDN); - ctx.addToEnvironment(Context.SECURITY_CREDENTIALS,password); - ctx.reconnect(connCtls); - return Boolean.TRUE; - } catch (NamingException e) { - ARE.getLog().error("AD认证失败!", e); - return Boolean.FALSE; - } - } -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/service/UserManagerService.java b/src_app/apx/com/amarsoft/als/user/logon/service/UserManagerService.java deleted file mode 100644 index 217c9925a..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/service/UserManagerService.java +++ /dev/null @@ -1,18 +0,0 @@ -package apx.com.amarsoft.als.user.logon.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface UserManagerService { - Map logon(HttpServletRequest request, Transaction sqlca, - @Context JBOTransaction tx) throws Exception; - - Map logout(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/service/impl/AppUserLoginServiceImpl.java b/src_app/apx/com/amarsoft/als/user/logon/service/impl/AppUserLoginServiceImpl.java deleted file mode 100644 index 6e1db6258..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/service/impl/AppUserLoginServiceImpl.java +++ /dev/null @@ -1,500 +0,0 @@ -package apx.com.amarsoft.als.user.logon.service.impl; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.DES; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.user.center.constant.UserCenterManagerResultConstant; -import apx.com.amarsoft.als.user.center.service.LoadHomePageService; -import apx.com.amarsoft.als.user.center.service.impl.LoadHomePageServiceImpl; -import apx.com.amarsoft.als.user.logon.constant.DESSecretKeyConstant; -import apx.com.amarsoft.als.user.logon.constant.LoginManagerConstant; -import apx.com.amarsoft.als.user.logon.constant.UserGestureStatus; -import apx.com.amarsoft.als.user.logon.constant.UserManagerResultConstant; -import apx.com.amarsoft.als.user.logon.constant.UserStatus; -import apx.com.amarsoft.als.user.logon.model.LoginUser; -import apx.com.amarsoft.als.user.logon.service.AppUserLoginService; -import apx.com.amarsoft.als.user.logon.service.AppUserLogoutService; -import apx.com.amarsoft.als.user.logon.util.ValidateRestfulParamUtil; -import cn.coyoteam.aweresf.configure.GlobalConfigure; -import cn.coyoteam.aweresf.consts.SessionConst; -import cn.coyoteam.aweresf.model.Org; -import cn.coyoteam.aweresf.model.User; -import cn.coyoteam.aweresf.web.als.LogonUser; -import cn.coyoteam.aweresf.web.als.TokenSession; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.RuntimeContext; -import com.amarsoft.awe.control.model.ComponentSession; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASOrg; -import com.amarsoft.context.ASPreference; -import com.amarsoft.context.ASUser; -import com.tenwa.util.MD5Util; - -public class AppUserLoginServiceImpl implements AppUserLoginService { - // 日志对象 - private static Log logger = ARE.getLog(); - // 用户登录名 - private String un; - // 用户登录名称 - private String pwd; - - // 用户设备ID - private String devId; - // 用户设备类型 - private String devOs; // 用户设备注册ID - private String devRegId; - // 用户状态码 - private String msgStatus; - - private LoginUser user; - // 登出服务 - private AppUserLogoutService logoutService = new AppUserLogoutServiceImpl(); - private TokenSession tokenSession; - - // begin 初始化数据 - private String parseCiphertext(String ciphertext) { - return DES.decrypt(ciphertext, DESSecretKeyConstant.DES_SECRET_KEY_ONE, - DESSecretKeyConstant.DES_SECRET_KEY_TWO, - DESSecretKeyConstant.DES_SECRET_KEY_THREE); - } - -// private void initTransaction(Transaction sqlca) { -// this.tokenSessionManager = null; -// this.tokenServiceObject.setTokenSessionManager(sqlca); -// this.tokenSessionManager = this.tokenServiceObject -// .getTokenSessionManager(); -// } -// -// private void initLogonToken(HttpServletRequest request) { -// this.tokenServiceObject = new TokenSessionObject(); -// this.tokenSession = null; -// this.tokenServiceObject.setTokenSession(request); -// this.tokenSession = this.tokenServiceObject.getTokenSession(); -// if (this.tokenSession != null) -// logger.info("userinfo >> " + this.tokenSession.getUserId()); -// } - - private void initLogonParam(HttpServletRequest request, Transaction sqlca) { - this.un = ""; - this.pwd = ""; - this.devId = ""; - this.devOs = ""; - this.devRegId = ""; - this.msgStatus = ""; - this.user = null; - - this.un = request.getParameter("un"); - this.pwd = parseCiphertext(request.getParameter("pwd")); - this.devId = request.getParameter("devid") == null ? "" : request - .getParameter("devid"); - this.devOs = request.getParameter("devtype") == null ? "" : request - .getParameter("devtype"); - this.devRegId = request.getParameter("dev_reg_id") == null ? "" - : request.getParameter("dev_reg_id"); - logger.info("info : un、pwd >> " + un + ", " + pwd); - } - - // end - // begin 保存数据 - /** - * 记录登录错误日志 - * - * @throws JBOException - */ - private void recordLoginErrorLog(HttpServletRequest request, - LoginUser user, String errMsg, JBOTransaction tx) - throws JBOException { - try { - BizObjectManager bm = JBOFactory - .getBizObjectManager("jbo.sys.USER_FAILEDLIST"); - tx.join(bm); - BizObject bo = bm.newObject(); - bo.setAttributeValue("LogonTime", getCurrentTime()); - bo.setAttributeValue("UserID", user.getUserId()); - bo.setAttributeValue("UserName", user.getUserName()); - bo.setAttributeValue("ErrorMessage", errMsg); - bo.setAttributeValue("LISTID", UUID.randomUUID()); - bm.saveObject(bo); - tx.commit(); - } catch (Exception e) { - logger.error(e); - tx.rollback(); - } - } - - private String getMD5Hex(byte[] buf) { - MessageDigest md5; - try { - md5 = MessageDigest.getInstance("MD5"); - } catch (NoSuchAlgorithmException e) { - logger.error(e); - throw new RuntimeException(e); - } - md5.update(buf); - byte[] tmp = md5.digest(); - StringBuilder sb = new StringBuilder(); - for (byte b : tmp) { - sb.append(Integer.toHexString(b & 0xff)); - } - return sb.toString().toUpperCase(); - } - - /** - * 记录session - * - * @throws Exception - */ - private TokenSession recordLoginSession(String uid, Transaction sqlca, - Map properties, JBOTransaction tx) throws Exception { - // initTransaction(sqlca); - // return this.tokenSessionManager.createTokenSession(uid, properties); - TokenSession tokenSession = new TokenSession(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.guaranty.TOKEN_SESSION"); - tx.join(bom); - BizObjectQuery boq = bom.createQuery("USER_ID=:USER_ID") - .setParameter("USER_ID", uid); - @SuppressWarnings("unchecked") - List bos = boq.getResultList(false); - for (BizObject bo : bos) { - bom.deleteObject(bo); - } - String sToken = getMD5Hex(UUID.randomUUID().toString().getBytes()); - String sDevId = properties.get("devId"); - String sDevOs = properties.get("devOs"); - tokenSession.setUserId(uid); - tokenSession.setToken(sToken); - tokenSession.setDevId(sDevId); - tokenSession.setDevOs(sDevOs); - tokenSession.setCreated(new Date()); - String tokenHoldTimeStr = GlobalConfigure.getInstance() - .getProperty(SessionConst.KEY_TOKEN_HOLD_TIME); - if (tokenHoldTimeStr == null) - tokenHoldTimeStr = "-1"; - Integer tokenHoldTime = Integer.parseInt(tokenHoldTimeStr); - // 如果设置holdTime小于0,则给他一个长达三年的有效时间 - if (tokenHoldTime <= 0) { - tokenHoldTime = 3 * 365 * 24 * 3600; - } - - // 计算token失效时间 - Calendar expireTime = Calendar.getInstance(); - expireTime.setTime(tokenSession.getCreated()); - expireTime.add(Calendar.SECOND, tokenHoldTime); - - tokenSession.setExpireIn(expireTime.getTime()); - BizObject bo = bom.newObject(); - bo.setAttributeValue("TOKEN", sToken); - bo.setAttributeValue("USER_ID", uid); - bo.setAttributeValue("DEV_ID", sDevId); - bo.setAttributeValue("DEV_OS", sDevOs); - bo.setAttributeValue("CREATED", getCurrentTime()); - bom.saveObject(bo); - tx.commit(); - - } catch (JBOException e) { - tokenSession = new TokenSession(); - logger.error(e); - tx.rollback(); - } - return tokenSession; - } - - // end - // begin 校验 -// /** -// * 校验 session token -// * -// * @param request -// * @return -// */ -// private boolean checkSessionToken(HttpServletRequest request) { -// initLogonToken(request); -// if (this.tokenSession == null) { -// return false; -// } -// return true; -// } - - /** - * 普通密码校验 - * - * @param request - * @param sqlca - * @return - * @throws JBOException - */ - private boolean commonKeyValidate(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws JBOException { - - // 校验用户普通密码 MD5加密 比对数据密码是否一致 - if (!MD5Util.getMD5EncodedPassword(this.pwd).equalsIgnoreCase( - this.user.getUserPwd())) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - UserManagerResultConstant.FAIL_RESULT_LOGIN_ERR_MSG); - recordLoginErrorLog(request, this.user, - UserManagerResultConstant.FAIL_RESULT_LOGIN_ERR_MSG, tx); - return false; - } - return true; - } - - /** - * 手密校验 - * - * @param request - * @param sqlca - * @return - * @throws JBOException - */ - private boolean handKeyValidate(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws JBOException { - if (!this.user.getEnableGesture().equals("1")) { - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - UserManagerResultConstant.FAIL_RESULT_HAND_KEY_ERR_MSG_NUENABLE); - return false; - } - // 校验用户普通密码 MD5加密 比对数据密码是否一致 - if (!MD5Util.getMD5EncodedPassword(this.pwd).equalsIgnoreCase( - this.user.getGesturePwd())) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - UserManagerResultConstant.FAIL_RESULT_LOGIN_ERR_MSG); - recordLoginErrorLog(request, this.user, - UserManagerResultConstant.FAIL_RESULT_LOGIN_ERR_MSG, tx); - return false; - } - return true; - - } - - // end - // begin 登录过程 - private Map process(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - - // 校验用户名和密码 不能为null 不能为空 不能只有空字符 - if (!ValidateRestfulParamUtil.validateReqPara(request, - LoginManagerConstant.APP_LOGIN_API)) { - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - UserManagerResultConstant.FAIL_RESULT_LOGIN_PARAM_UN_PWD_ERR_MSG); - return ReturnMapUtil.getReturnMap(); - } - initLogonParam(request, sqlca); - this.user = new LoginUser(this.un); - // 用户是否存在 - if (!this.user.isPojoFlag()) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - UserManagerResultConstant.FAIL_RESULT_LOGIN_ERR_MSG); - return ReturnMapUtil.getReturnMap(); - } - - // 校验用户状态 - this.msgStatus = ""; - switch (this.user.getStatus()) { - case "0": - this.msgStatus = UserStatus.LOCKING.getName(); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - UserManagerResultConstant.FAIL_RESULT_LOGIN_STATUS_LOCKING); - return ReturnMapUtil.getReturnMap(); - case "2": - this.msgStatus = UserStatus.DISABLE.getName(); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - UserManagerResultConstant.FAIL_RESULT_LOGIN_STATUS_DISABLE); - return ReturnMapUtil.getReturnMap(); - default: - this.msgStatus = UserStatus.NORMAL.getName(); - break; - } - // 校验密码 区分手密和普通密码 - String keyType = request.getParameter("keytype") == null ? "common" - : request.getParameter("keytype"); - switch (keyType) { - case "common": - if (!commonKeyValidate(request, sqlca, tx)) { - return ReturnMapUtil.getReturnMap(); - } - break; - case "hand": - if (!handKeyValidate(request, sqlca, tx)) { - return ReturnMapUtil.getReturnMap(); - } - break; - } - // 主动踢下线 查询 token session 存在 - logoutService.logout(request, sqlca, tx); - // 记录session - Map properties = new HashMap(); - properties.put("devId", this.devId); - properties.put("devOs", this.devOs); - this.tokenSession = null; - this.tokenSession = recordLoginSession(this.user.getUserId(), sqlca, - properties, tx); - if (this.tokenSession.getToken() == null) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - UserManagerResultConstant.FAIL_RESULT_LOGIN_TOKE_ERROR); - return ReturnMapUtil.getReturnMap(); - } - request.getSession(true); - request.getSession().setAttribute(SessionConst.KEY_TOKEN_SESSION, - this.tokenSession); - request.getSession().setAttribute(SessionConst.KEY_TOKEN, - this.tokenSession.getToken()); - UserManagerResultConstant.setCurUser(tokenSession.getUserId(), sqlca); - ASUser curUser = UserManagerResultConstant.curUser; - RuntimeContext CurARC = new RuntimeContext(); - CurARC.setUser(curUser); - CurARC.setPref(new ASPreference(curUser.getUserID())); - CurARC.setCompSession(new ComponentSession()); - request.getSession().setAttribute("CurARC", CurARC); - request.getSession().setAttribute("userid", curUser.getUserID()); - request.getSession().setAttribute("orgid", curUser.getOrgID()); - request.getSession().setAttribute("ASUser", curUser); - LogonUser luser = new LogonUser(); - User user1 = new User(); - user1.setUserId(curUser.getUserID()); - user1.setUserName(curUser.getUserName()); - user1.setStatus(curUser.getStatus()); - ASOrg curOrg = curUser.getBelongOrg(); - Org org = new Org(); - org.setOrgId(curOrg.getOrgID()); - org.setOrgName(curOrg.getOrgName()); - org.setOrgLevel(curOrg.getOrgLevel()); - org.setStatus(curOrg.getStatus()); - org.setSortNo(curOrg.getSortNo()); - user1.setOrg(org); - luser.setUser(user1); - luser.setToken(tokenSession.getToken()); - - // 修改用户手密信息 - try { - BizObjectManager bomcr = JBOFactory - .getBizObjectManager("jbo.sys.USER_INFO"); - tx.join(bomcr); - bomcr.createQuery( - "UPDATE o SET " - + "DEV_ID=:DEV_ID, DEV_OS=:DEV_OS, DEV_REG_ID=:DEV_REG_ID WHERE LOGINID=:LOGINID") - .setParameter("DEV_ID", this.devId) - .setParameter("DEV_OS", this.devOs) - .setParameter("DEV_REG_ID", this.devRegId) - .setParameter("LOGINID", this.un).executeUpdate(); - tx.commit(); - } catch (JBOException e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - UserCenterManagerResultConstant.FAIL_RESULT_MODILF_GESTURE_DB_ERROR); - return ReturnMapUtil.getReturnMap(); - } - return setLoginSuccessMap(this.user, msgStatus, sqlca, tx); - } - - /** - * 返回参数 - * - * @param user - * @param userstatusName - * @param sqlca - * @return - */ - private Map setLoginSuccessMap(LoginUser user, - String userstatusName, Transaction sqlca, JBOTransaction tx) { - // 返回参数 - Map body = new HashMap(); - body.put("loginid", this.un); - body.put("devid", this.devId); - body.put("devos", this.devOs); - body.put("dev_reg_id", this.devRegId); - body.put("userid", user.getUserId()); - body.put("username", user.getUserName()); - body.put("orgid", this.user.getOrg().getOrgId()); - body.put("user_status_code", - user.getStatus() == "" ? "0" : user.getStatus()); - body.put("userstatus", - userstatusName == "" ? UserStatus.NORMAL.getName() - : userstatusName); - body.put("enable_guesture_code", user.getEnableGesture()); - String enableGestureName = ""; - switch (user.getEnableGesture()) { - case "1": - enableGestureName = UserGestureStatus.ENABLE.getName(); - break; - default: - enableGestureName = UserGestureStatus.UNENABLE.getName(); - break; - } - body.put("enable_gesture", enableGestureName); - body.put("orgname", user.getOrgName()); - - LoadHomePageService loadHomePageService = new LoadHomePageServiceImpl(); - List> list = new ArrayList>(); - try { - list = loadHomePageService.getAppFlowShow(tx, user.getUserId()); - tx.commit(); - } catch (JBOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - if (list != null) { - body.put("flowlist", list); - ReturnMapUtil.setReturnMap(body, - ResultConstant.SUCCESS_RESULT_CODE, - UserManagerResultConstant.SUCCESS_RESULT_LOGIN_MSG); - return ReturnMapUtil.getReturnMap(); - } else { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - UserManagerResultConstant.FAIL_RESULT_LOGIN_FUND_FLOW); - return ReturnMapUtil.getReturnMap(); - } - } - - /** - * 返回当前时间 format:yyyy/MM/dd HH:mm:ss - * - * @return - */ - private static String getCurrentTime() { - return new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(Calendar - .getInstance().getTime()); - } - - // end - - @Override - public Map logon(HttpServletRequest request, - Transaction sqlca, @Context JBOTransaction tx) throws Exception { - return process(request, sqlca, tx); - } -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/service/impl/AppUserLogoutServiceImpl.java b/src_app/apx/com/amarsoft/als/user/logon/service/impl/AppUserLogoutServiceImpl.java deleted file mode 100644 index 77063e911..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/service/impl/AppUserLogoutServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -package apx.com.amarsoft.als.user.logon.service.impl; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import org.apache.commons.lang.StringUtils; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.service.FundTokenSessionInfoService; -import apx.com.amarsoft.als.base.service.impl.FundTokenSessionInfoServiceImpl; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.user.logon.constant.UserManagerResultConstant; -import apx.com.amarsoft.als.user.logon.service.AppUserLogoutService; -import cn.coyoteam.aweresf.consts.SessionConst; -import cn.coyoteam.aweresf.web.als.TokenSessionManagerFactory; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class AppUserLogoutServiceImpl implements AppUserLogoutService { - // 日志对象 - private static Log logger = ARE.getLog(); - FundTokenSessionInfoService tokenSessionService = new FundTokenSessionInfoServiceImpl(); - - @Override - public Map logout(HttpServletRequest request, - Transaction sqlca, @Context JBOTransaction tx) { - try { - Map map = tokenSessionService.fundSessionUser(request, sqlca); - ASUser CurARC = (ASUser) map.get("CurARC"); - if (CurARC != null) { - String sUserId = CurARC.getUserID(); - if (StringUtils.isNotBlank(sUserId)) { - TokenSessionManagerFactory.getALSTokenSessionManager(sqlca) - .dropTokenSession(sUserId); - request.getSession().setAttribute(SessionConst.KEY_TOKEN_SESSION, - null); - request.getSession().setAttribute(SessionConst.KEY_TOKEN, null); - request.getSession().setAttribute(SessionConst.KEY_CUR_ARC, null); - request.getSession().invalidate(); - } - ReturnMapUtil.setReturnMap(null, - ResultConstant.SUCCESS_RESULT_CODE, - UserManagerResultConstant.SUCCESS_RESULT_LOGOUT_MSG); - return ReturnMapUtil.getReturnMap(); - } - request.getSession().setAttribute(SessionConst.KEY_TOKEN_SESSION, - null); - request.getSession().setAttribute(SessionConst.KEY_TOKEN, null); - request.getSession().setAttribute(SessionConst.KEY_CUR_ARC, null); - request.getSession().invalidate(); - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - UserManagerResultConstant.FAIL_RESULT_LOGOUT_TOKEN_NULL_ERR_MSG); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - UserManagerResultConstant.FAIL_RESULT_LOGOUT_ERR_MSG); - } - return ReturnMapUtil.getReturnMap(); - } -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/service/impl/UserManagerServiceImpl.java b/src_app/apx/com/amarsoft/als/user/logon/service/impl/UserManagerServiceImpl.java deleted file mode 100644 index 00b0d6ad7..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/service/impl/UserManagerServiceImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -package apx.com.amarsoft.als.user.logon.service.impl; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.user.logon.constant.UserManagerResultConstant; -import apx.com.amarsoft.als.user.logon.service.AppUserLoginService; -import apx.com.amarsoft.als.user.logon.service.AppUserLogoutService; -import apx.com.amarsoft.als.user.logon.service.UserManagerService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -public class UserManagerServiceImpl implements UserManagerService { - - // 日志对象 - private static Log logger = ARE.getLog(); - // 登录服务 - private AppUserLoginService loginService = new AppUserLoginServiceImpl(); - // 登出服务 - private AppUserLogoutService logoutService = new AppUserLogoutServiceImpl(); - - @Override - public Map logon(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { -// if (ResultConstant.FAIL_RESULT_CODE.equals(ReturnMapUtil -// .getReturnMap().get("code"))) { -// logger.debug("UserManagerServiceImpl >> logon >. " -// + UserManagerResultConstant.FAIL_RESULT_LOGIOUT_ERR_2_MSG); -// ReturnMapUtil -// .setReturnMap( -// null, -// ResultConstant.FAIL_RESULT_CODE, -// UserManagerResultConstant.FAIL_RESULT_LOGIOUT_ERR_2_MSG); -// return ReturnMapUtil.getReturnMap(); -// } - return loginService.logon(request, sqlca, tx); - } catch (Exception e) { - logger.error("UserManagerServiceImpl >> logon >. " + e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - @Override - public Map logout(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return logoutService.logout(request, sqlca, tx); - } catch (Exception e) { - logger.error("UserManagerServiceImpl >> logout >. " + e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - -} diff --git a/src_app/apx/com/amarsoft/als/user/logon/util/ValidateRestfulParamUtil.java b/src_app/apx/com/amarsoft/als/user/logon/util/ValidateRestfulParamUtil.java deleted file mode 100644 index 1f9c62cde..000000000 --- a/src_app/apx/com/amarsoft/als/user/logon/util/ValidateRestfulParamUtil.java +++ /dev/null @@ -1,25 +0,0 @@ -package apx.com.amarsoft.als.user.logon.util; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; - -import apx.com.amarsoft.als.user.logon.constant.LoginManagerConstant; - -public class ValidateRestfulParamUtil { - public static boolean validateReqPara(HttpServletRequest request, - String apiType) { - switch (apiType) { - case LoginManagerConstant.APP_LOGIN_API: - if(StringUtils.isBlank(request.getParameter("un")) - || StringUtils.isBlank(request.getParameter("pwd")) - || StringUtils.isBlank(request.getParameter("dev_reg_id"))) { - return false; - } - break; - default: - break; - } - return true; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/als/FlowWorkManager.java b/src_app/apx/com/amarsoft/als/work/flow/als/FlowWorkManager.java deleted file mode 100644 index cf05d617c..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/als/FlowWorkManager.java +++ /dev/null @@ -1,36 +0,0 @@ -package apx.com.amarsoft.als.work.flow.als; - -import java.util.List; - -import apx.com.amarsoft.als.work.flow.mode.FlowAtt; -import apx.com.amarsoft.als.work.flow.mode.FlowOpinion; -import apx.com.amarsoft.als.work.flow.mode.FlowReader; -import apx.com.amarsoft.als.work.flow.mode.FlowTask; -import apx.com.amarsoft.als.work.flow.mode.FlowWork; - -public interface FlowWorkManager { - /** - * 查询代办列表 - */ - public List searchFlowWorkPending(String userid, String flowno); - - - - /** - * 意见 - */ - // 查询 - public List searchFlowOpinion(String objno, String objtype); - public List searchFlowOpinion(String objno, String objtype, String serialno); - /** - * 传阅 - */ - // 待传 - public List searchFlowReaderMatters(String userid); - - // task - public List searchFlowTask(String serialno); - - // - public List searchFlowAtts(); -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/als/SerialNoUtil.java b/src_app/apx/com/amarsoft/als/work/flow/als/SerialNoUtil.java deleted file mode 100644 index 488724a59..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/als/SerialNoUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -package apx.com.amarsoft.als.work.flow.als; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; - -public class SerialNoUtil { - // object_maxsn - public static BizObject searchSerialNo(String tablename, - String columnname, String datefmt, - String notfmt) { - try { - BizObjectManager bomcr = JBOFactory - .getBizObjectManager("jbo.awe.OBJECT_MAXSN"); - BizObject bocr = bomcr - .createQuery( - "SELECT o.MaxSerialNo FROM o WHERE o.TableName=:TableName " - + "and o.ColumnName=:ColumnName and o.DateFmt=:DateFmt and o.NoFmt=:NoFmt") - .setParameter("TableName", tablename) - .setParameter("ColumnName", columnname) - .setParameter("DateFmt", datefmt) - .setParameter("NoFmt", notfmt) - .getSingleResult(false); - return bocr; - } catch (JBOException e) { - return null; - } - } - - public static boolean updateSN(String ns, String tablename, - String columnname, String datefmt, - String notfmt) { - try { - BizObjectManager bomcr = JBOFactory - .getBizObjectManager("jbo.awe.OBJECT_MAXSN"); - int count = bomcr - .createQuery( - "update o set o.MaxSerialNo=:MaxSerialNo where o.TableName=:TableName" - + " and o.ColumnName=:ColumnName and o.DateFmt=:DateFmt and o.NoFmt=:NoFmt") - .setParameter("MaxSerialNo", ns) - .setParameter("TableName", tablename) - .setParameter("ColumnName", columnname) - .setParameter("DateFmt", datefmt) - .setParameter("NoFmt", notfmt).executeUpdate(); - if (count < 1) { - return false; - } - } catch (JBOException e) { - return false; - } - return true; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/als/factory/FlowWorkManagerFactory.java b/src_app/apx/com/amarsoft/als/work/flow/als/factory/FlowWorkManagerFactory.java deleted file mode 100644 index d1cea9c56..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/als/factory/FlowWorkManagerFactory.java +++ /dev/null @@ -1,52 +0,0 @@ -package apx.com.amarsoft.als.work.flow.als.factory; - -import apx.com.amarsoft.als.work.flow.als.FlowWorkManager; -import apx.com.amarsoft.als.work.flow.als.impl.AlsFlowAtt; -import apx.com.amarsoft.als.work.flow.als.impl.AlsFlowOpinion; -import apx.com.amarsoft.als.work.flow.als.impl.AlsFlowReader; -import apx.com.amarsoft.als.work.flow.als.impl.AlsFlowTask; -import apx.com.amarsoft.als.work.flow.als.impl.AlsFlowWorkManager; - -import com.amarsoft.awe.util.Transaction; - -public class FlowWorkManagerFactory { - public static FlowWorkManager getAlsFlowWorkManager(Transaction sqlca, - String sql) { - FlowWorkManager flowWorkManager = new AlsFlowWorkManager(); - ((AlsFlowWorkManager)flowWorkManager).setSqlca(sqlca); - ((AlsFlowWorkManager)flowWorkManager).setSql(sql); - return flowWorkManager; - } - - public static FlowWorkManager getAlsFlowOpinion(Transaction sqlca, - String sql) { - FlowWorkManager opinion = new AlsFlowOpinion(); - ((AlsFlowOpinion)opinion).setSqlca(sqlca); - ((AlsFlowOpinion)opinion).setSql(sql); - return opinion; - } - - public static FlowWorkManager getAlsFlowReader(Transaction sqlca, - String sql) { - FlowWorkManager reader = new AlsFlowReader(); - ((AlsFlowReader)reader).setSqlca(sqlca); - ((AlsFlowReader)reader).setSql(sql); - return reader; - } - - public static FlowWorkManager getAlsFlowTask(Transaction sqlca, - String sql) { - FlowWorkManager task = new AlsFlowTask(); - ((AlsFlowTask)task).setSqlca(sqlca); - ((AlsFlowTask)task).setSql(sql); - return task; - } - - public static FlowWorkManager getFlowAtts(Transaction sqlca, - String sql) { - FlowWorkManager att = new AlsFlowAtt(); - ((AlsFlowAtt)att).setSqlca(sqlca); - ((AlsFlowAtt)att).setSql(sql); - return att; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowAtt.java b/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowAtt.java deleted file mode 100644 index d8edcb2fa..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowAtt.java +++ /dev/null @@ -1,181 +0,0 @@ -package apx.com.amarsoft.als.work.flow.als.impl; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import apx.com.amarsoft.als.work.flow.als.FlowWorkManager; -import apx.com.amarsoft.als.work.flow.mode.FlowAtt; -import apx.com.amarsoft.als.work.flow.mode.FlowOpinion; -import apx.com.amarsoft.als.work.flow.mode.FlowReader; -import apx.com.amarsoft.als.work.flow.mode.FlowTask; -import apx.com.amarsoft.als.work.flow.mode.FlowWork; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; - -public class AlsFlowAtt implements FlowWorkManager { - private Transaction sqlca = null; - private String sql; - - public Transaction getSqlca() { - return sqlca; - } - - public void setSqlca(Transaction sqlca) { - this.sqlca = sqlca; - } - - public String getSql() { - return sql; - } - - public void setSql(String sql) { - this.sql = sql; - } - - - - private final String DOC_COLUMN_ATTACHMENTNO = "AttachmentNo"; - private final String DOC_COLUMN_FILENAME = "FileName"; - private final String DOC_COLUMN_CONTENTTYPE = "ContentType"; - private final String DOC_COLUMN_CONTENTLENGTH = "ContentLength"; - private final String DOC_COLUMN_BEGINTIME = "begintime"; - private final String DOC_COLUMN_INPUTUSER = "inputuser"; - private final String DOC_COLUMN_TASKNO = "taskno"; - private final String DOC_COLUMN_REMARK = "remark"; - private final String DOC_COLUMN_DOCNO = "DocNo"; - private final String DOC_COLUMN_DOCTYPE = "DOCTYPE"; - private final String DOC_COLUMN_TWO_CLASSIFY = "two_classify"; - private final String DOC_COLUMN_THREE_CLASSIFY = "three_classify"; - private final String DOC_COLUMN_DOCTITLE = "DocTitle"; - private final String DOC_COLUMN_DOCIMPORTANCE = "DocImportance"; - private final String DOC_COLUMN_ORGNAME = "OrgName"; - private final String DOC_COLUMN_USERID = "UserID"; - private final String DOC_COLUMN_USERNAME = "UserName"; - private final String DOC_COLUMN_INPUTTIME = "InputTime"; - private final String DOC_COLUMN_UPDATETIME = "UpdateTime"; - private final String DOC_COLUMN_OBJECTNO = "ObjectNo"; - private final String DOC_COLUMN_OBJECTTYPE = "ObjectType"; - private final String DOC_COLUMN_FILEPATH = "FILEPATH"; - - @Override - public List searchFlowAtts() { - ASResultSet rs = null; - List list = new ArrayList(); - try { - SqlObject sqlObject = new SqlObject(this.sql); - rs = sqlca.getResultSet(sqlObject); - while(rs.next()){ - FlowAtt att = new FlowAtt(); - if (fillFlowOpinionWithResultSet(att, rs)) { - att.setFlag(true); - list.add(att); - } else { - att.setFlag(false); - list.add(att); - } - } - } catch (SQLException e) { - ARE.getLog().error(e); - } catch (Exception e) { - ARE.getLog().error(e); - }finally{ - if(rs!=null){ - try { - rs.getStatement().close(); - rs = null; - } catch (SQLException e) { - ARE.getLog().error(e); - } - } - } - return list; - } - - public static void main(String[] args) { - String s = "2017/01/09/2017010900000004_2017010900000004_A融资租赁合同(设备回租).docx"; - System.out.println(s.substring(s.lastIndexOf("/")+1, s.length())); - } - - private boolean fillFlowOpinionWithResultSet(FlowAtt att, ASResultSet rs) throws SQLException{ - att.setAttachmentno(rs.getString(DOC_COLUMN_ATTACHMENTNO)); - att.setBegintime(rs.getString(DOC_COLUMN_BEGINTIME)); - att.setContentlength(rs.getString(DOC_COLUMN_CONTENTLENGTH)); - att.setContenttype(rs.getString(DOC_COLUMN_CONTENTTYPE)); - att.setDocimportance(rs.getString(DOC_COLUMN_DOCIMPORTANCE)); - att.setDocno(rs.getString(DOC_COLUMN_DOCNO)); - att.setDoctitle(rs.getString(DOC_COLUMN_DOCTITLE)); - att.setDoctype(rs.getString(DOC_COLUMN_DOCTYPE)); - att.setFilename(rs.getString(DOC_COLUMN_FILENAME)); - att.setInputtime(rs.getString(DOC_COLUMN_INPUTTIME)); - att.setInputuser(rs.getString(DOC_COLUMN_INPUTUSER)); - att.setObjectno(rs.getString(DOC_COLUMN_OBJECTNO)); - att.setObjecttype(rs.getString(DOC_COLUMN_OBJECTTYPE)); - att.setOrgname(rs.getString(DOC_COLUMN_ORGNAME)); - att.setRemark(rs.getString(DOC_COLUMN_REMARK)); - att.setTaskno(rs.getString(DOC_COLUMN_TASKNO)); - att.setThreeclassify(rs.getString(DOC_COLUMN_THREE_CLASSIFY)); - att.setTwoclassify(rs.getString(DOC_COLUMN_TWO_CLASSIFY)); - att.setUpdatetime(rs.getString(DOC_COLUMN_UPDATETIME)); - att.setUserid(rs.getString(DOC_COLUMN_USERID)); - att.setUsername(rs.getString(DOC_COLUMN_USERNAME)); - String path = rs.getString(DOC_COLUMN_FILEPATH); -// if (!(path == null) && !(path.equals(""))) { -// path = path.substring(path.lastIndexOf("/") + 1, path.length()); -// } - att.setFilepath(path); - // SELECT * FROM CODE_LIBRARY WHERE ITEMNO = - String sql = "SELECT o.ITEMNAME FROM o WHERE o.ITEMNO ='" + att.getDoctype() + "'"; - try { - BizObjectManager bomcr = JBOFactory - .getBizObjectManager("jbo.ui.codemap.CODE_LIBRARY"); - BizObject bocr = bomcr.createQuery(sql).getSingleResult(false); - if(bocr != null){ - att.setDoctypedisc(bocr.getAttribute("ITEMNAME") == null ? "" : bocr.getAttribute("ITEMNAME").toString()); - } else { - return false; - } - } catch (JBOException e) { - return false; - } - return true; - } - - @Override - public List searchFlowWorkPending(String userid, String flowno) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowOpinion(String objno, String objtype) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowReaderMatters(String userid) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowTask(String serialno) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowOpinion(String objno, String objtype, - String serialno) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowOpinion.java b/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowOpinion.java deleted file mode 100644 index 8a973ccc7..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowOpinion.java +++ /dev/null @@ -1,176 +0,0 @@ -package apx.com.amarsoft.als.work.flow.als.impl; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import apx.com.amarsoft.als.work.flow.als.FlowWorkManager; -import apx.com.amarsoft.als.work.flow.mode.FlowAtt; -import apx.com.amarsoft.als.work.flow.mode.FlowOpinion; -import apx.com.amarsoft.als.work.flow.mode.FlowReader; -import apx.com.amarsoft.als.work.flow.mode.FlowTask; -import apx.com.amarsoft.als.work.flow.mode.FlowWork; - -import com.amarsoft.are.ARE; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; - -public class AlsFlowOpinion implements FlowWorkManager { - -// private String TABLE_FLOW_OPINION = "flow_opinion"; -// private String TABLE_FLOW_TASK = "flow_task"; -// private String TABLE_FLOW_MODEL = "flow_model"; -// FM.Attribute3 AS OpinionRightType -// ,FM.Attribute4 AS OpinionRightPhases, -// FM.Attribute5 AS OpinionRightRoles - private String TASK_COLUMN_SERIAL_NO = "serialno"; - private String TASK_COLUMN_FLOW_NO = "FlowNO"; - private String TASK_COLUMN_PHASE_NAME = "PhaseName"; - private String TASK_COLUMN_PHASE_NO = "PhaseNo"; - private String TASK_COLUMN_USER_NAME = "UserName"; - private String TASK_COLUMN_ORG_NAME = "OrgName"; - private String TASK_COLUMN_PHASE_ACTION = "PhaseAction"; - private String TASK_COLUMN_BEGIN_TIME = "BeginTime"; - private String TASK_COLUMN_END_TIME = "EndTime"; - private String TASK_COLUMN_PHASE_CHOICE = "PhaseChoice"; - - private String OPINON_COLUMN_OPINION_NO = "OpinionNo"; - private String OPINON_COLUMN_PHASE_OPINION = "PhaseOpinion"; - private String OPINON_COLUMN_PHASE_OPINION1 = "PhaseOpinion1"; - private String OPINON_COLUMN_PHASE_OPINION2 = "PhaseOpinion2"; - private String OPINON_COLUMN_PHASE_OPINION3 = "PhaseOpinion3"; - - - private String MDODEL_COLUMN_ATTRIBUTE3 = "OpinionRightType"; - private String MDODEL_COLUMN_ATTRIBUTE4 = "OpinionRightPhases"; - private String MDODEL_COLUMN_ATTRIBUTE5 = "OpinionRightRoles"; - - private Transaction sqlca = null; - private String sql; - - public Transaction getSqlca() { - return sqlca; - } - - public void setSqlca(Transaction sqlca) { - this.sqlca = sqlca; - } - - public String getSql() { - return sql; - } - - public void setSql(String sql) { - this.sql = sql; - } - - @Override - public List searchFlowWorkPending(String userid, String flowno) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowOpinion(String objno, String objtype, - String serialno) { - ASResultSet rs = null; - List list = new ArrayList(); - try { - SqlObject sqlObject = new SqlObject(this.sql); - sqlObject.setParameter("ObjectNo", objno); - sqlObject.setParameter("ObjectType", objtype); - sqlObject.setParameter("SERIALNO", serialno); - rs = sqlca.getResultSet(sqlObject); - while(rs.next()){ - FlowOpinion opinion = new FlowOpinion(); - fillFlowOpinionWithResultSet(opinion, rs); - list.add(opinion); - } - } catch (SQLException e) { - ARE.getLog().error(e); - } catch (Exception e) { - ARE.getLog().error(e); - }finally{ - if(rs!=null){ - try { - rs.getStatement().close(); - rs = null; - } catch (SQLException e) { - ARE.getLog().error(e); - } - } - } - return list; - } - @Override - public List searchFlowOpinion(String objno, String objtype) { - ASResultSet rs = null; - List list = new ArrayList(); - try { - SqlObject sqlObject = new SqlObject(this.sql); - sqlObject.setParameter("ObjectNo", objno); - sqlObject.setParameter("ObjectType", objtype); - rs = sqlca.getResultSet(sqlObject); - while(rs.next()){ - FlowOpinion opinion = new FlowOpinion(); - fillFlowOpinionWithResultSet(opinion, rs); - list.add(opinion); - } - } catch (SQLException e) { - ARE.getLog().error(e); - } catch (Exception e) { - ARE.getLog().error(e); - }finally{ - if(rs!=null){ - try { - rs.getStatement().close(); - rs = null; - } catch (SQLException e) { - ARE.getLog().error(e); - } - } - } - return list; - } - - private void fillFlowOpinionWithResultSet(FlowOpinion opinion, ASResultSet rs) throws SQLException{ - opinion.setBeginTime(rs.getString(TASK_COLUMN_BEGIN_TIME)); - opinion.setEndTime(rs.getString(TASK_COLUMN_END_TIME)); - opinion.setFlowNo(rs.getString(TASK_COLUMN_FLOW_NO)); - opinion.setOpinionRightPhases(rs.getString(MDODEL_COLUMN_ATTRIBUTE4)); - opinion.setOpinionRightRoles(rs.getString(MDODEL_COLUMN_ATTRIBUTE5)); - opinion.setOpinionRightType(rs.getString(MDODEL_COLUMN_ATTRIBUTE3)); - opinion.setOrgName(rs.getString(TASK_COLUMN_ORG_NAME)); - opinion.setPhaseAction(rs.getString(TASK_COLUMN_PHASE_ACTION)); - opinion.setPhaseChoice(rs.getString(TASK_COLUMN_PHASE_CHOICE)); - opinion.setPhaseName(rs.getString(TASK_COLUMN_PHASE_NAME)); - opinion.setPhaseNo(rs.getString(TASK_COLUMN_PHASE_NO)); - opinion.setOpinionno(rs.getString(OPINON_COLUMN_OPINION_NO)); - opinion.setPhaseOpinion(rs.getString(OPINON_COLUMN_PHASE_OPINION)); - opinion.setPhaseOpinion1(rs.getString(OPINON_COLUMN_PHASE_OPINION1)); - opinion.setPhaseOpinion2(rs.getString(OPINON_COLUMN_PHASE_OPINION2)); - opinion.setPhaseOpinion3(rs.getString(OPINON_COLUMN_PHASE_OPINION3)); - opinion.setSerialno(rs.getString(TASK_COLUMN_SERIAL_NO)); - opinion.setUserName(rs.getString(TASK_COLUMN_USER_NAME)); - } - - @Override - public List searchFlowReaderMatters(String userid) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowTask(String serialno) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowAtts() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowReader.java b/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowReader.java deleted file mode 100644 index 3d44a194d..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowReader.java +++ /dev/null @@ -1,159 +0,0 @@ -package apx.com.amarsoft.als.work.flow.als.impl; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import apx.com.amarsoft.als.work.flow.als.FlowWorkManager; -import apx.com.amarsoft.als.work.flow.mode.FlowAtt; -import apx.com.amarsoft.als.work.flow.mode.FlowOpinion; -import apx.com.amarsoft.als.work.flow.mode.FlowReader; -import apx.com.amarsoft.als.work.flow.mode.FlowTask; -import apx.com.amarsoft.als.work.flow.mode.FlowWork; - -import com.amarsoft.are.ARE; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; - -public class AlsFlowReader implements FlowWorkManager{ - - private static final String COLUMN_SERIALNO = "SERIALNO"; - private static final String COLUMN_OBJECTNO = "OBJECTNO"; - private static final String COLUMN_OBJECTTYPE = "OBJECTTYPE"; - private static final String COLUMN_RELATIVESERIALNO = "RELATIVESERIALNO"; - private static final String COLUMN_FLOWNO = "FLOWNO"; - private static final String COLUMN_PHASENO = "PHASENO"; - private static final String COLUMN_PHASETYPE = "PHASETYPE"; - private static final String COLUMN_APPLYTYPE = "APPLYTYPE"; - private static final String COLUMN_USERID = "USERID"; - private static final String COLUMN_USERNAME = "USERNAME"; - private static final String COLUMN_ORGID = "ORGID"; - private static final String COLUMN_ORGNAME = "ORGNAME"; - private static final String COLUMN_ENDTIME = "ENDTIME"; - private static final String COLUMN_FLOWNAME = "FLOWNAME"; - private static final String COLUMN_PHASENAME = "PHASENAME"; - private static final String COLUMN_BEGINTIME = "BEGINTIME"; - private static final String COLUMN_FLOW_UNID = "FLOW_UNID"; - private static final String COLUMN_PROJ_ID = "PROJ_ID"; - private static final String COLUMN_CONTRACT_ID = "CONTRACT_ID"; - private static final String COLUMN_FLOW_KEY = "FLOW_KEY"; - private static final String COLUMN_PROJ_NAME = "PROJ_NAME"; - private static final String COLUMN_INPUTTIME = "INPUTTIME"; - private static final String COLUMN_READERID = "READERID"; - private static final String COLUMN_READER = "READER"; - private static final String COLUMN_PASSSTARTTIME = "PASSSTARTTIME"; - private static final String COLUMN_PASSENDTIME = "PASSENDTIME"; - private static final String COLUMN_ACTION = "ACTION"; - - private Transaction sqlca = null; - private String sql; - - public Transaction getSqlca() { - return sqlca; - } - - public void setSqlca(Transaction sqlca) { - this.sqlca = sqlca; - } - - public String getSql() { - return sql; - } - - public void setSql(String sql) { - this.sql = sql; - } - - @Override - public List searchFlowWorkPending(String userid, String flowno) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowOpinion(String objno, String objtype) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowReaderMatters(String userid) { - ASResultSet rs = null; - List list = new ArrayList(); - try { - SqlObject sqlObject = new SqlObject(this.sql); - sqlObject.setParameter("readers", userid); - rs = sqlca.getResultSet(sqlObject); - while(rs.next()){ - FlowReader reader = new FlowReader(); - fillFlowReaderWithResultSet(reader, rs); - list.add(reader); - } - } catch (SQLException e) { - ARE.getLog().error(e); - } catch (Exception e) { - ARE.getLog().error(e); - }finally{ - if(rs!=null){ - try { - rs.getStatement().close(); - rs = null; - } catch (SQLException e) { - ARE.getLog().error(e); - } - } - } - return list; - } - - private void fillFlowReaderWithResultSet(FlowReader reader, ASResultSet rs) throws SQLException{ - reader.setACTION(rs.getString(COLUMN_ACTION)); - reader.setAPPLYTYPE(rs.getString(COLUMN_APPLYTYPE)); - reader.setBEGINTIME(rs.getString(COLUMN_BEGINTIME)); - reader.setContract_id(rs.getString(COLUMN_CONTRACT_ID)); - reader.setENDTIME(rs.getString(COLUMN_ENDTIME)); - reader.setFlow_key(rs.getString(COLUMN_FLOW_KEY)); - reader.setFlow_unid(rs.getString(COLUMN_FLOW_UNID)); - reader.setFLOWNAME(rs.getString(COLUMN_FLOWNAME)); - reader.setFLOWNO(rs.getString(COLUMN_FLOWNO)); - reader.setInputTime(rs.getString(COLUMN_INPUTTIME)); - reader.setOBJECTNO(rs.getString(COLUMN_OBJECTNO)); - reader.setOBJECTTYPE(rs.getString(COLUMN_OBJECTTYPE)); - reader.setORGID(rs.getString(COLUMN_ORGID)); - reader.setORGNAME(rs.getString(COLUMN_ORGNAME)); - reader.setPassEndTime(rs.getString(COLUMN_PASSENDTIME)); - reader.setPassStartTime(rs.getString(COLUMN_PASSSTARTTIME)); - reader.setPHASENAME(rs.getString(COLUMN_PHASENAME)); - reader.setPHASENO(rs.getString(COLUMN_PHASENO)); - reader.setPHASETYPE(rs.getString(COLUMN_PHASETYPE)); - reader.setProj_id(rs.getString(COLUMN_PROJ_ID)); - reader.setProj_name(rs.getString(COLUMN_PROJ_NAME)); - reader.setReader(rs.getString(COLUMN_READER)); - reader.setReaderId(rs.getString(COLUMN_READERID)); - reader.setRELATIVESERIALNO(rs.getString(COLUMN_RELATIVESERIALNO)); - reader.setSERIALNO(rs.getString(COLUMN_SERIALNO)); - reader.setUSERID(rs.getString(COLUMN_USERID)); - reader.setUSERNAME(rs.getString(COLUMN_USERNAME)); -// reader.setAttribute1(rs.getString("ATTRIBUTE1")); - } - - @Override - public List searchFlowTask(String serialno) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowAtts() { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowOpinion(String objno, String objtype, - String serialno) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowTask.java b/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowTask.java deleted file mode 100644 index 66e07fdf3..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowTask.java +++ /dev/null @@ -1,174 +0,0 @@ -package apx.com.amarsoft.als.work.flow.als.impl; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import apx.com.amarsoft.als.work.flow.als.FlowWorkManager; -import apx.com.amarsoft.als.work.flow.mode.FlowAtt; -import apx.com.amarsoft.als.work.flow.mode.FlowOpinion; -import apx.com.amarsoft.als.work.flow.mode.FlowReader; -import apx.com.amarsoft.als.work.flow.mode.FlowTask; -import apx.com.amarsoft.als.work.flow.mode.FlowWork; - -import com.amarsoft.are.ARE; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; - -public class AlsFlowTask implements FlowWorkManager { - - private Transaction sqlca = null; - private String sql; - - public Transaction getSqlca() { - return sqlca; - } - - public void setSqlca(Transaction sqlca) { - this.sqlca = sqlca; - } - - public String getSql() { - return sql; - } - - public void setSql(String sql) { - this.sql = sql; - } -// -// private static final String TASK_COLUMN_AGENTORGNAME= "AGENTORGNAME"; -// private static final String TASK_COLUMN_AGENTORGID= "AGENTORGID"; -// private static final String TASK_COLUMN_AGENTUSERNAME= "AGENTUSERNAME"; -// private static final String TASK_COLUMN_AGENTUSERID= "AGENTUSERID"; -// private static final String TASK_COLUMN_RELANOTICENO= "RELANOTICENO"; -// private static final String TASK_COLUMN_ASSIGNEDTASKNO= "ASSIGNEDTASKNO"; -// private static final String TASK_COLUMN_PARENTFLOWNO= "PARENTFLOWNO"; -// private static final String TASK_COLUMN_ALLFORKNO= "ALLFORKNO"; -// private static final String TASK_COLUMN_FORKNO= "FORKNO"; -// private static final String TASK_COLUMN_TASKSTATE= "TASKSTATE"; -// private static final String TASK_COLUMN_BASEFLOWNO= "BASEFLOWNO"; -// private static final String TASK_COLUMN_VERSION= ""; -// private static final String TASK_COLUMN_FORKSTATE= ""; -// private static final String TASK_COLUMN_FLOWSTATE= ""; -// private static final String TASK_COLUMN_RELATIVEOBJECTNO= ""; -// private static final String TASK_COLUMN_PROCESSTASKNO= ""; -// private static final String TASK_COLUMN_PROCESSINSTNO= ""; -// private static final String TASK_COLUMN_GROUPINFO= ""; -// private static final String TASK_COLUMN_HEIGTH= ""; -// private static final String TASK_COLUMN_WIDTH= ""; -// private static final String TASK_COLUMN_CLIENTY= ""; -// private static final String TASK_COLUMN_CLIENTX= ""; -// private static final String TASK_COLUMN_COSTLOB= ""; -// private static final String TASK_COLUMN_STANDARDTIME2= ""; -// private static final String TASK_COLUMN_STANDARDTIME1= ""; -// private static final String TASK_COLUMN_RISKSCANRESULT= ""; -// private static final String TASK_COLUMN_AUTODECISION= ""; -// private static final String TASK_COLUMN_CHECKLISTRESULT= ""; -// private static final String TASK_COLUMN_PHASEOPINION4= ""; -// private static final String TASK_COLUMN_PHASEOPINION3= ""; -// private static final String TASK_COLUMN_PHASEOPINION2= ""; -// private static final String TASK_COLUMN_PHASEOPINION1= ""; -// private static final String TASK_COLUMN_PHASEOPINION= ""; -// private static final String TASK_COLUMN_PHASEACTION= ""; -// private static final String TASK_COLUMN_PHASECHOICE= ""; -// private static final String TASK_COLUMN_ENDTIME= ""; -// private static final String TASK_COLUMN_BEGINTIME= ""; -// private static final String TASK_COLUMN_ORGNAME= ""; -// private static final String TASK_COLUMN_ORGID= ""; -// private static final String TASK_COLUMN_USERNAME= ""; -// private static final String TASK_COLUMN_USERID= ""; -// private static final String TASK_COLUMN_APPLYTYPE= ""; -// private static final String TASK_COLUMN_PHASETYPE= ""; -// private static final String TASK_COLUMN_PHASENAME= ""; -// private static final String TASK_COLUMN_PHASENO= ""; -// private static final String TASK_COLUMN_FLOWNAME= ""; -// private static final String TASK_COLUMN_FLOWNO= ""; -// private static final String TASK_COLUMN_RELATIVESERIALNO= ""; -// private static final String TASK_COLUMN_OBJECTTYPE= ""; -// private static final String TASK_COLUMN_OBJECTNO= ""; -// private static final String TASK_COLUMN_SERIALNO= ""; -// - @Override - public List searchFlowWorkPending(String userid, String flowno) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowOpinion(String objno, String objtype) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowReaderMatters(String userid) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowTask(String serialno) { - ASResultSet rs = null; - List list = new ArrayList(); - try { - SqlObject sqlObject = new SqlObject(this.sql); - sqlObject.setParameter("SERIALNO", serialno); - rs = sqlca.getResultSet(sqlObject); - while(rs.next()){ - FlowTask task = new FlowTask(); - fillFlowTaskWithResultSet(task, rs); - list.add(task); - } - } catch (SQLException e) { - ARE.getLog().error(e); - } catch (Exception e) { - ARE.getLog().error(e); - }finally{ - if(rs!=null){ - try { - rs.getStatement().close(); - rs = null; - } catch (SQLException e) { - ARE.getLog().error(e); - } - } - } - return list; - } - - private void fillFlowTaskWithResultSet(FlowTask opinion, ASResultSet rs) throws SQLException{ -// opinion.setBeginTime(rs.getString(TASK_COLUMN_BEGIN_TIME)); -// opinion.setEndTime(rs.getString(TASK_COLUMN_END_TIME)); -// opinion.setFlowNo(rs.getString(TASK_COLUMN_FLOW_NO)); -// opinion.setOpinionRightPhases(rs.getString(MDODEL_COLUMN_ATTRIBUTE4)); -// opinion.setOpinionRightRoles(rs.getString(MDODEL_COLUMN_ATTRIBUTE5)); -// opinion.setOpinionRightType(rs.getString(MDODEL_COLUMN_ATTRIBUTE3)); -// opinion.setOrgName(rs.getString(TASK_COLUMN_ORG_NAME)); -// opinion.setPhaseAction(rs.getString(TASK_COLUMN_PHASE_ACTION)); -// opinion.setPhaseChoice(rs.getString(TASK_COLUMN_PHASE_CHOICE)); -// opinion.setPhaseName(rs.getString(TASK_COLUMN_PHASE_NAME)); -// opinion.setPhaseNo(rs.getString(TASK_COLUMN_PHASE_NO)); -// opinion.setOpinionno(rs.getString(OPINON_COLUMN_OPINION_NO)); -// opinion.setPhaseOpinion(rs.getString(OPINON_COLUMN_PHASE_OPINION)); -// opinion.setPhaseOpinion1(rs.getString(OPINON_COLUMN_PHASE_OPINION1)); -// opinion.setPhaseOpinion2(rs.getString(OPINON_COLUMN_PHASE_OPINION2)); -// opinion.setPhaseOpinion3(rs.getString(OPINON_COLUMN_PHASE_OPINION3)); -// opinion.setSerialno(rs.getString(TASK_COLUMN_SERIAL_NO)); -// opinion.setUserName(rs.getString(TASK_COLUMN_USER_NAME)); - } - - @Override - public List searchFlowAtts() { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowOpinion(String objno, String objtype, - String serialno) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowWorkManager.java b/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowWorkManager.java deleted file mode 100644 index 0dd7ba89d..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/als/impl/AlsFlowWorkManager.java +++ /dev/null @@ -1,135 +0,0 @@ -package apx.com.amarsoft.als.work.flow.als.impl; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import apx.com.amarsoft.als.work.flow.als.FlowWorkManager; -import apx.com.amarsoft.als.work.flow.mode.FlowAtt; -import apx.com.amarsoft.als.work.flow.mode.FlowOpinion; -import apx.com.amarsoft.als.work.flow.mode.FlowReader; -import apx.com.amarsoft.als.work.flow.mode.FlowTask; -import apx.com.amarsoft.als.work.flow.mode.FlowWork; - -import com.amarsoft.are.ARE; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; - - -public class AlsFlowWorkManager implements FlowWorkManager{ - - private static final String COLUMN_BEGIN_TIME = "begintime"; - private static final String COLUMN_FLOW_NAME = "flowname"; - private static final String COLUMN_PHASE_NAME = "phasename"; - private static final String COLUMN_PROJECT_NAME = "proj_name"; - private static final String COLUMN_ORJECT_NO = "objectno"; - private static final String COLUMN_ORJECT_TYPE = "objecttype"; - private static final String COLUMN_SERIAL_NO = "serialno"; - private static final String COLUMN_PHASE_TYPE = "phasetype"; - - private static final String COLUMN_FLOW_NO = "flowno"; - private static final String COLUMN_PHASE_NO = "phaseno"; - - private Transaction sqlca = null; - - private String sql; - - public Transaction getSqlca() { - return sqlca; - } - - public void setSqlca(Transaction sqlca) { - this.sqlca = sqlca; - } - - public String getSql() { - return sql; - } - - public void setSql(String sql) { - this.sql = sql; - } - - @Override - public List searchFlowWorkPending(String userid, String flowno) { - - ASResultSet rs = null; - List list = new ArrayList(); - try { - SqlObject sqlObject = new SqlObject(this.sql); - sqlObject.setParameter("userId", userid); - if (!flowno.equals("")) { - sqlObject.setParameter("flowno", flowno); - } - rs = sqlca.getResultSet(sqlObject); - while(rs.next()){ - FlowWork flowWork = new FlowWork(); - fillFlowWorkWithResultSet(flowWork, rs); - list.add(flowWork); - } - } catch (SQLException e) { - ARE.getLog().error(e); - } catch (Exception e) { - ARE.getLog().error(e); - }finally{ - if(rs!=null){ - try { - rs.getStatement().close(); - rs = null; - } catch (SQLException e) { - ARE.getLog().error(e); - } - } - } - return list; - } - - private void fillFlowWorkWithResultSet(FlowWork flowWork, ASResultSet rs) throws SQLException{ - flowWork.setBegintime(rs.getString(COLUMN_BEGIN_TIME)); - flowWork.setFlowname(rs.getString(COLUMN_FLOW_NAME)); - flowWork.setPhasename(rs.getString(COLUMN_PHASE_NAME)); - flowWork.setProjname(rs.getString(COLUMN_PROJECT_NAME)); - flowWork.setProjid(rs.getString("proj_id")); - flowWork.setObjectno(rs.getString(COLUMN_ORJECT_NO)); - flowWork.setObjecttype(rs.getString(COLUMN_ORJECT_TYPE)); - flowWork.setSerialno(rs.getString(COLUMN_SERIAL_NO)); - flowWork.setPhasetype(rs.getString(COLUMN_PHASE_TYPE)); - flowWork.setFlowno(rs.getString(COLUMN_FLOW_NO)); - flowWork.setPhaseno(rs.getString(COLUMN_PHASE_NO)); - flowWork.setAttribute1(rs.getString("ATTRIBUTE1")); - flowWork.setAttribute7(rs.getString("ATTRIBUTE7")); - flowWork.setOpinionSreQuired(rs.getString("OPINIONSREQUIRED")); - } - - @Override - public List searchFlowOpinion(String objno, String objtype) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowReaderMatters(String userid) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowTask(String serialno) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowAtts() { - // TODO Auto-generated method stub - return null; - } - - @Override - public List searchFlowOpinion(String objno, String objtype, - String serialno) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/business/AutoriskScan.java b/src_app/apx/com/amarsoft/als/work/flow/business/AutoriskScan.java deleted file mode 100644 index 2902d0d19..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/business/AutoriskScan.java +++ /dev/null @@ -1,169 +0,0 @@ -package apx.com.amarsoft.als.work.flow.business; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.StringUtils; - -import com.amarsoft.app.alarm.AlarmMessage; -import com.amarsoft.app.alarm.CheckItem; -import com.amarsoft.app.alarm.DefaultCheckItemRunner; -import com.amarsoft.app.alarm.DefaultScenarioContextLoader; -import com.amarsoft.app.alarm.ItemGroup; -import com.amarsoft.app.alarm.ScenarioContext; -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; -import com.tenwa.alarm.AlarmScenarioFactory; -import com.tenwa.flow.warning.Warning; - -public class AutoriskScan { - private static Log logger = ARE.getLog(); - - private String sFlowName; - private String sTaskNo; - private String sObjectType; - private String sObjectNo; - private String sFlowNo; - private String sPhaseNo; - - public AutoriskScan() { - this.sFlowName = ""; - this.sFlowNo = ""; - this.sObjectNo = ""; - this.sObjectType = ""; - this.sPhaseNo = ""; - this.sTaskNo = ""; - } - - public void init(String flowName, String flowNo, String objectNo, - String objectType, String phaseNo, String taskNo) { - this.sFlowName = flowName; - this.sFlowNo = flowNo; - this.sObjectNo = objectNo; - this.sObjectType = objectType; - this.sPhaseNo = phaseNo; - this.sTaskNo = taskNo; - } - - public String getsFlowName() { - return sFlowName; - } - public String getsTaskNo() { - return sTaskNo; - } - public String getsObjectType() { - return sObjectType; - } - public String getsObjectNo() { - return sObjectNo; - } - public String getsFlowNo() { - return sFlowNo; - } - public String getsPhaseNo() { - return sPhaseNo; - } - public void setsFlowName(String sFlowName) { - this.sFlowName = sFlowName; - } - public void setsTaskNo(String sTaskNo) { - this.sTaskNo = sTaskNo; - } - public void setsObjectType(String sObjectType) { - this.sObjectType = sObjectType; - } - public void setsObjectNo(String sObjectNo) { - this.sObjectNo = sObjectNo; - } - public void setsFlowNo(String sFlowNo) { - this.sFlowNo = sFlowNo; - } - public void setsPhaseNo(String sPhaseNo) { - this.sPhaseNo = sPhaseNo; - } - /** - * 流程提交风险预警检测 - * @param scanRiskMap. (message, code) - * @param tx JBOTransaction. - * @param Sqlca Sqlca. - * @return boolean true:通过, false:未通过. - * @throws Exception 出现异常未通过. - */ - public boolean authen(Map scanRiskMap, JBOTransaction tx, Transaction Sqlca) throws Exception { - logger.info(this.sFlowName + ":风险预警检测"); - String bizArgs = "TaskNo=" + this.sTaskNo + ",ObjectType=" + this.sObjectType + ",ObjectNo=" + this.sObjectNo - + ",FlowNo=" + this.sFlowNo + ",PhaseNo=" + this.sPhaseNo + ",isAutoCommit=true"; - String scenarioID = this.sFlowName; - String subTypeNo = this.sPhaseNo; - if (StringUtils.isBlank(bizArgs)){ - scanRiskMap.put("message", "风险探测,需要业务数据,请传入业务数据参数!"); - scanRiskMap.put("code", "-100"); - logger.info("风险探测,需要业务数据,请传入业务数据参数!"); - return false; - } - if (StringUtils.isBlank(scenarioID)) { - scanRiskMap.put("message", "风险探测,需要场景号,请传入场景号参数!"); - scanRiskMap.put("code", "-100"); - logger.info("风险探测,需要场景号,请传入场景号参数!"); - return false; - } - if (StringUtils.isBlank(subTypeNo)) { - subTypeNo = ""; - } - Warning warning = new Warning(); - warning.setScenarioid(scenarioID); - warning.setSubTypeNo(subTypeNo); - String scanRisk = warning.selectByScenarioid(tx); - if (scanRisk.equals("failed")) { - scanRiskMap.put("message", "无需检测风险预警!"); - scanRiskMap.put("code", "200"); - logger.info("无需检测风险预警!"); - return true; - } - logger.info(bizArgs); - logger.info("传入业务参数:" + bizArgs); - - DefaultScenarioContextLoader loader= AlarmScenarioFactory.createScenarioContextLoader(bizArgs); - loader.init(Sqlca,scenarioID,bizArgs,subTypeNo); - ScenarioContext context = loader.getContext(); //获取下文容器 - context.setCheckItemRunner(new DefaultCheckItemRunner()); //模型运行器 - - List gList0 = context.getScenario().getGroupList(); - //根据运行条件进行预处理,分组下检查项检查条件均没通过,则不显示该分组 - for(int i=0; i ckList0 = group.getCheckItemList(); - for(int j=0; j" + this.sFlowName); - this.sObjectType = ft.getAttribute("objecttype") == null ? "" : ft - .getAttribute("objecttype").toString().trim(); - logger.info("流程类型>" + this.sObjectType); - this.sObjectNo = ft.getAttribute("objectno") == null ? "" : ft - .getAttribute("objectno").toString().trim(); - logger.info("流程类型号>" + this.sObjectNo); - this.sFlowNo = ft.getAttribute("flowno") == null ? "" : ft - .getAttribute("flowno").toString().trim(); - logger.info("流程号>" + this.sFlowNo); - this.sPhaseNo = ft.getAttribute("phaseno") == null ? "" : ft - .getAttribute("phaseno").toString().trim(); - logger.info("节点号>" + this.sPhaseNo); - this.sUserId = ft.getAttribute("userid") == null ? "" : ft - .getAttribute("userid").toString().trim(); - logger.info("用户ID>" + this.sUserId); - checkUtil = new FlowSubmitCheckUtil(); - tx.commit(); - this.checkUtil - .init(this.sFlowName, this.sFlowNo, this.sObjectNo, - this.sObjectType, this.sPhaseNo, this.sTaskNo, - this.sUserId); - } catch (Exception e) { - logger.error("error>{}", e); - throw new Exception("FlowWorkBackStepBusiness >>> FlowWorkBackStepBusiness() >> error > " + e); - } - } - - public void backstepBeforeProess(Map scanRiskMap, - JBOTransaction tx, Transaction Sqlca) throws Exception { - - } - public void backStep(Map scanRiskMap, - JBOTransaction tx, Transaction Sqlca, String backType) throws Exception { - switch (backType) { - case "last": - backStep(scanRiskMap, tx, Sqlca); - break; - case "any": - backStep(scanRiskMap, tx, Sqlca); - break; - default: - break; - } - } - public void backStep(Map scanRiskMap, - JBOTransaction tx, Transaction Sqlca) throws Exception { - FlowAction action = new FlowAction(); - action.setTaskNo(this.sTaskNo); - try { - String backStepRs = action.backStep(tx); - if (backStepRs.equals("success")) { - scanRiskMap.put("message", "退回完成!"); - scanRiskMap.put("code", "200"); - logger.info("退回完成!"); - return; - } else { - scanRiskMap.put("message", "退回失败!"); - scanRiskMap.put("code", "500"); - logger.info("退回失败!"); - return; - } - } catch (Exception e) { - scanRiskMap.put("message", "退回出现异常!"); - scanRiskMap.put("code", "-100"); - logger.error("error>{}", e); - throw new Exception("FlowWorkBackStepBusiness >>> backstep() >> error > " + e); - } - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/business/FlowWorkSubmitBusiness.java b/src_app/apx/com/amarsoft/als/work/flow/business/FlowWorkSubmitBusiness.java deleted file mode 100644 index 7cc2535a6..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/business/FlowWorkSubmitBusiness.java +++ /dev/null @@ -1,235 +0,0 @@ -package apx.com.amarsoft.als.work.flow.business; - -import java.util.HashMap; -import java.util.Map; - -import jbo.sys.FLOW_TASK; -import apx.com.amarsoft.als.base.util.JsonUtil; -import apx.com.amarsoft.als.work.flow.util.FlowSubmitCheckUtil; - -import com.amarsoft.app.flow.FlowAction; -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.json.JSONException; -import com.amarsoft.awe.util.Transaction; -import com.tenwa.flow.task.TenwaFlowTask; - -public class FlowWorkSubmitBusiness { - private static Log logger = ARE.getLog(); - - private String sFlowName; - private String sTaskNo; - private String sObjectType; - private String sObjectNo; - private String sFlowNo; - private String sPhaseNo; - private String sUserId; - private FlowSubmitCheckUtil checkUtil; - - public FlowWorkSubmitBusiness(String sTaskNo) throws Exception { - try { - JBOTransaction tx = JBOFactory.getFactory().createTransaction(); - logger.info("初始化..."); - this.sTaskNo = sTaskNo; - logger.info("流程实例号" + this.sTaskNo); - BizObjectManager ftManager = JBOFactory.getBizObjectManager( - FLOW_TASK.CLASS_NAME, tx); - BizObject ft = ftManager - .createQuery( - "SELECT O.flowname,O.serialno,O.objecttype,O.objectno,O.flowno,O.phaseno,O.userid " - + "FROM O WHERE 1=1 AND O.serialno=:scenarioid") - .setParameter("scenarioid", this.sTaskNo) - .getSingleResult(false); - this.sFlowName = ft.getAttribute("flowname") == null ? "" : ft - .getAttribute("flowname").toString().trim(); - logger.info("流程名>" + this.sFlowName); - this.sObjectType = ft.getAttribute("objecttype") == null ? "" : ft - .getAttribute("objecttype").toString().trim(); - logger.info("流程类型>" + this.sObjectType); - this.sObjectNo = ft.getAttribute("objectno") == null ? "" : ft - .getAttribute("objectno").toString().trim(); - logger.info("流程类型号>" + this.sObjectNo); - this.sFlowNo = ft.getAttribute("flowno") == null ? "" : ft - .getAttribute("flowno").toString().trim(); - logger.info("流程号>" + this.sFlowNo); - this.sPhaseNo = ft.getAttribute("phaseno") == null ? "" : ft - .getAttribute("phaseno").toString().trim(); - logger.info("节点号>" + this.sPhaseNo); - this.sUserId = ft.getAttribute("userid") == null ? "" : ft - .getAttribute("userid").toString().trim(); - logger.info("用户ID>" + this.sUserId); - checkUtil = new FlowSubmitCheckUtil(); - tx.commit(); - this.checkUtil - .init(this.sFlowName, this.sFlowNo, this.sObjectNo, - this.sObjectType, this.sPhaseNo, this.sTaskNo, - this.sUserId); - } catch (Exception e) { - logger.error("error>{}", e); - throw new Exception( - "FlowWorkSubmitBusiness >>> FlowWorkSubmitBusiness() >> error > " - + e); - } - } - - /** - * 提交之前业务. - * - * @param scanRiskMap - * . - * @throws Exception - */ - public void submitBeforeProess(Map scanRiskMap, - JBOTransaction tx, Transaction Sqlca) throws Exception { - try { - // 根据objectType,objectNo从FLOW_TASK中查找最新的phaseNo,用于申请页面提交时检查申请记录是否已提交 - if (!this.checkUtil.checkNewPhaseNo(tx)) { - scanRiskMap.put("message", "该申请已经提交了,不能再次提交!"); - scanRiskMap.put("code", "-100"); - logger.info("该申请已经提交了,不能再次提交!"); - return; - } - // 根据ObjectType, ObjectNo, FlowNo, PhaseNo, UserID获取flow_task流水号 - if (!this.checkUtil.checkTaskIsExists(tx)) { - scanRiskMap.put("message", "该申请所对应的流程任务不存在,请核对!"); - scanRiskMap.put("code", "-100"); - logger.info("该申请所对应的流程任务不存在,请核对!"); - return; - } - // FlowNo, PhaseNo获取OPINIONS_REQUIRED 检查是否签署意见: Y - // 根据taskNo检查是否已经签署意见 yes-有意见; no-无意见; true false - if (!this.checkUtil.checkIsOpitionsRequire(tx)) { - scanRiskMap.put("message", "该业务未签署意见,不能提交,请先签署意见!"); - scanRiskMap.put("code", "-100"); - logger.info("该业务未签署意见,不能提交,请先签署意见!"); - return; - } - - AutoriskScan scan = new AutoriskScan(); - scan.init(this.sFlowName, this.sFlowNo, this.sObjectNo, - this.sObjectType, this.sPhaseNo, this.sTaskNo); - // 风险预警 - if (scan.authen(scanRiskMap, tx, Sqlca)) { // 检测通过 - // 获取路由 - TenwaFlowTask ft = new TenwaFlowTask(this.sTaskNo, tx);// 使用jboTrans - try { - String routeInfo = ft.getRouteInfo(); - - String flowNo = ft.FlowNo; - String phaseNo = ft.PhaseNo; - String flowState = ft.FlowState; - - Map data = new HashMap(); - data.put("flowno", flowNo); - data.put("phaseno", phaseNo); - data.put("flowstate", flowState); - data.put("routeinfo", JsonUtil.str2Map(routeInfo)); - scanRiskMap.put("message", data); - scanRiskMap.put("code", "200"); - logger.info(routeInfo); - - return; - } catch (Exception e) { - scanRiskMap.put("message", "获取路由人出现异常!"); - scanRiskMap.put("code", "-100"); - logger.error("error>{}", e); - throw new Exception( - "FlowWorkSubmitBusiness >>> submitBeforeProess() >> error > " - + e); - } - } else { - return; - } - } catch (Exception e) { - scanRiskMap.put("message", "提交前检查出现异常!"); - scanRiskMap.put("code", "-100"); - logger.error("error>{}", e); - throw new Exception( - "FlowWorkSubmitBusiness >>> submitBeforeProess() >> error > " - + e); - } - } - - /** - * 提交 - * - * @param scanRiskMap - * @param tx - * @param Sqlca - * @throws Exception - * @throws JSONException - */ - public void submitProess(Map scanRiskMap, - JBOTransaction tx, Transaction Sqlca, String phaseOpinion, - String phaseAction, String readUserIds, String curUserId) - throws Exception { - try { - if (!this.checkUtil.checkIsCommited(tx)) { - scanRiskMap.put("message", "此流程任务已提交!!"); - scanRiskMap.put("code", "-100"); - logger.info("此流程任务已提交!!"); - return; - } - - FlowAction action = new FlowAction(); - action.setTaskNo(this.sTaskNo); - action.setPhaseOpinion(phaseOpinion); - action.setPhaseAction(phaseAction); - action.setReadUserIds(readUserIds); - action.setUserID(curUserId); - String submitRs = action.submit(tx); - if (submitRs.equals("success")) { - scanRiskMap.put("message", "提交完成!"); - scanRiskMap.put("code", "200"); - logger.info("提交完成!"); - return; - } else { - scanRiskMap.put("message", "提交失败!"); - scanRiskMap.put("code", "500"); - logger.info("提交失败!"); - return; - } - } catch (Exception e) { - logger.error("error>{}", e); - throw new Exception( - "FlowWorkSubmitBusiness >>> submitBeforeProess() >> error > " - + e); - } - } - - public void submitAfterProess() { - - } - - public String getsFlowName() { - return sFlowName; - } - - public String getsTaskNo() { - return sTaskNo; - } - - public String getsObjectType() { - return sObjectType; - } - - public String getsObjectNo() { - return sObjectNo; - } - - public String getsFlowNo() { - return sFlowNo; - } - - public String getsPhaseNo() { - return sPhaseNo; - } - - public String getsUserId() { - return sUserId; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/bzsrv/FlowManageController.java b/src_app/apx/com/amarsoft/als/work/flow/bzsrv/FlowManageController.java deleted file mode 100644 index 7c37e224f..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/bzsrv/FlowManageController.java +++ /dev/null @@ -1,157 +0,0 @@ -package apx.com.amarsoft.als.work.flow.bzsrv; - -import java.io.IOException; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import apx.com.amarsoft.als.work.flow.service.FlowManageService; -import apx.com.amarsoft.als.work.flow.service.impl.FlowManageServiceImpl; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -@Path("/flow/work/manager") -public class FlowManageController { - private static Log logger = ARE.getLog(); - FlowManageService service = new FlowManageServiceImpl(); - - // begin /flow/manager 14 - @Path("/all/list") - @GET - public Map allListPending( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) { - logger.info("进入接口通道: 流程工作代办管理 >> app获取用户所有代办接口"); - return service.allListPending(request, sqlca, tx); - } - - @Path("/param/acquisition/val") - @GET - public Map getParamVal(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) { - logger.info("进入接口通道: 流程管理通用 >> 获取合同id接口"); - return service.getParamVal(request, sqlca, tx); - } - - @Path("/currency/acquisition/group") - @GET - public Map acquisitionGroupInfo( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) { - logger.info("进入接口通道: 流程管理通用 >> 业务分组信息接口"); - return service.acquisitionGroupInfo(request, sqlca, tx); - } - - @Path("/currency/acquisition/opinion") - @GET - public Map acquisitionOpinion( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) { - logger.info("进入接口通道: 流程管理通用 >> 获取意见接口"); - return service.acquisitionOpinion(request, sqlca, tx); - } - - @Path("/currency/remove/self/opinion") - @GET - public Map removeSelfOpinion( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) { - logger.info("进入接口通道: 流程管理通用 >> 删除签署接口"); - return service.removeSelfOpinion(request, sqlca, tx); - } - - @Path("/currency/submit/opinion") - @POST - public Map opinionSubmit( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws IOException { - logger.info("进入接口通道: 流程管理通用 >> 提交意见接口"); - return service.opinionSubmit(request, sqlca, tx); - } - - @Path("/currency/already") - @GET - public Map already(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) { - logger.info("进入接口通道: 流程管理通用 >> 已办列表查询接口"); - return service.already(request, sqlca, tx); - } - - @Path("/attachments/acquisition/list") - @GET - public Map searchFlowAtt( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 流程管理通用 >> 查询附件列表接口"); - return service.searchFlowAtt(request, sqlca, tx); - } - - @Path("/attachments/init/check") - @GET - public Map initAttTypeCheckBox( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception { - logger.info("进入接口通道: 流程管理通用 >> 加载上传选择框"); - return service.initAttTypeCheckBox(request, sqlca, tx); - } - - @Path("/attachments/upload/atts") - @POST - public Map uploadFlowAtt( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) { - logger.info("进入接口通道: 流程管理通用 >> 上传资料接口"); - return service.uploadFlowAtt(request, sqlca, tx); - } - - @Path("/process/submit/before/proess") - @GET - public Map submitBefore( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction jboTx) { - logger.info("进入接口通道: 流程管理提交 >> 检测预警接口"); - return service.submitBefore(request, sqlca, jboTx); - } - - @Path("/process/submit") - @POST - public Map submit(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction jboTx) { - logger.info("进入接口通道: 流程管理提交 >> 本节点提交接口"); - return service.submit(request, sqlca, jboTx); - } - - @Path("/process/back") - @GET - public Map backStep(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction jboTx) { - logger.info("进入接口通道: 流程管理提交 >> 本节点退回接口"); - return service.backStep(request, sqlca, jboTx); - } - - @Path("/process/back/get/return/point") - @GET - public Map getBackReturnPoint( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction jboTx) { - logger.info("进入接口通道: 流程管理提交 >> 获取可退回节点信息"); - return service.getBackReturnPoint(request, sqlca, jboTx); - } - - @Path("/process/back2") - @GET - public Map backStepReturnTask( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction jboTx) { - logger.info("进入接口通道: 流程管理提交 >> 退回选择节点接口"); - return service.backStepReturnTask(request, sqlca, jboTx); - } - // end -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/bzsrv/FlowWorkCurrencyController.java b/src_app/apx/com/amarsoft/als/work/flow/bzsrv/FlowWorkCurrencyController.java deleted file mode 100644 index 1ac468582..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/bzsrv/FlowWorkCurrencyController.java +++ /dev/null @@ -1,76 +0,0 @@ -package apx.com.amarsoft.als.work.flow.bzsrv; - -import javax.ws.rs.Path; - - -@Path("/flow/work/manager/currency") -public class FlowWorkCurrencyController { -// private static Log logger = ARE.getLog(); -// -// private FlowWorkCurrencyService service = new FlowWorkCurrencyServiceImpl(); -// private FlowWorkBusinessDetailsService businessDetailsService = new BusinessDetailsServiceImpl(); -// @Path("/acquisition/opinion") -// @GET -// public Map acquisitionOpinion(@Context HttpServletRequest request, @Context Transaction sqlca) { -// logger.info("进入接口通道: 流程管理通用 >> 获取意见接口"); -// return service.acquisitionOpinion(request, sqlca); -// } -// -// @Path("/submit/opinion") -// @POST -// public Map opinionSubmit(@Context HttpServletRequest request, @Context Transaction sqlca) throws IOException { -// logger.info("进入接口通道: 流程管理通用 >> 提交意见接口"); -// return service .opinionSubmit(request, sqlca); -// } - -// @Path("/already1") -// @GET -// public Map already(@Context HttpServletRequest request, @Context Transaction sqlca) { -// logger.info("进入接口通道: 流程管理通用 >> 已办列表查询接口"); -// return service .already (request, sqlca); -// } -// -// -// @Path("/demo") -// @GET -// public Map demo(@Context HttpServletRequest request, @Context Transaction sqlca) { -// logger.info("进入接口通道: 流程管理通用 >> demo接口"); -// String flowNo = request.getParameter("flowno"); -// String flowPhaseID=flowNo+"_default"; -// List> mapList = new ArrayList>(); -// Map body = new HashMap(); -// try { -// List workFlowPhaseClassList=WorkFlowHisPhaseInfoManager.getWorkFlowPhaseClassList(flowPhaseID); -// for (WorkFlowPhaseClass c : workFlowPhaseClassList) { -// Map map = Bean2MapUtil.beanToMap(c); -// mapList.add(map); -// } -// } catch (Exception e) { -// return null; -// } -// body.put("data", mapList); -// ReturnMapUtil.setReturnMap(body, "SUCCESS", "SUCCESS"); -// return ReturnMapUtil.getReturnMap(); -// } - -// @Path("/business/detail") -// @GET -// public Map searchDetail(@Context HttpServletRequest request, @Context Transaction sqlca) { -// logger.info("进入接口通道: 流程管理通用 >> 业务详情获取数据接口"); -// return businessDetailsService.searchBusinessDetails(request, sqlca); // service.searchDetail(request, sqlca); -// } - -// @Path("/acquisition/group") -// @GET -// public Map acquisitionGroupInfo(@Context HttpServletRequest request, @Context Transaction sqlca) { -// logger.info("进入接口通道: 流程管理通用 >> 业务分组信息接口"); -// return businessDetailsService.acquisitionGroupInfo(request, sqlca); // service.searchDetail(request, sqlca); -// } -// -// @Path("/init/display/for/add") -// @GET -// public Map initDisplayForAdd(@Context HttpServletRequest request, @Context Transaction sqlca) { -// logger.info("进入接口通道: 流程管理通用 >> 加载汇总评审委员意见信息接口"); -// return service.initDisplayForAdd(request, sqlca); -// } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/constant/ResultConstant.java b/src_app/apx/com/amarsoft/als/work/flow/constant/ResultConstant.java deleted file mode 100644 index 140f47bad..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/constant/ResultConstant.java +++ /dev/null @@ -1,20 +0,0 @@ -package apx.com.amarsoft.als.work.flow.constant; - -public class ResultConstant { - public static final String SUCCESS_RESULT_PENDING_ALL_MSG = "获取代办列表成功!"; - public static final String SUCCESS_RESULT_ALREADY_ALL_MSG = "获取已办列表成功!"; - public static final String SUCCESS_RESULT_ATT_MSG = "获取附件成功!"; - public static final String SUCCESS_RESULT_TYPE_MSG = "获取附件类型成功!"; - public static final String SUCCESS_RESULT_OPINION_MSG = "获取意见成功!"; - public static final String SUCCESS_RESULT_READER_MSG = "获取传阅成功!"; - public static final String SUCCESS_RESULT_SUBMIT_MSG = "提交成功!"; - public static final String SUCCESS_RESULT_UPLOAD_MSG = "上传成功!"; - public static final String SUCCESS_RESULT_DOWNLOAD_MSG = "下载成功!"; - public static final String FAIL_RESULT_PARAM_LACK = "重要参数缺少!"; - public static final String FAIL_RESULT_PAGE_INDEX = "你输入的页码有误,请重新输入!"; - public static final String FAIL_RESULT_SUBMIT_MSG = "提交失败!"; - public static final String FAIL_RESULT_TYPE_MSG = "获取附件类型失败!"; - public static final String FAIL_RESULT_GENER_SN_LOSS = "SERIAL_NO生成失败!"; - public static final String FAIL_RESULT_UPLOAD_MSG = "上传失败!"; - public static final String FAIL_RESULT_DOWNLOAD_MSG = "下载失败!"; -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/mode/AppBusinessGroup.java b/src_app/apx/com/amarsoft/als/work/flow/mode/AppBusinessGroup.java deleted file mode 100644 index 6bfdfdbb1..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/mode/AppBusinessGroup.java +++ /dev/null @@ -1,173 +0,0 @@ -package apx.com.amarsoft.als.work.flow.mode; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang.StringUtils; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; - -public class AppBusinessGroup { - - private static Log logger = ARE.getLog(); - - private String groupcode; - private String groupname; - private String flowno; - private String phaseno; - private String islist; - private String groupposition; -// private List appBusTemps; - private boolean flag = false; - - public void clear() { - this.groupcode = null; - this.groupname = null; - this.flowno = null; - this.phaseno = null; - this.islist = null; - this.groupposition = null; -// this.appBusTemps = null; - this.flag = false; - } - - public List getAppBusinessGroup(Transaction sqlca, String sql) { - List groups = new ArrayList(); - if (StringUtils.isBlank(sql)) { - sql += "SELECT "; - sql += " o.GROUP_CODE, o.GROUP_NAME, o.FLOWNO, o.PHASENO, o.ISLIST, o.GROUP_POSITION "; - sql += "FROM "; - sql += " APP_BUSINESS_GROUP o "; - sql += "WHERE "; - sql += " 1=1 "; -// sql += " AND o.FLOWNO=:FLOWNO "; -// sql += " AND o.PHASENO=:PHASENO "; - sql += "ORDER BY "; - sql += " o.GROUP_POSITION"; - } -// this.appBusTemps = new ArrayList(); - ASResultSet rs = null; - try { - SqlObject sqlObject = new SqlObject(sql)/*.setParameter("FLOWNO", this.flowno).setParameter("PHASENO", this.getPhaseno())*/; - rs = sqlca.getResultSet(sqlObject); - if (rs == null) return null; - while (rs.next()) { - String fArrStr = rs.getString("FLOWNO") == null ? "" : rs.getString("FLOWNO").toString().trim(); - for (String str : fArrStr.split(",")) { - str = str.trim(); - if (str.equals(this.flowno)) { - String pArrStr = rs.getString("PHASENO") == null ? "" : rs.getString("PHASENO").toString().trim(); - if (!pArrStr.equalsIgnoreCase("all")) { - for (String str1 : pArrStr.split(",")) { - if (str1.equals(this.phaseno)) { - AppBusinessGroup group = new AppBusinessGroup(); - group.setGroupcode(rs.getString("GROUP_CODE") - == null ? null : rs.getString("GROUP_CODE")); - group.setGroupname(rs.getString("GROUP_NAME") - == null ? null : rs.getString("GROUP_NAME")); - group.setFlowno(rs.getString("FLOWNO") - == null ? null : rs.getString("FLOWNO")); - group.setPhaseno(rs.getString("PHASENO") - == null ? null : rs.getString("PHASENO")); - group.setIslist(rs.getString("ISLIST") - == null ? null : rs.getString("ISLIST")); - if (rs.getString("ISLIST") != null - && rs.getString("ISLIST").equalsIgnoreCase("Y")) { - group.setIslist("Y"); - } else { - group.setIslist("N"); - } - group.setGroupposition(rs.getString("GROUP_POSITION") - == null ? null : rs.getString("GROUP_POSITION")); - group.setFlag(true); -// group.setAppBusTemps(appBusTemps); - groups.add(group); - } - } - } else { - AppBusinessGroup group = new AppBusinessGroup(); - group.setGroupcode(rs.getString("GROUP_CODE") - == null ? null : rs.getString("GROUP_CODE")); - group.setGroupname(rs.getString("GROUP_NAME") - == null ? null : rs.getString("GROUP_NAME")); - group.setFlowno(rs.getString("FLOWNO") - == null ? null : rs.getString("FLOWNO")); - group.setPhaseno(rs.getString("PHASENO") - == null ? null : rs.getString("PHASENO")); - group.setIslist(rs.getString("ISLIST") - == null ? null : rs.getString("ISLIST")); - if (rs.getString("ISLIST") != null - && rs.getString("ISLIST").equalsIgnoreCase("Y")) { - group.setIslist("Y"); - } else { - group.setIslist("N"); - } - group.setGroupposition(rs.getString("GROUP_POSITION") - == null ? null : rs.getString("GROUP_POSITION")); - group.setFlag(true); -// group.setAppBusTemps(appBusTemps); - groups.add(group); - } - break; - } - } - } - } catch (Exception e) { - logger.error("query app business group config error :" + e); - return null; - } - return groups; - } - public String getGroupcode() { - return groupcode; - } - public String getGroupname() { - return groupname; - } - public String getFlowno() { - return flowno; - } - public String getPhaseno() { - return phaseno; - } - public String getIslist() { - return islist; - } - public String getGroupposition() { - return groupposition; - } - public void setGroupcode(String groupcode) { - this.groupcode = groupcode; - } - public void setGroupname(String groupname) { - this.groupname = groupname; - } - public void setFlowno(String flowno) { - this.flowno = flowno; - } - public void setPhaseno(String phaseno) { - this.phaseno = phaseno; - } - public void setIslist(String islist) { - this.islist = islist; - } - public void setGroupposition(String groupposition) { - this.groupposition = groupposition; - } -// public List getAppBusTemps() { -// return appBusTemps; -// } -// public void setAppBusTemps(List appBusTemps) { -// this.appBusTemps = appBusTemps; -// } - public boolean isFlag() { - return flag; - } - public void setFlag(boolean flag) { - this.flag = flag; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/mode/AppBusinessTemp.java b/src_app/apx/com/amarsoft/als/work/flow/mode/AppBusinessTemp.java deleted file mode 100644 index 200562ffc..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/mode/AppBusinessTemp.java +++ /dev/null @@ -1,60 +0,0 @@ -package apx.com.amarsoft.als.work.flow.mode; - -public class AppBusinessTemp { - private String groupcode; - private String dono; - private String sortno; - private String dataname; - private String datacode; - private String islist; - private String isshow; - private String dataposition; - public String getGroupcode() { - return groupcode; - } - public String getDono() { - return dono; - } - public String getSortno() { - return sortno; - } - public String getDataname() { - return dataname; - } - public String getDatacode() { - return datacode; - } - public String getIslist() { - return islist; - } - public String getIsshow() { - return isshow; - } - public String getDataposition() { - return dataposition; - } - public void setGroupcode(String groupcode) { - this.groupcode = groupcode; - } - public void setDono(String dono) { - this.dono = dono; - } - public void setSortno(String sortno) { - this.sortno = sortno; - } - public void setDataname(String dataname) { - this.dataname = dataname; - } - public void setDatacode(String datacode) { - this.datacode = datacode; - } - public void setIslist(String islist) { - this.islist = islist; - } - public void setIsshow(String isshow) { - this.isshow = isshow; - } - public void setDataposition(String dataposition) { - this.dataposition = dataposition; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/mode/AppDetailDisplay.java b/src_app/apx/com/amarsoft/als/work/flow/mode/AppDetailDisplay.java deleted file mode 100644 index 4ca7e4e10..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/mode/AppDetailDisplay.java +++ /dev/null @@ -1,74 +0,0 @@ -package apx.com.amarsoft.als.work.flow.mode; - -public class AppDetailDisplay { - private String sortno; - private String islist; - private String isshow; - private String istitle; - private String colactualname; - private String colheader; - private String colname; - private String colcolumntype; - private String coltablename; - private String value; - public String getSortno() { - return sortno; - } - public String getIslist() { - return islist; - } - public String getIsshow() { - return isshow; - } - public String getIstitle() { - return istitle; - } - public void setSortno(String sortno) { - this.sortno = sortno; - } - public void setIslist(String islist) { - this.islist = islist; - } - public void setIsshow(String isshow) { - this.isshow = isshow; - } - public void setIstitle(String istitle) { - this.istitle = istitle; - } - public String getColactualname() { - return colactualname; - } - public String getColheader() { - return colheader; - } - public String getColname() { - return colname; - } - public void setColactualname(String colactualname) { - this.colactualname = colactualname; - } - public void setColheader(String colheader) { - this.colheader = colheader; - } - public void setColname(String colname) { - this.colname = colname; - } - public String getColcolumntype() { - return colcolumntype; - } - public String getColtablename() { - return coltablename; - } - public void setColcolumntype(String colcolumntype) { - this.colcolumntype = colcolumntype; - } - public void setColtablename(String coltablename) { - this.coltablename = coltablename; - } - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/mode/FlowAtt.java b/src_app/apx/com/amarsoft/als/work/flow/mode/FlowAtt.java deleted file mode 100644 index bbdc7aa47..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/mode/FlowAtt.java +++ /dev/null @@ -1,172 +0,0 @@ -package apx.com.amarsoft.als.work.flow.mode; - -public class FlowAtt { - private String attachmentno; - private String filename; - private String contenttype; - private String contentlength; - private String begintime; - private String inputuser; - private String taskno; - private String remark; - private String docno; - private String doctype; - private String twoclassify; - private String threeclassify; - private String doctitle; - private String docimportance; - private String orgname; - private String userid; - private String username; - private String inputtime; - private String updatetime; - private String objectno; - private String objecttype; - private String doctypedisc; - private String filepath; - private boolean flag; - public String getAttachmentno() { - return attachmentno; - } - public String getFilename() { - return filename; - } - public String getContenttype() { - return contenttype; - } - public String getContentlength() { - return contentlength; - } - public String getBegintime() { - return begintime; - } - public String getInputuser() { - return inputuser; - } - public String getTaskno() { - return taskno; - } - public String getRemark() { - return remark; - } - public String getDocno() { - return docno; - } - public String getDoctype() { - return doctype; - } - public String getTwoclassify() { - return twoclassify; - } - public String getThreeclassify() { - return threeclassify; - } - public String getDoctitle() { - return doctitle; - } - public String getDocimportance() { - return docimportance; - } - public String getOrgname() { - return orgname; - } - public String getUserid() { - return userid; - } - public String getUsername() { - return username; - } - public String getInputtime() { - return inputtime; - } - public String getUpdatetime() { - return updatetime; - } - public String getObjectno() { - return objectno; - } - public String getObjecttype() { - return objecttype; - } - public String getDoctypedisc() { - return doctypedisc; - } - public String getFilepath() { - return filepath; - } - public boolean isFlag() { - return flag; - } - public void setAttachmentno(String attachmentno) { - this.attachmentno = attachmentno; - } - public void setFilename(String filename) { - this.filename = filename; - } - public void setContenttype(String contenttype) { - this.contenttype = contenttype; - } - public void setContentlength(String contentlength) { - this.contentlength = contentlength; - } - public void setBegintime(String begintime) { - this.begintime = begintime; - } - public void setInputuser(String inputuser) { - this.inputuser = inputuser; - } - public void setTaskno(String taskno) { - this.taskno = taskno; - } - public void setRemark(String remark) { - this.remark = remark; - } - public void setDocno(String docno) { - this.docno = docno; - } - public void setDoctype(String doctype) { - this.doctype = doctype; - } - public void setTwoclassify(String twoclassify) { - this.twoclassify = twoclassify; - } - public void setThreeclassify(String threeclassify) { - this.threeclassify = threeclassify; - } - public void setDoctitle(String doctitle) { - this.doctitle = doctitle; - } - public void setDocimportance(String docimportance) { - this.docimportance = docimportance; - } - public void setOrgname(String orgname) { - this.orgname = orgname; - } - public void setUserid(String userid) { - this.userid = userid; - } - public void setUsername(String username) { - this.username = username; - } - public void setInputtime(String inputtime) { - this.inputtime = inputtime; - } - public void setUpdatetime(String updatetime) { - this.updatetime = updatetime; - } - public void setObjectno(String objectno) { - this.objectno = objectno; - } - public void setObjecttype(String objecttype) { - this.objecttype = objecttype; - } - public void setDoctypedisc(String doctypedisc) { - this.doctypedisc = doctypedisc; - } - public void setFilepath(String filepath) { - this.filepath = filepath; - } - public void setFlag(boolean flag) { - this.flag = flag; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/mode/FlowOpinion.java b/src_app/apx/com/amarsoft/als/work/flow/mode/FlowOpinion.java deleted file mode 100644 index e98063551..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/mode/FlowOpinion.java +++ /dev/null @@ -1,148 +0,0 @@ -package apx.com.amarsoft.als.work.flow.mode; - -public class FlowOpinion { - // table column - // task serial no 编号NO - private String serialno; - private String opinionno; - // task flow no 流程NO - private String flowNo; - // task phase no 节点NO - private String phaseNo; - // task phase name 节点名 - private String phaseName; - // task user name 用户名 - private String userName; - // task org name 所属机构名 - private String orgName; - // task phase action 节点行动 - private String phaseAction; - // task begin time 开始时间 - private String beginTime; - // task end time 结束时间 - private String endTime; - // task phase choice 节点选择 - private String phaseChoice; - // flow_opinion phase opinion 节点意见 - private String phaseOpinion; - // flow_opinion phase opinion1 节点意见扩展1 - private String phaseOpinion1; - // flow_opinion phase opinion2 节点意见扩展2 - private String phaseOpinion2; - // flow_opinion phase opinion3 节点意见扩展3 - private String phaseOpinion3; - // flow_model Attribute3 意见类型 - private String opinionRightType; - // flow_model Attribute4 意见节点 - private String opinionRightPhases; - // flow_model Attribute5 意见角色 - private String opinionRightRoles; - public String getSerialno() { - return serialno; - } - public String getFlowNo() { - return flowNo; - } - public String getPhaseNo() { - return phaseNo; - } - public String getPhaseName() { - return phaseName; - } - public String getUserName() { - return userName; - } - public String getOrgName() { - return orgName; - } - public String getPhaseAction() { - return phaseAction; - } - public String getBeginTime() { - return beginTime; - } - public String getEndTime() { - return endTime; - } - public String getPhaseChoice() { - return phaseChoice; - } - public String getPhaseOpinion() { - return phaseOpinion; - } - public String getPhaseOpinion1() { - return phaseOpinion1; - } - public String getPhaseOpinion2() { - return phaseOpinion2; - } - public String getPhaseOpinion3() { - return phaseOpinion3; - } - public String getOpinionRightType() { - return opinionRightType; - } - public String getOpinionRightPhases() { - return opinionRightPhases; - } - public String getOpinionRightRoles() { - return opinionRightRoles; - } - public void setSerialno(String serialno) { - this.serialno = serialno; - } - public void setFlowNo(String flowNo) { - this.flowNo = flowNo; - } - public void setPhaseNo(String phaseNo) { - this.phaseNo = phaseNo; - } - public void setPhaseName(String phaseName) { - this.phaseName = phaseName; - } - public void setUserName(String userName) { - this.userName = userName; - } - public void setOrgName(String orgName) { - this.orgName = orgName; - } - public void setPhaseAction(String phaseAction) { - this.phaseAction = phaseAction; - } - public void setBeginTime(String beginTime) { - this.beginTime = beginTime; - } - public void setEndTime(String endTime) { - this.endTime = endTime; - } - public void setPhaseChoice(String phaseChoice) { - this.phaseChoice = phaseChoice; - } - public void setPhaseOpinion(String phaseOpinion) { - this.phaseOpinion = phaseOpinion; - } - public void setPhaseOpinion1(String phaseOpinion1) { - this.phaseOpinion1 = phaseOpinion1; - } - public void setPhaseOpinion2(String phaseOpinion2) { - this.phaseOpinion2 = phaseOpinion2; - } - public void setPhaseOpinion3(String phaseOpinion3) { - this.phaseOpinion3 = phaseOpinion3; - } - public void setOpinionRightType(String opinionRightType) { - this.opinionRightType = opinionRightType; - } - public void setOpinionRightPhases(String opinionRightPhases) { - this.opinionRightPhases = opinionRightPhases; - } - public void setOpinionRightRoles(String opinionRightRoles) { - this.opinionRightRoles = opinionRightRoles; - } - public String getOpinionno() { - return opinionno; - } - public void setOpinionno(String opinionno) { - this.opinionno = opinionno; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/mode/FlowReader.java b/src_app/apx/com/amarsoft/als/work/flow/mode/FlowReader.java deleted file mode 100644 index 4cf75dcca..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/mode/FlowReader.java +++ /dev/null @@ -1,202 +0,0 @@ -package apx.com.amarsoft.als.work.flow.mode; - -public class FlowReader { - private String SERIALNO; - private String OBJECTNO; - private String OBJECTTYPE; - private String RELATIVESERIALNO; - private String FLOWNO; - private String PHASENO; - private String PHASETYPE; - private String APPLYTYPE; - private String USERID; - private String USERNAME; - private String ORGID; - private String ORGNAME; - private String ENDTIME; - private String FLOWNAME; - private String PHASENAME; - private String BEGINTIME; - - private String flow_unid; - private String proj_id; - private String contract_id; - private String flow_key; - private String proj_name; - private String InputTime; - - private String readerId; - private String reader; - private String passStartTime; - private String passEndTime; - private String ACTION; - private String attribute1; - public String getSERIALNO() { - return SERIALNO; - } - public String getOBJECTNO() { - return OBJECTNO; - } - public String getOBJECTTYPE() { - return OBJECTTYPE; - } - public String getRELATIVESERIALNO() { - return RELATIVESERIALNO; - } - public String getFLOWNO() { - return FLOWNO; - } - public String getPHASENO() { - return PHASENO; - } - public String getPHASETYPE() { - return PHASETYPE; - } - public String getAPPLYTYPE() { - return APPLYTYPE; - } - public String getUSERID() { - return USERID; - } - public String getUSERNAME() { - return USERNAME; - } - public String getORGID() { - return ORGID; - } - public String getORGNAME() { - return ORGNAME; - } - public String getENDTIME() { - return ENDTIME; - } - public String getFLOWNAME() { - return FLOWNAME; - } - public String getPHASENAME() { - return PHASENAME; - } - public String getBEGINTIME() { - return BEGINTIME; - } - public String getFlow_unid() { - return flow_unid; - } - public String getProj_id() { - return proj_id; - } - public String getContract_id() { - return contract_id; - } - public String getFlow_key() { - return flow_key; - } - public String getProj_name() { - return proj_name; - } - public String getInputTime() { - return InputTime; - } - public String getReaderId() { - return readerId; - } - public String getReader() { - return reader; - } - public String getPassStartTime() { - return passStartTime; - } - public String getPassEndTime() { - return passEndTime; - } - public String getACTION() { - return ACTION; - } - public void setSERIALNO(String sERIALNO) { - SERIALNO = sERIALNO; - } - public void setOBJECTNO(String oBJECTNO) { - OBJECTNO = oBJECTNO; - } - public void setOBJECTTYPE(String oBJECTTYPE) { - OBJECTTYPE = oBJECTTYPE; - } - public void setRELATIVESERIALNO(String rELATIVESERIALNO) { - RELATIVESERIALNO = rELATIVESERIALNO; - } - public void setFLOWNO(String fLOWNO) { - FLOWNO = fLOWNO; - } - public void setPHASENO(String pHASENO) { - PHASENO = pHASENO; - } - public void setPHASETYPE(String pHASETYPE) { - PHASETYPE = pHASETYPE; - } - public void setAPPLYTYPE(String aPPLYTYPE) { - APPLYTYPE = aPPLYTYPE; - } - public void setUSERID(String uSERID) { - USERID = uSERID; - } - public void setUSERNAME(String uSERNAME) { - USERNAME = uSERNAME; - } - public void setORGID(String oRGID) { - ORGID = oRGID; - } - public void setORGNAME(String oRGNAME) { - ORGNAME = oRGNAME; - } - public void setENDTIME(String eNDTIME) { - ENDTIME = eNDTIME; - } - public void setFLOWNAME(String fLOWNAME) { - FLOWNAME = fLOWNAME; - } - public void setPHASENAME(String pHASENAME) { - PHASENAME = pHASENAME; - } - public void setBEGINTIME(String bEGINTIME) { - BEGINTIME = bEGINTIME; - } - public void setFlow_unid(String flow_unid) { - this.flow_unid = flow_unid; - } - public void setProj_id(String proj_id) { - this.proj_id = proj_id; - } - public void setContract_id(String contract_id) { - this.contract_id = contract_id; - } - public void setFlow_key(String flow_key) { - this.flow_key = flow_key; - } - public void setProj_name(String proj_name) { - this.proj_name = proj_name; - } - public void setInputTime(String inputTime) { - InputTime = inputTime; - } - public void setReaderId(String readerId) { - this.readerId = readerId; - } - public void setReader(String reader) { - this.reader = reader; - } - public void setPassStartTime(String passStartTime) { - this.passStartTime = passStartTime; - } - public void setPassEndTime(String passEndTime) { - this.passEndTime = passEndTime; - } - public void setACTION(String aCTION) { - ACTION = aCTION; - } - public String getAttribute1() { - return attribute1; - } - public void setAttribute1(String attribute1) { - this.attribute1 = attribute1; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/mode/FlowTask.java b/src_app/apx/com/amarsoft/als/work/flow/mode/FlowTask.java deleted file mode 100644 index 3932a06f5..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/mode/FlowTask.java +++ /dev/null @@ -1,361 +0,0 @@ -package apx.com.amarsoft.als.work.flow.mode; - -public class FlowTask { - private String AGENTORGNAME; - private String AGENTORGID; - private String AGENTUSERNAME; - private String AGENTUSERID; - private String RELANOTICENO; - private String ASSIGNEDTASKNO; - private String PARENTFLOWNO; - private String ALLFORKNO; - private String FORKNO; - private String TASKSTATE; - private String BASEFLOWNO; - private String VERSION; - private String FORKSTATE; - private String FLOWSTATE; - private String RELATIVEOBJECTNO; - private String PROCESSTASKNO; - private String PROCESSINSTNO; - private String GROUPINFO; - private String HEIGTH; - private String WIDTH; - private String CLIENTY; - private String CLIENTX; - private String COSTLOB; - private String STANDARDTIME2; - private String STANDARDTIME1; - private String RISKSCANRESULT; - private String AUTODECISION; - private String CHECKLISTRESULT; - private String PHASEOPINION4; - private String PHASEOPINION3; - private String PHASEOPINION2; - private String PHASEOPINION1; - private String PHASEOPINION; - private String PHASEACTION; - private String PHASECHOICE; - private String ENDTIME; - private String BEGINTIME; - private String ORGNAME; - private String ORGID; - private String USERNAME; - private String USERID; - private String APPLYTYPE; - private String PHASETYPE; - private String PHASENAME; - private String PHASENO; - private String FLOWNAME; - private String FLOWNO; - private String RELATIVESERIALNO; - private String OBJECTTYPE; - private String OBJECTNO; - private String SERIALNO; - public String getAGENTORGNAME() { - return AGENTORGNAME; - } - public String getAGENTORGID() { - return AGENTORGID; - } - public String getAGENTUSERNAME() { - return AGENTUSERNAME; - } - public String getAGENTUSERID() { - return AGENTUSERID; - } - public String getRELANOTICENO() { - return RELANOTICENO; - } - public String getASSIGNEDTASKNO() { - return ASSIGNEDTASKNO; - } - public String getPARENTFLOWNO() { - return PARENTFLOWNO; - } - public String getALLFORKNO() { - return ALLFORKNO; - } - public String getFORKNO() { - return FORKNO; - } - public String getTASKSTATE() { - return TASKSTATE; - } - public String getBASEFLOWNO() { - return BASEFLOWNO; - } - public String getVERSION() { - return VERSION; - } - public String getFORKSTATE() { - return FORKSTATE; - } - public String getFLOWSTATE() { - return FLOWSTATE; - } - public String getRELATIVEOBJECTNO() { - return RELATIVEOBJECTNO; - } - public String getPROCESSTASKNO() { - return PROCESSTASKNO; - } - public String getPROCESSINSTNO() { - return PROCESSINSTNO; - } - public String getGROUPINFO() { - return GROUPINFO; - } - public String getHEIGTH() { - return HEIGTH; - } - public String getWIDTH() { - return WIDTH; - } - public String getCLIENTY() { - return CLIENTY; - } - public String getCLIENTX() { - return CLIENTX; - } - public String getCOSTLOB() { - return COSTLOB; - } - public String getSTANDARDTIME2() { - return STANDARDTIME2; - } - public String getSTANDARDTIME1() { - return STANDARDTIME1; - } - public String getRISKSCANRESULT() { - return RISKSCANRESULT; - } - public String getAUTODECISION() { - return AUTODECISION; - } - public String getCHECKLISTRESULT() { - return CHECKLISTRESULT; - } - public String getPHASEOPINION4() { - return PHASEOPINION4; - } - public String getPHASEOPINION3() { - return PHASEOPINION3; - } - public String getPHASEOPINION2() { - return PHASEOPINION2; - } - public String getPHASEOPINION1() { - return PHASEOPINION1; - } - public String getPHASEOPINION() { - return PHASEOPINION; - } - public String getPHASEACTION() { - return PHASEACTION; - } - public String getPHASECHOICE() { - return PHASECHOICE; - } - public String getENDTIME() { - return ENDTIME; - } - public String getBEGINTIME() { - return BEGINTIME; - } - public String getORGNAME() { - return ORGNAME; - } - public String getORGID() { - return ORGID; - } - public String getUSERNAME() { - return USERNAME; - } - public String getUSERID() { - return USERID; - } - public String getAPPLYTYPE() { - return APPLYTYPE; - } - public String getPHASETYPE() { - return PHASETYPE; - } - public String getPHASENAME() { - return PHASENAME; - } - public String getPHASENO() { - return PHASENO; - } - public String getFLOWNAME() { - return FLOWNAME; - } - public String getFLOWNO() { - return FLOWNO; - } - public String getRELATIVESERIALNO() { - return RELATIVESERIALNO; - } - public String getOBJECTTYPE() { - return OBJECTTYPE; - } - public String getOBJECTNO() { - return OBJECTNO; - } - public String getSERIALNO() { - return SERIALNO; - } - public void setAGENTORGNAME(String aGENTORGNAME) { - AGENTORGNAME = aGENTORGNAME; - } - public void setAGENTORGID(String aGENTORGID) { - AGENTORGID = aGENTORGID; - } - public void setAGENTUSERNAME(String aGENTUSERNAME) { - AGENTUSERNAME = aGENTUSERNAME; - } - public void setAGENTUSERID(String aGENTUSERID) { - AGENTUSERID = aGENTUSERID; - } - public void setRELANOTICENO(String rELANOTICENO) { - RELANOTICENO = rELANOTICENO; - } - public void setASSIGNEDTASKNO(String aSSIGNEDTASKNO) { - ASSIGNEDTASKNO = aSSIGNEDTASKNO; - } - public void setPARENTFLOWNO(String pARENTFLOWNO) { - PARENTFLOWNO = pARENTFLOWNO; - } - public void setALLFORKNO(String aLLFORKNO) { - ALLFORKNO = aLLFORKNO; - } - public void setFORKNO(String fORKNO) { - FORKNO = fORKNO; - } - public void setTASKSTATE(String tASKSTATE) { - TASKSTATE = tASKSTATE; - } - public void setBASEFLOWNO(String bASEFLOWNO) { - BASEFLOWNO = bASEFLOWNO; - } - public void setVERSION(String vERSION) { - VERSION = vERSION; - } - public void setFORKSTATE(String fORKSTATE) { - FORKSTATE = fORKSTATE; - } - public void setFLOWSTATE(String fLOWSTATE) { - FLOWSTATE = fLOWSTATE; - } - public void setRELATIVEOBJECTNO(String rELATIVEOBJECTNO) { - RELATIVEOBJECTNO = rELATIVEOBJECTNO; - } - public void setPROCESSTASKNO(String pROCESSTASKNO) { - PROCESSTASKNO = pROCESSTASKNO; - } - public void setPROCESSINSTNO(String pROCESSINSTNO) { - PROCESSINSTNO = pROCESSINSTNO; - } - public void setGROUPINFO(String gROUPINFO) { - GROUPINFO = gROUPINFO; - } - public void setHEIGTH(String hEIGTH) { - HEIGTH = hEIGTH; - } - public void setWIDTH(String wIDTH) { - WIDTH = wIDTH; - } - public void setCLIENTY(String cLIENTY) { - CLIENTY = cLIENTY; - } - public void setCLIENTX(String cLIENTX) { - CLIENTX = cLIENTX; - } - public void setCOSTLOB(String cOSTLOB) { - COSTLOB = cOSTLOB; - } - public void setSTANDARDTIME2(String sTANDARDTIME2) { - STANDARDTIME2 = sTANDARDTIME2; - } - public void setSTANDARDTIME1(String sTANDARDTIME1) { - STANDARDTIME1 = sTANDARDTIME1; - } - public void setRISKSCANRESULT(String rISKSCANRESULT) { - RISKSCANRESULT = rISKSCANRESULT; - } - public void setAUTODECISION(String aUTODECISION) { - AUTODECISION = aUTODECISION; - } - public void setCHECKLISTRESULT(String cHECKLISTRESULT) { - CHECKLISTRESULT = cHECKLISTRESULT; - } - public void setPHASEOPINION4(String pHASEOPINION4) { - PHASEOPINION4 = pHASEOPINION4; - } - public void setPHASEOPINION3(String pHASEOPINION3) { - PHASEOPINION3 = pHASEOPINION3; - } - public void setPHASEOPINION2(String pHASEOPINION2) { - PHASEOPINION2 = pHASEOPINION2; - } - public void setPHASEOPINION1(String pHASEOPINION1) { - PHASEOPINION1 = pHASEOPINION1; - } - public void setPHASEOPINION(String pHASEOPINION) { - PHASEOPINION = pHASEOPINION; - } - public void setPHASEACTION(String pHASEACTION) { - PHASEACTION = pHASEACTION; - } - public void setPHASECHOICE(String pHASECHOICE) { - PHASECHOICE = pHASECHOICE; - } - public void setENDTIME(String eNDTIME) { - ENDTIME = eNDTIME; - } - public void setBEGINTIME(String bEGINTIME) { - BEGINTIME = bEGINTIME; - } - public void setORGNAME(String oRGNAME) { - ORGNAME = oRGNAME; - } - public void setORGID(String oRGID) { - ORGID = oRGID; - } - public void setUSERNAME(String uSERNAME) { - USERNAME = uSERNAME; - } - public void setUSERID(String uSERID) { - USERID = uSERID; - } - public void setAPPLYTYPE(String aPPLYTYPE) { - APPLYTYPE = aPPLYTYPE; - } - public void setPHASETYPE(String pHASETYPE) { - PHASETYPE = pHASETYPE; - } - public void setPHASENAME(String pHASENAME) { - PHASENAME = pHASENAME; - } - public void setPHASENO(String pHASENO) { - PHASENO = pHASENO; - } - public void setFLOWNAME(String fLOWNAME) { - FLOWNAME = fLOWNAME; - } - public void setFLOWNO(String fLOWNO) { - FLOWNO = fLOWNO; - } - public void setRELATIVESERIALNO(String rELATIVESERIALNO) { - RELATIVESERIALNO = rELATIVESERIALNO; - } - public void setOBJECTTYPE(String oBJECTTYPE) { - OBJECTTYPE = oBJECTTYPE; - } - public void setOBJECTNO(String oBJECTNO) { - OBJECTNO = oBJECTNO; - } - public void setSERIALNO(String sERIALNO) { - SERIALNO = sERIALNO; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/mode/FlowWork.java b/src_app/apx/com/amarsoft/als/work/flow/mode/FlowWork.java deleted file mode 100644 index 646f5c149..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/mode/FlowWork.java +++ /dev/null @@ -1,103 +0,0 @@ -package apx.com.amarsoft.als.work.flow.mode; - -public class FlowWork { - private String begintime; - private String flowname; - private String phasename; - private String projname; - private String objectno; - private String objecttype; - private String serialno; - private String phasetype; - private String flowno; - private String phaseno; - private String attribute1; - private String attribute7; - private String projid; - private String opinionSreQuired; - - public String getBegintime() { - return begintime; - } - public String getFlowname() { - return flowname; - } - public String getPhasename() { - return phasename; - } - public String getProjname() { - return projname; - } - public void setBegintime(String begintime) { - this.begintime = begintime; - } - public void setFlowname(String flowname) { - this.flowname = flowname; - } - public void setPhasename(String phasename) { - this.phasename = phasename; - } - public void setProjname(String projname) { - this.projname = projname; - } - public String getObjectno() { - return objectno; - } - public String getObjecttype() { - return objecttype; - } - public String getSerialno() { - return serialno; - } - public String getPhasetype() { - return phasetype; - } - public void setObjectno(String objectno) { - this.objectno = objectno; - } - public void setObjecttype(String objecttype) { - this.objecttype = objecttype; - } - public void setSerialno(String serialno) { - this.serialno = serialno; - } - public void setPhasetype(String phasetype) { - this.phasetype = phasetype; - } - public String getFlowno() { - return flowno; - } - public void setFlowno(String flowno) { - this.flowno = flowno; - } - public String getPhaseno() { - return phaseno; - } - public void setPhaseno(String phaseno) { - this.phaseno = phaseno; - } - public String getAttribute1() { - return attribute1; - } - public void setAttribute1(String attribute1) { - this.attribute1 = attribute1; - } - public String getProjid() { - return projid; - } - public void setProjid(String projid) { - this.projid = projid; - } - public String getAttribute7() { - return attribute7; - } - public void setAttribute7(String attribute7) { - this.attribute7 = attribute7; - } - public String getOpinionSreQuired() { - return opinionSreQuired; - } - public void setOpinionSreQuired(String opinionSreQuired) { - this.opinionSreQuired = opinionSreQuired; - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/AlreadyBusinessService.java b/src_app/apx/com/amarsoft/als/work/flow/service/AlreadyBusinessService.java deleted file mode 100644 index 81fe5ab32..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/AlreadyBusinessService.java +++ /dev/null @@ -1,13 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface AlreadyBusinessService { - Map already(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx); -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/AttachmentService.java b/src_app/apx/com/amarsoft/als/work/flow/service/AttachmentService.java deleted file mode 100644 index 1c1249b2d..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/AttachmentService.java +++ /dev/null @@ -1,19 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface AttachmentService { - Map searchFlowLB_DocLibrary(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; - - Map initAttTypeCheckBox(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; - - Map uploadFlowAtt(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/FlowCommonService.java b/src_app/apx/com/amarsoft/als/work/flow/service/FlowCommonService.java deleted file mode 100644 index baafc9334..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/FlowCommonService.java +++ /dev/null @@ -1,24 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface FlowCommonService { - /** - * 获取参数 - * - * @param request - * @param sqlca - * @param tx - * @return - */ - Map getParamVal(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx); - - Map acquisitionGroupInfo(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx); -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/FlowManageService.java b/src_app/apx/com/amarsoft/als/work/flow/service/FlowManageService.java deleted file mode 100644 index db1e74239..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/FlowManageService.java +++ /dev/null @@ -1,182 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service; - -import java.io.IOException; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface FlowManageService { - /** - * 代办列表 - * - * @param request - * @param sqlca - * @return - */ - Map allListPending(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx); - - /** - * 已办列表 - * - * @param request - * @param sqlca - * @param tx - * @return - */ - Map already(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx); - - /** - * 流程意见查询 - * - * @param request - * @param sqlca - * @param tx - * @return - */ - Map acquisitionOpinion(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx); - - /** - * 删除签署意见 - * - * @param request - * @param sqlca - * @param tx - * @return - */ - Map removeSelfOpinion(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx); - - /** - * 流程意见提交 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws IOException - */ - Map opinionSubmit(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws IOException; - - /** - * 获取参数值 - * - * @param request - * @param sqlca - * @return - */ - Map getParamVal(@Context HttpServletRequest request, - @Context Transaction sqlca, JBOTransaction tx); - - /** - * 获取分组信息 - * - * @param request - * @param sqlca - * @param tx - * @return - */ - Map acquisitionGroupInfo( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx); - - /** - * 查询附件列表 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map searchFlowAtt(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx) - throws Exception; - - /** - * 加载上传选择框 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws Exception - */ - Map initAttTypeCheckBox( - @Context HttpServletRequest request, @Context Transaction sqlca, - @Context JBOTransaction tx) throws Exception; - - /** - * 上传资料 - * - * @param request - * @param sqlca - * @param tx - * @return - */ - Map uploadFlowAtt(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction tx); - - /** - * 提交前业务 - * - * @param request - * @param sqlca - * @param jboTx - * @return - */ - Map submitBefore(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction jboTx); - - /** - * 本节点提交 - * - * @param request - * @param sqlca - * @param jboTx - * @return - */ - Map submit(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction jboTx); - - /** - * 本节点退回 - * - * @param request - * @param sqlca - * @param jboTx - * @return - */ - Map backStep(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction jboTx); - - /** - * 获取可退回节点信息 - * - * @param request - * @param sqlca - * @param jboTx - * @return - */ - Map getBackReturnPoint(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction jboTx); - - /** - * 退回选择节点 - * - * @param request - * @param sqlca - * @param jboTx - * @return - */ - Map backStepReturnTask(@Context HttpServletRequest request, - @Context Transaction sqlca, @Context JBOTransaction jboTx); -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/FlowOperationService.java b/src_app/apx/com/amarsoft/als/work/flow/service/FlowOperationService.java deleted file mode 100644 index 5876c1337..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/FlowOperationService.java +++ /dev/null @@ -1,25 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface FlowOperationService { - Map submitBefore(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception ; - - Map submit(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception ; - - Map backStep(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception ; - - Map getBackReturnPoint(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception ; - - Map backStepReturnTask(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception ; -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/FlowWorkBusinessDetailsService.java b/src_app/apx/com/amarsoft/als/work/flow/service/FlowWorkBusinessDetailsService.java deleted file mode 100644 index d3fee5d07..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/FlowWorkBusinessDetailsService.java +++ /dev/null @@ -1,13 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.awe.util.Transaction; - -public interface FlowWorkBusinessDetailsService { - Map searchBusinessDetails(@Context HttpServletRequest request, @Context Transaction sqlca); - Map acquisitionGroupInfo(@Context HttpServletRequest request, @Context Transaction sqlca); -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/FlowWorkCurrencyService.java b/src_app/apx/com/amarsoft/als/work/flow/service/FlowWorkCurrencyService.java deleted file mode 100644 index 00f3b5285..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/FlowWorkCurrencyService.java +++ /dev/null @@ -1,10 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service; - - -public interface FlowWorkCurrencyService { -// Map acquisitionOpinion(@Context HttpServletRequest request, @Context Transaction sqlca); -// Map opinionSubmit(@Context HttpServletRequest request, @Context Transaction sqlca); -// Map already(@Context HttpServletRequest request, @Context Transaction sqlca); -// Map initDisplayForAdd(@Context HttpServletRequest request, @Context Transaction sqlca); - -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/OpinionService.java b/src_app/apx/com/amarsoft/als/work/flow/service/OpinionService.java deleted file mode 100644 index 062e3a3b6..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/OpinionService.java +++ /dev/null @@ -1,19 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface OpinionService { - Map acquisitionOpinion(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx); - - Map opinionSubmit(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; - - Map removeSelfOpinion(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception; -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/PendingBusinessService.java b/src_app/apx/com/amarsoft/als/work/flow/service/PendingBusinessService.java deleted file mode 100644 index d4505d4f3..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/PendingBusinessService.java +++ /dev/null @@ -1,13 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface PendingBusinessService { - Map allListPending(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx); -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/impl/AlreadyBusinessServiceImpl.java b/src_app/apx/com/amarsoft/als/work/flow/service/impl/AlreadyBusinessServiceImpl.java deleted file mode 100644 index 19ee61ff0..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/impl/AlreadyBusinessServiceImpl.java +++ /dev/null @@ -1,135 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.jbo.FlowInfoJbo; -import apx.com.amarsoft.als.base.jbo.FlowObjectJbo; -import apx.com.amarsoft.als.base.jbo.impl.FlowInfoJboImpl; -import apx.com.amarsoft.als.base.jbo.impl.FlowObjectJboImpl; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.work.flow.service.AlreadyBusinessService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -public class AlreadyBusinessServiceImpl implements AlreadyBusinessService { - private static Log logger = ARE.getLog(); - FlowInfoJbo flowInfoJbo = new FlowInfoJboImpl(); - FlowObjectJbo flowObjectJbo = new FlowObjectJboImpl(); - - public Map already(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - try { - Map body = new HashMap(); - String sFlowNos = ""; - List doneList = new ArrayList(); - String sFlowNo = request.getParameter("flowno"); - String sUserId = (String) request.getSession().getAttribute( - "userid"); - if (StringUtils.isNotBlank(sFlowNo)) { - sFlowNos = "'" + sFlowNo + "'"; - doneList = flowObjectJbo.getDoneList(tx, sUserId, sFlowNos, ""); - } else { - List appFlowNo = flowInfoJbo.findAllAppFlowNo(tx, - sUserId); - for (BizObject bo : appFlowNo) { - if (bo.getAttribute("flowname") != null) - sFlowNos += bo.getAttribute("flowname").toString() - + ","; - } - String[] aFlowNos = sFlowNos.split(","); - sFlowNos = ""; - for (String str : aFlowNos) { - sFlowNos += "'" + str + "',"; - } - if (sFlowNos.length() > 0) { - sFlowNos = sFlowNos.substring(0, sFlowNos.length() - 1); - } - doneList = flowObjectJbo.getDoneList(tx, sUserId, sFlowNos, ""); - } - - String sLimit = request.getParameter("limit"); - String sPageIndex = request.getParameter("pageindex"); - if (sLimit == null || sLimit.length() < 1) - sLimit = "20"; - if (sPageIndex == null || sPageIndex.length() < 1) - sPageIndex = "1"; - int num; - int index; - num = Integer.valueOf(sLimit); - index = Integer.valueOf(sPageIndex) - 1; - int pageIndexStart = (index) * num; - int pageIndexEnd = (index + 1) * num; - - List> list = new ArrayList>(); - body.put("datas", list); - for (int j = pageIndexStart; j < pageIndexEnd; j++) { - if (j > (doneList.size() - 1)) { - break; - } - if (Integer.valueOf(sPageIndex) < 1) { - break; - } - if (doneList.size() % num == 0) { - if ((doneList.size() / num) < index) { - break; - } - } else { - if ((doneList.size() / num) + 1 < index) { - break; - } - } - BizObject bo = doneList.get(j); - Map map = new HashMap(); - map.put("begintime", bo.getAttribute("BEGINTIME").getValue()); - map.put("flowname", bo.getAttribute("FLOWNAME").getValue()); - map.put("phasename", bo.getAttribute("PHASENAME").getValue()); - map.put("projname", bo.getAttribute("proj_name").getValue()); - map.put("objectno", bo.getAttribute("OBJECTNO").getValue()); - map.put("objecttype", bo.getAttribute("OBJECTTYPE").getValue()); - map.put("serialno", bo.getAttribute("SERIALNO").getValue()); - map.put("phasetype", bo.getAttribute("PHASETYPE").getValue()); - map.put("flowno", bo.getAttribute("FLOWNO").getValue()); - map.put("phaseno", bo.getAttribute("PHASENO").getValue()); - map.put("projectid", bo.getAttribute("proj_id").getValue()); - map.put("doSubmit", - bo.getAttribute("ATTRIBUTE1") == null ? false : (bo - .getAttribute("ATTRIBUTE1").toString() - .indexOf("doSubmit") > -1 ? true : false)); - map.put("backStep", - bo.getAttribute("ATTRIBUTE1") == null ? false : (bo - .getAttribute("ATTRIBUTE1").toString() - .indexOf("backStep") > -1 ? true : false)); - map.put("viewDetail", - bo.getAttribute("ATTRIBUTE1") == null ? false : (bo - .getAttribute("ATTRIBUTE1").toString() - .indexOf("viewDetail") > -1 ? true : false)); - map.put("processmode", bo.getAttribute("ATTRIBUTE7").getValue()); - map.put("opinionSreQuired", bo.getAttribute("OPINIONSREQUIRED") - .getValue()); - list.add(map); - } - ReturnMapUtil.setReturnMap(body, - ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } catch (JBOException e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "获取已办列表失败"); - return ReturnMapUtil.getReturnMap(); - } - } - -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/impl/AttachmentServiceImpl.java b/src_app/apx/com/amarsoft/als/work/flow/service/impl/AttachmentServiceImpl.java deleted file mode 100644 index 84ceead4a..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/impl/AttachmentServiceImpl.java +++ /dev/null @@ -1,647 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service.impl; - -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.lang.StringUtils; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.constant.cache.AppAweDoCache; -import apx.com.amarsoft.als.base.util.AweDoUtil; -import apx.com.amarsoft.als.base.util.JsonUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.work.flow.service.AttachmentService; - -import com.amarsoft.app.lc.workflow.action.GetFlowAction; -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.StringFunction; -import com.amarsoft.awe.Configure; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; -import com.amarsoft.dict.als.manage.NameManager; -import com.tenwa.doc.action.DocListInitAction; -import com.tenwa.doc.action.DocumentListAction; -import com.tenwa.doc.cache.DocListCache; -import com.tenwa.officetempalte.util.FileOperatorUtil; - -public class AttachmentServiceImpl implements AttachmentService { - private static Log logger = ARE.getLog(); - - @SuppressWarnings("unchecked") - public Map searchFlowLB_DocLibrary( - HttpServletRequest request, Transaction sqlca, JBOTransaction tx) - throws Exception { - String sFlowUnid = request.getParameter("objectNo"); - String sType = request.getParameter("type"); - String sPorjId = request.getParameter("proj_id"); - String sContractId = request.getParameter("contract_id"); - if (sType == null) - sType = ""; - String otherWhere = ""; - if (sType == "") { - BizObject flow = GetFlowAction.getFlowBussinessObject(sFlowUnid);// 流程对象 - otherWhere = DocListInitAction.getFlowWhere(flow, "O"); - } else if ("proj".equals(sType)) { - otherWhere = " and O.proj_id='" + sPorjId + "'"; - } else if ("contract".equals(sType)) { - otherWhere = " and (O.contract_id='" + sContractId - + "' OR O.proj_id='" + sPorjId + "')"; - } - // jbo.app.tenwa.doc.LB_DOCRELATIVE - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCRELATIVE"); - BizObjectQuery boq = bom - .createQuery("SELECT lib.ID, lib.Doc_Type, lib.One_Classify, lib.DOC_NAME, lib.REMARK, O.Flow_Unid, lib.IS_FILE_LIST " - + "FROM O,jbo.app.tenwa.doc.LB_DOCLIBRARY lib " - + "WHERE O.id=lib.relative_Id " - + "and EXISTS(select 1 from jbo.app.tenwa.doc.LB_DOCATTRIBUTE attr where lib.id=attr.library_id)" - + otherWhere); - List bos = boq.getResultList(false); - Map body = new HashMap(); - List> list = new ArrayList>(); - body.put("data", list); - - Map DoCatalog = (Map) AppAweDoCache - .getAppAweDoCachePool().get("LBDocumentList"); - List> libarary = (List>) DoCatalog - .get("library"); - - for (BizObject bo : bos) { - Map info = new HashMap(); - List> cols = new ArrayList>(); - for (Map element : libarary) { - Map col = new HashMap(); - for (String key : element.keySet()) { - col.put(key, element.get(key)); - } - - if ("filelist".equalsIgnoreCase(element.get("colname") - .toString())) { - String sJsonStr = DocListCache.getFile(bo - .getAttribute("id") == null ? "" : bo.getAttribute( - "id").toString()); - List> attInfoList = new ArrayList>(); - if (StringUtils.isBlank(sJsonStr)) { - col.put("value", attInfoList); - } else { - Map attMap = (Map) JsonUtil - .str2Map(sJsonStr); - for (String key : attMap.keySet()) { - Map attInfoMap = (Map) JsonUtil - .str2Map(attMap.get(key).toString()); - attInfoList.add(attInfoMap); - } - } - col.put("value", attInfoList); - } else if ("One_Classify".equalsIgnoreCase(element.get( - "colname").toString())) { - String classOne = NameManager.getItemName("DocList", bo - .getAttribute("One_Classify") == null ? "" : bo - .getAttribute("One_Classify").toString()); - col.put("value", classOne); - } else if ("Doc_Type".equalsIgnoreCase(element.get("colname") - .toString())) { - String docType = NameManager.getItemName("DocList", bo - .getAttribute("Doc_Type") == null ? "" : bo - .getAttribute("Doc_Type").toString()); - col.put("value", docType); - } else { - String tableName = element.get("coltablename") == null ? "" : element.get("coltablename").toString(); - if (!"".equals(tableName)) - col.put("value", bo.getAttribute(element.get("colname").toString()).getValue()); - else - col.put("value", null); - } - cols.add(col); - } - info.put("info", cols); - list.add(info); - } - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - public Map searchFlowAtt(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - Map body = new HashMap(); - - String sFlowUnid = request.getParameter("objectNo"); - String sType = request.getParameter("type"); - String sPorjId = request.getParameter("proj_id"); - String sContractId = request.getParameter("contract_id"); - - if (sType == null) - sType = ""; - - String otherWhere = ""; - - if (sType == "") { - BizObject flow = GetFlowAction.getFlowBussinessObject(sFlowUnid);// 流程对象 - otherWhere = DocListInitAction.getFlowWhere(flow, "O"); - } else if ("proj".equals(sType)) { - otherWhere = " and O.proj_id='" + sPorjId + "'"; - } else if ("contract".equals(sType)) { - otherWhere = " and (O.contract_id='" + sContractId - + "' OR O.proj_id='" + sPorjId + "')"; - } - - AweDoUtil au = new AweDoUtil(); - Map data = au.getTemplateInfo("LBDocumentList", sqlca, - otherWhere); - @SuppressWarnings("unchecked") - List> list = (List>) data - .get("data"); - if (data.get("error_message") != null) { - ReturnMapUtil.setReturnMap(body, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - - for (Map map : list) { - @SuppressWarnings("unchecked") - List> list2 = (List>) map - .get("info"); - for (Map map2 : list2) { - if ("1".equals(map2.get("sql_pro"))) { - map2.put("type", "string"); - } else { - map2.put("type", "list"); - String strJson = map2.get("value") == null ? "" : map2.get( - "value").toString(); - List> attInfoList = new ArrayList>(); - if (StringUtils.isBlank(strJson)) { - map2.put("value", attInfoList); - } else { - @SuppressWarnings("unchecked") - Map attMap = (Map) JsonUtil - .str2Map(strJson); - for (String key : attMap.keySet()) { - @SuppressWarnings("unchecked") - Map attInfoMap = (Map) JsonUtil - .str2Map(attMap.get(key).toString()); - attInfoList.add(attInfoMap); - } - } - map2.put("value", attInfoList); - } - } - } - body.put("data", list); - ReturnMapUtil - .setReturnMap( - body, - ResultConstant.SUCCESS_RESULT_CODE, - apx.com.amarsoft.als.work.flow.constant.ResultConstant.SUCCESS_RESULT_ATT_MSG); - return ReturnMapUtil.getReturnMap(); - } - - private String initCondition(String sFlowUnid, String sFlowNo, String type, - String docType) throws Exception { - String doc = DocumentListAction.getFlowDocument(sFlowUnid, sFlowNo); - - String condition = ""; - switch (type) { - case "docType": - if (doc.length() > 0) { - condition = " LENGTH(itemno)=3 and codeno='DocList' and itemno in (" - + doc + ")"; - } else { - condition = " 1=2"; - } - break; - case "oneClass": - if (StringUtils.isBlank(docType)) { - condition = " 1=2"; - } else { - condition = " LENGTH(itemno)=6 and codeno='DocList' and itemno like '" - + docType + "%' and itemno in (" + doc + ")"; - } - break; - default: - break; - } - - return condition; - } - - private Map initCodeLibrary(String condition) - throws Exception { - BizObjectManager bm = JBOFactory - .getBizObjectManager("jbo.sys.CODE_LIBRARY"); - @SuppressWarnings("unchecked") - List boList = bm.createQuery(condition).getResultList(false); - - if (boList == null || boList.size() < 1) { - boList = new ArrayList(); - } - List> list = new ArrayList>(); - for (BizObject bo : boList) { - Map map = new HashMap(); - map.put("item_no", bo.getAttribute("ITEMNO").getValue()); - map.put("item_name", bo.getAttribute("ITEMNAME").getValue()); - list.add(map); - } - - Map body = new HashMap(); - body.put("data", list); - ReturnMapUtil - .setReturnMap( - body, - ResultConstant.SUCCESS_RESULT_CODE, - apx.com.amarsoft.als.work.flow.constant.ResultConstant.SUCCESS_RESULT_ATT_MSG); - return ReturnMapUtil.getReturnMap(); - } - - @SuppressWarnings("unchecked") - private Map initCustId(String sOneClass, String sFlowUnid) - throws Exception { - // jbo.app.tenwa.doc.LB_DOCCONFIG - BizObjectManager bm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCCONFIG"); - List boList = bm - .createQuery("doc_class_itemno=:doc_class_itemno") - .setParameter("doc_class_itemno", sOneClass) - .getResultList(false); - if (boList == null || boList.size() < 1) { - boList = new ArrayList(); - } - List> list = new ArrayList>(); - for (BizObject bo : boList) { - Map map = new HashMap(); - map.put("item_no", bo.getAttribute("ID").getValue()); - map.put("item_name", bo.getAttribute("DOC_NAME").getValue()); - list.add(map); - } - BizObjectManager bm1 = null; - List boList1 = null; - switch (sOneClass) { - case "001001": - bm1 = JBOFactory - .getBizObjectManager("jbo.com.tenwa.lease.comm.LB_UNION_LESSEE_TEMP"); - boList1 = bm1 - .createQuery( - "SELECT O.customer_id, O.customer_name FROM " - + " O WHERE O.flowunid=:flowunid") - .setParameter("flowunid", sFlowUnid).getResultList(false); - - break; - - case "001002": - bm1 = JBOFactory - .getBizObjectManager("jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP"); - boList1 = bm1 - .createQuery( - "SELECT cust.customerid , cust.customername " - + "FROM O LEFT JOIN jbo.app.CUSTOMER_INFO cust ON O.assuror=cust.customerid " - + "where o.flowunid=:flowunid") - .setParameter("flowunid", sFlowUnid).getResultList(false); - break; - } - - if (boList1 == null || boList1.size() < 1) { - boList1 = new ArrayList(); - } - - List> list1 = new ArrayList>(); - for (BizObject bo : boList1) { - Map map = new HashMap(); - String item_no = ""; - String item_name = ""; - if ("001001".equals(sOneClass)) { - item_no = "CUSTOMER_ID"; - item_name = "CUSTOMER_NAME"; - } else if ("001002".equals(sOneClass)) { - item_no = "customerid"; - item_name = "customername"; - } - map.put("item_no", bo.getAttribute(item_no).getValue()); - map.put("item_name", bo.getAttribute(item_name).getValue()); - list1.add(map); - } - - Map body = new HashMap(); - body.put("data", list1); - body.put("data1", list); - ReturnMapUtil - .setReturnMap( - body, - ResultConstant.SUCCESS_RESULT_CODE, - apx.com.amarsoft.als.work.flow.constant.ResultConstant.SUCCESS_RESULT_ATT_MSG); - return ReturnMapUtil.getReturnMap(); - - } - - private Map initDocName(String sCustid, String sOneClass) - throws Exception { - DocumentListAction da = new DocumentListAction(); - da.setCustomerid(sCustid); - String ct = da.getCustomerType(); - if (ct.equals("Y")) { - sOneClass += "001"; - } else { - sOneClass += "002"; - } - - BizObjectManager bm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCCONFIG"); - @SuppressWarnings("unchecked") - List boList = bm - .createQuery("doc_class_itemno=:doc_class_itemno") - .setParameter("doc_class_itemno", sOneClass) - .getResultList(false); - if (boList == null || boList.size() < 1) { - boList = new ArrayList(); - } - List> list = new ArrayList>(); - for (BizObject bo : boList) { - Map map = new HashMap(); - map.put("item_no", bo.getAttribute("ID").getValue()); - map.put("item_name", bo.getAttribute("DOC_NAME").getValue()); - list.add(map); - } - - Map body = new HashMap(); - body.put("data", list); - ReturnMapUtil - .setReturnMap( - body, - ResultConstant.SUCCESS_RESULT_CODE, - apx.com.amarsoft.als.work.flow.constant.ResultConstant.SUCCESS_RESULT_ATT_MSG); - return ReturnMapUtil.getReturnMap(); - } - - public Map initAttTypeCheckBox(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - String sFlowUnid = request.getParameter("objectNo"); - String sFlowNo = request.getParameter("flowNo"); - String type = request.getParameter("type"); - String sDocType = request.getParameter("docType"); - String sOneClass = request.getParameter("oneClass"); - String sCustid = request.getParameter("custid"); - String sCondition = initCondition(sFlowUnid, sFlowNo, type, sDocType); - switch (type) { - case "docType":// 加载1级 - return initCodeLibrary(sCondition); - case "oneClass":// 加载2级 - return initCodeLibrary(sCondition); - case "custId":// 加载3级 - return initCustId(sOneClass, sFlowUnid); - case "docName":// 加载4级 - return initDocName(sCustid, sOneClass); - } - - return null; - } - - @SuppressWarnings("deprecation") - public Map uploadFlowAtt(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - - try { - @SuppressWarnings({ "unchecked" }) - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - List> fileList = new ArrayList>(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } else { - Map fileMap = new HashMap(); - fileMap.put("fileSize", item.getInputStream().available()); - fileMap.put("fileContentType", item.getContentType()); - fileMap.put("fileName", item.getName()); - fileMap.put("file", item.getInputStream()); - fileList.add(fileMap); - } - } - String sDocType, sOneClassify, sDocName, sRemark, sCustId, sFlowUnid, sFlowNo, libraryId, InputTime; - InputTime = StringFunction.getTodayNow(); // 附件上传时间 - libraryId = ""; // 附件编号 - sDocType = fieldMap.get("docType").toString();// 一级分类 - sOneClassify = fieldMap.get("oneClassify").toString();// 二级分类 - sDocName = fieldMap.get("docName").toString();// 资料名称 - sRemark = fieldMap.get("remark") == null ? "" : fieldMap.get( - "remark").toString();// 备注 - sCustId = fieldMap.get("custId") == null ? "" : fieldMap.get( - "custId").toString();// 客户 - sFlowUnid = fieldMap.get("flowUnid").toString();// 流程号 - sFlowNo = fieldMap.get("flowNo").toString();// 流程类型号 - ASUser user = (ASUser) request.getSession().getAttribute("ASUser"); - logger.info("备注 >" + sRemark); - logger.info("一级分类 >" + sDocType); - logger.info("二级分类 >" + sOneClassify); - logger.info("资料名称 >" + sDocName); - if (StringUtils.isNotBlank(sCustId)) - logger.info("客户 >" + sCustId); - - BizObject docconfig = JBOFactory - .createBizObjectQuery("jbo.app.tenwa.doc.LB_DOCCONFIG", - "id=:id").setParameter("id", sDocName) - .getSingleResult(false); - String docName = docconfig.getAttribute("DOC_NAME").getString(); - String otherParamWhere = ""; - if (sOneClassify == null) { - sOneClassify = ""; - } else if (sOneClassify.length() > 1) { - otherParamWhere = otherParamWhere - + " and One_Classify=:oneClassify"; - } - if (docName == null) { - docName = ""; - } else if (docName.length() > 1) { - otherParamWhere = otherParamWhere + " and DOC_NAME=:docName"; - } - if (sCustId.length() > 1) { - otherParamWhere = otherParamWhere - + " and rela.cust_id=:cust_id"; - } - - BizObjectManager relaBm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCRELATIVE"); - BizObjectManager libBm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); - BizObjectManager attrBm = JBOFactory - .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); - - BizObject lib = null; - BizObject flow = GetFlowAction.getFlowBussinessObject(sFlowUnid);// 流程对象 - - String otherWhere = DocListInitAction.getFlowWhere(flow, "rela"); - - String sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCRELATIVE rela on O.Relative_Id=rela.id where O.Doc_Type=:doc_type "; - sql += otherWhere; - sql += otherParamWhere; - BizObjectQuery query = libBm.createQuery(sql); - query.setParameter("doc_type", - NameManager.getItemName("DocList", sDocType)); - if (sOneClassify.length() > 0) - query.setParameter("oneClassify", - NameManager.getItemName("DocList", sOneClassify)); - if (docName.length() > 0) - query.setParameter("docName", docName); - if (sCustId.length() > 0) - query.setParameter("cust_id", sCustId); - lib = query.getSingleResult(true); - - if (lib != null) { - lib.setAttributeValue("Remark", sRemark); - libBm.saveObject(lib); - libraryId = lib.getAttribute("id").getString(); - } else { - otherParamWhere = ""; - otherWhere = DocListInitAction.getFlowWhere(flow, "O"); - if (sCustId.length() > 1) { - otherParamWhere = otherParamWhere - + " and O.cust_id=:cust_id"; - } - sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCLIBRARY lib on lib.Relative_Id=O.id where lib.Doc_Type=:doc_type "; - sql += otherWhere; - sql += otherParamWhere; - query = relaBm.createQuery(sql); - query.setParameter("doc_type", - NameManager.getItemName("DocList", sDocType)); - if (sCustId.length() > 0) - query.setParameter("cust_id", sCustId); - BizObject rela = query.getSingleResult(true); - String relativeid = ""; - if (rela == null) { - // 初始化附件关联对象 - rela = relaBm.newObject(); - rela.setAttributeValue("ObjectType", sFlowNo); - rela.setAttributeValue("Flow_Unid", sFlowUnid); - rela.setAttributeValue("proj_id", - flow.getAttribute("proj_id").getString()); - rela.setAttributeValue("contract_id", - flow.getAttribute("contract_id").getString()); - rela.setAttributeValue("cust_id", sCustId); - relaBm.saveObject(rela); - relativeid = rela.getAttribute("id").getString(); - } else { - relativeid = rela.getAttribute("id").getString(); - } - // 初始化附件 - lib = libBm.newObject(); - lib.setAttributeValue("Doc_Type", - NameManager.getItemName("DocList", sDocType)); - lib.setAttributeValue("One_Classify", - NameManager.getItemName("DocList", sOneClassify)); - lib.setAttributeValue("doc_Class_Itemno", sOneClassify); - lib.setAttributeValue("config_id", sDocName); - lib.setAttributeValue("doc_name", docName); - lib.setAttributeValue("Relative_Id", relativeid); - lib.setAttributeValue("BUSINESS_CHECK", "DocCheck_2"); - lib.setAttributeValue("REVIEW_CHECK", "DocCheck_2"); - lib.setAttributeValue("doc_nature", - docconfig.getAttribute("doc_nature").getString()); - lib.setAttributeValue("Remark", sRemark); - libBm.saveObject(lib); - libraryId = lib.getAttribute("id").getString(); - } - - for (Map fm : fileList) { - String sFileName, sFileSize, sFileContentType; - InputStream file = null; - file = (InputStream) fm.get("file"); - sFileName = (String) fm.get("fileName"); - sFileContentType = (String) fm.get("fileContentType"); - sFileSize = fm.get("fileSize") + ""; - BizObject attr = attrBm.newObject(); - attr.setAttributeValue("Library_Id", libraryId); - attr.setAttributeValue("FileName", sFileName); - attr.setAttributeValue("InputUserId", user.getUserID()); - attr.setAttributeValue("InputOrgId", user.getOrgID()); - attr.setAttributeValue("InputTime", InputTime); - attr.setAttributeValue("Remark", sRemark); - attr.setAttributeValue("ObjectType", sFlowNo); - // 得到不带路径的文件名 - sFileName = StringFunction.getFileName(sFileName); - sFileName = URLDecoder.decode( - URLDecoder.decode(sFileName, "UTF-8"), "UTF-8"); - - HttpSession session = null; - Configure CurConfig = null; - session = request.getSession(true); - if ((session == null) || (session.getAttributeNames() == null)) - throw new Exception("------Timeout------"); - - CurConfig = Configure.getInstance(session.getServletContext()); - if (CurConfig == null) - throw new ServletException("读取配置文件错误!请检查配置文件。"); - String sFileSavePath = CurConfig.getConfigure("FileSavePath"); - - String uuid = UUID.randomUUID().toString().replaceAll("-", ""); - String sFullPath = FileOperatorUtil - .getuploadFileDir(sFileSavePath) - + uuid - + "_" - + sFileName; - String sFilePath = sFullPath.replace(sFileSavePath, ""); - attr.setAttributeValue("FilePath", sFilePath); - attr.setAttributeValue("FullPath", sFullPath); - attr.setAttributeValue("Content_Type", sFileContentType); - attr.setAttributeValue("FileSize", sFileSize); - try { - attrBm.saveObject(attr); - } catch (Exception e) { - logger.error(e); - attrBm.deleteObject(attr); - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - apx.com.amarsoft.als.work.flow.constant.ResultConstant.FAIL_RESULT_UPLOAD_MSG); - return ReturnMapUtil.getReturnMap(); - } - - File f = new File(sFullPath); - DataOutputStream fileout = new DataOutputStream( - new FileOutputStream(f)); - byte b[] = new byte[Integer.valueOf(sFileSize)]; - @SuppressWarnings("unused") - int i = file.read(b, 0, Integer.valueOf(sFileSize) - 1); - fileout.write(b, 0, b.length); // 将文件数据存盘 - fileout.close(); - } - } catch (Exception e) { - logger.error(e); - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.FAIL_RESULT_CODE, - apx.com.amarsoft.als.work.flow.constant.ResultConstant.FAIL_RESULT_UPLOAD_MSG); - return ReturnMapUtil.getReturnMap(); - } - ReturnMapUtil - .setReturnMap( - null, - ResultConstant.SUCCESS_RESULT_CODE, - apx.com.amarsoft.als.work.flow.constant.ResultConstant.SUCCESS_RESULT_UPLOAD_MSG); - return ReturnMapUtil.getReturnMap(); - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/impl/BusinessDetailsServiceImpl.java b/src_app/apx/com/amarsoft/als/work/flow/service/impl/BusinessDetailsServiceImpl.java deleted file mode 100644 index c5ad2344f..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/impl/BusinessDetailsServiceImpl.java +++ /dev/null @@ -1,1255 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service.impl; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; - -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.base.util.ValidateRestfulParamUtil; -import apx.com.amarsoft.als.work.flow.constant.ResultConstant; -import apx.com.amarsoft.als.work.flow.mode.AppBusinessGroup; -import apx.com.amarsoft.als.work.flow.service.FlowWorkBusinessDetailsService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; - -public class BusinessDetailsServiceImpl implements - FlowWorkBusinessDetailsService { - - private static Log logger = ARE.getLog(); - - // ---------------------- check ------------------------------- - private String flowno; - private String phaseno; - // ---------------------- currency ------------------------------- - private String objno; - private List> listinfo = new ArrayList>(); - - List> cacheCols = new ArrayList>(); - List> cacheCols1 = new ArrayList>(); - - public List> getCacheCols() { - return cacheCols; - } - - public List> getCacheCols1() { - return cacheCols1; - } - - public void setCacheCols(List> cacheCols) { - this.cacheCols = cacheCols; - } - - public void setCacheCols1(List> cacheCols1) { - this.cacheCols1 = cacheCols1; - } - - // ---------------------- query data ------------------------------- - private String groupcode; - - // ---------------------- sql param ------------------------------- - // private List>> datas; - - private List> datas1; - - // ------------------------ mehtod name ---------------------------------- - - public BusinessDetailsServiceImpl() { - } - - public BusinessDetailsServiceImpl(String groupid) { - this.groupcode = groupid; - } - - private boolean checkFlowObjIsExistsData(String sql, Transaction sqlca) { - ASResultSet rs = null; - SqlObject sqlObject; - try { - sqlObject = new SqlObject(sql).setParameter("OBJECTNO", this.objno) - .setParameter("FLOWNO", this.flowno) - .setParameter("PHASENO", this.phaseno); - rs = sqlca.getResultSet(sqlObject); - if (rs != null) { - while (rs.next()) { - int objnum = rs.getInt("OBJ_NUM"); - if (objnum > 0) { - return true; - } - } - } else { - return true; - } - return true; - - } catch (SQLException e) { - logger.error("checkFlowObjIsExistsData :" + e); - return false; - } catch (Exception e) { - logger.error("checkFlowObjIsExistsData :" + e); - return false; - } finally { - if (rs != null) { - try { - rs.getStatement().close(); - rs = null; - } catch (SQLException e) { - ARE.getLog().error(e); - } - } - } - } - - public List> getGroups(String sql, Transaction sqlca) { - List> donos = new ArrayList>(); - ASResultSet rs = null; - try { - SqlObject sqlObject = new SqlObject(sql).setParameter("GROUP_CODE", - this.groupcode); - rs = sqlca.getResultSet(sqlObject); - - if (rs != null) { - while (rs.next()) { - Map dono = new HashMap(); - dono.put( - "dono", - rs.getString("DONO") == null ? null : rs - .getString("DONO")); - dono.put( - "groupcode", - rs.getString("GROUP_CODE") == null ? null : rs - .getString("GROUP_CODE")); - dono.put( - "jboclass", - rs.getString("JBOCLASS") == null ? null : rs - .getString("JBOCLASS")); - dono.put("jbofrom", rs.getString("JBOFROM") == null ? null - : rs.getString("JBOFROM")); - dono.put( - "jbogroup", - rs.getString("JBOGROUP") == null ? null : rs - .getString("JBOGROUP")); - dono.put( - "jboorder", - rs.getString("JBOORDER") == null ? null : rs - .getString("JBOORDER")); - dono.put( - "jbowhere", - rs.getString("JBOWHERE") == null ? null : rs - .getString("JBOWHERE")); - dono.put( - "businessprocess", - rs.getString("BUSINESSPROCESS") == null ? null : rs - .getString("BUSINESSPROCESS")); - dono.put("islist", rs.getString("ISLIST") == null ? null - : rs.getString("ISLIST")); - donos.add(dono); - } - if (donos.size() > 0) { - for (Map dono : donos) { - List> cols = new ArrayList>(); - - sql = "SELECT "; - sql += " o.DONO, o.SORTNO, o.DATA_CODE, o.DATA_NAME, o.ISLIST, o.ISSHOW, o.DATA_POSITION, o.ISCONVERT, "; - sql += " l.COLCOLUMNTYPE, l.COLACTUALNAME,l.COLNAME, l.COLTABLENAME, l.COLHEADER, l.coleditsource, l.coleditsourcetype, "; - sql += " l.colvisible, l.colreadonly, l.colrequired, l.coleditstyle, l.coltype "; - sql += "FROM "; - sql += " APP_BUSINESS_TEMPLATE o, AWE_DO_LIBRARY l "; - sql += "WHERE "; - sql += " 1=1 "; - sql += " AND o.DONO = l.DONO "; - sql += " AND o.SORTNO = l.SORTNO "; - sql += " AND l.ISINUSE = 1 "; - sql += " AND o.GROUP_CODE=:GROUP_CODE "; - sql += " AND o.DONO=:DONO "; - sql += "ORDER BY "; - sql += " o.DATA_POSITION"; - - rs = null; - sqlObject = null; - sqlObject = new SqlObject(sql).setParameter( - "GROUP_CODE", dono.get("groupcode").toString()) - .setParameter("DONO", - dono.get("dono").toString()); - - rs = sqlca.getResultSet(sqlObject); - if (rs != null) { - while (rs.next()) { - Map colinfo = new HashMap(); - colinfo.put( - "coleditsource", - rs.getString("coleditsource") == null ? null - : rs.getString("coleditsource")); - colinfo.put( - "coleditsourcetype", - rs.getString("coleditsourcetype") == null ? null - : rs.getString("coleditsourcetype")); - colinfo.put("dono", - rs.getString("DONO") == null ? null - : rs.getString("DONO")); - colinfo.put("sortno", - rs.getString("SORTNO") == null ? null - : rs.getString("SORTNO")); - colinfo.put("datacode", rs - .getString("DATA_CODE") == null ? null - : rs.getString("DATA_CODE")); - colinfo.put("dataname", rs - .getString("DATA_NAME") == null ? null - : rs.getString("DATA_NAME")); - colinfo.put("islist", - rs.getString("ISLIST") == null ? null - : rs.getString("ISLIST")); - - if (rs.getString("ISLIST") != null - && rs.getString("ISLIST") - .equalsIgnoreCase("Y")) { - colinfo.put("islist", "Y"); - } else { - colinfo.put("islist", "N"); - } - - colinfo.put("isshow", - rs.getString("ISSHOW") == null ? null - : rs.getString("ISSHOW")); - - if (rs.getString("ISSHOW") != null - && rs.getString("ISSHOW") - .equalsIgnoreCase("Y")) { - colinfo.put("isshow", "Y"); - } else { - colinfo.put("isshow", "N"); - } - - colinfo.put("isconvert", rs - .getString("ISCONVERT") == null ? null - : rs.getString("ISCONVERT")); - - if (rs.getString("ISCONVERT") != null - && rs.getString("ISCONVERT") - .equalsIgnoreCase("Y")) { - colinfo.put("isconvert", "Y"); - } else { - colinfo.put("isconvert", "N"); - } - - colinfo.put( - "dataposition", - rs.getString("DATA_POSITION") == null ? null - : rs.getString("DATA_POSITION")); - colinfo.put( - "coltype", - rs.getString("COLCOLUMNTYPE") == null ? null - : rs.getString("COLCOLUMNTYPE")); - colinfo.put( - "colactual", - rs.getString("COLACTUALNAME") == null ? null - : rs.getString("COLACTUALNAME")); - colinfo.put("colname", - rs.getString("COLNAME") == null ? null - : rs.getString("COLNAME")); - colinfo.put( - "coltablename", - rs.getString("COLTABLENAME") == null ? null - : rs.getString("COLTABLENAME")); - colinfo.put("colheader", rs - .getString("COLHEADER") == null ? null - : rs.getString("COLHEADER")); - colinfo.put( - "coleditstyle", - rs.getString("COLEDITSTYLE") == null ? null - : rs.getString("COLEDITSTYLE")); - colinfo.put( - "colrequired", - rs.getString("COLREQUIRED") == null ? null - : rs.getString("COLREQUIRED")); - colinfo.put( - "colreadonly", - rs.getString("COLREADONLY") == null ? null - : rs.getString("COLREADONLY")); - colinfo.put("colvisible", rs - .getString("COLVISIBLE") == null ? null - : rs.getString("COLVISIBLE")); - colinfo.put("basetype", - rs.getString("COLTYPE") == null ? null - : rs.getString("COLTYPE")); - cols.add(colinfo); - } - dono.put("colinfo", cols); - } - } - } - } - } catch (SQLException e) { - logger.error("getGroupinfos :" + e); - return donos; - } catch (Exception e) { - logger.error("getGroupinfos :" + e); - return donos; - } finally { - if (rs != null) { - try { - rs.getStatement().close(); - rs = null; - } catch (SQLException e) { - ARE.getLog().error(e); - } - } - } - return donos; - } - - private List> initTemplateConfig( - HttpServletRequest request, Transaction sqlca) { - try { - this.flowno = request.getParameter("flowno"); - this.phaseno = request.getParameter("phaseno"); - this.objno = request.getParameter("objno"); - this.groupcode = request.getParameter("groupid"); - List> donos = new ArrayList>(); - // check flow_obj flowno, phase, objno - String sql = ""; - sql += "SELECT "; - sql += " COUNT(1) as OBJ_NUM "; - sql += "FROM "; - sql += " FLOW_TASK O "; - sql += "WHERE "; - sql += " 1=1"; - sql += " AND OBJECTNO=:OBJECTNO "; - sql += " AND FLOWNO=:FLOWNO "; - sql += " AND PHASENO=:PHASENO"; - if (checkFlowObjIsExistsData(sql, sqlca)) { - sql = "SELECT "; - sql += " DISTINCT o.DONO, o.GROUP_CODE, "; - sql += " c.JBOCLASS, c.JBOFROM, c.JBOGROUP, c.JBOORDER, c.JBOWHERE, c.BUSINESSPROCESS, "; - sql += " bg.ISLIST "; - sql += "FROM "; - sql += " APP_BUSINESS_TEMPLATE o, AWE_DO_CATALOG c, APP_BUSINESS_GROUP BG "; - sql += "WHERE "; - sql += " 1=1 "; - sql += " AND o.GROUP_CODE = BG.GROUP_CODE "; - sql += " AND o.DONO = c.DONO "; - sql += " AND o.GROUP_CODE=:GROUP_CODE"; - donos = getGroups(sql, sqlca); - } - return donos; - } catch (Exception e) { - logger.error("init > catch error :" + e); - return null; - } - } - - @Override - public Map searchBusinessDetails( - HttpServletRequest request, Transaction sqlca) { - try { - Map searchBusinessDetails = searchBusinessDetailsProcess( - request, sqlca); - if (searchBusinessDetails != null) { - return searchBusinessDetails; - } else { - ReturnMapUtil.setReturnMap(null, "FAIL", "获取详情失败!请联系管理员"); - return ReturnMapUtil.getReturnMap(); - } - } catch (Exception e) { - ReturnMapUtil.setReturnMap(null, "FAIL", "获取详情失败!请联系管理员"); - return ReturnMapUtil.getReturnMap(); - } - - } - - public List> getItemName(String codeno, - Transaction sqlca, String otherWhere) throws Exception { - List> list = new ArrayList>(); - String sql = "SELECT ITEMNAME, ITEMNO FROM CODE_LIBRARY O WHERE codeno=:codeno " - + otherWhere; - ASResultSet rs = null; - SqlObject sqlObject = new SqlObject(sql).setParameter("codeno", codeno); - rs = sqlca.getResultSet(sqlObject); - while (rs.next()) { - String itemname = rs.getString("ITEMNAME") == null ? null : rs - .getString("ITEMNAME").toString().trim(); - String itemno = rs.getString("ITEMNO") == null ? null : rs - .getString("ITEMNO").toString().trim(); - Map map = new HashMap(); - map.put("itemname", itemname); - map.put("itemno", itemno); - list.add(map); - } - return list; - } - - public String getItemName(String codeno, String itemno, Transaction sqlca) - throws Exception { - try { - if (StringUtils.isBlank(itemno)) { - return itemno; - } - String sql = "SELECT ITEMNAME FROM CODE_LIBRARY O WHERE O.ITEMNO=:ITEMNO AND codeno=:codeno"; - ASResultSet rs = null; - SqlObject sqlObject = new SqlObject(sql).setParameter("ITEMNO", - itemno).setParameter("codeno", codeno); - rs = sqlca.getResultSet(sqlObject); - if (rs == null) { - return itemno; - } else { - while (rs.next()) { - String itemname = rs.getString("ITEMNAME") == null ? null - : rs.getString("ITEMNAME").toString().trim(); - if (itemname == null) { - return itemno; - } else { - return itemname; - } - } - } - } catch (Exception e) { - throw new Exception("获取item name 出现异常!"); - } - return itemno; - } - - @SuppressWarnings({ "unchecked", "unused" }) - private Map searchBusinessDetailsProcess( - HttpServletRequest request, Transaction sqlca) { - if (!ValidateRestfulParamUtil.validateReqPara(request, - new Exception().getStackTrace()[0].getMethodName())) { - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - List> groups = initTemplateConfig(request, sqlca); - if (groups == null || groups.size() < 1) { - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, - "用户没有具体绑定具体流程"); - return ReturnMapUtil.getReturnMap(); - } - Map body = new HashMap(); - for (Map group : groups) { - String jboclass = group.get("jboclass") == null ? null : group.get( - "jboclass").toString(); - String jbofrom = group.get("jbofrom") == null ? null : group.get( - "jbofrom").toString(); - String jbogroup = group.get("jbogroup") == null ? null : group.get( - "jbogroup").toString(); - String jboorder = group.get("jboorder") == null ? null : group.get( - "jboorder").toString(); - String jbowhere = group.get("jbowhere") == null ? null : group.get( - "jbowhere").toString(); - String islist = group.get("islist") == null ? null : group.get( - "islist").toString(); - String condition = ""; - String colListSql = ""; - String colDetailSql = ""; - String tableSql = ""; - String groupSql = ""; - String orderSql = ""; - String sql = "SELECT "; - - orderSql = sqlOrder(jboorder); - if (orderSql == null) { - return null; - } - - if (StringUtils.isNotBlank(jbowhere)) { - condition += " WHERE "; - condition += sqlCondition(jbowhere, orderSql); - } - if (condition == null) { - return null; - } - tableSql = getTable(jboclass, jbofrom); - if (tableSql == null) { - return null; - } - - groupSql = sqlGroup(jbogroup); - if (group == null) { - return null; - } - if (islist.trim().equalsIgnoreCase("Y")) { - String pageIndex = request.getParameter("pageindex"); - String limit = request.getParameter("limit"); - if (StringUtils.isBlank(pageIndex) - || StringUtils.isBlank(limit)) { - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - List> cols = (List>) group - .get("colinfo"); - colListSql = getColumnsSql(cols, "list"); - if (colListSql == null) { - return null; - } - String[] colArr = colListSql.split(","); - colListSql = ""; - for (int i = 0; i < colArr.length; i++) { - if (StringUtils.isNotBlank(colArr[i])) { - colListSql += colArr[i]; - } - if (i != colArr.length - 1 - && StringUtils.isNotBlank(colArr[i])) { - colListSql += ","; - } - - } - if (colListSql.substring(colListSql.length() - 1, - colListSql.length()).equals(",")) { - colListSql = colListSql.substring(0, - colListSql.length() - 1); - } - // 列表查询 - sql = "SELECT "; - sql += " " + colListSql + " " + tableSql + " " + condition - + " " + groupSql + " " + orderSql; - try { - logger.info("sql :" + sql); - executeSql(sqlca, sql, this.cacheCols1, "list"); - } catch (Exception e) { - return null; - } - int num; - int index; - try { - num = Integer.valueOf(limit); - index = Integer.valueOf(pageIndex) - 1; - } catch (NumberFormatException e) { - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - if (this.datas1.size() < 1) { - // this.listinfo.add(new HashMap()); - } else { - int pageIndexStart = (index) * num; - int pageIndexEnd = (index + 1) * num; - for (int li = pageIndexStart; li < pageIndexEnd; li++) { - List> cache = new ArrayList>(); - List> cache2 = new ArrayList>(); - if (li > (this.datas1.size() - 1)) { - break; - } - if (Integer.valueOf(pageIndex) < 1) { - break; - } - if (this.datas1.size() % num == 0) { - if ((this.datas1.size() / num) < index) { - break; - } - } else { - if ((this.datas1.size() / num) + 1 < index) { - break; - } - } - Map data = this.datas1.get(li); - List> collist = new ArrayList>(); - collist = (List>) data.get("data"); - for (Map colmap : collist) { - String svalue = colmap.get("value") == null ? "" - : colmap.get("value").toString().trim(); - String sdatacode = colmap.get("code") == null ? "" - : colmap.get("code").toString().trim(); - String sislist = colmap.get("islist") == null ? "" - : colmap.get("islist").toString().trim(); - String sisshow = colmap.get("isshow") == null ? "" - : colmap.get("isshow").toString().trim(); - String sdataname = colmap.get("display") == null ? "" - : colmap.get("display").toString().trim(); - String sisconvert = colmap.get("isconvert") == null ? "" - : colmap.get("isconvert").toString().trim(); - String scolname = colmap.get("colname") == null ? "" - : colmap.get("colname").toString().trim(); - String sposition = colmap.get("dataposition") == null ? "" - : colmap.get("dataposition").toString() - .trim(); - String coleditsource = colmap.get("coleditsource") == null ? "" - : colmap.get("coleditsource").toString() - .trim(); - String coleditsourcetype = colmap - .get("coleditsourcetype") == null ? "" - : colmap.get("coleditsourcetype") - .toString().trim(); - if (sisconvert.equalsIgnoreCase("y")) { - try { - svalue = getItemName(coleditsource, svalue, - sqlca); - } catch (Exception e) { - return null; - } - } - if (sislist.equalsIgnoreCase("y")) { - Map info = new HashMap(); - info.put("value", svalue); - info.put("display", sdataname); - info.put("code", sdatacode); - info.put("position", sposition); - info.put("colname", scolname); - cache2.add(info); - - } - if (sisshow.equalsIgnoreCase("y")) { - Map info = new HashMap(); - info.put("value", svalue); - info.put("display", sdataname); - info.put("code", sdatacode); - info.put("position", sposition); - info.put("colname", scolname); - cache.add(info); - } - } - for (Map map : this.cacheCols) { - String actual = map.get("colactual").toString(); - String ap = actual.substring( - actual.indexOf("(") + 1, - actual.indexOf(")")); - String[] apa = ap.split(","); - String[] apa1 = new String[apa.length]; - int ai = 0; - for (String str : apa) { - for (Map map1 : this.cacheCols1) { - if (map1.get("colname").toString().trim() - .equals(str.trim())) { - // strList.add(map1.get("value")==null ? - // "" - // : map1.get("value").toString()); - apa1[ai] = map1.get("value") == null ? "" - : map1.get("value").toString(); - ai++; - break; - } - } - } - // String strings[] = (String [])strList.toArray(); - String svalue = executeMethod(actual, apa1); - String sdatacode = map.get("datacode") == null ? "" - : map.get("datacode").toString().trim(); - String sisshow = map.get("isshow") == null ? "" - : map.get("isshow").toString().trim(); - String sislist = map.get("islist") == null ? "" - : map.get("islist").toString().trim(); - String sisconvert = map.get("isconvert") == null ? "" - : map.get("isconvert").toString().trim(); - String sdataname = map.get("dataname") == null ? "" - : map.get("dataname").toString().trim(); - String coleditsource = map.get("coleditsource") == null ? "" - : map.get("coleditsource").toString() - .trim(); - String coleditsourcetype = map - .get("coleditsourcetype") == null ? "" - : map.get("coleditsourcetype").toString() - .trim(); - if (sisconvert.equalsIgnoreCase("y")) { - try { - svalue = getItemName(coleditsource, svalue, - sqlca); - } catch (Exception e) { - return null; - } - } - if (sisshow.trim().equalsIgnoreCase("y")) { - Map info = new HashMap(); - info.put("value", svalue); - info.put("display", sdataname); - info.put("code", sdatacode); - info.put("position", - map.get("dataposition") == null ? "" - : map.get("dataposition") - .toString().trim()); - info.put("colname", - map.get("colname") == null ? "" : map - .get("colname").toString() - .trim()); - cache.add(info); - } - - if (sislist.trim().equalsIgnoreCase("y")) { - Map info = new HashMap(); - info.put("value", svalue); - info.put("display", sdataname); - info.put("code", sdatacode); - info.put("position", - map.get("dataposition") == null ? "" - : map.get("dataposition") - .toString().trim()); - info.put("colname", - map.get("colname") == null ? "" : map - .get("colname").toString() - .trim()); - cache2.add(info); - } - } - Map datas3 = new HashMap(); - List> infos3 = sortData(cols, cache); - List> infos4 = sortData(cols, - cache2); - datas3.put("detail_data", infos3); - datas3.put("list_data", infos4); - this.listinfo.add(datas3); - } - } - - } else { - List> cols = (List>) group - .get("colinfo"); - colDetailSql = getColumnsSql(cols, "detail"); - if (colDetailSql == null) { - return null; - } - String[] colArr = colDetailSql.split(","); - colDetailSql = ""; - for (int i = 0; i < colArr.length; i++) { - if (StringUtils.isNotBlank(colArr[i])) { - colDetailSql += colArr[i]; - } - if (i != colArr.length - 1 - && StringUtils.isNotBlank(colArr[i])) { - colDetailSql += ","; - } - } - // 详情查询 - if (colDetailSql.substring(colDetailSql.length() - 1, - colDetailSql.length()).equals(",")) { - colDetailSql = colDetailSql.substring(0, - colDetailSql.length() - 1); - } - sql = "SELECT "; - sql += " " + colDetailSql + " " + tableSql + " " + condition - + " " + groupSql + " " + orderSql; - try { - logger.info("sql :" + sql); - executeSql(sqlca, sql, this.cacheCols1, "detail"); - } catch (Exception e) { - return null; - } - for (Map data : this.datas1) { - List> cache = new ArrayList>(); - List> collist = new ArrayList>(); - collist = (List>) data.get("data"); - for (Map colmap : collist) { - String svalue = colmap.get("value") == null ? "" - : colmap.get("value").toString().trim(); - String sdatacode = colmap.get("code") == null ? "" - : colmap.get("code").toString().trim(); - String sisshow = colmap.get("isshow") == null ? "" - : colmap.get("isshow").toString().trim(); - String sisconvert = colmap.get("isconvert") == null ? "" - : colmap.get("isconvert").toString().trim(); - String scolname = colmap.get("colname") == null ? "" - : colmap.get("colname").toString().trim(); - String position = colmap.get("dataposition") == null ? "" - : colmap.get("dataposition").toString().trim(); - String coleditsource = colmap.get("coleditsource") == null ? "" - : colmap.get("coleditsource").toString().trim(); - String coleditsourcetype = colmap - .get("coleditsourcetype") == null ? "" : colmap - .get("coleditsourcetype").toString().trim(); - if (sisconvert.equalsIgnoreCase("y")) { - try { - svalue = getItemName(coleditsource, svalue, - sqlca); - } catch (Exception e) { - return null; - } - } - if (!sisshow.trim().equalsIgnoreCase("y")) { - continue; - } - String sdataname = colmap.get("display") == null ? "" - : colmap.get("display").toString().trim(); - Map info = new HashMap(); - info.put("value", svalue); - info.put("display", sdataname); - info.put("code", sdatacode); - info.put("position", position); - info.put("colname", scolname); - cache.add(info); - } - for (Map map : this.cacheCols) { - String actual = map.get("colactual").toString(); - String ap = actual.substring(actual.indexOf("(") + 1, - actual.indexOf(")")); - String[] apa = ap.split(","); - String[] apa1 = new String[apa.length]; - int ai = 0; - for (String str : apa) { - for (Map map1 : this.cacheCols1) { - if (map1.get("colname").toString().trim() - .equals(str.trim())) { - apa1[ai] = map1.get("value") == null ? "" - : map1.get("value").toString(); - ai++; - break; - } - } - } - String svalue = executeMethod(actual, apa1); - String sdatacode = map.get("datacode") == null ? "" - : map.get("datacode").toString().trim(); - String sisshow = map.get("isshow") == null ? "" : map - .get("isshow").toString().trim(); - String sisconvert = map.get("isconvert") == null ? "" - : map.get("isconvert").toString().trim(); - String sdataname = map.get("dataname") == null ? "" - : map.get("dataname").toString().trim(); - String coleditsource = map.get("coleditsource") == null ? "" - : map.get("coleditsource").toString().trim(); - String coleditsourcetype = map.get("coleditsourcetype") == null ? "" - : map.get("coleditsourcetype").toString() - .trim(); - if (sisconvert.equalsIgnoreCase("y")) { - try { - svalue = getItemName(coleditsource, svalue, - sqlca); - } catch (Exception e) { - return null; - } - } - if (!sisshow.trim().equalsIgnoreCase("y")) { - continue; - } - Map info = new HashMap(); - info.put("value", svalue); - info.put("display", sdataname); - info.put("code", sdatacode); - info.put( - "position", - map.get("dataposition") == null ? "" : map - .get("dataposition").toString().trim()); - info.put("colname", map.get("colname") == null ? "" - : map.get("colname").toString().trim()); - cache.add(info); - } - List> infos3 = sortData(cols, cache); - Map datas3 = new HashMap(); - datas3.put("detail_data", infos3); - this.listinfo.add(datas3); - } - } - } - body.put("datas", this.listinfo); - ReturnMapUtil.setReturnMap(body, "SUCCESS", "获取信息成功!"); - return ReturnMapUtil.getReturnMap(); - } - - public List> sortData(List> cols, - List> datas) { - List> newDatas = new ArrayList>(); - for (Map col : cols) { - for (Map data : datas) { - if (col.get("colname").toString().trim() - .equals(data.get("colname").toString().trim())) { - newDatas.add(data); - break; - } - } - } - return newDatas; - } - - private void executeSql(Transaction sqlca, String sql, - List> cols, String pagetype) throws Exception { - // this.datas = new ArrayList>>(); - this.datas1 = new ArrayList>(); - ASResultSet rs = null; - SqlObject sqlObject = new SqlObject(sql); - rs = sqlca.getResultSet(sqlObject); - if (rs != null) { - rs.last(); - if (rs.getRow() == 0) { - Map data = new HashMap(); - List> columns = new ArrayList>(); - if (pagetype.equalsIgnoreCase("list")) { - return; - } else { - for (Map col : cols) { - Map column = new HashMap(); - if (col.get("isshow").toString().trim() - .equalsIgnoreCase("y")) { - column.put("isconvert", col.get("isconvert")); - column.put("islist", col.get("islist")); - column.put("isshow", col.get("isshow")); - column.put("code", col.get("datacode")); - column.put("display", col.get("dataname")); - column.put("dataposition", col.get("dataposition")); - column.put("colname", col.get("colname")); - column.put("value", ""); - column.put("coleditsource", - col.get("coleditsource")); - column.put("coleditsourcetype", - col.get("coleditsourcetype")); - column.put("basetype", col.get("basetype")); - columns.add(column); - } - } - data.put("data", columns); - this.datas1.add(data); - } - } else { - rs.beforeFirst(); - } - while (rs.next()) { - Map data = new HashMap(); - List> columns = new ArrayList>(); - for (Map col : cols) { - Map column = new HashMap(); - column.put("isconvert", col.get("isconvert")); - column.put("islist", col.get("islist")); - column.put("isshow", col.get("isshow")); - column.put("code", col.get("datacode")); - column.put("display", col.get("dataname")); - column.put("dataposition", col.get("dataposition")); - column.put("coleditsource", col.get("coleditsource")); - column.put("coleditsourcetype", - col.get("coleditsourcetype")); - column.put("colname", col.get("colname")); - if (pagetype.equals("list")) { - col.put("value", - rs.getString(col.get("colname").toString())); - } else { - col.put("value", - rs.getString(col.get("colname").toString())); - } - column.put("value", col.get("value")); - column.put("basetype", col.get("basetype")); - columns.add(column); - } - data.put("data", columns); - this.datas1.add(data); - // if (pagetype.equals("detail")) { - // break; - // } - } - } else { - Map data = new HashMap(); - List> columns = new ArrayList>(); - for (Map col : cols) { - Map column = new HashMap(); - if (col.get("isshow").toString().trim().equalsIgnoreCase("y")) { - column.put("islist", col.get("islist")); - column.put("isshow", col.get("isshow")); - column.put("code", col.get("datacode")); - column.put("display", col.get("dataname")); - column.put("dataposition", col.get("dataposition")); - column.put("colname", col.get("colname")); - column.put("coleditsource", col.get("coleditsource")); - column.put("coleditsourcetype", - col.get("coleditsourcetype")); - column.put("value", ""); - column.put("basetype", col.get("basetype")); - columns.add(column); - } - } - data.put("data", columns); - this.datas1.add(data); - } - } - - private String executeMethod(String colactualname, String... params) { - - String value = ""; - - try { - String classpath = colactualname.substring(0, - colactualname.lastIndexOf(".")); - String methodName = colactualname.substring( - colactualname.lastIndexOf(".") + 1, - colactualname.indexOf("(")); - String paramsname = colactualname.substring( - colactualname.indexOf("(") + 1, colactualname.indexOf(")")); - String[] vParams = paramsname.split(","); - if (vParams.length != params.length) { - return null; - } - List Lparam = new ArrayList(); - for (String param : params) { - Lparam.add(param); - } - @SuppressWarnings("rawtypes") - Class classPathClass = Class.forName(classpath); - Object obj = classPathClass.newInstance(); - Method targetMethod = null; - Method[] cls = classPathClass.getDeclaredMethods(); - for (int j = 0; j < cls.length; j++) { - if (cls[j].getName().equalsIgnoreCase(methodName)) { - targetMethod = cls[j]; - } - } - value = (String) targetMethod.invoke(obj, Lparam.toArray()); - if (value == null) { - value = ""; - } - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | SecurityException - | IllegalArgumentException | InvocationTargetException e) { - logger.error("executeMethod" + e); - return null; - } - return value; - } - - public String sqlGroup(String jbogroup) { - String sql = " "; - try { - sql += jbogroup == null ? "" : jbogroup; - } catch (Exception e) { - logger.error("group > catch error :" + e); - return null; - } - return sql; - } - - public String sqlOrder(String jboorder) { - String sql = ""; - try { - if (!StringUtils.isBlank(jboorder)) { - sql = " ORDER BY " + jboorder; - } - } catch (Exception e) { - logger.error("order > catch error :" + e); - return null; - } - return sql; - } - - public String getTable(String jboclass, String jbofrom) { - String queryFrom = " FROM "; - String sFrom = jbofrom.toUpperCase(); - if (jbofrom.indexOf(",") != -1) { - String[] arr = jbofrom.split(","); - for (String str : arr) { - str = str.trim(); - if (queryFrom.length() > 0) { - queryFrom += ","; - } - if (str.equalsIgnoreCase("o")) { - String[] arr2 = jboclass.split("\\."); - queryFrom += arr2[arr2.length - 1] + " " + str; - } else { - String[] arr2 = str.trim().split(" "); - String[] arr3 = arr2[0].split("\\."); - queryFrom += arr3[arr3.length - 1] + " " + arr2[1]; - } - } - } else if (sFrom.indexOf(" JOIN ") != -1) { - if (sFrom.startsWith("O ")) { - String[] arr2 = jboclass.split("\\."); - queryFrom += arr2[arr2.length - 1]; - // queryFrom += " O "; - String[] att3 = jbofrom.split("join "); - for (String str3 : att3) { - if (str3.indexOf("jbo.") != -1) { - str3 = str3.substring(0, str3.indexOf(" ")); - String[] arr4 = str3.split("\\."); - jbofrom = jbofrom.replace(str3, arr4[arr4.length - 1]); - } - } - queryFrom += " " + jbofrom; - } - } else { - String[] arr2 = jboclass.split("\\."); - queryFrom += arr2[arr2.length - 1]; - queryFrom += " O "; - } - - return queryFrom; - } - - public String sqlCondition(String jbowhere, String orderSql) { - String sql = ""; - jbowhere = jbowhere.toUpperCase(); - String order = ""; - String[] sArr = jbowhere.split("ORDER BY"); - if (sArr.length > 1) { - jbowhere = sArr[0]; - order = sArr[1]; - } - try { - String[] whereparam = jbowhere.split("AND"); - int j = 0; - for (int i = 0; i < whereparam.length; i++) { - if (whereparam[i].indexOf(":") > 0) { - String[] paramname = whereparam[i].split(":"); - String key = paramname[1].trim(); - key = key.replace("_", ""); - if (key.equalsIgnoreCase("flowunid")) { - sql += paramname[0] + "'" + this.objno + "' "; - j++; - } else { - logger.error("jbo.where error :" + paramname[1] - + "Unable to get value!"); - return null; - } - - } else { - sql += whereparam[i] + " "; - j++; - } - if (i < whereparam.length - 1 && j > 0) { - sql += "AND "; - } - } - if (StringUtils.isBlank(orderSql) && StringUtils.isNotBlank(order)) { - sql += " ORDER BY " + order; - } - } catch (Exception e) { - logger.error("condition > catch error :" + e); - return null; - } - return sql; - } - - public String getColumnsSql(List> cols, String pagetype) { - String sql = ""; - try { - switch (pagetype) { - case "list": - int i = 0; - int j = 0; - for (Map col : cols) { - String colactual = col.get("colactual").toString(); - if (colactual == null) - return null; - if (colactual.trim().startsWith("v.''") - || colactual.trim().startsWith("''")) { - continue; - } - if (colactual.trim().startsWith("NameManager")) { - sql += (colactual.replace("NameManager.", "")); - // sql += " as " + col.get("colname"); - } else if (colactual.trim().startsWith("CodeManager")) { - sql += (colactual.replace("CodeManager.", "")); - } - String tn = col.get("coltablename") == null ? null : col - .get("coltablename").toString(); - if (tn != null && !tn.equals("")) { - sql += tn + "."; - } - if (colactual.trim().indexOf(".") > -1 - && !((colactual.trim().startsWith("NameManager")) || (colactual - .trim().startsWith("CodeManager")))) { - this.cacheCols.add(col); - continue; - } - sql += col.get("colname"); - i++; - if (i > 0 && j < cols.size() - 1) { - sql += ", "; - } - this.cacheCols1.add(col); - j++; - } - return sql; - case "detail": - i = 0; - j = 0; - for (Map col : cols) { - String colactual = col.get("colactual").toString(); - if (colactual == null) - return null; - if (colactual.trim().startsWith("v.''") - || colactual.trim().startsWith("''")) { - continue; - } - if (colactual.trim().startsWith("NameManager")) { - sql += (colactual.replace("NameManager.", "")); - // sql += " as " + col.get("colname"); - } else if (colactual.trim().startsWith("CodeManager")) { - sql += (colactual.replace("CodeManager.", "")); - } - String tn = col.get("coltablename") == null ? null : col - .get("coltablename").toString(); - if (tn != null && !tn.equals("")) { - sql += tn + "."; - } - if (colactual.trim().indexOf(".") > -1 - && !((colactual.trim().startsWith("NameManager")) || (colactual - .trim().startsWith("CodeManager")))) { - this.cacheCols.add(col); - continue; - } - sql += col.get("colname"); - i++; - if (i > 0 && j < cols.size() - 1) { - sql += ", "; - } - this.cacheCols1.add(col); - j++; - } - return sql; - } - } catch (Exception e) { - logger.error("getColumnsSql > catch error :" + e); - return null; - } - return sql; - } - - @Override - public Map acquisitionGroupInfo(HttpServletRequest request, - Transaction sqlca) { - if (!ValidateRestfulParamUtil.validateReqPara(request, - new Exception().getStackTrace()[0].getMethodName())) { - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - - AppBusinessGroup group = new AppBusinessGroup(); - group.setFlowno(request.getParameter("flowno")); - group.setPhaseno(request.getParameter("phaseno")); - - String sql = ""; - sql += "SELECT "; - sql += " o.GROUP_CODE, o.GROUP_NAME, o.FLOWNO, o.PHASENO, o.ISLIST, o.GROUP_POSITION "; - sql += "FROM "; - sql += " APP_BUSINESS_GROUP o "; - sql += "WHERE "; - sql += " 1=1 "; - // sql += " AND o.FLOWNO=:FLOWNO "; - // sql += " AND o.PHASENO=:PHASENO "; - sql += "ORDER BY "; - sql += " o.GROUP_POSITION"; - - List groups = group.getAppBusinessGroup(sqlca, sql); - if (groups == null || groups.size() < 1) { - ReturnMapUtil.setReturnMap(null, "SUCCESS", "没有找到业务分组记录"); - return ReturnMapUtil.getReturnMap(); - } - try { - Map body = new HashMap(); - body.put("groups", groups); - ReturnMapUtil.setReturnMap(body, "SUCCESS", "没有找到业务分组记录"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error("bean2Map error :" + e); - ReturnMapUtil.setReturnMap(null, "FILE", "获取业务分组信息失败,请联系管理员!"); - return ReturnMapUtil.getReturnMap(); - } - - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowCommonServiceImpl.java b/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowCommonServiceImpl.java deleted file mode 100644 index e5789f823..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowCommonServiceImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.work.flow.mode.AppBusinessGroup; -import apx.com.amarsoft.als.work.flow.service.FlowCommonService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; - -public class FlowCommonServiceImpl implements FlowCommonService { - private static Log logger = ARE.getLog(); - public Map getParamVal(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - String sType = request.getParameter("paramtype"); - String sObjectNo = request.getParameter("objno"); - if (sType == null) - sType = ""; - if (sObjectNo == null) - sObjectNo = ""; - switch (sType) { - case "CONTRACT_ID": // 合同ID - return getContractId(sObjectNo, sqlca); - default: - break; - } - // TODO Auto-generated method stub - return null; - } - - private Map getContractId(String objno, Transaction sqlca) { - Map col = new HashMap(); - ASResultSet rs = null; - String id = ""; - try { - String sql = "SELECT O.CONTRACT_ID FROM c1_condition O WHERE O.flow_unid='" - + objno + "'"; - SqlObject sqlObject = new SqlObject(sql); - rs = sqlca.getResultSet(sqlObject); - if (rs != null) { - while (rs.next()) { - id = rs.getString("CONTRACT_ID") == null ? "" : rs - .getString("CONTRACT_ID").toString().trim(); - break; - } - } - } catch (Exception e) { - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, - "获取合同ID失败~"); - return ReturnMapUtil.getReturnMap(); - } - - if (StringUtils.isBlank(id)) { - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, - "获取合同ID失败~"); - return ReturnMapUtil.getReturnMap(); - } - List> cols = new ArrayList>(); - col.put("code", "CONTRACT_ID"); - col.put("display", "合同ID"); - col.put("value", id); - cols.add(col); - Map body = new HashMap(); - body.put("datas", cols); - ReturnMapUtil.setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, - "获取参数成功!"); - return ReturnMapUtil.getReturnMap(); - } - - public Map acquisitionGroupInfo(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - AppBusinessGroup group = new AppBusinessGroup(); - group.setFlowno(request.getParameter("flowno")); - group.setPhaseno(request.getParameter("phaseno")); - - String sql = ""; - sql += "SELECT "; - sql += " o.GROUP_CODE, o.GROUP_NAME, o.FLOWNO, o.PHASENO, o.ISLIST, o.GROUP_POSITION "; - sql += "FROM "; - sql += " APP_BUSINESS_GROUP o "; - sql += "WHERE "; - sql += " 1=1 "; - sql += "ORDER BY "; - sql += " o.GROUP_POSITION"; - - List groups = group.getAppBusinessGroup(sqlca, sql); - if (groups == null || groups.size() < 1) { - ReturnMapUtil.setReturnMap(null, "SUCCESS", "没有找到业务分组记录"); - return ReturnMapUtil.getReturnMap(); - } - try { - Map body = new HashMap(); - body.put("groups", groups); - ReturnMapUtil.setReturnMap(body, "SUCCESS", "没有找到业务分组记录"); - return ReturnMapUtil.getReturnMap(); - } catch (Exception e) { - logger.error("bean2Map error :" + e); - ReturnMapUtil.setReturnMap(null, "FILE", "获取业务分组信息失败,请联系管理员!"); - return ReturnMapUtil.getReturnMap(); - } - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowManageServiceImpl.java b/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowManageServiceImpl.java deleted file mode 100644 index 22fc5db65..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowManageServiceImpl.java +++ /dev/null @@ -1,231 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service.impl; - -import java.io.IOException; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.work.flow.service.AlreadyBusinessService; -import apx.com.amarsoft.als.work.flow.service.AttachmentService; -import apx.com.amarsoft.als.work.flow.service.FlowCommonService; -import apx.com.amarsoft.als.work.flow.service.FlowManageService; -import apx.com.amarsoft.als.work.flow.service.FlowOperationService; -import apx.com.amarsoft.als.work.flow.service.OpinionService; -import apx.com.amarsoft.als.work.flow.service.PendingBusinessService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -public class FlowManageServiceImpl implements FlowManageService { - private static Log logger = ARE.getLog(); - - // 代办业务服务 - PendingBusinessService pendingBusiness = new PendingBusinessServiceImpl(); - // 已办业务服务 - AlreadyBusinessService alreadyBusiness = new AlreadyBusinessServiceImpl(); - // 流程意见服务 - OpinionService opinionService = new OpinionServiceImpl(); - // 流程常用工具服务 - FlowCommonService commonService = new FlowCommonServiceImpl(); - // 流程附件服务 - AttachmentService attService = new AttachmentServiceImpl(); - // 流程操作服务 - FlowOperationService operationService = new FlowOperationServiceImpl(); - - // begin 代办接口:列表查询 - public Map allListPending(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - try { - return pendingBusiness.allListPending(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - // end - - // begin 已办接口:列表查询 - public Map already(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - try { - return alreadyBusiness.already(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - // end - - // begin 意见接口:意见查询(审批意见/签署意见), 保存/编辑签署意见, 删除签署意见 - public Map acquisitionOpinion(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - try { - return opinionService.acquisitionOpinion(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map removeSelfOpinion(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - try { - return opinionService.removeSelfOpinion(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map opinionSubmit(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws IOException { - try { - return opinionService.opinionSubmit(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - // end - - // begin 辅助接口:获取必要参数 : CONTRACT_ID合同号 - public Map acquisitionGroupInfo(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - try { - return commonService.acquisitionGroupInfo(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - - public Map getParamVal(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - try { - return commonService.getParamVal(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - // end - - // begin 流程附件接口:列表查询 , 附件类型加载, 附件上传 - public Map searchFlowAtt(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return attService.searchFlowLB_DocLibrary(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map initAttTypeCheckBox(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - try { - return attService.initAttTypeCheckBox(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map uploadFlowAtt(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - try { - return attService.uploadFlowAtt(request, sqlca, tx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - // end - - // begin 流程实际操作接口: 风险预警 \获取提交路有人 \退回获取提交节点人 \提交 \直接退回 \退回选择节点 - public Map submitBefore(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) { - try { - return operationService.submitBefore(request, sqlca, jboTx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map submit(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) { - try { - return operationService.submit(request, sqlca, jboTx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map backStep(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) { - try { - return operationService.backStep(request, sqlca, jboTx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map getBackReturnPoint(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) { - try { - return operationService.getBackReturnPoint(request, sqlca, jboTx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map backStepReturnTask(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) { - try { - return operationService.backStepReturnTask(request, sqlca, jboTx); - } catch (Exception e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - // end -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowOperationServiceImpl.java b/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowOperationServiceImpl.java deleted file mode 100644 index 90445e6a8..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowOperationServiceImpl.java +++ /dev/null @@ -1,254 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service.impl; - -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.lang.StringUtils; - -import com.amarsoft.app.flow.FlowAction; -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.work.flow.business.FlowWorkBackStepBusiness; -import apx.com.amarsoft.als.work.flow.business.FlowWorkSubmitBusiness; -import apx.com.amarsoft.als.work.flow.service.FlowOperationService; - -public class FlowOperationServiceImpl implements FlowOperationService { - private static Log logger = ARE.getLog(); - - private Map submitBeforeProcess(HttpServletRequest request, - Transaction sqlca, @Context JBOTransaction jboTx) throws Exception { - Map map = new HashMap(); - String sSerialno = request.getParameter("serialno"); - try { - FlowWorkSubmitBusiness business = new FlowWorkSubmitBusiness( - sSerialno); - business.submitBeforeProess(map, jboTx, sqlca); - if (map.get("code").equals("200")) { - jboTx.commit(); - sqlca.commit(); - } else { - sqlca.rollback(); - jboTx.rollback(); - } - } catch (Exception e) { - logger.error("FlowOperationServiceImpl >>> submitBeforeProcess() >> error > " - + e); - sqlca.rollback(); - jboTx.rollback(); - return map; - } - return map; - } - - private Map backStepProcess(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception { - String backType = request.getParameter("backType"); - String sSerialno = request.getParameter("serialno"); - if (StringUtils.isBlank(backType)) - backType = "any"; - Map map = new HashMap(); - try { - FlowWorkBackStepBusiness business = new FlowWorkBackStepBusiness( - sSerialno); - business.backStep(map, jboTx, sqlca, backType); - if (map.get("code").equals("200")) { - jboTx.commit(); - sqlca.commit(); - } else { - sqlca.rollback(); - jboTx.rollback(); - } - } catch (Exception e) { - logger.error("FlowOperationServiceImpl >>> backStepProcess() >> error > " - + e); - sqlca.rollback(); - jboTx.rollback(); - return map; - } - return map; - } - - @SuppressWarnings({ "unchecked", "deprecation" }) - private Map submitProcess(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } - } - String sPhaseOpinion = fieldMap.get("phaseOpinion") == null ? "" - : fieldMap.get("phaseOpinion").toString(); - String sPhaseAction = fieldMap.get("phaseAction") == null ? "" - : fieldMap.get("phaseAction").toString(); - String sReadUserIds = fieldMap.get("readUserIds") == null ? "" - : fieldMap.get("readusers").toString(); - String sCurUserId = (String) request.getSession() - .getAttribute("userid"); - String sSerialno = fieldMap.get("serialno") == null ? "" : fieldMap - .get("serialno").toString(); - - Map map = new HashMap(); - try { - FlowWorkSubmitBusiness business = new FlowWorkSubmitBusiness( - sSerialno); - business.submitProess(map, jboTx, sqlca, sPhaseOpinion, - sPhaseAction, sReadUserIds, sCurUserId); - if (map.get("code").equals("200")) { - jboTx.commit(); - sqlca.commit(); - } else { - sqlca.rollback(); - jboTx.rollback(); - } - } catch (Exception e) { - logger.error("FlowOperationServiceImpl >>> submitProcess() >> error > " - + e); - sqlca.rollback(); - jboTx.rollback(); - return map; - } - - return map; - } - - public Map submitBefore(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception { - Map body = submitBeforeProcess(request, sqlca, jboTx); - ReturnMapUtil - .setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - - public Map submit(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception { - Map body = submitProcess(request, sqlca, jboTx); - if ("200".equals(body.get("code"))) { - ReturnMapUtil.setReturnMap(body, - ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } else { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map backStep(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception { - Map body = backStepProcess(request, sqlca, jboTx); - if ("200".equals(body.get("code"))) { - ReturnMapUtil.setReturnMap(body, - ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } else { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ""); - return ReturnMapUtil.getReturnMap(); - } - } - - @SuppressWarnings("deprecation") - public Map getBackReturnPoint(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception { - String sObjectNo = request.getParameter("objno"); - String sFlowNo = request.getParameter("flowno"); - String sPhaseNo = request.getParameter("phaseno"); - String sBeginTime = request.getParameter("begintime"); - sBeginTime = URLDecoder.decode(sBeginTime); - List> list = new ArrayList>(); - String queryStr = "select serialNo,userID,USERNAME,phaseNo,phaseName,beginTime,endTime from O where (phaseno,begintime) in (" - + "select phaseNo,max(begintime) from O,jbo.sys.FLOW_MODEL FM " - + "where O.flowNo=FM.flowNo and O.phaseNo=FM.phaseNo and objectNo='" - + sObjectNo - + "' " - + " and flowNo='" - + sFlowNo - + "' and Begintime<'" - + sBeginTime - + "' and Phaseopinion1<>'从上一步退回' " - + "and (FM.attribute7 IS NULL OR FM.attribute7='01') and ForkState is null " - + "and flowState not in('VOTED','UNVOTED','COLLECT') and endtime is not null " - + "and phaseno<>'" - + sPhaseNo - + "' group by phaseno) order by endtime desc "; - try { - BizObjectManager bomcr = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_TASK"); - @SuppressWarnings("unchecked") - List bocrs = bomcr.createQuery(queryStr).getResultList( - false); - for (BizObject bocr : bocrs) { - Map map = new HashMap(); - map.put("serialNo", bocr.getAttribute("SERIALNO")); - map.put("userId", bocr.getAttribute("USERID")); - map.put("userName", bocr.getAttribute("USERNAME")); - map.put("phaseNo", bocr.getAttribute("PHASENO")); - map.put("phaseName", bocr.getAttribute("PHASENAME")); - map.put("beginTime", bocr.getAttribute("BEGINTIME")); - map.put("endTime", bocr.getAttribute("ENDTIME")); - list.add(map); - } - } catch (JBOException e1) { - logger.error("FlowOperationServiceImpl >> backStepReturnTask > " - + e1); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "获取退回节点列表失败!"); - return ReturnMapUtil.getReturnMap(); - } - - Map body = new HashMap(); - body.put("data", list); - ReturnMapUtil.setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, - "获取退回节点列表成功!"); - return ReturnMapUtil.getReturnMap(); - } - - public Map backStepReturnTask(HttpServletRequest request, - Transaction sqlca, JBOTransaction jboTx) throws Exception { - String taskNo = request.getParameter("serialno"); - String returnPoint = request.getParameter("returnno"); - String recommit = request.getParameter("recommit"); - FlowAction action = new FlowAction(); - action.setTaskNo(taskNo); - action.setReturnPoint(returnPoint); - action.setRecommit(recommit); - String returnTask = ""; - try { - returnTask = action.returnTask(jboTx); - } catch (Exception e) { - jboTx.rollback(); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "退回节点失败!"); - return ReturnMapUtil.getReturnMap(); - } - jboTx.commit(); - ReturnMapUtil.setReturnMap(null, ResultConstant.SUCCESS_RESULT_CODE, - returnTask); - return ReturnMapUtil.getReturnMap(); - } - -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowWorkCurrencyServiceImpl.java b/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowWorkCurrencyServiceImpl.java deleted file mode 100644 index 21beecd9b..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/impl/FlowWorkCurrencyServiceImpl.java +++ /dev/null @@ -1,576 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service.impl; - -import apx.com.amarsoft.als.work.flow.service.FlowWorkCurrencyService; - -public class FlowWorkCurrencyServiceImpl extends Thread implements - FlowWorkCurrencyService { - -// private static Log logger = ARE.getLog(); -// -// private String objno; -// private String objtype; -// private String userid; -// private String scope; -// private int limit; -// private int pageindex; -// -// private List opinionList; -// -// private FlowWorkManager flowWorkManager; -// private List flowWorkList; -// -// private Map returnMap; -// -// private String serialno; -// private String opinionno; -// private String phasechoice; -// private String phaseopinion; -// private String inputorgid; -// private String inputuser; -// private String inputtime; -// private String updateuser; -// private String updatetime; - -// private void loadTransaction(Transaction sqlca, String sql) { -// this.flowWorkManager = FlowWorkManagerFactory.getAlsFlowOpinion(sqlca, -// sql); -// } -// -// private void loadTransaction2(Transaction sqlca, String sql) { -// this.flowWorkManager = FlowWorkManagerFactory.getAlsFlowWorkManager( -// sqlca, sql); -// } - -// private void loadInitSubmitOpinion(Map map) { -// this.serialno = ""; -// this.opinionno = ""; -// this.phasechoice = ""; -// this.phaseopinion = ""; -// this.inputorgid = ""; -// this.inputuser = ""; -// this.inputtime = ""; -// this.updateuser = ""; -// this.updatetime = ""; -// -// this.updatetime = DateUtil.getSystemTimeByFormat(new Date(), -// "yyyy/MM/dd HH:mm:ss"); -// this.inputtime = updatetime; -// -// this.serialno = map.get("serialno").toString(); -// this.opinionno = map.get("opinionno") == null ? "" : map.get( -// "opinionno").toString(); -// this.phasechoice = map.get("phasechoice") == null ? "" : map.get( -// "phasechoice").toString(); -// this.phaseopinion = map.get("phaseopinion") == null ? "" : map.get( -// "phaseopinion").toString(); -// this.inputorgid = map.get("orgid").toString(); -// this.inputuser = map.get("userid").toString(); -// this.updateuser = inputuser; -// } -// -// private void loadAcquisitionOpinion(HttpServletRequest request, -// Transaction sqlca) { -// this.objno = ""; -// this.objno = request.getParameter("objno"); -// this.objtype = ""; -// this.objtype = request.getParameter("objtype"); -// this.serialno = ""; -// this.serialno = request.getParameter("serialno"); -// this.scope = ""; -// this.scope = request.getParameter("scope") == null ? "" : request -// .getParameter("scope"); -// this.userid = ""; -// this.userid = request.getParameter("userid"); -// this.limit = Integer.valueOf(request.getParameter("limit").trim()); -// this.pageindex = Integer.valueOf(request.getParameter("pageindex") -// .trim()); -// this.opinionList = null; -// this.flowWorkManager = null; -// StringBuffer sb = new StringBuffer("SELECT "); -// sb.append("O.serialno, FO.OPINIONNO, O.FlowNo, O.PhaseNo, O.PhaseName, O.UserName, "); -// sb.append("O.OrgName,O.PhaseAction,O.BeginTime,O.EndTime, "); -// sb.append("O.PhaseChoice, FO.PhaseOpinion, FO.PhaseOpinion1, "); -// sb.append("FO.PhaseOpinion2, FO.PhaseOpinion3, FM.Attribute3 AS OpinionRightType, "); -// sb.append("FM.Attribute4 AS OpinionRightPhases, "); -// sb.append("FM.Attribute5 AS OpinionRightRoles "); -// sb.append("FROM flow_task O,flow_opinion FO,flow_model FM "); -// sb.append("WHERE O.Serialno=FO.SerialNo AND O.FlowNo=FM.FlowNo "); -// sb.append("AND O.PhaseNo=FM.PhaseNo AND ("); -// sb.append("FO.PhaseOpinion IS NOT NULL ) "); -// sb.append("AND O.ObjectNo=:ObjectNo AND O.ObjectType=:ObjectType "); -// if (this.scope.trim().equalsIgnoreCase("self")) { -// sb.append("AND O.SERIALNO=:SERIALNO "); -// } -// sb.append("ORDER BY O.BeginTime DESC ,O.SerialNo"); -// loadTransaction(sqlca, sb.toString()); -// if (this.scope.trim().equalsIgnoreCase("self")) { -// this.opinionList = this.flowWorkManager.searchFlowOpinion( -// this.objno, this.objtype, this.serialno); -// } else if (this.scope.trim().equalsIgnoreCase("other")) { -// this.opinionList = this.flowWorkManager.searchFlowOpinion( -// this.objno, this.objtype); -// } -// } -// -// private void saveOpinion() throws JBOException { -// BizObjectManager bm = JBOFactory -// .getBizObjectManager("jbo.sys.FLOW_OPINION"); -// BizObject bo = bm.newObject(); -// bo.setAttributeValue("SERIALNO", this.serialno); -// bo.setAttributeValue("PHASECHOICE", this.phasechoice); -// bo.setAttributeValue("INPUTORG", this.inputorgid); -// bo.setAttributeValue("INPUTUSER", this.inputuser); -// bo.setAttributeValue("INPUTTIME", this.inputtime); -// bo.setAttributeValue("UPDATEUSER", this.updateuser); -// bo.setAttributeValue("UPDATETIME", this.updatetime); -// bo.setAttributeValue("PHASEOPINION", this.phaseopinion); -// logger.info("准备保存意见"); -// bm.saveObject(bo); -// } -// -// private void modifyOpinion() throws JBOException { -// // UPDATE flow_opinion SET PHASEOPINION=:PHASEOPINION, -// // UPDATETIME=:UPDATETIME -// // WHERE OPINIONNO=:_KEY_OPINIONNO AND SERIALNO=:_KEY_SERIALNO -// String sql = "UPDATE o SET PHASEOPINION=:PHASEOPINION, UPDATETIME=:UPDATETIME "; -// sql += "WHERE OPINIONNO=:KEYOPINIONNO AND SERIALNO=:KEYSERIALNO"; -// logger.info("sql >> " + sql); -// BizObjectManager bomcr = JBOFactory -// .getBizObjectManager("jbo.sys.FLOW_OPINION"); -// bomcr.createQuery(sql).setParameter("PHASEOPINION", this.phaseopinion) -// .setParameter("UPDATETIME", this.updatetime) -// .setParameter("KEYOPINIONNO", this.opinionno) -// .setParameter("KEYSERIALNO", this.serialno).executeUpdate(); -// } -// -// private Map submitProccess(HttpServletRequest request, -// Transaction sqlca) { -// Map paramMap = new HashMap(); -// try { -// FileDataMultipartUtils.releaseParam(); -// FileDataMultipartUtils.readFile(request, paramMap); -// if (paramMap.size() > 0) { -// String uid = paramMap.get("userid") == null ? "" : paramMap -// .get("userid").toString(); -// String sn = paramMap.get("serialno") == null ? "" : paramMap -// .get("serialno").toString(); -// String oi = paramMap.get("orgid") == null ? "" : paramMap.get( -// "orgid").toString(); -// if (!validatePara(uid, sn, oi)) { -// setReturnMap( -// null, -// apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, -// ResultConstant.FAIL_RESULT_PARAM_LACK); -// return this.returnMap; -// } -// } else { -// setReturnMap( -// null, -// apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, -// ResultConstant.FAIL_RESULT_PARAM_LACK); -// return this.returnMap; -// } -// loadInitSubmitOpinion(paramMap); -// if (this.opinionno.equals("")) { -// saveOpinion(); -// } else { -// modifyOpinion(); -// } -// -// } catch (Exception e) { -// logger.info("error >> " + e); -// setReturnMap( -// null, -// apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, -// ResultConstant.FAIL_RESULT_SUBMIT_MSG); -// return this.returnMap; -// } -// -// setReturnMap( -// paramMap, -// apx.com.amarsoft.als.base.constant.ResultConstant.SUCCESS_RESULT_CODE, -// ResultConstant.SUCCESS_RESULT_SUBMIT_MSG); -// -// return this.returnMap; -// } -// -// @Override -// public Map opinionSubmit(HttpServletRequest request, -// Transaction sqlca) { -// return submitProccess(request, sqlca); -// } - - /** - * 用户代办已办 查询项目意见 - */ -// @Override -// public Map acquisitionOpinion(HttpServletRequest request, -// Transaction sqlca) { -// if (!validateReqPara(request, -// new Exception().getStackTrace()[0].getMethodName())) { -// setReturnMap( -// null, -// apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, -// ResultConstant.FAIL_RESULT_PARAM_LACK); -// return this.returnMap; -// } -// loadAcquisitionOpinion(request, sqlca); -// List> mapList = new ArrayList>(); -// int num = this.limit; -// int index = Integer.valueOf(this.pageindex) - 1; -// int pageIndexStart = (index) * num; -// int pageIndexEnd = (index + 1) * num; -// if (this.opinionList == null) { -// setReturnMap( -// null, -// apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, -// "出现异常请联系管理员!"); -// return this.returnMap; -// } -// for (int i = pageIndexStart; i < pageIndexEnd; i++) { -// if (i > (this.opinionList.size() - 1)) { -// break; -// } -// if (Integer.valueOf(this.pageindex) < 1) { -// break; -// } -// if (this.opinionList.size() % this.limit == 0) { -// if ((this.opinionList.size() / this.limit) < index) { -// break; -// } -// } else { -// if ((this.opinionList.size() / this.limit) + 1 < index) { -// break; -// } -// } -// Map map = new HashMap(); -// map.put("begintime", opinionList.get(i).getBeginTime()); -// map.put("endtime", opinionList.get(i).getEndTime()); -// map.put("flowno", opinionList.get(i).getFlowNo()); -// map.put("opinion_right_phases", opinionList.get(i) -// .getOpinionRightPhases()); -// map.put("opinion_right_roles", opinionList.get(i) -// .getOpinionRightRoles()); -// map.put("opinion_right_type", opinionList.get(i) -// .getOpinionRightType()); -// map.put("orgname", opinionList.get(i).getOrgName()); -// map.put("phaseaction", opinionList.get(i).getPhaseAction()); -// map.put("phasechoice", opinionList.get(i).getPhaseChoice()); -// map.put("phasename", opinionList.get(i).getPhaseName()); -// map.put("phaseno", opinionList.get(i).getPhaseNo()); -// map.put("phaseopinion", opinionList.get(i).getPhaseOpinion()); -// map.put("phaseopinion1", opinionList.get(i).getPhaseOpinion1()); -// map.put("phaseopinion2", opinionList.get(i).getPhaseOpinion2()); -// map.put("phaseopinion3", opinionList.get(i).getPhaseOpinion3()); -// map.put("serialno", opinionList.get(i).getSerialno()); -// map.put("username", opinionList.get(i).getUserName()); -// map.put("opinionno", opinionList.get(i).getOpinionno()); -// mapList.add(map); -// } -// Map body = new HashMap(); -// body.put("datas", mapList); -// -// setReturnMap( -// body, -// apx.com.amarsoft.als.base.constant.ResultConstant.SUCCESS_RESULT_CODE, -// ResultConstant.SUCCESS_RESULT_OPINION_MSG); -// return this.returnMap; -// } - -// private boolean validateParamNotBlank(String... paras) { -// for (String para : paras) { -// if (StringUtils.isBlank(para)) { -// return false; -// } -// } -// return true; -// } -// -// private boolean validateParamIsInt(String... paras) { -// for (String para : paras) { -// try { -// Integer iCheckValue = Integer.parseInt(para); -// if (iCheckValue instanceof Integer == false) { -// return false; -// } -// } catch (NumberFormatException e) { -// return false; -// } -// } -// return true; -// } -// -// private boolean validatePara(String... params) { -// for (String param : params) { -// if (StringUtils.isBlank(param)) { -// return false; -// } -// } -// return true; -// } -// -// private boolean validateReqPara(HttpServletRequest request, -// String methodName) { -// switch (methodName) { -// case "acquisitionOpinion": -// if (validateParamNotBlank(request.getParameter("objno"), -// request.getParameter("objtype"), -// request.getParameter("serialno"), -// request.getParameter("userid"), -// request.getParameter("pageindex"), -// request.getParameter("limit"))) { -// if (validateParamIsInt(request.getParameter("pageindex"), -// request.getParameter("limit"))) { -// return true; -// } -// } -// break; -// case "already": -// if (validateParamNotBlank(request.getParameter("userid"), -// request.getParameter("pageindex"), -// request.getParameter("limit"))) { -// if (validateParamIsInt(request.getParameter("pageindex"), -// request.getParameter("limit"))) { -// return true; -// } -// } -// break; -// // searchDetail -// case "searchDetailTemplate": -// if (validateParamNotBlank(request.getParameter("flowno"))) { -// return true; -// } -// break; -// case "searchDetail": -// if (validateParamNotBlank(request.getParameter("objno"), -// request.getParameter("dono"), -// request.getParameter("groupid"))) { -// return true; -// } -// break; -// default: -// break; -// } -// return false; -// } -// -// private void setReturnMap(Map body, String code, -// String message) { -// this.returnMap = new HashMap(); -// Map header = new HashMap(); -// header.put("code", code); -// header.put("message", message); -// this.returnMap.put("outline", header); -// if (body != null) { -// this.returnMap.put("content", body); -// } -// } - -// @Override -// public Map already(HttpServletRequest request, -// Transaction sqlca) { -// if (!validateReqPara(request, -// new Exception().getStackTrace()[0].getMethodName())) { -// setReturnMap( -// null, -// apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, -// ResultConstant.FAIL_RESULT_PARAM_LACK); -// return this.returnMap; -// } -// if (!validateParamIsInt(request.getParameter("pageindex"), -// request.getParameter("pageindex"))) { -// setReturnMap( -// null, -// apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, -// ResultConstant.FAIL_RESULT_PARAM_LACK); -// return this.returnMap; -// } -// loadInitAlready(request, sqlca); -// if (this.flowWorkList == null) { -// setReturnMap( -// null, -// apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, -// "用户没有具体绑定具体流程"); -// return this.returnMap; -// } -// List> mapList = new ArrayList>(); -// int index; -// try { -// index = this.pageindex - 1; -// } catch (NumberFormatException e) { -// setReturnMap( -// null, -// apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, -// ResultConstant.FAIL_RESULT_PARAM_LACK); -// return this.returnMap; -// } -// int pageIndexStart = index * limit; -// int pageIndexEnd = (index + 1) * limit; -// for (int i = pageIndexStart; i < pageIndexEnd; i++) { -// if (i > (flowWorkList.size() - 1)) { -// break; -// } -// if (Integer.valueOf(this.pageindex) < 1) { -// break; -// } -// if (flowWorkList.size() % this.limit == 0) { -// if ((flowWorkList.size() / this.limit) < index) { -// break; -// } -// } else { -// if ((flowWorkList.size() / this.limit) + 1 < index) { -// break; -// } -// } -// Map map = new HashMap(); -// map.put("begintime", flowWorkList.get(i).getBegintime()); -// map.put("flowname", flowWorkList.get(i).getFlowname()); -// map.put("phasename", flowWorkList.get(i).getPhasename()); -// map.put("projname", flowWorkList.get(i).getProjname()); -// map.put("objectno", flowWorkList.get(i).getObjectno()); -// map.put("objecttype", flowWorkList.get(i).getObjecttype()); -// map.put("serialno", flowWorkList.get(i).getSerialno()); -// map.put("phasetype", flowWorkList.get(i).getPhasetype()); -// map.put("flowno", flowWorkList.get(i).getFlowno()); -// map.put("phaseno", flowWorkList.get(i).getPhaseno()); -// String ab1 = flowWorkList.get(i).getAttribute1() == null ? "" -// : flowWorkList.get(i).getAttribute1(); -// if (ab1.indexOf("viewDetail") > -1) { -// map.put("viewDetail", true); -// } else { -// map.put("viewDetail", false); -// } -// -// mapList.add(map); -// } -// Map body = new HashMap(); -// body.put("datas", mapList); -// setReturnMap( -// body, -// apx.com.amarsoft.als.base.constant.ResultConstant.SUCCESS_RESULT_CODE, -// ResultConstant.SUCCESS_RESULT_ALREADY_ALL_MSG); -// return this.returnMap; -// } - -// private String getAppFlowno(Transaction sqlca) { -// String sql = "SELECT FLOWNAME FROM role_flow where roleid in (" -// + " SELECT roleid from user_role where userid=:USERID )"; -// ASResultSet rs = null; -// String str = ""; -// try { -// SqlObject sqlObject = new SqlObject(sql).setParameter("USERID", -// this.userid); -// rs = sqlca.getResultSet(sqlObject); -// while (rs.next()) { -// str += rs.getString("FLOWNAME") == null ? "" : rs -// .getString("FLOWNAME").toString().trim() -// + ","; -// } -// } catch (SQLException e) { -// ARE.getLog().error(e); -// } catch (Exception e) { -// ARE.getLog().error(e); -// } finally { -// if (rs != null) { -// try { -// rs.getStatement().close(); -// rs = null; -// } catch (SQLException e) { -// ARE.getLog().error(e); -// } -// } -// try { -// sqlca.commit(); -// } catch (JBOException e) { -// return ""; -// } -// } -// -// if (!str.equals("")) { -// String[] flow = str.split(","); -// str = "AND ("; -// int i = 1; -// for (String str1 : flow) { -// str += "o.flowno LIKE '%" + str1 + "%'"; -// if (i < flow.length) { -// str += " or "; -// } -// i++; -// } -// str += ") "; -// } -// -// return str; -// } -// -// private void loadInitAlready(HttpServletRequest request, Transaction sqlca) { -// this.userid = ""; -// this.userid = request.getParameter("userid").toString(); -// this.pageindex = 0; -// this.pageindex = Integer.valueOf(request.getParameter("pageindex")); -// this.limit = 0; -// this.limit = Integer.valueOf(request.getParameter("limit")); -// this.flowWorkList = null; -// this.flowWorkManager = null; -// String flowno = getAppFlowno(sqlca); -// if (StringUtils.isBlank(flowno)) { -// return; -// } -// StringBuffer sb = new StringBuffer("SELECT "); -// sb.append("O.SERIALNO,O.OBJECTNO,O.OBJECTTYPE,O.RELATIVESERIALNO,O.FLOWNO,O.PHASENO,O.PHASETYPE, "); -// sb.append("O.APPLYTYPE,O.USERID,O.USERNAME,O.ORGID,O.ORGNAME,FLOW_BUSSINESS_OBJECT.flow_unid, "); -// sb.append("FLOW_BUSSINESS_OBJECT.proj_id,FLOW_BUSSINESS_OBJECT.contract_id,FLOW_BUSSINESS_OBJECT.flow_key, "); -// sb.append("FLOW_BUSSINESS_OBJECT.proj_name,O.FLOWNAME,O.PHASENAME,O.BEGINTIME, "); -// sb.append("FLOW_BUSSINESS_OBJECT.InputTime,O.ENDTIME, m.ATTRIBUTE1, m.ATTRIBUTE7, m.OPINIONSREQUIRED, '' AS ACTION "); -// sb.append("FROM "); -// sb.append("flow_task O,flow_bussiness_object FLOW_BUSSINESS_OBJECT, FLOW_MODEL m "); -// sb.append("WHERE ").append( -// "O.OBJECTNO=FLOW_BUSSINESS_OBJECT.flow_unid "); -// sb.append(" AND o.flowno=m.flowno AND o.phaseno=m.phaseno "); -// sb.append("AND O.endtime IS NOT NULL "); -// sb.append("AND (O.UserID=:userId OR O.agentUserID=:userId) "); -// sb.append(flowno); -// sb.append("ORDER BY "); -// sb.append("O.ENDTIME DESC"); -// loadTransaction2(sqlca, sb.toString()); -// this.flowWorkList = this.flowWorkManager.searchFlowWorkPending( -// this.userid, ""); -// } - -// @Override -// public Map initDisplayForAdd(HttpServletRequest request, -// Transaction sqlca) { -// String objno = request.getParameter("objno"); -// Map body = new HashMap(); -// try { -// // 汇总评审委员意见 -// String sql = "SELECT getUserName(inputuserid) commissioner,getItemName('projCreditresult',result_type)" -// + " result,opinion FROM PROJ_RESULT_INFO_TEMP WHERE flow_unid=:flow_unid and (manager_veto is null or manager_veto = '')"; -// SqlObject asql = new SqlObject(sql); -// asql.setParameter("flow_unid", objno); -// Transaction Sqlca = Transaction.createTransaction("als"); -// ASResultSet rs = Sqlca.getASResultSet(asql); -// String poolconclusion = ""; -// while (rs.next()) { -// if (poolconclusion.length() > 0) -// poolconclusion += "\n"; -// poolconclusion += "委员名:" + rs.getString("commissioner") -// + ";表决类型:" + rs.getString("result") + ";评审意见:" -// + rs.getString("opinion"); -// } -// body.put("poolconclusion", poolconclusion); -// } catch (Exception e) { -// logger.error("error:", e); -// setReturnMap( -// null, -// apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, -// "获取出现异常!"); -// return this.returnMap; -// } -// setReturnMap( -// body, -// apx.com.amarsoft.als.base.constant.ResultConstant.SUCCESS_RESULT_CODE, -// ""); -// return this.returnMap; -// } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/impl/OpinionServiceImpl.java b/src_app/apx/com/amarsoft/als/work/flow/service/impl/OpinionServiceImpl.java deleted file mode 100644 index 7462b702c..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/impl/OpinionServiceImpl.java +++ /dev/null @@ -1,332 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service.impl; - -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.jbo.FlowObjectJbo; -import apx.com.amarsoft.als.base.jbo.UserInfoJbo; -import apx.com.amarsoft.als.base.jbo.impl.FlowObjectJboImpl; -import apx.com.amarsoft.als.base.jbo.impl.UserInfoJboImpl; -import apx.com.amarsoft.als.base.util.BizObjectUtil; -import apx.com.amarsoft.als.base.util.DateUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.work.flow.service.OpinionService; - -import com.amarsoft.app.lc.workflow.action.SignOpinionAction; -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.are.util.StringFunction; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -public class OpinionServiceImpl implements OpinionService { - private static Log logger = ARE.getLog(); - FlowObjectJbo flowObjectJbo = new FlowObjectJboImpl(); - - public Map acquisitionOpinion(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - try { - Map body = new HashMap(); - // 获取参数 - String sScope = request.getParameter("scope") == null ? "" - : request.getParameter("scope"); - String sObjectType = request.getParameter("objtype"); - String sObjectNo = request.getParameter("objno"); - String sCurFlowNo = request.getParameter("flowno"); - String sCurPhaseNo = request.getParameter("phaseno"); - String sSerialNo = request.getParameter("serialno"); - String sUserId = (String) request.getSession().getAttribute( - "userid"); - // 将空值转化为空字符串 - if (sObjectType == null) - sObjectType = ""; - if (sObjectNo == null) - sObjectNo = ""; - if (sCurFlowNo == null) - sCurFlowNo = ""; - if (sCurPhaseNo == null) - sCurPhaseNo = ""; - if (sSerialNo == null) - sSerialNo = ""; - List> list = new ArrayList>(); - body.put("datas", list); - if ("self".equals(sScope)) { - BizObject flowopinion = flowObjectJbo.getFlowOpinion(tx, - sSerialNo, sUserId); - if (flowopinion != null) { - BizObjectUtil util = new BizObjectUtil(); - Map map = util - .bizObject2MapValue(flowopinion); - list.add(map); - } - BizObject flowModel = flowObjectJbo.getFlowModel(tx, - sCurFlowNo, sCurPhaseNo); - String sNodeType = flowModel.getAttribute("NODETYPE") == null ? "" - : flowModel.getAttribute("NODETYPE").toString(); - if ("MEETING".equals(sNodeType)) { - body.put("enVisiblePhaseChoice", true); - body.put("enRequiredPhaseChoice", true); - } else { - - body.put("enVisiblePhaseChoice", false); - body.put("enVisiblePhaseChoice", false); - } - } else { - String sOpinionRightType = "", sOpinionRightPhases = "", sOpinionRightRoles = "", sPhaseAction = ""; - - boolean bRolePrivilege = false; // 哪些阶段能看 - boolean bPhasePrivilege = false;// - boolean bPhaseMatch = false;// 判断当前意见所处阶段是否在对应的特权阶段 - - String sFlowNo = "", sPhaseNo = ""; - String sSelfOpinionPhase = ""; - BizObject flowModel = flowObjectJbo.getFlowModel(tx, sFlowNo, - sPhaseNo); - if (flowModel != null) - sSelfOpinionPhase = flowModel.getAttribute("Attribute6") - .getString(); - - List opinionList = flowObjectJbo.getFlowTask(tx, - sObjectNo, sObjectType, sSelfOpinionPhase); - - for (BizObject opinionBo : opinionList) { - sOpinionRightType = opinionBo.getAttribute( - "OpinionRightType").getString(); // 查看意见方式 - // all_except(排除一些阶段) - // none_except(选择一些阶段) - sOpinionRightPhases = opinionBo.getAttribute( - "OpinionRightPhases").getString();// 不同查看意见方式对应的阶段 - sOpinionRightRoles = opinionBo.getAttribute( - "OpinionRightRoles").getString(); // 意见查看特权角色 - sPhaseAction = opinionBo.getAttribute("PhaseAction") - .getString(); - // 将空值转化为空字符串 - if (sOpinionRightType == null) - sOpinionRightType = ""; - if (sOpinionRightType.length() == 0) { - sOpinionRightType = "all_except"; - } - if (sOpinionRightPhases == null) - sOpinionRightPhases = ""; - if (sOpinionRightRoles == null) - sOpinionRightRoles = ""; - if (sPhaseAction == null) - sPhaseAction = ""; - - // 1、判断该用户是否拥有特权角色 - if (sOpinionRightRoles.equals("")) - bRolePrivilege = false; - else { - UserInfoJbo userJbo = new UserInfoJboImpl(); - List rolebos = userJbo.findRoleByUserId(tx, - sUserId); - List roles = new ArrayList(); - for (BizObject rolebo : rolebos) - roles.add(rolebo.getAttribute("ROLEID") == null ? "" - : rolebo.getAttribute("ROLEID").toString()); - for (int i = 0; i < roles.size(); i++) { - if (sOpinionRightRoles.indexOf(roles.get(i)) >= 0) { - bRolePrivilege = true; - break; - } - } - } - - // 2、判断当前意见所处阶段是否在模型对应的特权阶段 - if (sOpinionRightPhases.equals("")) - bPhaseMatch = false; - else { - int iCountPhases = StringFunction.getSeparateSum( - sOpinionRightPhases, ","); - - String sTempFlowPhase; - for (int i = 0; i < iCountPhases; i++) { - sTempFlowPhase = StringFunction.getSeparate( - sOpinionRightPhases, ",", i + 1); - if (sTempFlowPhase.indexOf(".") < 0) - sTempFlowPhase = sCurFlowNo + "." - + sTempFlowPhase; - if (sTempFlowPhase.equals(sCurFlowNo + "." - + sCurPhaseNo)) { - bPhaseMatch = true; - break; - } - } - } - - // 3、根据查看意见方式的不同,判断是否可以显示 - if (sOpinionRightType.equals("") - || sOpinionRightType.equals("none_except")) { - bPhasePrivilege = bPhaseMatch; - } else { - bPhasePrivilege = !bPhaseMatch; - } - - // 4、最终判断是否显示意见,如果不需要显示,则继续判断下一条意见 - // 该用户是否具有特权角色、该阶段意见是否属于该意见可查看阶段、该阶段是否属于 - if (!bPhasePrivilege && !bRolePrivilege - && sPhaseAction.indexOf("补充资料") < 0) - continue; - BizObjectUtil util = new BizObjectUtil(); - Map opinionMap = (Map) util - .bizObject2MapValue(opinionBo); - opinionMap.put("opinionno", sUserId); - list.add(opinionMap); - } - } - ReturnMapUtil.setReturnMap(body, - ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } catch (JBOException e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, - ResultConstant.FAIL_ERROR_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map opinionSubmit(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - return submitProccess(request, sqlca, tx); - } - - @SuppressWarnings({ "unchecked", "deprecation" }) - private Map submitProccess(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - FileItemFactory factory = new DiskFileItemFactory(); - FileUpload fu = new FileUpload(factory); - List list = (List) fu.parseRequest(request); - Map fieldMap = new HashMap(); - for (FileItem item : list) { - if (item.isFormField()) { - fieldMap.put(item.getFieldName(), - URLDecoder.decode(item.getString("UTF-8"), "UTF-8")); - } - } - if (fieldMap.size() > 0) { - ASUser asUser = (ASUser) request.getSession() - .getAttribute("ASUser"); - String sSerialno = fieldMap.get("serialno") == null ? "" : fieldMap - .get("serialno").toString(); - String sDate = DateUtil.getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss"); - String sOpinionno = asUser.getUserID(); - String sPhasechoice = fieldMap.get("phasechoice") == null ? "" - : fieldMap.get("phasechoice").toString(); - String sPhaseopinion = fieldMap.get("phaseopinion") == null ? "" - : fieldMap.get("phaseopinion").toString(); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_OPINION"); - tx.join(bom); - BizObject flowopinion = bom - .createQuery( - "SerialNo=:SerialNo and OpinionNo=:OpinionNo") - .setParameter("SerialNo", sSerialno) - .setParameter("OpinionNo", sOpinionno) - .getSingleResult(false); - if (flowopinion == null) { - flowopinion = bom.newObject(); - flowopinion.setAttributeValue("SERIALNO", sSerialno); - flowopinion.setAttributeValue("OPINIONNO", sOpinionno); - flowopinion.setAttributeValue("PHASECHOICE", sPhasechoice); - flowopinion - .setAttributeValue("PHASEOPINION", sPhaseopinion); - flowopinion - .setAttributeValue("INPUTORG", asUser.getOrgID()); - flowopinion.setAttributeValue("INPUTUSER", - asUser.getUserID()); - flowopinion.setAttributeValue("INPUTTIME", sDate); - bom.saveObject(flowopinion); - } else { - BizObjectQuery boq = bom - .createQuery( - "UPDATE o SET UPDATEUSER=:UPDATEUSER, UPDATETIME=:UPDATETIME, PHASECHOICE=:PHASECHOICE, " - + "PHASEOPINION=:PHASEOPINION WHERE SerialNo=:SerialNo and OpinionNo=:OpinionNo") - .setParameter("UPDATEUSER", asUser.getUserID()) - .setParameter("UPDATETIME", sDate) - .setParameter("PHASECHOICE", sPhasechoice) - .setParameter("PHASEOPINION", sPhaseopinion) - .setParameter("SerialNo", sSerialno) - .setParameter("OpinionNo", sOpinionno) - ; - - boq.executeUpdate(); - } - tx.commit(); - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.SUCCESS_RESULT_CODE, - "意见提交成功"); - return ReturnMapUtil.getReturnMap(); - } catch (JBOException e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, - "意见提交失败"); - return ReturnMapUtil.getReturnMap(); - } - } else { - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, - ResultConstant.FAIL_RESULT_PARAM_LACK); - return ReturnMapUtil.getReturnMap(); - } - } - - public Map removeSelfOpinion(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) throws Exception { - String sSerialNo = request.getParameter("serialno"); - String sOpinionNo = request.getParameter("opinionno"); - if (sSerialNo == null) - sSerialNo = ""; - if (sOpinionNo == null) - sOpinionNo = ""; - SignOpinionAction opinionAction = new SignOpinionAction(); - opinionAction.setOpinoinNo(sOpinionNo); - opinionAction.setSerialNo(sSerialNo); - try { - opinionAction.deleteSignOpinion(tx); - tx.commit(); - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.SUCCESS_RESULT_CODE, - "删除签署意见成功"); - return ReturnMapUtil.getReturnMap(); - } catch (JBOException e) { - logger.error(e); - tx.rollback(); - ReturnMapUtil - .setReturnMap( - null, - apx.com.amarsoft.als.base.constant.ResultConstant.FAIL_RESULT_CODE, - "删除签署意见失败"); - return ReturnMapUtil.getReturnMap(); - } - } -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/service/impl/PendingBusinessServiceImpl.java b/src_app/apx/com/amarsoft/als/work/flow/service/impl/PendingBusinessServiceImpl.java deleted file mode 100644 index fbdffc6c5..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/service/impl/PendingBusinessServiceImpl.java +++ /dev/null @@ -1,136 +0,0 @@ -package apx.com.amarsoft.als.work.flow.service.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang.StringUtils; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.jbo.FlowInfoJbo; -import apx.com.amarsoft.als.base.jbo.FlowObjectJbo; -import apx.com.amarsoft.als.base.jbo.impl.FlowInfoJboImpl; -import apx.com.amarsoft.als.base.jbo.impl.FlowObjectJboImpl; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; -import apx.com.amarsoft.als.work.flow.service.PendingBusinessService; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.Transaction; - -public class PendingBusinessServiceImpl implements PendingBusinessService { - private static Log logger = ARE.getLog(); - FlowInfoJbo flowInfoJbo = new FlowInfoJboImpl(); - FlowObjectJbo flowObjectJbo = new FlowObjectJboImpl(); - - public Map allListPending(HttpServletRequest request, - Transaction sqlca, JBOTransaction tx) { - Map body = new HashMap(); - String sFlowNos = ""; - List commissionList = new ArrayList(); - try { - String sFlowNo = request.getParameter("flowno"); - String sUserId = (String) request.getSession().getAttribute( - "userid"); - if (StringUtils.isNotBlank(sFlowNo)) { - sFlowNos = "'" + sFlowNo + "'"; - commissionList = flowObjectJbo - .getAppCommissionList(tx, sUserId, sFlowNos, ""); - } else { - List appFlowNo = flowInfoJbo.findAllAppFlowNo(tx, - sUserId); - for (BizObject bo : appFlowNo) { - if (bo.getAttribute("flowname") != null) - sFlowNos += bo.getAttribute("flowname").toString() - + ","; - } - String[] aFlowNos = sFlowNos.split(","); - sFlowNos = ""; - for (String str : aFlowNos) { - sFlowNos += "'" + str + "',"; - } - if (sFlowNos.length() > 0) { - sFlowNos = sFlowNos.substring(0, sFlowNos.length() - 1); - } - commissionList = flowObjectJbo - .getAppCommissionList(tx, sUserId, sFlowNos, ""); - } - String sLimit = request.getParameter("limit"); - String sPageIndex = request.getParameter("pageindex"); - if (sLimit == null || sLimit.length() < 1) - sLimit = "20"; - if (sPageIndex == null || sPageIndex.length() < 1) - sPageIndex = "1"; - int num; - int index; - num = Integer.valueOf(sLimit); - index = Integer.valueOf(sPageIndex) - 1; - int pageIndexStart = (index) * num; - int pageIndexEnd = (index + 1) * num; - - List> list = new ArrayList>(); - body.put("datas", list); - for (int j = pageIndexStart; j < pageIndexEnd; j++) { - if (j > (commissionList.size() - 1)) { - break; - } - if (Integer.valueOf(sPageIndex) < 1) { - break; - } - if (commissionList.size() % num == 0) { - if ((commissionList.size() / num) < index) { - break; - } - } else { - if ((commissionList.size() / num) + 1 < index) { - break; - } - } - BizObject bo = commissionList.get(j); - Map map = new HashMap(); - map.put("begintime", bo.getAttribute("BEGINTIME").getValue()); - map.put("flowname", bo.getAttribute("FLOWNAME").getValue()); - map.put("phasename", bo.getAttribute("PHASENAME").getValue()); - map.put("projname", bo.getAttribute("proj_name").getValue()); - map.put("objectno", bo.getAttribute("OBJECTNO").getValue()); - map.put("objecttype", bo.getAttribute("OBJECTTYPE").getValue()); - map.put("serialno", bo.getAttribute("SERIALNO").getValue()); - map.put("phasetype", bo.getAttribute("PHASETYPE").getValue()); - map.put("flowno", bo.getAttribute("FLOWNO").getValue()); - map.put("phaseno", bo.getAttribute("PHASENO").getValue()); - map.put("projectid", bo.getAttribute("proj_id").getValue()); - map.put("doSubmit", - bo.getAttribute("ATTRIBUTE1") == null ? false : (bo - .getAttribute("ATTRIBUTE1").toString() - .indexOf("doSubmit") > -1 ? true : false)); - map.put("backStep", - bo.getAttribute("ATTRIBUTE1") == null ? false : (bo - .getAttribute("ATTRIBUTE1").toString() - .indexOf("backStep") > -1 ? true : false)); - map.put("viewDetail", - bo.getAttribute("ATTRIBUTE1") == null ? false : (bo - .getAttribute("ATTRIBUTE1").toString() - .indexOf("viewDetail") > -1 ? true : false)); - map.put("processmode", bo.getAttribute("ATTRIBUTE7").getValue()); - map.put("opinionSreQuired", bo.getAttribute("OPINIONSREQUIRED") - .getValue()); - list.add(map); - } - ReturnMapUtil.setReturnMap(body, - ResultConstant.SUCCESS_RESULT_CODE, ""); - return ReturnMapUtil.getReturnMap(); - } catch (JBOException e) { - logger.error(e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "获取代办列表失败"); - return ReturnMapUtil.getReturnMap(); - } - } - -} diff --git a/src_app/apx/com/amarsoft/als/work/flow/util/FlowSubmitCheckUtil.java b/src_app/apx/com/amarsoft/als/work/flow/util/FlowSubmitCheckUtil.java deleted file mode 100644 index fa604933a..000000000 --- a/src_app/apx/com/amarsoft/als/work/flow/util/FlowSubmitCheckUtil.java +++ /dev/null @@ -1,197 +0,0 @@ -package apx.com.amarsoft.als.work.flow.util; - -import org.apache.commons.lang.StringUtils; - -import com.amarsoft.app.flow.FlowAction; -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.log.Log; - -public class FlowSubmitCheckUtil { - private static Log logger = ARE.getLog(); - - private String sFlowName; - private String sTaskNo; - private String sObjectType; - private String sObjectNo; - private String sFlowNo; - private String sPhaseNo; - private String sUserId; - private FlowAction action; - - public FlowSubmitCheckUtil() { - this.sFlowName = ""; - this.sFlowNo = ""; - this.sObjectNo = ""; - this.sObjectType = ""; - this.sPhaseNo = ""; - this.sTaskNo = ""; - this.sUserId = ""; - this.action = new FlowAction(); - } - - public void init(String flowName, String flowNo, String objectNo, - String objectType, String phaseNo, String taskNo, String userId) { - this.sFlowName = flowName; - this.sFlowNo = flowNo; - this.sObjectNo = objectNo; - this.sObjectType = objectType; - this.sPhaseNo = phaseNo; - this.sTaskNo = taskNo; - this.sUserId = userId; - this.action.setObjectType(this.sObjectType); - this.action.setObjectNo(this.sObjectNo); - this.action.setTaskNo(this.sTaskNo); - this.action.setFlowNo(this.sFlowNo); - this.action.setPhaseNo(this.sPhaseNo); - this.action.setUserID(this.sUserId); - } - - public String getsFlowName() { - return sFlowName; - } - - public String getsTaskNo() { - return sTaskNo; - } - - public String getsObjectType() { - return sObjectType; - } - - public String getsObjectNo() { - return sObjectNo; - } - - public String getsFlowNo() { - return sFlowNo; - } - - public String getsPhaseNo() { - return sPhaseNo; - } - - public String getsUserId() { - return sUserId; - } - - public void setsFlowName(String sFlowName) { - this.sFlowName = sFlowName; - } - - public void setsTaskNo(String sTaskNo) { - this.sTaskNo = sTaskNo; - } - - public void setsObjectType(String sObjectType) { - this.sObjectType = sObjectType; - } - - public void setsObjectNo(String sObjectNo) { - this.sObjectNo = sObjectNo; - } - - public void setsFlowNo(String sFlowNo) { - this.sFlowNo = sFlowNo; - } - - public void setsPhaseNo(String sPhaseNo) { - this.sPhaseNo = sPhaseNo; - } - - public void setsUserId(String sUserId) { - this.sUserId = sUserId; - } - - /** - * 根据objectType,objectNo从FLOW_TASK中查找最新的phaseNo,用于申请页面提交时检查申请记录是否已提交 - * - * @return curPhaseNo--流程最新的phaseNo - */ - public boolean checkNewPhaseNo(JBOTransaction trans) { - try { - String curPhaseinfo = this.action.getCurPhaseNo(trans); - if (!this.sPhaseNo.trim().equals(curPhaseinfo)) { - return false; - } - } catch (Exception e) { - logger.error("FlowSubmitCheckUtil >> checkNewPhaseNo > " + e); - return false; - } - return true; - } - - /** - * 是否已提交 - * @return true 未提交 false 已提交 - */ - - public boolean checkIsCommited(JBOTransaction trans) { - try { - String commited = this.action.isCommited(trans); - if(commited.equals("no")) { - return true; - } - } catch (Exception e) { - logger.error("FlowSubmitCheckUtil >> checkTaskIsExists > " - + e); - return false; - } - return false; - } - - /** - * 根据flow_object相关数据获取未完成的flow_task流水号 - * - * @return taskSerialNo - */ - public boolean checkTaskIsExists(JBOTransaction trans) { - try { - String taskno = this.action.getUnfinishedTaskNo(trans); - if (StringUtils.isBlank(taskno)) { - return false; - } - return true; - } catch (Exception e) { - logger.error("FlowSubmitCheckUtil >> checkTaskIsExists > " - + e); - return false; - } - } - - /** - * 1. 检测是否需要签署意见提交或退回 - * 2. 如果必须 签署意见 -根据taskNo检查是否已经签署意见 - * - * @return true-有意见; false-无意见; - */ - public boolean checkIsOpitionsRequire(JBOTransaction trans) { - try { - if (this.action.getIsOpitionsRequire(trans).equals("Y")) { - if (!this.action.isSignOpinion(trans).equals("yes")) { - return false; - } - } - } catch (Exception e) { - logger.error("FlowSubmitCheckUtil >> checkIsOpitionsRequire > " - + e); - return false; - } - return true; - } - - /** - * getIsStepLastUser - * @param trans - * @return String - */ - public String checkIsStepLastUser(JBOTransaction trans) { - try { - return this.action.getIsStepLastUser(trans); - } catch (Exception e) { - logger.error("FlowSubmitCheckUtil >> checkIsStepLastUser > " - + e); - return null; - } - } -} diff --git a/src_app/cn/coyoteam/aweresf/annotation/AutoBind.java b/src_app/cn/coyoteam/aweresf/annotation/AutoBind.java deleted file mode 100644 index 55ffb7d9d..000000000 --- a/src_app/cn/coyoteam/aweresf/annotation/AutoBind.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.coyoteam.aweresf.annotation; - - -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -@Target({java.lang.annotation.ElementType.PARAMETER}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface AutoBind{ - String value() default ""; -} diff --git a/src_app/cn/coyoteam/aweresf/consts/AWEConst.java b/src_app/cn/coyoteam/aweresf/consts/AWEConst.java deleted file mode 100644 index efadc63c4..000000000 --- a/src_app/cn/coyoteam/aweresf/consts/AWEConst.java +++ /dev/null @@ -1,7 +0,0 @@ -package cn.coyoteam.aweresf.consts; - -public class AWEConst { - public static final String KEY_NO_USE_SESSION = "NoUseSession"; - public static final String KEY_WEB_API = "WebApiPage"; - public static final String KEY_REQ_URI = "ReqURI"; -} diff --git a/src_app/cn/coyoteam/aweresf/consts/SessionConst.java b/src_app/cn/coyoteam/aweresf/consts/SessionConst.java deleted file mode 100644 index eed3ac313..000000000 --- a/src_app/cn/coyoteam/aweresf/consts/SessionConst.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.coyoteam.aweresf.consts; - -public class SessionConst { - - public static final String KEY_TOKEN_SESSION = "TokenSession"; - public static final String KEY_SMS_REQUIRE = "SMSRequired"; - public static final String KEY_TOKEN_HOLD_TIME = "TokenHoldTime"; - public static final String KEY_TOKEN = "token"; - - public static final String KEY_CUR_ARC = "CurARC"; - -} diff --git a/src_app/cn/coyoteam/aweresf/consts/XWConst.java b/src_app/cn/coyoteam/aweresf/consts/XWConst.java deleted file mode 100644 index 833020cad..000000000 --- a/src_app/cn/coyoteam/aweresf/consts/XWConst.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.coyoteam.aweresf.consts; - -/** - * DW/OW的一些全局常量 - * @author cytsir - * - */ -public class XWConst { - public static final String WEB_API_COMP= "WebApiComponent"; - public static final String XWURI= "XWURI"; - public static final String KEY_XW_INTERCEPT_CONFIG= "XWInterceptConfig"; -} diff --git a/src_app/cn/coyoteam/aweresf/util/BeanUtils.java b/src_app/cn/coyoteam/aweresf/util/BeanUtils.java deleted file mode 100644 index bcef5575d..000000000 --- a/src_app/cn/coyoteam/aweresf/util/BeanUtils.java +++ /dev/null @@ -1,133 +0,0 @@ -package cn.coyoteam.aweresf.util; - - -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.beanutils.PropertyUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * JavaBean操作工具 - * @author yangsong - * - */ -public class BeanUtils { - private static Logger logger = LoggerFactory.getLogger(BeanUtils.class); - - /** - * 复制javaBean属性 - * @param source 数据源对象 - * @param target 复制对的目标对象 - */ - public static void copyProperties(Object source, Object target){ - try { - PropertyUtils.copyProperties(target,source); - } catch (IllegalAccessException e) { - logger.warn("copyProperties error ", e); - } catch (InvocationTargetException e) { - logger.warn("copyProperties error ", e); - } catch (NoSuchMethodException e) { - logger.warn("copyProperties error ", e); - } - } - - /** - * JavaBean转为Map - * @param bean - * @return - * @throws IntrospectionException - * @throws IllegalAccessException - * @throws InvocationTargetException - */ - public static final Map bean2Map(Object bean) - throws IntrospectionException, IllegalAccessException, InvocationTargetException { - Map returnMap = new HashMap(); - BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass()); - PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); - for (int i = 0; i< propertyDescriptors.length; i++) { - PropertyDescriptor descriptor = propertyDescriptors[i]; - String propertyName = descriptor.getName(); - if (!propertyName.equals("class")) { - Method readMethod = descriptor.getReadMethod(); - Object result = readMethod.invoke(bean, new Object[0]); - if (result != null) { - returnMap.put(propertyName, result); - } else { - returnMap.put(propertyName, ""); - } - } - } - return returnMap; - } - - /** - * MAPl转为JavaBean - * @param map - * @param obj - */ - public static void map2Bean(Map map, Object obj) { - - try { - BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); - PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); - - for (PropertyDescriptor property : propertyDescriptors) { - String key = property.getName(); - - if (map.containsKey(key)) { - Object value = map.get(key); - // 得到property对应的setter方法 - Method setter = property.getWriteMethod(); - setter.invoke(obj, value); - } - - } - - } catch (Exception e) { - e.printStackTrace(); - logger.error("",e); - } - - - } - /** - * MAPl转为JavaBean - * @param map - * @param clazz - */ - public static void map2Bean(Map map, Class clazz) { - - try { - BeanInfo beanInfo = Introspector.getBeanInfo(clazz); - Object obj = clazz.newInstance(); - PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); - - for (PropertyDescriptor property : propertyDescriptors) { - String key = property.getName(); - - if (map.containsKey(key)) { - Object value = map.get(key); - // 得到property对应的setter方法 - Method setter = property.getWriteMethod(); - setter.invoke(obj, value); - } - - } - - } catch (Exception e) { - logger.error("",e); - } - - return; - - } - -} diff --git a/src_app/cn/coyoteam/aweresf/util/StringHelper.java b/src_app/cn/coyoteam/aweresf/util/StringHelper.java deleted file mode 100644 index 3299bb7bd..000000000 --- a/src_app/cn/coyoteam/aweresf/util/StringHelper.java +++ /dev/null @@ -1,210 +0,0 @@ -package cn.coyoteam.aweresf.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import com.amarsoft.are.lang.StringX; - -/** - * 字串通用工具处理类 - * @author yangsong - * @date 2014/06/18 - * - */ -public class StringHelper { - - /** - * 空串 - * @param s 字串 - * @param s1 字串为空时,返回的字串 - * @return - */ - public static String nvl(String s,String s1){ - if(StringX.isEmpty(s))return s1; - return s; - } - - /** - * 连接字串 - * @param strList - * @param delimiter - * @return - */ - public static String join(List strList,String delimiter){ - StringBuilder sb = new StringBuilder(); - for(int i=0;i sortSimilarity(String srcStr,double minRatio,String ...strList){ - return sortSimilarity(srcStr,minRatio,Arrays.asList(strList)); - } - /** - * 相似度匹配排序,比较和源字串的相似度,相似度最高的放到最前 - * @param srcStr 源字串 - * @param minRatio 最小匹配度,低于此值的,将不会出现到返回值中 - * @param strList 目标字串列表 - * @return - */ - public static List sortSimilarity(String srcStr,double minRatio,List strList){ - List simList = new ArrayList(); - //筛选 - Map simMap = new HashMap(); - for(int i=0;i0){ - String s = getMaxKeyValue(simMap); - if(s!=null)simList.add(s); - } - - return simList; - } - - private static String getMaxKeyValue(Map simMap){ - if(simMap.size()==0)return null; - String max = ""; - Iterator iterator = simMap.keySet().iterator(); - while(iterator.hasNext()){ - String i = iterator.next(); - if(i.compareTo(max)>0){ - max = i; - } - } - String r = simMap.get(max); - simMap.remove(max); - return r; - } - - /** - * 把字符串数组转化成SQL语句中的IN条件。 - * 例如:list={1:"a",2:"b",3:"c"},转化成'a','b','c' - * @param list - * @return - */ - public static String getSqlFormatOfIn(List list){ - String returnStr = ""; - if (list == null) - return "''"; - - for(String item : list) - returnStr += "'" + item + "',"; - - if (returnStr.length() < 1) - return "''"; - - return returnStr.substring(0, returnStr.length() - 1); - } - - /** - * 把带有分隔符的字符串转化成SQL语句中的IN条件。 - * 例如:source="a,b,c",format=",",转化成'a','b','c' - * @param source - * @param format - * @return - */ - public static String getSqlFormatOfIn(String source, String format){ - if(StringX.isEmpty(format)) - format = ","; - return getSqlFormatOfIn(source.split(format)); - } - - /** - * 把字符串数组转化成SQL语句中的IN条件。 - * 例如:strs={"a","b","c"},转化成'a','b','c' - * @param strs - * @return - */ - public static String getSqlFormatOfIn(String[] strs){ - String returnStr = ""; - for(String item : strs) - returnStr += "'" + item + "',"; - - if (returnStr.length() < 1) - return "''"; - - return returnStr.substring(0, returnStr.length() - 1); - } -} diff --git a/src_app/cn/coyoteam/aweresf/web/als/ALSTokenSessionManager.java b/src_app/cn/coyoteam/aweresf/web/als/ALSTokenSessionManager.java deleted file mode 100644 index 87f52ab80..000000000 --- a/src_app/cn/coyoteam/aweresf/web/als/ALSTokenSessionManager.java +++ /dev/null @@ -1,281 +0,0 @@ -package cn.coyoteam.aweresf.web.als; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.sql.SQLException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import apx.com.amarsoft.als.user.logon.model.LoginUser; -import cn.coyoteam.aweresf.configure.GlobalConfigure; -import cn.coyoteam.aweresf.consts.SessionConst; -import cn.coyoteam.aweresf.model.Org; -import cn.coyoteam.aweresf.model.User; - -import com.amarsoft.aims.util.DateTool; -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASOrg; -import com.amarsoft.context.ASUser; - -public class ALSTokenSessionManager implements TokenSessionManager { - // 日志对象 - private static Log logger = ARE.getLog(); - private Transaction sqlca = null; - - public Transaction getSqlca() { - return sqlca; - } - - public void setSqlca(Transaction sqlca) { - this.sqlca = sqlca; - } - - public void dropTokenSession(String sUserId) { - String sql = "delete from TOKEN_SESSION where user_id=:userid"; - try { - SqlObject sqlObject = new SqlObject(sql); - sqlObject.setParameter("userid", sUserId); - sqlca.executeSQL(sqlObject); - sqlca.commit(); - } catch (Exception e) { - try { - sqlca.rollback(); - } catch (JBOException e1) { - ARE.getLog().error(e1); - } - ARE.getLog().error(e); - } - - } - - public void dropTokenSession(TokenSession tokenSession) { - String sql = "delete from TOKEN_SESSION where user_id=:userid"; - try { - SqlObject sqlObject = new SqlObject(sql); - sqlObject.setParameter("userid", tokenSession.getUserId()); - sqlca.executeSQL(sqlObject); - sqlca.commit(); - } catch (Exception e) { - try { - sqlca.rollback(); - } catch (JBOException e1) { - ARE.getLog().error(e1); - } - ARE.getLog().error(e); - } - - } - - public User getUser(TokenSession tokenSession) { - String uid = tokenSession.getUserId(); - - ASUser curUser = null; - try { - curUser = ASUser.getUser(uid, sqlca); - } catch (Exception e) { - ARE.getLog().error(e); - return null; - } - User user = new User(); - user.setUserId(curUser.getUserID()); - user.setUserName(curUser.getUserName()); - user.setStatus(curUser.getStatus()); - ASOrg curOrg = curUser.getBelongOrg(); - Org org = new Org(); - org.setOrgId(curOrg.getOrgID()); - org.setOrgName(curOrg.getOrgName()); - org.setOrgLevel(curOrg.getOrgLevel()); - org.setStatus(curOrg.getStatus()); - org.setSortNo(curOrg.getSortNo()); - user.setOrg(org); - - return user; - } - - public TokenSession getTokenSession(String token) { - String sql = "select * from TOKEN_SESSION where token = :token"; - ASResultSet rs = null; - TokenSession tokenSession = null; - try { - SqlObject sqlObject = new SqlObject(sql); - sqlObject.setParameter("token", token); - rs = sqlca.getResultSet(sqlObject); - if (rs.next()) { - tokenSession = new TokenSession(); - fillTokenSessionWithResultSet(tokenSession, rs); - } - } catch (SQLException e) { - ARE.getLog().error(e); - } catch (Exception e) { - ARE.getLog().error(e); - } finally { - if (rs != null) { - try { - rs.getStatement().close(); - rs = null; - } catch (SQLException e) { - ARE.getLog().error(e); - } - } - } - return tokenSession; - } - - /** - * 在支持单个用户多个登录的情况下,用于查询用户的会话 - * - * @param uid - * @return - */ - public List searchUsersTokenSession(String uid) { - String sql = "select * from TOKEN_SESSION where user_id = :userId"; - ASResultSet rs = null; - List tknSessionList = new ArrayList(); - try { - SqlObject sqlObject = new SqlObject(sql); - sqlObject.setParameter("userId", uid); - rs = sqlca.getResultSet(sqlObject); - while (rs.next()) { - TokenSession tokenSession = new TokenSession(); - fillTokenSessionWithResultSet(tokenSession, rs); - tknSessionList.add(tokenSession); - } - } catch (SQLException e) { - ARE.getLog().error(e); - } catch (Exception e) { - ARE.getLog().error(e); - } finally { - if (rs != null) { - try { - rs.getStatement().close(); - rs = null; - } catch (SQLException e) { - ARE.getLog().error(e); - } - } - } - return tknSessionList; - } - - private void fillTokenSessionWithResultSet(TokenSession tokenSession, - ASResultSet rs) throws SQLException { - tokenSession.setToken(rs.getString("token")); - tokenSession.setUserId(rs.getString("user_id")); - tokenSession.setDevId(rs.getString("dev_id")); - tokenSession.setDevOs(rs.getString("dev_os")); - tokenSession.setCreated(DateTool.parseString2Date(rs - .getString("created"))); - tokenSession.setExpireIn(DateTool.parseString2Date(rs - .getString("expire_in"))); - } - - private String getMD5Hex(byte[] buf) { - MessageDigest md5; - try { - md5 = MessageDigest.getInstance("MD5"); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - md5.update(buf); - byte[] tmp = md5.digest(); - StringBuilder sb = new StringBuilder(); - for (byte b : tmp) { - sb.append(Integer.toHexString(b & 0xff)); - } - return sb.toString().toUpperCase(); - } - - public TokenSession createTokenSession(String uid, - Map properties) { - String token = getMD5Hex(UUID.randomUUID().toString().getBytes()); - - String devId = properties.get("devId"); - String devOs = properties.get("devOs"); - - String tokenHoldTimeStr = GlobalConfigure.getInstance().getProperty( - SessionConst.KEY_TOKEN_HOLD_TIME); - if (tokenHoldTimeStr == null) - tokenHoldTimeStr = "-1"; - Integer tokenHoldTime = Integer.parseInt(tokenHoldTimeStr); - // 如果设置holdTime小于0,则给他一个长达三年的有效时间 - if (tokenHoldTime <= 0) { - tokenHoldTime = 3 * 365 * 24 * 3600; - } - - TokenSession tokenSession = new TokenSession(); - tokenSession.setUserId(uid); - tokenSession.setToken(token); - tokenSession.setDevId(devId); - tokenSession.setDevOs(devOs); - tokenSession.setCreated(new Date()); - - // 计算token失效时间 - Calendar expireTime = Calendar.getInstance(); - expireTime.setTime(tokenSession.getCreated()); - expireTime.add(Calendar.SECOND, tokenHoldTime); - - tokenSession.setExpireIn(expireTime.getTime()); - - try { - saveTokenSession(tokenSession); - } catch (Exception e) { - logger.error(e); - } - - return tokenSession; - } - - private void saveTokenSession(TokenSession tokenSession) throws Exception { - // 如果存在一个一样的session,则删除它 - TokenSession existsTokenSession = getTokenSession(tokenSession - .getToken()); - if (existsTokenSession != null) { - dropTokenSession(existsTokenSession); - } - // 如果同一个用户,还有其他会话,给中止掉 - List existsUserTknSessionList = searchUsersTokenSession(tokenSession - .getUserId()); - for (TokenSession tknSession : existsUserTknSessionList) { - dropTokenSession(tknSession); - } - - String sql = "insert into TOKEN_SESSION(token,user_id,dev_id,dev_os,created,expire_in) values(:token,:user_id,:dev_id,:dev_os,:created,:expire_in)"; - try { - DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); - SqlObject sqlObject = new SqlObject(sql); - sqlObject.setParameter("token", tokenSession.getToken()); - sqlObject.setParameter("user_id", tokenSession.getUserId()); - sqlObject.setParameter("dev_id", tokenSession.getDevId()); - sqlObject.setParameter("dev_os", tokenSession.getDevOs()); - sqlObject.setParameter("created", - dateFormat.format(tokenSession.getCreated())); - sqlObject.setParameter("expire_in", - dateFormat.format(tokenSession.getExpireIn())); - sqlca.executeSQL(sqlObject); - sqlca.commit(); - } catch (Exception e) { - logger.error(e); - sqlca.rollback(); - } - - } - - @Override - public LoginUser getLoginUser(TokenSession tokenSession) { - String uid = tokenSession.getUserId(); - LoginUser user = new LoginUser(uid, ""); - return user; - } - -} diff --git a/src_app/cn/coyoteam/aweresf/web/als/ErrorOutputer.java b/src_app/cn/coyoteam/aweresf/web/als/ErrorOutputer.java deleted file mode 100644 index aa56eadf8..000000000 --- a/src_app/cn/coyoteam/aweresf/web/als/ErrorOutputer.java +++ /dev/null @@ -1,75 +0,0 @@ -package cn.coyoteam.aweresf.web.als; - -import java.io.IOException; -import java.io.PrintWriter; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import apx.com.amarsoft.als.base.model.RspObject; -import cn.coyoteam.aweresf.consts.AWEConst; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.amarsoft.are.ARE; - -public class ErrorOutputer { - public static final SerializerFeature[] FEATURES = new SerializerFeature[] { - SerializerFeature.WriteMapNullValue, - SerializerFeature.PrettyFormat, - SerializerFeature.WriteNonStringKeyAsString, - SerializerFeature.WriteNullListAsEmpty }; - - - public static void show404ErrorAsJson(HttpServletRequest request,HttpServletResponse response){ - RspObject rspObject = RspObject.build(new Exception("uri["+request.getAttribute(AWEConst.KEY_REQ_URI)+"] is not found")); - rspObject.getHeader().setCode("404"); - PrintWriter out = null; - try { - setResponseHeader(request,response); - out = response.getWriter(); - String jsonText = JSON.toJSONStringWithDateFormat(rspObject,"yyyy/MM/dd HH:mm:ss.SSS", FEATURES); - out.println(jsonText); - response.flushBuffer(); - } catch (IOException e) { - ARE.getLog().error(e); - } - } - public static void show500ErrorAsJson(HttpServletRequest request,HttpServletResponse response){ - RspObject rspObject = RspObject.build(new Exception("uri["+request.getAttribute(AWEConst.KEY_REQ_URI)+"] is not found")); - rspObject.getHeader().setCode("500"); - PrintWriter out = null; - try { - setResponseHeader(request,response); - out = response.getWriter(); - String jsonText = JSON.toJSONStringWithDateFormat(rspObject,"yyyy/MM/dd HH:mm:ss.SSS", FEATURES); - out.println(jsonText); - response.flushBuffer(); - } catch (IOException e) { - ARE.getLog().error(e); - } - } - - /** - * 设置响应头 - * @param request - * @param response - * @throws IOException - */ - public static void setResponseHeader(HttpServletRequest request,HttpServletResponse response) { - // 处理响应头 - String contentType = "application/json;"; - String charset = request.getCharacterEncoding(); - if (charset != null)contentType += "charset=" + charset; - - response.setHeader("Cache-Control", "no-cache"); - response.setHeader("Pragma", "no-cache"); - response.setDateHeader("Expires", 0); - response.addHeader("Access-Control-Allow-Origin", "*"); - response.addHeader("Allow","GET, POST, DELETE, PUT,OPTIONS"); - response.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - response.addHeader("Access-Control-Allow-Headers", "Content-Type"); - response.setHeader("Content-Type", contentType); - response.setContentType(contentType); - } -} diff --git a/src_app/cn/coyoteam/aweresf/web/als/LogonUser.java b/src_app/cn/coyoteam/aweresf/web/als/LogonUser.java deleted file mode 100644 index 94527c309..000000000 --- a/src_app/cn/coyoteam/aweresf/web/als/LogonUser.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.coyoteam.aweresf.web.als; - -import cn.coyoteam.aweresf.model.User; - -public class LogonUser { - private String token; - private User user; - - public String getToken() { - return token; - } - public void setToken(String token) { - this.token = token; - } - public User getUser() { - return user; - } - public void setUser(User user) { - this.user = user; - } - -} diff --git a/src_app/cn/coyoteam/aweresf/web/als/TokenSession.java b/src_app/cn/coyoteam/aweresf/web/als/TokenSession.java deleted file mode 100644 index 982a8d93e..000000000 --- a/src_app/cn/coyoteam/aweresf/web/als/TokenSession.java +++ /dev/null @@ -1,55 +0,0 @@ -package cn.coyoteam.aweresf.web.als; - -import java.io.Serializable; -import java.util.Date; - -public class TokenSession implements Serializable{ - - private static final long serialVersionUID = 1431984723022828070L; - - private String token; - private String userId; - private String devId; - private String devOs; - private Date created; - private Date expireIn; - - public String getToken() { - return token; - } - public void setToken(String token) { - this.token = token; - } - public String getUserId() { - return userId; - } - public void setUserId(String userId) { - this.userId = userId; - } - public String getDevId() { - return devId; - } - public void setDevId(String devId) { - this.devId = devId; - } - public String getDevOs() { - return devOs; - } - public void setDevOs(String devOs) { - this.devOs = devOs; - } - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - public Date getExpireIn() { - return expireIn; - } - public void setExpireIn(Date expireIn) { - this.expireIn = expireIn; - } - - -} diff --git a/src_app/cn/coyoteam/aweresf/web/als/TokenSessionManager.java b/src_app/cn/coyoteam/aweresf/web/als/TokenSessionManager.java deleted file mode 100644 index 9b4b0c296..000000000 --- a/src_app/cn/coyoteam/aweresf/web/als/TokenSessionManager.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.coyoteam.aweresf.web.als; - -import java.util.List; -import java.util.Map; - -import apx.com.amarsoft.als.user.logon.model.LoginUser; -import cn.coyoteam.aweresf.model.User; - -public interface TokenSessionManager { - - /** - * 创建token会话 - * @param uid - * @param properties - * @return - */ - public TokenSession createTokenSession(String uid,Map properties); - /** - * 删除token会话 - * @param tokenSession - */ - public void dropTokenSession(String sUserId); - /** - * 删除token会话 - * @param tokenSession - */ - public void dropTokenSession(TokenSession tokenSession); - - /** - * 根据token查找会话对象 - * @param token - * @return - */ - public TokenSession getTokenSession(String token); - - /** - * 列出单个用户的所有会话列表 - * @param uid - * @return - */ - public List searchUsersTokenSession(String uid); - - /** - * 根据token找到对应的用户 - * @param token - * @return - */ - public User getUser(TokenSession tokenSession); - - /** - * 根据token找到对应的用户 - * @param token - * @return - */ - public LoginUser getLoginUser(TokenSession tokenSession); - -} diff --git a/src_app/cn/coyoteam/aweresf/web/als/TokenSessionManagerFactory.java b/src_app/cn/coyoteam/aweresf/web/als/TokenSessionManagerFactory.java deleted file mode 100644 index 741aa1f3a..000000000 --- a/src_app/cn/coyoteam/aweresf/web/als/TokenSessionManagerFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.coyoteam.aweresf.web.als; - -import com.amarsoft.awe.util.Transaction; - -public class TokenSessionManagerFactory { - - public static TokenSessionManager getALSTokenSessionManager(Transaction sqlca){ - TokenSessionManager tokenSessionManager = new ALSTokenSessionManager(); - ((ALSTokenSessionManager)tokenSessionManager).setSqlca(sqlca); - return tokenSessionManager; - } -} diff --git a/src_app/cn/coyoteam/aweresf/web/filter/AWERunFilterPatch.java b/src_app/cn/coyoteam/aweresf/web/filter/AWERunFilterPatch.java deleted file mode 100644 index 3662c4bf7..000000000 --- a/src_app/cn/coyoteam/aweresf/web/filter/AWERunFilterPatch.java +++ /dev/null @@ -1,544 +0,0 @@ -package cn.coyoteam.aweresf.web.filter; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.sql.SQLException; -import java.text.DecimalFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.Enumeration; -import java.util.UUID; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import cn.coyoteam.aweresf.consts.AWEConst; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.Configure; -import com.amarsoft.awe.RuntimeContext; -import com.amarsoft.awe.control.PageConstants; -import com.amarsoft.awe.control.model.Component; -import com.amarsoft.awe.control.model.ComponentSession; -import com.amarsoft.awe.control.model.RunTimeInfo; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -/** - * 代码来源于AWE的RunFilter,由于restfull支持,因此需要对该类进行一些调整 - * @author cytsir - * - */ -public class AWERunFilterPatch implements Filter { - protected boolean reflushARC = true; - protected boolean runTimeDebug = false; - protected int runTimeShow = 600000; - protected boolean showFramePage = false; - protected boolean dbLog = false; - protected String encoding = null; - protected String dataSource = null; - protected String clientIPType = null; - - protected ArrayList excludedURLList = new ArrayList(); - protected boolean tranQueryString = false; - private static SimpleDateFormat sdf = new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss:SSS"); - private static DecimalFormat df = new DecimalFormat("#0.000#"); - private static DecimalFormat df_num = new DecimalFormat("#00"); - private static double WARNING_TIME = 1.0D; - private static RunTimeInfo rtInfo; - private static String basePath = null; - - public void destroy() { - } - - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - try { - if ((request.getCharacterEncoding() == null) - && (this.encoding != null)) { - request.setCharacterEncoding(this.encoding); - } - - Date dBeginTime = new Date(); - HttpServletRequest req = (HttpServletRequest) request; - HttpSession session = req.getSession(); - - Configure CurConfig = Configure.getInstance(session - .getServletContext()); - if (CurConfig == null) { - throw new ServletException("读取配置文件错误!请检查配置文件。"); - } - RuntimeContext CurARC = (RuntimeContext) session - .getAttribute("CurARC"); - if (!isNotNeedSessionPage(req)) { - if (CurARC == null) { - logTimeOutInfo(dBeginTime, req); - HttpServletResponse resp = (HttpServletResponse) response; - resp.sendRedirect(req.getContextPath() - + "/Frame/page/sys/SessionExpire.jsp"); - return; - } - if (needComponentInfo(CurARC, req)) { - logNoCompentInfo(dBeginTime, req); - HttpServletResponse resp = (HttpServletResponse) response; - resp.sendRedirect(req.getContextPath() - + "/Frame/page/sys/NoCompInfo.jsp"); - return; - } - if (isDoubleClickPage(req)) { - logDoubleClick(dBeginTime, req); - HttpServletResponse resp = (HttpServletResponse) response; - resp.sendRedirect(req.getContextPath() - + "/Frame/page/sys/DoubleClick.jsp"); - return; - } - } - - chain.doFilter(request, response); - - Date dEndTime = new Date(); - if (isGenSessionPage(req)) { - CurARC = (RuntimeContext) session.getAttribute("CurARC"); - } else if (!isNotNeedSessionPage(req)) { - session.setAttribute("LastRunEndTime", sdf.format(dEndTime)); - if (this.reflushARC) { - session.setAttribute("CurARC", CurARC); - } - } - if (this.runTimeDebug) - if (CurARC != null) { - logJspInfo(CurARC.getUser(), dBeginTime, dEndTime, req); - if ((this.dbLog) - && ((dEndTime.getTime() - dBeginTime.getTime()) / 1000.0D > WARNING_TIME)) - logInfoToDB(CurARC.getUser(), dBeginTime, dEndTime, req); - } else { - logNoSessionInfo(dBeginTime, dEndTime, req); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - private boolean isDoubleClickPage(HttpServletRequest req) throws Exception { - HttpSession session = req.getSession(); - String sCurQueryString = req.getQueryString(); - - if (sCurQueryString == null) - sCurQueryString = (String) req - .getAttribute("javax.servlet.forward.query_string"); - if (sCurQueryString == null) { - sCurQueryString = ""; - } else { - String[] sMQuery = sCurQueryString.split("&"); - sCurQueryString = ""; - for (int i1 = 0; i1 < sMQuery.length; i1++) { - if ((sMQuery[i1].length() > 5) - && (!sMQuery[i1].substring(0, 5).equals("rand="))) - sCurQueryString = sCurQueryString + sMQuery[i1] + "&"; - } - } - String sServletURL = req.getServletPath(); - String sCurJspName = req.getContextPath() + sServletURL; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss:SSS"); - String sBeginTimeTemp = sdf.format(new Date()); - - if ((session.getAttribute("LastRunJspName") != null) - && (session.getAttribute("LastRunJspName").equals(sCurJspName)) - && (session.getAttribute("LastRunQueryString") - .equals(sCurQueryString)) - && (session.getAttribute("LastRunEndTime").equals(""))) { - return true; - } - session.setAttribute("LastRunEndTime", ""); - session.setAttribute("LastRunJspName", sCurJspName); - session.setAttribute("LastRunQueryString", sCurQueryString); - session.setAttribute("LastRunBeginTime", sBeginTimeTemp); - return false; - } - - private boolean needComponentInfo(RuntimeContext CurARC, - HttpServletRequest req) throws Exception { - if (!req.getRequestURI().endsWith(".jsp")) { - return false; - } - - if (isNotNeedComponentPage(req)) { - return false; - } - - Component CurComp = null; - ComponentSession CurCompSession = CurARC.getCompSession(); - ASUser user = CurARC.getUser(); - - String sCompClientID = req.getParameter("CompClientID"); - if (sCompClientID == null) - sCompClientID = ""; - - if ((sCompClientID != null) && (!sCompClientID.equals(""))) { - CurComp = CurCompSession.lookUp(sCompClientID); - if (CurComp == null) { - CurARC.setErrCode("AWES0011"); - CurARC.setErrInfo("您请求的页面[" + req.getRequestURI() - + "]已过期。请不要通过“前进”、“后退”或“刷新”来访问本系统的功能。请不要同时对多个窗口进行操作。"); - getLog(req) - .warn("[COMP] Attach[" + user.getUserID() + "][" - + user.getUserName() + "][" + sCompClientID - + "][" + CurCompSession.getComponentsID() + "]"); - return true; - } - if ((req.getRequestURI().endsWith("Main.jsp")) - && (!req.getRequestURI().equals( - req.getContextPath() + CurComp.getCompURL()))) { - CurARC.setErrCode("AWES0012"); - CurARC.setErrInfo("不要试图在地址栏上直接输入URL进行访问[" + req.getRequestURI() - + "]"); - getLog(req) - .warn("[COMP] Attach[" + user.getUserID() + "][" - + user.getUserName() + "][" + sCompClientID - + "][" + CurCompSession.getComponentsID() + "]"); - return true; - } - } else { - CurARC.setErrCode("AWES0013"); - CurARC.setErrInfo("本页面[" + req.getRequestURI() + "]不允许非组件的访问方式!"); - getLog(req).warn( - "[COMP] Attach[" + user.getUserID() + "][" - + user.getUserName() + "][" + sCompClientID + "][" - + CurCompSession.getComponentsID() + "]"); - return true; - } - - return false; - } - - private boolean isGenSessionPage(HttpServletRequest req) { - for (int i = 0; i < PageConstants.GEN_SEESION_PAGES.length; i++) { - if (req.getRequestURI().matches(PageConstants.GEN_SEESION_PAGES[i])) { - return true; - } - } - return false; - } - - private boolean isNotNeedSessionPage(HttpServletRequest req) { - //如果属性中由于其他servlet设置过本次请求免除session,则作免除处理 - Boolean noUseSession = (Boolean)req.getAttribute(AWEConst.KEY_NO_USE_SESSION); -// System.out.println("AAA:"+noUseSession+","+req.getRequestURL()); - if(noUseSession!=null&&noUseSession==true){ - return true; - } - - for (int i = 0; i < PageConstants.NOT_NEED_SEESION_PAGES.length; i++) { - if (req.getRequestURI().matches(PageConstants.NOT_NEED_SEESION_PAGES[i])) { - return true; - } - } - for (int i = 0; i < this.excludedURLList.size(); i++) { - if (req.getRequestURI().matches((String) this.excludedURLList.get(i))) { - return true; - } - } - - return isGenSessionPage(req); - } - - private boolean isNotNeedComponentPage(HttpServletRequest req) { - for (int i = 0; i < PageConstants.NOT_NEED_COMPONENT_PAGES.length; i++) { - if (req.getRequestURI().matches( - PageConstants.NOT_NEED_COMPONENT_PAGES[i])) { - return true; - } - } - return isGenSessionPage(req); - } - - private boolean isFramePage(HttpServletRequest req) { - for (int i = 0; i < PageConstants.FRAME_PAGES.length; i++) { - if (req.getRequestURI().matches(PageConstants.FRAME_PAGES[i])) { - return true; - } - } - return false; - } - - private void logJspInfo(ASUser user, Date dBeginTime, Date dEndTime, - HttpServletRequest req) { - if ((!this.showFramePage) && (isFramePage(req))) - return; - logJspInfo(user, dBeginTime, dEndTime, req, "Normal"); - } - - private void logNoSessionInfo(Date dBeginTime, Date dEndTime, - HttpServletRequest req) { - logJspInfo(null, dBeginTime, dEndTime, req, "NoSession"); - } - - private void logJspInfo(ASUser user, Date dBeginTime, Date dEndTime, - HttpServletRequest req, String sType) { - double iTimeConsuming = (dEndTime.getTime() - dBeginTime.getTime()) / 1000.0D; - if (basePath == null) { - basePath = req.getScheme() + "://" + req.getServerName() + ":" - + req.getServerPort() + req.getContextPath(); - try { - basePath = basePath + ":" - + InetAddress.getLocalHost().getHostName(); - } catch (UnknownHostException e) { - e.printStackTrace(); - } - basePath = basePath + ":" + UUID.randomUUID().toString(); - rtInfo.setServerId(basePath); - ARE.getLog().info("AppServerId=" + rtInfo.getServerID()); - } - rtInfo.count(iTimeConsuming); - int iStep = (int) iTimeConsuming * 10; - StringBuffer sbf = new StringBuffer("[JSP"); - if (iTimeConsuming > WARNING_TIME) - sbf.append(df_num.format(iStep)); - sbf.append("]"); - sbf.append("{"); - sbf.append(df.format(iTimeConsuming)); - sbf.append("}"); - sbf.append("{T="); - sbf.append(sType); - sbf.append("}"); - if (user != null) { - sbf.append("{"); - sbf.append(user.getUserID()); - sbf.append("}"); - } - sbf.append("{"); - sbf.append(req.getRequestURI()); - sbf.append("}"); - sbf.append("{"); - sbf.append(getRemoteAddr(req)); - sbf.append("}"); - sbf.append("{BeginTime="); - sbf.append(sdf.format(dBeginTime)); - sbf.append(",EndTime="); - sbf.append(sdf.format(dEndTime)); - sbf.append("}"); - if (req.getQueryString() != null) { - sbf.append("{"); - sbf.append(getQueryString(req)); - sbf.append("}"); - } - if (iTimeConsuming > WARNING_TIME) { - getLog(req).warn(sbf.toString()); - } else - getLog(req).debug(sbf.toString()); - } - - private void logTimeOutInfo(Date dBeginTime, HttpServletRequest req) { - HttpSession s = req.getSession(); - logWarnInfo( - dBeginTime, - req, - "TimeOut[" + s.getId() + ":" + s.getCreationTime() + ":" - + s.getLastAccessedTime() + "]"); - } - - private void logDoubleClick(Date dBeginTime, HttpServletRequest req) { - logWarnInfo(dBeginTime, req, "DoubleClick"); - } - - private void logNoCompentInfo(Date dBeginTime, HttpServletRequest req) { - logWarnInfo(dBeginTime, req, "NoComp"); - } - - private void logWarnInfo(Date dBeginTime, HttpServletRequest req, - String sType) { - StringBuffer sbf = new StringBuffer("[JSP"); - sbf.append("{T="); - sbf.append(sType); - sbf.append("}"); - sbf.append("{"); - sbf.append(req.getRequestURI()); - sbf.append("}"); - sbf.append("{"); - sbf.append(getRemoteAddr(req)); - sbf.append("}"); - if (req.getQueryString() != null) { - sbf.append("{"); - sbf.append(getQueryString(req)); - sbf.append("}"); - } - getLog(req).warn(sbf.toString()); - } - - private String getRemoteAddr(HttpServletRequest req) { - String clientIP = req.getRemoteAddr(); - if (this.clientIPType != null) { - String ip = req.getHeader(this.clientIPType); - if ((ip != null) && (!"".endsWith(ip)) - && (!"unknown".equalsIgnoreCase(ip))) - clientIP = ip; - } - return clientIP; - } - - private Log getLog(HttpServletRequest req) { - return ARE.getLog("[" + req.getContextPath() + "]"); - } - - private String getQueryString(HttpServletRequest req) { - @SuppressWarnings("rawtypes") - Enumeration e = req.getParameterNames(); - int i = 0; - StringBuffer sbf = null; - while (e.hasMoreElements()) { - String sParaName = (String) e.nextElement(); - if (i == 0) { - sbf = new StringBuffer(); - } else { - sbf.append("&"); - } - i++; - sbf.append(sParaName); - sbf.append("="); - - String sParaValue = req.getParameter(sParaName); - if ((sParaValue != null) && (sParaValue.length() > 256)) { - sbf.append(sParaValue.substring(0, 256) + "..."); - } else { - sbf.append(sParaValue); - } - } - return sbf == null ? null : sbf.toString(); - } - - private void logInfoToDB(ASUser user, Date dBeginTime, Date dEndTime, - HttpServletRequest req) { - Transaction Sqlca = null; - try { - Sqlca = Transaction.createTransaction(this.dataSource); - SqlObject asql = new SqlObject( - "insert into user_runtime(SessionID,BeginTime,UserId,JspName,EndTime,TimeConsuming,UserName) values (:SessionID,:BeginTime,:UserId,:JspName,:EndTime,:TimeConsuming,:UserName)"); - asql.setParameter("SessionID", req.getSession().getId()); - asql.setParameter("BeginTime", sdf.format(dEndTime)); - asql.setParameter("UserId", user.getUserID()); - asql.setParameter("JspName", req.getRequestURI()); - asql.setParameter("EndTime", sdf.format(dEndTime)); - asql.setParameter( - "TimeConsuming", - df.format((dEndTime.getTime() - dBeginTime.getTime()) / 1000.0D)); - asql.setParameter("UserName", user.getUserName()); - Sqlca.executeSQL(asql); - } catch (Exception e) { - if (Sqlca != null) - try { - Sqlca.rollback(); - } catch (Exception e1) { - e1.printStackTrace(); - } - } finally { - if (Sqlca != null) - try { - Sqlca.commit(); - Sqlca.disConnect(); - Sqlca = null; - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public void init(FilterConfig filterConfig) { - String value = filterConfig.getInitParameter("RunTimeDebug"); - if (value == null) - this.runTimeDebug = true; - else if (value.equalsIgnoreCase("true")) - this.runTimeDebug = true; - else if (value.equalsIgnoreCase("yes")) - this.runTimeDebug = true; - else { - this.runTimeDebug = false; - } - value = filterConfig.getInitParameter("RunTimeShow"); - if ((value != null) && (!"".equals(this.dataSource))) { - this.runTimeShow = (60000 * Integer.parseInt(value)); - } - - value = filterConfig.getInitParameter("ShowFramePage"); - if (value == null) - this.showFramePage = false; - else if (value.equalsIgnoreCase("true")) - this.showFramePage = true; - else if (value.equalsIgnoreCase("yes")) - this.showFramePage = true; - else { - this.showFramePage = false; - } - value = filterConfig.getInitParameter("DbLog"); - if (value == null) - this.dbLog = false; - else if (value.equalsIgnoreCase("true")) - this.dbLog = true; - else if (value.equalsIgnoreCase("yes")) - this.dbLog = true; - else { - this.dbLog = false; - } - value = filterConfig.getInitParameter("ReflushARC"); - if (value == null) - this.reflushARC = true; - else if (value.equalsIgnoreCase("true")) - this.reflushARC = true; - else if (value.equalsIgnoreCase("yes")) - this.reflushARC = true; - else { - this.reflushARC = false; - } - this.encoding = filterConfig.getInitParameter("encoding"); - if ((this.encoding == null) || ("".equals(this.encoding))) { - this.encoding = null; - } - this.dataSource = filterConfig.getInitParameter("DataSource"); - if ((this.dataSource == null) || ("".equals(this.dataSource))) { - this.dataSource = "als"; - } - this.clientIPType = filterConfig.getInitParameter("ClientIPType"); - if ((this.clientIPType == null) || ("".equals(this.clientIPType))) { - this.clientIPType = null; - } - String sExcludedURLs = filterConfig.getInitParameter("ExcludedURLs"); - if (null != sExcludedURLs) { - String[] tmps = sExcludedURLs.split(","); - for (String tmp : tmps) { - tmp = tmp.trim(); - tmp = tmp.replaceAll("\\{\\{contextPath\\}\\}", filterConfig.getServletContext().getContextPath()); -// System.out.println("config-1:"+filterConfig.getServletContext().getContextPath()); -// System.out.println("config-x:"+tmp); - if (tmp.length() > 0) - this.excludedURLList.add(tmp); - } - } - - System.out.println("RunFilter InitParameter : encoding[" - + this.encoding + "] ReflushARC[" + this.reflushARC - + "] DataSource[" + this.dataSource + "] ExcludedURLs[" - + this.excludedURLList.size() + "][" + sExcludedURLs + "]"); - System.out.println("RunFilter InitParameter : RunTimeDebug[" - + this.runTimeDebug + "] RunTimeShow[" + this.runTimeShow - + "] ShowFramePage[" + this.showFramePage + "] DbLog[" - + this.dbLog + "] ClientIPType[" - + (this.clientIPType == null ? "" : this.clientIPType) + "]"); - if (filterConfig.getServletContext().getServerInfo().indexOf("Tomcat") != -1) { - this.tranQueryString = true; - } - - rtInfo = new RunTimeInfo(this.dataSource, this.runTimeShow, - sdf.format(new Date())); - } -} diff --git a/src_app/cn/coyoteam/aweresf/web/filter/SessionAndContextFilter.java b/src_app/cn/coyoteam/aweresf/web/filter/SessionAndContextFilter.java deleted file mode 100644 index 97965caf9..000000000 --- a/src_app/cn/coyoteam/aweresf/web/filter/SessionAndContextFilter.java +++ /dev/null @@ -1,320 +0,0 @@ -package cn.coyoteam.aweresf.web.filter; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.model.RspObject; -import cn.coyoteam.aweresf.configure.GlobalConfigure; -import cn.coyoteam.aweresf.consts.AWEConst; -import cn.coyoteam.aweresf.consts.SessionConst; -import cn.coyoteam.aweresf.util.StringHelper; -import cn.coyoteam.aweresf.web.als.TokenSession; -import cn.coyoteam.aweresf.web.als.TokenSessionManagerFactory; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.awe.RuntimeContext; -import com.amarsoft.awe.control.model.ComponentSession; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASPreference; -import com.amarsoft.context.ASUser; - - -/** - * 对JSP页面webapi进行改造想学适配的过滤器 - * @author EX-YANGSONG001 - * - */ -public class SessionAndContextFilter implements Filter { - private String encoding = "GBK"; - private boolean forceEncoding = true; - private String dataSource = "als"; - private Set noCheckURI = new HashSet(); - - - /** - * @return 获取 encoding - */ - public String getEncoding() { - return encoding; - } - - /** - * @param 把参数encoding 设置到 encoding - */ - public void setEncoding(String encoding) { - this.encoding = encoding; - } - - /** - * @return 获取 forceEncoding - */ - public boolean isForceEncoding() { - return forceEncoding; - } - - /** - * @param 把参数forceEncoding 设置到 forceEncoding - */ - public void setForceEncoding(boolean forceEncoding) { - this.forceEncoding = forceEncoding; - } - - public SessionAndContextFilter() { - } - - public void destroy() { - } - - public void setCharacterEncoding(HttpServletRequest req,HttpServletResponse rep) throws UnsupportedEncodingException{ - if(encoding!=null){ - req.setCharacterEncoding(encoding); - } - if(forceEncoding){ - rep.setCharacterEncoding(encoding); - } - } - - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - HttpServletRequest req = (HttpServletRequest)request; - HttpServletResponse rep = (HttpServletResponse)response; - setCharacterEncoding(req,rep); - - request.setAttribute(AWEConst.KEY_WEB_API,true); - request.setAttribute(AWEConst.KEY_REQ_URI, req.getRequestURI()); - //如果已经登录过了,会话中会存在RuntimeContext对象,直接使用就好了 - //主要用于在在状态的web模式下,也可以使用restfull接口 -// RuntimeContext CurARC = (RuntimeContext)req.getSession().getAttribute("CurARC"); -// if(CurARC != null){ -// chain.doFilter(req, rep); -// return; -// } - - //放行URI,直接通过 - String uri = req.getRequestURI().substring((req.getContextPath()+"/webapi").length());// req.getPathInfo(); - if(noCheckURI.contains(uri)){ - ARE.getLog().debug("NO-CHECK-URI:["+uri+"]"); - chain.doFilter(request, response); - }else{ - ASUser curUser = (ASUser) req.getSession().getAttribute("ASUser"); - String sUserId = ""; - if (curUser != null) - sUserId = curUser.getUserID(); - if (sUserId == null) - sUserId = ""; - try { - BizObjectManager bom = JBOFactory.getBizObjectManager("jbo.guaranty.TOKEN_SESSION"); - BizObjectQuery boq = bom.createQuery("USER_ID=:USER_ID").setParameter("USER_ID", sUserId); - @SuppressWarnings("unchecked") - List bos = boq.getResultList(false); - if (bos != null && bos.size() > 0) { - String sToken = (String) req.getSession().getAttribute(SessionConst.KEY_TOKEN); - if(sToken.length()==0) - sToken = StringHelper.nvl(req.getParameter(SessionConst.KEY_TOKEN),""); - boolean flag = false; - for (BizObject bo : bos) { - String boToken = bo.getAttribute("TOKEN") == null ? "" : bo.getAttribute("TOKEN").toString(); - if (sToken.equals(boToken)) { - chain.doFilter(request, response); - flag = true; - } - } - if (!flag) { - req.getSession().removeAttribute(SessionConst.KEY_TOKEN); - req.getSession().removeAttribute(SessionConst.KEY_CUR_ARC); - req.getSession().invalidate(); - RspObject rspObject = RspObject.buildError(ResultConstant.FAIL_TOKEN_INVALID_CODE, ResultConstant.FAIL_TOKEN_INVALID_MESSAGE); - outputRspObject(rspObject,req,rep); - } - } else { - req.getSession().removeAttribute(SessionConst.KEY_TOKEN); - req.getSession().removeAttribute(SessionConst.KEY_CUR_ARC); - req.getSession().invalidate(); - RspObject rspObject = RspObject.buildError(ResultConstant.FAIL_TOKEN_INVALID_CODE, ResultConstant.FAIL_TOKEN_INVALID_MESSAGE); - outputRspObject(rspObject,req,rep); - } - } catch (JBOException e1) { - ARE.getLog().info(e1); - req.getSession().removeAttribute(SessionConst.KEY_TOKEN); - req.getSession().removeAttribute(SessionConst.KEY_CUR_ARC); - req.getSession().invalidate(); - RspObject rspObject = RspObject.buildError(ResultConstant.FAIL_TOKEN_INVALID_CODE, ResultConstant.FAIL_TOKEN_INVALID_MESSAGE); - outputRspObject(rspObject,req,rep); - } - - - -// String token = StringHelper.nvl(req.getHeader(SessionConst.KEY_TOKEN),""); -// if(token.length()==0)token = StringHelper.nvl(req.getParameter(SessionConst.KEY_TOKEN),""); -//// if(token.length()==0)token = StringHelper.nvl((String)req.getSession().getAttribute(SessionConst.KEY_TOKEN),""); -// -// if(token.length()==0){ -// RspObject rspObject = RspObject.buildError("401", "非法请求,token不存在"); -// outputRspObject(rspObject,req,rep); -// }else{ -// doFilterWithToken(token, req, rep, chain); -// } - } - - } - - - protected void doFilterWithToken(String token,HttpServletRequest request,HttpServletResponse response,FilterChain chain){ - //1.根据token查找查出User信息 - //2.找到User信息后,把实例化过后的User放入Request对象中 - //3.filter放行 - Transaction sqlca = null; - try { - //检查token的合法性,合法则通过 - sqlca = Transaction.createTransaction(this.dataSource); - //1.查找到token会话 - TokenSession tokenSession = lookupTokenSession(token, request, sqlca); - if(tokenSession==null){ - RspObject rspObject = RspObject.buildError("401", "非法的token"); - outputRspObject(rspObject,request,response); - return; - } - //2.检查会话的合法性 - if(checkTokenSession(tokenSession, request, response, chain)){ - //3.把相应数据对象填充到HTTP会话中 - fillHttpSession(tokenSession, sqlca, request.getSession()); - chain.doFilter(request, response); - } - sqlca.commit(); - } catch (Exception e) { - RspObject rspObject = RspObject.buildError("ERROR", "系统内部出错。出错消息:"+e); - outputRspObject(rspObject,request,response); - ARE.getLog().error(e); - try { - if(sqlca!=null)sqlca.rollback(); - } catch (Exception e1) { - ARE.getLog().error(e1); - } - } finally{ - if(sqlca!=null){ - try { - sqlca.disConnect(); - } catch (Exception e) { - ARE.getLog().error(e); - } - sqlca = null; - } - } - } - - /** - * 检查TokenSession的合法性 - * @param tokenSession - * @param request - * @param response - * @param chain - * @return - */ - protected boolean checkTokenSession(TokenSession tokenSession,ServletRequest request, ServletResponse response, FilterChain chain){ - return true; - } - - /** - * 往HttpSession中放入一此数据,提供给后面的使用 - * @throws Exception - */ - private void fillHttpSession(TokenSession tokenSession, Transaction sqlca,HttpSession session) throws Exception { - //处理有token,但是 - RuntimeContext curARC = (RuntimeContext)session.getAttribute("CurARC"); - if(curARC==null){ - ASUser curUser = ASUser.getUser(tokenSession.getUserId(), sqlca); - RuntimeContext CurARC = new RuntimeContext(); - CurARC.setUser(curUser); - CurARC.setPref(new ASPreference(curUser.getUserID())); - CurARC.setCompSession(new ComponentSession()); - session.setAttribute("CurARC", CurARC); - } - } - - private TokenSession lookupTokenSession(String token,HttpServletRequest request,Transaction sqlca){ - TokenSession tokenSession = (TokenSession)request.getSession().getAttribute(SessionConst.KEY_TOKEN_SESSION); - if(tokenSession==null){ - tokenSession = TokenSessionManagerFactory.getALSTokenSessionManager(sqlca).getTokenSession(token); - } - return tokenSession; - - } - - private void outputRspObject(RspObject rspObject,HttpServletRequest req,HttpServletResponse rep){ - rep.setHeader("Cache-Control", "no-cache"); - rep.setHeader("Pragma", "no-cache"); - rep.setDateHeader("Expires", 0); - rep.addHeader("Access-Control-Allow-Origin", "*"); - rep.addHeader("Allow","GET, POST, DELETE, PUT,OPTIONS"); - rep.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - rep.addHeader("Access-Control-Allow-Headers", "Content-Type"); - rep.setContentType("application/json; charset="+encoding); - - String jsonString = JSON.toJSONStringWithDateFormat(rspObject, - "yyyy/MM/dd HH:mm:ss.SSS", SerializerFeature.WriteMapNullValue, - SerializerFeature.PrettyFormat, - SerializerFeature.WriteNonStringKeyAsString, - SerializerFeature.SortField); - try { - rep.getWriter().println(jsonString); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public void init(FilterConfig filterConfig) throws ServletException { - String s = filterConfig.getInitParameter("NoCheckURI"); - String cfgSMSRequired = filterConfig.getInitParameter(SessionConst.KEY_SMS_REQUIRE); - String cfgTokenHoldTime = filterConfig.getInitParameter("TokenHoldTime"); - String cfgDataSource = filterConfig.getInitParameter("dataSource"); - String cfgEncoding = filterConfig.getInitParameter("encoding"); - initNoCheckURI(s); - if("true".equals(cfgSMSRequired)){ - GlobalConfigure.getInstance().setProperty(SessionConst.KEY_SMS_REQUIRE, "true"); - }else{ - GlobalConfigure.getInstance().setProperty(SessionConst.KEY_SMS_REQUIRE, "false"); - } - if(cfgTokenHoldTime!=null&&cfgTokenHoldTime.matches("-?\\d+")){ - GlobalConfigure.getInstance().setProperty(SessionConst.KEY_TOKEN_HOLD_TIME, cfgTokenHoldTime); - } - if(cfgEncoding!=null){ - this.encoding = cfgEncoding; - } - GlobalConfigure.getInstance().setProperty("encoding", encoding); - if(cfgDataSource != null){ - this.dataSource = cfgDataSource; - } - - } - private void initNoCheckURI(String s){ - s = s.replaceAll("\\s+", ""); - s = s.replaceAll("^,", ""); - s = s.replaceAll(",$", ""); - s = s.replaceAll(",{2,}", ","); - String[] ss = s.split(","); - for(String si : ss){ - noCheckURI.add(si); - } - } - -} diff --git a/src_app/cn/coyoteam/aweresf/web/restfull/impl/AnnotationRestfullDispatcherImpl.java b/src_app/cn/coyoteam/aweresf/web/restfull/impl/AnnotationRestfullDispatcherImpl.java deleted file mode 100644 index 4fb364726..000000000 --- a/src_app/cn/coyoteam/aweresf/web/restfull/impl/AnnotationRestfullDispatcherImpl.java +++ /dev/null @@ -1,457 +0,0 @@ -package cn.coyoteam.aweresf.web.restfull.impl; - - -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.annotation.Annotation; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.DELETE; -import javax.ws.rs.FormParam; -import javax.ws.rs.GET; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; - -import org.apache.commons.beanutils.BeanUtils; - -import apx.com.amarsoft.als.base.model.RspObject; -import cn.coyoteam.aweresf.annotation.AutoBind; -import cn.coyoteam.aweresf.configure.GlobalConfigure; -import cn.coyoteam.aweresf.model.Org; -import cn.coyoteam.aweresf.model.User; -import cn.coyoteam.aweresf.util.ClassUtil; -import cn.coyoteam.aweresf.util.RequestUtil; -import cn.coyoteam.aweresf.web.als.RequestContext; -import cn.coyoteam.aweresf.web.restfull.RestfullDispatcher; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.log.Log; -import com.amarsoft.awe.RuntimeContext; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASOrg; -import com.amarsoft.context.ASUser; -import com.google.common.collect.Sets; - - -/** - * Restfull分发器实现类 - * - * @author yangsong - * @date 2015年3月29日 - */ -public class AnnotationRestfullDispatcherImpl implements RestfullDispatcher{ - - - protected Log logger = ARE.getLog(); - private String dataSource = "als"; - - private String[] parsePkgs(String pkgs){ - String resfScanPackage = pkgs; - resfScanPackage = resfScanPackage.replaceAll("\\s+", ""); - resfScanPackage = resfScanPackage.replaceAll("^,", ""); - resfScanPackage = resfScanPackage.replaceAll(",$", ""); - resfScanPackage = resfScanPackage.replaceAll(",{2,}", ","); - return resfScanPackage.split(","); - } - - private List> findClassWithPathAnno(String pkg){ - List> classList = new ArrayList>(); - - Set> classes = ClassUtil.getClasses(pkg); - for(Class clazz : classes){ - //从类注解上查找Path - Path classAnno = clazz.getAnnotation(Path.class); - if(classAnno==null)continue; -// String annoPath = classAnno.value(); - classList.add(clazz); - } - - return classList; - } - - public void uriMappingClassMethod(Set> classes){ - for(Class clazz : classes){ - Path classAnno = clazz.getAnnotation(Path.class); - if(classAnno==null)continue; - String classUriPath = classAnno.value(); - - Method[] methods = clazz.getMethods(); - for(Method method : methods){ - Path methodAnno = method.getAnnotation(Path.class); - String methodUriPath = ""; - if(methodAnno!=null){ - methodUriPath = methodAnno.value(); - } - String accessUri = classUriPath+methodUriPath; - //访问URI+请求方法组合成一个KEY - URIMappingKey key = null; - if(method.getAnnotation(POST.class)!=null){ - key = new URIMappingKey(accessUri,HttpMethod.POST); - }else if(method.getAnnotation(GET.class)!=null){ - key = new URIMappingKey(accessUri,HttpMethod.GET); - }else if(method.getAnnotation(PUT.class)!=null){ - key = new URIMappingKey(accessUri,HttpMethod.PUT); - }else if(method.getAnnotation(DELETE.class)!=null){ - key = new URIMappingKey(accessUri,HttpMethod.DELETE); - }else{ - continue; - } - - //类+方法组合成一个VALUE,如果已经被绑定过了,则抛出异常 - URIMappingValue existValue = URIMappingCache.getInstance().get(key); - if(existValue!=null){ - throw new RuntimeException(MessageFormat.format( - "{0} {1} --> {2}.{3} error,mapped on {4}.{5}", - key.getHttpMethod(), key.getUri(), - clazz.getName(),method.getName(), - existValue.getClazz().getName(),existValue.getMethod().getName() - )); - } - URIMappingValue value = new URIMappingValue(clazz,method); - ARE.getLog().info(String.format("%-6s %s --> %s.%s ", key.getHttpMethod(), key.getUri(),clazz.getName(),method.getName())); - URIMappingCache.getInstance().put(key, value); - } - } - } - - public void scanPackageAndInitResfSetting(String pkgExpr){ - URIMappingCache.getInstance().clear(); - String[] resfPkgs = parsePkgs(pkgExpr); - if(resfPkgs==null||resfPkgs.length==0)return; - - Set> classes = new HashSet>(); - - ARE.getLog().info("---------------------RESTFULL MAPPING------------------------"); - - for(String pkg : resfPkgs){ - classes.addAll(findClassWithPathAnno(pkg)); - } - - uriMappingClassMethod(classes); - - ARE.getLog().info("---------------------------------------------------------"); - } - - public void init(ServletContext servletContext) { - scanPackageAndInitResfSetting(servletContext.getInitParameter("RestfullScanPackage")); - } - - - - protected Map mapParameter(HttpServletRequest req){ - return RequestUtil.convertRequestToMap(req); - } - - public void doPost(HttpServletRequest req, HttpServletResponse rep) - throws ServletException, IOException { - doProcess(req,rep,HttpMethod.POST); - } - - public void doDelete(HttpServletRequest req, HttpServletResponse rep) - throws ServletException, IOException { - doProcess(req,rep,HttpMethod.DELETE); - - } - - public void doPut(HttpServletRequest req, HttpServletResponse rep) - throws ServletException, IOException { - doProcess(req,rep,HttpMethod.PUT); - - } - - public void doGet(HttpServletRequest req, HttpServletResponse rep) - throws ServletException, IOException { - doProcess(req,rep,HttpMethod.GET); - } - - - public void doProcess(HttpServletRequest req, HttpServletResponse rep,String httpMethod) throws IOException{ - RequestContext reqContext = new RequestContext(); - - RspObject rsp = null; - PrintWriter out = rep.getWriter(); - try{ - reqContext.req = req; - reqContext.rep = rep; - reqContext.curUser = lookupUser(req); - reqContext.jboTx = JBOFactory.createJBOTransaction(); - reqContext.sqlca = Transaction.createTransaction(this.dataSource); - - String uri = req.getPathInfo(); - Map parameter = mapParameter(req); - URIMappingKey key = new URIMappingKey(uri,httpMethod); - URIMappingValue value = URIMappingCache.getInstance().get(key); - - if(value==null) { - rsp = RspObject.build(new ServletException(MessageFormat.format("{0} {1} not found", key.getHttpMethod(),key.getUri()))); - rsp.getHeader().setCode("404"); - }else{ - logger.debug(httpMethod+" "+uri+" "+parameter+" "+value.getClazz().getName()); - Class clazz = value.getClazz(); - Method method = value.getMethod(); - Class returnType = method.getReturnType(); - Object repObject = null; - Object object = clazz.newInstance(); - repObject = invokeMethod(object,method,reqContext); - - //没有返回值的,repObject直接设置为空 - if("void".equals(returnType.getName())){ -// rsp = null; - rsp = RspObject.build(""); - }else if(repObject==null){ - rsp = RspObject.build(""); - }else if(repObject instanceof RspObject){ - rsp = (RspObject)repObject; - // app 附件下载 - } else if("AppAtt".equals(returnType.getSimpleName())) { - rsp = null; - }else{ - rsp = RspObject.build(repObject); - } - } - if(reqContext.jboTx!=null)reqContext.jboTx.commit(); - if(reqContext.sqlca!=null)reqContext.sqlca.commit(); - }catch(Throwable e){ - e = ((InvocationTargetException)e).getTargetException(); - logger.error("",e); - rsp = RspObject.build(e); - rsp.getHeader().setCode("500"); - if(e.getMessage()!=null){ - rsp.getHeader().setMessage(e.getMessage()); - } - - if(reqContext.jboTx!=null){ - try { - reqContext.jboTx.rollback(); - } catch (JBOException e1) { - logger.error("tx rollback error", e1); - } - } - if(reqContext.sqlca!=null){ - try { - reqContext.sqlca.rollback(); - } catch (Exception e1) { - logger.error("sqlca rollback error", e1); - } - } - }finally{ - if(reqContext.sqlca!=null){ - try { - reqContext.sqlca.disConnect(); - } catch (Exception e) { - logger.error("sqlca close error", e); - } - } - } -// String jsonString = JSON.toJSONStringWithDateFormat(rsp, "yyyy/MM/dd HH:mm:ss.SSS"); -// String jsonString = JSON.toJSONString(rsp,SerializerFeature.WriteMapNullValue); - if(rsp!=null){ - //设置响应头 - rep.setHeader("Cache-Control", "no-cache"); - rep.setHeader("Pragma", "no-cache"); - rep.setDateHeader("Expires", 0); - rep.addHeader("Access-Control-Allow-Origin", "*"); - rep.addHeader("Allow","GET, POST, DELETE, PUT,OPTIONS"); - rep.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - rep.addHeader("Access-Control-Allow-Headers", "Content-Type"); - rep.setContentType("application/json; charset="+GlobalConfigure.getInstance().getProperty("encoding")); - String jsonString = JSON.toJSONStringWithDateFormat(rsp, - "yyyy/MM/dd HH:mm:ss.SSS", SerializerFeature.WriteMapNullValue, - SerializerFeature.PrettyFormat, - SerializerFeature.WriteNonStringKeyAsString, - SerializerFeature.SortField); - out.println(jsonString); - } - } -// - private Object invokeMethod(Object object,Method method,RequestContext reqContext) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException{ - //取所有的参数类型以及参数注解,构建传入参数对象数组 - Class[] argTypes = method.getParameterTypes(); - Annotation[][] annotations = method.getParameterAnnotations(); - Object[] argValues = new Object[annotations.length]; - - for(int i=0;i numberTypeSet = Sets.newHashSet(); - numberTypeSet.add("byte"); -// numberTypeSet.add("char"); - numberTypeSet.add("short"); - numberTypeSet.add("int"); - numberTypeSet.add("long"); - numberTypeSet.add("float"); - numberTypeSet.add("double"); -// numberTypeSet.add("boolean"); - -// numberTypeSet.add("java.lang.Byte"); -//// numberTypeSet.add("java.lang.Character"); -// numberTypeSet.add("java.lang.Short"); -// numberTypeSet.add("java.lang.Integer"); -// numberTypeSet.add("java.lang.Long"); -// numberTypeSet.add("java.lang.Float"); -// numberTypeSet.add("java.lang.Double"); -// numberTypeSet.add("java.lang.Boolean"); -// System.out.println(typeName+"-"+numberTypeSet.contains(typeName)); - return numberTypeSet.contains(typeName); - } - - /** - * 从request中传入的参数始终都是String类型的,需要强制转换为Java方法上相应的方法 - * @param value - * @param argType - * @return - */ - private Object convertArgValue(String value,String argType){ - if("int".equals(argType)){ - return Integer.valueOf(value); - }else if("java.lang.Integer".equals(argType)){ - return Integer.valueOf(value); - }else if("java.lang.Double".equals(argType)){ - return Double.valueOf(value); - }else if("double".equals(argType)){ - return Double.valueOf(value); - }else if("java.lang.String".equals(argType)){ - return value; - } - return null; - } - - /** - * 根据注解,放入参数 - * @param instance - * @param annotation - * @param req - * @param rep - * @param typeName - * @return - */ - private Object injectWithAnnotation(Object instance, Annotation annotation, - RequestContext reqContext, String typeName) { - //从Request中取出参数 - if(annotation instanceof QueryParam){ - QueryParam anoQp = (QueryParam)annotation; - String paraName = anoQp.value(); - String paraValue = reqContext.getReq().getParameter(paraName); - if(paraValue==null)return null; - return convertArgValue(paraValue,typeName); - }else if(annotation instanceof FormParam){ - FormParam anoQp = (FormParam)annotation; - String paraName = anoQp.value(); - String paraValue = reqContext.getReq().getParameter(paraName); - if(paraValue==null)return null; - return convertArgValue(paraValue,typeName); - }else if(annotation instanceof AutoBind){ - String className = typeName; - Object beanValue = null; - try { - beanValue = Class.forName(className).newInstance(); - } catch (InstantiationException e) { - logger.error("",e); - } catch (IllegalAccessException e) { - logger.error("",e); - } catch (ClassNotFoundException e) { - logger.error("",e); - } - Map map = mapParameter(reqContext.getReq()); - try { - BeanUtils.populate(beanValue,map); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } -// BeanUtils.map2Bean(map, beanValue); - return beanValue; - }else if(annotation instanceof Context){ - if(" javax.servlet.ServletRequest".equals(typeName)){ - return reqContext.req; - }else if("javax.servlet.http.HttpServletRequest".equals(typeName)){ - return reqContext.req; - }else if("javax.servlet.ServletResponse".equals(typeName)){ - return reqContext.rep; - }else if("javax.servlet.http.HttpServletResponse".equals(typeName)){ - return reqContext.rep; - }else if("com.amarsoft.ams.base.User".equals(typeName)){ //用户对象 - return reqContext.curUser; - }else if("com.amarsoft.awe.util.Transaction".equals(typeName)){ //Sqlca对象 - return reqContext.sqlca; - }else if("com.amarsoft.are.jbo.JBOTransaction".equals(typeName)){ //JBO事务 - return reqContext.jboTx; - } - } - return null; - } - - /** - * 从上下文环境中取当前用户 - * @return - */ - public User lookupUser(HttpServletRequest request){ - ASUser curUser = null; - RuntimeContext curARC = (RuntimeContext)request.getSession().getAttribute("CurARC"); - if(curARC!=null){ - curUser = curARC.getUser(); - } - if(curUser==null)return null; - - User user = new User(); - user.setUserId(curUser.getUserID()); - user.setUserName(curUser.getUserName()); - user.setStatus(curUser.getStatus()); - ASOrg curOrg = curUser.getBelongOrg(); - Org org = new Org(); - org.setOrgId(curOrg.getOrgID()); - org.setOrgName(curOrg.getOrgName()); - org.setOrgLevel(curOrg.getOrgLevel()); - org.setStatus(curOrg.getStatus()); - org.setSortNo(curOrg.getSortNo()); - user.setOrg(org); - return user; - } - - public String getDataSource() { - return dataSource; - } - - public void setDataSource(String dataSource) { - this.dataSource = dataSource; - } - -} diff --git a/src_app/cn/coyoteam/aweresf/web/restfull/impl/RestfullApiDocIndex.java b/src_app/cn/coyoteam/aweresf/web/restfull/impl/RestfullApiDocIndex.java deleted file mode 100644 index d3ac04935..000000000 --- a/src_app/cn/coyoteam/aweresf/web/restfull/impl/RestfullApiDocIndex.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.coyoteam.aweresf.web.restfull.impl; - -import java.io.IOException; - -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import org.beetl.core.Configuration; -import org.beetl.core.GroupTemplate; -import org.beetl.core.Template; -import org.beetl.core.resource.ClasspathResourceLoader; - -/** - * Restfull接口文档 - * @author cytsir - * - */ -@Path("/api-doc-index") -public class RestfullApiDocIndex { - - @GET - public void showApiDocAsHtml(@Context HttpServletResponse response) throws IOException{ - ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader(); - Configuration cfg = Configuration.defaultConfiguration(); - GroupTemplate gt = new GroupTemplate(resourceLoader, cfg); - Template t = gt.getTemplate("/cn/coyoteam/aweresf/web/restfull/impl/rest-api-doc-template.html"); - t.binding("mappingList", URIMappingCache.getInstance().getMappingStore()); - t.renderTo(response.getWriter()); - } -} diff --git a/src_app/cn/coyoteam/aweresf/web/restfull/impl/rest-api-doc-template.html b/src_app/cn/coyoteam/aweresf/web/restfull/impl/rest-api-doc-template.html deleted file mode 100644 index c05a15351..000000000 --- a/src_app/cn/coyoteam/aweresf/web/restfull/impl/rest-api-doc-template.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - -restfull-apidoc-index - - - - - - - - - - - - - - - - - - - - - - - - -
NoHTTP-URIHTTP-METHODJAVA-CLASSJAVA-CLASS-METHOD
${itemLP.index}${item.key.uri}${item.key.httpMethod}${item.value.clazz.name}${item.value.method.name}
- - - - \ No newline at end of file diff --git a/src_app/cn/coyoteam/aweresf/web/servlet/XWRenderServlet.java b/src_app/cn/coyoteam/aweresf/web/servlet/XWRenderServlet.java deleted file mode 100644 index bbd4bdf0a..000000000 --- a/src_app/cn/coyoteam/aweresf/web/servlet/XWRenderServlet.java +++ /dev/null @@ -1,93 +0,0 @@ -package cn.coyoteam.aweresf.web.servlet; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import cn.coyoteam.aweresf.consts.XWConst; -import cn.coyoteam.aweresf.util.StringHelper; -import cn.coyoteam.aweresf.web.xw.render.XWRenderAsJson; -import cn.coyoteam.aweresf.web.xw.render.XWRenderIntercept; - -import com.amarsoft.awe.dw.ASObjectModel; -import com.amarsoft.awe.dw.ASObjectWindow; - -/*** - * DW或OW重新定向渲染处理Servlet - * @author EX-YANGSONG001 - * @date 2015/5/14 - */ -public class XWRenderServlet extends HttpServlet { - - private static final long serialVersionUID = 1836559134168560992L; - private Properties xwInterceptProperties = new Properties(); - - public XWRenderServlet() { - super(); - } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - ASObjectModel doTemp = (ASObjectModel)request.getAttribute("doTemp"); - ASObjectWindow dwTemp = (ASObjectWindow)request.getAttribute("dwTemp"); - @SuppressWarnings("unchecked") - XWRenderAsJson owRender = (XWRenderAsJson)request.getAttribute("owRender"); - - //对象不存在,则抛出错误 - if(doTemp == null || dwTemp == null) { - throw new ServletException("owRender not found!"); - } - - //如果相应的URI有拦截器存在,则设置拦截器,以备在数据渲染时调用 - String xwUri = (String)request.getAttribute(XWConst.XWURI); - XWRenderIntercept xwRenderIntercept = lookupXWRenderIntercept(xwUri); - if(xwRenderIntercept!=null)owRender.setXwRenderIntercept(xwRenderIntercept); - //执行渲染 - owRender.initXw(doTemp, dwTemp); - owRender.render(request, response); - } - - protected XWRenderIntercept lookupXWRenderIntercept(String xwUri){ - String className = xwInterceptProperties.getProperty(xwUri); - if(className==null)return null; - try { - Object object = Class.forName(className).newInstance(); - if(object instanceof XWRenderIntercept){ - XWRenderIntercept renderIntercept = (XWRenderIntercept)object; - return renderIntercept; - } - } catch (InstantiationException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } - return null; - } - - public void init(ServletConfig filterConfig) throws ServletException { - super.init(filterConfig); - String interceptConfig = StringHelper.nvl(filterConfig.getInitParameter(XWConst.KEY_XW_INTERCEPT_CONFIG),""); - interceptConfig = interceptConfig.replaceAll("\\s+", ""); - - if(interceptConfig!=null&&interceptConfig.startsWith("classpath:")){ - interceptConfig = interceptConfig.substring(10); - InputStream in = getClass().getResourceAsStream(interceptConfig); - try { - xwInterceptProperties.load(in); - } catch (IOException e) { - throw new ServletException(String.format("load %s file error", XWConst.KEY_XW_INTERCEPT_CONFIG)); - } - } - } - - - - -} diff --git a/src_app/cn/coyoteam/aweresf/web/servlet/XWTransformServlet.java b/src_app/cn/coyoteam/aweresf/web/servlet/XWTransformServlet.java deleted file mode 100644 index 75c260437..000000000 --- a/src_app/cn/coyoteam/aweresf/web/servlet/XWTransformServlet.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.coyoteam.aweresf.web.servlet; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.amarsoft.are.ARE; - -import cn.coyoteam.aweresf.consts.AWEConst; -import cn.coyoteam.aweresf.consts.XWConst; - - -/** - * DW/OW转换处理Servlet - * @author cytsir - * - */ -public class XWTransformServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - String targetUrl = request.getPathInfo(); - String queryParameter = request.getQueryString(); - - //需要特殊处理下,标识WEBAPI的组件ID为固定的 - if(queryParameter==null) { - queryParameter = "CompClientID="+XWConst.WEB_API_COMP; - } else { - queryParameter += "&CompClientID="+XWConst.WEB_API_COMP; - } - - //参数拼接 - if(queryParameter!=null)targetUrl+= "?"+queryParameter; - - //登记一个标志位,这样RunFilter(RunFilter被改造过)就不要强制使用session作为过滤条件了 -// ARE.getLog().trace("webapi-redirect-to:"+targetUrl); - request.setAttribute(XWConst.XWURI, request.getPathInfo()); - request.setAttribute(AWEConst.KEY_NO_USE_SESSION,true); - try{ - request.getRequestDispatcher(targetUrl).forward(request, response); - }catch(Exception e){ - e.printStackTrace(); - ARE.getLog().error(e); - } - } - - protected void doPost(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - doGet(request, response); - } - -} \ No newline at end of file diff --git a/src_app/cn/coyoteam/aweresf/web/xw/OWConvert.java b/src_app/cn/coyoteam/aweresf/web/xw/OWConvert.java deleted file mode 100644 index d65606907..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/OWConvert.java +++ /dev/null @@ -1,261 +0,0 @@ -package cn.coyoteam.aweresf.web.xw; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import com.amarsoft.awe.control.model.Page; -import com.amarsoft.awe.dw.ASColumn; -import com.amarsoft.awe.dw.ASDataObject; -import com.amarsoft.awe.dw.datamodel.CatalogModel; -import com.amarsoft.awe.dw.datamodel.GroupModel; -import com.amarsoft.awe.dw.ui.control.Support; -import com.amarsoft.dict.als.cache.AWEDataWindowCache; - -import cn.coyoteam.aweresf.web.xw.segment.model.CodePair; -import cn.coyoteam.aweresf.web.xw.segment.model.DataList; -import cn.coyoteam.aweresf.web.xw.segment.model.DataType; -import cn.coyoteam.aweresf.web.xw.segment.model.EditType; -import cn.coyoteam.aweresf.web.xw.segment.model.Element; -import cn.coyoteam.aweresf.web.xw.segment.model.ElementGroup; -import cn.coyoteam.aweresf.web.xw.segment.model.HorAlign; -import cn.coyoteam.aweresf.web.xw.segment.model.Segment; - -/** - * @author EX-YANGSONG001 - * - */ -public class OWConvert { - public static final String PAGE_NUMBER_NAME = "_pnu"; - public static final String PAGE_SIZE_NAME = "_psz"; - - /** - * 使用page中的参数初始化dataList - * @param dataList - * @param page - */ - public static void initDataListWithPage(DataList dataList,Page page){ - int pageIndex = -1; - int pageSize = -1; - try { - String _pnu = page.getParameter(PAGE_NUMBER_NAME); - if(_pnu!=null){ - pageIndex = Integer.parseInt(_pnu); - } - String _psz = page.getParameter(PAGE_SIZE_NAME); - if(_psz!=null){ - pageSize = Integer.parseInt(_psz); - } - } catch (Exception e) { - pageIndex = -1; - pageSize = -1; - } - pageIndex = pageIndex-1; - if(pageIndex<0)pageIndex = 0; - dataList.setPageIndex(pageIndex); - dataList.setPageSize(pageSize); - } - - @Deprecated - @SuppressWarnings("unchecked") - public static Map> buildCodePairs(ASDataObject doTemp) throws Exception { - Map> codemap = new HashMap>(); - - List columns = new ArrayList(); - columns.addAll(doTemp.Columns); - for(int i=0;i pairList = new ArrayList(); - String[] codes = Support.getCodes(editSource, editSourceType); - String id = column.getAttribute("COLNAME").toUpperCase(); - - if (null == codes) { - continue; - }else{ - if(null!=codes[0]&&null!=codes[1]){ - if(codes[0].equalsIgnoreCase("")&&codes[1].equalsIgnoreCase("today")){ - continue; - } - } - } - for(int j=0;j> buildSimpleCodePairs(ASDataObject doTemp) throws Exception { - Map> codemap = new HashMap>(); - - List columns = new ArrayList(); - columns.addAll(doTemp.Columns); - for(int i=0;i pairList = new ArrayList(); - Map pairs = new LinkedHashMap(); - String[] codes = Support.getCodes(editSource, editSourceType); - String id = column.getAttribute("COLNAME").toUpperCase(); - - if (null == codes) { - continue; - }else{ - if(null!=codes[0]&&null!=codes[1]){ - if(codes[0].equalsIgnoreCase("")&&codes[1].equalsIgnoreCase("today")){ - continue; - } - } - } - for(int j=0;j elements = segment.getElements(); - List groups = segment.getElementGroups(); - - //处理业务要素 - List columns = new ArrayList(); - columns.addAll(doTemp.Columns); - Collections.sort(columns, new Comparator(){ - public int compare(ASColumn col1, ASColumn col2) { - String sort1 = col1.getAttribute("SORTNO"); - String sort2 = col2.getAttribute("SORTNO"); - if(sort1==null)sort1 = ""; - return sort1.compareTo(sort2); - }}); - String followCol = "",mergeCol=""; - for(int i=0;i groupList = catModel.getGroupList(); - for(GroupModel groupItem:groupList){ - ElementGroup eleGrp = new ElementGroup(); - eleGrp.setId(groupItem.getDockId()); - eleGrp.setName(groupItem.getDockName()); - groups.add(eleGrp); - } - } - } - - /** - * 把OW的ColEditStyle转为JavaBean枚举模型 - * @param editStyle - * @return - */ - public static EditType buildEditType(String editStyle){ - Map maps = new HashMap(); - maps.put("Text", EditType.TextField); - maps.put("Textarea", EditType.TextArea); - maps.put("Radiobox", EditType.RadioBox); - maps.put("Select", EditType.Select); - maps.put("Checkbox", EditType.CheckBox); - maps.put("Checkbox2", EditType.CheckBox); - maps.put("Date", EditType.Date); - if(maps.containsKey(editStyle))return maps.get(editStyle); - else return EditType.TextField; - } - /** - * 把OW的ColEditStyle转为JavaBean枚举模型 - * @param colType - * @return - */ - public static DataType buildDataType(String colType){ - Map maps = new HashMap(); - maps.put("String",DataType.String); - maps.put("Number",DataType.Number); - if(maps.containsKey(colType))return maps.get(colType); - else return DataType.String; - } - - /** - * 对齐方式 - * @param colAlign - * @return - */ - public static HorAlign buildHorAlign(String colAlign){ - Map maps = new HashMap(); - maps.put("1",HorAlign.Left); - maps.put("2",HorAlign.Center); - maps.put("3",HorAlign.Right); - if(maps.containsKey(colAlign))return maps.get(colAlign); - else return HorAlign.Left; - } -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/render/InterceptHelper.java b/src_app/cn/coyoteam/aweresf/web/xw/render/InterceptHelper.java deleted file mode 100644 index b6dd284fc..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/render/InterceptHelper.java +++ /dev/null @@ -1,56 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.render; - -import java.util.Map; - -import cn.coyoteam.aweresf.web.xw.segment.model.Segment; - -import com.alibaba.fastjson.JSONObject; -import com.amarsoft.are.lang.StringX; - -/** - * URI拦截器公共方法类 - * @author oldbiao 2016年1月14日 - * - */ -public class InterceptHelper { - - /** - * 处理合并字段 - * @param xwData - */ - public static void executeColSpan(Segment xwData){ - String mergeCols = xwData.getMergeCol(); - if(StringX.isEmpty(mergeCols))return; - JSONObject data = (JSONObject)xwData.getData(); - Map> codeMap = xwData.getCodemap(); - String[] cols = mergeCols.split("@"); - String followCol = "",mergeCol=""; - for(String col:cols){ - mergeCol = col.split("-")[0];//需合并字段 - followCol = col.split("-")[1];//被跟随字段 - Object fcVal = getShowValue(data, codeMap, followCol); - Object mgVal = getShowValue(data, codeMap, mergeCol); - data.remove(mergeCol); - data.remove(followCol); - data.put(followCol, fcVal+""+mgVal); - xwData.getElements().remove(mergeCol); - } - } - - /** - * 获取代码转换后的值 - * @param data - * @param codeMap - * @param colID - * @return - */ - private static Object getShowValue(JSONObject data,Map> codeMap,String colID){ - Object fcVal = data.get(colID); - Map code = codeMap.get(colID); - if(code!=null){ - String sVal = code.get(fcVal); - if(!StringX.isEmpty(sVal))return sVal; - } - return fcVal; - } -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/render/XWRender.java b/src_app/cn/coyoteam/aweresf/web/xw/render/XWRender.java deleted file mode 100644 index e088ebdde..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/render/XWRender.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.render; - -import java.io.IOException; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author EX-YANGSONG001 - * OW或DW渲染接口 - */ -public interface XWRender { - - /** - * OW/DW/Strip渲染 - * @param request - * @param response - */ - public void render(HttpServletRequest request,HttpServletResponse response) throws IOException; -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/render/XWRenderAsJson.java b/src_app/cn/coyoteam/aweresf/web/xw/render/XWRenderAsJson.java deleted file mode 100644 index e65291ffb..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/render/XWRenderAsJson.java +++ /dev/null @@ -1,75 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.render; - -import java.io.IOException; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.amarsoft.awe.dw.ASDataObject; -import com.amarsoft.awe.dw.ASDataWindow; - -/** - * DW/OW/Strip渲染接口。渲染为JSON - * @author EX-YANGSONG001 - * - * @param - * @param - */ -public abstract class XWRenderAsJson implements XWRender { - public static final SerializerFeature[] FEATURES = new SerializerFeature[] { - SerializerFeature.WriteMapNullValue, - SerializerFeature.PrettyFormat, - SerializerFeature.WriteNonStringKeyAsString, - SerializerFeature.WriteNullListAsEmpty }; - - protected DoTemp doTemp; - protected DwTemp dwTemp; - protected XWRenderIntercept xwRenderIntercept; - - /** - * 设置DW/OW的两个核心对象 - * @param doTemp - * @param dwTemp - */ - public void initXw(DoTemp doTemp, DwTemp dwTemp){ - this.doTemp = doTemp; - this.dwTemp = dwTemp; - } - - public XWRenderIntercept getXwRenderIntercept() { - return xwRenderIntercept; - } - - public void setXwRenderIntercept(XWRenderIntercept xwRenderIntercept) { - this.xwRenderIntercept = xwRenderIntercept; - } - - - /** - * 设置响应头 - * @param request - * @param response - * @throws IOException - */ - public void setResponseHeader(HttpServletRequest request,HttpServletResponse response) { - // 处理响应头 - String contentType = "application/json;"; - String charset = request.getCharacterEncoding(); - if (charset != null)contentType += "charset=" + charset; - - response.setHeader("Cache-Control", "no-cache"); - response.setHeader("Pragma", "no-cache"); - response.setDateHeader("Expires", 0); - response.addHeader("Access-Control-Allow-Origin", "*"); - response.addHeader("Allow","GET, POST, DELETE, PUT,OPTIONS"); - response.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - response.addHeader("Access-Control-Allow-Headers", "Content-Type"); - response.setHeader("Content-Type", contentType); - response.setContentType(contentType); - // OWPortal portal = JSON.parseObject(jsonText, OWPortal.class); - // System.out.println("portal:"+portal); - // 响应数据 - // ARE.getLog().debug("content-type:"+contentType); - } -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/render/XWRenderIntercept.java b/src_app/cn/coyoteam/aweresf/web/xw/render/XWRenderIntercept.java deleted file mode 100644 index e7c9eb9e4..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/render/XWRenderIntercept.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.render; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.amarsoft.awe.dw.ASObjectModel; -import com.amarsoft.awe.dw.ASObjectWindow; - -import cn.coyoteam.aweresf.web.xw.segment.model.Segment; - -/** - * XW数据处理拦截器 - * @author cytsir - * - */ -public interface XWRenderIntercept { - /** - * XW数据渲染之前被执行调用的方法 - * @param request - * @param response - * @param doTemp - * @param dwTemp - * @param xwData - */ - public void beforeRender( - HttpServletRequest request, - HttpServletResponse response, - ASObjectModel doTemp, - ASObjectWindow dwTemp, - Segment xwData); -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/render/impl/OWInfoRenderAsJson.java b/src_app/cn/coyoteam/aweresf/web/xw/render/impl/OWInfoRenderAsJson.java deleted file mode 100644 index c35feb059..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/render/impl/OWInfoRenderAsJson.java +++ /dev/null @@ -1,73 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.render.impl; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import apx.com.amarsoft.als.base.model.RspObject; -import cn.coyoteam.aweresf.web.xw.OWConvert; -import cn.coyoteam.aweresf.web.xw.render.XWRenderAsJson; -import cn.coyoteam.aweresf.web.xw.render.impl.generator.GenOWInfoToJson; -import cn.coyoteam.aweresf.web.xw.segment.model.LayoutStyle; -import cn.coyoteam.aweresf.web.xw.segment.model.Segment; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.amarsoft.awe.dw.ASObjectModel; -import com.amarsoft.awe.dw.ASObjectWindow; - - -/** - * ObjectWindow对象的Info页面渲染为json - * @author EX-YANGSONG001 - * - */ -public class OWInfoRenderAsJson extends XWRenderAsJson { - - public void render(HttpServletRequest request, HttpServletResponse response) throws IOException { - // 生成json使用自定义的json数据生成处理器 - doTemp.setDataQueryClass(GenOWInfoToJson.class.getName()); - - Segment segment = new Segment(); - OWConvert.buildSegment(doTemp,segment); - segment.setLayoutStyle(LayoutStyle.Info); - Map> codemap; - RspObject rspObject = null; - try { - codemap = OWConvert.buildSimpleCodePairs(doTemp); - String dataJsonText = dwTemp.toJson(dwTemp.getArgsValue()); - // System.out.println("isUseDynamic:"+RSAClassLoader.isUseDynamic()); - JSONObject data = JSON.parseObject(dataJsonText); - //处理Info页面的显示与隐藏处理 - // dataJson = dataJson.replaceAll(":null", ":\"\""); - segment.setCodemap(codemap); - segment.setData(data); - - if(xwRenderIntercept!=null){ - xwRenderIntercept.beforeRender(request, response, doTemp, dwTemp, segment); - } - rspObject = RspObject.build(segment); - outoutRspObject(rspObject,request,response); - } catch (Exception e) { - rspObject = RspObject.build(e); - outoutRspObject(rspObject,request,response); - } - } - - public void outoutRspObject(RspObject rspObject,HttpServletRequest request,HttpServletResponse response){ - setResponseHeader(request, response); - - String jsonText = JSON.toJSONStringWithDateFormat(rspObject,"yyyy/MM/dd HH:mm:ss.SSS", FEATURES); - PrintWriter out = null; - try { - out = response.getWriter(); - out.println(jsonText); - } catch (IOException e) { - e.printStackTrace(out); - } - } - -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/render/impl/OWListRenderAsJson.java b/src_app/cn/coyoteam/aweresf/web/xw/render/impl/OWListRenderAsJson.java deleted file mode 100644 index 885bf3834..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/render/impl/OWListRenderAsJson.java +++ /dev/null @@ -1,125 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.render.impl; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Map; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import apx.com.amarsoft.als.base.model.RspObject; -import cn.coyoteam.aweresf.web.xw.OWConvert; -import cn.coyoteam.aweresf.web.xw.render.XWRenderAsJson; -import cn.coyoteam.aweresf.web.xw.render.impl.generator.GenOWListToJson; -import cn.coyoteam.aweresf.web.xw.segment.model.DataList; -import cn.coyoteam.aweresf.web.xw.segment.model.LayoutStyle; -import cn.coyoteam.aweresf.web.xw.segment.model.Segment; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.amarsoft.awe.dw.ASObjectModel; -import com.amarsoft.awe.dw.ASObjectWindow; - -/** - * ObjectWindow对象的List页面渲染为json - * @author EX-YANGSONG001 - * - */ -public class OWListRenderAsJson extends XWRenderAsJson { - - /** - * 将array中的key变为小写 - * 〈功能详细描述〉 - * @param data - * @return - */ - private JSONArray uppercaseArray(JSONArray data) { - JSONArray tmpData = new JSONArray(); - for (Object object : data) { - JSONObject jsonObject = JSONObject.parseObject(object.toString()); - JSONObject tmpObject = new JSONObject(); - Set objectKeys = jsonObject.keySet(); - String value = null; - for (String key : objectKeys) { - value = jsonObject.getString(key); - tmpObject.put(key.toUpperCase(), value); - } - tmpData.add(tmpObject); - } - return tmpData; - } - - public void render(HttpServletRequest request, HttpServletResponse response) throws IOException { - // 生成json使用自定义的json数据生成处理器 - doTemp.setDataQueryClass(GenOWListToJson.class.getName()); - Segment segment = new Segment(); - OWConvert.buildSegment(doTemp,segment); - segment.setLayoutStyle(LayoutStyle.List); -// String name=segment.getId(); - - Map> codemap; - RspObject rspObject = null; - try { - DataList dataList = new DataList(); - - OWConvert.initDataListWithPage(dataList, doTemp.getCurPage()); - //如果传入了页面大小,则使用传入的 - if(dataList.getPageSize()>0){ - dwTemp.setPageSize(dataList.getPageSize()); - } - codemap = OWConvert.buildSimpleCodePairs(doTemp); - String dataJsonText = dwTemp.toJson(dwTemp.getArgsValue()); - - JSONArray data = uppercaseArray(JSON.parseArray(dataJsonText)); - //处理List页面 - dataList.setList(data); - dataList.setRowCount(data.size()); -// dataList.setPageCount(dwTemp.getPageCount()); -// if(dataList.getPageSize()<=0){ -// dataList.setPageSize(dwTemp.getPageSize()); -// } - - //这里数据是在GenOWListToJson中计算后的数据,是最准确的数据 - String doPageCount = doTemp.getCurPage().getAttribute("OWListPageCount"); - String doPageSize = doTemp.getCurPage().getAttribute("OWListPageSize"); - String doRowCount = doTemp.getCurPage().getAttribute("OWListRowCount"); - if(doPageCount!=null){ - dataList.setPageCount(Integer.parseInt(doPageCount)); - } - if(doPageSize!=null){ - dataList.setPageSize(Integer.parseInt(doPageSize)); - } - if(doRowCount!=null){ - dataList.setPageCount(Integer.parseInt(doRowCount)); - } - - segment.setCodemap(codemap); - segment.setData(dataList); - - if(xwRenderIntercept!=null){ - xwRenderIntercept.beforeRender(request, response, doTemp, dwTemp, segment); - } - rspObject = RspObject.build(segment); - outoutRspObject(rspObject,request,response); - } catch (Exception e) { - rspObject = RspObject.build(e); - outoutRspObject(rspObject,request,response); - } - } - - public void outoutRspObject(RspObject rspObject,HttpServletRequest request,HttpServletResponse response){ - setResponseHeader(request, response); - - String jsonText = JSON.toJSONStringWithDateFormat(rspObject,"yyyy/MM/dd HH:mm:ss.SSS", FEATURES); - PrintWriter out = null; - try { - out = response.getWriter(); - out.println(jsonText); - } catch (IOException e) { - e.printStackTrace(out); - } - } - -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/render/impl/generator/GenOWInfoToJson.java b/src_app/cn/coyoteam/aweresf/web/xw/render/impl/generator/GenOWInfoToJson.java deleted file mode 100644 index 1057a39cd..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/render/impl/generator/GenOWInfoToJson.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.render.impl.generator; - -import java.util.Date; -import java.util.Hashtable; -import java.util.Iterator; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.lang.DataElement; -import com.amarsoft.awe.dw.handler.BusinessProcessData; -import com.amarsoft.awe.dw.ui.htmlfactory.InfoHtmlWithASDataObjectGenerator; -import com.amarsoft.awe.dw.ui.htmlfactory.imp.DefaultInfoHtmlGenerator; - -/** - * @author EX-YANGSONG001 - * 把Info页面数据处理为JSON数据的转换处理器 - */ -public class GenOWInfoToJson extends InfoHtmlWithASDataObjectGenerator{ - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void run(BusinessProcessData bpData) throws Exception { - //调用默认的generator,把数据抽取出来 - DefaultInfoHtmlGenerator generator = new DefaultInfoHtmlGenerator(asObj, paramstr, webRootPath, request); - generator.run(bpData); - BizObject jbo = generator.getBizObj(); - this.data = new Hashtable(); - for (int i = 0; i < jbo.getAttributeNumber(); i++) { - DataElement de = jbo.getAttribute(i); - Object value = de.getValue(); - //日期处理成字串 - if (de.getValue() instanceof Date) { - value= de.getString(); - } - //由于hashtable的key以及value均不能为null,因此,空的必需转为空串 - String name = de.getName(); - if(name==null)name = ""; - name = name.toUpperCase(); - if(value==null)value = ""; - data.put(name, value); - } - - // 处理虚字段 - Hashtable hashtable = generator.getVirtualFieldValues(); - Iterator iterator = hashtable.keySet().iterator(); - while (iterator.hasNext()) { - String key = (String) iterator.next(); - String value = (String) hashtable.get(key); - // System.out.println(key+"="+value); - if(key==null)key = ""; - key = key.toUpperCase(); - data.put(key, value); - } - } -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/render/impl/generator/GenOWListToJson.java b/src_app/cn/coyoteam/aweresf/web/xw/render/impl/generator/GenOWListToJson.java deleted file mode 100644 index cbb94e10b..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/render/impl/generator/GenOWListToJson.java +++ /dev/null @@ -1,56 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.render.impl.generator; - -import java.util.Date; - -import javax.servlet.http.HttpServletRequest; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.lang.DataElement; -import com.amarsoft.awe.dw.ASColumn; -import com.amarsoft.awe.dw.ASDataObject; -import com.amarsoft.awe.dw.handler.BusinessProcessData; -import com.amarsoft.awe.dw.ui.htmlfactory.imp.DefaultListHtmlGenerator; - -import cn.coyoteam.aweresf.web.xw.OWConvert; -import cn.coyoteam.aweresf.web.xw.segment.model.DataList; - -/** - * @author EX-YANGSONG001 - * 把Info页面数据处理为JSON数据的转换处理器 - */ -public class GenOWListToJson extends DefaultListHtmlGenerator{ - - public void run(BusinessProcessData bpData) throws Exception { - super.run(bpData); - asObj.getCurPage().setAttribute("OWListPageCount", ""+getPageCount()); - asObj.getCurPage().setAttribute("OWListPageSize", ""+getPageSize()); - asObj.getCurPage().setAttribute("OWListRowCount", ""+getRowCount()); - } - - public void initConstructParams(ASDataObject doTemp, String indexName, - String paramstr, int pageSize, int curPage, - HttpServletRequest request) { - DataList dataList = new DataList(); - OWConvert.initDataListWithPage(dataList, doTemp.getCurPage()); - int pgIdx = dataList.getPageIndex(); - int pgSz = dataList.getPageSize(); - - if(pgIdx<=0)pgIdx = curPage; - if(pgSz<=0)pgSz = pageSize; - super.initConstructParams(doTemp, indexName, paramstr, pgSz, pgIdx, request); - - } - - public String getValue(ASColumn column, BizObject jbo) throws Exception{ - String value = super.getValue(column, jbo); - String colName = column.getAttribute("colname"); - //日期处理为ALS系统格式化日期,不使用默认对象日期的ISO格式,否则再反向序列化时,会出错 - if(jbo.indexOfAttribute(colName)>0){ - DataElement element = jbo.getAttribute(colName); - if(element.getValue() instanceof Date){ - value = element.getString(); - } - } - return value; - } -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/CheckFormat.java b/src_app/cn/coyoteam/aweresf/web/xw/segment/model/CheckFormat.java deleted file mode 100644 index 7e9275dad..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/CheckFormat.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * - */ -package cn.coyoteam.aweresf.web.xw.segment.model; - -/** - * @author EX-YANGSONG001 - * - */ -public class CheckFormat { - -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/CodePair.java b/src_app/cn/coyoteam/aweresf/web/xw/segment/model/CodePair.java deleted file mode 100644 index 919206a03..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/CodePair.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.segment.model; - -import java.io.Serializable; - -/** - * @author EX-YANGSONG001 - * - */ -public class CodePair implements Serializable,Cloneable{ - - private static final long serialVersionUID = 654632198611917217L; - private String code; - private String name; - - - public CodePair() { - } - - public CodePair(String code, String name) { - this.code = code; - this.name = name; - } - /** - * @return 获取 code - */ - public String getCode() { - return code; - } - /** - * @param 把参数code 设置到 code - */ - public void setCode(String code) { - this.code = code; - } - /** - * @return 获取 name - */ - public String getName() { - return name; - } - /** - * @param 把参数name 设置到 name - */ - public void setName(String name) { - this.name = name; - } - - -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/DataList.java b/src_app/cn/coyoteam/aweresf/web/xw/segment/model/DataList.java deleted file mode 100644 index 072ff59ad..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/DataList.java +++ /dev/null @@ -1,79 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.segment.model; - -import java.io.Serializable; - -/** - * @author EX-YANGSONG001 - * 列表数据 - */ -public class DataList implements Serializable,Cloneable{ - - private static final long serialVersionUID = -3681515594509551592L; - - private int pageIndex; //当前页索引 - private int pageCount; //总页数 - private int rowCount; //当前页记录条数 - private int pageSize; //每页记录条数 - private Object list; - - /** - * @return 获取 当前页码对应的索引(从0开始) - */ - public int getPageIndex() { - return pageIndex; - } - /** - * @param 设置当前页码对应的索引(从0开始) - */ - public void setPageIndex(int pageIndex) { - this.pageIndex = pageIndex; - } - /** - * @return 获取总页数 - */ - public int getPageCount() { - return pageCount; - } - /** - * @param 设置总页数 - */ - public void setPageCount(int pageCount) { - this.pageCount = pageCount; - } - /** - * @return 获取当前页记录条数 - */ - public int getRowCount() { - return rowCount; - } - /** - * @param 设置当前页记录条数 - */ - public void setRowCount(int rowCount) { - this.rowCount = rowCount; - } - /** - * @return 获取每页大小 - */ - public int getPageSize() { - return pageSize; - } - /** - * @param 设置每页大小 - */ - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - /** - * @return 获取 list - */ - public Object getList() { - return list; - } - /** - * @param 把参数list 设置到 list - */ - public void setList(Object list) { - this.list = list; - } -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/DataType.java b/src_app/cn/coyoteam/aweresf/web/xw/segment/model/DataType.java deleted file mode 100644 index a10b33de5..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/DataType.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * - */ -package cn.coyoteam.aweresf.web.xw.segment.model; - -/** - * @author EX-YANGSONG001 - * - */ -public enum DataType { - String, Number -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/EditType.java b/src_app/cn/coyoteam/aweresf/web/xw/segment/model/EditType.java deleted file mode 100644 index 4a5d6488b..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/EditType.java +++ /dev/null @@ -1,8 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.segment.model; - -/** - * @author EX-YANGSONG001 编辑类型 - */ -public enum EditType { - TextField, TextArea, RadioBox, CheckBox, Select, Date -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/Element.java b/src_app/cn/coyoteam/aweresf/web/xw/segment/model/Element.java deleted file mode 100644 index 93f8e6d13..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/Element.java +++ /dev/null @@ -1,219 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.segment.model; - -import java.io.Serializable; - -/** - * 页面元素基础类 - * - * @author EX-YANGSONG001 - * - */ -public class Element implements Serializable, Cloneable { - - private static final long serialVersionUID = -287672580470742155L; - - protected String index; - protected String id; - protected String name; - protected EditType editType; - protected DataType dataType; - protected String prefix; - protected String suffix; - protected String groupId; - protected String checkFormat; - protected HorAlign horAlign; - protected String htmlStyle; - protected boolean visible; - protected boolean readonly; - protected boolean required; - protected int colspan; - /** - * @return 获取 index - */ - public String getIndex() { - return index; - } - /** - * @param 把参数index 设置到 index - */ - public void setIndex(String index) { - this.index = index; - } - /** - * @return 获取 id - */ - public String getId() { - return id; - } - /** - * @param 把参数id 设置到 id - */ - public void setId(String id) { - this.id = id; - } - /** - * @return 获取 name - */ - public String getName() { - return name; - } - /** - * @param 把参数name 设置到 name - */ - public void setName(String name) { - this.name = name; - } - /** - * @return 获取 editType - */ - public EditType getEditType() { - return editType; - } - /** - * @param 把参数editType 设置到 editType - */ - public void setEditType(EditType editType) { - this.editType = editType; - } - /** - * @return 获取 dataType - */ - public DataType getDataType() { - return dataType; - } - /** - * @param 把参数dataType 设置到 dataType - */ - public void setDataType(DataType dataType) { - this.dataType = dataType; - } - /** - * @return 获取 prefix - */ - public String getPrefix() { - return prefix; - } - /** - * @param 把参数prefix 设置到 prefix - */ - public void setPrefix(String prefix) { - this.prefix = prefix; - } - /** - * @return 获取 suffix - */ - public String getSuffix() { - return suffix; - } - /** - * @param 把参数suffix 设置到 suffix - */ - public void setSuffix(String suffix) { - this.suffix = suffix; - } - /** - * @return 获取 groupId - */ - public String getGroupId() { - return groupId; - } - /** - * @param 把参数groupId 设置到 groupId - */ - public void setGroupId(String groupId) { - this.groupId = groupId; - } - /** - * @return 获取 checkFormat - */ - public String getCheckFormat() { - return checkFormat; - } - /** - * @param 把参数checkFormat 设置到 checkFormat - */ - public void setCheckFormat(String checkFormat) { - this.checkFormat = checkFormat; - } - /** - * @return 获取 horAlign - */ - public HorAlign getHorAlign() { - return horAlign; - } - /** - * @param 把参数horAlign 设置到 horAlign - */ - public void setHorAlign(HorAlign horAlign) { - this.horAlign = horAlign; - } - /** - * @return 获取 htmlStyle - */ - public String getHtmlStyle() { - return htmlStyle; - } - /** - * @param 把参数htmlStyle 设置到 htmlStyle - */ - public void setHtmlStyle(String htmlStyle) { - this.htmlStyle = htmlStyle; - } - /** - * @return 获取 visible - */ - public boolean isVisible() { - return visible; - } - /** - * @param 把参数visible 设置到 visible - */ - public void setVisible(boolean visible) { - this.visible = visible; - } - /** - * @return 获取 readonly - */ - public boolean isReadonly() { - return readonly; - } - /** - * @param 把参数readonly 设置到 readonly - */ - public void setReadonly(boolean readonly) { - this.readonly = readonly; - } - /** - * @return 获取 required - */ - public boolean isRequired() { - return required; - } - /** - * @param 把参数required 设置到 required - */ - public void setRequired(boolean required) { - this.required = required; - } - /** - * @return 获取 colspan - */ - public int getColspan() { - return colspan; - } - /** - * @param 把参数colspan 设置到 colspan - */ - public void setColspan(int colspan) { - this.colspan = colspan; - } - - - public String toString() { - return "Element [id=" + id + ", name=" + name + ", editType=" - + editType + ", dataType=" + dataType + "]"; - } - - - -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/ElementGroup.java b/src_app/cn/coyoteam/aweresf/web/xw/segment/model/ElementGroup.java deleted file mode 100644 index 0d8e48b43..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/ElementGroup.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.segment.model; - -import java.io.Serializable; - -/** - * @author EX-YANGSONG001 - * 业务元素分组 - */ -public class ElementGroup implements Serializable, Cloneable { - private static final long serialVersionUID = -5180988762708683744L; - protected String id; - protected String name; - /** - * @return the id - */ - public String getId() { - return id; - } - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - /** - * @return the name - */ - public String getName() { - return name; - } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/HorAlign.java b/src_app/cn/coyoteam/aweresf/web/xw/segment/model/HorAlign.java deleted file mode 100644 index 12484029e..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/HorAlign.java +++ /dev/null @@ -1,5 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.segment.model; - -public enum HorAlign { - Left, Center, Right -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/LayoutStyle.java b/src_app/cn/coyoteam/aweresf/web/xw/segment/model/LayoutStyle.java deleted file mode 100644 index 1eca83fac..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/LayoutStyle.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.segment.model; - -/** - * @author EX-YANGSONG001 - * - */ -public enum LayoutStyle { - List,Info -} diff --git a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/Segment.java b/src_app/cn/coyoteam/aweresf/web/xw/segment/model/Segment.java deleted file mode 100644 index 495f28844..000000000 --- a/src_app/cn/coyoteam/aweresf/web/xw/segment/model/Segment.java +++ /dev/null @@ -1,131 +0,0 @@ -package cn.coyoteam.aweresf.web.xw.segment.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * 页面部件,包括页面元素,数据,代码对照表三部分组成 - * @author EX-YANGSONG001 - * @date 2015/05/14 - */ -public class Segment implements Serializable,Cloneable{ - private static final long serialVersionUID = -9079721086646268196L; - - protected String id; - protected String name; - protected LayoutStyle layoutStyle; - protected List elementGroups; - protected Map elements; - protected Object data; - protected Map> codemap; - protected String mergeCol;//待特殊处理合并字段 ,可在拦截器中选择是否对该部分字段处理。 - - public Segment(){ - elements = new LinkedHashMap(); - elementGroups = new ArrayList(); - } - - public Segment(String id, String name) { - this.id = id; - this.name = name; - } - - /** - * @return 获取 id - */ - public String getId() { - return id; - } - - /** - * @param 把参数id 设置到 id - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return 获取 name - */ - public String getName() { - return name; - } - - /** - * @param 把参数name 设置到 name - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return 获取 layoutStyle - */ - public LayoutStyle getLayoutStyle() { - return layoutStyle; - } - - /** - * @param 把参数layoutStyle 设置到 layoutStyle - */ - public void setLayoutStyle(LayoutStyle layoutStyle) { - this.layoutStyle = layoutStyle; - } - - /** - * @return 获取 elements - */ - public Map getElements() { - return elements; - } - - /** - * @return 获取元素分组 - */ - public List getElementGroups() { - return elementGroups; - } - - /** - * @return 获取 data - */ - public Object getData() { - return data; - } - - /** - * @param 把参数data 设置到 data - */ - public void setData(Object data) { - this.data = data; - } - - /** - * @return 获取 codemap - */ - public Map> getCodemap() { - return codemap; - } - - /** - * @param 把参数codemap 设置到 codemap - */ - public void setCodemap(Map> codemap) { - this.codemap = codemap; - } - - public String toString() { - return "Segment [id=" + id + ", name=" + name + ", elements="+ elements + "]"; - } - - public String getMergeCol() { - return mergeCol; - } - - public void setMergeCol(String mergeCol) { - this.mergeCol = mergeCol; - } -} diff --git a/src_app/com/amarsoft/aims/InitAREServletX.java b/src_app/com/amarsoft/aims/InitAREServletX.java deleted file mode 100644 index 385aa37c9..000000000 --- a/src_app/com/amarsoft/aims/InitAREServletX.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.amarsoft.aims; - - -import javax.servlet.ServletException; - -import com.amarsoft.are.InitAREServlet; -import com.amarsoft.are.lang.StringX; - -/** - * @author EX-YANGSONG001 - * 扩展ARE启动初始化类,保证在没有pafa.log.home的情况下,也能运行 - */ -public class InitAREServletX extends InitAREServlet { - - private static final long serialVersionUID = 7367963771771558983L; - - public void init() throws ServletException{ - String paraHome = System.getProperty("pafa.log.home"); - //如果不存在para.log.home则使用系统默认的APP_HOME替代 - if(paraHome==null){ - String appHome = getInitParameter("AppHome"); - if ((StringX.isSpace(appHome)) || (appHome.equals(".")) || (appHome.equals("/WEB-INF"))) { - appHome = getServletContext().getRealPath("/WEB-INF"); - appHome = appHome.replace(System.getProperty("file.separator").charAt(0), '/'); - } - paraHome = appHome+"/log"; - System.setProperty("pafa.log.home", paraHome); - } - super.init(); - } -} diff --git a/src_app/com/amarsoft/aims/flow/exp/FlowExpressionTool.java b/src_app/com/amarsoft/aims/flow/exp/FlowExpressionTool.java deleted file mode 100644 index 5ff5fe49f..000000000 --- a/src_app/com/amarsoft/aims/flow/exp/FlowExpressionTool.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.amarsoft.aims.flow.exp; - -import com.amarsoft.amarscript.Any; -import com.amarsoft.amarscript.Expression; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.biz.workflow.FlowTask; -/** - * 处理流程中表达式解析 - * @author SHIGUANGHUA347 - * - */ -public class FlowExpressionTool { - public static Any executeScript(String script, FlowTask task, Transaction Sqlca) throws Exception { - Any rel = null; - if ((script != null) && (!script.equals("")) && (script.trim().length() > 0)){ - try { - String [][] oConstantList = task.getConstantList(); - String [][] constantList = new String[oConstantList.length + 1][2]; - for(int i = 0; i < oConstantList.length; i++){ - constantList[i][0] = oConstantList[i][0]; - constantList[i][1] = oConstantList[i][1]; - } - constantList[oConstantList.length][0] = "#ForkNo"; - constantList[oConstantList.length][1] = task.ForkNo; - - script = Expression.pretreatConstant(script, constantList); - rel = Expression.getExpressionValue(script, Sqlca); - } catch (Exception ex) { - throw new Exception(ex.toString() + " " + script + "定义错误!"); - } - } - - return rel; - } - - public static Any executeScript(String script, String taskNo, Transaction Sqlca) throws Exception { - Any rel = null; - - boolean b = false; - try{ - if(Sqlca == null){ - Sqlca = Transaction.createTransaction("als"); - b = true; - } - FlowTask task = new FlowTask(taskNo, Sqlca); - rel = executeScript(script, task, Sqlca); - } catch (Exception ex) { - if (b && Sqlca != null){ - try { - Sqlca.rollback(); - } catch (Exception e1) { - e1.printStackTrace(); - } - } - - throw new Exception(ex.toString() + " " + script + "定义错误!"); - } finally { - if (b && Sqlca != null){ - try { - Sqlca.commit(); - Sqlca.disConnect(); - Sqlca = null; - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - return rel; - } -} diff --git a/src_app/com/amarsoft/aims/tools/CnUpperCaser.java b/src_app/com/amarsoft/aims/tools/CnUpperCaser.java deleted file mode 100644 index 697a46916..000000000 --- a/src_app/com/amarsoft/aims/tools/CnUpperCaser.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.amarsoft.aims.tools; - -import java.util.Arrays; -import java.util.List; - -/** - * @author xfliu - * @since 2014年8月14日上午9:12:14 - */ -public class CnUpperCaser { - // 整数部分 - private String integerPart; - // 小数部分 - private String floatPart; - - // 将数字转化为汉字的数组,因为各个实例都要使用所以设为静态 - private static final char[] cnNumbers = { '零', '壹', '贰', '叁', '肆', '伍', - '陆', '柒', '捌', '玖' }; - - // 供分级转化的数组,因为各个实例都要使用所以设为静态 - private static final char[] series = { '元', '拾', '百', '仟', '万', '拾', '百', - '仟', '亿' }; - - /** - * 构造函数,通过它将阿拉伯数字形式的字符串传入 - * - * @param original - */ - public CnUpperCaser(String original) { - // 成员变量初始化 - integerPart = ""; - floatPart = ""; - - if (original.contains(".")) { - // 如果包含小数点 - int dotIndex = original.indexOf("."); - integerPart = original.substring(0, dotIndex); - floatPart = original.substring(dotIndex + 1); - } else { - // 不包含小数点 - integerPart = original; - } - } - - /** - * 取得大写形式的字符串 - * - * @return - */ - public String getCnString() { - // 因为是累加所以用StringBuffer - StringBuffer sb = new StringBuffer(); - - // 整数部分处理 - for (int i = 0; i < integerPart.length(); i++) { - int number = getNumber(integerPart.charAt(i)); - - sb.append(cnNumbers[number]); - sb.append(series[integerPart.length() - 1 - i]); - } - - // 小数部分处理 - if (floatPart.length() > 0) { - sb.append("点"); - for (int i = 0; i < floatPart.length(); i++) { - int number = getNumber(floatPart.charAt(i)); - - sb.append(cnNumbers[number]); - } - } - - // 返回拼接好的字符串 - return sb.toString(); - } - - /** - * 将字符形式的数字转化为整形数字 因为所有实例都要用到所以用静态修饰 - * - * @param c - * @return - */ - private static int getNumber(char c) { - String str = String.valueOf(c); - return Integer.parseInt(str); - } - - /** - * @param args - */ - public static void main(String[] args) { -// System.out.println(new CnUpperCaser("123456789.12345").getCnString()); -// System.out.println(new CnUpperCaser("123456789").getCnString()); -// System.out.println(new CnUpperCaser(".123456789").getCnString()); -// System.out.println(new CnUpperCaser("0.1234").getCnString()); -// System.out.println(new CnUpperCaser("1").getCnString()); -// System.out.println(new CnUpperCaser("12").getCnString()); -// System.out.println(new CnUpperCaser("123").getCnString()); -// System.out.println(new CnUpperCaser("1234").getCnString()); -// System.out.println(new CnUpperCaser("12345").getCnString()); -// System.out.println(new CnUpperCaser("123456").getCnString()); -// System.out.println(new CnUpperCaser("1234567").getCnString()); -// System.out.println(new CnUpperCaser("12345678").getCnString()); -// System.out.println(new CnUpperCaser("123456789").getCnString()); - List numbers = Arrays.asList( - "1", - "123", - "123456789", - "101", - "1001", - "100000", - "1000300000250000004", - "205734908570001", - "1348900" - ); - NumberText nt = NumberText.getInstance(NumberText.Lang.ChineseSimplified); - for(String number : numbers) - System.out.println(nt.getText(number)); - - System.out.println("---"); - - nt = NumberText.getInstance(NumberText.Lang.ChineseTraditional); - for(String number : numbers) - System.out.println(nt.getText(number)); - - System.out.println("---"); - - nt = NumberText.getInstance(NumberText.Lang.English); - for(String number : numbers) - System.out.println(nt.getText(number)); - } -} diff --git a/src_app/com/amarsoft/aims/tools/Excel2SqlConvertor.java b/src_app/com/amarsoft/aims/tools/Excel2SqlConvertor.java deleted file mode 100644 index d27da2c92..000000000 --- a/src_app/com/amarsoft/aims/tools/Excel2SqlConvertor.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.amarsoft.aims.tools; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import jxl.Sheet; -import jxl.Workbook; -import jxl.read.biff.BiffException; - -public class Excel2SqlConvertor { - /** - *将xls文件按照指定的sql语句模板转换成sql脚本。 - *@param xlsFile xls文件路径 - *@param sqlFile 要输出的sql脚本文件路径 - *@param template sql语句模板 - *@param sheetIndex xls中标签页的序号(从0开始) - *@param start 转换开始的行数 (从0开始) - *@param end 转换结束的行数 (从0开始) - *@throws IOException - *@throws BiffException - */ - public static void convert(String xlsFile, String sqlFile, String template,int sheetIndex,int start, int end) throws IOException, BiffException { - // 获取工作薄 - Workbook workbook = Workbook.getWorkbook(new File(xlsFile)); - Sheet sheet = workbook.getSheet(sheetIndex); // 获取sql中的所有字段点位符 - Matcher matcher = Pattern.compile("(:\\d)").matcher(template); - List columns = new ArrayList(); - while (matcher.find()) { - columns.add(Integer.valueOf(matcher.group().replace(":", ""))); - } - // 输出sql脚本文件 - PrintWriter writer = new PrintWriter(new FileWriter(sqlFile)); - System.out.println("Writing sql statements to file: " + sqlFile); - System.out.println("-------------------------------------------------------------------------------"); - int rowCount = 0; - for (int i = 0, j = sheet.getRows(); i < j; i++) { - if (i < start - 1 || i >= end) { - continue; - }else { - // 组装sql语句 - String line = new String(template); - for (Integer column : columns) { - //System.out.println("xfliu"+line); - line = line.replace(":" + column, sheet.getCell(column, i).getContents()); - } - System.out.println(line); - writer.println(line); - rowCount++; - } - } - writer.flush(); - writer.close(); - System.out.println("-------------------------------------------------------------------------------"); - System.out.format("Converting completed. %d row(s) in total.%n", rowCount); - //Runtime.getRuntime().exec("notepad.exe " + sqlFile); } - - } - public static void main(String[] args) { - String xlsFile = "d:\\文档梳理20140813.xls"; - String sqlFile = "d:\\文档梳理20140813XT.SQL"; - // 其中:0 :2 :6 为值所在excel的列号 - //String template = "INSERT INTO NEW_BUSINESS_TYPE(TYPENO, SORTNO, TYPENAME,ISINUSE,OFFSHEETFLAG,ApplyDetailNo,ApproveDetailNo,ContractDetailNo,DisplayTemplet,INPUTUSER,INPUTORG,INPUTTIME) VALUES(':0', ':0', ':1',':2',':3',':4',':5',':6',':7'"+",'system','1','"+StringFunction.getTodayNow()+"');"; - //String template = "insert into CODE_LIBRARY (CODENO, ITEMNO, ITEMNAME, BANKNO, SORTNO, ISINUSE, ITEMDESCRIBE, ITEMATTRIBUTE, RELATIVECODE, ATTRIBUTE1, ATTRIBUTE2, ATTRIBUTE3, ATTRIBUTE4, ATTRIBUTE5, ATTRIBUTE6, ATTRIBUTE7, ATTRIBUTE8, INPUTUSER, INPUTORG, INPUTTIME, UPDATEUSER, UPDATETIME, REMARK, HELPTEXT) values ('BelSecIndustry',':0', ':1', null, ':0', '1', null, null, null, null, null, null, null, null, null, null, null, 'SYS_Designer', null, '2014/07/17', 'SYS_Designer', '2014/07/17', null, null);"; - String template = "insert into doc_library (DOCNO,sortno,doctitle,DocStage,REMARK) values (':0', ':0', ':1', ':2', ':3');"; - try { - Excel2SqlConvertor.convert(xlsFile, sqlFile, template, 1, 0, 170); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/src_app/com/amarsoft/aims/tools/NumberText.java b/src_app/com/amarsoft/aims/tools/NumberText.java deleted file mode 100644 index 77e7df130..000000000 --- a/src_app/com/amarsoft/aims/tools/NumberText.java +++ /dev/null @@ -1,626 +0,0 @@ -package com.amarsoft.aims.tools; - -import java.util.HashMap; -import java.util.Map; - -public abstract class NumberText { - - /*---------------------------------------------------------------------------- - * not designed to be inherented outside this file - * no public constructors provided, -- use factory method - ---------------------------------------------------------------------------*/ - private NumberText() {} - - /** - * Exports a {@code NumberText} implementation instance, based on a natural - * language argument. {@see Lang} - * - * @param lang - * @return a NumberText instance. - */ - public static NumberText getInstance(Lang lang) { - - return lang.instance(); - } - - /** - * Transfers an integer number into a String, specifically in which language - * depends on the implementation. - *

- * e.g. in EnglishWithDash, - *

- * 100 -> one hundred - *
- * -976083854 -> minus nine hundred and seventy-six million and eighty-three - * thousand eight hundred and fifty-four - * - * @param number the integer number to be transfered - * @return the result String - */ - public final String getText(long number) { - - return getText(Long.toString(number)); - } - - /** - * Transfers an integer number into a String, specifically in which language - * depends on the implementation. - *

- * e.g. in EnglishWithDash, - *

- * 100 -> one hundred - *
- * -976083854 -> minus nine hundred and seventy-six million and eighty-three - * thousand eight hundred and fifty-four - * - * @param number the integer number to be transfered - * @return the result String - */ - public abstract String getText(String number); - - /** - * Transfers an integer number into a String of its ordinal representation, - * specifically in which language depends on the implementation. - *

- * e.g. in EnglishWithDash, - *

- * 100 -> one hundredth - *
- * 8331125 -> eight million three hundred and thirty-one thousand one - * hundred and twenty-fifth - * - * @param number the integer number to be transfered - * @return the result String - */ - public final String getOrdinalText(long number) { - - return getOrdinalText(Long.toString(number)); - } - - /** - *

- * Transfers an integer number into a String of its ordinal representation, - * specifically in which language depends on the implementation. - *

- * - *

- * e.g. in EnglishWithDash, - *

- * 100 -> one hundredth - *
- * 8331125 -> eight million three hundred and thirty-one thousand one - * hundred and twenty-fifth - *

- * - * @param number the integer number to be transfered - * @return the result String - */ - public abstract String getOrdinalText(String number); - - /** - * This enumeration type is typically named under a natural language - * name, and is to mark a specific implementation name; it is used as an - * argument to call the factory method - * {@link NumberText#getInstance(NumberText.Lang)}. - */ - public static enum Lang { - - English (NumberTextEnglishCleanSpaceOnly.INSTANCE), - EnglishWithDash (NumberTextEnglish.INSTANCE), - ChineseSimplified (NumberTextChinese.SIMPLIFIED), - ChineseTraditional (NumberTextChinese.TRADITIONAL), - ; - - private final NumberText instance; - private Lang(NumberText instance) { - - this.instance = instance; - } - - private NumberText instance() { - - if( instance == null ) - throw new UnsupportedOperationException( - "Language not supported yet : " + this); - - return instance; - } - } - - abstract int limit(); - - void checkNumber(String number) { - - if( !number.matches("-?\\d+") ) - throw new NumberFormatException(); - - int length = number.length(); - if( number.startsWith("-") ) - length --; - - if( length > limit() ) - throw new UnsupportedOperationException( - "The current " + NumberText.class.getSimpleName() + - "can only handle numbers up to (+/-)10^" + limit() + "."); - } - - /*---------------------------------------------------------------------------- - * EnglishWithDash Implementation - ---------------------------------------------------------------------------*/ - private static class NumberTextEnglish extends NumberText { - - private static final NumberText INSTANCE = new NumberTextEnglish(); - - static enum Connect { - - Minus ("minus"), - Hundred ("hundred"), - And ("and"), - AfterMinus (" "), - AfterNumber (" "), - AfterPower (" "), - AfterHundred (" "), - AfterAnd (" "), - AfterTen ("-"), - ; - - final String display; - Connect(String display) { this.display = display; } - - private static boolean isConnect(char c) { - return c == ' ' || c == '-'; - } - } - - static enum Power { - - Thousand ("thousand"), // 10 ^ 3 - Million ("million"), // 10 ^ 6 - Billion ("billion"), // 10 ^ 9 - Trillion ("trillion"), // 10 ^ 12 - Quadrillion ("quadrillion"), // 10 ^ 15 - Quintillion ("quintillion"), // 10 ^ 18 (enough for Long.MAX_VALUE) - Sextillion ("sextillion"), // 10 ^ 21 - Septillion ("septillion"), // 10 ^ 24 - Octillion ("octillion"), // 10 ^ 27 - Nonillion ("nonillion"), // 10 ^ 30 - Decillion ("decillion"), // 10 ^ 33 - Undecillion ("undecillion"), // 10 ^ 36 - Duodecillion ("duodecillion"), // 10 ^ 39 - Tredecillion ("tredecillion"), // 10 ^ 42 - Quattuordecillion ("quattuordecillion"), // 10 ^ 45 - Quindecillion ("quindecillion"), // 10 ^ 48 - Sexdecillion ("sexdecillion"), // 10 ^ 51 - Septendecillion ("septendecillion"), // 10 ^ 54 - Octodecillion ("octodecillion"), // 10 ^ 57 - Novemdecillion ("novemdecillion"), // 10 ^ 60 - Vigintillion ("vigintillion"), // 10 ^ 63 - ; - - final String display; - Power(String display) { this.display = display; } - } - - static enum Digit { - - Zero ("zero", "zeroth", "ten", ""), - One ("one", "first", "eleven", "ten"), - Two ("two", "second", "twelve", "twenty"), - Three ("three", "third", "thirteen", "thirty"), - Four ("four", "fourth", "fourteen", "fourty"), - Five ("five", "fifth", "fifteen", "fifty"), - Six ("six", "sixth", "sixteen", "sixty"), - Seven ("seven", "seventh", "seventeen", "seventy"), - Eight ("eight", "eighth", "eighteen", "eighty"), - Nine ("nine", "nineth", "nineteen", "ninety"), - ; - - final String display, displayOrdinal, plusTen, multiTen; - Digit(String display, String displayOrdinal, - String plusTen, String multiTen) { - this.display = display; - this.displayOrdinal = displayOrdinal; - this.plusTen = plusTen; - this.multiTen = multiTen; - } - } - - private static final Map _Ordinals; - static { - _Ordinals = new HashMap(); - for(Digit d : Digit.values()) - _Ordinals.put(d.display, d.displayOrdinal); - } - - @Override - int limit() { - - return 63; - } - - @Override - public String getText(String number) { - - checkNumber(number); - - StringBuilder builder = new StringBuilder(); - buildText(builder, number); - return builder.toString(); - } - - @Override - public String getOrdinalText(String number) { - - checkNumber(number); - - StringBuilder builder = new StringBuilder(); - buildText(builder, number); - replaceLastTokenWithOrdinal(builder); - return builder.toString(); - } - - private void buildText(StringBuilder builder, String number) { - - assert builder != null; - - if( number.startsWith("-") ) { - builder.append(getConnectDisplay(Connect.Minus)) - .append(getConnectDisplay(Connect.AfterMinus)); - number = number.substring(1); - } - - int power = 0; - while(number.length() > (power + 1) * 3) - power++; - - while(power > 0) { - boolean modified = extendToken(builder, number, power * 3); - if( modified ) - builder.append(getConnectDisplay(Connect.AfterNumber)) - .append(getPowerDisplay(Power.values()[power-1])); - power--; - } - extendToken(builder, number, 0); - } - - private boolean extendToken(StringBuilder builder, - String number, - int suffix) { - - assert builder != null && suffix < number.length(); - - int len = number.length() - suffix; - int hundreds = len > 2 ? (int)(number.charAt(len-3)-'0') : -1; - int tens = len > 1 ? (int)(number.charAt(len-2)-'0') : -1; - int inds = (int)(number.charAt(len-1)-'0'); - - if( hundreds <= 0 && tens <= 0 && inds <= 0 && suffix > 0 ) - return false; - else if( len > 3 ) - builder.append(getConnectDisplay(Connect.AfterPower)); - - if( hundreds == 0 ) { - if( len > 3 && (tens > 0 || inds > 0) ) - builder.append(getConnectDisplay(Connect.And)) - .append(getConnectDisplay(Connect.AfterAnd)); - } - else if( hundreds > 0 ) { - builder.append(getDigitName(Digit.values()[hundreds])) - .append(getConnectDisplay(Connect.AfterNumber)) - .append(getConnectDisplay(Connect.Hundred)); - if( tens > 0 || inds > 0 ) - builder.append(getConnectDisplay(Connect.AfterHundred)) - .append(getConnectDisplay(Connect.And)) - .append(getConnectDisplay(Connect.AfterAnd)); - } - - if( tens > 1 ) { - builder.append(getDigitMultiTen(Digit.values()[tens])); - if( inds > 0 ) - builder.append(getConnectDisplay(Connect.AfterTen)); - } - - if( tens == 1 ) - builder.append(getDigitPlusTen(Digit.values()[inds])); - else if( inds > 0 || number.length() == 1 ) - builder.append(getDigitName(Digit.values()[inds])); - - return true; - } - - private void replaceLastTokenWithOrdinal(StringBuilder builder) { - - assert builder != null && builder.length() > 0; - - int suffix = builder.length()-1; - while( suffix >= 0 && !isConnect(builder.charAt(suffix)) ) - suffix--; - String lastToken = builder.substring(suffix+1); - builder.delete(suffix+1, builder.length()).append(toOrdinal(lastToken)); - } - - String getPowerDisplay(Power power) { - - assert power != null; - - return power.display; - } - - String getConnectDisplay(Connect connect) { - - assert connect != null; - - return connect.display; - } - - String getDigitName(Digit digit) { - - assert digit != null; - - return digit.display; - } - - String toOrdinal(String name) { - - assert name != null && !name.isEmpty(); - - String result = _Ordinals.get(name); - if( result == null ) { - if( name.charAt(name.length()-1) == 'y' ) - result = name.substring(0, name.length()-1) + "ieth"; - else - result = name + "th"; - } - return result; - } - - String getDigitPlusTen(Digit digit) { - - assert digit != null; - - return digit.plusTen; - } - - String getDigitMultiTen(Digit digit) { - - assert digit != null; - - return digit.multiTen; - } - - boolean isConnect(char c) { - return Connect.isConnect(c); - } - } - - /*---------------------------------------------------------------------------- - * EnglishWithDash with only Clean Space Connectors - ---------------------------------------------------------------------------*/ - private static class NumberTextEnglishCleanSpaceOnly - extends NumberTextEnglish { - - private static final NumberText INSTANCE = - new NumberTextEnglishCleanSpaceOnly(); - - @Override - String getConnectDisplay(Connect connect) { - - return connect == Connect.AfterTen ? - " " : - super.getConnectDisplay(connect); - } - } - - /*---------------------------------------------------------------------------- - * ChineseSimplified Implementation - ---------------------------------------------------------------------------*/ - private static class NumberTextChinese extends NumberText { - - private static final NumberText SIMPLIFIED = - new NumberTextChinese(Type.Simplified); - private static final NumberText TRADITIONAL = - new NumberTextChinese(Type.Traditional); - - static enum Type { Simplified, Traditional; } - - static enum Connect { - Di ("第", "第"), - Fu ("负", "負"), - Ling ("零", "零"), - Shi ("十", "拾"), - Bai ("百", "佰"), - Qian ("千", "仟"), - ; - - final String display, displayTraditional; - Connect(String display, String displayTraditional) { - this.display = display; - this.displayTraditional = displayTraditional; - } - } - - static enum Power { - - Wan ("万", "萬"), // 10^4 - Yi ("亿", "億"), // 10^8 - Zhao ("兆", "兆"), // 10^12 - Jing ("京", "京"), // 10^16 (enough for Long.MAX_VALUE) - Gai ("垓", "垓"), // 10^20 - Zi ("秭", "秭"), // 10^24 - Rang ("穰", "穰"), // 10^28 - Gou ("沟", "溝"), // 10^32 - Jian ("涧", "澗"), // 10^36 - Zheng ("正", "正"), // 10^40 - Zai ("载", "載"), // 10^44 - ; - - final String display, displayTraditional; - Power(String display, String displayTraditional) { - this.display = display; - this.displayTraditional = displayTraditional; - } - } - - static enum Digit { - - Ling ("零", "零"), // just to occupy this position - Yi ("一", "壹"), - Er ("二", "贰"), - San ("三", "叁"), - Si ("四", "肆"), - Wu ("五", "伍"), - Liu ("六", "陆"), - Qi ("七", "柒"), - Ba ("八", "捌"), - Jiu ("九", "玖"), - ; - - final String display, displayTraditional; - Digit(String display, String displayTraditional) { - this.display = display; - this.displayTraditional = displayTraditional; - } - } - - private final Type type; - private NumberTextChinese(Type type) { - assert type != null; - - this.type = type; - } - - @Override - int limit() { - - return 44; - } - - @Override - public String getText(String number) { - - checkNumber(number); - - StringBuilder builder = new StringBuilder(); - buildText(builder, number); - return builder.toString(); - } - - @Override - public String getOrdinalText(String number) { - - checkNumber(number); - - StringBuilder builder = new StringBuilder().append(Connect.Di); - buildText(builder, number); - return builder.toString(); - } - - private void buildText(StringBuilder builder, String number) { - - assert builder != null; - - if( number.startsWith("-") ) { - builder.append(getConnectDisplay(Connect.Fu)); - number = number.substring(1); - } - - int power = 0; - while(number.length() > (power + 1) * 4) - power++; - - while(power > 0) { - if( extendToken(builder, number, power * 4) ) - builder.append(getPowerDisplay(Power.values()[power-1])); - power--; - } - extendToken(builder, number, 0); - } - - private boolean extendToken(StringBuilder builder, - String number, - int suffix) { - - assert builder != null && number.length() > suffix; - - int len = number.length() - suffix; - int qian = len > 3 ? (int)(number.charAt(len-4)-'0') : -1; - int bai = len > 2 ? (int)(number.charAt(len-3)-'0') : -1; - int shi = len > 1 ? (int)(number.charAt(len-2)-'0') : -1; - int ind = (int)(number.charAt(len-1)-'0'); - - boolean nonZero = false; // true if any of the digits is not zero - if( qian == 0 ) { - if( bai > 0 || shi > 0 || ind > 0 ) - builder.append(getConnectDisplay(Connect.Ling)); - } - else if( qian > 0 ){ - builder.append(getDigitDisplay(Digit.values()[qian])) - .append(getConnectDisplay(Connect.Qian)); - nonZero = true; - } - - if( bai == 0 ) { - if( qian > 0 && (shi > 0 || ind > 0) ) - builder.append(getConnectDisplay(Connect.Ling)); - } - else if( bai > 0 ){ - builder.append(getDigitDisplay(Digit.values()[bai])) - .append(getConnectDisplay(Connect.Bai)); - nonZero = true; - } - - if( shi == 0 ) { - if( bai > 0 && ind > 0 ) - builder.append(getConnectDisplay(Connect.Ling)); - } - else if( shi > 0 ){ - if( number.length() > 2 || shi != 1 ) - builder.append(getDigitDisplay(Digit.values()[shi])); - builder.append(getConnectDisplay(Connect.Shi)); - nonZero = true; - } - - if( ind == 0 ){ - boolean addZero = len == 1; - for(int i=1; addZero && i<=suffix; i++) { - if( number.charAt(i) != '0' ) - addZero = false; - } - if( addZero ) builder.append(getConnectDisplay(Connect.Ling)); - } - else { - builder.append(getDigitDisplay(Digit.values()[ind])); - nonZero = true; - } - return nonZero; - } - - String getConnectDisplay(Connect connect) { - - assert connect != null; - - return type == Type.Simplified ? - connect.display : - connect.displayTraditional; - } - - String getPowerDisplay(Power power) { - - assert power != null; - - return type == Type.Simplified ? - power.display : - power.displayTraditional; - } - - String getDigitDisplay(Digit digit) { - - assert digit != null; - - return type == Type.Simplified ? - digit.display : - digit.displayTraditional; - } - } -} - diff --git a/src_app/com/amarsoft/aims/util/ClassHelper.java b/src_app/com/amarsoft/aims/util/ClassHelper.java deleted file mode 100644 index f6e155449..000000000 --- a/src_app/com/amarsoft/aims/util/ClassHelper.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.amarsoft.aims.util; - -/** - * java类静态方法 - * @author syang - * @date 2013-12-30 - */ -public class ClassHelper { - /** - * 创建类的实例 - * @param clazz 类Class对象 - * @param className 类名 - * @return 类实例 - * @throws ClassNotFoundException - * @throws InstantiationException - * @throws IllegalAccessException - */ - public static T createInstance(Class clazz,String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException{ - @SuppressWarnings("unchecked") - Class clazzInstance = (Class) Class.forName(className); - return clazzInstance.newInstance(); - } -} diff --git a/src_app/com/amarsoft/aims/util/ERateTool.java b/src_app/com/amarsoft/aims/util/ERateTool.java deleted file mode 100644 index 4c1a23f86..000000000 --- a/src_app/com/amarsoft/aims/util/ERateTool.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.amarsoft.aims.util; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.lang.StringX; - - - -/** - * 汇率辅助处理工具类 - * @author syang - * @date 2013-12-27 - */ -public class ERateTool { - /** 人民币币种常量 */ - public static final String CURRENCY_RMB = "01"; - /** - * 取任一两种币种间的汇率 - * @param fromCurrency 原币种 - * @param toCurrency 转换的目标币种 - * @return - */ - public static double getERate(String fromCurrency,String toCurrency){ - if(StringX.isEmpty(fromCurrency)){ - ARE.getLog().error("汇率转换源币种为空"); - return 1.0; - } - if(StringX.isEmpty(toCurrency)){ - ARE.getLog().error("汇率转换目标币种为空"); - return 1.0; - } - - if(fromCurrency.equals(toCurrency)){ //两个币种相同,直接返回1 - return 1.0; - } - double currencyFrom = 1.0; - double currencyTo = 1.0; - try { - BizObjectManager bm = JBOFactory.getBizObjectManager("jbo.sys.ERATE_INFO"); - BizObject boFrom = bm.createQuery("Currency=:Currency").setParameter("Currency", fromCurrency).getSingleResult(false); - BizObject boTo = bm.createQuery("Currency=:Currency").setParameter("Currency", toCurrency).getSingleResult(false); - if(boFrom==null||boTo==null)return 1.0; - currencyFrom = boFrom.getAttribute("ExchangeValue").getDouble(); - currencyTo = boTo.getAttribute("ExchangeValue").getDouble(); - } catch (JBOException e) { - ARE.getLog().error("汇率获取错误:JBO读取错误"); - } - - return NumberAssistant.divided(currencyFrom, currencyTo); - } - - /** - * 获取转换成人民币的汇率 - * @param sCurrency - * @return - */ - public static double getERateRMB(String currency){ - return getERate(currency,CURRENCY_RMB); - } - - /** - * 获取金额通过两个币种转换后的值 - * @param sum 金额 - * @param fromCurrency 原币种 - * @param toCurrency 目标币种 - * @return - */ - public static double getExchange(double sum,String fromCurrency,String toCurrency){ - return NumberAssistant.multiply(sum,getERate(fromCurrency,toCurrency)); - } - - /** - * 指定币种的金额转换为人民币后的金额 - * @param sum 金额 - * @param fromCurrency 原币种 - * @return - */ - public static double getExchangeRMB(double sum,String fromCurrency){ - return getExchange(sum,fromCurrency,CURRENCY_RMB); - } - /** - * 人民币转换为本位币后的金额 - * @param rmbSum 人民币金额 - * @param baseCurrency 本位币币种 - * @return - */ - public static double getRMBExchangeBase(double rmbSum,String baseCurrency){ - return getExchange(rmbSum,CURRENCY_RMB,baseCurrency); - } - - -} diff --git a/src_app/com/amarsoft/aims/util/HexHelper.java b/src_app/com/amarsoft/aims/util/HexHelper.java deleted file mode 100644 index 7fdf96676..000000000 --- a/src_app/com/amarsoft/aims/util/HexHelper.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.amarsoft.aims.util; - -import java.io.ByteArrayOutputStream; -import java.io.UnsupportedEncodingException; - -import com.amarsoft.are.lang.StringX; - -/** - * 十六进制辅助处理类 - * @author EX-YANGSONG001 - * - */ -public class HexHelper { - - /** - * unicode转字串 - * @param str - * @return - */ - public static String unicode2String(String... str){ - StringBuffer sb = new StringBuffer(); - for(String s:str){ - if(StringX.isEmpty(s))continue; - int a = Integer.parseInt(s,16); - sb.append((char)a); - } - return sb.toString(); - } - /** - * 转化字符串为十六进制编码 - * @param s - * @return - */ - public static String toHexString(String s) { - String str = ""; - for (int i = 0; i < s.length(); i++) { - int ch = (int) s.charAt(i); - String s4 = Integer.toHexString(ch); - str = str + s4; - } - return str; - } - - // 转化十六进制编码为字符串 - public static String toStringHex1(String s,String charset) throws UnsupportedEncodingException { - byte[] baKeyword = new byte[s.length() / 2]; - for (int i = 0; i < baKeyword.length; i++) { - baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16)); - } - s = new String(baKeyword, charset);// UTF-16le:Not - return s; - } - - public static void main(String[] args) { - String s = encode("[投资计划规模]*85%+[人行基准利率(5年以上)]*90%"); - System.out.println(s); - System.out.println(decode("GB18030","5B62958D448BA1521289C46A215D2A3835252B5B4EBA884C57FA51C65229738728355E744EE54E0A295D2A393025")); - } - - /* - * 16进制数字字符集 - */ - private static String hexString = "0123456789ABCDEF"; - - /** - * 将字符串编码成16进制数字,适用于所有字符(包括中文) - * @param str - * @return - */ - public static String encode(String str) { - // 根据默认编码获取字节数组 - byte[] bytes = str.getBytes(); - StringBuilder sb = new StringBuilder(bytes.length * 2); - // 将字节数组中每个字节拆解成2位16进制整数 - for (int i = 0; i < bytes.length; i++) { - sb.append(hexString.charAt((bytes[i] & 0xf0) >> 4)); - sb.append(hexString.charAt((bytes[i] & 0x0f) >> 0)); - } - return sb.toString(); - } - - - /** - * 将16进制数字解码成字符串,适用于所有字符(包括中文) - * @param charset - * @param str - * @return - * @throws UnsupportedEncodingException - */ - public static String decode(String charset,String[] str) throws UnsupportedEncodingException { - StringBuffer sb = new StringBuffer(); - for(String s:str){ - ByteArrayOutputStream baos = new ByteArrayOutputStream(s.length() / 2); - // 将每2位16进制整数组装成一个字节 - for (int i = 0; i < s.length(); i += 2){ - baos.write((hexString.indexOf(s.charAt(i)) << 4 | hexString.indexOf(s.charAt(i + 1)))); - } - sb.append(new String(baos.toByteArray(),charset)); - } - return sb.toString(); - } - /** - * 将16进制数字解码成字符串,适用于所有字符(包括中文) - * @param bytes - * @return - */ - public static String decode(String... str) { - StringBuffer sb = new StringBuffer(); - for(String s:str){ - ByteArrayOutputStream baos = new ByteArrayOutputStream(s.length() / 2); - // 将每2位16进制整数组装成一个字节 - for (int i = 0; i < s.length(); i += 2){ - baos.write((hexString.indexOf(s.charAt(i)) << 4 | hexString.indexOf(s.charAt(i + 1)))); - } - sb.append(new String(baos.toByteArray())); - } - return sb.toString(); - } - - /** - * 将指定byte数组以16进制的形式打印到控制台 - * @param hint - * @param b - */ - public static void printHexString(String hint, byte[] b) { - System.out.print(hint); - for (int i = 0; i < b.length; i++) { - String hex = Integer.toHexString(b[i] & 0xFF); - if (hex.length() == 1) { - hex = '0' + hex; - } - System.out.print(hex.toUpperCase() + " "); - } - System.out.println(""); - } - - /** - * 二进制转为16进制 - * @param b - * @return - */ - public static String bytes2HexString(byte[] b) { - String ret = ""; - for (int i = 0; i < b.length; i++) { - String hex = Integer.toHexString(b[i] & 0xFF); - if (hex.length() == 1) { - hex = '0' + hex; - } - ret += hex.toUpperCase(); - } - return ret; - } - - /** - * 将两个ASCII字符合成一个字节; 如:"EF"--> 0xEF - * @param src0 - * @param src1 - * @return - */ - public static byte uniteBytes(byte src0, byte src1) { - byte _b0 = Byte.decode("0x" + new String(new byte[] { src0 })).byteValue(); - _b0 = (byte) (_b0 << 4); - byte _b1 = Byte.decode("0x" + new String(new byte[] { src1 })).byteValue(); - byte ret = (byte) (_b0 ^ _b1); - return ret; - } - - /** - * 将指定字符串src,以每两个字符分割转换为16进制形式 如:"2B44EFD9" --> byte[]{0x2B, 0x44, 0xEF,0xD9} - * @param src - * @return - */ - public static byte[] hexString2Bytes(String src) { - byte[] ret = new byte[8]; - byte[] tmp = src.getBytes(); - for (int i = 0; i < 8; i++) { - ret[i] = uniteBytes(tmp[i * 2], tmp[i * 2 + 1]); - } - return ret; - } -} diff --git a/src_app/com/amarsoft/aims/util/JBOHelper.java b/src_app/com/amarsoft/aims/util/JBOHelper.java deleted file mode 100644 index 0349c41c1..000000000 --- a/src_app/com/amarsoft/aims/util/JBOHelper.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.amarsoft.aims.util; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.lang.DataElement; - -/** - * JBO工具类 - * @author syang - * @date 2013/11/18 - */ -public class JBOHelper { - private static Pattern SQL_WHERE_PATTERN = Pattern.compile("\\w+=:(\\w+)",Pattern.CASE_INSENSITIVE); - - /** - * 查找单个对象 - * @param tx 事务对象 - * @param needUpdate 查出来的对象是否需要更新 - * @param jboClass JBO类名 - * @param whereClause where条件 - * @param values 参数值列表 - * @return - */ - public static BizObject querySingle(JBOTransaction tx,boolean needUpdate,String jboClass,String whereClause,Object... values){ - BizObject bizObject = null; - try { - BizObjectQuery query = genQuery(tx,jboClass,whereClause,values); - bizObject = query.getSingleResult(needUpdate); - } catch (JBOException e) { - ARE.getLog().error(MessageFormat.format("在JBO类[{0}]上查找JBO对象出错,查询条件[{1}]", jboClass,whereClause),e); - } - return bizObject; - } - - /** - * 查找单个对象(不需要事务,查出来的对象可以被更新) - * @param jboClass JBO类名 - * @param whereClause where条件 - * @param values 参数值列表 - * @return - */ - public static BizObject querySingle(String jboClass,String whereClause,Object... values){ - return querySingle(null,true,jboClass,whereClause,values); - } - - /** - * 创建JBO新对象 - * @param tx - * @param jboClass - * @return - */ - public static BizObject createBizObject(JBOTransaction tx,String jboClass){ - BizObjectManager bm; - BizObject bo = null; - try { - bm = JBOFactory.getBizObjectManager(jboClass); - if(tx!=null)tx.join(bm); - bo = bm.newObject(); - } catch (JBOException e) { - ARE.getLog().error(MessageFormat.format("在JBO类[{0}]上创建BO对象出错", jboClass),e); - } - return bo; - } - /** - * 创建JBO新对象 - * @param tx - * @param jboClass - * @return - */ - public static BizObject createBizObject(String jboClass){ - return createBizObject(null,jboClass); - } - - /** - * 保存JBO对象 - * @param tx - * @param jboClass - * @param bo - * @return - */ - public static BizObject saveBizObject(JBOTransaction tx,String jboClass,BizObject bo){ - BizObjectManager bm; - try { - bm = JBOFactory.getBizObjectManager(jboClass); - if(tx!=null)tx.join(bm); - bm.saveObject(bo); - } catch (JBOException e) { - ARE.getLog().error(MessageFormat.format("在JBO类[{0}]上创建BO对象出错", jboClass),e); - } - return bo; - } - - - /** - * 保存JBO对象 - * @param jboClass - * @param bo - * @return - */ - public static BizObject saveBizObject(String jboClass,BizObject bo){ - return saveBizObject(null,jboClass,bo); - } - - /** - * 查询一个JBO列表 - * @param tx 事务对象 - * @param needUpdate 查出来的对象是否需要更新 - * @param jboClass JBO类名 - * @param whereClause where条件 - * @param values 参数值列表 - * @return - */ - @SuppressWarnings("unchecked") - public static List queryList(JBOTransaction tx,boolean needUpdate,String jboClass,String whereClause,Object... values){ - List jboList = null; - try { - BizObjectQuery query = genQuery(tx,jboClass,whereClause,values); - jboList = query.getResultList(needUpdate); - } catch (JBOException e) { - ARE.getLog().error(MessageFormat.format("在JBO类[{0}]上查找JBO对象出错,查询条件[{1}]", jboClass,whereClause),e); - } - return jboList; - } - - /** - * 查询一个JBO列表(不需要事务,查出来的对象可以被更新) - * @param jboClass JBO类名 - * @param whereClause where条件 - * @param values 参数值列表 - * @return - */ - public static List queryList(String jboClass,String whereClause,Object... values){ - return queryList(null,true,jboClass,whereClause,values); - } - - /** - * 从JBO的SQL where子语句中解析出参数 - * @param paraNames - * @param s - */ - private static void parseParameterNames(List paraNames,String s){ - Matcher matcher = SQL_WHERE_PATTERN.matcher(s); - if(matcher.find()&&matcher.groupCount()>0){ - String name = matcher.group(1); - paraNames.add(name); - parseParameterNames(paraNames,matcher.replaceFirst("")); - } - } - - /** - * 生成查询条件 - * @param tx 事务对象 - * @param jboClass JBO类名 - * @param whereClause where条件 - * @param values 参数值列表 - * @return - * @throws JBOException - */ - private static BizObjectQuery genQuery(JBOTransaction tx,String jboClass,String whereClause,Object... values) throws JBOException{ - BizObjectManager manager = JBOFactory.getBizObjectManager(jboClass); - if(tx!=null)tx.join(manager); - BizObjectQuery query = manager.createQuery(whereClause); - List paraNames = new ArrayList(); - parseParameterNames(paraNames,whereClause); - - for(int i=0;i - * 该类来源于宁波项目组,原作者王慧
- * 在宁波的基础上,根据安硕信贷系统开发编码规则对代码及注释进行了规范化处理 - * @author syang - * @since 2013-12-27 - * - */ -public class NumberAssistant { - - /** - * 判断一个数字型变量是否是整数。如:double d1=3.00;此时,d1为整数 - * @param originalSum 数字型变量 - * @return - */ - public static boolean isNumeric(double originalSum){ - Double numObj =new Double(originalSum); - return numObj.intValue()==originalSum; - } - - /** - * 保留6位有效数字 - * @param originalSum - * @return - */ - public static double keepSixDecimalFraction(double originalSum){ - return Double.parseDouble(new DecimalFormat("0.000000").format(originalSum)); - } - - /** - * 保留7位有效数字 - * @param originalSum 数字型变量 - * @return - */ - public static double keepSevenDecimalFraction(double originalSum){ - return Double.parseDouble(new DecimalFormat("0.0000000").format(originalSum)); - } - - /** - * 保留6位有效数字 - * @param originalSum 数字型变量 - * @param roud 是否在第七位是否四舍五入 - * @return - */ - public static double keepSixDecimalFraction(double originalSum,boolean roud){ - if(roud){ - return keepSixDecimalFraction(originalSum); - }else{ - return Double.parseDouble((new DecimalFormat("0.0000000").format(originalSum)).substring(0,8)); - } - } - - /** - * 保留2位有效数字 - * @param originalSum 数字型变量 - * @return - */ - public static double keepTwoDecimalFraction(double originalSum){ - return Double.parseDouble(new DecimalFormat("0.00").format(originalSum)); - } - - /** - * 保留2位有效数字,三位一逗,不转换为科学计数法 - * @param originalSum 数字型变量 - * @return - */ - public static String keepTwoDecimalFormat(double originalSum){ - DecimalFormat d = new DecimalFormat("###,##0.00"); - return d.format(originalSum); - } - - /** - * 加法运算 - * @param d1 - * @param d2 - * @return - */ - public static double add(double d1, double d2) { - BigDecimal b1 = new BigDecimal(d1); - BigDecimal b2 = new BigDecimal(d2); - return b1.add(b2).doubleValue(); - } - - /** - * 减法运算 - * @param d1 - * @param d2 - * @return - */ - public static double subtract(double d1, double d2) { - BigDecimal b1 = new BigDecimal(d1); - BigDecimal b2 = new BigDecimal(d2); - return b1.subtract(b2).doubleValue(); - } - - /** - * 乘法运算 - * @param d1 - * @param d2 - * @return - */ - public static double multiply(double d1, double d2) { - BigDecimal b1 = new BigDecimal(d1); - BigDecimal b2 = new BigDecimal(d2); - return b1.multiply(b2).doubleValue(); - } - - /** - * 除法运算 - * @param d1 - * @param d2 - * @return - */ - public static double divided(double d1, double d2) { - BigDecimal b1 = new BigDecimal(d1); - BigDecimal b2 = new BigDecimal(d2); - return b1.divide(b2, 10, BigDecimal.ROUND_HALF_DOWN).doubleValue(); - } - - /** - * 判断两个数字是否相等 - * @param d1 - * @param d2 - * @return - */ - public static boolean equals(double d1,double d2){ - return equals(d1,d2,0.01); - } - - /** - * 判断两个数字是否相等 - * @param d1 - * @param d2 - * @param scale - * @return - */ - public static boolean equals(double d1,double d2,double scale){ - return NumberAssistant.subtract(d1, d2)<=scale; - } - - /** - * 判断大于关系 - * @param d1 - * @param d2 - * @return - */ - public static boolean moreThan(double d1, double d2){ - return NumberAssistant.moreThan(d1, d2, 0.01); - } - - /** - * 判断大于关系 - * @param d1 - * @param d2 - * @param scale - * @return - */ - public static boolean moreThan(double d1, double d2, double scale){ - if(NumberAssistant.equals(d1, d2, scale)){ - return false; - }else{ - return d1 > d2; - } - } - /** - * 金额单位型的转换,如果单位是万元则数据乘以一万,等等 - * @param unitText 单位类型 %,万,亿等等 - * @param valueType 1表示除(一般用在显示时处理),2表示乘(一般用在页面存入数据库时处理) - * @param value 需转换的数据 - */ - public static double doubleValueConvert(String unitText,int valueType,double value){ - double returnValue = value; - if(!StringX.isEmpty(unitText)){ - if(unitText.indexOf("%")>=0){ - if(valueType==2) returnValue = Arith.div(value, 100); - else if(valueType==1) returnValue = Arith.mul(value, 100); - } - if(unitText.indexOf("万")>=0){ - if(valueType==1) returnValue = Arith.div(value, 10000); - else if(valueType==2) returnValue = Arith.mul(value, 10000); - } - if(unitText.indexOf("亿")>=0){ - if(valueType==1) returnValue = Arith.div(value, 100000000); - else if(valueType==2) returnValue = Arith.mul(value, 100000000); - } - } - return returnValue; - } -} diff --git a/src_app/com/amarsoft/aims/util/XMLHelper.java b/src_app/com/amarsoft/aims/util/XMLHelper.java deleted file mode 100644 index 6bbebe07f..000000000 --- a/src_app/com/amarsoft/aims/util/XMLHelper.java +++ /dev/null @@ -1,222 +0,0 @@ -package com.amarsoft.aims.util; - - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.thoughtworks.xstream.XStream; -import com.thoughtworks.xstream.io.HierarchicalStreamWriter; -import com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver; -import com.thoughtworks.xstream.io.json.JsonWriter; -import com.thoughtworks.xstream.io.xml.DomDriver; - -/** - * xml文件操作类 - * @author yangsong - * @date 2013/11/07 - */ -public class XMLHelper { - private static final Log log = LogFactory.getLog(XMLHelper.class); - - /** - * 保存对象至XML文件 - * @param file 文件 - * @param obj 要存储的对象 - * @param alias xml节点别名映射 - */ - public static void saveToXMLFile(File file,Object obj,Map> alias){ - //保存 - ObjectOutputStream out = null; - try { - if(!file.exists())file.createNewFile(); - XStream xstream = new XStream(new DomDriver()); - alias(xstream,alias); - out = xstream.createObjectOutputStream(new FileWriter(file)); - out.writeObject(obj); - } catch (IOException e) { - log.error("保存对象至XML出错",e); - } finally{ - if(out != null){ - try { out.close(); } catch (IOException e) { } - } - } - } - /** - * 从文件中读取对象 - * @param file - * @param alias - * @return - */ - public static Object readFromXMLFile(File file,Map> alias){ - XStream xstream = new XStream(new DomDriver()); - alias(xstream,alias); - ObjectInputStream ois = null; - Object obj = null; - try { - if(!file.exists())file.createNewFile(); - ois = xstream.createObjectInputStream(new FileReader(file)); - obj = ois.readObject(); - } catch (FileNotFoundException e) { - log.warn("Task记录文件不存在",e); - } catch (IOException e) { - log.error("Task记录文件读取出错",e); - } catch (ClassNotFoundException e) { - log.error("从文件中读取的java类不存在",e); - } catch(Exception e){ - log.warn("从文件中没有读取到任何对象",e); - }finally{ - if(ois!=null){ - try { ois.close(); } catch (IOException e) { } - } - } - return obj; - } - /** - * 别名 - * @param xstream - * @param alias - */ - private static void alias(XStream xstream,Map> alias){ - if(alias==null||alias.size()==0)return; - Iterator>> iterator = alias.entrySet().iterator(); - while(iterator.hasNext()){ - Entry> entry = iterator.next(); - xstream.alias(entry.getKey(), entry.getValue()); - } - } - - /** - * 把对象转换为JSON字符串 - * @param obj 需要转换的对象 - * @param dropRootNode 是否删除根节点 - * @param alias 别名设置 - * @return - */ - public static String getAsJsonString(Object obj,boolean dropRootNode,Map> alias){ - String strJson = null; - JsonHierarchicalStreamDriver streamDriver = null; - if(dropRootNode){ //如果需要删除根节点,则重写方法 - streamDriver = new JsonHierarchicalStreamDriver() { - public HierarchicalStreamWriter createWriter(Writer out) { - return new JsonWriter(out, JsonWriter.DROP_ROOT_MODE); - } - }; - }else{ - streamDriver = new JsonHierarchicalStreamDriver(); - } - XStream xstream = new XStream(streamDriver); - xstream.setMode(XStream.NO_REFERENCES); -// xstream.setMode(XStream.ID_REFERENCES); - alias(xstream,alias); - strJson = xstream.toXML(obj); - return strJson; - } - /** - * 把对象转为XML字串 - * @param obj - * @param alias - * @return - */ - public static String getAsXMLString(Object obj,Map> alias){ - String strJson = null; - XStream xstream = new XStream(new DomDriver()); - xstream.setMode(XStream.NO_REFERENCES); -// xstream.setMode(XStream.ID_REFERENCES); - alias(xstream,alias); - strJson = xstream.toXML(obj); - return strJson; - } - /** - * 把对象转换为JSON字符串 - * @param obj - * @return - */ - public static String getAsJsonString(Object obj){ - return getAsJsonString(obj,true,null); - } - /** - * 创建一个XPath的XMLFile对象 - * @param file - * @param xPathExpr - * @return - */ - public static XMLParse createXMLFile(File file){ - return new XMLParse(file); - } - /** - * 使用xml字串构建一个xmlParse对象 - * @param xmlString - * @return - */ - public static XMLParse createXMLFile(String xmlString){ - return new XMLParse(xmlString); - } - /** - * 从XML文件中创建出列表对象列表 - * @param clazz 要创建的类名 - * @param fileName 文件名 - * @param create 如果文件不存在,是否创建文件 - * @param alias 读取别名 - * @return - */ - @SuppressWarnings("unchecked") - public static List createObjectsFromFile(Class clazz,String fileName,boolean create,Map> alias){ - File file = new File(fileName); - if(!file.exists()&&create){ - try { - file.createNewFile(); - } catch (IOException e) { - log.error("创建新文件失败",e); - } - } - - List objectList = (List)XMLHelper.readFromXMLFile(file, alias); - if(objectList==null) objectList = new ArrayList(); - return objectList; - } - - /** - * - * 保存对象列表 - * @param clazz 类名 - * @param fileName 文件名 - * @param objectList 对象列表 - * @param alias 写入时的别名 - * @param comparator 排序接口 - */ - public static void saveObjectsToXMLFile(Class clazz,String fileName,List objectList,Map> alias,Comparator comparator){ - //如果传入排序接口,则进行一次排序操作 - if(comparator!=null){ - Collections.sort(objectList,comparator); - } - //保存 - File file = new File(fileName); - if(!file.exists()){ - try { - file.createNewFile(); - } catch (IOException e) { - log.error("创建新文件失败",e); - } - } - XMLHelper.saveToXMLFile(file, objectList, alias); - } - -} - diff --git a/src_app/com/amarsoft/aims/util/XMLParse.java b/src_app/com/amarsoft/aims/util/XMLParse.java deleted file mode 100644 index a41ed7546..000000000 --- a/src_app/com/amarsoft/aims/util/XMLParse.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.amarsoft.aims.util; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.log.Log; - -/** - * 使用XPath的XML对象 - * @author yangsong - * @date 2013/11/11 - */ -public class XMLParse{ - public static final String DEFAULT_CHARSET = "GBK"; - private Log log = null; - private Document document; - - public XMLParse(){ - this(ARE.getLog()); - } - public XMLParse(Log log){ - setLog(log); - } - public void setLog(Log log){ - log = ARE.getLog(); - } - /** - * 构造函数 - * @param file - * @param xPathExpr - */ - public XMLParse(File file) { - this(); - // 1.得到DOM解析器的工厂实例 - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - try { - DocumentBuilder builder = factory.newDocumentBuilder(); - document = builder.parse(file); - } catch (SAXException e) { - log.error("SAXException",e); - } catch (IOException e) { - log.error("IOException",e); - } catch (ParserConfigurationException e) { - log.error("ParserConfigurationException",e); - } - } - /** - * 构造函数 - * @param file - * @param xPathExpr - */ - public XMLParse(InputStream in) { - this(); - // 1.得到DOM解析器的工厂实例 - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - try { - DocumentBuilder builder = factory.newDocumentBuilder(); - document = builder.parse(in); - } catch (SAXException e) { - log.error("SAXException",e); - } catch (IOException e) { - log.error("IOException",e); - } catch (ParserConfigurationException e) { - log.error("ParserConfigurationException",e); - } - } - /** - * 使用XML字串构建一个对象 - * @param xmlString - */ - public XMLParse(String xmlString){ - this(); - // 1.得到DOM解析器的工厂实例 - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - try { - DocumentBuilder builder = factory.newDocumentBuilder(); - InputStream inputStream = new ByteArrayInputStream(xmlString.getBytes());//xml为要解析的字符串 - document = builder.parse(inputStream); - } catch (SAXException e) { - log.error("SAXException",e); - } catch (IOException e) { - log.error("IOException",e); - } catch (ParserConfigurationException e) { - log.error("ParserConfigurationException",e); - } - } - /** - * 根据XPath表达式,取节点列表 - * @param xPathExpr - * @return - */ - public NodeList getNodeList(String xPathExpr){ - NodeList nodeList = null; - try { - XPathFactory xFactory = XPathFactory.newInstance(); - XPath xPath = xFactory.newXPath(); - XPathExpression xExpr = xPath.compile(xPathExpr); - nodeList = (NodeList)xExpr.evaluate(document,XPathConstants.NODESET); - } catch (XPathExpressionException e) { - log.error("XPathExpressionException",e); - } - return nodeList; - } - /** - * 根据XPath表达式,取一个节点,如有多个,则返回第一个 - * @param xPathExpr - * @return - */ - public Node getNode(String xPathExpr){ - NodeList nodeList = getNodeList(xPathExpr); - if(nodeList.getLength()>0){ - return nodeList.item(0); - }else{ - return null; - } - } - /** - * 根据XPath表达式,取一个节点,如有多个,则返回第一个 - * @param xPathExpr - * @return - */ - public Element getElement(String xPathExpr){ - return (Element)getNode(xPathExpr); - } - /** - * 获取一个XML片段 - * @param xPathExpr - * @param charset - * @return - */ - public String getXMLString(String xPathExpr, String charset) { - String xmlString = null; - Node node = getNode(xPathExpr); - if(node==null)return xmlString; - try { - TransformerFactory factory = TransformerFactory.newInstance(); - Transformer transformer; - transformer = factory.newTransformer(); - DOMSource source = new DOMSource(node); - transformer.setOutputProperty(OutputKeys.ENCODING, charset); - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - StringWriter writer = new StringWriter(); - StreamResult result = new StreamResult(writer); - transformer.transform(source, result); - xmlString = writer.toString(); - } catch (TransformerConfigurationException e) { - log.error("TransformerConfigurationException", e); - } catch (TransformerException e) { - log.error("TransformerException", e); - } - return xmlString; - } - /** - * 取一个XML片段,默认使用UTF-8 - * @param xPathExpr - * @return - */ - public String getXMLString(String xPathExpr){ - return getXMLString(xPathExpr,DEFAULT_CHARSET); - } - /** - * 返回文档对象 - * @return - */ - public Document getDocument(){ - return this.document; - } -} diff --git a/src_app/com/amarsoft/aims/worktips/CommonWorkTips.java b/src_app/com/amarsoft/aims/worktips/CommonWorkTips.java deleted file mode 100644 index c755f3221..000000000 --- a/src_app/com/amarsoft/aims/worktips/CommonWorkTips.java +++ /dev/null @@ -1,159 +0,0 @@ -/** - * - */ -package com.amarsoft.aims.worktips; - -import java.sql.SQLException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.context.ASUser; -import com.amarsoft.dict.als.object.Item; - -/** - * 工作台提示通用处理类, - * @author yuchengjun - */ -public abstract class CommonWorkTips implements WorkTips{ - - protected StringBuilder tipBuffer=new StringBuilder(); - protected ASUser CurUser; - protected int TipNums=0;//提示笔数 - protected String imagePath1=""; - - protected int maxCount = 10000;//最大计算的笔数 - - private List workItemList; - private Item curitem; - - public String getCountSql() { - return null; - } - - public int getSqlCount() throws Exception{ - return 5; - /* - int iCount = 0; - Transaction Sqlca = null; - String CountSql = getCountSql(); - - //如果计数SQL为空则直接取逻辑 - try{ - Sqlca = new Transaction("als"); - maxCount=100; - if(CountSql==null || "".equals(CountSql)){ - if(!this.getClass().getName().equals("com.amarsoft.proj.nbcb.worktip.BPSWorkItem")) - ARE.getLog().warn("日常工作提示未按照要求进行配置,请关注!"+this.getClass().getName()); - iCount = getTipsNum(); - return iCount; - }else{ - - if(CountSql.indexOf("jbo.")>0){ - ARE.getLog().error("日常工作提示计算CountSql中包含 jbo标签,请按照标准SQL组织查询!"+this.getClass().getName()); - return 0; - } - - String sQuerySeql = CountSql + " and RowNum<=:RowNum";//+this.maxCount; - - try{ - sQuerySeql=StringFunction.replace(sQuerySeql, "'"+CurUser.getUserID()+"'", ":UserID"); - sQuerySeql=StringFunction.replace(sQuerySeql, "'"+CurUser.getOrgID()+"'", ":OrgID"); - sQuerySeql=StringFunction.replace(sQuerySeql, "'"+Tools.getSortNo(this.CurUser)+"%'", ":OrgSortNO"); - sQuerySeql=StringFunction.replace(sQuerySeql, "'"+StringFunction.getToday()+"'", ":inputDate"); - ARE.getLog().info("代办SQL:"+sQuerySeql); - String inputDate=StringFunction.getToday(); - int[] days={60,50,30,10,7,5,3,2,1}; - SqlObject asql = new SqlObject(sQuerySeql); - asql.setParameter("UserID", this.CurUser.getUserID()); - asql.setParameter("OrgID", this.CurUser.getOrgID()); - asql.setParameter("RowNum",this.maxCount); - asql.setParameter("inputDate",inputDate); - asql.setParameter("OrgSortNO",Tools.getSortNo(this.CurUser)+"%"); - for(int iday:days){ - String day=StringFunction.getRelativeDate(inputDate, -iday); - asql.setParameter("inputDate"+iday,day); - } - setParameter(asql); - // ARE.getLog().debug(this.curitem.getItemName()+" "+this.curitem.getItemAttribute()); - iCount = Integer.parseInt(Sqlca.getString(asql)); - }catch (NumberFormatException NumberE) { - ARE.getLog().error("["+curitem.getItemAttribute()+"]日常工作提示:Sql未按照规范输出 count 结果,请按照 select count(1) from ..."+this.getClass().getName()); - //ARE.getLog().error(NumberE.toString()); - }catch (Exception e) { - ARE.getLog().error("["+curitem.getItemAttribute()+"]["+this.getCuritem().getItemAttribute()+"]\n日常工作计算失败!"+this.getClass().getName()); - //ARE.getLog().error(e.toString()); - } - } - }finally{ - - if(Sqlca != null){ - Sqlca.disConnect(); - Sqlca=null; - } - } - - return iCount; - */} - - public void setParameter(final SqlObject asql) throws SQLException{ - - } - /** - * 设置用户对象 - * @param curUser - */ - public void setCurUser(ASUser curUser) { - CurUser = curUser; - } - - /** - * 设置最大计算的笔数 - * @param iCount - */ - public void setMaxCount(int iCount){ - this.maxCount = iCount; - } - - /** - * @param map - * @return - */ - public String initTipString(Map map){ - for(Iterator ito = map.keySet().iterator();ito.hasNext();){ - String key = ito.next(); - String value = map.get(key); - //tipBuffer.append("
  • "+key+" "+value+"
  • "); - tipBuffer.append("
  • "+key+" "+value+"
  • "); - } - return tipBuffer.toString(); - } - public List getWorkItemList() { - return workItemList; - } - public void setWorkItemList(List workItemList) { - this.workItemList = workItemList; - } - public Item getCuritem() { - return curitem; - } - public void setCuritem(Item curitem) { - this.curitem = curitem; - } - /** - * 获得业务目录下的待办笔数 - * @return - */ - public Long getActivityNumber() - { - if(this.workItemList==null) return 0l; - String sCatalogCode=this.getCuritem().getAttribute1(); - if(sCatalogCode==null) return 0l; - for(ProcessModel p:workItemList) - { - if(p.getCatalogCode().equalsIgnoreCase(sCatalogCode)) return p.getActivityNumber(); - } - return 0l; - } -} diff --git a/src_app/com/amarsoft/aims/worktips/ProcessModel.java b/src_app/com/amarsoft/aims/worktips/ProcessModel.java deleted file mode 100644 index 4df18f70d..000000000 --- a/src_app/com/amarsoft/aims/worktips/ProcessModel.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.amarsoft.aims.worktips; - -/** - * 暂时未用到,后续可能会删去 - * - * - */ -public class ProcessModel { - - private String processDefID; - private String processDefName; - private String catalogCode; - private String catalogName; - private String describe; - - private String status;//1-未发布 3-已发布 - private String catalogUUID; - private Long activityNumber;//当前任务数量 - private String activityDefID; //活动定义编号 - private String activityDefName; //活动定义名称 - - public String getProcessDefID() { - return processDefID; - } - public void setProcessDefID(String processDefID) { - this.processDefID = processDefID; - } - public String getProcessDefName() { - return processDefName; - } - public void setProcessDefName(String processDefName) { - this.processDefName = processDefName; - } - public String getCatalogCode() { - return catalogCode; - } - public void setCatalogCode(String catalogCode) { - this.catalogCode = catalogCode; - } - public String getCatalogName() { - return catalogName; - } - public void setCatalogName(String catalogName) { - this.catalogName = catalogName; - } - public String getDescribe() { - return describe; - } - public void setDescribe(String describe) { - this.describe = describe; - } - public String getStatus() { - return status; - } - public void setStatus(String status) { - this.status = status; - } - public String getCatalogUUID() { - return catalogUUID; - } - public void setCatalogUUID(String catalogUUID) { - this.catalogUUID = catalogUUID; - } - public Long getActivityNumber() { - return activityNumber; - } - public void setActivityNumber(Long activityNumber) { - this.activityNumber = activityNumber; - } - public String getActivityDefID() { - return activityDefID; - } - public void setActivityDefID(String activityDefID) { - this.activityDefID = activityDefID; - } - public String getActivityDefName() { - return activityDefName; - } - public void setActivityDefName(String activityDefName) { - this.activityDefName = activityDefName; - } - - -} diff --git a/src_app/com/amarsoft/aims/worktips/WorkTips.java b/src_app/com/amarsoft/aims/worktips/WorkTips.java deleted file mode 100644 index e7f1104f8..000000000 --- a/src_app/com/amarsoft/aims/worktips/WorkTips.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.amarsoft.aims.worktips; - -/** - * 工作提示实现接口 - * @author hqchen - * - */ -public interface WorkTips { - - /** - * 工作台提示信息,返回工作台的提示文字以及超链接 - * @return - */ - public String getTipsString() throws Exception; - - - /** - * 获取计算所需要的条数的逻辑SQL - */ - public String getCountSql(); - - - /** - * 直接获取计算得到的结果 - *
    不建议使用该方法 - *
    建议直接将计算逻辑的SQL放入到 getCountSql中 - * @return - */ - @Deprecated - public int getTipsNum() throws Exception; - - - /** - * 通过设置的SQL 获取计算得到的工作件数 - * @return - */ - public int getSqlCount() throws Exception; -} diff --git a/src_app/com/amarsoft/aims/worktips/WorkTipsTree.java b/src_app/com/amarsoft/aims/worktips/WorkTipsTree.java deleted file mode 100644 index 9763057e5..000000000 --- a/src_app/com/amarsoft/aims/worktips/WorkTipsTree.java +++ /dev/null @@ -1,345 +0,0 @@ -package com.amarsoft.aims.worktips; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import com.amarsoft.are.ARE; -import com.amarsoft.context.ASUser; -import com.amarsoft.dict.als.manage.CodeManager; -import com.amarsoft.dict.als.object.Item; -/** - * 工作台任务提示核心类,页面直接使用此类完成相关操作 - * @author xiao - * - */ -public class WorkTipsTree implements Serializable{ - - private static final long serialVersionUID = -492498259152170237L; - - private Integer[] sortNoLenArray; - private Map counterCache ;//计数器缓存 - private Item[] items; - private ASUser curUser; - private String codeNo; - private int iMaxCount=10000; - private List workItemList; - private List itemFilterList; - /** - * 工作台提示 - * @param user - * @throws Exception - */ - public WorkTipsTree(ASUser user,String codeNo) throws Exception - { - this(user,codeNo,1000); - } - - /** - * 工作台提示 - * @param ASUser 当前用户 - * @param codeNo 提示编号 - * @param iMaxCount 最大计算待办任务的数量,用户数据库性能优化 - * @throws Exception - */ - public WorkTipsTree(ASUser user,String codeNo, int iMaxCount) throws Exception - { - this.curUser=user; - this.codeNo=codeNo; - this.counterCache = new HashMap(); - this.itemFilterList = new ArrayList(); - this.items = CodeManager.getItems(codeNo); - initSortLenArray(items); - this.addItemFilter(getItemFilterByRole()); - this.iMaxCount = iMaxCount; - } - - private ItemFilter defultFilterByRole = null; - /** - * 使用角色进行过滤的过滤器 - * @return - */ - public ItemFilter getItemFilterByRole(){ - if(defultFilterByRole==null){ - defultFilterByRole = new ItemFilter(){ - public boolean filter(WorkTipsTree parentContext, Item currentItem) { - String roleIdString = currentItem.getRelativeCode(); - if(roleIdString==null||roleIdString.length()==0)return true;//乐观控制,如果角色没有配置,则默认全部可见 - String[] roles = roleIdString.split(","); - try { - return parentContext.getCurUser().hasRole(roles); - } catch (Exception e) { - ARE.getLog().error("查找当前用户是否有指定角色时出错了",e); - } - return false; - } - }; - } - return defultFilterByRole; - } - - /** - * 设置长度 - * @param items - */ - private void initSortLenArray(Item[] items){ - Set set = new TreeSet(); - for(Item item:items){ - set.add(item.getSortNo().length()); - } - sortNoLenArray = set.toArray(new Integer[set.size()]); - } - /** - * 获得工作提示信息 - * @author cjyu - * @throws Exception - */ - public Item[] getItems() throws Exception - { - List tmpItems = new ArrayList(); - for(Item item:items){ - if(filterPass(item)){ - tmpItems.add(item); - } - } - return tmpItems.toArray(new Item[tmpItems.size()]); - } - - /** - * 获取待办任务提示第一层的HTML数据 - * @param codeNo 代码名称 - * @return - * @throws Exception - */ - public String getTipsHTML() throws Exception{ - StringBuilder sbHTML = new StringBuilder(); - - Item[] items=getItems(); - - - List itemList = getFirstLevelItemList(items); - sbHTML.append("
      "); - for(Item item:itemList){ -// if(!filterPass(item))continue; - sbHTML.append(getItemAsHTML(item)); - } - sbHTML.append("\n
    "); - - return sbHTML.toString(); - } - /** - * 单行转为HTML - * @param item - * @return - * @throws Exception - */ - private String getItemAsHTML(Item item) throws Exception{ - StringBuilder sbHTML = new StringBuilder(); - - boolean hasChildren = getChildren(item).size()>0; - boolean hasExecuteClass = false; - if(item.getItemAttribute()!=null&&item.getItemAttribute().trim().length()>0)hasExecuteClass = true; - sbHTML.append("\n "); -// sbHTML.append(item.getSortNo()+"-"+item.getItemName()); - sbHTML.append(item.getItemName()); - sbHTML.append(" "); - - return sbHTML.toString(); - } - /** - * 获取指定节点子节点的HTML数据 - * @param itemNo - * @return - * @throws Exception - */ - public String getChildrenHTML(String itemNo){ - StringBuilder sbHTML = new StringBuilder(); - try { - Item currentItem = CodeManager.getItem(codeNo, itemNo); - - String className = currentItem.getItemAttribute(); - - if(className!=null&&className.trim().length()>0){//如果该层节点上配置了className,就不递归至子节点计数了 - String html = getClassHTML(className,currentItem); - if(html.startsWith("script:")){//脚本不需要特殊处理 - sbHTML.append(html); - }else{ - sbHTML.append("
      "); - sbHTML.append(html); - sbHTML.append("\n
    "); - } - }else{ - List children = getChildren(currentItem); - if(children.size()>0){ - sbHTML.append("
      "); - for(Item child:children){ - sbHTML.append(getItemAsHTML(child)); - } - sbHTML.append("\n
    "); - } - } - } catch (Exception e) { - ARE.getLog().error("取CodeNo:"+codeNo+",ItemNo:"+itemNo+"列表时,出错", e); - } - return sbHTML.toString(); - } - /** - * 取当前节点的子节点 - * @param items 所有节点集合 - * @param currentItem 当前节点 - * @return - * @throws Exception - */ - public List getChildren(Item currentItem) throws Exception{ - Item[] items = getItems(); - List itemList = new ArrayList(); - int startLength = -1; - for(Item item:items){ - if(item.getSortNo().equals(currentItem.getSortNo()))continue; - if(!item.getSortNo().startsWith(currentItem.getSortNo()))continue; - if(startLength==-1)startLength = item.getSortNo().length();//以第一个匹配的长度作为标准长度 - if(startLength!=item.getSortNo().length())continue; -// if(!filterPass(item))continue; //如果当前节点被过滤了,则跳过 - itemList.add(item); - } - return itemList; - } - /** - * 取第一层节点 - * @param items - * @return - */ - private List getFirstLevelItemList(Item[] items){ - List itemList = new ArrayList(); - for(Item item:items){ -// if(!filterPass(item))continue; - if(item.getItemNo().length()==sortNoLenArray[0]){ - itemList.add(item); - } - } - return itemList; - } - /** - * 获取指定节点的计数 - * @param codeNo - * @param itemNo - * @return - * @throws Exception - */ - public int getCounter(String itemNo){ - int countAll = 0; - String cacheKey = codeNo+"-"+itemNo; - if(counterCache.containsKey(cacheKey))return counterCache.get(cacheKey); - - try { - Item item = CodeManager.getItem(codeNo, itemNo); - if(!filterPass(item)) throw new Exception("该项已被过滤"); - String className = item.getItemAttribute(); - - if(className!=null&&className.trim().length()>0){//如果该层节点上配置了className,就不递归至子节点计数了 - countAll += getClassCalcCount(className,item); - }else{ //递归取子节点的计数 - List children = getChildren(item); - for(Item child:children){ - countAll += getCounter(child.getItemNo()); - } - } - } catch (Exception e) { - ARE.getLog().error("计算CodeNo:"+codeNo+",ItemNo:"+itemNo+"总数时,出错", e); - countAll = 0; - } - counterCache.put(cacheKey, countAll); - return countAll; - } - /** - * 通过类计算计数 - *
  • cjyu 增加流程平台待办工作,增加当前对应的Item,用于计算时用同一个类然后通过参数进行计算 - * @param className - * @return - * @throws Exception - */ - public int getClassCalcCount(String className,Item curitem) throws Exception{ - try{ - CommonWorkTips tips=(CommonWorkTips)Class.forName(className).newInstance(); - tips.setWorkItemList(getWorkItemList()); - tips.setCuritem(curitem); - tips.setCurUser(curUser); - tips.setMaxCount(this.iMaxCount); - return tips.getSqlCount(); - }catch(ClassNotFoundException e){ - ARE.getLog().error(e.getMessage()+"未实现"); - } - return 0; - } - /** - *
  • cjyu 增加流程平台待办工作,增加当前对应的Item,用于计算时用同一个类然后通过参数进行计算 - * @param className - * @param curitem - * @return - * @throws Exception - */ - public String getClassHTML(String className,Item curitem) throws Exception{ - CommonWorkTips tips=(CommonWorkTips)Class.forName(className).newInstance(); - tips.setWorkItemList(getWorkItemList()); - tips.setCuritem(curitem); - tips.setCurUser(curUser); - return tips.getTipsString(); - } - public List getWorkItemList() { - return workItemList; - } - public void setWorkItemList(List workItemList) { - this.workItemList = workItemList; - } - - public ASUser getCurUser() { - return curUser; - } - public String getCodeNo() { - return codeNo; - } - /** - * 添加一个过滤项 - * @param itemFilter - */ - public void addItemFilter(ItemFilter itemFilter){ - this.itemFilterList.add(itemFilter); - } - /** - * 检查当前项是否被过滤掉 - * @param currentItem - * @return - */ - public boolean filterPass(Item currentItem){ - boolean pass = true; - for(ItemFilter itemFilter:this.itemFilterList){ - pass = pass&&itemFilter.filter(this, currentItem); - if(!pass)return pass; //只要其中一项被过滤了,就可以中断退出 - } - - return pass; - } - /** - * 提示项过滤器 - * @author ls0478 - * - */ - public interface ItemFilter extends Serializable{ - /** - * 过滤项规则 - * @param parentContext 任务项容器 - * @param currentItem 当前项 - * @return - */ - public boolean filter(WorkTipsTree parentContext,Item currentItem); - } -} diff --git a/src_app/com/amarsoft/aims/worktips/impl/ExampleTipLi.java b/src_app/com/amarsoft/aims/worktips/impl/ExampleTipLi.java deleted file mode 100644 index f159ac0cd..000000000 --- a/src_app/com/amarsoft/aims/worktips/impl/ExampleTipLi.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.amarsoft.aims.worktips.impl; - -import com.amarsoft.aims.worktips.CommonWorkTips; -/** - * CommonWorkTips的实现示例:最终的任务子项以
    • 的方式展示 - * @author xiao - * - */ -public class ExampleTipLi extends CommonWorkTips{ - - public String getTipsString() throws Exception { - /** - * 进一步展示子项(li)示例 - */ - StringBuffer buff=new StringBuffer(); - buff.append("
        "); - for(int i = 0 ;i产品名称:产品test"+i+"  "); - buff.append("专项检查名称:检查test"+i+"  "); - } - buff.append("
      "); - return buff.toString(); - } - - public int getSqlCount() throws Exception{ - //具体需根据业务逻辑处理,可结合getCountSql实现 - return 20; - } - - public int getTipsNum() throws Exception { - return 0; - } - -} diff --git a/src_app/com/amarsoft/aims/worktips/impl/ExampleTipMenu.java b/src_app/com/amarsoft/aims/worktips/impl/ExampleTipMenu.java deleted file mode 100644 index 53b0478dc..000000000 --- a/src_app/com/amarsoft/aims/worktips/impl/ExampleTipMenu.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.amarsoft.aims.worktips.impl; - -import com.amarsoft.aims.worktips.CommonWorkTips; -/** - * CommonWorkTips的实现示例:最终的任务子项点击后模拟点击导航栏菜单 - * @author xiao - * - */ -public class ExampleTipMenu extends CommonWorkTips{ - - public String getTipsString() throws Exception { - return "script:menuTo('/AfterPlanManage/AfterPlanView.jsp','Title=专项投后检查&TreeView=SpecialTaskView')"; - } - - public int getSqlCount() throws Exception{ - //具体需根据业务逻辑处理,可结合getCountSql实现 - return 8; - } - - public int getTipsNum() throws Exception { - return 0; - } - -} diff --git a/src_app/com/amarsoft/aims/worktips/impl/ExampleTipPop.java b/src_app/com/amarsoft/aims/worktips/impl/ExampleTipPop.java deleted file mode 100644 index 84bb12122..000000000 --- a/src_app/com/amarsoft/aims/worktips/impl/ExampleTipPop.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.amarsoft.aims.worktips.impl; - - -import com.amarsoft.aims.worktips.CommonWorkTips; -/** - * CommonWorkTips的实现示例:最终的任务子项点击后弹出对话框 - * @author xiao - * - */ -public class ExampleTipPop extends CommonWorkTips{ - - public String getCountSql() { - return ""; - } - - public int getSqlCount() throws Exception{ - //具体需根据业务逻辑处理,可结合getCountSql实现 - return 5; - } - - public String getTipsString() throws Exception { - return "script:openDialog('/AfterPlanManage/SpecialTask/SpecialTaskList.jsp','','');"; - } - - - public int getTipsNum() throws Exception { - return 0; - } - - - - -} diff --git a/src_app/com/amarsoft/aims/xwrender-intercept.properties b/src_app/com/amarsoft/aims/xwrender-intercept.properties deleted file mode 100644 index 2b98becdb..000000000 --- a/src_app/com/amarsoft/aims/xwrender-intercept.properties +++ /dev/null @@ -1 +0,0 @@ -/PlanManage/PlanInfo.jsp=com.amarsoft.aims.xw.intercept.PlanInfoIntercept \ No newline at end of file diff --git a/src_app/config/Hander.java b/src_app/config/Hander.java deleted file mode 100644 index 0730f2c58..000000000 --- a/src_app/config/Hander.java +++ /dev/null @@ -1,13 +0,0 @@ -package config; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.awe.dw.handler.impl.CommonHandler; - -public class Hander extends CommonHandler{ - @Override - protected void initDisplayForAdd(BizObject bo) throws Exception { - // TODO Auto-generated method stub - bo.setAttributeValue("GROUP_CODE", this.asPage.getAttribute("GROUP_CODE").toString()); - } - -} \ No newline at end of file diff --git a/src_app/config/InterfaceConfig.java b/src_app/config/InterfaceConfig.java deleted file mode 100644 index be2dcda69..000000000 --- a/src_app/config/InterfaceConfig.java +++ /dev/null @@ -1,116 +0,0 @@ -package config; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -import com.amarsoft.are.ARE; - -/** - * 接口配置数据管理 - * @author EX-YANGSONG001 - * - */ -public class InterfaceConfig{ - - public static final String MESSAGE_RESOURCE_BASE = "config"; - - /** - * EOA接口配置文件 - */ - public static String EOA_CONFIG_FILE = "EOASetting.properties"; - /** - * 影像接口配置文件 - */ - public static String IM_CONFIG_FILE = "IMClient.properties"; - /** - * 邮件接口配置文件 - */ - public static String MAIL_CONFIG_FILE = "MailClient.properties"; - /** - * 投管中心接口配置文件 - */ - public static String NCMS_CONFIG_FILE = "NcmsSetting.properties"; - /** - * UM/SSO接口配置文件 - */ - public static String UMSSO_CONFIG_FILE = "UMSSO.properties"; - - private static Properties eoaProperties = null; - private static Properties imProperties = null; - private static Properties mailProperties = null; - private static Properties ncmsProperties = null; - private static Properties umssoProperties = null; - - private static Properties getProperties(String file){ - //根据客户要求,需要分离配置文件到独立的目录中,配置文件目录会被添加到CLASSPATH中 - //因此,先直接去读配置文件,如果读不到,则最终到配置目录config下去读 - InputStream in = InterfaceConfig.class.getClassLoader().getResourceAsStream(file); - Properties properties = new Properties(); - if(in==null){ - ARE.getLog().error("从CLASSPATH读取不到配置文件["+file+"]"); -// ARE.getLog().warn("从CLASSPATH读取不到配置文件["+file+"],使用默认配置"); -// in = InterfaceConfig.class.getClassLoader().getResourceAsStream(MESSAGE_RESOURCE_BASE+"/"+file); - } - try { - properties.load(in); - } catch (IOException e) { - ARE.getLog().error("配置目录下读配置文件["+file+"]出错", e); - }finally{ - if(in!=null) - try { - in.close(); - } catch (IOException e) { - } - } - return properties; - } - /** - * EOA配置项获取 - * @param name - * @return - */ - public static String getEOAConfigItem(String name){ - if(eoaProperties==null)eoaProperties=getProperties(EOA_CONFIG_FILE); - return eoaProperties.getProperty(name); - } - - /** - * 获取IM配置数据 - * @param name - * @return - */ - public static String getIMConfigItem(String name){ - if(imProperties==null)imProperties=getProperties(IM_CONFIG_FILE); - return imProperties.getProperty(name); - } - - /** - * 邮件配置数据 - * @param name - * @return - */ - public static String getMailConfigItem(String name){ - if(mailProperties==null)mailProperties=getProperties(MAIL_CONFIG_FILE); - return mailProperties.getProperty(name); - } - - /** - * NCMS配置数据 - * @param name - * @return - */ - public static String getNCMSConfigItem(String name){ - if(ncmsProperties==null)ncmsProperties=getProperties(NCMS_CONFIG_FILE); - return ncmsProperties.getProperty(name); - } - /** - * UMSSO配置数据 - * @param name - * @return - */ - public static String getUMSSOConfigItem(String name){ - if(umssoProperties==null)umssoProperties=getProperties(UMSSO_CONFIG_FILE); - return umssoProperties.getProperty(name); - } -} diff --git a/src_app/config/InterfaceConfigFromDB.java b/src_app/config/InterfaceConfigFromDB.java deleted file mode 100644 index a2db6cc72..000000000 --- a/src_app/config/InterfaceConfigFromDB.java +++ /dev/null @@ -1,57 +0,0 @@ -package config; - -import com.amarsoft.aims.util.StringHelper; -import com.amarsoft.are.ARE; -import com.amarsoft.are.lang.StringX; -import com.amarsoft.dict.als.manage.CodeManager; -import com.amarsoft.dict.als.object.Item; - - -/** - * 接口配置数据管理 - * @author EX-YANGSONG001 - * - */ -public class InterfaceConfigFromDB{ - - public static final String CODE_CONFIG = "FixConfig"; - public static final String APP_CODE_CONFIG = "APPFixConfig"; - - public static String getConfigItem(String itemNo){ - String configValue = ""; - try { - Item item = CodeManager.getItem(CODE_CONFIG, itemNo); - if(item != null) - configValue = StringHelper.nvl(item.getItemDescribe(), ""); - } catch (Exception e) { - ARE.getLog().error("",e); - } - System.out.println(configValue); - return configValue; - } - - /** - * 获取APP配置项信息 - * @param itemNo - * @return - */ - public static String getAppConfigItem(String itemNo){ - String configValue = ""; - try { - Item item = CodeManager.getItem(APP_CODE_CONFIG, itemNo); - if(item != null) - configValue = StringHelper.nvl(item.getItemDescribe(), ""); - } catch (Exception e) { - ARE.getLog().error("",e); - } - return configValue; - } - - - public static String getSysUserPwd(){ - String pwd = getAppConfigItem("app.um.pwd"); - if(StringX.isEmpty(pwd)){} - //pwd = CyberArkService.getCyberArkPassword(getAppConfigItem("app.um.id")); - return pwd; - } -} diff --git a/src_app/config/SysVersionConfig.java b/src_app/config/SysVersionConfig.java deleted file mode 100644 index fd1ec7cf2..000000000 --- a/src_app/config/SysVersionConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -package config; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -import com.amarsoft.are.ARE; - -/** - * 获取系统版本号 - * @author wmzhu - * @date 2015年6月24日 - */ -public class SysVersionConfig { - - public static String getSystemVersion() throws IOException{ - Properties proper = new Properties(); - InputStream in = new FileInputStream(ARE.getProperty("APP_HOME")+"/etc/sysversion.properties"); - if(in != null){ - proper.load(in); - in.close(); - } - return proper.getProperty("SysVersion"); - } - -} diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/ApplyListQueryController.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/ApplyListQueryController.java new file mode 100644 index 000000000..bf1a30a0b --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/ApplyListQueryController.java @@ -0,0 +1,35 @@ +package apx.com.amarsoft.als.apzl.apply.query; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.apzl.apply.query.service.ApplyListQueryService; +import apx.com.amarsoft.als.apzl.apply.query.service.impl.ApplyListQueryServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +@Path("/apply") +public class ApplyListQueryController { + + @Path("/list") + @POST + public Map queryList(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] ApplyListQueryController run ................."); + ARE.getLog().info("[Path] /apply/list" + " run ................."); + + ApplyListQueryService service = new ApplyListQueryServiceImpl(); + return service.queryList(request, response, tx, sqlca, ReturnMapUtil); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/manage/ApplyDoManage.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/manage/ApplyDoManage.java new file mode 100644 index 000000000..f0edb9dd6 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/manage/ApplyDoManage.java @@ -0,0 +1,46 @@ +package apx.com.amarsoft.als.apzl.apply.query.manage; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoQueryManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public class ApplyDoManage extends AbstractAweDoQueryManage { + private String sAddWhere; + private String dono; + private Map fieldMap; + + public void setFieldMap(Map fieldMap) { + this.fieldMap = fieldMap; + } + + public void setDono(String dono) { + this.dono = dono; + } + + public void getGroupId() { + sGroupId = this.dono; + } + + public void getOtherWhere() { + super.sOtherWhere = StringX.isSpace(sAddWhere) ? "" + : this.sAddWhere; + } + + public void setsAddWhere(String sAddWhere) { + this.sAddWhere = sAddWhere; + } + + public Map queryDefaultDo(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + setParamMap(fieldMap); + return getData(request, sqlca, tx, ReturnMapUtil); + } +} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/service/ApplyListQueryService.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/service/ApplyListQueryService.java new file mode 100644 index 000000000..06560c234 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/service/ApplyListQueryService.java @@ -0,0 +1,17 @@ +package apx.com.amarsoft.als.apzl.apply.query.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public interface ApplyListQueryService { + Map queryList(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) throws Exception; +} diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/service/impl/ApplyListQueryServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/service/impl/ApplyListQueryServiceImpl.java new file mode 100644 index 000000000..2867add1d --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/query/service/impl/ApplyListQueryServiceImpl.java @@ -0,0 +1,39 @@ +package apx.com.amarsoft.als.apzl.apply.query.service.impl; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +import apx.com.amarsoft.als.apzl.apply.query.manage.ApplyDoManage; +import apx.com.amarsoft.als.apzl.apply.query.service.ApplyListQueryService; +import apx.com.amarsoft.als.base.awe.execute.util.ApplyManagerUtil; + +public class ApplyListQueryServiceImpl implements ApplyListQueryService { + private Map fieldMap; + + @SuppressWarnings("unchecked") + public Map queryList(HttpServletRequest request, + HttpServletResponse response, JBOTransaction tx, Transaction sqlca, + ReturnMapUtil ReturnMapUtil) throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + + ApplyManagerUtil ApplyManagerUtil = new ApplyManagerUtil(fieldMap); + String dono = ApplyManagerUtil.getDono(); + String whereClause = ApplyManagerUtil.getWhereClause(); + + ApplyDoManage manage = new ApplyDoManage(); + manage.setDono(dono); + manage.setFieldMap(fieldMap); + manage.setsAddWhere(whereClause); + return manage.queryDefaultDo(request, sqlca, tx, ReturnMapUtil); + } + +} diff --git a/src_app/apx/com/amarsoft/als/base/awe/AbstractAweDoDeleteManage.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoDeleteManage.java similarity index 65% rename from src_app/apx/com/amarsoft/als/base/awe/AbstractAweDoDeleteManage.java rename to src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoDeleteManage.java index 160acfe4d..41bb2f5c7 100644 --- a/src_app/apx/com/amarsoft/als/base/awe/AbstractAweDoDeleteManage.java +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoDeleteManage.java @@ -1,215 +1,258 @@ -package apx.com.amarsoft.als.base.awe; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import apx.com.amarsoft.als.base.awe.model.AppBusinessGroupModel; -import apx.com.amarsoft.als.base.awe.model.AweDoCataLogModel; -import apx.com.amarsoft.als.base.awe.util.AweDoCommUtil; -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -/** - * 模板 分组 删除管理 - * - * @author jiaji.liu - * - */ -public abstract class AbstractAweDoDeleteManage { - public void afterDelete(BizObject bo) { - ARE.getLog() - .info("======================================= this afterDelete: default ======================================"); - } - - public void beforeDelete(BizObject bo) { - ARE.getLog() - .info("======================================= this beforeDelete: default ======================================"); - } - - protected Map deleteBusiness(Transaction sqlca, - JBOTransaction tx, String sDono, Map paramMap, - String sOtherWhere) throws JBOException { - AweDoCataLogModel oAweDoCataLog = new AweDoCataLogModel(sDono); - int iCount = oAweDoCataLog.getsDono().length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "模板号:" + sDono + "不存在!"); - ARE.getLog().debug("模板号:" + sDono + "不存在!"); - return ReturnMapUtil.getReturnMap(); - } - String sDoName = oAweDoCataLog.getsDoName(); - ARE.getLog().info("=========模板名:" + sDoName + "=========="); - String sJboClass = oAweDoCataLog.getsJboClass(); - String sJboWhere = oAweDoCataLog.getsJboWhere(); - iCount = sJboClass.length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "模板号,模板名称:" + sDono + "," + sDoName + "主表未找到!"); - ARE.getLog().debug("模板号,模板名称:" + sDono + "," + sDoName + "主表未找到!"); - return ReturnMapUtil.getReturnMap(); - } - iCount = sJboWhere.length(); - if (iCount > 0) - sJboWhere = AweDoCommUtil.whereHandle(sJboWhere, paramMap); - - ARE.getLog().info("=========获取AWE_DO_LIBRARY=========="); - List> donoLibrary = oAweDoCataLog.getoLibrary(); - List> elementDatas = new ArrayList>(); - for (Map element : donoLibrary) { - String sColTableName = element.get("coltablename") == null ? "" - : element.get("coltablename").toString(); - if ("o".equalsIgnoreCase(sColTableName)) { - Map elementData = new HashMap(); - for (String sKey : element.keySet()) { - elementData.put(sKey, element.get(sKey)); - } - elementDatas.add(elementData); - } - } - ARE.getLog().info("=========3.开始删除=========="); - try { - BizObjectManager deleteBom = JBOFactory - .getBizObjectManager(sJboClass); - tx.join(deleteBom); - BizObjectQuery deleteBoq = deleteBom.createQuery(sJboWhere - + sOtherWhere); - BizObject deleteBo = deleteBoq.getSingleResult(true); - if (null == deleteBo) { - - } else { - beforeDelete(deleteBo); - deleteBom.deleteObject(deleteBo); - afterDelete(deleteBo); - tx.commit(); - } - } catch (Exception e) { - tx.rollback(); - ARE.getLog().error( - ResultConstant.FAIL_DELETE + "\r\n" + "error:" + e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ResultConstant.FAIL_DELETE); - return ReturnMapUtil.getReturnMap(); - } - ReturnMapUtil.setReturnMap(null, ResultConstant.SUCCESS_RESULT_CODE, - ResultConstant.SUCCESS_DELETE); - return ReturnMapUtil.getReturnMap(); - } - - /** - * 根据分组号删除数据 - * - * @param tx - * @param sGroupCode - * @param paramMap - * @return - * @throws Exception - */ - public Map removeGroupData(Transaction sqlca, JBOTransaction tx, - String sGroupCode, Map paramMap, String sOtherWhere) throws Exception { - ARE.getLog() - .info("======================================= removeGroupData:begin > 删除开始 ======================================"); - if (sGroupCode == null) sGroupCode = ""; - if (sGroupCode.length() == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "分组号为空,无法查询具体模板数据!"); - ARE.getLog().debug("分组号为空,无法查询具体模板数据!"); - ARE.getLog() - .info("======================================= removeGroupData:end > 删除失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - ARE.getLog().info("=========1.获取分组号=========="); - ARE.getLog().info("=========获取分组号: " + sGroupCode + "=========="); - ARE.getLog().info("=========准备获取APP分组信息=========="); - AppBusinessGroupModel oGroup = new AppBusinessGroupModel(sGroupCode); - int iCount = oGroup.getsGroupCode().length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "分组号:" + sGroupCode + " 未找到相应分组配置!"); - ARE.getLog().debug("分组号:" + sGroupCode + " 未找到相应分组配置!"); - ARE.getLog() - .info("======================================= removeGroupData:end > 删除失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - iCount = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) - .getsDono().length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "分组号:" + sGroupCode + " 配置元素模板为空!"); - ARE.getLog().debug("分组号:" + sGroupCode + " 配置元素模板为空!"); - ARE.getLog() - .info("======================================= removeGroupData:end > 删除失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - String sDono = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) - .getsDono(); - ARE.getLog().info("=========获取模板号:" + sDono + "=========="); - ARE.getLog().info("=========2.获取模板信息=========="); - Map oAppResult = deleteBusiness(sqlca, tx, sDono, - paramMap, sOtherWhere); - @SuppressWarnings("unchecked") - String sCode = ((Map) oAppResult.get("outline")) - .get("code") == null ? "" : ((Map) oAppResult - .get("outline")).get("code").toString(); - if (!ResultConstant.SUCCESS_RESULT_CODE.equals(sCode)) { - ARE.getLog() - .info("======================================= removeGroupData:end > 删除失败 ======================================"); - } - ARE.getLog() - .info("======================================= removeGroupData:end > 删除结束 ======================================"); - return oAppResult; - } - - /** - * 根据模板号删除 - * - * @param tx - * @param sDono - * @param paramMap - * @return - * @throws Exception - */ - public Map removeDonoData(Transaction sqlca, - JBOTransaction tx, String sDono, Map paramMap, - String sOtherWhere) throws Exception { - ARE.getLog() - .info("======================================= removeDonoData:begin > 删除开始 ======================================"); - if (sDono == null) sDono = ""; - int iCount = sDono.length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "模板号不能为空!"); - ARE.getLog().debug("模板号不能为空!"); - ARE.getLog() - .info("======================================= removeDonoData:end > 删除失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - ARE.getLog().info("=========1.获取模板号=========="); - ARE.getLog().info("=========获取模板号:" + sDono + "=========="); - ARE.getLog().info("=========2.获取模板信息=========="); - Map oAppResult = deleteBusiness(sqlca, tx, sDono, - paramMap, sOtherWhere); - @SuppressWarnings("unchecked") - String sCode = ((Map) oAppResult.get("outline")) - .get("code") == null ? "" : ((Map) oAppResult - .get("outline")).get("code").toString(); - if (!ResultConstant.SUCCESS_RESULT_CODE.equals(sCode)) { - ARE.getLog() - .info("======================================= removeDonoData:end > 删除失败 ======================================"); - } - - ARE.getLog() - .info("======================================= removeDonoData:end > 删除结束 ======================================"); - return oAppResult; - } -} +package apx.com.amarsoft.als.base.awe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import apx.com.amarsoft.als.base.awe.model.AppBusinessGroupModel; +import apx.com.amarsoft.als.base.awe.model.AweDoCataLogModel; +import apx.com.amarsoft.als.base.awe.util.AweDoCommUtil; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.util.ReturnMapUtil; + +/** + * 模板 分组 删除管理 + * + * @author jiaji.liu + * + */ +public abstract class AbstractAweDoDeleteManage extends AbstractAweDoHandler { + ReturnMapUtil ReturnMapUtil; + public void afterDelete(BizObject bo, JBOTransaction tx) throws Exception { + ARE.getLog() + .info("======================================= this afterDelete: default ======================================"); + } + + public void beforeDelete(BizObject bo, JBOTransaction tx) throws Exception { + ARE.getLog() + .info("======================================= this beforeDelete: default ======================================"); + } + + public String setsOtherWhere(String sJboWhere, String sOtherWhere) { + if (StringX.isSpace(sOtherWhere)) + return sJboWhere; + sOtherWhere = sOtherWhere.trim(); + if (StringX.isSpace(sJboWhere)) { + if (sOtherWhere.toLowerCase().startsWith("and ")) + sOtherWhere = new StringBuilder().append("1 = 1 ") + .append(sOtherWhere).toString(); + } else { + if (!sOtherWhere.toLowerCase().startsWith("and ")) + sOtherWhere = new StringBuilder().append("and ") + .append(sOtherWhere).toString(); + sOtherWhere = new StringBuilder().append(sJboWhere).append(" ") + .append(sOtherWhere).toString(); + } + return sOtherWhere; + } + + protected Map deleteBusiness(Transaction sqlca, + JBOTransaction tx, String sDono, Map paramMap, + String sOtherWhere, ReturnMapUtil ReturnMapUtil) throws JBOException { + this.ReturnMapUtil = ReturnMapUtil; + AweDoCataLogModel oAweDoCataLog = new AweDoCataLogModel(sDono); + int iCount = oAweDoCataLog.getsDono().length(); + if (iCount == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "模板号:" + sDono + "不存在!"); + ARE.getLog().debug("模板号:" + sDono + "不存在!"); + return ReturnMapUtil.getReturnMap(); + } + String sDoName = oAweDoCataLog.getsDoName(); + ARE.getLog().info("=========模板名:" + sDoName + "=========="); + String sJboClass = oAweDoCataLog.getsJboClass(); + String sJboWhere = oAweDoCataLog.getsJboWhere(); + if (sOtherWhere != null && sOtherWhere.length() > 0) + sJboWhere = setsOtherWhere(sJboWhere, sOtherWhere); + iCount = sJboClass.length(); + if (iCount == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "模板号,模板名称:" + sDono + "," + + sDoName + "主表未找到!"); + ARE.getLog().debug("模板号,模板名称:" + sDono + "," + sDoName + "主表未找到!"); + return ReturnMapUtil.getReturnMap(); + } + iCount = sJboWhere.length(); + if (iCount > 0) + sJboWhere = AweDoCommUtil.whereHandle(sJboWhere, paramMap); + + ARE.getLog().info("=========获取AWE_DO_LIBRARY=========="); + List> donoLibrary = oAweDoCataLog.getoLibrary(); + List> elementDatas = new ArrayList>(); + for (Map element : donoLibrary) { + String sColTableName = element.get("coltablename") == null ? "" + : element.get("coltablename").toString(); + if ("o".equalsIgnoreCase(sColTableName)) { + Map elementData = new HashMap(); + for (String sKey : element.keySet()) { + elementData.put(sKey, element.get(sKey)); + } + elementDatas.add(elementData); + } + } + ARE.getLog().info("=========3.开始删除=========="); + try { + BizObjectManager deleteBom = JBOFactory + .getBizObjectManager(sJboClass); + tx.join(deleteBom); + BizObjectQuery deleteBoq = deleteBom.createQuery(sJboWhere + + sOtherWhere); + BizObject deleteBo = deleteBoq.getSingleResult(true); + if (null == deleteBo) { + + } else { + beforeDelete(deleteBo, tx); + deleteBom.deleteObject(deleteBo); + afterDelete(deleteBo, tx); + tx.commit(); + } + } catch (Exception e) { + tx.rollback(); + ARE.getLog().error( + RestfullConstant.baseProperty.get("FAIL_DELETE") + "\r\n" + + "error:" + e); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), + (String) RestfullConstant.baseProperty.get("FAIL_DELETE")); + return ReturnMapUtil.getReturnMap(); + } + ReturnMapUtil.setReturnMap(null, (String) RestfullConstant.baseProperty + .get("SUCCESS".toLowerCase()), + (String) RestfullConstant.baseProperty.get("SUCCESS_DELETE")); + return ReturnMapUtil.getReturnMap(); + } + + /** + * 根据分组号删除数据 + * + * @param tx + * @param sGroupCode + * @param paramMap + * @return + * @throws Exception + */ + public Map removeGroupData(Transaction sqlca, + JBOTransaction tx, String sGroupCode, Map paramMap, + String sOtherWhere, ReturnMapUtil ReturnMapUtil) throws Exception { + this.ReturnMapUtil = ReturnMapUtil; + ARE.getLog() + .info("======================================= removeGroupData:begin > 删除开始 ======================================"); + if (sGroupCode == null) + sGroupCode = ""; + if (sGroupCode.length() == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "分组号为空,无法查询具体模板数据!"); + ARE.getLog().debug("分组号为空,无法查询具体模板数据!"); + ARE.getLog() + .info("======================================= removeGroupData:end > 删除失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + ARE.getLog().info("=========1.获取分组号=========="); + ARE.getLog().info("=========获取分组号: " + sGroupCode + "=========="); + ARE.getLog().info("=========准备获取APP分组信息=========="); + AppBusinessGroupModel oGroup = new AppBusinessGroupModel(sGroupCode); + int iCount = oGroup.getsGroupCode().length(); + if (iCount == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "分组号:" + sGroupCode + + " 未找到相应分组配置!"); + ARE.getLog().debug("分组号:" + sGroupCode + " 未找到相应分组配置!"); + ARE.getLog() + .info("======================================= removeGroupData:end > 删除失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + iCount = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) + .getsDono().length(); + if (iCount == 0) { + ReturnMapUtil + .setReturnMap(null, (String) RestfullConstant.baseProperty + .get("FAIL".toLowerCase()), "分组号:" + sGroupCode + + " 配置元素模板为空!"); + ARE.getLog().debug("分组号:" + sGroupCode + " 配置元素模板为空!"); + ARE.getLog() + .info("======================================= removeGroupData:end > 删除失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + String sDono = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) + .getsDono(); + ARE.getLog().info("=========获取模板号:" + sDono + "=========="); + ARE.getLog().info("=========2.获取模板信息=========="); + Map oAppResult = deleteBusiness(sqlca, tx, sDono, + paramMap, sOtherWhere, ReturnMapUtil); + @SuppressWarnings("unchecked") + String sCode = ((Map) oAppResult.get("outline")) + .get("code") == null ? "" : ((Map) oAppResult + .get("outline")).get("code").toString(); + if (!RestfullConstant.baseProperty.get("SUCCESS".toLowerCase()).equals( + sCode)) { + ARE.getLog() + .info("======================================= removeGroupData:end > 删除失败 ======================================"); + } + ARE.getLog() + .info("======================================= removeGroupData:end > 删除结束 ======================================"); + return oAppResult; + } + + /** + * 根据模板号删除 + * + * @param tx + * @param sDono + * @param paramMap + * @return + * @throws Exception + */ + public Map removeDonoData(Transaction sqlca, + JBOTransaction tx, String sDono, Map paramMap, + String sOtherWhere, ReturnMapUtil ReturnMapUtil) throws Exception { + this.ReturnMapUtil = ReturnMapUtil; + ARE.getLog() + .info("======================================= removeDonoData:begin > 删除开始 ======================================"); + if (sDono == null) + sDono = ""; + int iCount = sDono.length(); + if (iCount == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "模板号不能为空!"); + ARE.getLog().debug("模板号不能为空!"); + ARE.getLog() + .info("======================================= removeDonoData:end > 删除失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + ARE.getLog().info("=========1.获取模板号=========="); + ARE.getLog().info("=========获取模板号:" + sDono + "=========="); + ARE.getLog().info("=========2.获取模板信息=========="); + Map oAppResult = deleteBusiness(sqlca, tx, sDono, + paramMap, sOtherWhere, ReturnMapUtil); + @SuppressWarnings("unchecked") + String sCode = ((Map) oAppResult.get("outline")) + .get("code") == null ? "" : ((Map) oAppResult + .get("outline")).get("code").toString(); + if (!RestfullConstant.baseProperty.get("SUCCESS".toLowerCase()).equals( + sCode)) { + ARE.getLog() + .info("======================================= removeDonoData:end > 删除失败 ======================================"); + } + + ARE.getLog() + .info("======================================= removeDonoData:end > 删除结束 ======================================"); + return oAppResult; + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoHandler.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoHandler.java new file mode 100644 index 000000000..4e42484e7 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoHandler.java @@ -0,0 +1,44 @@ +package apx.com.amarsoft.als.base.awe; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOTransaction; + +public abstract class AbstractAweDoHandler { + protected void initDisplayForAdd(BizObject bo) throws JBOException { + } + + protected void initDisplayForEdit(BizObject bo) throws JBOException { + } + + protected void afterDelete(BizObject bo, JBOTransaction tx) + throws Exception { + } + + public void beforeDelete(BizObject bo, JBOTransaction tx) throws Exception { + } + + protected void saveBeforeProcess(BizObject bo) throws Exception { + } + + protected void afterInsert(BizObject bo, JBOTransaction tx) + throws Exception { + } + + protected void afterUpdate(BizObject bo, JBOTransaction tx) + throws Exception { + } + + protected void beforeInsert(BizObject bo, JBOTransaction tx) + throws Exception { + } + + protected void beforeUpdate(BizObject bo, JBOTransaction tx) + throws Exception { + } + + protected boolean validityCheck(BizObject bo, boolean isInsert, + JBOTransaction tx) throws Exception { + return true; + } +} diff --git a/src_app/apx/com/amarsoft/als/base/awe/AbstractAweDoInitDisplayManage.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoInitDisplayManage.java similarity index 77% rename from src_app/apx/com/amarsoft/als/base/awe/AbstractAweDoInitDisplayManage.java rename to src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoInitDisplayManage.java index 5296d591f..823e70748 100644 --- a/src_app/apx/com/amarsoft/als/base/awe/AbstractAweDoInitDisplayManage.java +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoInitDisplayManage.java @@ -1,336 +1,377 @@ -package apx.com.amarsoft.als.base.awe; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import apx.com.amarsoft.als.base.awe.model.AppBusinessGroupModel; -import apx.com.amarsoft.als.base.awe.model.AweDoCataLogModel; -import apx.com.amarsoft.als.base.awe.util.AweDoCommUtil; -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.dict.als.manage.CodeManager; - -public abstract class AbstractAweDoInitDisplayManage { - private String sMessage = ""; - - public void initDisplayForAdd(BizObject bo) { - ARE.getLog() - .info("======================================= this initDisplayForAdd: default ======================================"); - } - - public void initDisplayForEdit(BizObject bo) { - ARE.getLog() - .info("======================================= this initDisplayForEdit: default ======================================"); - } - - protected List> findDonoElement(Transaction sqlca, - JBOTransaction tx, String sDono, Map paramMap, - String sOtherWhere) throws JBOException { - AweDoCataLogModel oAweDoCataLog = new AweDoCataLogModel(sDono); - int iCount = oAweDoCataLog.getsDono().length(); - if (iCount == 0) { - ARE.getLog().debug("模板号:" + sDono + "不存在!"); - sMessage = "模板号:" + sDono + "不存在!"; - return new ArrayList>(); - } - String sDoName = oAweDoCataLog.getsDoName(); - ARE.getLog().info("=========模板名:" + sDoName + "=========="); - String sJboClass = oAweDoCataLog.getsJboClass(); - String sJboWhere = oAweDoCataLog.getsJboWhere(); - iCount = sJboClass.length(); - if (iCount == 0) { - ARE.getLog().debug("模板号,模板名称:" + sDono + "," + sDoName + "主表未找到!"); - sMessage = "模板号,模板名称:" + sDono + "," + sDoName + "主表未找到!"; - return new ArrayList>(); - } - iCount = sJboWhere.length(); - if (iCount > 0) - sJboWhere = AweDoCommUtil.whereHandle(sJboWhere, paramMap); - - ARE.getLog().info("=========获取AWE_DO_LIBRARY=========="); - List> donoLibrary = oAweDoCataLog.getoLibrary(); - ARE.getLog().info("=========3.开始删除=========="); - try { - BizObjectManager initBom = JBOFactory - .getBizObjectManager(sJboClass); - BizObjectQuery initBoq = initBom.createQuery(sJboWhere - + sOtherWhere); - @SuppressWarnings("unchecked") - List initBos = initBoq.getResultList(false); - List> datas = new ArrayList>(); - if (initBos.size() == 0) { - Map data = new HashMap(); - List> cols = new ArrayList>(); - for (Map doLibraryMap : donoLibrary) { - String sColTableName = doLibraryMap.get("COLTABLENAME" - .toLowerCase()) == null ? "" : doLibraryMap.get( - "COLTABLENAME".toLowerCase()).toString(); - if (!"o".equalsIgnoreCase(sColTableName)) { - continue; - } - doLibraryMap.put("itemno", ""); - doLibraryMap.put("value", ""); - Map col = new HashMap(); - col.put("basetype", col.get("coltype")); - for (String key : doLibraryMap.keySet()) { - col.put(key, doLibraryMap.get(key)); - } - cols.add(col); - } - data.put("detail_data", cols); - datas.add(data); - } else { - BizObject initBo = initBos.get(0); - Map data = new HashMap(); - List> cols = new ArrayList>(); - for (Map doLibraryMap : donoLibrary) { - String sColTableName = doLibraryMap.get("COLTABLENAME" - .toLowerCase()) == null ? "" : doLibraryMap.get( - "COLTABLENAME".toLowerCase()).toString(); - if (!"o".equalsIgnoreCase(sColTableName)) { - continue; - } - - String sActualName = doLibraryMap.get("COLACTUALNAME" - .toLowerCase()) == null ? "" : doLibraryMap.get( - "COLACTUALNAME".toLowerCase()).toString(); - doLibraryMap.put("itemno", initBo.getAttribute(sActualName) - .getValue()); - String sColedSourceType = doLibraryMap - .get("COLEDITSOURCETYPE".toLowerCase()) == null ? "" - : doLibraryMap.get( - "COLEDITSOURCETYPE".toLowerCase()) - .toString(); - String sColedSource = doLibraryMap.get("COLEDITSOURCE" - .toLowerCase()) == null ? "" : doLibraryMap.get( - "COLEDITSOURCE".toLowerCase()).toString(); - if ("code".equalsIgnoreCase(sColedSourceType)) { - String sItemName = CodeManager.getItemName( - sColedSource, - initBo.getAttribute(sActualName) == null ? "" - : initBo.getAttribute(sActualName) - .toString()); - doLibraryMap.put("value", sItemName); - } else if ("jbo".equalsIgnoreCase(sColedSourceType)) { - if (sColedSource.length() == 0) { - doLibraryMap - .put("itemno", - initBo.getAttribute(sActualName) - .getValue()); - doLibraryMap - .put("value", - initBo.getAttribute(sActualName) - .getValue()); - } - String[] aSrouce = sColedSource.split(","); - if (aSrouce.length != 4) { - doLibraryMap - .put("itemno", - initBo.getAttribute(sActualName) - .getValue()); - doLibraryMap - .put("value", - initBo.getAttribute(sActualName) - .getValue()); - } else { - try { - BizObjectManager sourceManager = JBOFactory - .getBizObjectManager(aSrouce[0]); - BizObjectQuery sourceQuery = sourceManager - .createQuery("SELECT " + aSrouce[1] - + "," + aSrouce[2] - + " FROM O WHERE " + aSrouce[3]); - BizObject sourceObject = sourceQuery - .getSingleResult(false); - if (null == sourceObject) { - doLibraryMap.put("itemno", initBo - .getAttribute(sActualName) - .getValue()); - doLibraryMap.put("value", initBo - .getAttribute(sActualName) - .getValue()); - } else { - doLibraryMap.put("itemno", sourceObject - .getAttribute(aSrouce[1]) - .getValue()); - doLibraryMap.put("value", sourceObject - .getAttribute(aSrouce[2]) - .getValue()); - } - } catch (Exception e) { - doLibraryMap.put("itemno", - initBo.getAttribute(sActualName) - .getValue()); - doLibraryMap.put("value", - initBo.getAttribute(sActualName) - .getValue()); - } - } - } else if ("codetable".equalsIgnoreCase(sColedSourceType)) { - if (sColedSource.length() == 0) { - doLibraryMap - .put("itemno", - initBo.getAttribute(sActualName) - .getValue()); - doLibraryMap - .put("value", - initBo.getAttribute(sActualName) - .getValue()); - } - String[] aSource = sColedSource.split(","); - if (aSource.length % 2 == 0) { - for (int ai = 0; ai < aSource.length; ai++) { - if ((ai + 1) % 2 != 0 - && initBo.getAttribute(sActualName) - .getValue().equals(aSource[ai])) { - doLibraryMap.put("itemno", initBo - .getAttribute(sActualName) - .getValue()); - doLibraryMap.put("value", aSource[ai + 1]); - } - } - } - if (null == doLibraryMap.get("value")) { - doLibraryMap - .put("itemno", - initBo.getAttribute(sActualName) - .getValue()); - doLibraryMap - .put("value", - initBo.getAttribute(sActualName) - .getValue()); - } - } else if ("@MIN_MAX".equalsIgnoreCase(sColedSourceType)) { - doLibraryMap.put("value", - initBo.getAttribute(sActualName).getValue()); - } else if ("SubPage".equalsIgnoreCase(sColedSourceType)) { - doLibraryMap.put("value", - initBo.getAttribute(sActualName).getValue()); - } else { - doLibraryMap.put("value", - initBo.getAttribute(sActualName).getValue()); - } - - Map col = new HashMap(); - Map colList = new HashMap(); - for (String key : doLibraryMap.keySet()) { - col.put(key, doLibraryMap.get(key)); - colList.put(key, doLibraryMap.get(key)); - } - col.put("basetype", col.get("coltype")); - cols.add(col); - } - data.put("detail_data", cols); - datas.add(data); - } - return datas; - } catch (Exception e) { - ARE.getLog() - .error(ResultConstant.SUCCESS_INIT_DISPLAY + "\r\n" - + "error:" + e); - return new ArrayList>(); - } - } - - public Map loadGroupSavePage(Transaction sqlca, - JBOTransaction tx, String sGroupCode, Map paramMap, - String sOtherWhere) throws Exception { - ARE.getLog() - .info("======================================= removeGroupData:begin > 初始化保存元素开始 ======================================"); - if (sGroupCode == null) sGroupCode = ""; - if (sGroupCode.length() == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "分组号为空,无法查询具体模板数据!"); - ARE.getLog().debug("分组号为空,无法查询具体模板数据!"); - ARE.getLog() - .info("======================================= removeGroupData:end > 删除失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - ARE.getLog().info("=========1.获取分组号=========="); - ARE.getLog().info("=========获取分组号: " + sGroupCode + "=========="); - ARE.getLog().info("=========准备获取APP分组信息=========="); - AppBusinessGroupModel oGroup = new AppBusinessGroupModel(sGroupCode); - int iCount = oGroup.getsGroupCode().length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "分组号:" + sGroupCode + " 未找到相应分组配置!"); - ARE.getLog().debug("分组号:" + sGroupCode + " 未找到相应分组配置!"); - ARE.getLog() - .info("======================================= removeGroupData:end > 删除失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - iCount = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) - .getsDono().length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "分组号:" + sGroupCode + " 配置元素模板为空!"); - ARE.getLog().debug("分组号:" + sGroupCode + " 配置元素模板为空!"); - ARE.getLog() - .info("======================================= removeGroupData:end > 删除失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - String sDono = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) - .getsDono(); - ARE.getLog().info("=========获取模板号:" + sDono + "=========="); - ARE.getLog().info("=========2.获取模板信息=========="); - List> bos = findDonoElement(sqlca, tx, sDono, paramMap, - sOtherWhere); - if (bos.size() == 0) { - if (sMessage.length() == 0) - sMessage = ResultConstant.FAIL_INIT_DISPLAY; - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - sMessage); - return ReturnMapUtil.getReturnMap(); - } - Map body = new HashMap(); - body.put("datas", bos); - ReturnMapUtil.setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, - ResultConstant.SUCCESS_INIT_DISPLAY); - return ReturnMapUtil.getReturnMap(); - } - - public Map loadDonoSavePage(Transaction sqlca, - JBOTransaction tx, String sDono, Map paramMap, - String sOtherWhere) throws Exception { - ARE.getLog() - .info("======================================= removeDonoData:begin > 删除开始 ======================================"); - if (sDono == null) sDono = ""; - int iCount = sDono.length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "模板号 不能为空!"); - ARE.getLog().debug("模板号 不能为空!"); - ARE.getLog() - .info("======================================= removeDonoData:end > 删除失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - ARE.getLog().info("=========1.获取模板号=========="); - ARE.getLog().info("=========获取模板号:" + sDono + "=========="); - ARE.getLog().info("=========2.获取模板信息=========="); - List> bos = findDonoElement(sqlca, tx, sDono, paramMap, - sOtherWhere); - if (bos.size() == 0) { - if (sMessage.length() == 0) - sMessage = ResultConstant.FAIL_INIT_DISPLAY; - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - sMessage); - return ReturnMapUtil.getReturnMap(); - } - Map body = new HashMap(); - body.put("datas", bos); - ReturnMapUtil.setReturnMap(body, ResultConstant.SUCCESS_RESULT_CODE, - ResultConstant.SUCCESS_INIT_DISPLAY); - return ReturnMapUtil.getReturnMap(); - } -} +package apx.com.amarsoft.als.base.awe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import apx.com.amarsoft.als.base.awe.model.AppBusinessGroupModel; +import apx.com.amarsoft.als.base.awe.model.AweDoCataLogModel; +import apx.com.amarsoft.als.base.awe.util.AweDoCommUtil; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.dict.als.manage.CodeManager; +import com.base.constant.RestfullConstant; +import com.base.util.ReturnMapUtil; + +public abstract class AbstractAweDoInitDisplayManage { + private String sMessage = ""; + ReturnMapUtil ReturnMapUtil; + + public void initDisplayForAdd(BizObject bo) { + ARE.getLog() + .info("======================================= this initDisplayForAdd: default ======================================"); + } + + public void initDisplayForEdit(BizObject bo) { + ARE.getLog() + .info("======================================= this initDisplayForEdit: default ======================================"); + } + + public String setsOtherWhere(String sJboWhere, String sOtherWhere) { + if (StringX.isSpace(sOtherWhere)) + return sJboWhere; + sOtherWhere = sOtherWhere.trim(); + if (StringX.isSpace(sJboWhere)) { + if (sOtherWhere.toLowerCase().startsWith("and ")) + sOtherWhere = new StringBuilder().append("1 = 1 ") + .append(sOtherWhere).toString(); + } else { + if (!sOtherWhere.toLowerCase().startsWith("and ")) + sOtherWhere = new StringBuilder().append("and ") + .append(sOtherWhere).toString(); + sOtherWhere = new StringBuilder().append(sJboWhere).append(" ") + .append(sOtherWhere).toString(); + } + return sOtherWhere; + } + + protected List> findDonoElement(Transaction sqlca, + JBOTransaction tx, String sDono, Map paramMap, + String sOtherWhere, ReturnMapUtil ReturnMapUtil) throws JBOException { + this.ReturnMapUtil = ReturnMapUtil; + AweDoCataLogModel oAweDoCataLog = new AweDoCataLogModel(sDono); + int iCount = oAweDoCataLog.getsDono().length(); + if (iCount == 0) { + ARE.getLog().debug("模板号:" + sDono + "不存在!"); + sMessage = "模板号:" + sDono + "不存在!"; + return new ArrayList>(); + } + String sDoName = oAweDoCataLog.getsDoName(); + ARE.getLog().info("=========模板名:" + sDoName + "=========="); + String sJboClass = oAweDoCataLog.getsJboClass(); + String sJboWhere = oAweDoCataLog.getsJboWhere(); + if (sOtherWhere != null && sOtherWhere.length() > 0) + sJboWhere = setsOtherWhere(sJboWhere, sOtherWhere); + iCount = sJboClass.length(); + if (iCount == 0) { + ARE.getLog().debug("模板号,模板名称:" + sDono + "," + sDoName + "主表未找到!"); + sMessage = "模板号,模板名称:" + sDono + "," + sDoName + "主表未找到!"; + return new ArrayList>(); + } + iCount = sJboWhere.length(); + if (iCount > 0) + sJboWhere = AweDoCommUtil.whereHandle(sJboWhere, paramMap); + + ARE.getLog().info("=========获取AWE_DO_LIBRARY=========="); + List> donoLibrary = oAweDoCataLog.getoLibrary(); + ARE.getLog().info("=========3.开始删除=========="); + try { + BizObjectManager initBom = JBOFactory + .getBizObjectManager(sJboClass); + BizObjectQuery initBoq = initBom.createQuery(sJboWhere + + sOtherWhere); + @SuppressWarnings("unchecked") + List initBos = initBoq.getResultList(false); + List> datas = new ArrayList>(); + if (initBos.size() == 0) { + Map data = new HashMap(); + List> cols = new ArrayList>(); + for (Map doLibraryMap : donoLibrary) { + String sColTableName = doLibraryMap.get("COLTABLENAME" + .toLowerCase()) == null ? "" : doLibraryMap.get( + "COLTABLENAME".toLowerCase()).toString(); + if (!"o".equalsIgnoreCase(sColTableName)) { + continue; + } + doLibraryMap.put("itemno", ""); + doLibraryMap.put("value", ""); + Map col = new HashMap(); + col.put("basetype", col.get("coltype")); + for (String key : doLibraryMap.keySet()) { + col.put(key, doLibraryMap.get(key)); + } + cols.add(col); + } + data.put("detail_data", cols); + datas.add(data); + } else { + BizObject initBo = initBos.get(0); + Map data = new HashMap(); + List> cols = new ArrayList>(); + for (Map doLibraryMap : donoLibrary) { + String sColTableName = doLibraryMap.get("COLTABLENAME" + .toLowerCase()) == null ? "" : doLibraryMap.get( + "COLTABLENAME".toLowerCase()).toString(); + if (!"o".equalsIgnoreCase(sColTableName)) { + continue; + } + + String sActualName = doLibraryMap.get("COLACTUALNAME" + .toLowerCase()) == null ? "" : doLibraryMap.get( + "COLACTUALNAME".toLowerCase()).toString(); + doLibraryMap.put("itemno", initBo.getAttribute(sActualName) + .getValue()); + String sColedSourceType = doLibraryMap + .get("COLEDITSOURCETYPE".toLowerCase()) == null ? "" + : doLibraryMap.get( + "COLEDITSOURCETYPE".toLowerCase()) + .toString(); + String sColedSource = doLibraryMap.get("COLEDITSOURCE" + .toLowerCase()) == null ? "" : doLibraryMap.get( + "COLEDITSOURCE".toLowerCase()).toString(); + if ("code".equalsIgnoreCase(sColedSourceType)) { + String sItemName = CodeManager.getItemName( + sColedSource, + initBo.getAttribute(sActualName) == null ? "" + : initBo.getAttribute(sActualName) + .toString()); + doLibraryMap.put("value", sItemName); + } else if ("jbo".equalsIgnoreCase(sColedSourceType)) { + if (sColedSource.length() == 0) { + doLibraryMap + .put("itemno", + initBo.getAttribute(sActualName) + .getValue()); + doLibraryMap + .put("value", + initBo.getAttribute(sActualName) + .getValue()); + } + String[] aSrouce = sColedSource.split(","); + if (aSrouce.length != 4) { + doLibraryMap + .put("itemno", + initBo.getAttribute(sActualName) + .getValue()); + doLibraryMap + .put("value", + initBo.getAttribute(sActualName) + .getValue()); + } else { + try { + BizObjectManager sourceManager = JBOFactory + .getBizObjectManager(aSrouce[0]); + BizObjectQuery sourceQuery = sourceManager + .createQuery("SELECT " + aSrouce[1] + + "," + aSrouce[2] + + " FROM O WHERE " + aSrouce[3]); + BizObject sourceObject = sourceQuery + .getSingleResult(false); + if (null == sourceObject) { + doLibraryMap.put("itemno", initBo + .getAttribute(sActualName) + .getValue()); + doLibraryMap.put("value", initBo + .getAttribute(sActualName) + .getValue()); + } else { + doLibraryMap.put("itemno", sourceObject + .getAttribute(aSrouce[1]) + .getValue()); + doLibraryMap.put("value", sourceObject + .getAttribute(aSrouce[2]) + .getValue()); + } + } catch (Exception e) { + doLibraryMap.put("itemno", + initBo.getAttribute(sActualName) + .getValue()); + doLibraryMap.put("value", + initBo.getAttribute(sActualName) + .getValue()); + } + } + } else if ("codetable".equalsIgnoreCase(sColedSourceType)) { + if (sColedSource.length() == 0) { + doLibraryMap + .put("itemno", + initBo.getAttribute(sActualName) + .getValue()); + doLibraryMap + .put("value", + initBo.getAttribute(sActualName) + .getValue()); + } + String[] aSource = sColedSource.split(","); + if (aSource.length % 2 == 0) { + for (int ai = 0; ai < aSource.length; ai++) { + if ((ai + 1) % 2 != 0 + && initBo.getAttribute(sActualName) + .getValue().equals(aSource[ai])) { + doLibraryMap.put("itemno", initBo + .getAttribute(sActualName) + .getValue()); + doLibraryMap.put("value", aSource[ai + 1]); + } + } + } + if (null == doLibraryMap.get("value")) { + doLibraryMap + .put("itemno", + initBo.getAttribute(sActualName) + .getValue()); + doLibraryMap + .put("value", + initBo.getAttribute(sActualName) + .getValue()); + } + } else if ("@MIN_MAX".equalsIgnoreCase(sColedSourceType)) { + doLibraryMap.put("value", + initBo.getAttribute(sActualName).getValue()); + } else if ("SubPage".equalsIgnoreCase(sColedSourceType)) { + doLibraryMap.put("value", + initBo.getAttribute(sActualName).getValue()); + } else { + doLibraryMap.put("value", + initBo.getAttribute(sActualName).getValue()); + } + + Map col = new HashMap(); + Map colList = new HashMap(); + for (String key : doLibraryMap.keySet()) { + col.put(key, doLibraryMap.get(key)); + colList.put(key, doLibraryMap.get(key)); + } + col.put("basetype", col.get("coltype")); + cols.add(col); + } + data.put("detail_data", cols); + datas.add(data); + } + return datas; + } catch (Exception e) { + ARE.getLog() + .error(RestfullConstant.baseProperty.get("FAIL_INIT_DISPLAY") + "\r\n" + + "error:" + e); + return new ArrayList>(); + } + } + + public Map loadGroupSavePage(Transaction sqlca, + JBOTransaction tx, String sGroupCode, Map paramMap, + String sOtherWhere, ReturnMapUtil ReturnMapUtil) throws Exception { + this.ReturnMapUtil = ReturnMapUtil; + ARE.getLog() + .info("======================================= removeGroupData:begin > 初始化保存元素开始 ======================================"); + if (sGroupCode == null) + sGroupCode = ""; + if (sGroupCode.length() == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "分组号为空,无法查询具体模板数据!"); + ARE.getLog().debug("分组号为空,无法查询具体模板数据!"); + ARE.getLog() + .info("======================================= removeGroupData:end > 删除失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + ARE.getLog().info("=========1.获取分组号=========="); + ARE.getLog().info("=========获取分组号: " + sGroupCode + "=========="); + ARE.getLog().info("=========准备获取APP分组信息=========="); + AppBusinessGroupModel oGroup = new AppBusinessGroupModel(sGroupCode); + int iCount = oGroup.getsGroupCode().length(); + if (iCount == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "分组号:" + sGroupCode + + " 未找到相应分组配置!"); + ARE.getLog().debug("分组号:" + sGroupCode + " 未找到相应分组配置!"); + ARE.getLog() + .info("======================================= removeGroupData:end > 删除失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + iCount = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) + .getsDono().length(); + if (iCount == 0) { + ReturnMapUtil + .setReturnMap(null, (String) RestfullConstant.baseProperty + .get("FAIL".toLowerCase()), "分组号:" + sGroupCode + + " 配置元素模板为空!"); + ARE.getLog().debug("分组号:" + sGroupCode + " 配置元素模板为空!"); + ARE.getLog() + .info("======================================= removeGroupData:end > 删除失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + String sDono = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) + .getsDono(); + ARE.getLog().info("=========获取模板号:" + sDono + "=========="); + ARE.getLog().info("=========2.获取模板信息=========="); + List> bos = findDonoElement(sqlca, tx, sDono, + paramMap, sOtherWhere, ReturnMapUtil); + if (bos.size() == 0) { + if (sMessage.length() == 0) + sMessage = (String) RestfullConstant.baseProperty + .get("FAIL_INIT_DISPLAY"); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), sMessage); + return ReturnMapUtil.getReturnMap(); + } + Map body = new HashMap(); + body.put("datas", bos); + ReturnMapUtil.setReturnMap(body, (String) RestfullConstant.baseProperty + .get("SUCCESS".toLowerCase()), + (String) RestfullConstant.baseProperty + .get("SUCCESS_INIT_DISPLAY")); + return ReturnMapUtil.getReturnMap(); + } + + public Map loadDonoSavePage(Transaction sqlca, + JBOTransaction tx, String sDono, Map paramMap, + String sOtherWhere, ReturnMapUtil ReturnMapUtil) throws Exception { + this.ReturnMapUtil = ReturnMapUtil; + ARE.getLog() + .info("======================================= removeDonoData:begin > 删除开始 ======================================"); + if (sDono == null) + sDono = ""; + int iCount = sDono.length(); + if (iCount == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "模板号 不能为空!"); + ARE.getLog().debug("模板号 不能为空!"); + ARE.getLog() + .info("======================================= removeDonoData:end > 删除失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + ARE.getLog().info("=========1.获取模板号=========="); + ARE.getLog().info("=========获取模板号:" + sDono + "=========="); + ARE.getLog().info("=========2.获取模板信息=========="); + List> bos = findDonoElement(sqlca, tx, sDono, + paramMap, sOtherWhere, ReturnMapUtil); + if (bos.size() == 0) { + if (sMessage.length() == 0) + sMessage = (String) RestfullConstant.baseProperty + .get("FAIL_INIT_DISPLAY"); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), sMessage); + return ReturnMapUtil.getReturnMap(); + } + Map body = new HashMap(); + body.put("datas", bos); + ReturnMapUtil.setReturnMap(body, (String) RestfullConstant.baseProperty + .get("SUCCESS".toLowerCase()), + (String) RestfullConstant.baseProperty + .get("SUCCESS_INIT_DISPLAY")); + return ReturnMapUtil.getReturnMap(); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoQueryManage.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoQueryManage.java new file mode 100644 index 000000000..a7ccc607e --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoQueryManage.java @@ -0,0 +1,1474 @@ +package apx.com.amarsoft.als.base.awe; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import jbo.app.AWE_DO_GROUP; +import jbo.app.AWE_DO_LIBRARY; +import apx.com.amarsoft.als.base.awe.util.AweDoCommUtil; +import apx.com.amarsoft.als.base.cache.instance.AppAweDoCache; +import apx.com.amarsoft.als.base.cache.instance.AppCodeCache; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.are.log.Log; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.util.BizObjectUtil; +import com.base.util.MultipartDataUtil; +import com.base.util.RequestUtil; +import com.base.util.ReturnMapUtil; + +public abstract class AbstractAweDoQueryManage extends AbstractAweDoHandler { + private static Log logger = ARE.getLog(); + ReturnMapUtil ReturnMapUtil; + protected Map paramMap; // 参数 + private Map donoMap; // 获取AWE_DO_CATALOG MAP格式: + + private List> templateList; // 获取分组模板信息 + + // AWE_DO_CATALOG + private String sDoName; // 获取当前模板名称 + private String sDono; // 获取当前分组模板号 + private String sJboClass; // JBO对象名 + private String sJboFrom; // JBOFROM子句 + private String sJboWhere; // JBOWHERE子句 + private String sJboOrder; // JBOGROUP子句 + private String sJboGroup; // JBOORDER子句 + + // APP_GROUP + private String sGroupIsList; // Y表示列表 N表示表单 + + // APP_GROUP_TEMPLATE + private String sGroupCode; // 分组号 + private String sDataName; // APP显示表单元素名 + private String sDataCode; // 表单元素号 + private String sIsList; // 是否列表显示 + private String sIsShow; // 分是否表单显示 + private String sPosition; // 分组模板数据位置 + // private String sIsConvert; // 预留字段 + + protected String sGroupId; // 同group_code + protected String sOtherWhere; // 附加条件 + + protected String sFilter; + + private String sPageIndex; + private String sLimit; + private String sDataCount; + private String sInputUserId; + private String sInputOrgId; + private String sUpdateUserId; + private String sUpdateOrgId; + protected Map noRequestParamMap; + + protected void initDisplayForAdd(BizObject bo) throws JBOException { + ARE.getLog() + .info("======================================= this initDisplayForAdd: default ======================================"); + } + + protected void initDisplayForEdit(BizObject bo) throws JBOException { + ARE.getLog() + .info("======================================= this initDisplayForEdit: default ======================================"); + } + + public void setNoRequestParamMap(Map noRequestParamMap) { + this.noRequestParamMap = noRequestParamMap; + } + + public void setParamMap(Map paramMap) { + this.paramMap = paramMap; + } + + public void getGroupId() { + sGroupId = ""; + } + + public void getOtherWhere() { + sOtherWhere = ""; + } + + public void getsFilter(String sFilter) { + this.sFilter = sFilter; + } + + public void setsJboClass(String sJboClass) { + this.sJboClass = sJboClass; + } + + public void setsJboWhere(String sJboWhere) { + this.sJboWhere = sJboWhere; + } + + public void setsJboOrder(String sJboOrder) { + this.sJboOrder = sJboOrder; + } + + public void setsJboGroup(String sJboGroup) { + this.sJboGroup = sJboGroup; + } + + public void setsOtherWhereHandler() { + if (StringX.isSpace(sOtherWhere)) + return; + sOtherWhere = sOtherWhere.trim(); + if (StringX.isSpace(this.sJboWhere)) { + if (sOtherWhere.toLowerCase().startsWith("and ")) + sOtherWhere = new StringBuilder().append("1 = 1 ") + .append(sOtherWhere).toString(); + } else { + if (!sOtherWhere.toLowerCase().startsWith("and ")) + sOtherWhere = new StringBuilder().append("and ") + .append(sOtherWhere).toString(); + sOtherWhere = new StringBuilder().append(this.sJboWhere) + .append(" ").append(sOtherWhere).toString(); + } + + this.sJboWhere = sOtherWhere; + } + + // begin 获取数据 + @SuppressWarnings("unchecked") + public Map getData(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + this.ReturnMapUtil = ReturnMapUtil; + getGroupId(); + Map appResult = new HashMap(); + appResult = findGroupTemplate(request, sqlca, tx, sGroupId); + if (null != appResult) + return appResult; + // 获取AWE_DO_LIBRARY LIST格式: + List> donoLibrary = (List>) this.donoMap + .get("library"); + + List queryList = new ArrayList(); + List methodList = new ArrayList(); + List> library = new ArrayList>(); + String sFilters = ""; + int iFilters = 0; + for (Map templateMap : this.templateList) { + // 模板library : + // 字段排序 SORTNO + String sDoSortno = templateMap.get("SORTNO".toLowerCase()) == null ? "" + : templateMap.get("SORTNO".toLowerCase()).toString(); + // 字段索引 COLINDEX + String sDoColIndex = templateMap.get("COLINDEX".toLowerCase()) == null ? "" + : templateMap.get("COLINDEX".toLowerCase()).toString(); + // 使用名称 COLNAME + String sDoColName = templateMap.get("COLNAME".toLowerCase()) == null ? "" + : templateMap.get("COLNAME".toLowerCase()).toString(); + for (Map doLibraryMap : donoLibrary) { + // APP分组: + // 字段排序 SORTNO + String sGroupSortno = doLibraryMap.get("sortno") == null ? "" + : doLibraryMap.get("sortno").toString(); + // 字段索引 COLINDEX + String sGroupColIndex = doLibraryMap.get("colindex") == null ? "" + : doLibraryMap.get("colindex").toString(); + // 使用名称 COLNAME + String sGroupColName = doLibraryMap.get("colname") == null ? "" + : doLibraryMap.get("colname").toString(); + // APP分组 和 AWE 模板library 中的(字段索引、字段排序、使用名称 绑定使用 + // 使用名称 不区分大小写 ) + if (!(sGroupSortno.equals(sDoSortno) + && sGroupColIndex.equals(sDoColIndex) && sGroupColName + .equalsIgnoreCase(sDoColName))) { + continue; + } + if (sGroupColName.startsWith("v.")) { + sGroupColName = sGroupColName.replace("v.", ""); + } + if (sGroupColName.startsWith("V.")) { + sGroupColName = sGroupColName.replace("V.", ""); + } + // 数据库原名 + String sActualName = doLibraryMap.get("colactualname") == null ? "" + : doLibraryMap.get("colactualname").toString(); + // 数据表名 + String sTableName = doLibraryMap.get("coltablename") == null ? "" + : doLibraryMap.get("coltablename").toString(); + + if (sActualName.toLowerCase().equals("inputuserid")) { + this.sInputUserId = sTableName.length() > 0 ? sTableName + + "." + sActualName : sActualName; + } + + if (sActualName.toLowerCase().equals("inputorgid")) { + this.sInputOrgId = sTableName.length() > 0 ? sTableName + + "." + sActualName : sActualName; + } + + if (sActualName.toLowerCase().equals("updateuserid")) { + this.sUpdateUserId = sTableName.length() > 0 ? sTableName + + "." + sActualName : sActualName; + } + + if (sActualName.toLowerCase().equals("updateorgid")) { + this.sUpdateOrgId = sTableName.length() > 0 ? sTableName + + "." + sActualName : sActualName; + } + + // 数据库原名 v.''或'' 不是表中字段 + // 直接剔除 + // 注释: 后续虚拟字段 VALUE 为“” + // if ("v.''".equals(sActualName) || "''".equals(sActualName)) { + // continue; + // } + + // 数据表名不为 空字符串 表示元素 肯定是表中字段 + if (sTableName.length() > 0) { + // 数据表名.数据库原名 as V.分组使用名称 + // O.CUSTOMERID AS V.CUSTOMERID + queryList.add(sTableName + "." + sActualName + " as v." + + sGroupColName); + } else { + + String sActualName1 = sActualName; + int o = 0; + o = sActualName1.contains("(") ? sActualName1.indexOf("(") + : sActualName1.length(); + sActualName1 = sActualName1.substring(0, o); + // 数据表名为空字符串 需要特殊处理 1. SQL过程方法 2. 类方法 + // SQL过程方法 数据库原名 以‘NameManager.’开头 + if (sActualName1.startsWith("NameManager.")) { + String sSqlProcess = sActualName; + sSqlProcess = sSqlProcess.replace("NameManager.", ""); + String sMethodName = sSqlProcess.substring(0, + sSqlProcess.indexOf("(")); + String sParam = sSqlProcess.replace(sMethodName, ""); + sMethodName = "v." + sMethodName; + // NameManager.getItemName("IsInUse",RoleStatus) + sParam = sParam.replace("(", ""); + sParam = sParam.replace(")", ""); + String[] aProcess = sParam.split(","); + if (sSqlProcess.startsWith("getItemName")) { + // NameManager.getItemName("NoPassDeal",NoPassDeal) + // 从 ‘,’ 开始分割 分割后长度应为2 + if (aProcess.length != 2) { + ReturnMapUtil + .setReturnMap( + null, + (String) RestfullConstant.baseProperty + .get("FAIL" + .toLowerCase()), + "模板号:" + + this.sDono + + "中字段索引:" + + sDoColIndex + + "排序号:" + + sDoSortno + + "使用名称:" + + sDoColName + + " 的字段数据库原名:" + + sActualName + + "格式有问题" + + "\r\n" + + "格式应为:NameManager.getItemName(\"xxx\",yyy)"); + logger.debug("模板号:" + + this.sDono + + "中字段索引:" + + sDoColIndex + + "排序号:" + + sDoSortno + + "使用名称:" + + sDoColName + + " 的字段数据库原名:" + + sActualName + + "格式有问题" + + "\r\n" + + "格式应为:NameManager.getItemName(\"xxx\",yyy)"); + return ReturnMapUtil.getReturnMap(); + } + // String sProcess = "v." + aProcess[0] + ", v." + // + aProcess[1] + " as v." + sGroupColName; + if (!aProcess[1].contains(".")) { + // aProcess[1] = "O." + aProcess[1]; + BizObjectManager doLibraryManage = JBOFactory + .getBizObjectManager(AWE_DO_LIBRARY.CLASS_NAME); + BizObject doLibrary = doLibraryManage + .createQuery( + "DONO=:DONO AND COLACTUALNAME=:COLACTUALNAME") + .setParameter("DONO", this.sDono) + .setParameter("COLACTUALNAME", + aProcess[1]) + .getSingleResult(false); + String sColTableName = doLibrary + .getAttribute("COLTABLENAME") == null ? "" + : doLibrary + .getAttribute("COLTABLENAME") + .toString(); + if (sColTableName.length() > 0) + sColTableName += "." + aProcess[1]; + aProcess[1] = sColTableName; + } + // 注释说明 有表名定义 无需操作 + // else { + // aProcess[1] = "v." + aProcess[1]; + // } + String sProcess = sMethodName + "(" + + aProcess[0].trim() + "," + aProcess[1] + + ") as v." + sGroupColName; + queryList.add(sProcess); + } else { + // NameManager.getOrgName(single_department) + // NameManager.getCustomerName(FACT_OBJECT) + // NameManager.getUserName(INPUTUSERID) + // NameManager.getRoleName(roleId) + // NameManager.getProjectNameByID(PROJECT_ID) + + // 从 ‘(’ 开始分割 分割后长度应为2 + if (aProcess.length != 1) { + ReturnMapUtil + .setReturnMap( + null, + (String) RestfullConstant.baseProperty + .get("FAIL" + .toLowerCase()), + "模板号:" + + this.sDono + + "中字段索引:" + + sDoColIndex + + "排序号:" + + sDoSortno + + "使用名称:" + + sDoColName + + " 的字段数据库原名:" + + sActualName + + "格式有问题" + + "\r\n" + + "格式应为:NameManager.getProjectNameByID(xxx)"); + logger.debug("模板号:" + + this.sDono + + "中字段索引:" + + sDoColIndex + + "排序号:" + + sDoSortno + + "使用名称:" + + sDoColName + + " 的字段数据库原名:" + + sActualName + + "格式有问题" + + "\r\n" + + "格式应为:NameManager.getProjectNameByID(xxx)"); + return ReturnMapUtil.getReturnMap(); + } + // getUserName(xxx) AS V.xxx + // String sProcess = "v." + aProcess[0] + "(v." + // + aProcess[1] + " as v." + sGroupColName; + // aProcess[1] = this.sInputUserId; + if (aProcess[0].toLowerCase().contains( + "inputuserid")) { + aProcess[0] = this.sInputUserId; + } else if (aProcess[0].toLowerCase().contains( + "inputorgid")) { + aProcess[0] = this.sInputOrgId; + } else if (!aProcess[0].contains(".")) { + // aProcess[0] = "O." + aProcess[0]; + + BizObjectManager doLibraryManage = JBOFactory + .getBizObjectManager(AWE_DO_LIBRARY.CLASS_NAME); + BizObject doLibrary = doLibraryManage + .createQuery( + "DONO=:DONO AND COLACTUALNAME=:COLACTUALNAME") + .setParameter("DONO", this.sDono) + .setParameter("COLACTUALNAME", + aProcess[0]) + .getSingleResult(false); + String sColTableName = doLibrary + .getAttribute("COLTABLENAME") == null ? "" + : doLibrary + .getAttribute("COLTABLENAME") + .toString(); + if (sColTableName.length() > 0) + sColTableName += "." + aProcess[0]; + aProcess[0] = sColTableName; + + } + // 注释说明 有表名定义 无需操作 + // else { + // aProcess[0] = "v." + aProcess[0]; + // } + String sProcess = sMethodName + "(" + aProcess[0] + + ") as v." + sGroupColName; + queryList.add(sProcess); + } + } else if (sActualName1.startsWith("CodeManager.")) { + // CodeManager.getItemName('CountryCode',issuecountry) + String sSqlProcess = sActualName; + sSqlProcess = sSqlProcess.replace("CodeManager.", ""); + String sMethodName = sSqlProcess.substring(0, + sSqlProcess.indexOf("(")); + String sParam = sSqlProcess.replace(sMethodName, ""); + sMethodName = "v." + sMethodName; + sParam = sParam.replace("(", ""); + sParam = sParam.replace(")", ""); + String[] aProcess = sParam.split(","); + // CodeManager.getItemName('CountryCode',issuecountry) + // -> V.getItemName('CountryCode', V.issuecountry) + sSqlProcess = sSqlProcess.replace("CodeManager.", ""); + // 从 ‘,’ 开始分割 分割后长度应为2 + if (aProcess.length != 2) { + ReturnMapUtil + .setReturnMap( + null, + (String) RestfullConstant.baseProperty + .get("FAIL".toLowerCase()), + "模板号:" + + this.sDono + + "中字段索引:" + + sDoColIndex + + "排序号:" + + sDoSortno + + "使用名称:" + + sDoColName + + " 的字段数据库原名:" + + sActualName + + "格式有问题" + + "\r\n" + + "格式应为:CodeManager.getItemName('CountryCode',issuecountry)"); + logger.debug("模板号:" + + this.sDono + + "中字段索引:" + + sDoColIndex + + "排序号:" + + sDoSortno + + "使用名称:" + + sDoColName + + " 的字段数据库原名:" + + sActualName + + "格式有问题" + + "\r\n" + + "格式应为:CodeManager.getItemName('CountryCode',issuecountry)"); + return ReturnMapUtil.getReturnMap(); + } + // getItemName('CountryCode',xxx) AS V.xxx + // String sProcess = "v." + aProcess[0] + ", v." + // + aProcess[1] + " as v." + sGroupColName; + if (!aProcess[1].contains(".")) { + // aProcess[1] = "O." + aProcess[1]; + BizObjectManager doLibraryManage = JBOFactory + .getBizObjectManager(AWE_DO_LIBRARY.CLASS_NAME); + BizObject doLibrary = doLibraryManage + .createQuery( + "DONO=:DONO AND COLACTUALNAME=:COLACTUALNAME") + .setParameter("DONO", this.sDono) + .setParameter("COLACTUALNAME", aProcess[1]) + .getSingleResult(false); + String sColTableName = doLibrary + .getAttribute("COLTABLENAME") == null ? "" + : doLibrary.getAttribute("COLTABLENAME") + .toString(); + if (sColTableName.length() > 0) + sColTableName += "." + aProcess[1]; + aProcess[1] = sColTableName; + } + // 注释说明 有表名定义 无需操作 + // else { + // aProcess[1] = "v." + aProcess[1]; + // } + String sProcess = sMethodName + "(" + + aProcess[0].trim() + "," + aProcess[1] + + ") as v." + sGroupColName; + queryList.add(sProcess); + } else if (sActualName1.length() + - sActualName1.replace(".", "").length() > 1) { + methodList.add(doLibraryMap.get("colactualname") + ""); + } else if (sActualName1.equals("''")) { + String sProcess = "v.'' as v." + sGroupColName; + queryList.add(sProcess); + } else if (sActualName1.equals("v.''")) { + String sProcess = "v.'' as v." + sGroupColName; + queryList.add(sProcess); + } else if ((!sActualName1.contains(".")) + && (sActualName.contains("("))) { + String sSqlProcess = sActualName; + // sSqlProcess = sSqlProcess.replace("CodeManager.", + // ""); + String sMethodName = sSqlProcess.substring(0, + sSqlProcess.indexOf("(")); + String sParam = sSqlProcess.replace(sMethodName, ""); + sMethodName = "v." + sMethodName; + sParam = sParam.replace("(", ""); + sParam = sParam.replace(")", ""); + String[] aProcess = sParam.split(","); + + // getHaveApplyMoney(O.ID) + // 从 ‘(’ 开始分割 分割后长度应为2 + if (aProcess.length != 1) { + + ReturnMapUtil + .setReturnMap( + null, + (String) RestfullConstant.baseProperty + .get("FAIL".toLowerCase()), + "模板号:" + + this.sDono + + "中字段索引:" + + sDoColIndex + + "排序号:" + + sDoSortno + + "使用名称:" + + sDoColName + + " 的字段数据库原名:" + + sActualName + + "格式有问题" + + "\r\n" + + "格式应为:NameManager.getProjectNameByID(xxx)"); + logger.debug("模板号:" + + this.sDono + + "中字段索引:" + + sDoColIndex + + "排序号:" + + sDoSortno + + "使用名称:" + + sDoColName + + " 的字段数据库原名:" + + sActualName + + "格式有问题" + + "\r\n" + + "格式应为:NameManager.getProjectNameByID(xxx)"); + return ReturnMapUtil.getReturnMap(); + } + // getUserName(xxx) AS V.xxx + // String sProcess = "v." + aProcess[0] + "(v." + // + aProcess[1] + " as v." + sGroupColName; + // aProcess[1] = this.sInputUserId; + if (aProcess[0].toLowerCase().contains("inputuserid")) { + aProcess[0] = this.sInputUserId; + } else if (aProcess[0].toLowerCase().contains( + "inputorgid")) { + aProcess[0] = this.sInputOrgId; + } else if (!aProcess[0].contains(".")) { + // aProcess[0] = "O." + aProcess[0]; + + BizObjectManager doLibraryManage = JBOFactory + .getBizObjectManager(AWE_DO_LIBRARY.CLASS_NAME); + BizObject doLibrary = doLibraryManage + .createQuery( + "DONO=:DONO AND COLACTUALNAME=:COLACTUALNAME") + .setParameter("DONO", this.sDono) + .setParameter("COLACTUALNAME", aProcess[0]) + .getSingleResult(false); + String sColTableName = doLibrary + .getAttribute("COLTABLENAME") == null ? "" + : doLibrary.getAttribute("COLTABLENAME") + .toString(); + if (sColTableName.length() > 0) + sColTableName += "." + aProcess[0]; + aProcess[0] = sColTableName; + + } + // 注释说明 有表名定义 无需操作 + // else { + // aProcess[0] = "v." + aProcess[0]; + // } + String sProcess = sMethodName + "(" + aProcess[0] + + ") as v." + sGroupColName; + queryList.add(sProcess); + } else { + String sProcess = sActualName + " as v." + + sGroupColName; + queryList.add(sProcess); + } + } + this.sDataName = templateMap.get("DATA_NAME".toLowerCase()) == null ? "" + : templateMap.get("DATA_NAME".toLowerCase()).toString(); + this.sDataCode = templateMap.get("DATA_CODE".toLowerCase()) == null ? "" + : templateMap.get("DATA_CODE".toLowerCase()).toString(); + this.sIsList = templateMap.get("ISLIST".toLowerCase()) == null ? "" + : templateMap.get("ISLIST".toLowerCase()).toString(); + this.sIsShow = templateMap.get("ISSHOW".toLowerCase()) == null ? "" + : templateMap.get("ISSHOW".toLowerCase()).toString(); + this.sPosition = templateMap.get("DATA_POSITION".toLowerCase()) == null ? "" + : templateMap.get("DATA_POSITION".toLowerCase()) + .toString(); + // 注释说明 字段删除 + // this.sIsConvert = templateMap.get("ISCONVERT".toLowerCase()) + // == null ? "" + // : templateMap.get("ISCONVERT".toLowerCase()).toString(); + doLibraryMap.put("display".toLowerCase(), this.sDataName); + doLibraryMap.put("code".toLowerCase(), this.sDataCode); + doLibraryMap.put("ISLIST".toLowerCase(), this.sIsList); + doLibraryMap.put("ISSHOW".toLowerCase(), this.sIsShow); + doLibraryMap.put("position".toLowerCase(), this.sPosition); + // 注释说明 字段删除 + // doLibraryMap.put("ISCONVERT".toLowerCase(), this.sIsConvert); + doLibraryMap.put("value", ""); + doLibraryMap.put("itemno", ""); + library.add(doLibraryMap); + break; + } + } + if (queryList.size() == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "根据分组号:" + this.sGroupCode + + "未找到所配置的查询字段!"); + logger.debug("根据分组号:" + this.sGroupCode + "未找到所配置的查询字段!"); + return ReturnMapUtil.getReturnMap(); + } + String sJboQuery = ""; + for (String str : queryList) { + sJboQuery += str + ","; + } + if (sJboQuery.endsWith(",")) + sJboQuery = sJboQuery.substring(0, sJboQuery.length() - 1); + if (this.sJboClass == null) + this.sJboClass = donoMap.get("JBOCLASS".toLowerCase()) == null ? "" + : donoMap.get("JBOCLASS".toLowerCase()).toString(); + if (this.sJboFrom == null) + this.sJboFrom = donoMap.get("JBOFROM".toLowerCase()) == null ? "" + : donoMap.get("JBOFROM".toLowerCase()).toString(); + if (this.sJboWhere == null) + this.sJboWhere = donoMap.get("JBOWHERE".toLowerCase()) == null ? "" + : donoMap.get("JBOWHERE".toLowerCase()).toString(); + getOtherWhere(); + setsOtherWhereHandler(); + if (this.sJboOrder == null) + this.sJboOrder = donoMap.get("JBOORDER".toLowerCase()) == null ? "" + : donoMap.get("JBOORDER".toLowerCase()).toString(); + if (this.sJboGroup == null) + this.sJboGroup = donoMap.get("JBOGROUP".toLowerCase()) == null ? "" + : donoMap.get("JBOGROUP".toLowerCase()).toString(); + this.sJboWhere = AweDoCommUtil.whereHandle(sJboWhere, paramMap); + if (this.sJboWhere.length() > 0) { + this.sJboWhere = " WHERE " + this.sJboWhere; + } + if (this.sJboOrder.length() > 0) { + this.sJboOrder = " ORDER BY " + this.sJboOrder; + } + if (this.sJboGroup.length() > 0) { + this.sJboGroup = " GROUP BY " + this.sJboGroup; + } + + String sSql = "SELECT " + sJboQuery + " "; + sSql += "FROM " + sJboFrom + this.sJboWhere + this.sJboOrder + " " + + this.sJboGroup; + logger.debug("sql:" + sSql); + BizObjectManager classManage = JBOFactory + .getBizObjectManager(this.sJboClass); + List rtBos = classManage.createQuery(sSql).getResultList( + false); + + ARE.getLog().info("FILTER BEFORE RESULT SIZE:" + rtBos.size()); + BizObjectManager bom1 = JBOFactory + .getBizObjectManager("jbo.app.APP_BUSINESS_GROUP"); + BizObject bo1 = bom1.createQuery("GROUP_CODE=:GROUP_CODE") + .setParameter("GROUP_CODE", sGroupCode).getSingleResult(false); + this.sGroupIsList = bo1.getAttribute("ISLIST") == null ? "N" : bo1 + .getAttribute("ISLIST").toString(); + appResult = new HashMap(); + List> datas = new ArrayList>(); + if (rtBos == null || rtBos.size() < 1) { + initDisplayForAdd(classManage.newObject()); + Map data = new HashMap(); + List> cols = new ArrayList>(); + for (Map doLibraryMap : library) { + // 缺省值 + String sDefult = doLibraryMap.get("COLDEFAULTVALUE" + .toLowerCase()) == null ? "" : doLibraryMap.get( + "COLDEFAULTVALUE".toLowerCase()).toString(); + // 显示来源类型 + String sSourceType = doLibraryMap.get("coleditsourcetype") == null ? "" + : doLibraryMap.get("coleditsourcetype").toString(); + // 显示来源 + String sSource = doLibraryMap.get("coleditsource") == null ? "" + : doLibraryMap.get("coleditsource").toString(); + // 中文显示名 + String sHeader = doLibraryMap.get("colheader") == null ? "" + : doLibraryMap.get("colheader").toString(); + // ISFILTER + String sIsFilter = doLibraryMap.get("ISFILTER".toLowerCase()) == null ? "" + : doLibraryMap.get("ISFILTER".toLowerCase()).toString(); + if (iFilters < 1 && "1".equals(sIsFilter)) { + sFilters += sHeader + ","; + } + doLibraryMap.put("itemno", ""); + doLibraryMap.put("value", ""); + if (sDefult.length() > 0) { + doLibraryMap.put("itemno", sDefult); + doLibraryMap.put("value", sDefult); + if ("code".equalsIgnoreCase(sSourceType)) { + List> codeLibrary = null; + try { + codeLibrary = (List>) ((Map) AppCodeCache + .getAppCodeCachePool().get(sSource)) + .get("library"); + } catch (Exception e) { + doLibraryMap.put("value", sDefult); + } + if (codeLibrary == null) { + doLibraryMap.put("value", sDefult); + } else { + for (Map code : codeLibrary) { + String sItemNo = code.get("ITEMNO" + .toLowerCase()) == null ? "" : code + .get("ITEMNO".toLowerCase()).toString(); + if (sItemNo.trim().toLowerCase() + .equals(sDefult.toLowerCase())) { + + String sItemName = code.get("ITEMNAME" + .toLowerCase()) == null ? "" : code + .get("ITEMNAME".toLowerCase()) + .toString(); + doLibraryMap.put("value", sItemName); + break; + } + } + } + } else if ("jbo".equalsIgnoreCase(sSourceType)) { + // -- JBO + // jbo.sys.CODE_LIBRARY,itemno,itemname,codeno='IsInUse' + + if (sSource.contains(",")) { + String[] arrayJbo = sSource.split(","); + if (arrayJbo.length >= 4) { + String sClass = arrayJbo[0]; + String sKey = arrayJbo[1]; + String sValue = arrayJbo[2]; + String sWhere = arrayJbo[3]; + if (arrayJbo.length > 4) { + for (int io = 4; io < arrayJbo.length; io++) { + sWhere += "," + arrayJbo[io]; + } + } + BizObjectManager bom = JBOFactory + .getBizObjectManager(sClass); + BizObjectQuery boq = bom.createQuery("SELECT " + + sKey + ", " + sValue + + " FROM O WHERE " + sWhere); + List bos = boq.getResultList(false); + for (BizObject bo : bos) { + // sDefult + if (sDefult.equals(bo.getAttribute(sKey) + .getValue())) { + doLibraryMap + .put("value", + bo.getAttribute(sValue) == null ? "" + : bo.getAttribute( + sValue) + .toString()); + break; + } + } + } + } + } + } else if ("CodeTable".equalsIgnoreCase(sSourceType)) { + // -- CodeTable ACQUIRED,运行,PAUSED,暂停,WAITING,等待 + if (sSource.length() > 0) { + String[] aSource = sSource.split(","); + if (aSource.length % 2 == 0) { + for (int ai = 0; ai < aSource.length; ai++) { + if ((ai + 1) % 2 != 0 + && sDefult.equals(aSource[ai])) { + doLibraryMap.put("value", aSource[ai + 1]); + } + } + } + if (null == doLibraryMap.get("value")) { + doLibraryMap.put("value", sDefult); + } + } + + } else if ("@MIN_MAX".equalsIgnoreCase(sSourceType)) { + + } else if ("SubPage".equalsIgnoreCase(sSourceType)) { + + } + + Map col = new HashMap(); + col.put("basetype", doLibraryMap.get("coltype")); + for (String key : doLibraryMap.keySet()) { + col.put(key.toLowerCase(), doLibraryMap.get(key)); + } + String sIsShow = doLibraryMap.get("ISSHOW".toLowerCase()) == null ? "" + : doLibraryMap.get("ISSHOW".toLowerCase()).toString(); + if ("y".equalsIgnoreCase(sIsShow)) { + cols.add(col); + } + } + if ("y".equalsIgnoreCase(sGroupIsList)) { + datas = new ArrayList>(); + } else { + data.put("detail_data", cols); + datas.add(data); + String sGroupEnable = bo1.getAttribute("GROUP_ENABLE") == null ? "0" + : bo1.getAttribute("GROUP_ENABLE").toString(); + if ("1".equals(sGroupEnable)) { + BizObjectManager doGroupManage = JBOFactory + .getBizObjectManager(AWE_DO_GROUP.CLASS_NAME); + BizObjectQuery doGroupQuery = doGroupManage.createQuery( + "DONO=:DONO ORDER BY SORTNO").setParameter("DONO", + this.sDono); + List doGroupBos = doGroupQuery + .getResultList(false); + BizObjectUtil util = new BizObjectUtil(); + List> doGroupList = new ArrayList>(); + for (BizObject doGroupBo : doGroupBos) { + Map doGroupMap = util + .bizObject2MapValue3(doGroupBo); + doGroupList.add(doGroupMap); + } + appResult.put("doGroup", doGroupList); + } + } + sFilters = sFilters.length() > 0 ? sFilters.substring(0, + sFilters.length() - 1) : sFilters; + appResult.put("filters", sFilters); + appResult.put("datas", datas); + appResult.put("count", 0); + + appResult.put("record_num", datas.size()); + appResult.put("dataCount", 0); + appResult.put("sumCount", rtBos.size()); + ReturnMapUtil.setReturnMap(appResult, + (String) RestfullConstant.baseProperty.get("SUCCESS" + .toLowerCase()), ""); + return ReturnMapUtil.getReturnMap(); + } + + // String sPageIndex = request.getParameter("pageIndex"); + // String sLimit = request.getParameter("limit"); + // String sDataCount = request.getParameter("dataCount"); + if (sPageIndex == null) + sPageIndex = "1"; + if (sLimit == null) + sLimit = "10"; + int iPageIndex, iLimit; + iPageIndex = Integer.valueOf(sPageIndex); + iLimit = Integer.valueOf(sLimit); + iPageIndex = iPageIndex - 1; + int pageIndexStart = (iPageIndex) * iLimit; + int pageIndexEnd = (iPageIndex + 1) * iLimit; + // DATA COUNT 停留浮标 + int iDataCount = StringX.isSpace(sDataCount) ? Integer + .valueOf(pageIndexStart) : Integer.valueOf(sDataCount) + 1; + // 获取SQL查询value及item name 赋予library中 + + // 为null 或 "" 不处理过滤 + boolean bIsFlagParam = !(StringX.isSpace(sFilter)); // filter总开关 + for (int i = pageIndexStart; i < pageIndexEnd;) { + boolean flag = false; // filter result + // 数据数量大于list数据 + if (iDataCount > (rtBos.size() - 1)) { + iDataCount--; + break; + } + if (iPageIndex + 1 < 1) { + break; + } + // 数据数量被limit整除 不再+1循环 + if (rtBos.size() % iLimit == 0) { + if ((rtBos.size() / iLimit) < iPageIndex) { + break; + } + } else { + if ((rtBos.size() / iLimit) + 1 < iPageIndex) { + break; + } + } + BizObject rtBo = rtBos.get(iDataCount); + initDisplayForEdit(rtBo); + Map data = new HashMap(); + List> cols = new ArrayList>(); + List> colLists = new ArrayList>(); + boolean librarIsFilterAllNo = false; + for (Map doLibraryMap : library) { + // 模板library : + // 字段排序 SORTNO + String sDoSortno = doLibraryMap.get("SORTNO".toLowerCase()) == null ? "" + : doLibraryMap.get("SORTNO".toLowerCase()).toString(); + // 字段索引 COLINDEX + String sDoColIndex = doLibraryMap.get("COLINDEX".toLowerCase()) == null ? "" + : doLibraryMap.get("COLINDEX".toLowerCase()).toString(); + // 使用名称 COLNAME + String sDoColName = doLibraryMap.get("COLNAME".toLowerCase()) == null ? "" + : doLibraryMap.get("COLNAME".toLowerCase()).toString(); + // 数据库原名 + String sActualName = doLibraryMap.get("colactualname") == null ? "" + : doLibraryMap.get("colactualname").toString(); + // 使用名称 + String sColName = doLibraryMap.get("colname") == null ? "" + : doLibraryMap.get("colname").toString(); + // 显示来源类型 + String sSourceType = doLibraryMap.get("coleditsourcetype") == null ? "" + : doLibraryMap.get("coleditsourcetype").toString(); + // 显示来源 + String sSource = doLibraryMap.get("coleditsource") == null ? "" + : doLibraryMap.get("coleditsource").toString(); + // 中文显示名 + String sHeader = doLibraryMap.get("colheader") == null ? "" + : doLibraryMap.get("colheader").toString(); + // ISFILTER + String sIsFilter = doLibraryMap.get("ISFILTER".toLowerCase()) == null ? "" + : doLibraryMap.get("ISFILTER".toLowerCase()).toString(); + librarIsFilterAllNo = (librarIsFilterAllNo == false) ? sIsFilter + .equals("1") : true; + if (iFilters < 1 + && "1".equals(doLibraryMap.get("ISFILTER".toLowerCase()))) { + sFilters += sHeader + ","; + } + // filter字段开关 + boolean libraryIsFlag = (bIsFlagParam == true && sIsFilter + .equals("1")) ? true : false; + // 注释说明 虚拟字段 不处理 直接 赋值为空 + // if ("v.''".equals(sActualName) || "''".equals(sActualName)) { + // continue; + // } + String sResultValue = ""; + String sValue = ""; + sColName = sColName.startsWith("v.") + || sColName.startsWith("V.") ? sColName.substring( + "v.".length(), sColName.length()) : sColName; + + if (!("v.''".equals(sActualName) || "''".equals(sActualName) || (sActualName) + .contains("."))) { + sValue = rtBo.getAttribute(sColName) == null ? "" : rtBo + .getAttribute(sColName).toString(); + sResultValue = rtBo.getAttribute(sColName).getValue() == null ? "" + : rtBo.getAttribute(sColName).getValue().toString(); + } + if (sActualName.length() + - sActualName.replace(".", "").length() > 1) { + String[] array = sActualName.split("\\("); + if (array.length != 2) { + ReturnMapUtil + .setReturnMap( + null, + (String) RestfullConstant.baseProperty + .get("FAIL".toLowerCase()), + "模板号:" + + this.sDono + + "中字段索引:" + + sDoColIndex + + "排序号:" + + sDoSortno + + "使用名称:" + + sDoColName + + " 的字段数据库原名:" + + sActualName + + "格式有问题" + + "\r\n" + + "格式应为:com.xxx.xx.class.method(params..)"); + logger.debug("模板号:" + this.sDono + "中字段索引:" + + sDoColIndex + "排序号:" + sDoSortno + "使用名称:" + + sDoColName + " 的字段数据库原名:" + sActualName + + "格式有问题" + "\r\n" + + "格式应为:com.xxx.xx.class.method(params..)"); + return ReturnMapUtil.getReturnMap(); + } + // 获取 类方法所有参数 + String sParams1 = array[1]; + // 如果结尾不是括号结尾 + if (!sParams1.endsWith(")")) { + ReturnMapUtil + .setReturnMap( + null, + (String) RestfullConstant.baseProperty + .get("FAIL".toLowerCase()), + "模板号:" + + this.sDono + + "中字段索引:" + + sDoColIndex + + "排序号:" + + sDoSortno + + "使用名称:" + + sDoColName + + " 的字段数据库原名:" + + sActualName + + "格式有问题" + + "\r\n" + + "格式应为:com.xxx.xx.class.method(params..)"); + logger.debug("模板号:" + this.sDono + "中字段索引:" + + sDoColIndex + "排序号:" + sDoSortno + "使用名称:" + + sDoColName + " 的字段数据库原名:" + sActualName + + "格式有问题" + "\r\n" + + "格式应为:com.xxx.xx.class.method(params..)"); + return ReturnMapUtil.getReturnMap(); + } + sParams1 = sParams1.substring(0, sParams1.length() - 1); + String[] aParam = sParams1.split(","); + String[] aSet = new String[aParam.length]; + for (int j = 0; j < aParam.length; j++) { + // String sColName1 = sDoColName; + // String sColName2 = aParam[j]; + // if (sColName1.equals(sColName2)) { + try { + aSet[j] = rtBo.getAttribute(aParam[j]) == null ? "" + : rtBo.getAttribute(aParam[j]).toString(); + } catch (Exception e) { + aSet[j] = aParam[j].replace("'", ""); +// aSet[j] = aParam[j]; + continue; + } + // } + } + sValue = executeMethod(sActualName, aSet); + doLibraryMap.put("value", sValue == null ? "" : sValue); + doLibraryMap.put("itemno", sValue == null ? "" : sValue); + } else { + if (sColName.startsWith("v.")) { + sColName = sColName.replace("v.", ""); + } + if (sColName.startsWith("V.")) { + sColName = sColName.replace("V.", ""); + } + if (null != rtBo.getAttribute(sColName)) { + sResultValue = rtBo.getAttribute(sColName).toString(); + doLibraryMap.put("itemno", sResultValue); + doLibraryMap.put("value", sResultValue); + } else { + doLibraryMap.put("value", ""); + doLibraryMap.put("itemno", ""); + } + } + if ("code".equalsIgnoreCase(sSourceType)) { + List> codeLibrary = null; + doLibraryMap.put("itemno", sResultValue); + doLibraryMap.put("value", sResultValue); + + // String [] aSource = sSource.split(","); + try { + codeLibrary = (List>) ((Map) AppCodeCache + .getAppCodeCachePool().get(sSource)) + .get("library"); + } catch (Exception e) { + doLibraryMap.put("value", sResultValue); + } + if (codeLibrary == null) { + sResultValue += ""; + doLibraryMap.put("value", sResultValue); + } else { + String sResultValue2 = ""; + for (Map code : codeLibrary) { + String sItemNo = code.get("ITEMNO".toLowerCase()) == null ? "" + : code.get("ITEMNO".toLowerCase()) + .toString(); + String[] aValue = sResultValue.split(","); + for (String str : aValue) { + if (sItemNo.trim().toLowerCase() + .equals(str.toLowerCase())) { + + String sItemName = code.get("ITEMNAME" + .toLowerCase()) == null ? "" : code + .get("ITEMNAME".toLowerCase()) + .toString(); + // doLibraryMap.put("value", sItemName); + + String sResultValue3 = StringX.isSpace(sResultValue2) ? sItemName + : ("," + sItemName); + sResultValue2 += sResultValue3; + break; + } + } + // if (sItemNo.trim().toLowerCase() + // .equals(sResultValue.toLowerCase())) { + // + // String sItemName = code.get("ITEMNAME" + // .toLowerCase()) == null ? "" : code + // .get("ITEMNAME".toLowerCase()) + // .toString(); + // doLibraryMap.put("value", sItemName); + // sResultValue += "," + sItemName; + // break; + // } + } + + if (sResultValue2.startsWith(",")) { + sResultValue2 = sResultValue2.substring(1, sResultValue2.length()); + } + doLibraryMap.put("value", sResultValue2); + } + // try { + // codeLibrary = (List>) ((Map) AppCodeCache + // .getAppCodeCachePool().get(sSource)) + // .get("library"); + // } catch (Exception e) { + // doLibraryMap.put("value", sResultValue); + // } + // if (codeLibrary == null) { + // doLibraryMap.put("value", sResultValue); + // } else { + // for (Map code : codeLibrary) { + // String sItemNo = code.get("ITEMNO".toLowerCase()) == null + // ? "" + // : code.get("ITEMNO".toLowerCase()) + // .toString(); + // if (sItemNo.trim().toLowerCase() + // .equals(sResultValue.toLowerCase())) { + // + // String sItemName = code.get("ITEMNAME" + // .toLowerCase()) == null ? "" : code + // .get("ITEMNAME".toLowerCase()) + // .toString(); + // doLibraryMap.put("value", sItemName); + // break; + // } + // } + // } + } else if ("jbo".equalsIgnoreCase(sSourceType)) { + // -- JBO + // jbo.sys.CODE_LIBRARY,itemno,itemname,codeno='IsInUse' + doLibraryMap.put("itemno", sResultValue); + doLibraryMap.put("value", sResultValue); + + if (!sSource.contains(",")) { + doLibraryMap.put("itemno", sResultValue); + doLibraryMap.put("value", sResultValue); + } + String[] arrayJbo = sSource.split(","); + if (arrayJbo.length < 4) { + doLibraryMap.put("itemno", sResultValue); + doLibraryMap.put("value", sResultValue); + } else { + String sClass = arrayJbo[0]; + String sKey = arrayJbo[1]; + sValue = arrayJbo[2]; + String sWhere = arrayJbo[3]; + if (arrayJbo.length > 4) { + for (int io = 4; io < arrayJbo.length; io++) { + sWhere += "," + arrayJbo[io]; + } + } + BizObjectManager bom = JBOFactory + .getBizObjectManager(sClass); + BizObjectQuery boq = bom.createQuery("SELECT " + sKey + + ", " + sValue + " FROM O WHERE " + sWhere); + List bos = boq.getResultList(false); + for (BizObject bo : bos) { + // sResultValue + if (sResultValue.equals(bo.getAttribute(sKey) + .getValue())) { + doLibraryMap.put("value", bo + .getAttribute(sValue) == null ? "" : bo + .getAttribute(sValue).toString()); + break; + } + } + } + } else if ("CodeTable".equalsIgnoreCase(sSourceType)) { + // -- CodeTable ACQUIRED,运行,PAUSED,暂停,WAITING,等待 + doLibraryMap.put("itemno", sResultValue); + doLibraryMap.put("value", sResultValue); + if (sSource.length() == 0) { + + } else { + String[] aSource = sSource.split(","); + if (aSource.length % 2 == 0) { + for (int ai = 0; ai < aSource.length; ai++) { + if ((ai + 1) % 2 != 0 + && sResultValue.equals(aSource[ai])) { + doLibraryMap.put("value", aSource[ai + 1]); + } + } + } + if (null == doLibraryMap.get("value")) { + doLibraryMap.put("value", sResultValue); + } + } + + } else if ("@MIN_MAX".equalsIgnoreCase(sSourceType)) { + + } else if ("SubPage".equalsIgnoreCase(sSourceType)) { + + } + Map col = new HashMap(); + Map colList = new HashMap(); + // 是否需要过滤字段值 + String sFilterValue = doLibraryMap.get("value") == null ? "" + : doLibraryMap.get("value").toString(); + // libraryIsFlag + flag = (libraryIsFlag == true && !flag) ? sFilterValue + .contains(sFilter) : flag; + for (String key : doLibraryMap.keySet()) { + col.put(key.toLowerCase(), doLibraryMap.get(key)); + colList.put(key.toLowerCase(), doLibraryMap.get(key)); + } + + col.put("basetype", col.get("coltype")); + String sIsShow = doLibraryMap.get("ISSHOW".toLowerCase()) == null ? "" + : doLibraryMap.get("ISSHOW".toLowerCase()).toString(); + if ("y".equalsIgnoreCase(sGroupIsList)) { + String sIsList = doLibraryMap.get("ISLIST".toLowerCase()) == null ? "" + : doLibraryMap.get("ISLIST".toLowerCase()) + .toString(); + if ("y".equalsIgnoreCase(sIsList)) { + colLists.add(colList); + } + } else { + String sGroupEnable = bo1.getAttribute("GROUP_ENABLE") == null ? "0" + : bo1.getAttribute("GROUP_ENABLE").toString(); + if ("1".equals(sGroupEnable)) { + BizObjectManager doGroupManage = JBOFactory + .getBizObjectManager(AWE_DO_GROUP.CLASS_NAME); + BizObjectQuery doGroupQuery = doGroupManage + .createQuery("DONO=:DONO ORDER BY SORTNO") + .setParameter("DONO", this.sDono); + List doGroupBos = doGroupQuery + .getResultList(false); + BizObjectUtil util = new BizObjectUtil(); + List> doGroupList = new ArrayList>(); + for (BizObject doGroupBo : doGroupBos) { + Map doGroupMap = util + .bizObject2MapValue3(doGroupBo); + doGroupList.add(doGroupMap); + } + appResult.put("doGroup", doGroupList); + } + } + if ("y".equalsIgnoreCase(sIsShow)) { + cols.add(col); + } + } + iDataCount++; + // 1. 没有过滤条件("" or null) + // 2. 字段未设置过滤 (library for all - isFilter = 0) + // 3. 过滤结果== true(满足一个字段即可) + if (!bIsFlagParam || !librarIsFilterAllNo || flag) { + i++; + if ("y".equalsIgnoreCase(sGroupIsList)) { + appResult.put("IS_LIST", "Y"); + data.put("list_data", colLists); + } else { + appResult.put("IS_LIST", "N"); + data.put("detail_data", cols); + } + datas.add(data); + } + iFilters++; + } + // 查询数量 + ARE.getLog().info("FILTER AFTER RESULT SIZE:" + datas.size()); + appResult.put("record_num", datas.size()); + appResult.put("datas", datas); + appResult.put("dataCount", ++iDataCount); + appResult.put("sumCount", rtBos.size()); + sFilters = sFilters.length() > 0 ? sFilters.substring(0, + sFilters.length() - 1) : sFilters; + if ("y".equalsIgnoreCase(sGroupIsList)) + appResult.put("filters", sFilters); + ReturnMapUtil.setReturnMap(appResult, + (String) RestfullConstant.baseProperty.get("SUCCESS" + .toLowerCase()), ""); + return ReturnMapUtil.getReturnMap(); + } + + // end + + @SuppressWarnings("unchecked") + private Map findGroupTemplate(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, String groupid) + throws Exception { + if (request == null) { + ARE.getLog().info("=========2.加载参数=========="); + this.paramMap = new HashMap(); + if (noRequestParamMap == null) + return null; + for (String sKey : noRequestParamMap.keySet()) { + paramMap.put(sKey.toLowerCase(), noRequestParamMap.get(sKey)); + paramMap.put(sKey.toUpperCase(), noRequestParamMap.get(sKey)); + } + return null; + } + Map appResult = checkGroupCodeIsValid(request, groupid); + if (null != appResult) + return appResult; + + if (this.paramMap == null) { + try { + ARE.getLog().info("=========2.加载参数=========="); + Map paramMap1 = new HashMap(); + this.paramMap = new HashMap(); + if (request.getMethod().equalsIgnoreCase("GET")) { + paramMap1 = RequestUtil.convertRequestToMap(request); + } else { + this.paramMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + this.paramMap = (Map) this.paramMap + .get("fieldMap"); + } + + if (paramMap1.size() > 0) { + for (String key : paramMap1.keySet()) { + paramMap.put(key.toLowerCase(), paramMap1.get(key)); + paramMap.put(key.toUpperCase(), paramMap1.get(key)); + } + } + + } catch (Exception e) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "获取加载参数出现异常,请联系管理员!"); + logger.error("获取加载参数出现异常,请联系管理员! \r\n" + "error:" + e); + return ReturnMapUtil.getReturnMap(); + } + } + getsFilter(paramMap.get("globaltext") == null ? null : paramMap.get( + "globaltext").toString()); + sPageIndex = paramMap.get("pageindex") == null ? null : paramMap.get( + "pageindex").toString(); + sLimit = paramMap.get("limit") == null ? null : paramMap.get("limit") + .toString(); + sDataCount = paramMap.get("datacount") == null ? null : paramMap.get( + "datacount").toString(); + return null; + } + + @SuppressWarnings("unchecked") + private Map checkGroupCodeIsValid( + HttpServletRequest request, String groupid) throws Exception { + try { + ARE.getLog().info("=========1.获取分组号=========="); + ARE.getLog().info("分组号:" + groupid); + this.sGroupCode = groupid; + + if (sGroupCode.length() == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "分组号为空,无法查询具体模板数据!"); + logger.debug("分组号为空,无法查询具体模板数据!"); + return ReturnMapUtil.getReturnMap(); + } + ARE.getLog().info("=========获取分组号: " + sGroupCode + "=========="); + ARE.getLog().info("=========准备获取APP分组信息=========="); + // 获取APP分组信息 + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.APP_BUSINESS_TEMPLATE"); + BizObjectQuery boq = bom.createQuery( + "GROUP_CODE=:GROUP_CODE ORDER BY DATA_POSITION") + .setParameter("GROUP_CODE", sGroupCode); + + List bos = boq.getResultList(false); + if (bos == null || bos.size() < 1) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "分组号:" + sGroupCode + + " 未找到相应分组配置!"); + logger.debug("分组号:" + sGroupCode + " 未找到相应分组配置!"); + return ReturnMapUtil.getReturnMap(); + } + + this.templateList = new ArrayList>(); + for (BizObject template : bos) { + BizObjectUtil util = new BizObjectUtil(); + Map templateMap = util + .bizObject2MapValue3(template); + templateList.add(templateMap); + } + BizObject bo = bos.get(0); + + this.sDono = bo.getAttribute("DONO") == null ? "" : bo + .getAttribute("DONO").toString(); + if (sDono.length() == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "分组号:" + sGroupCode + + " 配置元素模板为空!"); + logger.debug("分组号:" + sGroupCode + " 配置元素模板为空!"); + return ReturnMapUtil.getReturnMap(); + } + + ARE.getLog().info("=========获取模板号:" + sDono + "=========="); + + // 获取AWE_DO_CATALOG MAP格式: + this.donoMap = new HashMap(); + this.donoMap = (Map) AppAweDoCache + .getAppAweDoCachePool().get(sDono); + if (null == donoMap || donoMap.size() == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "模板号:" + sDono + "不存在!"); + logger.debug("模板号:" + sDono + "不存在!"); + return ReturnMapUtil.getReturnMap(); + } + this.sDoName = donoMap.get("DONAME".toLowerCase()) == null ? "" + : donoMap.get("DONAME".toLowerCase()).toString(); + logger.info("模板中文名:" + this.sDoName); + } catch (Exception e) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "获取分组信息出现异常,请联系管理员!"); + logger.error("获取分组信息出现异常,请联系管理员! \r\n" + "error:" + e); + return ReturnMapUtil.getReturnMap(); + } + return null; + } + + private String executeMethod(String colactualname, String... params) { + + String value = ""; + + try { + String classpath = colactualname.substring(0, + colactualname.lastIndexOf(".")); + String methodName = colactualname.substring( + colactualname.lastIndexOf(".") + 1, + colactualname.indexOf("(")); + String paramsname = colactualname.substring( + colactualname.indexOf("(") + 1, colactualname.indexOf(")")); + String[] vParams = paramsname.split(","); + if (vParams.length != params.length) { + return null; + } + List Lparam = new ArrayList(); + for (String param : params) { + Lparam.add(param); + } + @SuppressWarnings("rawtypes") + Class classPathClass = Class.forName(classpath); + Object obj = classPathClass.newInstance(); + Method targetMethod = null; + Method[] cls = classPathClass.getDeclaredMethods(); + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase(methodName)) { + targetMethod = cls[j]; + try { + value = (String) targetMethod.invoke(obj, Lparam.toArray()); + } catch (Exception e2) { + continue; + } + } + } + if (value == null) { + value = ""; + } + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | SecurityException + | IllegalArgumentException e) { + logger.error("executeMethod" + e); + return null; + } + return value; + } + + public static void main(String[] args) { + String str = "O.contract_id = :contract_id"; + System.out.println(str.matches("[\\S:]+?")); + + String Str = new String("Welcome to Tutorialspoint.com"); + + System.out.print("Return Value :"); + System.out.println(Str.matches("(.*)Tutorials(.*)")); + + System.out.print("Return Value :"); + System.out.println(Str.matches("Tutorials")); + + System.out.print("Return Value :"); + System.out.println(Str.matches("Welcome(.*)")); + } +} diff --git a/src_app/apx/com/amarsoft/als/base/awe/AbstractAweDoSaveManage.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoSaveManage.java similarity index 55% rename from src_app/apx/com/amarsoft/als/base/awe/AbstractAweDoSaveManage.java rename to src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoSaveManage.java index 8a1817820..74c98bbaa 100644 --- a/src_app/apx/com/amarsoft/als/base/awe/AbstractAweDoSaveManage.java +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/AbstractAweDoSaveManage.java @@ -1,336 +1,472 @@ -package apx.com.amarsoft.als.base.awe; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import apx.com.amarsoft.als.base.awe.model.AppBusinessGroupModel; -import apx.com.amarsoft.als.base.awe.model.AweDoCataLogModel; -import apx.com.amarsoft.als.base.awe.util.AweDoCommUtil; -import apx.com.amarsoft.als.base.constant.ResultConstant; -import apx.com.amarsoft.als.base.util.DateUtil; -import apx.com.amarsoft.als.base.util.ReturnMapUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.are.util.SpecialTools; -import com.amarsoft.awe.util.Transaction; -import com.amarsoft.context.ASUser; - -/** - * 模板 分组 保存管理 - * - * @author jiaji.liu - * - */ -public abstract class AbstractAweDoSaveManage { - - public void afterInsert(BizObject bo) { - ARE.getLog() - .info("======================================= this afterInsert: default ======================================"); - } - - public void afterUpdate(BizObject bo) { - ARE.getLog() - .info("======================================= this afterUpdate: default ======================================"); - } - - public void beforeInsert(BizObject bo) { - ARE.getLog() - .info("======================================= this beforeInsert: default ======================================"); - } - - public void beforeUpdate(BizObject bo) { - ARE.getLog() - .info("======================================= this beforeUpdate: default ======================================"); - } - - public boolean validityCheck(BizObject bo, boolean isInsert) { - ARE.getLog() - .info("======================================= this validityCheck: default/true ======================================"); - return isInsert; - } - - /** - * 保存业务 - * - * @param sqlca - * @param tx - * @param sDono - * @param paramMap - * @param sUserId - * @param sOtherWhere - * @return - * @throws JBOException - */ - protected Map saveBusiness(Transaction sqlca, - JBOTransaction tx, String sDono, Map paramMap, - String sUserId, String sOtherWhere) throws JBOException { - AweDoCataLogModel oAweDoCataLog = new AweDoCataLogModel(sDono); - int iCount = oAweDoCataLog.getsDono().length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "模板号:" + sDono + "不存在!"); - ARE.getLog().debug("模板号:" + sDono + "不存在!"); - return ReturnMapUtil.getReturnMap(); - } - String sDoName = oAweDoCataLog.getsDoName(); - ARE.getLog().info("=========模板名:" + sDoName + "=========="); - String sJboClass = oAweDoCataLog.getsJboClass(); - String sJboWhere = oAweDoCataLog.getsJboWhere(); - iCount = sJboClass.length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "模板号,模板名称:" + sDono + "," + sDoName + "主表未找到!"); - ARE.getLog().debug("模板号,模板名称:" + sDono + "," + sDoName + "主表未找到!"); - return ReturnMapUtil.getReturnMap(); - } - iCount = sJboWhere.length(); - if (iCount > 0) - sJboWhere = AweDoCommUtil.whereHandle(sJboWhere, paramMap); - - ARE.getLog().info("=========获取AWE_DO_LIBRARY=========="); - List> donoLibrary = oAweDoCataLog.getoLibrary(); - List> elementDatas = new ArrayList>(); - for (Map element : donoLibrary) { - String sColTableName = element.get("coltablename") == null ? "" - : element.get("coltablename").toString(); - if ("o".equalsIgnoreCase(sColTableName)) { - Map elementData = new HashMap(); - for (String sKey : element.keySet()) { - elementData.put(sKey, element.get(sKey)); - } - elementDatas.add(elementData); - } - } - ARE.getLog().info("=========3.开始保存=========="); - try { - BizObjectManager saveBom = JBOFactory - .getBizObjectManager(sJboClass); - tx.join(saveBom); - BizObjectQuery saveBoq = saveBom.createQuery(sJboWhere - + sOtherWhere); - BizObject saveObject = saveBoq.getSingleResult(true); - ASUser oCurUser = ASUser.getUser( - SpecialTools.real2Amarsoft(sUserId), sqlca); - if (null == saveObject) { - saveObject = saveBom.newObject(); - for (Map elementData : elementDatas) { - String sActualName = elementData.get("colactualname") == null ? "" - : elementData.get("colactualname").toString(); - String sColName = elementData.get("colname") == null ? "" - : elementData.get("colname").toString(); - if ("INPUTTIME".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("INPUTTIME", DateUtil - .getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss")); - continue; - } else if ("InputDate".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("InputDate", DateUtil - .getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss")); - continue; - } else if ("INPUTUSERID".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("INPUTUSERID", - oCurUser.getUserID()); - continue; - } else if ("INPUTUSER".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("INPUTUSER", - oCurUser.getUserID()); - continue; - } else if ("INPUTORGID".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("INPUTORGID", - oCurUser.getOrgID()); - continue; - } else if ("INPUTORG".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("INPUTORG", - oCurUser.getOrgID()); - continue; - } - String sValue = paramMap.get(sActualName.toLowerCase()) == null ? "" - : paramMap.get(sActualName.toLowerCase()) - .toString(); - if (sValue.length() == 0) - sValue = paramMap.get(sColName.toLowerCase()) == null ? "" - : paramMap.get(sColName.toLowerCase()) - .toString(); - if (sValue.length() == 0) - sValue = ""; - if (sValue.length() == 0) - continue; - saveObject.setAttributeValue(sActualName, sValue); - } - if (validityCheck(saveObject, true)) { - beforeInsert(saveObject); - saveBom.saveObject(saveObject); - afterInsert(saveObject); - } - } else { - for (Map elementData : elementDatas) { - String sActualName = elementData.get("colactualname") == null ? "" - : elementData.get("colactualname").toString(); - String sColName = elementData.get("colname") == null ? "" - : elementData.get("colname").toString(); - if ("UPDATETIME".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("UPDATETIME", DateUtil - .getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss")); - continue; - } else if ("UpdateDate".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("UpdateDate", DateUtil - .getSystemTimeByFormat(new Date(), - "yyyy/MM/dd HH:mm:ss")); - continue; - } else if ("UPDATEUSERID".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("UPDATEUSERID", - oCurUser.getUserID()); - continue; - } else if ("UPDATEUSER".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("UPDATEUSER", - oCurUser.getUserID()); - continue; - } else if ("UPDATEORGID".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("UPDATEORGID", - oCurUser.getOrgID()); - continue; - } else if ("updateorg".equalsIgnoreCase(sActualName)) { - saveObject.setAttributeValue("updateorg", - oCurUser.getOrgID()); - continue; - } - String sValue = paramMap.get(sActualName.toLowerCase()) == null ? "" - : paramMap.get(sActualName.toLowerCase()) - .toString(); - if (sValue.length() == 0) - sValue = paramMap.get(sColName.toLowerCase()) == null ? "" - : paramMap.get(sColName.toLowerCase()) - .toString(); - if (sValue.length() == 0) - sValue = ""; - if (sValue.length() == 0) - continue; - saveObject.setAttributeValue(sActualName, sValue); - } - if (validityCheck(saveObject, true)) { - beforeUpdate(saveObject); - saveBom.saveObject(saveObject); - afterUpdate(saveObject); - } - } - tx.commit(); - } catch (Exception e) { - tx.rollback(); - ARE.getLog() - .error(ResultConstant.FAIL_SAVE + "\r\n" + "error:" + e); - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - ResultConstant.FAIL_SAVE); - return ReturnMapUtil.getReturnMap(); - } - ReturnMapUtil.setReturnMap(null, ResultConstant.SUCCESS_RESULT_CODE, - ResultConstant.SUCCESS_SAVE); - return ReturnMapUtil.getReturnMap(); - } - - /** - * 根据分组号实现保存编辑 - */ - public Map saveGroupData(Transaction sqlca, - JBOTransaction tx, String sGroupCode, Map paramMap, - String sUserId, String sOtherWhere) throws Exception { - ARE.getLog() - .info("======================================= saveGroupData:begin > 保存开始 ======================================"); - if (sGroupCode == null) sGroupCode = ""; - if (sGroupCode.length() == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "分组号为空,无法查询具体模板数据!"); - ARE.getLog().debug("分组号为空,无法查询具体模板数据!"); - ARE.getLog() - .info("======================================= saveGroupData:end > 保存失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - ARE.getLog().info("=========1.获取分组号=========="); - ARE.getLog().info("=========获取分组号: " + sGroupCode + "=========="); - ARE.getLog().info("=========准备获取APP分组信息=========="); - AppBusinessGroupModel oGroup = new AppBusinessGroupModel(sGroupCode); - int iCount = oGroup.getsGroupCode().length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "分组号:" + sGroupCode + " 未找到相应分组配置!"); - ARE.getLog().debug("分组号:" + sGroupCode + " 未找到相应分组配置!"); - ARE.getLog() - .info("======================================= saveGroupData:end > 保存失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - iCount = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) - .getsDono().length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "分组号:" + sGroupCode + " 配置元素模板为空!"); - ARE.getLog().debug("分组号:" + sGroupCode + " 配置元素模板为空!"); - ARE.getLog() - .info("======================================= saveGroupData:end > 保存失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - String sDono = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) - .getsDono(); - ARE.getLog().info("=========获取模板号:" + sDono + "=========="); - ARE.getLog().info("=========2.获取模板信息=========="); - Map oAppResult = saveBusiness(sqlca, tx, sDono, - paramMap, sUserId, sOtherWhere); - @SuppressWarnings("unchecked") - String sCode = ((Map) oAppResult.get("outline")) - .get("code") == null ? "" : ((Map) oAppResult - .get("outline")).get("code").toString(); - if (!ResultConstant.SUCCESS_RESULT_CODE.equals(sCode)) { - ARE.getLog() - .info("======================================= saveGroupData:end > 保存失败 ======================================"); - } - ARE.getLog() - .info("======================================= saveGroupData:end > 保存结束 ======================================"); - return oAppResult; - } - - /** - * 根据模板号实现保存编辑 - */ - public Map saveDonoData(Transaction sqlca, - JBOTransaction tx, String sDono, Map paramMap, - String sUserId, String sOtherWhere) throws Exception { - ARE.getLog() - .info("======================================= saveDonoData:begin > 保存开始 ======================================"); - if (sDono == null) sDono = ""; - int iCount = sDono.length(); - if (iCount == 0) { - ReturnMapUtil.setReturnMap(null, ResultConstant.FAIL_RESULT_CODE, - "模板号不能为空!"); - ARE.getLog().debug("模板号不能为空!"); - ARE.getLog() - .info("======================================= saveDonoData:end > 保存失败 ======================================"); - return ReturnMapUtil.getReturnMap(); - } - ARE.getLog().info("=========1.获取模板号=========="); - ARE.getLog().info("=========获取模板号:" + sDono + "=========="); - ARE.getLog().info("=========2.获取模板信息=========="); - Map oAppResult = saveBusiness(sqlca, tx, sDono, - paramMap, sUserId, sOtherWhere); - @SuppressWarnings("unchecked") - String sCode = ((Map) oAppResult.get("outline")) - .get("code") == null ? "" : ((Map) oAppResult - .get("outline")).get("code").toString(); - if (!ResultConstant.SUCCESS_RESULT_CODE.equals(sCode)) { - ARE.getLog() - .info("======================================= saveDonoData:end > 保存失败 ======================================"); - } - - ARE.getLog() - .info("======================================= saveDonoData:end > 保存结束 ======================================"); - return oAppResult; - } -} +package apx.com.amarsoft.als.base.awe; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import apx.com.amarsoft.als.base.awe.model.AppBusinessGroupModel; +import apx.com.amarsoft.als.base.awe.model.AweDoCataLogModel; +import apx.com.amarsoft.als.base.awe.util.AweDoCommUtil; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.are.util.SpecialTools; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.base.constant.RestfullConstant; +import com.base.util.BizObjectUtil; +import com.base.util.DateUtil; +import com.base.util.ReturnMapUtil; + +/** + * 模板 分组 保存管理 + * + * @author jiaji.liu + * + */ +public abstract class AbstractAweDoSaveManage extends AbstractAweDoHandler { + ReturnMapUtil ReturnMapUtil; + protected String sMsg; + + protected String sJboClass; + protected BizObject saveObject; + + protected Map paramMap; + + public void setsJboClass(String sJboClass) { + this.sJboClass = sJboClass; + } + + protected String timeFormat; + + public void setTimeFormat(String timeFormat) { + this.timeFormat = timeFormat; + } + + protected void setPara() throws JBOException { + + } + + public void saveBeforeProcess(BizObject bo) throws Exception { + ARE.getLog() + .info("======================================= this saveBeforeProcess: default ======================================"); + } + + protected void afterInsert(BizObject bo, JBOTransaction tx) throws Exception { + ARE.getLog() + .info("======================================= this afterInsert: default ======================================"); + } + + protected void afterUpdate(BizObject bo, JBOTransaction tx) throws Exception { + ARE.getLog() + .info("======================================= this afterUpdate: default ======================================"); + } + + protected void beforeInsert(BizObject bo, JBOTransaction tx) throws Exception { + ARE.getLog() + .info("======================================= this beforeInsert: default ======================================"); + } + + protected void beforeUpdate(BizObject bo, JBOTransaction tx) throws Exception { + ARE.getLog() + .info("======================================= this beforeUpdate: default ======================================"); + } + + protected boolean validityCheck(BizObject bo, boolean isInsert, + JBOTransaction tx) throws Exception { + ARE.getLog() + .info("======================================= this validityCheck: default/true ======================================"); + sMsg = "默认校验!"; + return true; + } + + public String setsOtherWhere(String sJboWhere, String sOtherWhere) { + if (StringX.isSpace(sOtherWhere)) + return sJboWhere; + sOtherWhere = sOtherWhere.trim(); + if (StringX.isSpace(sJboWhere)) { + if (sOtherWhere.toLowerCase().startsWith("and ")) + sOtherWhere = new StringBuilder().append("1 = 1 ") + .append(sOtherWhere).toString(); + } else { + if (!sOtherWhere.toLowerCase().startsWith("and ")) + sOtherWhere = new StringBuilder().append("and ") + .append(sOtherWhere).toString(); + sOtherWhere = new StringBuilder().append(sJboWhere).append(" ") + .append(sOtherWhere).toString(); + } + return sOtherWhere; + } + + /** + * 保存业务 + * + * @param sqlca + * @param tx + * @param sDono + * @param paramMap + * @param sUserId + * @param sOtherWhere + * @return + * @throws JBOException + */ + protected Map saveBusiness(Transaction sqlca, + JBOTransaction tx, String sDono, Map paramMap, + String sUserId, String sOtherWhere, ReturnMapUtil ReturnMapUtil) throws JBOException { + this.ReturnMapUtil = ReturnMapUtil; + Map map = new HashMap(); + this.paramMap = paramMap; + AweDoCataLogModel oAweDoCataLog = new AweDoCataLogModel(sDono); + int iCount = oAweDoCataLog.getsDono().length(); + if (iCount == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "模板号:" + sDono + "不存在!"); + ARE.getLog().debug("模板号:" + sDono + "不存在!"); + return ReturnMapUtil.getReturnMap(); + } + String sDoName = oAweDoCataLog.getsDoName(); + ARE.getLog().info("=========模板名:" + sDoName + "=========="); + String sJboClass = ""; + sJboClass = StringX.isSpace(this.sJboClass) ? oAweDoCataLog + .getsJboClass() : this.sJboClass; + String sJboFrom = oAweDoCataLog.getsJboFrom(); + String sJboWhere = oAweDoCataLog.getsJboWhere(); + if (sOtherWhere != null && sOtherWhere.length() > 0) + sJboWhere = setsOtherWhere(sJboWhere, sOtherWhere); + // String sJboOrder = oAweDoCataLog.getsJboOrder(); + // String sJboGroup = oAweDoCataLog.getsJboGroup(); + iCount = sJboClass.length(); + if (iCount == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "模板号,模板名称:" + sDono + "," + + sDoName + "主表未找到!"); + ARE.getLog().debug("模板号,模板名称:" + sDono + "," + sDoName + "主表未找到!"); + return ReturnMapUtil.getReturnMap(); + } + iCount = sJboWhere.length(); + if (iCount > 0) + sJboWhere = AweDoCommUtil.whereHandle(sJboWhere, paramMap); + + ARE.getLog().info("=========获取AWE_DO_LIBRARY=========="); + List> donoLibrary = oAweDoCataLog.getoLibrary(); + List> elementDatas = new ArrayList>(); + for (Map element : donoLibrary) { + String sColTableName = element.get("coltablename") == null ? "" + : element.get("coltablename").toString(); + if ("o".equalsIgnoreCase(sColTableName)) { + Map elementData = new HashMap(); + for (String sKey : element.keySet()) { + elementData.put(sKey, element.get(sKey)); + } + elementDatas.add(elementData); + } + } + ARE.getLog().info("=========3.开始保存=========="); + try { + BizObjectManager saveBom = JBOFactory + .getBizObjectManager(sJboClass); + tx.join(saveBom); + BizObjectQuery saveBoq = saveBom.createQuery("SELECT O.* FROM " + + sJboFrom + " WHERE " + sJboWhere); + this.saveObject = saveBoq.getSingleResult(true); + ASUser oCurUser = ASUser.getUser( + SpecialTools.real2Amarsoft(sUserId), sqlca); + boolean flag = false; + if (null == saveObject) { + flag = true; + saveObject = saveBom.newObject(); + setPara(); + for (Map elementData : elementDatas) { + String sActualName = elementData.get("colactualname") == null ? "" + : elementData.get("colactualname").toString(); + String sColName = elementData.get("colname") == null ? "" + : elementData.get("colname").toString(); + + if ("INPUTTIME".equalsIgnoreCase(sActualName)) { + if (StringX.isSpace(timeFormat)) + saveObject.setAttributeValue("INPUTTIME", DateUtil + .getSystemTimeByFormat(new Date(), + "yyyy/MM/dd HH:mm:ss")); + else + saveObject.setAttributeValue("INPUTTIME", DateUtil + .getSystemTimeByFormat(new Date(), + timeFormat)); + continue; + } else if ("InputDate".equalsIgnoreCase(sActualName)) { + if (StringX.isSpace(timeFormat)) + saveObject.setAttributeValue("InputDate", DateUtil + .getSystemTimeByFormat(new Date(), + "yyyy/MM/dd HH:mm:ss")); + else + saveObject.setAttributeValue("InputDate", DateUtil + .getSystemTimeByFormat(new Date(), + timeFormat)); + continue; + } else if ("INPUTUSERID".equalsIgnoreCase(sActualName)) { + saveObject.setAttributeValue("INPUTUSERID", + oCurUser.getUserID()); + continue; + } else if ("INPUTUSER".equalsIgnoreCase(sActualName)) { + saveObject.setAttributeValue("INPUTUSER", + oCurUser.getUserID()); + continue; + } else if ("INPUTORGID".equalsIgnoreCase(sActualName)) { + saveObject.setAttributeValue("INPUTORGID", + oCurUser.getOrgID()); + continue; + } else if ("INPUTORG".equalsIgnoreCase(sActualName)) { + saveObject.setAttributeValue("INPUTORG", + oCurUser.getOrgID()); + continue; + } + String sValue = paramMap.get(sActualName.toLowerCase()) == null ? "" + : paramMap.get(sActualName.toLowerCase()) + .toString(); + if (sValue.length() == 0) + sValue = paramMap.get(sColName.toLowerCase()) == null ? "" + : paramMap.get(sColName.toLowerCase()) + .toString(); + if (sValue.length() == 0) + sValue = ""; + if (sValue.length() == 0) + continue; + saveObject.setAttributeValue(sActualName, sValue); + } + if (validityCheck(saveObject, flag, tx)) { + saveBeforeProcess(saveObject); + beforeInsert(saveObject, tx); + saveBom.saveObject(saveObject); + afterInsert(saveObject, tx); + } else { + tx.rollback(); + ARE.getLog().error( + RestfullConstant.baseProperty.get("FAIL_SAVE") + + "\r\n" + sMsg); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), sMsg); + return ReturnMapUtil.getReturnMap(); + } + } else { + setPara(); + for (Map elementData : elementDatas) { + String sActualName = elementData.get("colactualname") == null ? "" + : elementData.get("colactualname").toString(); + String sColName = elementData.get("colname") == null ? "" + : elementData.get("colname").toString(); + if ("id".equalsIgnoreCase(sActualName)) { + continue; + } + if ("UPDATETIME".equalsIgnoreCase(sActualName)) { + if (StringX.isSpace(timeFormat)) + saveObject.setAttributeValue("UPDATETIME", DateUtil + .getSystemTimeByFormat(new Date(), + "yyyy/MM/dd HH:mm:ss")); + else + saveObject.setAttributeValue("UPDATETIME", DateUtil + .getSystemTimeByFormat(new Date(), + timeFormat)); + continue; + } else if ("UpdateDate".equalsIgnoreCase(sActualName)) { + if (StringX.isSpace(timeFormat)) + saveObject.setAttributeValue("UpdateDate", DateUtil + .getSystemTimeByFormat(new Date(), + "yyyy/MM/dd HH:mm:ss")); + else + saveObject.setAttributeValue("UpdateDate", DateUtil + .getSystemTimeByFormat(new Date(), + timeFormat)); + continue; + } else if ("UPDATEUSERID".equalsIgnoreCase(sActualName)) { + saveObject.setAttributeValue("UPDATEUSERID", + oCurUser.getUserID()); + continue; + } else if ("UPDATEUSER".equalsIgnoreCase(sActualName)) { + saveObject.setAttributeValue("UPDATEUSER", + oCurUser.getUserID()); + continue; + } else if ("UPDATEORGID".equalsIgnoreCase(sActualName)) { + saveObject.setAttributeValue("UPDATEORGID", + oCurUser.getOrgID()); + continue; + } else if ("updateorg".equalsIgnoreCase(sActualName)) { + saveObject.setAttributeValue("updateorg", + oCurUser.getOrgID()); + continue; + } + String sValue = paramMap.get(sActualName.toLowerCase()) == null ? "" + : paramMap.get(sActualName.toLowerCase()) + .toString(); + for (String sKey : paramMap.keySet()) { + if (sColName.toLowerCase().equals(sKey)) { + saveObject.setAttributeValue(sActualName, sValue); + } + } + // if (sValue.length() == 0) + // sValue = paramMap.get(sColName.toLowerCase()) == null ? + // "" + // : paramMap.get(sColName.toLowerCase()) + // .toString(); + // if (sValue.length() == 0) + // sValue = ""; + // // bug : 重新赋值为空 不操作 + // if (sValue.length() == 0) + // continue; + // saveObject.setAttributeValue(sActualName, sValue); + } + if (validityCheck(saveObject, flag, tx)) { + saveBeforeProcess(saveObject); + beforeUpdate(saveObject, tx); + saveBom.saveObject(saveObject); + afterUpdate(saveObject, tx); + } else { + tx.rollback(); + ARE.getLog().error( + RestfullConstant.baseProperty.get("FAIL_SAVE") + + "\r\n" + sMsg); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), sMsg); + return ReturnMapUtil.getReturnMap(); + } + } + tx.commit(); + BizObjectUtil util = new BizObjectUtil(); + map = util.bizObject2MapValue3(saveObject); + } catch (Exception e) { + tx.rollback(); + ARE.getLog().error( + RestfullConstant.baseProperty.get("FAIL_SAVE") + "\r\n" + + "error:" + e); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), + (String) RestfullConstant.baseProperty.get("FAIL_SAVE")); + return ReturnMapUtil.getReturnMap(); + } + Map body = new HashMap(); + body.put("datas", map); + ReturnMapUtil.setReturnMap(body, (String) RestfullConstant.baseProperty + .get("SUCCESS".toLowerCase()), + (String) RestfullConstant.baseProperty.get("SUCCESS_SAVE")); + return ReturnMapUtil.getReturnMap(); + } + + /** + * 根据分组号实现保存编辑 + */ + public Map saveGroupData(Transaction sqlca, + JBOTransaction tx, String sGroupCode, Map paramMap, + String sUserId, String sOtherWhere, ReturnMapUtil ReturnMapUtil) throws Exception { + this.ReturnMapUtil = ReturnMapUtil; + ARE.getLog() + .info("======================================= saveGroupData:begin > 保存开始 ======================================"); + if (sGroupCode == null) + sGroupCode = ""; + if (sGroupCode.length() == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "分组号为空,无法查询具体模板数据!"); + ARE.getLog().debug("分组号为空,无法查询具体模板数据!"); + ARE.getLog() + .info("======================================= saveGroupData:end > 保存失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + ARE.getLog().info("=========1.获取分组号=========="); + ARE.getLog().info("=========获取分组号: " + sGroupCode + "=========="); + ARE.getLog().info("=========准备获取APP分组信息=========="); + AppBusinessGroupModel oGroup = new AppBusinessGroupModel(sGroupCode); + int iCount = oGroup.getsGroupCode().length(); + if (iCount == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "分组号:" + sGroupCode + + " 未找到相应分组配置!"); + ARE.getLog().debug("分组号:" + sGroupCode + " 未找到相应分组配置!"); + ARE.getLog() + .info("======================================= saveGroupData:end > 保存失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + iCount = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) + .getsDono().length(); + if (iCount == 0) { + ReturnMapUtil + .setReturnMap(null, (String) RestfullConstant.baseProperty + .get("FAIL".toLowerCase()), "分组号:" + sGroupCode + + " 配置元素模板为空!"); + ARE.getLog().debug("分组号:" + sGroupCode + " 配置元素模板为空!"); + ARE.getLog() + .info("======================================= saveGroupData:end > 保存失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + String sDono = oGroup.getoElements().get(0).get("TEMP".toLowerCase()) + .getsDono(); + ARE.getLog().info("=========获取模板号:" + sDono + "=========="); + ARE.getLog().info("=========2.获取模板信息=========="); + Map oAppResult = saveBusiness(sqlca, tx, sDono, + paramMap, sUserId, sOtherWhere, ReturnMapUtil); + @SuppressWarnings("unchecked") + String sCode = ((Map) oAppResult.get("outline")) + .get("code") == null ? "" : ((Map) oAppResult + .get("outline")).get("code").toString(); + if (!RestfullConstant.baseProperty.get("SUCCESS".toLowerCase()).equals( + sCode)) { + ARE.getLog() + .info("======================================= saveGroupData:end > 保存失败 ======================================"); + } + ARE.getLog() + .info("======================================= saveGroupData:end > 保存结束 ======================================"); + return oAppResult; + } + + /** + * 根据模板号实现保存编辑 + */ + public Map saveDonoData(Transaction sqlca, + JBOTransaction tx, String sDono, Map paramMap, + String sUserId, String sOtherWhere, ReturnMapUtil ReturnMapUtil) throws Exception { + this.ReturnMapUtil = ReturnMapUtil; + ARE.getLog() + .info("======================================= saveDonoData:begin > 保存开始 ======================================"); + if (sDono == null) + sDono = ""; + int iCount = sDono.length(); + if (iCount == 0) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "模板号不能为空!"); + ARE.getLog().debug("模板号不能为空!"); + ARE.getLog() + .info("======================================= saveDonoData:end > 保存失败 ======================================"); + return ReturnMapUtil.getReturnMap(); + } + ARE.getLog().info("=========1.获取模板号=========="); + ARE.getLog().info("=========获取模板号:" + sDono + "=========="); + ARE.getLog().info("=========2.获取模板信息=========="); + Map oAppResult = saveBusiness(sqlca, tx, sDono, + paramMap, sUserId, sOtherWhere, ReturnMapUtil); + @SuppressWarnings("unchecked") + String sCode = ((Map) oAppResult.get("outline")) + .get("code") == null ? "" : ((Map) oAppResult + .get("outline")).get("code").toString(); + if (!RestfullConstant.baseProperty.get("SUCCESS".toLowerCase()).equals( + sCode)) { + ARE.getLog() + .info("======================================= saveDonoData:end > 保存失败 ======================================"); + } + + ARE.getLog() + .info("======================================= saveDonoData:end > 保存结束 ======================================"); + return oAppResult; + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweAppDoFlowDoDetailController.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweAppDoFlowDoDetailController.java new file mode 100644 index 000000000..2ef9b46a9 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweAppDoFlowDoDetailController.java @@ -0,0 +1,255 @@ +package apx.com.amarsoft.als.base.awe.controller; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import jbo.app.APP_BUSINESS_GROUP; +import jbo.app.APP_BUSINESS_TEMPLATE; +import apx.com.amarsoft.als.base.flow.AppConfigFlow; +import apx.com.amarsoft.als.base.flow.FlowTask; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +@Path("/comm") +public class AweAppDoFlowDoDetailController { + private Map fieldMap; + + private String taskNo; + private String objectNo; + private String flowNo; + private String phaseNo; + + @Path("/query/app/do/detail") + @POST + @SuppressWarnings("unchecked") + public Map queryAppDoDetail( + @Context HttpServletResponse response, + @Context HttpServletRequest request, @Context JBOTransaction tx, + @Context Transaction sqlca) throws JBOException { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] AweAppDoFlowDoDetailController run ................."); + ARE.getLog().info( + "[Path] /comm/query/app/do/detail" + " run ................."); + try { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + taskNo = fieldMap.get("serialno") == null ? "" : fieldMap.get( + "serialno").toString(); + objectNo = fieldMap.get("OBJECTNO") == null ? "" : fieldMap.get( + "OBJECTNO").toString(); + + ARE.getLog().debug("objectNo:" + objectNo); + ARE.getLog().debug("taskNo:" + taskNo); + + FlowTask FlowTask = new FlowTask(); + FlowTask.setSerialNo(taskNo); + BizObject bo = FlowTask.queryFlowTask(request, sqlca, tx, fieldMap); + + if (null == bo) { + ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty + .get("FAIL").toString(), "未找到流程实例!"); + return ReturnMapUtil.getReturnMap(); + } + objectNo = bo.getAttribute("OBJECTNO") == null ? "" : bo + .getAttribute("OBJECTNO").toString(); + flowNo = bo.getAttribute("FLOWNO") == null ? "" : bo.getAttribute( + "FLOWNO").toString(); + phaseNo = bo.getAttribute("PHASENO") == null ? "" : bo + .getAttribute("PHASENO").toString(); + + AppConfigFlow AppConfigFlow = new AppConfigFlow(); + AppConfigFlow.setFlowNo(flowNo); + AppConfigFlow.setPhaseNo(phaseNo); + List appNodeProject = AppConfigFlow + .queryAppConfigDetailByProject(tx); + List> list = new ArrayList>(); + for (BizObject project : appNodeProject) { + if (null == project) + continue; + Map map = new HashMap(); + String id = project.getAttribute("id") == null ? "" : project + .getAttribute("id").toString(); + map.put("id", id); + map.put("flowNo", project.getAttribute("flowno").getValue()); + map.put("phaseNo", project.getAttribute("phaseno").getValue()); + map.put("display", project.getAttribute("config_display") + .getValue()); + map.put("enableOperation", + project.getAttribute("enable_operation").getValue()); + map.put("sortno", project.getAttribute("sortno").getValue()); + List> list3 = new ArrayList>(); + AppConfigFlow.setCatalogId(id); + List appNodeMiddle = AppConfigFlow + .queryMiddleByCatalogId(tx); + for (BizObject middle : appNodeMiddle) { + Map map2 = new HashMap(); + map2.put("display", middle.getAttribute("app_display") + .getValue()); + map2.put("enableQuery", middle.getAttribute("ENABLE_QUERY") + .getValue()); + map2.put("enableSave", middle.getAttribute("ENABLE_SAVE") + .getValue()); + map2.put("enableDelete", + middle.getAttribute("ENABLE_DELETE").getValue()); + + map2.put("enableDownLoad", + middle.getAttribute("ENABLE_DOWNLOAD").getValue()); + + map2.put("downloadParam", + middle.getAttribute("DOWNLOAD_PARAM").getValue()); + + map2.put("sortno", middle.getAttribute("sortno").getValue()); + String id2 = middle.getAttribute("APP_NODE_LIBRARY_ID") == null ? "" + : middle.getAttribute("APP_NODE_LIBRARY_ID") + .toString(); + AppConfigFlow.setMiddleId(id2); + BizObject appNodeProjectLibrary = AppConfigFlow + .queryLibraryByMiddleId(tx); + + String ec = appNodeProjectLibrary + .getAttribute("ENABLE_CONDITION") == null ? "" + : appNodeProjectLibrary.getAttribute( + "ENABLE_CONDITION").toString(); + + boolean bOpenCondition = true; + + if ("Y".equals(ec)) { // 根据条件挂页签 + String oc = appNodeProjectLibrary + .getAttribute("OPEN_CONDITION") == null ? "" + : appNodeProjectLibrary.getAttribute( + "OPEN_CONDITION").toString(); + String classpath = oc.substring(0, oc.lastIndexOf(".")); + String methodName = oc.substring(oc.lastIndexOf(".") + 1, + oc.lastIndexOf("(")); + @SuppressWarnings("rawtypes") + Class classPathClass = Class.forName(classpath); + Object obj = classPathClass.newInstance(); + Method targetMethod = null; + Method[] cls = classPathClass.getDeclaredMethods(); + + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase("setFieldMap")) { + targetMethod = cls[j]; + List Lparam = new ArrayList(); + Lparam.add(fieldMap); + targetMethod.invoke(obj, Lparam.toArray()); + } + } + + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase(methodName)) { + targetMethod = cls[j]; + List Lparam = new ArrayList(); +// Lparam.add(fieldMap); + bOpenCondition = (boolean) targetMethod.invoke( + obj, Lparam.toArray()); + } + } + } + + if (!bOpenCondition) continue; // 未通过条件 页签不挂 + + String id3 = appNodeProjectLibrary.getAttribute("id") == null ? "" + : appNodeProjectLibrary.getAttribute("id") + .toString(); + String appBusinessGroupCode = appNodeProjectLibrary + .getAttribute("APP_BUSINESS_GROUP_CODE") == null ? "" + : appNodeProjectLibrary.getAttribute( + "APP_BUSINESS_GROUP_CODE").toString(); + map2.put("id", id3); + map2.put("appBusinessGroup", appBusinessGroupCode); + map2.put("initialCondition", appNodeProjectLibrary + .getAttribute("INITIAL_CONDITION").getValue()); + map2.put("auxiliaryCondition", appNodeProjectLibrary + .getAttribute("AUXILIARY_CONDITION").getValue()); + map2.put("interfaceDesc", appNodeProjectLibrary + .getAttribute("INTERFACE_DESC").getValue()); + map2.put("displayInterFace", appNodeProjectLibrary + .getAttribute("DISPLAY_MANAGE_CLASS").getValue()); + map2.put("saveInterFace", appNodeProjectLibrary + .getAttribute("SAVE_MANAGE_CLASS").getValue()); + map2.put("deleteInterFace", appNodeProjectLibrary + .getAttribute("DELETE_MANAGE_CLASS").getValue()); + map2.put("fatherId", + appNodeProjectLibrary.getAttribute("FATHER_ID") + .getValue()); + list3.add(map2); + + BizObjectManager appBusinessManage = JBOFactory + .getBizObjectManager(APP_BUSINESS_GROUP.CLASS_NAME); + BizObject appBusiness = appBusinessManage + .createQuery("GROUP_CODE=:GROUP_CODE") + .setParameter("GROUP_CODE", appBusinessGroupCode) + .getSingleResult(false); + Map map3 = new HashMap(); + if (null != appBusiness) { + map3.put("groupName", + appBusiness.getAttribute("GROUP_NAME") + .getValue()); + map3.put("isList", appBusiness.getAttribute("ISLIST") + .getValue()); + BizObjectManager templateManage = JBOFactory + .getBizObjectManager(APP_BUSINESS_TEMPLATE.CLASS_NAME); + BizObject template = templateManage + .createQuery("GROUP_CODE=:GROUP_CODE") + .setParameter("GROUP_CODE", + appBusinessGroupCode) + .getSingleResult(false); + if (null == template) { + map3.put("dono", ""); + } else + map3.put("dono", template.getAttribute("dono") + .getValue()); + } + map2.put("appBusiness", map3); + } + map.put("library", list3); + list.add(map); + } + + Map body = new HashMap(); + body.put("flowProject", list); + + if (!StringX.isSpace(phaseNo)) { + AweFlow flow = new AweFlow(flowNo); + // 流程模型基本信息 + Map flowModel = flow.queryModel(tx, phaseNo); + // 流程基本信息 + Map flowBaseInfo = flow.queryBaseInfo(tx); + body.put("flowModel", flowModel); + body.put("flowBaseInfo", flowBaseInfo); + } else { + body.put("flowModel", new HashMap()); + body.put("flowBaseInfo", new HashMap()); + } + ReturnMapUtil + .setReturnMap(body, + RestfullConstant.baseProperty.get("SUCCESS") + .toString(), ""); + return ReturnMapUtil.getReturnMap(); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweDoQueryController.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweDoQueryController.java new file mode 100644 index 000000000..8ae2f94a8 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweDoQueryController.java @@ -0,0 +1,433 @@ +package apx.com.amarsoft.als.base.awe.controller; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.base.awe.util.AweDoCommUtil; +import apx.com.amarsoft.als.base.flow.AppConfigFlow; +import apx.com.amarsoft.als.base.flow.FlowTask; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +@Path("/comm/query/by/dono") +public class AweDoQueryController { + private String dono; + private String groupCode; + private String interfaceDesc; + private String initialCondition; + private String auxiliaryCondition; + // private String addWhere; + private Map fieldMap; + + // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + + @SuppressWarnings("unchecked") + @Path("/data") + @POST + public Map query(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] AweDoQueryController run ................."); + ARE.getLog().info( + "[Path] /comm/query/by/dono/data" + " run ................."); + try { + + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + String objectNo = fieldMap.get("OBJECTNO") == null ? "" : fieldMap + .get("OBJECTNO").toString(); + fieldMap.put("OBJECTNO", objectNo); + fieldMap.put("OBJECTNO".toLowerCase(), objectNo); + fieldMap.put("FLOWUNID", objectNo); + fieldMap.put("FLOWUNID".toLowerCase(), objectNo); + fieldMap.put("FLOW_UNID", objectNo); + fieldMap.put("FLOW_UNID".toLowerCase(), objectNo); + + FlowTask FlowTask = new FlowTask(); + BizObject bo = FlowTask.queryFlowTask(request, sqlca, tx, fieldMap); + if (null != bo) { + if (null == bo.getAttribute("SERIALNO")) { + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("FAIL") + .toString(), "获取流程实例流水号失败!"); + return ReturnMapUtil.getReturnMap(); + } + String taskNo = bo.getAttribute("SERIALNO").getValue() + .toString(); + fieldMap.put("taskNo", taskNo); + fieldMap.put("taskNo".toLowerCase(), taskNo); + fieldMap.put("task_no", taskNo); + fieldMap.put("task_No".toLowerCase(), taskNo); + } + + String id = request.getParameter("id"); + + AppConfigFlow AppConfigFlow = new AppConfigFlow(); + AppConfigFlow.setId(id); + BizObject library = AppConfigFlow.queryLibraryById(tx); + if (null == library) { + ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty + .get("FAIL").toString(), "未找到模板配置!"); + return ReturnMapUtil.getReturnMap(); + } + // APP页签模板分组号 + groupCode = library.getAttribute("APP_BUSINESS_GROUP_CODE") == null ? "" + : library.getAttribute("APP_BUSINESS_GROUP_CODE") + .toString(); + if (StringX.isSpace(groupCode)) { + ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty + .get("FAIL").toString(), "APP页签模板分组号码无效!"); + return ReturnMapUtil.getReturnMap(); + } + // 接口描述 DefaultDoManage 默认类型 + interfaceDesc = library.getAttribute("INTERFACE_DESC") == null ? "" + : library.getAttribute("INTERFACE_DESC").toString(); + // if (!"DefaultDoManage".equals(interfaceDesc)) { + // ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty + // .get("FAIL").toString(), + // "调用模板接口错误,此页面不是默认模板查询!请使用接口:/webapi/resf" + interfaceDesc); + // return ReturnMapUtil.getReturnMap(); + // } + String classpath = "apx.com.amarsoft.als.base.awe.controller.DefaultDoManage"; + // + if (!"DefaultDoManage".equals(interfaceDesc)) { + classpath = library.getAttribute("DISPLAY_MANAGE_CLASS") == null ? "" + : library.getAttribute("DISPLAY_MANAGE_CLASS") + .toString(); + } + initialCondition = library.getAttribute("INITIAL_CONDITION") == null ? "" + : library.getAttribute("INITIAL_CONDITION").toString(); + initialConditionHandler(library); + auxiliaryCondition = library.getAttribute("AUXILIARY_CONDITION") == null ? "" + : library.getAttribute("AUXILIARY_CONDITION").toString(); + String otherWhere = auxiliaryConditionHandle(library); + System.out.println("othereWhere :" + otherWhere); + + AppConfigFlow.setGroupCode(groupCode); + BizObject group = AppConfigFlow.queryGroup(tx); + if (null == group) { + ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty + .get("FAIL").toString(), "未找到模板配置!"); + return ReturnMapUtil.getReturnMap(); + } + List templates = AppConfigFlow.queryTemplate(tx); + if (templates.size() < 1) { + ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty + .get("FAIL").toString(), "未找到模板配置!"); + return ReturnMapUtil.getReturnMap(); + } + BizObject template = templates.get(0); +// dono = template.getAttribute("dono") == null ? "" : template +// .getAttribute("dono").toString(); + dono = groupCode; + @SuppressWarnings("rawtypes") + Class classPathClass = Class.forName(classpath); + Object obj = classPathClass.newInstance(); + Method targetMethod = null; + Method[] cls = classPathClass.getDeclaredMethods(); + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase("setDono")) { + targetMethod = cls[j]; + List Lparam = new ArrayList(); + Lparam.add(this.dono); + targetMethod.invoke(obj, Lparam.toArray()); + } + } + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase("setsAddWhere")) { + targetMethod = cls[j]; + List Lparam = new ArrayList(); + Lparam.add(otherWhere); + targetMethod.invoke(obj, Lparam.toArray()); + } + } + + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase("setFieldMap")) { + targetMethod = cls[j]; + List Lparam = new ArrayList(); + Lparam.add(fieldMap); + targetMethod.invoke(obj, Lparam.toArray()); + } + } + + // for (int j = 0; j < cls.length; j++) { + // if (cls[j].getName().equalsIgnoreCase("setReturnMapUtil")) { + // targetMethod = cls[j]; + // List Lparam = new ArrayList(); + // Lparam.add(ReturnMapUtil); + // targetMethod.invoke(obj, Lparam.toArray()); + // } + // } + + List Lparam = new ArrayList(); + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase("queryDefaultDo")) { + targetMethod = cls[j]; + Lparam.add(request); + Lparam.add(sqlca); + Lparam.add(tx); + Lparam.add(ReturnMapUtil); + } + } + return (Map) targetMethod.invoke(obj, + Lparam.toArray()); + // if (value == null) { + // value = ""; + // } + + // DefaultDoManage manage = new DefaultDoManage(); + // manage.setDono(this.dono); + // manage.setsAddWhere(otherWhere); + // manage.setParamMap(fieldMap); + // return manage.queryDefaultDo(request, sqlca, tx); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + + } + + public void initialConditionHandler(BizObject library) throws JBOException { + // groupcode,userid + if (StringX.isSpace(initialCondition)) { + return; + } + String[] array = initialCondition.split(","); + for (String str : array) { + str = str.trim(); + if (fieldMap.get(str.toLowerCase()) != null) + continue; + for (int i = 1; i < 10; i++) { + String param = "ATTRIBUTE" + i; + String str2 = library.getAttribute(param) == null ? "" + : library.getAttribute(param).toString(); + str2 = str2.trim(); + if (StringX.isSpace(str2) || StringX.isSpace(str)) { + continue; + } + // where条件参数处理 + String str3 = whereParamHandle(str, str2); + if ("continue".equals(str3)) + continue; + else if ("execute".equals(str3)) + continue; + else + continue; + } + } + } + + public String auxiliaryConditionHandle(BizObject library) + throws JBOException { + // " and groupcode=:groupcode and userid=:userid@groupcode,userid" + // and groupcode=:groupcode and userid=:userid + // groupcode,userid + // 附加查询条件 + String otherWhere = ""; + if (!StringX.isSpace(auxiliaryCondition)) { + String[] array = auxiliaryCondition.split("@"); + if (array.length > 0) + otherWhere = array[0]; + if (array.length > 1) { + String otherWhereParam = array[1]; + String[] array2 = otherWhereParam.split(","); + if (array2.length > 0) { + for (String str : array2) { + str = str.trim(); + for (int i = 1; i < 10; i++) { + if (fieldMap.get(str.toLowerCase()) == null) { + String param = "ATTRIBUTE" + i; + String str2 = library.getAttribute(param) == null ? "" + : library.getAttribute(param) + .toString(); + str2 = str2.trim(); + if (StringX.isSpace(str2) + || StringX.isSpace(str)) { + // otherWhere = otherWhere.replace(":" + + // str, + // "''"); + continue; + } + // 附加条件 和 where条件参数处理 + String str3 = whereParamHandle(str, str2); + if ("continue".equals(str3)) + continue; + else if ("execute".equals(str3)) + continue; + else + continue; + + } + } + } + } + } + } + return otherWhere; + } + + public String executeMethod(String colactualname, String... params) { + + String value = ""; + + try { + String classpath = colactualname.substring(0, + colactualname.lastIndexOf(".")); + String methodName = colactualname.substring( + colactualname.lastIndexOf(".") + 1, + colactualname.indexOf("(")); + String paramsname = colactualname.substring( + colactualname.indexOf("(") + 1, colactualname.indexOf(")")); + String[] vParams = paramsname.split(","); + if (vParams.length == 1 && "".equals(vParams[0].trim())) + vParams = new String[0]; + if (vParams.length != params.length) { + return null; + } + List Lparam = new ArrayList(); + for (String param : params) { + Lparam.add(param); + } + @SuppressWarnings("rawtypes") + Class classPathClass = Class.forName(classpath); + Object obj = classPathClass.newInstance(); + Method targetMethod = null; + Method[] cls = classPathClass.getDeclaredMethods(); + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase(methodName)) { + targetMethod = cls[j]; + } + } + value = (String) targetMethod.invoke(obj, Lparam.toArray()); + if (value == null) { + value = ""; + } + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | SecurityException + | IllegalArgumentException | InvocationTargetException e) { + ARE.getLog().error("executeMethod" + e); + return null; + } + return value; + } + + public String whereParamHandle(String paramStr, String attribute) { + // attribute:com.amarsoft.app.lc.workflow.action.GetFlowActionGetFlowAction.getFlowParamByFlowUnid(FlowUnid,serialno)@CustomerId + // com.amarsoft.app.lc.workflow.action.GetFlowActionGetFlowAction.getFlowParamByFlowUnid(FlowUnid,serialno) + // CustomerId + String[] array = attribute.split("@"); + if (array.length < 2) + return "continue"; + String classStr = array[0]; + String paramStr2 = array[1]; + classStr = classStr.trim(); + paramStr2.trim(); + if (!paramStr.toLowerCase().equals(paramStr2.toLowerCase())) { + return "continue"; + } + System.out.println(classStr); + String param = classStr.substring(classStr.indexOf("(") + 1, + classStr.indexOf(")")); + param = param.trim(); + System.out.println(param); + + String[] array1 = param.split(","); + if (array1.length == 1 && "".equals(array1[0])) { + String[] aSet = new String[0]; + String value = executeMethod(classStr, aSet); + fieldMap.put(paramStr.toLowerCase(), value); + fieldMap.put(paramStr.toUpperCase(), value); + fieldMap.put(paramStr, value); + return "execute"; + } + + int count = array1.length; + String[] aSet = new String[count]; + int i = 0; + for (String str : array1) { + str = str.trim(); + if (fieldMap.get(param.toLowerCase()) == null) { + return "continue"; + } + aSet[i] = fieldMap.get(param.toLowerCase()).toString(); + i++; + } + + if (fieldMap.get(param.toLowerCase()) == null) { + return "continue"; + } + + String value = executeMethod(classStr, aSet); + fieldMap.put(paramStr.toLowerCase(), value); + fieldMap.put(paramStr.toUpperCase(), value); + fieldMap.put(paramStr, value); + return "execute"; + } + + public String whereParamHandle(String sqlWhere, String whereParam, + String attribute) { + String[] array = attribute.split("@"); + if (array.length < 2) + return "continue"; + String classStr = array[0]; + String paramStr2 = array[1]; + classStr = classStr.trim(); + paramStr2.trim(); + if (!whereParam.toLowerCase().equals(paramStr2.toLowerCase())) { + return "continue"; + } + System.out.println(classStr); + String param = classStr.substring(classStr.indexOf("(") + 1, + classStr.indexOf(")")); + param = param.trim(); + System.out.println(param); + + String[] array1 = param.split(","); + int count = array1.length; + String[] aSet = new String[count]; + int i = 0; + for (String str : array1) { + str = str.trim(); + if (fieldMap.get(param.toLowerCase()) == null) { + return "continue"; + } + aSet[i] = fieldMap.get(param.toLowerCase()).toString(); + i++; + } + + if (fieldMap.get(param.toLowerCase()) == null) { + return "continue"; + } + + String value = executeMethod(classStr, aSet); + fieldMap.put(whereParam.toLowerCase(), value); + fieldMap.put(whereParam.toUpperCase(), value); + fieldMap.put(whereParam, value); + return "execute"; + } + + public String whereHandle(String sqlWhere) { + return AweDoCommUtil.whereHandle(sqlWhere, fieldMap); + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweDoSaveController.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweDoSaveController.java new file mode 100644 index 000000000..0223d3820 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweDoSaveController.java @@ -0,0 +1,422 @@ +package apx.com.amarsoft.als.base.awe.controller; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.base.awe.util.AweDoCommUtil; +import apx.com.amarsoft.als.base.flow.AppConfigFlow; +import apx.com.amarsoft.als.base.flow.FlowTask; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.base.constant.RestfullConstant; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +@Path("/comm/save/by/dono") +public class AweDoSaveController { + private String dono; + private String groupCode; + private String interfaceDesc; + private String initialCondition; + private String auxiliaryCondition; + + private Map fieldMap; + + // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + + @SuppressWarnings("unchecked") + @Path("/data") + @POST + public Map query(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] AweDoSaveController run ................."); + ARE.getLog().info( + "[Path] /comm/save/by/dono/data" + " run ................."); + try { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + String objectNo = fieldMap.get("OBJECTNO") == null ? "" : fieldMap + .get("OBJECTNO").toString(); + fieldMap.put("FLOWUNID", objectNo); + fieldMap.put("FLOWUNID".toLowerCase(), objectNo); + fieldMap.put("FLOW_UNID", objectNo); + fieldMap.put("FLOW_UNID".toLowerCase(), objectNo); + + FlowTask FlowTask = new FlowTask(); + BizObject bo = FlowTask.queryFlowTask(request, sqlca, tx, fieldMap); + if (null != bo) { + if (null == bo.getAttribute("SERIALNO")) { + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("FAIL") + .toString(), "获取流程实例流水号失败!"); + return ReturnMapUtil.getReturnMap(); + } + String taskNo = fieldMap.get("SERIALNO") == bo + .getAttribute("SERIALNO").getValue().toString() ? "" + : fieldMap.get("SERIALNO").toString(); + fieldMap.put("taskNo", taskNo); + fieldMap.put("taskNo".toLowerCase(), taskNo); + fieldMap.put("task_no", taskNo); + fieldMap.put("task_No".toLowerCase(), taskNo); + } + String id = request.getParameter("id"); + AppConfigFlow AppConfigFlow = new AppConfigFlow(); + AppConfigFlow.setId(id); + BizObject library = AppConfigFlow.queryLibraryById(tx); + if (null == library) { + ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty + .get("FAIL").toString(), "未找到模板配置!"); + return ReturnMapUtil.getReturnMap(); + } + // APP页签模板分组号 + groupCode = library.getAttribute("APP_BUSINESS_GROUP_CODE") == null ? "" + : library.getAttribute("APP_BUSINESS_GROUP_CODE") + .toString(); + if (StringX.isSpace(groupCode)) { + ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty + .get("FAIL").toString(), "APP页签模板分组号码无效!"); + return ReturnMapUtil.getReturnMap(); + } + // 接口描述 DefaultDoManage 默认类型 + interfaceDesc = library.getAttribute("INTERFACE_DESC") == null ? "" + : library.getAttribute("INTERFACE_DESC").toString(); + + String classpath = "apx.com.amarsoft.als.base.awe.controller.DefaultSaveDoManage"; + // + if (!"DefaultDoManage".equals(interfaceDesc)) { + classpath = library.getAttribute("SAVE_MANAGE_CLASS") == null ? "" + : library.getAttribute("SAVE_MANAGE_CLASS").toString(); + } + + initialCondition = library.getAttribute("INITIAL_CONDITION") == null ? "" + : library.getAttribute("INITIAL_CONDITION").toString(); + + initialConditionHandler(library); + auxiliaryCondition = library.getAttribute("AUXILIARY_CONDITION") == null ? "" + : library.getAttribute("AUXILIARY_CONDITION").toString(); + String otherWhere = auxiliaryConditionHandle(library); + ARE.getLog().debug("othereWhere :" + otherWhere); + + AppConfigFlow.setGroupCode(groupCode); + BizObject group = AppConfigFlow.queryGroup(tx); + if (null == group) { + ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty + .get("FAIL").toString(), "未找到模板配置!"); + return ReturnMapUtil.getReturnMap(); + } + List templates = AppConfigFlow.queryTemplate(tx); + if (templates.size() < 1) { + ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty + .get("FAIL").toString(), "未找到模板配置!"); + return ReturnMapUtil.getReturnMap(); + } + BizObject template = templates.get(0); + dono = template.getAttribute("dono") == null ? "" : template + .getAttribute("dono").toString(); + + @SuppressWarnings("rawtypes") + Class classPathClass = Class.forName(classpath); + Object obj = classPathClass.newInstance(); + Method targetMethod = null; + Method[] cls = classPathClass.getDeclaredMethods(); + ASUser curUser = new ASUser(request.getSession() + .getAttribute("userid").toString()); + + // manage.setCurUser(curUser); + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase("setDono")) { + targetMethod = cls[j]; + List Lparam = new ArrayList(); + Lparam.add(this.dono); + targetMethod.invoke(obj, Lparam.toArray()); + } + } + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase("setAddWhere")) { + targetMethod = cls[j]; + List Lparam = new ArrayList(); + Lparam.add(otherWhere); + targetMethod.invoke(obj, Lparam.toArray()); + } + } + + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase("setFieldMap")) { + targetMethod = cls[j]; + List Lparam = new ArrayList(); + Lparam.add(fieldMap); + targetMethod.invoke(obj, Lparam.toArray()); + } + } + + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase("setCurUser")) { + targetMethod = cls[j]; + List Lparam = new ArrayList(); + Lparam.add(curUser); + targetMethod.invoke(obj, Lparam.toArray()); + } + } + + // for (int j = 0; j < cls.length; j++) { + // if (cls[j].getName().equalsIgnoreCase("setReturnMapUtil")) { + // targetMethod = cls[j]; + // List Lparam = new ArrayList(); + // Lparam.add(ReturnMapUtil); + // targetMethod.invoke(obj, Lparam.toArray()); + // } + // } + + List Lparam = new ArrayList(); + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase("DefaultSave")) { + targetMethod = cls[j]; + Lparam.add(request); + Lparam.add(sqlca); + Lparam.add(tx); + Lparam.add(ReturnMapUtil); + } + } + return (Map) targetMethod.invoke(obj, + Lparam.toArray()); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + public void initialConditionHandler(BizObject library) throws JBOException { + // groupcode,userid + if (StringX.isSpace(initialCondition)) { + return; + } + String[] array = initialCondition.split(","); + for (String str : array) { + str = str.trim(); + if (fieldMap.get(str.toLowerCase()) != null) + continue; + for (int i = 1; i < 10; i++) { + String param = "ATTRIBUTE" + i; + String str2 = library.getAttribute(param) == null ? "" + : library.getAttribute(param).toString(); + str2 = str2.trim(); + if (StringX.isSpace(str2) || StringX.isSpace(str)) { + continue; + } + // where条件参数处理 + String str3 = whereParamHandle(str, str2); + if ("continue".equals(str3)) + continue; + else if ("execute".equals(str3)) + continue; + else + continue; + } + } + } + + public String auxiliaryConditionHandle(BizObject library) + throws JBOException { + // 附加查询条件 + String otherWhere = ""; + if (!StringX.isSpace(auxiliaryCondition)) { + String[] array = auxiliaryCondition.split("@"); + if (array.length > 0) + otherWhere = array[0]; + if (array.length > 1) { + String otherWhereParam = array[1]; + String[] array2 = otherWhereParam.split(","); + if (array2.length > 0) { + for (String str : array2) { + str = str.trim(); + for (int i = 1; i < 10; i++) { + if (fieldMap.get(str.toLowerCase()) == null) { + String param = "ATTRIBUTE" + i; + String str2 = library.getAttribute(param) == null ? "" + : library.getAttribute(param) + .toString(); + str2 = str2.trim(); + if (StringX.isSpace(str2) + || StringX.isSpace(str)) { + // otherWhere = otherWhere.replace(":" + + // str, + // "''"); + continue; + } + // 附加条件 和 where条件参数处理 + String str3 = whereParamHandle(str, str2); + if ("continue".equals(str3)) + continue; + else if ("execute".equals(str3)) + continue; + else + continue; + + } + } + } + } + } + } + return otherWhere; + } + + public String executeMethod(String colactualname, String... params) { + + String value = ""; + + try { + String classpath = colactualname.substring(0, + colactualname.lastIndexOf(".")); + String methodName = colactualname.substring( + colactualname.lastIndexOf(".") + 1, + colactualname.indexOf("(")); + String paramsname = colactualname.substring( + colactualname.indexOf("(") + 1, colactualname.indexOf(")")); + String[] vParams = paramsname.split(","); + if (vParams.length == 1 && "".equals(vParams[0].trim())) + vParams = new String[0]; + if (vParams.length != params.length) { + return null; + } + List Lparam = new ArrayList(); + for (String param : params) { + Lparam.add(param); + } + @SuppressWarnings("rawtypes") + Class classPathClass = Class.forName(classpath); + Object obj = classPathClass.newInstance(); + Method targetMethod = null; + Method[] cls = classPathClass.getDeclaredMethods(); + for (int j = 0; j < cls.length; j++) { + if (cls[j].getName().equalsIgnoreCase(methodName)) { + targetMethod = cls[j]; + } + } + value = (String) targetMethod.invoke(obj, Lparam.toArray()); + if (value == null) { + value = ""; + } + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | SecurityException + | IllegalArgumentException | InvocationTargetException e) { + ARE.getLog().error("executeMethod" + e); + return null; + } + return value; + } + + public String whereParamHandle(String paramStr, String attribute) { + String[] array = attribute.split("@"); + if (array.length < 2) + return "continue"; + String classStr = array[0]; + String paramStr2 = array[1]; + classStr = classStr.trim(); + paramStr2.trim(); + if (!paramStr.toLowerCase().equals(paramStr2.toLowerCase())) { + return "continue"; + } + System.out.println(classStr); + String param = classStr.substring(classStr.indexOf("(") + 1, + classStr.indexOf(")")); + param = param.trim(); + System.out.println(param); + + String[] array1 = param.split(","); + if (array1.length == 1 && "".equals(array1[0])) { + String[] aSet = new String[0]; + String value = executeMethod(classStr, aSet); + fieldMap.put(paramStr.toLowerCase(), value); + fieldMap.put(paramStr.toUpperCase(), value); + fieldMap.put(paramStr, value); + return "execute"; + } + + int count = array1.length; + String[] aSet = new String[count]; + int i = 0; + for (String str : array1) { + str = str.trim(); + if (fieldMap.get(param.toLowerCase()) == null) { + return "continue"; + } + aSet[i] = fieldMap.get(param.toLowerCase()).toString(); + i++; + } + + if (fieldMap.get(param.toLowerCase()) == null) { + return "continue"; + } + + String value = executeMethod(classStr, aSet); + fieldMap.put(paramStr.toLowerCase(), value); + fieldMap.put(paramStr.toUpperCase(), value); + fieldMap.put(paramStr, value); + return "execute"; + } + + public String whereParamHandle(String sqlWhere, String whereParam, + String attribute) { + String[] array = attribute.split("@"); + if (array.length < 2) + return "continue"; + String classStr = array[0]; + String paramStr2 = array[1]; + classStr = classStr.trim(); + paramStr2.trim(); + if (!whereParam.toLowerCase().equals(paramStr2.toLowerCase())) { + return "continue"; + } + System.out.println(classStr); + String param = classStr.substring(classStr.indexOf("(") + 1, + classStr.indexOf(")")); + param = param.trim(); + System.out.println(param); + + String[] array1 = param.split(","); + int count = array1.length; + String[] aSet = new String[count]; + int i = 0; + for (String str : array1) { + str = str.trim(); + if (fieldMap.get(param.toLowerCase()) == null) { + return "continue"; + } + aSet[i] = fieldMap.get(param.toLowerCase()).toString(); + i++; + } + + if (fieldMap.get(param.toLowerCase()) == null) { + return "continue"; + } + + String value = executeMethod(classStr, aSet); + fieldMap.put(whereParam.toLowerCase(), value); + fieldMap.put(whereParam.toUpperCase(), value); + fieldMap.put(whereParam, value); + return "execute"; + } + + public String whereHandle(String sqlWhere) { + return AweDoCommUtil.whereHandle(sqlWhere, fieldMap); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweFlow.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweFlow.java new file mode 100644 index 000000000..272c782e7 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweFlow.java @@ -0,0 +1,9 @@ +package apx.com.amarsoft.als.base.awe.controller; + +import apx.com.amarsoft.als.base.flow.Flow; + +public class AweFlow extends Flow { + public AweFlow(String flowNo) { + super.sFlowNo = flowNo; + } +} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweTree.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweTree.java new file mode 100644 index 000000000..edaccc4a3 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/AweTree.java @@ -0,0 +1,9 @@ +package apx.com.amarsoft.als.base.awe.controller; + +import apx.com.amarsoft.als.base.tree.Tree; + +public class AweTree extends Tree { + public AweTree(String code) { + super.CODE = code; + } +} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/DefaultDoManage.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/DefaultDoManage.java new file mode 100644 index 000000000..063b8e645 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/DefaultDoManage.java @@ -0,0 +1,46 @@ +package apx.com.amarsoft.als.base.awe.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoQueryManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public class DefaultDoManage extends AbstractAweDoQueryManage { + private String sAddWhere; + private String dono; + private Map fieldMap; + + public void setFieldMap(Map fieldMap) { + this.fieldMap = fieldMap; + } + + public void setDono(String dono) { + this.dono = dono; + } + + public void getGroupId() { + sGroupId = this.dono; + } + + public void getOtherWhere() { + super.sOtherWhere = StringX.isSpace(sAddWhere) ? "" + : this.sAddWhere; + } + + public void setsAddWhere(String sAddWhere) { + this.sAddWhere = sAddWhere; + } + + public Map queryDefaultDo(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + setParamMap(fieldMap); + return getData(request, sqlca, tx, ReturnMapUtil); + } +} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/DefaultSaveDoManage.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/DefaultSaveDoManage.java new file mode 100644 index 000000000..0d9e56f5f --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/DefaultSaveDoManage.java @@ -0,0 +1,43 @@ +package apx.com.amarsoft.als.base.awe.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.base.util.ReturnMapUtil; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoSaveManage; + +public class DefaultSaveDoManage extends AbstractAweDoSaveManage { + private String addWhere; + private String dono; + private Map fieldMap; + private ASUser curUser; + + public void setFieldMap(Map fieldMap) { + this.fieldMap = fieldMap; + } + + public void setCurUser(ASUser curUser) { + this.curUser = curUser; + } + + public void setDono(String dono) { + this.dono = dono; + } + + public void setAddWhere(String addWhere) { + this.addWhere = addWhere; + } + + public Map DefaultSave(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx, + ReturnMapUtil ReturnMapUtil) throws Exception { + return saveBusiness(sqlca, tx, dono, fieldMap, curUser.getUserID(), + addWhere, ReturnMapUtil); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/ReloadCacheAllController.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/ReloadCacheAllController.java new file mode 100644 index 000000000..e93a17475 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/controller/ReloadCacheAllController.java @@ -0,0 +1,35 @@ +package apx.com.amarsoft.als.base.awe.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import com.amarsoft.app.util.ReloadCacheConfigAction; +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.util.ReturnMapUtil; + +@Path("/load") +public class ReloadCacheAllController { + @Path("/cache") + @GET + public Map loadCachePro(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] ReloadCacheAllController run ................."); + ARE.getLog().info( + "[Path] /load/cache" + " run ................."); + ReloadCacheConfigAction ReloadCacheConfigAction = new ReloadCacheConfigAction(); + ReloadCacheConfigAction.reloadCacheAll(); + ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty.get("success").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/execute/util/ApplyManagerUtil.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/execute/util/ApplyManagerUtil.java new file mode 100644 index 000000000..aede1ce7a --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/execute/util/ApplyManagerUtil.java @@ -0,0 +1,52 @@ +package apx.com.amarsoft.als.base.awe.execute.util; + +import java.util.Map; + +import com.amarsoft.biz.workflow.ApplyManager; +import com.amarsoft.context.ASUser; + +public class ApplyManagerUtil { + public Map fieldMap; + + public void setFieldMap(Map fieldMap) { + this.fieldMap = fieldMap; + } + private ApplyManager applyManager; + + public ApplyManager getApplyManager() { + return this.applyManager; + } + + public String getWhereClause() { + return this.applyManager.getWhereClause(); + } + + public String getDono() { + return this.applyManager.getDono(); + } + + public ApplyManagerUtil(Map fieldMap) + throws Exception { + String userId = fieldMap.get("userid") == null ? "" : fieldMap.get( + "userid").toString(); + ASUser CurUser = new ASUser(userId); + String sApplyType = fieldMap.get("applytype") == null ? "" : fieldMap + .get("applytype").toString(); + String sPhaseType = fieldMap.get("phasetype") == null ? "" : fieldMap + .get("phasetype").toString(); + this.applyManager = new ApplyManager(sApplyType, sPhaseType, + CurUser); + } + + public ApplyManagerUtil() throws Exception { + String userId = fieldMap.get("userid") == null ? "" : fieldMap.get( + "userid").toString(); + ASUser CurUser = new ASUser(userId); + String sApplyType = fieldMap.get("applytype") == null ? "" : fieldMap + .get("applytype").toString(); + String sPhaseType = fieldMap.get("phasetype") == null ? "" : fieldMap + .get("phasetype").toString(); + this.applyManager = new ApplyManager(sApplyType, sPhaseType, + CurUser); + } +} diff --git a/src_app/apx/com/amarsoft/als/base/awe/model/AppBusinessGroupModel.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/model/AppBusinessGroupModel.java similarity index 96% rename from src_app/apx/com/amarsoft/als/base/awe/model/AppBusinessGroupModel.java rename to src_app_fresh/apx/com/amarsoft/als/base/awe/model/AppBusinessGroupModel.java index 6146fb4f3..503fd1aa6 100644 --- a/src_app/apx/com/amarsoft/als/base/awe/model/AppBusinessGroupModel.java +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/model/AppBusinessGroupModel.java @@ -1,169 +1,168 @@ -package apx.com.amarsoft.als.base.awe.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import apx.com.amarsoft.als.base.util.BizObjectUtil; - -import com.amarsoft.are.ARE; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; - -public class AppBusinessGroupModel implements Serializable { - private static final long serialVersionUID = 5267767941045672191L; - // APP_GROUP - private String sGroupCode; // 页签号 - private String sGroupName; // APP所显示的页签名 - private String sFlowNo; // 该页签 所绑定的流程号 - private String sPhaseNo; // 该页签 所绑定的节点号 - private String sIsList; // 该页签 Y表示列表 N表示表单 - private String sGroupPosition; // 该页签所在排序位置 - - private List> oElements; // 该页签所有元素属性 - - public AppBusinessGroupModel(String sGroupCode) { - if (sGroupCode.length() > 0) - loadAppBusinessGroup(sGroupCode); - } - - protected synchronized void loadAppBusinessGroup(String sGroupCode) { - ARE.getLog() - .info("======================================= begin:loadAppBusinessGroup 开始======================================"); - try { - BizObjectManager bom = JBOFactory - .getBizObjectManager("jbo.app.APP_BUSINESS_GROUP"); - BizObjectQuery boq = bom.createQuery("GROUP_CODE=:GROUP_CODE") - .setParameter("GROUP_CODE", sGroupCode); - BizObject bo = boq.getSingleResult(false); - if (bo == null) { - ARE.getLog() - .info("======================================= end:loadAppBusinessGroup 失败======================================"); - this.sGroupCode = ""; - this.sGroupName = ""; - this.sFlowNo = ""; - this.sPhaseNo = ""; - this.sIsList = ""; - this.sGroupPosition = ""; - this.oElements = new ArrayList>(); - return ; - } - BizObjectUtil util = new BizObjectUtil(); - Map oAppBusinessGroup = util.bizObject2MapValue(bo); - this.sGroupCode = oAppBusinessGroup.get("GROUP_CODE".toLowerCase()) == null ? "" - : oAppBusinessGroup.get("GROUP_CODE".toLowerCase()) - .toString(); - this.sGroupName = oAppBusinessGroup.get("GROUP_NAME".toLowerCase()) == null ? "" - : oAppBusinessGroup.get("GROUP_NAME".toLowerCase()) - .toString(); - this.sFlowNo = oAppBusinessGroup.get("FLOWNO".toLowerCase()) == null ? "" - : oAppBusinessGroup.get("FLOWNO".toLowerCase()).toString(); - this.sPhaseNo = oAppBusinessGroup.get("PHASENO".toLowerCase()) == null ? "" - : oAppBusinessGroup.get("PHASENO".toLowerCase()).toString(); - this.sIsList = oAppBusinessGroup.get("ISLIST".toLowerCase()) == null ? "" - : oAppBusinessGroup.get("ISLIST".toLowerCase()).toString(); - this.sGroupPosition = oAppBusinessGroup.get("GROUP_POSITION" - .toLowerCase()) == null ? "" : oAppBusinessGroup.get( - "GROUP_POSITION".toLowerCase()).toString(); - this.oElements = new ArrayList>(); - BizObjectManager bom1 = JBOFactory - .getBizObjectManager("jbo.app.APP_BUSINESS_TEMPLATE"); - BizObjectQuery boq1 = bom1.createQuery( - "GROUP_CODE=:GROUP_CODE ORDER BY DATA_POSITION") - .setParameter("GROUP_CODE", sGroupCode); - @SuppressWarnings("unchecked") - List bos = boq1.getResultList(false); - for (BizObject bo1 : bos) { - Map oElement = new HashMap(); - Map oTemplate = util.bizObject2MapValue(bo1); - AppBusinessTemplateModel oTemplateModel = new AppBusinessTemplateModel(); - oTemplateModel.setsDataCode(oTemplate.get("DATA_CODE" - .toLowerCase()) == null ? "" : oTemplate.get( - "DATA_CODE".toLowerCase()).toString()); - oTemplateModel.setsDataName(oTemplate.get("DATA_NAME" - .toLowerCase()) == null ? "" : oTemplate.get( - "DATA_NAME".toLowerCase()).toString()); - oTemplateModel.setsGroupCode(oTemplate.get("GROUP_CODE" - .toLowerCase()) == null ? "" : oTemplate.get( - "GROUP_CODE".toLowerCase()).toString()); - oTemplateModel.setsIsConvert(oTemplate.get("ISCONVERT" - .toLowerCase()) == null ? "" : oTemplate.get( - "ISCONVERT".toLowerCase()).toString()); - oTemplateModel - .setsIsList(oTemplate.get("ISLIST".toLowerCase()) == null ? "" - : oTemplate.get("ISLIST".toLowerCase()) - .toString()); - oTemplateModel - .setsIsShow(oTemplate.get("ISSHOW".toLowerCase()) == null ? "" - : oTemplate.get("ISSHOW".toLowerCase()) - .toString()); - oTemplateModel.setsPosition(oTemplate.get("DATA_POSITION" - .toLowerCase()) == null ? "" : oTemplate.get( - "DATA_POSITION".toLowerCase()).toString()); - oTemplateModel.setsColIndex(oTemplate.get("COLINDEX" - .toLowerCase()) == null ? "" : oTemplate.get( - "COLINDEX".toLowerCase()).toString()); - oTemplateModel.setsColName(oTemplate.get("COLNAME" - .toLowerCase()) == null ? "" : oTemplate.get( - "COLNAME".toLowerCase()).toString()); - oTemplateModel - .setsSortNo(oTemplate.get("SORTNO".toLowerCase()) == null ? "" - : oTemplate.get("SORTNO".toLowerCase()) - .toString()); - oTemplateModel - .setsDono(oTemplate.get("DONO".toLowerCase()) == null ? "" - : oTemplate.get("DONO".toLowerCase()) - .toString()); - oElement.put("TEMP".toLowerCase(), oTemplateModel); - oElements.add(oElement); - } - ARE.getLog() - .info("======================================= end:loadAppBusinessGroup 成功======================================"); - } catch (JBOException e) { - ARE.getLog() - .info("======================================= end:loadAppBusinessGroup 失败======================================"); - ARE.getLog().error("error > ", e); - this.sGroupCode = ""; - this.sGroupName = ""; - this.sFlowNo = ""; - this.sPhaseNo = ""; - this.sIsList = ""; - this.sGroupPosition = ""; - this.oElements = new ArrayList>(); - } - } - - public String getsGroupCode() { - return sGroupCode; - } - - public String getsGroupName() { - return sGroupName; - } - - public String getsFlowNo() { - return sFlowNo; - } - - public String getsPhaseNo() { - return sPhaseNo; - } - - public String getsIsList() { - return sIsList; - } - - public String getsGroupPosition() { - return sGroupPosition; - } - - public List> getoElements() { - return oElements; - } - -} +package apx.com.amarsoft.als.base.awe.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.base.util.BizObjectUtil; + +public class AppBusinessGroupModel implements Serializable { + private static final long serialVersionUID = 5267767941045672191L; + // APP_GROUP + private String sGroupCode; // 页签号 + private String sGroupName; // APP所显示的页签名 + private String sFlowNo; // 该页签 所绑定的流程号 + private String sPhaseNo; // 该页签 所绑定的节点号 + private String sIsList; // 该页签 Y表示列表 N表示表单 + private String sGroupPosition; // 该页签所在排序位置 + + private List> oElements; // 该页签所有元素属性 + + public AppBusinessGroupModel(String sGroupCode) { + if (sGroupCode.length() > 0) + loadAppBusinessGroup(sGroupCode); + } + + protected synchronized void loadAppBusinessGroup(String sGroupCode) { + ARE.getLog() + .info("======================================= begin:loadAppBusinessGroup 开始======================================"); + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.APP_BUSINESS_GROUP"); + BizObjectQuery boq = bom.createQuery("GROUP_CODE=:GROUP_CODE") + .setParameter("GROUP_CODE", sGroupCode); + BizObject bo = boq.getSingleResult(false); + if (bo == null) { + ARE.getLog() + .info("======================================= end:loadAppBusinessGroup 失败======================================"); + this.sGroupCode = ""; + this.sGroupName = ""; + this.sFlowNo = ""; + this.sPhaseNo = ""; + this.sIsList = ""; + this.sGroupPosition = ""; + this.oElements = new ArrayList>(); + return ; + } + BizObjectUtil util = new BizObjectUtil(); + Map oAppBusinessGroup = util.bizObject2MapValue(bo); + this.sGroupCode = oAppBusinessGroup.get("GROUP_CODE".toLowerCase()) == null ? "" + : oAppBusinessGroup.get("GROUP_CODE".toLowerCase()) + .toString(); + this.sGroupName = oAppBusinessGroup.get("GROUP_NAME".toLowerCase()) == null ? "" + : oAppBusinessGroup.get("GROUP_NAME".toLowerCase()) + .toString(); + this.sFlowNo = oAppBusinessGroup.get("FLOWNO".toLowerCase()) == null ? "" + : oAppBusinessGroup.get("FLOWNO".toLowerCase()).toString(); + this.sPhaseNo = oAppBusinessGroup.get("PHASENO".toLowerCase()) == null ? "" + : oAppBusinessGroup.get("PHASENO".toLowerCase()).toString(); + this.sIsList = oAppBusinessGroup.get("ISLIST".toLowerCase()) == null ? "" + : oAppBusinessGroup.get("ISLIST".toLowerCase()).toString(); + this.sGroupPosition = oAppBusinessGroup.get("GROUP_POSITION" + .toLowerCase()) == null ? "" : oAppBusinessGroup.get( + "GROUP_POSITION".toLowerCase()).toString(); + this.oElements = new ArrayList>(); + BizObjectManager bom1 = JBOFactory + .getBizObjectManager("jbo.app.APP_BUSINESS_TEMPLATE"); + BizObjectQuery boq1 = bom1.createQuery( + "GROUP_CODE=:GROUP_CODE ORDER BY DATA_POSITION") + .setParameter("GROUP_CODE", sGroupCode); + @SuppressWarnings("unchecked") + List bos = boq1.getResultList(false); + for (BizObject bo1 : bos) { + Map oElement = new HashMap(); + Map oTemplate = util.bizObject2MapValue(bo1); + AppBusinessTemplateModel oTemplateModel = new AppBusinessTemplateModel(); + oTemplateModel.setsDataCode(oTemplate.get("DATA_CODE" + .toLowerCase()) == null ? "" : oTemplate.get( + "DATA_CODE".toLowerCase()).toString()); + oTemplateModel.setsDataName(oTemplate.get("DATA_NAME" + .toLowerCase()) == null ? "" : oTemplate.get( + "DATA_NAME".toLowerCase()).toString()); + oTemplateModel.setsGroupCode(oTemplate.get("GROUP_CODE" + .toLowerCase()) == null ? "" : oTemplate.get( + "GROUP_CODE".toLowerCase()).toString()); + oTemplateModel.setsIsConvert(oTemplate.get("ISCONVERT" + .toLowerCase()) == null ? "" : oTemplate.get( + "ISCONVERT".toLowerCase()).toString()); + oTemplateModel + .setsIsList(oTemplate.get("ISLIST".toLowerCase()) == null ? "" + : oTemplate.get("ISLIST".toLowerCase()) + .toString()); + oTemplateModel + .setsIsShow(oTemplate.get("ISSHOW".toLowerCase()) == null ? "" + : oTemplate.get("ISSHOW".toLowerCase()) + .toString()); + oTemplateModel.setsPosition(oTemplate.get("DATA_POSITION" + .toLowerCase()) == null ? "" : oTemplate.get( + "DATA_POSITION".toLowerCase()).toString()); + oTemplateModel.setsColIndex(oTemplate.get("COLINDEX" + .toLowerCase()) == null ? "" : oTemplate.get( + "COLINDEX".toLowerCase()).toString()); + oTemplateModel.setsColName(oTemplate.get("COLNAME" + .toLowerCase()) == null ? "" : oTemplate.get( + "COLNAME".toLowerCase()).toString()); + oTemplateModel + .setsSortNo(oTemplate.get("SORTNO".toLowerCase()) == null ? "" + : oTemplate.get("SORTNO".toLowerCase()) + .toString()); + oTemplateModel + .setsDono(oTemplate.get("DONO".toLowerCase()) == null ? "" + : oTemplate.get("DONO".toLowerCase()) + .toString()); + oElement.put("TEMP".toLowerCase(), oTemplateModel); + oElements.add(oElement); + } + ARE.getLog() + .info("======================================= end:loadAppBusinessGroup 成功======================================"); + } catch (JBOException e) { + ARE.getLog() + .info("======================================= end:loadAppBusinessGroup 失败======================================"); + ARE.getLog().error("error > ", e); + this.sGroupCode = ""; + this.sGroupName = ""; + this.sFlowNo = ""; + this.sPhaseNo = ""; + this.sIsList = ""; + this.sGroupPosition = ""; + this.oElements = new ArrayList>(); + } + } + + public String getsGroupCode() { + return sGroupCode; + } + + public String getsGroupName() { + return sGroupName; + } + + public String getsFlowNo() { + return sFlowNo; + } + + public String getsPhaseNo() { + return sPhaseNo; + } + + public String getsIsList() { + return sIsList; + } + + public String getsGroupPosition() { + return sGroupPosition; + } + + public List> getoElements() { + return oElements; + } + +} diff --git a/src_app/apx/com/amarsoft/als/base/awe/model/AppBusinessTemplateModel.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/model/AppBusinessTemplateModel.java similarity index 95% rename from src_app/apx/com/amarsoft/als/base/awe/model/AppBusinessTemplateModel.java rename to src_app_fresh/apx/com/amarsoft/als/base/awe/model/AppBusinessTemplateModel.java index 4ca5b8c86..e6780b648 100644 --- a/src_app/apx/com/amarsoft/als/base/awe/model/AppBusinessTemplateModel.java +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/model/AppBusinessTemplateModel.java @@ -1,109 +1,109 @@ -package apx.com.amarsoft.als.base.awe.model; - -import java.io.Serializable; - -public class AppBusinessTemplateModel implements Serializable { - private static final long serialVersionUID = -4642124885038279421L; - // APP_GROUP_TEMPLATE - private String sGroupCode; // 分组号 - private String sDataName; // APP显示表单元素名 - private String sDataCode; // 表单元素号 - private String sIsList; // 是否列表显示 - private String sIsShow; // 分是否表单显示 - private String sPosition; // 分组模板数据位置 - private String sIsConvert; // 预留字段 - - private String sDono; - private String sSortNo; - private String sColIndex; - private String sColName; - - public String getsGroupCode() { - return sGroupCode; - } - - public String getsDataName() { - return sDataName; - } - - public String getsDataCode() { - return sDataCode; - } - - public String getsIsList() { - return sIsList; - } - - public String getsIsShow() { - return sIsShow; - } - - public String getsPosition() { - return sPosition; - } - - public String getsIsConvert() { - return sIsConvert; - } - - public void setsGroupCode(String sGroupCode) { - this.sGroupCode = sGroupCode; - } - - public void setsDataName(String sDataName) { - this.sDataName = sDataName; - } - - public void setsDataCode(String sDataCode) { - this.sDataCode = sDataCode; - } - - public void setsIsList(String sIsList) { - this.sIsList = sIsList; - } - - public void setsIsShow(String sIsShow) { - this.sIsShow = sIsShow; - } - - public void setsPosition(String sPosition) { - this.sPosition = sPosition; - } - - public void setsIsConvert(String sIsConvert) { - this.sIsConvert = sIsConvert; - } - - public String getsSortNo() { - return sSortNo; - } - - public String getsColIndex() { - return sColIndex; - } - - public String getsColName() { - return sColName; - } - - public void setsSortNo(String sSortNo) { - this.sSortNo = sSortNo; - } - - public void setsColIndex(String sColIndex) { - this.sColIndex = sColIndex; - } - - public void setsColName(String sColName) { - this.sColName = sColName; - } - - public String getsDono() { - return sDono; - } - - public void setsDono(String sDono) { - this.sDono = sDono; - } - -} +package apx.com.amarsoft.als.base.awe.model; + +import java.io.Serializable; + +public class AppBusinessTemplateModel implements Serializable { + private static final long serialVersionUID = -4642124885038279421L; + // APP_GROUP_TEMPLATE + private String sGroupCode; // 分组号 + private String sDataName; // APP显示表单元素名 + private String sDataCode; // 表单元素号 + private String sIsList; // 是否列表显示 + private String sIsShow; // 分是否表单显示 + private String sPosition; // 分组模板数据位置 + private String sIsConvert; // 预留字段 + + private String sDono; + private String sSortNo; + private String sColIndex; + private String sColName; + + public String getsGroupCode() { + return sGroupCode; + } + + public String getsDataName() { + return sDataName; + } + + public String getsDataCode() { + return sDataCode; + } + + public String getsIsList() { + return sIsList; + } + + public String getsIsShow() { + return sIsShow; + } + + public String getsPosition() { + return sPosition; + } + + public String getsIsConvert() { + return sIsConvert; + } + + public void setsGroupCode(String sGroupCode) { + this.sGroupCode = sGroupCode; + } + + public void setsDataName(String sDataName) { + this.sDataName = sDataName; + } + + public void setsDataCode(String sDataCode) { + this.sDataCode = sDataCode; + } + + public void setsIsList(String sIsList) { + this.sIsList = sIsList; + } + + public void setsIsShow(String sIsShow) { + this.sIsShow = sIsShow; + } + + public void setsPosition(String sPosition) { + this.sPosition = sPosition; + } + + public void setsIsConvert(String sIsConvert) { + this.sIsConvert = sIsConvert; + } + + public String getsSortNo() { + return sSortNo; + } + + public String getsColIndex() { + return sColIndex; + } + + public String getsColName() { + return sColName; + } + + public void setsSortNo(String sSortNo) { + this.sSortNo = sSortNo; + } + + public void setsColIndex(String sColIndex) { + this.sColIndex = sColIndex; + } + + public void setsColName(String sColName) { + this.sColName = sColName; + } + + public String getsDono() { + return sDono; + } + + public void setsDono(String sDono) { + this.sDono = sDono; + } + +} diff --git a/src_app/apx/com/amarsoft/als/base/awe/model/AweDoCataLogModel.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/model/AweDoCataLogModel.java similarity index 94% rename from src_app/apx/com/amarsoft/als/base/awe/model/AweDoCataLogModel.java rename to src_app_fresh/apx/com/amarsoft/als/base/awe/model/AweDoCataLogModel.java index 07de0bdb8..76c198354 100644 --- a/src_app/apx/com/amarsoft/als/base/awe/model/AweDoCataLogModel.java +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/model/AweDoCataLogModel.java @@ -1,111 +1,113 @@ -package apx.com.amarsoft.als.base.awe.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.amarsoft.are.ARE; - -import apx.com.amarsoft.als.base.constant.cache.AppAweDoCache; - -public class AweDoCataLogModel implements Serializable { - private static final long serialVersionUID = 6520122901254597634L; - - // AWE_DO_CATALOG - private String sDoName; // 获取当前模板名称 - private String sDono; // 获取当前分组模板号 - private String sJboClass; // JBO对象名 - private String sJboFrom; // JBOFROM子句 - private String sJboWhere; // JBOWHERE子句 - private String sJboOrder; // JBOGROUP子句 - private String sJboGroup; // JBOORDER子句 - private String sBusinessProcess; // 业务事件 - private String sIsValidate; // 是否校验 - // AWE_DO_LIBRARY - private List> oLibrary; - - public AweDoCataLogModel(String sDono) { - if (sDono.length() > 0) - initAweDoCataLog(sDono); - } - - @SuppressWarnings("unchecked") - protected synchronized void initAweDoCataLog(String sDono) { - ARE.getLog() - .info("======================================= begin:initAweDoCataLog 开始======================================"); - Map aweDoCache = (Map) AppAweDoCache - .getAppAweDoCachePool().get(sDono); - if (aweDoCache == null) { - aweDoCache = new HashMap(); - } - - this.sDono = aweDoCache.get("DONO".toLowerCase()) == null ? "" - : aweDoCache.get("DONO".toLowerCase()).toString(); - this.sDoName = aweDoCache.get("DONAME".toLowerCase()) == null ? "" - : aweDoCache.get("DONAME".toLowerCase()).toString(); - this.sJboClass = aweDoCache.get("JBOCLASS".toLowerCase()) == null ? "" - : aweDoCache.get("JBOCLASS".toLowerCase()).toString(); - this.sJboFrom = aweDoCache.get("JBOFROM".toLowerCase()) == null ? "" - : aweDoCache.get("JBOFROM".toLowerCase()).toString(); - this.sJboWhere = aweDoCache.get("JBOWHERE".toLowerCase()) == null ? "" - : aweDoCache.get("JBOWHERE".toLowerCase()).toString(); - this.sJboOrder = aweDoCache.get("JBOORDER".toLowerCase()) == null ? "" - : aweDoCache.get("JBOORDER".toLowerCase()).toString(); - this.sJboGroup = aweDoCache.get("JBOGROUP".toLowerCase()) == null ? "" - : aweDoCache.get("JBOGROUP".toLowerCase()).toString(); - this.sBusinessProcess = aweDoCache.get("BUSINESSPROCESS".toLowerCase()) == null ? "" - : aweDoCache.get("BUSINESSPROCESS".toLowerCase()).toString(); - this.sIsValidate = aweDoCache.get("ISVALIDATE".toLowerCase()) == null ? "" - : aweDoCache.get("ISVALIDATE".toLowerCase()).toString(); - this.oLibrary = (List>) (aweDoCache - .get("LIBRARY".toLowerCase()) == null ? new ArrayList>() - : aweDoCache.get("LIBRARY".toLowerCase())); - ARE.getLog() - .info("======================================= end initAweDoCataLog 成功======================================"); - } - - public String getsDoName() { - return sDoName; - } - - public String getsDono() { - return sDono; - } - - public String getsJboClass() { - return sJboClass; - } - - public String getsJboFrom() { - return sJboFrom; - } - - public String getsJboWhere() { - return sJboWhere; - } - - public String getsJboOrder() { - return sJboOrder; - } - - public String getsJboGroup() { - return sJboGroup; - } - - public String getsBusinessProcess() { - return sBusinessProcess; - } - - public String getsIsValidate() { - return sIsValidate; - } - - public List> getoLibrary() { - if (null == oLibrary) - oLibrary = new ArrayList>(); - return oLibrary; - } - -} +package apx.com.amarsoft.als.base.awe.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import apx.com.amarsoft.als.base.cache.instance.AppAweDoCache; + +import com.amarsoft.are.ARE; + +public class AweDoCataLogModel implements Serializable { + private static final long serialVersionUID = 6520122901254597634L; + + // AWE_DO_CATALOG + private String sDoName; // 获取当前模板名称 + private String sDono; // 获取当前分组模板号 + private String sJboClass; // JBO对象名 + private String sJboFrom; // JBOFROM子句 + private String sJboWhere; // JBOWHERE子句 + private String sJboOrder; // JBOGROUP子句 + private String sJboGroup; // JBOORDER子句 + private String sBusinessProcess; // 业务事件 + private String sIsValidate; // 是否校验 + // AWE_DO_LIBRARY + private List> oLibrary; + + public AweDoCataLogModel(String sDono) { + if (sDono == null) + sDono = ""; + if (sDono.length() > 0) + initAweDoCataLog(sDono); + } + + @SuppressWarnings("unchecked") + protected synchronized void initAweDoCataLog(String sDono) { + ARE.getLog() + .info("======================================= begin:initAweDoCataLog 开始======================================"); + Map aweDoCache = (Map) AppAweDoCache + .getAppAweDoCachePool().get(sDono); + if (aweDoCache == null) { + aweDoCache = new HashMap(); + } + + this.sDono = aweDoCache.get("DONO".toLowerCase()) == null ? "" + : aweDoCache.get("DONO".toLowerCase()).toString(); + this.sDoName = aweDoCache.get("DONAME".toLowerCase()) == null ? "" + : aweDoCache.get("DONAME".toLowerCase()).toString(); + this.sJboClass = aweDoCache.get("JBOCLASS".toLowerCase()) == null ? "" + : aweDoCache.get("JBOCLASS".toLowerCase()).toString(); + this.sJboFrom = aweDoCache.get("JBOFROM".toLowerCase()) == null ? "" + : aweDoCache.get("JBOFROM".toLowerCase()).toString(); + this.sJboWhere = aweDoCache.get("JBOWHERE".toLowerCase()) == null ? "" + : aweDoCache.get("JBOWHERE".toLowerCase()).toString(); + this.sJboOrder = aweDoCache.get("JBOORDER".toLowerCase()) == null ? "" + : aweDoCache.get("JBOORDER".toLowerCase()).toString(); + this.sJboGroup = aweDoCache.get("JBOGROUP".toLowerCase()) == null ? "" + : aweDoCache.get("JBOGROUP".toLowerCase()).toString(); + this.sBusinessProcess = aweDoCache.get("BUSINESSPROCESS".toLowerCase()) == null ? "" + : aweDoCache.get("BUSINESSPROCESS".toLowerCase()).toString(); + this.sIsValidate = aweDoCache.get("ISVALIDATE".toLowerCase()) == null ? "" + : aweDoCache.get("ISVALIDATE".toLowerCase()).toString(); + this.oLibrary = (List>) (aweDoCache + .get("LIBRARY".toLowerCase()) == null ? new ArrayList>() + : aweDoCache.get("LIBRARY".toLowerCase())); + ARE.getLog() + .info("======================================= end initAweDoCataLog 成功======================================"); + } + + public String getsDoName() { + return sDoName; + } + + public String getsDono() { + return sDono; + } + + public String getsJboClass() { + return sJboClass; + } + + public String getsJboFrom() { + return sJboFrom; + } + + public String getsJboWhere() { + return sJboWhere; + } + + public String getsJboOrder() { + return sJboOrder; + } + + public String getsJboGroup() { + return sJboGroup; + } + + public String getsBusinessProcess() { + return sBusinessProcess; + } + + public String getsIsValidate() { + return sIsValidate; + } + + public List> getoLibrary() { + if (null == oLibrary) + oLibrary = new ArrayList>(); + return oLibrary; + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/select/SelectCatalogWin.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/select/SelectCatalogWin.java new file mode 100644 index 000000000..4f990e02c --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/select/SelectCatalogWin.java @@ -0,0 +1,527 @@ +package apx.com.amarsoft.als.base.awe.select; + +import java.sql.ResultSetMetaData; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import javax.servlet.http.HttpServletRequest; + +import jbo.sys.SELECT_CATALOG; +import apx.com.amarsoft.als.base.cache.instance.AppCodeCache; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.ASResultSet; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; +import com.base.util.MultipartDataUtil; +import com.base.util.RequestUtil; + +public class SelectCatalogWin { + private String sSelName; + private boolean loadSelectflag = true; + private Map param; + + public boolean isLoadSelectflag() { + return loadSelectflag; + } + + public void setsSelName(String sSelName) { + this.sSelName = sSelName; + } + + public void setParam(String sKey, String sValue) { + this.param.put(sKey, sValue); + } + + private String sGlobalText; + + @SuppressWarnings("unchecked") + public SelectCatalogWin(String sSelName, JBOTransaction tx, + Transaction Sqlca, HttpServletRequest request) throws Exception { + param = new HashMap(); + String sRequestMethod = request.getMethod(); + Map paramMap1 = new HashMap(); + if (sRequestMethod.equalsIgnoreCase("GET")) { + paramMap1 = RequestUtil.convertRequestToMap(request); + } else { + this.param = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + this.param = (Map) this.param.get("fieldMap"); + } + if (param.size() > 0) { + for (String key : param.keySet()) { + if (key.toLowerCase().equals("globaltext")) { + sGlobalText = param.get("globaltext") == null ? null + : param.get("globaltext").toString(); + } else { + param.put(key.toLowerCase(), param.get(key)); + param.put(key.toUpperCase(), param.get(key)); + param.put(key, param.get(key)); + } + } + } + if (paramMap1.size() > 0) { + for (String key : paramMap1.keySet()) { + if (key.toLowerCase().equals("globaltext")) { + sGlobalText = paramMap1.get("globaltext") == null ? null + : paramMap1.get("globaltext").toString(); + } else { + param.put(key.toLowerCase(), paramMap1.get(key)); + param.put(key.toUpperCase(), paramMap1.get(key)); + param.put(key, paramMap1.get(key)); + } + } + } + this.sSelName = sSelName; + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager(SELECT_CATALOG.CLASS_NAME); + BizObjectQuery boq = bom.createQuery("SELNAME=:SELNAME") + .setParameter("SELNAME", this.sSelName); + BizObject bo = boq.getSingleResult(false); + + if (null == bo) { + this.loadSelectflag = false; + } + this.sSelDescribe = bo.getAttribute("SELDESCRIBE") == null ? "" + : bo.getAttribute("SELDESCRIBE").toString(); + this.sSelHideField = bo.getAttribute("SELHIDEFIELD") == null ? "" + : bo.getAttribute("SELHIDEFIELD").toString(); + this.sSelCode = bo.getAttribute("SELCODE") == null ? "" : bo + .getAttribute("SELCODE").toString(); + this.sSelFieldName = bo.getAttribute("SELFIELDNAME") == null ? "" + : bo.getAttribute("SELFIELDNAME").toString(); + this.sSelReturnValue = bo.getAttribute("SELRETURNVALUE") == null ? "" + : bo.getAttribute("SELRETURNVALUE").toString(); + // doTemp.setCheckFormat( + this.sAttribute3 = bo.getAttribute("Attribute3") == null ? "" : bo + .getAttribute("Attribute3").getString(); + // 若1则 doTemp.WhereClauseNoFilter += " and 1=2 "; + this.sAttribute4 = bo.getAttribute("Attribute4") == null ? "" : bo + .getAttribute("Attribute4").getString(); + // 设置下拉框来源 + this.sAttribute5 = bo.getAttribute("Attribute5") == null ? "" : bo + .getAttribute("Attribute5").getString(); + + this.sSelFilterField = bo.getAttribute("SelFilterField") == null ? "" + : bo.getAttribute("SelFilterField").getString(); + + } catch (Exception e) { + ARE.getLog().error(e); + this.loadSelectflag = false; + } + } + + private String sSelDescribe; + + private String sSelHideField; + + private String sSelCode; + + private String sSelFieldName; + + private String sSelReturnValue; + + private String sAttribute3; + private String sAttribute4; + private String sAttribute5; + private String sSelFilterField; + + public Map execute(JBOTransaction tx, Transaction Sqlca, + HttpServletRequest request) throws Exception { + return execute(tx, Sqlca, request, null); + } + + public Map execute(JBOTransaction tx, Transaction Sqlca, + HttpServletRequest request, String sOtherWhere) throws Exception { + Map map = new HashMap(); + if (!this.loadSelectflag) { + map.put("datas", map); + return map; + } + Map paramMap = new HashMap(); + + if (param.size() > 0) { + for (String key : param.keySet()) { + paramMap.put("#" + key, param.get(key)); + } + } + + map.put("describer", this.sSelDescribe); + String sql = this.sSelCode; + + if (paramMap.size() > 0) { + for (String sKey : paramMap.keySet()) { + sql = sql.replace(sKey, paramMap.get(sKey) == null ? "" + : paramMap.get(sKey).toString()); + } + } + sql = sql.trim(); + sql = sql.substring(0, 6) + " ROWNUM as tenwaROWNUM ,\r\n" + + sql.substring(7, sql.length()); + // KeyFilter加快查询速度 + StringTokenizer stFilter = new StringTokenizer(sAttribute4, "@"); + String sFilter = ""; + while (stFilter.hasMoreTokens()) { + String sFilterValue = stFilter.nextToken().trim(); + sFilter = sFilter + " " + sFilterValue; + } + sFilter = sFilter.trim(); + if (sFilter.length() > 0) { + // doTemp.setKeyFilter(sSelPrimaryKey); + String sSql = sql.toLowerCase(); + String sSFilter = sFilter.toLowerCase(); + if (sSql.contains("where") || sSFilter.contains("where")) { + sql += sFilter; + } else { + sql += " where " + sFilter; + } + } + String sql2 = " and ("; + // sGlobalText + if (sGlobalText != null && sGlobalText.length() > 0) + sGlobalText = sGlobalText.trim(); + if ((sGlobalText != null && sGlobalText.length() > 0) + && sSelFilterField.length() > 0) { + String sql3 = sql; + sql3 = sql3.toLowerCase(); + sql3 = sql3.substring(0, sql3.indexOf("from")); + String[] aArray = sSelFilterField.split(","); + int i = 0; + for (String sSelectFilter : aArray) { + String sTableName = sql3.substring(0, + sql3.indexOf(sSelectFilter.toLowerCase())); + sTableName = sTableName + .substring(sTableName.lastIndexOf(",") + 1); + if (i > 0) { + sql2 += " or "; + } + sql2 += sTableName + sSelectFilter + " like '%" + sGlobalText + + "%'"; + i++; + } + sql2 += ")"; + String sSql = sql.toLowerCase(); + String sSql2 = sql2.toLowerCase(); + if (sSql.contains("where") || sSql2.contains("where")) { + sql += sql2; + } else { + sql += " where " + sql2; + } + } + if (!StringX.isSpace(sOtherWhere)) { + String[] array = sOtherWhere.split("&"); + sql = sql.replace(array[0], array[1]); + } + sql = sql.trim(); + sql = sql.replace("\r\n", " "); + while (sql.contains(" ")) { + sql = sql.replace(" ", " "); + } + ARE.getLog().info("sql > " + sql); + String sPageIndex = request.getParameter("pageIndex"); + String sLimit = request.getParameter("limit"); + if (sPageIndex == null) + sPageIndex = "1"; + if (sLimit == null) + sLimit = "10"; + int iPageIndex, iLimit; + iPageIndex = Integer.valueOf(sPageIndex); + iPageIndex = iPageIndex - 1; + iLimit = Integer.valueOf(sLimit); + int pageIndexStart = (iPageIndex) * iLimit; + int pageIndexEnd = (iPageIndex + 1) * iLimit; + sql = "SELECT * FROM (" + sql + ") A WHERE tenwaROWNUM BETWEEN " + + pageIndexStart + " AND " + pageIndexEnd; + String[] aSelReturnValue = sSelReturnValue.split("@"); + String[] aSelFieldName = sSelFieldName.split(","); + String[] aSelHideField = sSelHideField.split(","); + String sFilters = ""; + + String sql1 = sql.toLowerCase(); + List> hms = new ArrayList>(); + if (sql1.startsWith("select")) { + ASResultSet rs = null; + SqlObject sqlObject = new SqlObject(sql); + rs = Sqlca.getResultSet(sqlObject); + while (rs.next()) { + ResultSetMetaData rsmd = rs.getMetaData(); + Map row = new HashMap(); + int count = rsmd.getColumnCount(); + List> colList = new ArrayList>(); + for (int i = 1; i <= count; i++) { + int k = 0; + Map col = new HashMap(); + String key = rsmd.getColumnLabel(i); + if (key.toUpperCase().equals("tenwaROWNUM".toUpperCase())) { + k = i; + continue; + } + int index = k == 0 ? i : i + 1; + String value = rs.getString(index); + col.put("code", key); + col.put("value", value); + col.put("itemno", value); + col.put("isHidden", false); + col.put("isReturn", false); + if (sAttribute5.length() > 0) { + querySource(sAttribute5, col, tx, Sqlca); + } + col.put("colcheckformat", "1"); + if (sAttribute3.length() > 0) { + colCheckFormart(sAttribute3, col); + } + + // 隐藏域 , + for (String str : aSelHideField) { + if (str.equalsIgnoreCase(key)) { + col.put("isHidden", true); + break; + } + } + // 返回域 @ + for (String str : aSelReturnValue) { + if (str.equalsIgnoreCase(key)) { + col.put("isReturn", true); + break; + } + } + // 显示名 , + col.put("display", aSelFieldName[index - 2]); + colList.add(col); + } + row.put("row", colList); + hms.add(row); + } + } else { + boolean bResult = Sqlca.equals(new SqlObject(sql)); + map.put("executeResult", bResult); + } + List> list = new ArrayList>(); + int j = 0; + for (Map cache : hms) { + cache = hms.get(j); + list.add(cache); + j++; + } + sFilters = takeFilterName(sSelFilterField, sSelFieldName, sSelCode, + Sqlca, sOtherWhere); + sFilters = sFilters.trim(); + if (sFilters.endsWith(",")) + sFilters = sFilters.substring(0, sFilters.length() - 1); + map.put("selFilterField", sFilters); + map.put("datas", list); + return map; + } + + // begin 字段处理 + /** + * + * 获取过滤中文字符串 + * + * @param sStr + * 过滤字段. + * @param sStr2 + * 显示中文名. + * @param sql + * @param sqlca + * @return String filter name 过滤字段中文名. + * @throws Exception + */ + private static String takeFilterName(String sStr, String sStr2, String sql, + Transaction sqlca, String sOtherWhere) throws Exception { + if (!StringX.isSpace(sOtherWhere)) { + String[] array = sOtherWhere.split("&"); + sql = sql.replace(array[0], array[1]); + } + sql = sql.trim(); + sql = sql.replace("\r\n", " "); + while (sql.contains(" ")) { + sql = sql.replace(" ", " "); + } + String sSql = sql; + sSql = sSql.trim(); + if (StringX.isSpace(sStr) || StringX.isSpace(sStr2) + || StringX.isSpace(sSql)) { + return ""; + } + String sSqlContext = sSql; + sSqlContext = sSqlContext.toLowerCase(); + if (sSqlContext.contains("group by")) { + String sSqlContextGroupAfter = sSqlContext.substring( + sSqlContext.lastIndexOf("group by")).trim(); + String sSqlContextGroupBefore = sSqlContext.substring(0, + sSqlContext.lastIndexOf("group by")).trim(); + if (sSqlContextGroupBefore.contains(" where ")) { + sSqlContextGroupBefore += " and 1=2"; + } else { + sSqlContextGroupBefore += " where 1=2"; + } + sSql = sSqlContextGroupBefore + " " + sSqlContextGroupAfter; + } else { + if (sSqlContext.contains("order by")) { + String sSqlContextOrderAfter = sSqlContext.substring( + sSqlContext.lastIndexOf("order by")).trim(); + String sSqlContextOrderBefore = sSqlContext.substring(0, + sSqlContext.lastIndexOf("order by")).trim(); + if (sSqlContextOrderBefore.contains(" where ")) { + sSqlContextOrderBefore += " and 1=2"; + } else { + sSqlContextOrderBefore += " where 1=2"; + } + sSql = sSqlContextOrderBefore + " " + sSqlContextOrderAfter; + } + } + String sFilters = ""; + String[] aSelFieldName = sStr2.split(","); + ASResultSet rs = null; + SqlObject sqlObject = new SqlObject(sSql); + rs = sqlca.getResultSet(sqlObject); + ResultSetMetaData rsmd = rs.getMetaData(); + int count = rsmd.getColumnCount(); + for (int i = 1; i <= count; i++) { + String key = rsmd.getColumnLabel(i); + String[] array = sStr.split(","); + for (String sKey : array) { + if (sKey.toLowerCase().equals(key.toLowerCase().toLowerCase())) { + sFilters += aSelFieldName[i - 1] + ","; + } + } + } + + return sFilters; + } + + /** + * + * 获取字段格式 + * + * @param sStr + * sAttribute3 + * @param col + */ + @SuppressWarnings("unused") + private static void colCheckFormart(String sStr, Map col) { + String sCode = col.get("code").toString(); + StringTokenizer stFilter = new StringTokenizer(sStr, "@"); + List> list = new ArrayList>(); + while (stFilter.hasMoreTokens()) { + String sColumnList = stFilter.nextToken().trim(); + String sCheckFormart = stFilter.nextToken().trim(); + sCheckFormart = sCheckFormart == null ? "" : sCheckFormart; + sCheckFormart = sCheckFormart.trim(); + sCheckFormart = sCheckFormart.equals("") ? "1" : sCheckFormart; + if (sCode.equals(sColumnList)) { + col.put("colcheckformat", sCheckFormart); + } + } + } + + /** + * + * 获取字段来源 + * + * @param sStr + * sAttribute5 + * @param col + * @param tx + * @param sqlca + * @throws Exception + */ + private static void querySource(String sStr, Map col, + JBOTransaction tx, Transaction sqlca) throws Exception { + String sCode = col.get("code").toString(); + StringTokenizer stFilter = new StringTokenizer(sStr, "@"); + List> list = new ArrayList>(); + while (stFilter.hasMoreTokens()) { + String sFilterOptions = null; + String sColumnList = stFilter.nextToken().trim(); + String sSourceType = stFilter.nextToken().trim(); + String sSource = stFilter.nextToken().trim(); + if (stFilter.hasMoreTokens()) + sFilterOptions = stFilter.nextToken().trim(); + Map map = new HashMap(); + // map.put("col", sColumnList); + map.put("type", sSourceType); + map.put("source", sSource); + map.put("sFilterOptions", sFilterOptions); + if (sCode.toUpperCase().equals(sColumnList.toUpperCase())) + list.add(map); + } + for (Map map : list) { + System.out.println("col:" + map.get("col") + ", type:" + + map.get("type") + "source:" + map.get("source")); + queryprocess(map, col, tx, sqlca); + } + } + + @SuppressWarnings("unchecked") + private static void queryprocess(Map map, + Map col, JBOTransaction tx, Transaction sqlca) + throws Exception { + String sValue = col.get("value").toString(); + // String sColumnList = map.get("col").toString(); + String sSourceType = map.get("type").toString(); + String sSource = map.get("source").toString(); + if ("code".equalsIgnoreCase(sSourceType)) { + List> codeLibrary = null; + try { + codeLibrary = (List>) ((Map) AppCodeCache + .getAppCodeCachePool().get(sSource)).get("library"); + } catch (Exception e) { + col.put("value", sValue); + } + if (codeLibrary != null) { + for (Map code : codeLibrary) { + String sItemNo = code.get("ITEMNO".toLowerCase()) == null ? "" + : code.get("ITEMNO".toLowerCase()).toString(); + if (sItemNo.trim().toLowerCase().equals(sValue)) { + String sItemName = code.get("ITEMNAME".toLowerCase()) == null ? "" + : code.get("ITEMNAME".toLowerCase()).toString(); + col.put("value", sItemName); + break; + } + } + } + } else if ("sql".equalsIgnoreCase(sSourceType)) { + try { + String sSource1 = sSource; + sSource1 = sSource1.trim(); + sSource1 = sSource1.substring(sSource1.indexOf(" "), + sSource1.length()); + sSource1 = sSource1.trim(); + sSource1 = sSource1.substring(0, sSource1.indexOf(" ")); + sSource1 = sSource1.trim(); + String[] array = sSource1.split(","); + String itemno = array[0].trim(); + String itemname = array[1].trim(); + + ASResultSet rs = null; + SqlObject sqlObject = new SqlObject(sSource); + rs = sqlca.getResultSet(sqlObject); + while (rs.next()) { + String sItemNo = rs.getStringValue(itemno).toString(); + String sItemName = rs.getStringValue(itemname).toString(); + if (sItemNo.equals(sValue)) { + col.put("value", sItemName); + break; + } + } + } catch (Exception e) { + col.put("value", sValue); + } + } else if ("codetable".equalsIgnoreCase(sSourceType)) { + + } + } + // end +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/util/AweDoCommUtil.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/util/AweDoCommUtil.java new file mode 100644 index 000000000..c6cdc98bb --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/util/AweDoCommUtil.java @@ -0,0 +1,132 @@ +package apx.com.amarsoft.als.base.awe.util; + +import java.util.HashMap; +import java.util.Map; + +import com.amarsoft.are.util.SpecialTools; + +public class AweDoCommUtil { + public static void main(String[] args) throws Exception { + + System.out.println(SpecialTools.real2Amarsoft("123 ")); + + + String str = "((EXISTS( SELECT * FROM jbo.com .tenwa.lease.comm.LB_GUARANTEE_UNIT lgu " + + "WHERE lgu.CONTRACT_ID=O.CONTRACT_ID AND lgu.ASSUROR=:customerid) " + + "OR EXISTS( SELECT * FROM jbo.com .tenwa.lease.comm.LB_UNION_LESSEE lul " + + "WHERE lul.CONTRACT_ID=O.CONTRACT_ID AND lul.CUSTOMER_ID=:customerid)))"; + + + Map map = new HashMap(); + map.put("ASSUROR", "123"); + map.put("ASSUROR".toLowerCase(), "123"); + map.put("CUSTOMER_ID", "123"); + map.put("CUSTOMER_ID".toLowerCase(), "123"); + System.out.println(whereHandle(str, map)); + } + + public static String whereHandle(String sJboWhere, + Map paramMap) { + return whereHandle1(sJboWhere, paramMap); + } + + private static String whereHandle1(String sJboWhere, + Map paramMap) { + String where = sJboWhere; + where = where.replace(" AND ", " and "); + where = where.replace(" OR ", " or "); + String[] array = where.split("and"); + for (String str : array) { + if (str.contains(":")) { + String[] orArray = str.split("or"); + if (orArray.length >= 2) { + // [ (O.INPUTORGID=:inputOrgId , O.INPUTORGID like :inputOrgId1)] + for (String orStr : orArray) { + // O.contract_id = :contract_id + String[] array1 = orStr.split(":"); + // O.contract_id = > 0 + // contract_id> 1 + if (array1.length != 2) + continue; + if (!array1[0].contains(".")) { + String sKey = array1[0].toLowerCase(); + sKey = sKey.trim(); + sKey = sKey.substring(0, sKey.length() - 1); + sKey = sKey.trim(); + String newStr = array1[0] + "'" + + paramMap.get(sKey) + "' "; + sJboWhere = sJboWhere.replace(orStr, newStr); + continue; + } + String[] array2 = array1[0].split("\\."); + if (array2.length < 2) + continue; + String sKey = array2[1].toLowerCase(); + // inputorgid like + if (sKey.contains("like") || sKey.contains("LIKE")) { + String newStr = array1[0] + "'" + paramMap.get(sKey.trim().replaceAll("like", "").trim()) + "' "; + String sStr = array1[1]; + while (sStr.endsWith(")")) { + newStr += ")"; + sStr = sStr.substring(0, sStr.length() - 1); + } + sJboWhere = sJboWhere.replace(orStr, newStr); + } else { + sKey = sKey.trim(); + sKey = sKey.substring(0, sKey.length() - 1); + sKey = sKey.trim(); + String newStr = array1[0] + "'" + + paramMap.get(sKey) + "' "; + String sStr = array1[1]; + while (sStr.endsWith(")")) { + newStr += ")"; + sStr = sStr.substring(0, sStr.length() - 1); + } + sJboWhere = sJboWhere.replace(orStr, newStr); + } + sJboWhere += " "; + } + sJboWhere = sJboWhere.substring(0, sJboWhere.length() - 1); + } else { + // O.contract_id = :contract_id + String[] array1 = str.split(":"); + // O.contract_id = > 0 + // contract_id> 1 + if (array1.length != 2) + continue; + if (!array1[0].contains(".")) { + String sKey = array1[0].toLowerCase(); + sKey = sKey.trim(); + sKey = sKey.substring(0, sKey.length() - 1); + sKey = sKey.trim(); + String newStr = array1[0] + "'" + + paramMap.get(sKey) + "' "; + String sStr = array1[1]; + while (sStr.endsWith(")")) { + newStr += ")"; + sStr = sStr.substring(0, sStr.length() - 1); + } + sJboWhere = sJboWhere.replace(str, newStr); + continue; + } + String[] array2 = array1[0].split("\\."); + if (array2.length < 2) + continue; + String sKey = array2[1].toLowerCase(); + sKey = sKey.trim(); + sKey = sKey.substring(0, sKey.length() - 1); + sKey = sKey.trim(); + String newStr = array1[0] + "'" + + paramMap.get(sKey) + "' "; + String sStr = array1[1]; + while (sStr.endsWith(")")) { + newStr += ")"; + sStr = sStr.substring(0, sStr.length() - 1); + } + sJboWhere = sJboWhere.replace(str, newStr); + } + } + } + return sJboWhere; + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppAweDoCache.java b/src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppAweDoCache.java new file mode 100644 index 000000000..fc7587d45 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppAweDoCache.java @@ -0,0 +1,337 @@ +package apx.com.amarsoft.als.base.cache.instance; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import jbo.awe.AWE_DO_CATALOG; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.dict.als.cache.AbstractCache; + +public class AppAweDoCache extends AbstractCache { + private static AppAweDoCache instance = null; + private static Map appAweDoCachePool = null; + + public static synchronized AppAweDoCache getInstance() { + if (instance == null) { + instance = new AppAweDoCache(); + } + return instance; + } + + public static synchronized Map getAppAweDoCachePool() { + if (null == appAweDoCachePool) + appAweDoCachePool = new HashMap(); + return appAweDoCachePool; + } + + @Override + public synchronized void clear() throws Exception { + getAppAweDoCachePool().clear(); + appAweDoCachePool = null; + } + + @Override + public synchronized boolean load(Transaction arg0) throws Exception { + ARE.getLog() + .info("[CACHE] AppAweDOCache bulid Begin ................."); + initAweDoCachePool(); + ARE.getLog() + .info("[CACHE] AppAweDOCache bulid End ..................."); + return true; + } + + @SuppressWarnings("unchecked") + private synchronized void initAweDoCachePool() throws JBOException { + // begin awe_do_catalog/awe_do_library in cache + appAweDoCachePool = new HashMap(); + // String sSql = + // "SELECT O.DONO,o.DONAME,O.ISINUSE,O.JBOCLASS,O.JBOWHERE,O.JBOFROM,O.JBOORDER,O.JBOGROUP,o.BUSINESSPROCESS,o.ISVALIDATE,"; + // sSql += + // "AWE_DO_LIBRARY.DONO AS v.DONO1,AWE_DO_LIBRARY.isinuse AS v.isinuse1,AWE_DO_LIBRARY.colindex,AWE_DO_LIBRARY.sortno,AWE_DO_LIBRARY.coltablename,"; + // sSql += + // "AWE_DO_LIBRARY.colactualname,AWE_DO_LIBRARY.colname,AWE_DO_LIBRARY.coltype,"; + // sSql += "AWE_DO_LIBRARY.coldefaultvalue,AWE_DO_LIBRARY.colheader,"; + // sSql += "AWE_DO_LIBRARY.colunit,AWE_DO_LIBRARY.colcolumntype,"; + // sSql += + // "AWE_DO_LIBRARY.coleditstyle,AWE_DO_LIBRARY.colcheckformat,AWE_DO_LIBRARY.colalign,"; + // sSql += + // "AWE_DO_LIBRARY.coleditsourcetype,AWE_DO_LIBRARY.coleditsource,AWE_DO_LIBRARY.colhtmlstyle,"; + // sSql += + // "AWE_DO_LIBRARY.collimit,AWE_DO_LIBRARY.colvisible,AWE_DO_LIBRARY.colreadonly,"; + // sSql += + // "AWE_DO_LIBRARY.colrequired,AWE_DO_LIBRARY.colsortable,AWE_DO_LIBRARY.isfilter,"; + // sSql += + // "AWE_DO_LIBRARY.colspan,AWE_DO_LIBRARY.isautocomplete,AWE_DO_LIBRARY.groupid,"; + // sSql += + // "AWE_DO_LIBRARY.colfilterrefid,AWE_DO_LIBRARY.inputuser,AWE_DO_LIBRARY.inputtime,"; + // sSql += + // "AWE_DO_LIBRARY.updateuser,AWE_DO_LIBRARY.updatetime,AWE_DO_LIBRARY.isaudit,"; + // sSql += + // "AWE_DO_LIBRARY.colfilterattrs,AWE_DO_LIBRARY.isupdate,AWE_DO_LIBRARY.parentcolindex,"; + // sSql += + // "AWE_DO_LIBRARY.tips,AWE_DO_LIBRARY.colinnerbtevent,AWE_DO_LIBRARY.colfilteroptions"; + // sSql += " FROM "; + // sSql += + // "O,jbo.app.AWE_DO_LIBRARY AWE_DO_LIBRARY,jbo.app.APP_BUSINESS_GROUP APP_BUSINESS_GROUP"; + // sSql += " WHERE "; + // sSql += + // "O.DONO=AWE_DO_LIBRARY.DONO AND O.ISINUSE=1 AND AWE_DO_LIBRARY.ISINUSE=1 AND APP_BUSINESS_GROUP.GROUP_CODE=O.DONO"; + // sSql += " ORDER BY "; + // sSql += " O.DONO,AWE_DO_LIBRARY.sortno"; + String sSql = "SELECT DISTINCT app_business_template.GROUP_CODE, O.DONO,o.DONAME,O.ISINUSE,O.JBOCLASS,O.JBOWHERE,O.JBOFROM,O.JBOORDER,O.JBOGROUP,o.BUSINESSPROCESS,o.ISVALIDATE,"; + sSql += "AWE_DO_LIBRARY.DONO AS v.DONO1,AWE_DO_LIBRARY.isinuse AS v.isinuse1,AWE_DO_LIBRARY.colindex,AWE_DO_LIBRARY.sortno,AWE_DO_LIBRARY.coltablename,"; + sSql += "AWE_DO_LIBRARY.colactualname,AWE_DO_LIBRARY.colname,AWE_DO_LIBRARY.coltype,"; + sSql += "AWE_DO_LIBRARY.coldefaultvalue,AWE_DO_LIBRARY.colheader,"; + sSql += "AWE_DO_LIBRARY.colunit,AWE_DO_LIBRARY.colcolumntype,"; + sSql += "AWE_DO_LIBRARY.coleditstyle,AWE_DO_LIBRARY.colcheckformat,AWE_DO_LIBRARY.colalign,"; + sSql += "AWE_DO_LIBRARY.coleditsourcetype,AWE_DO_LIBRARY.coleditsource,AWE_DO_LIBRARY.colhtmlstyle,"; + sSql += "AWE_DO_LIBRARY.collimit,AWE_DO_LIBRARY.colvisible,AWE_DO_LIBRARY.colreadonly,"; + sSql += "AWE_DO_LIBRARY.colrequired,AWE_DO_LIBRARY.colsortable,AWE_DO_LIBRARY.isfilter,"; + sSql += "AWE_DO_LIBRARY.colspan,AWE_DO_LIBRARY.isautocomplete,AWE_DO_LIBRARY.groupid,"; + sSql += "AWE_DO_LIBRARY.colfilterrefid,AWE_DO_LIBRARY.inputuser,AWE_DO_LIBRARY.inputtime,"; + sSql += "AWE_DO_LIBRARY.updateuser,AWE_DO_LIBRARY.updatetime,AWE_DO_LIBRARY.isaudit,"; + sSql += "AWE_DO_LIBRARY.colfilterattrs,AWE_DO_LIBRARY.isupdate,AWE_DO_LIBRARY.parentcolindex,"; + sSql += "AWE_DO_LIBRARY.tips,AWE_DO_LIBRARY.colinnerbtevent,AWE_DO_LIBRARY.colfilteroptions"; + sSql += " FROM "; + sSql += "O,jbo.app.AWE_DO_LIBRARY AWE_DO_LIBRARY,jbo.app.APP_BUSINESS_GROUP APP_BUSINESS_GROUP, jbo.app.APP_BUSINESS_TEMPLATE app_business_template"; + sSql += " WHERE "; + sSql += "O.DONO=AWE_DO_LIBRARY.DONO AND O.ISINUSE=1 AND AWE_DO_LIBRARY.isinuse=1 AND app_business_template.DONO=O.DONO AND app_business_template.GROUP_CODE=APP_BUSINESS_GROUP.GROUP_CODE"; + sSql += " ORDER BY "; + sSql += " O.DONO,AWE_DO_LIBRARY.sortno"; + BizObjectManager bom = JBOFactory + .getBizObjectManager(AWE_DO_CATALOG.CLASS_NAME); + BizObjectQuery boq = bom.createQuery(sSql); + List bos = boq.getResultList(false); + String sDonoCache = ""; + Map mapCache = null; + List> libraryCache = null; + for (BizObject bo : bos) { + String sDono = bo.getAttribute("DONO") == null ? "" : bo + .getAttribute("DONO").toString(); + Map map = null; + List> library = null; + if (sDono.length() > 0 && !sDonoCache.equals(sDono)) { + map = new HashMap(); + library = new ArrayList>(); + map.put("DONO", bo.getAttribute("DONO").getValue()); + map.put("DONAME", bo.getAttribute("DONAME").getValue()); + map.put("ISINUSE", bo.getAttribute("ISINUSE").getValue()); + map.put("JBOCLASS", bo.getAttribute("JBOCLASS").getValue()); + map.put("JBOWHERE", bo.getAttribute("JBOWHERE").getValue()); + map.put("JBOFROM", bo.getAttribute("JBOFROM").getValue()); + map.put("JBOORDER", bo.getAttribute("JBOORDER").getValue()); + map.put("JBOGROUP", bo.getAttribute("JBOGROUP").getValue()); + map.put("BUSINESSPROCESS", bo.getAttribute("BUSINESSPROCESS") + .getValue()); + map.put("ISVALIDATE", bo.getAttribute("ISVALIDATE").getValue()); + map.put("DONO".toLowerCase(), bo.getAttribute("DONO") + .getValue()); + map.put("DONAME".toLowerCase(), bo.getAttribute("DONAME") + .getValue()); + map.put("ISINUSE".toLowerCase(), bo.getAttribute("ISINUSE") + .getValue()); + map.put("JBOCLASS".toLowerCase(), bo.getAttribute("JBOCLASS") + .getValue()); + map.put("JBOWHERE".toLowerCase(), bo.getAttribute("JBOWHERE") + .getValue()); + map.put("JBOFROM".toLowerCase(), bo.getAttribute("JBOFROM") + .getValue()); + map.put("JBOORDER".toLowerCase(), bo.getAttribute("JBOORDER") + .getValue()); + map.put("JBOGROUP".toLowerCase(), bo.getAttribute("JBOGROUP") + .getValue()); + map.put("BUSINESSPROCESS".toLowerCase(), + bo.getAttribute("BUSINESSPROCESS").getValue()); + map.put("ISVALIDATE".toLowerCase(), + bo.getAttribute("ISVALIDATE").getValue()); + } else { + map = mapCache; + library = libraryCache; + } + if (map != null) { + Map lMap = new HashMap(); + lMap.put("DONO", bo.getAttribute("DONO1").getValue()); + // lMap.put("ISINUSE", bo.getAttribute("isinuse1").getValue()); + lMap.put("COLINDEX", bo.getAttribute("colindex").getValue()); + lMap.put("SORTNO", bo.getAttribute("sortno").getValue()); + lMap.put("COLTABLENAME", bo.getAttribute("coltablename") + .getValue()); + lMap.put("COLACTUALNAME", bo.getAttribute("colactualname") + .getValue()); + lMap.put("COLNAME", bo.getAttribute("colname").getValue()); + lMap.put("COLTYPE", bo.getAttribute("coltype").getValue()); + lMap.put("COLDEFAULTVALUE", bo.getAttribute("coldefaultvalue") + .getValue()); + lMap.put("COLHEADER", bo.getAttribute("colheader").getValue()); + // lMap.put("COLUNIT", bo.getAttribute("colunit").getValue()); + // lMap.put("COLCOLUMNTYPE", + // bo.getAttribute("colcolumntype").getValue()); + lMap.put("COLEDITSTYLE", bo.getAttribute("coleditstyle") + .getValue()); + lMap.put("COLCHECKFORMAT", bo.getAttribute("colcheckformat") + .getValue()); + // lMap.put("COLALIGN", bo.getAttribute("colalign").getValue()); + lMap.put("COLEDITSOURCETYPE", + bo.getAttribute("coleditsourcetype").getValue()); + lMap.put("COLEDITSOURCE", bo.getAttribute("coleditsource") + .getValue()); + // lMap.put("COLHTMLSTYLE", + // bo.getAttribute("colhtmlstyle").getValue()); + // lMap.put("COLLIMIT", bo.getAttribute("collimit").getValue()); + lMap.put("COLVISIBLE", bo.getAttribute("colvisible").getValue()); + lMap.put("COLREADONLY", bo.getAttribute("colreadonly") + .getValue()); + lMap.put("COLREQUIRED", bo.getAttribute("colrequired") + .getValue()); + // lMap.put("COLSORTABLE", + // bo.getAttribute("colsortable").getValue()); + lMap.put("ISFILTER", bo.getAttribute("isfilter").getValue()); + // lMap.put("COLSPAN", bo.getAttribute("colspan").getValue()); + // lMap.put("ISAUTOCOMPLETE", + // bo.getAttribute("isautocomplete").getValue()); + lMap.put("GROUPID", bo.getAttribute("groupid").getValue()); + // lMap.put("COLFILTERREFID", + // bo.getAttribute("colfilterrefid").getValue()); + // lMap.put("INPUTUSER", + // bo.getAttribute("inputuser").getValue()); + // lMap.put("INPUTTIME", + // bo.getAttribute("inputtime").getValue()); + // lMap.put("UPDATEUSER", + // bo.getAttribute("updateuser").getValue()); + // lMap.put("UPDATETIME", + // bo.getAttribute("updatetime").getValue()); + // lMap.put("ISAUDIT", bo.getAttribute("isaudit").getValue()); + // lMap.put("COLFILTERATTRS", + // bo.getAttribute("colfilterattrs").getValue()); + // lMap.put("ISUPDATE", bo.getAttribute("isupdate").getValue()); + // lMap.put("PARENTCOLINDEX", + // bo.getAttribute("parentcolindex").getValue()); + // lMap.put("TIPS", bo.getAttribute("tips").getValue()); + // lMap.put("COLINNERBTEVENT", + // bo.getAttribute("colinnerbtevent").getValue()); + // lMap.put("COLFILTEROPTIONS", + // bo.getAttribute("colfilteroptions").getValue()); + + lMap.put("DONO".toLowerCase(), bo.getAttribute("DONO1") + .getValue()); + // lMap.put("ISINUSE".toLowerCase(), + // bo.getAttribute("isinuse1").getValue()); + lMap.put("COLINDEX".toLowerCase(), bo.getAttribute("colindex") + .getValue()); + lMap.put("SORTNO".toLowerCase(), bo.getAttribute("sortno") + .getValue()); + lMap.put("COLTABLENAME".toLowerCase(), + bo.getAttribute("coltablename").getValue()); + lMap.put("COLACTUALNAME".toLowerCase(), + bo.getAttribute("colactualname").getValue()); + lMap.put("COLNAME".toLowerCase(), bo.getAttribute("colname") + .getValue()); + lMap.put("COLTYPE".toLowerCase(), bo.getAttribute("coltype") + .getValue()); + lMap.put("COLDEFAULTVALUE".toLowerCase(), + bo.getAttribute("coldefaultvalue").getValue()); + lMap.put("COLHEADER".toLowerCase(), bo + .getAttribute("colheader").getValue()); + // lMap.put("COLUNIT".toLowerCase(), + // bo.getAttribute("colunit").getValue()); + // lMap.put("COLCOLUMNTYPE".toLowerCase(), + // bo.getAttribute("colcolumntype").getValue()); + lMap.put("COLEDITSTYLE".toLowerCase(), + bo.getAttribute("coleditstyle").getValue()); + lMap.put("COLCHECKFORMAT".toLowerCase(), + bo.getAttribute("colcheckformat").getValue()); + // lMap.put("COLALIGN".toLowerCase(), + // bo.getAttribute("colalign").getValue()); + lMap.put("COLEDITSOURCETYPE".toLowerCase(), + bo.getAttribute("coleditsourcetype").getValue()); + lMap.put("COLEDITSOURCE".toLowerCase(), + bo.getAttribute("coleditsource").getValue()); + // lMap.put("COLHTMLSTYLE".toLowerCase(), + // bo.getAttribute("colhtmlstyle").getValue()); + // lMap.put("COLLIMIT".toLowerCase(), + // bo.getAttribute("collimit").getValue()); + lMap.put("COLVISIBLE".toLowerCase(), + bo.getAttribute("colvisible").getValue()); + lMap.put("COLREADONLY".toLowerCase(), + bo.getAttribute("colreadonly").getValue()); + lMap.put("COLREQUIRED".toLowerCase(), + bo.getAttribute("colrequired").getValue()); + // lMap.put("COLSORTABLE".toLowerCase(), + // bo.getAttribute("colsortable").getValue()); + lMap.put("ISFILTER".toLowerCase(), bo.getAttribute("isfilter") + .getValue()); + // lMap.put("COLSPAN", bo.getAttribute("colspan").getValue()); + // lMap.put("ISAUTOCOMPLETE".toLowerCase(), + // bo.getAttribute("isautocomplete").getValue()); + lMap.put("GROUPID".toLowerCase(), bo.getAttribute("groupid") + .getValue()); + // lMap.put("COLFILTERREFID".toLowerCase(), + // bo.getAttribute("colfilterrefid").getValue()); + // lMap.put("INPUTUSER".toLowerCase(), + // bo.getAttribute("inputuser").getValue()); + // lMap.put("INPUTTIME".toLowerCase(), + // bo.getAttribute("inputtime").getValue()); + // lMap.put("UPDATEUSER".toLowerCase(), + // bo.getAttribute("updateuser").getValue()); + // lMap.put("UPDATETIME".toLowerCase(), + // bo.getAttribute("updatetime").getValue()); + // lMap.put("ISAUDIT".toLowerCase(), + // bo.getAttribute("isaudit").getValue()); + // lMap.put("COLFILTERATTRS".toLowerCase(), + // bo.getAttribute("colfilterattrs").getValue()); + // lMap.put("ISUPDATE".toLowerCase(), + // bo.getAttribute("isupdate").getValue()); + // lMap.put("PARENTCOLINDEX".toLowerCase(), + // bo.getAttribute("parentcolindex").getValue()); + // lMap.put("TIPS".toLowerCase(), + // bo.getAttribute("tips").getValue()); + // lMap.put("COLINNERBTEVENT".toLowerCase(), + // bo.getAttribute("colinnerbtevent").getValue()); + // lMap.put("COLFILTEROPTIONS".toLowerCase(), + // bo.getAttribute("colfilteroptions").getValue()); + library.add(lMap); + map.put("library", library); + appAweDoCachePool.put(sDono, map); + } + sDonoCache = sDono; + mapCache = map; + libraryCache = library; + } + // appAweDoCachePool = new HashMap(); + // BizObjectManager doCatalogBom = JBOFactory + // .getBizObjectManager("jbo.awe.AWE_DO_CATALOG"); + // BizObjectQuery doCatalogBoq = doCatalogBom + // .createQuery("1=1 and isinuse ='1'"); + // List doCatalogs = doCatalogBoq.getResultList(false); + // for (BizObject doCatalog : doCatalogs) { + // BizObjectUtil util = new BizObjectUtil(); + // Map map = util.bizObject2MapValue3(doCatalog); + // String dono = map.get("dono").toString(); + // BizObjectManager libraryBom = JBOFactory + // .getBizObjectManager("jbo.app.AWE_DO_LIBRARY"); + // BizObjectQuery libraryBqm = libraryBom + // .createQuery("isinuse =1 AND dono='" + dono + // + "' ORDER BY SORTNO"); + // List librarys = libraryBqm.getResultList(false); + // List> list = new ArrayList>(); + // for (BizObject library : librarys) { + // Map libraryMap = util.bizObject2MapValue3(library); + // list.add(libraryMap); + // } + // map.put("library", list); + // appAweDoCachePool.put(dono, map); + // } + // end + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppCodeCache.java b/src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppCodeCache.java new file mode 100644 index 000000000..6b72a16b1 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppCodeCache.java @@ -0,0 +1,174 @@ + +package apx.com.amarsoft.als.base.cache.instance; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import jbo.sys.CODE_CATALOG; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.dict.als.cache.AbstractCache; + +public class AppCodeCache extends AbstractCache { + private static Map appCodeCachePool = null; + private static AppCodeCache instance = null; + + public static synchronized AppCodeCache getInstance() { + if (instance == null) { + instance = new AppCodeCache(); + } + return instance; + } + + public static Map getAppCodeCachePool() { + return appCodeCachePool; + } + + public synchronized Map getCacheMapPool() { + if (appCodeCachePool == null) + appCodeCachePool = new HashMap(); + return appCodeCachePool; + } + + @Override + public synchronized void clear() throws Exception { + getCacheMapPool().clear(); + appCodeCachePool = null; + } + + @Override + public synchronized boolean load(Transaction arg0) throws Exception { + ARE.getLog().info("[CACHE] AppCodeCache bulid Begin ................."); + initCodeCachePool(); + ARE.getLog().info("[CACHE] AppCodeCache bulid End ..................."); + return true; + } + + @SuppressWarnings("unchecked") + private synchronized void initCodeCachePool() throws JBOException { + appCodeCachePool = new HashMap(); + // begin code_catalog/code_library in cache + String sSql = "SELECT "; + sSql += "O.CODENO,O.SORTNO,O.CODENAME,O.CODETYPEONE,O.CODETYPETWO,O.CODEDESCRIBE,O.CODEATTRIBUTE,O.REMARK,"; + sSql += "CODE_LIBRARY.CODENO AS V.CODENO1,CODE_LIBRARY.ITEMNO,CODE_LIBRARY.ITEMNAME,CODE_LIBRARY.BANKNO,CODE_LIBRARY.SORTNO AS V.SORTNO1,CODE_LIBRARY.ISINUSE,CODE_LIBRARY.ITEMDESCRIBE,"; + sSql += "CODE_LIBRARY.ITEMATTRIBUTE,CODE_LIBRARY.RELATIVECODE,CODE_LIBRARY.ATTRIBUTE1,CODE_LIBRARY.ATTRIBUTE2,CODE_LIBRARY.ATTRIBUTE3,CODE_LIBRARY.ATTRIBUTE4,CODE_LIBRARY.ATTRIBUTE5,"; + sSql += "CODE_LIBRARY.ATTRIBUTE6,CODE_LIBRARY.ATTRIBUTE7,CODE_LIBRARY.ATTRIBUTE8,CODE_LIBRARY.HELPTEXT,CODE_LIBRARY.REMARK AS V.REMARK1"; + sSql += " FROM O,jbo.ui.system.CODE_LIBRARY CODE_LIBRARY "; + sSql += "WHERE O.CODENO = CODE_LIBRARY.CODENO AND CODE_LIBRARY.ISINUSE='1' "; + sSql += "AND O.CODENO NOT IN ('COLINPUTTYPE','ButtonSetFlow','AWEPageTxt','ButtonSetA') AND CODENAME NOT LIKE '%树图' "; + sSql += "ORDER BY O.CODENO,CODE_LIBRARY.SORTNO"; + BizObjectManager bom = JBOFactory.getBizObjectManager(CODE_CATALOG.CLASS_NAME); + BizObjectQuery boq = bom.createQuery(sSql); + List bos = boq.getResultList(false); + String sCodeNoCache = ""; + Map mapCache = null; + List> libraryCache = null; + for (BizObject bo : bos) { + String sCodeNo = bo.getAttribute("CODENO") == null ? "" : bo.getAttribute("CODENO").toString(); + Map map = null; + List> library = null; + if (sCodeNo.length() > 0 && !sCodeNoCache.equals(sCodeNo)) { + map = new HashMap(); + library = new ArrayList>(); + map.put("CODENO", bo.getAttribute("CODENO").getValue()); + map.put("SORTNO", bo.getAttribute("SORTNO").getValue()); + map.put("CODENAME", bo.getAttribute("CODENAME").getValue()); + map.put("CODETYPEONE", bo.getAttribute("CODETYPEONE").getValue()); + map.put("CODETYPETWO", bo.getAttribute("CODETYPETWO").getValue()); + map.put("CODEDESCRIBE", bo.getAttribute("CODEDESCRIBE").getValue()); + map.put("CODEATTRIBUTE", bo.getAttribute("CODEATTRIBUTE").getValue()); + map.put("REMARK", bo.getAttribute("REMARK").getValue()); + + map.put("CODENO".toLowerCase(), bo.getAttribute("CODENO").getValue()); + map.put("SORTNO".toLowerCase(), bo.getAttribute("SORTNO").getValue()); + map.put("CODENAME".toLowerCase(), bo.getAttribute("CODENAME").getValue()); + map.put("CODETYPEONE".toLowerCase(), bo.getAttribute("CODETYPEONE").getValue()); + map.put("CODETYPETWO".toLowerCase(), bo.getAttribute("CODETYPETWO").getValue()); + map.put("CODEDESCRIBE".toLowerCase(), bo.getAttribute("CODEDESCRIBE").getValue()); + map.put("CODEATTRIBUTE".toLowerCase(), bo.getAttribute("CODEATTRIBUTE").getValue()); + map.put("REMARK".toLowerCase(), bo.getAttribute("REMARK").getValue()); + } else { + map = mapCache; + library = libraryCache; + } + if (map != null) { + Map lMap = new HashMap(); + lMap.put("CODENO", bo.getAttribute("CODENO1").getValue()); + lMap.put("ITEMNO", bo.getAttribute("ITEMNO").getValue()); + lMap.put("ITEMNAME", bo.getAttribute("ITEMNAME").getValue()); + lMap.put("BANKNO", bo.getAttribute("BANKNO").getValue()); + lMap.put("SORTNO", bo.getAttribute("SORTNO1").getValue()); + lMap.put("ISINUSE", bo.getAttribute("ISINUSE").getValue()); + lMap.put("ITEMDESCRIBE", bo.getAttribute("ITEMDESCRIBE").getValue()); + lMap.put("ITEMATTRIBUTE", bo.getAttribute("ITEMATTRIBUTE").getValue()); + lMap.put("ATTRIBUTE1", bo.getAttribute("ATTRIBUTE1").getValue()); + lMap.put("ATTRIBUTE2", bo.getAttribute("ATTRIBUTE2").getValue()); + lMap.put("ATTRIBUTE3", bo.getAttribute("ATTRIBUTE3").getValue()); + lMap.put("ATTRIBUTE4", bo.getAttribute("ATTRIBUTE4").getValue()); + lMap.put("ATTRIBUTE5", bo.getAttribute("ATTRIBUTE5").getValue()); + lMap.put("ATTRIBUTE6", bo.getAttribute("ATTRIBUTE6").getValue()); + lMap.put("ATTRIBUTE7", bo.getAttribute("ATTRIBUTE7").getValue()); + lMap.put("ATTRIBUTE8", bo.getAttribute("ATTRIBUTE8").getValue()); + lMap.put("HELPTEXT", bo.getAttribute("HELPTEXT").getValue()); + lMap.put("REMARK", bo.getAttribute("REMARK1").getValue()); + + lMap.put("CODENO".toLowerCase(), bo.getAttribute("CODENO1").getValue()); + lMap.put("ITEMNO".toLowerCase(), bo.getAttribute("ITEMNO").getValue()); + lMap.put("ITEMNAME".toLowerCase(), bo.getAttribute("ITEMNAME").getValue()); + lMap.put("BANKNO".toLowerCase(), bo.getAttribute("BANKNO").getValue()); + lMap.put("SORTNO".toLowerCase(), bo.getAttribute("SORTNO1").getValue()); + lMap.put("ISINUSE".toLowerCase(), bo.getAttribute("ISINUSE").getValue()); + lMap.put("ITEMDESCRIBE".toLowerCase(), bo.getAttribute("ITEMDESCRIBE").getValue()); + lMap.put("ITEMATTRIBUTE".toLowerCase(), bo.getAttribute("ITEMATTRIBUTE").getValue()); + lMap.put("ATTRIBUTE1".toLowerCase(), bo.getAttribute("ATTRIBUTE1").getValue()); + lMap.put("ATTRIBUTE2".toLowerCase(), bo.getAttribute("ATTRIBUTE2").getValue()); + lMap.put("ATTRIBUTE3".toLowerCase(), bo.getAttribute("ATTRIBUTE3").getValue()); + lMap.put("ATTRIBUTE4".toLowerCase(), bo.getAttribute("ATTRIBUTE4").getValue()); + lMap.put("ATTRIBUTE5".toLowerCase(), bo.getAttribute("ATTRIBUTE5").getValue()); + lMap.put("ATTRIBUTE6".toLowerCase(), bo.getAttribute("ATTRIBUTE6").getValue()); + lMap.put("ATTRIBUTE7".toLowerCase(), bo.getAttribute("ATTRIBUTE7").getValue()); + lMap.put("ATTRIBUTE8.toLowerCase()", bo.getAttribute("ATTRIBUTE8").getValue()); + lMap.put("HELPTEXT".toLowerCase(), bo.getAttribute("HELPTEXT").getValue()); + lMap.put("REMARK".toLowerCase(), bo.getAttribute("REMARK1").getValue()); + library.add(lMap); + map.put("library", library); + appCodeCachePool.put(sCodeNo, map); + } + sCodeNoCache = sCodeNo; + mapCache = map; + libraryCache = library; + } +// BizObjectManager catalogBom = JBOFactory +// .getBizObjectManager("jbo.sys.CODE_CATALOG"); +// BizObjectQuery catalogBoq = catalogBom +// .createQuery("1=1"); +// List catalogs = catalogBoq.getResultList(false); +// for (BizObject catalog : catalogs) { +// BizObjectUtil util = new BizObjectUtil(); +// Map map = util.bizObject2MapValue(catalog); +// String codeno = map.get("codeno").toString(); +// BizObjectManager libraryBom = JBOFactory +// .getBizObjectManager("jbo.ui.system.CODE_LIBRARY"); +// BizObjectQuery libraryBqm = libraryBom +// .createQuery("isinuse ='1' AND CODENO='" + codeno +// + "' ORDER BY SORTNO"); +// List librarys = libraryBqm.getResultList(false); +// List> list = new ArrayList>(); +// for (BizObject library : librarys) { +// Map libraryMap = util.bizObject2MapValue(library); +// list.add(libraryMap); +// } +// map.put("library", list); +// AppCodeCache.appCodeCachePool.put(codeno, map); +// } + // end + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppConfigCache.java b/src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppConfigCache.java new file mode 100644 index 000000000..660cf1629 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppConfigCache.java @@ -0,0 +1,45 @@ +package apx.com.amarsoft.als.base.cache.instance; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.dict.als.cache.AbstractCache; +import com.base.constant.RestfullConstant; +import com.base.helper.SessionHelper; + +public class AppConfigCache extends AbstractCache { + private static AppConfigCache instance = null; + + public static synchronized AppConfigCache getInstance() { + if (instance == null) { + instance = new AppConfigCache(); + } + return instance; + } + + @Override + public void clear() throws Exception { + // TODO Auto-generated method stub + } + + @Override + public synchronized boolean load(Transaction arg0) throws Exception { + ARE.getLog().info("[APPKICKOFFLINE] Begin ................."); +// kickOffline(); + ARE.getLog().info("[APPKICKOFFLINE] End................."); + + ARE.getLog().info("[init config] Begin ................."); + loadConfig(); + ARE.getLog().info("[init config] End................."); + + return true; + } + + private synchronized void loadConfig() throws Exception { + RestfullConstant.initProperties(); + } + + private synchronized void kickOffline() throws JBOException { + SessionHelper.removerAll(); + } +} diff --git a/src_app/apx/com/amarsoft/als/base/constant/CacheConstant.java b/src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppConstantCache.java similarity index 80% rename from src_app/apx/com/amarsoft/als/base/constant/CacheConstant.java rename to src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppConstantCache.java index e48ea409c..70bc7833a 100644 --- a/src_app/apx/com/amarsoft/als/base/constant/CacheConstant.java +++ b/src_app_fresh/apx/com/amarsoft/als/base/cache/instance/AppConstantCache.java @@ -1,284 +1,267 @@ -package apx.com.amarsoft.als.base.constant; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import apx.com.amarsoft.als.base.constant.cache.AppCodeCache; - -import com.amarsoft.are.ARE; -import com.amarsoft.awe.util.Transaction; - -public class CacheConstant { - private static CacheConstant instance = null; - private static Map nationcode; // 洲:国家 - private static Map unitKind; // 行业 - private static Map downtown; // 省市区 - - public static Map getNationcode() { - if (nationcode == null) - nationcode = new HashMap(); - return nationcode; - } - - public static Map getUnitKind() { - if (unitKind == null) - unitKind = new HashMap(); - return unitKind; - } - - public static Map getDowntown() { - if (downtown == null) - downtown = new HashMap(); - return downtown; - } - - public static synchronized CacheConstant getInstance() { - if (instance == null) { - instance = new CacheConstant(); - } - return instance; - } - - public static synchronized boolean load(Transaction Sqlca) throws Exception { - nationcode = new HashMap(); - unitKind = new HashMap(); - downtown = new HashMap(); - ARE.getLog() - .info("[CACHE] CacheConstant bulid Begin ................."); - instance.initNationcode(); - instance.initUnitKind(); - instance.initDowntown(); - ARE.getLog().info("[CACHE] CacheConstant bulid END ................."); - return true; - } - - @SuppressWarnings("unchecked") - private synchronized void initNationcode() { - String sCodeNo = "CountryCode"; - List> list = new ArrayList>(); - nationcode.put("data", list); - Map catalog = (Map) AppCodeCache - .getAppCodeCachePool().get(sCodeNo); - List> library = (List>) catalog - .get("library"); - for (Map codeData : library) { - String sItemNo = codeData.get("ITEMNO".toLowerCase()).toString(); - String sItemName = codeData.get("ITEMNAME".toLowerCase()) - .toString(); - Pattern pattern = Pattern.compile("[0-9]*"); - Matcher isNum = pattern.matcher(sItemNo); - if (isNum.matches()) { - Map map = new HashMap(); - map.put("itemno", sItemNo); - map.put("itemname", sItemName); - map.put("sortno", codeData.get("sortno")); - list.add(map); - } - } - for (Map map : list) { - List> list1 = new ArrayList>(); - String key = map.get("itemno").toString(); - for (Map codeData : library) { - String sSortno = codeData.get("SORTNO".toLowerCase()) - .toString(); - String sItemNo = codeData.get("ITEMNO".toLowerCase()) - .toString(); - String sItemName = codeData.get("ITEMNAME".toLowerCase()) - .toString(); - if (sSortno.startsWith(key) && !sSortno.equals(key)) { - Map map1 = new HashMap(); - map1.put("itemno", sItemNo); - map1.put("itemname", sItemName); - map1.put("sortno", sSortno); - list1.add(map1); - } - } - map.put("content", list1); - } - } - - @SuppressWarnings("unchecked") - private synchronized void initUnitKind() { - String sCodeNo = "NewIndustryType"; - List> list1 = new ArrayList>(); - List> list2 = new ArrayList>(); - List> list3 = new ArrayList>(); - List> list4 = new ArrayList>(); - unitKind.put("data", list1); - Map catalog = (Map) AppCodeCache - .getAppCodeCachePool().get(sCodeNo); - List> library = (List>) catalog - .get("library"); - - for (Map codeLibrary : library) { - if (codeLibrary.get("ITEMNO".toLowerCase()).toString().length() == 1) { - Map map1 = new HashMap(); - map1.put("itemno", codeLibrary.get("ITEMNO".toLowerCase())); - map1.put("itemname", codeLibrary.get("ITEMNAME".toLowerCase())); - map1.put("sortno", codeLibrary.get("sortno")); - list1.add(map1); - } else if (codeLibrary.get("ITEMNO".toLowerCase()).toString() - .length() == 3) { - Map map2 = new HashMap(); - map2.put("itemno", codeLibrary.get("ITEMNO".toLowerCase())); - map2.put("itemname", codeLibrary.get("ITEMNAME".toLowerCase())); - map2.put("sortno", codeLibrary.get("sortno")); - list2.add(map2); - } else if (codeLibrary.get("ITEMNO".toLowerCase()).toString() - .length() == 4) { - Map map3 = new HashMap(); - map3.put("itemno", codeLibrary.get("ITEMNO".toLowerCase())); - map3.put("itemname", codeLibrary.get("ITEMNAME".toLowerCase())); - map3.put("sortno", codeLibrary.get("sortno")); - list3.add(map3); - } else if (codeLibrary.get("ITEMNO".toLowerCase()).toString() - .length() > 4) { - Map map4 = new HashMap(); - map4.put("itemno", codeLibrary.get("ITEMNO".toLowerCase())); - map4.put("itemname", codeLibrary.get("ITEMNAME".toLowerCase())); - map4.put("sortno", codeLibrary.get("sortno")); - list4.add(map4); - } - } - - for (int i = 0; i < list1.size(); i++) { - Map codeLibrary1 = list1.get(i); - List> list = new ArrayList>(); - for (Map codeLibrary2 : list2) { - if (codeLibrary2 - .get("ITEMNO".toLowerCase()) - .toString() - .startsWith( - codeLibrary1.get("ITEMNO".toLowerCase()) - .toString())) { - list.add(codeLibrary2); - continue; - } - } - codeLibrary1.put("content", list); - } - - for (int i = 0; i < list2.size(); i++) { - Map codeLibrary2 = list2.get(i); - List> list = new ArrayList>(); - for (Map codeLibrary3 : list3) { - if (codeLibrary3 - .get("ITEMNO".toLowerCase()) - .toString() - .startsWith( - codeLibrary2.get("ITEMNO".toLowerCase()) - .toString())) { - list.add(codeLibrary3); - continue; - } - } - codeLibrary2.put("content", list); - } - - for (int i = 0; i < list3.size(); i++) { - Map codeLibrary3 = list3.get(i); - List> list = new ArrayList>(); - for (Map codeLibrary4 : list4) { - if (codeLibrary4 - .get("ITEMNO".toLowerCase()) - .toString() - .startsWith( - codeLibrary3.get("ITEMNO".toLowerCase()) - .toString())) { - list.add(codeLibrary4); - continue; - } - } - codeLibrary3.put("content", list); - } - } - - @SuppressWarnings("unchecked") - private synchronized void initDowntown() { - String sCodeNo = "AreaCode"; - List> provinceList = new ArrayList>(); - List> cityList = new ArrayList>(); - List> areaList = new ArrayList>(); - downtown.put("data", provinceList); - Map catalog = (Map) AppCodeCache - .getAppCodeCachePool().get(sCodeNo); - List> library = (List>) catalog - .get("library"); - - for (Map codeData : library) { - String sSortNo = codeData.get("SORTNO".toLowerCase()) == null ? "" - : codeData.get("SORTNO".toLowerCase()).toString(); - if (sSortNo.length() == 2) { - Map province = new HashMap(); - province.put("itemname", codeData.get("itemname")); - province.put("itemno", codeData.get("itemno")); - province.put("sortno", codeData.get("sortno")); - provinceList.add(province); - } - } - - for (Map codeData : library) { - String sSortNo = codeData.get("SORTNO".toLowerCase()) == null ? "" - : codeData.get("SORTNO".toLowerCase()).toString(); - if (sSortNo.length() == 4) { - Map city = new HashMap(); - city.put("itemname", codeData.get("itemname")); - city.put("itemno", codeData.get("itemno")); - city.put("sortno", codeData.get("sortno")); - cityList.add(city); - } - } - - for (Map codeData : library) { - String sSortNo = codeData.get("SORTNO".toLowerCase()) == null ? "" - : codeData.get("SORTNO".toLowerCase()).toString(); - if (sSortNo.length() == 6) { - Map area = new HashMap(); - area.put("itemname", codeData.get("itemname")); - area.put("itemno", codeData.get("itemno")); - area.put("sortno", codeData.get("sortno")); - areaList.add(area); - } - } - - for (Map province : provinceList) { - String sProvinceSortNo = province.get("SORTNO".toLowerCase()) == null ? "" - : province.get("SORTNO".toLowerCase()).toString(); - List> citys = new ArrayList>(); - for (Map city : cityList) { - String sCitySortNo = city.get("SORTNO".toLowerCase()) == null ? "" - : city.get("SORTNO".toLowerCase()).toString(); - if (sCitySortNo.startsWith(sProvinceSortNo)) { - citys.add(city); - } - } - province.put("citys", citys); - for (Map city : citys) { - String sCitySortNo = city.get("SORTNO".toLowerCase()) == null ? "" - : city.get("SORTNO".toLowerCase()).toString(); - List> areas = new ArrayList>(); - for (Map area : areaList) { - String sAreaSortNo = area.get("SORTNO".toLowerCase()) == null ? "" - : area.get("SORTNO".toLowerCase()).toString(); - if (sAreaSortNo.startsWith(sCitySortNo)) { - areas.add(area); - } - } - city.put("areas", areas); - } - } - } - - public synchronized void clear() { - getDowntown().clear(); - getNationcode().clear(); - getUnitKind().clear(); - nationcode = null; - unitKind = null; - downtown = null; - } -} +package apx.com.amarsoft.als.base.cache.instance; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.amarsoft.are.ARE; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.dict.als.cache.AbstractCache; + +public class AppConstantCache extends AbstractCache { + private static AppConstantCache instance = null; + private static Map AppConstantPool; + + public static Map getAppConstantPool() { + return AppConstantPool; + } + + public synchronized Map getCacheMapPool() { + if (AppConstantPool == null) + AppConstantPool = new HashMap(); + return AppConstantPool; + } + + public static synchronized AppConstantCache getInstance() { + if (instance == null) { + instance = new AppConstantCache(); + } + return instance; + } + + @Override + public void clear() throws Exception { + getCacheMapPool().clear(); + AppConstantPool = null; + } + + @Override + public boolean load(Transaction arg0) throws Exception { + ARE.getLog().info( + "[CACHE] AppConstantCache bulid Begin ................."); + getCacheMapPool(); +// initNationcode(); // 国家 +// initUnitKind(); // 行业 + initProvinceCityArea(); // 省市区 + ARE.getLog().info( + "[CACHE] AppConstantCache bulid End ..................."); + return true; + } + + @SuppressWarnings("unchecked") + private static synchronized void initProvinceCityArea() { + String sCodeNo = "AreaCode"; + List> provinceList = new ArrayList>(); + List> cityList = new ArrayList>(); + List> areaList = new ArrayList>(); + Map catalog = (Map) AppCodeCache + .getAppCodeCachePool().get(sCodeNo); + List> library = (List>) catalog + .get("library"); + + for (Map codeData : library) { + String sSortNo = codeData.get("SORTNO".toLowerCase()) == null ? "" + : codeData.get("SORTNO".toLowerCase()).toString(); + if (sSortNo.length() == 2) { + Map province = new HashMap(); + province.put("itemname", codeData.get("itemname")); + province.put("itemno", codeData.get("itemno")); + province.put("sortno", codeData.get("sortno")); + provinceList.add(province); + } + } + + for (Map codeData : library) { + String sSortNo = codeData.get("SORTNO".toLowerCase()) == null ? "" + : codeData.get("SORTNO".toLowerCase()).toString(); + if (sSortNo.length() == 4) { + Map city = new HashMap(); + city.put("itemname", codeData.get("itemname")); + city.put("itemno", codeData.get("itemno")); + city.put("sortno", codeData.get("sortno")); + cityList.add(city); + } + } + + for (Map codeData : library) { + String sSortNo = codeData.get("SORTNO".toLowerCase()) == null ? "" + : codeData.get("SORTNO".toLowerCase()).toString(); + if (sSortNo.length() == 6) { + Map area = new HashMap(); + area.put("itemname", codeData.get("itemname")); + area.put("itemno", codeData.get("itemno")); + area.put("sortno", codeData.get("sortno")); + areaList.add(area); + } + } + + for (Map province : provinceList) { + String sProvinceSortNo = province.get("SORTNO".toLowerCase()) == null ? "" + : province.get("SORTNO".toLowerCase()).toString(); + List> citys = new ArrayList>(); + for (Map city : cityList) { + String sCitySortNo = city.get("SORTNO".toLowerCase()) == null ? "" + : city.get("SORTNO".toLowerCase()).toString(); + if (sCitySortNo.startsWith(sProvinceSortNo)) { + citys.add(city); + } + } + province.put("citys", citys); + for (Map city : citys) { + String sCitySortNo = city.get("SORTNO".toLowerCase()) == null ? "" + : city.get("SORTNO".toLowerCase()).toString(); + List> areas = new ArrayList>(); + for (Map area : areaList) { + String sAreaSortNo = area.get("SORTNO".toLowerCase()) == null ? "" + : area.get("SORTNO".toLowerCase()).toString(); + if (sAreaSortNo.startsWith(sCitySortNo)) { + areas.add(area); + } + } + city.put("areas", areas); + } + } + AppConstantPool.put("provinceCityArea", provinceList); + } + + @SuppressWarnings("unchecked") + public static synchronized void initUnitKind() { + String sCodeNo = "NewIndustryType"; + List> list1 = new ArrayList>(); + List> list2 = new ArrayList>(); + List> list3 = new ArrayList>(); + List> list4 = new ArrayList>(); + Map catalog = (Map) AppCodeCache + .getAppCodeCachePool().get(sCodeNo); + List> library = (List>) catalog + .get("library"); + + for (Map codeLibrary : library) { + if (codeLibrary.get("ITEMNO".toLowerCase()).toString().length() == 1) { + Map map1 = new HashMap(); + map1.put("itemno", codeLibrary.get("ITEMNO".toLowerCase())); + map1.put("itemname", codeLibrary.get("ITEMNAME".toLowerCase())); + list1.add(map1); + } else if (codeLibrary.get("ITEMNO".toLowerCase()).toString() + .length() == 3) { + Map map2 = new HashMap(); + map2.put("itemno", codeLibrary.get("ITEMNO".toLowerCase())); + map2.put("itemname", codeLibrary.get("ITEMNAME".toLowerCase())); + list2.add(map2); + } else if (codeLibrary.get("ITEMNO".toLowerCase()).toString() + .length() == 4) { + Map map3 = new HashMap(); + map3.put("itemno", codeLibrary.get("ITEMNO".toLowerCase())); + map3.put("itemname", codeLibrary.get("ITEMNAME".toLowerCase())); + list3.add(map3); + } else if (codeLibrary.get("ITEMNO".toLowerCase()).toString() + .length() > 4) { + Map map4 = new HashMap(); + map4.put("itemno", codeLibrary.get("ITEMNO".toLowerCase())); + map4.put("itemname", codeLibrary.get("ITEMNAME".toLowerCase())); + list4.add(map4); + } + } + + for (int i = 0; i < list1.size(); i++) { + Map codeLibrary1 = list1.get(i); + List> list = new ArrayList>(); + for (Map codeLibrary2 : list2) { + if (codeLibrary2 + .get("ITEMNO".toLowerCase()) + .toString() + .startsWith( + codeLibrary1.get("ITEMNO".toLowerCase()) + .toString())) { + list.add(codeLibrary2); + continue; + } + } + codeLibrary1.put("content", list); + } + + for (int i = 0; i < list2.size(); i++) { + Map codeLibrary2 = list2.get(i); + List> list = new ArrayList>(); + for (Map codeLibrary3 : list3) { + if (codeLibrary3 + .get("ITEMNO".toLowerCase()) + .toString() + .startsWith( + codeLibrary2.get("ITEMNO".toLowerCase()) + .toString())) { + list.add(codeLibrary3); + continue; + } + } + codeLibrary2.put("content", list); + } + + for (int i = 0; i < list3.size(); i++) { + Map codeLibrary3 = list3.get(i); + List> list = new ArrayList>(); + for (Map codeLibrary4 : list4) { + if (codeLibrary4 + .get("ITEMNO".toLowerCase()) + .toString() + .startsWith( + codeLibrary3.get("ITEMNO".toLowerCase()) + .toString())) { + list.add(codeLibrary4); + continue; + } + } + codeLibrary3.put("content", list); + } + AppConstantPool.put("unitKind", list1); + } + + @SuppressWarnings("unchecked") + public static synchronized void initNationcode() { + String sCodeNo = "CountryCode"; + List> list = new ArrayList>(); + Map catalog = (Map) AppCodeCache + .getAppCodeCachePool().get(sCodeNo); + List> library = (List>) catalog + .get("library"); + for (Map codeData : library) { + String sItemNo = codeData.get("ITEMNO".toLowerCase()).toString(); + String sItemName = codeData.get("ITEMNAME".toLowerCase()) + .toString(); + Pattern pattern = Pattern.compile("[0-9]*"); + Matcher isNum = pattern.matcher(sItemNo); + if (isNum.matches()) { + Map map = new HashMap(); + map.put("itemno", sItemNo); + map.put("itemname", sItemName); + map.put("sortno", codeData.get("sortno")); + list.add(map); + } + } + for (Map map : list) { + List> list1 = new ArrayList>(); + String key = map.get("itemno").toString(); + for (Map codeData : library) { + String sSortno = codeData.get("SORTNO".toLowerCase()) + .toString(); + String sItemNo = codeData.get("ITEMNO".toLowerCase()) + .toString(); + String sItemName = codeData.get("ITEMNAME".toLowerCase()) + .toString(); + if (sSortno.startsWith(key) && !sSortno.equals(key)) { + Map map1 = new HashMap(); + map1.put("itemno", sItemNo); + map1.put("itemname", sItemName); + map1.put("sortno", sSortno); + list1.add(map1); + } + } + map.put("content", list1); + } + AppConstantPool.put("nationCode", list); + } + +} diff --git a/src_app/apx/com/amarsoft/als/base/constant/cache/loader/AppAweDoLoader.java b/src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppAweDoLoader.java similarity index 67% rename from src_app/apx/com/amarsoft/als/base/constant/cache/loader/AppAweDoLoader.java rename to src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppAweDoLoader.java index fb4615042..0fa728020 100644 --- a/src_app/apx/com/amarsoft/als/base/constant/cache/loader/AppAweDoLoader.java +++ b/src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppAweDoLoader.java @@ -1,12 +1,12 @@ -package apx.com.amarsoft.als.base.constant.cache.loader; - -import apx.com.amarsoft.als.base.constant.cache.AppAweDoCache; - -import com.amarsoft.dict.als.cache.AbstractCache; -import com.amarsoft.dict.als.cache.loader.AbstractLoader; - -public class AppAweDoLoader extends AbstractLoader { - public AbstractCache getCacheInstance() { - return AppAweDoCache.getInstance(); - } -} +package apx.com.amarsoft.als.base.cache.loader; + +import apx.com.amarsoft.als.base.cache.instance.AppAweDoCache; + +import com.amarsoft.dict.als.cache.AbstractCache; +import com.amarsoft.dict.als.cache.loader.AbstractLoader; + +public class AppAweDoLoader extends AbstractLoader { + public AbstractCache getCacheInstance() { + return AppAweDoCache.getInstance(); + } +} diff --git a/src_app/apx/com/amarsoft/als/base/constant/cache/loader/AppCodeLoader.java b/src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppCodeLoader.java similarity index 67% rename from src_app/apx/com/amarsoft/als/base/constant/cache/loader/AppCodeLoader.java rename to src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppCodeLoader.java index cb7520d59..07afc6039 100644 --- a/src_app/apx/com/amarsoft/als/base/constant/cache/loader/AppCodeLoader.java +++ b/src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppCodeLoader.java @@ -1,12 +1,12 @@ -package apx.com.amarsoft.als.base.constant.cache.loader; - -import apx.com.amarsoft.als.base.constant.cache.AppCodeCache; - -import com.amarsoft.dict.als.cache.AbstractCache; -import com.amarsoft.dict.als.cache.loader.AbstractLoader; - -public class AppCodeLoader extends AbstractLoader { - public AbstractCache getCacheInstance() { - return AppCodeCache.getInstance(); - } -} +package apx.com.amarsoft.als.base.cache.loader; + +import apx.com.amarsoft.als.base.cache.instance.AppCodeCache; + +import com.amarsoft.dict.als.cache.AbstractCache; +import com.amarsoft.dict.als.cache.loader.AbstractLoader; + +public class AppCodeLoader extends AbstractLoader { + public AbstractCache getCacheInstance() { + return AppCodeCache.getInstance(); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppConfigLoader.java b/src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppConfigLoader.java new file mode 100644 index 000000000..cde7f49a2 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppConfigLoader.java @@ -0,0 +1,11 @@ +package apx.com.amarsoft.als.base.cache.loader; + +import apx.com.amarsoft.als.base.cache.instance.AppConfigCache; + +import com.amarsoft.dict.als.cache.loader.AbstractLoader; + +public class AppConfigLoader extends AbstractLoader { + public AppConfigCache getCacheInstance() { + return AppConfigCache.getInstance(); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppConstantLoader.java b/src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppConstantLoader.java new file mode 100644 index 000000000..ceb5c4318 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/cache/loader/AppConstantLoader.java @@ -0,0 +1,12 @@ +package apx.com.amarsoft.als.base.cache.loader; + +import apx.com.amarsoft.als.base.cache.instance.AppConstantCache; + +import com.amarsoft.dict.als.cache.AbstractCache; +import com.amarsoft.dict.als.cache.loader.AbstractLoader; + +public class AppConstantLoader extends AbstractLoader { + public AbstractCache getCacheInstance() { + return AppConstantCache.getInstance(); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/flow/AppConfigFlow.java b/src_app_fresh/apx/com/amarsoft/als/base/flow/AppConfigFlow.java new file mode 100644 index 000000000..add9320d8 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/flow/AppConfigFlow.java @@ -0,0 +1,154 @@ +package apx.com.amarsoft.als.base.flow; + +import java.util.ArrayList; +import java.util.List; + +import jbo.app.APP_BUSINESS_GROUP; +import jbo.app.APP_BUSINESS_TEMPLATE; +import jbo.app.PRD_NODEINFO_CATALOG_APP; +import jbo.app.PRD_NODEINFO_LIBRARY_APP; +import jbo.app.PRD_NODEINFO_MIDDLE_APP; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; + +public class AppConfigFlow { + + private String flowNo; + private String phaseNo; + + private String id; + + public void setId(String id) { + this.id = id; + } + + public void setFlowNo(String flowNo) { + this.flowNo = flowNo; + } + + public void setPhaseNo(String phaseNo) { + this.phaseNo = phaseNo; + } + + private String groupCode; + + public void setGroupCode(String groupCode) { + this.groupCode = groupCode; + } + + public List queryTemplate(JBOTransaction tx) throws JBOException { + BizObjectManager bom = JBOFactory + .getBizObjectManager(APP_BUSINESS_TEMPLATE.CLASS_NAME); + String sql = "GROUP_CODE='" + this.groupCode + "'"; + List bos = bom.createQuery(sql).getResultList(false); + return bos; + } + + public BizObject queryGroup(JBOTransaction tx) throws JBOException { + BizObjectManager bom = JBOFactory + .getBizObjectManager(APP_BUSINESS_GROUP.CLASS_NAME); + String sql = "GROUP_CODE='" + this.groupCode + "'"; + BizObject bo = bom.createQuery(sql).getSingleResult(false); + return bo; + } + + public BizObject queryLibraryById(JBOTransaction tx) throws JBOException { + BizObjectManager bom = JBOFactory + .getBizObjectManager(PRD_NODEINFO_LIBRARY_APP.CLASS_NAME); + String sql = "id='" + this.id + "'"; + BizObject bo = bom.createQuery(sql).getSingleResult(false); + return bo; + } + + public List queryAppConfigDetailByProduct(JBOTransaction tx) + throws JBOException { + BizObjectManager bom = JBOFactory + .getBizObjectManager(PRD_NODEINFO_CATALOG_APP.CLASS_NAME); + String sql = "FLOWNO='" + this.flowNo + "'"; + sql += " AND CONFIG_TYPE='Product' ORDER BY SORTNO"; + List bos = bom.createQuery(sql).getResultList(false); + return bos; + } + + public List queryAppConfigDetailByProject(JBOTransaction tx) + throws JBOException { + BizObjectManager bom = JBOFactory + .getBizObjectManager(PRD_NODEINFO_CATALOG_APP.CLASS_NAME); + String sql = "FLOWNO='" + this.flowNo + "'"; + if (StringX.isSpace(this.phaseNo)) { + sql += " AND (PHASENO IS NULL OR PHASE='')"; + } else { + sql += " AND PHASENO='" + this.phaseNo + "'"; + } + sql += " AND CONFIG_TYPE='Project' ORDER BY SORTNO"; + List bos = bom.createQuery(sql).getResultList(false); + return bos; + } + + private String catalogId; + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public List queryMiddleByCatalogId(JBOTransaction tx) + throws JBOException { + BizObjectManager bom = JBOFactory + .getBizObjectManager(PRD_NODEINFO_MIDDLE_APP.CLASS_NAME); + List newBos = new ArrayList(); + if (StringX.isSpace(this.catalogId)) + return newBos; + newBos = bom.createQuery("O.APP_NODE_CATALOG_ID='"+this.catalogId+"' AND O.ISINUSE=1 ORDER BY O.SORTNO") + .getResultList(false); + return newBos; + } + +// public List queryLibraryByCatalogId(JBOTransaction tx) +// throws JBOException { +// +// BizObjectManager bom = JBOFactory +// .getBizObjectManager(PRD_NODEINFO_LIBRARY_APP.CLASS_NAME); +// List bos = bom.createQuery("1=1 ORDER BY SORTNO") +// .getResultList(false); +// List newBos = new ArrayList(); +// +// if (StringUtils.isBlank(this.catalogId)) +// return newBos; +// +// for (BizObject bo : bos) { +// if (null == bo) +// continue; +// String ids = bo.getAttribute("APP_NODEID") == null ? "" : bo +// .getAttribute("APP_NODEID").toString(); +// String[] array = ids.split(","); +// if (array.length < 1) +// continue; +// for (String id : array) { +// if (id.equals(catalogId)) { +// newBos.add(bo); +// } +// } +// } +// return newBos; +// } + private String middleId; + + public void setMiddleId(String middleId) { + this.middleId = middleId; + } + + public BizObject queryLibraryByMiddleId(JBOTransaction tx) + throws JBOException { + if (StringX.isSpace(this.middleId)) + return null; + BizObjectManager bom = JBOFactory + .getBizObjectManager(PRD_NODEINFO_LIBRARY_APP.CLASS_NAME); + BizObject bo = bom.createQuery("O.ID='"+this.middleId+"'").getSingleResult(false); + return bo; + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/flow/Flow.java b/src_app_fresh/apx/com/amarsoft/als/base/flow/Flow.java new file mode 100644 index 000000000..563cbeff5 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/flow/Flow.java @@ -0,0 +1,92 @@ +package apx.com.amarsoft.als.base.flow; + +import java.util.HashMap; +import java.util.Map; + +import jbo.sys.CODE_LIBRARY; +import jbo.sys.FLOW_CATALOG; +import jbo.sys.FLOW_MODEL; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.base.util.BizObjectUtil; + +public abstract class Flow { + protected String sFlowNo; + protected String sFlowPageConfig; + + public String getsFlowNo() { + return sFlowNo; + } + + public void setsFlowNo(String sFlowNo) { + this.sFlowNo = sFlowNo; + } + + public String getsFlowPageConfig() { + return sFlowPageConfig; + } + + public void setsFlowPageConfig(String sFlowPageConfig) { + this.sFlowPageConfig = sFlowPageConfig; + } + + /** + * 获取 合同审批流程基本信息 + * + * @param tx + * @return + * @throws JBOException + */ + public Map queryBaseInfo(JBOTransaction tx) + throws JBOException { + BizObjectManager bom = JBOFactory + .getBizObjectManager(FLOW_CATALOG.CLASS_NAME); + BizObject bo = bom.createQuery("FlowNo='" + sFlowNo + "'") + .getSingleResult(false); + if (null == bo) + return new HashMap(); + Map map = new HashMap(); + map.put("flowNo", bo.getAttribute("FLOWNO").getValue()); + map.put("display", bo.getAttribute("FLOWNAME").getValue()); + map.put("flowType", bo.getAttribute("FLOWTYPE").getValue()); + return map; + } + + /** + * 获取 合同审批流程模型 + * + * @param tx + * @param sPhaseNo + * @return + * @throws JBOException + */ + public Map queryModel(JBOTransaction tx, String sPhaseNo) + throws JBOException { + // FLOW_MODEL + BizObjectManager bom = JBOFactory + .getBizObjectManager(FLOW_MODEL.CLASS_NAME); + BizObject bo = bom.createQuery( + "FlowNo='" + sFlowNo + "' AND PHASENO='" + sPhaseNo + "'") + .getSingleResult(false); + if (null == bo) + return new HashMap(); + BizObjectUtil util = new BizObjectUtil(); + Map map = new HashMap(); + map = util.bizObject2MapValue2(bo); + String attribute4 = bo.getAttribute("ATTRIBUTE4".toLowerCase()) == null ? "" : bo.getAttribute( + "ATTRIBUTE4".toLowerCase()).toString(); + + BizObjectManager bom1 = JBOFactory + .getBizObjectManager(CODE_LIBRARY.CLASS_NAME); + BizObject bo1 = bom1.createQuery("ITEMNO='" + attribute4+"'") + .getSingleResult(false); + String attribute2 = bo1.getAttribute("attribute2") == null ? "" : bo1 + .getAttribute("attribute2").toString(); + map.put("button", attribute2); + return map; + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/flow/FlowTask.java b/src_app_fresh/apx/com/amarsoft/als/base/flow/FlowTask.java new file mode 100644 index 000000000..a7b4ca447 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/flow/FlowTask.java @@ -0,0 +1,103 @@ +package apx.com.amarsoft.als.base.flow; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + + + + +import jbo.sys.FLOW_OBJECT; +import jbo.sys.FLOW_TASK; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.util.MultipartDataUtil; + +public class FlowTask { + private String flowNo; + private String objectNo; +// private String objectType; +// private String phaseType; +// private String applyType; + private String serialNo; +// private String userId; + +// public void setObjectType(String objectType) { +// this.objectType = objectType; +// } +// +// public void setPhaseType(String phaseType) { +// this.phaseType = phaseType; +// } +// +// public void setApplyType(String applyType) { +// this.applyType = applyType; +// } +// +// public void setUserId(String userId) { +// this.userId = userId; +// } + + public void setSerialNo(String serialNo) { + this.serialNo = serialNo; + } + + public void setFlowNo(String flowNo) { + this.flowNo = flowNo; + } + + public void setObjectNo(String objectNo) { + this.objectNo = objectNo; + } + + @SuppressWarnings("unchecked") + public BizObject queryFlowTask(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, Map fieldMap) + throws Exception { + if (null == fieldMap) { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + } + objectNo = fieldMap.get("OBJECTNO") == null ? "" : fieldMap.get( + "OBJECTNO").toString(); + serialNo = fieldMap.get("SERIALNO") == null ? "" : fieldMap.get( + "SERIALNO").toString(); + return queryFlowTask(tx); + } + + public BizObject queryFlowTask(JBOTransaction tx) throws Exception { + String sSql = "SELECT O.* FROM O,"; + sSql += FLOW_OBJECT.CLASS_NAME + " FLOW_OBJECT "; + sSql += "WHERE FLOW_OBJECT.OBJECTNO=O.OBJECTNO "; + sSql += "AND FLOW_OBJECT.FLOWNO=O.FLOWNO "; + sSql += "AND FLOW_OBJECT.PHASENO=O.PHASENO "; + sSql += "AND FLOW_OBJECT.PHASETYPE=O.PHASETYPE "; + sSql += "AND FLOW_OBJECT.OBJECTNO='" + objectNo + "' "; + BizObjectManager bom = JBOFactory + .getBizObjectManager(FLOW_TASK.CLASS_NAME); + + sSql = (!StringX.isSpace(this.serialNo)) ? "SERIALNO='" + serialNo + + "'" : sSql; + return bom.createQuery(sSql).getSingleResult(false); + } + + public BizObject queryFlowTaskByFlowObject(JBOTransaction tx) + throws JBOException { + BizObjectManager bom = JBOFactory + .getBizObjectManager(FLOW_TASK.CLASS_NAME); + return bom + .createQuery( + "SELECT O.* FROM O, " + + FLOW_OBJECT.CLASS_NAME + + " FLOW_OBJECT WHERE FLOW_OBJECT.OBJECTNO=O.OBJECTNO AND FLOW_OBJECT.PHASENO=O.PHASENO AND FLOW_OBJECT.FLOWNO=:FLOWNO AND FLOW_OBJECT.OBJECTNO=:OBJECTNO") + .setParameter("FLOWNO", flowNo) + .setParameter("OBJECTNO", objectNo).getSingleResult(false); + } +} diff --git a/src_app/apx/com/amarsoft/als/base/model/Footer.java b/src_app_fresh/apx/com/amarsoft/als/base/model/Footer.java similarity index 100% rename from src_app/apx/com/amarsoft/als/base/model/Footer.java rename to src_app_fresh/apx/com/amarsoft/als/base/model/Footer.java diff --git a/src_app/apx/com/amarsoft/als/base/model/Header.java b/src_app_fresh/apx/com/amarsoft/als/base/model/Header.java similarity index 100% rename from src_app/apx/com/amarsoft/als/base/model/Header.java rename to src_app_fresh/apx/com/amarsoft/als/base/model/Header.java diff --git a/src_app/apx/com/amarsoft/als/base/model/RspObject.java b/src_app_fresh/apx/com/amarsoft/als/base/model/RspObject.java similarity index 100% rename from src_app/apx/com/amarsoft/als/base/model/RspObject.java rename to src_app_fresh/apx/com/amarsoft/als/base/model/RspObject.java diff --git a/src_app_fresh/apx/com/amarsoft/als/base/product/Product.java b/src_app_fresh/apx/com/amarsoft/als/base/product/Product.java new file mode 100644 index 000000000..cf43fe2a0 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/product/Product.java @@ -0,0 +1,167 @@ +//package apx.com.amarsoft.als.base.product; +// +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.List; +//import java.util.Map; +// +//import jbo.app.BUSINESS_TYPE; +//import jbo.com.tenwa.lease.comm.LB_MAIN_PROJECT_INFO; +//import jbo.com.tenwa.lease.comm.LB_RESERVE_PROJECT_PRODUCT; +//import jbo.prd.PRD_NODEINFO; +//import jbo.prd.PRD_STAGENODE; +// +//import com.amarsoft.app.lc.workflow.action.GetFlowAction; +//import com.amarsoft.are.jbo.BizObject; +//import com.amarsoft.are.jbo.BizObjectManager; +//import com.amarsoft.are.jbo.JBOFactory; +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.are.util.json.JSONDecoder; +//import com.amarsoft.are.util.json.JSONObject; +// +//public class Product { +// // private String sProjectId; +// private String sObjectNo; +// private String sPrdStage; +// +// public void setsPrdStage(String sPrdStage) { +// this.sPrdStage = sPrdStage; +// } +// +// // public void setsProjectId(String sProjectId) { +// // this.sProjectId = sProjectId; +// // } +// +// public void setsObjectNo(String sObjectNo) { +// this.sObjectNo = sObjectNo; +// } +// +// /** +// * 获取产品信息 +// * +// * @param tx +// * @return +// * @throws Exception +// */ +// @SuppressWarnings("unchecked") +// public Map queryProductInfo(JBOTransaction tx) +// throws Exception { +// Map resultMap = new HashMap(); +// Map flowParams = GetFlowAction.getFlowParamByFlowUnid(sObjectNo); +// Map flowParams1 = new HashMap(); +// for (String sKey : flowParams.keySet()) { +// flowParams1.put(sKey, flowParams.get(sKey)); +// } +// String sMainProjectId = flowParams.get("MainProjectId"); +// String sReserveProjectId = flowParams.get("ReserveProjectId"); +// String sProjectProduct = flowParams.get("ProjectProduct"); +// System.out.println("MainProjectId:" + sMainProjectId); +// System.out.println("ReserveProjectId:" + sReserveProjectId); +// System.out.println("ProjectProduct:" + sProjectProduct); +// JSONObject jsonObject = JSONDecoder.decode(sProjectProduct); +// flowParams1.put("ProjectProduct", jsonObject); +// resultMap.put("flowParams", flowParams1); +// BizObjectManager bom = JBOFactory +// .getBizObjectManager(LB_RESERVE_PROJECT_PRODUCT.CLASS_NAME); +// String sSql = ""; +// if (null == sReserveProjectId) { +// sSql = "SELECT "; +// sSql += "DISTINCT BUSINESS_TYPE.TYPENO, BUSINESS_TYPE.TYPENAME, BUSINESS_TYPE.SORTNO "; +// sSql += "FROM O, " + LB_MAIN_PROJECT_INFO.CLASS_NAME +// + " LB_MAIN_PROJECT_INFO, " + BUSINESS_TYPE.CLASS_NAME +// + " BUSINESS_TYPE "; +// sSql += ""; +// sSql += "WHERE LB_MAIN_PROJECT_INFO.RESERVEPROJECTID = O.PROJECT_ID "; +// sSql += "AND BUSINESS_TYPE.TYPENO=O.PRODUCT_ID "; +// sSql += "AND LB_MAIN_PROJECT_INFO.RESERVEPROJECTID='" +// + sMainProjectId + "' "; +// sSql += "ORDER BY BUSINESS_TYPE.SORTNO"; +// } else { +// sSql = "SELECT "; +// sSql += "DISTINCT BUSINESS_TYPE.TYPENO, BUSINESS_TYPE.TYPENAME, BUSINESS_TYPE.SORTNO "; +// sSql += "FROM O, " + BUSINESS_TYPE.CLASS_NAME + " BUSINESS_TYPE "; +// sSql += ""; +// sSql += "WHERE BUSINESS_TYPE.TYPENO=O.PRODUCT_ID "; +// sSql += "AND O.PROJECT_ID='" + sReserveProjectId + "' "; +// sSql += "ORDER BY BUSINESS_TYPE.SORTNO"; +// } +// +// List bos = bom.createQuery(sSql).getResultList(false); +// List> list = new ArrayList>(); +// for (BizObject bo : bos) { +// if (null == bo) +// continue; +// String sTypeNo = (String) bo.getAttribute("TYPENO").getValue(); +// Map map = new HashMap(); +// map.put("code", sTypeNo); +// map.put("display", bo.getAttribute("TYPENAME").getValue()); +// BizObjectManager bom2 = JBOFactory +// .getBizObjectManager(PRD_NODEINFO.CLASS_NAME); +// String sSql2 = "SELECT "; +// sSql2 += "DISTINCT O.NodeID,O.NodeName,O.ItemDescribe, O.SORTNO "; +// sSql2 += "FROM O," + PRD_STAGENODE.CLASS_NAME + " PS"; +// sSql2 += " WHERE PS.node_id=O.nodeid AND PS.prd_id='" + sTypeNo +// + "' AND PS.PRD_STAGE='" + sPrdStage +// + "' ORDER BY O.SORTNO"; +// List bos2 = bom2.createQuery(sSql2).getResultList(false); +// List> list2 = new ArrayList>(); +// for (BizObject bo2 : bos2) { +// if (null == bo2) +// continue; +// Map map2 = new HashMap(); +// map2.put("code", bo2.getAttribute("NodeID").getValue()); +// map2.put("display", bo2.getAttribute("NodeName").getValue()); +// list2.add(map2); +// List> list3 = new ArrayList>(); +// String sItemDescribe = (String) bo2 +// .getAttribute("ITEMDESCRIBE").getValue(); +// if (sItemDescribe.contains("'")) { +// BizObjectManager bom3 = JBOFactory +// .getBizObjectManager(PRD_NODEINFO.CLASS_NAME); +// String sSql3 = "SELECT DISTINCT O.NodeID,O.NodeName,O.ItemDescribe, O.SORTNO "; +// sSql3 += "FROM O WHERE O.NODEID IN(" + sItemDescribe +// + ") ORDER BY O.SORTNO"; +// List bos3 = bom3.createQuery(sSql3) +// .getResultList(false); +// for (BizObject bo3 : bos3) { +// if (null == bo3) +// continue; +// Map map3 = new HashMap(); +// map3.put("code", bo3.getAttribute("NodeID").getValue()); +// map3.put("display", bo3.getAttribute("NodeName") +// .getValue()); +// list3.add(map3); +// } +// map2.put("submenu", list3); +// } else { +// map2.put("submenu", new ArrayList>()); +// } +// map.put("menu", list2); +// } +// list.add(map); +// } +// resultMap.put("menuInfo", list); +// return resultMap; +// // BizObjectManager bom = JBOFactory +// // .getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME); +// // BizObject bo = bom.createQuery("FLOW_UNID='" + sObjectNo + "'") +// // .getSingleResult(false); +// // if (null == bo) +// // return new ArrayList>(); +// // sProjectId = bo.getAttribute("proj_id") == null ? "" : +// // bo.getAttribute("proj_id").toString(); +// // BizObjectManager bom1 = JBOFactory +// // .getBizObjectManager(LB_RESERVE_PROJECT_PRODUCT.CLASS_NAME); +// // List bos = +// // bom1.createQuery("SELECT BUSINESS_TYPE.TYPENO, BUSINESS_TYPE.TYPENAME FROM O, "+BUSINESS_TYPE.CLASS_NAME+" BUSINESS_TYPE WHERE BUSINESS_TYPE.TYPENO=O.PROJECT_ID AND O.PROJECT_ID='"+sProjectId+"'").getResultList(false); +// // List> list = new ArrayList>(); +// // for (BizObject bo1 : bos) { +// // if (bo1 == null) continue; +// // Map map = new HashMap(); +// // map.put("code", bo1.getAttribute("TYPENO").getValue()); +// // map.put("display", bo1.getAttribute("TYPENAME").getValue()); +// // list.add(map); +// // } +// // return list; +// } +//} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/script/TableScript.java b/src_app_fresh/apx/com/amarsoft/als/base/script/TableScript.java new file mode 100644 index 000000000..12e5ca4ee --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/script/TableScript.java @@ -0,0 +1,8 @@ +package apx.com.amarsoft.als.base.script; + +import java.util.Map; + +public abstract class TableScript { + //参数:0.是否显示, 1.标题,2.URL,3. 是否有关闭按钮(默认无)) + public abstract Map createTab(boolean bFalg, String sTitle, boolean sEnableClose); +} diff --git a/src_app_fresh/apx/com/amarsoft/als/base/tree/Tree.java b/src_app_fresh/apx/com/amarsoft/als/base/tree/Tree.java new file mode 100644 index 000000000..c2fdf1b41 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/base/tree/Tree.java @@ -0,0 +1,104 @@ +package apx.com.amarsoft.als.base.tree; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import jbo.sys.CODE_CATALOG; +import jbo.sys.CODE_LIBRARY; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.base.util.BizObjectUtil; + +public class Tree { + protected String CODE; + public String getCODE() { + return CODE; + } + + public void setCODE(String cODE) { + CODE = cODE; + } + + /** + * 获取 合同审批流程 主 树图 + * + * @param tx + * @return + * @throws JBOException + */ + @SuppressWarnings("unchecked") + public List> queryTree(JBOTransaction tx) + throws JBOException { + // FLOW_CATALOG + BizObjectManager bom = JBOFactory + .getBizObjectManager(CODE_CATALOG.CLASS_NAME); + List bos = bom.createQuery("CODENO='" + CODE + "'") + .getResultList(false); + List> list = new ArrayList>(); + for (BizObject bo : bos) { + if (null == bo) continue; + BizObjectUtil util = new BizObjectUtil(); + list.add(util.bizObject2MapValue2(bo)); + } + return list; + } + + /** + * 获取 合同审批流程 主 树图库 + * + * @param tx + * @return + * @throws JBOException + */ + @SuppressWarnings("unchecked") + public List> queryTreeLibrary(JBOTransaction tx) + throws JBOException { + // FLOW_CATALOG + BizObjectManager bom = JBOFactory + .getBizObjectManager(CODE_LIBRARY.CLASS_NAME); + List bos = bom.createQuery("CODENO='" + CODE + "'") + .getResultList(false); + List> list = new ArrayList>(); + for (BizObject bo : bos) { + if (null == bo) continue; + Map map = new HashMap(); + map.put("code", bo.getAttribute("ITEMNO").getValue()); + map.put("display", bo.getAttribute("ITEMNAME").getValue()); + map.put("buttoms", bo.getAttribute("ITEMDESCRIBE").getValue()); + list.add(map); + } + return list; + } + + /** + * 获取 合同审批流程 详情树图库 + * + * @param tx + * @return + * @throws JBOException + */ + public List> queryPhaseTreeLibrary(JBOTransaction tx, String sFlowPageConfig) + throws JBOException { + // FLOW_CATALOG + BizObjectManager bom = JBOFactory + .getBizObjectManager(CODE_LIBRARY.CLASS_NAME); + List bos = bom.createQuery("CODENO='" + sFlowPageConfig + "' AND ISINUSE = '1' ORDER BY SORTNO") + .getResultList(false); + List> list = new ArrayList>(); + for (BizObject bo : bos) { + if (null == bo) continue; + Map map = new HashMap(); + map.put("code", bo.getAttribute("ITEMNO").getValue()); + map.put("flowPageConfig", sFlowPageConfig); + map.put("display", bo.getAttribute("ITEMNAME").getValue()); + list.add(map); + } + return list; + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/action/back/controller/BackStepCommController.java b/src_app_fresh/apx/com/amarsoft/als/business/action/back/controller/BackStepCommController.java new file mode 100644 index 000000000..30f9bfdb8 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/action/back/controller/BackStepCommController.java @@ -0,0 +1,95 @@ +package apx.com.amarsoft.als.business.action.back.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.business.action.service.BackStepService; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +/** + * 通用流程退回 + * + * @author jiaji.liu + * + */ +@Path("/flow/action") +public class BackStepCommController { + // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + BackStepService service = new BackStepService(); + + /** + * 通用流程退回 + * + * @param request + * @param sqlca + * @param tx + * @return + * @throws Exception + */ + @Path("/back/commit") + @POST + public Map back(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx) + throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] BackStepCommController run ................."); + ARE.getLog().info( + "[Path] /flow/action/back/commit" + " run ................."); + try { + + return service.back(request, sqlca, tx, null, ReturnMapUtil, + request.getSession().getAttribute("userid").toString()); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + + @Path("/return/task/before") + @POST + public Map queryReturnTaskList(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx) + throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] BackStepCommController run ................."); + ARE.getLog().info( + "[Path] /flow/action/return/task/before" + " run ................."); + try { + + return service.queryReturnTaskList(request, sqlca, tx, null, ReturnMapUtil, + request.getSession().getAttribute("userid").toString()); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + + @Path("/return/task") + @POST + public Map taskReturn(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx) + throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] BackStepCommController run ................."); + ARE.getLog().info( + "[Path] /flow/action/return/task" + " run ................."); + try { + + return service.taskReturn(request, sqlca, tx, null, ReturnMapUtil, + request.getSession().getAttribute("userid").toString()); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/action/ready/controller/FlowActionReadyController.java b/src_app_fresh/apx/com/amarsoft/als/business/action/ready/controller/FlowActionReadyController.java new file mode 100644 index 000000000..1618c51f5 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/action/ready/controller/FlowActionReadyController.java @@ -0,0 +1,69 @@ +package apx.com.amarsoft.als.business.action.ready.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.business.action.scenario.AutoRiskScanService; +import apx.com.amarsoft.als.business.action.service.DoSubmitService; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +@Path("/flow/action") +public class FlowActionReadyController { + AutoRiskScanService service = new AutoRiskScanService(); + DoSubmitService service2 = new DoSubmitService(); + + @Path("/scan/service") + @POST + public Map submitReady(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] FlowActionReadyController run ................."); + ARE.getLog().info( + "[Path] /flow/action/scan/service" + " run ................."); + try { + + return service + .autoRiskScan(request, sqlca, tx, null, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + /** + * 通用流程提交获取路由 + * + * @param request + * @param sqlca + * @param tx + * @return + * @throws Exception + */ + @Path("/submit/service") + @POST + public Map doSubmit(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx) + throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] FlowActionReadyController run ................."); + ARE.getLog() + .info("[Path] /flow/action/submit/service" + + " run ................."); + try { + return service2.doSubmit(request, sqlca, tx, null, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/action/scenario/AutoRiskScanService.java b/src_app_fresh/apx/com/amarsoft/als/business/action/scenario/AutoRiskScanService.java new file mode 100644 index 000000000..50c917aaa --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/action/scenario/AutoRiskScanService.java @@ -0,0 +1,162 @@ +package apx.com.amarsoft.als.business.action.scenario; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.flow.FlowTask; +import apx.com.amarsoft.als.business.action.service.DoSubmitService; + +import com.amarsoft.app.flow.FlowAction; +import com.amarsoft.app.lc.workflow.action.GetFlowAction; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.util.ReturnMapUtil; +import com.base.util.ScenarioUtil; + +public class AutoRiskScanService { + // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + private String taskNo; + private String objectType; + private String objectNo; + private String flowNo; + private String flowName; + private String phaseNo; + private String bizArgs; + + private String applyType; // 申请类型 + private String phaseName; // 节点名称 + private String assignedTaskNo; // 退回节点流水号 + private String flowState; // 流程状态 + + public void setTaskNo(String taskNo) { + this.taskNo = taskNo; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public void setObjectNo(String objectNo) { + this.objectNo = objectNo; + } + + public void setFlowNo(String flowNo) { + this.flowNo = flowNo; + } + + public void setFlowName(String flowName) { + this.flowName = flowName; + } + + public void setPhaseNo(String phaseNo) { + this.phaseNo = phaseNo; + } + + public void setBizArgs(String bizArgs) { + this.bizArgs = bizArgs; + } + + public Map autoRiskScan(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, Map fieldMap, + ReturnMapUtil ReturnMapUtil) throws Exception { + DoSubmitService service = new DoSubmitService(); + Map map = service.doSubmitScanBefore(request, sqlca, + tx, null, ReturnMapUtil); + if (null != map) + return map; + + fieldMap = service.getFieldMap(); + String userId = fieldMap.get("userid") == null ? "" : fieldMap.get( + "userid").toString(); + if (StringX.isSpace(bizArgs)) { + // this.taskNo = this.taskNo == null ? "" : this.taskNo; + FlowTask FlowTask = new FlowTask(); + // FlowTask.setSerialNo(taskNo); + BizObject bo = FlowTask.queryFlowTask(request, sqlca, tx, fieldMap); + if (null != bo) { + this.objectType = bo.getAttribute("OBJECTTYPE") == null ? "" + : bo.getAttribute("OBJECTTYPE").toString(); + this.objectNo = bo.getAttribute("OBJECTNO") == null ? "" : bo + .getAttribute("OBJECTNO").toString(); + this.flowNo = bo.getAttribute("FLOWNO") == null ? "" : bo + .getAttribute("FLOWNO").toString(); + this.phaseNo = bo.getAttribute("PHASENO") == null ? "" : bo + .getAttribute("PHASENO").toString(); + this.taskNo = bo.getAttribute("SERIALNO") == null ? "" : bo + .getAttribute("SERIALNO").toString(); + this.flowName = bo.getAttribute("FLOWNAME") == null ? "" : bo + .getAttribute("FLOWNAME").toString(); + this.applyType = bo.getAttribute("APPLYTYPE") == null ? "" : bo + .getAttribute("APPLYTYPE").toString(); + this.phaseName = bo.getAttribute("phasename") == null ? "" : bo + .getAttribute("phasename").toString(); + this.assignedTaskNo = bo.getAttribute("assignedtaskno") == null ? "" + : bo.getAttribute("assignedtaskno").toString(); + this.flowState = bo.getAttribute("flowState") == null ? "" : bo + .getAttribute("flowState").toString(); + this.bizArgs = "ObjectType=" + objectType + "&ObjectNo=" + + objectNo + "&PhaseNo=" + phaseNo + "&TaskNo=" + + taskNo + "&UserId=" + userId + "&isAutoCommit=true"; + } + } + BizObject task = GetFlowAction.getFlowTaskParams(taskNo); + String flowState = task.getAttribute("FLOWSTATE") == null ? "" : task + .getAttribute("FLOWSTATE").getString(); + String assignedTaskNo = task.getAttribute("assignedTaskNo") == null ? "" + : task.getAttribute("assignedTaskNo").getString(); + + if (StringX.isSpace(flowName)) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL"), + "缺少风险预警CODE!"); + return ReturnMapUtil.getReturnMap(); + } + + if (StringX.isSpace(bizArgs)) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL"), + "缺少风险预警检测参数!"); + return ReturnMapUtil.getReturnMap(); + } + + ScenarioUtil scenarioUtil = new ScenarioUtil(); + boolean autoResult = scenarioUtil.autoRiskScan(flowName, bizArgs, "", + tx, sqlca); + Map body = new HashMap(); + body.put("autoResult", autoResult); + if (autoResult && (!StringX.isSpace(scenarioUtil.getsMsg()))) { + body.put("autoDetail", scenarioUtil.getsMsg()); + } else { + body.put("autoDetail", scenarioUtil.getList()); + } + if (autoResult) { + // 此任务为退回的任务,将按照要求在退回后重新提交给退回人!是否继续? + body.put("assignedTaskNo", assignedTaskNo); + if (flowState.equals("MEETING")) { + + } else { + FlowAction FlowAction = new FlowAction(); + FlowAction.setTaskNo(taskNo); + FlowAction.setObjectNo(objectNo); +// String sRet = FlowAction.getVotedNum(tx); // 得到已投票个数 + String sNum = FlowAction.getMeetingNum(tx); // 得到未投票个数 + + if(Integer.valueOf(sNum)>0){ + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty.get("FAIL"), "目前还有委员没有投票,不允许提交!"); + return ReturnMapUtil.getReturnMap(); + } + } + body.put("flowState", flowState); + } + + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty.get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/action/service/BackStepService.java b/src_app_fresh/apx/com/amarsoft/als/business/action/service/BackStepService.java new file mode 100644 index 000000000..605a893c1 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/action/service/BackStepService.java @@ -0,0 +1,191 @@ +package apx.com.amarsoft.als.business.action.service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import jbo.sys.FLOW_TASK; +import apx.com.amarsoft.als.base.flow.FlowTask; + +import com.amarsoft.app.flow.FlowAction; +import com.amarsoft.app.lc.workflow.action.FlowManageAction; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.util.BizObjectUtil; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +public class BackStepService { + private Map fieldMap; + private String message; + + @SuppressWarnings("unchecked") + public Map queryReturnTaskList( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx, Map fieldMap, + ReturnMapUtil ReturnMapUtil, String userId) throws Exception { + this.fieldMap = fieldMap; + if (null == this.fieldMap) { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + this.fieldMap = (Map) testMap.get("fieldMap"); + } + +// String taskNo = this.fieldMap.get("serialno") == null ? "" +// : this.fieldMap.get("serialno").toString(); + FlowTask FlowTask = new FlowTask(); + BizObject task = FlowTask.queryFlowTask(request, sqlca, tx, this.fieldMap); + + if (null == task) { + message = "请选择一条信息!"; + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("fail").toString(), + message); + return ReturnMapUtil.getReturnMap(); + } + + String objectNo = task.getAttribute("objectNo") == null ? "" : task + .getAttribute("objectNo").toString(); + String flowNo = task.getAttribute("flowNo") == null ? "" : task + .getAttribute("flowNo").toString(); + String phaseNo = task.getAttribute("phaseNo") == null ? "" : task + .getAttribute("phaseNo").toString(); + + String queryStr = "select serialNo,userID,USERNAME,phaseNo,phaseName,"; + queryStr += "beginTime,endTime from O,jbo.sys.FLOW_MODEL FM "; + queryStr += "where O.flowNo=FM.flowNo and O.phaseNo=FM.phaseNo and objectNo='"; + queryStr += objectNo; + queryStr += "'"; + queryStr += " and flowNo='"; + queryStr += flowNo; + queryStr += "' and phaseNo<'"; + queryStr += phaseNo; + queryStr += "' and v.nvl(FM.attribute7,'01')='01' "; + queryStr += "and ForkState is null "; + queryStr += "and flowState not in('VOTED','UNVOTED','COLLECT') "; + queryStr += "and endtime is not null order by endtime desc "; + + BizObjectManager bom = JBOFactory.getBizObjectManager(FLOW_TASK.CLASS_NAME); + List bos = bom.createQuery(queryStr).getResultList(false); + BizObjectUtil BizObjectUtil = new BizObjectUtil(); + List> list = new ArrayList>(); + for (BizObject bo : bos) { + Map map = BizObjectUtil.bizObject2MapValue2(bo); + list.add(map); + } + Map body = new HashMap(); + body.put("returnTaskList", list); + + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("SUCCESS").toString(), + message); + return ReturnMapUtil.getReturnMap(); + } + + @SuppressWarnings("unchecked") + public Map taskReturn(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx, + Map fieldMap, ReturnMapUtil ReturnMapUtil, + String userId) throws Exception { + this.fieldMap = fieldMap; + if (null == this.fieldMap) { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + this.fieldMap = (Map) testMap.get("fieldMap"); + } + + String taskNo = this.fieldMap.get("serialno") == null ? "" + : this.fieldMap.get("serialno").toString(); + + FlowTask FlowTask = new FlowTask(); + BizObject task = FlowTask.queryFlowTask(request, sqlca, tx, this.fieldMap); + + if (null == task) { + message = "请选择一条信息!"; + } + + String returnTaskNo = this.fieldMap.get("returntaskno") == null ? "" + : this.fieldMap.get("returntaskno").toString(); + + String isRecommit = this.fieldMap.get("checked") == null ? "" + : this.fieldMap.get("checked").toString(); + + FlowAction FlowAction = new FlowAction(); + if ("directsubmit".equals(isRecommit)) { + FlowAction.setRecommit("Y"); + } + + FlowAction.setTaskNo(taskNo); + FlowAction.setReturnPoint(returnTaskNo); + message = FlowAction.returnTask(tx); + + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("SUCCESS").toString(), + message); + return ReturnMapUtil.getReturnMap(); + } + + @SuppressWarnings("unchecked") + public Map back(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx, + Map fieldMap, ReturnMapUtil ReturnMapUtil, + String userId) throws Exception { + this.fieldMap = fieldMap; + if (null == this.fieldMap) { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + this.fieldMap = (Map) testMap.get("fieldMap"); + } + + String taskNo = this.fieldMap.get("serialno") == null ? "" + : this.fieldMap.get("serialno").toString(); + + FlowTask FlowTask = new FlowTask(); + BizObject task = FlowTask.queryFlowTask(request, sqlca, tx, this.fieldMap); + + if (null == task) { + message = "请选择一条信息!"; + } + + FlowAction FlowAction = new FlowAction(); + FlowAction.setTaskNo(taskNo); + String sReturn = FlowAction.isSignOpinion(tx); + + if (!"yes".equals(sReturn)) { + message = "该业务未签署意见,不能提交,请先签署意见!"; + } + + if (!StringX.isSpace(message)) { + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("FAIL").toString(), + message); + return ReturnMapUtil.getReturnMap(); + } + + FlowManageAction FlowManageAction = new FlowManageAction(); + FlowManageAction.setTaskNo(taskNo); + FlowManageAction.setUserID(userId); + String returnValue = FlowManageAction.backStep(tx); + + if ("退回完成".equals(returnValue)) { + ReturnMapUtil + .setReturnMap(null, + RestfullConstant.baseProperty.get("SUCCESS") + .toString(), ""); + } else { + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("FAIL").toString(), + "操作失败! "); + } + return ReturnMapUtil.getReturnMap(); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/action/service/DoSubmitService.java b/src_app_fresh/apx/com/amarsoft/als/business/action/service/DoSubmitService.java new file mode 100644 index 000000000..15cdba684 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/action/service/DoSubmitService.java @@ -0,0 +1,508 @@ +package apx.com.amarsoft.als.business.action.service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import jbo.sys.FLOW_MODEL; +import apx.com.amarsoft.als.base.flow.FlowTask; + +import com.amarsoft.app.flow.FlowAction; +import com.amarsoft.app.lc.workflow.action.GetFlowAction; +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.base.constant.RestfullConstant; +import com.base.util.BizObjectUtil; +import com.base.util.JsonUtil; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +public class DoSubmitService { + private String taskNo; // 流水号 + private String objectType; // 流程实例类型 + private String objectNo; // 流程实例编号 + private String flowNo; // 流程编号 + private String flowName; // 流程名称 + private String phaseNo; // 节点编号 + private String projectId; // 项目编号 + private String projectName; // 项目编号 + private String curFlowUser; // 当前流程操作用户 + private String agentFlowUser; // 流程代理用户 + private String assignSubmitType; // 分配提交类型 + private String assignFinish; // 分配完成 + private String endTime; // 流程节点结束时间 + + private String applyType; // 申请类型 + private String phaseName; // 节点名称 + private String assignedTaskNo; // 退回节点流水号 + private String flowState; // 流程状态 + + private String message; + + private String bodyMessage = "", headMessage = "", isMeeting = ""; + + private Map fieldMap; + + // private String sReadUser; + // private String sRouteType; + // private String sIsLastUser; + // private String sRoute; + + // private String userButtonType; + + public void setTaskNo(String taskNo) { + this.taskNo = taskNo; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public void setObjectNo(String objectNo) { + this.objectNo = objectNo; + } + + public void setFlowNo(String flowNo) { + this.flowNo = flowNo; + } + + public void setFlowName(String flowName) { + this.flowName = flowName; + } + + public void setPhaseNo(String phaseNo) { + this.phaseNo = phaseNo; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public void setCurFlowUser(String curFlowUser) { + this.curFlowUser = curFlowUser; + } + + public void setAgentFlowUser(String agentFlowUser) { + this.agentFlowUser = agentFlowUser; + } + + public void setAssignSubmitType(String assignSubmitType) { + this.assignSubmitType = assignSubmitType; + } + + public void setAssignFinish(String assignFinish) { + this.assignFinish = assignFinish; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Map getFieldMap() { + return fieldMap; + } + + // public void setsRouteType(String sRouteType) { + // this.sRouteType = sRouteType; + // } + // + // public void setsReadUser(String sReadUser) { + // this.sReadUser = sReadUser; + // } + // + // public void setsIsLastUser(String sIsLastUser) { + // this.sIsLastUser = sIsLastUser; + // } + // + // public void setsRoute(String sRoute) { + // this.sRoute = sRoute; + // } + + // public void queryProjectId() throws Exception { + // Map flowParams = GetFlowAction + // .getFlowParamByFlowUnid(this.objectNo); + // Map flowParams1 = new HashMap(); + // // for (String sKey : flowParams.keySet()) { + // // flowParams1.put(sKey, flowParams.get(sKey)); + // // } + // String sMainProjectId = flowParams.get("MainProjectId"); + // String sReserveProjectId = flowParams.get("ReserveProjectId"); + // String sProjectProduct = flowParams.get("ProjectProduct"); + // System.out.println("MainProjectId:" + sMainProjectId); + // System.out.println("ReserveProjectId:" + sReserveProjectId); + // System.out.println("ProjectProduct:" + sProjectProduct); + // this.projectName = flowParams.get("ProjectName"); + // this.projectId = flowParams.get("ProjectId"); + // if (StringX.isSpace(this.projectId)) { + // if (null == sReserveProjectId) { + // BizObjectManager bom = JBOFactory + // .getBizObjectManager(LB_RESERVE_PROJECT_PRODUCT.CLASS_NAME); + // String sSql = ""; + // sSql = "SELECT "; + // sSql += "DISTINCT O.PROJECT_ID "; + // sSql += "FROM O, " + LB_MAIN_PROJECT_INFO.CLASS_NAME + // + " LB_MAIN_PROJECT_INFO "; + // sSql += ""; + // sSql += "WHERE LB_MAIN_PROJECT_INFO.RESERVEPROJECTID = O.PROJECT_ID "; + // sSql += "AND LB_MAIN_PROJECT_INFO.RESERVEPROJECTID='" + // + sMainProjectId + "' "; + // BizObject bo = bom.createQuery(sSql).getSingleResult(false); + // if (null == bo) { + // this.projectId = ""; + // } else { + // this.projectId = bo.getAttribute("PROJECT_ID") == null ? "" + // : bo.getAttribute("PROJECT_ID").toString(); + // } + // } else { + // this.projectId = sReserveProjectId; + // } + // } + // ARE.getLog().info("ProjectId : " + this.projectId); + // } + + @SuppressWarnings("unchecked") + public Map doSubmitScanBefore(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, Map fieldMap, + ReturnMapUtil ReturnMapUtil) throws Exception { + this.fieldMap = fieldMap; + if (null == this.fieldMap) { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + this.fieldMap = (Map) testMap.get("fieldMap"); + } + + Map body = new HashMap(); + boolean flag = true; + FlowTask FlowTask = new FlowTask(); + BizObject bo = FlowTask + .queryFlowTask(request, sqlca, tx, this.fieldMap); + if (null != bo) { + this.objectType = bo.getAttribute("OBJECTTYPE") == null ? "" : bo + .getAttribute("OBJECTTYPE").toString(); + this.objectNo = bo.getAttribute("OBJECTNO") == null ? "" : bo + .getAttribute("OBJECTNO").toString(); + this.flowNo = bo.getAttribute("FLOWNO") == null ? "" : bo + .getAttribute("FLOWNO").toString(); + this.phaseNo = bo.getAttribute("PHASENO") == null ? "" : bo + .getAttribute("PHASENO").toString(); + this.taskNo = bo.getAttribute("SERIALNO") == null ? "" : bo + .getAttribute("SERIALNO").toString(); + this.flowName = bo.getAttribute("FLOWNAME") == null ? "" : bo + .getAttribute("FLOWNAME").toString(); + this.applyType = bo.getAttribute("APPLYTYPE") == null ? "" : bo + .getAttribute("APPLYTYPE").toString(); + this.phaseName = bo.getAttribute("phasename") == null ? "" : bo + .getAttribute("phasename").toString(); + this.assignedTaskNo = bo.getAttribute("assignedtaskno") == null ? "" + : bo.getAttribute("assignedtaskno").toString(); + this.flowState = bo.getAttribute("flowState") == null ? "" : bo + .getAttribute("flowState").toString(); + } else { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL"), + "请选择一条信息!"); + return ReturnMapUtil.getReturnMap(); + } + + String sUserId = request.getSession().getAttribute("userid").toString(); + + FlowAction FlowAction = new FlowAction(); + FlowAction.setTaskNo(this.taskNo); + FlowAction.setObjectType(this.objectType); + FlowAction.setObjectNo(this.objectNo); + FlowAction.setFlowNo(flowNo); + FlowAction.setPhaseNo(phaseNo); + FlowAction.setUserID(sUserId); + + // // 检查该业务是否已经提交了(解决用户打开多个界面进行重复操作而产生的错误) + // String sNewPhaseNo = FlowAction.getCurPhaseNo(tx); + // if (!this.phaseNo.equals(sNewPhaseNo)) { + // flag = false; + // this.message = "该申请已经提交了,不能再次提交!"; + // } else { + // // 获取未完成的任务流水号 + // String sTaskNo = FlowAction.getUnfinishedTaskNo(tx); + // if (StringX.isSpace(sTaskNo)) { + // flag = false; + // this.message = "该申请所对应的流程任务不存在,请核对!"; + // } + // } + + // 检查是否签署意见 +// String sResult = FlowAction.getIsOpitionsRequire(tx); + BizObject flowModel = GetFlowAction.getFlowModelParams(flowNo, phaseNo); + String isOpitionRequired = flowModel.getAttribute("OPINIONSREQUIRED") + .getString(); + if ("".equals(isOpitionRequired)) { + isOpitionRequired = "Y"; + } + + if (flag && "Y".equals(isOpitionRequired)) { + String sResult = FlowAction.isSignOpinion(tx); // 返回值: yes-有意见; no-无意见; + // error-查询出错 + if (!"yes".equals(sResult)) { + flag = false; + // 该业务未签署意见,不能提交,请先签署意见! + this.message = "/该业务未签署意见,不能提交,请先签署意见!"; + } + } + + if (!flag) { + ARE.getLog().debug(this.message); + body.put("autoResult", flag); + body.put("autoDetail", this.message); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty.get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } else { + return null; + } + + } + + @SuppressWarnings("unchecked") + public Map doSubmit(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, Map fieldMap, + ReturnMapUtil ReturnMapUtil) throws Exception { + this.fieldMap = fieldMap; + if (null == this.fieldMap) { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + this.fieldMap = (Map) testMap.get("fieldMap"); + } + FlowTask FlowTask = new FlowTask(); + BizObject bo = FlowTask + .queryFlowTask(request, sqlca, tx, this.fieldMap); + if (null != bo) { + this.objectType = bo.getAttribute("OBJECTTYPE") == null ? "" : bo + .getAttribute("OBJECTTYPE").toString(); + this.objectNo = bo.getAttribute("OBJECTNO") == null ? "" : bo + .getAttribute("OBJECTNO").toString(); + this.flowNo = bo.getAttribute("FLOWNO") == null ? "" : bo + .getAttribute("FLOWNO").toString(); + this.phaseNo = bo.getAttribute("PHASENO") == null ? "" : bo + .getAttribute("PHASENO").toString(); + this.taskNo = bo.getAttribute("SERIALNO") == null ? "" : bo + .getAttribute("SERIALNO").toString(); + this.flowName = bo.getAttribute("FLOWNAME") == null ? "" : bo + .getAttribute("FLOWNAME").toString(); + this.applyType = bo.getAttribute("APPLYTYPE") == null ? "" : bo + .getAttribute("APPLYTYPE").toString(); + this.phaseName = bo.getAttribute("phasename") == null ? "" : bo + .getAttribute("phasename").toString(); + this.assignedTaskNo = bo.getAttribute("assignedtaskno") == null ? "" + : bo.getAttribute("assignedtaskno").toString(); + this.flowState = bo.getAttribute("flowState") == null ? "" : bo + .getAttribute("flowState").toString(); + } else { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL"), + " 此流程任务不存在!"); + ReturnMapUtil.getReturnMap(); + } + + if ("".equals(this.taskNo)) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL"), + "请选择一条信息!"); + return ReturnMapUtil.getReturnMap(); + } + + String sUserId = request.getSession().getAttribute("userid").toString(); + + JBOTransaction tx1 = JBOFactory.createJBOTransaction(); + com.amarsoft.biz.workflow.FlowTask ft = new com.amarsoft.biz.workflow.FlowTask( + taskNo, tx);// 使用jboTrans + String flowNo = ft.FlowNo; + String flowState = ft.FlowState; + + // 会签历史纪录阶段号问题 + if (("MEETING").equals(flowState)) { + flowNo = flowNo + sUserId; + } + String[] phaseOpinions = ft.getChoiceList(); + tx1.commit(); + + String[] nextPhases; + boolean bActionReqiured = true; + FlowAction FlowAction = new FlowAction(); + boolean isPool = false, isHide = true; + + FlowAction.setFlowNo(flowNo); + String mPhaseName = "", mPhaseNo = "", mPhaseDes = ""; + + List> list = new ArrayList>(); + for (String phaseOpinion : phaseOpinions) { + Map map = new HashMap(); + List> mList = new ArrayList>(); + FlowAction.setTaskNo(taskNo); + FlowAction.setPhaseOpinion(phaseOpinion); + String nextPhaseAttrs = FlowAction.getNextPhaseAttr(tx); + nextPhases = nextPhaseAttrs.split("@"); + // 非并行阶段 + if (nextPhases.length == 1) { + String nextPhaseDes = ""; + nextPhaseDes = nextPhases[0].split(",")[2]; + if ("POOL".equals(nextPhaseDes) || "END".equals(nextPhaseDes) + || "SUPPLY".equals(nextPhaseDes) + || "FORK&POOL".equals(nextPhaseDes)) { + bActionReqiured = false; + if ("POOL".equals(nextPhaseDes)) + isPool = true; + } else { + bActionReqiured = true; + } + } + + String actionList = FlowAction.getActionList(tx); + if (bActionReqiured) { + if (StringX.isSpace(actionList)) { + message = "所选阶段没有用户可以选择,请确认!"; + } else { + if (nextPhases.length > 1) { + for (int i = 0; i < nextPhases.length; i++) { + mPhaseName = nextPhases[i].split(",")[1]; + mPhaseNo = nextPhases[i].split(",")[0]; + mPhaseDes = nextPhases[i].split(",")[2]; + FlowAction.setPhaseNo(mPhaseNo); + if ("POOL".equals(mPhaseDes) + || "END".equals(mPhaseDes) + || "SUPPLY".equals(mPhaseDes) + || "FORK&POOL".equals(mPhaseDes)) { + isHide = true; + } else { + isHide = false; + } + + Map mMap = queryPhaseMap( + mPhaseName, mPhaseNo, mPhaseDes, phaseOpinion, + actionList, FlowAction, tx); + mList.add(mMap); + } + if ("".equals(headMessage)) { + isPool = true; + bodyMessage = ""; + } + } else { + mPhaseName = nextPhases[0].split(",")[1]; + mPhaseNo = nextPhases[0].split(",")[0]; + mPhaseDes = nextPhases[0].split(",")[2]; + FlowAction.setPhaseNo(mPhaseNo); + Map mMap = queryPhaseMap(mPhaseName, + mPhaseNo, mPhaseDes, phaseOpinion, actionList, FlowAction, + tx); + mList.add(mMap); + isHide = false; + } + } + } else { + mPhaseName = nextPhases[0].split(",")[1]; + mPhaseNo = nextPhases[0].split(",")[0]; + mPhaseDes = nextPhases[0].split(",")[2]; + FlowAction.setPhaseNo(mPhaseNo); + Map mMap = queryPhaseMap(mPhaseName, mPhaseNo, mPhaseDes, + phaseOpinion, actionList, FlowAction, tx); + mList.add(mMap); + isHide = true; + } + + isMeeting = FlowAction.isMeeting(tx); + bodyMessage = getNextPhaseInfo(phaseOpinion, tx, FlowAction); + map.put("bodyMessage", bodyMessage); + map.put("phaseInfo", mList); + map.put("phaseOpinion", phaseOpinion); + map.put("isMeeting", isMeeting); + + map.put("userInfo", + queryUserInfo(phaseOpinion, actionList, mPhaseNo, + FlowAction, tx)); + list.add(map); + } + + if (!StringX.isSpace(this.message)) { + ARE.getLog().debug(this.message); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL"), + this.message); + return ReturnMapUtil.getReturnMap(); + } + + Map body = new HashMap(); + body.put("phaseAction", list); + body.put("isPool", isPool); + body.put("isHide", isHide); + + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty.get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } + + public Map queryPhaseMap(String mPhaseName, + String mPhaseNo, String mPhaseDes, String phaseOpinion, String actionList, + FlowAction FlowAction, JBOTransaction tx) throws Exception { + Map mMap = new HashMap(); + + headMessage = "请选择" + mPhaseName + "用户:"; + mMap.put("phaseName", mPhaseName); + mMap.put("phaseNo", mPhaseNo); + mMap.put("nodeType", mPhaseDes); + mMap.put("headMessage", headMessage); + + return mMap; + } + + public List> queryUserInfo(String phaseOpinion, + String actionList, String mPhaseNo, FlowAction FlowAction, + JBOTransaction tx) throws Exception { + List> uList = new ArrayList>(); + + for (int j = 0; j < actionList.split("@").length; j++) { + String userIDStr = actionList.split("@")[j]; + String userID = userIDStr.split(" ")[0]; + if (userID.indexOf("|") > -1) { + String phaseNo = userID.split("|")[0]; + if (mPhaseNo.equals(phaseNo)) { + userIDStr = userIDStr.replace(phaseNo + "|", ""); + } + } + Map uMap = new HashMap(); + uMap.put("userId", userIDStr); + uMap.put("userInfo", userIDStr.split(" ")[1]); + uList.add(uMap); + } + return uList; + } + + public String getNextPhaseInfo(String phaseOpinion, JBOTransaction tx, + FlowAction FlowAction) throws Exception { + FlowAction.setTaskNo(taskNo); + FlowAction.setPhaseOpinion(phaseOpinion); + String nextPhaseInfo = FlowAction.getNextPhaseInfo(tx); + return nextPhaseInfo; + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/action/submit/controller/FlowActionCommitController.java b/src_app_fresh/apx/com/amarsoft/als/business/action/submit/controller/FlowActionCommitController.java new file mode 100644 index 000000000..d7aa47e1e --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/action/submit/controller/FlowActionCommitController.java @@ -0,0 +1,47 @@ +//package apx.com.amarsoft.als.business.action.submit.controller; +// +//import java.util.Map; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.ws.rs.POST; +//import javax.ws.rs.Path; +//import javax.ws.rs.core.Context; +// +//import apx.com.amarsoft.als.business.action.submit.service.FlowActionCommitService; +//import apx.com.amarsoft.als.business.action.submit.service.impl.FlowActionCommitServiceImpl; +// +//import com.amarsoft.are.ARE; +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.awe.util.Transaction; +//import com.base.util.ReturnMapUtil; +// +//@Path("/flow/action") +//public class FlowActionCommitController { +// FlowActionCommitService service = new FlowActionCommitServiceImpl(); +// /** +// * 通用流程提交 +// * +// * @param request +// * @param sqlca +// * @param tx +// * @return +// * @throws Exception +// */ +// @Path("/commit") +// @POST +// public Map commit(@Context HttpServletRequest request, +// @Context Transaction sqlca, @Context JBOTransaction tx) +// throws Exception { +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); +// ARE.getLog() +// .info("[CONTROLLER] FlowActionCommitController run ................."); +// ARE.getLog().info( +// "[Path] /flow/action/commit" + " run ................."); +// try { +// +// return service.commit(request, sqlca, tx, ReturnMapUtil); +// } catch (Exception e) { +// return ReturnMapUtil.rollback(e); +// } +// } +//} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/action/submit/service/FlowActionCommitService.java b/src_app_fresh/apx/com/amarsoft/als/business/action/submit/service/FlowActionCommitService.java new file mode 100644 index 000000000..5aa928ba6 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/action/submit/service/FlowActionCommitService.java @@ -0,0 +1,16 @@ +//package apx.com.amarsoft.als.business.action.submit.service; +// +//import java.util.Map; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.ws.rs.core.Context; +// +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.awe.util.Transaction; +//import com.base.util.ReturnMapUtil; +// +//public interface FlowActionCommitService { +// Map commit(@Context HttpServletRequest request, +// @Context Transaction sqlca, @Context JBOTransaction tx, +// ReturnMapUtil ReturnMapUtil) throws Exception; +//} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/action/submit/service/impl/FlowActionCommitServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/business/action/submit/service/impl/FlowActionCommitServiceImpl.java new file mode 100644 index 000000000..4e35ace86 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/action/submit/service/impl/FlowActionCommitServiceImpl.java @@ -0,0 +1,255 @@ +//package apx.com.amarsoft.als.business.action.submit.service.impl; +// +//import java.util.Map; +// +//import javax.servlet.http.HttpServletRequest; +// +//import apx.com.amarsoft.als.base.flow.FlowTask; +//import apx.com.amarsoft.als.business.action.submit.service.FlowActionCommitService; +// +//import com.amarsoft.app.flow.FlowAction; +//import com.amarsoft.are.jbo.BizObject; +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.are.lang.StringX; +//import com.amarsoft.awe.util.Transaction; +//import com.base.constant.RestfullConstant; +//import com.base.util.MultipartDataUtil; +//import com.base.util.ReturnMapUtil; +// +//public class FlowActionCommitServiceImpl implements FlowActionCommitService { +// private Map fieldMap; +// +// private String taskNo; // 流水号 +// +// private String message; +// private String phaseOpinion; +// private String phaseAction; +// private String nextPhaseInfo; +// private String isPool; +// +// public Map endMeetingTask(Transaction sqlca, +// JBOTransaction tx, ReturnMapUtil ReturnMapUtil) throws Exception { +// FlowAction FlowAction = new FlowAction(); +// FlowAction.setTaskNo(taskNo); +// FlowAction.endMeetingTask(tx); +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("SUCCESS").toString(), ""); +// return ReturnMapUtil.getReturnMap(); +// } +// +// public Map AssignedTaskNo(Transaction sqlca, +// JBOTransaction tx, ReturnMapUtil ReturnMapUtil) throws Exception { +// FlowAction FlowAction = new FlowAction(); +// FlowAction.setTaskNo(taskNo); +// FlowAction.setPhaseOpinion("null"); +// FlowAction.setPhaseAction("null"); +// FlowAction.submit(tx); +// String returnValue = FlowAction.submit(tx); +// +// if (StringX.isSpace(returnValue) || "undefined".equals(returnValue) +// || "null".equals(returnValue) || "_CANCEL_".equals(returnValue)) { +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("SUCCESS").toString(), +// returnValue); +// return ReturnMapUtil.getReturnMap(); +// } else if ("Success".toLowerCase().equals(returnValue.toLowerCase())) { +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("SUCCESS").toString(), +// returnValue); +// } else { +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("SUCCESS").toString(), +// returnValue); +// } +// return ReturnMapUtil.getReturnMap(); +// } +// +// @SuppressWarnings("unchecked") +// @Override +// public Map commit(HttpServletRequest request, +// Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) +// throws Exception { +// +// Map testMap = (Map) MultipartDataUtil +// .readRequestParam(request, "UTF-8"); +// this.fieldMap = (Map) testMap.get("fieldMap"); +// +// String type = this.fieldMap.get("submittype") == null ? "" +// : this.fieldMap.get("submittype").toString(); +// +// FlowTask FlowTask = new FlowTask(); +// BizObject bo = FlowTask +// .queryFlowTask(request, sqlca, tx, this.fieldMap); +// if (null != bo) { +// this.taskNo = bo.getAttribute("SERIALNO") == null ? "" : bo +// .getAttribute("SERIALNO").toString(); +// } else { +// ReturnMapUtil.setReturnMap(null, +// (String) RestfullConstant.baseProperty.get("FAIL"), +// "请选择一条有效流程!"); +// return ReturnMapUtil.getReturnMap(); +// } +// String endTime = bo.getAttribute("ENDTIME") == null ? "" : bo.getAttribute("ENDTIME").toString(); +// if (!"".equals(endTime)) { +// message = "此流程任务已提交!"; +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("FAIL").toString(), +// message); +// return ReturnMapUtil.getReturnMap(); +// } +// +// switch (type) { +// case "1": +// return AssignedTaskNo(sqlca, tx, ReturnMapUtil); +// case "2": +// return endMeetingTask(sqlca, tx, ReturnMapUtil); +// } +// +// FlowAction FlowAction = new FlowAction(); +// FlowAction.setTaskNo(this.taskNo); +// String isCommited = FlowAction.isCommited(tx); +// +// if ("yes".equals(isCommited)) { +// message = "此流程任务已提交!"; +// } else { +// this.phaseOpinion = this.fieldMap.get("phaseopinion") == null ? "" +// : this.fieldMap.get("phaseopinion").toString(); +// +// this.phaseAction = this.fieldMap.get("phaseaction") == null ? "" +// : this.fieldMap.get("phaseaction").toString(); +// this.nextPhaseInfo = this.fieldMap.get("bodymessage") == null ? "" +// : this.fieldMap.get("bodymessage").toString(); +// if (StringX.isSpace(phaseOpinion)) { +// message = "请选择提交动作!"; +// } else { +// FlowAction.setPhaseOpinion(phaseOpinion); +// String nextPhaseAttrs = FlowAction.getNextPhaseAttr(tx); +// +// String[] nextPhases = nextPhaseAttrs.split("@"); +// +// String phaseAction = ""; +// +// phaseAction = getNextActionValue(nextPhases, FlowAction, tx); +// if (StringX.isSpace(phaseAction)) { +// message = "请选择提交用户信息!"; +// } else { +// FlowAction.setPhaseAction(phaseAction); +// String joinNode = FlowAction.isJoinNode(tx); +// +// if ("1".equals(joinNode)) {// 如果是join节点 +// String joinUserID = FlowAction.getJoinUser(tx); +// String curUserID = phaseAction.split(" ")[0]; +// if ((!curUserID.equals(joinUserID) && (!"" +// .equals(joinUserID)))) { +// message = "先前分支的提交人为" + joinUserID + ",请选择相同人员!"; +// } +// } +// String commitPeopleTip = ""; +// boolean bPool = Boolean.valueOf(isPool); +// if (bPool) {// 如果下一阶段是任务池,则提示 可以挑选任务的用户 +// String[] arr = phaseAction.split("@"); +// +// for (int i = 0; i < arr.length; i++) { +// String userID = arr[i].split(" ")[0]; +// if (userID.indexOf("|") > -1) {// 并行任务 +// String[] phaseUser = userID.split("|"); +// userID = "阶段:" + phaseUser[0] + "-用户:" +// + phaseUser[1]; +// } +// commitPeopleTip = commitPeopleTip + userID + " "; +// } +// } +// String readUserIds = ""; +// +// FlowAction.setTaskNo(this.taskNo); +// FlowAction.setPhaseOpinion(this.phaseOpinion); +// FlowAction.setPhaseAction(this.phaseAction); +// FlowAction.setNextPhaseInfo(nextPhaseInfo); +// FlowAction.setReadUserIds(readUserIds); +// FlowAction.setUserID(request.getSession() +// .getAttribute("userid").toString()); +// String returnValue = FlowAction.submit(tx); +// +// if (StringX.isSpace(returnValue) +// || "undefined".equals(returnValue) +// || "null".equals(returnValue) +// || "_CANCEL_".equals(returnValue)) { +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("SUCCESS") +// .toString(), ""); +// return ReturnMapUtil.getReturnMap(); +// } else if ("Success".toLowerCase().equals( +// returnValue.toLowerCase())) { +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("SUCCESS") +// .toString(), ""); +// return ReturnMapUtil.getReturnMap(); +// } else { +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("FAIL") +// .toString(), "提交失败!"); +// return ReturnMapUtil.getReturnMap(); +// } +// } +// } +// +// } +// +// if (!StringX.isSpace(message)) { +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("FAIL").toString(), +// message); +// } +// return ReturnMapUtil.getReturnMap(); +// } +// +// public String getNextActionValue(String[] nextPhases, +// FlowAction FlowAction, JBOTransaction tx) throws Exception { +// String phaseAction = ""; +// if (nextPhases.length == 1) { +// String nextPhaseDes = ""; +// nextPhaseDes = nextPhases[0].split(",")[2]; +// if ("POOL".equals(nextPhaseDes) || "FORK&POOL".equals(nextPhaseDes)) { +// phaseAction = FlowAction.getActionList(tx); +// } else if ("END".equals(nextPhaseDes)) { +// phaseAction = "system"; +// } else { +// phaseAction = this.phaseAction; +// } +// } else { +// String actionList = FlowAction.getActionList(tx); +// for (int i = 0; i < nextPhases.length; i++) { +// String mPhaseName = nextPhases[i].split(",")[1]; +// String mPhaseNo = nextPhases[i].split(",")[0]; +// String mPhaseDes = nextPhases[i].split(",")[2]; +// String mPhaseAction = ""; +// if ("POOL".equals(mPhaseDes) || "FORK&POOL".equals(mPhaseDes)) { +// for (int j = 0; j < actionList.split("@").length; j++) { +// String userIDStr = actionList.split("@")[j]; +// String userID = userIDStr.split(" ")[0]; +// if (userID.indexOf("|") > -1) { +// String phaseNo = userID.split("|")[0]; +// if (mPhaseNo.equals(phaseNo)) { +// mPhaseAction = mPhaseAction + "@" + userIDStr; +// } +// } +// } +// if (mPhaseAction.indexOf("@") > -1) +// mPhaseAction = mPhaseAction.substring(1); +// phaseAction += "@" + mPhaseAction; +// } else { +// mPhaseAction = this.phaseAction; +// phaseAction += "@" + mPhaseNo + "|" + mPhaseAction; +// } +// +// if (StringX.isSpace(mPhaseAction)) { +// message = "请选择" + mPhaseName + "用户!"; +// } +// } +// if (phaseAction.indexOf("@") > -1) +// phaseAction = phaseAction.substring(1); +// +// } +// return phaseAction; +// } +//} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/attachment/controller/DocumentController.java b/src_app_fresh/apx/com/amarsoft/als/business/attachment/controller/DocumentController.java new file mode 100644 index 000000000..2477ad79c --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/attachment/controller/DocumentController.java @@ -0,0 +1,152 @@ +//package apx.com.amarsoft.als.business.attachment.controller; +// +//import java.util.Map; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.ws.rs.POST; +//import javax.ws.rs.Path; +//import javax.ws.rs.core.Context; +// +//import apx.com.amarsoft.als.business.attachment.service.DocumentService; +//import apx.com.amarsoft.als.business.attachment.service.impl.DocumentServiceImpl; +// +//import com.amarsoft.are.ARE; +//import com.amarsoft.are.jbo.JBOException; +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.awe.util.Transaction; +//import com.base.util.ReturnMapUtil; +// +//@Path("/flow/document") +//public class DocumentController { +// // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); +// DocumentService service = new DocumentServiceImpl(); +// +// /** +// * 流程 附件一览 +// * +// * @param request +// * @param sqlca +// * @param tx +// * @return +// * @throws Exception +// */ +// @Path("/library/list") +// @POST +// public Map queryDocumentList( +// @Context HttpServletRequest request, @Context Transaction sqlca, +// @Context JBOTransaction tx) throws Exception { +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); +// ARE.getLog().info( +// "[CONTROLLER] DocumentController run ................."); +// ARE.getLog().info( +// "[Path] /flow/document/library/list" +// + " run ................."); +// try { +// return service.queryDocumentList(request, sqlca, tx, +// ReturnMapUtil); +// } catch (Exception e) { +// return ReturnMapUtil.rollback(e); +// } +// } +// +// /** +// * 附件查询 +// * +// * @param request +// * @param sqlca +// * @param tx +// * @return +// * @throws Exception +// */ +// @Path("/attachment/list") +// @POST +// public Map queryAttachmentList( +// @Context HttpServletRequest request, @Context Transaction sqlca, +// @Context JBOTransaction tx) throws Exception { +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); +// ARE.getLog().info( +// "[CONTROLLER] DocumentController run ................."); +// ARE.getLog().info( +// "[Path] /flow/document/attachment/list" +// + " run ................."); +// try { +// return service.queryAttachmentList(request, sqlca, tx, +// ReturnMapUtil); +// } catch (Exception e) { +// return ReturnMapUtil.rollback(e); +// } +// } +// +// /** +// * 加载 上传元素 +// * +// * @param request +// * @param sqlca +// * @param tx +// * @return +// * @throws Exception +// */ +// @Path("/load/upload/element") +// @POST +// public Map loadLBDocumentUpladElment( +// @Context HttpServletRequest request, @Context Transaction sqlca, +// @Context JBOTransaction tx) throws Exception { +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); +// ARE.getLog().info( +// "[CONTROLLER] DocumentController run ................."); +// ARE.getLog().info( +// "[Path] /flow/document/load/upload/element" +// + " run ................."); +// try { +// return service.loadDocumentUpladElment(request, sqlca, tx, +// ReturnMapUtil); +// } catch (Exception e) { +// return ReturnMapUtil.rollback(e); +// } +// } +// +// /** +// * 获取一级分类 +// * +// * @param request +// * @param sqlca +// * @param tx +// * @return +// * @throws Exception +// */ +// @Path("/doc/type/list") +// @POST +// public Map queryDocType( +// @Context HttpServletRequest request, @Context Transaction sqlca, +// @Context JBOTransaction tx) throws Exception { +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); +// ARE.getLog().info( +// "[CONTROLLER] DocumentController run ................."); +// ARE.getLog().info( +// "[Path] /flow/document/doc/type/list" +// + " run ................."); +// try { +// return service.queryDocType(request, sqlca, tx, ReturnMapUtil); +// } catch (Exception e) { +// return ReturnMapUtil.rollback(e); +// } +// } +// +// @Path("/attachment/upload") +// @POST +// public Map adjustUpload( +// @Context HttpServletRequest request, @Context Transaction sqlca, +// @Context JBOTransaction tx) throws JBOException { +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); +// ARE.getLog().info( +// "[CONTROLLER] DocumentController run ................."); +// ARE.getLog().info( +// "[Path] /flow/document/attachment/upload" +// + " run ................."); +// try { +// return service.adjustUpload(request, sqlca, tx, ReturnMapUtil); +// } catch (Exception e) { +// return ReturnMapUtil.rollback(e); +// } +// } +//} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/attachment/manage/DocumentList01DoManage.java b/src_app_fresh/apx/com/amarsoft/als/business/attachment/manage/DocumentList01DoManage.java new file mode 100644 index 000000000..bde6d6889 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/attachment/manage/DocumentList01DoManage.java @@ -0,0 +1,33 @@ +package apx.com.amarsoft.als.business.attachment.manage; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoQueryManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public class DocumentList01DoManage extends AbstractAweDoQueryManage { + private String sAddWhere; + + public void getGroupId() { + sGroupId = "DocumentList01"; + } + + public void getOtherWhere() { + super.sOtherWhere = this.sAddWhere; + } + + public void setsAddWhere(String sAddWhere) { + this.sAddWhere = sAddWhere; + } + + public Map queryDocumentList01DoManage( + HttpServletRequest request, Transaction sqlca, JBOTransaction tx, + ReturnMapUtil ReturnMapUtil) throws Exception { + return getData(request, sqlca, tx, ReturnMapUtil); + } +} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/business/attachment/manage/UploadAttachmentDoManage.java b/src_app_fresh/apx/com/amarsoft/als/business/attachment/manage/UploadAttachmentDoManage.java new file mode 100644 index 000000000..0a34d4dc2 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/attachment/manage/UploadAttachmentDoManage.java @@ -0,0 +1,33 @@ +package apx.com.amarsoft.als.business.attachment.manage; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoQueryManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public class UploadAttachmentDoManage extends AbstractAweDoQueryManage { + private String sAddWhere; + + public void getGroupId() { + sGroupId = "UploadAttachment"; + } + + public void getOtherWhere() { + super.sOtherWhere = this.sAddWhere; + } + + public void setsAddWhere(String sAddWhere) { + this.sAddWhere = sAddWhere; + } + + public Map queryUploadAttachmentDoManage( + HttpServletRequest request, Transaction sqlca, JBOTransaction tx, + ReturnMapUtil ReturnMapUtil) throws Exception { + return getData(request, sqlca, tx, ReturnMapUtil); + } +} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/business/attachment/service/DocumentService.java b/src_app_fresh/apx/com/amarsoft/als/business/attachment/service/DocumentService.java new file mode 100644 index 000000000..33df70b41 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/attachment/service/DocumentService.java @@ -0,0 +1,35 @@ +//package apx.com.amarsoft.als.business.attachment.service; +// +//import java.util.Map; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.ws.rs.core.Context; +// +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.awe.util.Transaction; +//import com.base.util.ReturnMapUtil; +// +//public interface DocumentService { +// Map queryDocumentList( +// @Context HttpServletRequest request, @Context Transaction sqlca, +// @Context JBOTransaction tx, ReturnMapUtil ReturnMapUtil) +// throws Exception; +// +// Map queryAttachmentList( +// @Context HttpServletRequest request, @Context Transaction sqlca, +// @Context JBOTransaction tx, ReturnMapUtil ReturnMapUtil) +// throws Exception; +// +// Map loadDocumentUpladElment( +// @Context HttpServletRequest request, @Context Transaction sqlca, +// @Context JBOTransaction tx, ReturnMapUtil ReturnMapUtil) +// throws Exception; +// +// Map queryDocType(@Context HttpServletRequest request, +// @Context Transaction sqlca, @Context JBOTransaction tx, +// ReturnMapUtil ReturnMapUtil) throws Exception; +// +// Map adjustUpload(@Context HttpServletRequest request, +// @Context Transaction sqlca, @Context JBOTransaction tx, +// ReturnMapUtil ReturnMapUtil) throws Exception; +//} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/attachment/service/impl/DocumentServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/business/attachment/service/impl/DocumentServiceImpl.java new file mode 100644 index 000000000..7ec9f0ae4 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/attachment/service/impl/DocumentServiceImpl.java @@ -0,0 +1,328 @@ +//package apx.com.amarsoft.als.business.attachment.service.impl; +// +//import java.io.DataOutputStream; +//import java.io.File; +//import java.io.FileOutputStream; +//import java.io.InputStream; +//import java.text.SimpleDateFormat; +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.List; +//import java.util.Map; +// +//import javax.servlet.http.HttpServletRequest; +// +//import jbo.sys.CODE_LIBRARY; +//import jbo.sys.FLOW_TASK; +//import apx.com.amarsoft.als.business.attachment.manage.DocumentList01DoManage; +//import apx.com.amarsoft.als.business.attachment.manage.UploadAttachmentDoManage; +//import apx.com.amarsoft.als.business.attachment.service.DocumentService; +// +//import com.amarsoft.are.jbo.BizObject; +//import com.amarsoft.are.jbo.BizObjectManager; +//import com.amarsoft.are.jbo.JBOFactory; +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.are.jbo.impl.BizObjectTableMapper; +//import com.amarsoft.are.lang.DateX; +//import com.amarsoft.awe.Configure; +//import com.amarsoft.awe.common.attachment.FileNameHelper; +//import com.amarsoft.awe.util.ASResultSet; +//import com.amarsoft.awe.util.DBKeyHelp; +//import com.amarsoft.awe.util.SqlObject; +//import com.amarsoft.awe.util.Transaction; +//import com.amarsoft.context.ASUser; +//import com.base.constant.RestfullConstant; +//import com.base.util.MultipartDataUtil; +//import com.base.util.ReturnMapUtil; +//import com.tenwa.flow.cache.DocListCache2; +// +//public class DocumentServiceImpl implements DocumentService { +// private Map fieldMap; +// +// @SuppressWarnings("unchecked") +// public Map queryDocumentList(HttpServletRequest request, +// Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) +// throws Exception { +// +// Map testMap = ( Map) MultipartDataUtil +// .readRequestParam(request, "UTF-8"); +// fieldMap = (Map) testMap.get("fieldMap"); +// String sTask = fieldMap.get("SERIALNO") == null ? "" : fieldMap.get( +// "SERIALNO").toString(); +// BizObjectManager taskManage = JBOFactory +// .getBizObjectManager(FLOW_TASK.CLASS_NAME); +// BizObject task = taskManage.createQuery("serialno=:serialno") +// .setParameter("serialno", sTask).getSingleResult(false); +// +// if (null == task) { +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("FAIL").toString(), +// "流水编号无效!"); +// return ReturnMapUtil.getReturnMap(); +// } +// +// String sObjectNo = task.getAttribute("OBJECTNO") == null ? "" : task +// .getAttribute("OBJECTNO").toString(); +// +// String sAddWhere = "AND dr.OBJECTTYPE<>'Customer' AND dr.OBJECTTYPE<>'LoanContract' AND dr.ObjectNo='" +// + sObjectNo + "' "; +// +// DocumentList01DoManage manage = new DocumentList01DoManage(); +// manage.setParamMap(fieldMap); +// manage.setsAddWhere(sAddWhere); +// return manage.queryDocumentList01DoManage(request, sqlca, tx, +// ReturnMapUtil); +// } +// +// @SuppressWarnings("unchecked") +// public Map queryAttachmentList(HttpServletRequest request, +// Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) +// throws Exception { +// +// Map testMap = ( Map) MultipartDataUtil +// .readRequestParam(request, "UTF-8"); +// fieldMap = (Map) testMap.get("fieldMap"); +// String docNo = fieldMap.get("docno") == null ? "" : fieldMap.get( +// "docno").toString(); +// Map body = new HashMap(); +// body.put("fileList", DocListCache2.getFileByDocNo(docNo)); +// +// ReturnMapUtil.setReturnMap(body, RestfullConstant.baseProperty.get("SUCCESS").toString(), +// ""); +// return ReturnMapUtil.getReturnMap(); +// } +// +// @SuppressWarnings("unchecked") +// public Map loadDocumentUpladElment( +// HttpServletRequest request, Transaction sqlca, JBOTransaction tx, +// ReturnMapUtil ReturnMapUtil) throws Exception { +// Map testMap = (Map) MultipartDataUtil +// .readRequestParam(request, "UTF-8"); +// fieldMap = (Map) testMap.get("fieldMap"); +// +// UploadAttachmentDoManage manage = new UploadAttachmentDoManage(); +// manage.queryUploadAttachmentDoManage(request, sqlca, tx, ReturnMapUtil); +// +// String userId = request.getSession().getAttribute("userid").toString(); +// ASUser user = new ASUser(userId, sqlca); +// ReturnMapUtil.setDataValue(0, "userid", userId, userId); +// ReturnMapUtil.setDataValue(0, "username", user.getUserName(), +// user.getUserName()); +// ReturnMapUtil +// .setDataValue(0, "orgid", user.getOrgID(), user.getOrgID()); +// ReturnMapUtil.setDataValue(0, "orgname", user.getOrgName(), +// user.getOrgName()); +// ReturnMapUtil +// .setDataValue(0, "DocImportance".toLowerCase(), "01", "一般"); +// ReturnMapUtil.setDataValue(0, "docDate".toLowerCase(), +// DateX.format(new java.util.Date()), +// DateX.format(new java.util.Date())); +// +// return ReturnMapUtil.getReturnMap(); +// } +// +// @SuppressWarnings("unchecked") +// public Map queryDocType(HttpServletRequest request, +// Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) +// throws Exception { +// +// Map testMap = (Map) MultipartDataUtil +// .readRequestParam(request, "UTF-8"); +// fieldMap = (Map) testMap.get("fieldMap"); +// String taskNo = fieldMap.get("serialno") == null ? "" : fieldMap.get( +// "serialno").toString(); +// BizObjectManager taskManage = JBOFactory +// .getBizObjectManager(FLOW_TASK.CLASS_NAME); +// BizObject task = taskManage.createQuery("serialno=:serialno") +// .setParameter("serialno", taskNo).getSingleResult(false); +// if (null == task) { +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("FAIL").toString(), +// "流水编号无效!"); +// return ReturnMapUtil.getReturnMap(); +// } +// String sFlowNo = task.getAttribute("FLOWNO") == null ? "" : task +// .getAttribute("FLOWNO").toString(); +// String sPhaseNo = task.getAttribute("PHASENO") == null ? "" : task +// .getAttribute("PHASENO").toString(); +// +// String condition = ""; +// ASResultSet rs = null; +// String sql = "SELECT attachment_type FROM flow_model_pair where flowno=:flowno and phaseno=:phaseno"; +// SqlObject asql = new SqlObject(sql); +// asql.setParameter("flowno", sFlowNo); +// asql.setParameter("phaseno", sPhaseNo); +// rs = sqlca.getASResultSet(asql); +// if (rs.next()) { +// condition = rs.getString("attachment_type"); +// } +// rs.close(); +// condition = "'" + condition.replaceAll(",", "','") + "'"; +// +// BizObjectManager codeManage = JBOFactory +// .getBizObjectManager(CODE_LIBRARY.CLASS_NAME); +// List codes = codeManage.createQuery( +// "codeno='wordtempletypefirst' and itemno in (" + condition +// + ")").getResultList(false); +// +// List> list = new ArrayList>(); +// for (BizObject bo1 : codes) { +// if (null == bo1) +// continue; +// Map map = new HashMap(); +// map.put("itemNo", bo1.getAttribute("itemno").getValue()); +// map.put("itemName", bo1.getAttribute("itemname").getValue()); +// list.add(map); +// } +// Map body = new HashMap(); +// body.put("docType", list); +// ReturnMapUtil.setReturnMap(body, +// RestfullConstant.baseProperty.get("SUCCESS").toString(), ""); +// return ReturnMapUtil.getReturnMap(); +// } +// +// @SuppressWarnings("unchecked") +// public Map adjustUpload(HttpServletRequest request, +// Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) +// throws Exception { +// Map testMap = (Map) MultipartDataUtil +// .readRequestParam(request, "UTF-8"); +// fieldMap = (Map) testMap.get("fieldMap"); +// List> fileList = (List>) (testMap +// .get("fileList") == null ? new ArrayList>() +// : testMap.get("fileList")); +// String taskNo = fieldMap.get("SERIALNO") == null ? "" : fieldMap.get( +// "SERIALNO").toString(); +// BizObjectManager taskManage = JBOFactory +// .getBizObjectManager(FLOW_TASK.CLASS_NAME); +// BizObject task = taskManage.createQuery("serialno=:serialno") +// .setParameter("serialno", taskNo).getSingleResult(false); +// if (null == task) { +// ReturnMapUtil.setReturnMap(null, +// RestfullConstant.baseProperty.get("FAIL").toString(), +// "流水编号无效!"); +// return ReturnMapUtil.getReturnMap(); +// } +//// String sFlowNo = task.getAttribute("FLOWNO") == null ? "" : task +//// .getAttribute("FLOWNO").toString(); +// String sObjectNo = task.getAttribute("OBJECTNO") == null ? "" : task +// .getAttribute("objectno").toString(); +// String sObjectType = task.getAttribute("OBJECTTYPE") == null ? "" : task +// .getAttribute("OBJECTTYPE").toString(); +// String sDocType = fieldMap.get("DOC_TYPE") == null ? "" : fieldMap.get( +// "DOC_TYPE").toString(); +// String sRemark = fieldMap.get("remark") == null ? "" : fieldMap.get( +// "remark").toString(); +// +// ASResultSet rs = null; +// // template_no IS NULL---附件一览上传的不需要template_no编号 +// String sql = "SELECT dl.docno FROM doc_library dl LEFT OUTER JOIN doc_relative dr ON dl.docno=dr.docno WHERE objectno=:objectno AND doctype=:doctype AND template_no IS NULL"; +// SqlObject asql = new SqlObject(sql); +// asql.setParameter("objectno", sObjectNo); +// asql.setParameter("doctype", sDocType); +// rs = sqlca.getASResultSet(asql); +// String sDocNo = ""; +// String userId = request.getSession().getAttribute("userid").toString(); +// ASUser user = new ASUser(userId, sqlca); +// +// if (rs.next()) { +// sDocNo = rs.getString("docno"); +// } else { +// BizObjectManager bm = JBOFactory +// .getBizObjectManager("jbo.sys.DOC_LIBRARY"); +// JBOTransaction tx1 = JBOFactory.createJBOTransaction(); +// tx1.join(bm); +// BizObject docLibrary = bm.newObject(); +// docLibrary.setAttributeValue("UserID", user.getUserID()); +// docLibrary.setAttributeValue("UserName", user.getUserName()); +// docLibrary.setAttributeValue("OrgID", user.getOrgID()); +// docLibrary.setAttributeValue("OrgName", user.getOrgName()); +// docLibrary.setAttributeValue("docType", sDocType); +// docLibrary.setAttributeValue("DocTitle", "appUpload"); +// +// bm.saveObject(docLibrary); +// tx1.commit(); +// +// sDocNo = docLibrary.getAttribute("docno").getString(); +// BizObjectManager bmR = JBOFactory +// .getBizObjectManager("jbo.sys.DOC_RELATIVE"); +// tx1.join(bmR); +// BizObject docRelative = bmR.newObject(); +// docRelative.setAttributeValue("docno", sDocNo); +// docRelative.setAttributeValue("objecttype", sObjectType); +// docRelative.setAttributeValue("objectno", sObjectNo); +// bmR.saveObject(docRelative); +// tx1.commit(); +// } +// +// for (Map fileMap : fileList) { +// String sFileName, sFileContentType, sFileSize; +// sFileName = fileMap.get("fileName") == null ? "" : fileMap.get( +// "fileName").toString(); +// InputStream file = (InputStream) fileMap.get("file"); +// sFileContentType = fileMap.get("fileContentType") == null ? "" +// : fileMap.get("fileContentType").toString(); +// sFileSize = fileMap.get("fileSize") == null ? "" : fileMap.get( +// "fileSize").toString(); +// +// +// Configure CurConfig = Configure.getInstance(); +// String sFileSavePath = CurConfig.getConfigure("FileSavePath"); +// String sFileSaveMode = CurConfig.getConfigure("FileSaveMode"); +// String sFileNameType = CurConfig.getConfigure("FileNameType"); +// +// BizObjectManager attM = JBOFactory +// .getBizObjectManager("jbo.sys.DOC_ATTACHMENT"); +// String trueTable = ((BizObjectTableMapper) attM).getTable(); // 取得真实的表名 +// String sAttachmentNo = DBKeyHelp.getSerialNo(trueTable, +// "AttachmentNo"); +// BizObject bo = attM.newObject(); +// bo.setAttributeValue("DocNo", sDocNo); +// bo.setAttributeValue("AttachmentNo", sAttachmentNo); +// +// java.util.Date dateNow = new java.util.Date(); +// SimpleDateFormat sdfTemp = new SimpleDateFormat( +// "yyyy/MM/dd HH:mm:ss"); +// String sFullPath = "", sFilePath = ""; +// String sBeginTime = sdfTemp.format(dateNow); +// if (sFileSaveMode.equals("Disk")) { // 存放文件服务器中 +// sFullPath = FileNameHelper.getFullPath(sDocNo, sAttachmentNo, +// sFileName, sFileSavePath, sFileNameType, null); +// sFilePath = FileNameHelper.getFilePath(sDocNo, sAttachmentNo, +// sFileName, sFileNameType); +// bo.setAttributeValue("FilePath",sFilePath); +// bo.setAttributeValue("FullPath",sFullPath); +// } +// dateNow = new java.util.Date(); +// String sEndTime = sdfTemp.format(dateNow); +// bo.setAttributeValue("FileSaveMode", sFileSaveMode); +// bo.setAttributeValue("FileName", sFileName); +// bo.setAttributeValue("ContentType", sFileContentType); +// bo.setAttributeValue("ContentLength", sFileSize); +// bo.setAttributeValue("BeginTime", sBeginTime); +// bo.setAttributeValue("EndTime", sEndTime); +// bo.setAttributeValue("InputUser", user.getUserID()); +// bo.setAttributeValue("InputOrg", user.getOrgID()); +// bo.setAttributeValue("taskno", taskNo); +// bo.setAttributeValue("REMARK", sRemark); +// +// attM.saveObject(bo); +// +// File f = new File(sFullPath); +// DataOutputStream fileout = new DataOutputStream( +// new FileOutputStream(f)); +// byte b[] = new byte[Integer.valueOf(sFileSize)]; +// @SuppressWarnings("unused") +// int i = file.read(b, 0, Integer.valueOf(sFileSize) - 1); +// fileout.write(b, 0, b.length); // 将文件数据存盘 +// fileout.close(); +// +// } +// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty +// .get("SUCCESS") == null ? "SUCCESS" +// : RestfullConstant.baseProperty.get("SUCCESS").toString(), +// "上传成功!"); +// return ReturnMapUtil.getReturnMap(); +// } +// +//} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/business/comm/AppMyWorkPassCondition.java b/src_app_fresh/apx/com/amarsoft/als/business/comm/AppMyWorkPassCondition.java new file mode 100644 index 000000000..0df34e4c2 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/comm/AppMyWorkPassCondition.java @@ -0,0 +1,76 @@ +package apx.com.amarsoft.als.business.comm; + +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import jbo.app.PRD_NODEINFO_CATALOG_APP; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; + +public class AppMyWorkPassCondition { + public String filterAppFlow(JBOTransaction tx, String type) + throws JBOException { + BizObjectManager catalogManage = JBOFactory + .getBizObjectManager(PRD_NODEINFO_CATALOG_APP.CLASS_NAME); + String sql = ""; + if ("pass".equals(type)) { + // 传阅事宜 + List catalog = catalogManage + .createQuery( + "SELECT DISTINCT FLOWNO, PHASENO FROM O WHERE ENABLE_OPERATION='Y'") + .getResultList(false); + for (BizObject bo : catalog) { + if (null == bo) + continue; + String phaseNo = bo.getAttribute("PHASENO") == null ? "" : bo + .getAttribute("PHASENO").toString(); + if (StringX.isSpace(phaseNo)) + continue; + if ("".equals(phaseNo) || "1000".equals(phaseNo) + || "8000".equals(phaseNo)) + continue; + String flowNo = bo.getAttribute("FLOWNO") == null ? "" : bo + .getAttribute("FLOWNO").toString(); + if (StringX.isSpace(flowNo)) + continue; + sql += " (flowno='" + flowNo + "' and phaseno='" + phaseNo + + "') or"; + } + } else if ("passClose".equals(type)) { + List catalog = catalogManage.createQuery( + "SELECT DISTINCT FLOWNO FROM O").getResultList(false); + for (BizObject bo : catalog) { + if (null == bo) + continue; + String flowNo = bo.getAttribute("FLOWNO") == null ? "" : bo + .getAttribute("FLOWNO").toString(); + if (StringX.isSpace(flowNo)) + continue; + sql += "flowno='" + flowNo + "' or "; + + } + } + if (!StringX.isSpace(sql)) { + sql = sql.substring(0, sql.length() - 3); + sql = " and (" + sql + ")"; + } + return sql; + } + + public String queryCondition(HttpServletRequest request, Transaction sqlca, + JBOTransaction tx, String sBusinessType) throws JBOException { + String sUserId = (String) request.getSession().getAttribute("userid"); + String isRead = "pass".equals(sBusinessType) ? "0" : "1"; + String jboWhere = "FLOW_READER.isRead='" + isRead + + "' and FLOW_READER.reader='" + sUserId + "' "; + return jboWhere + filterAppFlow(tx, sBusinessType); + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/comm/WorkBusinessCondition.java b/src_app_fresh/apx/com/amarsoft/als/business/comm/WorkBusinessCondition.java new file mode 100644 index 000000000..a4b0f8f9a --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/comm/WorkBusinessCondition.java @@ -0,0 +1,102 @@ +package apx.com.amarsoft.als.business.comm; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import jbo.app.PRD_NODEINFO_CATALOG_APP; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; + +public class WorkBusinessCondition { + + public String filterAppFlow(JBOTransaction tx, String type) + throws JBOException { + BizObjectManager catalogManage = JBOFactory + .getBizObjectManager(PRD_NODEINFO_CATALOG_APP.CLASS_NAME); + String sql = ""; + if ("to".equals(type)) { + // 代办 + List catalog = catalogManage + .createQuery( + "SELECT DISTINCT FLOWNO, PHASENO FROM O WHERE ENABLE_OPERATION='Y'") + .getResultList(false); + for (BizObject bo : catalog) { + if (null == bo) + continue; + String phaseNo = bo.getAttribute("PHASENO") == null ? "" : bo + .getAttribute("PHASENO").toString(); + if (StringX.isSpace(phaseNo)) + continue; + if ("".equals(phaseNo) || "1000".equals(phaseNo) + || "8000".equals(phaseNo)) + continue; + String flowNo = bo.getAttribute("FLOWNO") == null ? "" : bo + .getAttribute("FLOWNO").toString(); + if (StringX.isSpace(flowNo)) + continue; + sql += " (flowno='" + flowNo + "' and phaseno='" + phaseNo + + "') or"; + } + + } else { + List catalog = catalogManage.createQuery( + "SELECT DISTINCT FLOWNO FROM O").getResultList(false); + for (BizObject bo : catalog) { + if (null == bo) + continue; + String flowNo = bo.getAttribute("FLOWNO") == null ? "" : bo + .getAttribute("FLOWNO").toString(); + if (StringX.isSpace(flowNo)) + continue; + sql += "flowno='" + flowNo + "' or "; + + } + } + if (!StringX.isSpace(sql)) { + sql = sql.substring(0, sql.length() - 3); + sql = " and (" + sql + ")"; + } + return sql; + } + + public String queryCondition(HttpServletRequest request, Transaction sqlca, + JBOTransaction tx, String sBusinessType) throws JBOException { + String sUserId = (String) request.getSession().getAttribute("userid"); + String jboWhere = ""; + if ("to".equals(sBusinessType)) { // 代办 + long l = System.currentTimeMillis(); + // new日期对象 + Date date = new Date(l); + // 转换提日期输出格式 + SimpleDateFormat dateFormat = new SimpleDateFormat( + "yyyy-MM-dd HH:mm:ss"); + String now = dateFormat.format(date); + jboWhere = "(O.endtime IS NULL OR O.endtime='') AND O.flowstate<>'START' "; + jboWhere += " AND (userid='" + + sUserId + + "' OR (v.NVL(O.AGENTUSERID,'" + + sUserId + + "')='" + + sUserId + + "' and EXISTS( SELECT * FROM jbo.com.tenwa.entity.comm.FLOW_ENTRUSTED_USER tu WHERE O.userid=tu.SourceUser "; + jboWhere += " and tu.endtime>= '" + now + "' and tu.begintime<='" + + now + "' AND v.substr(O.begintime,1,10)<=tu.EndTime"; + jboWhere += " AND tu.isVaild='0' AND tu.NewUser='" + sUserId + + "')) or O.AGENTUSERID='" + sUserId + "' )"; + } else if ("has".equals(sBusinessType)) { // 已办 + jboWhere = "O.endtime is not null and (O.UserID='" + sUserId + + "' or O.agentUserID='" + sUserId + "') "; + } + + return jboWhere + filterAppFlow(tx, sBusinessType); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/opinion/history/controller/FlowOpinionHistoryController.java b/src_app_fresh/apx/com/amarsoft/als/business/opinion/history/controller/FlowOpinionHistoryController.java new file mode 100644 index 000000000..2e7504ab6 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/opinion/history/controller/FlowOpinionHistoryController.java @@ -0,0 +1,39 @@ +package apx.com.amarsoft.als.business.opinion.history.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.business.opinion.history.service.FlowOpinionHistoryService; +import apx.com.amarsoft.als.business.opinion.history.service.impl.FlowOpinionHistoryServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +@Path("/flow/opinion") +public class FlowOpinionHistoryController { +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + FlowOpinionHistoryService service = new FlowOpinionHistoryServiceImpl(); + + @Path("/history/list") + @POST + public Map queryHistoryOpinIon( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] FlowOpinionHistoryController run ................."); + ARE.getLog().info( + "[Path] /flow/opinion/history/list" + " run ................."); + try { + return service.queryHistoryOpinIon(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/opinion/history/service/FlowOpinionHistoryService.java b/src_app_fresh/apx/com/amarsoft/als/business/opinion/history/service/FlowOpinionHistoryService.java new file mode 100644 index 000000000..4c80e0dd6 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/opinion/history/service/FlowOpinionHistoryService.java @@ -0,0 +1,16 @@ +package apx.com.amarsoft.als.business.opinion.history.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public interface FlowOpinionHistoryService { + Map queryHistoryOpinIon( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx, ReturnMapUtil ReturnMapUtil) throws Exception; +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/opinion/history/service/impl/FlowOpinionHistoryServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/business/opinion/history/service/impl/FlowOpinionHistoryServiceImpl.java new file mode 100644 index 000000000..0b0e85098 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/opinion/history/service/impl/FlowOpinionHistoryServiceImpl.java @@ -0,0 +1,234 @@ +package apx.com.amarsoft.als.business.opinion.history.service.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import jbo.sys.FLOW_OBJECT; +import jbo.sys.FLOW_OPINION; +import jbo.sys.FLOW_TASK; +import apx.com.amarsoft.als.business.opinion.history.service.FlowOpinionHistoryService; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +public class FlowOpinionHistoryServiceImpl implements FlowOpinionHistoryService { + private Map fieldMap; +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + + @SuppressWarnings("unchecked") + public Map queryHistoryOpinIon(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) throws Exception { + + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + String sObjectNo = fieldMap.get("OBJECTNO") == null ? "" : fieldMap + .get("OBJECTNO").toString(); + if (StringX.isSpace(sObjectNo)) { + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("FAIL").toString(), + "流程编号无效!"); + return ReturnMapUtil.getReturnMap(); + } + BizObjectManager bom = JBOFactory + .getBizObjectManager(FLOW_OBJECT.CLASS_NAME); + BizObject bo = bom.createQuery("OBJECTNO=:OBJECTNO") + .setParameter("OBJECTNO", sObjectNo).getSingleResult(false); + if (null == bo) { + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("FAIL").toString(), + "流程编号无效!"); + return ReturnMapUtil.getReturnMap(); + } + String sFlowNo = bo.getAttribute("FLOWNO") == null ? "" : bo + .getAttribute("FLOWNO").toString(); + + // String sSql = "SELECT "; + // sSql += + // "O.PhaseName,O.UserName,O.OrgName, FO.INPUTTIME, O.BeginTime,O.EndTime, FO.PHASEOPINION "; + // sSql += "FROM O, " + FLOW_OPINION.CLASS_NAME + " FO "; + // sSql += "WHERE O.SERIALNO = FO.SERIALNO "; + // sSql += "AND O.OBJECTNO='" + sObjectNo + "' AND O.FLOWNO='" + sFlowNo + // + "' "; + // sSql += "ORDER BY O.EndTime DESC"; + // + // BizObjectManager bom1 = JBOFactory + // .getBizObjectManager(FLOW_TASK.CLASS_NAME); + + String sSql = "SELECT "; + + sSql += "FT.PhaseName,FT.UserName,FT.OrgName, O.INPUTTIME, FT.BeginTime,FT.EndTime, O.PHASEOPINION "; + sSql += "FROM O, " + FLOW_TASK.CLASS_NAME + " FT "; + sSql += "WHERE FT.SERIALNO = O.SERIALNO "; + sSql += "AND FT.OBJECTNO='" + sObjectNo + "' AND FT.FLOWNO='" + sFlowNo + + "' "; + sSql += "ORDER BY FT.EndTime DESC"; + BizObjectManager bom1 = JBOFactory + .getBizObjectManager(FLOW_OPINION.CLASS_NAME); + + List bos = bom1.createQuery(sSql).getResultList(false); + List> list = new ArrayList>(); + for (BizObject bo1 : bos) { + if (null == bo1) + continue; + List> oDataElement = new ArrayList>(); + String value = ""; + String code = ""; + String display = ""; + Map PhaseName = new HashMap(); + PhaseName.put("value", value = bo1.getAttribute("PhaseName") + .getValue() == null ? "" : bo1.getAttribute("PhaseName") + .getValue().toString()); + PhaseName.put("code", code = bo1.getAttribute("PhaseName") + .getName() == null ? "" : bo1.getAttribute("PhaseName") + .getName().toString()); + PhaseName.put("display", display = bo1.getAttribute("PhaseName") + .getLabel() == null ? "" : bo1.getAttribute("PhaseName") + .getLabel().toString()); + System.out.println(code + ">" + display + ">" + value); + oDataElement.add(PhaseName); + + Map UserName = new HashMap(); + UserName.put("value", value = bo1.getAttribute("UserName") + .getValue() == null ? "" : bo1.getAttribute("UserName") + .getValue().toString()); + UserName.put("code", + code = bo1.getAttribute("UserName").getName() == null ? "" + : bo1.getAttribute("UserName").getName().toString()); + UserName.put("display", display = bo1.getAttribute("UserName") + .getLabel() == null ? "" : bo1.getAttribute("UserName") + .getLabel().toString()); + System.out.println(code + ">" + display + ">" + value); + oDataElement.add(UserName); + + Map OrgName = new HashMap(); + OrgName.put("value", + value = bo1.getAttribute("OrgName").getValue() == null ? "" + : bo1.getAttribute("OrgName").getValue().toString()); + OrgName.put("code", + code = bo1.getAttribute("OrgName").getName() == null ? "" + : bo1.getAttribute("OrgName").getName().toString()); + OrgName.put("display", display = bo1.getAttribute("OrgName") + .getLabel() == null ? "" : bo1.getAttribute("OrgName") + .getLabel().toString()); + System.out.println(code + ">" + display + ">" + value); + oDataElement.add(OrgName); + + Map INPUTTIME = new HashMap(); + INPUTTIME.put("value", value = bo1.getAttribute("INPUTTIME") + .getValue() == null ? "" : bo1.getAttribute("INPUTTIME") + .getValue().toString()); + INPUTTIME.put("code", code = bo1.getAttribute("INPUTTIME") + .getName() == null ? "" : bo1.getAttribute("INPUTTIME") + .getName().toString()); + INPUTTIME.put("display", display = bo1.getAttribute("INPUTTIME") + .getLabel() == null ? "" : bo1.getAttribute("INPUTTIME") + .getLabel().toString()); + System.out.println(code + ">" + display + ">" + value); + oDataElement.add(INPUTTIME); + + Map BeginTime = new HashMap(); + BeginTime.put("value", value = bo1.getAttribute("BeginTime") + .getValue() == null ? "" : bo1.getAttribute("BeginTime") + .getValue().toString()); + BeginTime.put("code", code = bo1.getAttribute("BeginTime") + .getName() == null ? "" : bo1.getAttribute("BeginTime") + .getName().toString()); + BeginTime.put("display", display = bo1.getAttribute("BeginTime") + .getLabel() == null ? "" : bo1.getAttribute("BeginTime") + .getLabel().toString()); + System.out.println(code + ">" + display + ">" + value); + oDataElement.add(BeginTime); + + Map EndTime = new HashMap(); + EndTime.put("value", + value = bo1.getAttribute("EndTime").getValue() == null ? "" + : bo1.getAttribute("EndTime").getValue().toString()); + EndTime.put("code", + code = bo1.getAttribute("EndTime").getName() == null ? "" + : bo1.getAttribute("EndTime").getName().toString()); + EndTime.put("display", display = bo1.getAttribute("EndTime") + .getLabel() == null ? "" : bo1.getAttribute("EndTime") + .getLabel().toString()); + System.out.println(code + ">" + display + ">" + value); + oDataElement.add(EndTime); + + Map PHASEOPINION = new HashMap(); + PHASEOPINION.put("value", value = bo1.getAttribute("PHASEOPINION") + .getValue() == null ? "" : bo1.getAttribute("PHASEOPINION") + .getValue().toString()); + PHASEOPINION.put("code", code = bo1.getAttribute("PHASEOPINION") + .getName() == null ? "" : bo1.getAttribute("PHASEOPINION") + .getName().toString()); + PHASEOPINION + .put("display", + display = bo1.getAttribute("PHASEOPINION") + .getLabel() == null ? "" : bo1 + .getAttribute("PHASEOPINION").getLabel() + .toString()); + System.out.println(code + ">" + display + ">" + value); + oDataElement.add(PHASEOPINION); + Map map = new HashMap(); + map.put("dataElements", oDataElement); + List> list2 = (List>) map + .get("dataElements"); + if (list2.size() == 6) { + Map map2 = new HashMap(); + map2.put("code", "ENDTIME"); + map2.put("display", "完成执行时间"); + map2.put("value", ""); + list2.add(map2); + } + for (Map map2 : list2) { + String sCode = map2.get("code") == null ? "" : map2.get("code") + .toString(); + if ("PHASENAME".equals(sCode)) { + // 步骤名称 + map2.put("display", "步骤名称"); + continue; + } else if ("USERNAME".equals(sCode)) { + // 处理人 + map2.put("display", "处理人"); + continue; + } else if ("ORGNAME".equals(sCode)) { + // 处理人所属机构 + map2.put("display", "处理人所属机构"); + continue; + } else if ("BEGINTIME".equals(sCode)) { + // 收到时间 + map2.put("display", "收到时间"); + continue; + } else if ("PHASEOPINION".equals(sCode)) { + // 意见 + map2.put("display", "意见"); + continue; + } else if ("INPUTTIME".equals(sCode)) { + // 意见填写时间 + map2.put("display", "意见填写时间"); + continue; + } else if ("ENDTIME".equals(sCode)) { + // 完成时间 + map2.put("display", "完成时间"); + continue; + } + } + list.add(map); + } + Map body = new HashMap(); + body.put("historyOpinion", list); + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("SUCCESS").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/controller/SignTaskOpinionController.java b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/controller/SignTaskOpinionController.java new file mode 100644 index 000000000..6c5afcf5c --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/controller/SignTaskOpinionController.java @@ -0,0 +1,72 @@ +package apx.com.amarsoft.als.business.opinion.sign.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.business.opinion.sign.service.SignTaskOpinionService; +import apx.com.amarsoft.als.business.opinion.sign.service.impl.SignTaskOpinionServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +@Path("/flow/opinion") +public class SignTaskOpinionController { + SignTaskOpinionService service = new SignTaskOpinionServiceImpl(); + + @Path("/sign/info") + @POST + public Map querySignInfo( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] SignTaskOpinionController run ................."); + ARE.getLog().info( + "[Path] /flow/opinion/sign/info" + " run ................."); + try { + return service.querySignInfo(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + @Path("/sign/save") + @POST + public Map querySignSave( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] SignTaskOpinionController run ................."); + ARE.getLog().info( + "[Path] /flow/opinion/sign/save" + " run ................."); + try { + return service.saveSignInfo(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + @Path("/sign/del") + @POST + public Map querySignDel( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] SignTaskOpinionController run ................."); + ARE.getLog().info( + "[Path] /flow/opinion/sign/del" + " run ................."); + try { + return service.delSignInfo(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/manage/SignTaskOpinionInfoDelDoManage.java b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/manage/SignTaskOpinionInfoDelDoManage.java new file mode 100644 index 000000000..c73fafb50 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/manage/SignTaskOpinionInfoDelDoManage.java @@ -0,0 +1,22 @@ +package apx.com.amarsoft.als.business.opinion.sign.manage; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoDeleteManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public class SignTaskOpinionInfoDelDoManage extends AbstractAweDoDeleteManage { + public Map SignTaskOpinionInfoDe( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx, Map paramMap, + ReturnMapUtil ReturnMapUtil) throws Exception { + return deleteBusiness(sqlca, tx, "SignTaskOpinionInfo", paramMap, "", + ReturnMapUtil); + } +} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/manage/SignTaskOpinionInfoDoManage.java b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/manage/SignTaskOpinionInfoDoManage.java new file mode 100644 index 000000000..8b89df935 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/manage/SignTaskOpinionInfoDoManage.java @@ -0,0 +1,33 @@ +package apx.com.amarsoft.als.business.opinion.sign.manage; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoQueryManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public class SignTaskOpinionInfoDoManage extends AbstractAweDoQueryManage { + private String sAddWhere; + + public void getGroupId() { + sGroupId = "SignTaskOpinionInfo"; + } + + public void getOtherWhere() { + super.sOtherWhere = this.sAddWhere; + } + + public void setsAddWhere(String sAddWhere) { + this.sAddWhere = sAddWhere; + } + + public Map querySignTaskOpinionInfo( + HttpServletRequest request, Transaction sqlca, JBOTransaction tx, + ReturnMapUtil ReturnMapUtil) throws Exception { + return getData(request, sqlca, tx, ReturnMapUtil); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/manage/SignTaskOpinionInfoSaveDoManage.java b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/manage/SignTaskOpinionInfoSaveDoManage.java new file mode 100644 index 000000000..03b16cda0 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/manage/SignTaskOpinionInfoSaveDoManage.java @@ -0,0 +1,29 @@ +package apx.com.amarsoft.als.business.opinion.sign.manage; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoSaveManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.base.util.ReturnMapUtil; + +public class SignTaskOpinionInfoSaveDoManage extends AbstractAweDoSaveManage { + private ASUser curUser; + + public void setCurUser(ASUser curUser) { + this.curUser = curUser; + } + + public Map SignTaskOpinionInfoSave( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx, Map paramMap, + ReturnMapUtil ReturnMapUtil) throws Exception { + return saveBusiness(sqlca, tx, "SignTaskOpinionInfo", paramMap, + curUser.getUserID(), "", ReturnMapUtil); + } +} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/service/SignTaskOpinionService.java b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/service/SignTaskOpinionService.java new file mode 100644 index 000000000..79c7d21d8 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/service/SignTaskOpinionService.java @@ -0,0 +1,22 @@ +package apx.com.amarsoft.als.business.opinion.sign.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public interface SignTaskOpinionService { + Map querySignInfo( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx, ReturnMapUtil ReturnMapUtil) throws Exception; + Map saveSignInfo( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx, ReturnMapUtil ReturnMapUtil) throws Exception; + Map delSignInfo( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx, ReturnMapUtil ReturnMapUtil) throws Exception; +} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/service/impl/SignTaskOpinionServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/service/impl/SignTaskOpinionServiceImpl.java new file mode 100644 index 000000000..faa3d5719 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/opinion/sign/service/impl/SignTaskOpinionServiceImpl.java @@ -0,0 +1,100 @@ +package apx.com.amarsoft.als.business.opinion.sign.service.impl; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import jbo.sys.FLOW_TASK; +import apx.com.amarsoft.als.business.opinion.sign.manage.SignTaskOpinionInfoDelDoManage; +import apx.com.amarsoft.als.business.opinion.sign.manage.SignTaskOpinionInfoDoManage; +import apx.com.amarsoft.als.business.opinion.sign.manage.SignTaskOpinionInfoSaveDoManage; +import apx.com.amarsoft.als.business.opinion.sign.service.SignTaskOpinionService; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.base.constant.RestfullConstant; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +public class SignTaskOpinionServiceImpl implements SignTaskOpinionService { + private Map fieldMap; + + // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + + @SuppressWarnings("unchecked") + public Map querySignInfo(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + String sTaskNo = fieldMap.get("SERIALNO") == null ? "" : fieldMap.get( + "SERIALNO").toString(); + if (StringX.isSpace(sTaskNo)) { + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("FAIL").toString(), + "流程编号无效!"); + return ReturnMapUtil.getReturnMap(); + } + + String sUserId = request.getSession().getAttribute("userid").toString(); + + BizObjectManager bom1 = JBOFactory + .getBizObjectManager(FLOW_TASK.CLASS_NAME); + BizObject bo1 = bom1.createQuery("SERIALNO=:SERIALNO") + .setParameter("SERIALNO", sTaskNo).getSingleResult(false); + if (null == bo1) { + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("FAIL").toString(), + "流程编号无效!"); + return ReturnMapUtil.getReturnMap(); + } + + fieldMap.put("SerialNo".toLowerCase(), sTaskNo); + fieldMap.put("SerialNo".toUpperCase(), sTaskNo); + fieldMap.put("SerialNo", sTaskNo); + fieldMap.put("OpinionNo".toLowerCase(), sUserId); + fieldMap.put("OpinionNo".toUpperCase(), sUserId); + fieldMap.put("OpinionNo", sUserId); + + SignTaskOpinionInfoDoManage manage = new SignTaskOpinionInfoDoManage(); + manage.setParamMap(fieldMap); + return manage.querySignTaskOpinionInfo(request, sqlca, tx, ReturnMapUtil); + } + + @SuppressWarnings("unchecked") + public Map saveSignInfo(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + String sUserId = request.getSession().getAttribute("userid").toString(); + ASUser curUser = new ASUser(sUserId, sqlca); + fieldMap = (Map) testMap.get("fieldMap"); + + fieldMap.put("OpinionNo".toLowerCase(), sUserId); + fieldMap.put("OpinionNo".toUpperCase(), sUserId); + fieldMap.put("OpinionNo", sUserId); + SignTaskOpinionInfoSaveDoManage manage = new SignTaskOpinionInfoSaveDoManage(); + manage.setCurUser(curUser); + manage.setTimeFormat("yyyy/MM/dd"); + return manage.SignTaskOpinionInfoSave(request, sqlca, tx, fieldMap, ReturnMapUtil); + } + + @SuppressWarnings("unchecked") + public Map delSignInfo(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + SignTaskOpinionInfoDelDoManage manage = new SignTaskOpinionInfoDelDoManage(); + return manage.SignTaskOpinionInfoDe(request, sqlca, tx, fieldMap, ReturnMapUtil); + } + +} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/close/controller/AppMyWorkPassCloseController.java b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/close/controller/AppMyWorkPassCloseController.java new file mode 100644 index 000000000..ddd825521 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/close/controller/AppMyWorkPassCloseController.java @@ -0,0 +1,38 @@ +package apx.com.amarsoft.als.business.work.circulate.close.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.business.work.circulate.close.service.AppMyWorkPassCloseService; +import apx.com.amarsoft.als.business.work.circulate.close.service.impl.AppMyWorkPassCloseServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +@Path("/my/work") +public class AppMyWorkPassCloseController { + AppMyWorkPassCloseService service = new AppMyWorkPassCloseServiceImpl(); + @Path("/pass/close") + @POST + public Map queryFlowMyWorkHas( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] AppMyWorkPassCloseController run ................."); + ARE.getLog() + .info("[Path] /my/work/pass/close" + " run ................."); + try { + return service + .queryFlowMyWorkHas(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/close/service/AppMyWorkPassCloseService.java b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/close/service/AppMyWorkPassCloseService.java new file mode 100644 index 000000000..a05d51647 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/close/service/AppMyWorkPassCloseService.java @@ -0,0 +1,16 @@ +package apx.com.amarsoft.als.business.work.circulate.close.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public interface AppMyWorkPassCloseService { + Map queryFlowMyWorkHas(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx, + ReturnMapUtil ReturnMapUtil) throws Exception; +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/close/service/impl/AppMyWorkPassCloseServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/close/service/impl/AppMyWorkPassCloseServiceImpl.java new file mode 100644 index 000000000..ed17b509d --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/close/service/impl/AppMyWorkPassCloseServiceImpl.java @@ -0,0 +1,34 @@ +package apx.com.amarsoft.als.business.work.circulate.close.service.impl; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.business.comm.AppMyWorkPassCondition; +import apx.com.amarsoft.als.business.work.circulate.close.service.AppMyWorkPassCloseService; +import apx.com.amarsoft.als.business.work.circulate.manage.HasPassQueryDoManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +public class AppMyWorkPassCloseServiceImpl implements AppMyWorkPassCloseService { + private Map fieldMap; + + @SuppressWarnings("unchecked") + public Map queryFlowMyWorkHas(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + AppMyWorkPassCondition amwpc = new AppMyWorkPassCondition(); + String condition = amwpc + .queryCondition(request, sqlca, tx, "passClose"); + HasPassQueryDoManage manage = new HasPassQueryDoManage(); + manage.setParamMap(fieldMap); + manage.setsAddWhere(condition); + return manage.queryFlowMyWorkHas(request, sqlca, tx, ReturnMapUtil); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/manage/HasPassQueryDoManage.java b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/manage/HasPassQueryDoManage.java new file mode 100644 index 000000000..50a258602 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/manage/HasPassQueryDoManage.java @@ -0,0 +1,36 @@ +package apx.com.amarsoft.als.business.work.circulate.manage; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoQueryManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public class HasPassQueryDoManage extends AbstractAweDoQueryManage { + private String sAddWhere; + + public void getGroupId() { + sGroupId = "FlowMyWorkHasPass"; + } + + public void getOtherWhere() { + super.sOtherWhere = StringX.isSpace(sAddWhere) ? "" + : this.sAddWhere; + } + + public void setsAddWhere(String sAddWhere) { + this.sAddWhere = sAddWhere; + } + + public Map queryFlowMyWorkHas(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + return getData(request, sqlca, tx, ReturnMapUtil); + } +} + diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/pass/controller/AppMyWorkPassController.java b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/pass/controller/AppMyWorkPassController.java new file mode 100644 index 000000000..483fde36b --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/pass/controller/AppMyWorkPassController.java @@ -0,0 +1,54 @@ +package apx.com.amarsoft.als.business.work.circulate.pass.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.business.work.circulate.pass.service.AppMyWorkPassService; +import apx.com.amarsoft.als.business.work.circulate.pass.service.impl.AppMyWorkPassServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public class AppMyWorkPassController { + AppMyWorkPassService service = new AppMyWorkPassServiceImpl(); + + @Path("/pass") + @POST + public Map queryFlowMyWorkHas( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] AppMyWorkPassController run ................."); + ARE.getLog().info("[Path] /my/work/pass" + " run ................."); + try { + return service + .queryFlowMyWorkHas(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + @Path("/action/close") + @POST + public Map actionClose( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] AppMyWorkPassController run ................."); + ARE.getLog().info("[Path] /my/work/action/close" + " run ................."); + try { + return service + .actionClose(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} \ No newline at end of file diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/pass/service/AppMyWorkPassService.java b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/pass/service/AppMyWorkPassService.java new file mode 100644 index 000000000..aed3f6973 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/pass/service/AppMyWorkPassService.java @@ -0,0 +1,20 @@ +package apx.com.amarsoft.als.business.work.circulate.pass.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public interface AppMyWorkPassService { + Map queryFlowMyWorkHas(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx, + ReturnMapUtil ReturnMapUtil) throws Exception; + + Map actionClose(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx, + ReturnMapUtil ReturnMapUtil) throws Exception; +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/pass/service/impl/AppMyWorkPassServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/pass/service/impl/AppMyWorkPassServiceImpl.java new file mode 100644 index 000000000..d65d6413f --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/circulate/pass/service/impl/AppMyWorkPassServiceImpl.java @@ -0,0 +1,53 @@ +package apx.com.amarsoft.als.business.work.circulate.pass.service.impl; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.business.comm.AppMyWorkPassCondition; +import apx.com.amarsoft.als.business.work.circulate.manage.HasPassQueryDoManage; +import apx.com.amarsoft.als.business.work.circulate.pass.service.AppMyWorkPassService; + +import com.amarsoft.app.flow.FlowAction; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +public class AppMyWorkPassServiceImpl implements AppMyWorkPassService { + private Map fieldMap; + + @SuppressWarnings("unchecked") + public Map queryFlowMyWorkHas(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + AppMyWorkPassCondition amwpc = new AppMyWorkPassCondition(); + String condition = amwpc.queryCondition(request, sqlca, tx, "pass"); + HasPassQueryDoManage manage = new HasPassQueryDoManage(); + manage.setParamMap(fieldMap); + manage.setsAddWhere(condition); + return manage.queryFlowMyWorkHas(request, sqlca, tx, ReturnMapUtil); + } + + @SuppressWarnings("unchecked") + public Map actionClose(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + String id = fieldMap.get("id") == null ? "" : fieldMap.get("id") + .toString(); + FlowAction FlowAction = new FlowAction(); + FlowAction.setPassReadid(id); + FlowAction.endPassedByID(tx); + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("SUCCESS").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/has/controller/FlowMyWorkHasController.java b/src_app_fresh/apx/com/amarsoft/als/business/work/has/controller/FlowMyWorkHasController.java new file mode 100644 index 000000000..194c9dc3b --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/has/controller/FlowMyWorkHasController.java @@ -0,0 +1,55 @@ +package apx.com.amarsoft.als.business.work.has.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.business.work.has.service.FlowMyWorkHasService; +import apx.com.amarsoft.als.business.work.has.service.impl.FlowMyWorkHasServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +/** + * 我的工作 > 我的已办 + * + * @author jiaji.liu + * + */ +@Path("/my/work") +public class FlowMyWorkHasController { + // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + FlowMyWorkHasService service = new FlowMyWorkHasServiceImpl(); + + /** + * 已办列表 + * + * @param request + * @param sqlca + * @param tx + * @return + * @throws Exception + */ + @Path("/has/list") + @POST + public Map queryFlowMyWorkHas( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] FlowMyWorkHasController run ................."); + ARE.getLog() + .info("[Path] /my/work/has/list" + " run ................."); + try { + return service + .queryFlowMyWorkHas(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/has/manage/FlowMyWorkHasDoManage.java b/src_app_fresh/apx/com/amarsoft/als/business/work/has/manage/FlowMyWorkHasDoManage.java new file mode 100644 index 000000000..3a8e40ed1 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/has/manage/FlowMyWorkHasDoManage.java @@ -0,0 +1,35 @@ +package apx.com.amarsoft.als.business.work.has.manage; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoQueryManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public class FlowMyWorkHasDoManage extends AbstractAweDoQueryManage { + private String sAddWhere; + + public void getGroupId() { + sGroupId = "FlowMyWorkHasDo"; + } + + public void getOtherWhere() { + super.sOtherWhere = StringX.isSpace(sAddWhere) ? "" + : this.sAddWhere; + } + + public void setsAddWhere(String sAddWhere) { + this.sAddWhere = sAddWhere; + } + + public Map queryFlowMyWorkHas(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + return getData(request, sqlca, tx, ReturnMapUtil); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/has/service/FlowMyWorkHasService.java b/src_app_fresh/apx/com/amarsoft/als/business/work/has/service/FlowMyWorkHasService.java new file mode 100644 index 000000000..4a8941341 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/has/service/FlowMyWorkHasService.java @@ -0,0 +1,16 @@ +package apx.com.amarsoft.als.business.work.has.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public interface FlowMyWorkHasService { + Map queryFlowMyWorkHas(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx, + ReturnMapUtil ReturnMapUtil) throws Exception; +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/has/service/impl/FlowMyWorkHasServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/business/work/has/service/impl/FlowMyWorkHasServiceImpl.java new file mode 100644 index 000000000..08877a2d5 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/has/service/impl/FlowMyWorkHasServiceImpl.java @@ -0,0 +1,36 @@ +package apx.com.amarsoft.als.business.work.has.service.impl; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.business.comm.WorkBusinessCondition; +import apx.com.amarsoft.als.business.work.has.manage.FlowMyWorkHasDoManage; +import apx.com.amarsoft.als.business.work.has.service.FlowMyWorkHasService; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +public class FlowMyWorkHasServiceImpl implements FlowMyWorkHasService { + private Map fieldMap; + + WorkBusinessCondition WorkBusinessCondition = new WorkBusinessCondition(); + + @SuppressWarnings("unchecked") + public Map queryFlowMyWorkHas(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + String sOtherWhere = WorkBusinessCondition.queryCondition(request, + sqlca, tx, "has"); + FlowMyWorkHasDoManage manage = new FlowMyWorkHasDoManage(); + manage.setsAddWhere(sOtherWhere); + manage.setParamMap(fieldMap); + return manage.queryFlowMyWorkHas(request, sqlca, tx, ReturnMapUtil); + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/to/controller/FlowMyWorkToController.java b/src_app_fresh/apx/com/amarsoft/als/business/work/to/controller/FlowMyWorkToController.java new file mode 100644 index 000000000..f4b8efdba --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/to/controller/FlowMyWorkToController.java @@ -0,0 +1,52 @@ +package apx.com.amarsoft.als.business.work.to.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.business.work.to.service.FlowMyWorkToService; +import apx.com.amarsoft.als.business.work.to.service.impl.FlowMyWorkToServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +/** + * 我的工作 > 我的代办 + * + * @author jiaji.liu + * + */ +@Path("/my/work") +public class FlowMyWorkToController { + FlowMyWorkToService service = new FlowMyWorkToServiceImpl(); + + /** + * 已办列表 + * + * @param request + * @param sqlca + * @param tx + * @return + * @throws Exception + */ + @Path("/to/list") + @POST + public Map queryFlowMyWorkTo( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] FlowMyWorkToController run ................."); + ARE.getLog().info("[Path] /my/work/to/list" + " run ................."); + try { + return service.queryFlowMyWorkTo(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/to/manage/FlowMyWorkToDoManage.java b/src_app_fresh/apx/com/amarsoft/als/business/work/to/manage/FlowMyWorkToDoManage.java new file mode 100644 index 000000000..cea413871 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/to/manage/FlowMyWorkToDoManage.java @@ -0,0 +1,35 @@ +package apx.com.amarsoft.als.business.work.to.manage; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoQueryManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public class FlowMyWorkToDoManage extends AbstractAweDoQueryManage { + private String sAddWhere; + + public void getGroupId() { + sGroupId = "FlowMyWorkToDo"; + } + + public void getOtherWhere() { + super.sOtherWhere = StringX.isSpace(sAddWhere) ? "" + : this.sAddWhere; + } + + public void setsAddWhere(String sAddWhere) { + this.sAddWhere = sAddWhere; + } + + public Map queryFlowMyWorkTo(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + return getData(request, sqlca, tx, ReturnMapUtil); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/to/service/FlowMyWorkToService.java b/src_app_fresh/apx/com/amarsoft/als/business/work/to/service/FlowMyWorkToService.java new file mode 100644 index 000000000..656290cf1 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/to/service/FlowMyWorkToService.java @@ -0,0 +1,16 @@ +package apx.com.amarsoft.als.business.work.to.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public interface FlowMyWorkToService { + Map queryFlowMyWorkTo(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx, + ReturnMapUtil ReturnMapUtil) throws Exception; +} diff --git a/src_app_fresh/apx/com/amarsoft/als/business/work/to/service/impl/FlowMyWorkToServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/business/work/to/service/impl/FlowMyWorkToServiceImpl.java new file mode 100644 index 000000000..4a6234312 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/business/work/to/service/impl/FlowMyWorkToServiceImpl.java @@ -0,0 +1,35 @@ +package apx.com.amarsoft.als.business.work.to.service.impl; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.business.comm.WorkBusinessCondition; +import apx.com.amarsoft.als.business.work.to.manage.FlowMyWorkToDoManage; +import apx.com.amarsoft.als.business.work.to.service.FlowMyWorkToService; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +public class FlowMyWorkToServiceImpl implements FlowMyWorkToService { + private Map fieldMap; + WorkBusinessCondition WorkBusinessCondition = new WorkBusinessCondition(); + + @SuppressWarnings("unchecked") + public Map queryFlowMyWorkTo(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + String sOtherWhere = WorkBusinessCondition.queryCondition(request, + sqlca, tx, "to"); + FlowMyWorkToDoManage manage = new FlowMyWorkToDoManage(); + manage.setsAddWhere(sOtherWhere); + manage.setParamMap(fieldMap); + return manage.queryFlowMyWorkTo(request, sqlca, tx, ReturnMapUtil); + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/currency/select/contract/controller/ContractSelectController.java b/src_app_fresh/apx/com/amarsoft/als/currency/select/contract/controller/ContractSelectController.java new file mode 100644 index 000000000..4da4deeaf --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/currency/select/contract/controller/ContractSelectController.java @@ -0,0 +1,39 @@ +package apx.com.amarsoft.als.currency.select.contract.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.currency.select.contract.service.ContractSelectService; +import apx.com.amarsoft.als.currency.select.contract.service.impl.ContractSelectServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +@Path("/select/detail") +public class ContractSelectController { + ContractSelectService service = new ContractSelectServiceImpl(); +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + // 客户变更申请 合同列表 + @Path("/contract/customer/change/list") + @POST + public Map getLBContractCustomerList( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] ContractInfoListController run ................."); + ARE.getLog().info( + "[Path] /select/detail/contract/customer/change/list run ................."); + try { + return service.getLBContractCustomerList(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/currency/select/contract/service/ContractSelectService.java b/src_app_fresh/apx/com/amarsoft/als/currency/select/contract/service/ContractSelectService.java new file mode 100644 index 000000000..0c6bcbaf8 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/currency/select/contract/service/ContractSelectService.java @@ -0,0 +1,17 @@ +package apx.com.amarsoft.als.currency.select.contract.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public interface ContractSelectService { + Map getLBContractCustomerList( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception; +} diff --git a/src_app_fresh/apx/com/amarsoft/als/currency/select/contract/service/impl/ContractSelectServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/currency/select/contract/service/impl/ContractSelectServiceImpl.java new file mode 100644 index 000000000..17f20a01d --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/currency/select/contract/service/impl/ContractSelectServiceImpl.java @@ -0,0 +1,33 @@ +package apx.com.amarsoft.als.currency.select.contract.service.impl; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.awe.select.SelectCatalogWin; +import apx.com.amarsoft.als.currency.select.contract.service.ContractSelectService; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.base.constant.RestfullConstant; +import com.base.util.ReturnMapUtil; + +public class ContractSelectServiceImpl implements ContractSelectService { + // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + + public Map getLBContractCustomerList( + HttpServletRequest request, Transaction sqlca, JBOTransaction tx, + ReturnMapUtil ReturnMapUtil) throws Exception { + String sSelName = "SelectContractInfoCustChangeList"; + SelectCatalogWin select = new SelectCatalogWin(sSelName, tx, sqlca, + request); + ASUser curUser = new ASUser((String) request.getSession().getAttribute( + "userid"), sqlca); + select.setParam("orgId", curUser.getOrgID()); + Map body = select.execute(tx, sqlca, request); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty.get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/currency/select/controller/SelectDataController.java b/src_app_fresh/apx/com/amarsoft/als/currency/select/controller/SelectDataController.java new file mode 100644 index 000000000..39869bcec --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/currency/select/controller/SelectDataController.java @@ -0,0 +1,108 @@ +package apx.com.amarsoft.als.currency.select.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.currency.select.service.SelectDataService; +import apx.com.amarsoft.als.currency.select.service.impl.SelectDataServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +@Path("/select/data") +public class SelectDataController { + SelectDataService selectDataService = new SelectDataServiceImpl(); + + // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + @Path("/get/common") + @GET + public Map getCommonSelectDataGet( + @Context HttpServletRequest request, JBOTransaction tx, + Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] SelectDataController run ................."); + ARE.getLog().info( + "[Path] /select/data/get/common run ................."); + try { + return selectDataService + .getCommonSelectData(request, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + @Path("/get/common") + @POST + public Map getCommonSelectDataPost( + @Context HttpServletRequest request, JBOTransaction tx, + Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] SelectDataController run ................."); + ARE.getLog().info( + "[Path] /select/data/get/common run ................."); + try { + return selectDataService + .getCommonSelectData(request, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + @Path("/get/nation") + @GET + public Map getNationSelectData(JBOTransaction tx, + Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] SelectDataController run ................."); + ARE.getLog().info( + "[Path] /select/data/get/nation run ................."); + try { + return selectDataService.getNationSelectData(ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + @Path("/get/unit/kind") + @GET + public Map getUnitKindSelectData(JBOTransaction tx, + Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] SelectDataController run ................."); + ARE.getLog().info( + "[Path] /select/data/get/unit/kind run ................."); + try { + return selectDataService.getUnitKindSelectData(ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + @Path("/get/province/city/area") + @GET + public Map getProvinceCityAreaSelectData(JBOTransaction tx, + Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] SelectDataController run ................."); + ARE.getLog() + .info("[Path] /select/data/get/province/city/area run ................."); + try { + return selectDataService + .getProvinceCityAreaSelectData(ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/currency/select/service/SelectDataService.java b/src_app_fresh/apx/com/amarsoft/als/currency/select/service/SelectDataService.java new file mode 100644 index 000000000..3a0a9ee69 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/currency/select/service/SelectDataService.java @@ -0,0 +1,48 @@ +package apx.com.amarsoft.als.currency.select.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.base.util.ReturnMapUtil; + +public interface SelectDataService { + /** + * 获取普通选择数据 (code. jbo. codetable. min_max. ) + * + * @param request + * @return + * @throws Exception + */ + Map getCommonSelectData( + @Context HttpServletRequest request, ReturnMapUtil ReturnMapUtil) + throws Exception; + + /** + * 获取国家选择数据 + * + * @return + * @throws Exception + */ + Map getNationSelectData(ReturnMapUtil ReturnMapUtil) + throws Exception; + + /** + * 获取行业选择数据 + * + * @return + * @throws Exception + */ + Map getUnitKindSelectData(ReturnMapUtil ReturnMapUtil) + throws Exception; + + /** + * 获取省市区选择数据 + * + * @return + * @throws Exception + */ + Map getProvinceCityAreaSelectData( + ReturnMapUtil ReturnMapUtil) throws Exception; +} diff --git a/src_app_fresh/apx/com/amarsoft/als/currency/select/service/impl/SelectDataServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/currency/select/service/impl/SelectDataServiceImpl.java new file mode 100644 index 000000000..3137311a2 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/currency/select/service/impl/SelectDataServiceImpl.java @@ -0,0 +1,293 @@ +package apx.com.amarsoft.als.currency.select.service.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.cache.instance.AppCodeCache; +import apx.com.amarsoft.als.base.cache.instance.AppConstantCache; +import apx.com.amarsoft.als.currency.select.service.SelectDataService; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.base.constant.RestfullConstant; +import com.base.util.BizObjectUtil; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +public class SelectDataServiceImpl implements SelectDataService { + // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + @SuppressWarnings("unchecked") + @Override + public Map getCommonSelectData(HttpServletRequest request, + ReturnMapUtil ReturnMapUtil) throws Exception { + try { + Map fieldMap = new HashMap(); + String sSourceType = ""; + String sSource = ""; + if ("GET".equals(request.getMethod())) { + sSourceType = request.getParameter("type"); + sSource = request.getParameter("source"); + } else { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + sSourceType = fieldMap.get("type") == null ? null : fieldMap + .get("type").toString(); + sSource = fieldMap.get("source") == null ? null : fieldMap.get( + "source").toString(); + } + if (null == sSourceType) + sSourceType = ""; + if (null == sSource) + sSourceType = ""; + Map body = new HashMap(); + List> list = new ArrayList>(); + BizObjectUtil util = new BizObjectUtil(); + if (sSourceType.length() < 1 || sSource.length() < 1) { + body.put("selectData", list); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty.get("SUCCESS"), + ""); + return ReturnMapUtil.getReturnMap(); + } + + sSourceType = sSourceType.toLowerCase(); + + switch (sSourceType.toLowerCase()) { + case "code": + Map appCodeCachePool = AppCodeCache + .getAppCodeCachePool(); + Map map = (Map) appCodeCachePool + .get(sSource); + List> library = (List>) map + .get("library"); + list = handleLibrary(library); + break; + case "jbo": + if (!sSource.contains(",")) { + body.put("selectData", list); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty + .get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } + String[] arrayJbo = sSource.split(","); + if (arrayJbo.length < 4) { + body.put("selectData", list); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty + .get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } + + String sClass = arrayJbo[0]; + String sKey = arrayJbo[1]; + String sValue = arrayJbo[2]; + String sWhere = arrayJbo[3]; + + if (arrayJbo.length > 4) { + for (int i = 4; i < arrayJbo.length; i++) { + sWhere += "," + arrayJbo[i]; + } + } + BizObjectManager bom = JBOFactory.getBizObjectManager(sClass); + BizObjectQuery boq = bom.createQuery("SELECT " + sKey + ", " + + sValue + " FROM O WHERE " + sWhere); + List bos = boq.getResultList(false); + List> jboList = new ArrayList>(); + for (BizObject bo : bos) { + jboList.add(util.bizObject2MapValue(bo)); + } + try { + list = handleJbo(bos, sKey, sValue); + } catch (Exception e) { + ARE.getLog().error(e); + list = new ArrayList>(); + } + break; + case "codetable": + if (!sSource.contains(",")) { + body.put("selectData", list); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty + .get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } + String[] arrayCodeTable = sSource.split(","); + if (arrayCodeTable.length % 2 != 0) { + body.put("selectData", list); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty + .get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } + list = handleCodeTableSource(arrayCodeTable); + break; + case "@min_max": + // 6,8 + if (!sSource.contains(",")) { + body.put("selectData", list); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty + .get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } + String[] arrayMinMax = sSource.split(","); + if (arrayMinMax.length != 2) { + body.put("selectData", list); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty + .get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } + list = handleMinMax(arrayMinMax); + break; + default: + break; + } + body.put("selectData", list); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty.get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } catch (Exception e) { + ARE.getLog().error(e); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL"), + setFailMessage("普通下拉")); + return ReturnMapUtil.getReturnMap(); + } + } + + @Override + public Map getNationSelectData(ReturnMapUtil ReturnMapUtil) + throws Exception { + try { + Map getAppConstantPool = AppConstantCache + .getAppConstantPool(); + @SuppressWarnings("unchecked") + List> list = (List>) getAppConstantPool + .get("nationCode"); + Map body = new HashMap(); + body.put("selectData", list); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty.get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } catch (Exception e) { + ARE.getLog().error(e); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL"), + setFailMessage("国别")); + return ReturnMapUtil.getReturnMap(); + } + } + + @Override + public Map getUnitKindSelectData(ReturnMapUtil ReturnMapUtil) + throws Exception { + try { + Map getAppConstantPool = AppConstantCache + .getAppConstantPool(); + @SuppressWarnings("unchecked") + List> list = (List>) getAppConstantPool + .get("unitKind"); + Map body = new HashMap(); + body.put("selectData", list); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty.get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } catch (Exception e) { + ARE.getLog().error(e); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL"), + setFailMessage("行业")); + return ReturnMapUtil.getReturnMap(); + } + } + + @Override + public Map getProvinceCityAreaSelectData( + ReturnMapUtil ReturnMapUtil) throws Exception { + try { + Map getAppConstantPool = AppConstantCache + .getAppConstantPool(); + @SuppressWarnings("unchecked") + List> list = (List>) getAppConstantPool + .get("provinceCityArea"); + Map body = new HashMap(); + body.put("selectData", list); + ReturnMapUtil.setReturnMap(body, + (String) RestfullConstant.baseProperty.get("SUCCESS"), ""); + return ReturnMapUtil.getReturnMap(); + } catch (Exception e) { + ARE.getLog().error(e); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL"), + setFailMessage("省市区")); + return ReturnMapUtil.getReturnMap(); + } + } + + private List> handleMinMax(String[] arrayMinMax) { + List> list = new ArrayList>(); + Map map = new HashMap(); + map.put("min", arrayMinMax[0]); + map.put("max", arrayMinMax[1]); + list.add(map); + return list; + } + + private List> handleJbo(List jboList, + String sKey, String sValue) throws JBOException { + List> list = new ArrayList>(); + for (BizObject jboMapa : jboList) { + Map map = new HashMap(); + map.put("itemno", jboMapa.getAttribute(sKey) == null ? null + : jboMapa.getAttribute(sKey).toString()); + map.put("itemname", jboMapa.getAttribute(sValue) == null ? null + : jboMapa.getAttribute(sValue).toString()); + list.add(map); + } + return list; + } + + private List> handleLibrary( + List> library) { + List> list = new ArrayList>(); + for (Map col : library) { + Map map = new HashMap(); + map.put("itemno", col.get("itemno")); + map.put("itemname", col.get("itemname")); + list.add(map); + } + return list; + } + + private List> handleCodeTableSource( + String[] arrayCodeTable) { + List> list = new ArrayList>(); + for (int i = 0; i < arrayCodeTable.length; i += 2) { + if (i == 0 || i % 2 == 0) { + Map map = new HashMap(); + map.put("itemno", arrayCodeTable[i]); + map.put("itemname", arrayCodeTable[i + 1]); + list.add(map); + } + } + return list; + } + + private String setFailMessage(String sKey) { + String sMessage = "获取#key#选择框数据失败!"; + sMessage = sMessage.replace("#key#", sKey); + return sMessage; + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/doc/AppAtt.java b/src_app_fresh/apx/com/amarsoft/als/doc/AppAtt.java new file mode 100644 index 000000000..ca4ae6119 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/doc/AppAtt.java @@ -0,0 +1,5 @@ +package apx.com.amarsoft.als.doc; + +public class AppAtt { + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/doc/controller/DocManageController.java b/src_app_fresh/apx/com/amarsoft/als/doc/controller/DocManageController.java new file mode 100644 index 000000000..3c0fc93af --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/doc/controller/DocManageController.java @@ -0,0 +1,159 @@ +//package apx.com.amarsoft.als.doc.controller; +// +//import java.io.File; +//import java.io.FileInputStream; +//import java.io.InputStream; +//import java.util.List; +//import java.util.Map; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import javax.ws.rs.GET; +//import javax.ws.rs.Path; +//import javax.ws.rs.core.Context; +// +//import org.apache.commons.io.FileUtils; +// +//import com.amarsoft.are.ARE; +//import com.amarsoft.are.jbo.BizObject; +//import com.amarsoft.are.jbo.JBOFactory; +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.awe.util.Transaction; +//import com.base.constant.RestfullConstant; +//import com.base.helper.AppHelper; +//import com.base.util.DownloadAttUtil; +//import com.base.util.ReturnMapUtil; +// +//import apx.com.amarsoft.als.doc.AppAtt; +//import apx.com.amarsoft.als.doc.service.DocManageService; +// +//@Path("/files") +//public class DocManageController { +// DocManageService service = new DocManageService(); +// +// @Path("/down/docById") +// @GET +// public AppAtt attachmentDownloadById(@Context HttpServletRequest request, +// @Context HttpServletResponse response) throws Exception { +// String sId = request.getParameter("id"); +// return service.attachmentDownloadById(sId, request, response); +// } +// +// @Path("/remove/docById") +// @GET +// public Map removeDocById( +// @Context HttpServletRequest request, +// @Context HttpServletResponse response, @Context Transaction sqlca, +// JBOTransaction tx) throws Exception { +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); +// try { +// String sId = request.getParameter("id"); +// +// if (service.removeDocById(sId, tx)) { +// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty +// .get("SUCCESS").toString(), "文件移除成功!"); +// } else { +// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty +// .get("FAIL").toString(), "文件移除失败!"); +// } +// return ReturnMapUtil.getReturnMap(); +// } catch (Exception e) { +// return ReturnMapUtil.rollback(e); +// } +// } +// +// @Path("/downloadPlist") +// @GET +// public void downloadPlist(@Context HttpServletResponse response, +// @Context HttpServletRequest request) throws Exception { +// String sFileName = "ios-com.ceb-fl.eleasing-app.plist"; +// String sPath = request.getSession().getServletContext().getRealPath("/") +// + "/plist/" + sFileName; +// ARE.getLog().debug("文件名:" + sFileName); +// ARE.getLog().debug("路径:" + sPath); +// DownloadAttUtil.setCharset(response, null); +// try { +// DownloadAttUtil.downloadAppIOS(sFileName, sPath, response); +// } catch (Exception e) { +// String contextPath = request.getContextPath(); +// response.setHeader("Refresh", "1;url=" + contextPath + "/404.html"); +// ARE.getLog().error("app应用下载失败", e); +// throw new Exception("------Timeout------"); +// } +// } +// +// @Path("/downloadAppById") +// @GET +// public void downloadAppApplication(@Context HttpServletRequest request, +// @Context HttpServletResponse response, @Context Transaction sqlca) +// throws Exception { +// String id = request.getParameter("id"); +// String path = ""; +// String fileName = ""; +// String sql = "SELECT O.IMAGE_PATH, O.FILE_NAME " +// + "FROM O WHERE 1=1 AND id=" + "'" + id + "'"; +// List bolist = JBOFactory.getFactory() +// .getManager("jbo.app.APP_VERSION").createQuery(sql) +// .getResultList(false); +// if (bolist != null && bolist.size() > 0) { +// BizObject bo = bolist.get(0); +// path = bo.getAttribute("IMAGE_PATH") == null ? "" : bo +// .getAttribute("IMAGE_PATH").toString().trim(); +// fileName = bo.getAttribute("FILE_NAME") == null ? "" : bo +// .getAttribute("FILE_NAME").toString().trim(); +// } +// // fileName = URLEncoder.encode(fileName, "GBK"); +// fileName = new String(fileName.getBytes(), "ISO-8859-1"); +// response.reset(); +// response.setHeader("Content-disposition", "attachment; filename=" +// + fileName); +// response.setContentType("text/html; charset=UTF-8"); +// File file = new File(path); +// response.setContentLength((int) file.length()); +// +// try (InputStream in = new FileInputStream(path)) { +// FileUtils.copyFile(new File(path), response.getOutputStream()); +// } catch (Exception e) { +// ARE.getLog().error("app应用下载失败", e); +// ARE.getLog().error("------Timeout------"); +// return; +// } +// } +// +// @Path("/downloadApp") +// @GET +// public void downloadFileApp(@Context HttpServletRequest request, +// @Context HttpServletResponse response, @Context Transaction sqlca) +// throws Exception { +// String sDevType = request.getParameter("devType"); +// sDevType = request.getParameter("devType") == null ? "ios" +// : request.getParameter("devType").toString(); +// String userAgent = request.getHeader("user-agent"); +// if (null != userAgent) { +// if (userAgent.toLowerCase().indexOf("iphone") >= 0) { +// sDevType = "ios"; +// } else { +// sDevType = "android"; +// } +// } +// Map appMap = AppHelper.getNewVersionByPhoneType(sDevType); +// String sFileName = ""; +// String sPath = ""; +// if (null != appMap) { +// sFileName = appMap.get("FILE_NAME".toLowerCase()) == null ? "" : appMap.get("FILE_NAME".toLowerCase()).toString(); +// sPath = appMap.get("IMAGE_PATH".toLowerCase()) == null ? "" : appMap.get("IMAGE_PATH".toLowerCase()).toString(); +// } +// ARE.getLog().debug("文件名:" + sFileName); +// ARE.getLog().debug("路径:" + sPath); +// DownloadAttUtil.setCharset(response, null); +// try { +// DownloadAttUtil.downloadAppAndroid(sFileName, sPath, response); +// } catch (Exception e) { +// String contextPath = request.getContextPath(); +// response.setHeader("Refresh", "1;url=" + contextPath + "/404.html"); +// ARE.getLog().error("app应用下载失败", e); +// throw new Exception("------Timeout------"); +// } +// } +// +//} diff --git a/src_app_fresh/apx/com/amarsoft/als/doc/service/DocManageService.java b/src_app_fresh/apx/com/amarsoft/als/doc/service/DocManageService.java new file mode 100644 index 000000000..2a81f303e --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/doc/service/DocManageService.java @@ -0,0 +1,85 @@ +//package apx.com.amarsoft.als.doc.service; +// +//import java.util.Map; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import javax.ws.rs.core.Context; +// +//import jbo.app.tenwa.doc.DOC_ATTRIBUTE; +//import apx.com.amarsoft.als.doc.AppAtt; +// +//import com.amarsoft.are.ARE; +//import com.amarsoft.are.jbo.BizObject; +//import com.amarsoft.are.jbo.BizObjectManager; +//import com.amarsoft.are.jbo.JBOFactory; +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.base.helper.LBDocHelper; +//import com.base.util.DownloadAttUtil; +// +//public class DocManageService { +// public AppAtt attachmentDownloadById(String sId, +// @Context HttpServletRequest request, +// @Context HttpServletResponse response) throws Exception { +// DownloadAttUtil.setCharset(response, null); +// // LB_DOCATTRIBUTE >. ID +// String sDevType = request.getParameter("devType") == null ? "ios" +// : request.getParameter("devType").toString(); +// String userAgent = request.getHeader("user-agent"); +// if (null != userAgent) { +// if (userAgent.toLowerCase().indexOf("iphone") >= 0) { +// sDevType = "ios"; +// } else { +// sDevType = "android"; +// } +// } +// Map lbDocMap = LBDocHelper.getDocById2(sId); +// if (null != lbDocMap) { +// String sFileName = lbDocMap.get("FILENAME".toLowerCase()) == null ? "" +// : lbDocMap.get("FILENAME".toLowerCase()).toString(); +// String sFilePath = lbDocMap.get("FILEPATH".toLowerCase()) == null ? "" +// : lbDocMap.get("FILEPATH".toLowerCase()).toString(); +// String sFileSize = lbDocMap.get("CONTENTLENGTH".toLowerCase()) == null ? "" +// : lbDocMap.get("CONTENTLENGTH".toLowerCase()).toString(); +// +// try { +// DownloadAttUtil.downloadAtt(sFileName, sFilePath, sFileSize, +// response, request, sDevType); +// } catch (Exception e) { +// String contextPath = request.getContextPath(); +// response.setHeader("Refresh", "1;url=" + contextPath +// + "/404.html"); +// ARE.getLog().error(e); +// throw new Exception("------Timeout------"); +// } +// } else { +// String contextPath = request.getContextPath(); +// response.setHeader("Refresh", "1;url=" + contextPath + "/404.html"); +// throw new Exception("------Timeout------"); +// } +// return new AppAtt(); +// } +// +// /** +// * 根据 attachment no 移除 附件 +// * @param sId +// * @param tx +// * @return +// */ +// public boolean removeDocById(String sId, JBOTransaction tx) { +// try { +// BizObjectManager manage = JBOFactory +// .getBizObjectManager(DOC_ATTRIBUTE.CLASS_NAME); +// BizObject bo = manage.createQuery("attachmentno=:id").setParameter("id", sId) +// .getSingleResult(true); +// if (null == bo) +// return true; +// manage.deleteObject(bo); +// return true; +// } catch (Exception e) { +// ARE.getLog().error(e); +// return false; +// } +// } +// +//} diff --git a/src_app_fresh/apx/com/amarsoft/als/test/controller/TestController.java b/src_app_fresh/apx/com/amarsoft/als/test/controller/TestController.java new file mode 100644 index 000000000..02de5fc65 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/test/controller/TestController.java @@ -0,0 +1,100 @@ +package apx.com.amarsoft.als.test.controller; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.util.DateUtil; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +@Path("/test") +public class TestController { + private Map fieldMap; + + @SuppressWarnings("unchecked") + @Path("/testdemo") + @POST + public Map demo1(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + // 不变 + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + // 不变 + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + + String userId = request.getSession().getAttribute("userid").toString(); + + // String param = request.getParameter("param"); + // String d = DateUtil.getSystemTimeByFormat("yyyy年MM月dd日"); + Map body = new HashMap(); + body.put("userId", userId); + + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("success").toString(), + "this is a message"); + return ReturnMapUtil.getReturnMap(); + + } + + @Path("/testdemo") + @GET + public Map testdemo(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) { + // String param = request.getParameter("param"); + String d = DateUtil.getSystemTimeByFormat("yyyy年MM月dd日"); + Map body = new HashMap(); + body.put("系统时间", d); + + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("success").toString(), + "this is a message"); + return ReturnMapUtil.getReturnMap(); + + } + @Path("/demo") + @GET + public Map demo(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) { + String param = request.getParameter("param"); + Map body = new HashMap(); + body.put("desc", param); + + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ReturnMapUtil.setReturnMap(body, RestfullConstant.baseProperty.get("success").toString(), "this is a message"); + return ReturnMapUtil.getReturnMap(); + + } + + +// @Path("/get/province/city/area") +// @GET +// public Map getProvinceCityAreaSelectData(JBOTransaction tx, +// Transaction sqlca) throws Exception { +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); +// ARE.getLog().info( +// "[CONTROLLER] SelectDataController run ................."); +// ARE.getLog() +// .info("[Path] /select/data/get/province/city/area run ................."); +// try { +// return selectDataService +// .getProvinceCityAreaSelectData(ReturnMapUtil); +// } catch (Exception e) { +// return ReturnMapUtil.rollback(e); +// } +// } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/user/logon/controller/AppUserLogonController.java b/src_app_fresh/apx/com/amarsoft/als/user/logon/controller/AppUserLogonController.java new file mode 100644 index 000000000..f98dd3853 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/user/logon/controller/AppUserLogonController.java @@ -0,0 +1,57 @@ +package apx.com.amarsoft.als.user.logon.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.user.logon.service.AppUserLoginService; +import apx.com.amarsoft.als.user.logon.service.AppUserLogoutService; +import apx.com.amarsoft.als.user.logon.service.impl.AppUserLoginServiceImpl; +import apx.com.amarsoft.als.user.logon.service.impl.AppUserLogoutServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +@Path("/logon/manager") +public class AppUserLogonController { + + AppUserLogoutService logoutService = new AppUserLogoutServiceImpl(); + AppUserLoginService loginService = new AppUserLoginServiceImpl(); +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + @Path("/logon") + @GET + public Map login( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws JBOException { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info("[CONTROLLER] AppUserLogonController run ................."); + ARE.getLog().info("[Path] /logon/manager/logon run ................."); + try { + return loginService.login(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + @Path("/logout") + @GET + public Map logout( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) + throws JBOException { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info("[CONTROLLER] AppUserLogonController run ................."); + ARE.getLog().info("[Path] /logon/manager/logout run ................."); + try { + return logoutService.logout(request, sqlca, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app/apx/com/amarsoft/als/user/logon/service/AppUserLoginService.java b/src_app_fresh/apx/com/amarsoft/als/user/logon/service/AppUserLoginService.java similarity index 54% rename from src_app/apx/com/amarsoft/als/user/logon/service/AppUserLoginService.java rename to src_app_fresh/apx/com/amarsoft/als/user/logon/service/AppUserLoginService.java index 69113d02f..272bffdd1 100644 --- a/src_app/apx/com/amarsoft/als/user/logon/service/AppUserLoginService.java +++ b/src_app_fresh/apx/com/amarsoft/als/user/logon/service/AppUserLoginService.java @@ -1,24 +1,17 @@ -package apx.com.amarsoft.als.user.logon.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface AppUserLoginService { - /** - * APP 用户登录 记录token session 错误日志等业务 - * - * @param request - * @param sqlca - * @param tx - * @return - * @throws JBOException - */ - Map logon(HttpServletRequest request, Transaction sqlca, - @Context JBOTransaction tx) throws Exception; -} +package apx.com.amarsoft.als.user.logon.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public interface AppUserLoginService { + Map login(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx, + ReturnMapUtil ReturnMapUtil) throws JBOException; +} diff --git a/src_app/apx/com/amarsoft/als/user/logon/service/AppUserLogoutService.java b/src_app_fresh/apx/com/amarsoft/als/user/logon/service/AppUserLogoutService.java similarity index 57% rename from src_app/apx/com/amarsoft/als/user/logon/service/AppUserLogoutService.java rename to src_app_fresh/apx/com/amarsoft/als/user/logon/service/AppUserLogoutService.java index 3de274eb0..30cd7598d 100644 --- a/src_app/apx/com/amarsoft/als/user/logon/service/AppUserLogoutService.java +++ b/src_app_fresh/apx/com/amarsoft/als/user/logon/service/AppUserLogoutService.java @@ -1,22 +1,16 @@ -package apx.com.amarsoft.als.user.logon.service; - -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; - -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.Transaction; - -public interface AppUserLogoutService { - /** - * APP用户登出服务 - * - * @param request - * @param sqlca - * @param tx - * @return - */ - Map logout(HttpServletRequest request, Transaction sqlca, - @Context JBOTransaction tx); -} +package apx.com.amarsoft.als.user.logon.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public interface AppUserLogoutService { + Map logout(@Context HttpServletRequest request, + @Context Transaction sqlca, @Context JBOTransaction tx, + ReturnMapUtil ReturnMapUtil); +} diff --git a/src_app_fresh/apx/com/amarsoft/als/user/logon/service/impl/AppUserLoginServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/user/logon/service/impl/AppUserLoginServiceImpl.java new file mode 100644 index 000000000..9a97ed55d --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/user/logon/service/impl/AppUserLoginServiceImpl.java @@ -0,0 +1,335 @@ +package apx.com.amarsoft.als.user.logon.service.impl; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.servlet.http.HttpServletRequest; + +import jbo.app.PRD_NODEINFO_CATALOG_APP; +import jbo.sys.FLOW_CATALOG; +import jbo.sys.FLOW_MODEL; +import jbo.sys.USER_ROLE; +//import jbo.app.APP_MENU_INFO; +import apx.com.amarsoft.als.user.logon.service.AppUserLoginService; +import cn.bean.Org; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.helper.SessionHelper; +import com.base.helper.UserHelper; +import com.base.tool.ExpireTool; +//import com.base.util.BizObjectUtil; +import com.base.util.DES; +import com.base.util.DateUtil; +import com.base.util.MD5Util; +import com.base.util.ReturnMapUtil; + +public class AppUserLoginServiceImpl implements AppUserLoginService { + + public String queryRoleId() { + String str = RestfullConstant.baseProperty.get("FILTER_USER_ROLE_ID") == null ? "''" + : RestfullConstant.baseProperty.get("FILTER_USER_ROLE_ID") + .toString(); + return str; + } + + @SuppressWarnings("unchecked") + public boolean userRoleFilter(String userId) throws JBOException { + BizObjectManager bom = JBOFactory + .getBizObjectManager(USER_ROLE.CLASS_NAME); + String roleIds = queryRoleId(); + if ("none".equals(roleIds)) + return true; + BizObjectQuery boq = bom + .createQuery("SELECT * FROM O WHERE ROLEID IN (" + roleIds + + ")"); + List bos = boq.getResultList(false); + + if (bos == null || bos.size() == 0) { + return true; + } + + for (BizObject bo : bos) { + String roleUserId = bo.getAttribute("USERID") == null ? "" : bo + .getAttribute("USERID").toString(); + if (userId.equals(roleUserId)) { + return true; + } + } + return false; + } + + public Map login(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws JBOException { + String sUn = request.getParameter("un"); + String sPwd = request.getParameter("pwd"); + String sDevOs = request.getParameter("devtype"); + String sDevId = request.getParameter("devid"); + String sDevRegId = request.getParameter("dev_reg_id"); + String sKeyType = request.getParameter("keytype") == null ? "common" + : request.getParameter("keytype"); + if (null == sUn) + sUn = ""; + if (null == sPwd) + sPwd = ""; + if (null == sDevOs) + sDevOs = ""; + if (null == sDevId) + sDevId = ""; + if (null == sDevRegId) + sDevRegId = ""; + + Map userMap = UserHelper.getUserByLoginId(sUn); + + if (null == userMap) { + // 无用户 + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "用户不存在!"); + return ReturnMapUtil.getReturnMap(); + } + + if (!userRoleFilter(userMap.get("USERID".toLowerCase()).toString())) { + // 用户不存在 或 离职 + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "无权限登录!"); + return ReturnMapUtil.getReturnMap(); + } + + // 用户是否存在 及 状态校验 + if (null == userMap || null == userMap.get("USERID".toLowerCase())) { + // 用户不存在 或 离职 + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "登录失败,用户不存在或已离职!"); + return ReturnMapUtil.getReturnMap(); + } + // 密码校验 + sPwd = DES.decrypt(sPwd); + sPwd = MD5Util.getMD5EncodedPassword(sPwd); + switch (sKeyType) { + case "common": + if (!sPwd.equalsIgnoreCase(userMap.get("PASSWORD".toLowerCase()) + .toString())) { + // 普通密码不正确 + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "登录失败,用户名或密码错误,请重新登录!"); + return ReturnMapUtil.getReturnMap(); + } + break; + + case "hand": + if (!sPwd.equalsIgnoreCase(userMap.get( + "GESTURE_PASSWORD".toLowerCase()).toString())) { + // 手势密码不正确 + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "登录失败,用户名或密码错误,请重新登录!"); + return ReturnMapUtil.getReturnMap(); + } + break; + } + + try { + // 登录前操作 + userLoginBefreBusiness(tx, userMap.get("USERID".toLowerCase()) + .toString()); + // 打印异常日志 继续操作 + userLoginBusiness(request, tx, userMap.get("USERID".toLowerCase()) + .toString(), sDevId, sDevOs); + // 登录后操作 + userLoginAfter(tx, userMap.get("USERID".toLowerCase()).toString(), + sDevId, sDevOs, sDevRegId, ReturnMapUtil); + } catch (JBOException e) { + try { + tx.rollback(); + } catch (JBOException e1) { + ARE.getLog().error(e1); + } + ARE.getLog().error(e); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "用户登录失败,请重新登录!"); + return ReturnMapUtil.getReturnMap(); + } + + Map body = new HashMap(); + + // menu + // List> list = new ArrayList>(); + // try { + // BizObjectManager bom = JBOFactory + // .getBizObjectManager(APP_MENU_INFO.CLASS_NAME); + // BizObjectQuery boq = bom + // .createQuery("SELECT O.MENUID, O.MENUNAME, O.DISPLAYNAME, O.SORTNO, O.CODE FROM O,jbo.sys.USER_INFO UI, jbo.awe.AWE_ROLE_MENU ARM, jbo.awe.USER_ROLE UR WHERE ARM.MENUID = O.MENUID AND ARM.ROLEID = UR.ROLEID AND UR.USERID=UI.USERID AND UI.LOGINID=:LOGINID ORDER BY O.SORTNO ASC"); + // @SuppressWarnings("unchecked") + // List bos = boq.setParameter("LOGINID", + // userMap.get("LOGINID".toLowerCase()).toString()).getResultList(false); + // BizObjectUtil util = new BizObjectUtil(); + // for (BizObject bo : bos) { + // list.add(util.bizObject2MapValue3(bo)); + // } + // } catch (JBOException e) { + // // TODO Auto-generated catch block + // e.printStackTrace(); + // } + // body.put("MenuDatas", list); + body.put("flowDesc", queryFlowInfo(tx)); +// body.put("phaseType", queryPhaseType(tx)); + body.put("loginid", userMap.get("LOGINID".toLowerCase())); + body.put("devid", userMap.get("DEV_ID".toLowerCase())); + body.put("devos", userMap.get("DEV_OS".toLowerCase())); + body.put("dev_reg_id", userMap.get("DEV_REG_ID".toLowerCase())); + body.put("userid", userMap.get("USERID".toLowerCase())); + body.put("username", userMap.get("USERNAME".toLowerCase())); + body.put("user_status_code", userMap.get("STATUS".toLowerCase())); + body.put("enable_guesture_code", + userMap.get("ENABLE_GESTURE".toLowerCase())); + Org o = new Org(userMap.get("BELONGORG".toLowerCase()) == null ? "" + : userMap.get("BELONGORG".toLowerCase()).toString()); + body.put("orgid", o.getOrgId()); + body.put("orgname", o.getOrgName()); + String sMsg = ""; + GregorianCalendar ca = new GregorianCalendar(); + if (ca.get(GregorianCalendar.AM_PM) > 0) { + sMsg = "下午好, "; + } else { + sMsg = "上午好, "; + } + sMsg += userMap.get("USERNAME".toLowerCase()) + "!"; + ReturnMapUtil.setReturnMap(body, (String) RestfullConstant.baseProperty + .get("SUCCESS".toLowerCase()), sMsg); + return ReturnMapUtil.getReturnMap(); + } + + public static void main(String args[]) { + GregorianCalendar ca = new GregorianCalendar(); + System.out.println(ca.get(GregorianCalendar.AM_PM)); + } + + private void userLoginAfter(JBOTransaction tx, String sUserId, + String sDevId, String sDevOs, String sDevRegId, + ReturnMapUtil ReturnMapUtil) throws JBOException { + Map map = new HashMap(); + map.put("DEV_ID", sDevId); + map.put("DEV_OS", sDevOs); + map.put("DEV_REG_ID", sDevRegId); + UserHelper.edit(tx, sUserId, map); + } + + private void userLoginBusiness(HttpServletRequest request, + JBOTransaction tx, String sUserId, String sDevId, String sDevOs) + throws JBOException { + // 保存token + + long sExpire = ExpireTool.getExpireTime(); + String curDate = DateUtil.getSystemTimeByFormat("yyyy/MM/dd HH:mm:ss"); + String sToken = getMD5Hex(UUID.randomUUID().toString().getBytes()); + Map map = new HashMap(); + map.put("TOKEN", sToken); + map.put("USER_ID", sUserId); + map.put("DEV_ID", sDevId); + map.put("DEV_OS", sDevOs); + map.put("CREATED", curDate); + map.put("EXPIRE_IN", sExpire); + SessionHelper.save(tx, map); + // 记录session + request.getSession().setAttribute( + (String) RestfullConstant.sessionProperty.get("USERID" + .toLowerCase()), sUserId); + request.getSession().setAttribute( + (String) RestfullConstant.sessionProperty.get("TOKEN" + .toLowerCase()), sToken); + request.getSession().setAttribute( + (String) RestfullConstant.sessionProperty.get("EXPIRE" + .toLowerCase()), sExpire); + request.getSession().setAttribute( + (String) RestfullConstant.sessionProperty.get("DEVID" + .toLowerCase()), sDevId); + request.getSession().setAttribute( + (String) RestfullConstant.sessionProperty.get("DEVOS" + .toLowerCase()), sDevOs); + } + + @SuppressWarnings("unchecked") + public List> queryPhaseType(JBOTransaction tx) + throws JBOException { + BizObjectManager bom = JBOFactory + .getBizObjectManager(FLOW_MODEL.CLASS_NAME); + List bos = bom.createQuery( + "SELECT DISTINCT PHASETYPE from o").getResultList(false); + List> list = new ArrayList>(); + for (BizObject bo : bos) { + if (null == bo) + continue; + Map phaseTypeInfo = new HashMap(); + phaseTypeInfo.put("phaseType", bo.getAttribute("PHASETYPE") + .getValue()); + list.add(phaseTypeInfo); + } + return list; + } + + @SuppressWarnings("unchecked") + public List> queryFlowInfo(JBOTransaction tx) + throws JBOException { + BizObjectManager bom = JBOFactory + .getBizObjectManager(PRD_NODEINFO_CATALOG_APP.CLASS_NAME); + List bos = bom + .createQuery( + "SELECT DISTINCT FLOW_CATALOG.FLOWNO, FLOW_CATALOG.FLOWNAME from o, " + + FLOW_CATALOG.CLASS_NAME + + " FLOW_CATALOG WHERE O.FLOWNO=FLOW_CATALOG.FLOWNO AND O.ENABLE_OPERATION='Y'") + .getResultList(false); + List> list = new ArrayList>(); + for (BizObject bo : bos) { + if (null == bo) + continue; + Map flowInfo = new HashMap(); + flowInfo.put("flowNo", bo.getAttribute("FLOWNO").getValue()); + flowInfo.put("flowName", bo.getAttribute("FLOWNAME").getValue()); + list.add(flowInfo); + } + return list; + } + + private void userLoginBefreBusiness(JBOTransaction tx, String sUserId) + throws JBOException { + // 强踢已登录设备同ID用户下线 + // SessionHelper.removerByUserId(tx, sUserId); + } + + private String getMD5Hex(byte[] buf) { + MessageDigest md5; + try { + md5 = MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + // logger.error(e); + throw new RuntimeException(e); + } + md5.update(buf); + byte[] tmp = md5.digest(); + StringBuilder sb = new StringBuilder(); + for (byte b : tmp) { + sb.append(Integer.toHexString(b & 0xff)); + } + return sb.toString().toUpperCase(); + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/user/logon/service/impl/AppUserLogoutServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/user/logon/service/impl/AppUserLogoutServiceImpl.java new file mode 100644 index 000000000..902f68761 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/user/logon/service/impl/AppUserLogoutServiceImpl.java @@ -0,0 +1,36 @@ +package apx.com.amarsoft.als.user.logon.service.impl; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.user.logon.service.AppUserLogoutService; + +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.helper.SessionHelper; +import com.base.util.ReturnMapUtil; + +public class AppUserLogoutServiceImpl implements AppUserLogoutService { +// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + public Map logout(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) { + String sUserId = (String) request.getSession().getAttribute((String) RestfullConstant.sessionProperty + .get("USERID".toLowerCase())); + try { + SessionHelper.removerByUserId(tx, sUserId); + } catch (JBOException e) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "用户注销失败!"); + return ReturnMapUtil.getReturnMap(); + } + request.getSession().invalidate(); + ReturnMapUtil.setReturnMap(null, (String) RestfullConstant.baseProperty + .get("SUCCESS".toLowerCase()), "用户注销成功!"); + return ReturnMapUtil.getReturnMap(); + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/user/pwd/controller/AppUserPwdController.java b/src_app_fresh/apx/com/amarsoft/als/user/pwd/controller/AppUserPwdController.java new file mode 100644 index 000000000..69785f91d --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/user/pwd/controller/AppUserPwdController.java @@ -0,0 +1,72 @@ +package apx.com.amarsoft.als.user.pwd.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.user.pwd.service.GesturePwdService; +import apx.com.amarsoft.als.user.pwd.service.impl.GesturePwdServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +@Path("/user/center/manager") +public class AppUserPwdController { + GesturePwdService gesturePwdService = new GesturePwdServiceImpl(); + + @Path("/setup/gesture") + @GET + public Map setupGesture( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + try { + ARE.getLog().info( + "[CONTROLLER] AppUserPwdController run ................."); + ARE.getLog() + .info("[Path] /user/center/manager/setup/gesture run ................."); + return gesturePwdService.setupGesture(request, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + @Path("/close/gesture") + @GET + public Map closeGesture( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + try { + ARE.getLog().info( + "[CONTROLLER] AppUserPwdController run ................."); + ARE.getLog() + .info("[Path] /user/center/manager/close/gesture run ................."); + return gesturePwdService.closeGesture(request, tx, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + @Path("/acquisition/gesture") + @GET + public Map acquisitionGesture( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + try { + ARE.getLog().info( + "[CONTROLLER] AppUserPwdController run ................."); + ARE.getLog() + .info("[Path] /user/center/manager/acquisition/gesture run ................."); + return gesturePwdService.acquisitionGesture(request, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/user/pwd/service/GesturePwdService.java b/src_app_fresh/apx/com/amarsoft/als/user/pwd/service/GesturePwdService.java new file mode 100644 index 000000000..c11fb4678 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/user/pwd/service/GesturePwdService.java @@ -0,0 +1,20 @@ +package apx.com.amarsoft.als.user.pwd.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.base.util.ReturnMapUtil; + +public interface GesturePwdService { + Map setupGesture(@Context HttpServletRequest request, + @Context JBOTransaction tx, ReturnMapUtil ReturnMapUtil); + + Map closeGesture(@Context HttpServletRequest request, + @Context JBOTransaction tx, ReturnMapUtil ReturnMapUtil); + + Map acquisitionGesture(@Context HttpServletRequest request, + ReturnMapUtil ReturnMapUtil); +} diff --git a/src_app_fresh/apx/com/amarsoft/als/user/pwd/service/impl/GesturePwdServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/user/pwd/service/impl/GesturePwdServiceImpl.java new file mode 100644 index 000000000..7571930cd --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/user/pwd/service/impl/GesturePwdServiceImpl.java @@ -0,0 +1,104 @@ +package apx.com.amarsoft.als.user.pwd.service.impl; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.user.pwd.service.GesturePwdService; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOTransaction; +import com.base.constant.RestfullConstant; +import com.base.helper.UserHelper; +import com.base.util.DES; +import com.base.util.MD5Util; +import com.base.util.ReturnMapUtil; + +public class GesturePwdServiceImpl implements GesturePwdService { + // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + public Map setupGesture(HttpServletRequest request, + JBOTransaction tx, ReturnMapUtil ReturnMapUtil) { + String sUserId = request.getParameter("userid"); + sUserId = sUserId == null ? request.getSession().getAttribute("userid") == null ? null + : request.getSession().getAttribute("userid").toString() + : sUserId; + String sPwd = request.getParameter("pwd"); + if (null == sPwd) + sPwd = ""; + DES.decrypt(sPwd); + sPwd = MD5Util.getMD5EncodedPassword(sPwd); + Map map = new HashMap(); + map.put("ENABLE_GESTURE", "1"); + map.put("GESTURE_PASSWORD", sPwd); + try { + UserHelper.edit(tx, sUserId, map); + } catch (JBOException e) { + ARE.getLog().error(e); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "设置手钥密码数据操作失败!"); + return ReturnMapUtil.getReturnMap(); + } + ReturnMapUtil.setReturnMap(null, (String) RestfullConstant.baseProperty + .get("SUCCESS".toLowerCase()), "成功设置或重设手钥密码!"); + return ReturnMapUtil.getReturnMap(); + } + + public Map closeGesture(HttpServletRequest request, + JBOTransaction tx, ReturnMapUtil ReturnMapUtil) { + // NO CHECK URI + String sUserId = request.getParameter("userid"); + sUserId = sUserId == null ? request.getSession().getAttribute("userid") == null ? null + : request.getSession().getAttribute("userid").toString() + : sUserId; + if (null == sUserId) + sUserId = ""; + Map map = new HashMap(); + map.put("ENABLE_GESTURE", ""); + map.put("GESTURE_PASSWORD", ""); + try { + UserHelper.edit(tx, sUserId, map); + } catch (JBOException e) { + ARE.getLog().error(e); + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "关闭手钥密码数据操作失败!"); + return ReturnMapUtil.getReturnMap(); + } + ReturnMapUtil.setReturnMap(null, (String) RestfullConstant.baseProperty + .get("SUCCESS".toLowerCase()), "成功关闭手钥密码!"); + return ReturnMapUtil.getReturnMap(); + } + + public Map acquisitionGesture(HttpServletRequest request, + ReturnMapUtil ReturnMapUtil) { + + // NO CHECK URI + String sUserId = request.getParameter("userid"); + sUserId = sUserId == null ? request.getSession().getAttribute("userid") == null ? null + : request.getSession().getAttribute("userid").toString() + : sUserId; + if (null == sUserId) + sUserId = ""; + Map userMap = UserHelper.getUser(sUserId); + if (userMap == null) { + ReturnMapUtil.setReturnMap(null, + (String) RestfullConstant.baseProperty.get("FAIL" + .toLowerCase()), "没用找到该用户!"); + return ReturnMapUtil.getReturnMap(); + } + Map body = new HashMap(); + body.put("loginid", userMap.get("loginid")); + body.put("username", userMap.get("username")); + body.put("userid", userMap.get("userid")); + String sEnable = (String) userMap.get("ENABLE_GESTURE".toLowerCase()); + + body.put("enablegesture", sEnable); + body.put("enableGestureName", "1".equals(sEnable) ? "开启" : "关闭"); + ReturnMapUtil.setReturnMap(body, (String) RestfullConstant.baseProperty + .get("SUCCESS".toLowerCase()), ""); + return ReturnMapUtil.getReturnMap(); + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/user/sys/controller/VersionController.java b/src_app_fresh/apx/com/amarsoft/als/user/sys/controller/VersionController.java new file mode 100644 index 000000000..88f11004b --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/user/sys/controller/VersionController.java @@ -0,0 +1,38 @@ +package apx.com.amarsoft.als.user.sys.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.user.sys.service.VersionService; +import apx.com.amarsoft.als.user.sys.service.impl.VersionServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +@Path("/user/center/manager") +public class VersionController { + VersionService versionService = new VersionServiceImpl(); + + @Path("/detection/version") + @GET + public Map detectionVersion( + @Context HttpServletRequest request, @Context Transaction sqlca, + @Context JBOTransaction tx) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + try { + ARE.getLog().info( + "[CONTROLLER] VersionController run ................."); + ARE.getLog() + .info("[Path] /user/center/manager/detection/version run ................."); + return versionService.detectionVersion(request, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/user/sys/service/VersionService.java b/src_app_fresh/apx/com/amarsoft/als/user/sys/service/VersionService.java new file mode 100644 index 000000000..593304677 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/user/sys/service/VersionService.java @@ -0,0 +1,18 @@ +package apx.com.amarsoft.als.user.sys.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import com.base.util.ReturnMapUtil; + +public interface VersionService { + /** + * 描述: 检测版本是否最新版本 返回给APP端 + * @param request + * @return + */ + Map detectionVersion(@Context HttpServletRequest request, + ReturnMapUtil ReturnMapUtil); +} diff --git a/src_app_fresh/apx/com/amarsoft/als/user/sys/service/impl/VersionServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/user/sys/service/impl/VersionServiceImpl.java new file mode 100644 index 000000000..48e721076 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/user/sys/service/impl/VersionServiceImpl.java @@ -0,0 +1,79 @@ +package apx.com.amarsoft.als.user.sys.service.impl; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.user.sys.service.VersionService; + +import com.base.constant.RestfullConstant; +import com.base.helper.AppHelper; +import com.base.util.ReturnMapUtil; + +public class VersionServiceImpl implements VersionService { + // ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); + public Map detectionVersion(HttpServletRequest request, + ReturnMapUtil ReturnMapUtil) { + + String sDevOs = request.getParameter("devos"); + +// String userAgent = request.getHeader("user-agent"); +// if (null != userAgent) { +// if (userAgent.toLowerCase().indexOf("ios") >= 0) { +// sDevOs = "ios"; +// } else { +// sDevOs = "android"; +// } +// } + + String sVersionCode = request.getParameter("versioncode"); + if (null == sDevOs) + sDevOs = ""; + if (null == sVersionCode) + sVersionCode = ""; + Map versionMap = AppHelper + .getNewVersionByPhoneType(sDevOs); + Map body = new HashMap(); + Map constant = new HashMap(); + if (null == versionMap) { + // 没有数据 当前最新版本 + body.put("upgradecode", "0"); + body.put("upgradedesc", "未找到升级版本或当前用户APP已是最新版本!"); + } else { + if (sVersionCode + .equals(versionMap.get("VERSION_CODE".toLowerCase()))) { + // 当前意见最新版本 + // 没有数据 当前最新版本 + body.put("upgradecode", "0"); + body.put("upgradedesc", "未找到升级版本或当前用户APP已是最新版本!"); + } else { + // 有新版本发布 + if ("Y".equals(versionMap.get("MUST_UPDATE".toLowerCase()))) { + // 强制更新 + body.put("upgradecode", "1"); + body.put("upgradedesc", "当前有更新版本,需要用户强制更新!"); + } else { + // 选择更新 + body.put("upgradecode", "2"); + body.put("upgradedesc", "当前有更新的版本!"); + } + constant.put("versioncode", + versionMap.get("VERSION_CODE".toLowerCase())); + constant.put("versionname", + versionMap.get("VERSION_NAME".toLowerCase())); + constant.put("mustupdate", + versionMap.get("MUST_UPDATE".toLowerCase())); + constant.put("path", "api/files/downloadFile?path=/wordFiles/" + + versionMap.get("IMAGE_PATH".toLowerCase())); + constant.put("filename", + versionMap.get("FILE_NAME".toLowerCase())); + } + } + body.put("versionconstant", constant); + ReturnMapUtil.setReturnMap(body, (String) RestfullConstant.baseProperty + .get("SUCCESS".toLowerCase()), ""); + return ReturnMapUtil.getReturnMap(); + } + +} diff --git a/src_app_fresh/cn/access/authority/AnnotationRestfullDispatcherImpl.java b/src_app_fresh/cn/access/authority/AnnotationRestfullDispatcherImpl.java new file mode 100644 index 000000000..2e3ef6564 --- /dev/null +++ b/src_app_fresh/cn/access/authority/AnnotationRestfullDispatcherImpl.java @@ -0,0 +1,352 @@ +package cn.access.authority; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.annotation.Annotation; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.text.MessageFormat; +import java.util.Map; +import java.util.Set; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.HttpMethod; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.base.model.RspObject; +import cn.access.dispatcher.RestfullDispatcher; +import cn.bean.Org; +import cn.bean.User; +import cn.config.container.RequestContext; +import cn.config.mapping.URIMappingCache; +import cn.config.mapping.URIMappingKey; +import cn.config.mapping.URIMappingValue; +import cn.config.model.GlobalConfigure; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.log.Log; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.helper.SessionHelper; +import com.base.helper.UserHelper; +import com.base.tool.URIMappingTool; +import com.base.util.RequestUtil; +import com.google.common.collect.Sets; + +/** + * Restfull分发器实现类 + * + * @author yangsong + * @date 2015年3月29日 + */ +public class AnnotationRestfullDispatcherImpl implements RestfullDispatcher { + + protected Log logger = ARE.getLog(); + private Long sExpire; + + /** + * 自动扫描路径设置 + */ + public void init(ServletContext servletContext) { + URIMappingTool.scanPackageAndInitResfSetting(servletContext + .getInitParameter("RestfullScanPackage")); + } + + public void doPost(HttpServletRequest req, HttpServletResponse rep) + throws ServletException, IOException { + doProcess(req, rep, HttpMethod.POST); + } + + public void doDelete(HttpServletRequest req, HttpServletResponse rep) + throws ServletException, IOException { + doProcess(req, rep, HttpMethod.DELETE); + + } + + public void doPut(HttpServletRequest req, HttpServletResponse rep) + throws ServletException, IOException { + doProcess(req, rep, HttpMethod.PUT); + + } + + public void doGet(HttpServletRequest req, HttpServletResponse rep) + throws ServletException, IOException { + doProcess(req, rep, HttpMethod.GET); + } + + protected void doProcess(HttpServletRequest req, HttpServletResponse rep, + String httpMethod) throws IOException { + RequestContext reqContext = new RequestContext(); + RspObject rsp = null; + PrintWriter out = rep.getWriter(); + try { + setRequestContext(reqContext, req, rep); + rsp = callService(req, httpMethod, reqContext, rsp); + if (reqContext.jboTx != null) + reqContext.jboTx.commit(); + if (reqContext.sqlca != null) + reqContext.sqlca.commit(); + } catch (Throwable e) { + e = ((InvocationTargetException) e).getTargetException(); + logger.error("", e); + if (reqContext.jboTx != null) { + try { + reqContext.jboTx.rollback(); + } catch (JBOException e1) { + logger.error("tx rollback error", e1); + } + } + if (reqContext.sqlca != null) { + try { + reqContext.sqlca.rollback(); + } catch (Exception e1) { + logger.error("sqlca rollback error", e1); + } + } + rsp = RspObject.build(e); + rsp.getHeader().setCode("500"); + if (e.getMessage() != null) { + rsp.getHeader().setMessage(e.getMessage()); + } + } finally { + if (reqContext.sqlca != null) { + try { + reqContext.sqlca.disConnect(); + } catch (Exception e) { + logger.error("sqlca close error", e); + } + } + } + setResonse(rep, rsp, out); + } + + protected void setRequestContext(RequestContext reqContext, + HttpServletRequest req, HttpServletResponse rep) throws Exception { + reqContext.req = req; + reqContext.rep = rep; + reqContext.curUser = lookupUser(req); + reqContext.jboTx = JBOFactory.createJBOTransaction(); + reqContext.sqlca = Transaction + .createTransaction((String) RestfullConstant.baseProperty + .get("DATASOURCE".toLowerCase())); + } + + protected RspObject callService(HttpServletRequest req, + String httpMethod, RequestContext reqContext, RspObject rsp) + throws Exception { + String uri = req.getPathInfo(); + Map parameter = mapParameter(req); + URIMappingKey key = new URIMappingKey(uri, httpMethod); + URIMappingValue value = URIMappingCache.getInstance().get(key); + + if (value == null) { + rsp = RspObject.build(new ServletException(MessageFormat.format( + "{0} {1} not found", key.getHttpMethod(), key.getUri()))); + rsp.getHeader().setCode( + (String) RestfullConstant.baseProperty.get("CODE404" + .toLowerCase())); + } else { + logger.debug(httpMethod + " " + uri + " " + parameter + " " + + value.getClazz().getName()); + Class clazz = value.getClazz(); + Method method = value.getMethod(); + Class returnType = method.getReturnType(); + Object repObject = null; + Object object = clazz.newInstance(); + repObject = invokeMethod(object, method, reqContext); + + // 没有返回值的,repObject直接设置为空 + if (RestfullConstant.baseProperty.get("VOID".toLowerCase()).equals( + returnType.getName())) { + // rsp = null; + rsp = RspObject.build(""); + } else if (repObject == null) { + rsp = RspObject.build(""); + } else if (repObject instanceof RspObject) { + rsp = (RspObject) repObject; + // app 附件下载 + } else if (RestfullConstant.baseProperty + .get("APPATT".toLowerCase()).equals( + returnType.getSimpleName())) { + rsp = null; + } else { + rsp = RspObject.build(repObject); + } + // 修改到期 + sExpire = SessionHelper.edit(reqContext.jboTx, req); + } + + return rsp; + } + + // + protected Object invokeMethod(Object object, Method method, + RequestContext reqContext) throws IllegalAccessException, + IllegalArgumentException, InvocationTargetException { + // 取所有的参数类型以及参数注解,构建传入参数对象数组 + Class[] argTypes = method.getParameterTypes(); + Annotation[][] annotations = method.getParameterAnnotations(); + Object[] argValues = new Object[annotations.length]; + + for (int i = 0; i < annotations.length; i++) { + int length = annotations[i].length; + argValues[i] = null; + String typeName = argTypes[i].getName(); + if (length == 0) {// 如果为0,则表示没有为该参数添加注释 + if (isBaseNumberType(typeName)) { + argValues[i] = (short) 0;// 基础数据类型不能为null,要给个默认值0 + } else { + continue; + } + } + ; + + for (int k = 0; k < length; k++) { + Annotation annotation = annotations[i][k]; + argValues[i] = injectWithAnnotation(object, annotation, + reqContext, typeName); + } + } + // System.out.println("arg:"+Arrays.asList(argValues)); + return method.invoke(object, argValues); + } + + protected boolean isBaseNumberType(String typeName) { + Set numberTypeSet = Sets.newHashSet(); + numberTypeSet.add("byte"); + numberTypeSet.add("short"); + numberTypeSet.add("int"); + numberTypeSet.add("long"); + numberTypeSet.add("float"); + numberTypeSet.add("double"); + return numberTypeSet.contains(typeName); + } + + /** + * 从request中传入的参数始终都是String类型的,需要强制转换为Java方法上相应的方法 + * + * @param value + * @param argType + * @return + */ + protected Object convertArgValue(String value, String argType) { + if ("int".equals(argType)) { + return Integer.valueOf(value); + } else if ("java.lang.Integer".equals(argType)) { + return Integer.valueOf(value); + } else if ("java.lang.Double".equals(argType)) { + return Double.valueOf(value); + } else if ("double".equals(argType)) { + return Double.valueOf(value); + } else if ("java.lang.String".equals(argType)) { + return value; + } + return null; + } + + /** + * 根据注解,放入参数 + * + * @param instance + * @param annotation + * @param req + * @param rep + * @param typeName + * @return + */ + protected Object injectWithAnnotation(Object instance, + Annotation annotation, RequestContext reqContext, String typeName) { + // 从Request中取出参数 + if (annotation instanceof QueryParam) { + QueryParam anoQp = (QueryParam) annotation; + String paraName = anoQp.value(); + String paraValue = reqContext.getReq().getParameter(paraName); + if (paraValue == null) + return null; + return convertArgValue(paraValue, typeName); + } else if (annotation instanceof Context) { + if (" javax.servlet.ServletRequest".equals(typeName)) { + return reqContext.req; + } else if ("javax.servlet.http.HttpServletRequest".equals(typeName)) { + return reqContext.req; + } else if ("javax.servlet.ServletResponse".equals(typeName)) { + return reqContext.rep; + } else if ("javax.servlet.http.HttpServletResponse" + .equals(typeName)) { + return reqContext.rep; + } else if ("com.amarsoft.ams.base.User".equals(typeName)) { // 用户对象 + return reqContext.curUser; + } else if ("com.amarsoft.awe.util.Transaction".equals(typeName)) { // Sqlca对象 + return reqContext.sqlca; + } else if ("com.amarsoft.are.jbo.JBOTransaction".equals(typeName)) { // JBO事务 + return reqContext.jboTx; + } + } + return null; + } + + /** + * 从上下文环境中取当前用户 + * + * @return + */ + protected User lookupUser(HttpServletRequest request) { + + String sUserId = (String) request.getSession().getAttribute( + (String) RestfullConstant.sessionProperty.get("USERID" + .toLowerCase())); + if (sUserId == null || sUserId.length() < 1) + return null; + Map userMap = UserHelper.getUser(sUserId); + if (userMap == null) + return null; + User user = new User(); + user.setUserId(userMap.get("USERID".toLowerCase()) == null ? "" + : userMap.get("USERID".toLowerCase()).toString()); + user.setStatus(userMap.get("STATUS".toLowerCase()) == null ? "" + : userMap.get("STATUS".toLowerCase()).toString()); + user.setUserName(userMap.get("USERNAME".toLowerCase()) == null ? "" + : userMap.get("USERNAME".toLowerCase()).toString()); + Org org = new Org(userMap.get("".toLowerCase()) == null ? "" : userMap + .get("".toLowerCase()).toString()); + user.setOrg(org); + return user; + } + + protected void setResonse(HttpServletResponse rep, RspObject rsp, + PrintWriter out) { + if (rsp != null) { + // 设置响应头 + rep.setHeader("Cache-Control", "no-cache"); + rep.setHeader("Pragma", "no-cache"); + // rep.setDateHeader("Expires", 0); + rep.setDateHeader("Expires", sExpire); + rep.addHeader("Access-Control-Allow-Origin", "*"); + rep.addHeader("Allow", "GET, POST, DELETE, PUT,OPTIONS"); + rep.addHeader("Access-Control-Allow-Methods", + "GET, POST, DELETE, PUT"); + rep.addHeader("Access-Control-Allow-Headers", "Content-Type"); + rep.setContentType("application/json; charset=" + + GlobalConfigure.getInstance().getProperty("encoding")); + String jsonString = JSON.toJSONStringWithDateFormat(rsp, + "yyyy/MM/dd HH:mm:ss.SSS", + SerializerFeature.WriteMapNullValue, + SerializerFeature.PrettyFormat, + SerializerFeature.WriteNonStringKeyAsString, + SerializerFeature.SortField); + out.println(jsonString); + } + } + + protected Map mapParameter(HttpServletRequest req) { + return RequestUtil.convertRequestToMap(req); + } +} diff --git a/src_app/cn/coyoteam/aweresf/web/restfull/RestfullDispatcher.java b/src_app_fresh/cn/access/dispatcher/RestfullDispatcher.java similarity index 96% rename from src_app/cn/coyoteam/aweresf/web/restfull/RestfullDispatcher.java rename to src_app_fresh/cn/access/dispatcher/RestfullDispatcher.java index 0016987cf..aefb9b0a6 100644 --- a/src_app/cn/coyoteam/aweresf/web/restfull/RestfullDispatcher.java +++ b/src_app_fresh/cn/access/dispatcher/RestfullDispatcher.java @@ -1,4 +1,4 @@ -package cn.coyoteam.aweresf.web.restfull; +package cn.access.dispatcher; import java.io.IOException; diff --git a/src_app/cn/coyoteam/aweresf/model/Org.java b/src_app_fresh/cn/bean/Org.java similarity index 98% rename from src_app/cn/coyoteam/aweresf/model/Org.java rename to src_app_fresh/cn/bean/Org.java index beabbb421..2d089dd2d 100644 --- a/src_app/cn/coyoteam/aweresf/model/Org.java +++ b/src_app_fresh/cn/bean/Org.java @@ -1,4 +1,4 @@ -package cn.coyoteam.aweresf.model; +package cn.bean; import java.io.Serializable; diff --git a/src_app/cn/coyoteam/aweresf/model/User.java b/src_app_fresh/cn/bean/User.java similarity index 97% rename from src_app/cn/coyoteam/aweresf/model/User.java rename to src_app_fresh/cn/bean/User.java index 9f1334207..fb797580f 100644 --- a/src_app/cn/coyoteam/aweresf/model/User.java +++ b/src_app_fresh/cn/bean/User.java @@ -1,4 +1,4 @@ -package cn.coyoteam.aweresf.model; +package cn.bean; import java.io.Serializable; diff --git a/src_app/cn/coyoteam/aweresf/web/als/RequestContext.java b/src_app_fresh/cn/config/container/RequestContext.java similarity index 93% rename from src_app/cn/coyoteam/aweresf/web/als/RequestContext.java rename to src_app_fresh/cn/config/container/RequestContext.java index 028a02d09..cf22d40ca 100644 --- a/src_app/cn/coyoteam/aweresf/web/als/RequestContext.java +++ b/src_app_fresh/cn/config/container/RequestContext.java @@ -1,9 +1,9 @@ -package cn.coyoteam.aweresf.web.als; +package cn.config.container; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import cn.coyoteam.aweresf.model.User; +import cn.bean.User; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.awe.util.Transaction; diff --git a/src_app/cn/coyoteam/aweresf/web/restfull/impl/URIMappingCache.java b/src_app_fresh/cn/config/mapping/URIMappingCache.java similarity index 97% rename from src_app/cn/coyoteam/aweresf/web/restfull/impl/URIMappingCache.java rename to src_app_fresh/cn/config/mapping/URIMappingCache.java index 95d33a198..71cbb6dff 100644 --- a/src_app/cn/coyoteam/aweresf/web/restfull/impl/URIMappingCache.java +++ b/src_app_fresh/cn/config/mapping/URIMappingCache.java @@ -1,4 +1,4 @@ -package cn.coyoteam.aweresf.web.restfull.impl; +package cn.config.mapping; import java.util.ArrayList; import java.util.Comparator; @@ -13,7 +13,7 @@ import java.util.TreeMap; */ public class URIMappingCache { private static URIMappingCache instance = null; - + private Map mappingStore = new TreeMap(new Comparator() { public int compare(URIMappingKey o1, URIMappingKey o2) { if (o1 == null && o2 == null) return 0; diff --git a/src_app/cn/coyoteam/aweresf/web/restfull/impl/URIMappingKey.java b/src_app_fresh/cn/config/mapping/URIMappingKey.java similarity index 96% rename from src_app/cn/coyoteam/aweresf/web/restfull/impl/URIMappingKey.java rename to src_app_fresh/cn/config/mapping/URIMappingKey.java index e9c2352ea..688041d25 100644 --- a/src_app/cn/coyoteam/aweresf/web/restfull/impl/URIMappingKey.java +++ b/src_app_fresh/cn/config/mapping/URIMappingKey.java @@ -1,4 +1,4 @@ -package cn.coyoteam.aweresf.web.restfull.impl; +package cn.config.mapping; import java.io.Serializable; diff --git a/src_app/cn/coyoteam/aweresf/web/restfull/impl/URIMappingValue.java b/src_app_fresh/cn/config/mapping/URIMappingValue.java similarity index 93% rename from src_app/cn/coyoteam/aweresf/web/restfull/impl/URIMappingValue.java rename to src_app_fresh/cn/config/mapping/URIMappingValue.java index 06d5f4af0..5932d083e 100644 --- a/src_app/cn/coyoteam/aweresf/web/restfull/impl/URIMappingValue.java +++ b/src_app_fresh/cn/config/mapping/URIMappingValue.java @@ -1,4 +1,4 @@ -package cn.coyoteam.aweresf.web.restfull.impl; +package cn.config.mapping; import java.io.Serializable; import java.lang.reflect.Method; diff --git a/src_app/cn/coyoteam/aweresf/configure/GlobalConfigure.java b/src_app_fresh/cn/config/model/GlobalConfigure.java similarity index 91% rename from src_app/cn/coyoteam/aweresf/configure/GlobalConfigure.java rename to src_app_fresh/cn/config/model/GlobalConfigure.java index 45ac64a6d..4ac74efe1 100644 --- a/src_app/cn/coyoteam/aweresf/configure/GlobalConfigure.java +++ b/src_app_fresh/cn/config/model/GlobalConfigure.java @@ -1,4 +1,4 @@ -package cn.coyoteam.aweresf.configure; +package cn.config.model; import java.util.Properties; diff --git a/src_app_fresh/cn/filter/SessionAndContextFilter.java b/src_app_fresh/cn/filter/SessionAndContextFilter.java new file mode 100644 index 000000000..388a71257 --- /dev/null +++ b/src_app_fresh/cn/filter/SessionAndContextFilter.java @@ -0,0 +1,158 @@ +package cn.filter; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import apx.com.amarsoft.als.base.model.RspObject; +import cn.config.model.GlobalConfigure; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.amarsoft.are.ARE; +import com.base.constant.RestfullConstant; +import com.base.helper.SessionHelper; +import com.base.tool.PkgsTool; + +/** + * 对JSP页面webapi进行改造想学适配的过滤器 + * + * @author EX-YANGSONG001 + * + */ +public class SessionAndContextFilter implements Filter { + private Set noCheckURI = new HashSet(); + + private String encoding; + + public SessionAndContextFilter() { + } + + public void destroy() { + } + + /** + * 加载免过滤接口地址 记载有效期时间 加载编码 + * + */ + public void init(FilterConfig filterConfig) throws ServletException { + // 免过滤 + String sCheckURL = filterConfig + .getInitParameter("NoCheckURI"); + // 有效时间 + String cfgTokenHoldTime = filterConfig + .getInitParameter("TokenHoldTime"); + // 编码 + String cfgEncoding = filterConfig + .getInitParameter("encoding"); + + if (null == sCheckURL) sCheckURL = ""; + if (null == cfgTokenHoldTime) cfgTokenHoldTime = ""; + if (null == cfgEncoding) cfgEncoding = ""; + + initNoCheckURI(sCheckURL); + + if (cfgTokenHoldTime != null && cfgTokenHoldTime.matches("-?\\d+")) { + GlobalConfigure.getInstance().setProperty("TokenHoldTime".toLowerCase(), cfgTokenHoldTime); + GlobalConfigure.getInstance().setProperty("TokenHoldTime".toUpperCase(), cfgTokenHoldTime); + GlobalConfigure.getInstance().setProperty("TokenHoldTime", cfgTokenHoldTime); + } + if (cfgEncoding != null) { + this.encoding = cfgEncoding; + } + GlobalConfigure.getInstance().setProperty("encoding", this.encoding); + } + + /** + * 过滤接口 规则: 免过滤 / 过滤 过滤: 用户ID 和 TOKEN 以及有效期时间 比较 判断 访问权限 非过滤:无需判断 + * 直接开启绿色通道访问接口 返回 code 406 无效访问权限 + */ + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletRequest req = (HttpServletRequest) request; + HttpServletResponse rep = (HttpServletResponse) response; + setCharacterEncoding(req, rep); + + request.setAttribute((String) RestfullConstant.sessionProperty + .get("WEBAPI".toLowerCase()), true); + request.setAttribute((String) RestfullConstant.sessionProperty + .get("REQURI".toLowerCase()), req.getRequestURI()); + + // 如果已经登录过了,会话中会存在RuntimeContext对象,直接使用就好了 + // 主要用于在在状态的web模式下,也可以使用restfull接口 + // 放行URI,直接通过 + String uri = req.getRequestURI().substring( + (req.getContextPath() + "/webapi").length());// req.getPathInfo(); + if (!noCheckURI.contains(uri)) { + List> sesionList = SessionHelper + .getSessionTokenBySession(req); + if (sesionList == null || sesionList.size() < 1) { + req.getSession().invalidate(); + RspObject rspObject = RspObject.buildError( + (String) RestfullConstant.baseProperty.get("CODE406" + .toLowerCase()), + (String) RestfullConstant.baseProperty.get("MSG406" + .toLowerCase())); + outputRspObject(rspObject, req, rep); + return; + } + } + ARE.getLog().debug("URI:[" + uri + "]"); + chain.doFilter(request, response); + } + + protected void setCharacterEncoding(HttpServletRequest req, + HttpServletResponse rep) throws UnsupportedEncodingException { + if (this.encoding == null) + this.encoding = (String) RestfullConstant.baseProperty + .get("DATAENCODING".toLowerCase()); + req.setCharacterEncoding(this.encoding); + if ("true".equalsIgnoreCase((String) RestfullConstant.baseProperty.get("FORCEENCODING" + .toLowerCase()))) + rep.setCharacterEncoding(this.encoding); + } + + private void outputRspObject(RspObject rspObject, + HttpServletRequest req, HttpServletResponse rep) { + rep.setHeader("Cache-Control", "no-cache"); + rep.setHeader("Pragma", "no-cache"); + rep.setDateHeader("Expires", 0); + rep.addHeader("Access-Control-Allow-Origin", "*"); + rep.addHeader("Allow", "GET, POST, DELETE, PUT,OPTIONS"); + rep.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + rep.addHeader("Access-Control-Allow-Headers", "Content-Type"); + rep.setContentType("application/json; charset=" + + (String) RestfullConstant.baseProperty.get("DATAENCODING" + .toLowerCase())); + + String jsonString = JSON.toJSONStringWithDateFormat(rspObject, + "yyyy/MM/dd HH:mm:ss.SSS", SerializerFeature.WriteMapNullValue, + SerializerFeature.PrettyFormat, + SerializerFeature.WriteNonStringKeyAsString, + SerializerFeature.SortField); + try { + rep.getWriter().println(jsonString); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void initNoCheckURI(String sPkgs) { + String[] aPakgs = PkgsTool.parsePkgs(sPkgs); + for (String sPakg : aPakgs) { + noCheckURI.add(sPakg); + } + } +} diff --git a/src_app/cn/coyoteam/aweresf/web/servlet/RestfullServiceServlet.java b/src_app_fresh/cn/servlet/RestfullServiceServlet.java similarity index 79% rename from src_app/cn/coyoteam/aweresf/web/servlet/RestfullServiceServlet.java rename to src_app_fresh/cn/servlet/RestfullServiceServlet.java index 2c087c3bf..2d411cc4e 100644 --- a/src_app/cn/coyoteam/aweresf/web/servlet/RestfullServiceServlet.java +++ b/src_app_fresh/cn/servlet/RestfullServiceServlet.java @@ -1,4 +1,4 @@ -package cn.coyoteam.aweresf.web.servlet; +package cn.servlet; import java.io.IOException; @@ -10,8 +10,8 @@ import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import cn.coyoteam.aweresf.web.restfull.RestfullDispatcher; -import cn.coyoteam.aweresf.web.restfull.impl.AnnotationRestfullDispatcherImpl; +import cn.access.authority.AnnotationRestfullDispatcherImpl; +import cn.access.dispatcher.RestfullDispatcher; /** @@ -33,15 +33,6 @@ public class RestfullServiceServlet extends HttpServlet{ dispatcher.init(getServletContext()); } - - -// protected void service(HttpServletRequest req, HttpServletResponse rep) -// throws ServletException, IOException { -// super.service(req, rep); -// String method = req.getParameter("_method"); -// } - - //=============================== //POST,DELETE,PUT,GET四个基础方法 //=============================== diff --git a/src_app_fresh/com/base/constant/RestfullConstant.java b/src_app_fresh/com/base/constant/RestfullConstant.java new file mode 100644 index 000000000..de4c75b23 --- /dev/null +++ b/src_app_fresh/com/base/constant/RestfullConstant.java @@ -0,0 +1,239 @@ +package com.base.constant; + +import java.io.FileInputStream; +import java.net.URL; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; + +import com.amarsoft.are.ARE; +import com.amarsoft.awe.Configure; + +public class RestfullConstant { + + /** + * KEY OF SESSION ================== parameter ============================ + * PROPERTY_KEY_USER_ID. 用户ID PROPERTY_KEY_TOKEN. 访问令牌 PROPERTY_KEY_DEV_ID. + * 手机设备ID PROPERTY_KEY_DEV_OS. 手机设备类型 EY_EXPIRE. 到期时间 PROPERTY_KEY_WEB_API. + * 接口服务是否开启 . PROPERTY_KEY_REQ_URI. 请求访问路径. + */ + public static final String PROPERTY_KEY_USER_ID = "base.session.check.user.id"; + public static final String PROPERTY_KEY_TOKEN = "base.session.check.token"; + public static final String PROPERTY_KEY_DEV_ID = "base.session.check.dev.id"; + public static final String PROPERTY_KEY_DEV_OS = "base.session.check.dev.os"; + public static final String PROPERTY_KEY_EXPIRE = "base.session.check.expire"; + + public static final String PROPERTY_KEY_WEB_API = "base.session.web.api.page"; + public static final String PROPERTY_KEY_REQ_URI = "base.session.req.uri"; + + /** + * KEY OF BASE ================== parameter ============================ + * PROPERTY_KEY_TOKEN_HOLD_TIME. 令牌有效期 5分钟 PROPERTY_KEY_ENDCODING. 编码 + * encoding PROPERTY_KEY_NO_FILETER. 免过滤请求路径 PROPERTY_KEY_DATA_ENCODING. + * 编码格式 GBK PROPERTY_KEY_FORCE_ENCODING. 返回编码设置 TRUE GBK FALSE 不设置 + * PROPERTY_KEY_DATA_SOURCE. 数据来源 als PROPERTY_KEY_SERVICE_RETURN_TYPE_VOID. + * 接口返回类型 void. PROPERTY_KEY_SERVICE_RETURN_TYPE_APPATT. 接口返回类型 APP附件. + * + * PROPERTY_KEY_CODE_500. 异常返回 CODE PROPERTY_KEY_MSG_500. 异常返回信息 + * PROPERTY_KEY_CODE_404. 接口不存在CODE PROPERTY_KEY_CODE_406. 令牌失效 CODE + * PROPERTY_KEY_MSG_406. 令牌失效信息 PROPERTY_KEY_RESULT_SUCCESS_CODE. 返回成功 CODE + * PROPERTY_KEY_RESULT_FAIL_CODE. 返回失败CODE + * + * 推送功能 配置 (小米jar) PROPERTY_KEY_PUSH_ENABLE. 推送是否开启 + * PROPERTY_KEY_PUSH_SECRET_IOS. IOS推送秘钥 PROPERTY_KEY_PUSH_SECRET_ANDROID. + * 安卓推送秘钥 PROPERTY_KEY_PAGE_NAME. 包名 FAIL_SAVE. 保存失败 FAIL_EDIT. 编辑失败 + * FAIL_DELETE. 删除失败 FAIL_INIT_DISPLAY. 加载页面失败 SUCCESS_SAVE.保存成功 + * SUCCESS_EDIT.编辑成功 SUCCESS_DELETE. 删除成功 SUCCESS_INIT_DISPLAY.加载页面成功 + * DES_SECRET_KEY_ONE. 加密参数1 DES_SECRET_KEY_TWO. 加密参数2 DES_SECRET_KEY_THREE. + * 加密参数3 + */ + public static final String PROPERTY_KEY_TOKEN_HOLD_TIME = "base.param.key.hold.time"; + public static final String PROPERTY_KEY_ENCODING = "base.param.key.encoding"; + public static final String PROPERTY_KEY_NO_FILETER = "base.param.key.no.check.uri"; + public final static String PROPERTY_KEY_DATA_ENCODING = "base.data.encoding"; + public final static String PROPERTY_KEY_FORCE_ENCODING = "base.data.fource.encoding"; + public final static String PROPERTY_KEY_DATA_SOURCE = "base.data.source"; + public final static String PROPERTY_KEY_SERVICE_RETURN_TYPE_VOID = "base.return.type.void"; + public final static String PROPERTY_KEY_SERVICE_RETURN_TYPE_APPATT = "base.return.type.app.att"; + + public final static String PROPERTY_KEY_CODE_500 = "base.return.code.500"; + public final static String PROPERTY_KEY_MSG_500 = "base.return.msg.500"; + public final static String PROPERTY_KEY_CODE_404 = "base.return.code.404"; + public final static String PROPERTY_KEY_CODE_406 = "base.return.code.406"; + public final static String PROPERTY_KEY_MSG_406 = "base.return.msg.406"; + public final static String PROPERTY_KEY_RESULT_SUCCESS_CODE = "base.return.result.success.code"; + public final static String PROPERTY_KEY_RESULT_FAIL_CODE = "base.return.result.fail.code"; + + public final static String PROPERTY_KEY_PUSH_ENABLE = "push.message.switch"; + public final static String PROPERTY_KEY_PUSH_SECRET_IOS = "push.message.secret.key.ios"; + public final static String PROPERTY_KEY_PUSH_SECRET_ANDROID = "push.message.secret.key.android"; + public final static String PROPERTY_KEY_PACKAGE_NAME = "push.message.package.name"; + + public static final String FAIL_SAVE = "base.return.msg.save.fail"; + public static final String FAIL_EDIT = "base.return.msg.edit.fail"; + public static final String FAIL_DELETE = "base.return.msg.del.fail"; + public static final String FAIL_INIT_DISPLAY = "base.return.msg.init.display.fail"; + public static final String SUCCESS_SAVE = "base.return.msg.save.success"; + public static final String SUCCESS_EDIT = "base.return.msg.edit.success"; + public static final String SUCCESS_DELETE = "base.return.msg.del.success"; + public static final String SUCCESS_INIT_DISPLAY = "base.return.msg.init.display.success"; + + public static final String DES_SECRET_KEY_ONE = "base.pwd.encryption.des.one"; + public static final String DES_SECRET_KEY_TWO = "base.pwd.encryption.des.two"; + public static final String DES_SECRET_KEY_THREE = "base.pwd.encryption.des.three"; + + public static final String CUSTOMER_TYPE_COMPANY = "base.customer.type.company"; + public static final String CUSTOMER_TYPE_PERSON = "base.customer.type.person"; + + public static final String FILTER_USER_ROLE_ID = "base.filter.user.role.id"; + + /** + * APP SESSION 配置 + */ + public static Map sessionProperty; + + /** + * APP 基本配置 + */ + public static Map baseProperty; + + private static void setMap(Map objMap, String sKey, + String sValue) { + ARE.getLog().debug("Map >> key :" + sKey + ", value :" + sValue); + objMap.put(sKey.toLowerCase(), sValue); + objMap.put(sKey.toUpperCase(), sValue); + } + + private static void loadBaseKey(Properties pro) { + baseProperty = new HashMap(); + + // base : 令牌有效期 + setMap(baseProperty, "TOKENHOLDTIME", + pro.getProperty(PROPERTY_KEY_TOKEN_HOLD_TIME)); + + // base : 编码 + setMap(baseProperty, "ENCODING", pro.getProperty(PROPERTY_KEY_ENCODING)); + + // base : 免过滤地址 + setMap(baseProperty, "NOFILETER", + pro.getProperty(PROPERTY_KEY_NO_FILETER)); + + // base : GBK + setMap(baseProperty, "DATAENCODING", + pro.getProperty(PROPERTY_KEY_DATA_ENCODING)); + + // base : response return value encoding enable true + // [setcharencoding=GBK] false [setcharencoding=default] + setMap(baseProperty, "FORCEENCODING", + pro.getProperty(PROPERTY_KEY_FORCE_ENCODING)); + + // base : transaction & JBOTransaction source = [als] + setMap(baseProperty, "DATASOURCE", + pro.getProperty(PROPERTY_KEY_DATA_SOURCE)); + + // base : response return type + setMap(baseProperty, "VOID", + pro.getProperty(PROPERTY_KEY_SERVICE_RETURN_TYPE_VOID)); + setMap(baseProperty, "APPATT", + pro.getProperty(PROPERTY_KEY_SERVICE_RETURN_TYPE_APPATT)); + + // base : code & massage + setMap(baseProperty, "CODE500", pro.getProperty(PROPERTY_KEY_CODE_500)); + setMap(baseProperty, "MSG500", pro.getProperty(PROPERTY_KEY_MSG_500)); + setMap(baseProperty, "CODE404", pro.getProperty(PROPERTY_KEY_CODE_404)); + setMap(baseProperty, "CODE406", pro.getProperty(PROPERTY_KEY_CODE_406)); + setMap(baseProperty, "MSG406", pro.getProperty(PROPERTY_KEY_MSG_406)); + + setMap(baseProperty, "FAIL_SAVE", pro.getProperty(FAIL_SAVE)); + setMap(baseProperty, "FAIL_EDIT", pro.getProperty(FAIL_EDIT)); + setMap(baseProperty, "FAIL_DELETE", pro.getProperty(FAIL_DELETE)); + setMap(baseProperty, "FAIL_INIT_DISPLAY", + pro.getProperty(FAIL_INIT_DISPLAY)); + setMap(baseProperty, "SUCCESS_SAVE", pro.getProperty(SUCCESS_SAVE)); + setMap(baseProperty, "SUCCESS_EDIT", pro.getProperty(SUCCESS_EDIT)); + setMap(baseProperty, "SUCCESS_DELETE", pro.getProperty(SUCCESS_DELETE)); + setMap(baseProperty, "SUCCESS_INIT_DISPLAY", + pro.getProperty(SUCCESS_INIT_DISPLAY)); + + setMap(baseProperty, "FILTER_USER_ROLE_ID", + pro.getProperty(FILTER_USER_ROLE_ID)); + // base : result code + setMap(baseProperty, "SUCCESS", + pro.getProperty(PROPERTY_KEY_RESULT_SUCCESS_CODE)); + setMap(baseProperty, "FAIL", + pro.getProperty(PROPERTY_KEY_RESULT_FAIL_CODE)); + + // base : application push massage config + setMap(baseProperty, "PUSHENABLE", + pro.getProperty(PROPERTY_KEY_PUSH_ENABLE)); + setMap(baseProperty, "SECRETIOS", + pro.getProperty(PROPERTY_KEY_PUSH_SECRET_IOS)); + setMap(baseProperty, "SECRETANDROID", + pro.getProperty(PROPERTY_KEY_PUSH_SECRET_ANDROID)); + setMap(baseProperty, "PACKAGENAME", + pro.getProperty(PROPERTY_KEY_PACKAGE_NAME)); + // DES + setMap(baseProperty, "DES_SECRET_KEY_ONE", + pro.getProperty(DES_SECRET_KEY_ONE)); + setMap(baseProperty, "DES_SECRET_KEY_TWO", + pro.getProperty(DES_SECRET_KEY_TWO)); + setMap(baseProperty, "DES_SECRET_KEY_THREE", + pro.getProperty(DES_SECRET_KEY_THREE)); + + // CUSTOMER TYPE 01 + setMap(baseProperty, "CUSTOMER_TYPE_COMPANY", + pro.getProperty(CUSTOMER_TYPE_COMPANY)); + // CUSTOMER TYPE 03 + setMap(baseProperty, "CUSTOMER_TYPE_PERSON", + pro.getProperty(CUSTOMER_TYPE_PERSON)); + } + + private static void loadSessionKey(Properties pro) { + sessionProperty = new HashMap(); + setMap(sessionProperty, "USERID", pro.getProperty(PROPERTY_KEY_USER_ID)); + setMap(sessionProperty, "TOKEN", pro.getProperty(PROPERTY_KEY_TOKEN)); + setMap(sessionProperty, "DEVID", pro.getProperty(PROPERTY_KEY_DEV_ID)); + setMap(sessionProperty, "DEVOS", pro.getProperty(PROPERTY_KEY_DEV_OS)); + setMap(sessionProperty, "EXPIRE", pro.getProperty(PROPERTY_KEY_EXPIRE)); + setMap(sessionProperty, "WEBAPI", pro.getProperty(PROPERTY_KEY_WEB_API)); + setMap(sessionProperty, "REQURI", pro.getProperty(PROPERTY_KEY_REQ_URI)); + } + + public static void initProperties() throws Exception { + ARE.getLog().debug("开启加载APP_CONFIG.PROPERTIES "); + @SuppressWarnings("deprecation") + Configure CurConfig = Configure.getInstance(); + try { + // String path = + // request.getSession().getServletContext().getRealPath("/"); + // String proRootPath = directory.getCanonicalPath(); + URL url = RestfullConstant.class.getResource("/"); + String sClassPath = url.getPath(); + sClassPath = sClassPath.startsWith("/") ? sClassPath.substring(1, + sClassPath.indexOf("/WEB-INF") + 8) : sClassPath; + + String fileName = sClassPath + + CurConfig.getConfigure("AppConfigPath"); + //String fileName = CurConfig.getConfigure("AppConfigPath"); + ARE.getLog().debug("文件全路径:" + fileName); + Properties pro = new Properties(); + FileInputStream in = new FileInputStream(fileName); + pro.load(in); + Iterator it = pro.stringPropertyNames().iterator(); + + while (it.hasNext()) { + String sKey = it.next(); + ARE.getLog().debug( + "key:" + sKey + " property:" + pro.getProperty(sKey)); + } + + loadSessionKey(pro); + loadBaseKey(pro); + in.close(); + } catch (Exception e) { + ARE.getLog().error(e); + throw new Exception("加载APP配置文件失败" + e); + } + } +} diff --git a/src_app_fresh/com/base/encoding/BaseDigestPasswordEncoder.java b/src_app_fresh/com/base/encoding/BaseDigestPasswordEncoder.java new file mode 100644 index 000000000..ce9b2acce --- /dev/null +++ b/src_app_fresh/com/base/encoding/BaseDigestPasswordEncoder.java @@ -0,0 +1,44 @@ +/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.base.encoding; + +/** + *

      Convenience base for digest password encoders.

      + * + * @author colin sampaleanu + * @version $Id: BaseDigestPasswordEncoder.java 3550 2009-04-13 13:43:23Z ltaylor $ + */ +public abstract class BaseDigestPasswordEncoder extends BasePasswordEncoder { + //~ Instance fields ================================================================================================ + + private boolean encodeHashAsBase64 = false; + + //~ Methods ======================================================================================================== + + public boolean getEncodeHashAsBase64() { + return encodeHashAsBase64; + } + + /** + * The encoded password is normally returned as Hex (32 char) version of the hash bytes. Setting this + * property to true will cause the encoded pass to be returned as Base64 text, which will consume 24 characters. + * + * @param encodeHashAsBase64 set to true for Base64 output + */ + public void setEncodeHashAsBase64(boolean encodeHashAsBase64) { + this.encodeHashAsBase64 = encodeHashAsBase64; + } +} diff --git a/src_app_fresh/com/base/encoding/BasePasswordEncoder.java b/src_app_fresh/com/base/encoding/BasePasswordEncoder.java new file mode 100644 index 000000000..c56f26476 --- /dev/null +++ b/src_app_fresh/com/base/encoding/BasePasswordEncoder.java @@ -0,0 +1,90 @@ +/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.base.encoding; + +/** + *

      Convenience base for all password encoders.

      + * + * @author Ben Alex + * @version $Id: BasePasswordEncoder.java 3550 2009-04-13 13:43:23Z ltaylor $ + */ +public abstract class BasePasswordEncoder implements PasswordEncoder { + //~ Methods ======================================================================================================== + + /** + * Used by subclasses to extract the password and salt from a merged String created using + * {@link #mergePasswordAndSalt(String,Object,boolean)}.

      The first element in the returned array is the + * password. The second element is the salt. The salt array element will always be present, even if no salt was + * found in the mergedPasswordSalt argument.

      + * + * @param mergedPasswordSalt as generated by mergePasswordAndSalt + * + * @return an array, in which the first element is the password and the second the salt + * + * @throws IllegalArgumentException if mergedPasswordSalt is null or empty. + */ + protected String[] demergePasswordAndSalt(String mergedPasswordSalt) { + if ((mergedPasswordSalt == null) || "".equals(mergedPasswordSalt)) { + throw new IllegalArgumentException("Cannot pass a null or empty String"); + } + + String password = mergedPasswordSalt; + String salt = ""; + + int saltBegins = mergedPasswordSalt.lastIndexOf("{"); + + if ((saltBegins != -1) && ((saltBegins + 1) < mergedPasswordSalt.length())) { + salt = mergedPasswordSalt.substring(saltBegins + 1, mergedPasswordSalt.length() - 1); + password = mergedPasswordSalt.substring(0, saltBegins); + } + + return new String[] {password, salt}; + } + + /** + * Used by subclasses to generate a merged password and salt String.

      The generated password + * will be in the form of password{salt}.

      + *

      A null can be passed to either method, and will be handled correctly. If the + * salt is null or empty, the resulting generated password will simply be the passed + * password. The toString method of the salt will be used to represent the + * salt.

      + * + * @param password the password to be used (can be null) + * @param salt the salt to be used (can be null) + * @param strict ensures salt doesn't contain the delimiters + * + * @return a merged password and salt String + * + * @throws IllegalArgumentException if the salt contains '{' or '}' characters. + */ + protected String mergePasswordAndSalt(String password, Object salt, boolean strict) { + if (password == null) { + password = ""; + } + + if (strict && (salt != null)) { + if ((salt.toString().lastIndexOf("{") != -1) || (salt.toString().lastIndexOf("}") != -1)) { + throw new IllegalArgumentException("Cannot use { or } in salt.toString()"); + } + } + + if ((salt == null) || "".equals(salt)) { + return password; + } else { + return password + "{" + salt.toString() + "}"; + } + } +} diff --git a/src_app_fresh/com/base/encoding/Md5PasswordEncoder.java b/src_app_fresh/com/base/encoding/Md5PasswordEncoder.java new file mode 100644 index 000000000..31d579bf5 --- /dev/null +++ b/src_app_fresh/com/base/encoding/Md5PasswordEncoder.java @@ -0,0 +1,36 @@ +/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.base.encoding; + +/** + *

      MD5 implementation of PasswordEncoder.

      + *

      If a null password is presented, it will be treated as an empty String ("") + * password.

      + *

      As MD5 is a one-way hash, the salt can contain any characters.

      + * + * This is a convenience class that extends the + * {@link MessageDigestPasswordEncoder} and passes MD5 as the algorithm to use. + * + * @author Ray Krueger + * @author colin sampaleanu + * @author Ben Alex + * @version $Id: Md5PasswordEncoder.java 3550 2009-04-13 13:43:23Z ltaylor $ + */ +public class Md5PasswordEncoder extends MessageDigestPasswordEncoder { + + public Md5PasswordEncoder() { + super("MD5"); + } +} diff --git a/src_app_fresh/com/base/encoding/MessageDigestPasswordEncoder.java b/src_app_fresh/com/base/encoding/MessageDigestPasswordEncoder.java new file mode 100644 index 000000000..cc43d88d7 --- /dev/null +++ b/src_app_fresh/com/base/encoding/MessageDigestPasswordEncoder.java @@ -0,0 +1,124 @@ +package com.base.encoding; + +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.codec.binary.Hex; + +/** + * Base for digest password encoders. + *

      This class can be used stand-alone, or one of the subclasses can be used for compatiblity and convenience. + * When using this class directly you must specify a + * + * Message Digest Algorithm to use as a constructor arg

      + * + *

      The encoded password hash is normally returned as Hex (32 char) version of the hash bytes. + * Setting the encodeHashAsBase64 property to true will cause the encoded pass to be returned + * as Base64 text, which will consume 24 characters. + * See {@link BaseDigestPasswordEncoder#setEncodeHashAsBase64(boolean)} + *

      + *

      + * This PasswordEncoder can be used directly as in the following example:
      + *

      + * <bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder">
      + *     <constructor-arg value="MD5"/>
      + * </bean>
      + * 
      + *

      + * + * @author Ray Krueger + * @since 1.0.1 + */ +public class MessageDigestPasswordEncoder extends BaseDigestPasswordEncoder { + + private final String algorithm; + + /** + * The digest algorithm to use + * Supports the named + * Message Digest Algorithms in the Java environment. + * + * @param algorithm + */ + public MessageDigestPasswordEncoder(String algorithm) { + this(algorithm, false); + } + + /** + * Convenience constructor for specifying the algorithm and whether or not to enable base64 encoding + * + * @param algorithm + * @param encodeHashAsBase64 + * @throws IllegalArgumentException if an unknown + */ + public MessageDigestPasswordEncoder(String algorithm, boolean encodeHashAsBase64) throws IllegalArgumentException { + this.algorithm = algorithm; + setEncodeHashAsBase64(encodeHashAsBase64); + //Validity Check + getMessageDigest(); + } + + /** + * Encodes the rawPass using a MessageDigest. + * If a salt is specified it will be merged with the password before encoding. + * + * @param rawPass The plain text password + * @param salt The salt to sprinkle + * @return Hex string of password digest (or base64 encoded string if encodeHashAsBase64 is enabled. + */ + public String encodePassword(String rawPass, Object salt) { + String saltedPass = mergePasswordAndSalt(rawPass, salt, false); + MessageDigest messageDigest = getMessageDigest(); + + byte[] digest; + + try { + digest = messageDigest.digest(saltedPass.getBytes("UTF-8")); + } catch (UnsupportedEncodingException e) { + throw new IllegalStateException("UTF-8 not supported!"); + } + + if (getEncodeHashAsBase64()) { + return new String(Base64.encodeBase64(digest)); + } else { + return new String(Hex.encodeHex(digest)); + } + } + + /** + * Get a MessageDigest instance for the given algorithm. + * Throws an IllegalArgumentException if algorithm is unknown + * + * @return MessageDigest instance + * @throws IllegalArgumentException if NoSuchAlgorithmException is thrown + */ + protected final MessageDigest getMessageDigest() throws IllegalArgumentException { + try { + return MessageDigest.getInstance(algorithm); + } catch (NoSuchAlgorithmException e) { + throw new IllegalArgumentException("No such algorithm [" + algorithm + "]"); + } + } + + /** + * Takes a previously encoded password and compares it with a rawpassword after mixing in the salt and + * encoding that value + * + * @param encPass previously encoded password + * @param rawPass plain text password + * @param salt salt to mix into password + * @return true or false + */ + public boolean isPasswordValid(String encPass, String rawPass, Object salt) { + String pass1 = "" + encPass; + String pass2 = encodePassword(rawPass, salt); + + return pass1.equals(pass2); + } + + public String getAlgorithm() { + return algorithm; + } +} diff --git a/src_app_fresh/com/base/encoding/PasswordEncoder.java b/src_app_fresh/com/base/encoding/PasswordEncoder.java new file mode 100644 index 000000000..a2fe71b7c --- /dev/null +++ b/src_app_fresh/com/base/encoding/PasswordEncoder.java @@ -0,0 +1,76 @@ +/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.base.encoding; + +import org.springframework.dao.DataAccessException; + + +/** + *

      + * Interface for performing authentication operations on a password. + *

      + * + * @author colin sampaleanu + * @version $Id: PasswordEncoder.java 3550 2009-04-13 13:43:23Z ltaylor $ + */ +public interface PasswordEncoder { + //~ Methods ======================================================================================================== + + /** + *

      Encodes the specified raw password with an implementation specific algorithm.

      + *

      This will generally be a one-way message digest such as MD5 or SHA, but may also be a plaintext + * variant which does no encoding at all, but rather returns the same password it was fed. The latter is useful to + * plug in when the original password must be stored as-is.

      + *

      The specified salt will potentially be used by the implementation to "salt" the initial value before + * encoding. A salt is usually a user-specific value which is added to the password before the digest is computed. + * This means that computation of digests for common dictionary words will be different than those in the backend + * store, because the dictionary word digests will not reflect the addition of the salt. If a per-user salt is + * used (rather than a system-wide salt), it also means users with the same password will have different digest + * encoded passwords in the backend store.

      + *

      If a salt value is provided, the same salt value must be use when calling the {@link + * #isPasswordValid(String, String, Object)} method. Note that a specific implementation may choose to ignore the + * salt value (via null), or provide its own.

      + * + * @param rawPass the password to encode + * @param salt optionally used by the implementation to "salt" the raw password before encoding. A + * null value is legal. + * + * @return encoded password + * + * @throws DataAccessException DOCUMENT ME! + */ + String encodePassword(String rawPass, Object salt) + throws DataAccessException; + + /** + *

      Validates a specified "raw" password against an encoded password.

      + *

      The encoded password should have previously been generated by {@link #encodePassword(String, + * Object)}. This method will encode the rawPass (using the optional salt), and then + * compared it with the presented encPass.

      + *

      For a discussion of salts, please refer to {@link #encodePassword(String, Object)}.

      + * + * @param encPass a pre-encoded password + * @param rawPass a raw password to encode and compare against the pre-encoded password + * @param salt optionally used by the implementation to "salt" the raw password before encoding. A + * null value is legal. + * + * @return true if the password is valid , false otherwise + * + * @throws DataAccessException DOCUMENT ME! + */ + boolean isPasswordValid(String encPass, String rawPass, Object salt) + throws DataAccessException; +} diff --git a/src_app_fresh/com/base/helper/AppHelper.java b/src_app_fresh/com/base/helper/AppHelper.java new file mode 100644 index 000000000..870c6f973 --- /dev/null +++ b/src_app_fresh/com/base/helper/AppHelper.java @@ -0,0 +1,92 @@ +package com.base.helper; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.base.util.BizObjectUtil; + +public class AppHelper { + public static Map getNewVersionByPhoneType(String sDevType) { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.APP_VERSION"); + BizObjectQuery boq = bom + .createQuery( + "PHONE_TYPE=:PHONE_TYPE AND IS_NEW='Y' ORDER BY UP_DATE DESC") + .setParameter("PHONE_TYPE", sDevType); + BizObject bo = boq.getSingleResult(false); + + if (bo == null) + return null; + + BizObjectUtil boUtil = new BizObjectUtil(); + return boUtil.bizObject2MapValue(bo); + } catch (JBOException e) { + ARE.getLog().error(e); + return null; + } + } + + public static Map getPushMsgConfig() { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.APP_PUSH_CONFIG"); + BizObjectQuery boq = bom.createQuery("1=1"); + BizObject bo = boq.getSingleResult(false); + + if (bo == null) + return null; + + BizObjectUtil boUtil = new BizObjectUtil(); + return boUtil.bizObject2MapValue(bo); + } catch (JBOException e) { + ARE.getLog().error(e); + return null; + } + } + + public static List> getPushMsgResult() { + List> list = new ArrayList>(); + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.APP_PUSH_MESSAGE"); + BizObjectQuery boq = bom.createQuery("1=1"); + List bos = boq.getResultList(false); + + for (BizObject bo : bos) { + if (bo == null) + continue; + BizObjectUtil boUtil = new BizObjectUtil(); + list.add(boUtil.bizObject2MapValue(bo)); + } + } catch (JBOException e) { + ARE.getLog().error(e); + } + + return list; + } + + public static Map getGroup(String sGroupCode) { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.APP_BUSINESS_GROUP"); + BizObjectQuery boq = bom.createQuery("GROUP_CODE=:GROUP_CODE").setParameter("GROUP_CODE", sGroupCode); + BizObject bo = boq.getSingleResult(false); + + if (bo == null) return null; + + BizObjectUtil boUtil = new BizObjectUtil(); + return boUtil.bizObject2MapValue(bo); + } catch (JBOException e) { + ARE.getLog().error(e); + return null; + } + } +} diff --git a/src_app_fresh/com/base/helper/AweDoHelper.java b/src_app_fresh/com/base/helper/AweDoHelper.java new file mode 100644 index 000000000..b31f16811 --- /dev/null +++ b/src_app_fresh/com/base/helper/AweDoHelper.java @@ -0,0 +1,5 @@ +package com.base.helper; + +public class AweDoHelper { + +} diff --git a/src_app_fresh/com/base/helper/BFTemplateHelper.java b/src_app_fresh/com/base/helper/BFTemplateHelper.java new file mode 100644 index 000000000..c1afbe7c9 --- /dev/null +++ b/src_app_fresh/com/base/helper/BFTemplateHelper.java @@ -0,0 +1,23 @@ +package com.base.helper; + +import java.util.Map; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.base.util.BizObjectUtil; + +public class BFTemplateHelper { + public static Map getDocById(String sId) + throws JBOException { + BizObjectManager bm = JBOFactory + .getBizObjectManager("jbo.com.tenwa.entity.comm.officetempalte.BF_TEMPLATE"); + BizObject bo = bm.createQuery("id=:id").setParameter("id", sId) + .getSingleResult(false); + if (null == bo) + return null; + BizObjectUtil util = new BizObjectUtil(); + return util.bizObject2MapValue(bo); + } +} diff --git a/src_app_fresh/com/base/helper/CustomerHelper.java b/src_app_fresh/com/base/helper/CustomerHelper.java new file mode 100644 index 000000000..fd43b151c --- /dev/null +++ b/src_app_fresh/com/base/helper/CustomerHelper.java @@ -0,0 +1,94 @@ +//package com.base.helper; +// +//import java.util.List; +// +//import jbo.app.tenwa.customer.CUSTOMER_ADDRESS; +//import jbo.app.tenwa.customer.CUSTOMER_CERT; +//import jbo.app.tenwa.customer.CUSTOMER_COMPANY; +//import jbo.app.tenwa.customer.CUSTOMER_INFO; +//import jbo.app.tenwa.customer.CUSTOMER_PERSON; +//import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE; +// +//import com.amarsoft.are.jbo.BizObject; +//import com.amarsoft.are.jbo.BizObjectManager; +//import com.amarsoft.are.jbo.BizObjectQuery; +//import com.amarsoft.are.jbo.JBOException; +//import com.amarsoft.are.jbo.JBOFactory; +//import com.base.constant.RestfullConstant; +// +//public class CustomerHelper { +// private final static String COMPANY_TYPE = RestfullConstant.baseProperty +// .get("CUSTOMER_TYPE_COMPANY").toString(); // 01 +// private final static String PERSON_TYPE = RestfullConstant.baseProperty +// .get("CUSTOMER_TYPE_PERSON").toString(); // 03 +// +// public static BizObject getCustomerCertInfo(String sCertType, String sCertId) +// throws JBOException { +// BizObjectManager manage = JBOFactory +// .getBizObjectManager(CUSTOMER_CERT.CLASS_NAME); +// BizObjectQuery query = manage +// .createQuery("CERTTYPE=:CERTTYPE AND CERTID=:CERTID") +// .setParameter("CERTTYPE", sCertType) +// .setParameter("CERTID", sCertId); +// BizObject object = query.getSingleResult(false); +// return object; +// } +// +// public static BizObject getCustomerInfo(String sCertType, String sCertId) +// throws JBOException { +// BizObjectManager manage = JBOFactory +// .getBizObjectManager(CUSTOMER_INFO.CLASS_NAME); +// BizObjectQuery query = manage +// .createQuery("CERTTYPE=:CERTTYPE AND CERTID=:CERTID") +// .setParameter("CERTTYPE", sCertType) +// .setParameter("CERTID", sCertId); +// BizObject object = query.getSingleResult(false); +// return object; +// } +// +// public static BizObject getCustomerInfo(String sCustomerId) +// throws JBOException { +// BizObjectManager manage = JBOFactory +// .getBizObjectManager(CUSTOMER_INFO.CLASS_NAME); +// BizObjectQuery query = manage.createQuery("CUSTOMERID=:CUSTOMERID") +// .setParameter("CUSTOMERID", sCustomerId); +// BizObject object = query.getSingleResult(false); +// return object; +// } +// +// public static BizObject getCustomerInfoByProject(String sProjectId) +// throws JBOException { +// String sSql = "SELECT O.* FROM O," + LB_UNION_LESSEE.CLASS_NAME +// + " LB_UNION_LESSEE"; +// sSql += " WHERE LB_UNION_LESSEE.PROJECT_ID=:PROJECT_ID"; +// BizObjectManager boManage = JBOFactory +// .getBizObjectManager(CUSTOMER_INFO.CLASS_NAME); +// BizObjectQuery boQuery = boManage.createQuery(sSql).setParameter( +// "PROJECT_ID", sProjectId); +// return boQuery.getSingleResult(false); +// } +// +// public static BizObject getCustomerDetail(String sCustomerType, +// String sCustomerId) throws JBOException { +// BizObjectManager manage = null; +// manage = COMPANY_TYPE.equals(sCustomerType) ? JBOFactory +// .getBizObjectManager(CUSTOMER_COMPANY.CLASS_NAME) : PERSON_TYPE +// .equals(sCustomerType) ? JBOFactory +// .getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME) : null; +// BizObjectQuery query = manage.createQuery("CUSTOMERID=:CUSTOMERID") +// .setParameter("CUSTOMERID", sCustomerId); +// BizObject object = query.getSingleResult(false); +// return object; +// } +// +// public static List getCustomerAddress(String sCustomerId) +// throws JBOException { +// BizObjectManager manage = JBOFactory +// .getBizObjectManager(CUSTOMER_ADDRESS.CLASS_NAME); +// BizObjectQuery query = manage.createQuery("CUSTOMERID=:CUSTOMERID") +// .setParameter("CUSTOMERID", sCustomerId); +// @SuppressWarnings("unchecked") +// List list = query.getResultList(false); +// return list; +// } +//} diff --git a/src_app_fresh/com/base/helper/DocLibraryHelper.java b/src_app_fresh/com/base/helper/DocLibraryHelper.java new file mode 100644 index 000000000..094ebef9b --- /dev/null +++ b/src_app_fresh/com/base/helper/DocLibraryHelper.java @@ -0,0 +1,34 @@ +package com.base.helper; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.base.util.BizObjectUtil; + +public class DocLibraryHelper { + + public List> findDocAttributeList(String sql) { + List> list = new ArrayList>(); + BizObject bo = null; + try { + BizObjectManager bom1 = JBOFactory + .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); + BizObjectQuery boq1 = bom1.createQuery(sql); + bo = boq1.getSingleResult(false); + if (bo == null) + return list; + BizObjectUtil boUtil = new BizObjectUtil(); + list.add(boUtil.bizObject2MapValue(bo)); + } catch (JBOException e) { + ARE.getLog().error(e); + } + return list; + } +} diff --git a/src_app_fresh/com/base/helper/LBDocHelper.java b/src_app_fresh/com/base/helper/LBDocHelper.java new file mode 100644 index 000000000..110222f90 --- /dev/null +++ b/src_app_fresh/com/base/helper/LBDocHelper.java @@ -0,0 +1,37 @@ +package com.base.helper; + +import java.util.Map; + +import jbo.sys.DOC_ATTACHMENT; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.base.util.BizObjectUtil; + +public class LBDocHelper { +// public static Map getDocById(String sId) +// throws JBOException { +// BizObjectManager bm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); +// BizObject bo = bm.createQuery("id=:id").setParameter("id", sId) +// .getSingleResult(false); +// if (null == bo) +// return null; +// BizObjectUtil util = new BizObjectUtil(); +// return util.bizObject2MapValue(bo); +// } + + public static Map getDocById2(String sId) + throws JBOException { + BizObjectManager bm = JBOFactory + .getBizObjectManager(DOC_ATTACHMENT.CLASS_NAME); + BizObject bo = bm.createQuery("ATTACHMENTNO=:id").setParameter("id", sId) + .getSingleResult(false); + if (null == bo) + return null; + BizObjectUtil util = new BizObjectUtil(); + return util.bizObject2MapValue(bo); + } +} diff --git a/src_app_fresh/com/base/helper/ProjHelpler.java b/src_app_fresh/com/base/helper/ProjHelpler.java new file mode 100644 index 000000000..22b059c3c --- /dev/null +++ b/src_app_fresh/com/base/helper/ProjHelpler.java @@ -0,0 +1,52 @@ +//package com.base.helper; +// +//import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO; +//import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE; +// +//import com.amarsoft.are.jbo.BizObject; +//import com.amarsoft.are.jbo.BizObjectManager; +//import com.amarsoft.are.jbo.BizObjectQuery; +//import com.amarsoft.are.jbo.JBOFactory; +// +//public class ProjHelpler { +// public static BizObject queryProjectInfoByContractNuber(String sContractNumber) +// throws Exception { +// BizObjectManager boManage = JBOFactory +// .getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME); +// BizObjectQuery boQuery = boManage.createQuery( +// "O.CONTRACT_NUMBER=:CONTRACT_NUMBER").setParameter( +// "CONTRACT_NUMBER", sContractNumber); +// return boQuery.getSingleResult(false); +// } +// +// public static BizObject queryProjectInfoById(String sId) throws Exception { +// BizObjectManager boManage = JBOFactory +// .getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME); +// BizObjectQuery boQuery = boManage.createQuery( +// "O.id=:id").setParameter( +// "id", sId); +// return boQuery.getSingleResult(false); +// } +// +// public static BizObject queryProjectInfoByContractId(String sContractId) throws Exception { +// String sSql = "SELECT O.* FROM O," + LB_UNION_LESSEE.CLASS_NAME + " LB_UNION_LESSEE"; +// sSql += " WHERE LB_UNION_LESSEE.CONTRACT_ID=:CONTRACT_ID"; +// BizObjectManager boManage = JBOFactory +// .getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME); +// BizObjectQuery boQuery = boManage.createQuery( +// sSql).setParameter( +// "CONTRACT_ID", sContractId); +// return boQuery.getSingleResult(false); +// } +// +// public static BizObject queryProjectInfoByCustomerId(String sCustomerId) throws Exception { +// String sSql = "SELECT O.* FROM O," + LB_UNION_LESSEE.CLASS_NAME + " LB_UNION_LESSEE"; +// sSql += " WHERE LB_UNION_LESSEE.CUSTOMER_ID=:CUSTOMER_ID"; +// BizObjectManager boManage = JBOFactory +// .getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME); +// BizObjectQuery boQuery = boManage.createQuery( +// sSql).setParameter( +// "CUSTOMER_ID", sCustomerId); +// return boQuery.getSingleResult(false); +// } +//} diff --git a/src_app_fresh/com/base/helper/SessionHelper.java b/src_app_fresh/com/base/helper/SessionHelper.java new file mode 100644 index 000000000..03973dfd1 --- /dev/null +++ b/src_app_fresh/com/base/helper/SessionHelper.java @@ -0,0 +1,181 @@ +package com.base.helper; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.base.constant.RestfullConstant; +import com.base.tool.ExpireTool; +import com.base.util.BizObjectUtil; + +public class SessionHelper { + + public static List> getSessionTokenByToken(String sToken) { + List> list = new ArrayList>(); + BizObject bo = null; + + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.TOKEN_SESSION"); + BizObjectQuery boq = bom.createQuery("TOKEN=:TOKEN").setParameter( + "TOKEN", sToken); + bo = boq.getSingleResult(false); + } catch (JBOException e) { + ARE.getLog().error(e); + } + + if (bo == null) + return list; + BizObjectUtil boUtil = new BizObjectUtil(); + list.add(boUtil.bizObject2MapValue(bo)); + return list; + } + + public static List> getSessionTokenBySession( + HttpServletRequest req) { + String sUserId = (String) req.getSession() + .getAttribute( + (String) RestfullConstant.sessionProperty.get("USERID" + .toLowerCase())); + String sToken = (String) req.getSession() + .getAttribute( + (String) RestfullConstant.sessionProperty.get("TOKEN" + .toLowerCase())); + String sExpire = new Date().getTime() + ""; + List> list = new ArrayList>(); + BizObject bo = null; + + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.TOKEN_SESSION"); + BizObjectQuery boq = bom + .createQuery( + "TOKEN=:TOKEN AND USER_ID=:USER_ID AND EXPIRE_IN > :EXPIRE_IN") + .setParameter("TOKEN", sToken) + .setParameter("USER_ID", sUserId) + .setParameter("EXPIRE_IN", sExpire); + bo = boq.getSingleResult(false); + } catch (JBOException e) { + ARE.getLog().error(e); + } + + if (bo == null) + return list; + BizObjectUtil boUtil = new BizObjectUtil(); + list.add(boUtil.bizObject2MapValue(bo)); + return list; + } + + public static List> getSessionTokenByUserId( + String sUserId) { + List> list = new ArrayList>(); + BizObject bo = null; + + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.TOKEN_SESSION"); + BizObjectQuery boq = bom.createQuery("USER_ID=:USER_ID") + .setParameter("USER_ID", sUserId); + bo = boq.getSingleResult(false); + } catch (JBOException e) { + ARE.getLog().error(e); + } + + if (bo == null) + return list; + BizObjectUtil boUtil = new BizObjectUtil(); + list.add(boUtil.bizObject2MapValue(bo)); + return list; + } + + public static void save(JBOTransaction tx, Map map) + throws JBOException { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.TOKEN_SESSION"); + BizObject bo = bom.newObject(); + ; + for (String key : map.keySet()) { + bo.setAttributeValue(key.toUpperCase(), map.get(key)); + } + if (bo == null) + return; + tx.join(bom); + bom.saveObject(bo); + tx.commit(); + } catch (JBOException e) { + ARE.getLog().error(e); + } + } + + public static Long edit(JBOTransaction tx, HttpServletRequest req) + throws JBOException { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.TOKEN_SESSION"); + + String sUserId = (String) req.getSession().getAttribute("userid"); + String sToken = (String) req.getSession().getAttribute("token"); + String sExpire = ExpireTool.getExpireTime() + ""; + BizObjectQuery boq = bom + .createQuery("USER_ID=:USER_ID AND TOKEN=:TOKEN") + .setParameter("USER_ID", sUserId) + .setParameter("TOKEN", sToken); + BizObject bo = boq.getSingleResult(true); + if (bo == null) + return 0l; + bo.setAttributeValue("EXPIRE_IN", sExpire); + tx.join(bom); + bom.saveObject(bo); + tx.commit(); + req.getSession().setAttribute("expire", sExpire); + return Long.valueOf(sExpire); + } catch (JBOException e) { + ARE.getLog().error(e); + return 0l; + } + } + + public static void removerByUserId(JBOTransaction tx, String sUserId) + throws JBOException { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.TOKEN_SESSION"); + BizObjectQuery boq = bom.createQuery("USER_ID=:USER_ID") + .setParameter("USER_ID", sUserId); + BizObject bo = boq.getSingleResult(true); + if (bo == null) + return; + tx.join(bom); + bom.deleteObject(bo); + tx.commit(); + } catch (JBOException e) { + ARE.getLog().error(e); + } + } + + public static void removerAll() throws JBOException { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.app.TOKEN_SESSION"); + BizObjectQuery boq = bom.createQuery("1=1"); + @SuppressWarnings("unchecked") + List bos = boq.getResultList(true); + for (BizObject bo : bos) { + bom.deleteObject(bo); + } + } catch (JBOException e) { + ARE.getLog().error(e); + } + } +} diff --git a/src_app/com/amarsoft/aims/util/StringHelper.java b/src_app_fresh/com/base/helper/StringHelper.java similarity index 99% rename from src_app/com/amarsoft/aims/util/StringHelper.java rename to src_app_fresh/com/base/helper/StringHelper.java index 1761c939b..274a87dda 100644 --- a/src_app/com/amarsoft/aims/util/StringHelper.java +++ b/src_app_fresh/com/base/helper/StringHelper.java @@ -1,4 +1,4 @@ -package com.amarsoft.aims.util; +package com.base.helper; import java.util.ArrayList; import java.util.Arrays; diff --git a/src_app_fresh/com/base/helper/UserHelper.java b/src_app_fresh/com/base/helper/UserHelper.java new file mode 100644 index 000000000..5deedc648 --- /dev/null +++ b/src_app_fresh/com/base/helper/UserHelper.java @@ -0,0 +1,86 @@ +package com.base.helper; + +import java.util.List; +import java.util.Map; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.BizObjectQuery; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.base.util.BizObjectUtil; + +public class UserHelper { + + public static List getUsers(String sUserIds) { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.sys.USER_INFO"); + BizObjectQuery boq = bom.createQuery("USERID in (" + sUserIds + ")"); + @SuppressWarnings("unchecked") + List bos = boq.getResultList(false); + return bos; + } catch (JBOException e) { + ARE.getLog().error(e); + return null; + } + } + + public static Map getUser(String sUserId) { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.sys.USER_INFO"); + BizObjectQuery boq = bom.createQuery("USERID=:USERID").setParameter( + "USERID", sUserId); + BizObject bo = boq.getSingleResult(false); + if (bo == null) + return null; + BizObjectUtil boUtil = new BizObjectUtil(); + return boUtil.bizObject2MapValue(bo); + } catch (JBOException e) { + ARE.getLog().error(e); + return null; + } + } + + public static Map getUserByLoginId(String loginId) { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.sys.USER_INFO"); + BizObjectQuery boq = bom.createQuery("LOGINID=:LOGINID AND STATUS = '1'").setParameter( + "LOGINID", loginId); + BizObject bo = boq.getSingleResult(false); + if (bo == null) + return null; + BizObjectUtil boUtil = new BizObjectUtil(); + return boUtil.bizObject2MapValue(bo); + } catch (JBOException e) { + ARE.getLog().error(e); + return null; + } + } + + public static void edit(JBOTransaction tx, String sUserId, Map map) throws JBOException { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager("jbo.sys.USER_INFO"); + BizObjectQuery boq = bom.createQuery("USERID=:USERID").setParameter( + "USERID", sUserId); + BizObject bo = boq.getSingleResult(true); + if (bo == null) + return; + + for (String key : map.keySet()) { + bo.setAttributeValue(key.toUpperCase(), map.get(key)); + } + + tx.join(bom); + bom.saveObject(bo); + tx.commit(); + } catch (JBOException e) { + ARE.getLog().error(e); + } + } +} diff --git a/src_app/com/amarsoft/aims/util/DateTool.java b/src_app_fresh/com/base/tool/DateTool.java similarity index 99% rename from src_app/com/amarsoft/aims/util/DateTool.java rename to src_app_fresh/com/base/tool/DateTool.java index 9ba74365d..989c7fe11 100644 --- a/src_app/com/amarsoft/aims/util/DateTool.java +++ b/src_app_fresh/com/base/tool/DateTool.java @@ -1,4 +1,4 @@ -package com.amarsoft.aims.util; +package com.base.tool; import java.text.ParseException; import java.text.SimpleDateFormat; diff --git a/src_app_fresh/com/base/tool/ExpireTool.java b/src_app_fresh/com/base/tool/ExpireTool.java new file mode 100644 index 000000000..dd16d7121 --- /dev/null +++ b/src_app_fresh/com/base/tool/ExpireTool.java @@ -0,0 +1,30 @@ +package com.base.tool; + +import java.util.Calendar; +import java.util.Date; + +import cn.config.model.GlobalConfigure; + +import com.base.constant.RestfullConstant; + +public class ExpireTool { + + public static long getExpireTime() { + String tokenHoldTimeStr = GlobalConfigure.getInstance().getProperty( + (String) RestfullConstant.baseProperty.get("TOKENHOLDTIME" + .toUpperCase())); + if (tokenHoldTimeStr == null) + tokenHoldTimeStr = "-1"; + Integer tokenHoldTime = Integer.parseInt(tokenHoldTimeStr); + // 如果设置holdTime小于0,则给他5分组有效时间 + if (tokenHoldTime <= 0) { + tokenHoldTime = 5 * 60; + } + + // 计算token失效时间 + Calendar expireTime = Calendar.getInstance(); + expireTime.setTime(new Date()); + expireTime.add(Calendar.SECOND, tokenHoldTime); + return expireTime.getTime().getTime(); + } +} diff --git a/src_app_fresh/com/base/tool/PkgsTool.java b/src_app_fresh/com/base/tool/PkgsTool.java new file mode 100644 index 000000000..07fa8cce5 --- /dev/null +++ b/src_app_fresh/com/base/tool/PkgsTool.java @@ -0,0 +1,11 @@ +package com.base.tool; + +public class PkgsTool { + public static String[] parsePkgs(String sPkgs) { + sPkgs = sPkgs.replaceAll("\\s+", ""); + sPkgs = sPkgs.replaceAll("^,", ""); + sPkgs = sPkgs.replaceAll(",$", ""); + sPkgs = sPkgs.replaceAll(",{2,}", ","); + return sPkgs.split(","); + } +} diff --git a/src_app_fresh/com/base/tool/URIMappingTool.java b/src_app_fresh/com/base/tool/URIMappingTool.java new file mode 100644 index 000000000..a659b8983 --- /dev/null +++ b/src_app_fresh/com/base/tool/URIMappingTool.java @@ -0,0 +1,110 @@ +package com.base.tool; + +import java.lang.reflect.Method; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HttpMethod; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; + +import cn.config.mapping.URIMappingCache; +import cn.config.mapping.URIMappingKey; +import cn.config.mapping.URIMappingValue; + +import com.amarsoft.are.ARE; +import com.base.util.ClassUtil; + +public class URIMappingTool { + public static void uriMappingClassMethod(Set> classes) { + for (Class clazz : classes) { + Path classAnno = clazz.getAnnotation(Path.class); + if (classAnno == null) + continue; + String classUriPath = classAnno.value(); + + Method[] methods = clazz.getMethods(); + for (Method method : methods) { + Path methodAnno = method.getAnnotation(Path.class); + String methodUriPath = ""; + if (methodAnno != null) { + methodUriPath = methodAnno.value(); + } + String accessUri = classUriPath + methodUriPath; + // 访问URI+请求方法组合成一个KEY + URIMappingKey key = null; + if (method.getAnnotation(POST.class) != null) { + key = new URIMappingKey(accessUri, HttpMethod.POST); + } else if (method.getAnnotation(GET.class) != null) { + key = new URIMappingKey(accessUri, HttpMethod.GET); + } else if (method.getAnnotation(PUT.class) != null) { + key = new URIMappingKey(accessUri, HttpMethod.PUT); + } else if (method.getAnnotation(DELETE.class) != null) { + key = new URIMappingKey(accessUri, HttpMethod.DELETE); + } else { + continue; + } + + // 类+方法组合成一个VALUE,如果已经被绑定过了,则抛出异常 + URIMappingValue existValue = URIMappingCache.getInstance().get( + key); + if (existValue != null) { + throw new RuntimeException(MessageFormat.format( + "{0} {1} --> {2}.{3} error,mapped on {4}.{5}", + key.getHttpMethod(), key.getUri(), clazz.getName(), + method.getName(), existValue.getClazz().getName(), + existValue.getMethod().getName())); + } + URIMappingValue value = new URIMappingValue(clazz, method); + ARE.getLog().info( + String.format("%-6s %s --> %s.%s ", + key.getHttpMethod(), key.getUri(), + clazz.getName(), method.getName())); + URIMappingCache.getInstance().put(key, value); + } + } + } + + public static void scanPackageAndInitResfSetting(String pkgExpr) { + URIMappingCache.getInstance().clear(); + String[] resfPkgs = PkgsTool.parsePkgs(pkgExpr); + if (resfPkgs == null || resfPkgs.length == 0) + return; + + Set> classes = new HashSet>(); + + ARE.getLog() + .info("---------------------RESTFULL MAPPING------------------------"); + + for (String pkg : resfPkgs) { + classes.addAll(findClassWithPathAnno(pkg)); + } + + URIMappingTool.uriMappingClassMethod(classes); + + ARE.getLog().info( + "---------------------------------------------------------"); + } + + private static List> findClassWithPathAnno(String pkg) { + List> classList = new ArrayList>(); + + Set> classes = ClassUtil.getClasses(pkg); + for (Class clazz : classes) { + // 从类注解上查找Path + Path classAnno = clazz.getAnnotation(Path.class); + if (classAnno == null) + continue; + // String annoPath = classAnno.value(); + classList.add(clazz); + } + + return classList; + } +} diff --git a/src_app/apx/com/amarsoft/als/base/util/Bean2MapUtil.java b/src_app_fresh/com/base/util/Bean2MapUtil.java similarity index 93% rename from src_app/apx/com/amarsoft/als/base/util/Bean2MapUtil.java rename to src_app_fresh/com/base/util/Bean2MapUtil.java index 749580f60..4015fca32 100644 --- a/src_app/apx/com/amarsoft/als/base/util/Bean2MapUtil.java +++ b/src_app_fresh/com/base/util/Bean2MapUtil.java @@ -1,28 +1,28 @@ -package apx.com.amarsoft.als.base.util; - -import java.beans.PropertyDescriptor; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.beanutils.PropertyUtilsBean; - -public class Bean2MapUtil { - public static Map beanToMap(Object obj) { - Map params = new HashMap(0); - try { - PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean(); - PropertyDescriptor[] descriptors = propertyUtilsBean - .getPropertyDescriptors(obj); - for (int i = 0; i < descriptors.length; i++) { - String name = descriptors[i].getName(); - if (!"class".equals(name)) { - params.put(name, - propertyUtilsBean.getNestedProperty(obj, name)); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return params; - } -} +package com.base.util; + +import java.beans.PropertyDescriptor; +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.beanutils.PropertyUtilsBean; + +public class Bean2MapUtil { + public static Map beanToMap(Object obj) { + Map params = new HashMap(0); + try { + PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean(); + PropertyDescriptor[] descriptors = propertyUtilsBean + .getPropertyDescriptors(obj); + for (int i = 0; i < descriptors.length; i++) { + String name = descriptors[i].getName(); + if (!"class".equals(name)) { + params.put(name, + propertyUtilsBean.getNestedProperty(obj, name)); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return params; + } +} diff --git a/src_app/apx/com/amarsoft/als/base/util/BizObjectUtil.java b/src_app_fresh/com/base/util/BizObjectUtil.java similarity index 52% rename from src_app/apx/com/amarsoft/als/base/util/BizObjectUtil.java rename to src_app_fresh/com/base/util/BizObjectUtil.java index 41f378d9c..8da01bddc 100644 --- a/src_app/apx/com/amarsoft/als/base/util/BizObjectUtil.java +++ b/src_app_fresh/com/base/util/BizObjectUtil.java @@ -1,113 +1,170 @@ -package apx.com.amarsoft.als.base.util; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import apx.com.amarsoft.als.base.constant.cache.AppAweDoCache; -import apx.com.amarsoft.als.base.constant.cache.AppCodeCache; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.lang.DataElement; - -public class BizObjectUtil { - /** - * BizObject 转 MAP display/ value/ name 分别指定 DataElement的getLabel/ getValue/ - * getName source:字典表 - * - * @param bo - * BizObject - * @param doNo - * AweDOCatalog:dono 通过doNo查询字段source来源 从而获取字典表显示值 如果doNo为null - * 返回格式为{name, {display:'', value:''}} - * @return Map MAP格式:{name, {display:'', value:'', - * source:''}} name/ - */ - public Map bizObject2Map(BizObject bo, String doNo) { - Map map = new HashMap(); - DataElement[] aDataElements = bo.getAttributes(); - for (DataElement oDataElement : aDataElements) { - Map data = new HashMap(); - data.put("display", oDataElement.getLabel()); - data.put("value", oDataElement.getValue()); - if (null != doNo) - data.put( - "source", - getAweDoLibrarySource(doNo, oDataElement.getLabel(), - oDataElement.getName(), - oDataElement.getValue() == null ? "" - : oDataElement.getValue().toString())); - map.put(oDataElement.getName().toLowerCase(), data); - } - return map; - } - - /** - * BizObject 转 MAP value/ name 分别指定 DataElement的 getValue/ getName - * - * @param bo - * BizObject - * @return Map MAP格式:{name:'', value:''} - */ - public Map bizObject2MapValue(BizObject bo) { - Map map = new HashMap(); - DataElement[] aDataElements = bo.getAttributes(); - for (DataElement oDataElement : aDataElements) { - map.put(oDataElement.getName().toLowerCase(), - oDataElement.getValue()); - } - return map; - } - - @SuppressWarnings("unchecked") - private String getAweDoLibrarySource(String doNo, String label, - String name, String value) { - Map catalog = (Map) AppAweDoCache - .getAppAweDoCachePool().get(doNo); - List> library = (List>) catalog - .get("library"); - for (int i = 0; i < library.size(); i++) { - Map dataElement = library.get(i); - String sColName = dataElement.get("COLNAME".toLowerCase()) == null ? "" - : dataElement.get("COLNAME".toLowerCase()).toString(); - if (/* label.equals(sColHeader) && */name.toLowerCase().equals( - sColName.toLowerCase())) { - String sSourceType = dataElement.get("COLEDITSOURCETYPE" - .toLowerCase()) == null ? "" : dataElement.get( - "COLEDITSOURCETYPE".toLowerCase()).toString(); - if ("code".equalsIgnoreCase(sSourceType)) { - String sSource = dataElement.get("COLEDITSOURCE" - .toLowerCase()) == null ? "" : dataElement.get( - "COLEDITSOURCE".toLowerCase()).toString(); - return getCodeLibrayItemName(sSource, value); - } - break; - } - } - return value; - } - - @SuppressWarnings("unchecked") - private String getCodeLibrayItemName(String codeNo, String itemNo) { - if (itemNo.length() == 0) return ""; - Map catalog = (Map) AppCodeCache - .getAppCodeCachePool().get(codeNo); - List> library = (List>) catalog - .get("library"); - int iRecodeNum = -1; - String sItemName = ""; - for (int i = 0; i < library.size(); i++) { - Map elementSource = library.get(i); - if (itemNo.equals(elementSource.get("ITEMNO".toLowerCase()))) { - iRecodeNum = i; - sItemName = elementSource.get("ITEMNAME".toLowerCase()) == null ? "" - : elementSource.get("ITEMNAME".toLowerCase()) - .toString(); - } - } - if (iRecodeNum == -1) { - return "no source"; - } - return sItemName; - } -} +package com.base.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import apx.com.amarsoft.als.base.cache.instance.AppAweDoCache; +import apx.com.amarsoft.als.base.cache.instance.AppCodeCache; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.lang.DataElement; + +public class BizObjectUtil { + /** + * BizObject 转 MAP display/ value/ name 分别指定 DataElement的getLabel/ getValue/ + * getName source:字典表 + * + * @param bo + * BizObject + * @param doNo + * AweDOCatalog:dono 通过doNo查询字段source来源 从而获取字典表显示值 如果doNo为null + * 返回格式为{name, {display:'', value:''}} + * @return Map MAP格式:{name, {display:'', value:'', + * source:''}} name/ + */ + public List> bizObject2Map(BizObject bo, String doNo) { + List> list = new ArrayList>(); + DataElement[] aDataElements = bo.getAttributes(); + for (DataElement oDataElement : aDataElements) { + Map data = new HashMap(); + data.put("col", oDataElement); + list.add(data); +// data.put("display", oDataElement.getLabel()); +// data.put("value", oDataElement.getValue()); +// if (null != doNo) +// data.put( +// "source", +// getAweDoLibrarySource(doNo, oDataElement.getLabel(), +// oDataElement.getName(), +// oDataElement.getValue() == null ? "" +// : oDataElement.getValue().toString())); +// map.put(oDataElement.getName().toLowerCase(), data); + } + return list; + } + + /** + * BizObject 转 MAP value/ name 分别指定 DataElement的 getValue/ getName + * + * @param bo + * BizObject + * @return Map MAP格式:{name:'', value:''} + */ + public Map bizObject2MapValue(BizObject bo) { + if (null == bo) return new HashMap(); + Map map = new HashMap(); + DataElement[] aDataElements = bo.getAttributes(); + for (DataElement oDataElement : aDataElements) { + map.put(oDataElement.getName().toLowerCase(), + oDataElement.getValue()); + map.put(oDataElement.getName().toUpperCase(), + oDataElement.getValue()); + } + return map; + } + + public Map bizObject2MapValue3(BizObject bo) { + if (null == bo) return new HashMap(); + Map map = new HashMap(); + DataElement[] aDataElements = bo.getAttributes(); + for (DataElement oDataElement : aDataElements) { + map.put(oDataElement.getName().toLowerCase(), + oDataElement.getValue()); + } + return map; + } + + /** + * BizObject 转 MAP value/ name 分别指定 DataElement的 getValue/ getName + * + * @param bo + * BizObject + * @return Map MAP格式:{name:'', value:''} + */ + public Map bizObject2MapValue2(BizObject bo) { + if (null == bo) return new HashMap(); + Map map = new HashMap(); + DataElement[] aDataElements = bo.getAttributes(); + List> list = new ArrayList>(); + for (DataElement oDataElement : aDataElements) { + Map oDataElementMap = new HashMap(); + oDataElementMap.put("value", oDataElement.getValue()); + oDataElementMap.put("code", oDataElement.getName()); + oDataElementMap.put("display", oDataElement.getLabel()); + list.add(oDataElementMap); + } + map.put("dataElements", list); + return map; + } + + public Map bizObject2MapValue4(BizObject bo) { + if (null == bo) return new HashMap(); + Map map = new HashMap(); + DataElement[] aDataElements = bo.getAttributes(); + List> list = new ArrayList>(); + for (DataElement oDataElement : aDataElements) { + if (null == oDataElement.getValue()) continue; + Map oDataElementMap = new HashMap(); + oDataElementMap.put("value", oDataElement.getValue()); + oDataElementMap.put("code", oDataElement.getName()); + oDataElementMap.put("display", oDataElement.getLabel()); + list.add(oDataElementMap); + } + map.put("dataElements", list); + return map; + } + + @SuppressWarnings("unchecked") + private String getAweDoLibrarySource(String doNo, String label, + String name, String value) { + Map catalog = (Map) AppAweDoCache + .getAppAweDoCachePool().get(doNo); + List> library = (List>) catalog + .get("library"); + for (int i = 0; i < library.size(); i++) { + Map dataElement = library.get(i); + String sColName = dataElement.get("COLNAME".toLowerCase()) == null ? "" + : dataElement.get("COLNAME".toLowerCase()).toString(); + if (/* label.equals(sColHeader) && */name.toLowerCase().equals( + sColName.toLowerCase())) { + String sSourceType = dataElement.get("COLEDITSOURCETYPE" + .toLowerCase()) == null ? "" : dataElement.get( + "COLEDITSOURCETYPE".toLowerCase()).toString(); + if ("code".equalsIgnoreCase(sSourceType)) { + String sSource = dataElement.get("COLEDITSOURCE" + .toLowerCase()) == null ? "" : dataElement.get( + "COLEDITSOURCE".toLowerCase()).toString(); + return getCodeLibrayItemName(sSource, value); + } + break; + } + } + return value; + } + + @SuppressWarnings("unchecked") + private String getCodeLibrayItemName(String codeNo, String itemNo) { + if (itemNo.length() == 0) return ""; + Map catalog = (Map) AppCodeCache + .getAppCodeCachePool().get(codeNo); + List> library = (List>) catalog + .get("library"); + int iRecodeNum = -1; + String sItemName = ""; + for (int i = 0; i < library.size(); i++) { + Map elementSource = library.get(i); + if (itemNo.equals(elementSource.get("ITEMNO".toLowerCase()))) { + iRecodeNum = i; + sItemName = elementSource.get("ITEMNAME".toLowerCase()) == null ? "" + : elementSource.get("ITEMNAME".toLowerCase()) + .toString(); + } + } + if (iRecodeNum == -1) { + return "no source"; + } + return sItemName; + } +} diff --git a/src_app/cn/coyoteam/aweresf/util/ClassUtil.java b/src_app_fresh/com/base/util/ClassUtil.java similarity index 99% rename from src_app/cn/coyoteam/aweresf/util/ClassUtil.java rename to src_app_fresh/com/base/util/ClassUtil.java index 8a21e396e..c46f1b668 100644 --- a/src_app/cn/coyoteam/aweresf/util/ClassUtil.java +++ b/src_app_fresh/com/base/util/ClassUtil.java @@ -1,4 +1,4 @@ -package cn.coyoteam.aweresf.util; +package com.base.util; import java.io.File; import java.io.FileFilter; diff --git a/src_app_fresh/com/base/util/ContractDocUploadUtil.java b/src_app_fresh/com/base/util/ContractDocUploadUtil.java new file mode 100644 index 000000000..0ff4c3b3b --- /dev/null +++ b/src_app_fresh/com/base/util/ContractDocUploadUtil.java @@ -0,0 +1,475 @@ +//package com.base.util; +// +//import java.io.DataOutputStream; +//import java.io.File; +//import java.io.FileOutputStream; +//import java.io.InputStream; +//import java.net.URLDecoder; +//import java.util.Date; +//import java.util.List; +//import java.util.Map; +// +//import com.amarsoft.are.jbo.BizObject; +//import com.amarsoft.are.jbo.BizObjectManager; +//import com.amarsoft.are.jbo.BizObjectQuery; +//import com.amarsoft.are.jbo.JBOFactory; +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.are.util.SpecialTools; +//import com.amarsoft.are.util.StringFunction; +//import com.amarsoft.awe.Configure; +//import com.amarsoft.awe.util.Transaction; +//import com.amarsoft.context.ASUser; +//import com.base.constant.RestfullConstant; +// +//public class ContractDocUploadUtil { +// +// // 提前结清上传 +// public static Map adjustUpload( +// Map fieldMap, List> fileList, +// Transaction sqlca, JBOTransaction tx, String sObjectType, +// String sUserId, ReturnMapUtil ReturnMapUtil) throws Exception { +// ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), +// sqlca); +// String sCurDate = DateUtil.getSystemTimeByFormat(new Date(), +// "yyyy/MM/dd HH:mm:ss"); +// String sContractId = fieldMap.get("contract_id") == null ? "" +// : fieldMap.get("contract_id").toString(); // 合同编号 +// String sApplyld = fieldMap.get("flowunid") == null ? "" : fieldMap.get( +// "flowunid").toString(); // 中间表id +// for (Map map : fileList) { +// String sFileName, sFileContentType, sFileSize; +// sFileName = map.get("fileName") == null ? "" : map.get("fileName") +// .toString(); +// InputStream file = (InputStream) map.get("file"); +// sFileContentType = map.get("fileContentType") == null ? "" : map +// .get("fileContentType").toString(); +// sFileSize = map.get("fileSize") == null ? "" : map.get("fileSize") +// .toString(); +// BizObjectManager relaBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCRELATIVE"); +// BizObjectManager libBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); +// BizObjectManager attrBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); +// +// BizObject lib = null; +// +// String sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCRELATIVE rela on O.Relative_Id=rela.id where rela.contract_id=:contract_id and rela.objecttype=:objecttype and rela.flow_unid=:flow_unid"; +// +// BizObjectQuery query = libBm.createQuery(sql); +// query.setParameter("contract_id", sContractId); +// query.setParameter("objecttype", sObjectType); +// query.setParameter("flow_unid", sApplyld); +// lib = query.getSingleResult(true); +// +// String libraryId = ""; +// if (lib != null) { +// libBm.saveObject(lib); +// libraryId = lib.getAttribute("id").getString(); +// } else { +// sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCLIBRARY lib on O.id=lib.Relative_Id where O.contract_id=:contract_id and O.objecttype=:objecttype and O.flow_unid=:flow_unid"; +// query = relaBm.createQuery(sql); +// query.setParameter("contract_id", sContractId); +// query.setParameter("objecttype", sObjectType); +// query.setParameter("flow_unid", sApplyld); +// BizObject rela = query.getSingleResult(true); +// String relativeid = ""; +// if (rela == null) { +// // 初始化附件关联对象 +// rela = relaBm.newObject(); +// rela.setAttributeValue("ObjectType", sObjectType); +// rela.setAttributeValue("contract_id", sContractId); +// rela.setAttributeValue("flow_unid", sApplyld); +// relaBm.saveObject(rela); +// relativeid = rela.getAttribute("id").getString(); +// } else { +// relativeid = rela.getAttribute("id").getString(); +// } +// // 初始化附件 +// lib = libBm.newObject(); +// lib.setAttributeValue("Relative_Id", relativeid); +// libBm.saveObject(lib); +// libraryId = lib.getAttribute("id").getString(); +// } +// BizObject attr = attrBm.newObject(); +// attr.setAttributeValue("Library_Id", libraryId); +// attr.setAttributeValue("FileName", sFileName); +// attr.setAttributeValue("InputUserId", oCurUser.getUserID()); +// attr.setAttributeValue("InputOrgId", oCurUser.getOrgID()); +// attr.setAttributeValue("InputTime", sCurDate); +// attr.setAttributeValue("ObjectType", sObjectType); +// +// @SuppressWarnings("deprecation") +// Configure CurConfig = Configure.getInstance(); +// String sFileSavePath = CurConfig.getConfigure("FileSavePath"); +// +// String uuid = java.util.UUID.randomUUID().toString() +// .replaceAll("-", ""); +// String sFullPath = com.tenwa.officetempalte.util.FileOperatorUtil +// .getuploadFileDir(sFileSavePath) + uuid + "_" + sFileName; +// +// String sFilePath = sFullPath.replace(sFileSavePath, ""); +// +// attr.setAttributeValue("FilePath", sFilePath); +// attr.setAttributeValue("FullPath", sFullPath); +// attr.setAttributeValue("Content_Type", sFileContentType); +// attr.setAttributeValue("FileSize", sFileSize); +// attrBm.saveObject(attr); +// +// File f = new File(sFullPath); +// DataOutputStream fileout = new DataOutputStream( +// new FileOutputStream(f)); +// byte b[] = new byte[Integer.valueOf(sFileSize)]; +// @SuppressWarnings("unused") +// int i = file.read(b, 0, Integer.valueOf(sFileSize) - 1); +// fileout.write(b, 0, b.length); // 将文件数据存盘 +// fileout.close(); +// } +// tx.commit(); +// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty +// .get("SUCCESS") == null ? "SUCCESS" +// : RestfullConstant.baseProperty.get("SUCCESS").toString(), +// "上传成功!"); +// return ReturnMapUtil.getReturnMap(); +// } +// +// // 账号变更上传 +// public static Map contractUpload( +// Map fieldMap, List> fileList, +// Transaction sqlca, JBOTransaction tx, String sObjectType, +// String sUserId, ReturnMapUtil ReturnMapUtil) throws Exception { +// ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), +// sqlca); +// String sCurDate = DateUtil.getSystemTimeByFormat(new Date(), +// "yyyy/MM/dd HH:mm:ss"); +// String sContractId = fieldMap.get("id") == null ? "" : fieldMap.get( +// "id").toString(); // 合同编号 +// for (Map map : fileList) { +// String sFileName, sFileContentType, sFileSize; +// sFileName = map.get("fileName") == null ? "" : map.get("fileName") +// .toString(); +// InputStream file = (InputStream) map.get("file"); +// sFileContentType = map.get("fileContentType") == null ? "" : map +// .get("fileContentType").toString(); +// sFileSize = map.get("fileSize") == null ? "" : map.get("fileSize") +// .toString(); +// BizObjectManager relaBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCRELATIVE"); +// BizObjectManager libBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); +// BizObjectManager attrBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); +// +// BizObject lib = null; +// String sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCRELATIVE rela on O.Relative_Id=rela.id where rela.contract_id=:contractId and rela.objecttype=:objecttype "; +// BizObjectQuery query = libBm.createQuery(sql); +// query.setParameter("contractId", sContractId); +// query.setParameter("objecttype", sObjectType); +// lib = query.getSingleResult(true); +// String libraryId = ""; +// if (lib != null) { +// libBm.saveObject(lib); +// libraryId = lib.getAttribute("id").getString(); +// } else { +// sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCLIBRARY lib on O.id=lib.Relative_Id where O.contract_id=:contractId and O.objecttype=:objecttype "; +// query = relaBm.createQuery(sql); +// query.setParameter("contractId", sContractId); +// query.setParameter("objecttype", sObjectType); +// BizObject rela = query.getSingleResult(true); +// String relativeid = ""; +// if (rela == null) { +// // 初始化附件关联对象 +// rela = relaBm.newObject(); +// rela.setAttributeValue("ObjectType", sObjectType); +// rela.setAttributeValue("contract_id", sContractId); +// relaBm.saveObject(rela); +// relativeid = rela.getAttribute("id").getString(); +// } +// // 初始化附件 +// lib = libBm.newObject(); +// lib.setAttributeValue("Relative_Id", relativeid); +// libBm.saveObject(lib); +// libraryId = lib.getAttribute("id").getString(); +// } +// +// BizObject attr = attrBm.createQuery( +// "library_id='" + libraryId + "'").getSingleResult(true); +// if (attr == null) { +// attr = attrBm.newObject(); +// } +// attr.setAttributeValue("Library_Id", libraryId); +// attr.setAttributeValue("FileName", sFileName); +// attr.setAttributeValue("InputUserId", oCurUser.getUserID()); +// attr.setAttributeValue("InputOrgId", oCurUser.getOrgID()); +// attr.setAttributeValue("InputTime", sCurDate); +// attr.setAttributeValue("ObjectType", sObjectType); +// +// @SuppressWarnings("deprecation") +// Configure CurConfig = Configure.getInstance(); +// String sFileSavePath = CurConfig.getConfigure("FileSavePath"); +// +// String uuid = java.util.UUID.randomUUID().toString() +// .replaceAll("-", ""); +// String sFullPath = com.tenwa.officetempalte.util.FileOperatorUtil +// .getuploadFileDir(sFileSavePath) + uuid + "_" + sFileName; +// +// String sFilePath = sFullPath.replace(sFileSavePath, ""); +// attr.setAttributeValue("FilePath", sFilePath); +// attr.setAttributeValue("FullPath", sFullPath); +// attr.setAttributeValue("Content_Type", sFileContentType); +// attr.setAttributeValue("FileSize", sFileSize); +// attrBm.saveObject(attr); +// +// File f = new File(sFullPath); +// DataOutputStream fileout = new DataOutputStream( +// new FileOutputStream(f)); +// byte b[] = new byte[Integer.valueOf(sFileSize)]; +// @SuppressWarnings("unused") +// int i = file.read(b, 0, Integer.valueOf(sFileSize) - 1); +// fileout.write(b, 0, b.length); // 将文件数据存盘 +// fileout.close(); +// } +// tx.commit(); +// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty +// .get("SUCCESS") == null ? "SUCCESS" +// : RestfullConstant.baseProperty.get("SUCCESS").toString(), +// "上传成功!"); +// return ReturnMapUtil.getReturnMap(); +// } +// +// // 合同签约上传 +// public static Map contractDocUpload( +// Map fieldMap, List> fileList, +// Transaction sqlca, JBOTransaction tx, String sObjectType, +// String sUserId, ReturnMapUtil ReturnMapUtil) throws Exception { +// ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), +// sqlca); +// String sCurDate = DateUtil.getSystemTimeByFormat(new Date(), +// "yyyy/MM/dd HH:mm:ss"); +// String sLibraryId = fieldMap.get("library_id") == null ? "" : fieldMap +// .get("library_id").toString(); +// +// for (Map map : fileList) { +// BizObjectManager libBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); +// BizObjectManager attrBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); +// +// BizObjectQuery query = libBm.createQuery("ID=:ID").setParameter( +// "ID", sLibraryId); +// BizObject lib = query.getSingleResult(true); +// lib.setAttributeValue("Remark", fieldMap.get("remark")); +// libBm.saveObject(lib); +// +// String sFileName, sFileContentType, sFileSize; +// sFileName = map.get("fileName") == null ? "" : map.get("fileName") +// .toString(); +// InputStream file = (InputStream) map.get("file"); +// sFileContentType = map.get("fileContentType") == null ? "" : map +// .get("fileContentType").toString(); +// sFileSize = map.get("fileSize") == null ? "" : map.get("fileSize") +// .toString(); +// +// BizObject attr = attrBm.newObject(); +// +// attr.setAttributeValue("Library_Id", sLibraryId); +// attr.setAttributeValue("FileName", sFileName); +// attr.setAttributeValue("InputUserId", oCurUser.getUserID()); +// attr.setAttributeValue("InputOrgId", oCurUser.getOrgID()); +// attr.setAttributeValue("InputTime", sCurDate); +// attr.setAttributeValue("objectType", sObjectType); +// if (null != fieldMap.get("channelapplyid")) { +// attr.setAttributeValue("APPLY_ID", +// fieldMap.get("channelapplyid")); +// } +// +// // 得到不带路径的文件名 +// sFileName = StringFunction.getFileName(sFileName); +// sFileName = URLDecoder.decode( +// URLDecoder.decode(sFileName, "UTF-8"), "UTF-8"); +// // 取得真实的表名 +// // String sAttachmentNo = DBKeyHelp.getSerialNo(trueTable, "Id"); +// +// // 得到不带路径的文件名 +// sFileName = StringFunction.getFileName(sFileName); +// sFileName = URLDecoder.decode( +// URLDecoder.decode(sFileName, "UTF-8"), "UTF-8"); +// // 定义数据库操作变量 +// // 获取配置文件的参数 +// @SuppressWarnings("deprecation") +// Configure CurConfig = Configure.getInstance(); +// String sFileSavePath = CurConfig.getConfigure("FileSavePath"); +// +// String uuid = java.util.UUID.randomUUID().toString() +// .replaceAll("-", ""); +// String sFullPath = com.tenwa.officetempalte.util.FileOperatorUtil +// .getuploadFileDir(sFileSavePath) + uuid + "_" + sFileName; +// +// String sFilePath = sFullPath.replace(sFileSavePath, ""); +// attr.setAttributeValue("FilePath", sFilePath); +// attr.setAttributeValue("FullPath", sFullPath); +// attr.setAttributeValue("Content_Type", sFileContentType); +// attr.setAttributeValue("FileSize", sFileSize); +// attrBm.saveObject(attr); +// File f = new File(sFullPath); +// DataOutputStream fileout = new DataOutputStream( +// new FileOutputStream(f)); +// byte b[] = new byte[Integer.valueOf(sFileSize)]; +// @SuppressWarnings("unused") +// int i = file.read(b, 0, Integer.valueOf(sFileSize) - 1); +// fileout.write(b, 0, b.length); // 将文件数据存盘 +// fileout.close(); +// } +// +// tx.commit(); +// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty +// .get("SUCCESS") == null ? "SUCCESS" +// : RestfullConstant.baseProperty.get("SUCCESS").toString(), +// "上传成功!"); +// return ReturnMapUtil.getReturnMap(); +// } +//// +//// // 客户变更上传营业执照 +//// public static Map companyBusinessLicenseDocUpload( +//// Map fieldMap, List> fileList, +//// Transaction sqlca, JBOTransaction tx, String sObjectType, +//// String sUserId, ReturnMapUtil ReturnMapUtil) throws Exception { +//// ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), +//// sqlca); +//// String sCurDate = DateUtil.getSystemTimeByFormat(new Date(), +//// "yyyy/MM/dd HH:mm:ss"); +//// String sCustomerId = fieldMap.get("customerid") == null ? "" : fieldMap +//// .get("customerid").toString(); +//// +//// BizObjectManager custManage = JBOFactory +//// .getBizObjectManager(CUSTOMER_INFO.CLASS_NAME); +//// BizObject cust = custManage.createQuery("customerid=:customerid") +//// .setParameter("customerid", sCustomerId).getSingleResult(false); +//// if (null == cust) { +//// ReturnMapUtil.setReturnMap(null, +//// RestfullConstant.baseProperty.get("FAIL").toString(), +//// "客户无效!"); +//// return ReturnMapUtil.getReturnMap(); +//// } +//// String sCustomerType = cust.getAttribute("customertype").toString(); +//// if ("03".equals(sCustomerType)) +//// sObjectType = "CustomerPersonChange"; +//// JBOTransaction tx1 = JBOFactory.createJBOTransaction(); +//// JBOTransaction tx2 = JBOFactory.createJBOTransaction(); +//// JBOTransaction tx3 = JBOFactory.createJBOTransaction(); +//// BizObjectManager libBm = JBOFactory +//// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); +//// tx1.join(libBm); +//// String sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCRELATIVE rela on O.Relative_Id=rela.id where rela.cust_id=:cust_id and rela.objecttype=:objecttype "; +//// BizObjectQuery query = libBm.createQuery(sql); +//// query.setParameter("cust_id", sCustomerId); +//// query.setParameter("objecttype", sObjectType); +//// BizObject lib = query.getSingleResult(true); +//// String libraryId = ""; +//// if (null == lib) { +//// BizObjectManager relaBm = JBOFactory +//// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCRELATIVE"); +//// tx2.join(relaBm); +//// sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCLIBRARY lib on O.id=lib.Relative_Id where O.cust_id=:cust_id and O.objecttype=:objecttype "; +//// query = relaBm.createQuery(sql); +//// query.setParameter("cust_id", sCustomerId); +//// query.setParameter("objecttype", sObjectType); +//// BizObject rela = query.getSingleResult(true); +//// String relativeid = ""; +//// if (rela == null) { +//// // 初始化附件关联对象 +//// rela = relaBm.newObject(); +//// rela.setAttributeValue("ObjectType", sObjectType); +//// rela.setAttributeValue("cust_id", sCustomerId); +//// relaBm.saveObject(rela); +//// relativeid = rela.getAttribute("id").getString(); +//// tx2.commit(); +//// } else { +//// relativeid = rela.getAttribute("id").getString(); +//// } +//// // 初始化附件 +//// lib = libBm.newObject(); +//// lib.setAttributeValue("Relative_Id", relativeid); +//// libBm.saveObject(lib); +//// tx1.commit(); +//// libraryId = lib.getAttribute("id").getString(); +//// } else { +//// libraryId = lib.getAttribute("id").getString(); +//// } +//// BizObjectManager attrBm = JBOFactory +//// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); +//// tx3.join(attrBm); +//// if ("03".equals(sCustomerType)) { +////// attrBm.createQuery( +////// "UPDATE O SET STATUS=1 WHERE LIBRARY_ID=:LIBRARY_ID") +////// .setParameter("LIBRARY_ID", libraryId).executeUpdate(); +//// attrBm.createQuery( +//// "UPDATE O SET STATUS=1 WHERE LIBRARY_ID=:LIBRARY_ID") +//// .setParameter("LIBRARY_ID", libraryId).executeUpdate(); +//// tx3.commit(); +//// } +//// +//// for (Map map : fileList) { +//// String sFileName, sFileContentType, sFileSize; +//// sFileName = map.get("fileName") == null ? "" : map.get("fileName") +//// .toString(); +//// InputStream file = (InputStream) map.get("file"); +//// sFileContentType = map.get("fileContentType") == null ? "" : map +//// .get("fileContentType").toString(); +//// sFileSize = map.get("fileSize") == null ? "" : map.get("fileSize") +//// .toString(); +//// BizObject attr = attrBm.newObject(); +//// attr.setAttributeValue("Library_Id", libraryId); +//// attr.setAttributeValue("FileName", sFileName); +//// attr.setAttributeValue("InputUserId", oCurUser.getUserID()); +//// attr.setAttributeValue("InputOrgId", oCurUser.getOrgID()); +//// attr.setAttributeValue("InputTime", sCurDate); +//// attr.setAttributeValue("objectType", sObjectType); +//// // attr.setAttributeValue("STATUS", 1); +//// +//// // 得到不带路径的文件名 +//// sFileName = StringFunction.getFileName(sFileName); +//// sFileName = URLDecoder.decode( +//// URLDecoder.decode(sFileName, "UTF-8"), "UTF-8"); +//// // 取得真实的表名 +//// // String sAttachmentNo = DBKeyHelp.getSerialNo(trueTable, "Id"); +//// +//// // 得到不带路径的文件名 +//// sFileName = StringFunction.getFileName(sFileName); +//// sFileName = URLDecoder.decode( +//// URLDecoder.decode(sFileName, "UTF-8"), "UTF-8"); +//// // 定义数据库操作变量 +//// // 获取配置文件的参数 +//// @SuppressWarnings("deprecation") +//// Configure CurConfig = Configure.getInstance(); +//// String sFileSavePath = CurConfig.getConfigure("FileSavePath"); +//// +//// String uuid = java.util.UUID.randomUUID().toString() +//// .replaceAll("-", ""); +//// String sFullPath = com.tenwa.officetempalte.util.FileOperatorUtil +//// .getuploadFileDir(sFileSavePath) + uuid + "_" + sFileName; +//// +//// String sFilePath = sFullPath.replace(sFileSavePath, ""); +//// attr.setAttributeValue("FilePath", sFilePath); +//// attr.setAttributeValue("FullPath", sFullPath); +//// attr.setAttributeValue("Content_Type", sFileContentType); +//// attr.setAttributeValue("FileSize", sFileSize); +//// attrBm.saveObject(attr); +//// tx3.commit(); +//// File f = new File(sFullPath); +//// DataOutputStream fileout = new DataOutputStream( +//// new FileOutputStream(f)); +//// byte b[] = new byte[Integer.valueOf(sFileSize)]; +//// @SuppressWarnings("unused") +//// int i = file.read(b, 0, Integer.valueOf(sFileSize) - 1); +//// fileout.write(b, 0, b.length); // 将文件数据存盘 +//// fileout.close(); +//// } +//// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(); +//// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty +//// .get("SUCCESS") == null ? "SUCCESS" +//// : RestfullConstant.baseProperty.get("SUCCESS").toString(), +//// "上传成功!"); +//// return ReturnMapUtil.getReturnMap(); +//// } +//} diff --git a/src_app_fresh/com/base/util/DES.java b/src_app_fresh/com/base/util/DES.java new file mode 100644 index 000000000..fa61eeb21 --- /dev/null +++ b/src_app_fresh/com/base/util/DES.java @@ -0,0 +1,1076 @@ +package com.base.util; + +import java.util.ArrayList; +import java.util.List; + +import com.base.constant.RestfullConstant; + +/** + * DES服务端的处理,和des.js配合使用 + * + * @author EX-YANGSONG001 + * + */ +@SuppressWarnings({ "unused", "unchecked", "rawtypes" }) +public class DES { + + public static void main(String[] args) { + System.out.println(DES.encrypt("000000als")); + } + /** + * 加密 + * + * @param data + * @param sKeyOne + * @param sKeyTwo + * @param sKeyThree + * @return + */ + public static String encrypt(String data) { +// String sKeyOne = "0123456789abc"; +// String sKeyTwo ="1234567890abc"; +// String sKeyThree = "1234567890!@#"; + + String sKeyOne = (String) RestfullConstant.baseProperty + .get("DES_SECRET_KEY_ONE"); + String sKeyTwo = (String) RestfullConstant.baseProperty + .get("DES_SECRET_KEY_TWO"); + String sKeyThree = (String) RestfullConstant.baseProperty + .get("DES_SECRET_KEY_THREE"); + int leng = data.length(); + String encData = ""; + List sKeyOneBt = null, sKeyTwoBt = null, sKeyThreeBt = null; + int firstLength = 0, secondLength = 0, thirdLength = 0; + if (sKeyOne != null && sKeyOne != "") { + sKeyOneBt = getKeyBytes(sKeyOne); + firstLength = sKeyOneBt.size(); + } + if (sKeyTwo != null && sKeyTwo != "") { + sKeyTwoBt = getKeyBytes(sKeyTwo); + secondLength = sKeyTwoBt.size(); + } + if (sKeyThree != null && sKeyThree != "") { + sKeyThreeBt = getKeyBytes(sKeyThree); + thirdLength = sKeyThreeBt.size(); + } + + if (leng > 0) { + if (leng < 4) { + int[] bt = strToBt(data); + int[] encByte = null; + if (sKeyOne != null && sKeyOne != "" && sKeyTwo != null + && sKeyTwo != "" && sKeyThree != null + && sKeyThree != "") { + int[] tempBt; + int x, y, z; + tempBt = bt; + for (x = 0; x < firstLength; x++) { + tempBt = enc(tempBt, (int[]) sKeyOneBt.get(x)); + } + for (y = 0; y < secondLength; y++) { + tempBt = enc(tempBt, (int[]) sKeyTwoBt.get(y)); + } + for (z = 0; z < thirdLength; z++) { + tempBt = enc(tempBt, (int[]) sKeyThreeBt.get(z)); + } + encByte = tempBt; + } else { + if (sKeyOne != null && sKeyOne != "" && sKeyTwo != null + && sKeyTwo != "") { + int[] tempBt; + int x, y; + tempBt = bt; + for (x = 0; x < firstLength; x++) { + tempBt = enc(tempBt, (int[]) sKeyOneBt.get(x)); + } + for (y = 0; y < secondLength; y++) { + tempBt = enc(tempBt, (int[]) sKeyTwoBt.get(y)); + } + encByte = tempBt; + } else { + if (sKeyOne != null && sKeyOne != "") { + int[] tempBt; + int x = 0; + tempBt = bt; + for (x = 0; x < firstLength; x++) { + tempBt = enc(tempBt, (int[]) sKeyOneBt.get(x)); + } + encByte = tempBt; + } + } + } + encData = bt64ToHex(encByte); + } else { + int iterator = (leng / 4); + int remainder = leng % 4; + int i = 0; + for (i = 0; i < iterator; i++) { + String tempData = data.substring(i * 4 + 0, i * 4 + 4); + int[] tempByte = strToBt(tempData); + int[] encByte = null; + if (sKeyOne != null && sKeyOne != "" && sKeyTwo != null + && sKeyTwo != "" && sKeyThree != null + && sKeyThree != "") { + int[] tempBt; + int x, y, z; + tempBt = tempByte; + for (x = 0; x < firstLength; x++) { + tempBt = enc(tempBt, (int[]) sKeyOneBt.get(x)); + } + for (y = 0; y < secondLength; y++) { + tempBt = enc(tempBt, (int[]) sKeyTwoBt.get(y)); + } + for (z = 0; z < thirdLength; z++) { + tempBt = enc(tempBt, (int[]) sKeyThreeBt.get(z)); + } + encByte = tempBt; + } else { + if (sKeyOne != null && sKeyOne != "" && sKeyTwo != null + && sKeyTwo != "") { + int[] tempBt; + int x, y; + tempBt = tempByte; + for (x = 0; x < firstLength; x++) { + tempBt = enc(tempBt, (int[]) sKeyOneBt.get(x)); + } + for (y = 0; y < secondLength; y++) { + tempBt = enc(tempBt, (int[]) sKeyTwoBt.get(y)); + } + encByte = tempBt; + } else { + if (sKeyOne != null && sKeyOne != "") { + int[] tempBt; + int x; + tempBt = tempByte; + for (x = 0; x < firstLength; x++) { + tempBt = enc(tempBt, + (int[]) sKeyOneBt.get(x)); + } + encByte = tempBt; + } + } + } + encData += bt64ToHex(encByte); + } + if (remainder > 0) { + String remainderData = data.substring(iterator * 4 + 0, + leng); + int[] tempByte = strToBt(remainderData); + int[] encByte = null; + if (sKeyOne != null && sKeyOne != "" && sKeyTwo != null + && sKeyTwo != "" && sKeyThree != null + && sKeyThree != "") { + int[] tempBt; + int x, y, z; + tempBt = tempByte; + for (x = 0; x < firstLength; x++) { + tempBt = enc(tempBt, (int[]) sKeyOneBt.get(x)); + } + for (y = 0; y < secondLength; y++) { + tempBt = enc(tempBt, (int[]) sKeyTwoBt.get(y)); + } + for (z = 0; z < thirdLength; z++) { + tempBt = enc(tempBt, (int[]) sKeyThreeBt.get(z)); + } + encByte = tempBt; + } else { + if (sKeyOne != null && sKeyOne != "" && sKeyTwo != null + && sKeyTwo != "") { + int[] tempBt; + int x, y; + tempBt = tempByte; + for (x = 0; x < firstLength; x++) { + tempBt = enc(tempBt, (int[]) sKeyOneBt.get(x)); + } + for (y = 0; y < secondLength; y++) { + tempBt = enc(tempBt, (int[]) sKeyTwoBt.get(y)); + } + encByte = tempBt; + } else { + if (sKeyOne != null && sKeyOne != "") { + int[] tempBt; + int x; + tempBt = tempByte; + for (x = 0; x < firstLength; x++) { + tempBt = enc(tempBt, + (int[]) sKeyOneBt.get(x)); + } + encByte = tempBt; + } + } + } + encData += bt64ToHex(encByte); + } + } + } + return encData; + } + + /* + * decrypt the encrypted string to the original string + * + * return the original string + */ + public static String decrypt(String data) { + String sKeyOne, sKeyTwo, sKeyThree; + sKeyOne = (String) RestfullConstant.baseProperty + .get("DES_SECRET_KEY_ONE"); + sKeyTwo = (String) RestfullConstant.baseProperty + .get("DES_SECRET_KEY_TWO"); + sKeyThree = (String) RestfullConstant.baseProperty + .get("DES_SECRET_KEY_THREE"); + int leng = data.length(); + String decStr = ""; + List sKeyOneBt = null, sKeyTwoBt = null, sKeyThreeBt = null; + int firstLength = 0, secondLength = 0, thirdLength = 0; + if (sKeyOne != null && sKeyOne != "") { + sKeyOneBt = getKeyBytes(sKeyOne); + firstLength = sKeyOneBt.size(); + } + if (sKeyTwo != null && sKeyTwo != "") { + sKeyTwoBt = getKeyBytes(sKeyTwo); + secondLength = sKeyTwoBt.size(); + } + if (sKeyThree != null && sKeyThree != "") { + sKeyThreeBt = getKeyBytes(sKeyThree); + thirdLength = sKeyThreeBt.size(); + } + + int iterator = leng / 16; + int i = 0; + for (i = 0; i < iterator; i++) { + String tempData = data.substring(i * 16 + 0, i * 16 + 16); + String strByte = hexToBt64(tempData); + int[] intByte = new int[64]; + int j = 0; + for (j = 0; j < 64; j++) { + intByte[j] = Integer.parseInt(strByte.substring(j, j + 1)); + } + int[] decByte = null; + if (sKeyOne != null && sKeyOne != "" && sKeyTwo != null + && sKeyTwo != "" && sKeyThree != null && sKeyThree != "") { + int[] tempBt; + int x, y, z; + tempBt = intByte; + for (x = thirdLength - 1; x >= 0; x--) { + tempBt = dec(tempBt, (int[]) sKeyThreeBt.get(x)); + } + for (y = secondLength - 1; y >= 0; y--) { + tempBt = dec(tempBt, (int[]) sKeyTwoBt.get(y)); + } + for (z = firstLength - 1; z >= 0; z--) { + tempBt = dec(tempBt, (int[]) sKeyOneBt.get(z)); + } + decByte = tempBt; + } else { + if (sKeyOne != null && sKeyOne != "" && sKeyTwo != null + && sKeyTwo != "") { + int[] tempBt; + int x, y, z; + tempBt = intByte; + for (x = secondLength - 1; x >= 0; x--) { + tempBt = dec(tempBt, (int[]) sKeyTwoBt.get(x)); + } + for (y = firstLength - 1; y >= 0; y--) { + tempBt = dec(tempBt, (int[]) sKeyOneBt.get(y)); + } + decByte = tempBt; + } else { + if (sKeyOne != null && sKeyOne != "") { + int[] tempBt; + int x, y, z; + tempBt = intByte; + for (x = firstLength - 1; x >= 0; x--) { + tempBt = dec(tempBt, (int[]) sKeyOneBt.get(x)); + } + decByte = tempBt; + } + } + } + decStr += byteToString(decByte); + } + return decStr; + } + + /* + * chang the string into the bit array + * + * return bit array(it's length % 64 = 0) + */ + + private static List getKeyBytes(String key) { + List keyBytes = new ArrayList(); + int leng = key.length(); + int iterator = (leng / 4); + int remainder = leng % 4; + int i = 0; + for (i = 0; i < iterator; i++) { + keyBytes.add(i, strToBt(key.substring(i * 4 + 0, i * 4 + 4))); + } + if (remainder > 0) { + // keyBytes[i] = strToBt(key.substring(i*4+0,leng)); + keyBytes.add(i, strToBt(key.substring(i * 4 + 0, leng))); + } + return keyBytes; + } + + /* + * chang the string(it's length <= 4) into the bit array + * + * return bit array(it's length = 64) + */ + private static int[] strToBt(String str) { + int leng = str.length(); + int[] bt = new int[64]; + if (leng < 4) { + int i = 0, j = 0, p = 0, q = 0; + for (i = 0; i < leng; i++) { + int k = str.charAt(i); + for (j = 0; j < 16; j++) { + int pow = 1, m = 0; + for (m = 15; m > j; m--) { + pow *= 2; + } + // bt.set(16*i+j,""+(k/pow)%2)); + bt[16 * i + j] = (k / pow) % 2; + } + } + for (p = leng; p < 4; p++) { + int k = 0; + for (q = 0; q < 16; q++) { + int pow = 1, m = 0; + for (m = 15; m > q; m--) { + pow *= 2; + } + // bt[16*p+q]=parseInt(k/pow)%2; + // bt.add(16*p+q,""+((k/pow)%2)); + bt[16 * p + q] = (k / pow) % 2; + } + } + } else { + for (int i = 0; i < 4; i++) { + int k = str.charAt(i); + for (int j = 0; j < 16; j++) { + int pow = 1; + for (int m = 15; m > j; m--) { + pow *= 2; + } + // bt[16*i+j]=parseInt(k/pow)%2; + // bt.add(16*i+j,""+((k/pow)%2)); + bt[16 * i + j] = (k / pow) % 2; + } + } + } + return bt; + } + + /* + * chang the bit(it's length = 4) into the hex + * + * return hex + */ + private static String bt4ToHex(String binary) { + String hex = ""; + if (binary.equalsIgnoreCase("0000")) { + hex = "0"; + } else if (binary.equalsIgnoreCase("0001")) { + hex = "1"; + } else if (binary.equalsIgnoreCase("0010")) { + hex = "2"; + } else if (binary.equalsIgnoreCase("0011")) { + hex = "3"; + } else if (binary.equalsIgnoreCase("0100")) { + hex = "4"; + } else if (binary.equalsIgnoreCase("0101")) { + hex = "5"; + } else if (binary.equalsIgnoreCase("0110")) { + hex = "6"; + } else if (binary.equalsIgnoreCase("0111")) { + hex = "7"; + } else if (binary.equalsIgnoreCase("1000")) { + hex = "8"; + } else if (binary.equalsIgnoreCase("1001")) { + hex = "9"; + } else if (binary.equalsIgnoreCase("1010")) { + hex = "A"; + } else if (binary.equalsIgnoreCase("1011")) { + hex = "B"; + } else if (binary.equalsIgnoreCase("1100")) { + hex = "C"; + } else if (binary.equalsIgnoreCase("1101")) { + hex = "D"; + } else if (binary.equalsIgnoreCase("1110")) { + hex = "E"; + } else if (binary.equalsIgnoreCase("1111")) { + hex = "F"; + } + + return hex; + } + + /* + * chang the hex into the bit(it's length = 4) + * + * return the bit(it's length = 4) + */ + private static String hexToBt4(String hex) { + String binary = ""; + if (hex.equalsIgnoreCase("0")) { + binary = "0000"; + } else if (hex.equalsIgnoreCase("1")) { + binary = "0001"; + } + if (hex.equalsIgnoreCase("2")) { + binary = "0010"; + } + if (hex.equalsIgnoreCase("3")) { + binary = "0011"; + } + if (hex.equalsIgnoreCase("4")) { + binary = "0100"; + } + if (hex.equalsIgnoreCase("5")) { + binary = "0101"; + } + if (hex.equalsIgnoreCase("6")) { + binary = "0110"; + } + if (hex.equalsIgnoreCase("7")) { + binary = "0111"; + } + if (hex.equalsIgnoreCase("8")) { + binary = "1000"; + } + if (hex.equalsIgnoreCase("9")) { + binary = "1001"; + } + if (hex.equalsIgnoreCase("A")) { + binary = "1010"; + } + if (hex.equalsIgnoreCase("B")) { + binary = "1011"; + } + if (hex.equalsIgnoreCase("C")) { + binary = "1100"; + } + if (hex.equalsIgnoreCase("D")) { + binary = "1101"; + } + if (hex.equalsIgnoreCase("E")) { + binary = "1110"; + } + if (hex.equalsIgnoreCase("F")) { + binary = "1111"; + } + return binary; + } + + /* + * chang the bit(it's length = 64) into the string + * + * return string + */ + private static String byteToString(int[] byteData) { + String str = ""; + for (int i = 0; i < 4; i++) { + int count = 0; + for (int j = 0; j < 16; j++) { + int pow = 1; + for (int m = 15; m > j; m--) { + pow *= 2; + } + count += byteData[16 * i + j] * pow; + } + if (count != 0) { + str += "" + (char) (count); + } + } + return str; + } + + private static String bt64ToHex(int[] byteData) { + String hex = ""; + for (int i = 0; i < 16; i++) { + String bt = ""; + for (int j = 0; j < 4; j++) { + bt += byteData[i * 4 + j]; + } + hex += bt4ToHex(bt); + } + return hex; + } + + private static String hexToBt64(String hex) { + String binary = ""; + for (int i = 0; i < 16; i++) { + binary += hexToBt4(hex.substring(i, i + 1)); + } + return binary; + } + + /* + * the 64 bit des core arithmetic + */ + + private static int[] enc(int[] dataByte, int[] keyByte) { + int[][] keys = generateKeys(keyByte); + int[] ipByte = initPermute(dataByte); + int[] ipLeft = new int[32]; + int[] ipRight = new int[32]; + int[] tempLeft = new int[32]; + int i = 0, j = 0, k = 0, m = 0, n = 0; + for (k = 0; k < 32; k++) { + ipLeft[k] = ipByte[k]; + ipRight[k] = ipByte[32 + k]; + } + for (i = 0; i < 16; i++) { + for (j = 0; j < 32; j++) { + tempLeft[j] = ipLeft[j]; + ipLeft[j] = ipRight[j]; + } + int[] key = new int[48]; + for (m = 0; m < 48; m++) { + key[m] = keys[i][m]; + } + int[] tempRight = xor( + pPermute(sBoxPermute(xor(expandPermute(ipRight), key))), + tempLeft); + for (n = 0; n < 32; n++) { + ipRight[n] = tempRight[n]; + } + + } + + int[] finalData = new int[64]; + for (i = 0; i < 32; i++) { + finalData[i] = ipRight[i]; + finalData[32 + i] = ipLeft[i]; + } + return finallyPermute(finalData); + } + + private static int[] dec(int[] dataByte, int[] keyByte) { + int[][] keys = generateKeys(keyByte); + int[] ipByte = initPermute(dataByte); + int[] ipLeft = new int[32]; + int[] ipRight = new int[32]; + int[] tempLeft = new int[32]; + int i = 0, j = 0, k = 0, m = 0, n = 0; + for (k = 0; k < 32; k++) { + ipLeft[k] = ipByte[k]; + ipRight[k] = ipByte[32 + k]; + } + for (i = 15; i >= 0; i--) { + for (j = 0; j < 32; j++) { + tempLeft[j] = ipLeft[j]; + ipLeft[j] = ipRight[j]; + } + int[] key = new int[48]; + for (m = 0; m < 48; m++) { + key[m] = keys[i][m]; + } + + int[] tempRight = xor( + pPermute(sBoxPermute(xor(expandPermute(ipRight), key))), + tempLeft); + for (n = 0; n < 32; n++) { + ipRight[n] = tempRight[n]; + } + } + + int[] finalData = new int[64]; + for (i = 0; i < 32; i++) { + finalData[i] = ipRight[i]; + finalData[32 + i] = ipLeft[i]; + } + return finallyPermute(finalData); + } + + private static int[] initPermute(int[] originalData) { + int[] ipByte = new int[64]; + int i = 0, m = 1, n = 0, j, k; + for (i = 0, m = 1, n = 0; i < 4; i++, m += 2, n += 2) { + for (j = 7, k = 0; j >= 0; j--, k++) { + ipByte[i * 8 + k] = originalData[j * 8 + m]; + ipByte[i * 8 + k + 32] = originalData[j * 8 + n]; + } + } + return ipByte; + } + + private static int[] expandPermute(int[] rightData) { + int[] epByte = new int[48]; + int i, j; + for (i = 0; i < 8; i++) { + if (i == 0) { + epByte[i * 6 + 0] = rightData[31]; + } else { + epByte[i * 6 + 0] = rightData[i * 4 - 1]; + } + epByte[i * 6 + 1] = rightData[i * 4 + 0]; + epByte[i * 6 + 2] = rightData[i * 4 + 1]; + epByte[i * 6 + 3] = rightData[i * 4 + 2]; + epByte[i * 6 + 4] = rightData[i * 4 + 3]; + if (i == 7) { + epByte[i * 6 + 5] = rightData[0]; + } else { + epByte[i * 6 + 5] = rightData[i * 4 + 4]; + } + } + return epByte; + } + + private static int[] xor(int[] byteOne, int[] byteTwo) { + // var xorByte = new Array(byteOne.length); + // for(int i = 0;i < byteOne.length; i ++){ + // xorByte[i] = byteOne[i] ^ byteTwo[i]; + // } + // return xorByte; + int[] xorByte = new int[byteOne.length]; + for (int i = 0; i < byteOne.length; i++) { + xorByte[i] = byteOne[i] ^ byteTwo[i]; + } + return xorByte; + } + + private static int[] sBoxPermute(int[] expandByte) { + + // var sBoxByte = new Array(32); + int[] sBoxByte = new int[32]; + String binary = ""; + int[][] s1 = { + { 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 }, + { 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8 }, + { 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0 }, + { 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 } }; + + /* Table - s2 */ + int[][] s2 = { + { 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10 }, + { 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5 }, + { 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15 }, + { 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9 } }; + + /* Table - s3 */ + int[][] s3 = { + { 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8 }, + { 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1 }, + { 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7 }, + { 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12 } }; + /* Table - s4 */ + int[][] s4 = { + { 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15 }, + { 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9 }, + { 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4 }, + { 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14 } }; + + /* Table - s5 */ + int[][] s5 = { + { 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9 }, + { 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6 }, + { 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14 }, + { 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 } }; + + /* Table - s6 */ + int[][] s6 = { + { 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11 }, + { 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8 }, + { 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6 }, + { 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13 } }; + + /* Table - s7 */ + int[][] s7 = { + { 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1 }, + { 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6 }, + { 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2 }, + { 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12 } }; + + /* Table - s8 */ + int[][] s8 = { + { 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7 }, + { 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2 }, + { 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8 }, + { 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 } }; + + for (int m = 0; m < 8; m++) { + int i = 0, j = 0; + i = expandByte[m * 6 + 0] * 2 + expandByte[m * 6 + 5]; + j = expandByte[m * 6 + 1] * 2 * 2 * 2 + expandByte[m * 6 + 2] * 2 + * 2 + expandByte[m * 6 + 3] * 2 + expandByte[m * 6 + 4]; + switch (m) { + case 0: + binary = getBoxBinary(s1[i][j]); + break; + case 1: + binary = getBoxBinary(s2[i][j]); + break; + case 2: + binary = getBoxBinary(s3[i][j]); + break; + case 3: + binary = getBoxBinary(s4[i][j]); + break; + case 4: + binary = getBoxBinary(s5[i][j]); + break; + case 5: + binary = getBoxBinary(s6[i][j]); + break; + case 6: + binary = getBoxBinary(s7[i][j]); + break; + case 7: + binary = getBoxBinary(s8[i][j]); + break; + } + sBoxByte[m * 4 + 0] = Integer.parseInt(binary.substring(0, 1)); + sBoxByte[m * 4 + 1] = Integer.parseInt(binary.substring(1, 2)); + sBoxByte[m * 4 + 2] = Integer.parseInt(binary.substring(2, 3)); + sBoxByte[m * 4 + 3] = Integer.parseInt(binary.substring(3, 4)); + } + return sBoxByte; + } + + private static int[] pPermute(int[] sBoxByte) { + int[] pBoxPermute = new int[32]; + pBoxPermute[0] = sBoxByte[15]; + pBoxPermute[1] = sBoxByte[6]; + pBoxPermute[2] = sBoxByte[19]; + pBoxPermute[3] = sBoxByte[20]; + pBoxPermute[4] = sBoxByte[28]; + pBoxPermute[5] = sBoxByte[11]; + pBoxPermute[6] = sBoxByte[27]; + pBoxPermute[7] = sBoxByte[16]; + pBoxPermute[8] = sBoxByte[0]; + pBoxPermute[9] = sBoxByte[14]; + pBoxPermute[10] = sBoxByte[22]; + pBoxPermute[11] = sBoxByte[25]; + pBoxPermute[12] = sBoxByte[4]; + pBoxPermute[13] = sBoxByte[17]; + pBoxPermute[14] = sBoxByte[30]; + pBoxPermute[15] = sBoxByte[9]; + pBoxPermute[16] = sBoxByte[1]; + pBoxPermute[17] = sBoxByte[7]; + pBoxPermute[18] = sBoxByte[23]; + pBoxPermute[19] = sBoxByte[13]; + pBoxPermute[20] = sBoxByte[31]; + pBoxPermute[21] = sBoxByte[26]; + pBoxPermute[22] = sBoxByte[2]; + pBoxPermute[23] = sBoxByte[8]; + pBoxPermute[24] = sBoxByte[18]; + pBoxPermute[25] = sBoxByte[12]; + pBoxPermute[26] = sBoxByte[29]; + pBoxPermute[27] = sBoxByte[5]; + pBoxPermute[28] = sBoxByte[21]; + pBoxPermute[29] = sBoxByte[10]; + pBoxPermute[30] = sBoxByte[3]; + pBoxPermute[31] = sBoxByte[24]; + return pBoxPermute; + } + + private static int[] finallyPermute(int[] endByte) { + int[] fpByte = new int[64]; + fpByte[0] = endByte[39]; + fpByte[1] = endByte[7]; + fpByte[2] = endByte[47]; + fpByte[3] = endByte[15]; + fpByte[4] = endByte[55]; + fpByte[5] = endByte[23]; + fpByte[6] = endByte[63]; + fpByte[7] = endByte[31]; + fpByte[8] = endByte[38]; + fpByte[9] = endByte[6]; + fpByte[10] = endByte[46]; + fpByte[11] = endByte[14]; + fpByte[12] = endByte[54]; + fpByte[13] = endByte[22]; + fpByte[14] = endByte[62]; + fpByte[15] = endByte[30]; + fpByte[16] = endByte[37]; + fpByte[17] = endByte[5]; + fpByte[18] = endByte[45]; + fpByte[19] = endByte[13]; + fpByte[20] = endByte[53]; + fpByte[21] = endByte[21]; + fpByte[22] = endByte[61]; + fpByte[23] = endByte[29]; + fpByte[24] = endByte[36]; + fpByte[25] = endByte[4]; + fpByte[26] = endByte[44]; + fpByte[27] = endByte[12]; + fpByte[28] = endByte[52]; + fpByte[29] = endByte[20]; + fpByte[30] = endByte[60]; + fpByte[31] = endByte[28]; + fpByte[32] = endByte[35]; + fpByte[33] = endByte[3]; + fpByte[34] = endByte[43]; + fpByte[35] = endByte[11]; + fpByte[36] = endByte[51]; + fpByte[37] = endByte[19]; + fpByte[38] = endByte[59]; + fpByte[39] = endByte[27]; + fpByte[40] = endByte[34]; + fpByte[41] = endByte[2]; + fpByte[42] = endByte[42]; + fpByte[43] = endByte[10]; + fpByte[44] = endByte[50]; + fpByte[45] = endByte[18]; + fpByte[46] = endByte[58]; + fpByte[47] = endByte[26]; + fpByte[48] = endByte[33]; + fpByte[49] = endByte[1]; + fpByte[50] = endByte[41]; + fpByte[51] = endByte[9]; + fpByte[52] = endByte[49]; + fpByte[53] = endByte[17]; + fpByte[54] = endByte[57]; + fpByte[55] = endByte[25]; + fpByte[56] = endByte[32]; + fpByte[57] = endByte[0]; + fpByte[58] = endByte[40]; + fpByte[59] = endByte[8]; + fpByte[60] = endByte[48]; + fpByte[61] = endByte[16]; + fpByte[62] = endByte[56]; + fpByte[63] = endByte[24]; + return fpByte; + } + + private static String getBoxBinary(int i) { + String binary = ""; + switch (i) { + case 0: + binary = "0000"; + break; + case 1: + binary = "0001"; + break; + case 2: + binary = "0010"; + break; + case 3: + binary = "0011"; + break; + case 4: + binary = "0100"; + break; + case 5: + binary = "0101"; + break; + case 6: + binary = "0110"; + break; + case 7: + binary = "0111"; + break; + case 8: + binary = "1000"; + break; + case 9: + binary = "1001"; + break; + case 10: + binary = "1010"; + break; + case 11: + binary = "1011"; + break; + case 12: + binary = "1100"; + break; + case 13: + binary = "1101"; + break; + case 14: + binary = "1110"; + break; + case 15: + binary = "1111"; + break; + } + return binary; + } + + /* + * generate 16 keys for xor + */ + private static int[][] generateKeys(int[] keyByte) { + int[] key = new int[56]; + int[][] keys = new int[16][48]; + + // keys[ 0] = new Array(); + // keys[ 1] = new Array(); + // keys[ 2] = new Array(); + // keys[ 3] = new Array(); + // keys[ 4] = new Array(); + // keys[ 5] = new Array(); + // keys[ 6] = new Array(); + // keys[ 7] = new Array(); + // keys[ 8] = new Array(); + // keys[ 9] = new Array(); + // keys[10] = new Array(); + // keys[11] = new Array(); + // keys[12] = new Array(); + // keys[13] = new Array(); + // keys[14] = new Array(); + // keys[15] = new Array(); + int[] loop = new int[] { 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 }; + + for (int i = 0; i < 7; i++) { + for (int j = 0, k = 7; j < 8; j++, k--) { + key[i * 8 + j] = keyByte[8 * k + i]; + } + } + + int i = 0; + for (i = 0; i < 16; i++) { + int tempLeft = 0; + int tempRight = 0; + for (int j = 0; j < loop[i]; j++) { + tempLeft = key[0]; + tempRight = key[28]; + for (int k = 0; k < 27; k++) { + key[k] = key[k + 1]; + key[28 + k] = key[29 + k]; + } + key[27] = tempLeft; + key[55] = tempRight; + } + // var tempKey = new Array(48); + int[] tempKey = new int[48]; + tempKey[0] = key[13]; + tempKey[1] = key[16]; + tempKey[2] = key[10]; + tempKey[3] = key[23]; + tempKey[4] = key[0]; + tempKey[5] = key[4]; + tempKey[6] = key[2]; + tempKey[7] = key[27]; + tempKey[8] = key[14]; + tempKey[9] = key[5]; + tempKey[10] = key[20]; + tempKey[11] = key[9]; + tempKey[12] = key[22]; + tempKey[13] = key[18]; + tempKey[14] = key[11]; + tempKey[15] = key[3]; + tempKey[16] = key[25]; + tempKey[17] = key[7]; + tempKey[18] = key[15]; + tempKey[19] = key[6]; + tempKey[20] = key[26]; + tempKey[21] = key[19]; + tempKey[22] = key[12]; + tempKey[23] = key[1]; + tempKey[24] = key[40]; + tempKey[25] = key[51]; + tempKey[26] = key[30]; + tempKey[27] = key[36]; + tempKey[28] = key[46]; + tempKey[29] = key[54]; + tempKey[30] = key[29]; + tempKey[31] = key[39]; + tempKey[32] = key[50]; + tempKey[33] = key[44]; + tempKey[34] = key[32]; + tempKey[35] = key[47]; + tempKey[36] = key[43]; + tempKey[37] = key[48]; + tempKey[38] = key[38]; + tempKey[39] = key[55]; + tempKey[40] = key[33]; + tempKey[41] = key[52]; + tempKey[42] = key[45]; + tempKey[43] = key[41]; + tempKey[44] = key[49]; + tempKey[45] = key[35]; + tempKey[46] = key[28]; + tempKey[47] = key[31]; + int m; + switch (i) { + case 0: + for (m = 0; m < 48; m++) { + keys[0][m] = tempKey[m]; + } + break; + case 1: + for (m = 0; m < 48; m++) { + keys[1][m] = tempKey[m]; + } + break; + case 2: + for (m = 0; m < 48; m++) { + keys[2][m] = tempKey[m]; + } + break; + case 3: + for (m = 0; m < 48; m++) { + keys[3][m] = tempKey[m]; + } + break; + case 4: + for (m = 0; m < 48; m++) { + keys[4][m] = tempKey[m]; + } + break; + case 5: + for (m = 0; m < 48; m++) { + keys[5][m] = tempKey[m]; + } + break; + case 6: + for (m = 0; m < 48; m++) { + keys[6][m] = tempKey[m]; + } + break; + case 7: + for (m = 0; m < 48; m++) { + keys[7][m] = tempKey[m]; + } + break; + case 8: + for (m = 0; m < 48; m++) { + keys[8][m] = tempKey[m]; + } + break; + case 9: + for (m = 0; m < 48; m++) { + keys[9][m] = tempKey[m]; + } + break; + case 10: + for (m = 0; m < 48; m++) { + keys[10][m] = tempKey[m]; + } + break; + case 11: + for (m = 0; m < 48; m++) { + keys[11][m] = tempKey[m]; + } + break; + case 12: + for (m = 0; m < 48; m++) { + keys[12][m] = tempKey[m]; + } + break; + case 13: + for (m = 0; m < 48; m++) { + keys[13][m] = tempKey[m]; + } + break; + case 14: + for (m = 0; m < 48; m++) { + keys[14][m] = tempKey[m]; + } + break; + case 15: + for (m = 0; m < 48; m++) { + keys[15][m] = tempKey[m]; + } + break; + } + } + return keys; + } +} diff --git a/src_app/apx/com/amarsoft/als/base/util/DateUtil.java b/src_app_fresh/com/base/util/DateUtil.java similarity index 79% rename from src_app/apx/com/amarsoft/als/base/util/DateUtil.java rename to src_app_fresh/com/base/util/DateUtil.java index de11ba90c..29476bb1e 100644 --- a/src_app/apx/com/amarsoft/als/base/util/DateUtil.java +++ b/src_app_fresh/com/base/util/DateUtil.java @@ -1,151 +1,181 @@ -package apx.com.amarsoft.als.base.util; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -public class DateUtil { - public final static String FULL_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"; - public final static String TIME_MONTH = "MONTH"; - public final static String TIME_DAY = "DAY"; - public final static String TIME_YEAR = "YEAR"; - - public static int getIntervalDays(Date startDate, Date endDate) { - if ((null == startDate) || (null == endDate)) { - return -1; - } - long intervalMilli = (endDate.getTime() - startDate.getTime()); - return (int) (intervalMilli / (24 * 60 * 60 * 1000)); - } - - public static int daysOfTwo(Date startDate, Date endDate) { - Calendar aCalendar = Calendar.getInstance(); - aCalendar.setTime(startDate); - int day1 = aCalendar.get(Calendar.DAY_OF_YEAR); - aCalendar.setTime(endDate); - int day2 = aCalendar.get(Calendar.DAY_OF_YEAR); - return day2 - day1; - } - - public static String addDate(Date startDate, String type, Integer num) { - Calendar aCalendar = Calendar.getInstance(); - aCalendar.setTime(startDate); - if (type.equalsIgnoreCase(DateUtil.TIME_DAY)) { - aCalendar.add(Calendar.DAY_OF_YEAR, num); - } else if (type.equalsIgnoreCase(DateUtil.TIME_MONTH)) { - aCalendar.add(Calendar.MONTH, num); - } else { - aCalendar.add(Calendar.YEAR, num); - } - return DateUtil - .getSystemTimeByFormat(aCalendar.getTime(), "yyyy-MM-dd"); - } - - public static String addDate(String startDate, String type, Integer num) { - Date dateStart = getTimeByFormat(startDate, "yyyy-MM-dd"); - return addDate(dateStart, type, num); - } - - public static Date getEndDateByDays(Date startDate, int days) { - Calendar aCalendar = Calendar.getInstance(); - aCalendar.setTime(startDate); - aCalendar.add(Calendar.DAY_OF_YEAR, days); - return aCalendar.getTime(); - } - - public static String getSystemDate() { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - return sdf.format(new Date()); - } - - public static String getSystemDateTime() { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - return sdf.format(new Date()); - } - - public static String getSystemDateDetailTime() { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:sss"); - return sdf.format(new Date()); - } - - public static String getDateTime(Date date) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - if (null == date) { - date = new Date(); - } - return sdf.format(date); - } - - /** - * @param dateFormat - * 输出日期格式,形如:yyyy-MM-dd HH:mm:ss - * @return 格式化后的日期字符串 - */ - public static String getSystemTimeByFormat(String dateFormat) { - SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); - return sdf.format(new Date()); - } - - public static String getSystemTimeByFormat(Date date, String dateFormat) { - SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); - return sdf.format(date); - } - - public static String getTimeAllByFormat(String dateFormat) - throws ParseException { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - Date date = sdf.parse(dateFormat); - DateFormat format = new SimpleDateFormat("yyyy年MM月dd日"); - return format.format(date); - } - - /** - * @param dateStr - * 日期字符串,形如:yyyy-MM-dd HH:mm:ss - * @param dateFormat - * 输出日期格式,形如:yyyy-MM-dd HH:mm:ss - * @return 格式化后的日期字符串 - */ - public static Date getTimeByFormat(String dateStr, String dateFormat) { - SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); - Date date = null; - try { - date = sdf.parse(dateStr); - } catch (ParseException e) { - e.printStackTrace(); - } - return date; - } - - /** - * 获取 yyyy-MM-dd 日期 - * - * @param dateStr - * 日期时间字符串 - * @param dateFormat - * dateStr的字符串格式 - * @return ' yyyy-MM-dd '格式日期 - */ - public static String getFormateDate(String dateStr, String dateFormat) { - SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); - Date date = null; - try { - date = sdf.parse(dateStr); - } catch (ParseException e) { - e.printStackTrace(); - } - sdf = new SimpleDateFormat("yyyy-MM-dd"); - return sdf.format(date); - - } - public static void main(String[] args) { - String date = getSystemTimeByFormat(new Date(), "yyyy/MM/dd HH:mm:ss"); - System.out.println(date); - String []dateArray = date.split("/"); - System.out.println("year :" + dateArray[0]); - System.out.println("month :" + dateArray[1]); - System.out.println("day :" + dateArray[2]); - } -} +package com.base.util; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +public class DateUtil { + public final static String FULL_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"; + public final static String TIME_MONTH = "MONTH"; + public final static String TIME_DAY = "DAY"; + public final static String TIME_YEAR = "YEAR"; + + public static int getIntervalDays(Date startDate, Date endDate) { + if ((null == startDate) || (null == endDate)) { + return -1; + } + long intervalMilli = (endDate.getTime() - startDate.getTime()); + return (int) (intervalMilli / (24 * 60 * 60 * 1000)); + } + + @SuppressWarnings("static-access") + public static String getNexMonthDate(Date date, int iInterval, String returnForMat) { + Calendar calendar = new GregorianCalendar(); + calendar.setTime(date); + calendar.add(calendar.MONTH, iInterval);// 把日期往后增加一个月.整数往后推,负数往前移动 + date=calendar.getTime(); //这个时间就是日期往后推一天的结果 + String sDate = DateUtil.getSystemTimeByFormat(date, returnForMat); + return sDate; + } + + public static int daysOfTwo(Date startDate, Date endDate) { + Calendar aCalendar = Calendar.getInstance(); + aCalendar.setTime(startDate); + int day1 = aCalendar.get(Calendar.DAY_OF_YEAR); + aCalendar.setTime(endDate); + int day2 = aCalendar.get(Calendar.DAY_OF_YEAR); + return day2 - day1; + } + + public static int getMonthSpace(String date1, String date2) + throws ParseException { + + int result = 0; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); + + Calendar c1 = Calendar.getInstance(); + Calendar c2 = Calendar.getInstance(); + + c1.setTime(sdf.parse(date1)); + c2.setTime(sdf.parse(date2)); + + result = c2.get(Calendar.MONTH) - c1.get(Calendar.MONTH); + + return result+( c2.get(Calendar.YEAR) - c1.get(Calendar.YEAR))*12; + + } + + public static String addDate(Date startDate, String type, Integer num) { + Calendar aCalendar = Calendar.getInstance(); + aCalendar.setTime(startDate); + if (type.equalsIgnoreCase(DateUtil.TIME_DAY)) { + aCalendar.add(Calendar.DAY_OF_YEAR, num); + } else if (type.equalsIgnoreCase(DateUtil.TIME_MONTH)) { + aCalendar.add(Calendar.MONTH, num); + } else { + aCalendar.add(Calendar.YEAR, num); + } + return DateUtil + .getSystemTimeByFormat(aCalendar.getTime(), "yyyy-MM-dd"); + } + + public static String addDate(String startDate, String type, Integer num) { + Date dateStart = getTimeByFormat(startDate, "yyyy-MM-dd"); + return addDate(dateStart, type, num); + } + + public static Date getEndDateByDays(Date startDate, int days) { + Calendar aCalendar = Calendar.getInstance(); + aCalendar.setTime(startDate); + aCalendar.add(Calendar.DAY_OF_YEAR, days); + return aCalendar.getTime(); + } + + public static String getSystemDate() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + return sdf.format(new Date()); + } + + public static String getSystemDateTime() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return sdf.format(new Date()); + } + + public static String getSystemDateDetailTime() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:sss"); + return sdf.format(new Date()); + } + + public static String getDateTime(Date date) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + if (null == date) { + date = new Date(); + } + return sdf.format(date); + } + + /** + * @param dateFormat + * 输出日期格式,形如:yyyy-MM-dd HH:mm:ss + * @return 格式化后的日期字符串 + */ + public static String getSystemTimeByFormat(String dateFormat) { + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); + return sdf.format(new Date()); + } + + public static String getSystemTimeByFormat(Date date, String dateFormat) { + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); + return sdf.format(date); + } + + public static String getTimeAllByFormat(String dateFormat) + throws ParseException { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Date date = sdf.parse(dateFormat); + DateFormat format = new SimpleDateFormat("yyyy年MM月dd日"); + return format.format(date); + } + + /** + * @param dateStr + * 日期字符串,形如:yyyy-MM-dd HH:mm:ss + * @param dateFormat + * 输出日期格式,形如:yyyy-MM-dd HH:mm:ss + * @return 格式化后的日期字符串 + */ + public static Date getTimeByFormat(String dateStr, String dateFormat) { + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); + Date date = null; + try { + date = sdf.parse(dateStr); + } catch (ParseException e) { + e.printStackTrace(); + } + return date; + } + + /** + * 获取 yyyy-MM-dd 日期 + * + * @param dateStr + * 日期时间字符串 + * @param dateFormat + * dateStr的字符串格式 + * @return ' yyyy-MM-dd '格式日期 + */ + public static String getFormateDate(String dateStr, String dateFormat) { + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); + Date date = null; + try { + date = sdf.parse(dateStr); + } catch (ParseException e) { + e.printStackTrace(); + } + sdf = new SimpleDateFormat("yyyy-MM-dd"); + return sdf.format(date); + + } + public static void main(String[] args) { + String date = getSystemTimeByFormat(new Date(), "yyyy/MM/dd HH:mm:ss"); + System.out.println(date); + String []dateArray = date.split("/"); + System.out.println("year :" + dateArray[0]); + System.out.println("month :" + dateArray[1]); + System.out.println("day :" + dateArray[2]); + } +} diff --git a/src_app_fresh/com/base/util/DocumenetUpload.java b/src_app_fresh/com/base/util/DocumenetUpload.java new file mode 100644 index 000000000..f3ef8fb5e --- /dev/null +++ b/src_app_fresh/com/base/util/DocumenetUpload.java @@ -0,0 +1,143 @@ +//package com.base.util; +// +//import java.io.DataOutputStream; +//import java.io.File; +//import java.io.FileOutputStream; +//import java.io.InputStream; +//import java.net.URLDecoder; +//import java.util.Date; +//import java.util.List; +//import java.util.Map; +// +//import jbo.com.tenwa.entity.comm.officetempalte.BF_TEMPLATE; +// +//import com.amarsoft.are.jbo.BizObject; +//import com.amarsoft.are.jbo.BizObjectManager; +//import com.amarsoft.are.jbo.BizObjectQuery; +//import com.amarsoft.are.jbo.JBOFactory; +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.are.util.StringFunction; +//import com.amarsoft.awe.Configure; +//import com.amarsoft.awe.util.Transaction; +//import com.amarsoft.context.ASUser; +//import com.base.constant.RestfullConstant; +//import com.tenwa.officetempalte.util.FileOperatorUtil; +// +//public class DocumenetUpload { +// private final static String COMPANY_TYPE = RestfullConstant.baseProperty +// .get("CUSTOMER_TYPE_COMPANY").toString(); // 01 +// private final static String PERSON_TYPE = RestfullConstant.baseProperty +// .get("CUSTOMER_TYPE_PERSON").toString(); // 03 +// +// public static Map businessDocumentUpload( +// Map testMap, List> fileList, +// Transaction sqlca, JBOTransaction tx, String sObjectType, +// String sUserId, ReturnMapUtil ReturnMapUtil) throws Exception { +// +// String sDocLibraryId = testMap.get("library_id") == null ? "" : testMap +// .get("library_id").toString(); +// String sCustomerType = testMap.get("customertype") == null ? "" +// : testMap.get("customertype").toString(); +// +//// String TEMPLATE_NO_COMPANTY = RestfullConstant.download +//// .get("TEMPLATE_NO_COMPANTY") == null ? "" +//// : RestfullConstant.download +//// .get("TEMPLATE_NO_COMPANTY").toString(); +//// +//// String TEMPLATE_NO_PERSON = RestfullConstant.download +//// .get("TEMPLATE_NO_PERSON") == null ? "" +//// : RestfullConstant.download +//// .get("TEMPLATE_NO_PERSON").toString(); +// +// String sTemplateNo = ""; +//// sTemplateNo = sCustomerType.equals(COMPANY_TYPE) ? TEMPLATE_NO_COMPANTY// 法人合同模板 +//// : sCustomerType.equals(PERSON_TYPE) ? TEMPLATE_NO_PERSON // 自然人合同模板 +//// : ""; // 担保人合同模板 +// sTemplateNo = ""; // 担保人合同模板 +// +// BizObjectManager tempalteManger = JBOFactory +// .getBizObjectManager(BF_TEMPLATE.CLASS_NAME); +// BizObjectQuery tempalteMangerQuery = tempalteManger +// .createQuery("id=:id "); +// tempalteMangerQuery.setParameter("id", sTemplateNo); +// BizObject tempalte = tempalteMangerQuery.getSingleResult(false); +// String sDocType = tempalte.getAttribute("DOCTYPE").toString(); +// String sDocClassItemno = tempalte.getAttribute("DOC_CLASS_ITEMNO") +// .toString(); +// String sConfigId = tempalte.getAttribute("CONFIG_ID").toString(); +// String sRemark = testMap.get("remark") == null ? "" : testMap.get( +// "remark").toString(); +// ASUser curUser = new ASUser(sUserId, sqlca); +// String sCurDate = DateUtil.getSystemTimeByFormat(new Date(), +// "yyyy/MM/dd HH:mm:ss"); +// for (Map map : fileList) { +// String sFileName, sFileSize, sFileContentType; +// sFileName = map.get("fileName") == null ? "" : map.get("fileName") +// .toString(); +// sFileContentType = map.get("fileContentType") == null ? "" : map +// .get("fileContentType").toString(); +// sFileSize = map.get("fileSize") == null ? "" : map.get("fileSize") +// .toString(); +// // 得到不带路径的文件名 +// sFileName = StringFunction.getFileName(sFileName); +// sFileName = URLDecoder.decode( +// URLDecoder.decode(sFileName, "UTF-8"), "UTF-8"); +// InputStream file = (InputStream) map.get("file"); +// // 定义数据库操作变量 +// // 获取配置文件的参数 +// @SuppressWarnings("deprecation") +// Configure CurConfig = Configure.getInstance(); +// String sFileSavePath = CurConfig.getConfigure("FileSavePath"); +// +// String uuid = java.util.UUID.randomUUID().toString() +// .replaceAll("-", ""); +// String sFullPath = FileOperatorUtil.getuploadFileDir(sFileSavePath) +// + uuid + "_" + sFileName; +// +// String sFilePath = sFullPath.replace(sFileSavePath, ""); +// +// File f = new File(sFullPath); +// DataOutputStream fileout = new DataOutputStream( +// new FileOutputStream(f)); +// byte b[] = new byte[Integer.valueOf(sFileSize)]; +// @SuppressWarnings("unused") +// int i = file.read(b, 0, Integer.valueOf(sFileSize) - 1); +// fileout.write(b, 0, b.length); // 将文件数据存盘 +// fileout.close(); +// +// BizObjectManager libBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); +// BizObjectManager attrBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); +// BizObject lib = libBm.createQuery("id=:id") +// .setParameter("id", sDocLibraryId).getSingleResult(true); +// lib = lib == null ? libBm.newObject() : lib; +// lib.setAttributeValue("Remark", sRemark); +// lib.setAttributeValue("CONFIG_ID", sConfigId); +// lib.setAttributeValue("DOC_CLASS_ITEMNO", sDocClassItemno); +// lib.setAttributeValue("DOC_TYPE", sDocType); +// lib.setAttributeValue("One_Classify", sDocClassItemno); +// lib.setAttributeValue("DOC_NAME", sConfigId); +// libBm.saveObject(lib); +// BizObject attr = attrBm.newObject(); +// attr.setAttributeValue("Library_Id", sDocLibraryId); +// attr.setAttributeValue("FileName", sFileName); +// attr.setAttributeValue("InputUserId", curUser.getUserID()); +// attr.setAttributeValue("InputOrgId", curUser.getOrgID()); +// attr.setAttributeValue("InputTime", sCurDate); +// attr.setAttributeValue("objectType", sObjectType); +// attr.setAttributeValue("FilePath", sFilePath); +// attr.setAttributeValue("FullPath", sFullPath); +// attr.setAttributeValue("Content_Type", sFileContentType); +// attr.setAttributeValue("FileSize", sFileSize); +// +// attrBm.saveObject(attr); +// } +// tx.commit(); +// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty +// .get("SUCCESS") == null ? "SUCCESS" +// : RestfullConstant.baseProperty.get("SUCCESS").toString(), +// "上传成功!"); +// return ReturnMapUtil.getReturnMap(); +// } +//} diff --git a/src_app_fresh/com/base/util/DownloadAttUtil.java b/src_app_fresh/com/base/util/DownloadAttUtil.java new file mode 100644 index 000000000..4ab9d396a --- /dev/null +++ b/src_app_fresh/com/base/util/DownloadAttUtil.java @@ -0,0 +1,185 @@ +package com.base.util; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.OutputStream; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import com.amarsoft.are.ARE; +import com.amarsoft.awe.Configure; + +public class DownloadAttUtil { + + public static void downloadAppIOS(String sFileName, String sPath, + HttpServletResponse response) throws Exception { +// sFileName = URLEncoder.encode(sFileName, "GBK"); + sFileName = new String(sFileName.getBytes(), "ISO-8859-1"); + response.reset(); + response.setHeader("Content-disposition", "attachment; filename=" + + sFileName); + File file = new File(sPath); + response.setContentLength((int) file.length()); + FileInputStream fileInputStream = null; + BufferedInputStream bufferedInputStream = null; + OutputStream outputStream = null; + try { + response.setContentType("application/octet-stream");// 指明response的返回对象是文件流 + // 读出文件到response + // 这里是先需要把要把文件内容先读到缓冲区 + // 再把缓冲区的内容写到response的输出流供用户下载 + fileInputStream = new FileInputStream(file); + bufferedInputStream = new BufferedInputStream( + fileInputStream); + byte[] b = new byte[bufferedInputStream.available()]; + bufferedInputStream.read(b); + outputStream = response.getOutputStream(); + outputStream.write(b); + } catch (Exception e) { + ARE.getLog().error(e); + throw new Exception("输入流文件出现异常 :" + e); + } finally { + // 人走带门 + bufferedInputStream.close(); + outputStream.flush(); + outputStream.close(); + fileInputStream.close(); + } + +// +// +// +// +// try (InputStream in = new FileInputStream(sPath)) { +// FileUtils.copyFile(new File(sPath), response.getOutputStream()); +// } catch (Exception e) { +// ARE.getLog().error(e); +// throw new Exception("输入流文件出现异常 :" + e); +// } + } + + public static void downloadAppAndroid(String sFileName, String sPath, + HttpServletResponse response) throws Exception { + sFileName = new String(sFileName.getBytes(), "ISO-8859-1"); + response.reset(); + response.setHeader("Content-disposition", "attachment; filename=" + + sFileName); + File file = new File(sPath); + response.setContentLength((int) file.length()); + FileInputStream fileInputStream = null; + BufferedInputStream bufferedInputStream = null; + OutputStream outputStream = null; + try { + response.setContentType("application/octet-stream");// 指明response的返回对象是文件流 + // 读出文件到response + // 这里是先需要把要把文件内容先读到缓冲区 + // 再把缓冲区的内容写到response的输出流供用户下载 + fileInputStream = new FileInputStream(file); + bufferedInputStream = new BufferedInputStream( + fileInputStream); + byte[] b = new byte[bufferedInputStream.available()]; + bufferedInputStream.read(b); + outputStream = response.getOutputStream(); + outputStream.write(b); + } catch (Exception e) { + ARE.getLog().error(e); + throw new Exception("输入流文件出现异常 :" + e); + } finally { + // 人走带门 + bufferedInputStream.close(); + outputStream.flush(); + outputStream.close(); + fileInputStream.close(); + } + + } + + /** + * 描述:下载附件设置response + * + * @param fileName + * @param path + * @param fileSize + * @param response + * @param request + * @throws Exception + */ + public static void downloadAtt(String sFileName, String sPath, + String sFileSize, HttpServletResponse response, + HttpServletRequest request, String sDevType) throws Exception { + if ("ios".equals(sDevType)) + sFileName = new String(sFileName.getBytes(), "ISO-8859-1"); + else + sFileName = new String(sFileName.getBytes(), "ISO-8859-1"); + response.reset(); + response.setHeader("Content-disposition", "attachment; filename=" + + sFileName); + response.setContentType("application/octet-stream");// 指明response的返回对象是文件流 + HttpSession session; + Configure CurConfig; + session = request.getSession(true); + if ((session == null) || (session.getAttributeNames() == null)) { + ARE.getLog().error("读取配置文件错误!请检查配置文件。"); + throw new Exception("------Timeout------"); + } + + CurConfig = Configure.getInstance(session.getServletContext()); + if (CurConfig == null) { + ARE.getLog().error("读取配置文件错误!请检查配置文件。"); + throw new ServletException("读取配置文件错误!请检查配置文件。"); + } + String path1 = CurConfig.getConfigure("FileSavePath"); + File file = new File(path1 + "/" + sPath); + if (!file.exists()) { + ARE.getLog().error("读取文件错误!请检查[文件。"); + throw new ServletException("读取文件错误!请检查[文件。"); + } + response.setContentLength((int) file.length()); +// if (sFileSize != null && !"".equals(sFileSize)) { +// response.setContentLength(Integer.valueOf(sFileSize)); +// } else { +// } + FileInputStream fileInputStream = null; + BufferedInputStream bufferedInputStream = null; + OutputStream outputStream = null; + try { + // 读出文件到response + // 这里是先需要把要把文件内容先读到缓冲区 + // 再把缓冲区的内容写到response的输出流供用户下载 + fileInputStream = new FileInputStream(file); + bufferedInputStream = new BufferedInputStream( + fileInputStream); + byte[] b = new byte[bufferedInputStream.available()]; + bufferedInputStream.read(b); + outputStream = response.getOutputStream(); + outputStream.write(b); + } catch (Exception e) { + ARE.getLog().error(e); + throw new Exception("输入流文件出现异常 :" + e); + } finally { + // 人走带门 + bufferedInputStream.close(); + outputStream.flush(); + outputStream.close(); + fileInputStream.close(); + } + } + + /** + * 描述:设置response编码 编码默认UTF-8 + * + * @param response + * @param sCharset + */ + public static void setCharset(HttpServletResponse response, String sCharset) { + if (null == sCharset) + sCharset = ""; + if (sCharset.length() < 1) + sCharset = "UTF-8"; + response.setContentType("text/html; charset=" + sCharset); + } +} \ No newline at end of file diff --git a/src_app_fresh/com/base/util/HttpUtil.java b/src_app_fresh/com/base/util/HttpUtil.java new file mode 100644 index 000000000..43ead62ac --- /dev/null +++ b/src_app_fresh/com/base/util/HttpUtil.java @@ -0,0 +1,119 @@ +package com.base.util; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Map; + +import org.slf4j.Logger; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.are.log.Log; + + +public class HttpUtil { + + private static final Log LOGGER = ARE.getLog(); + private static final String HTTP_CONNECTION_TIMEOUT = "3000"; + private static final String HTTP_READ_TIMEOUT = "3000"; + private static final String HTTP_METHOD_GET = "GET"; + private static final String HTTP_METHOD_POST = "POST"; + + private static String DoProcess(String strUrl, String strContent, String httpMethod) throws Exception { + return DoProcess(strUrl,strContent,httpMethod,null); + } + + private static String DoProcess(String strUrl, String strContent, String httpMethod,String timeOut) throws Exception { + URL postUrl = new URL(strUrl); + HttpURLConnection connection = (HttpURLConnection) postUrl.openConnection(); + System.setProperty("sun.net.client.defaultConnectTimeout", HTTP_CONNECTION_TIMEOUT); + System.setProperty("sun.net.client.defaultReadTimeout", HTTP_READ_TIMEOUT); + + if(StringX.isEmpty(timeOut)){ + connection.setConnectTimeout(Integer.parseInt(HTTP_CONNECTION_TIMEOUT)); + }else{ + connection.setConnectTimeout(Integer.parseInt(timeOut)); + } + + if(StringX.isEmpty(timeOut)){ + connection.setReadTimeout(Integer.parseInt(HTTP_READ_TIMEOUT)); + }else{ + connection.setReadTimeout(Integer.parseInt(timeOut)); + } + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setRequestMethod(httpMethod); + connection.setUseCaches(false); + + connection.setInstanceFollowRedirects(true); + connection.setRequestProperty("Content-Type","application/json;charset=UTF-8"); + + connection.connect(); + + if(strContent != null && !"".equals(strContent)) { + OutputStream out = connection.getOutputStream(); +// out.write(strContent.getBytes("utf-8")); + out.write(strContent.getBytes("UTF-8")); + out.close(); + } + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(),"UTF-8")); + String line=""; + StringBuilder strBuf=new StringBuilder(); +// LOGGER.info("{} URL=>{}", new Object[]{httpMethod,strUrl}); + LOGGER.info("=============== "+httpMethod+":"+strUrl); + while ((line = reader.readLine()) != null){ + strBuf.append(line); + } + reader.close(); +// LOGGER.debug("responseCode => {} | responseMessage => {}", new Object[]{connection.getResponseCode(),connection.getResponseMessage()}); + connection.disconnect(); + return strBuf.toString(); + } + + public static String PostMsg(String strPostUrl, String strContent) throws Exception + { + return DoProcess(strPostUrl, strContent, HTTP_METHOD_POST); + } + + public static String PostLongMsg(String strPostUrl, String strContent) throws Exception + { + return DoProcess(strPostUrl, strContent, HTTP_METHOD_POST,"3600000"); + } + + public static String GetMsg(String strGetUrl) throws Exception + { + return DoProcess(strGetUrl, null, HTTP_METHOD_GET); + } + + + public static void main(String[] args) throws Exception { + String sServer = "http://localhost:8080/cebfl/webapi/resf"; + String sServiceImpl = "/logon/manager/logon"; + String sParam = "un=admin&pwd=07C193B5FFC84B6F5A903A00A4D3DFF07ED10BEC39024D00&dev_reg_id=111&keytype=common"; +// String strGetUrl = sServer+sServiceImpl+"?"+sParam; + String strGetUrl = "http://localhost:9090/getConfiguration"; +// try { +// String jsonStr = GetMsg(strGetUrl); +//// jsonStr = new String(jsonStr.getBytes("iso-8859-1"),"GBK"); +//// jsonStr = URLDecoder.decode(jsonStr, "GBK"); +// System.out.println(jsonStr); +// Map map = (Map) JsonUtil.str2Map(jsonStr); +// System.out.println(map); +// System.out.println( +// ((Map)(map.get("header"))).get("code") +// ); +// Map map1 = +// (Map) ((Map)(map.get("body"))).get("outline"); +// System.out.println(map1.get("code")); +// System.out.println(map1.get("message")); +// } catch (Exception e) { +// System.out.println(e); +// } + + System.out.println(GetMsg(strGetUrl)); + } + +} \ No newline at end of file diff --git a/src_app/apx/com/amarsoft/als/base/util/JsonUtil.java b/src_app_fresh/com/base/util/JsonUtil.java similarity index 94% rename from src_app/apx/com/amarsoft/als/base/util/JsonUtil.java rename to src_app_fresh/com/base/util/JsonUtil.java index fe1bd14f7..d165602f3 100644 --- a/src_app/apx/com/amarsoft/als/base/util/JsonUtil.java +++ b/src_app_fresh/com/base/util/JsonUtil.java @@ -1,93 +1,93 @@ -package apx.com.amarsoft.als.base.util; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; - -public class JsonUtil { - - /** - * json 字符串转MAP - * @param String str - * @return Map - */ - public static Map str2Map(String str) { - JSONObject jsonObject = JSONObject.fromObject(str); - Map map = (Map) jsonObject; - return map; - } - - /** - * json 字符串转JSONObject - * @param String str - * @return JSONObject - */ - public static JSONObject str2JSONObject(String str) { - return JSONObject.fromObject(str); - } - - /** - * 字符串转JSONArray - * @param str - * @return - */ - public static JSONArray str2JSONArray(String str) { - return JSONArray.fromObject(str); - } - - /** - * json 字符串转MAP列表 - */ - public static List> str2List(String str) { - List> list = new ArrayList>(); - JSONArray jArr = JSONArray.fromObject(str); - for (int i = 0; i < jArr.size(); i ++) { - JSONObject jObj = jArr.getJSONObject(i); - list.add((Map)jObj); - } - return list; - } - - /** - * java对象转换成json对象,并转化为字符串 - * @param Object obj - * @return JSONObject - */ - public static JSONObject obj2JSONObject(Object obj) { - return JSONObject.fromObject(obj); - } - - /** - * java 对象列表转换为json对象数组,并转为字符串 - * @param List objs - * @return JSONArray - */ - public static JSONArray obj2JSONArray(List objs) { - return JSONArray.fromObject(objs); - } - - /** - * json数组 转对象列表 - * @param jsonArr - * @param className - * @return - */ - @SuppressWarnings("deprecation") - public static List JSONArray2List(JSONArray jsonArr, Class className) { - return JSONArray.toList(jsonArr, className); - } - - /** - * json 转对象 - * @param json - * @param className - * @return - */ - public static Object JSONObject2Object(JSONObject json, Class className) { - return JSONObject.toBean(json, className); - } - -} +package com.base.util; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +public class JsonUtil { + + /** + * json 字符串转MAP + * @param String str + * @return Map + */ + public static Map str2Map(String str) { + JSONObject jsonObject = JSONObject.fromObject(str); + Map map = (Map) jsonObject; + return map; + } + + /** + * json 字符串转JSONObject + * @param String str + * @return JSONObject + */ + public static JSONObject str2JSONObject(String str) { + return JSONObject.fromObject(str); + } + + /** + * 字符串转JSONArray + * @param str + * @return + */ + public static JSONArray str2JSONArray(String str) { + return JSONArray.fromObject(str); + } + + /** + * json 字符串转MAP列表 + */ + public static List> str2List(String str) { + List> list = new ArrayList>(); + JSONArray jArr = JSONArray.fromObject(str); + for (int i = 0; i < jArr.size(); i ++) { + JSONObject jObj = jArr.getJSONObject(i); + list.add((Map)jObj); + } + return list; + } + + /** + * java对象转换成json对象,并转化为字符串 + * @param Object obj + * @return JSONObject + */ + public static JSONObject obj2JSONObject(Object obj) { + return JSONObject.fromObject(obj); + } + + /** + * java 对象列表转换为json对象数组,并转为字符串 + * @param List objs + * @return JSONArray + */ + public static JSONArray obj2JSONArray(List objs) { + return JSONArray.fromObject(objs); + } + + /** + * json数组 转对象列表 + * @param jsonArr + * @param className + * @return + */ + @SuppressWarnings("deprecation") + public static List JSONArray2List(JSONArray jsonArr, Class className) { + return JSONArray.toList(jsonArr, className); + } + + /** + * json 转对象 + * @param json + * @param className + * @return + */ + public static Object JSONObject2Object(JSONObject json, Class className) { + return JSONObject.toBean(json, className); + } + +} diff --git a/src_app_fresh/com/base/util/LBAdjustDocumentUploadUtil.java b/src_app_fresh/com/base/util/LBAdjustDocumentUploadUtil.java new file mode 100644 index 000000000..286553b18 --- /dev/null +++ b/src_app_fresh/com/base/util/LBAdjustDocumentUploadUtil.java @@ -0,0 +1,157 @@ +//package com.base.util; +// +//import java.io.DataOutputStream; +//import java.io.File; +//import java.io.FileOutputStream; +//import java.io.InputStream; +//import java.net.URLDecoder; +//import java.util.Date; +//import java.util.List; +//import java.util.Map; +// +//import com.amarsoft.are.jbo.BizObject; +//import com.amarsoft.are.jbo.BizObjectManager; +//import com.amarsoft.are.jbo.BizObjectQuery; +//import com.amarsoft.are.jbo.JBOFactory; +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.are.util.SpecialTools; +//import com.amarsoft.are.util.StringFunction; +//import com.amarsoft.awe.Configure; +//import com.amarsoft.awe.util.Transaction; +//import com.amarsoft.context.ASUser; +//import com.base.constant.RestfullConstant; +//import com.tenwa.officetempalte.util.FileOperatorUtil; +// +//public class LBAdjustDocumentUploadUtil { +// public static Map LBAdjustDocumentUpload( +// Map fieldMap, List> fileList, +// Transaction sqlca, JBOTransaction tx, String sObjectType, +// String sUserId, ReturnMapUtil ReturnMapUtil) throws Exception { +// ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId), +// sqlca); +// String sCurDate = DateUtil.getSystemTimeByFormat(new Date(), +// "yyyy/MM/dd HH:mm:ss"); +// +// String sContractId = fieldMap.get("contract_id") == null ? "" +// : fieldMap.get("contract_id").toString(); +// +// String sApplyId = fieldMap.get("APPLY_ID") == null ? "" : fieldMap.get( +// "APPLY_ID").toString(); +// +// String sLibraryId = ""; +// for (Map map : fileList) { +// BizObjectManager relaBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCRELATIVE"); +// BizObjectManager libBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); +// BizObjectManager attrBm = JBOFactory +// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); +// +// BizObject lib = null; +// +// String sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCRELATIVE rela on O.Relative_Id=rela.id where rela.contract_id=:contract_id and rela.objecttype=:objecttype and rela.flow_unid=:flow_unid"; +// +// BizObjectQuery query = libBm.createQuery(sql); +// query.setParameter("contract_id", sContractId); +// query.setParameter("objecttype", sObjectType); +// query.setParameter("flow_unid", sApplyId); +// lib = query.getSingleResult(true); +// +// if (lib != null) { +// libBm.saveObject(lib); +// sLibraryId = lib.getAttribute("id").getString(); +// } else { +// sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCLIBRARY lib on O.id=lib.Relative_Id where O.contract_id=:contract_id and O.objecttype=:objecttype and O.flow_unid=:flow_unid"; +// query = relaBm.createQuery(sql); +// query.setParameter("contract_id", sContractId); +// query.setParameter("objecttype", sObjectType); +// query.setParameter("flow_unid", sApplyId); +// BizObject rela = query.getSingleResult(true); +// String relativeid = ""; +// if (rela == null) { +// // 初始化附件关联对象 +// rela = relaBm.newObject(); +// rela.setAttributeValue("ObjectType", sObjectType); +// rela.setAttributeValue("contract_id", sContractId); +// rela.setAttributeValue("flow_unid", sApplyId); +// relaBm.saveObject(rela); +// relativeid = rela.getAttribute("id").getString(); +// } else { +// relativeid = rela.getAttribute("id").getString(); +// } +// // 初始化附件 +// lib = libBm.newObject(); +// lib.setAttributeValue("Relative_Id", relativeid); +// libBm.saveObject(lib); +// sLibraryId = lib.getAttribute("id").getString(); +// } +// String sFileName, sFileContentType, sFileSize; +// sFileName = map.get("fileName") == null ? "" : map.get("fileName") +// .toString(); +// InputStream file = (InputStream) map.get("file"); +// sFileContentType = map.get("fileContentType") == null ? "" : map +// .get("fileContentType").toString(); +// sFileSize = map.get("fileSize") == null ? "" : map.get("fileSize") +// .toString(); +// +// BizObject attr = attrBm.newObject(); +// attr.setAttributeValue("Library_Id", sLibraryId); +// attr.setAttributeValue("FileName", sFileName); +// attr.setAttributeValue("InputUserId", oCurUser.getUserID()); +// attr.setAttributeValue("InputOrgId", oCurUser.getOrgID()); +// attr.setAttributeValue("InputTime", sCurDate); +// attr.setAttributeValue("ObjectType", sObjectType); +// +// // 得到不带路径的文件名 +// sFileName = StringFunction.getFileName(sFileName); +// sFileName = URLDecoder.decode( +// URLDecoder.decode(sFileName, "UTF-8"), "UTF-8"); +// // 定义数据库操作变量 +// // SqlObject so = null; +// // String sNewSql = ""; +// // String sFileSaveMode = CurConfig.getConfigure("FileSaveMode"); +// // String sFileSavePath = CurConfig.getConfigure("FileSavePath"); +// // String sFileNameType = CurConfig.getConfigure("FileNameType"); +// // String trueTable = ((BizObjectTableMapper) attrBm).getTable(); // +// // 取得真实的表名 +// // String sAttachmentNo = DBKeyHelp.getSerialNo(trueTable, "Id"); +// +// // 得到不带路径的文件名 +// sFileName = StringFunction.getFileName(sFileName); +// sFileName = URLDecoder.decode( +// URLDecoder.decode(sFileName, "UTF-8"), "UTF-8"); +// // 定义数据库操作变量 +// // 获取配置文件的参数 +// @SuppressWarnings("deprecation") +// Configure CurConfig = Configure.getInstance(); +// String sFileSavePath = CurConfig.getConfigure("FileSavePath"); +// +// String uuid = java.util.UUID.randomUUID().toString() +// .replaceAll("-", ""); +// String sFullPath = FileOperatorUtil.getuploadFileDir(sFileSavePath) +// + uuid + "_" + sFileName; +// +// String sFilePath = sFullPath.replace(sFileSavePath, ""); +// attr.setAttributeValue("FilePath", sFilePath); +// attr.setAttributeValue("FullPath", sFullPath); +// attr.setAttributeValue("Content_Type", sFileContentType); +// attr.setAttributeValue("FileSize", sFileSize); +// attrBm.saveObject(attr); +// File f = new File(sFullPath); +// DataOutputStream fileout = new DataOutputStream( +// new FileOutputStream(f)); +// byte b[] = new byte[Integer.valueOf(sFileSize)]; +// @SuppressWarnings("unused") +// int i = file.read(b, 0, Integer.valueOf(sFileSize) - 1); +// fileout.write(b, 0, b.length); // 将文件数据存盘 +// fileout.close(); +// } +// +// tx.commit(); +// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty +// .get("SUCCESS") == null ? "SUCCESS" +// : RestfullConstant.baseProperty.get("SUCCESS").toString(), +// "上传成功!"); +// return ReturnMapUtil.getReturnMap(); +// } +//} diff --git a/src_app_fresh/com/base/util/MD5Util.java b/src_app_fresh/com/base/util/MD5Util.java new file mode 100644 index 000000000..62489f90c --- /dev/null +++ b/src_app_fresh/com/base/util/MD5Util.java @@ -0,0 +1,23 @@ +package com.base.util; + +import org.springframework.security.authentication.encoding.Md5PasswordEncoder; + + + /** + *@author liuhongguang + *@createDate 2010-3-25 涓嬪崍05:23:51 + **/ +public class MD5Util +{ + public static String getMD5EncodedPassword(String str) { + Md5PasswordEncoder md5 = new Md5PasswordEncoder(); + return md5.encodePassword(str, null); + } + public static String getMD5EncodedPasswordWithSalt(String str,Object salt) { + Md5PasswordEncoder md5 = new Md5PasswordEncoder(); + return md5.encodePassword(str, salt); + } + /*public static void main(String []args) throws Exception{ + System.out.println(MD5Util.getMD5EncodedPasswordWithSalt("111111", "1")); + }*/ +} diff --git a/src_app_fresh/com/base/util/MultipartDataUtil.java b/src_app_fresh/com/base/util/MultipartDataUtil.java new file mode 100644 index 000000000..ea1dcbb2a --- /dev/null +++ b/src_app_fresh/com/base/util/MultipartDataUtil.java @@ -0,0 +1,77 @@ +package com.base.util; + +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.FileItemFactory; +import org.apache.commons.fileupload.FileUpload; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; + +import com.base.constant.RestfullConstant; + +public class MultipartDataUtil { + + public static Map readRequestParam( + HttpServletRequest request, String encoding) throws Exception { + FileItemFactory factory = new DiskFileItemFactory(); + FileUpload fu = new FileUpload(factory); + @SuppressWarnings({ "unchecked", "deprecation" }) + List list = (List) fu.parseRequest(request); + Map fieldMap = new HashMap(); + List> fileList = new ArrayList>(); + for (FileItem item : list) { + if (item.isFormField()) { + + if (null != encoding) { + fieldMap.put(item.getFieldName(), URLDecoder.decode( + item.getString(encoding), encoding)); + fieldMap.put(item.getFieldName().toLowerCase(), URLDecoder.decode( + item.getString(encoding), encoding)); + fieldMap.put(item.getFieldName().toUpperCase(), URLDecoder.decode( + item.getString(encoding), encoding)); + } else if ("".equals(encoding)) { + fieldMap.put(item.getFieldName(), + URLDecoder.decode(item.getString(), "UTF-8")); + fieldMap.put(item.getFieldName().toLowerCase(), + URLDecoder.decode(item.toString(), "UTF-8")); + fieldMap.put(item.getFieldName().toUpperCase(), + URLDecoder.decode(item.getString(), "UTF-8")); + } else if (null == encoding) { + String str = new String(item.getString().getBytes( + "ISO-8859-1"), + (String) RestfullConstant.baseProperty + .get("DATAENCODING")); + fieldMap.put(item.getFieldName(), str); + fieldMap.put(item.getFieldName().toLowerCase(), str); + fieldMap.put(item.getFieldName().toUpperCase(), str); + } + + } else { + Map fileMap = new HashMap(); + fileMap.put("fileSize", item.getInputStream().available()); + fileMap.put("fileContentType", item.getContentType()); + fileMap.put("fileName", item.getName()); + fileMap.put("file", item.getInputStream()); + fileList.add(fileMap); + } + } + Map multipartDataMap = new HashMap(); + String userId = request.getSession().getAttribute("userid").toString(); + fieldMap.put("userid".toLowerCase(), userId); + fieldMap.put("userid".toUpperCase(), userId); + multipartDataMap.put("fieldMap", fieldMap); + multipartDataMap.put("fileList", fileList); + return multipartDataMap; + } + + public static void main(String[] args) { + boolean flag = true; + System.out.println(!flag ? "false" : true); + } +} diff --git a/src_app/cn/coyoteam/aweresf/util/RequestUtil.java b/src_app_fresh/com/base/util/RequestUtil.java similarity index 89% rename from src_app/cn/coyoteam/aweresf/util/RequestUtil.java rename to src_app_fresh/com/base/util/RequestUtil.java index 918ed6a79..4054f58f7 100644 --- a/src_app/cn/coyoteam/aweresf/util/RequestUtil.java +++ b/src_app_fresh/com/base/util/RequestUtil.java @@ -1,4 +1,4 @@ -package cn.coyoteam.aweresf.util; +package com.base.util; import java.io.UnsupportedEncodingException; @@ -36,8 +36,6 @@ public class RequestUtil { } catch (UnsupportedEncodingException e) { logger.error("",e); } -// String value = req.getParameter(name); -// String[] values = req.getParameterValues(name); map.put(name, value); } return map; diff --git a/src_app_fresh/com/base/util/ReturnMapUtil.java b/src_app_fresh/com/base/util/ReturnMapUtil.java new file mode 100644 index 000000000..7b2e3ef8c --- /dev/null +++ b/src_app_fresh/com/base/util/ReturnMapUtil.java @@ -0,0 +1,107 @@ +package com.base.util; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; + +public class ReturnMapUtil { + private Map returnMap = new HashMap(); + private JBOTransaction tx; + private Transaction sqlca; + + public ReturnMapUtil(JBOTransaction tx, Transaction sqlca) { + this.tx = tx; + this.sqlca = sqlca; + } + + public Map rollback(Exception e) throws JBOException { + tx.rollback(); + sqlca.rollback(); + ARE.getLog().error(e); + setReturnMap(null, + RestfullConstant.baseProperty.get("CODE500").toString(), + RestfullConstant.baseProperty.get("MSG500").toString()); + return returnMap; + } + + public void setReturnMap(Map returnMap) { + this.returnMap = returnMap; + } + + public void setReturnMap(Map body, String code, + String message) { + returnMap = new HashMap(); + Map header = new HashMap(); + header.put("code", code); + header.put("message", message); + returnMap.put("outline", header); + if (body != null) { + returnMap.put("content", body); + } + } + + public Map getReturnMap() { + return returnMap; + } + + @SuppressWarnings("unchecked") + public void setContent(String key, Object value) { + Map body = (Map) returnMap + .get("content"); + body.put(key, value); + } + + @SuppressWarnings("unchecked") + public Object getContent(String key) { + Map body = (Map) returnMap + .get("content"); + return body.get(key); + } + + @SuppressWarnings("unchecked") + public void setDataValue(int count, String code, + String itemno, String value) { + Map body = (Map) returnMap + .get("content"); + List> datas = (List>) body + .get("datas"); + Map data = datas.get(count); + List> cols = (List>) data + .get("detail_data"); + for (Map col : cols) { + if (code.equals(col.get("code"))) { + col.put("itemno", itemno); + col.put("value", value); + } + } + } + + @SuppressWarnings("unchecked") + public String getDataValue(int count, String code) { + String str = ""; + Map body = (Map) returnMap + .get("content"); + List> datas = (List>) body + .get("datas"); + Map data = datas.get(count); + List> cols = (List>) data + .get("detail_data"); + for (Map col : cols) { + if (code.equals(col.get("code"))) { + String itemno = col.get("itemno") == null ? "" : col.get( + "itemno").toString(); + String value = col.get("value") == null ? "" : col.get( + "value").toString(); + str = "".equals(itemno) && "".equals(value) ? "" : itemno+"@"+value; + } + } + + return str; + } +} diff --git a/src_app_fresh/com/base/util/ScenarioUtil.java b/src_app_fresh/com/base/util/ScenarioUtil.java new file mode 100644 index 000000000..fe7e70c4e --- /dev/null +++ b/src_app_fresh/com/base/util/ScenarioUtil.java @@ -0,0 +1,227 @@ +package com.base.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.amarsoft.app.alarm.AlarmMessage; +import com.amarsoft.app.alarm.CheckItem; +import com.amarsoft.app.alarm.DefaultCheckItemRunner; +import com.amarsoft.app.alarm.DefaultScenarioContextLoader; +import com.amarsoft.app.alarm.ItemGroup; +import com.amarsoft.app.alarm.ScenarioContext; +import com.amarsoft.app.alarm.ScenarioContextLoader; +import com.amarsoft.app.alarm.StringTool; +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.ObjectConverts; +import com.amarsoft.awe.util.Transaction; +import com.tenwa.flow.warning.Warning; + +public class ScenarioUtil { + List> list; + String sMsg; + + public String getsMsg() { + return sMsg; + } + + public List> getList() { + return list; + } + + public boolean autoRiskScan(String sScenarioID, String sBizArgs, + String sSubTypeNo, JBOTransaction tx, Transaction sqlca) + throws Exception { + + boolean sReturn = true; + if (StringX.isSpace(sScenarioID)) { + sMsg = "sScenarioID不能为空!"; + return false; + } + if (StringX.isSpace(sBizArgs)) { + sMsg = "sBizArgs不能为空!"; + return false; + } + + Warning warning = new Warning(); + warning.setScenarioid(sScenarioID); + warning.setSubTypeNo(sSubTypeNo); + String sRes = warning.selectByScenarioid(tx); + + String autoCommit = "false"; + if ("failed".equals(sRes.toLowerCase())) { + sMsg = "无需风险预警!"; + return true; + } else { + if (sBizArgs.indexOf("isAutoCommit=true") >= 0) { + autoCommit = "true"; + } + // 获得组件参数 + System.out.println(sBizArgs); + sBizArgs = sBizArgs.replace("&", ","); + ARE.getLog().debug("传入业务参数:" + sBizArgs); + // 加载器 + ScenarioContextLoader loader = new DefaultScenarioContextLoader(); + ((DefaultScenarioContextLoader) loader).init(sqlca, sScenarioID, + sBizArgs, sSubTypeNo); + ScenarioContext context = loader.getContext(); // 获取下文容器 + context.setCheckItemRunner(new DefaultCheckItemRunner()); // 模型运行器 + String scenarioSerializable = ObjectConverts.getString(context); // 序列化 + + List gList0 = context.getScenario().getGroupList(); + List gList = new ArrayList(); + + // 根据运行条件进行预处理,分组下检查项检查条件均没通过,则不显示该分组 + for (int i = 0; i < gList0.size(); i++) { + ItemGroup group = gList0.get(i); + List ckList0 = group.getCheckItemList(); + List ckList1 = new ArrayList(); // 存放检查通过的 + for (int j = 0; j < ckList0.size(); j++) { + CheckItem ckItem = ckList0.get(j); + String sCondition = ckItem.getRunCondition(); // 运行条件 + if (sCondition != null && sCondition.length() > 0) { + boolean bCondition = StringTool.runAmarScript(sqlca, + sCondition, context.getParameter()) + .booleanValue(); + if (!bCondition) + continue; + else + ckList1.add(ckItem); + } else { + ckList1.add(ckItem); + } + } + if (ckList1.size() > 0) { // 重组分组 + group.getCheckItemList().clear(); + group.getCheckItemList().addAll(ckList1); + gList.add(group); + } + } + for (int i = 0; i < gList.size(); i++) { + ItemGroup group = gList.get(i); + List ckList = group.getCheckItemList(); + String sGroupId = group.getGroupID(); + String sGroupName = group.getGroupName(); + list = new ArrayList>(); + for (int j = 0; j < ckList.size(); j++) { + CheckItem ckItem = ckList.get(j); + // String sItemId = ckItem.getItemID(); + String viewerScript = ckItem.getBizViewer(); + if (viewerScript == null) + viewerScript = ""; + else + viewerScript = StringTool.pretreat( + context.getParameter(), viewerScript); + + if (ckItem.getItemID().equals("0028")) { + autoCommit="fales"; + continue; + } else { + String sItemName = ckItem.getItemName(); + String sItemId = ckItem.getItemID(); + try { + Map map = alarmModelInvoker( + sGroupId, sItemId, sqlca, tx, + scenarioSerializable); + map.put("sItemName", sItemName); + map.put("sGroupName", sGroupName); + list.add(map); + if (map.get("sStatus") == null ? false + : (boolean) map.get("sStatus") == false) { + sReturn = false; + } + } catch (Exception e) { + ARE.getLog().error(e); + return false; + } + } + } + } + } + return sReturn; + } + + @SuppressWarnings("deprecation") + public Map alarmModelInvoker(String sGroupId, + String sItemId, Transaction Sqlca, JBOTransaction tx, + String serializableScenario) throws Exception { + Map map = new HashMap(); + try { + if (serializableScenario == null) + serializableScenario = ""; + + if (serializableScenario.length() == 0) + throw new Exception("场景对象获取错误!"); + try { + + ScenarioContext context = (ScenarioContext) ObjectConverts + .getObject(serializableScenario); + + CheckItem chItem = context.getScenario().getCheckItem(sGroupId, + sItemId); + + String sPassMessage = chItem.getPassMessage(); + String sNoPassMessage = chItem.getNoPassMessage(); + if (sPassMessage == null) + sPassMessage = ""; + if (sNoPassMessage == null) + sNoPassMessage = ""; + + // AlarmMessage am = (AlarmMessage) context.getCheckItemRunner() + // .run(Sqlca, chItem); + AlarmMessage am = (AlarmMessage) context.getCheckItemRunner() + .run(Sqlca, chItem); + StringBuffer sbMessage = new StringBuffer(); + String sMessage = ""; + for (int j = 0; j < am.size(); j++) { + sbMessage.append(am.getMessage(j) + "[~`~]"); + } + if (sbMessage.length() > 5) { + sMessage = sbMessage.substring(0, sbMessage.length() - 5); + } else { + sMessage = ""; + } + + // 如果执行后,返回的消息为空 + // 1.如果通过,则消息取配置的通过的提示消息 + // 2.如果未通过,则取配置的未通过的提示消息 + if (sMessage.equals("")) { + if (am.isPass()) { + sMessage = sPassMessage; + } else { + sMessage = sNoPassMessage; + } + } + // Thread.sleep(200); + // 生成JSON + boolean sStatus = am.isPass(); + String sNoPassDeal = am.getNoPassDeal(); + String sMsg = sMessage; + map.put("sStatus", sStatus); + map.put("sNoPassDeal", sNoPassDeal); + map.put("sMsg", sMsg); + ARE.getLog().debug( + "status:" + am.isPass() + "|message:" + sMessage); + } catch (Exception e) { + ARE.getLog().error(e); + throw e; + } + } catch (Exception e) { + if (Sqlca != null) + Sqlca.getConnection().rollback(); + e.printStackTrace(); + ARE.getLog().error(e.getMessage(), e); + throw e; + } finally { + if (Sqlca != null) { + Sqlca.getConnection().commit(); + Sqlca.disConnect(); + Sqlca = null; + } + } + return map; + } +} diff --git a/src_app_fresh/com/base/util/SerialNumberUtil.java b/src_app_fresh/com/base/util/SerialNumberUtil.java new file mode 100644 index 000000000..5d348fb83 --- /dev/null +++ b/src_app_fresh/com/base/util/SerialNumberUtil.java @@ -0,0 +1,474 @@ +//package com.base.util; +// +//import java.text.DecimalFormat; +//import java.util.Calendar; +//import java.util.HashMap; +//import java.util.Map; +// +//import jbo.com.tenwa.entity.comm.serialutil.T_SERIAL_DISCARD_NUMBER; +//import jbo.com.tenwa.entity.comm.serialutil.T_SERIAL_NUMBER; +// +//import com.amarsoft.are.jbo.BizObject; +//import com.amarsoft.are.jbo.BizObjectManager; +//import com.amarsoft.are.jbo.BizObjectQuery; +//import com.amarsoft.are.jbo.JBOFactory; +//import com.amarsoft.are.jbo.JBOTransaction; +//import com.amarsoft.are.lang.StringX; +//import com.tenwa.comm.util.date.DateAssistant; +//import com.tenwa.comm.util.jboutil.DataOperatorUtil; +// +//public class SerialNumberUtil { +// public static synchronized String getInvoiceSerialNo(JBOTransaction tx) +// throws Exception { +// return SerialNumberUtil.getSerialNumber( +// "PR{year}{month}{maxOrderNumber}", 6, null, "单据号", null, tx); +// } +// +// public static synchronized String getAssetsDisposalApplyNo(JBOTransaction tx) +// throws Exception { +// return SerialNumberUtil.getSerialNumber("FW{year}{maxOrderNumber}", 4, +// null, "资产处置申请编号", null, tx); +// } +// +// public static synchronized String getRiskAlertNumber(JBOTransaction tx) +// throws Exception { +// return SerialNumberUtil.getSerialNumber("{year}风险预警{maxOrderNumber}", +// 4, null, "风险预警号", null, tx); +// } +// +// public static synchronized String getFileBorrowingNumber(JBOTransaction tx) +// throws Exception { +// return SerialNumberUtil.getSerialNumber("{year}借阅单{maxOrderNumber}", 4, +// null, "借阅单流水号", null, tx); +// } +// +// public static synchronized String getProjectSerialNumber(String orgId, +// JBOTransaction tx) throws Exception { +// return SerialNumberUtil.getSerialNumber( +// "P{year}{month}{day}{maxOrderNumber}", 6, null, "项目编号" + orgId, +// null, tx); +// } +// +// // 光大合同编号 +// public static synchronized String getContractSerialNumber(String leasForm, +// String orgId, JBOTransaction tx) throws Exception { +// String currentDateTime = DateAssistant.getTodayNow(); +// String currentYear = currentDateTime.substring(0, 4); +// String month = currentDateTime.substring(5, 7); +// return SerialNumberUtil.getSerialNumber("{year}{month}-" + leasForm +// + "{maxOrderNumber}", 5, null, currentYear + month + leasForm, +// null, tx); +// } +// +// public static synchronized String getEbankSerialNumber(String orgId, +// JBOTransaction tx) throws Exception { +// return SerialNumberUtil.getSerialNumber( +// "E-{year}{month}{maxOrderNumber}", 3, null, "网银编号" + orgId, +// null, tx); +// } +// +// public static synchronized String getOutNoNumber(JBOTransaction tx) +// throws Exception { +// return SerialNumberUtil.getSerialNumber( +// "PF{year}{month}{maxOrderNumber}", 4, null, "", null, tx); +// } +// +// public static synchronized String getRentOutNoNumber(JBOTransaction tx) +// throws Exception { +// return SerialNumberUtil.getSerialNumber( +// "PR{year}{month}{maxOrderNumber}", 4, null, "", null, tx); +// } +// +// public static synchronized String getGroupCompanyNumber(JBOTransaction tx) +// throws Exception { +// return SerialNumberUtil.getSerialNumber( +// "G{year}{month}{day}{maxOrderNumber}", 8, null, "集团编号", null, +// tx); +// } +// +// public static synchronized String getPlannumber(String sSerialType, +// String calType, JBOTransaction tx) throws Exception { +// String sSerialType2 = ""; +// if (calType.equals("proj_process")) { +// sSerialType2 = sSerialType + "{maxOrderNumber}"; +// return SerialNumberUtil.getSerialNumber(sSerialType2, 2, null, +// sSerialType + "方案编号", null, tx); +// } else if (calType.equals("pay_process")) { +// sSerialType2 = sSerialType + "-{maxOrderNumber}"; +// return SerialNumberUtil.getSerialNumber(sSerialType2, 2, null, +// sSerialType + "投放编号", null, tx); +// } else { +// sSerialType2 = sSerialType + "{maxOrderNumber}"; +// return SerialNumberUtil.getContractNumber(sSerialType2, 2, null, +// sSerialType, null, tx); +// } +// } +// +// public static synchronized String getProjectSerialNumber1(String orgId, +// JBOTransaction tx) throws Exception { +// return SerialNumberUtil.getSerialNumber("P{year}{maxOrderNumber}", 7, +// null, "项目编号" + orgId, null, tx); +// } +// +// /* +// * public static String getContractSerialNaumber(String +// * sSerialType,JBOTransaction tx) throws Exception { String +// * projectno=sSerialType; sSerialType=sSerialType+"-{maxOrderNumber}"; +// * return SerialNumberUtil.getSerialNumber(sSerialType,4,null,projectno, +// * null, tx); } +// */ +// protected static synchronized String getContractNumber( +// String serialNumberPattern, int numberCount, +// Map model, String type, Integer queryYear, +// JBOTransaction tx) throws Exception { +// String currentDateTime = DateAssistant.getTodayNow(); +// String currentYear = currentDateTime.substring(0, 4); +// String month = currentDateTime.substring(5, 7); +// String day = currentDateTime.substring(8, 10); +// String hour = currentDateTime.substring(11, 13); +// String minute = currentDateTime.substring(14, 16); +// String second = currentDateTime.substring(17, 19); +// +// Integer year = Integer.parseInt(currentYear); +// if (null != queryYear) { +// year = queryYear; +// } +// Map paramMap = new HashMap(); +// paramMap.put("year", year + ""); +// paramMap.put("month", month + ""); +// paramMap.put("day", day + ""); +// paramMap.put("hour", hour + ""); +// paramMap.put("minute", minute + ""); +// paramMap.put("second", second + ""); +// +// int maxOrderNumber = getMaxOrderNumber(type, queryYear, tx); +// +// BizObject contract = JBOFactory +// .createBizObjectQuery( +// "jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP", +// "contract_no=:contractid") +// .setParameter("contractid", type).getSingleResult(false); +// +// BizObject proj = JBOFactory +// .createBizObjectQuery( +// "jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP", +// "id=:id") +// .setParameter("id", +// contract.getAttribute("project_id").getString()) +// .getSingleResult(false); +// +// int max = getMaxOrderNumber(proj.getAttribute("PROJECT_NO").getString() +// + "方案编号", queryYear, tx); +// +// maxOrderNumber = max > maxOrderNumber ? max : maxOrderNumber; +// +// StringBuffer numberFormat = new StringBuffer(); +// for (int i = 0; i < numberCount; i++) { +// numberFormat.append("0"); +// } +// +// DecimalFormat df = new DecimalFormat(numberFormat.toString()); +// String serialNumberFormat = df.format(maxOrderNumber); +// paramMap.put("maxOrderNumber", serialNumberFormat); +// if (null != model) { +// paramMap.putAll(model); +// } +// String serialNumberString = getSerialNumber(paramMap, +// serialNumberPattern); +// +// return serialNumberString; +// } +// +// protected static synchronized String getSerialNumber( +// String serialNumberPattern, int numberCount, +// Map model, String type, Integer queryYear, +// JBOTransaction tx) throws Exception +// +// { +// String currentDateTime = DateAssistant.getTodayNow(); +// String currentYear = currentDateTime.substring(0, 4); +// String month = currentDateTime.substring(5, 7); +// String day = currentDateTime.substring(8, 10); +// String hour = currentDateTime.substring(11, 13); +// String minute = currentDateTime.substring(14, 16); +// String second = currentDateTime.substring(17, 19); +// +// Integer year = Integer.parseInt(currentYear); +// if (null != queryYear) { +// year = queryYear; +// } +// Map paramMap = new HashMap(); +// paramMap.put("year", year + ""); +// paramMap.put("month", month + ""); +// paramMap.put("day", day + ""); +// paramMap.put("hour", hour + ""); +// paramMap.put("minute", minute + ""); +// paramMap.put("second", second + ""); +// +// int maxOrderNumber = getMaxOrderNumber(type, queryYear, tx); +// StringBuffer numberFormat = new StringBuffer(); +// for (int i = 0; i < numberCount; i++) { +// numberFormat.append("0"); +// } +// +// DecimalFormat df = new DecimalFormat(numberFormat.toString()); +// String serialNumberFormat = df.format(maxOrderNumber); +// paramMap.put("maxOrderNumber", serialNumberFormat); +// if (null != model) { +// paramMap.putAll(model); +// } +// String serialNumberString = getSerialNumber(paramMap, +// serialNumberPattern); +// +// return serialNumberString; +// } +// +// protected static synchronized String getSerialNumber( +// Map paramMap, String serialNumberPattern) { +// for (String key : paramMap.keySet()) { +// if (serialNumberPattern.indexOf("{" + key + "}") >= 0) { +// serialNumberPattern = serialNumberPattern.replace("{" + key +// + "}", paramMap.get(key)); +// } +// } +// return serialNumberPattern; +// } +// +// /*** +// * serialNumberPattern匹配值 {year}->年份,如果参数year为空则取当前年 {month}->当前月 {day}->当前日 +// * {hour}->时 {minute}->分 {second}->秒 {maxOrderNumber}->当前最大序号 +// * +// * **/ +// protected static synchronized String getSerialNumberByMonth( +// String serialNumberPattern, int numberCount, +// Map model, String type, Integer queryYear, +// Integer queryMonth, JBOTransaction tx) throws Exception { +// String currentDateTime = DateAssistant.getTodayNow(); +// String currentYear = currentDateTime.substring(0, 4); +// String monthStr = currentDateTime.substring(5, 7); +// String day = currentDateTime.substring(8, 10); +// String hour = currentDateTime.substring(11, 13); +// String minute = currentDateTime.substring(14, 16); +// String second = currentDateTime.substring(17, 19); +// +// int year = Integer.parseInt(currentYear); +// int month = Integer.parseInt(monthStr); +// if (null != queryYear) { +// year = queryYear; +// } +// if (null != queryMonth) { +// month = queryMonth; +// } +// Map paramMap = new HashMap(); +// paramMap.put("year", year + ""); +// paramMap.put("month", monthStr + ""); +// paramMap.put("day", day + ""); +// paramMap.put("hour", hour + ""); +// paramMap.put("minute", minute + ""); +// paramMap.put("second", second + ""); +// +// int maxOrderNumber = getMaxOrderNumberByMonth(type, year, month, tx); +// StringBuffer numberFormat = new StringBuffer(); +// for (int i = 0; i < numberCount; i++) { +// numberFormat.append("0"); +// } +// +// DecimalFormat df = new DecimalFormat(numberFormat.toString()); +// String serialNumberFormat = df.format(maxOrderNumber); +// paramMap.put("maxOrderNumber", serialNumberFormat); +// if (null != model) { +// paramMap.putAll(model); +// } +// +// String serialNumberString = getSerialNumber(paramMap, +// serialNumberPattern); +// +// return serialNumberString; +// } +// +// // 考虑并发情况必须采用同步机制 +// @SuppressWarnings("unchecked") +// protected static synchronized int getMaxOrderNumber(String type, +// Integer queryYear, JBOTransaction tx) throws Exception { +// int currentYear = Calendar.getInstance().get(Calendar.YEAR); +// BizObjectManager tNumberManager = JBOFactory +// .getBizObjectManager(T_SERIAL_NUMBER.CLASS_NAME); +// tx.join(tNumberManager); +// Map searchCondtion = new HashMap(); +// if (!StringX.isEmpty(type)) { +// searchCondtion.put("type_", type); +// } +// if (null != queryYear) { +// searchCondtion.put("year_", queryYear.toString()); +// +// } +// String querySql = DataOperatorUtil.getQuerySql(searchCondtion); +// BizObjectQuery bqDest = tNumberManager.createQuery(querySql); +// for (String key : searchCondtion.keySet()) { +// bqDest.setParameter(key, searchCondtion.get(key).toString()); +// } +// BizObject serialNumber = null; +// serialNumber = bqDest.getSingleResult(true);// 目标JBO,需要做更新操作 +// +// if (null == serialNumber) { +// +// serialNumber = tNumberManager.newObject(); +// if (null != queryYear) { +// currentYear = queryYear; +// } +// serialNumber.setAttributeValue("year_", currentYear); +// serialNumber.setAttributeValue("type_", type); +// serialNumber.setAttributeValue("order_number_", "0"); +// } +// int maxOrderNumber = Integer.valueOf(serialNumber.getAttribute( +// "order_number_").getInt()) + 1; +// serialNumber.setAttributeValue("order_number_", maxOrderNumber); +// tNumberManager.saveObject(serialNumber); +// return maxOrderNumber; +// } +// +// // 考虑并发情况必须采用同步机制 +// @SuppressWarnings("unchecked") +// protected static synchronized int getMaxOrderNumberByMonth(String type, +// Integer queryYear, Integer queryMonth, JBOTransaction tx) +// throws Exception { +// +// int currentYear = Calendar.getInstance().get(Calendar.YEAR); +// int currentMonth = Calendar.getInstance().get(Calendar.MONTH); +// BizObjectManager tNumberManager = JBOFactory +// .getBizObjectManager(T_SERIAL_NUMBER.CLASS_NAME); +// tx.join(tNumberManager); +// Map searchCondtion = new HashMap(); +// if (!StringX.isEmpty(type)) { +// searchCondtion.put("type_", type); +// } +// if (null != queryYear) { +// searchCondtion.put("year_", queryYear.toString()); +// +// } +// if (null != queryMonth) { +// searchCondtion.put("month_", queryMonth.toString()); +// +// } +// String querySql = DataOperatorUtil.getQuerySql(searchCondtion); +// BizObjectQuery bqDest = tNumberManager.createQuery(querySql); +// for (String key : searchCondtion.keySet()) { +// bqDest.setParameter(key, searchCondtion.get(key).toString()); +// } +// BizObject serialNumber = null; +// serialNumber = bqDest.getSingleResult(true);// 目标JBO,需要做更新操作 +// +// if (null == serialNumber) { +// +// serialNumber = tNumberManager.newObject(); +// if (null != queryYear) { +// currentYear = queryYear; +// } +// if (null != queryMonth) { +// currentMonth = queryMonth; +// } +// serialNumber.setAttributeValue("year_", currentYear); +// serialNumber.setAttributeValue("month_", currentMonth); +// serialNumber.setAttributeValue("type_", type); +// serialNumber.setAttributeValue("order_number_", "0"); +// } +// int maxOrderNumber = Integer.valueOf(serialNumber.getAttribute( +// "order_number_").getInt()) + 1; +// serialNumber.setAttributeValue("order_number_", maxOrderNumber); +// tNumberManager.saveObject(serialNumber); +// return maxOrderNumber; +// } +// +// /** +// * 优先从号码废弃池中取号,如果号码废弃池中没有待取号吗,则根据序列号生成 +// * +// * @param serialNumberPattern +// * @param numberCount +// * @param model +// * @param type +// * @param queryYear +// * @param hibernateTemplate +// * @param jdbcTemplate +// * @return +// * @throws Exception +// */ +// protected static synchronized String getSerialNumberFirstDiscard( +// String serialNumberPattern, int numberCount, +// Map model, String type, Integer queryYear, +// JBOTransaction tx) throws Exception { +// String currentDateTime = DateAssistant.getTodayNow(); +// String currentYear = currentDateTime.substring(0, 4); +// String month = currentDateTime.substring(5, 7); +// String day = currentDateTime.substring(8, 10); +// String hour = currentDateTime.substring(11, 13); +// String minute = currentDateTime.substring(14, 16); +// String second = currentDateTime.substring(17, 19); +// +// int year = Integer.parseInt(currentYear); +// if (null != queryYear) { +// year = queryYear; +// } +// Map paramMap = new HashMap(); +// paramMap.put("year", year + ""); +// paramMap.put("month", month + ""); +// paramMap.put("day", day + ""); +// paramMap.put("hour", hour + ""); +// paramMap.put("minute", minute + ""); +// paramMap.put("second", second + ""); +// +// int maxOrderNumber = 0; +// // 从废弃池查找可用号码 +// maxOrderNumber = getMinDiscardNumber(type, queryYear, tx); +// if (maxOrderNumber < 0) {// 废弃池中没有数据 +// maxOrderNumber = getMaxOrderNumber(type, year, tx); +// } +// StringBuffer numberFormat = new StringBuffer(); +// for (int i = 0; i < numberCount; i++) { +// numberFormat.append("0"); +// } +// DecimalFormat df = new DecimalFormat(numberFormat.toString()); +// String serialNumberFormat = df.format(maxOrderNumber); +// paramMap.put("maxOrderNumber", serialNumberFormat); +// if (null != model) { +// paramMap.putAll(model); +// } +// +// String serialNumberString = getSerialNumber(paramMap, +// serialNumberPattern); +// +// return serialNumberString; +// } +// +// @SuppressWarnings("unchecked") +// protected static synchronized int getMinDiscardNumber(String type, +// Integer queryYear, JBOTransaction tx) throws Exception { +// BizObjectManager tNumberManager = JBOFactory +// .getBizObjectManager(T_SERIAL_DISCARD_NUMBER.CLASS_NAME); +// tx.join(tNumberManager); +// Map searchCondtion = new HashMap(); +// if (!StringX.isEmpty(type)) { +// searchCondtion.put("type_", type); +// } +// if (null != queryYear) { +// searchCondtion.put("year_", queryYear.toString()); +// +// } +// +// String querySql = DataOperatorUtil.getQuerySql(searchCondtion); +// BizObjectQuery bqDest = tNumberManager.createQuery(querySql); +// for (String key : searchCondtion.keySet()) { +// bqDest.setParameter(key, searchCondtion.get(key).toString()); +// } +// BizObject serialNumber = null; +// serialNumber = bqDest.getSingleResult(true);// 目标JBO,需要做更新操作 +// +// if (null != serialNumber) { +// int minOrderNumber = serialNumber.getAttribute("discard_number_") +// .getInt(); +// tNumberManager.deleteObject(serialNumber); +// return minOrderNumber; +// } +// return -1; +// } +// +//} diff --git a/src_app/apx/com/amarsoft/als/base/util/StringUtil.java b/src_app_fresh/com/base/util/StringUtil.java similarity index 93% rename from src_app/apx/com/amarsoft/als/base/util/StringUtil.java rename to src_app_fresh/com/base/util/StringUtil.java index b36636cc0..0933a703c 100644 --- a/src_app/apx/com/amarsoft/als/base/util/StringUtil.java +++ b/src_app_fresh/com/base/util/StringUtil.java @@ -1,188 +1,189 @@ -package apx.com.amarsoft.als.base.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; - -/** - * - */ -public class StringUtil { - public static String nullToString(final Object obj, String... defaultValue) { - - if (obj != null) { - if (obj.getClass().isEnum()) { - return ((Enum) obj).name(); - } else { - return obj.toString(); - } - } - for (String v : defaultValue) { - return v; - } - return ""; - - } - - public static String booleanToString(final Boolean b, String... defaultValue) { - Boolean temp = b; - if (b == null) - temp = false; - - if (defaultValue != null) { - int c = defaultValue.length; - if (c > 0 && temp) - return defaultValue[0]; - if (c > 1 && !temp) - return defaultValue[1]; - } - return temp.toString(); - } - - public static String lTrim(String str) { - return str.replaceAll("^\\s*", ""); - } - - public static String rTrim(String str) { - return str.replaceAll("\\s*$", ""); - } - - @SuppressWarnings("rawtypes") - public static String join(Object items, String splitChar) { - StringBuffer sb = new StringBuffer(); - if (items instanceof Collection) { - Collection collectionItems = (Collection) items; - int index = 0; - for (Object collectionItem : collectionItems) { - if (++index > 1) { - sb.append(splitChar); - } - sb.append(StringUtil.nullToString(collectionItem)); - } - } else { - Object[] arrayItems = (Object[]) items; - for (int i = 0; i < arrayItems.length; i++) { - if (i > 0) { - sb.append(splitChar); - } - sb.append(StringUtil.nullToString(arrayItems[i])); - } - } - return sb.toString(); - } - - @SuppressWarnings("rawtypes") - public static String join(Object items, String splitChar, String itemPrefix, String itemSuffix) { - StringBuffer sb = new StringBuffer(); - if (items instanceof Collection) { - Collection collectionItems = (Collection) items; - int index = 0; - for (Object collectionItem : collectionItems) { - if (++index > 1) { - sb.append(splitChar); - } - sb.append(itemPrefix + StringUtil.nullToString(collectionItem) + itemSuffix); - } - } else { - Object[] arrayItems = (Object[]) items; - for (int i = 0; i < arrayItems.length; i++) { - if (i > 0) { - sb.append(splitChar); - } - sb.append(StringUtil.nullToString(arrayItems[i])); - } - } - return sb.toString(); - } - - public static String toSqlJoinString(String joinString, String splitChar) { - if (null == joinString) - return "''"; - String[] arr = joinString.split(splitChar); - StringBuffer sb = new StringBuffer(); - int index = 0; - for (String str : arr) { - if (index++ > 0) { - sb.append(","); - } - sb.append("'" + str + "'"); - } - return sb.toString(); - } - - public static String empty2Other(Object obj, String replaceValue) { - String value = StringUtil.nullToString(obj); - if (value.trim().isEmpty()) { - return replaceValue; - } - return value; - } - - public static String getJsonString(Object str) { - - return nullToString(str).replaceAll("\"", "'").replaceAll("\r", "\\\\r").replaceAll("\n", "\\\\n").replaceAll("\\\\", "\\\\\\\\"); - } - - public static String traceExceptionMessage(Object source, Throwable e) { - String newLine = System.getProperty("line.separator"); - StringBuffer exceptionInfo_sb = new StringBuffer(source.toString()); - exceptionInfo_sb.append(newLine + e.toString()); - StackTraceElement[] trace = e.getStackTrace(); - for (int i = 0; i < trace.length; i++) { - exceptionInfo_sb.append(newLine + "\t " + trace[i]); - } - return exceptionInfo_sb.toString(); - } - - public static String getClearWhereSQL(String table_sql_temp) { - /* - * Pattern p = Pattern.compile("\\s*where\\s*1\\s*=\\s*1\\s*and?", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); - * table_sql_temp = p.matcher(table_sql_temp).replaceAll(" _W_H_E_R_E_ "); - * p = Pattern.compile("\\s*where\\s*1\\s*=\\s*1\\s*", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); - * table_sql_temp = p.matcher(table_sql_temp).replaceAll(" "); - * p = Pattern.compile(" _W_H_E_R_E_ ", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); - * table_sql_temp = p.matcher(table_sql_temp).replaceAll(" WHERE "); - */ - return table_sql_temp; - } - - public static boolean isExistElement(Object[] arr, Object findValue) { - boolean isFound = false; - for (Object value : arr) { - if (findValue.equals(value)) { - isFound = true; - } - break; - } - return isFound; - } - - public static Collection getCollectionByString(String collectionType, String sourceString, String splitString) { - Collection collection = null; - if ("set".equalsIgnoreCase(collectionType)) { - collection = new HashSet(); - } else if ("list".equals(collectionType)) { - collection = new ArrayList(); - } - if (null == sourceString) { - return collection; - } - for (String str : sourceString.split(splitString)) { - collection.add(str); - } - return collection; - } - - public static Collection getLongCollectionByString(String collectionType, String sourceString, String splitString) { - Collection collection = null; - if ("set".equalsIgnoreCase(collectionType)) { - collection = new HashSet(); - } else if ("list".equals(collectionType)) { - collection = new ArrayList(); - } - for (String str : sourceString.split(splitString)) { - collection.add(Long.valueOf(str)); - } - return collection; - } -} +package com.base.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; + +/** + * @author tracywindy 2012-3-28 上午09:40:17 email:tracywindy@126.com + * + */ +public class StringUtil { + public static String nullToString(final Object obj, String... defaultValue) { + + if (obj != null) { + if (obj.getClass().isEnum()) { + return ((Enum) obj).name(); + } else { + return obj.toString(); + } + } + for (String v : defaultValue) { + return v; + } + return ""; + + } + + public static String booleanToString(final Boolean b, String... defaultValue) { + Boolean temp = b; + if (b == null) + temp = false; + + if (defaultValue != null) { + int c = defaultValue.length; + if (c > 0 && temp) + return defaultValue[0]; + if (c > 1 && !temp) + return defaultValue[1]; + } + return temp.toString(); + } + + public static String lTrim(String str) { + return str.replaceAll("^\\s*", ""); + } + + public static String rTrim(String str) { + return str.replaceAll("\\s*$", ""); + } + + @SuppressWarnings("unchecked") + public static String join(Object items, String splitChar) { + StringBuffer sb = new StringBuffer(); + if (items instanceof Collection) { + Collection collectionItems = (Collection) items; + int index = 0; + for (Object collectionItem : collectionItems) { + if (++index > 1) { + sb.append(splitChar); + } + sb.append(StringUtil.nullToString(collectionItem)); + } + } else { + Object[] arrayItems = (Object[]) items; + for (int i = 0; i < arrayItems.length; i++) { + if (i > 0) { + sb.append(splitChar); + } + sb.append(StringUtil.nullToString(arrayItems[i])); + } + } + return sb.toString(); + } + + @SuppressWarnings("unchecked") + public static String join(Object items, String splitChar, String itemPrefix, String itemSuffix) { + StringBuffer sb = new StringBuffer(); + if (items instanceof Collection) { + Collection collectionItems = (Collection) items; + int index = 0; + for (Object collectionItem : collectionItems) { + if (++index > 1) { + sb.append(splitChar); + } + sb.append(itemPrefix + StringUtil.nullToString(collectionItem) + itemSuffix); + } + } else { + Object[] arrayItems = (Object[]) items; + for (int i = 0; i < arrayItems.length; i++) { + if (i > 0) { + sb.append(splitChar); + } + sb.append(StringUtil.nullToString(arrayItems[i])); + } + } + return sb.toString(); + } + + public static String toSqlJoinString(String joinString, String splitChar) { + if (null == joinString) + return "''"; + String[] arr = joinString.split(splitChar); + StringBuffer sb = new StringBuffer(); + int index = 0; + for (String str : arr) { + if (index++ > 0) { + sb.append(","); + } + sb.append("'" + str + "'"); + } + return sb.toString(); + } + + public static String empty2Other(Object obj, String replaceValue) { + String value = StringUtil.nullToString(obj); + if (value.trim().isEmpty()) { + return replaceValue; + } + return value; + } + + public static String getJsonString(Object str) { + + return nullToString(str).replaceAll("\"", "'").replaceAll("\r", "\\\\r").replaceAll("\n", "\\\\n").replaceAll("\\\\", "\\\\\\\\"); + } + + public static String traceExceptionMessage(Object source, Throwable e) { + String newLine = System.getProperty("line.separator"); + StringBuffer exceptionInfo_sb = new StringBuffer(source.toString()); + exceptionInfo_sb.append(newLine + e.toString()); + StackTraceElement[] trace = e.getStackTrace(); + for (int i = 0; i < trace.length; i++) { + exceptionInfo_sb.append(newLine + "\t " + trace[i]); + } + return exceptionInfo_sb.toString(); + } + + public static String getClearWhereSQL(String table_sql_temp) { + /* + * Pattern p = Pattern.compile("\\s*where\\s*1\\s*=\\s*1\\s*and?", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); + * table_sql_temp = p.matcher(table_sql_temp).replaceAll(" _W_H_E_R_E_ "); + * p = Pattern.compile("\\s*where\\s*1\\s*=\\s*1\\s*", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); + * table_sql_temp = p.matcher(table_sql_temp).replaceAll(" "); + * p = Pattern.compile(" _W_H_E_R_E_ ", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); + * table_sql_temp = p.matcher(table_sql_temp).replaceAll(" WHERE "); + */ + return table_sql_temp; + } + + public static boolean isExistElement(Object[] arr, Object findValue) { + boolean isFound = false; + for (Object value : arr) { + if (findValue.equals(value)) { + isFound = true; + } + break; + } + return isFound; + } + + public static Collection getCollectionByString(String collectionType, String sourceString, String splitString) { + Collection collection = null; + if ("set".equalsIgnoreCase(collectionType)) { + collection = new HashSet(); + } else if ("list".equals(collectionType)) { + collection = new ArrayList(); + } + if (null == sourceString) { + return collection; + } + for (String str : sourceString.split(splitString)) { + collection.add(str); + } + return collection; + } + + public static Collection getLongCollectionByString(String collectionType, String sourceString, String splitString) { + Collection collection = null; + if ("set".equalsIgnoreCase(collectionType)) { + collection = new HashSet(); + } else if ("list".equals(collectionType)) { + collection = new ArrayList(); + } + for (String str : sourceString.split(splitString)) { + collection.add(Long.valueOf(str)); + } + return collection; + } +} diff --git a/src_app_fresh/com/base/util/WordToPDFUtil.java b/src_app_fresh/com/base/util/WordToPDFUtil.java new file mode 100644 index 000000000..fb7235f2f --- /dev/null +++ b/src_app_fresh/com/base/util/WordToPDFUtil.java @@ -0,0 +1,55 @@ +package com.base.util; +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; + +import org.apache.log4j.Logger; + +import com.amarsoft.are.ARE; +public class WordToPDFUtil { + // 将word格式的文件转换为pdf格式 + public synchronized static Boolean Word2Pdf(String srcPath, String desPath) throws Exception { + // 源文件目录 + File inputFile = new File(srcPath); + if (!inputFile.exists()) { + ARE.getLog().error("源文件不存在!"); + return false; + } + // 输出文件目录 + File outputFile = new File(desPath); + if (!outputFile.getParentFile().exists()) { + outputFile.getParentFile().exists(); + } + Process process = null; + //获取当前时间的毫秒数 + long start= System.currentTimeMillis(); + ARE.getLog().info("============转换pdf开始============"); + try{ + String cmd = "C:\\Program Files\\LibreOffice 5\\program\\soffice --headless -invisible --convert-to pdf "+srcPath+" --outdir "+desPath; + ARE.getLog().info("python:"+cmd); + process = Runtime.getRuntime().exec(cmd); + String cmdMsg = ""; + BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream())); + while((cmdMsg=bufferedReader.readLine()) !=null){ + ARE.getLog().info(cmdMsg); + } + process.waitFor(); + }catch(Exception e){ + e.printStackTrace(); + return false; + }finally{ + if(null!=process){ + process.destroy(); + } + long end = System.currentTimeMillis(); + //输出转换pdf所需毫秒数 + ARE.getLog().info(end-start+"毫秒"); + ARE.getLog().info("============转换pdf结束============"); + } + return true; + } + + public static void main(String[] args) throws Exception { + WordToPDFUtil.Word2Pdf("D:\\project\\clms_app_manage\\WebContent\\fileTemplate\\光大金融租赁公司融资租赁合同.docx", "d:\\woqu"); + } +} diff --git a/src_jbo/jbo/com/tenwa/entity/comm/own/LC_SOURCE_OF_FUNDS.java b/src_jbo/jbo/com/tenwa/entity/comm/own/LC_SOURCE_OF_FUNDS.java deleted file mode 100644 index 435bc107a..000000000 --- a/src_jbo/jbo/com/tenwa/entity/comm/own/LC_SOURCE_OF_FUNDS.java +++ /dev/null @@ -1,48 +0,0 @@ -package jbo.com.tenwa.entity.comm.own; - -import java.lang.String; - -/** -* 资金来源(每月底资金专员维护) - JBO命名常量类

      -* Note: This file is generated by ADE tools, dont modify it.
      - -*/ -public interface LC_SOURCE_OF_FUNDS{ - /** - * 资金来源(每月底资金专员维护)

      - * 代表本类映射的BizObjectClass - */ - public static final String CLASS_NAME = "jbo.com.tenwa.entity.comm.own.LC_SOURCE_OF_FUNDS"; - /** - * id STRING(32)
      - */ - public static final String id = "id"; - /** - * 是否借入资金 STRING(32)
      - */ - public static final String if_loan_money = "if_loan_money"; - /** - * 借款银行 STRING(32)
      - */ - public static final String loan_bank = "loan_bank"; - /** - * 借款合同号 STRING(32)
      - */ - public static final String loan_contract_no = "loan_contract_no"; - /** - * 借款本金(资金专员匹配) STRING(32)
      - */ - public static final String loan_principal = "loan_principal"; - /** - * 借款利率 STRING(32)
      - */ - public static final String loan_rate = "loan_rate"; - /** - * 当期利息费用(当月) STRING(32)
      - */ - public static final String current_interest_money = "current_interest_money"; - /** - * 累计利息费用(投放日至当月) STRING(32)
      - */ - public static final String cumulative_interest_money = "cumulative_interest_money"; -} \ No newline at end of file diff --git a/src_jbo/jbo/com/tenwa/lease/carbrand/LB_CARDATA_BRAND.java b/src_jbo/jbo/com/tenwa/lease/carbrand/LB_CARDATA_BRAND.java deleted file mode 100644 index b26558b29..000000000 --- a/src_jbo/jbo/com/tenwa/lease/carbrand/LB_CARDATA_BRAND.java +++ /dev/null @@ -1,92 +0,0 @@ -package jbo.com.tenwa.lease.carbrand; - -import java.lang.String; - -/** -* 二手车品牌表 - JBO命名常量类

      -* Note: This file is generated by ADE tools, dont modify it.
      - -*/ -public interface LB_CARDATA_BRAND{ - /** - * 二手车品牌表

      - * 代表本类映射的BizObjectClass - */ - public static final String CLASS_NAME = "jbo.com.tenwa.lease.carbrand.LB_CARDATA_BRAND"; - /** - * 标识编号 STRING(32)
      - */ - public static final String ID = "ID"; - /** - * 品牌ID STRING(32)
      - */ - public static final String brandid = "brandid"; - /** - * 品牌名称 STRING(100)
      - */ - public static final String brandname = "brandname"; - /** - * 品牌首字母 STRING(100)
      - */ - public static final String brandinitial = "brandinitial"; - /** - * 操作类型 STRING(100)
      - */ - public static final String opertype = "opertype"; - /** - * 车型时间戳 STRING(100)
      - */ - public static final String modeltimestamp = "modeltimestamp"; - /** - * 车系时间戳 STRING(100)
      - */ - public static final String seriestimestamp = "seriestimestamp"; - /** - * 品牌时间戳 STRING(100)
      - */ - public static final String brandtimestamp = "brandtimestamp"; - /** - * 当前版本号 STRING(100)
      - */ - public static final String currentversion = "currentversion"; - /** - * 最初版本号 STRING(100)
      - */ - public static final String initialversion = "initialversion"; - /** - * 保留字段1 STRING(100)
      - */ - public static final String retainfield1 = "retainfield1"; - /** - * 保留字段2 STRING(100)
      - */ - public static final String retainfield2 = "retainfield2"; - /** - * 保留字段3 STRING(100)
      - */ - public static final String retainfield3 = "retainfield3"; - /** - * 登记人 STRING(32)
      - */ - public static final String inputuserid = "inputuserid"; - /** - * 登记部门 STRING(32)
      - */ - public static final String inputorgid = "inputorgid"; - /** - * 登记时间 STRING(32)
      - */ - public static final String inputtime = "inputtime"; - /** - * 更新人 STRING(32)
      - */ - public static final String updateuserid = "updateuserid"; - /** - * 更新部门 STRING(32)
      - */ - public static final String updateorgid = "updateorgid"; - /** - * 更新时间 STRING(32)
      - */ - public static final String updatetime = "updatetime"; -} \ No newline at end of file diff --git a/src_jbo/jbo/com/tenwa/lease/carbrand/LB_CARDATA_MODEL.java b/src_jbo/jbo/com/tenwa/lease/carbrand/LB_CARDATA_MODEL.java deleted file mode 100644 index 9f2b11307..000000000 --- a/src_jbo/jbo/com/tenwa/lease/carbrand/LB_CARDATA_MODEL.java +++ /dev/null @@ -1,144 +0,0 @@ -package jbo.com.tenwa.lease.carbrand; - -import java.lang.String; - -/** -* - JBO命名常量类

      -* Note: This file is generated by ADE tools, dont modify it.
      - -*/ -public interface LB_CARDATA_MODEL{ - /** - *

      - * 代表本类映射的BizObjectClass - */ - public static final String CLASS_NAME = "jbo.com.tenwa.lease.carbrand.LB_CARDATA_MODEL"; - /** - * 标识编号 STRING(32)
      - */ - public static final String ID = "ID"; - /** - * 品牌ID STRING(32)
      - */ - public static final String brandid = "brandid"; - /** - * 品牌名称 STRING(100)
      - */ - public static final String brandname = "brandname"; - /** - * 车系ID STRING(32)
      - */ - public static final String seriesid = "seriesid"; - /** - * 车系名称 STRING(100)
      - */ - public static final String seriesname = "seriesname"; - /** - * 车系组名 STRING(100)
      - */ - public static final String seriesgroupname = "seriesgroupname"; - /** - * 车型ID STRING(32)
      - */ - public static final String modelid = "modelid"; - /** - * 车型名称 STRING(100)
      - */ - public static final String modelname = "modelname"; - /** - * 指导价 STRING(100)
      - */ - public static final String price = "price"; - /** - * 排量 STRING(100)
      - */ - public static final String liter = "liter"; - /** - * 变速箱 STRING(100)
      - */ - public static final String geartype = "geartype"; - /** - * 年款 STRING(100)
      - */ - public static final String modelyear = "modelyear"; - /** - * 制造商类型 STRING(100)
      - */ - public static final String makertype = "makertype"; - /** - * 排放标准 STRING(100)
      - */ - public static final String dischargestandard = "dischargestandard"; - /** - * 座位数 STRING(100)
      - */ - public static final String seatnumber = "seatnumber"; - /** - * 最小上牌年份 STRING(100)
      - */ - public static final String minregyear = "minregyear"; - /** - * 最大上牌年份 STRING(100)
      - */ - public static final String maxregyear = "maxregyear"; - /** - * 操作类型 STRING(100)
      - */ - public static final String opertype = "opertype"; - /** - * 车型时间戳 STRING(100)
      - */ - public static final String modeltimestamp = "modeltimestamp"; - /** - * 车系时间戳 STRING(100)
      - */ - public static final String seriestimestamp = "seriestimestamp"; - /** - * 品牌时间戳 STRING(100)
      - */ - public static final String brandtimestamp = "brandtimestamp"; - /** - * 当前版本号 STRING(100)
      - */ - public static final String currentversion = "currentversion"; - /** - * 最初版本号 STRING(100)
      - */ - public static final String initialversion = "initialversion"; - /** - * 保留字段1 STRING(100)
      - */ - public static final String retainfield1 = "retainfield1"; - /** - * 保留字段2 STRING(100)
      - */ - public static final String retainfield2 = "retainfield2"; - /** - * 保留字段3 STRING(100)
      - */ - public static final String retainfield3 = "retainfield3"; - /** - * 登记人 STRING(100)
      - */ - public static final String inputuserid = "inputuserid"; - /** - * 登记部门 STRING(100)
      - */ - public static final String inputorgid = "inputorgid"; - /** - * 登记时间 STRING(100)
      - */ - public static final String inputtime = "inputtime"; - /** - * 更新人 STRING(100)
      - */ - public static final String updateuserid = "updateuserid"; - /** - * 更新部门 STRING(100)
      - */ - public static final String updateorgid = "updateorgid"; - /** - * 更新时间 STRING(100)
      - */ - public static final String updatetime = "updatetime"; -} \ No newline at end of file diff --git a/src_jbo/jbo/com/tenwa/lease/carbrand/LB_CARDATA_SERIES.java b/src_jbo/jbo/com/tenwa/lease/carbrand/LB_CARDATA_SERIES.java deleted file mode 100644 index e72e9c3f9..000000000 --- a/src_jbo/jbo/com/tenwa/lease/carbrand/LB_CARDATA_SERIES.java +++ /dev/null @@ -1,108 +0,0 @@ -package jbo.com.tenwa.lease.carbrand; - -import java.lang.String; - -/** -* 二手车车系表 - JBO命名常量类

      -* Note: This file is generated by ADE tools, dont modify it.
      - -*/ -public interface LB_CARDATA_SERIES{ - /** - * 二手车车系表

      - * 代表本类映射的BizObjectClass - */ - public static final String CLASS_NAME = "jbo.com.tenwa.lease.carbrand.LB_CARDATA_SERIES"; - /** - * 标识编号 STRING(32)
      - */ - public static final String ID = "ID"; - /** - * 品牌ID STRING(32)
      - */ - public static final String brandid = "brandid"; - /** - * 品牌名称 STRING(100)
      - */ - public static final String brandname = "brandname"; - /** - * 车系ID STRING(32)
      - */ - public static final String seriesid = "seriesid"; - /** - * 车系名称 STRING(100)
      - */ - public static final String seriesname = "seriesname"; - /** - * 车系组名 STRING(100)
      - */ - public static final String seriesgroupname = "seriesgroupname"; - /** - * 汽车品种 STRING(100)
      - */ - public static final String levelname = "levelname"; - /** - * 制造商类型 STRING(100)
      - */ - public static final String makertype = "makertype"; - /** - * 操作类型 STRING(100)
      - */ - public static final String opertype = "opertype"; - /** - * 车型时间戳 STRING(100)
      - */ - public static final String modeltimestamp = "modeltimestamp"; - /** - * 车系时间戳 STRING(100)
      - */ - public static final String seriestimestamp = "seriestimestamp"; - /** - * 品牌时间戳 STRING(100)
      - */ - public static final String brandtimestamp = "brandtimestamp"; - /** - * 当前版本号 STRING(100)
      - */ - public static final String currentversion = "currentversion"; - /** - * 最初版本号 STRING(100)
      - */ - public static final String initialversion = "initialversion"; - /** - * 保留字段1 STRING(100)
      - */ - public static final String retainfield1 = "retainfield1"; - /** - * 保留字段2 STRING(100)
      - */ - public static final String retainfield2 = "retainfield2"; - /** - * 保留字段3 STRING(100)
      - */ - public static final String retainfield3 = "retainfield3"; - /** - * 登记人 STRING(32)
      - */ - public static final String inputuserid = "inputuserid"; - /** - * 登记部门 STRING(32)
      - */ - public static final String inputorgid = "inputorgid"; - /** - * 登记时间 STRING(32)
      - */ - public static final String inputtime = "inputtime"; - /** - * 更新人 STRING(32)
      - */ - public static final String updateuserid = "updateuserid"; - /** - * 更新部门 STRING(32)
      - */ - public static final String updateorgid = "updateorgid"; - /** - * 更新时间 STRING(32)
      - */ - public static final String updatetime = "updatetime"; -} \ No newline at end of file diff --git a/work/org/apache/jsp/money/sourceOfFundsInfo_jsp.class b/work/org/apache/jsp/money/sourceOfFundsInfo_jsp.class deleted file mode 100644 index 2bdee5c57..000000000 Binary files a/work/org/apache/jsp/money/sourceOfFundsInfo_jsp.class and /dev/null differ diff --git a/work/org/apache/jsp/money/sourceOfFundsInfo_jsp.java b/work/org/apache/jsp/money/sourceOfFundsInfo_jsp.java deleted file mode 100644 index 9f32a4d3f..000000000 --- a/work/org/apache/jsp/money/sourceOfFundsInfo_jsp.java +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Generated by the Jasper component of Apache Tomcat - * Version: Apache Tomcat/7.0.85 - * Generated at: 2018-05-29 03:54:07 UTC - * Note: The last modified time of this file was set to - * the last modified time of the source file after - * generation to assist with modification tracking. - */ -package org.apache.jsp.money; - -import javax.servlet.*; -import javax.servlet.http.*; -import javax.servlet.jsp.*; -import java.io.*; -import java.sql.*; -import java.text.*; -import java.util.*; -import com.amarsoft.are.ARE; -import com.amarsoft.are.lang.*; -import com.amarsoft.are.jbo.*; -import com.amarsoft.are.jbo.ql.*; -import com.amarsoft.are.security.*; -import com.amarsoft.are.util.*; -import com.amarsoft.amarscript.*; -import com.amarsoft.context.*; -import com.amarsoft.awe.*; -import com.amarsoft.awe.Configure; -import com.amarsoft.awe.RuntimeContext; -import com.amarsoft.awe.control.model.*; -import com.amarsoft.awe.util.*; -import com.amarsoft.web.ui.*; -import com.amarsoft.awe.ui.model.*; -import com.amarsoft.awe.ui.widget.*; -import com.amarsoft.awe.res.*; -import com.amarsoft.awe.res.model.*; -import com.amarsoft.dict.als.manage.*; -import com.amarsoft.awe.dw.*; -import com.amarsoft.awe.res.JspfText; - -public final class sourceOfFundsInfo_jsp extends org.apache.jasper.runtime.HttpJspBase - implements org.apache.jasper.runtime.JspSourceDependent { - - private static final javax.servlet.jsp.JspFactory _jspxFactory = - javax.servlet.jsp.JspFactory.getDefaultFactory(); - - private static java.util.Map _jspx_dependants; - - static { - _jspx_dependants = new java.util.HashMap(16); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/ow/info_context_menu.jspf", Long.valueOf(1526962688744L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_sqlca_tail.jspf", Long.valueOf(1526962689151L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_head_res.jspf", Long.valueOf(1526962729861L)); - _jspx_dependants.put("/AppMain/resources/include/app_tail.jspf", Long.valueOf(1526962738841L)); - _jspx_dependants.put("/Frame/resources/include/ui/include_buttonset_dw.jspf", Long.valueOf(1526962685797L)); - _jspx_dependants.put("/Frame/resources/include/include_end.jspf", Long.valueOf(1526962726941L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_debug.jspf", Long.valueOf(1526962687626L)); - _jspx_dependants.put("/Frame/resources/include/include_begin_info.jspf", Long.valueOf(1526962698913L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/ow/overdiv.jspf", Long.valueOf(1526962692238L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/ow/info.jspf", Long.valueOf(1526962727974L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/buttonset_dw.jspf", Long.valueOf(1526962734737L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_sqlca_head.jspf", Long.valueOf(1526962740677L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_head_res_dw.jspf", Long.valueOf(1526962743650L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_runtime_context.jspf", Long.valueOf(1526962715951L)); - _jspx_dependants.put("/AppMain/resources/include/app_head.jspf", Long.valueOf(1526962753987L)); - _jspx_dependants.put("/Frame/resources/include/ui/include_info.jspf", Long.valueOf(1526962745666L)); - } - - private volatile javax.el.ExpressionFactory _el_expressionfactory; - private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; - - public java.util.Map getDependants() { - return _jspx_dependants; - } - - public javax.el.ExpressionFactory _jsp_getExpressionFactory() { - if (_el_expressionfactory == null) { - synchronized (this) { - if (_el_expressionfactory == null) { - _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); - } - } - } - return _el_expressionfactory; - } - - public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { - if (_jsp_instancemanager == null) { - synchronized (this) { - if (_jsp_instancemanager == null) { - _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); - } - } - } - return _jsp_instancemanager; - } - - public void _jspInit() { - } - - public void _jspDestroy() { - } - - public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) - throws java.io.IOException, javax.servlet.ServletException { - - final javax.servlet.jsp.PageContext pageContext; - final javax.servlet.ServletContext application; - final javax.servlet.ServletConfig config; - javax.servlet.jsp.JspWriter out = null; - final java.lang.Object page = this; - javax.servlet.jsp.JspWriter _jspx_out = null; - javax.servlet.jsp.PageContext _jspx_page_context = null; - - - try { - response.setContentType("text/html; charset=GBK"); - pageContext = _jspxFactory.getPageContext(this, request, response, - "/Frame/page/control/ErrorPage.jsp", false, 65536, true); - _jspx_page_context = pageContext; - application = pageContext.getServletContext(); - config = pageContext.getServletConfig(); - out = pageContext.getOut(); - _jspx_out = out; - - out.write('\r'); - out.write('\n'); - - response.setHeader("Cache-Control","no-store"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader("Expires",0); - - HttpSession session = request.getSession(false); - if (session== null) throw new Exception("------Timeout------"); - RuntimeContext CurARC = (RuntimeContext)session.getAttribute("CurARC"); - if(CurARC == null) throw new Exception("------Timeout------"); - - Configure CurConfig = Configure.getInstance(application); - if(CurConfig ==null) throw new Exception("璇诲彇閰嶇疆鏂囦欢閿欒锛佽妫鏌ラ厤缃枃浠"); - - String sWebRootPath = request.getContextPath(); - if(!CurConfig.getContextPath().equals(sWebRootPath)) CurConfig.setContextPath(sWebRootPath); - String sServletURL = request.getServletPath(); - - String sCompClientID = request.getParameter("CompClientID"); - if(sCompClientID==null) sCompClientID=""; - - ASUser CurUser = CurARC.getUser(); - ASOrg CurOrg = CurUser.getBelongOrg(); - ASPreference CurPref = CurARC.getPref(); - String sSkinPath = CurUser.getSkin().getPath(); - - String[] functions = {"getItemName","getOrgName","getUserName","getCustomerName","getBusinessName","getObjectTypeName", - "getFlowName","getPhaseName","getRoleName","getModelName", - "concat","nvl","substr"}; - for(int i=0;i\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write(""); -/* 椤圭洰搴旂敤鎵╁睍鍐呭*/ - out.write("\n"); - out.write(" "); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write(""); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - -boolean isShowButton = true; -String sButtonPosition = "north"; -String sBrowserTitle = ""; -String sASNavigatorHtml =""; -String sASWizardHtml = ""; - - - /* - Author: undefined 2018-05-29 - Content: 绀轰緥璇︽儏椤甸潰 - History Log: - */ - String sPrevUrl = CurPage.getParameter("ID"); - if(sPrevUrl == null) sPrevUrl = "/money/sourceOfFunds.jsp"; - - String sTempletNo = "sourceOfFundsInfo";//--妯℃澘鍙-- - ASObjectModel doTemp = new ASObjectModel(sTempletNo); - doTemp.setColTips("", "娴嬭瘯"); - ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); - dwTemp.Style = "2";//freeform - //dwTemp.ReadOnly = "-2";//鍙妯″紡 - dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); - - String sButtons[][] = { - {"true","All","Button","淇濆瓨","淇濆瓨鎵鏈変慨鏀","save()","","","",""}, - {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","杩斿洖","杩斿洖鍒楄〃","returnList()","","","",""} - }; - sButtonPosition = "south"; - - out.write("\n"); - out.write("\n"); - out.write("
      \n"); - out.write("\t
      \n"); - out.write("
      \n"); - out.write("
      \n"); - out.write("
      \n"); - out.write(" \t
        \n"); - out.write("\t\t
      \n"); - out.write("\t
      \n"); - out.write("\t
      \n"); - out.write("\t\t
        \n"); - out.write("\t\t
      \n"); - out.write("\t
      \n"); - out.write("\t\n"); - out.write(" \n"); - out.write("
      \n"); - out.write("\n"); - out.write("\n"); - out.write("\t\n"); - out.write("\n"); - out.write("\n"); - out.write("\t\n"); - out.write("\n"); - -if(com.amarsoft.awe.ui.model.ItemHelp.isShowButton(isShowButton,sButtons) && ("both".equalsIgnoreCase(sButtonPosition) || "north".equalsIgnoreCase(sButtonPosition)) ){ - out.write("\n"); - out.write("\t\n"); - out.write("\t\t\n"); - out.write("\t\n"); -} - out.write("\n"); - out.write("\t \n"); - out.write("\t\n"); - out.write("
      \n"); - out.write("\t\t"); - out.print(sASNavigatorHtml); - out.write("\n"); - out.write("
      \n"); - out.write("\t\t"); - out.print(sASWizardHtml); - out.write("\n"); - out.write("
      \n"); - out.write("\t\t\t"); - out.print(Button.getHtmlText(sButtons, CurUser, CurPage, CurConfig)); - out.write("\n"); - out.write("\t
      \n"); - out.write("\t\t\t
      \n"); - out.write("\t\t\t
      \n"); - out.write("\t\t\t\t"); -out.print(CurPage.getObjectWindowOutput().get(0)); - out.write("\n"); - out.write("\t\t\t\t\n"); - out.write("\t\t\t
      \n"); - out.write("\t\t\t
      \n"); - out.write("\t\t\t\t"); -if(com.amarsoft.awe.ui.model.ItemHelp.isShowButton(isShowButton,sButtons) && ("both".equalsIgnoreCase(sButtonPosition) || "south".equalsIgnoreCase(sButtonPosition)) ){ - out.write("\n"); - out.write("\t\t\t\t\t
      \n"); - out.write("\t\t\t\t\t\t
      \n"); - out.write("\t\t\t\t\t\t"); - out.print(Button.getHtmlText(sButtons, CurUser, CurPage, CurConfig)); - out.write(" \n"); - out.write("\t\t\t\t\t
      \n"); - out.write("\t\t\t\t"); -} - out.write("\n"); - out.write("\t
      \n"); - -ButtonItem [] biButtonArray = ItemHelp.getButtonItemArray(CurUser,sButtons,CurComp.getAttribute("RightType",10),request.getRequestURI().substring(request.getRequestURI().indexOf(sWebRootPath)+sWebRootPath.length())); - - out.write("\n"); - out.write("
      \n"); - out.write("\t"); - - if(biButtonArray!=null){ - - for(int i=0;i0){ - iconCls = "iconCls=\""+ iconCls +"\""; - } - else{ - if(biButtonArray[i].getText().equals("鏂板")){ - iconCls = "btn_icon_add"; - iconCls = "iconCls=\""+ iconCls +"\""; - } - else if(biButtonArray[i].getText().equals("淇濆瓨")){ - iconCls = "btn_icon_save"; - iconCls = "iconCls=\""+ iconCls +"\""; - } - else if(biButtonArray[i].getText().equals("璇︽儏")){ - iconCls = "btn_icon_detail"; - iconCls = "iconCls=\""+ iconCls +"\""; - } - else if(biButtonArray[i].getText().equals("鎻愪氦")){ - iconCls = "btn_icon_submit"; - iconCls = "iconCls=\""+ iconCls +"\""; - } - else if(biButtonArray[i].getText().equals("鍒犻櫎")){ - iconCls = "btn_icon_delete"; - iconCls = "iconCls=\""+ iconCls +"\""; - } - } - out.println("
      "+biButtonArray[i].getText()+"
      "); - } - } - //out.println("
      "); - } - out.write("\n"); - out.write("\t\n"); - out.write("\t\n"); - out.write("
      "); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("
      \n"); - out.write("\t\n"); - out.write("
      \t\n"); - out.write("
      \n"); - out.write("\t
        ["); - out.print(LanguageManager.getOWSystemLanguage(CurUser.getLanguage(), JspfText.Sure) ); - out.write("] 
      \n"); - out.write("\t
      \n"); - out.write("
      "); - out.write("\r\n"); - out.write("\r\n"); - -if(sCurRunMode!=null && sCurRunMode.equals("Development")){ - - out.write("\n"); - out.write("\n"); -}else{ - out.write("\n"); - out.write("\n"); -} - -}catch(Exception e){ - if(Sqlca!=null) Sqlca.rollback(); - e.printStackTrace(); - ARE.getLog().error(e.getMessage(),e); - throw e; -}finally{ - if(Sqlca!=null){ - Sqlca.commit(); - Sqlca.disConnect(); - Sqlca = null; - } -} - -/* 椤圭洰搴旂敤鎵╁睍鍐呭 */ - out.write("\n"); - out.write(""); - } catch (java.lang.Throwable t) { - if (!(t instanceof javax.servlet.jsp.SkipPageException)){ - out = _jspx_out; - if (out != null && out.getBufferSize() != 0) - try { - if (response.isCommitted()) { - out.flush(); - } else { - out.clearBuffer(); - } - } catch (java.io.IOException e) {} - if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); - else throw new ServletException(t); - } - } finally { - _jspxFactory.releasePageContext(_jspx_page_context); - } - } -} diff --git a/work/org/apache/jsp/money/sourceOfFunds_jsp.class b/work/org/apache/jsp/money/sourceOfFunds_jsp.class deleted file mode 100644 index 46488583d..000000000 Binary files a/work/org/apache/jsp/money/sourceOfFunds_jsp.class and /dev/null differ diff --git a/work/org/apache/jsp/money/sourceOfFunds_jsp.java b/work/org/apache/jsp/money/sourceOfFunds_jsp.java deleted file mode 100644 index 62f485ffb..000000000 --- a/work/org/apache/jsp/money/sourceOfFunds_jsp.java +++ /dev/null @@ -1,719 +0,0 @@ -/* - * Generated by the Jasper component of Apache Tomcat - * Version: Apache Tomcat/7.0.56 - * Generated at: 2018-06-04 10:19:22 UTC - * Note: The last modified time of this file was set to - * the last modified time of the source file after - * generation to assist with modification tracking. - */ -package org.apache.jsp.money; - -import javax.servlet.*; -import javax.servlet.http.*; -import javax.servlet.jsp.*; -import java.io.*; -import java.sql.*; -import java.text.*; -import java.util.*; -import com.amarsoft.are.ARE; -import com.amarsoft.are.lang.*; -import com.amarsoft.are.jbo.*; -import com.amarsoft.are.jbo.ql.*; -import com.amarsoft.are.security.*; -import com.amarsoft.are.util.*; -import com.amarsoft.amarscript.*; -import com.amarsoft.context.*; -import com.amarsoft.awe.*; -import com.amarsoft.awe.Configure; -import com.amarsoft.awe.RuntimeContext; -import com.amarsoft.awe.control.model.*; -import com.amarsoft.awe.util.*; -import com.amarsoft.web.ui.*; -import com.amarsoft.awe.ui.model.*; -import com.amarsoft.awe.ui.widget.*; -import com.amarsoft.awe.res.*; -import com.amarsoft.awe.res.model.*; -import com.amarsoft.dict.als.manage.*; -import com.amarsoft.awe.dw.*; -import com.amarsoft.awe.res.LanguageManager; -import com.amarsoft.awe.res.JspfText; -import com.amarsoft.awe.res.JspfText; -import com.amarsoft.awe.control.model.Parameter; - -public final class sourceOfFunds_jsp extends org.apache.jasper.runtime.HttpJspBase - implements org.apache.jasper.runtime.JspSourceDependent { - - private static final javax.servlet.jsp.JspFactory _jspxFactory = - javax.servlet.jsp.JspFactory.getDefaultFactory(); - - private static java.util.Map _jspx_dependants; - - static { - _jspx_dependants = new java.util.HashMap(17); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_sqlca_tail.jspf", Long.valueOf(1528075721151L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/ow/list.jspf", Long.valueOf(1528075740525L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_head_res.jspf", Long.valueOf(1528075733681L)); - _jspx_dependants.put("/AppMain/resources/include/app_tail.jspf", Long.valueOf(1528075735041L)); - _jspx_dependants.put("/Frame/resources/include/ui/include_buttonset_dw.jspf", Long.valueOf(1528075720521L)); - _jspx_dependants.put("/Frame/resources/include/include_end.jspf", Long.valueOf(1528075733311L)); - _jspx_dependants.put("/Frame/resources/include/include_begin_list.jspf", Long.valueOf(1528075740415L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_debug.jspf", Long.valueOf(1528075720881L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/ow/overdiv.jspf", Long.valueOf(1528075721968L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/buttonset_dw.jspf", Long.valueOf(1528075734591L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_sqlca_head.jspf", Long.valueOf(1528075737825L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_head_res_dw.jspf", Long.valueOf(1528075738825L)); - _jspx_dependants.put("/Frame/resources/include/ui/include_list.jspf", Long.valueOf(1528075722458L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_runtime_context.jspf", Long.valueOf(1528075728280L)); - _jspx_dependants.put("/AppMain/resources/include/app_head.jspf", Long.valueOf(1528075740625L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/ow/full_filter.jspf", Long.valueOf(1528075731601L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/ow/list_context_menu.jspf", Long.valueOf(1528075721171L)); - } - - private javax.el.ExpressionFactory _el_expressionfactory; - private org.apache.tomcat.InstanceManager _jsp_instancemanager; - - public java.util.Map getDependants() { - return _jspx_dependants; - } - - public void _jspInit() { - _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); - _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); - } - - public void _jspDestroy() { - } - - public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) - throws java.io.IOException, javax.servlet.ServletException { - - final javax.servlet.jsp.PageContext pageContext; - final javax.servlet.ServletContext application; - final javax.servlet.ServletConfig config; - javax.servlet.jsp.JspWriter out = null; - final java.lang.Object page = this; - javax.servlet.jsp.JspWriter _jspx_out = null; - javax.servlet.jsp.PageContext _jspx_page_context = null; - - - try { - response.setContentType("text/html; charset=GBK"); - pageContext = _jspxFactory.getPageContext(this, request, response, - "/Frame/page/control/ErrorPage.jsp", false, 65536, true); - _jspx_page_context = pageContext; - application = pageContext.getServletContext(); - config = pageContext.getServletConfig(); - out = pageContext.getOut(); - _jspx_out = out; - - out.write('\n'); - - response.setHeader("Cache-Control","no-store"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader("Expires",0); - - HttpSession session = request.getSession(false); - if (session== null) throw new Exception("------Timeout------"); - RuntimeContext CurARC = (RuntimeContext)session.getAttribute("CurARC"); - if(CurARC == null) throw new Exception("------Timeout------"); - - Configure CurConfig = Configure.getInstance(application); - if(CurConfig ==null) throw new Exception("璇诲彇閰嶇疆鏂囦欢閿欒锛佽妫鏌ラ厤缃枃浠"); - - String sWebRootPath = request.getContextPath(); - if(!CurConfig.getContextPath().equals(sWebRootPath)) CurConfig.setContextPath(sWebRootPath); - String sServletURL = request.getServletPath(); - - String sCompClientID = request.getParameter("CompClientID"); - if(sCompClientID==null) sCompClientID=""; - - ASUser CurUser = CurARC.getUser(); - ASOrg CurOrg = CurUser.getBelongOrg(); - ASPreference CurPref = CurARC.getPref(); - String sSkinPath = CurUser.getSkin().getPath(); - - String[] functions = {"getItemName","getOrgName","getUserName","getCustomerName","getBusinessName","getObjectTypeName", - "getFlowName","getPhaseName","getRoleName","getModelName", - "concat","nvl","substr"}; - for(int i=0;i\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write(""); -/* 椤圭洰搴旂敤鎵╁睍鍐呭*/ - out.write("\n"); - out.write(" "); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write(""); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - - boolean isShowFilter = true; - boolean isShowButton = true; - String sBrowserTitle = ""; - String sButtonPosition = "north"; - String sASNavigatorHtml =""; - String sASWizardHtml = ""; - String pageSize = CurPage.getParameter("PageSize"); - if(CurConfig.getConfigure("ListQuerySelection")!=null){ - - out.write("\n"); - out.write("\t\n"); -} - - /* - Author: undefined 2018-05-29 - Content: - History Log: - */ - ASObjectModel doTemp = new ASObjectModel("sourceOfFunds"); - ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); - dwTemp.Style="1"; //--璁剧疆涓篏rid椋庢牸-- - dwTemp.ReadOnly = "1"; //鍙妯″紡 - dwTemp.setPageSize(10); - dwTemp.genHTMLObjectWindow(""); - - //0銆佹槸鍚﹀睍绀 1銆 鏉冮檺鎺у埗 2銆 灞曠ず绫诲瀷 3銆佹寜閽樉绀哄悕绉 4銆佹寜閽В閲婃枃瀛 5銆佹寜閽Е鍙戜簨浠朵唬鐮 6銆 7銆 8銆 9銆佸浘鏍囷紝CSS灞傚彔鏍峰紡 10銆侀鏍 - String sButtons[][] = { - {"true","All","Button","鏂板","鏂板","newRecord()","","","","btn_icon_add",""}, - {"true","","Button","璇︽儏","璇︽儏","viewAndEdit()","","","","btn_icon_detail",""}, - {"true","","Button","鍒犻櫎","鍒犻櫎","if(confirm('纭疄瑕佸垹闄ゅ悧?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, - }; - - -String pagesize=CurPage.getParameter("PageSize"); -if(pagesize==null){pagesize=dwTemp.getPageSize()+"";} -dwTemp.setPageSize(Integer.valueOf(pagesize)); -dwTemp.genHTMLObjectWindow(""); - - out.write('\n'); - out.write("\n"); - out.write("\n"); -for(String outString : CurPage.getObjectWindowOutput()) out.print(outString); - out.write("\n"); - out.write("\n"); - out.write("
      \n"); - out.write("
      \n"); - out.write("
      \n"); - out.write("
      \n"); - out.write("
      \n"); - out.write(" \t
        \n"); - out.write("\t\t
      \n"); - out.write("\t
      \n"); - out.write("\t
      \n"); - out.write("\t\t
        \n"); - out.write("\t\t
      \n"); - out.write("\t
      \n"); - out.write("\t\n"); - out.write(" \n"); - out.write("
      \n"); - out.write("\n"); -if(!com.amarsoft.are.lang.StringX.isSpace(sASNavigatorHtml)){ - out.write("\n"); - out.write("\t\n"); - out.write(""); -} - out.write('\n'); -if(!com.amarsoft.are.lang.StringX.isSpace(sASWizardHtml)){ - out.write("\n"); - out.write("\t\n"); - out.write(""); -} - out.write('\n'); -if(com.amarsoft.awe.ui.model.ItemHelp.isShowButton(isShowButton,sButtons) && sButtons.length > 0 && ("both".equalsIgnoreCase(sButtonPosition) || "north".equalsIgnoreCase(sButtonPosition))){ - out.write("\n"); - out.write("\n"); - out.write("\t\n"); - out.write("\n"); -} - out.write("\n"); - out.write("\n"); - out.write("\t \n"); - out.write("\t\n"); - out.write("\t\n"); - out.write("\t"); -if(com.amarsoft.awe.ui.model.ItemHelp.isShowButton(isShowButton,sButtons) && ("both".equalsIgnoreCase(sButtonPosition) || "south".equalsIgnoreCase(sButtonPosition))){ - out.write("\n"); - out.write("\t\n"); - out.write("\n"); - out.write("\t\n"); - out.write("\n"); -} - out.write("\n"); - out.write("
      \n"); - out.write("\t\t"); - out.print(sASNavigatorHtml); - out.write("\n"); - out.write("
      \n"); - out.write("\t\t"); - out.print(sASWizardHtml); - out.write("\n"); - out.write("
      \n"); - out.write("\t\t"); - out.print(Button.getHtmlText(sButtons, CurUser, CurPage, CurConfig)); - out.write("\n"); - out.write("
      \n"); - out.write("\t \t\n"); - out.write("\t\t\t
      \n"); - out.write("\t\t\t"); - - //鐢熸垚鎼滅储鎸夐挳 - String[][] sSearchButtons = { - {"true","纭畾","纭畾","if(tableSearchFromInput())document.getElementById('TableFilter').style.display='none';","","","",""}, - {"true","鍙栨秷","鍙栨秷","document.getElementById('TableFilter').style.display='none'","","","",""} - }; - - out.write("\n"); - out.write("\t\t\t
      \n"); - out.write("\t\t\t\t\n"); - out.write("\t\t\t
      \n"); - out.write("\t\t\t
      \n"); - out.write("\t\t\t\n"); - out.write("\t\t\t"); - out.write('\n'); - -ButtonItem btFIlter1 = new ButtonItem("纭畾","纭畾","if(tableSearchFromInput())document.getElementById('TableFilter').style.display='none';"); -ButtonItem btFIlter2 = new ButtonItem("楂樼骇","楂樼骇","openFullFilter(0,event)"); -ButtonItem btFIlter20 = new ButtonItem("杩樺師","杩樺師","TableFactory.clearFilter(0);if(tableSearchFromInput())document.getElementById('TableFilter').style.display='none';"); -ButtonItem btFIlter21 = new ButtonItem("鍏抽棴","鍏抽棴","document.getElementById('TableFilter').style.display='none';"); - - out.write("
      \n"); - out.write("\t\n"); - out.write("\t\n"); - out.write("\t\n"); - out.write("\t\n"); - out.write("\t\n"); - out.write("\t
      \n"); - out.write("\t"); - out.print(new Button(btFIlter1).getHtmlText()); - out.write("\n"); - out.write("\t\n"); - out.write("\t"); - out.print(new Button(btFIlter2).getHtmlText()); - out.write("\n"); - out.write("\t\n"); - out.write("\t"); - out.print(new Button(btFIlter20).getHtmlText()); - out.write("\n"); - out.write("\t\n"); - out.write("\t"); - out.print(new Button(btFIlter21).getHtmlText()); - out.write("\n"); - out.write("\t
      \n"); - out.write("
      \n"); - out.write("
      \n"); - out.write("\t\n"); - out.write("
      \n"); - out.write(""); - out.write("\n"); - out.write("\t\t\t\n"); - out.write("\t\t\t
      \n"); - out.write("\t\t\t\n"); - out.write("\t\t\t
      \n"); - out.write("\t\t
      \n"); - out.write("\t\t"); - out.print(Button.getHtmlText(sButtons, CurUser, CurPage, CurConfig)); - out.write("\n"); - out.write("
      \n"); - -String sUrlBase2 = request.getRequestURI().substring(request.getRequestURI().indexOf(sWebRootPath)+sWebRootPath.length()); -ButtonItem [] biButtonArray = ItemHelp.getButtonItemArray(CurUser,sButtons,CurComp.getAttribute("RightType",10),sUrlBase2); - - out.write("\n"); - out.write("
      \n"); - out.write("\t
      鍒锋柊
      \n"); - out.write("\t
      \n"); - out.write("\t
      鍏ㄩ儴閫変腑
      \n"); - out.write("\t
      鍏ㄩ儴鍙栨秷
      \n"); - out.write("\t"); - - if(biButtonArray!=null){ - out.println("
      "); - for(int i=0;i0) - iconCls = "iconCls=\""+ iconCls +"\""; - else{ - if(biButtonArray[i].getText().equals("鏂板")){ - iconCls = "btn_icon_add"; - iconCls = "iconCls=\""+ iconCls +"\""; - } - else if(biButtonArray[i].getText().equals("淇濆瓨")){ - iconCls = "btn_icon_save"; - iconCls = "iconCls=\""+ iconCls +"\""; - } - else if(biButtonArray[i].getText().equals("鍒犻櫎")){ - iconCls = "btn_icon_delete"; - iconCls = "iconCls=\""+ iconCls +"\""; - } - } - out.println("
      "+biButtonArray[i].getText()+"
      "); - //System.out.println("
      "+biButtonArray[i].getText()+"
      "); - } - } - } - out.write("\n"); - out.write("
      "); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("
      \n"); - out.write("\t\n"); - out.write("
      \t\n"); - out.write("
      \n"); - out.write("\t
        ["); - out.print(LanguageManager.getOWSystemLanguage(CurUser.getLanguage(), JspfText.Sure) ); - out.write("] 
      \n"); - out.write("\t
      \n"); - out.write("
      "); - out.write('\n'); - out.write('\n'); - -Vector param=CurComp.getParameterList(); -String newParam=""; -for(int i=0;i0){newParam+="&";} - newParam+=param.get(i).paraName+"="+param.get(i).paraValue; - } -} -String sourceUrl=CurComp.getAttribute("ComponentURL"); -String newtarget=CurComp.getAttribute("TargetWindow"); - - out.write("\n"); - out.write(""); - out.write("\n"); - out.write("\n"); - -if(sCurRunMode!=null && sCurRunMode.equals("Development")){ - - out.write("\n"); - out.write("\n"); -}else{ - out.write("\n"); - out.write("\n"); -} - -}catch(Exception e){ - if(Sqlca!=null) Sqlca.rollback(); - e.printStackTrace(); - ARE.getLog().error(e.getMessage(),e); - throw e; -}finally{ - if(Sqlca!=null){ - Sqlca.commit(); - Sqlca.disConnect(); - Sqlca = null; - } -} - -/* 椤圭洰搴旂敤鎵╁睍鍐呭 */ - out.write("\n"); - out.write(""); - } catch (java.lang.Throwable t) { - if (!(t instanceof javax.servlet.jsp.SkipPageException)){ - out = _jspx_out; - if (out != null && out.getBufferSize() != 0) - try { - if (response.isCommitted()) { - out.flush(); - } else { - out.clearBuffer(); - } - } catch (java.io.IOException e) {} - if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); - else throw new ServletException(t); - } - } finally { - _jspxFactory.releasePageContext(_jspx_page_context); - } - } -}