diff --git a/build.xml b/build.xml index 81f002e76c69ea95d12307901081c84e052581fb..1cf9e28cd6057abbaed2f8ab1b222b0eed899516 100644 --- a/build.xml +++ b/build.xml @@ -45,14 +45,14 @@ project.setNewProperty("length_aix_mb", length_aix_mbytes); ]]> - - + + @@ -116,14 +116,14 @@ "url": "/download/o2server-${VERSION}-aix.zip", "sha256": "${build_aix.sha}" }, - "raspberrypi": { + "raspi": { "system": "raspberrypi", "name": "o2server-${VERSION}-raspi.zip", "fileName": "o2server-${VERSION}-raspi.zip", "fileSize": "${length_raspberrypi_mb}MB", "updateTime": "${TODAY}", "url": "/download/o2server-${VERSION}-raspi.zip", - "sha256": "${build_raspberrypi.sha}" + "sha256": "${build_raspi.sha}" }, "mips": { "system": "mips", @@ -185,14 +185,14 @@ "url": "/download/o2server-${VERSION}-aix.zip", "sha256": "${build_aix.sha}" }, - "raspberrypi": { - "system": "raspberrypi", + "raspi": { + "system": "raspi", "name": "o2server-${VERSION}-raspi.zip", "fileName": "o2server-${VERSION}-raspi.zip", - "fileSize": "${length_raspberrypi_mb}MB", + "fileSize": "${length_raspi_mb}MB", "updateTime": "${TODAY}", "url": "/download/o2server-${VERSION}-raspi.zip", - "sha256": "${build_raspberrypi.sha}" + "sha256": "${build_raspi.sha}" }, "mips": { "system": "mips", @@ -220,7 +220,7 @@ } } - + @@ -308,7 +308,7 @@ - + @@ -320,7 +320,7 @@ - + diff --git a/gulpfile.js b/gulpfile.js index b3e14a849a2f8814747cec43d2e0880806def360..c1039f0add596b13dcbcb4b0d309a0baf00baee5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -19,6 +19,8 @@ var fg = require('fast-glob'); var logger = require('gulp-logger'); var assetRev = require('gulp-tm-asset-rev'); const os = require('os'); +var through2 = require('through2'); +var path = require('path'); //var downloadHost = "download.o2oa.net"; // var downloadHost = "release.o2oa.net"; @@ -46,7 +48,7 @@ var jvmUrls = { "arm": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/arm", "macos": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/macos", "risc": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/risc", - "raspberrypi": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/raspberrypi", + "raspi": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/raspi", "windows": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/windows" }; @@ -57,15 +59,16 @@ var scripts = { "arm": ["o2server/*arm*", "o2server/*.jar", "o2server/*.html", "o2server/version.o2"], "macos": ["o2server/*macos*", "o2server/*.jar", "o2server/*.html", "o2server/version.o2"], "risc": ["o2server/*risc*", "o2server/*.jar", "o2server/*.html", "o2server/version.o2"], - "raspberrypi": ["o2server/*raspberrypi*", "o2server/*.jar", "o2server/*.html", "o2server/version.o2"], + "raspi": ["o2server/*raspi*", "o2server/*.jar", "o2server/*.html", "o2server/version.o2"], "windows": ["o2server/*windows*", "o2server/*.jar", "o2server/*.html", "o2server/version.o2"] }; var o_options = minimist(process.argv.slice(2), {//upload: local ftp or sftp - string: ["e"] + string: ["e", "lp"] }); var options = {}; options.ev = o_options.e || "all"; +options.lp = o_options.lp || "zh-cn"; var jvmUrl = jvmUrls[options.ev]; var scriptSource = scripts[options.ev]; @@ -460,6 +463,8 @@ function build_concat_xform(){ 'o2web/source/' + path + '/DatagridPC.js', 'o2web/source/' + path + '/Textfield.js', 'o2web/source/' + path + '/Personfield.js', + 'o2web/source/' + path + '/Button.js', + 'o2web/source/' + path + '/ViewSelector.js', 'o2web/source/' + path + '/*.js', 'o2web/source/x_component_process_Work/Processor.js', '!o2web/source/' + path + '/Office.js' @@ -491,9 +496,100 @@ function build_bundle(){ .pipe(gulp.dest(dest)) } -function build_concat_basework() { + +function concat_Actions(){ + return through2.obj(function (file, enc, cb) { + if (file.isNull()) { + this.push(file); + return cb(); + } + + if (file.isStream()) { + this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported')); + return cb(); + } + var content = file.contents.toString(); + + var o = path.parse(file.path); + var name = o.name; + content = "var actionJson = "+content; + content = content+"\nif (!o2.xAction.RestActions.Action[\""+name+"\"]) o2.xAction.RestActions.Action[\""+name+"\"] = new Class({Extends: o2.xAction.RestActions.Action});"; + content = content+"\no2.Actions.actions[\""+name+"\"] = new o2.xAction.RestActions.Action[\""+name+"\"](\""+name+"\", actionJson);"; + + file.contents = new Buffer.from(content); + this.push(file); + cb(); + }); +} +function concat_Style(){ + return through2.obj(function (file, enc, cb) { + if (file.isNull()) { + this.push(file); + return cb(); + } + + if (file.isStream()) { + this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported')); + return cb(); + } + var content = file.contents.toString(); + var name = file.path.replace(process.cwd(), "").replace(/\\/g, "/") + name = ".."+name.substring(name.indexOf("/source")+7); + content = "var csskey = encodeURIComponent(\""+name+"\");\no2.widget.css[csskey]="+content; + + file.contents = new Buffer.from(content); + this.push(file); + cb(); + }); +} + +function build_concat_basework_style(){ + return gulp.src([ + "o2web/source/x_component_process_Work/$Main/default/css.wcss", + "o2web/source/x_component_process_Xform/$Form/default/css.wcss", + "o2web/source/o2_core/o2/widget/$Tab/mobileForm/css.wcss", + "o2web/source/o2_core/o2/widget/$Menu/tab/css.wcss", + "o2web/source/o2_core/o2/widget/$Tab/form/css.wcss", + "o2web/source/x_component_process_Xform/$Form/default/doc.wcss", + "o2web/source/o2_core/o2/widget/$Toolbar/documentEdit/css.wcss", + "o2web/source/o2_core/o2/widget/$Toolbar/documentEdit_side/css.wcss", + "o2web/source/x_component_process_Xform/$Form/default/css.wcss" + ]) + .pipe(concat_Style()) + .pipe(concat('js/base_work_style_temp.js')) + .pipe(gulp.dest('o2web/source/x_desktop/')); +} + +function build_concat_basework_action(){ + return gulp.src([ + "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json", + "o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.json", + "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.json", + "o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.json", + "o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.json", + "o2web/source/o2_core/o2/xAction/services/x_program_center.json", + "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.json" + ]) + .pipe(concat_Actions()) + .pipe(concat('js/base_work_actions_temp.js')) + .pipe(gulp.dest('o2web/source/x_desktop/')); +} + +function build_concat_basework_clean(cb) { + var dest = [ + 'o2web/source/x_desktop/js/base_work_actions_temp.js', + 'o2web/source/x_desktop/js/base_work_style_temp.js' + ]; + return del(dest, cb); +} + +function build_concat_basework_body() { var src = [ - 'o2web/source/x_desktop/js/base_work_begin.js', + 'o2web/source/x_desktop/js/base_concat_head.js', + 'o2web/source/o2_core/o2/lp/'+(options.lp || 'zh-cn')+'.js', + + 'o2web/source/x_desktop/js/base_work_style_temp.js', + 'o2web/source/o2_core/o2/widget/Common.js', 'o2web/source/o2_core/o2/widget/Dialog.js', 'o2web/source/o2_core/o2/widget/UUID.js', @@ -511,6 +607,12 @@ function build_concat_basework() { 'o2web/source/o2_core/o2/xDesktop/Dialog.js', 'o2web/source/o2_core/o2/xDesktop/Window.js', 'o2web/source/x_component_Common/Main.js', + + 'o2web/source/o2_core/o2/lp/'+(options.lp || 'zh-cn')+'.js', + 'o2web/source/x_component_process_Work/lp/'+(options.lp || 'zh-cn')+'.js', + 'o2web/source/x_component_process_Xform/lp/'+(options.lp || 'zh-cn')+'.js', + 'o2web/source/x_component_Selector/lp/'+(options.lp || 'zh-cn')+'.js', + 'o2web/source/x_component_process_Work/Main.js', 'o2web/source/x_component_Selector/package.js', 'o2web/source/x_component_Selector/Person.js', @@ -526,13 +628,16 @@ function build_concat_basework() { 'o2web/source/o2_core/o2/xScript/Environment.js', 'o2web/source/x_component_Template/MTooltips.js', 'o2web/source/x_component_Template/MSelector.js', + 'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js', 'o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.js', 'o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.js', 'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.js', 'o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.js', 'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.js', - 'o2web/source/x_desktop/js/base_work_end.js', + + 'o2web/source/x_desktop/js/base_work_actions_temp.js', + 'o2web/source/x_desktop/js/base.js' ]; var dest = 'target/o2server/servers/webServer/x_desktop/js/'; @@ -543,10 +648,116 @@ function build_concat_basework() { .pipe(rename({ extname: '.min.js' })) .pipe(gulp.dest(dest)); } -// function build_concat(){ -// return gulp.parallel(build_concat_o2, build_concat_desktop, build_concat_xform); -// } -exports.build_concat = gulp.parallel(build_concat_o2, build_concat_desktop, build_concat_xform, build_bundle, build_concat_basework); + +function build_concat_baseportal_style(){ + return gulp.src([ + "o2web/source/x_component_process_Work/$Main/default/css.wcss", + "o2web/source/x_component_portal_Portal/$Main/default/css.wcss", + "o2web/source/x_component_process_Xform/$Form/default/css.wcss", + "o2web/source/o2_core/o2/widget/$Tab/mobileForm/css.wcss", + "o2web/source/o2_core/o2/widget/$Menu/tab/css.wcss", + ]) + .pipe(concat_Style()) + .pipe(concat('js/base_portal_style_temp.js')) + .pipe(gulp.dest('o2web/source/x_desktop/')); +} + +function build_concat_baseportal_action(){ + return gulp.src([ + "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json", + "o2web/source/o2_core/o2/xAction/services/x_portal_assemble_surface.json", + "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.json", + "o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.json", + "o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.json", + "o2web/source/o2_core/o2/xAction/services/x_program_center.json", + "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.json" + ]) + .pipe(concat_Actions()) + .pipe(concat('js/base_portal_actions_temp.js')) + .pipe(gulp.dest('o2web/source/x_desktop/')); +} + +function build_concat_baseportal_clean(cb) { + var dest = [ + 'o2web/source/x_desktop/js/base_portal_actions_temp.js', + 'o2web/source/x_desktop/js/base_portal_style_temp.js' + ]; + return del(dest, cb); +} + +function build_concat_baseportal_body() { + var src = [ + 'o2web/source/x_desktop/js/base_concat_head.js', + 'o2web/source/o2_core/o2/lp/'+(options.lp || 'zh-cn')+'.js', + + 'o2web/source/x_desktop/js/base_portal_style_temp.js', + + 'o2web/source/o2_core/o2/widget/Common.js', + 'o2web/source/o2_core/o2/widget/Dialog.js', + 'o2web/source/o2_core/o2/widget/UUID.js', + 'o2web/source/o2_core/o2/widget/Menu.js', + 'o2web/source/o2_core/o2/widget/Toolbar.js', + 'o2web/source/o2_core/o2/xDesktop/Common.js', + 'o2web/source/o2_core/o2/xDesktop/Actions/RestActions.js', + 'o2web/source/o2_core/o2/xAction/RestActions.js', + 'o2web/source/o2_core/o2/xDesktop/Access.js', + 'o2web/source/o2_core/o2/xDesktop/Dialog.js', + 'o2web/source/o2_core/o2/xDesktop/Menu.js', + 'o2web/source/o2_core/o2/xDesktop/UserData.js', + 'o2web/source/x_component_Template/MPopupForm.js', + 'o2web/source/o2_core/o2/xDesktop/Authentication.js', + 'o2web/source/o2_core/o2/xDesktop/Window.js', + + 'o2web/source/x_component_Common/Main.js', + + 'o2web/source/x_component_process_Work/lp/'+(options.lp || 'zh-cn')+'.js', + 'o2web/source/x_component_portal_Portal/lp/'+(options.lp || 'zh-cn')+'.js', + 'o2web/source/x_component_process_Xform/lp/'+(options.lp || 'zh-cn')+'.js', + 'o2web/source/x_component_Selector/lp/'+(options.lp || 'zh-cn')+'.js', + + 'o2web/source/x_component_portal_Portal/Main.js', + + 'o2web/source/x_component_Selector/package.js', + 'o2web/source/x_component_Selector/Person.js', + 'o2web/source/x_component_Selector/Identity.js', + 'o2web/source/x_component_Selector/Unit.js', + 'o2web/source/x_component_Selector/IdentityWidthDuty.js', + 'o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js', + 'o2web/source/x_component_Selector/UnitWithType.js', + + 'o2web/source/o2_core/o2/xScript/Actions/UnitActions.js', + 'o2web/source/o2_core/o2/xScript/Actions/ScriptActions.js', + 'o2web/source/o2_core/o2/xScript/Actions/CMSScriptActions.js', + 'o2web/source/o2_core/o2/xScript/Actions/PortalScriptActions.js', + 'o2web/source/o2_core/o2/xScript/PageEnvironment.js', + + 'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js', + 'o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.js', + 'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.js', + 'o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.js', + 'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.js', + + 'o2web/source/x_desktop/js/base_portal_actions_temp.js', + + 'o2web/source/x_desktop/js/base.js' + ]; + var dest = 'target/o2server/servers/webServer/x_desktop/js/'; + return gulp.src(src) + .pipe(concat('base_portal.js')) + .pipe(gulp.dest(dest)) + .pipe(uglify()) + .pipe(rename({ extname: '.min.js' })) + .pipe(gulp.dest(dest)); +} + +exports.build_concat = gulp.parallel( + build_concat_o2, + build_concat_desktop, + build_concat_xform, + build_bundle, + gulp.series(build_concat_basework_style, build_concat_basework_action, build_concat_basework_body,build_concat_basework_clean), + gulp.series(build_concat_baseportal_style, build_concat_baseportal_action, build_concat_baseportal_body,build_concat_baseportal_clean) +); function build_web_v_html() { @@ -638,7 +849,20 @@ function chmod_sh(){ function chmod_servers(){ return (shell.task('chmod 777 -R target/o2server/servers'))(); } -exports.build_web = gulp.series(build_web_minimize, build_web_move, gulp.parallel(build_concat_o2, build_concat_desktop, build_concat_xform, build_bundle, build_concat_basework), build_web_v_html, build_web_v_o2); +exports.build_web = gulp.series( + build_web_minimize, + build_web_move, + gulp.parallel( + build_concat_o2, + build_concat_desktop, + build_concat_xform, + gulp.series(build_concat_basework_style, build_concat_basework_action, build_concat_basework_body,build_concat_basework_clean), + gulp.series(build_concat_baseportal_style, build_concat_baseportal_action, build_concat_baseportal_body,build_concat_baseportal_clean), + build_bundle + ), + build_web_v_html, + build_web_v_o2); + if (os.platform().indexOf("win")==-1){ exports.deploy = gulp.series(deploy_server, chmod_jvm, chmod_commons, chmod_sh, chmod_servers); }else{ diff --git a/o2server/configSample/centerServer.json b/o2server/configSample/centerServer.json index 9a8a25e125f1291667f256e75a45dd3d3133bf1f..de869d1039b5fa6212c9b525510c6d37b4bc7844 100644 --- a/o2server/configSample/centerServer.json +++ b/o2server/configSample/centerServer.json @@ -13,6 +13,7 @@ "statExclusions": "*.js,*.gif,*.jpg,*.png,*.css,*.ico", "maxFormContent": 20.0, "exposeJest": true, + "persistentConnectionsEnable": true, "###enable": "是否启用###", "###order": "center节点顺序,顺序排列0,1,2...###", "###sslEnable": "是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.###", @@ -27,5 +28,6 @@ "###statEnable": "启用统计,默认启用统计.###", "###statExclusions": "统计忽略路径,默认忽略*.js,*.gif,*.jpg,*.png,*.css,*.ico###", "###maxFormContent": "最大提交数据限制(M),限制有所上传的内容大小,包括附件.###", - "###exposeJest": "暴露jest接口.###" + "###exposeJest": "暴露jest接口.###", + "###persistentConnectionsEnable": "是否启用长连接,默认false.###" } \ No newline at end of file diff --git a/o2server/configSample/dingding.json b/o2server/configSample/dingding.json index 1ee8b2c1d8d29dda299d0c40a1c91b68a28e97b9..838d323e5425e011cc56d1d454c38253b74d64f7 100644 --- a/o2server/configSample/dingding.json +++ b/o2server/configSample/dingding.json @@ -19,7 +19,7 @@ "###agentId": "agentId###", "###appKey": "应用的key,唯一标识###", "###appSecret": "应用的密钥###", - "###syncCron": "组织同步cron,默认每10分钟同步一次.###", + "###syncCron": "回调信号触发同步检查,默认每10分钟运行一次,如果期间内有钉钉回调信号接收到,那么触发同步任务进行人员同步.###", "###forceSyncCron": "强制拉入同步cron,默认在每天的8点和12点强制进行同步.###", "###oapiAddress": "oapi服务器地址###", "###workUrl": "钉钉消息打开工作的url地址,如:http://dev.o2oa.net/x_desktop/###", diff --git a/o2server/configSample/externalStorageSources.json b/o2server/configSample/externalStorageSources.json index 2f2c8996accf46968ef7addfff2b8229ac85f314..3c4199eb8a430e2ff8d9c7d4d79396cbe54f59e7 100644 --- a/o2server/configSample/externalStorageSources.json +++ b/o2server/configSample/externalStorageSources.json @@ -286,5 +286,29 @@ "###name": "存储节点名,对应存储名称,谨慎修改.###", "###deepPath": "是否使用更深的路径.###" } + ], + "general": [ + { + "protocol": "webdav", + "username": "admin", + "password": "admin", + "host": "127.0.0.1", + "port": 8080.0, + "prefix": "", + "enable": true, + "weight": 100.0, + "name": "251", + "deepPath": false, + "###protocol": "协议,可选值ftp,webdav###", + "###username": "登录用户名.###", + "###password": "登录密码.###", + "###host": "主机地址.###", + "###port": "端口.###", + "###prefix": "前缀路径.###", + "###enable": "是否启用###", + "###weight": "设置权重.###", + "###name": "存储节点名,对应存储名称,谨慎修改.###", + "###deepPath": "是否使用更深的路径.###" + } ] } \ No newline at end of file diff --git a/o2server/configSample/manifest.cfg b/o2server/configSample/manifest.cfg index cc35f009db5b28e713e874239f00762e17868236..da4c786d84479b4af16da964f9c3aa47b88fa392 100644 --- a/o2server/configSample/manifest.cfg +++ b/o2server/configSample/manifest.cfg @@ -33,5 +33,6 @@ "vfs.json":"虚拟文件存储配置", "welink.json":"华为WeLink配置", "workTime.json":"工作时间配置", - "zhengwuDingding.json":"政务钉钉配置" + "zhengwuDingding.json":"政务钉钉配置", + "web.json":"前端相关配置" } \ No newline at end of file diff --git a/o2server/configSample/node_127.0.0.1.json b/o2server/configSample/node_127.0.0.1.json index a50eeae2e00568755b61bfc76afff6e9730b55ec..778a757aa6478ca598173cb10efa6fcf40f99320 100644 --- a/o2server/configSample/node_127.0.0.1.json +++ b/o2server/configSample/node_127.0.0.1.json @@ -16,6 +16,7 @@ "statExclusions": "*.js,*.gif,*.jpg,*.png,*.css,*.ico", "maxFormContent": 20.0, "exposeJest": true, + "persistentConnectionsEnable": true, "###enable": "是否启用###", "###order": "center节点顺序,顺序排列0,1,2...###", "###sslEnable": "是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.###", @@ -30,7 +31,8 @@ "###statEnable": "启用统计,默认启用统计.###", "###statExclusions": "统计忽略路径,默认忽略*.js,*.gif,*.jpg,*.png,*.css,*.ico###", "###maxFormContent": "最大提交数据限制(M),限制有所上传的内容大小,包括附件.###", - "###exposeJest": "暴露jest接口.###" + "###exposeJest": "暴露jest接口.###", + "###persistentConnectionsEnable": "是否启用长连接,默认false.###" }, "application": { "enable": true, @@ -48,6 +50,7 @@ "statExclusions": "*.js,*.gif,*.jpg,*.png,*.css,*.ico", "maxFormContent": 20.0, "exposeJest": true, + "persistentConnectionsEnable": true, "###enable": "是否启用###", "###port": "http/https端口,负责向前端提供数据访问接口.默认为20020端口.###", "###sslEnable": "是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.###", @@ -62,7 +65,8 @@ "###statEnable": "启用统计,默认启用统计.###", "###statExclusions": "统计忽略路径,默认忽略*.js,*.gif,*.jpg,*.png,*.css,*.ico###", "###maxFormContent": "最大提交数据限制(M),限制有所上传的内容大小,包括附件.###", - "###exposeJest": "暴露jest接口.###" + "###exposeJest": "暴露jest接口.###", + "###persistentConnectionsEnable": "是否启用长连接,默认false.###" }, "web": { "enable": true, @@ -73,6 +77,7 @@ "statEnable": false, "statExclusions": "*.gif,*.jpg,*.png,*.ico", "cacheControlMaxAge": 0.0, + "persistentConnectionsEnable": true, "###enable": "是否启用###", "###port": "http/https端口,用户输入网址后实际访问的第一个端口.http协议默认为80端口,https默认为443端口.###", "###sslEnable": "是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.###", @@ -84,7 +89,8 @@ "###statExclusions": "统计忽略路径,默认忽略*.gif,*.jpg,*.png,*.ico###", "###cacheControlMaxAge": "服务器max-age缓存时间(秒)###", "###proxyCenterEnable": "是否启用center服务器代理.###", - "###proxyApplicationEnable": "是否启用application服务器代理###" + "###proxyApplicationEnable": "是否启用application服务器代理###", + "###persistentConnectionsEnable": "是否启用长连接,默认true.###" }, "data": { "enable": true, @@ -108,7 +114,7 @@ "###excludes": "在此节点上不存储的类,和includes一起设置实际存储的类,可以使用通配符*###", "###jmxEnable": "是否启动jmx,如果启用,可以通过本地的jmx客户端进行访问,不支持远程jmx客户端.###", "###cacheSize": "H2数据库缓存大小,设置H2用于作为缓存的内存大小,以M作为单位,这里默认为512M.###", - "###logLevel": "默认日志级别,FATAL, ERROR, WARN, INFO, TRACE. 完成的配置为DefaultLevel\u003dWARN, Tool\u003dTRACE, Enhance\u003dTRACE, METADATA\u003dTRACE, Runtime\u003dTRACE, Query\u003dTRACE, DataCache\u003dTRACE, JDBC\u003dTRACE, SQL\u003dTRACE###", + "###logLevel": "默认日志级别,FATAL, ERROR, WARN, INFO, TRACE. 完整的配置为DefaultLevel\u003dWARN, Tool\u003dTRACE, Enhance\u003dTRACE, METADATA\u003dTRACE, Runtime\u003dTRACE, Query\u003dTRACE, DataCache\u003dTRACE, JDBC\u003dTRACE, SQL\u003dTRACE###", "###maxTotal": "最大使用连接数###", "###maxIdle": "最大空闲连接数###", "###statEnable": "启用统计,默认启用###", @@ -135,12 +141,12 @@ }, "logLevel": "warn", "dumpData": { - "enable": true, + "enable": false, "cron": "", "size": 7.0, "path": "", - "###enable": "是否启用,默认每天凌晨2点进行备份.###", - "###cron": "定时任务cron表达式###", + "###enable": "是否启用,默认禁用.###", + "###cron": "定时任务cron表达式,默认每天凌晨2点进行备份.###", "###size": "最大保留份数,超过将自动删除最久的数据.###", "###path": "备份路径###" }, diff --git a/o2server/configSample/qiyeweixin.json b/o2server/configSample/qiyeweixin.json index 109d3c13614d87291d63a56bd3a11a3698979fa0..a01f75fe8c9707096ed2dd5062f622b491bfdd22 100644 --- a/o2server/configSample/qiyeweixin.json +++ b/o2server/configSample/qiyeweixin.json @@ -17,7 +17,7 @@ "attendanceSyncAgentId": "", "attendanceSyncSecret": "", "###enable": "是否启用.###", - "###syncCron": "拉入同步cron,默认每10分钟同步一次.###", + "###syncCron": "回调信号触发同步检查,默认每10分钟运行一次,如果期间内有企业微信回调信号接收到,那么触发同步任务进行人员同步.###", "###forceSyncCron": "强制拉入同步cron,默认在每天的8点和12点强制进行同步.###", "###apiAddress": "api服务器地址###", "###corpId": "企业微信corpId###", diff --git a/o2server/configSample/vfs.json b/o2server/configSample/vfs.json index a5428ea8f93542a1cd7d1f1d54623a522824680c..6d6b22858344748b837b2ae6892b6b4933b1ae3d 100644 --- a/o2server/configSample/vfs.json +++ b/o2server/configSample/vfs.json @@ -4,5 +4,8 @@ }, "ftps": { "passive": true + }, + "sftp": { + "passive": true } } \ No newline at end of file diff --git a/o2server/configSample/web.json b/o2server/configSample/web.json new file mode 100644 index 0000000000000000000000000000000000000000..122e7c7ede322c0acef4b28555906d766ed52c0f --- /dev/null +++ b/o2server/configSample/web.json @@ -0,0 +1,4 @@ +{ + "mock": {}, + "###mock": "使用Post模拟Put,Get模拟Delete的模块.###" +} \ No newline at end of file diff --git a/o2server/configSample/zhengwuDingding.json b/o2server/configSample/zhengwuDingding.json index 40d4b3c326eb0bda739bb2390ab07ea797139d27..6e3b4e7ba63d2c0f8e58c5b393fde07ed0a2adf8 100644 --- a/o2server/configSample/zhengwuDingding.json +++ b/o2server/configSample/zhengwuDingding.json @@ -21,7 +21,7 @@ "###appId": "政务钉钉appId###", "###appSecret": "政务钉钉appSecret###", "###agentId": "政务钉钉agentId###", - "###syncCron": "拉入同步cron,默认每10分钟同步一次.###", + "###syncCron": "回调信号触发同步检查,默认每10分钟运行一次,如果期间内有政务钉钉回调信号接收到,那么触发同步任务进行人员同步.###", "###forceSyncCron": "强制拉入同步cron,默认在每天的8点和12点强制进行同步.###", "###oapiAddress": "oapi服务器地址###", "###corpId": "政务钉钉corpId###", diff --git a/o2server/pom.xml b/o2server/pom.xml index 26f69acc5dc3e8c298222c1acc9cc52d8a894bdd..9662987b3e78c59f3432a332dc8d34ef811ced1f 100644 --- a/o2server/pom.xml +++ b/o2server/pom.xml @@ -1017,4 +1017,10 @@ + + + o2oa-release + http://maven.o2oa.net/repository/o2oa-release/ + + diff --git a/o2server/x_attendance_assemble_control/pom.xml b/o2server/x_attendance_assemble_control/pom.xml index 641ae1c6866a7ac0471f20c2fd4a25d7929745e0..bf0ee4c05852ea645537d0388410aa62902501d3 100644 --- a/o2server/x_attendance_assemble_control/pom.xml +++ b/o2server/x_attendance_assemble_control/pom.xml @@ -128,6 +128,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/container/EntityManagerContainer.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/container/EntityManagerContainer.java index bb314cff4fa9cfc72c1d80d52603ed20182e6ee2..f5e9bc1592463eb57b5b413f8e1d5a34a5440241 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/container/EntityManagerContainer.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/container/EntityManagerContainer.java @@ -10,6 +10,7 @@ import java.util.Date; import java.util.List; import java.util.Map.Entry; import java.util.Objects; +import java.util.Optional; import java.util.stream.Collectors; import javax.persistence.EntityManager; @@ -17,7 +18,6 @@ import javax.persistence.Query; import javax.persistence.Tuple; import javax.persistence.TypedQuery; import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaDelete; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; @@ -644,6 +644,61 @@ public class EntityManagerContainer extends EntityManagerContainerBasic { return os.stream().findFirst().orElse(null); } + public Optional firstEqualAndLessThanOrEqualTo(Class cls, String attribute, + Object value, String otherAttribute, Comparable otherValue) throws Exception { + EntityManager em = this.get(cls); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(cls); + Root root = cq.from(cls); + cq.select(root) + .where(cb.and(cb.equal(root.get(attribute), value), + cb.lessThanOrEqualTo(root.get(otherAttribute), otherValue))) + .orderBy(cb.desc(root.get(otherAttribute))); + List os = em.createQuery(cq).setMaxResults(1).getResultList(); + return os.stream().findFirst(); + } + + public Optional firstEqualAndLessThan(Class cls, String attribute, Object value, + String otherAttribute, Comparable otherValue) throws Exception { + EntityManager em = this.get(cls); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(cls); + Root root = cq.from(cls); + cq.select(root) + .where(cb.and(cb.equal(root.get(attribute), value), cb.lessThan(root.get(otherAttribute), otherValue))) + .orderBy(cb.desc(root.get(otherAttribute))); + List os = em.createQuery(cq).setMaxResults(1).getResultList(); + return os.stream().findFirst(); + } + + public Optional firstEqualAndGreaterThanOrEqualTo(Class cls, String attribute, + Object value, String otherAttribute, Comparable otherValue) throws Exception { + EntityManager em = this.get(cls); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(cls); + Root root = cq.from(cls); + cq.select(root) + .where(cb.and(cb.equal(root.get(attribute), value), + cb.greaterThanOrEqualTo(root.get(otherAttribute), otherValue))) + .orderBy(cb.asc(root.get(otherAttribute))); + List os = em.createQuery(cq).setMaxResults(1).getResultList(); + return os.stream().findFirst(); + } + + public Optional firstEqualAndGreaterThan(Class cls, String attribute, Object value, + String otherAttribute, Comparable otherValue) throws Exception { + EntityManager em = this.get(cls); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(cls); + Root root = cq.from(cls); + cq.select(root) + .where(cb.and(cb.equal(root.get(attribute), value), + cb.greaterThan(root.get(otherAttribute), otherValue))) + .orderBy(cb.asc(root.get(otherAttribute))); + List os = em.createQuery(cq).setMaxResults(1).getResultList(); + return os.stream().findFirst(); + } + public Long count(Class cls) throws Exception { EntityManager em = this.get(cls); CriteriaBuilder cb = em.getCriteriaBuilder(); @@ -888,8 +943,7 @@ public class EntityManagerContainer extends EntityManagerContainerBasic { CriteriaQuery cq = cb.createQuery(String.class); Root root = cq.from(cls); cq.select(root.get(JpaObject.id_FIELDNAME)).where(cb.isMember(root.get(attribute), cb.literal(values))); - return new ArrayList<>( - em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList())); + return new ArrayList<>(em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList())); } public List idsNotIn(Class cls, String attribute, diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/PersistenceXmlHelper.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/PersistenceXmlHelper.java index 76254845c8765cb3e1db4426e6b9842b3ae79240..cae34a96a8bb8dfeee8f3f2f7b39eaf1baca8e47 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/PersistenceXmlHelper.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/container/factory/PersistenceXmlHelper.java @@ -172,7 +172,7 @@ public class PersistenceXmlHelper { mapped_element.addText(o.getName()); } } - if(dynamicFlag) { + if (dynamicFlag) { for (String className : names) { if (className.startsWith(DynamicEntity.CLASS_PACKAGE)) { dyClasses.add(className); @@ -192,7 +192,7 @@ public class PersistenceXmlHelper { mapped_element.addText(dyClass); } for (Class o : JpaObjectTools.scanMappedSuperclass(DynamicBaseEntity.class)) { - if(!o.getName().equals(DynamicBaseEntity.class.getName())) { + if (!o.getName().equals(DynamicBaseEntity.class.getName())) { Element mapped_element = unit.addElement("class"); mapped_element.addText(o.getName()); } @@ -296,6 +296,9 @@ public class PersistenceXmlHelper { if (Config.externalDataSources().hasSchema()) { properties.put("openjpa.jdbc.Schema", JpaObject.default_schema); } + if (StringUtils.isNotEmpty(Config.externalDataSources().getTransactionIsolation())) { + properties.put("openjpa.jdbc.TransactionIsolation", Config.externalDataSources().getTransactionIsolation()); + } for (String name : Config.externalDataSources().findNamesOfContainerEntity(className)) { properties.put("openjpa.ConnectionFactoryName", Config.RESOURCE_JDBC_PREFIX + name); properties.put("openjpa.Log", Config.externalDataSources().log(name)); diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/JpaObject.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/JpaObject.java index 57a5541e5f18dd4b9b8499441bfece0cf7115e4f..e27110a95339b40e395267463ece7efef9d92098 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/JpaObject.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/JpaObject.java @@ -20,6 +20,7 @@ import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.openjpa.persistence.jdbc.ContainerTable; +import org.apache.openjpa.persistence.jdbc.Strategy; import com.x.base.core.entity.annotation.Flag; import com.x.base.core.entity.annotation.RestrictFlag; @@ -309,8 +310,15 @@ public abstract class JpaObject extends GsonPropertyObject implements Serializab if (BooleanUtils.isTrue(excludeInvisible) && FieldsInvisible.contains(field.getName())) { continue; } - if (BooleanUtils.isTrue(excludeLob) && (null != field.getAnnotation(Lob.class))) { - continue; + if (BooleanUtils.isTrue(excludeLob)) { + if (null != field.getAnnotation(Lob.class)) { + continue; + } else { + Strategy strategy = field.getAnnotation(Strategy.class); + if ((null != strategy) && StringUtils.equals(JsonPropertiesValueHandler, strategy.value())) { + continue; + } + } } names.add(field.getName()); } diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageObject.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageObject.java index 51306750691480f82ea16a1b909ed06ece555e08..e65218fc7741f45b759c10b4fd7e3914810cb250 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageObject.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageObject.java @@ -117,14 +117,6 @@ public abstract class StorageObject extends SliceJpaObject { return this.updateContent(mapping, input); } - // /** 更新Content内容 */ - // public Long updateContent(StorageMapping mapping, byte[] bytes) throws - // Exception { - // try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) { - // return updateContent(mapping, bais); - // } - // } - /** 更新Content内容 */ public Long updateContent(StorageMapping mapping, byte[] bytes, String name) throws Exception { try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) { @@ -148,64 +140,6 @@ public abstract class StorageObject extends SliceJpaObject { /** 更新Content内容 */ public Long updateContent(StorageMapping mapping, InputStream input) throws Exception { return updateContent(mapping, IOUtils.toByteArray(input)); - // long length = -1L; - // FileSystemManager manager = this.getFileSystemManager(); - // String prefix = this.getPrefix(mapping); - // String path = this.path(); - // if (StringUtils.isEmpty(path)) { - // throw new Exception("path can not be empty."); - // } - // FileSystemOptions options = this.getOptions(mapping); - // try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { - // /* 由于可以在传输过程中取消传输,先拷贝到内存 */ - // IOUtils.copyLarge(input, baos); - // FileObject fo = null; - // OutputStream output = null; - // try { - // /* - // * 需要进行两次判断,在前端使用nginx分发的情况下,可能同时触发多个文件的上传,多个文件同时上传可能会同时创建文件的存储目录,会在后台导致错误 - // * org.apache.commons.vfs2.FileSystemException: Could not create folder - // * - // "ftp://processPlatform:***@o2.server01.com:20040/20200601/1beb018a-5009-4baa-a9ef-7e903f9d48ef". - // * 这种情况下再次发起请求尝试获取文件可以解决这个问题. - // */ - // try { - // fo = manager.resolveFile(prefix + PATHSEPARATOR + path, options); - // output = fo.getContent().getOutputStream(); - // } catch (FileSystemException fse) { - // // 此段代码全部关闭对象,并要进行webdav判断进行关闭。 - // if (null != output) { - // output.close(); - // } - // if (null != fo) { - // if (!Objects.equals(StorageProtocol.webdav, mapping.getProtocol())) { - // /* webdav关闭会试图去关闭commons.httpClient */ - // manager.closeFileSystem(fo.getFileSystem()); - // } - // fo.close(); - // } - // fo = manager.resolveFile(prefix + PATHSEPARATOR + path, options); - // output = fo.getContent().getOutputStream(); - // } - // length = IOUtils.copyLarge(new ByteArrayInputStream(baos.toByteArray()), - // output); - // this.setLength(length); - // if (!Objects.equals(StorageProtocol.webdav, mapping.getProtocol())) { - // /* webdav关闭会试图去关闭commons.httpClient */ - // manager.closeFileSystem(fo.getFileSystem()); - // } - // } finally { - // if (null != output) { - // output.close(); - // } - // if (null != fo) { - // fo.close(); - // } - // } - // } - // this.setStorage(mapping.getName()); - // this.setLastUpdateTime(new Date()); - // return length; } /** 更新Content内容 */ @@ -229,7 +163,8 @@ public abstract class StorageObject extends SliceJpaObject { OutputStream output = fo.getContent().getOutputStream()) { length = IOUtils.copyLarge(new ByteArrayInputStream(bytes), output); this.setLength(length); - if (!Objects.equals(StorageProtocol.webdav, mapping.getProtocol())) { + if ((!Objects.equals(StorageProtocol.webdav, mapping.getProtocol())) + && (!Objects.equals(StorageProtocol.sftp, mapping.getProtocol()))) { /* webdav关闭会试图去关闭commons.httpClient */ manager.closeFileSystem(fo.getFileSystem()); } @@ -339,6 +274,12 @@ public abstract class StorageObject extends SliceJpaObject { + URLEncoder.encode(mapping.getPassword(), DefaultCharset.name) + "@" + mapping.getHost() + ":" + mapping.getPort(); break; + case sftp: + // ftps://[ username[: password]@] hostname[: port][ relative-path] + prefix = "sftp://" + URLEncoder.encode(mapping.getUsername(), DefaultCharset.name) + ":" + + URLEncoder.encode(mapping.getPassword(), DefaultCharset.name) + "@" + mapping.getHost() + ":" + + mapping.getPort(); + break; case cifs: // smb://[ username[: password]@] hostname[: port][ absolute-path] prefix = "smb://" + URLEncoder.encode(mapping.getUsername(), DefaultCharset.name) + ":" @@ -369,6 +310,19 @@ public abstract class StorageObject extends SliceJpaObject { switch (mapping.getProtocol()) { // bzip2,file, ftp, ftps, gzip, hdfs, http, https, jar, ram, res, sftp, // tar, temp, webdav, zip, cifs, mime; + case sftp: + FtpFileSystemConfigBuilder sftpBuilder = FtpFileSystemConfigBuilder.getInstance(); + sftpBuilder.setPassiveMode(opts, Config.vfs().getSftp().getPassive()); + /** 强制不校验IP */ + sftpBuilder.setRemoteVerification(opts, false); + sftpBuilder.setFileType(opts, FtpFileType.BINARY); + sftpBuilder.setConnectTimeout(opts, 10000); + sftpBuilder.setSoTimeout(opts, 10000); + sftpBuilder.setControlEncoding(opts, DefaultCharset.name); + // By default, the path is relative to the user's home directory. This can be + // changed with: + sftpBuilder.setUserDirIsRoot(opts, false); + break; case ftp: FtpFileSystemConfigBuilder ftpBuilder = FtpFileSystemConfigBuilder.getInstance(); /* diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageProtocol.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageProtocol.java index 99a0745cd48bcc6e2b4ed8b2331e7123c355bd73..257d95355d4555594140e8a2fa87f0a1e5a91a78 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageProtocol.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/StorageProtocol.java @@ -1,6 +1,7 @@ package com.x.base.core.entity; public enum StorageProtocol { - ftp, ftps, webdav, cifs, file; + ftp, ftps, webdav, cifs, file, sftp; + public static final int length = JpaObject.length_16B; } diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/dynamic/DynamicEntityBuilder.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/dynamic/DynamicEntityBuilder.java index 95439255327e033cbe86d1f4cce3cf703ffbf417..a088a7fc59d0a1ee48667699f070a8272b28ee97 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/dynamic/DynamicEntityBuilder.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/entity/dynamic/DynamicEntityBuilder.java @@ -16,7 +16,6 @@ import javax.persistence.OrderColumn; import javax.persistence.Table; import javax.persistence.Temporal; -import org.apache.commons.lang3.StringUtils; import org.apache.openjpa.persistence.PersistentCollection; import org.apache.openjpa.persistence.PersistentMap; import org.apache.openjpa.persistence.jdbc.ContainerTable; @@ -42,6 +41,7 @@ import com.x.base.core.entity.annotation.ContainerEntity; import com.x.base.core.entity.dynamic.DynamicEntity.Field; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.tools.ListTools; +import com.x.base.core.project.tools.StringTools; public class DynamicEntityBuilder { @@ -196,10 +196,10 @@ public class DynamicEntityBuilder { FieldSpec fieldSpec = FieldSpec.builder(typeClass, field.getName(), Modifier.PRIVATE) .addAnnotation(this.fieldDescribe(field)).addAnnotation(this.index(field)) .addAnnotation(this.checkPersist(field)).addAnnotation(column).build(); - MethodSpec get = MethodSpec.methodBuilder("get" + StringUtils.capitalize(field.getName())) + MethodSpec get = MethodSpec.methodBuilder(StringTools.getMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(typeClass).addStatement("return this." + field.getName()) .build(); - MethodSpec set = MethodSpec.methodBuilder("set" + StringUtils.capitalize(field.getName())) + MethodSpec set = MethodSpec.methodBuilder(StringTools.setMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(void.class).addParameter(typeClass, field.getName()) .addStatement("this." + field.getName() + " = " + field.getName()).build(); builder.addField(this.fieldName(field)).addField(fieldSpec).addMethod(get).addMethod(set); @@ -222,10 +222,10 @@ public class DynamicEntityBuilder { FieldSpec fieldSpec = FieldSpec.builder(Date.class, field.getName(), Modifier.PRIVATE) .addAnnotation(this.fieldDescribe(field)).addAnnotation(this.index(field)) .addAnnotation(this.checkPersist(field)).addAnnotation(column).addAnnotation(temporal).build(); - MethodSpec get = MethodSpec.methodBuilder("get" + StringUtils.capitalize(field.getName())) + MethodSpec get = MethodSpec.methodBuilder(StringTools.getMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(Date.class).addStatement("return this." + field.getName()) .build(); - MethodSpec set = MethodSpec.methodBuilder("set" + StringUtils.capitalize(field.getName())) + MethodSpec set = MethodSpec.methodBuilder(StringTools.setMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(void.class).addParameter(Date.class, field.getName()) .addStatement("this." + field.getName() + " = " + field.getName()).build(); builder.addField(this.fieldName(field)).addField(fieldSpec).addMethod(get).addMethod(set); @@ -249,10 +249,10 @@ public class DynamicEntityBuilder { FieldSpec fieldSpec = FieldSpec.builder(Date.class, field.getName(), Modifier.PRIVATE) .addAnnotation(this.fieldDescribe(field)).addAnnotation(this.index(field)) .addAnnotation(this.checkPersist(field)).addAnnotation(column).addAnnotation(temporal).build(); - MethodSpec get = MethodSpec.methodBuilder("get" + StringUtils.capitalize(field.getName())) + MethodSpec get = MethodSpec.methodBuilder(StringTools.getMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(Date.class).addStatement("return this." + field.getName()) .build(); - MethodSpec set = MethodSpec.methodBuilder("set" + StringUtils.capitalize(field.getName())) + MethodSpec set = MethodSpec.methodBuilder(StringTools.setMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(void.class).addParameter(Date.class, field.getName()) .addStatement("this." + field.getName() + " = " + field.getName()).build(); builder.addField(this.fieldName(field)).addField(fieldSpec).addMethod(get).addMethod(set); @@ -276,10 +276,10 @@ public class DynamicEntityBuilder { FieldSpec fieldSpec = FieldSpec.builder(Date.class, field.getName(), Modifier.PRIVATE) .addAnnotation(this.fieldDescribe(field)).addAnnotation(this.index(field)) .addAnnotation(this.checkPersist(field)).addAnnotation(column).addAnnotation(temporal).build(); - MethodSpec get = MethodSpec.methodBuilder("get" + StringUtils.capitalize(field.getName())) + MethodSpec get = MethodSpec.methodBuilder(StringTools.getMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(Date.class).addStatement("return this." + field.getName()) .build(); - MethodSpec set = MethodSpec.methodBuilder("set" + StringUtils.capitalize(field.getName())) + MethodSpec set = MethodSpec.methodBuilder(StringTools.setMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(void.class).addParameter(Date.class, field.getName()) .addStatement("this." + field.getName() + " = " + field.getName()).build(); builder.addField(this.fieldName(field)).addField(fieldSpec).addMethod(get).addMethod(set); @@ -365,10 +365,10 @@ public class DynamicEntityBuilder { FieldSpec fieldSpec = FieldSpec.builder(list_type, field.getName(), Modifier.PRIVATE) .addAnnotation(this.fieldDescribe(field)).addAnnotation(containerTable).addAnnotation(elementIndex) .addAnnotation(persistentCollection).addAnnotation(orderColumn).addAnnotation(elementColumn).build(); - MethodSpec get = MethodSpec.methodBuilder("get" + StringUtils.capitalize(field.getName())) + MethodSpec get = MethodSpec.methodBuilder(StringTools.getMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(list_type).addStatement("return this." + field.getName()) .build(); - MethodSpec set = MethodSpec.methodBuilder("set" + StringUtils.capitalize(field.getName())) + MethodSpec set = MethodSpec.methodBuilder(StringTools.setMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(void.class).addParameter(list_type, field.getName()) .addStatement("this." + field.getName() + " = " + field.getName()).build(); builder.addField(this.fieldName(field)).addField(fieldSpec).addMethod(get).addMethod(set); @@ -401,10 +401,10 @@ public class DynamicEntityBuilder { FieldSpec fieldSpec = FieldSpec.builder(String.class, field.getName(), Modifier.PRIVATE) .addAnnotation(this.fieldDescribe(field)).addAnnotation(lob).addAnnotation(basic).addAnnotation(column) .build(); - MethodSpec get = MethodSpec.methodBuilder("get" + StringUtils.capitalize(field.getName())) + MethodSpec get = MethodSpec.methodBuilder(StringTools.getMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(String.class).addStatement("return this." + field.getName()) .build(); - MethodSpec set = MethodSpec.methodBuilder("set" + StringUtils.capitalize(field.getName())) + MethodSpec set = MethodSpec.methodBuilder(StringTools.setMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(void.class).addParameter(String.class, field.getName()) .addStatement("this." + field.getName() + " = " + field.getName()).build(); builder.addField(this.fieldName(field)).addField(fieldSpec).addMethod(get).addMethod(set); @@ -467,9 +467,9 @@ public class DynamicEntityBuilder { .addAnnotation(keyColumn).addAnnotation(elementColumn).addAnnotation(elementIndex) .addAnnotation(keyIndex).build(); - MethodSpec get = MethodSpec.methodBuilder("get" + StringUtils.capitalize(field.getName())) + MethodSpec get = MethodSpec.methodBuilder(StringTools.getMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(map_type).addStatement("return this." + field.getName()).build(); - MethodSpec set = MethodSpec.methodBuilder("set" + StringUtils.capitalize(field.getName())) + MethodSpec set = MethodSpec.methodBuilder(StringTools.setMethodName(field.getName())) .addModifiers(Modifier.PUBLIC).returns(void.class).addParameter(map_type, field.getName()) .addStatement("this." + field.getName() + " = " + field.getName()).build(); builder.addField(this.fieldName(field)).addField(fieldSpec).addMethod(get).addMethod(set); diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/Kingbase8Dictionary.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/Kingbase8Dictionary.java index 10a987734cbdd9d891753288f34d72c65cda6fa0..254e071a17a236dbdbd5ee990688c92d7ab11376 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/Kingbase8Dictionary.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/Kingbase8Dictionary.java @@ -27,7 +27,7 @@ public class Kingbase8Dictionary extends DBDictionary { public String namedSequenceFromOneSchemaSQL = "select SYS_NAMESPACE.NSPNAME as SEQUENCE_SCHEMA, SYS_CLASS.RELNAME as SEQUENCE_NAME from SYS_NAMESPACE,SYS_CLASS where SYS_NAMESPACE.OID=SYS_CLASS.RELNAMESPACE and SYS_CLASS.RELKIND='S' AND SYS_CLASS.RELNAME = ? AND SYS_NAMESPACE.NSPNAME = ?"; public Kingbase8Dictionary() { - this.platform = "KingbaseES"; + this.platform = "KingbaseES8"; this.validationSQL = "SELECT NOW()"; this.supportsSelectStartIndex = true; this.supportsSelectEndIndex = true; diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/Kingbase8DictionaryBack.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/Kingbase8DictionaryBack.java deleted file mode 100644 index 004034793e63e6b33a270ffff23580683bff2e3a..0000000000000000000000000000000000000000 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/Kingbase8DictionaryBack.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.x.base.core.openjpa.jdbc.sql; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.openjpa.jdbc.schema.Column; -import org.apache.openjpa.jdbc.sql.BooleanRepresentation; -import org.apache.openjpa.jdbc.sql.BooleanRepresentationFactory; -import org.apache.openjpa.jdbc.sql.DBDictionary; -import org.apache.openjpa.lib.util.Localizer; - -public class Kingbase8DictionaryBack extends DBDictionary { - - public static final String VENDOR_DAMENG = "Kingbase8"; - private static final Localizer _loc = Localizer.forPackage(DMDictionary.class); - - public Kingbase8DictionaryBack() { - this.platform = "Kingbase8"; - supportsDeferredConstraints = false; - } - - public void connectedConfiguration(Connection conn) throws SQLException { - super.connectedConfiguration(conn); - boolean requiresWarnings = true; - DatabaseMetaData meta = conn.getMetaData(); - String driverName = meta.getDriverName(); - String url = meta.getURL(); - if (this.driverVendor == null) { - if ((driverName != null) && (driverName.equalsIgnoreCase("com.kingbase8.Driver"))) { - this.driverVendor = "Kingbase8JdbcDriver"; - if ((url != null) && (url.startsWith("jdbc:kingbase8://"))) { - requiresWarnings = false; - } - } else { - this.driverVendor = "other"; - } - } - if (("Kingbase8JdbcDriver".equalsIgnoreCase(this.driverVendor)) && (requiresWarnings)) { - this.log.warn(_loc.get("kingbase8 Jdbc connection", url)); - } - } - - protected BooleanRepresentation booleanRepresentation = BooleanRepresentationFactory.BOOLEAN; - - /** - * Convert the specified column of the SQL ResultSet to the proper java type. - */ - public boolean getBoolean(ResultSet rs, int column) throws SQLException { - return booleanRepresentation.getBoolean(rs, column); - } - - /** - * Set the given value as a parameter to the statement. - */ - public void setBoolean(PreparedStatement stmnt, int idx, boolean val, Column col) throws SQLException { - booleanRepresentation.setBoolean(stmnt, idx, val); - } - - public String booleanTypeName = "BOOL"; - -} diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/Kingbase8R6Dictionary.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/Kingbase8R6Dictionary.java new file mode 100644 index 0000000000000000000000000000000000000000..1fba7c79094f032d2b1a6e4e397adab36ec084b1 --- /dev/null +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/Kingbase8R6Dictionary.java @@ -0,0 +1,254 @@ +package com.x.base.core.openjpa.jdbc.sql; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; + +import org.apache.openjpa.jdbc.kernel.exps.FilterValue; +import org.apache.openjpa.jdbc.schema.Column; +import org.apache.openjpa.jdbc.schema.Sequence; +import org.apache.openjpa.jdbc.schema.Table; +import org.apache.openjpa.jdbc.sql.BooleanRepresentation; +import org.apache.openjpa.jdbc.sql.BooleanRepresentationFactory; +import org.apache.openjpa.jdbc.sql.DBDictionary; +import org.apache.openjpa.jdbc.sql.SQLBuffer; +import org.apache.openjpa.lib.jdbc.DelegatingConnection; +import org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement; + +public class Kingbase8R6Dictionary extends DBDictionary { + public String allSequencesSQL = "select SYS_NAMESPACE.NSPNAME as SEQUENCE_SCHEMA, SYS_CLASS.RELNAME as SEQUENCE_NAME from SYS_NAMESPACE,SYS_CLASS where SYS_NAMESPACE.OID=SYS_CLASS.RELNAMESPACE and SYS_CLASS.RELKIND='S'"; + public String namedSequencesFromAllSchemasSQL = "select SYS_NAMESPACE.NSPNAME as SEQUENCE_SCHEMA, SYS_CLASS.RELNAME as SEQUENCE_NAME from SYS_NAMESPACE,SYS_CLASS where SYS_NAMESPACE.OID=SYS_CLASS.RELNAMESPACE and SYS_CLASS.RELKIND='S' AND SYS_CLASS.RELNAME = ?"; + public String allSequencesFromOneSchemaSQL = "select SYS_NAMESPACE.NSPNAME as SEQUENCE_SCHEMA, SYS_CLASS.RELNAME as SEQUENCE_NAME from SYS_NAMESPACE,SYS_CLASS where SYS_NAMESPACE.OID=SYS_CLASS.RELNAMESPACE and SYS_CLASS.RELKIND='S' AND SYS_NAMESPACE.NSPNAME = ?"; + public String namedSequenceFromOneSchemaSQL = "select SYS_NAMESPACE.NSPNAME as SEQUENCE_SCHEMA, SYS_CLASS.RELNAME as SEQUENCE_NAME from SYS_NAMESPACE,SYS_CLASS where SYS_NAMESPACE.OID=SYS_CLASS.RELNAMESPACE and SYS_CLASS.RELKIND='S' AND SYS_CLASS.RELNAME = ? AND SYS_NAMESPACE.NSPNAME = ?"; + + public Kingbase8R6Dictionary() { + this.platform = "KingbaseES8R6"; + // 适配 V8R6 + this.schemaCase = SCHEMA_CASE_LOWER; + // 适配 V8R6 + this.doubleTypeName = "DOUBLE PRECISION"; + this.validationSQL = "SELECT NOW()"; + this.supportsSelectStartIndex = true; + this.supportsSelectEndIndex = true; + this.supportsLockingWithDistinctClause = false; + this.maxTableNameLength = 63; + this.maxColumnNameLength = 63; + this.maxIndexNameLength = 63; + this.maxConstraintNameLength = 63; + this.maxAutoAssignNameLength = 63; + this.lastGeneratedKeyQuery = "SELECT CURRVAL(''{2}'')"; + this.supportsAutoAssign = true; + this.autoAssignTypeName = "INT IDENTITY"; + this.nextSequenceQuery = "SELECT NEXTVAL(''{0}'')"; + this.binaryTypeName = "BYTEA"; + this.longVarbinaryTypeName = "BYTEA"; + this.varbinaryTypeName = "BYTEA"; + this.longVarcharTypeName = "TEXT"; + this.charTypeName = "CHAR{0}"; + this.varcharTypeName = "VARCHAR{0}"; + /* add by Ray */ + this.bitTypeName = "BOOL"; + this.systemSchemaSet.addAll(Arrays.asList(new String[] { "INFORMATION_SCHEMA", "SYS_CATALOG" })); + this.fixedSizeTypeNameSet.addAll(Arrays.asList(new String[] { "TEXT", "XML", "INTERVAL YEAR", "INTERVAL MONTH", + "INTERVAL DAY", "INTERVAL HOUR", "INTERVAL MINUTE", "INTERVAL SECOND", " INTERVAL YEAR TO MONTH", + "INTERVAL DAY TO SECOND", "BIT VARYING", "BYTEA", "BOOLEAN" })); + this.reservedWordSet.addAll(Arrays.asList(new String[] { "ABORT", "ABSOLUTE", "ACCESS", "ACTION", "ADD", + "ADMIN", "AFTER", "AGGREGATE", "ALL", "ALSO", "ALTER", "ANALYSE", "ANALYZE", "AND", "ANY", "ARRAY", + "AS", "ASC", "ASSERTION", "ASSIGNMENT", "ASYMMETRIC", "AT", "AUTHID", "AUTHORIZATION", "BACKWARD", + "BEFORE", "BEGIN", "BETWEEN", "BIGINT", "BINARY", "BIT", "BODY", "BOOLEAN", "BOTH", "BY", "CACHE", + "CALL", "CALLED", "CASCADE", "CASCADED", "CASE", "CAST", "CHAIN", "CHAR", "CHARACTER", + "CHARACTERISTICS", "CHECK", "CHECKALLOCATE", "CHECKCATALOG", "CHECKDB", "CHECKINDEX", "CHECKPOINT", + "CHECKTABLE", "CHECKTABLESPACE", "CLASS", "CLOSE", "CLUSTER", "COALESCE", "COLLATE", "COLUMN", + "COMMENT", "COMMIT", "COMMITTED", "CONCURRENTLY", "CONNECTION", "CONSTANT", "CONSTRAINT", "CONSTRAINTS", + "CONVERSION", "CONVERT", "COPY", "CREATE", "CREATEDB", "CREATEROLE", "CREATEUSER", "CROSS", "CSV", + "CURRENT_DATE", "CURRENT_ROLE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "CURRENT_USER", "CURSOR", "CYCLE", + "DATABASE", "DATAFILE", "DATEADD", "DATEDIFF", "DATEPART", "DAY", "DBCC", "DEALLOCATE", "DEC", + "DECIMAL", "DECLARE", "DEFAULT", "DEFAULTS", "DEFERRABLE", "DEFERRED", "DEFINER", "DELETE", "DELIMITER", + "DELIMITERS", "DESC", "DISABLE", "DISTINCT", "DO", "DOMAIN", "DOUBLE", "DROP", "EACH", "ELSE", "ENABLE", + "ENCODING", "ENCRYPTED", "END", "ESCAPE", "EXCEPT", "EXCLUDING", "EXCLUSIVE", "EXECUTE", "EXISTS", + "EXPLAIN", "EXTERNAL", "EXTERNALLY", "EXTRACT", "FALSE", "FETCH", "FILEGROWTH", "FILENAME", "FIRST", + "FLOAT", "FOR", "FORCE", "FOREIGN", "FORWARD", "FREEZE", "FROM", "FULL", "FUNCTION", "GETDATE", + "GLOBAL", "GRANT", "GRANTED", "GREATEST", "GROUP", "HANDLER", "HAVING", "HOLD", "HOUR", "IDENTIFIED", + "IDENTITY", "IF", "IFNULL", "ILIKE", "IMMEDIATE", "IMMUTABLE", "IMPLICIT", "IN", "INCLUDING", + "INCREMENT", "INDEX", "INDEXES", "INHERIT", "INHERITS", "INITIALLY", "INNER", "INOUT", "INPUT", + "INSENSITIVE", "INSERT", "INSTEAD", "INT", "INTEGER", "INTERNAL", "INTERSECT", "INTERVAL", "INTO", + "INVOKER", "IS", "ISNULL", "ISOLATION", "JOIN", "KEY", "LANCOMPILER", "LANGUAGE", "LARGE", "LAST", + "LEADING", "LEAST", "LEFT", "LEVEL", "LIKE", "LIMIT", "LINK", "LIST", "LISTEN", "LOAD", "LOCAL", + "LOCALTIME", "LOCALTIMESTAMP", "LOCATION", "LOCK", "LOGFILE", "LOGIN", "MATCH", "MAXSIZE", "MAXVALUE", + "MINUTE", "MINVALUE", "MODE", "MODIFY", "MONTH", "MOVE", "NAME", "NAMES", "NATIONAL", "NATURAL", + "NCHAR", "NEW", "NEXT", "NO", "NOALLOCATE", "NOCONSTRAINT", "NOCREATEDB", "NOCREATEROLE", + "NOCREATEUSER", "NOINDEX", "NOINHERIT", "NOLOGIN", "NONE", "NOSUPERUSER", "NOT", "NOTHING", "NOTIFY", + "NOTNULL", "NOWAIT", "NULL", "NULLIF", "NUMERIC", "OBJECT", "OF", "OFF", "OFFSET", "OIDS", "OLD", "ON", + "ONLY", "OPERATOR", "OPTION", "OR", "ORDER", "OUT", "OUTER", "OVERLAPS", "OVERLAY", "OWNED", "OWNER", + "PACKAGE", "PARTIAL", "PASSWORD", "PERCENT", "PLACING", "POSITION", "PRECISION", "PREPARE", "PREPARED", + "PRESERVE", "PRIMARY", "PRIOR", "PRIVILEGES", "PROCEDURAL", "PROCEDURE", "QUOTE", "READ", "REAL", + "REASSIGN", "RECHECK", "REFERENCES", "REINDEX", "RELATIVE", "RELEASE", "REMOVE", "RENAME", "REPEATABLE", + "REPLACE", "RESET", "RESIZE", "RESTART", "RESTRICT", "RETURNING", "RETURNS", "REVOKE", "RIGHT", "ROLE", + "ROLLBACK", "ROW", "ROWNUM", "ROWS", "ROWTYPE", "RULE", "SAVEPOINT", "SCHEMA", "SCROLL", "SECOND", + "SECURITY", "SELECT", "SEQUENCE", "SERIALIZABLE", "SESSION", "SESSION_USER", "SET", "SETOF", "SHARE", + "SHOW", "SIMILAR", "SIMPLE", "SIZE", "SMALLINT", "SOME", "STABLE", "START", "STATEMENT", "STATISTICS", + "STDIN", "STDOUT", "STORAGE", "STRICT", "SUBSTRING", "SUPERUSER", "SWITCH", "SYMMETRIC", "SYSDATE", + "SYSID", "SYSTEM", "TABLE", "TABLESPACE", "TEMP", "TEMPFILE", "TEMPLATE", "TEMPORARY", "THEN", "TIME", + "TIMESTAMP", "TIMESTAMPADD", "TIMESTAMPDIFF", "TINYINT", "TO", "TOP", "TRAILING", "TRANSACTION", + "TREAT", "TRIGGER", "TRIM", "TRUE", "TRUNCATE", "TRUSTED", "TYPE", "UNCOMMITTED", "UNENCRYPTED", + "UNION", "UNIQUE", "UNKNOWN", "UNLISTEN", "UNTIL", "UPDATE", "USAGE", "USER", "USING", "VACUUM", + "VALID", "VALIDATOR", "VALUES", "VARCHAR", "VARCHAR2", "VARYING", "VERBOSE", "VIEW", "VOLATILE", "WHEN", + "WHERE", "WITH", "WITHOUT", "WORK", "WRITE", "YEAR", "ZONE", "BLOB", "BYTEA", "CLOB", "DATE", "TEXT", + "TIMESTAMPTZ", "TIMETZ", "RETURN", "ROWCOUNT", "CMAX", "CMIN", "CTID", "OID", "TABLEOID", "XMAX", + "XMIN" })); + } + + public Date getDate(ResultSet paramResultSet, int paramInt) throws SQLException { + try { + return super.getDate(paramResultSet, paramInt); + } catch (StringIndexOutOfBoundsException localStringIndexOutOfBoundsException) { + String str = paramResultSet.getString(paramInt); + SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SS"); + try { + return localSimpleDateFormat.parse(str); + } catch (ParseException localParseException) { + throw new SQLException(localParseException.toString()); + } + } + } + + /* add by Ray */ + protected BooleanRepresentation booleanRepresentation = BooleanRepresentationFactory.BOOLEAN; + + /** + * Convert the specified column of the SQL ResultSet to the proper java type. + */ + public boolean getBoolean(ResultSet rs, int column) throws SQLException { + return booleanRepresentation.getBoolean(rs, column); + } + + /** + * Set the given value as a parameter to the statement. + */ + public void setBoolean(PreparedStatement stmnt, int idx, boolean val, Column col) throws SQLException { + booleanRepresentation.setBoolean(stmnt, idx, val); + } + +// public void setBoolean(PreparedStatement paramPreparedStatement, int paramInt, boolean paramBoolean, +// Column paramColumn) throws SQLException { +// paramPreparedStatement.setBoolean(paramInt, paramBoolean); +// } + + /* add by Ray end */ + + protected void appendSelectRange(SQLBuffer paramSQLBuffer, long paramLong1, long paramLong2, boolean paramBoolean) { + if (paramLong2 != Long.MAX_VALUE) { + paramSQLBuffer.append(" LIMIT ").appendValue(paramLong2 - paramLong1); + } + if (paramLong1 != 0L) { + paramSQLBuffer.append(" OFFSET ").appendValue(paramLong1); + } + } + + public void indexOf(SQLBuffer paramSQLBuffer, FilterValue paramFilterValue1, FilterValue paramFilterValue2, + FilterValue paramFilterValue3) { + paramSQLBuffer.append("(POSITION("); + paramFilterValue2.appendTo(paramSQLBuffer); + paramSQLBuffer.append(" IN "); + if (paramFilterValue3 != null) { + substring(paramSQLBuffer, paramFilterValue1, paramFilterValue3, null); + } else { + paramFilterValue1.appendTo(paramSQLBuffer); + } + paramSQLBuffer.append(") - 1"); + if (paramFilterValue3 != null) { + paramSQLBuffer.append(" + "); + paramFilterValue3.appendTo(paramSQLBuffer); + } + paramSQLBuffer.append(")"); + } + + public String[] getCreateSequenceSQL(Sequence paramSequence) { + String[] arrayOfString = super.getCreateSequenceSQL(paramSequence); + if (paramSequence.getAllocate() > 1) { + int tmp23_22 = 0; + String[] tmp23_21 = arrayOfString; + tmp23_21[tmp23_22] = (tmp23_21[tmp23_22] + " CACHE " + paramSequence.getAllocate()); + } + return arrayOfString; + } + + protected String getSequencesSQL(String paramString1, String paramString2) { + if ((paramString1 == null) && (paramString2 == null)) { + return this.allSequencesSQL; + } + if (paramString1 == null) { + return this.namedSequencesFromAllSchemasSQL; + } + if (paramString2 == null) { + return this.allSequencesFromOneSchemaSQL; + } + return this.namedSequenceFromOneSchemaSQL; + } + + public boolean isSystemSequence(String paramString1, String paramString2, boolean paramBoolean) { + if (super.isSystemSequence(paramString1, paramString2, paramBoolean)) { + return true; + } + int i = paramString1.indexOf('_'); + return (i != -1) && (i != paramString1.length() - 4) && (paramString1.toUpperCase().endsWith("_SEQ")); + } + + public boolean isSystemTable(String paramString1, String paramString2, boolean paramBoolean) { + return (super.isSystemTable(paramString1, paramString2, paramBoolean)) + || ((paramString1 != null) && (paramString1.toLowerCase().startsWith("sys_"))); + } + + public boolean isSystemIndex(String paramString, Table paramTable) { + return (super.isSystemIndex(paramString, paramTable)) + || ((paramString != null) && (paramString.toLowerCase().startsWith("sys_"))); + } + + public Connection decorate(Connection paramConnection) throws SQLException { + return new KingbaseConnection(super.decorate(paramConnection), this); + } + + private static class KingbasePreparedStatement extends DelegatingPreparedStatement { + public KingbasePreparedStatement(PreparedStatement paramPreparedStatement, Connection paramConnection, + Kingbase8R6Dictionary paramKingbaseDictionary) { + super(paramPreparedStatement, paramConnection); + } + + protected ResultSet executeQuery(boolean paramBoolean) throws SQLException { + try { + return super.executeQuery(paramBoolean); + } catch (SQLException localSQLException) { + ResultSet localResultSet = getResultSet(paramBoolean); + if (localResultSet == null) { + throw localSQLException; + } + return localResultSet; + } + } + } + + private static class KingbaseConnection extends DelegatingConnection { + private final Kingbase8R6Dictionary _dict; + + public KingbaseConnection(Connection paramConnection, Kingbase8R6Dictionary paramKingbaseDictionary) { + super(paramConnection); + this._dict = paramKingbaseDictionary; + } + + protected PreparedStatement prepareStatement(String paramString, boolean paramBoolean) throws SQLException { + return new Kingbase8R6Dictionary.KingbasePreparedStatement(super.prepareStatement(paramString, false), this, + this._dict); + } + + protected PreparedStatement prepareStatement(String paramString, int paramInt1, int paramInt2, + boolean paramBoolean) throws SQLException { + return new Kingbase8R6Dictionary.KingbasePreparedStatement( + super.prepareStatement(paramString, paramInt1, paramInt2, false), this, this._dict); + } + } +} diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/OscarDictionary.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/OscarDictionary.java index a3a3349b14793e44b1f2008750448bfef0c39491..4e5bfb1e7196bfa481f758ebc4a87ae484c2569b 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/OscarDictionary.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/OscarDictionary.java @@ -1,5 +1,6 @@ package com.x.base.core.openjpa.jdbc.sql; +import org.apache.openjpa.jdbc.sql.BooleanRepresentationFactory; import org.apache.openjpa.jdbc.sql.DBDictionary; import org.apache.openjpa.lib.util.Localizer; @@ -18,6 +19,10 @@ public class OscarDictionary extends DBDictionary { maxEmbeddedClobSize = -1; maxEmbeddedBlobSize = -1; doubleTypeName = "DOUBLE PRECISION"; + booleanTypeName = "BOOL"; + useGetStringForClobs = true; + useSetStringForClobs = true; + booleanRepresentation = BooleanRepresentationFactory.BOOLEAN; } } diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/annotation/ApiAllBuilder.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/annotation/ApiAllBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..e651f1e5e8d355fd3fe47fe1e58fe7d890684b14 --- /dev/null +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/annotation/ApiAllBuilder.java @@ -0,0 +1,910 @@ +package com.x.base.core.project.annotation; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; +import java.util.ArrayList; +import java.util.Collection; +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 java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +import javax.persistence.Table; +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.FormParam; +import javax.ws.rs.GET; +import javax.ws.rs.HEAD; +import javax.ws.rs.OPTIONS; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Lob; +import javax.persistence.OrderColumn; +import org.apache.openjpa.persistence.jdbc.ElementColumn; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; +import org.apache.openjpa.persistence.jdbc.ContainerTable; + +import org.apache.commons.collections4.list.SetUniqueList; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.ClassUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.reflect.FieldUtils; +import org.apache.commons.lang3.reflect.MethodUtils; + +import com.google.gson.JsonElement; +import com.x.base.core.project.annotation.ApiBuilder.JaxrsApiMethod; +import com.x.base.core.project.annotation.ApiBuilder.JaxrsClass; +import com.x.base.core.project.annotation.ApiBuilder.JaxrsField; +import com.x.base.core.project.annotation.ApiBuilder.JaxrsFormParameter; +import com.x.base.core.project.annotation.ApiBuilder.JaxrsMethod; +import com.x.base.core.project.annotation.ApiBuilder.JaxrsPathParameter; +import com.x.base.core.project.annotation.ApiBuilder.JaxrsQueryParameter; +import com.x.base.core.project.bean.WrapCopier; +import com.x.base.core.project.gson.XGsonBuilder; +import com.x.base.core.project.jaxrs.StandardJaxrsAction; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.base.core.project.tools.DefaultCharset; +import com.x.base.core.project.tools.ListTools; + +import io.github.classgraph.ClassGraph; +import io.github.classgraph.ClassInfo; +import io.github.classgraph.ScanResult; + +public class ApiAllBuilder { + + private static Logger logger = LoggerFactory.getLogger(ApiAllBuilder.class); + + public static void main(String[] args) throws IOException { + String filePath = args[0]; + filePath = filePath.substring(0, filePath.lastIndexOf(File.separator)); + filePath = filePath + File.separator+"x_program_center"; + File dir = new File(filePath ,"src/main/webapp/describe/api"); + ApiAllBuilder builder = new ApiAllBuilder(); + builder.scan(dir); + } + + private void scan(File dir) { + try { + ArrayList List = new ArrayList(); + List.add("x_processplatform_assemble_surface"); + List.add("x_portal_assemble_surface"); + List.add("x_query_assemble_surface"); + List.add("x_cms_assemble_control"); + List.add("x_organization_assemble_express"); + List.add("x_organization_assemble_control"); + + if (dir.isDirectory()) { + LinkedHashMap mapList = new LinkedHashMap<>(); + File[] fs = dir.listFiles(); + for(File f:fs){ + if(f.isFile()) { + String fileNameJosn = f.getName(); + if(!fileNameJosn.equalsIgnoreCase("apiList.json")) { + if(List.contains(fileNameJosn.substring(0,fileNameJosn.lastIndexOf(".")))) { + mapList.put(fileNameJosn.substring(0,fileNameJosn.lastIndexOf(".")), FileUtils.readFileToString(f,"UTF-8")); + } + } + } + } + File fileList = new File(dir, "apiList.json"); + FileUtils.writeStringToFile(fileList, XGsonBuilder.toJson(mapList), DefaultCharset.charset); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void scan0(File dir,String fileName) { + try { + List jaxrsClasses = new ArrayList<>(); + List> classes = this.scanJaxrsClass(); + for (Class clz : classes) { + if (StandardJaxrsAction.class.isAssignableFrom(clz)) { + jaxrsClasses.add(this.jaxrsClass(clz)); + } + } + + + LinkedHashMap> map = new LinkedHashMap<>(); + jaxrsClasses = jaxrsClasses.stream().sorted(Comparator.comparing(JaxrsClass::getName)) + .collect(Collectors.toList()); + map.put("jaxrs", jaxrsClasses); + File file = new File(dir, fileName + ".json"); + FileUtils.writeStringToFile(file, XGsonBuilder.toJson(map), DefaultCharset.charset); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private List> scanJaxrsClass() throws Exception { + try (ScanResult scanResult = new ClassGraph().disableJarScanning().enableAnnotationInfo().scan()) { + SetUniqueList> classes = SetUniqueList.setUniqueList(new ArrayList>()); + for (ClassInfo info : scanResult.getClassesWithAnnotation(ApplicationPath.class.getName())) { + Class applicationPathClass = ClassUtils.getClass(info.getName()); + for (Class o : (Set>) MethodUtils.invokeMethod(applicationPathClass.newInstance(), + "getClasses")) { + Path path = o.getAnnotation(Path.class); + JaxrsDescribe jaxrsDescribe = o.getAnnotation(JaxrsDescribe.class); + if (null != path && null != jaxrsDescribe) { + classes.add(o); + } + } + } + return classes; + } + } + + private JaxrsClass jaxrsClass(Class clz) throws Exception { + logger.print("describe class:{}.", clz.getName()); + JaxrsDescribe jaxrsDescribe = clz.getAnnotation(JaxrsDescribe.class); + JaxrsClass jaxrsClass = new JaxrsClass(); + jaxrsClass.setName(clz.getSimpleName()); + for (Method method : clz.getMethods()) { + JaxrsMethodDescribe jaxrsMethodDescribe = method.getAnnotation(JaxrsMethodDescribe.class); + if (null != jaxrsMethodDescribe) { + + jaxrsClass.getMethods().add(this.jaxrsApiMethod(clz, method)); + } + } + + return jaxrsClass; + + } + + + private List> getSortData(String indicator, List> data) { + class MapSort implements Comparator> { + private String keyName = ""; + private MapSort(String keyName) { + this.keyName = keyName; + } + public int compare(Map mp1, Map mp2) { + System.out.println("this.keyName=" + mp1.keySet().toArray()[0]); + String d1 = mp1.keySet().toArray()[0].toString(); + String d2 = mp2.keySet().toArray()[0].toString(); + return d2.compareTo(d1); + } + } + MapSort mapSort = new MapSort(indicator); + Collections.sort(data, mapSort); + return data; + } + + private JaxrsApiMethod jaxrsApiMethod(Class clz, Method method) throws Exception { + JaxrsMethodDescribe jaxrsMethodDescribe = method.getAnnotation(JaxrsMethodDescribe.class); + JaxrsApiMethod jaxrsMethod = new JaxrsApiMethod(); + jaxrsMethod.setName(method.getName()); + Class actionClass = jaxrsMethodDescribe.action(); + if (null != method.getAnnotation(GET.class)) { + jaxrsMethod.setMethod("GET"); + } else if (null != method.getAnnotation(POST.class)) { + jaxrsMethod.setMethod("POST"); + } else if (null != method.getAnnotation(PUT.class)) { + jaxrsMethod.setMethod("PUT"); + } else if (null != method.getAnnotation(DELETE.class)) { + jaxrsMethod.setMethod("DELETE"); + } else if (null != method.getAnnotation(OPTIONS.class)) { + jaxrsMethod.setMethod("OPTIONS"); + } else if (null != method.getAnnotation(HEAD.class)) { + jaxrsMethod.setMethod("HEAD"); + } + + if (!jaxrsMethod.getMethod().equalsIgnoreCase("GET")) { + Consumes consumes = method.getAnnotation(Consumes.class); + if (null != consumes) { + if(consumes.value()[0].equals("multipart/form-data")) { + jaxrsMethod.setEnctype("formData"); + }else { + jaxrsMethod.setEnctype(consumes.value()[0]); + } + } else { + //jaxrsMethod.setEnctype(MediaType.APPLICATION_JSON); + } + } + + + Path path = method.getAnnotation(Path.class); + if (null == path) { + jaxrsMethod.setUri("jaxrs/" + clz.getAnnotation(Path.class).value()); + } else { + jaxrsMethod.setUri("jaxrs/" + clz.getAnnotation(Path.class).value() + "/" + path.value()); + } + + return jaxrsMethod; + } + + private JaxrsMethod jaxrsMethod(Class clz, Method method) throws Exception { + JaxrsMethodDescribe jaxrsMethodDescribe = method.getAnnotation(JaxrsMethodDescribe.class); + + + JaxrsMethod jaxrsMethod = new JaxrsMethod(); + jaxrsMethod.setName(method.getName()); + jaxrsMethod.setDescription(jaxrsMethodDescribe.value()); + Class actionClass = jaxrsMethodDescribe.action(); + jaxrsMethod.setClassName(actionClass.getName()); + if (null != method.getAnnotation(GET.class)) { + jaxrsMethod.setType("GET"); + } else if (null != method.getAnnotation(POST.class)) { + jaxrsMethod.setType("POST"); + } else if (null != method.getAnnotation(PUT.class)) { + jaxrsMethod.setType("PUT"); + } else if (null != method.getAnnotation(DELETE.class)) { + jaxrsMethod.setType("DELETE"); + } else if (null != method.getAnnotation(OPTIONS.class)) { + jaxrsMethod.setType("OPTIONS"); + } else if (null != method.getAnnotation(HEAD.class)) { + jaxrsMethod.setType("HEAD"); + } + Class woClass = this.getWoClass(actionClass); + if (null != woClass) { + jaxrsMethod.setOuts(this.jaxrsOutField(woClass)); + } + Class wiClass = this.getWiClass(actionClass); + if (null != wiClass) { + jaxrsMethod.setIns(this.jaxrsInField(wiClass)); + } else { + if (StringUtils.equals("POST", jaxrsMethod.getType()) || StringUtils.equals("PUT", jaxrsMethod.getType())) { + /** 如果没有定义Wi对象,那么有可能使用的是jsonElement对象 */ + if (ArrayUtils.contains(method.getParameterTypes(), JsonElement.class)) { + jaxrsMethod.setUseJsonElementParameter(true); + } else { + jaxrsMethod.setUseStringParameter(true); + } + } + } + Consumes consumes = method.getAnnotation(Consumes.class); + if (null != consumes) { + jaxrsMethod.setContentType(consumes.value()[0]); + } else { + jaxrsMethod.setContentType(MediaType.APPLICATION_JSON); + } + Produces produces = method.getAnnotation(Produces.class); + if (null != produces) { + jaxrsMethod.setResultContentType(produces.value()[0]); + jaxrsMethod.setResultContentType(produces.value()[0]); + } + Path path = method.getAnnotation(Path.class); + if (null == path) { + jaxrsMethod.setPath("jaxrs/" + clz.getAnnotation(Path.class).value()); + } else { + jaxrsMethod.setPath("jaxrs/" + clz.getAnnotation(Path.class).value() + "/" + path.value()); + } + for (Parameter o : method.getParameters()) { + FormDataParam formDataParam = o.getAnnotation(FormDataParam.class); + FormParam formParam = o.getAnnotation(FormParam.class); + PathParam pathParam = o.getAnnotation(PathParam.class); + QueryParam queryParam = o.getAnnotation(QueryParam.class); + if (null != formDataParam) { + jaxrsMethod.getFormParameters().add(this.jaxrsFormDataParameter(clz, method, o)); + } else if (null != formParam) { + jaxrsMethod.getFormParameters().add(this.jaxrsFormParameter(clz, method, o)); + } else if (null != queryParam) { + jaxrsMethod.getQueryParameters().add(this.jaxrsQueryParameter(clz, method, o)); + } else if (null != pathParam) { + jaxrsMethod.getPathParameters().add(this.jaxrsPathParameter(clz, method, o)); + } + } + jaxrsMethod.setFormParameters(jaxrsMethod.getFormParameters().stream().filter(Objects::nonNull) + .sorted(Comparator.comparing(JaxrsFormParameter::getName, Comparator.nullsLast(String::compareTo))) + .collect(Collectors.toList())); + jaxrsMethod.setQueryParameters(jaxrsMethod.getQueryParameters().stream().filter(Objects::nonNull) + .sorted(Comparator.comparing(JaxrsQueryParameter::getName, Comparator.nullsLast(String::compareTo))) + .collect(Collectors.toList())); + jaxrsMethod.setPathParameters(jaxrsMethod.getPathParameters().stream().filter(Objects::nonNull) + .sorted(Comparator.comparing(JaxrsPathParameter::getName, Comparator.nullsLast(String::compareTo))) + .collect(Collectors.toList())); + return jaxrsMethod; + } + + private JaxrsFormParameter jaxrsFormDataParameter(Class clz, Method method, Parameter parameter) { + JaxrsParameterDescribe jaxrsParameterDescribe = parameter.getAnnotation(JaxrsParameterDescribe.class); + FormDataParam formDataParam = parameter.getAnnotation(FormDataParam.class); + if (StringUtils.equalsIgnoreCase("file", formDataParam.value())) { + if (parameter.getType() == FormDataContentDisposition.class) { + /** 单独处理附件 */ + JaxrsFormParameter o = new JaxrsFormParameter(); + o.setType("File"); + o.setName(formDataParam.value()); + if (null != jaxrsParameterDescribe) { + o.setDescription(jaxrsParameterDescribe.value()); + } else { + logger.print("类: {}, 方法: {} ,未设置参数 {} 的JaxrsParameterDescribe.", clz.getName(), method.getName(), + formDataParam.value()); + o.setDescription(""); + } + return o; + } + } else { + JaxrsFormParameter o = new JaxrsFormParameter(); + o.setType(this.simpleType(parameter.getType().toString())); + o.setName(formDataParam.value()); + if (null != jaxrsParameterDescribe) { + o.setDescription(jaxrsParameterDescribe.value()); + } else { + logger.print("类: {}, 方法: {} ,未设置参数 {} 的JaxrsParameterDescribe.", clz.getName(), method.getName(), + formDataParam.value()); + o.setDescription(""); + } + return o; + } + return null; + } + + private JaxrsFormParameter jaxrsFormParameter(Class clz, Method method, Parameter parameter) { + JaxrsParameterDescribe jaxrsParameterDescribe = parameter.getAnnotation(JaxrsParameterDescribe.class); + FormParam formParam = parameter.getAnnotation(FormParam.class); + JaxrsFormParameter o = new JaxrsFormParameter(); + o.setType(this.simpleType(parameter.getType().toString())); + o.setName(formParam.value()); + if (null != jaxrsParameterDescribe) { + o.setDescription(jaxrsParameterDescribe.value()); + } else { + logger.print("类: {}, 方法: {} ,未设置参数 {} 的JaxrsParameterDescribe.", clz.getName(), method.getName(), + formParam.value()); + o.setDescription(""); + } + return o; + } + + private JaxrsQueryParameter jaxrsQueryParameter(Class clz, Method method, Parameter parameter) { + JaxrsParameterDescribe jaxrsParameterDescribe = parameter.getAnnotation(JaxrsParameterDescribe.class); + QueryParam queryParam = parameter.getAnnotation(QueryParam.class); + JaxrsQueryParameter o = new JaxrsQueryParameter(); + if (null != jaxrsParameterDescribe) { + o.setDescription(jaxrsParameterDescribe.value()); + } else { + logger.print("类: {}, 方法: {} ,未设置参数 {} 的JaxrsParameterDescribe.", clz.getName(), method.getName(), + queryParam.value()); + o.setDescription(""); + } + o.setName(queryParam.value()); + o.setType(this.simpleType(parameter.getType().getName())); + return o; + } + + private JaxrsPathParameter jaxrsPathParameter(Class clz, Method method, Parameter parameter) throws Exception { + JaxrsParameterDescribe jaxrsParameterDescribe = parameter.getAnnotation(JaxrsParameterDescribe.class); + PathParam pathParam = parameter.getAnnotation(PathParam.class); + JaxrsPathParameter o = new JaxrsPathParameter(); + o.setName(pathParam.value()); + if (null != jaxrsParameterDescribe) { + o.setDescription(jaxrsParameterDescribe.value()); + } else { + logger.print("类: {}, 方法: {} ,未设置参数 {} 的JaxrsParameterDescribe.", clz.getName(), method.getName(), + pathParam.value()); + o.setDescription(""); + } + o.setType(this.getJaxrsParameterType(parameter)); + return o; + } + + private Class getWiClass(Class actionClass) { + for (Class c : actionClass.getDeclaredClasses()) { + if (StringUtils.equals(c.getSimpleName(), "Wi")) { + return c; + } + } + return null; + } + + private Class getWoClass(Class actionClass) { + for (Class c : actionClass.getDeclaredClasses()) { + if (StringUtils.equals(c.getSimpleName(), "Wo")) { + return c; + } + } + return null; + } + + private List jaxrsInField(Class clz) throws Exception { + List list = new ArrayList<>(); + List fields = FieldUtils.getAllFieldsList(clz); + List copierCopyFields = this.listCopierCopyFields(clz); + if (ListTools.isNotEmpty(copierCopyFields)) { + List os = new ArrayList<>(); + for (Field o : fields) { + FieldDescribe fieldDescribe = o.getAnnotation(FieldDescribe.class); + if ((null != fieldDescribe) + && (copierCopyFields.contains(o.getName()) || this.inWiNotInEntity(o.getName(), clz))) { + os.add(o); + } + fields = os; + } + } + for (Field o : fields) { + FieldDescribe fieldDescribe = o.getAnnotation(FieldDescribe.class); + if (null != fieldDescribe) { + JaxrsField jaxrsField = new JaxrsField(); + jaxrsField.setName(o.getName()); + jaxrsField.setDescription(fieldDescribe.value()); + jaxrsField.setType(this.getJaxrsFieldType(o)); + jaxrsField.setIsBaseType(false); + if (Collection.class.isAssignableFrom(o.getType())) { + jaxrsField.setIsCollection(true); + if (StringUtils.containsAny(jaxrsField.getType(), "", "", "", "", + "", "", "")) { + jaxrsField.setIsBaseType(true); + } + } else { + // O2LEE,String[]未被判断为collection导致组织的JSON格式不符合wrapIn要求 + if (StringUtils.equalsAnyIgnoreCase("String[]", jaxrsField.getType())) { + jaxrsField.setIsCollection(true); + } else { + jaxrsField.setIsCollection(false); + } + if (StringUtils.startsWithAny(jaxrsField.getType(), "String", "Boolean", "Date", "Integer", + "Double", "Long", "Float")) { + jaxrsField.setIsBaseType(true); + } + } + list.add(jaxrsField); + } + } + return list; + } + + private List jaxrsOutField(Class clz) throws Exception { + List list = new ArrayList<>(); + List fields = FieldUtils.getAllFieldsList(clz); + List copierEraseFields = this.listCopierEraseFields(clz); + if (ListTools.isNotEmpty(copierEraseFields)) { + List os = new ArrayList<>(); + for (Field o : fields) { + FieldDescribe fieldDescribe = o.getAnnotation(FieldDescribe.class); + if ((null != fieldDescribe) && (!copierEraseFields.contains(o.getName()))) { + os.add(o); + } + } + fields = os; + } + for (Field o : fields) { + FieldDescribe fieldDescribe = o.getAnnotation(FieldDescribe.class); + if (null != fieldDescribe) { + JaxrsField jaxrsField = new JaxrsField(); + jaxrsField.setName(o.getName()); + jaxrsField.setDescription(fieldDescribe.value()); + jaxrsField.setType(this.getJaxrsFieldType(o)); + if (Collection.class.isAssignableFrom(o.getType())) { + jaxrsField.setIsCollection(true); + } else { + jaxrsField.setIsCollection(false); + } + list.add(jaxrsField); + } + } + return list; + } + + private String getJaxrsFieldType(Field o) { + String value = o.getGenericType().getTypeName(); + return this.simpleType(value); + } + + private String getJaxrsParameterType(Parameter o) { + String value = o.getType().getTypeName(); + return this.simpleType(value); + } + + private String simpleType(String value) { + value = value.replaceAll(" ", ""); + String[] ss = value.split("[,|<|>]"); + for (String s : ss) { + String[] ns = s.split("[.|\\$]"); + value = value.replace(s, ns[ns.length - 1]); + } + return value; + } + + private List listCopierEraseFields(Class clz) { + try { + Object o = FieldUtils.readStaticField(clz, "copier", true); + WrapCopier copier = (WrapCopier) o; + return copier.getEraseFields(); + } catch (Exception e) { + return null; + } + } + + private List listCopierCopyFields(Class clz) { + try { + Object o = FieldUtils.readStaticField(clz, "copier", true); + WrapCopier copier = (WrapCopier) o; + return copier.getCopyFields(); + } catch (Exception e) { + return null; + } + } + + /** 判断字段是否在Wi中但是没有在Entity类中说明是Wi新增字段,需要进行描述 */ + private Boolean inWiNotInEntity(String field, Class clz) { + try { + Object o = FieldUtils.readStaticField(clz, "copier", true); + WrapCopier copier = (WrapCopier) o; + if ((null != FieldUtils.getField(copier.getOrigClass(), field, true)) + && (null == FieldUtils.getField(copier.getDestClass(), field, true))) { + return true; + } + return false; + } catch (Exception e) { + return null; + } + } + + public class JaxrsClass { + + private String name; + private List methods = new ArrayList<>(); + + public List getMethods() { + return methods; + } + + public void setMethods(List methods) { + this.methods = methods; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } + + public class JaxrsApiMethod{ + private String name; + private String uri; + private String method; + private String enctype; + + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getUri() { + return uri; + } + public void setUri(String uri) { + this.uri = uri; + } + public String getMethod() { + return method; + } + public void setMethod(String method) { + this.method = method; + } + public String getEnctype() { + return enctype; + } + public void setEnctype(String enctype) { + this.enctype = enctype; + } + + } + public class JaxsApiMethodProperty{ + private String name; + private String uri; + private String method; + private String enctype; + + public String getUri() { + return uri; + } + public void setUri(String uri) { + this.uri = uri; + } + public String getMethod() { + return method; + } + public void setMethod(String method) { + this.method = method; + } + public String getEnctype() { + return enctype; + } + public void setEnctype(String enctype) { + this.enctype = enctype; + } + + } + public class JaxrsMethod { + private String name; + private String className; + private String description; + private String type; + private String path; + private String contentType; + private String resultContentType; + private Boolean useJsonElementParameter = false; + private Boolean useStringParameter = false; + private List pathParameters = new ArrayList<>(); + private List formParameters = new ArrayList<>(); + private List queryParameters = new ArrayList<>(); + private List ins = new ArrayList<>(); + private List outs = new ArrayList<>(); + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getIns() { + return ins; + } + + public void setIns(List ins) { + this.ins = ins; + } + + public List getOuts() { + return outs; + } + + public void setOuts(List outs) { + this.outs = outs; + } + + public String getContentType() { + return contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public List getPathParameters() { + return pathParameters; + } + + public void setPathParameters(List pathParameters) { + this.pathParameters = pathParameters; + } + + public List getFormParameters() { + return formParameters; + } + + public void setFormParameters(List formParameters) { + this.formParameters = formParameters; + } + + public List getQueryParameters() { + return queryParameters; + } + + public void setQueryParameters(List queryParameters) { + this.queryParameters = queryParameters; + } + + public Boolean getUseJsonElementParameter() { + return useJsonElementParameter; + } + + public void setUseJsonElementParameter(Boolean useJsonElementParameter) { + this.useJsonElementParameter = useJsonElementParameter; + } + + public String getResultContentType() { + return resultContentType; + } + + public void setResultContentType(String resultContentType) { + this.resultContentType = resultContentType; + } + + public Boolean getUseStringParameter() { + return useStringParameter; + } + + public void setUseStringParameter(Boolean useStringParameter) { + this.useStringParameter = useStringParameter; + } + + } + + public class JaxrsField { + + private String name; + private String type; + private Boolean isCollection; + private String description; + private Boolean isBaseType; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Boolean getIsCollection() { + return isCollection; + } + + public void setIsCollection(Boolean isCollection) { + this.isCollection = isCollection; + } + + public Boolean getIsBaseType() { + return isBaseType; + } + + public void setIsBaseType(Boolean isBaseType) { + this.isBaseType = isBaseType; + } + + } + + public class JaxrsPathParameter { + + private String name; + private String type; + private String description; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + } + + public class JaxrsFormParameter { + + private String name; + private String type; + private String description; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + } + + public class JaxrsQueryParameter { + + private String name; + private String type; + private String description; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + } + +} \ No newline at end of file diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/annotation/ApiBuilder.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/annotation/ApiBuilder.java index c1d2a306f108332c7de36963b8bfd03c189e79d3..e38c40307da0d5b8e5aff579d774b9fabe476728 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/annotation/ApiBuilder.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/annotation/ApiBuilder.java @@ -9,11 +9,9 @@ import java.util.ArrayList; import java.util.Collection; 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 java.util.Map.Entry; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -63,22 +61,45 @@ public class ApiBuilder { private static Logger logger = LoggerFactory.getLogger(ApiBuilder.class); public static void main(String[] args) throws IOException { - //System.out.println("ApiBuilder......"); File basedir = new File(args[0]); File sourcedir = new File(args[1]); File dir = new File(basedir, "src/main/webapp/describe"); - FileUtils.forceMkdir(dir); - ApiBuilder builder = new ApiBuilder(); - builder.scan(dir); - //FileUtils.copyDirectory(sourcedir, new File(dir, "sources")); - + String filePath = args[0]; + String fileName = filePath.substring(filePath.lastIndexOf(File.separator), filePath.length()); + filePath = filePath.substring(0, filePath.lastIndexOf(File.separator)); + filePath = filePath + File.separator+"x_program_center"; + dir = new File(filePath ,"src/main/webapp/describe/api"); + FileUtils.forceMkdir(dir); + builder.scan(dir,fileName); + } + + private void scan(File dir,String fileName) { + try { + List jaxrsClasses = new ArrayList<>(); + List> classes = this.scanJaxrsClass(); + for (Class clz : classes) { + if (StandardJaxrsAction.class.isAssignableFrom(clz)) { + jaxrsClasses.add(this.jaxrsClass(clz)); + } + } + + LinkedHashMap> map = new LinkedHashMap<>(); + jaxrsClasses = jaxrsClasses.stream().sorted(Comparator.comparing(JaxrsClass::getName)) + .collect(Collectors.toList()); + map.put("jaxrs", jaxrsClasses); + File file = new File(dir, fileName + ".json"); + FileUtils.writeStringToFile(file, XGsonBuilder.toJson(map), DefaultCharset.charset); + } catch (Exception e) { + e.printStackTrace(); + } } + private void scan(File dir) { try { List jaxrsClasses = new ArrayList<>(); @@ -123,23 +144,13 @@ public class ApiBuilder { logger.print("describe class:{}.", clz.getName()); JaxrsDescribe jaxrsDescribe = clz.getAnnotation(JaxrsDescribe.class); JaxrsClass jaxrsClass = new JaxrsClass(); - //jaxrsClass.setClassName(clz.getName()); jaxrsClass.setName(clz.getSimpleName()); - //jaxrsClass.setDescription(jaxrsDescribe.value()); for (Method method : clz.getMethods()) { JaxrsMethodDescribe jaxrsMethodDescribe = method.getAnnotation(JaxrsMethodDescribe.class); if (null != jaxrsMethodDescribe) { - /* - Map map = new HashMap(); - map.put(method.getName(), this.jaxrsApiMethod(clz, method)); - jaxrsClass.getMethods().add(map); - */ jaxrsClass.getMethods().add(this.jaxrsApiMethod(clz, method)); } - } - - //jaxrsClass.setMethods(this.getSortData("name",jaxrsClass.getMethods())); - + } return jaxrsClass; } @@ -152,7 +163,6 @@ public class ApiBuilder { this.keyName = keyName; } public int compare(Map mp1, Map mp2) { - System.out.println("this.keyName=" + mp1.keySet().toArray()[0]); String d1 = mp1.keySet().toArray()[0].toString(); String d2 = mp2.keySet().toArray()[0].toString(); return d2.compareTo(d1); @@ -167,9 +177,7 @@ public class ApiBuilder { JaxrsMethodDescribe jaxrsMethodDescribe = method.getAnnotation(JaxrsMethodDescribe.class); JaxrsApiMethod jaxrsMethod = new JaxrsApiMethod(); jaxrsMethod.setName(method.getName()); - //jaxrsMethod.setDescription(jaxrsMethodDescribe.value()); Class actionClass = jaxrsMethodDescribe.action(); - //jaxrsMethod.setClassName(actionClass.getName()); if (null != method.getAnnotation(GET.class)) { jaxrsMethod.setMethod("GET"); } else if (null != method.getAnnotation(POST.class)) { @@ -541,23 +549,13 @@ public class ApiBuilder { public String getName() { return name; } - /* - private List> methods = new ArrayList>(); - public List> getMethods() { - return methods; - } - public void setMethods(List> methods) { - this.methods = methods; - } - */ public void setName(String name) { this.name = name; } } public class JaxrsApiMethod{ - //private List name = new ArrayList<>(); private String name; private String uri; private String method; diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/build/CreateConfigSample.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/build/CreateConfigSample.java index 4e5beb35a5a9fdbfb4673ab336748f47f1eb28a2..714f80d7adbefde47d97c2725dd58a3e80114a9b 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/build/CreateConfigSample.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/build/CreateConfigSample.java @@ -80,6 +80,7 @@ public class CreateConfigSample { classes.add(WorkTime.class); classes.add(ZhengwuDingding.class); classes.add(Cache.class); + //classes.add(Web.class); Collections.sort(classes, new Comparator>() { public int compare(Class c1, Class c2) { diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ApplicationServer.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ApplicationServer.java index 9a11d4f38e541058e8d1e9a46810f39163eb1319..e7806774c0a4ae6c01074d944c2f732ef47f217c 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ApplicationServer.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ApplicationServer.java @@ -21,6 +21,7 @@ public class ApplicationServer extends ConfigObject { private static final String DEFAULT_STATEXCLUSIONS = "*.js,*.gif,*.jpg,*.png,*.css,*.ico"; private static final Integer DEFAULT_MAXFORMCONTENT = 20; private static final Boolean DEFAULT_EXPOSEJEST = true; + private static final Boolean DEFAULT_PERSISTENTCONNECTIONSENABLE = true; public ApplicationServer() { this.enable = true; @@ -38,6 +39,7 @@ public class ApplicationServer extends ConfigObject { this.statExclusions = DEFAULT_STATEXCLUSIONS; this.maxFormContent = DEFAULT_MAXFORMCONTENT; this.exposeJest = DEFAULT_EXPOSEJEST; + this.persistentConnectionsEnable = DEFAULT_PERSISTENTCONNECTIONSENABLE; } @FieldDescribe("是否启用") @@ -71,6 +73,14 @@ public class ApplicationServer extends ConfigObject { @FieldDescribe("暴露jest接口.") private Boolean exposeJest; + @FieldDescribe("是否启用长连接,默认false.") + private Boolean persistentConnectionsEnable; + + public Boolean getPersistentConnectionsEnable() { + return persistentConnectionsEnable == null ? DEFAULT_PERSISTENTCONNECTIONSENABLE + : this.persistentConnectionsEnable; + } + public Boolean getExposeJest() { return BooleanUtils.isNotFalse(this.exposeJest); } diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/CenterServer.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/CenterServer.java index 616c967fbf6670ca385aa2d610fbab9b0300782d..b126487471044efa1c8ab3a6433fb5ef94a234ac 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/CenterServer.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/CenterServer.java @@ -22,6 +22,7 @@ public class CenterServer extends ConfigObject { private static final String DEFAULT_STATEXCLUSIONS = "*.js,*.gif,*.jpg,*.png,*.css,*.ico"; private static final Integer DEFAULT_MAXFORMCONTENT = 20; private static final Boolean DEFAULT_EXPOSEJEST = true; + private static final Boolean DEFAULT_PERSISTENTCONNECTIONSENABLE = true; public static CenterServer defaultInstance() { return new CenterServer(); @@ -42,6 +43,7 @@ public class CenterServer extends ConfigObject { this.statExclusions = DEFAULT_STATEXCLUSIONS; this.maxFormContent = DEFAULT_MAXFORMCONTENT; this.exposeJest = DEFAULT_EXPOSEJEST; + this.persistentConnectionsEnable = DEFAULT_PERSISTENTCONNECTIONSENABLE; } @FieldDescribe("是否启用") @@ -75,6 +77,14 @@ public class CenterServer extends ConfigObject { @FieldDescribe("暴露jest接口.") private Boolean exposeJest; + @FieldDescribe("是否启用长连接,默认false.") + private Boolean persistentConnectionsEnable; + + public Boolean getPersistentConnectionsEnable() { + return persistentConnectionsEnable == null ? DEFAULT_PERSISTENTCONNECTIONSENABLE + : this.persistentConnectionsEnable; + } + public Boolean getExposeJest() { return BooleanUtils.isNotFalse(this.exposeJest); } diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java index 77769307cc11a628b0e9345f90561ec69e8ef10a..d37417911a64b632ffd85a990892876315b27e14 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java @@ -3,9 +3,10 @@ package com.x.base.core.project.config; import java.io.File; import java.io.FileFilter; import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; @@ -13,6 +14,13 @@ import java.util.concurrent.LinkedBlockingQueue; import javax.naming.InitialContext; import javax.ws.rs.core.MediaType; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.filefilter.WildcardFileFilter; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; +import org.eclipse.jetty.http.MimeTypes; + import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.x.base.core.project.x_program_center; @@ -22,13 +30,6 @@ import com.x.base.core.project.tools.DefaultCharset; import com.x.base.core.project.tools.Host; import com.x.base.core.project.tools.NumberTools; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.io.filefilter.WildcardFileFilter; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.StringUtils; -import org.eclipse.jetty.http.MimeTypes; - public class Config { private static Config INSTANCE; @@ -79,11 +80,13 @@ public class Config { public static final String PATH_CONFIG_CACHE = "config/cache.json"; public static final String PATH_CONFIG_COMPONENTS = "config/components.json"; public static final String PATH_CONFIG_EMAIL = "config/email.json"; + public static final String PATH_CONFIG_WEB = "config/web.json"; public static final String DIR_COMMONS = "commons"; public static final String DIR_COMMONS_TESS4J_TESSDATA = "commons/tess4j/tessdata"; public static final String DIR_COMMONS_EXT = "commons/ext"; public static final String DIR_CONFIG = "config"; + public static final String DIR_CONFIG_COVERTOWEBSERVER = "config/coverToWebServer"; public static final String DIR_CONFIGSAMPLE = "configSample"; public static final String DIR_CUSTOM = "custom"; public static final String DIR_CUSTOM_JARS = "custom/jars"; @@ -100,6 +103,7 @@ public class Config { public static final String DIR_LOCAL_UPDATE = "local/update"; public static final String DIR_LOCAL_TEMP = "local/temp"; public static final String DIR_LOCAL_TEMP_CLASSES = "local/temp/classes"; + public static final String DIR_LOCAL_TEMP_CUSTOM = "local/temp/custom"; public static final String DIR_LOCAL_TEMP_SQL = "local/temp/sql"; public static final String DIR_LOCAL_TEMP_DYNAMIC = "local/temp/dynamic"; public static final String DIR_LOCAL_TEMP_DYNAMIC_SRC = "local/temp/dynamic/src"; @@ -115,6 +119,7 @@ public class Config { public static final String DIR_SERVERS_CENTERSERVER_WEBAPPS = "servers/centerServer/webapps"; public static final String DIR_SERVERS_CENTERSERVER_WORK = "servers/centerServer/work"; public static final String DIR_SERVERS_WEBSERVER = "servers/webServer"; + public static final String DIR_SERVERS_WEBSERVER_X_DESKTOP_RES_CONFIG = "servers/webServer/x_desktop/res/config"; public static final String DIR_STORE = "store"; public static final String DIR_STORE_JARS = "store/jars"; @@ -320,6 +325,20 @@ public class Config { return new File(base(), DIR_LOCAL_TEMP_CLASSES); } + public static File dir_local_temp_custom() throws Exception { + return new File(base(), DIR_LOCAL_TEMP_CUSTOM); + } + + public static File dir_local_temp_custom(Boolean force) throws Exception { + File dir = new File(base(), DIR_LOCAL_TEMP_CUSTOM); + if (force) { + if ((!dir.exists()) || dir.isFile()) { + FileUtils.forceMkdir(dir); + } + } + return dir; + } + public static File dir_local_temp_dynamic() throws Exception { return new File(base(), DIR_LOCAL_TEMP_DYNAMIC); } @@ -442,41 +461,51 @@ public class Config { return dir; } - public static void flush() { - if (null != INSTANCE) { - synchronized (Config.class) { - if (null != INSTANCE) { - INSTANCE = null; - } - } + public static Path path_servers_webServer_x_desktop_res_config(Boolean force) throws Exception { + Path path = Paths.get(base(), DIR_SERVERS_WEBSERVER_X_DESKTOP_RES_CONFIG); + if (!Files.exists(path)) { + Files.createDirectories(path); + } + return path; + } + + public static Path path_config_coverToWebServer(Boolean force) throws Exception { + Path path = Paths.get(base(), DIR_CONFIG_COVERTOWEBSERVER); + if (!Files.exists(path)) { + Files.createDirectories(path); + } + return path; + } + + public static Path path_servers_webServer(Boolean force) throws Exception { + Path path = Paths.get(base(), DIR_SERVERS_WEBSERVER); + if (!Files.exists(path)) { + Files.createDirectories(path); } + return path; } - private static Config instance() throws Exception { + public static synchronized void flush() { + INSTANCE = null; + } + + private static synchronized Config instance() throws Exception { if (null == INSTANCE) { - synchronized (Config.class) { - if (null == INSTANCE) { - INSTANCE = new Config(); - } - } + INSTANCE = new Config(); } return INSTANCE; } private String version; - public static String version() throws Exception { + public static synchronized String version() throws Exception { if (null == instance().version) { - synchronized (Config.class) { - if (null == instance().version) { - String text = BaseTools.readString(PATH_VERSION); - if (XGsonBuilder.isJsonObject(text)) { - JsonObject obj = XGsonBuilder.instance().fromJson(text, JsonObject.class); - instance().version = obj.get("version").getAsString(); - } else { - instance().version = text; - } - } + String text = BaseTools.readString(PATH_VERSION); + if (XGsonBuilder.isJsonObject(text)) { + JsonObject obj = XGsonBuilder.instance().fromJson(text, JsonObject.class); + instance().version = obj.get("version").getAsString(); + } else { + instance().version = text; } } return instance().version; @@ -484,132 +513,104 @@ public class Config { private String node; - public static String node() throws Exception { + public static synchronized String node() throws Exception { if (null == instance().node) { - synchronized (Config.class) { - if (null == instance().node) { - instance().node = BaseTools.readCfg(PATH_LOCAL_NODE, Host.ROLLBACK_IPV4); - } - } + instance().node = BaseTools.readCfg(PATH_LOCAL_NODE, Host.ROLLBACK_IPV4); } return instance().node; } private String base; - public static String base() throws Exception { + public static synchronized String base() throws Exception { if (null == instance().base) { - synchronized (Config.class) { - if (null == instance().base) { - instance().base = BaseTools.getBasePath(); - } - } + instance().base = BaseTools.getBasePath(); } return instance().base; } private Nodes nodes; - public static Nodes nodes() throws Exception { + public static synchronized Nodes nodes() throws Exception { if (null == instance().nodes) { - synchronized (Config.class) { - if (null == instance().nodes) { - Nodes nodes = new Nodes(); - FileFilter fileFilter = new WildcardFileFilter("node_*.json"); - File[] files = dir_config().listFiles(fileFilter); - if (null != files && files.length > 0) { - for (File o : files) { - String name = StringUtils.substringBetween(o.getName(), "node_", ".json"); - Node node = BaseTools.readConfigObject(DIR_CONFIG + "/" + o.getName(), Node.class); - if (StringUtils.isNotEmpty(name) && BooleanUtils.isTrue(node.getEnable())) { - nodes.put(name, node); - } - } - } else { - Node o = Node.defaultInstance(); - nodes.put(node(), o); - } - /* 20191009兼容centerServer */ - CenterServer c = BaseTools.readConfigObject(PATH_CONFIG_CENTERSERVER, CenterServer.class); - if (null != c) { - for (Node n : nodes.values()) { - n.setCenter(c); - } + Nodes nodes = new Nodes(); + FileFilter fileFilter = new WildcardFileFilter("node_*.json"); + File[] files = dir_config().listFiles(fileFilter); + if (null != files && files.length > 0) { + for (File o : files) { + String name = StringUtils.substringBetween(o.getName(), "node_", ".json"); + Node node = BaseTools.readConfigObject(DIR_CONFIG + "/" + o.getName(), Node.class); + if (StringUtils.isNotEmpty(name) && BooleanUtils.isTrue(node.getEnable())) { + nodes.put(name, node); } - /* 20191009兼容centerServer end */ - instance().nodes = nodes; + } + } else { + Node o = Node.defaultInstance(); + nodes.put(node(), o); + } + /* 20191009兼容centerServer */ + CenterServer c = BaseTools.readConfigObject(PATH_CONFIG_CENTERSERVER, CenterServer.class); + if (null != c) { + for (Node n : nodes.values()) { + n.setCenter(c); } } + /* 20191009兼容centerServer end */ + instance().nodes = nodes; } return instance().nodes; } private Token token; - public static Token token() throws Exception { + public static synchronized Token token() throws Exception { if (null == instance().token) { - synchronized (Config.class) { - if (null == instance().token) { - Token o = BaseTools.readConfigObject(PATH_CONFIG_TOKEN, Token.class); - if (null == o) { - o = Token.defaultInstance(); - } - instance().token = o; - } + Token o = BaseTools.readConfigObject(PATH_CONFIG_TOKEN, Token.class); + if (null == o) { + o = Token.defaultInstance(); } + instance().token = o; } return instance().token; } private ExternalDataSources externalDataSources; - public static ExternalDataSources externalDataSources() throws Exception { + public static synchronized ExternalDataSources externalDataSources() throws Exception { if (null == instance().externalDataSources) { - synchronized (Config.class) { - if (null == instance().externalDataSources) { - ExternalDataSources obj = BaseTools.readConfigObject(PATH_CONFIG_EXTERNALDATASOURCES, - ExternalDataSources.class); - if (null == obj) { - obj = ExternalDataSources.defaultInstance(); - } - instance().externalDataSources = obj; - } + ExternalDataSources obj = BaseTools.readConfigObject(PATH_CONFIG_EXTERNALDATASOURCES, + ExternalDataSources.class); + if (null == obj) { + obj = ExternalDataSources.defaultInstance(); } + instance().externalDataSources = obj; } return instance().externalDataSources; } private ExternalStorageSources externalStorageSources; - public static ExternalStorageSources externalStorageSources() throws Exception { + public static synchronized ExternalStorageSources externalStorageSources() throws Exception { if (null == instance().externalStorageSources) { - synchronized (Config.class) { - if (null == instance().externalStorageSources) { - ExternalStorageSources obj = BaseTools.readConfigObject(PATH_CONFIG_EXTERNALSTORAGESOURCES, - ExternalStorageSources.class); - if (null == obj) { - obj = ExternalStorageSources.defaultInstance(); - } - instance().externalStorageSources = obj; - } + ExternalStorageSources obj = BaseTools.readConfigObject(PATH_CONFIG_EXTERNALSTORAGESOURCES, + ExternalStorageSources.class); + if (null == obj) { + obj = ExternalStorageSources.defaultInstance(); } + instance().externalStorageSources = obj; } return instance().externalStorageSources; } private String publicKey; - public static String publicKey() throws Exception { + public static synchronized String publicKey() throws Exception { if (null == instance().publicKey) { - synchronized (Config.class) { - if (null == instance().publicKey) { - File file = new File(Config.base(), PATH_CONFIG_PUBLICKEY); - if (file.exists() && file.isFile()) { - instance().publicKey = FileUtils.readFileToString(file, "utf-8"); - } else { - instance().publicKey = DEFAULT_PUBLIC_KEY; - } - } + File file = new File(Config.base(), PATH_CONFIG_PUBLICKEY); + if (file.exists() && file.isFile()) { + instance().publicKey = FileUtils.readFileToString(file, "utf-8"); + } else { + instance().publicKey = DEFAULT_PUBLIC_KEY; } } return instance().publicKey; @@ -617,17 +618,13 @@ public class Config { private String privateKey; - public static String privateKey() throws Exception { + public static synchronized String privateKey() throws Exception { if (null == instance().privateKey) { - synchronized (Config.class) { - if (null == instance().privateKey) { - File file = new File(Config.base(), PATH_CONFIG_PRIVATEKEY); - if (file.exists() && file.isFile()) { - instance().privateKey = FileUtils.readFileToString(file, "utf-8"); - } else { - instance().privateKey = DEFAULT_PRIVATE_KEY; - } - } + File file = new File(Config.base(), PATH_CONFIG_PRIVATEKEY); + if (file.exists() && file.isFile()) { + instance().privateKey = FileUtils.readFileToString(file, "utf-8"); + } else { + instance().privateKey = DEFAULT_PRIVATE_KEY; } } return instance().privateKey; @@ -635,191 +632,128 @@ public class Config { private Person person = null; - public static Person person() throws Exception { + public static synchronized Person person() throws Exception { if (null == instance().person) { - synchronized (Config.class) { - if (null == instance().person) { - Person obj = BaseTools.readConfigObject(PATH_CONFIG_PERSON, Person.class); - if (null == obj) { - obj = Person.defaultInstance(); - } - instance().person = obj; - } + Person obj = BaseTools.readConfigObject(PATH_CONFIG_PERSON, Person.class); + if (null == obj) { + obj = Person.defaultInstance(); } + instance().person = obj; } return instance().person; } private Communicate communicate = null; - public static Communicate communicate() throws Exception { + public static synchronized Communicate communicate() throws Exception { if (null == instance().communicate) { - synchronized (Config.class) { - if (null == instance().communicate) { - Communicate obj = BaseTools.readConfigObject(PATH_CONFIG_COMMUNICATE, Communicate.class); - if (null == obj) { - obj = Communicate.defaultInstance(); - } - instance().communicate = obj; - } + Communicate obj = BaseTools.readConfigObject(PATH_CONFIG_COMMUNICATE, Communicate.class); + if (null == obj) { + obj = Communicate.defaultInstance(); } + instance().communicate = obj; } return instance().communicate; } private Meeting meeting; - public static Meeting meeting() throws Exception { + public static synchronized Meeting meeting() throws Exception { if (null == instance().meeting) { - synchronized (Config.class) { - if (null == instance().meeting) { - Meeting obj = BaseTools.readConfigObject(PATH_CONFIG_MEETING, Meeting.class); - if (null == obj) { - obj = Meeting.defaultInstance(); - } - instance().meeting = obj; - } + Meeting obj = BaseTools.readConfigObject(PATH_CONFIG_MEETING, Meeting.class); + if (null == obj) { + obj = Meeting.defaultInstance(); } + instance().meeting = obj; } return instance().meeting; } private com.x.base.core.project.utils.time.WorkTime workTime; - public static com.x.base.core.project.utils.time.WorkTime workTime() throws Exception { + public static synchronized com.x.base.core.project.utils.time.WorkTime workTime() throws Exception { if (null == instance().workTime) { - synchronized (Config.class) { - if (null == instance().workTime) { - com.x.base.core.project.config.WorkTime obj = BaseTools.readConfigObject(PATH_CONFIG_WORKTIME, - com.x.base.core.project.config.WorkTime.class); - if (null == obj) { - obj = com.x.base.core.project.config.WorkTime.defaultInstance(); - } - instance().workTime = new com.x.base.core.project.utils.time.WorkTime(obj.getAmStart(), - obj.getAmEnd(), obj.getPmStart(), obj.getPmEnd(), obj.getHolidays(), obj.getWorkdays(), - obj.getWeekends()); - } + com.x.base.core.project.config.WorkTime obj = BaseTools.readConfigObject(PATH_CONFIG_WORKTIME, + com.x.base.core.project.config.WorkTime.class); + if (null == obj) { + obj = com.x.base.core.project.config.WorkTime.defaultInstance(); } + instance().workTime = new com.x.base.core.project.utils.time.WorkTime(obj.getAmStart(), obj.getAmEnd(), + obj.getPmStart(), obj.getPmEnd(), obj.getHolidays(), obj.getWorkdays(), obj.getWeekends()); } return instance().workTime; } public Collect collect; - public static Collect collect() throws Exception { + public static synchronized Collect collect() throws Exception { if (null == instance().collect) { - synchronized (Config.class) { - if (null == instance().collect) { - Collect obj = BaseTools.readConfigObject(PATH_CONFIG_COLLECT, Collect.class); - if (null == obj) { - obj = Collect.defaultInstance(); - } - instance().collect = obj; - - } + Collect obj = BaseTools.readConfigObject(PATH_CONFIG_COLLECT, Collect.class); + if (null == obj) { + obj = Collect.defaultInstance(); } + instance().collect = obj; } return instance().collect; } public DumpRestoreData dumpRestoreData; - public static DumpRestoreData dumpRestoreData() throws Exception { + public static synchronized DumpRestoreData dumpRestoreData() throws Exception { if (null == instance().dumpRestoreData) { - synchronized (Config.class) { - if (null == instance().dumpRestoreData) { - DumpRestoreData obj = BaseTools.readConfigObject(PATH_CONFIG_DUMPRESTOREDATA, - DumpRestoreData.class); - if (null == obj) { - obj = DumpRestoreData.defaultInstance(); - } - instance().dumpRestoreData = obj; - } + DumpRestoreData obj = BaseTools.readConfigObject(PATH_CONFIG_DUMPRESTOREDATA, DumpRestoreData.class); + if (null == obj) { + obj = DumpRestoreData.defaultInstance(); } + instance().dumpRestoreData = obj; } return instance().dumpRestoreData; } -// public DumpRestoreStorage dumpRestoreStorage; -// -// public static DumpRestoreStorage dumpRestoreStorage() throws Exception { -// if (null == instance().dumpRestoreStorage) { -// synchronized (Config.class) { -// if (null == instance().dumpRestoreStorage) { -// DumpRestoreStorage obj = BaseTools.readConfigObject(PATH_CONFIG_DUMPRESTORESTORAGE, -// DumpRestoreStorage.class); -// if (null == obj) { -// obj = DumpRestoreStorage.defaultInstance(); -// } -// instance().dumpRestoreStorage = obj; -// } -// } -// } -// return instance().dumpRestoreStorage; -// } - public String initialScriptText; - public static String initialScriptText() throws Exception { + public static synchronized String initialScriptText() throws Exception { if (null == instance().initialScriptText) { - synchronized (Config.class) { - if (null == instance().initialScriptText) { - instance().initialScriptText = BaseTools.readString(PATH_COMMONS_INITIALSCRIPTTEXT); - } - } + instance().initialScriptText = BaseTools.readString(PATH_COMMONS_INITIALSCRIPTTEXT); } return instance().initialScriptText; } public String initialServiceScriptText; - public static String initialServiceScriptText() throws Exception { + public static synchronized String initialServiceScriptText() throws Exception { if (null == instance().initialServiceScriptText) { - synchronized (Config.class) { - if (null == instance().initialServiceScriptText) { - instance().initialServiceScriptText = BaseTools.readString(PATH_COMMONS_INITIALSERVICESCRIPTTEXT); - } - } + instance().initialServiceScriptText = BaseTools.readString(PATH_COMMONS_INITIALSERVICESCRIPTTEXT); } return instance().initialServiceScriptText; } public String mooToolsScriptText; - public static String mooToolsScriptText() throws Exception { + public static synchronized String mooToolsScriptText() throws Exception { if (null == instance().mooToolsScriptText) { - synchronized (Config.class) { - if (null == instance().mooToolsScriptText) { - instance().mooToolsScriptText = BaseTools.readString(PATH_COMMONS_MOOTOOLSSCRIPTTEXT); - } - } + instance().mooToolsScriptText = BaseTools.readString(PATH_COMMONS_MOOTOOLSSCRIPTTEXT); } return instance().mooToolsScriptText; } private MimeTypes mimeTypes; - public static MimeTypes mimeTypes() throws Exception { + public static synchronized MimeTypes mimeTypes() throws Exception { if (null == instance().mimeTypes) { - synchronized (Config.class) { - if (null == instance().mimeTypes) { - MimeTypes mimeTypes = new MimeTypes(); - /* 添加o2自定义格式 */ - mimeTypes.addMimeMapping("wcss", "application/json"); - /* 添加默认格式 */ - mimeTypes.addMimeMapping("", "application/octet-stream"); - /* 添加新版office格式 */ - mimeTypes.addMimeMapping("docx", - "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); - mimeTypes.addMimeMapping("xlsx", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - mimeTypes.addMimeMapping("pptx", - "application/vnd.openxmlformats-officedocument.presentationml.presentation"); - /* 名片 */ - mimeTypes.addMimeMapping("vcf", "text/x-vcard"); - instance().mimeTypes = mimeTypes; - } - } + MimeTypes mimeTypes = new MimeTypes(); + /* 添加o2自定义格式 */ + mimeTypes.addMimeMapping("wcss", "application/json"); + /* 添加默认格式 */ + mimeTypes.addMimeMapping("", "application/octet-stream"); + /* 添加新版office格式 */ + mimeTypes.addMimeMapping("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + mimeTypes.addMimeMapping("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + mimeTypes.addMimeMapping("pptx", + "application/vnd.openxmlformats-officedocument.presentationml.presentation"); + /* 名片 */ + mimeTypes.addMimeMapping("vcf", "text/x-vcard"); + instance().mimeTypes = mimeTypes; } return instance().mimeTypes; } @@ -843,18 +777,14 @@ public class Config { private StorageMappings storageMappings; - public static StorageMappings storageMappings() throws Exception { + public static synchronized StorageMappings storageMappings() throws Exception { if (null == instance().storageMappings) { - synchronized (Config.class) { - if (null == instance().storageMappings) { - ExternalStorageSources obj = BaseTools.readConfigObject(PATH_CONFIG_EXTERNALSTORAGESOURCES, - ExternalStorageSources.class); - if ((obj != null)) { - instance().storageMappings = new StorageMappings(obj); - } else { - instance().storageMappings = new StorageMappings(nodes()); - } - } + ExternalStorageSources obj = BaseTools.readConfigObject(PATH_CONFIG_EXTERNALSTORAGESOURCES, + ExternalStorageSources.class); + if ((obj != null)) { + instance().storageMappings = new StorageMappings(obj); + } else { + instance().storageMappings = new StorageMappings(nodes()); } } return instance().storageMappings; @@ -862,20 +792,16 @@ public class Config { private File sslKeyStore; - public static File sslKeyStore() throws Exception { + public static synchronized File sslKeyStore() throws Exception { if (null == instance().sslKeyStore) { - synchronized (Config.class) { - if (null == instance().sslKeyStore) { - File file = new File(BaseTools.getBasePath(), PATH_CONFIG_SSLKEYSTORE); - if ((!file.exists()) || file.isDirectory()) { - file = new File(BaseTools.getBasePath(), PATH_CONFIG_SSLKEYSTORE + ".jks"); - } - if ((!file.exists()) || file.isDirectory()) { - file = new File(BaseTools.getBasePath(), PATH_CONFIG_SSLKEYSTORESAMPLE); - } - instance().sslKeyStore = file; - } + File file = new File(BaseTools.getBasePath(), PATH_CONFIG_SSLKEYSTORE); + if ((!file.exists()) || file.isDirectory()) { + file = new File(BaseTools.getBasePath(), PATH_CONFIG_SSLKEYSTORE + ".jks"); } + if ((!file.exists()) || file.isDirectory()) { + file = new File(BaseTools.getBasePath(), PATH_CONFIG_SSLKEYSTORESAMPLE); + } + instance().sslKeyStore = file; } return instance().sslKeyStore; } @@ -939,55 +865,42 @@ public class Config { private Messages messages; - public static Messages messages() throws Exception { + public static synchronized Messages messages() throws Exception { if (null == instance().messages) { - synchronized (Config.class) { - if (null == instance().messages) { - Messages obj = Messages.defaultInstance(); - Messages custom = BaseTools.readConfigObject(PATH_CONFIG_MESSAGES, Messages.class); - if (null != custom) { - custom.entrySet().stream().forEach(o -> { - obj.put(o.getKey(), - new Message(o.getValue().getConsumers(), o.getValue().getConsumersV2())); - }); - } - instance().messages = obj; - } + Messages obj = Messages.defaultInstance(); + Messages custom = BaseTools.readConfigObject(PATH_CONFIG_MESSAGES, Messages.class); + if (null != custom) { + custom.entrySet().stream().forEach(o -> { + obj.put(o.getKey(), new Message(o.getValue().getConsumers(), o.getValue().getConsumersV2())); + }); } + instance().messages = obj; } return instance().messages; } private String messageSendRuleScript; - public static String messageSendRuleScript() throws Exception { + public static synchronized String messageSendRuleScript() throws Exception { if (null == instance().messageSendRuleScript) { - synchronized (Config.class) { - if (null == instance().messageSendRuleScript) { - String scriptStr = BaseTools.readString(PATH_CONFIG_MESSAGES_SEND_RULE); - if (scriptStr == null) { - scriptStr = ""; - } - instance().messageSendRuleScript = scriptStr; - } + String scriptStr = BaseTools.readString(PATH_CONFIG_MESSAGES_SEND_RULE); + if (scriptStr == null) { + scriptStr = ""; } + instance().messageSendRuleScript = scriptStr; } return instance().messageSendRuleScript; } private PushConfig pushConfig; - public static PushConfig pushConfig() throws Exception { + public static synchronized PushConfig pushConfig() throws Exception { if (null == instance().pushConfig) { - synchronized (Config.class) { - if (null == instance().pushConfig) { - PushConfig custom = BaseTools.readConfigObject(PATH_CONFIG_JPUSH, PushConfig.class); - if (null != custom) { - instance().pushConfig = custom; - } else { - instance().pushConfig = PushConfig.defaultInstance(); - } - } + PushConfig custom = BaseTools.readConfigObject(PATH_CONFIG_JPUSH, PushConfig.class); + if (null != custom) { + instance().pushConfig = custom; + } else { + instance().pushConfig = PushConfig.defaultInstance(); } } return instance().pushConfig; @@ -995,172 +908,130 @@ public class Config { private ProcessPlatform processPlatform; - public static ProcessPlatform processPlatform() throws Exception { + public static synchronized ProcessPlatform processPlatform() throws Exception { if (null == instance().processPlatform) { - synchronized (Config.class) { - if (null == instance().processPlatform) { - ProcessPlatform obj = BaseTools.readConfigObject(PATH_CONFIG_PROCESSPLATFORM, - ProcessPlatform.class); - if (null == obj) { - obj = ProcessPlatform.defaultInstance(); - } - instance().processPlatform = obj; - } + ProcessPlatform obj = BaseTools.readConfigObject(PATH_CONFIG_PROCESSPLATFORM, ProcessPlatform.class); + if (null == obj) { + obj = ProcessPlatform.defaultInstance(); } + instance().processPlatform = obj; } return instance().processPlatform; } private Query query; - public static Query query() throws Exception { + public static synchronized Query query() throws Exception { if (null == instance().query) { - synchronized (Config.class) { - if (null == instance().query) { - Query obj = BaseTools.readConfigObject(PATH_CONFIG_QUERY, Query.class); - if (null == obj) { - obj = Query.defaultInstance(); - } - instance().query = obj; - } + Query obj = BaseTools.readConfigObject(PATH_CONFIG_QUERY, Query.class); + if (null == obj) { + obj = Query.defaultInstance(); } + instance().query = obj; } return instance().query; } private Dingding dingding; - public static Dingding dingding() throws Exception { + public static synchronized Dingding dingding() throws Exception { if (null == instance().dingding) { - synchronized (Config.class) { - if (null == instance().dingding) { - Dingding obj = BaseTools.readConfigObject(PATH_CONFIG_DINGDING, Dingding.class); - if (null == obj) { - obj = Dingding.defaultInstance(); - } - instance().dingding = obj; - } + Dingding obj = BaseTools.readConfigObject(PATH_CONFIG_DINGDING, Dingding.class); + if (null == obj) { + obj = Dingding.defaultInstance(); } + instance().dingding = obj; } return instance().dingding; } private WeLink weLink; - public static WeLink weLink() throws Exception { + public static synchronized WeLink weLink() throws Exception { if (null == instance().weLink) { - synchronized (Config.class) { - if (null == instance().weLink) { - WeLink obj = BaseTools.readConfigObject(PATH_CONFIG_WELINK, WeLink.class); - if (null == obj) { - obj = WeLink.defaultInstance(); - } - instance().weLink = obj; - } + WeLink obj = BaseTools.readConfigObject(PATH_CONFIG_WELINK, WeLink.class); + if (null == obj) { + obj = WeLink.defaultInstance(); } + instance().weLink = obj; } return instance().weLink; } private Qiyeweixin qiyeweixin; - public static Qiyeweixin qiyeweixin() throws Exception { + public static synchronized Qiyeweixin qiyeweixin() throws Exception { if (null == instance().qiyeweixin) { - synchronized (Config.class) { - if (null == instance().qiyeweixin) { - Qiyeweixin obj = BaseTools.readConfigObject(PATH_CONFIG_QIYEWEIXIN, Qiyeweixin.class); - if (null == obj) { - obj = Qiyeweixin.defaultInstance(); - } - instance().qiyeweixin = obj; - } + Qiyeweixin obj = BaseTools.readConfigObject(PATH_CONFIG_QIYEWEIXIN, Qiyeweixin.class); + if (null == obj) { + obj = Qiyeweixin.defaultInstance(); } + instance().qiyeweixin = obj; } return instance().qiyeweixin; } private ZhengwuDingding zhengwuDingding; - public static ZhengwuDingding zhengwuDingding() throws Exception { + public static synchronized ZhengwuDingding zhengwuDingding() throws Exception { if (null == instance().zhengwuDingding) { - synchronized (Config.class) { - if (null == instance().zhengwuDingding) { - ZhengwuDingding obj = BaseTools.readConfigObject(PATH_CONFIG_ZHENGWUDINGDING, - ZhengwuDingding.class); - if (null == obj) { - obj = ZhengwuDingding.defaultInstance(); - } - instance().zhengwuDingding = obj; - } + ZhengwuDingding obj = BaseTools.readConfigObject(PATH_CONFIG_ZHENGWUDINGDING, ZhengwuDingding.class); + if (null == obj) { + obj = ZhengwuDingding.defaultInstance(); } + instance().zhengwuDingding = obj; } return instance().zhengwuDingding; } private MQ mq; - public static MQ mq() throws Exception { + public static synchronized MQ mq() throws Exception { if (null == instance().mq) { - synchronized (Config.class) { - if (null == instance().mq) { - MQ obj = BaseTools.readConfigObject(PATH_CONFIG_MQ, MQ.class); - if (null == obj) { - obj = MQ.defaultInstance(); - } - instance().mq = obj; - } + MQ obj = BaseTools.readConfigObject(PATH_CONFIG_MQ, MQ.class); + if (null == obj) { + obj = MQ.defaultInstance(); } + instance().mq = obj; } return instance().mq; } private Vfs vfs; - public static Vfs vfs() throws Exception { + public static synchronized Vfs vfs() throws Exception { if (null == instance().vfs) { - synchronized (Config.class) { - if (null == instance().vfs) { - Vfs obj = BaseTools.readConfigObject(PATH_CONFIG_VFS, Vfs.class); - if (null == obj) { - obj = Vfs.defaultInstance(); - } - instance().vfs = obj; - } + Vfs obj = BaseTools.readConfigObject(PATH_CONFIG_VFS, Vfs.class); + if (null == obj) { + obj = Vfs.defaultInstance(); } + instance().vfs = obj; } return instance().vfs; } private AppStyle appStyle; - public static AppStyle appStyle() throws Exception { + public static synchronized AppStyle appStyle() throws Exception { if (null == instance().appStyle) { - synchronized (Config.class) { - if (null == instance().appStyle) { - AppStyle obj = BaseTools.readConfigObject(PATH_CONFIG_APPSTYLE, AppStyle.class); - if (null == obj) { - obj = AppStyle.defaultInstance(); - } - instance().appStyle = obj; - } + AppStyle obj = BaseTools.readConfigObject(PATH_CONFIG_APPSTYLE, AppStyle.class); + if (null == obj) { + obj = AppStyle.defaultInstance(); } + instance().appStyle = obj; } return instance().appStyle; } private File startImage; - public static File startImage() throws Exception { + public static synchronized File startImage() throws Exception { if (null == instance().startImage) { - synchronized (Config.class) { - if (null == instance().startImage) { - File file = new File(BaseTools.getBasePath(), PATH_CONFIG_STARTIMAGE); - if (file.exists() && file.isFile()) { - instance().startImage = file; - } else { - instance().startImage = null; - } - } + File file = new File(BaseTools.getBasePath(), PATH_CONFIG_STARTIMAGE); + if (file.exists() && file.isFile()) { + instance().startImage = file; + } else { + instance().startImage = null; } } return instance().startImage; @@ -1168,51 +1039,39 @@ public class Config { private LogLevel logLevel; - public static LogLevel logLevel() throws Exception { + public static synchronized LogLevel logLevel() throws Exception { if (null == instance().logLevel) { - synchronized (Config.class) { - if (null == instance().logLevel) { - LogLevel obj = BaseTools.readConfigObject(PATH_CONFIG_LOGLEVEL, LogLevel.class); - if (null == obj) { - obj = LogLevel.defaultInstance(); - } - instance().logLevel = obj; - } + LogLevel obj = BaseTools.readConfigObject(PATH_CONFIG_LOGLEVEL, LogLevel.class); + if (null == obj) { + obj = LogLevel.defaultInstance(); } + instance().logLevel = obj; } return instance().logLevel; } private ClientInit clientInit; - public static ClientInit clientInit() throws Exception { + public static synchronized ClientInit clientInit() throws Exception { if (null == instance().clientInit) { - synchronized (Config.class) { - if (null == instance().clientInit) { - ClientInit obj = BaseTools.readConfigObject(PATH_CONFIG_CLIENTINIT, ClientInit.class); - if (null == obj) { - obj = ClientInit.defaultInstance(); - } - instance().clientInit = obj; - } + ClientInit obj = BaseTools.readConfigObject(PATH_CONFIG_CLIENTINIT, ClientInit.class); + if (null == obj) { + obj = ClientInit.defaultInstance(); } + instance().clientInit = obj; } return instance().clientInit; } private byte[] bindLogo; - public static byte[] bindLogo() throws Exception { + public static synchronized byte[] bindLogo() throws Exception { if (null == instance().bindLogo) { - synchronized (Config.class) { - if (null == instance().bindLogo) { - File file = new File(Config.base(), PATH_CONFIG_BINDLOGO); - if (file.exists() && file.isFile()) { - instance().bindLogo = FileUtils.readFileToByteArray(file); - } else { - instance().bindLogo = DEFAULT_BINDLOGO; - } - } + File file = new File(Config.base(), PATH_CONFIG_BINDLOGO); + if (file.exists() && file.isFile()) { + instance().bindLogo = FileUtils.readFileToByteArray(file); + } else { + instance().bindLogo = DEFAULT_BINDLOGO; } } return instance().bindLogo; @@ -1220,64 +1079,48 @@ public class Config { private InitialContext initialContext; - private static InitialContext initialContext() throws Exception { + private static synchronized InitialContext initialContext() throws Exception { if (null == instance().initialContext) { - synchronized (Config.class) { - if (null == instance().initialContext) { - instance().initialContext = new InitialContext(); - } - } + instance().initialContext = new InitialContext(); } return instance().initialContext; } public Slice slice; - public static Slice slice() throws Exception { + public static synchronized Slice slice() throws Exception { if (null == instance().slice) { - synchronized (Config.class) { - if (null == instance().slice) { - Slice obj = BaseTools.readConfigObject(PATH_CONFIG_SLICE, Slice.class); - if (null == obj) { - obj = Slice.defaultInstance(); - } - instance().slice = obj; - } + Slice obj = BaseTools.readConfigObject(PATH_CONFIG_SLICE, Slice.class); + if (null == obj) { + obj = Slice.defaultInstance(); } + instance().slice = obj; } return instance().slice; } public Exmail exmail; - public static Exmail exmail() throws Exception { + public static synchronized Exmail exmail() throws Exception { if (null == instance().exmail) { - synchronized (Config.class) { - if (null == instance().exmail) { - Exmail obj = BaseTools.readConfigObject(PATH_CONFIG_EXMAIL, Exmail.class); - if (null == obj) { - obj = Exmail.defaultInstance(); - } - instance().exmail = obj; - } + Exmail obj = BaseTools.readConfigObject(PATH_CONFIG_EXMAIL, Exmail.class); + if (null == obj) { + obj = Exmail.defaultInstance(); } + instance().exmail = obj; } return instance().exmail; } public Portal portal; - public static Portal portal() throws Exception { + public static synchronized Portal portal() throws Exception { if (null == instance().portal) { - synchronized (Config.class) { - if (null == instance().portal) { - Portal obj = BaseTools.readConfigObject(PATH_CONFIG_PORTAL, Portal.class); - if (null == obj) { - obj = Portal.defaultInstance(); - } - instance().portal = obj; - } + Portal obj = BaseTools.readConfigObject(PATH_CONFIG_PORTAL, Portal.class); + if (null == obj) { + obj = Portal.defaultInstance(); } + instance().portal = obj; } return instance().portal; } @@ -1310,21 +1153,46 @@ public class Config { private Components components = null; - public static Components components() throws Exception { + public static synchronized Components components() throws Exception { if (null == instance().components) { - synchronized (Config.class) { - if (null == instance().components) { - Components obj = BaseTools.readConfigObject(PATH_CONFIG_COMPONENTS, Components.class); - if (null == obj) { - obj = Components.defaultInstance(); - } - instance().components = obj; - } + Components obj = BaseTools.readConfigObject(PATH_CONFIG_COMPONENTS, Components.class); + if (null == obj) { + obj = Components.defaultInstance(); } + instance().components = obj; } return instance().components; } + public JsonObject web; + + public static synchronized JsonObject web() throws Exception { + if (null == instance().web) { + JsonObject obj = BaseTools.readConfigObject(PATH_CONFIG_WEB, JsonObject.class); + if (null == obj) { + obj = new JsonObject(); + } + instance().web = obj; + } + return instance().web; + } + + public Map customConfig = new HashMap<>(); + + public static synchronized JsonObject customConfig(String configName) throws Exception { + if(StringUtils.isBlank(configName)){ + return null; + }else{ + if(instance().customConfig.get(configName)==null){ + JsonObject obj = BaseTools.readConfigObject(DIR_CONFIG+"/"+configName+".json", JsonObject.class); + if(obj!=null){ + instance().customConfig.put(configName, obj); + } + } + return instance().customConfig.get(configName); + } + } + public static Object resource(String name) throws Exception { return initialContext().lookup(name); } @@ -1415,4 +1283,4 @@ public class Config { initialContext().rebind(RESOURCE_NODE_PROCESSPLATFORMEXECUTORS, executorServices); } -} \ No newline at end of file +} diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/DataServer.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/DataServer.java index 448a5670972ffd1f2ec84e07102d281a01190dc7..7f38f9070759e2b564b37a2aec6a90e649ceb091 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/DataServer.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/DataServer.java @@ -57,7 +57,7 @@ public class DataServer extends ConfigObject { private Boolean jmxEnable; @FieldDescribe("H2数据库缓存大小,设置H2用于作为缓存的内存大小,以M作为单位,这里默认为512M.") private Integer cacheSize; - @FieldDescribe("默认日志级别,FATAL, ERROR, WARN, INFO, TRACE. 完成的配置为DefaultLevel=WARN, Tool=TRACE, Enhance=TRACE, METADATA=TRACE, Runtime=TRACE, Query=TRACE, DataCache=TRACE, JDBC=TRACE, SQL=TRACE") + @FieldDescribe("默认日志级别,FATAL, ERROR, WARN, INFO, TRACE. 完整的配置为DefaultLevel=WARN, Tool=TRACE, Enhance=TRACE, METADATA=TRACE, Runtime=TRACE, Query=TRACE, DataCache=TRACE, JDBC=TRACE, SQL=TRACE") private String logLevel; @FieldDescribe("最大使用连接数") private Integer maxTotal; diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Dingding.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Dingding.java index 6c755210fd598b5620f390e9aacb5b16d64d82ee..7184c5b164fdb941d059f9f29b4df9ec543e4efb 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Dingding.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Dingding.java @@ -31,7 +31,7 @@ public class Dingding extends ConfigObject { @FieldDescribe("应用的密钥") private String appSecret; - @FieldDescribe("组织同步cron,默认每10分钟同步一次.") + @FieldDescribe("回调信号触发同步检查,默认每10分钟运行一次,如果期间内有钉钉回调信号接收到,那么触发同步任务进行人员同步.") private String syncCron; @FieldDescribe("强制拉入同步cron,默认在每天的8点和12点强制进行同步.") diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSource.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSource.java index dfe42d92f8f9a10f35031e1960a784c21973ce7a..cf4e896f787dfa6bc9f21f690c53456d7fef3741 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSource.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSource.java @@ -30,6 +30,9 @@ public class ExternalDataSource extends ConfigObject { this.statEnable = DEFAULT_STATENABLE; this.statFilter = DEFAULT_STATFILTER; this.slowSqlMillis = DEFAULT_SLOWSQLMILLIS; + this.transactionIsolation = DEFAULT_TRANSACTIONISOLATION; + this.testConnectionOnCheckin = DEFAULT_TESTCONNECTIONONCHECKIN; + this.testConnectionOnCheckout = DEFAULT_TESTCONNECTIONONCHECKOUT; } public static ExternalDataSource defaultInstance() { @@ -58,13 +61,20 @@ public class ExternalDataSource extends ConfigObject { private String statFilter; @FieldDescribe("执行缓慢sql毫秒数,默认2000毫秒,执行缓慢的sql将被单独记录.") private Integer slowSqlMillis; - @FieldDescribe("设置此数据库存储的类,默认情况下存储所有类型,如果需要对每个类进行单独的控制以达到高性能,可以将不同的类存储到不同的节点上提高性能.可以使用通配符*") private List includes; @FieldDescribe("在此节点上不存储的类,和includes一起设置实际存储的类,可以使用通配符*") private List excludes; @FieldDescribe("默认日志级别,FATAL, ERROR, WARN, INFO, TRACE. 完成的配置为DefaultLevel=WARN, Tool=TRACE, Enhance=TRACE, METADATA=TRACE, Runtime=TRACE, Query=TRACE, DataCache=TRACE, JDBC=TRACE, SQL=TRACE") private String logLevel = DEFAULT_LOGLEVEL; + @FieldDescribe("事务隔离级别:default,none,read-committed,read-uncommitted,repeatable-read,serializable.默认使用default(数据库设置的事务级别).") + private String transactionIsolation; + @FieldDescribe("测试入池连接,默认false.") + private Boolean testConnectionOnCheckin; + @FieldDescribe("测试出池连接,默认false.") + private Boolean testConnectionOnCheckout; + @FieldDescribe("空闲阈值,默认300秒.") + private Integer maxIdleTime; public static final Integer DEFAULT_MAXTOTAL = 50; @@ -78,6 +88,31 @@ public class ExternalDataSource extends ConfigObject { public static final String DEFAULT_LOGLEVEL = "WARN"; + public static final String DEFAULT_TRANSACTIONISOLATION = "default"; + + public static final Boolean DEFAULT_TESTCONNECTIONONCHECKIN = false; + + public static final Boolean DEFAULT_TESTCONNECTIONONCHECKOUT = false; + + public static final Integer DEFAULT_MAXIDLETIME = 300; + + public Integer getMaxIdleTime() { + return maxIdleTime == null ? DEFAULT_MAXIDLETIME : this.maxIdleTime; + } + + public Boolean getTestConnectionOnCheckin() { + return this.testConnectionOnCheckin == null ? DEFAULT_TESTCONNECTIONONCHECKIN : this.testConnectionOnCheckin; + } + + public Boolean getTestConnectionOnCheckout() { + return this.testConnectionOnCheckout == null ? DEFAULT_TESTCONNECTIONONCHECKOUT : this.testConnectionOnCheckout; + } + + public String getTransactionIsolation() { + return StringUtils.isEmpty(this.transactionIsolation) ? DEFAULT_TRANSACTIONISOLATION + : this.transactionIsolation; + } + public String getLogLevel() { return StringUtils.isEmpty(this.logLevel) ? DEFAULT_LOGLEVEL : this.logLevel; } diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSources.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSources.java index d08814d5e8bf3307d19bb6064e92b282375a689d..9059313342c5fe9b46159be46013e3e6a2e25b75 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSources.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSources.java @@ -117,4 +117,32 @@ public class ExternalDataSources extends CopyOnWriteArrayList result = new ActionResult<>(); result.setData(woCallback.getObject()); diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoFile.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoFile.java index 8310acddfd34faaa41e30b86ab3392801a17f836..55b5693a1f7f6ae529101af820b4b173f9459c74 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoFile.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoFile.java @@ -1,9 +1,8 @@ package com.x.base.core.project.jaxrs; import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.gson.GsonPropertyObject; -public abstract class WoFile extends GsonPropertyObject { +public abstract class WoFile extends WoMaxAgeFastETag { private static final long serialVersionUID = -4566232046358204025L; @FieldDescribe("说明") diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoMaxAgeFastETag.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoMaxAgeFastETag.java new file mode 100644 index 0000000000000000000000000000000000000000..92781ce11141b905ce803d0c55451c49ddd4d35d --- /dev/null +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoMaxAgeFastETag.java @@ -0,0 +1,28 @@ +package com.x.base.core.project.jaxrs; + +import com.x.base.core.project.gson.GsonPropertyObject; + +public class WoMaxAgeFastETag extends GsonPropertyObject { + + private static final long serialVersionUID = -8408799363043605326L; + + private String fastETag; + + private Integer maxAge = null; + + public String getFastETag() { + return fastETag; + } + + public void setFastETag(String fastETag) { + this.fastETag = fastETag; + } + + public Integer getMaxAge() { + return maxAge; + } + + public void setMaxAge(Integer maxAge) { + this.maxAge = maxAge; + } +} diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoText.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoText.java index 52520bf0481eec70759ae74d377ee19c8f665c0d..1b944716ea285e655c1b249ae52964f46cd22593 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoText.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WoText.java @@ -1,9 +1,11 @@ package com.x.base.core.project.jaxrs; +import org.apache.commons.lang3.StringUtils; + import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.gson.GsonPropertyObject; +import com.x.base.core.project.http.HttpMediaType; -public class WoText extends GsonPropertyObject { +public class WoText extends WoMaxAgeFastETag { public WoText() { } @@ -15,6 +17,17 @@ public class WoText extends GsonPropertyObject { @FieldDescribe("text") private String text; + @FieldDescribe("返回Content_Type") + private String contentType; + + public String getContentType() { + return StringUtils.isEmpty(this.contentType) ? HttpMediaType.TEXT_PLAIN_UTF_8 : this.contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + public String getText() { return text; } diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/logger/Logger.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/logger/Logger.java index cba1d16a7f8769271a920e2d3fbce5775ce5b799..3453ff93c32ca76330c2dc862d30a1dd836f22b9 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/logger/Logger.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/logger/Logger.java @@ -198,7 +198,8 @@ public class Logger { sb.append(e.getMessage()); String headString = this.headToString(request); String bodyString = this.bodyToString(body); - String requestUrl = request.getRequestURL().toString(); + String requestUrl = request.getRequestURL().toString() + + (StringUtils.isEmpty(request.getQueryString()) ? "" : "?" + request.getQueryString()); String stackTraceString = ExceptionUtils.getStackTrace(e); Object[] arr = new String[] { effectivePerson.getDistinguishedName(), request.getMethod(), requestUrl, request.getRemoteHost(), request.getRemoteAddr(), headString, bodyString }; diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/script/ScriptFactory.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/script/ScriptFactory.java index 02ee820c13eca0e4257bc1fa65054d2915b96568..ca66cccba8041644daf48444d7b089bcb2d509d5 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/script/ScriptFactory.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/script/ScriptFactory.java @@ -3,30 +3,26 @@ package com.x.base.core.project.script; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Objects; -import java.util.regex.Matcher; import javax.script.Compilable; import javax.script.CompiledScript; -import javax.script.ScriptContext; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; -import javax.script.ScriptException; -import javax.script.SimpleScriptContext; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.text.StringEscapeUtils; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.x.base.core.entity.JpaObject; import com.x.base.core.project.config.Config; -import com.x.base.core.project.tools.StringTools; +import com.x.base.core.project.tools.PropertyTools; import jdk.nashorn.api.scripting.ScriptObjectMirror; +import jdk.nashorn.internal.runtime.ScriptObject; public class ScriptFactory { @@ -242,10 +238,7 @@ public class ScriptFactory { if (obj instanceof CharSequence) { list.add(Objects.toString(obj, "")); } else { - Object d = PropertyUtils.getProperty(obj, JpaObject.DISTINGUISHEDNAME); - if (null != d) { - list.add(Objects.toString(d, "")); - } + list.add(PropertyTools.getOrElse(obj, JpaObject.DISTINGUISHEDNAME, String.class, "")); } } } @@ -258,19 +251,23 @@ public class ScriptFactory { if (obj instanceof CharSequence) { list.add(Objects.toString(obj, "")); } else { - Object d = PropertyUtils.getProperty(obj, JpaObject.DISTINGUISHEDNAME); - if (null != d) { - list.add(Objects.toString(d, "")); + if (obj instanceof ScriptObject) { + ScriptObject so = (ScriptObject) obj; + if (so.containsKey(JpaObject.DISTINGUISHEDNAME)) { + list.add(Objects.toString(so.get(JpaObject.DISTINGUISHEDNAME), "")); + } + } else { + list.add(PropertyTools.getOrElse(obj, JpaObject.DISTINGUISHEDNAME, String.class, + "")); } } } } } else { - Object d = PropertyUtils.getProperty(o, JpaObject.DISTINGUISHEDNAME); - if (null != d) { - list.add(Objects.toString(d, "")); - } + list.add(PropertyTools.getOrElse(o, JpaObject.DISTINGUISHEDNAME, String.class, "")); } + } else { + list.add(Objects.toString(o, "")); } } return list; diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/EscapeStringTools.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/EscapeStringTools.java new file mode 100644 index 0000000000000000000000000000000000000000..1b6ad41c860c2630d3765b376d7f5f41a3cf0d86 --- /dev/null +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/EscapeStringTools.java @@ -0,0 +1,198 @@ +package com.x.base.core.project.tools; + +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLDecoder; +import java.nio.charset.Charset; +import java.util.regex.Pattern; + +public class EscapeStringTools { + public static final Charset utf8Charset = Charset.forName("UTF-8"); + + protected static final String _allowableInUrl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$&'()*+,-./:;=?@_~"; + + protected static final String _allowableInUrlQuery = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&'()*+,-./:;=?@_~"; + + private static final char _URIEscape = '%'; + + static final byte blank = 32; + + static final byte plus = 43; + + static final byte hexa = 97; + + static final byte hexf = 102; + + static final byte hexA = 65; + + static final byte hexF = 70; + + static final byte hex0 = 48; + + static final byte hex9 = 57; + + static final byte ten = 10; + + private static String xescapeString(String in, String allowable, char esc, boolean spaceplus) { + try { + StringBuffer out = new StringBuffer(); + if (in == null) + return null; + byte[] utf8 = in.getBytes(utf8Charset); + byte[] allow8 = allowable.getBytes(utf8Charset); + for (byte b : utf8) { + if (b == 32 && spaceplus) { + out.append('+'); + } else { + boolean found = false; + for (byte a : allow8) { + if (a == b) { + found = true; + break; + } + } + if (found) { + out.append((char)b); + } else { + String c = Integer.toHexString(b); + out.append(esc); + if (c.length() < 2) + out.append('0'); + out.append(c); + } + } + } + return out.toString(); + } catch (Exception e) { + return in; + } + } + + private static String escapeString(String in, String allowable) { + return xescapeString(in, allowable, '%', false); + } + + private static String xunescapeString(String in, char escape, boolean spaceplus) { + try { + if (in == null) + return null; + byte[] utf8 = in.getBytes(utf8Charset); + byte escape8 = (byte)escape; + byte[] out = new byte[utf8.length]; + int index8 = 0; + for (int i = 0; i < utf8.length; ) { + byte b = utf8[i++]; + if (b == 43 && spaceplus) { + out[index8++] = 32; + } else if (b == escape8) { + if (i + 2 <= utf8.length) { + b = (byte)(fromHex(utf8[i]) << 4 | fromHex(utf8[i + 1])); + i += 2; + } + } + out[index8++] = b; + } + return new String(out, 0, index8, utf8Charset); + } catch (Exception e) { + return in; + } + } + + private static String unescapeString(String in) { + return xunescapeString(in, '%', false); + } + + private static byte fromHex(byte b) throws NumberFormatException { + if (b >= 48 && b <= 57) + return (byte)(b - 48); + if (b >= 97 && b <= 102) + return (byte)(10 + b - 97); + if (b >= 65 && b <= 70) + return (byte)(10 + b - 65); + throw new NumberFormatException("Illegal hex character: " + b); + } + + private static final Pattern p = Pattern.compile("([\\w]+)://([.\\w]+(:[\\d]+)?)([/][^?#])?([?][^#]*)?([#].*)?"); + + public static String escapeURL(String surl) { + String protocol = null; + String authority = null; + String path = null; + String query = null; + String fragment = null; + URL u = null; + try { + u = new URL(surl); + } catch (MalformedURLException e) { + return null; + } + protocol = u.getProtocol(); + authority = u.getAuthority(); + path = u.getPath(); + query = u.getQuery(); + fragment = u.getRef(); + StringBuilder url = new StringBuilder(); + url.append(protocol); + url.append("://"); + url.append(authority); + if (path != null && path.length() > 0) { + String[] pieces = path.split("[/]", -1); + for (int i = 0; i < pieces.length; i++) { + String p = pieces[i]; + if (p == null) + p = ""; + if (i > 0) + url.append("/"); + url.append(urlEncode(p)); + } + } + if (query != null && query.length() > 0) { + url.append("?"); + url.append(escapeURLQuery(query)); + } + if (fragment != null && fragment.length() > 0) { + url.append("#"); + url.append(urlEncode(fragment)); + } + return url.toString(); + } + + static int nextpiece(String s, int index, String sep) { + index = s.indexOf(sep, index); + if (index < 0) + index = s.length(); + return index; + } + + public static String escapeURLQuery(String ce) { + try { + ce = escapeString(ce, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&'()*+,-./:;=?@_~"); + } catch (Exception e) { + ce = null; + } + return ce; + } + + public static String unescapeURLQuery(String ce) { + try { + ce = unescapeString(ce); + } catch (Exception e) { + ce = null; + } + return ce; + } + + public static String urlEncode(String s) { + s = escapeString(s, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$&'()*+,-./:;=?@_~"); + return s; + } + + public static String urlDecode(String s) { + try { + s = URLDecoder.decode(s, "UTF-8"); + } catch (Exception e) { + s = null; + } + return s; + } +} diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/PropertyTools.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/PropertyTools.java index 1cc16e9384b5f0616043db6e20f62d1ce3730008..b1acab557970a011c4de125ad65ea0ee88cbdb24 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/PropertyTools.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/PropertyTools.java @@ -1,16 +1,35 @@ package com.x.base.core.project.tools; +import java.lang.reflect.Field; + import org.apache.commons.beanutils.PropertyUtils; +import org.apache.commons.lang3.reflect.FieldUtils; public class PropertyTools { @SuppressWarnings("unchecked") public static T getOrElse(Object bean, String name, Class cls, T defaultObject) throws Exception { - if ((null != bean) && PropertyUtils.isReadable(bean, name)) { - Object o = PropertyUtils.getProperty(bean, name); - if (null != o) { - return (T) o; + if (null != bean) { + try { + // 如果使用PropertyUtils.isReadable那么Nested就会失效,无法获取map类型中的值. + // Object o = PropertyUtils.getNestedProperty(bean, name); + Object o = PropertyUtils.getProperty(bean, name); + if (null != o) { + return (T) o; + } + } catch (NoSuchMethodException e) { + // java.lang.NoSuchMethodException: Unknown property 'abc' on class 'class + // java.lang.Object' + // nothing pass + } + Field field = FieldUtils.getField(bean.getClass(), name, true); + if (null != field) { + Object o = FieldUtils.readField(field, bean, true); + if (null != o) { + return (T) o; + } } } return defaultObject; } -} + +} \ No newline at end of file diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/StringTools.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/StringTools.java index 269404ce5e2e1a7a137a00e1aff5161475a86617..c1ff3da8d4464600df6de3bf838918d90ab298c4 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/StringTools.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/StringTools.java @@ -1,5 +1,7 @@ package com.x.base.core.project.tools; +import static java.util.Locale.ENGLISH; + import java.io.ByteArrayInputStream; import java.io.InputStreamReader; import java.lang.reflect.Field; @@ -29,6 +31,8 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.reflect.FieldUtils; import org.slf4j.helpers.MessageFormatter; +import com.alibaba.druid.sql.visitor.functions.Char; + public class StringTools { // 脚本文本 @@ -365,28 +369,6 @@ public class StringTools { public static boolean matchWildcard(String str, String pattern) { return Objects.toString(str, "").matches(Objects.toString(pattern, "").replace("?", ".?").replace("*", ".*?")); - // if (StringUtils.isNotEmpty(str) && StringUtils.isNotEmpty(pattern) && - // StringUtils.contains(pattern, "*")) { - // if (StringUtils.equals(pattern, "*")) { - // return true; - // } - // if (StringUtils.startsWith(pattern, "*")) { - // return StringUtils.endsWith(str, StringUtils.substringAfter(pattern, "*")); - // } - // if (StringUtils.endsWith(pattern, "*")) { - // return StringUtils.startsWith(str, StringUtils.substringBeforeLast(pattern, - // "*")); - // } - // String[] parts = StringUtils.split(pattern, "*", 2); - // if (StringUtils.startsWith(str, parts[0]) && StringUtils.endsWith(str, - // parts[1])) { - // return true; - // } else { - // return false; - // } - // } else { - // return StringUtils.equals(str, pattern); - // } } public static List includesExcludesWithWildcard(List list, Collection includes, @@ -544,4 +526,26 @@ public class StringTools { return result.toArray(new String[result.size()]); } + public static String getMethodName(String name) { + return methodName("get", name); + } + + public static String setMethodName(String name) { + return methodName("set", name); + } + + private static String methodName(String getOrSet, String name) { + if (StringUtils.isEmpty(name) || StringUtils.isEmpty(getOrSet)) { + return name; + } + StringBuilder sb = new StringBuilder(); + sb.append(getOrSet); + if ((name.length() > 1) && (StringUtils.isAllLowerCase(name.substring(0, 1)) + && StringUtils.isAllUpperCase(name.substring(1, 2)))) { + sb.append(name); + } else { + sb.append(StringUtils.capitalize(name)); + } + return sb.toString(); + } } \ No newline at end of file diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/utils/time/WorkTime.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/utils/time/WorkTime.java index 173a536df8a6b9e6905e449628a918717ebf3ff6..b0cec4fa89e97aa3c878f76cdc5d694375dc5631 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/utils/time/WorkTime.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/utils/time/WorkTime.java @@ -85,4 +85,12 @@ public class WorkTime extends BaseWorkTime { return false; } + public boolean isWorkDay(Date d) { + return !this.isHoliday(DateUtils.toCalendar(d)); + } + + public boolean isWorkDay(Calendar c) { + return !this.isHoliday(c); + } + } diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_organization_assemble_control.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_organization_assemble_control.java index 236f8b7faeb48af32a245af94f22bc520aa92fbd..7bd6d44e940e7e71ce5961bd515bccf10006b659 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_organization_assemble_control.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_organization_assemble_control.java @@ -1,5 +1,6 @@ package com.x.base.core.project; +import com.x.base.core.entity.StorageType; import com.x.base.core.project.annotation.Module; import com.x.base.core.project.annotation.ModuleCategory; import com.x.base.core.project.annotation.ModuleType; @@ -10,6 +11,6 @@ import com.x.base.core.project.annotation.ModuleType; "com.x.organization.core.entity.Identity", "com.x.organization.core.entity.PersonAttribute", "com.x.organization.core.entity.Unit", "com.x.organization.core.entity.UnitAttribute", "com.x.organization.core.entity.PersonCard","com.x.organization.core.entity.PermissionSetting", - "com.x.organization.core.entity.UnitDuty" }, storeJars = { "x_organization_core_entity" }) + "com.x.organization.core.entity.UnitDuty", "com.x.general.core.entity.file.GeneralFile" },storageTypes = { StorageType.general}, storeJars = { "x_organization_core_entity" ,"x_general_core_entity"}) public class x_organization_assemble_control extends Deployable { } diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_portal_assemble_designer.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_portal_assemble_designer.java index 0368978539ae1a490a361ea4e58ee07d9c8cd148..8b3737d511ebccc7503b4b5ef4bab2ecae74e743 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_portal_assemble_designer.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_portal_assemble_designer.java @@ -7,7 +7,8 @@ import com.x.base.core.project.annotation.ModuleType; @Module(type = ModuleType.ASSEMBLE, category = ModuleCategory.OFFICIAL, name = "门户设计", packageName = "com.x.portal.assemble.designer", containerEntities = { "com.x.portal.core.entity.Portal", "com.x.portal.core.entity.Widget", "com.x.portal.core.entity.Page", "com.x.portal.core.entity.Script", "com.x.portal.core.entity.File", - "com.x.portal.core.entity.TemplatePage" }, storeJars = { "x_organization_core_entity", - "x_organization_core_express", "x_portal_core_entity" }) + "com.x.portal.core.entity.TemplatePage", "com.x.cms.core.entity.element.Script", + "com.x.processplatform.core.entity.element.Script" }, storeJars = { "x_organization_core_entity", + "x_organization_core_express", "x_portal_core_entity", "x_cms_core_entity", "x_processplatform_core_entity" }) public class x_portal_assemble_designer extends Deployable { } diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_portal_assemble_surface.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_portal_assemble_surface.java index a02590710e08a087d28d871edbb8fb465c98857b..5b312f5123389c151cac0f7442a1450523f512bc 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_portal_assemble_surface.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_portal_assemble_surface.java @@ -6,7 +6,9 @@ import com.x.base.core.project.annotation.ModuleType; @Module(type = ModuleType.ASSEMBLE, category = ModuleCategory.OFFICIAL, name = "门户", packageName = "com.x.portal.assemble.surface", containerEntities = { "com.x.portal.core.entity.Portal", "com.x.portal.core.entity.Widget", "com.x.portal.core.entity.Page", - "com.x.portal.core.entity.Script", "com.x.portal.core.entity.File" }, storeJars = { - "x_organization_core_entity", "x_organization_core_express", "x_portal_core_entity" }) + "com.x.portal.core.entity.Script", "com.x.portal.core.entity.File", "com.x.cms.core.entity.element.Script", + "com.x.processplatform.core.entity.element.Script" }, storeJars = { + "x_organization_core_entity", "x_organization_core_express", "x_portal_core_entity", "x_cms_core_entity", + "x_processplatform_core_entity" }) public class x_portal_assemble_surface extends Deployable { } \ No newline at end of file diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_processplatform_service_processing.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_processplatform_service_processing.java index 26b23861657506546f25cf8a19a3c6363959d5ac..105c8de3c79560df8637556d3fc5e429c4cceb63 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_processplatform_service_processing.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_processplatform_service_processing.java @@ -29,9 +29,11 @@ import com.x.base.core.project.annotation.ModuleType; "com.x.processplatform.core.entity.element.Form", "com.x.processplatform.core.entity.element.FormField", "com.x.processplatform.core.entity.element.Embed", "com.x.processplatform.core.entity.element.Mapping", "com.x.processplatform.core.entity.log.SignalStackLog", "com.x.query.core.entity.Item", + "com.x.cms.core.entity.element.Script", "com.x.portal.core.entity.Script", "com.x.query.dynamic.entity.*" }, storageTypes = { StorageType.processPlatform }, storeJars = { "x_organization_core_entity", "x_organization_core_express", "x_processplatform_core_entity", - "x_processplatform_core_express", "x_query_core_entity" }, dynamicJars = { "x_query_dynamic_entity" }) + "x_processplatform_core_express", "x_query_core_entity", "x_cms_core_entity", + "x_portal_core_entity" }, dynamicJars = { "x_query_dynamic_entity" }) public class x_processplatform_service_processing extends Deployable { } diff --git a/o2server/x_bbs_assemble_control/pom.xml b/o2server/x_bbs_assemble_control/pom.xml index bf702d6ee90e2778329f350628232e80e05131fe..3fc49942570e67a63d7c517326145f5e04714f69 100644 --- a/o2server/x_bbs_assemble_control/pom.xml +++ b/o2server/x_bbs_assemble_control/pom.xml @@ -124,6 +124,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_calendar_assemble_control/pom.xml b/o2server/x_calendar_assemble_control/pom.xml index a2b2e353e29a68d2894c821db8286c8b6a398ee8..c2e476aaf8385e0cc457a46a91f9d0d584a59fa5 100644 --- a/o2server/x_calendar_assemble_control/pom.xml +++ b/o2server/x_calendar_assemble_control/pom.xml @@ -124,6 +124,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_cms_assemble_control/pom.xml b/o2server/x_cms_assemble_control/pom.xml index 24830d30c7fbe180ec5b951dfddc0da52a5d84b9..ef9727298fe47bb318f6ba55929492c28a8ee10e 100644 --- a/o2server/x_cms_assemble_control/pom.xml +++ b/o2server/x_cms_assemble_control/pom.xml @@ -144,6 +144,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/ActionApplication.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/ActionApplication.java index 753778ead20042cc9a43b9eed22b75deabdc0647..21886ae33aeae6911b874a8beb2be2ed631fcaab 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/ActionApplication.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/ActionApplication.java @@ -9,6 +9,7 @@ import com.x.cms.assemble.control.jaxrs.appinfo.AppInfoAnonymousAction; import com.x.cms.assemble.control.jaxrs.appinfo.AppInfoConfigAction; import com.x.cms.assemble.control.jaxrs.categoryinfo.CategoryInfoAction; import com.x.cms.assemble.control.jaxrs.categoryinfo.CategoryInfoAnonymousAction; +import com.x.cms.assemble.control.jaxrs.commend.DocumentCommendAction; import com.x.cms.assemble.control.jaxrs.comment.DocumentCommentInfoAction; import com.x.cms.assemble.control.jaxrs.data.DataAction; import com.x.cms.assemble.control.jaxrs.document.DocumentAction; @@ -85,6 +86,7 @@ public class ActionApplication extends AbstractActionApplication { this.classes.add(FormAnonymousAction.class); this.classes.add(ScriptAnonymousAction.class); this.classes.add(DocumentCommentInfoAction.class); + this.classes.add(DocumentCommendAction.class); return this.classes; } diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/CmsJaxrsFilter.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/CmsJaxrsFilter.java index bbc9c0f9925c20e7b01fcc91b18c930038271cd3..b97d1fcea56f702501fd5ab3ad47cc1373fa56fa 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/CmsJaxrsFilter.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/CmsJaxrsFilter.java @@ -1,6 +1,6 @@ package com.x.cms.assemble.control.jaxrs; -import com.x.base.core.project.jaxrs.ManagerUserJaxrsFilter; +import com.x.base.core.project.jaxrs.CipherManagerUserJaxrsFilter; import javax.servlet.annotation.WebFilter; @@ -37,8 +37,9 @@ import javax.servlet.annotation.WebFilter; "/jaxrs/permission/*", "/jaxrs/docpermission/*", "/jaxrs/comment/*", + "/jaxrs/commend/*", "/servlet/*" }, asyncSupported = true) -public class CmsJaxrsFilter extends ManagerUserJaxrsFilter { +public class CmsJaxrsFilter extends CipherManagerUserJaxrsFilter { } \ No newline at end of file diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionCreate.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionCreate.java index 40892537f975cf7f6c1507d96cc221481d774452..da23a8a51511a3424ebd158f77deb195ed295d0a 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionCreate.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionCreate.java @@ -13,6 +13,7 @@ import com.x.base.core.entity.dataitem.ItemCategory; import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -47,7 +48,7 @@ class ActionCreate extends BaseAction { emc.persist(o, CheckPersistType.all); } emc.commit(); - ApplicationCache.notify(AppDict.class); + CacheManager.notify(AppDict.class); Wo wo = new Wo(); wo.setId(appInfoDict.getId()); result.setData(wo); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionDelete.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionDelete.java index 38aeb22ea8c1e7b5bd6018f8399eab72098d4c04..c69650179092948ab8df09f6397be51ef82fa6ad 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionDelete.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionDelete.java @@ -6,6 +6,7 @@ import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.annotation.CheckRemoveType; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -37,7 +38,7 @@ class ActionDelete extends BaseAction { emc.beginTransaction(AppDict.class); emc.remove(dict, CheckRemoveType.all); emc.commit(); - ApplicationCache.notify(AppDict.class); + CacheManager.notify(AppDict.class); Wo wo = new Wo(); wo.setId(dict.getId()); result.setData(wo); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionEdit.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionEdit.java index d55a2cb15edca007624e17f847ca1e745688929c..ba187a15143a9c33c64ae64d60e7653f65692af1 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionEdit.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appdictdesign/ActionEdit.java @@ -13,6 +13,7 @@ import com.x.base.core.entity.dataitem.ItemCategory; import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -63,7 +64,7 @@ class ActionEdit extends BaseAction { emc.persist(o, CheckPersistType.all); } emc.commit(); - ApplicationCache.notify(AppDict.class); + CacheManager.notify(AppDict.class); Wo wo = new Wo(); wo.setId(dict.getId()); result.setData(wo); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoAction.java index b80348ff8d4eb53757cbb9f89eb179bc259693b6..bdac6a3140426a1c7f5843fcaa35dd78905b4438 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoAction.java @@ -9,10 +9,8 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; @@ -28,7 +26,6 @@ import java.util.List; @JaxrsDescribe("信息发布(CMS)-栏目(APPINFO)管理服务") public class AppInfoAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger(AppInfoAction.class); @JaxrsMethodDescribe(value = "创建新的栏目信息或者更新已存在的栏目信息。", action = ActionSave.class) @@ -41,7 +38,7 @@ public class AppInfoAction extends StandardJaxrsAction { Boolean check = true; if (check) { try { - result = ((ActionSave)proxy.getProxy(ActionSave.class)).execute( request, effectivePerson, jsonElement ); + result = new ActionSave().execute( request, effectivePerson, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "栏目信息保存时发生异常。"); @@ -62,7 +59,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionDelete)proxy.getProxy(ActionDelete.class)).execute(request, effectivePerson, id); + result = new ActionDelete().execute(request, effectivePerson, id); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "根据ID删除CMS应用信息对象发生未知异常,ID:" + id); @@ -84,7 +81,7 @@ public class AppInfoAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionQueryGetControl)proxy.getProxy(ActionQueryGetControl.class)).execute( request, id, effectivePerson ); + result = new ActionQueryGetControl().execute( request, id, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); result.error( e ); @@ -104,7 +101,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionEraseDocumentWithAppInfo)proxy.getProxy(ActionEraseDocumentWithAppInfo.class)).execute(request, id, effectivePerson ); + result = new ActionEraseDocumentWithAppInfo().execute(request, id, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "根据栏目ID删除所有的信息文档发生未知异常,ID:" + id); @@ -124,7 +121,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionGet)proxy.getProxy(ActionGet.class)).execute( request, effectivePerson, flag ); + result = new ActionGet().execute( request, effectivePerson, flag ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "根据指定ID查询应用栏目信息对象时发生异常。flag:" + flag ); @@ -143,7 +140,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionGetByAlias)proxy.getProxy(ActionGetByAlias.class)).execute(request, effectivePerson, alias); + result = new ActionGetByAlias().execute(request, effectivePerson, alias); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "根据指定应用唯一标识查询应用栏目信息对象时发生异常。ALIAS:" + alias); @@ -163,7 +160,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanViewArticle_WithAppType)proxy.getProxy(ActionListWhatICanViewArticle_WithAppType.class)).execute(request, effectivePerson, appType ); + result = new ActionListWhatICanViewArticle_WithAppType().execute(request, effectivePerson, appType ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -183,7 +180,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanViewArticle)proxy.getProxy(ActionListWhatICanViewArticle.class)).execute(request, effectivePerson); + result = new ActionListWhatICanViewArticle().execute(request, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -203,7 +200,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanViewData)proxy.getProxy(ActionListWhatICanViewData.class)).execute(request, effectivePerson); + result = new ActionListWhatICanViewData().execute(request, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -224,7 +221,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanViewData_WithAppType)proxy.getProxy(ActionListWhatICanViewData_WithAppType.class)).execute(request, effectivePerson, appType ); + result = new ActionListWhatICanViewData_WithAppType().execute(request, effectivePerson, appType ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -245,7 +242,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanViewAllDocType_WithAppType)proxy.getProxy(ActionListWhatICanViewAllDocType_WithAppType.class)).execute( request, effectivePerson, appType ); + result = new ActionListWhatICanViewAllDocType_WithAppType().execute( request, effectivePerson, appType ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -265,7 +262,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanViewAllDocType)proxy.getProxy(ActionListWhatICanViewAllDocType.class)).execute(request, effectivePerson); + result = new ActionListWhatICanViewAllDocType().execute(request, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -285,7 +282,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanPublish)proxy.getProxy(ActionListWhatICanPublish.class)).execute(request, effectivePerson); + result = new ActionListWhatICanPublish().execute(request, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -306,8 +303,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanPublish_WithAppType)proxy.getProxy(ActionListWhatICanPublish_WithAppType.class)) - .execute(request, effectivePerson, appType ); + result = new ActionListWhatICanPublish_WithAppType().execute(request, effectivePerson, appType ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -328,7 +324,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionGetPublishableAppInfo)proxy.getProxy(ActionGetPublishableAppInfo.class)).execute(request, effectivePerson, appId ); + result = new ActionGetPublishableAppInfo().execute(request, effectivePerson, appId ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -348,7 +344,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListAllAppType)proxy.getProxy(ActionListAllAppType.class)).execute(request, effectivePerson); + result = new ActionListAllAppType().execute(request, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -368,7 +364,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListAllManageableAppType)proxy.getProxy(ActionListAllManageableAppType.class)).execute(request, effectivePerson); + result = new ActionListAllManageableAppType().execute(request, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -388,8 +384,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanManage)proxy.getProxy(ActionListWhatICanManage.class)) - .execute(request, effectivePerson); + result = new ActionListWhatICanManage().execute(request, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -410,8 +405,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanManage_WithAppType)proxy.getProxy(ActionListWhatICanManage_WithAppType.class)) - .execute(request, effectivePerson, appType); + result = new ActionListWhatICanManage_WithAppType().execute(request, effectivePerson, appType); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, @@ -431,7 +425,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListAll)proxy.getProxy(ActionListAll.class)).execute(request, effectivePerson); + result = new ActionListAll().execute(request, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "查询所有应用栏目信息对象时发生异常"); @@ -453,7 +447,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListNextWithFilter)proxy.getProxy(ActionListNextWithFilter.class)).execute(request, effectivePerson, id, count, jsonElement ); + result = new ActionListNextWithFilter().execute(request, effectivePerson, id, count, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "查询栏目信息对象时发生异常"); @@ -475,7 +469,7 @@ public class AppInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListPrevWithFilter)proxy.getProxy(ActionListPrevWithFilter.class)).execute(request, effectivePerson, id, count, jsonElement); + result = new ActionListPrevWithFilter().execute(request, effectivePerson, id, count, jsonElement); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "查询栏目信息对象时发生异常"); @@ -499,7 +493,7 @@ public class AppInfoAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionAppIconUpload)proxy.getProxy(ActionAppIconUpload.class)).execute(request, effectivePerson, appId, size, bytes, disposition ); + result = new ActionAppIconUpload().execute(request, effectivePerson, appId, size, bytes, disposition ); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoAnonymousAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoAnonymousAction.java index e32cf363f4502fcf63573224f1fac036f8340f31..74ea6862d4cd8747b347c7294989dd5a50bf2ab0 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoAnonymousAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoAnonymousAction.java @@ -9,10 +9,8 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -26,7 +24,6 @@ import java.util.List; @Path("anonymous/appinfo") public class AppInfoAnonymousAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger(AppInfoAnonymousAction.class); @JaxrsMethodDescribe(value = "根据标识获取信息栏目信息对象.", action = ActionGetAnonymous.class) @@ -38,7 +35,7 @@ public class AppInfoAnonymousAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionGetAnonymous)proxy.getProxy(ActionGetAnonymous.class)).execute( request, effectivePerson, flag ); + result = new ActionGetAnonymous().execute( request, effectivePerson, flag ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "根据指定ID查询应用栏目信息对象时发生异常。flag:" + flag ); @@ -60,8 +57,7 @@ public class AppInfoAnonymousAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListNextWithFilterAnonymous)proxy.getProxy(ActionListNextWithFilterAnonymous.class)) - .execute(request, effectivePerson, id, count, jsonElement ); + result = new ActionListNextWithFilterAnonymous().execute(request, effectivePerson, id, count, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "查询栏目信息对象时发生异常"); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoConfigAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoConfigAction.java index bad42f5d0d8dd1f8791433fc4d850d483ec78ac9..6caa9aae96702b029daba06d900665f363233fc9 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoConfigAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoConfigAction.java @@ -10,10 +10,8 @@ import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; import com.x.base.core.project.jaxrs.WoText; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -26,7 +24,6 @@ import javax.ws.rs.core.MediaType; @JaxrsDescribe("信息发布(CMS)-栏目配置支持信息(APPINFOCONFIG)管理服务") public class AppInfoConfigAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger(AppInfoConfigAction.class); @JaxrsMethodDescribe(value = "更新栏目配置支持信息,JSON格式。", action = ActionSaveConfig.class) @@ -42,7 +39,7 @@ public class AppInfoConfigAction extends StandardJaxrsAction { Boolean check = true; if (check) { try { - result = ((ActionSaveConfig)proxy.getProxy(ActionSaveConfig.class)).execute( request, effectivePerson, appId, jsonElement ); + result = new ActionSaveConfig().execute( request, effectivePerson, appId, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "栏目信息保存时发生异常。"); @@ -63,7 +60,7 @@ public class AppInfoConfigAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionGetConfig)proxy.getProxy(ActionGetConfig.class)).execute( request, effectivePerson, id ); + result = new ActionGetConfig().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "根据指定ID查询应用栏目配置支持信息时发生异常。id:" + id ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoExportAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoExportAction.java index bc37f7ed7e00b674b11d7ac1212c1bd965c4a20c..c7824f435d3fb308cc8bdff6535193c01b21247e 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoExportAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoExportAction.java @@ -8,10 +8,8 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -24,7 +22,6 @@ import javax.ws.rs.core.MediaType; @JaxrsDescribe("信息发布栏目导出服务") public class AppInfoExportAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger(AppInfoExportAction.class); @JaxrsMethodDescribe(value = "根据ID导出栏目信息对象所有设计.", action = ActionAppInfoExport.class) @@ -36,7 +33,7 @@ public class AppInfoExportAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionAppInfoExport)proxy.getProxy(ActionAppInfoExport.class)).execute( request, effectivePerson, id ); + result = new ActionAppInfoExport().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "根据指定ID导出栏目信息对象时发生异常。ID:" + id ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoImportAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoImportAction.java index cde15b00d35f022dfa1c609fa9f5259cdc857e13..0ba97034ec4e294ce0580fadc687d0502a768cd3 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoImportAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/AppInfoImportAction.java @@ -8,10 +8,8 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -24,7 +22,6 @@ import javax.ws.rs.core.MediaType; @JaxrsDescribe("信息发布栏目导入服务") public class AppInfoImportAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger(AppInfoImportAction.class); @JaxrsMethodDescribe(value = "根据别名获取信息栏目信息对象.", action = ActionGetByAlias.class) @@ -36,7 +33,7 @@ public class AppInfoImportAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionGetByAlias)proxy.getProxy(ActionGetByAlias.class)).execute(request, effectivePerson, id); + result = new ActionGetByAlias().execute(request, effectivePerson, id); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppInfoProcess(e, "根据指定应用唯一标识查询应用栏目信息对象时发生异常。ALIAS:" + id); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionDelete.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionDelete.java index 843758a88fb64cc5ffaa5577349d93f7866e8055..b120fec5bd0da1b957b38b6b74b53c4427a05fc7 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionDelete.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionDelete.java @@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.categoryinfo; import com.x.base.core.project.annotation.AuditLog; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -71,10 +72,10 @@ public class ActionDelete extends BaseAction { CmsBatchOperationProcessService.OPT_TYPE_DELETE, id, id, "删除分类:ID=" + id ); new LogService().log(null, effectivePerson.getDistinguishedName(), categoryInfo.getAppName() + "-" + categoryInfo.getCategoryName(), id, "", "", "", "CATEGORY", "删除"); - - ApplicationCache.notify( AppInfo.class ); - ApplicationCache.notify( CategoryInfo.class ); - ApplicationCache.notify( ViewCategory.class ); + + CacheManager.notify( AppInfo.class ); + CacheManager.notify( CategoryInfo.class ); + CacheManager.notify( ViewCategory.class ); } catch (Exception e) { Exception exception = new ExceptionCategoryInfoProcess(e, "分类信息在删除时发生异常。ID:" + id); result.error(exception); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionSave.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionSave.java index e6bf9a0d5052c9cae9c180a33c666309fbe09423..5e2167129f958438e264916dd937298861b852c6 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionSave.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionSave.java @@ -7,6 +7,7 @@ import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -190,11 +191,11 @@ public class ActionSave extends BaseAction { }else { new LogService().log(null, effectivePerson.getDistinguishedName(), categoryInfo.getAppName() + "-" + categoryInfo.getCategoryName(), categoryInfo.getId(), "", "", "", "CATEGORY", "新增"); } - - ApplicationCache.notify(AppInfo.class); - ApplicationCache.notify(CategoryInfo.class); - ApplicationCache.notify(ViewCategory.class); - ApplicationCache.notify(Document.class); + + CacheManager.notify(AppInfo.class); + CacheManager.notify(CategoryInfo.class); + CacheManager.notify(ViewCategory.class); + CacheManager.notify(Document.class); } catch (Exception e) { check = false; Exception exception = new ExceptionCategoryInfoProcess(e, "分类信息在保存时发生异常."); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/CategoryInfoAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/CategoryInfoAction.java index 8cd4f89fce2be3d5e2ba007eaad3df8975aa90d5..21ea911247c0f30660e2143dd22844a956436518 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/CategoryInfoAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/CategoryInfoAction.java @@ -9,10 +9,8 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -27,7 +25,6 @@ import java.util.List; @JaxrsDescribe("信息发布内容分类管理") public class CategoryInfoAction extends StandardJaxrsAction{ - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger( CategoryInfoAction.class ); @JaxrsMethodDescribe(value = "创建或者更新信息分类信息对象.", action = ActionSave.class) @@ -40,7 +37,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ Boolean check = true; if( check ){ try { - result = ((ActionSave)proxy.getProxy(ActionSave.class)).execute( request, effectivePerson, jsonElement ); + result = new ActionSave().execute( request, effectivePerson, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "分类信息在保存时发生异常." ); @@ -62,7 +59,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult result = null; try { - result = ((ActionSaveImportView)proxy.getProxy(ActionSaveImportView.class)).execute( request, effectivePerson, categoryId, jsonElement ); + result = new ActionSaveImportView().execute( request, effectivePerson, categoryId, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "为分类绑定导入数据的列表ID时发生异常。categoryId:"+ categoryId ); @@ -83,7 +80,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ Boolean check = true; if( check ){ try { - result = ((ActionSaveExtContent)proxy.getProxy(ActionSaveExtContent.class)).execute( request, effectivePerson, jsonElement ); + result = new ActionSaveExtContent().execute( request, effectivePerson, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "分类扩展信息在保存时发生异常." ); @@ -104,7 +101,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult result = new ActionResult<>(); try { - result = ((ActionDelete)proxy.getProxy(ActionDelete.class)).execute( request, id, effectivePerson ); + result = new ActionDelete().execute( request, id, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "分类信息在删除时发生异常。ID:" + id ); @@ -124,7 +121,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionEraseDocumentWithCategory)proxy.getProxy(ActionEraseDocumentWithCategory.class)).execute(request, id, effectivePerson ); + result = new ActionEraseDocumentWithCategory().execute(request, id, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess(e, "根据分类ID删除所有的信息文档发生未知异常,ID:" + id); @@ -144,7 +141,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanView_Article)proxy.getProxy(ActionListWhatICanView_Article.class)).execute( request, appId, effectivePerson ); + result = new ActionListWhatICanView_Article().execute( request, appId, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据指定应用栏目ID查询分类信息列表时发生异常。ID:" + appId ); @@ -164,7 +161,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanView_Data)proxy.getProxy(ActionListWhatICanView_Data.class)).execute( request, appId, effectivePerson ); + result = new ActionListWhatICanView_Data().execute( request, appId, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据指定应用栏目ID查询分类信息列表时发生异常。ID:" + appId ); @@ -184,7 +181,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanView_AllType)proxy.getProxy(ActionListWhatICanView_AllType.class)).execute( request, appId, effectivePerson ); + result = new ActionListWhatICanView_AllType().execute( request, appId, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据指定应用栏目ID查询分类信息列表时发生异常。ID:" + appId ); @@ -204,7 +201,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanPublish)proxy.getProxy(ActionListWhatICanPublish.class)).execute( request, appId, effectivePerson ); + result = new ActionListWhatICanPublish().execute( request, appId, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据应用栏目ID查询分类信息对象时发生异常。AppId:" + appId ); @@ -223,7 +220,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = null; try { - result = ((ActionListAll)proxy.getProxy(ActionListAll.class)).execute( request, effectivePerson ); + result = new ActionListAll().execute( request, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "查询所有分类信息对象时发生异常。" ); @@ -243,7 +240,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult result = null; try { - result = ((ActionGet)proxy.getProxy(ActionGet.class)).execute( request, flag, effectivePerson ); + result = new ActionGet().execute( request, flag, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据ID查询分类信息对象时发生异常。flag:" + flag ); @@ -265,7 +262,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ Boolean check = true; if( check ){ try { - result = ((ActionQueryGetControl)proxy.getProxy(ActionQueryGetControl.class)).execute( request, id, effectivePerson ); + result = new ActionQueryGetControl().execute( request, id, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); result.error( e ); @@ -285,7 +282,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult result = null; try { - result = ((ActionGetByAlias)proxy.getProxy(ActionGetByAlias.class)).execute( request, alias, effectivePerson ); + result = new ActionGetByAlias().execute( request, alias, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据标识查询分类信息对象时发生异常。ALIAS:"+ alias ); @@ -308,7 +305,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = null; try { - result = ((ActionListNextWithFilter)proxy.getProxy(ActionListNextWithFilter.class)).execute( request, effectivePerson, id, count, jsonElement); + result = new ActionListNextWithFilter().execute( request, effectivePerson, id, count, jsonElement); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "列示根据过滤条件的信息分类时发生异常。" ); @@ -331,7 +328,7 @@ public class CategoryInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = null; try { - result = ((ActionListPrevWithFilter)proxy.getProxy(ActionListPrevWithFilter.class)).execute( request, effectivePerson, id, count, jsonElement); + result = new ActionListPrevWithFilter().execute( request, effectivePerson, id, count, jsonElement); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "列示根据过滤条件的信息分类时发生异常。" ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/CategoryInfoAnonymousAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/CategoryInfoAnonymousAction.java index a8d8e46238b722647d3e109fd62248b1a68c2959..d22bbe49651b2fbfc77ed867a2b6332230df180d 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/CategoryInfoAnonymousAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/CategoryInfoAnonymousAction.java @@ -9,10 +9,8 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -27,7 +25,6 @@ import java.util.List; @JaxrsDescribe("可匿名访问的信息发布内容分类管理服务") public class CategoryInfoAnonymousAction extends StandardJaxrsAction{ - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger( CategoryInfoAnonymousAction.class ); @JaxrsMethodDescribe(value = "根据Flag获取分类信息对象.", action = ActionGetAnonymous.class) @@ -40,7 +37,7 @@ public class CategoryInfoAnonymousAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult result = null; try { - result = ((ActionGetAnonymous)proxy.getProxy(ActionGetAnonymous.class)).execute( request, flag, effectivePerson ); + result = new ActionGetAnonymous().execute( request, flag, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据ID查询分类信息对象时发生异常。flag:" + flag ); @@ -63,7 +60,7 @@ public class CategoryInfoAnonymousAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = null; try { - result = ((ActionListNextWithFilterAnonymous)proxy.getProxy(ActionListNextWithFilterAnonymous.class)).execute( request, effectivePerson, id, count, jsonElement); + result = new ActionListNextWithFilterAnonymous().execute( request, effectivePerson, id, count, jsonElement); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "列示根据过滤条件的信息分类时发生异常。" ); @@ -83,7 +80,7 @@ public class CategoryInfoAnonymousAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanView_Article)proxy.getProxy(ActionListWhatICanView_Article.class)).execute( request, appId, effectivePerson ); + result = new ActionListWhatICanView_Article().execute( request, appId, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据指定应用栏目ID查询分类信息列表时发生异常。ID:" + appId ); @@ -103,7 +100,7 @@ public class CategoryInfoAnonymousAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanView_Data)proxy.getProxy(ActionListWhatICanView_Data.class)).execute( request, appId, effectivePerson ); + result = new ActionListWhatICanView_Data().execute( request, appId, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据指定应用栏目ID查询分类信息列表时发生异常。ID:" + appId ); @@ -123,7 +120,7 @@ public class CategoryInfoAnonymousAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanView_AllType)proxy.getProxy(ActionListWhatICanView_AllType.class)).execute( request, appId, effectivePerson ); + result = new ActionListWhatICanView_AllType().execute( request, appId, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据指定应用栏目ID查询分类信息列表时发生异常。ID:" + appId ); @@ -143,7 +140,7 @@ public class CategoryInfoAnonymousAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListWhatICanPublish)proxy.getProxy(ActionListWhatICanPublish.class)).execute( request, appId, effectivePerson ); + result = new ActionListWhatICanPublish().execute( request, appId, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCategoryInfoProcess( e, "根据应用栏目ID查询分类信息对象时发生异常。AppId:" + appId ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/ActionGet.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/ActionGet.java new file mode 100644 index 0000000000000000000000000000000000000000..578d886f71b3f7148f059b1f3246e7b8f2d776f3 --- /dev/null +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/ActionGet.java @@ -0,0 +1,53 @@ +package com.x.cms.assemble.control.jaxrs.commend; + +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.entity.JpaObject; +import com.x.base.core.project.bean.WrapCopier; +import com.x.base.core.project.bean.WrapCopierFactory; +import com.x.base.core.project.cache.Cache; +import com.x.base.core.project.cache.CacheManager; +import com.x.base.core.project.exception.ExceptionEntityNotExist; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.base.core.project.tools.ListTools; +import com.x.cms.core.entity.DocumentCommend; + +import javax.servlet.http.HttpServletRequest; +import java.util.Optional; + +public class ActionGet extends BaseAction { + + private static Logger logger = LoggerFactory.getLogger( ActionGet.class ); + + protected ActionResult execute( HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception { + ActionResult result = new ActionResult<>(); + Wo wo = null; + Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id ); + Optional optional = CacheManager.get(cacheCategory, cacheKey ); + + if (optional.isPresent()) { + result.setData((Wo)optional.get()); + } else { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + DocumentCommend dc = emc.find(id, DocumentCommend.class); + if (null == dc) { + throw new ExceptionEntityNotExist(id, DocumentCommend.class); + } + wo = Wo.copier.copy( dc ); + CacheManager.put(cacheCategory, cacheKey, wo); + result.setData( wo ); + } + } + + return result; + } + + public static class Wo extends DocumentCommend { + + static WrapCopier copier = WrapCopierFactory.wo( DocumentCommend.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible)); + + } +} \ No newline at end of file diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/ActionListPaging.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/ActionListPaging.java new file mode 100644 index 0000000000000000000000000000000000000000..c75153cdbf2f1380b43fef30840d76c1b8059ab8 --- /dev/null +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/ActionListPaging.java @@ -0,0 +1,61 @@ +package com.x.cms.assemble.control.jaxrs.commend; + +import com.google.gson.JsonElement; +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.entity.JpaObject; +import com.x.base.core.project.bean.WrapCopier; +import com.x.base.core.project.bean.WrapCopierFactory; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.cms.core.entity.DocumentCommend; +import com.x.cms.core.entity.DocumentCommend_; +import org.apache.commons.lang3.StringUtils; + +import javax.persistence.EntityManager; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import java.util.List; + +class ActionListPaging extends BaseAction { + ActionResult> execute(EffectivePerson effectivePerson, Integer page, Integer size, JsonElement jsonElement) throws Exception { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + ActionResult> result = new ActionResult<>(); + Wi wi = this.convertToWrapIn(jsonElement, Wi.class); + EntityManager em = emc.get(DocumentCommend.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(DocumentCommend.class); + Root root = cq.from(DocumentCommend.class); + Predicate p = cb.conjunction(); + if (StringUtils.isNotBlank(wi.getDocumentId())){ + p = cb.and(p, root.get(DocumentCommend_.documentId).in(wi.getDocumentId())); + } + if (StringUtils.isNotBlank(wi.getCommendPerson())){ + p = cb.and(p, root.get(DocumentCommend_.commendPerson).in(wi.getCommendPerson())); + } + List wos = emc.fetchDescPaging(DocumentCommend.class, Wo.copier, p, page, size, DocumentCommend.sequence_FIELDNAME); + result.setData(wos); + result.setCount(emc.count(DocumentCommend.class, p)); + return result; + } + } + + public static class Wi extends DocumentCommend{ + + private static final long serialVersionUID = 8042740393049682505L; + + static WrapCopier copier = WrapCopierFactory.wi(Wi.class, DocumentCommend.class, null, + JpaObject.FieldsUnmodify); + } + + public static class Wo extends DocumentCommend { + + private static final long serialVersionUID = -1828627584254370972L; + + static WrapCopier copier = WrapCopierFactory.wo(DocumentCommend.class, Wo.class, null, + JpaObject.FieldsInvisible); + + } +} diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/BaseAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/BaseAction.java new file mode 100644 index 0000000000000000000000000000000000000000..11b4b35f9c64ef08f3773e1e97490f8930e65f91 --- /dev/null +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/BaseAction.java @@ -0,0 +1,12 @@ +package com.x.cms.assemble.control.jaxrs.commend; + +import com.x.base.core.project.cache.Cache; +import com.x.base.core.project.jaxrs.StandardJaxrsAction; +import com.x.cms.core.entity.Document; +import com.x.cms.core.entity.DocumentCommend; + +public class BaseAction extends StandardJaxrsAction { + + protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(DocumentCommend.class, Document.class); + +} diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/DocumentCommendAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/DocumentCommendAction.java new file mode 100644 index 0000000000000000000000000000000000000000..422e42b0c73e0d6e285c0211313d407e23b2c652 --- /dev/null +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/commend/DocumentCommendAction.java @@ -0,0 +1,64 @@ +package com.x.cms.assemble.control.jaxrs.commend; + +import com.google.gson.JsonElement; +import com.x.base.core.project.annotation.JaxrsDescribe; +import com.x.base.core.project.annotation.JaxrsMethodDescribe; +import com.x.base.core.project.annotation.JaxrsParameterDescribe; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.http.HttpMediaType; +import com.x.base.core.project.jaxrs.ResponseFactory; +import com.x.base.core.project.jaxrs.StandardJaxrsAction; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.*; +import javax.ws.rs.container.AsyncResponse; +import javax.ws.rs.container.Suspended; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.List; + +@Path("commend") +@JaxrsDescribe("点赞信息管理") +public class DocumentCommendAction extends StandardJaxrsAction { + + private Logger logger = LoggerFactory.getLogger(DocumentCommendAction.class); + + @JaxrsMethodDescribe(value = "根据标识获取点赞对象.", action = ActionGet.class) + @GET + @Path("{id}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void get( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("评论ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + try { + result = new ActionGet().execute( request, effectivePerson, id ); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "分页列示点赞对象.", action = ActionListPaging.class) + @POST + @Path("list/paging/{page}/size/{size}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void listPaging(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("分页") @PathParam("page") Integer page, + @JaxrsParameterDescribe("每页数量") @PathParam("size") Integer size, JsonElement jsonElement) { + ActionResult> result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionListPaging().execute(effectivePerson, page, size, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } +} \ No newline at end of file diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/comment/ActionSave.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/comment/ActionSave.java index fb7cc48b6843ea62e77d4c88aaebc14551e80378..43fdd9207bed2731e7d5ab8946a12d6c165a750c 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/comment/ActionSave.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/comment/ActionSave.java @@ -7,6 +7,7 @@ import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -64,8 +65,8 @@ public class ActionSave extends BaseAction { documentCommentInfo = documentCommentInfoPersistService.save( documentCommentInfo, wi.getContent(), effectivePerson ); // 更新缓存 - ApplicationCache.notify( Document.class ); - ApplicationCache.notify( DocumentCommentInfo.class ); + CacheManager.notify( Document.class ); + CacheManager.notify( DocumentCommentInfo.class ); Wo wo = new Wo(); wo.setId( documentCommentInfo.getId() ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/comment/DocumentCommentInfoAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/comment/DocumentCommentInfoAction.java index f1f717372d767851d10ec5be6228ac84596d8e2c..60c90e043435c0593270a244ecd52d0176664c7c 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/comment/DocumentCommentInfoAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/comment/DocumentCommentInfoAction.java @@ -9,10 +9,8 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -26,7 +24,6 @@ import java.util.List; @JaxrsDescribe("评论信息管理") public class DocumentCommentInfoAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private Logger logger = LoggerFactory.getLogger(DocumentCommentInfoAction.class); @JaxrsMethodDescribe(value = "根据标识获取评论信息对象.", action = ActionGet.class) @@ -38,7 +35,7 @@ public class DocumentCommentInfoAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult result = new ActionResult<>(); try { - result = ((ActionGet)proxy.getProxy(ActionGet.class)).execute( request, effectivePerson, id ); + result = new ActionGet().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionCommentQuery(e, "根据指定ID查询评论信息对象时发生异常。id:" + id ); @@ -60,7 +57,7 @@ public class DocumentCommentInfoAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListPageWithFilter)proxy.getProxy(ActionListPageWithFilter.class)).execute(request, effectivePerson, page, size, jsonElement ); + result = new ActionListPageWithFilter().execute(request, effectivePerson, page, size, jsonElement ); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -80,7 +77,7 @@ public class DocumentCommentInfoAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListPrevWithFilter)proxy.getProxy(ActionListPrevWithFilter.class)).execute(request, effectivePerson, id, count, jsonElement); + result = new ActionListPrevWithFilter().execute(request, effectivePerson, id, count, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -100,7 +97,7 @@ public class DocumentCommentInfoAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListNextWithFilter)proxy.getProxy(ActionListNextWithFilter.class)).execute(request, effectivePerson, id, count, jsonElement); + result = new ActionListNextWithFilter().execute(request, effectivePerson, id, count, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -118,7 +115,7 @@ public class DocumentCommentInfoAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionSave)proxy.getProxy(ActionSave.class)).execute(request, effectivePerson, jsonElement); + result = new ActionSave().execute(request, effectivePerson, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -137,7 +134,7 @@ public class DocumentCommentInfoAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionDelete)proxy.getProxy(ActionDelete.class)).execute(request, effectivePerson, id); + result = new ActionDelete().execute(request, effectivePerson, id); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -157,7 +154,7 @@ public class DocumentCommentInfoAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionPersistCommend)proxy.getProxy(ActionPersistCommend.class)).execute( request, id, effectivePerson ); + result = new ActionPersistCommend().execute( request, id, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); result.error( e ); @@ -179,7 +176,7 @@ public class DocumentCommentInfoAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionPersistUnCommend)proxy.getProxy(ActionPersistUnCommend.class)).execute( request, id, effectivePerson ); + result = new ActionPersistUnCommend().execute( request, id, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); result.error( e ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistChangeCategory.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistChangeCategory.java index 938db6e6cea3710bd3e2ba026dd0c04aa0cd7bca..3a89adbfb5d0d529fc3d2764446cb9ed92c4ae42 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistChangeCategory.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistChangeCategory.java @@ -4,6 +4,7 @@ import com.google.gson.JsonElement; import com.x.base.core.project.annotation.AuditLog; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; @@ -123,7 +124,7 @@ public class ActionPersistChangeCategory extends BaseAction { } wo.setFailtureList( failture ); wo.setSuccessList( success ); - ApplicationCache.notify(Document.class); + CacheManager.notify(Document.class); } } result.setCount(Long.parseLong( wo.getTotal().toString() ) ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistPublishAndNotify.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistPublishAndNotify.java index 7038cbc04df5e69ed48f5e9372da3d0874daed9c..610e9dc8de11d8d3800a337d075459c3b634ef6b 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistPublishAndNotify.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistPublishAndNotify.java @@ -9,6 +9,7 @@ import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -214,7 +215,7 @@ public class ActionPersistPublishAndNotify extends BaseAction { } } - ApplicationCache.notify( Document.class ); + CacheManager.notify( Document.class ); return result; } diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistPublishContent.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistPublishContent.java index ea518549e6cd5cfbba1039ff63bc0fe9c4680dbb..292e9ba74544d3e3f51c7e4685ee30e662486daa 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistPublishContent.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionPersistPublishContent.java @@ -7,6 +7,7 @@ import java.util.*; import javax.servlet.http.HttpServletRequest; import com.x.base.core.entity.annotation.CheckPersistType; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.config.StorageMapping; import com.x.base.core.project.exception.ExceptionWhen; import com.x.processplatform.core.entity.content.Attachment; @@ -16,12 +17,10 @@ import org.apache.commons.lang3.StringUtils; import com.google.gson.JsonElement; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; import com.x.base.core.project.annotation.AuditLog; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; -import com.x.base.core.project.cache.ApplicationCache; import com.x.base.core.project.gson.XGsonBuilder; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; @@ -416,8 +415,8 @@ public class ActionPersistPublishContent extends BaseAction { } } - ApplicationCache.notify(FileInfo.class); - ApplicationCache.notify(Document.class); + CacheManager.notify(FileInfo.class); + CacheManager.notify(Document.class); return result; } diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryGetDocumentData.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryGetDocumentData.java new file mode 100644 index 0000000000000000000000000000000000000000..921dfaca443b7313eef687ed5687482f5c46b191 --- /dev/null +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryGetDocumentData.java @@ -0,0 +1,100 @@ +package com.x.cms.assemble.control.jaxrs.document; + +import com.x.base.core.entity.JpaObject; +import com.x.base.core.project.annotation.FieldDescribe; +import com.x.base.core.project.bean.WrapCopier; +import com.x.base.core.project.bean.WrapCopierFactory; +import com.x.base.core.project.cache.Cache; +import com.x.base.core.project.cache.CacheManager; +import com.x.base.core.project.gson.GsonPropertyObject; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.cms.core.entity.Document; +import com.x.cms.core.entity.content.Data; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +public class ActionQueryGetDocumentData extends BaseAction { + + private static Logger logger = LoggerFactory.getLogger(ActionQueryGetDocumentData.class); + + protected ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String id) throws Exception { + ActionResult result = new ActionResult<>(); + Wo wo = getDocumentQueryResult(id); + result.setData(wo); + return result; + } + + private Wo getDocumentQueryResult(String id) throws Exception { + Wo wo = null; + + Cache.CacheKey cacheKey = new Cache.CacheKey(this.getClass(), id); + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + wo = (Wo)optional.get(); + } else { + Document document = documentQueryService.get(id); + wo = new Wo(); + if(document!=null) { + WoDocument woOutDocument = WoDocument.copier.copy(document); + wo.setDocId(document.getId()); + wo.setDocument(woOutDocument); + wo.setData(documentQueryService.getDocumentData(document)); + CacheManager.put(cacheCategory, cacheKey, wo); + } + } + return wo; + } + + public static class Wo extends GsonPropertyObject { + @FieldDescribe( "文档ID." ) + private String docId; + + @FieldDescribe( "作为输出的CMS文档数据对象." ) + private WoDocument document; + + @FieldDescribe( "文档所有数据信息." ) + private Data data; + + public String getDocId() { + return docId; + } + + public void setDocId(String docId) { + this.docId = docId; + } + + public WoDocument getDocument() { + return document; + } + + public void setDocument( WoDocument document) { + this.document = document; + } + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + + } + + public static class WoDocument extends Document { + + private static final long serialVersionUID = -5076990764713538973L; + + public static List Excludes = new ArrayList(); + + public static WrapCopier copier = WrapCopierFactory.wo( Document.class, WoDocument.class, null,JpaObject.FieldsInvisible); + + } + +} \ No newline at end of file diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryListDocumentData.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryListDocumentData.java new file mode 100644 index 0000000000000000000000000000000000000000..1bae77793e53bc90a441578c093ad6fea5083c77 --- /dev/null +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryListDocumentData.java @@ -0,0 +1,131 @@ +package com.x.cms.assemble.control.jaxrs.document; + +import com.google.gson.JsonElement; +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.entity.JpaObject; +import com.x.base.core.project.annotation.FieldDescribe; +import com.x.base.core.project.bean.WrapCopier; +import com.x.base.core.project.bean.WrapCopierFactory; +import com.x.base.core.project.cache.Cache; +import com.x.base.core.project.cache.CacheManager; +import com.x.base.core.project.gson.GsonPropertyObject; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.cms.assemble.control.Business; +import com.x.cms.core.entity.Document; +import com.x.cms.core.entity.content.Data; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +public class ActionQueryListDocumentData extends BaseAction { + + private static Logger logger = LoggerFactory.getLogger(ActionQueryListDocumentData.class); + + protected ActionResult> execute(HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception { + ActionResult> result = new ActionResult<>(); + Wi wi = this.convertToWrapIn( jsonElement, Wi.class ); + Business business = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + business = new Business(emc); + } + List wos = new ArrayList<>(); + if(wi.getDocIds()!=null && !wi.getDocIds().isEmpty()) { + wos = getDocumentQueryResult(business, wi.getDocIds(), effectivePerson); + } + result.setData(wos); + return result; + } + + private List getDocumentQueryResult(Business business, List ids, EffectivePerson effectivePerson) throws Exception { + List wos = new ArrayList<>(); + Wo wo = null; + List docs = documentQueryService.list(ids); + //先不考虑阅读权限的问题 + /*List unitNames = userManagerService.listUnitNamesWithPerson(effectivePerson.getDistinguishedName()); + List groupNames = userManagerService.listGroupNamesByPerson(effectivePerson.getDistinguishedName());*/ + for (Document document : docs){ + //if(this.hasReadPermission(business, document, unitNames, groupNames, effectivePerson, null)) { + Cache.CacheKey cacheKey = new Cache.CacheKey(this.getClass(), document.getId()); + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + wo = (Wo)optional.get(); + } else { + wo = new Wo(); + WoDocument woOutDocument = WoDocument.copier.copy(document); + wo.setDocId(document.getId()); + wo.setDocument(woOutDocument); + wo.setData(documentQueryService.getDocumentData(document)); + CacheManager.put(cacheCategory, cacheKey, wo); + } + wos.add(wo); + //} + } + + return wos; + } + + public static class Wo extends GsonPropertyObject { + @FieldDescribe( "文档ID." ) + private String docId; + + @FieldDescribe( "作为输出的CMS文档数据对象." ) + private WoDocument document; + + @FieldDescribe( "文档所有数据信息." ) + private Data data; + + public String getDocId() { + return docId; + } + + public void setDocId(String docId) { + this.docId = docId; + } + + public WoDocument getDocument() { + return document; + } + + public void setDocument( WoDocument document) { + this.document = document; + } + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + + } + + public static class WoDocument extends Document { + + private static final long serialVersionUID = -5076990764713538973L; + + public static List Excludes = new ArrayList(); + + public static WrapCopier copier = WrapCopierFactory.wo( Document.class, WoDocument.class, null,JpaObject.FieldsInvisible); + + } + + public static class Wi extends GsonPropertyObject { + @FieldDescribe( "文档id" ) + private List docIds = new ArrayList<>(); + + public List getDocIds() { + return docIds; + } + + public void setDocIds(List docIds) { + this.docIds = docIds; + } + } +} \ No newline at end of file diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryPermissionReadDocument.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryPermissionReadDocument.java index cafda35cd22a80c61530a4a52a0e5d7b648c16fd..9c77b1a6792cb9531ee2313451b02683344022c2 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryPermissionReadDocument.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryPermissionReadDocument.java @@ -1,17 +1,14 @@ package com.x.cms.assemble.control.jaxrs.document; +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WrapBoolean; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.organization.Person; -import com.x.base.core.project.tools.ListTools; -import com.x.cms.core.entity.AppInfo; -import com.x.cms.core.entity.CategoryInfo; +import com.x.cms.assemble.control.Business; import com.x.cms.core.entity.Document; -import org.apache.commons.lang3.StringUtils; -import java.util.List; public class ActionQueryPermissionReadDocument extends BaseAction { @@ -19,6 +16,10 @@ public class ActionQueryPermissionReadDocument extends BaseAction { protected ActionResult execute(EffectivePerson effectivePerson, String id, String queryPerson) throws Exception { ActionResult result = new ActionResult<>(); + Business business = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + business = new Business(emc); + } Wo wo = new Wo(); wo.setValue(false); result.setData(wo); @@ -26,115 +27,10 @@ public class ActionQueryPermissionReadDocument extends BaseAction { if(document == null){ return result; } - //匿名用户是否可读 - if(effectivePerson.isAnonymous()){ - AppInfo appInfo = appInfoServiceAdv.get( document.getAppId() ); - CategoryInfo categoryInfo = categoryInfoServiceAdv.get(document.getCategoryId()); - if(appInfo!=null && categoryInfo!=null){ - boolean flag = true; - //检查这个文档所在的栏目和分类是否都是全员可见 - if( ( ListTools.isNotEmpty( document.getReadPersonList() ) && !document.getReadPersonList().contains( "所有人" ) ) - || ListTools.isNotEmpty( document.getReadUnitList() ) || ListTools.isNotEmpty( document.getReadGroupList() ) ) { - flag = false; - } - //检查这个文档所在的栏目和分类是否都是全员可见 - if( !appInfo.getAllPeopleView() ) { - //栏目不可见 - flag = false; - } - //检查这个文档所在的栏目和分类是否都是全员可见 - if( !categoryInfo.getAllPeopleView() ) { - //分类不可见 - flag = false; - } - wo.setValue(flag); - return result; - } - }else{ - String personName = effectivePerson.getDistinguishedName(); - if(effectivePerson.isManager()){ - if(StringUtils.isNotEmpty(queryPerson)){ - Person person = userManagerService.getPerson(queryPerson); - if(person!=null){ - personName = person.getDistinguishedName(); - }else{ - return result; - } - }else{ - wo.setValue(true); - return result; - } - } - List unitNames = userManagerService.listUnitNamesWithPerson(personName); - List groupNames = userManagerService.listGroupNamesByPerson(personName); - //是否是读者 - if(ListTools.contains(document.getReadPersonList(), getShortTargetFlag(personName)) || - ListTools.contains(document.getReadPersonList(), "所有人")){ - wo.setValue(true); - return result; - } - for(String unitName : unitNames){ - if(ListTools.contains(document.getReadUnitList(), getShortTargetFlag(unitName))){ - wo.setValue(true); - return result; - } - } - for(String groupName : groupNames){ - if(ListTools.contains(document.getReadGroupList(), getShortTargetFlag(groupName))){ - wo.setValue(true); - return result; - } - } - //是否是作者 - if( ListTools.isNotEmpty( document.getAuthorPersonList() )) { - if( document.getAuthorPersonList().contains( personName ) ) { - wo.setValue(true); - return result; - } - } - if( ListTools.isNotEmpty( document.getAuthorUnitList() )) { - if( ListTools.containsAny( unitNames, document.getAuthorUnitList())) { - wo.setValue(true); - return result; - } - } - if( ListTools.isNotEmpty( document.getAuthorGroupList() )) { - if( ListTools.containsAny( groupNames, document.getAuthorGroupList())) { - wo.setValue(true); - return result; - } - } - //是否是分类的管理者 - CategoryInfo categoryInfo = categoryInfoServiceAdv.get(document.getCategoryId()); - if ( categoryInfoServiceAdv.isCategoryInfoManager( categoryInfo, personName, unitNames, groupNames )) { - wo.setValue(true); - return result; - } - //是否是栏目的管理者 - AppInfo appInfo = appInfoServiceAdv.get( document.getAppId() ); - if (appInfoServiceAdv.isAppInfoManager( appInfo, personName, unitNames, groupNames )) { - wo.setValue(true); - return result; - } - } - return result; - } + wo.setValue(this.hasReadPermission(business, document, null, null, effectivePerson, queryPerson)); - private String getShortTargetFlag(String distinguishedName) { - String target = null; - if( StringUtils.isNotEmpty( distinguishedName ) ){ - String[] array = distinguishedName.split("@"); - StringBuffer sb = new StringBuffer(); - if( array.length == 3 ){ - target = sb.append(array[1]).append("@").append(array[2]).toString(); - }else if( array.length == 2 ){ - //2段 - target = sb.append(array[0]).append("@").append(array[1]).toString(); - }else{ - target = array[0]; - } - } - return target; + + return result; } public static class Wo extends WrapBoolean { diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/BaseAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/BaseAction.java index de3148c5bcec0c0148857c2cde7c8e0f66e36a6e..21aad8f4901e5e34ca6ef51b8bf36d63b0fca366 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/BaseAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/BaseAction.java @@ -6,9 +6,12 @@ import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.annotation.CheckPersistType; import com.x.base.core.project.cache.Cache; +import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.StandardJaxrsAction; +import com.x.base.core.project.organization.Person; import com.x.base.core.project.tools.ListTools; import com.x.cms.assemble.control.Business; +import com.x.cms.assemble.control.ThisApplication; import com.x.cms.assemble.control.service.AppInfoServiceAdv; import com.x.cms.assemble.control.service.CategoryInfoServiceAdv; import com.x.cms.assemble.control.service.DocCommendPersistService; @@ -23,6 +26,7 @@ import com.x.cms.assemble.control.service.QueryViewService; import com.x.cms.assemble.control.service.UserManagerService; import com.x.cms.core.entity.*; import com.x.query.core.entity.Item; +import org.apache.commons.lang3.StringUtils; public class BaseAction extends StandardJaxrsAction { @@ -208,6 +212,82 @@ public class BaseAction extends StandardJaxrsAction { return false; } + protected boolean hasReadPermission(Business business, Document document, List unitNames, List groupNames, EffectivePerson effectivePerson, String queryPerson) throws Exception{ + String personName = effectivePerson.getDistinguishedName(); + if(effectivePerson.isManager()){ + if(StringUtils.isNotEmpty(queryPerson)){ + Person person = userManagerService.getPerson(queryPerson); + if(person!=null){ + personName = person.getDistinguishedName(); + }else{ + return false; + } + }else { + return true; + } + } + //是否是读者 + if(ListTools.contains(document.getReadPersonList(), getShortTargetFlag(personName)) || + ListTools.contains(document.getReadPersonList(), "所有人")){ + return true; + } + if(unitNames == null){ + unitNames = userManagerService.listUnitNamesWithPerson(personName); + } + for(String unitName : unitNames){ + if(ListTools.contains(document.getReadUnitList(), getShortTargetFlag(unitName))){ + return true; + } + } + if (groupNames == null){ + groupNames = userManagerService.listGroupNamesByPerson(personName); + } + for(String groupName : groupNames){ + if(ListTools.contains(document.getReadGroupList(), getShortTargetFlag(groupName))){ + return true; + } + } + //是否是作者 + if( ListTools.isNotEmpty( document.getAuthorPersonList() )) { + if( document.getAuthorPersonList().contains( personName ) ) { + return true; + } + } + if( ListTools.isNotEmpty( document.getAuthorUnitList() )) { + if( ListTools.containsAny( unitNames, document.getAuthorUnitList())) { + return true; + } + } + if( ListTools.isNotEmpty( document.getAuthorGroupList() )) { + if( ListTools.containsAny( groupNames, document.getAuthorGroupList())) { + return true; + } + } + + if(business.isHasPlatformRole(personName, ThisApplication.ROLE_CMSManager)){ + return true; + } + + return false; + } + + protected String getShortTargetFlag(String distinguishedName) { + String target = null; + if( StringUtils.isNotEmpty( distinguishedName ) ){ + String[] array = distinguishedName.split("@"); + StringBuffer sb = new StringBuffer(); + if( array.length == 3 ){ + target = sb.append(array[1]).append("@").append(array[2]).toString(); + }else if( array.length == 2 ){ + //2段 + target = sb.append(array[0]).append("@").append(array[1]).toString(); + }else{ + target = array[0]; + } + } + return target; + } + // /** diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentAction.java index 6b404ad3ae34ab8e46d632fe123ddc6d24e48c41..28e2725d9ad2d9d744e33b8b33b1453ed65d4659 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentAction.java @@ -9,10 +9,8 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import com.x.cms.assemble.control.queue.DataImportStatus; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; @@ -27,334 +25,341 @@ import java.util.List; @Path("document") @JaxrsDescribe("信息发布信息文档管理") -public class DocumentAction extends StandardJaxrsAction{ +public class DocumentAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); - private static Logger logger = LoggerFactory.getLogger( DocumentAction.class ); + private static Logger logger = LoggerFactory.getLogger(DocumentAction.class); @JaxrsMethodDescribe(value = "变更指定文档的分类信息.", action = ActionPersistChangeCategory.class) @PUT @Path("category/change") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_changeCategory( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_changeCategory(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - - if( check ){ + + if (check) { try { - result = ((ActionPersistChangeCategory)proxy.getProxy(ActionPersistChangeCategory.class)).execute( request, jsonElement, effectivePerson ); + result = new ActionPersistChangeCategory().execute(request, jsonElement, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } - + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "指修改指定文档的数据。", action = ActionPersistBatchModifyData.class) @PUT @Path("batch/data/modify") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_batchDataModify( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_batchDataModify(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionPersistBatchModifyData)proxy.getProxy(ActionPersistBatchModifyData.class)).execute( request, jsonElement, effectivePerson ); + result = new ActionPersistBatchModifyData().execute(request, jsonElement, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "根据导入批次号查询导入状态信息.", action = ActionQueryImportStatusWithName.class) @GET @Path("batch/{batchName}/status") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_checkImportStatus( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + public void query_checkImportStatus(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("导入批次号") @PathParam("batchName") String batchName) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionQueryImportStatusWithName)proxy.getProxy(ActionQueryImportStatusWithName.class)).execute( request, effectivePerson, batchName ); + result = new ActionQueryImportStatusWithName().execute(request, effectivePerson, batchName); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "查询所有的导入状态信息.", action = ActionQueryAllImportStatus.class) @GET @Path("batch/status") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_checkAllImportStatus( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_checkAllImportStatus(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); try { - result = ((ActionQueryAllImportStatus)proxy.getProxy(ActionQueryAllImportStatus.class)).execute( request, effectivePerson ); + result = new ActionQueryAllImportStatus().execute(request, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "根据ID获取信息发布文档信息对象详细信息,包括附件列表,数据信息.", action = ActionQueryGetDocument.class) @GET @Path("{id}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_get( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + public void query_get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionQueryGetDocument)proxy.getProxy(ActionQueryGetDocument.class)).execute( request, id, effectivePerson ); + result = new ActionQueryGetDocument().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "列示文档对象可供排序和展示使用的列名.", action = ActionQueryListDocumentFields.class) @GET @Path("document/fields") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_listDocumentFields( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_listDocumentFields(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionQueryListDocumentFields)proxy.getProxy(ActionQueryListDocumentFields.class)).execute( request ); + result = new ActionQueryListDocumentFields().execute(request); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - - + @JaxrsMethodDescribe(value = "根据ID访问信息发布文档信息对象详细信息,包括附件列表,数据信息.", action = ActionQueryViewDocument.class) @GET @Path("{id}/view") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_view( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + public void query_view(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionQueryViewDocument)proxy.getProxy(ActionQueryViewDocument.class)).execute( request, id, effectivePerson ); + result = new ActionQueryViewDocument().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "根据ID获取信息发布文档信息被访问次数.", action = ActionQueryCountViewTimes.class) @GET @Path("{id}/view/count") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_getViewCount( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + public void query_getViewCount(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionQueryCountViewTimes)proxy.getProxy(ActionQueryCountViewTimes.class)).execute( request, id, effectivePerson ); + result = new ActionQueryCountViewTimes().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "查询符合过滤条件的已发布的信息数量.", action = ActionQueryCountWithFilter.class) @PUT @Path("filter/count") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_countDocumentWithFilter( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_countDocumentWithFilter(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionQueryCountWithFilter)proxy.getProxy(ActionQueryCountWithFilter.class)).execute( request, jsonElement, effectivePerson ); + result = new ActionQueryCountWithFilter().execute(request, jsonElement, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "根据ID删除信息发布文档信息.", action = ActionPersistDeleteDocument.class) @DELETE @Path("{id}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_delete( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionPersistDeleteDocument)proxy.getProxy(ActionPersistDeleteDocument.class)).execute( request, id, effectivePerson ); + result = new ActionPersistDeleteDocument().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "根据批次号删除信息发布文档信息.", action = ActionPersistDeleteWithBatch.class) @DELETE @Path("batch/{batchId}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_deleteWithBatchName( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("batchId") String batchId) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_deleteWithBatchName(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("batchId") String batchId) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionPersistDeleteWithBatch)proxy.getProxy(ActionPersistDeleteWithBatch.class)).execute( request, batchId, effectivePerson ); + result = new ActionPersistDeleteWithBatch().execute(request, batchId, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "根据ID归档信息发布文档信息.", action = ActionPersistArchive.class) @GET @Path("achive/{id}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_achive( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_achive(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionPersistArchive)proxy.getProxy(ActionPersistArchive.class)).execute( request, id, effectivePerson ); + result = new ActionPersistArchive().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "根据文档ID正式发布文档,并且使用Message通知所有的阅读者。", action = ActionPersistPublishAndNotify.class) @PUT @Path("publish/{id}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_publishAndNotify( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("文档ID") @PathParam("id") String id, JsonElement jsonElement ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_publishAndNotify(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("文档ID") @PathParam("id") String id, + JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionPersistPublishAndNotify)proxy.getProxy(ActionPersistPublishAndNotify.class)).execute( request, id, effectivePerson, jsonElement ); + result = new ActionPersistPublishAndNotify().execute(request, id, effectivePerson, jsonElement); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } - + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "直接发布信息内容,创建新的信息发布文档并且直接发布.", action = ActionPersistPublishContent.class) @PUT @Path("publish/content") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_publishContent( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_publishContent(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - - if( check ){ - System.out.println( "please wait, system try to publish content......" ); + + if (check) { + System.out.println("please wait, system try to publish content......"); try { - result = ((ActionPersistPublishContent)proxy.getProxy(ActionPersistPublishContent.class)).execute( request, jsonElement, effectivePerson ); - System.out.println( "system publish content successful!" ); + result = new ActionPersistPublishContent().execute(request, jsonElement, effectivePerson); + System.out.println("system publish content successful!"); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "根据ID取消信息内容发布状态,修改为草稿.", action = ActionPersistPublishCancel.class) @PUT @Path("publish/{id}/cancel") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_publishCancel( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_publishCancel(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); try { - result = ((ActionPersistPublishCancel)proxy.getProxy(ActionPersistPublishCancel.class)).execute( request, id, effectivePerson ); + result = new ActionPersistPublishCancel().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "列示符合过滤条件的已发布的信息内容, 下一页.", action = ActionQueryListNextWithFilter.class) @PUT @Path("filter/list/{id}/next/{count}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_listNextWithFilter( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count, - JsonElement jsonElement ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_listNextWithFilter(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id, + @JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count, JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionQueryListNextWithFilter)proxy.getProxy(ActionQueryListNextWithFilter.class)).execute( request, id, count, jsonElement, effectivePerson ); + result = new ActionQueryListNextWithFilter().execute(request, id, count, jsonElement, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); @@ -365,46 +370,47 @@ public class DocumentAction extends StandardJaxrsAction{ @Path("filter/list/{id}/prev/{count}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_listPrevWithFilter( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count, - JsonElement jsonElement ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_listPrevWithFilter(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id, + @JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count, JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionQueryListPrevWithFilter)proxy.getProxy(ActionQueryListPrevWithFilter.class)).execute( request, id, count, jsonElement, effectivePerson ); + result = new ActionQueryListPrevWithFilter().execute(request, id, count, jsonElement, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "列示符合过滤条件的草稿信息内容, 下一页.", action = ActionQueryListDraftNextWithFilter.class) @PUT @Path("draft/list/{id}/next/{count}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_listDraftNextWithFilter( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id, - @JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count, - JsonElement jsonElement) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_listDraftNextWithFilter(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id, + @JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count, JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionQueryListDraftNextWithFilter)proxy.getProxy(ActionQueryListDraftNextWithFilter.class)).execute( request, id, count, jsonElement, effectivePerson ); + result = new ActionQueryListDraftNextWithFilter().execute(request, id, count, jsonElement, + effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); @@ -415,18 +421,18 @@ public class DocumentAction extends StandardJaxrsAction{ @Path("pictures/{id}/first") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_listFirstPictures( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_listFirstPictures(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionQueryGetFirstPicture)proxy.getProxy(ActionQueryGetFirstPicture.class)).execute( request, id, effectivePerson ); + result = new ActionQueryGetFirstPicture().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); @@ -437,38 +443,39 @@ public class DocumentAction extends StandardJaxrsAction{ @Path("pictures/{id}/all") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_listAllPictures( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_listAllPictures(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionQueryListAllPictures)proxy.getProxy(ActionQueryListAllPictures.class)).execute( request, id, effectivePerson ); + result = new ActionQueryListAllPictures().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "从Excel文件导入文档数据.", action = ActionPersistImportDataExcel.class) @POST @Path("import/category/{categoryId}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.MULTIPART_FORM_DATA) - public void persist_importDocumentFormExcel(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("分类ID") @PathParam("categoryId") String categoryId, + public void persist_importDocumentFormExcel(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("分类ID") @PathParam("categoryId") String categoryId, @JaxrsParameterDescribe("作为参数的JSON字符串") @FormDataParam("json_data") String json_data, @FormDataParam(FILE_FIELD) final byte[] bytes, @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionPersistImportDataExcel)proxy.getProxy(ActionPersistImportDataExcel.class)).execute(request, effectivePerson, categoryId, bytes, json_data, disposition); + result = new ActionPersistImportDataExcel().execute(request, effectivePerson, categoryId, bytes, json_data, + disposition); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -480,107 +487,108 @@ public class DocumentAction extends StandardJaxrsAction{ @POST @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_save( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_save(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - - if( check ){ + + if (check) { try { - result = ((ActionPersistSaveDocument)proxy.getProxy(ActionPersistSaveDocument.class)).execute( request, jsonElement, effectivePerson ); + result = new ActionPersistSaveDocument().execute(request, jsonElement, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } - + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "文档点赞.", action = ActionPersistCommend.class) @GET @Path("{id}/commend") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_commend( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_commend(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionPersistCommend)proxy.getProxy(ActionPersistCommend.class)).execute( request, id, effectivePerson ); + result = new ActionPersistCommend().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "取消文档点赞.", action = ActionPersistUnCommend.class) @GET @Path("{id}/uncommend") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_unCommend( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_unCommend(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionPersistUnCommend)proxy.getProxy(ActionPersistUnCommend.class)).execute( request, id, effectivePerson ); + result = new ActionPersistUnCommend().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "文档置顶.", action = ActionPersistTopDocument.class) @GET @Path("{id}/top") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_top( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_top(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionPersistTopDocument)proxy.getProxy(ActionPersistTopDocument.class)).execute( request, id, effectivePerson ); + result = new ActionPersistTopDocument().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "取消文档置顶.", action = ActionPersistUnTopDocument.class) @GET @Path("{id}/unTop") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void persist_unTop( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void persist_unTop(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionPersistUnTopDocument)proxy.getProxy(ActionPersistUnTopDocument.class)).execute( request, id, effectivePerson ); + result = new ActionPersistUnTopDocument().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); @@ -591,64 +599,65 @@ public class DocumentAction extends StandardJaxrsAction{ @Path("filter/list/{page}/size/{size}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_listWithFilterPaging( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("分页") @PathParam("page") Integer page, - @JaxrsParameterDescribe("数量") @PathParam("size") Integer size, JsonElement jsonElement) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_listWithFilterPaging(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("分页") @PathParam("page") Integer page, + @JaxrsParameterDescribe("数量") @PathParam("size") Integer size, JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult> result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionQueryListWithFilterPaging)proxy.getProxy(ActionQueryListWithFilterPaging.class)).execute( request, page, size, jsonElement, effectivePerson ); + result = new ActionQueryListWithFilterPaging().execute(request, page, size, jsonElement, + effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "获取文件访问控制信息.", action = ActionQueryGetControl.class) @GET @Path("{id}/control") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_getControl( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_getControl(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionQueryGetControl)proxy.getProxy(ActionQueryGetControl.class)).execute( request, id, effectivePerson ); + result = new ActionQueryGetControl().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - + @JaxrsMethodDescribe(value = "获取文件可见范围内的所有人员.", action = ActionQueryListVisiblePersons.class) @GET @Path("{id}/persons") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_getVisiblePersons( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_getVisiblePersons(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { - result = ((ActionQueryListVisiblePersons)proxy.getProxy(ActionQueryListVisiblePersons.class)).execute( request, id, effectivePerson ); + result = new ActionQueryListVisiblePersons().execute(request, id, effectivePerson); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); @@ -659,19 +668,62 @@ public class DocumentAction extends StandardJaxrsAction{ @Path("{id}/permission/read") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void query_PermissionReadDocument( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { - EffectivePerson effectivePerson = this.effectivePerson( request ); + public void query_PermissionReadDocument(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = new ActionResult<>(); Boolean check = true; - if( check ){ + if (check) { try { result = new ActionQueryPermissionReadDocument().execute(effectivePerson, id, null); } catch (Exception e) { result = new ActionResult<>(); - result.error( e ); - logger.error( e, effectivePerson, request, null); + result.error(e); + logger.error(e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "列示文档数据.", action = ActionQueryListDocumentData.class) + @POST + @Path("list/document/data") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_listDocumentData(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson(request); + ActionResult> result = new ActionResult<>(); + + try { + result = new ActionQueryListDocumentData().execute(request, effectivePerson, jsonElement); + } catch (Exception e) { + result.error(e); + logger.error(e, effectivePerson, request, jsonElement); + } + + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "查看文档数据.", action = ActionQueryGetDocumentData.class) + @GET + @Path("{id}/document/data") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_getDocumentData(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson(request); + ActionResult result = new ActionResult<>(); + Boolean check = true; + + if (check) { + try { + result = new ActionQueryGetDocumentData().execute(request, effectivePerson, id); + } catch (Exception e) { + result = new ActionResult<>(); + result.error(e); + logger.error(e, effectivePerson, request, null); } } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentAction2.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentAction2.java new file mode 100644 index 0000000000000000000000000000000000000000..1e6af091ac155571ea4fbc8b4d2ec9916955f92d --- /dev/null +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/DocumentAction2.java @@ -0,0 +1,718 @@ +package com.x.cms.assemble.control.jaxrs.document; + +import com.google.gson.JsonElement; +import com.x.base.core.project.annotation.JaxrsDescribe; +import com.x.base.core.project.annotation.JaxrsMethodDescribe; +import com.x.base.core.project.annotation.JaxrsParameterDescribe; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.http.HttpMediaType; +import com.x.base.core.project.jaxrs.ResponseFactory; +import com.x.base.core.project.jaxrs.StandardJaxrsAction; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.cms.assemble.control.queue.DataImportStatus; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.*; +import javax.ws.rs.container.AsyncResponse; +import javax.ws.rs.container.Suspended; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.List; + +@Path("document") +@JaxrsDescribe("信息发布信息文档管理") +public class DocumentAction2 extends StandardJaxrsAction{ + + private static Logger logger = LoggerFactory.getLogger( DocumentAction2.class ); + + @JaxrsMethodDescribe(value = "变更指定文档的分类信息.", action = ActionPersistChangeCategory.class) + @PUT + @Path("category/change") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_changeCategory( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + + if( check ){ + try { + result = new ActionPersistChangeCategory().execute( request, jsonElement, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "指修改指定文档的数据。", action = ActionPersistBatchModifyData.class) + @PUT + @Path("batch/data/modify") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_batchDataModify( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + if( check ){ + try { + result = new ActionPersistBatchModifyData().execute( request, jsonElement, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "根据导入批次号查询导入状态信息.", action = ActionQueryImportStatusWithName.class) + @GET + @Path("batch/{batchName}/status") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_checkImportStatus( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("导入批次号") @PathParam("batchName") String batchName) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + try { + result = new ActionQueryImportStatusWithName().execute( request, effectivePerson, batchName ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "查询所有的导入状态信息.", action = ActionQueryAllImportStatus.class) + @GET + @Path("batch/status") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_checkAllImportStatus( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult> result = new ActionResult<>(); + try { + result = new ActionQueryAllImportStatus().execute( request, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "根据ID获取信息发布文档信息对象详细信息,包括附件列表,数据信息.", action = ActionQueryGetDocument.class) + @GET + @Path("{id}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_get( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + try { + result = new ActionQueryGetDocument().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "列示文档对象可供排序和展示使用的列名.", action = ActionQueryListDocumentFields.class) + @GET + @Path("document/fields") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_listDocumentFields( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + try { + result = new ActionQueryListDocumentFields().execute( request ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + + @JaxrsMethodDescribe(value = "根据ID访问信息发布文档信息对象详细信息,包括附件列表,数据信息.", action = ActionQueryViewDocument.class) + @GET + @Path("{id}/view") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_view( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + try { + result = new ActionQueryViewDocument().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "根据ID获取信息发布文档信息被访问次数.", action = ActionQueryCountViewTimes.class) + @GET + @Path("{id}/view/count") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_getViewCount( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + try { + result = new ActionQueryCountViewTimes().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "查询符合过滤条件的已发布的信息数量.", action = ActionQueryCountWithFilter.class) + @PUT + @Path("filter/count") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_countDocumentWithFilter( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + + if( check ){ + try { + result = new ActionQueryCountWithFilter().execute( request, jsonElement, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "根据ID删除信息发布文档信息.", action = ActionPersistDeleteDocument.class) + @DELETE + @Path("{id}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_delete( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + try { + result = new ActionPersistDeleteDocument().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "根据批次号删除信息发布文档信息.", action = ActionPersistDeleteWithBatch.class) + @DELETE + @Path("batch/{batchId}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_deleteWithBatchName( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("batchId") String batchId) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + try { + result = new ActionPersistDeleteWithBatch().execute( request, batchId, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "根据ID归档信息发布文档信息.", action = ActionPersistArchive.class) + @GET + @Path("achive/{id}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_achive( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + try { + result = new ActionPersistArchive().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "根据文档ID正式发布文档,并且使用Message通知所有的阅读者。", action = ActionPersistPublishAndNotify.class) + @PUT + @Path("publish/{id}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_publishAndNotify( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("文档ID") @PathParam("id") String id, JsonElement jsonElement ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + + if( check ){ + try { + result = new ActionPersistPublishAndNotify().execute( request, id, effectivePerson, jsonElement ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "直接发布信息内容,创建新的信息发布文档并且直接发布.", action = ActionPersistPublishContent.class) + @PUT + @Path("publish/content") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_publishContent( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + + if( check ){ + System.out.println( "please wait, system try to publish content......" ); + try { + result = new ActionPersistPublishContent().execute( request, jsonElement, effectivePerson ); + System.out.println( "system publish content successful!" ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "根据ID取消信息内容发布状态,修改为草稿.", action = ActionPersistPublishCancel.class) + @PUT + @Path("publish/{id}/cancel") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_publishCancel( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + try { + result = new ActionPersistPublishCancel().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "列示符合过滤条件的已发布的信息内容, 下一页.", action = ActionQueryListNextWithFilter.class) + @PUT + @Path("filter/list/{id}/next/{count}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_listNextWithFilter( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id, + @JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count, + JsonElement jsonElement ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult> result = new ActionResult<>(); + Boolean check = true; + + if( check ){ + try { + result = new ActionQueryListNextWithFilter().execute( request, id, count, jsonElement, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "列示符合过滤条件的已发布的信息内容, 上一页.", action = ActionQueryListPrevWithFilter.class) + @PUT + @Path("filter/list/{id}/prev/{count}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_listPrevWithFilter( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id, + @JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count, + JsonElement jsonElement ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult> result = new ActionResult<>(); + Boolean check = true; + + if( check ){ + try { + result = new ActionQueryListPrevWithFilter().execute( request, id, count, jsonElement, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "列示符合过滤条件的草稿信息内容, 下一页.", action = ActionQueryListDraftNextWithFilter.class) + @PUT + @Path("draft/list/{id}/next/{count}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_listDraftNextWithFilter( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id, + @JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count, + JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult> result = new ActionResult<>(); + Boolean check = true; + + if( check ){ + try { + result = new ActionQueryListDraftNextWithFilter().execute( request, id, count, jsonElement, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "根据信息发布文档ID查询文档第一张图片信息列表.", action = ActionQueryGetFirstPicture.class) + @GET + @Path("pictures/{id}/first") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_listFirstPictures( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + if( check ){ + try { + result = new ActionQueryGetFirstPicture().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "根据信息发布文档ID查询文档所有的图片信息列表.", action = ActionQueryListAllPictures.class) + @GET + @Path("pictures/{id}/all") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_listAllPictures( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult> result = new ActionResult<>(); + Boolean check = true; + if( check ){ + try { + result = new ActionQueryListAllPictures().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "从Excel文件导入文档数据.", action = ActionPersistImportDataExcel.class) + @POST + @Path("import/category/{categoryId}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.MULTIPART_FORM_DATA) + public void persist_importDocumentFormExcel(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("分类ID") @PathParam("categoryId") String categoryId, + @JaxrsParameterDescribe("作为参数的JSON字符串") @FormDataParam("json_data") String json_data, + @FormDataParam(FILE_FIELD) final byte[] bytes, + @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionPersistImportDataExcel().execute(request, effectivePerson, categoryId, bytes, json_data, disposition); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "保存信息发布文档信息对象.", action = ActionPersistSaveDocument.class) + @POST + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_save( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + + if( check ){ + try { + result = new ActionPersistSaveDocument().execute( request, jsonElement, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "文档点赞.", action = ActionPersistCommend.class) + @GET + @Path("{id}/commend") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_commend( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + if( check ){ + try { + result = new ActionPersistCommend().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "取消文档点赞.", action = ActionPersistUnCommend.class) + @GET + @Path("{id}/uncommend") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_unCommend( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + if( check ){ + try { + result = new ActionPersistUnCommend().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "文档置顶.", action = ActionPersistTopDocument.class) + @GET + @Path("{id}/top") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_top( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + if( check ){ + try { + result = new ActionPersistTopDocument().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "取消文档置顶.", action = ActionPersistUnTopDocument.class) + @GET + @Path("{id}/unTop") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void persist_unTop( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + if( check ){ + try { + result = new ActionPersistUnTopDocument().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "分页查询符合过滤条件的已发布的信息内容.", action = ActionQueryListWithFilterPaging.class) + @PUT + @Path("filter/list/{page}/size/{size}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_listWithFilterPaging( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("分页") @PathParam("page") Integer page, + @JaxrsParameterDescribe("数量") @PathParam("size") Integer size, JsonElement jsonElement) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult> result = new ActionResult<>(); + Boolean check = true; + + if( check ){ + try { + result = new ActionQueryListWithFilterPaging().execute( request, page, size, jsonElement, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "获取文件访问控制信息.", action = ActionQueryGetControl.class) + @GET + @Path("{id}/control") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_getControl( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + if( check ){ + try { + result = new ActionQueryGetControl().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "获取文件可见范围内的所有人员.", action = ActionQueryListVisiblePersons.class) + @GET + @Path("{id}/persons") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_getVisiblePersons( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + if( check ){ + try { + result = new ActionQueryListVisiblePersons().execute( request, id, effectivePerson ); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "查询当前用户是否有阅读文档的权限.", action = ActionQueryPermissionReadDocument.class) + @GET + @Path("{id}/permission/read") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_PermissionReadDocument( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + + if( check ){ + try { + result = new ActionQueryPermissionReadDocument().execute(effectivePerson, id, null); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "列示文档数据.", action = ActionQueryListDocumentData.class) + @POST + @Path("list/document/data") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_listDocumentData( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement ) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult> result = new ActionResult<>(); + + try { + result = new ActionQueryListDocumentData().execute( request, effectivePerson, jsonElement ); + } catch (Exception e) { + result.error( e ); + logger.error( e, effectivePerson, request, jsonElement); + } + + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "查看文档数据.", action = ActionQueryGetDocumentData.class) + @GET + @Path("{id}/document/data") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void query_getDocumentData( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("信息文档ID") @PathParam("id") String id) { + EffectivePerson effectivePerson = this.effectivePerson( request ); + ActionResult result = new ActionResult<>(); + Boolean check = true; + + if( check ){ + try { + result = new ActionQueryGetDocumentData().execute(request, effectivePerson, id); + } catch (Exception e) { + result = new ActionResult<>(); + result.error( e ); + logger.error( e, effectivePerson, request, null); + } + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } +} \ No newline at end of file diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/file/FileAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/file/FileAction.java index 7600c05147f6001a1392f64283e1a2da8ce248df..4707daa471bfd810ae70c27461c7f648bb0cc745 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/file/FileAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/file/FileAction.java @@ -9,10 +9,8 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; @@ -28,7 +26,6 @@ import java.util.List; @JaxrsDescribe("资源文件管理") public class FileAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger(FileAction.class); @JaxrsMethodDescribe(value = "列示文件对象,下一页.", action = ActionListNext.class) @@ -42,7 +39,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListNext)proxy.getProxy(ActionListNext.class)).execute(id, count); + result = new ActionListNext().execute(id, count); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -61,7 +58,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListPrev)proxy.getProxy(ActionListPrev.class)).execute(id, count); + result = new ActionListPrev().execute(id, count); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -79,7 +76,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionGet)proxy.getProxy(ActionGet.class)).execute(effectivePerson, flag); + result = new ActionGet().execute(effectivePerson, flag); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -96,7 +93,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionCreate)proxy.getProxy(ActionCreate.class)).execute(effectivePerson, jsonElement); + result = new ActionCreate().execute(effectivePerson, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, jsonElement); result.error(e); @@ -114,7 +111,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionEdit)proxy.getProxy(ActionEdit.class)).execute(effectivePerson, id, jsonElement); + result = new ActionEdit().execute(effectivePerson, id, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, jsonElement); result.error(e); @@ -132,7 +129,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionDelete)proxy.getProxy(ActionDelete.class)).execute(effectivePerson, flag); + result = new ActionDelete().execute(effectivePerson, flag); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -150,7 +147,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListWithApp)proxy.getProxy(ActionListWithApp.class)).execute(effectivePerson, appInfoFlag); + result = new ActionListWithApp().execute(effectivePerson, appInfoFlag); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -171,7 +168,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionUpload)proxy.getProxy(ActionUpload.class)).execute(effectivePerson, id, fileName, bytes, disposition); + result = new ActionUpload().execute(effectivePerson, id, fileName, bytes, disposition); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -188,7 +185,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionDownload)proxy.getProxy(ActionDownload.class)).execute(effectivePerson, id); + result = new ActionDownload().execute(effectivePerson, id); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -205,7 +202,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionContent)proxy.getProxy(ActionContent.class)).execute(effectivePerson, id); + result = new ActionContent().execute(effectivePerson, id); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -223,7 +220,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionCopy)proxy.getProxy(ActionCopy.class)).execute(effectivePerson, flag, appInfoFlag); + result = new ActionCopy().execute(effectivePerson, flag, appInfoFlag); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -241,7 +238,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionDownloadWithApp)proxy.getProxy(ActionDownloadWithApp.class)).execute(effectivePerson, flag, appInfoFlag); + result = new ActionDownloadWithApp().execute(effectivePerson, flag, appInfoFlag); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -259,7 +256,7 @@ public class FileAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionContentWithApp)proxy.getProxy(ActionContentWithApp.class)).execute(effectivePerson, flag, appInfoFlag); + result = new ActionContentWithApp().execute(effectivePerson, flag, appInfoFlag); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionDelete.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionDelete.java index ce24fcf3b23e3dfe59ed84e4c38cf4ae8bb3aeee..a824ab38cd0f8b3f36fa79345fab124f14c099ae 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionDelete.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionDelete.java @@ -5,6 +5,7 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.annotation.CheckRemoveType; import com.x.base.core.project.annotation.AuditLog; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.config.StorageMapping; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; @@ -76,12 +77,12 @@ public class ActionDelete extends BaseAction { keys.add( "file.all" ); //清除文档的附件列表缓存 keys.add( "file." + id ); //清除指定ID的附件信息缓存 keys.add( ApplicationCache.concreteCacheKey( "document", document.getId(), isAnonymous, isManager ) ); //清除文档的附件列表缓存 - ApplicationCache.notify( FileInfo.class, keys ); + CacheManager.notify( FileInfo.class, keys ); keys.clear(); keys.add( ApplicationCache.concreteCacheKey( document.getId(), "view", isAnonymous, isManager ) ); //清除文档阅读缓存 keys.add( ApplicationCache.concreteCacheKey( document.getId(), "get", isManager ) ); //清除文档信息获取缓存 - ApplicationCache.notify( Document.class, keys ); + CacheManager.notify( Document.class, keys ); // 成功删除一个附件信息 logService.log(emc, effectivePerson.getDistinguishedName(), fileInfo.getName(), fileInfo.getAppId(), diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUpdate.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUpdate.java index fd92501720bcc9cb1be6bcf0606d97bff755cfdb..495c910462bef0d9623b10d0dc6829bbdcba43fc 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUpdate.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUpdate.java @@ -5,6 +5,7 @@ import java.util.UUID; import javax.servlet.http.HttpServletRequest; +import com.x.base.core.project.cache.CacheManager; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.apache.tika.Tika; @@ -125,7 +126,7 @@ public class ActionFileUpdate extends BaseAction { if (check) { try { - if ( documentQueryService.getFileInfoManagerAssess( effectivePerson, document, categoryInfo, appInfo ) ) { + if ( !documentQueryService.getFileInfoManagerAssess( effectivePerson, document, categoryInfo, appInfo ) ) { check = false; Exception exception = new ExceptionDocumentAccessDenied(effectivePerson.getDistinguishedName(), document.getTitle(), document.getId()); result.error(exception); @@ -191,7 +192,7 @@ public class ActionFileUpdate extends BaseAction { } //文件存储 - attachment.saveContent( mapping, bytes, fileName ); + attachment.updateContent( mapping, bytes, fileName ); //完成替换逻辑 attachment = fileInfoServiceAdv.updateAttachment( docId, old_attId, attachment, mapping ); // @@ -205,9 +206,9 @@ public class ActionFileUpdate extends BaseAction { // keys.add( ApplicationCache.concreteCacheKey( document.getId(), "view", isAnonymous, isManager ) ); //清除文档阅读缓存 // keys.add( ApplicationCache.concreteCacheKey( document.getId(), "get", isManager ) ); //清除文档信息获取缓存 // ApplicationCache.notify( Document.class, keys ); - - ApplicationCache.notify( FileInfo.class ); - ApplicationCache.notify( Document.class ); + + CacheManager.notify( FileInfo.class ); + CacheManager.notify( Document.class ); Wo wo = new Wo(); wo.setId( attachment.getId() ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUpdateCallback.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUpdateCallback.java index bc072f4aa86fa54c59d8a913c60c67b8992ed17a..3ff74f3719497d9d7d1ea8e0cdea142ed4e66ab2 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUpdateCallback.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUpdateCallback.java @@ -124,7 +124,7 @@ public class ActionFileUpdateCallback extends BaseAction { attachment.getText()); } - attachment.saveContent(mapping, bytes, fileName); + attachment.updateContent(mapping, bytes, fileName); attachment = fileInfoServiceAdv.updateAttachment( docId, old_attId, attachment, mapping ); // // List keys = new ArrayList<>(); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUploadCallback.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUploadCallback.java index 133e9ec4fb9c19edcb5206ccedd6cbabcb87bd88..9dbf5dc4b00addab0dae861e1fdfcde9b183c6d0 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUploadCallback.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionFileUploadCallback.java @@ -5,6 +5,7 @@ import java.util.UUID; import javax.servlet.http.HttpServletRequest; +import com.x.base.core.project.cache.CacheManager; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.apache.tika.Tika; @@ -128,9 +129,9 @@ public class ActionFileUploadCallback extends BaseAction { // keys.add( ApplicationCache.concreteCacheKey( document.getId(), "view", isAnonymous, isManager ) ); //清除文档阅读缓存 // keys.add( ApplicationCache.concreteCacheKey( document.getId(), "get", isManager ) ); //清除文档信息获取缓存 // ApplicationCache.notify( Document.class, keys ); - - ApplicationCache.notify( FileInfo.class ); - ApplicationCache.notify( Document.class ); + + CacheManager.notify( FileInfo.class ); + CacheManager.notify( Document.class ); WoObject woObject = new WoObject(); woObject.setId(attachment.getId()); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/FileInfoAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/FileInfoAction.java index b41e25fa261411c95dcff1ce96b5cae9a03dd076..2ce40936efa5c05389c15ee7c117dff66def5e5f 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/FileInfoAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/FileInfoAction.java @@ -10,10 +10,8 @@ import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.http.WrapOutString; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; @@ -29,7 +27,6 @@ import java.util.List; @JaxrsDescribe("附件信息管理") public class FileInfoAction extends StandardJaxrsAction{ - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger( FileInfoAction.class ); @JaxrsMethodDescribe(value = "获取全部的文件或者附件列表.", action = ActionListAll.class) @@ -41,7 +38,7 @@ public class FileInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListAll)proxy.getProxy(ActionListAll.class)).execute( request, effectivePerson ); + result = new ActionListAll().execute( request, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); result.error( e ); @@ -60,7 +57,7 @@ public class FileInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListByDocId)proxy.getProxy(ActionListByDocId.class)).execute( request, effectivePerson, documentId ); + result = new ActionListByDocId().execute( request, effectivePerson, documentId ); } catch (Exception e) { result = new ActionResult<>(); result.error( e ); @@ -80,7 +77,7 @@ public class FileInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult result = new ActionResult<>(); try { - result = ((ActionGet)proxy.getProxy(ActionGet.class)).execute( request, effectivePerson, id, documentId ); + result = new ActionGet().execute( request, effectivePerson, id, documentId ); } catch (Exception e) { result = new ActionResult<>(); result.error( e ); @@ -99,7 +96,7 @@ public class FileInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult result = new ActionResult<>(); try { - result = ((ActionDelete)proxy.getProxy(ActionDelete.class)).execute( request, effectivePerson, id ); + result = new ActionDelete().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); result.error( e ); @@ -119,7 +116,7 @@ public class FileInfoAction extends StandardJaxrsAction{ EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult result = new ActionResult<>(); try { - result = ((ActionImageToBase64)proxy.getProxy(ActionImageToBase64.class)).execute( request, effectivePerson, id, size ); + result = new ActionImageToBase64().execute( request, effectivePerson, id, size ); } catch (Exception e) { result = new ActionResult<>(); result.error( e ); @@ -138,7 +135,7 @@ public class FileInfoAction extends StandardJaxrsAction{ ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionFileDownload)proxy.getProxy(ActionFileDownload.class)).execute(request, effectivePerson, id); + result = new ActionFileDownload().execute(request, effectivePerson, id); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -156,7 +153,7 @@ public class FileInfoAction extends StandardJaxrsAction{ ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionFileDownloadStream)proxy.getProxy(ActionFileDownloadStream.class)).execute(request, effectivePerson, id ); + result = new ActionFileDownloadStream().execute(request, effectivePerson, id ); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -175,7 +172,7 @@ public class FileInfoAction extends StandardJaxrsAction{ ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionFileEdit)proxy.getProxy(ActionFileEdit.class)).execute( request, effectivePerson, id, docId, jsonElement); + result = new ActionFileEdit().execute( request, effectivePerson, id, docId, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -198,7 +195,7 @@ public class FileInfoAction extends StandardJaxrsAction{ ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionFileUpload)proxy.getProxy(ActionFileUpload.class)).execute(request, effectivePerson, docId, site, fileName, bytes, disposition); + result = new ActionFileUpload().execute(request, effectivePerson, docId, site, fileName, bytes, disposition); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -222,7 +219,7 @@ public class FileInfoAction extends StandardJaxrsAction{ ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionFileUpdate)proxy.getProxy(ActionFileUpdate.class)).execute(request, effectivePerson, docId, id, site, fileName, bytes, disposition); + result = new ActionFileUpdate().execute(request, effectivePerson, docId, id, site, fileName, bytes, disposition); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -245,7 +242,7 @@ public class FileInfoAction extends StandardJaxrsAction{ ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionFileUploadCallback)proxy.getProxy(ActionFileUploadCallback.class)).execute(request, effectivePerson, docId, callback, site, fileName, bytes, disposition); + result = new ActionFileUploadCallback().execute(request, effectivePerson, docId, callback, site, fileName, bytes, disposition); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -270,7 +267,7 @@ public class FileInfoAction extends StandardJaxrsAction{ ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionFileUpdateCallback)proxy.getProxy(ActionFileUpdateCallback.class)).execute(request, effectivePerson, docId, id, callback, site, fileName, bytes, disposition); + result = new ActionFileUpdateCallback().execute(request, effectivePerson, docId, id, callback, site, fileName, bytes, disposition); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/form/FormAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/form/FormAction.java index 3f2aa540cd4892cce7a8cf2f4270b1a4259f88dc..724f65e91e406a7c8158ec24d57c8323d89b9177 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/form/FormAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/form/FormAction.java @@ -7,10 +7,8 @@ import com.x.base.core.project.annotation.JaxrsParameterDescribe; import com.x.base.core.project.http.*; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -24,7 +22,6 @@ import java.util.List; @JaxrsDescribe("表单信息管理") public class FormAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger( FormAction.class ); @JaxrsMethodDescribe(value = "获取全部的表单模板列表.", action = ActionListAll.class) @@ -36,7 +33,7 @@ public class FormAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListAll)proxy.getProxy(ActionListAll.class)).execute( request, effectivePerson ); + result = new ActionListAll().execute( request, effectivePerson ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionServiceLogic( e, "系统在查询所有CMS表单时发生异常。" ); @@ -56,7 +53,7 @@ public class FormAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListByApp)proxy.getProxy(ActionListByApp.class)).execute( request, effectivePerson, appId ); + result = new ActionListByApp().execute( request, effectivePerson, appId ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionServiceLogic( e, "系统在根据栏目ID查询表单时发生异常。" ); @@ -76,7 +73,7 @@ public class FormAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult result = new ActionResult<>(); try { - result = ((ActionGet)proxy.getProxy(ActionGet.class)).execute( request, effectivePerson, id ); + result = new ActionGet().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionServiceLogic( e, "系统在根据ID查询表单时发生异常。" ); @@ -97,7 +94,7 @@ public class FormAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionGetWithAppInfo)proxy.getProxy(ActionGetWithAppInfo.class)).execute(request, effectivePerson, appFlag, formFlag); + result = new ActionGetWithAppInfo().execute(request, effectivePerson, appFlag, formFlag); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -116,7 +113,7 @@ public class FormAction extends StandardJaxrsAction { if( check ){ try { - result = ((ActionSave)proxy.getProxy(ActionSave.class)).execute( request, effectivePerson, null, jsonElement ); + result = new ActionSave().execute( request, effectivePerson, null, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); result.error( e ); @@ -139,7 +136,7 @@ public class FormAction extends StandardJaxrsAction { if( check ){ try { - result = ((ActionSave)proxy.getProxy(ActionSave.class)).execute( request, effectivePerson, id, jsonElement ); + result = new ActionSave().execute( request, effectivePerson, id, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); result.error( e ); @@ -159,7 +156,7 @@ public class FormAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult result = new ActionResult<>(); try { - result = ((ActionDelete)proxy.getProxy(ActionDelete.class)).execute( request, effectivePerson, id ); + result = new ActionDelete().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionServiceLogic( e, "系统在根据ID删除表单时发生异常。" ); @@ -182,7 +179,7 @@ public class FormAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListNextWithFilter)proxy.getProxy(ActionListNextWithFilter.class)).execute( request, effectivePerson, id, count, appId, jsonElement ); + result = new ActionListNextWithFilter().execute( request, effectivePerson, id, count, appId, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionServiceLogic( e, "系统在查询所有CMS表单时发生异常。" ); @@ -205,7 +202,7 @@ public class FormAction extends StandardJaxrsAction { EffectivePerson effectivePerson = this.effectivePerson( request ); ActionResult> result = new ActionResult<>(); try { - result = ((ActionListPrevWithFilter)proxy.getProxy(ActionListPrevWithFilter.class)).execute( request, effectivePerson, id, count, appId, jsonElement ); + result = new ActionListPrevWithFilter().execute( request, effectivePerson, id, count, appId, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionServiceLogic( e, "系统在查询所有CMS表单时发生异常。" ); @@ -226,7 +223,7 @@ public class FormAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListFormFieldWithAppInfo)proxy.getProxy(ActionListFormFieldWithAppInfo.class)).execute(applicationId); + result = new ActionListFormFieldWithAppInfo().execute(applicationId); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -244,7 +241,7 @@ public class FormAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListFormFieldWithForm)proxy.getProxy(ActionListFormFieldWithForm.class)).execute(id); + result = new ActionListFormFieldWithForm().execute(id); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/image/ImageAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/image/ImageAction.java index 7ddab392e1a751b943c6e30295f2efcaabc9412d..b7e04c9d37ba4526317f809ecc0e7fc2c61a24ea 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/image/ImageAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/image/ImageAction.java @@ -9,10 +9,8 @@ import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.http.WrapOutString; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; @@ -27,7 +25,6 @@ import javax.ws.rs.core.MediaType; @JaxrsDescribe("附件信息管理") public class ImageAction extends StandardJaxrsAction{ - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger( ImageAction.class ); @JaxrsMethodDescribe(value = "将上传的图片传为base64.", action = ActionImageBase64Encode.class) @@ -43,7 +40,7 @@ public class ImageAction extends StandardJaxrsAction{ ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionImageBase64Encode)proxy.getProxy(ActionImageBase64Encode.class)).execute(request, effectivePerson, size, bytes, disposition); + result = new ActionImageBase64Encode().execute(request, effectivePerson, size, bytes, disposition); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -64,7 +61,7 @@ public class ImageAction extends StandardJaxrsAction{ ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionImageChangeSize)proxy.getProxy(ActionImageChangeSize.class)).execute(request, effectivePerson, id, width, height); + result = new ActionImageChangeSize().execute(request, effectivePerson, id, width, height); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/input/ActionCover.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/input/ActionCover.java index 05331343534be5037808ca5ae5dee072440d970e..0418b4f3b140fbcd121c3895ca475dab956aafff 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/input/ActionCover.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/input/ActionCover.java @@ -59,6 +59,10 @@ class ActionCover extends BaseAction { appInfo.setAppName(this.idleAppInfoName(business, appInfo.getAppName(), appInfo.getId())); appInfo.setAppAlias(this.idleAppInfoAlias(business, appInfo.getAppAlias(), appInfo.getId())); persistObjects.add(appInfo); + }else{ + WrapCms.inCopier.copy(wi, appInfo); + appInfo.setAppName(this.idleAppInfoName(business, appInfo.getAppName(), appInfo.getId())); + appInfo.setAppAlias(this.idleAppInfoAlias(business, appInfo.getAppAlias(), appInfo.getId())); } //2020年1月16日 O2LEE 保存栏目信息对应的配置支持信息JSON ---->start diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/output/OutputAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/output/OutputAction.java index 3a97c0b6c9411bb19801ab60eff8b33ae5af3f6e..d16496bf998d35f6c6387ad79e66b23adcfe3ccf 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/output/OutputAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/output/OutputAction.java @@ -26,8 +26,6 @@ import java.util.List; @JaxrsDescribe("导出CMS") public class OutputAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); - private static Logger logger = LoggerFactory.getLogger(OutputAction.class); @JaxrsMethodDescribe(value = "选择栏目结构.", action = ActionSelect.class) @@ -41,7 +39,7 @@ public class OutputAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionSelect)proxy.getProxy(ActionSelect.class)).execute(effectivePerson, appInfoFlag, jsonElement); + result = new ActionSelect().execute(effectivePerson, appInfoFlag, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, jsonElement); result.error(e); @@ -58,7 +56,7 @@ public class OutputAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionList)proxy.getProxy(ActionList.class)).execute(effectivePerson); + result = new ActionList().execute(effectivePerson); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoManagerSave.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoManagerSave.java index 4da5edf3420ac98b8ab0dbe04741bfed2087e647..af54341b5fb85b910104f1ade570ad0a6cab58b7 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoManagerSave.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoManagerSave.java @@ -4,6 +4,7 @@ import com.google.gson.JsonElement; import com.x.base.core.project.annotation.AuditLog; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -70,7 +71,7 @@ public class ActionAppInfoManagerSave extends BaseAction { if( check ){ String description = "栏目:"+appId+"权限变更"; new LogService().log( null, effectivePerson.getDistinguishedName(), description, appId, "", "", appId, "APPINFO_MANAGER", "管理权限变更" ); - ApplicationCache.notify( AppInfo.class ); + CacheManager.notify( AppInfo.class ); Wo wo = new Wo(); wo.setId( appId ); result.setData( wo ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoPublisherSave.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoPublisherSave.java index 56e8f8c8585b0c5da0a4c04166cb0e7cec638ba9..6f2a1504d6b583db7ab39cfacf1d32f3a02e302a 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoPublisherSave.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoPublisherSave.java @@ -4,6 +4,7 @@ import com.google.gson.JsonElement; import com.x.base.core.project.annotation.AuditLog; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -70,8 +71,8 @@ public class ActionAppInfoPublisherSave extends BaseAction { if( check ){ String description = "栏目:"+appId+"权限变更"; new LogService().log( null, effectivePerson.getDistinguishedName(), description, appId, "", "", appId, "APPINFO_PUBLISHER", "发布权限变更" ); - - ApplicationCache.notify( AppInfo.class ); + + CacheManager.notify( AppInfo.class ); Wo wo = new Wo(); wo.setId( appId ); result.setData( wo ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoViewerSave.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoViewerSave.java index 313f81b12ad6f09db2e1504cce55a4b9a96d7510..d012c90ddd527e504e9a28fd0b293a33241e1b7b 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoViewerSave.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionAppInfoViewerSave.java @@ -4,6 +4,7 @@ import com.google.gson.JsonElement; import com.x.base.core.project.annotation.AuditLog; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -70,8 +71,8 @@ public class ActionAppInfoViewerSave extends BaseAction { if( check ){ String description = "栏目:"+appId+"权限变更"; new LogService().log( null, effectivePerson.getDistinguishedName(), description, appId, "", "", appId, "APPINFO_VIEWER", "可见权限变更" ); - - ApplicationCache.notify( AppInfo.class ); + + CacheManager.notify( AppInfo.class ); Wo wo = new Wo(); wo.setId( appId ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoManagerSave.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoManagerSave.java index a6cb65ee255814889e4d7fa17fd243e73ebd609e..b5353c01bd4782816d523e3050c74f4562233da3 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoManagerSave.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoManagerSave.java @@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletRequest; import com.google.gson.JsonElement; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -70,9 +71,9 @@ public class ActionCategoryInfoManagerSave extends BaseAction { if( check ){ String description = "分类:"+categoryId+"权限变更"; new LogService().log( null, effectivePerson.getDistinguishedName(), description, categoryId, "", "", categoryId, "CATEGORYINFO_MANAGER", "管理权限变更" ); - - ApplicationCache.notify( AppInfo.class ); - ApplicationCache.notify( CategoryInfo.class ); + + CacheManager.notify( AppInfo.class ); + CacheManager.notify( CategoryInfo.class ); Wo wo = new Wo(); wo.setId( categoryId ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoPublisherSave.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoPublisherSave.java index f7c37aff75fbaef7f38ccb999547cb199012120e..061b9326d005160453d0d21fa74be9863c5d0005 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoPublisherSave.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoPublisherSave.java @@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletRequest; import com.google.gson.JsonElement; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -70,9 +71,9 @@ public class ActionCategoryInfoPublisherSave extends BaseAction { if( check ){ String description = "分类:"+categoryId+"权限变更"; new LogService().log( null, effectivePerson.getDistinguishedName(), description, categoryId, "", "", categoryId, "CATEGORYINFO_PUBLISHER", "发布权限变更" ); - - ApplicationCache.notify( AppInfo.class ); - ApplicationCache.notify( CategoryInfo.class ); + + CacheManager.notify( AppInfo.class ); + CacheManager.notify( CategoryInfo.class ); Wo wo = new Wo(); wo.setId( categoryId ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoViewerSave.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoViewerSave.java index fd3d3d1bc3d5aab3feca50c13a074e31d49f9d56..bb73ad2ef96405e08b73f9a43346ec9fb2f87472 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoViewerSave.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionCategoryInfoViewerSave.java @@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletRequest; import com.google.gson.JsonElement; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -70,9 +71,9 @@ public class ActionCategoryInfoViewerSave extends BaseAction { if( check ){ String description = "分类:"+categoryId+"权限变更"; new LogService().log( null, effectivePerson.getDistinguishedName(), description, categoryId, "", "", categoryId, "CATEGORYINFO_VIEWER", "可见范围变更" ); - - ApplicationCache.notify( AppInfo.class ); - ApplicationCache.notify( CategoryInfo.class ); + + CacheManager.notify( AppInfo.class ); + CacheManager.notify( CategoryInfo.class ); Wo wo = new Wo(); wo.setId( categoryId ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionRefreshAllDocumentPermission.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionRefreshAllDocumentPermission.java index e0b86425cab44e1fc09fd909f41a8f1bac340082..10f8a8212d77112bfcd4f6881c7a6c04e0eee295 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionRefreshAllDocumentPermission.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionRefreshAllDocumentPermission.java @@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.permission; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.logger.Logger; @@ -34,7 +35,7 @@ public class ActionRefreshAllDocumentPermission extends BaseAction { logger.error(e, effectivePerson, request, null); } } - ApplicationCache.notify(Document.class); + CacheManager.notify(Document.class); return result; } diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionRefreshDocumentPermission.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionRefreshDocumentPermission.java index 17b50e2005984918325c05ca3af1805348812cc9..905af8b77151872ce7df3d67710b614808e25576 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionRefreshDocumentPermission.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/ActionRefreshDocumentPermission.java @@ -5,6 +5,7 @@ import com.x.base.core.entity.JpaObject; import com.x.base.core.project.annotation.AuditLog; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -84,7 +85,7 @@ public class ActionRefreshDocumentPermission extends BaseAction { } - ApplicationCache.notify( Document.class ); + CacheManager.notify( Document.class ); return result; } diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionAction.java index 905218357d093e11537222b9eddd057263111554..a902272b76bb60da1fdac5fb3a4a5ed43f0ff2c4 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionAction.java @@ -25,7 +25,6 @@ import javax.ws.rs.core.MediaType; @JaxrsDescribe("栏目分类权限配置操作") public class PermissionAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger( PermissionAction.class ); @JaxrsMethodDescribe(value = "查询登录用户是否指定栏目的管理员.", action = ActionIsAppInfoManager.class) @@ -40,7 +39,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionIsAppInfoManager)proxy.getProxy(ActionIsAppInfoManager.class)).execute( request, effectivePerson, id ); + result = new ActionIsAppInfoManager().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "查询登录用户是否指定栏目的管理员时发生异常。" ); @@ -63,7 +62,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionIsCategoryInfoManager)proxy.getProxy(ActionIsCategoryInfoManager.class)).execute( request, effectivePerson, id ); + result = new ActionIsCategoryInfoManager().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "查询登录用户是否指定分类的管理员时发生异常。" ); @@ -86,7 +85,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionListAppInfoManagers)proxy.getProxy(ActionListAppInfoManagers.class)).execute( request, effectivePerson, id ); + result = new ActionListAppInfoManagers().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "查询栏目管理员信息列表时发生异常。" ); @@ -109,7 +108,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionListAppInfoPublishers)proxy.getProxy(ActionListAppInfoPublishers.class)).execute( request, effectivePerson, id ); + result = new ActionListAppInfoPublishers().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "查询栏目发布者信息列表时发生异常。" ); @@ -132,7 +131,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionListAppInfoViewers)proxy.getProxy(ActionListAppInfoViewers.class)).execute( request, effectivePerson, id ); + result = new ActionListAppInfoViewers().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "查询栏目可见范围信息时发生异常。" ); @@ -155,7 +154,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionListCategoryInfoManagers)proxy.getProxy(ActionListCategoryInfoManagers.class)).execute( request, effectivePerson, id ); + result = new ActionListCategoryInfoManagers().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "查询分类管理员信息列表时发生异常。" ); @@ -178,7 +177,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionListCategoryInfoPublishers)proxy.getProxy(ActionListCategoryInfoPublishers.class)).execute( request, effectivePerson, id ); + result = new ActionListCategoryInfoPublishers().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "查询分类发布者信息列表时发生异常。" ); @@ -201,7 +200,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionListCategoryInfoViewers)proxy.getProxy(ActionListCategoryInfoViewers.class)).execute( request, effectivePerson, id ); + result = new ActionListCategoryInfoViewers().execute( request, effectivePerson, id ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "查询分类发布范围信息时发生异常。" ); @@ -224,7 +223,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionAppInfoManagerSave)proxy.getProxy(ActionAppInfoManagerSave.class)).execute( request, effectivePerson, id, jsonElement ); + result = new ActionAppInfoManagerSave().execute( request, effectivePerson, id, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "栏目管理员权限更新时发生异常。" ); @@ -247,7 +246,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionAppInfoPublisherSave)proxy.getProxy(ActionAppInfoPublisherSave.class)).execute( request, effectivePerson, id, jsonElement ); + result = new ActionAppInfoPublisherSave().execute( request, effectivePerson, id, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "栏目发布者权限更新时发生异常。" ); @@ -270,7 +269,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionAppInfoViewerSave)proxy.getProxy(ActionAppInfoViewerSave.class)).execute( request, effectivePerson, id, jsonElement ); + result = new ActionAppInfoViewerSave().execute( request, effectivePerson, id, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "栏目可见范围权限更新时发生异常。" ); @@ -293,7 +292,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionCategoryInfoManagerSave)proxy.getProxy(ActionCategoryInfoManagerSave.class)).execute( request, effectivePerson, id, jsonElement ); + result = new ActionCategoryInfoManagerSave().execute( request, effectivePerson, id, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "分类管理员权限更新时发生异常。" ); @@ -316,7 +315,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionCategoryInfoPublisherSave)proxy.getProxy(ActionCategoryInfoPublisherSave.class)).execute( request, effectivePerson, id, jsonElement ); + result = new ActionCategoryInfoPublisherSave().execute( request, effectivePerson, id, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "分类发布者权限更新时发生异常。" ); @@ -339,7 +338,7 @@ public class PermissionAction extends StandardJaxrsAction { Boolean check = true; if( check ){ try { - result = ((ActionCategoryInfoViewerSave)proxy.getProxy(ActionCategoryInfoViewerSave.class)).execute( request, effectivePerson, id, jsonElement ); + result = new ActionCategoryInfoViewerSave().execute( request, effectivePerson, id, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionAppCategoryAdminProcess( e, "分类可见范围权限更新时发生异常。" ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionForDocumentAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionForDocumentAction.java index 6e7ad5b9782137f0232648f202f215f88487cd9e..8132ffc09131816bc2ba76cf29c83ccc70fa0043 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionForDocumentAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionForDocumentAction.java @@ -8,10 +8,8 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; @@ -27,7 +25,6 @@ import javax.ws.rs.core.MediaType; @JaxrsDescribe("信息文档发布权限管理") public class PermissionForDocumentAction extends StandardJaxrsAction{ - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger( PermissionForDocumentAction.class ); @JaxrsMethodDescribe(value = "刷新信息文档发布权限.", action = ActionRefreshDocumentPermission.class) @@ -41,7 +38,7 @@ public class PermissionForDocumentAction extends StandardJaxrsAction{ if(check){ try { - result = ((ActionRefreshDocumentPermission)proxy.getProxy(ActionRefreshDocumentPermission.class)).execute( request, effectivePerson, jsonElement ); + result = new ActionRefreshDocumentPermission().execute( request, effectivePerson, jsonElement ); } catch (Exception e) { result = new ActionResult<>(); Exception exception = new ExceptionServiceLogic( e, "系统在更新文档的访问和管理权限过程中发生异常!" ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionManagerAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionManagerAction.java index 6c0b078ad4c5225cf7bd96e3fa4cc4a4db466efa..5c227671b3276cb563890c5422da81efd7ac394e 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionManagerAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/permission/PermissionManagerAction.java @@ -7,10 +7,8 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -23,7 +21,6 @@ import javax.ws.rs.core.MediaType; @JaxrsDescribe("文档权限操作服务(管理员)") public class PermissionManagerAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger( PermissionManagerAction.class ); @JaxrsMethodDescribe(value = "重新计算所有文档的权限信息.", action = ActionRefreshAllDocumentPermission.class) diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryview/QueryViewAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryview/QueryViewAction.java index 5a687e74b302106317af980bde27e6762d753fe9..644915d33dd7b185919ca415f7f036665ae51e77 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryview/QueryViewAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryview/QueryViewAction.java @@ -8,8 +8,6 @@ import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; -import com.x.cms.assemble.control.ThisApplication; import com.x.cms.core.entity.query.Query; import javax.servlet.http.HttpServletRequest; @@ -25,8 +23,6 @@ import java.util.List; @JaxrsDescribe("数据视图信息管理") public class QueryViewAction extends BaseAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); - @JaxrsMethodDescribe(value = "列示所有栏目中的数据视图信息.", action = ActionListAll.class) @GET @Path("list/all") @@ -36,7 +32,7 @@ public class QueryViewAction extends BaseAction { ActionResult> result = new ActionResult<>(); try { EffectivePerson effectivePerson = this.effectivePerson( request ); - result = ((ActionListAll)proxy.getProxy(ActionListAll.class)).execute( request, effectivePerson); + result = new ActionListAll().execute( request, effectivePerson); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -53,7 +49,7 @@ public class QueryViewAction extends BaseAction { ActionResult> result = new ActionResult<>(); try { EffectivePerson effectivePerson = this.effectivePerson( request ); - result = ((ActionList)proxy.getProxy(ActionList.class)).execute( request, effectivePerson); + result = new ActionList().execute( request, effectivePerson); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -71,7 +67,7 @@ public class QueryViewAction extends BaseAction { ActionResult result = new ActionResult<>(); try { EffectivePerson effectivePerson = this.effectivePerson(request); - result = ((ActionFlag)proxy.getProxy(ActionFlag.class)).execute( request, effectivePerson, flag); + result = new ActionFlag().execute( request, effectivePerson, flag); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -94,7 +90,7 @@ public class QueryViewAction extends BaseAction { if( check ){ try { - result = ((ActionExecute)proxy.getProxy(ActionExecute.class)).execute( request, effectivePerson, flag, appId, jsonElement); + result = new ActionExecute().execute( request, effectivePerson, flag, appId, jsonElement); } catch (Throwable th) { th.printStackTrace(); result.error(th); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionCreate.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionCreate.java index 683d929225acc200f72e36fef49c429f7b1ed8c3..50de3f2b1afa06b8471857590e523d1b117fc317 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionCreate.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionCreate.java @@ -14,6 +14,7 @@ import com.x.base.core.entity.annotation.CheckPersistType; import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -59,7 +60,7 @@ class ActionCreate extends BaseAction { emc.beginTransaction(QueryView.class); emc.persist(queryView, CheckPersistType.all); emc.commit(); - ApplicationCache.notify(QueryView.class); + CacheManager.notify(QueryView.class); Wo wo = new Wo(); wo.setId(queryView.getId()); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionDelete.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionDelete.java index bff3150206aacba27090c3ab038ff3c0509e6477..000e8a73abc95dd35561578f7ed5485ff8c77377 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionDelete.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionDelete.java @@ -4,6 +4,7 @@ import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.annotation.CheckRemoveType; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.exception.ExceptionWhen; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; @@ -22,7 +23,7 @@ class ActionDelete extends BaseAction { //business.applicationEditAvailable(effectivePerson, application, ExceptionWhen.not_allow); emc.remove(queryView, CheckRemoveType.all); emc.commit(); - ApplicationCache.notify(QueryView.class); + CacheManager.notify(QueryView.class); Wo wo = new Wo(); wo.setId( queryView.getId() ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionUpdate.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionUpdate.java index 886c4ec2055189c581bdcf145b88df34669ed2af..4f3a78e0782642b989681b064db48882b0f2d085 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionUpdate.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/ActionUpdate.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import com.x.base.core.project.cache.CacheManager; import org.apache.commons.lang3.StringUtils; import com.google.gson.JsonElement; @@ -49,7 +50,7 @@ class ActionUpdate extends BaseAction { this.transQuery(queryView); emc.check(queryView, CheckPersistType.all); emc.commit(); - ApplicationCache.notify(QueryView.class); + CacheManager.notify(QueryView.class); Wo wo = new Wo(); wo.setId( queryView.getId() ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/QueryViewDesignAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/QueryViewDesignAction.java index c16f79de18bc186b115921c311fca59f1ac3204c..993bdca347b405b798a56047daf1791800ec0ebc 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/QueryViewDesignAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/queryviewdesign/QueryViewDesignAction.java @@ -8,9 +8,7 @@ import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.cms.assemble.control.ExceptionWrapInConvert; -import com.x.cms.assemble.control.ThisApplication; import com.x.cms.core.entity.query.Query; import javax.servlet.http.HttpServletRequest; @@ -25,8 +23,6 @@ import java.util.List; @JaxrsDescribe("数据视图设计信息管理") public class QueryViewDesignAction extends BaseAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); - @JaxrsMethodDescribe(value = "列示数据视图设计信息对象,下一页.", action = ActionListNext.class) @GET @Path("list/{id}/next/{count}") @@ -38,7 +34,7 @@ public class QueryViewDesignAction extends BaseAction { ) { ActionResult> result = new ActionResult<>(); try { - result = ((ActionListNext)proxy.getProxy(ActionListNext.class)).execute(id, count); + result = new ActionListNext().execute(id, count); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -57,7 +53,7 @@ public class QueryViewDesignAction extends BaseAction { ) { ActionResult> result = new ActionResult<>(); try { - result = ((ActionListPrev)proxy.getProxy(ActionListPrev.class)).execute(id, count); + result = new ActionListPrev().execute(id, count); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -75,7 +71,7 @@ public class QueryViewDesignAction extends BaseAction { ActionResult result = new ActionResult<>(); try { EffectivePerson effectivePerson = this.effectivePerson(request); - result = ((ActionFlag)proxy.getProxy(ActionFlag.class)).execute(effectivePerson, flag); + result = new ActionFlag().execute(effectivePerson, flag); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -93,7 +89,7 @@ public class QueryViewDesignAction extends BaseAction { ActionResult result = new ActionResult<>(); try { EffectivePerson effectivePerson = this.effectivePerson(request); - result = ((ActionGet)proxy.getProxy(ActionGet.class)).execute(effectivePerson, id); + result = new ActionGet().execute(effectivePerson, id); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -112,7 +108,7 @@ public class QueryViewDesignAction extends BaseAction { if( check ){ try { - result = ((ActionCreate)proxy.getProxy(ActionCreate.class)).execute( request, effectivePerson, jsonElement ); + result = new ActionCreate().execute( request, effectivePerson, jsonElement ); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -136,7 +132,7 @@ public class QueryViewDesignAction extends BaseAction { if( check ){ try { - result = ((ActionUpdate)proxy.getProxy(ActionUpdate.class)).execute(effectivePerson, id, jsonElement ); + result = new ActionUpdate().execute(effectivePerson, id, jsonElement ); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -155,7 +151,7 @@ public class QueryViewDesignAction extends BaseAction { ActionResult result = new ActionResult<>(); try { EffectivePerson effectivePerson = this.effectivePerson(request); - result = ((ActionDelete)proxy.getProxy(ActionDelete.class)).execute( effectivePerson, id ); + result = new ActionDelete().execute( effectivePerson, id ); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -173,7 +169,7 @@ public class QueryViewDesignAction extends BaseAction { ActionResult> result = new ActionResult<>(); try { EffectivePerson effectivePerson = this.effectivePerson(request); - result = ((ActionListWithApplication)proxy.getProxy(ActionListWithApplication.class)).execute(effectivePerson, applicationId); + result = new ActionListWithApplication().execute(effectivePerson, applicationId); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -203,7 +199,7 @@ public class QueryViewDesignAction extends BaseAction { } if( check ){ try { - result = ((ActionSimulate)proxy.getProxy(ActionSimulate.class)).execute(effectivePerson, flag, wrapIn); + result = new ActionSimulate().execute(effectivePerson, flag, wrapIn); } catch (Throwable th) { th.printStackTrace(); result.error(th); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ActionUpdate.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ActionUpdate.java index b133761acaae0ecd9402cc1b387ff343af2bbd0d..06681c091a26bb211e66b97e860fd4296d89526d 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ActionUpdate.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ActionUpdate.java @@ -8,7 +8,6 @@ import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.JpaObject; import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.cache.ApplicationCache; import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.ActionResult; @@ -18,22 +17,21 @@ import com.x.cms.assemble.control.ExceptionWrapInConvert; import com.x.cms.core.entity.Log; import com.x.cms.core.entity.element.Script; - class ActionUpdate extends BaseAction { - ActionResult execute( EffectivePerson effectivePerson, String id, JsonElement jsonElement ) throws Exception { + ActionResult execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception { ActionResult result = new ActionResult<>(); Wi wrapIn = null; Boolean check = true; - + try { - wrapIn = this.convertToWrapIn( jsonElement, Wi.class ); - } catch (Exception e ) { + wrapIn = this.convertToWrapIn(jsonElement, Wi.class); + } catch (Exception e) { check = false; - Exception exception = new ExceptionWrapInConvert( e, jsonElement ); - result.error( exception ); + Exception exception = new ExceptionWrapInConvert(e, jsonElement); + result.error(exception); e.printStackTrace(); } - if( check ){ + if (check) { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { Script script = emc.find(id, Script.class); if (null == script) { @@ -41,19 +39,19 @@ class ActionUpdate extends BaseAction { } emc.beginTransaction(Script.class); wrapIn.copyTo(script, JpaObject.ID_DISTRIBUTEFACTOR); - script.setLastUpdatePerson( effectivePerson.getDistinguishedName()); + script.setLastUpdatePerson(effectivePerson.getDistinguishedName()); script.setLastUpdateTime(new Date()); emc.commit(); // 清除所有的Script缓存 CacheManager.notify(Script.class); - // 记录日志 emc.beginTransaction(Log.class); - logService.log(emc, effectivePerson.getDistinguishedName(), script.getName(), script.getAppId(), "", "", script.getId(), "SCRIPT", "更新"); + logService.log(emc, effectivePerson.getDistinguishedName(), script.getName(), script.getAppId(), "", "", + script.getId(), "SCRIPT", "更新"); emc.commit(); - + Wo wo = new Wo(); - wo.setId( script.getId() ); + wo.setId(script.getId()); result.setData(wo); } catch (Throwable th) { th.printStackTrace(); @@ -62,36 +60,36 @@ class ActionUpdate extends BaseAction { } return result; } - + public class Wi extends GsonPropertyObject { @FieldDescribe("创建时间.") private Date createTime; - + @FieldDescribe("更新时间.") private Date updateTime; - + @FieldDescribe("ID.") private String id; - + @FieldDescribe("脚本名称.") private String name; - + @FieldDescribe("脚本别名.") private String alias; - + @FieldDescribe("脚本说明.") private String description; - + @FieldDescribe("是否验证成功.") private Boolean validated; - + @FieldDescribe("所属栏目ID.") private String appId; - + @FieldDescribe("脚本内容.") private String text; - + @FieldDescribe("依赖的脚本ID列表.") private List dependScriptList; @@ -176,7 +174,7 @@ class ActionUpdate extends BaseAction { } } - + public static class Wo extends WoId { } diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAction.java index 76b4a940df2de5b321407d4b9dc82440d54772da..cbbb422cb4d6c5801bff6265c36e0000a0798a9a 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAction.java @@ -25,16 +25,13 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.cms.assemble.control.ThisApplication; @Path("script") @JaxrsDescribe("脚本信息管理") public class ScriptAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); private static Logger logger = LoggerFactory.getLogger(ScriptAction.class); @JaxrsMethodDescribe(value = "根据ID获取指定的脚本信息.", action = ActionGet.class) @@ -47,7 +44,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionGet) proxy.getProxy(ActionGet.class)).execute(effectivePerson, id); + result = new ActionGet().execute(effectivePerson, id); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -64,7 +61,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionCreate) proxy.getProxy(ActionCreate.class)).execute(request, effectivePerson, jsonElement); + result = new ActionCreate().execute(request, effectivePerson, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, jsonElement); result.error(e); @@ -82,7 +79,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionUpdate) proxy.getProxy(ActionUpdate.class)).execute(effectivePerson, id, jsonElement); + result = new ActionUpdate().execute(effectivePerson, id, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, jsonElement); result.error(e); @@ -100,7 +97,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionDelete) proxy.getProxy(ActionDelete.class)).execute(effectivePerson, id); + result = new ActionDelete().execute(effectivePerson, id); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -118,8 +115,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListWithApplication) proxy.getProxy(ActionListWithApplication.class)) - .execute(effectivePerson, flag); + result = new ActionListWithApplication().execute(effectivePerson, flag); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -138,8 +134,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionGetWithAppAndName) proxy.getProxy(ActionGetWithAppAndName.class)).execute(effectivePerson, - appId, name); + result = new ActionGetWithAppAndName().execute(effectivePerson, appId, name); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -158,7 +153,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListNext) proxy.getProxy(ActionListNext.class)).execute(effectivePerson, id, count); + result = new ActionListNext().execute(effectivePerson, id, count); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -177,7 +172,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListPrev) proxy.getProxy(ActionListPrev.class)).execute(effectivePerson, id, count); + result = new ActionListPrev().execute(effectivePerson, id, count); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -196,7 +191,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionPostScriptNested) proxy.getProxy(ActionPostScriptNested.class)).execute(request, + result = new ActionPostScriptNested().execute(request, effectivePerson, uniqueName, flag, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, jsonElement); @@ -217,8 +212,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionGetScriptNestedImported) proxy.getProxy(ActionGetScriptNestedImported.class)) - .execute(request, effectivePerson, uniqueName, flag); + result = new ActionGetScriptNestedImported().execute(request, effectivePerson, uniqueName, flag); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -237,7 +231,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionLoad) proxy.getProxy(ActionLoad.class)).execute(effectivePerson, flag, applicationFlag, + result = new ActionLoad().execute(effectivePerson, flag, applicationFlag, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, jsonElement); @@ -257,7 +251,7 @@ public class ScriptAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListPaging)proxy.getProxy(ActionListPaging.class)).execute(effectivePerson, page, size); + result = new ActionListPaging().execute(effectivePerson, page, size); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAnonymousAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAnonymousAction.java index fce1cba6c26ebf3be03279d57be2e6e4bebd5eb0..deef6c5f4cd73f9aad80494c8d3c81ea82069cbe 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAnonymousAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/script/ScriptAnonymousAction.java @@ -8,8 +8,6 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -23,8 +21,6 @@ import java.util.List; @JaxrsDescribe("可匿名访问的脚本信息管理服务") public class ScriptAnonymousAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); - @JaxrsMethodDescribe(value = "根据ID获取指定的脚本信息.", action = ActionGet.class) @GET @Path("{id}") @@ -35,7 +31,7 @@ public class ScriptAnonymousAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionGet)proxy.getProxy(ActionGet.class)).execute( effectivePerson, id ); + result = new ActionGet().execute( effectivePerson, id ); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -53,7 +49,7 @@ public class ScriptAnonymousAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListWithApplication)proxy.getProxy(ActionListWithApplication.class)).execute( effectivePerson, appId ); + result = new ActionListWithApplication().execute( effectivePerson, appId ); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -72,7 +68,7 @@ public class ScriptAnonymousAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionGetWithAppAndName)proxy.getProxy(ActionGetWithAppAndName.class)).execute( effectivePerson, appId, name ); + result = new ActionGetWithAppAndName().execute( effectivePerson, appId, name ); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -92,7 +88,7 @@ public class ScriptAnonymousAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListNext)proxy.getProxy(ActionListNext.class)).execute( effectivePerson, id, count ); + result = new ActionListNext().execute( effectivePerson, id, count ); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -112,7 +108,7 @@ public class ScriptAnonymousAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListPrev)proxy.getProxy(ActionListPrev.class)).execute( effectivePerson, id, count ); + result = new ActionListPrev().execute( effectivePerson, id, count ); } catch (Throwable th) { th.printStackTrace(); result.error(th); @@ -131,7 +127,7 @@ public class ScriptAnonymousAction extends StandardJaxrsAction { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = ((ActionListPaging)proxy.getProxy(ActionListPaging.class)).execute(effectivePerson, page, size); + result = new ActionListPaging().execute(effectivePerson, page, size); } catch (Throwable th) { th.printStackTrace(); result.error(th); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/search/SearchFilterAction.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/search/SearchFilterAction.java index 89af984d471c9baccab7f59bdfe8bbc288c9c8e8..6daa705fc316182a12eb681b58133b4422f8267a 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/search/SearchFilterAction.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/search/SearchFilterAction.java @@ -8,8 +8,6 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.HttpMediaType; import com.x.base.core.project.jaxrs.ResponseFactory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.base.core.project.jaxrs.proxy.StandardJaxrsActionProxy; -import com.x.cms.assemble.control.ThisApplication; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -22,8 +20,6 @@ import javax.ws.rs.core.MediaType; @JaxrsDescribe("信息文档搜索服务") public class SearchFilterAction extends StandardJaxrsAction { - private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context()); - @JaxrsMethodDescribe(value = "获取用户有权限访问的所有已发布文档分类列表.", action = ActionListAppSearchFilterForDocStatus.class) @GET @Path("list/publish/filter/category/{categoryId}") @@ -33,9 +29,7 @@ public class SearchFilterAction extends StandardJaxrsAction { @JaxrsParameterDescribe("分类ID") @PathParam("categoryId") String categoryId) { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = - ((ActionListAppSearchFilterForDocStatus)proxy - .getProxy(ActionListAppSearchFilterForDocStatus.class)) - .execute(request, effectivePerson, "published", categoryId); + new ActionListAppSearchFilterForDocStatus().execute(request, effectivePerson, "published", categoryId); asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } @@ -48,9 +42,7 @@ public class SearchFilterAction extends StandardJaxrsAction { @JaxrsParameterDescribe("分类ID") @PathParam("categoryId") String categoryId) { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = - ((ActionListAppSearchFilterForDocStatus)proxy - .getProxy(ActionListAppSearchFilterForDocStatus.class)) - .execute(request, effectivePerson, "draft", categoryId); + new ActionListAppSearchFilterForDocStatus().execute(request, effectivePerson, "draft", categoryId); asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } @@ -63,9 +55,7 @@ public class SearchFilterAction extends StandardJaxrsAction { @JaxrsParameterDescribe("分类ID") @PathParam("categoryId") String categoryId) { EffectivePerson effectivePerson = this.effectivePerson(request); ActionResult result = - ((ActionListAppSearchFilterForDocStatus)proxy - .getProxy(ActionListAppSearchFilterForDocStatus.class)) - .execute(request, effectivePerson, "archived", categoryId); + new ActionListAppSearchFilterForDocStatus().execute(request, effectivePerson, "archived", categoryId); asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } } \ No newline at end of file diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/templateform/ActionCreate.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/templateform/ActionCreate.java index e8dc5b8ae6ec99b599a77fe558e1178f913ef331..2aa94d171c68dd65d92c5212ab209d16ccaecb3b 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/templateform/ActionCreate.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/templateform/ActionCreate.java @@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.templateform; import java.util.Arrays; +import com.x.base.core.project.cache.CacheManager; import org.apache.commons.lang3.StringUtils; import com.google.gson.JsonElement; @@ -44,7 +45,7 @@ class ActionCreate extends BaseAction { emc.persist(o, CheckPersistType.all); } emc.commit(); - ApplicationCache.notify(TemplateForm.class); + CacheManager.notify(TemplateForm.class); Wo wo = new Wo(); wo.setId(o.getId()); result.setData(wo); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/templateform/ActionDelete.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/templateform/ActionDelete.java index 271f70e70dd8033ce82bd789e19f1c0dec00df2f..ab4a8315cb06aea84c3d82103932819674380f53 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/templateform/ActionDelete.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/templateform/ActionDelete.java @@ -4,6 +4,7 @@ import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.annotation.CheckRemoveType; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -28,7 +29,7 @@ class ActionDelete extends BaseAction { emc.beginTransaction(TemplateForm.class); emc.remove(template, CheckRemoveType.all); emc.commit(); - ApplicationCache.notify(TemplateForm.class); + CacheManager.notify(TemplateForm.class); Wo wo = new Wo(); wo.setId(template.getId()); result.setData(wo); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionDelete.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionDelete.java index 996d688eddf9d44fe14110c18e998d8350acbe71..8e946dd8d504d07592fd568e26e3ef23e7086f53 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionDelete.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionDelete.java @@ -6,6 +6,7 @@ import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.annotation.CheckRemoveType; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -39,9 +40,9 @@ public class ActionDelete extends BaseAction { Wo wo = new Wo(); wo.setId( viewCategory.getId() ); result.setData(wo); - - ApplicationCache.notify( View.class ); - ApplicationCache.notify( ViewCategory.class ); + + CacheManager.notify( View.class ); + CacheManager.notify( ViewCategory.class ); } catch (Throwable th) { th.printStackTrace(); result.error(th); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionSave.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionSave.java index bfe0d3f9eb4541f0a779546a928badb5fb5b2a3c..aa15e664d1d45a6afd1082533e8a5bd8812369a4 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionSave.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionSave.java @@ -5,6 +5,7 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; +import com.x.base.core.project.cache.CacheManager; import org.apache.commons.lang3.StringUtils; import com.google.gson.JsonElement; @@ -74,8 +75,8 @@ public class ActionSave extends BaseAction { Wo wo = new Wo(); wo.setId( viewCategory.getId() ); result.setData(wo); - ApplicationCache.notify( View.class ); - ApplicationCache.notify( ViewCategory.class ); + CacheManager.notify( View.class ); + CacheManager.notify( ViewCategory.class ); } catch (Throwable th) { th.printStackTrace(); result.error(th); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionDelete.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionDelete.java index 885328048eac1c7ed4e055f6cca925f6969d6897..f17fce3e0a064c8bd50808fb654e2d672f0da33a 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionDelete.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionDelete.java @@ -8,6 +8,7 @@ import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.annotation.CheckRemoveType; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; @@ -59,7 +60,7 @@ public class ActionDelete extends BaseAction { wrap = new Wo(); wrap.setId(viewFieldConfig.getId()); - ApplicationCache.notify(ViewFieldConfig.class); + CacheManager.notify(ViewFieldConfig.class); result.setData(wrap); } catch (Throwable th) { th.printStackTrace(); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionSave.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionSave.java index 48306398209b968751092a22fcb76e7e1bd1b226..940b38a25a5f04eb2f31768090dcf35ac03e3056 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionSave.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionSave.java @@ -5,6 +5,7 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; +import com.x.base.core.project.cache.CacheManager; import org.apache.commons.lang3.StringUtils; import com.google.gson.JsonElement; @@ -130,8 +131,8 @@ public class ActionSave extends BaseAction { wrap = new Wo(); wrap.setId( viewFieldConfig.getId() ); result.setData(wrap); - ApplicationCache.notify( ViewFieldConfig.class ); - ApplicationCache.notify( View.class ); + CacheManager.notify( ViewFieldConfig.class ); + CacheManager.notify( View.class ); } catch (Throwable th) { th.printStackTrace(); result.error(th); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/queue/QueueDataRowImport.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/queue/QueueDataRowImport.java index 7b49e0cecc5d7a58a485e5f3fe0bcb12f9719183..5554a6abb2f39e1a1194ce34fd36333299c4a938 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/queue/QueueDataRowImport.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/queue/QueueDataRowImport.java @@ -59,7 +59,7 @@ public class QueueDataRowImport extends AbstractQueue { document.setTitle( "无标题" ); } } - + boolean flag = false; try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) { emc.beginTransaction( Document.class ); document.setDocStatus( excelReadRuntime.template.getDocStatus() ); //已发布 @@ -102,11 +102,7 @@ public class QueueDataRowImport extends AbstractQueue { data.setDocument( document ); documentDataHelper.update( data ); emc.commit(); - - new CmsBatchOperationPersistService().addOperation( - CmsBatchOperationProcessService.OPT_OBJ_DOCUMENT, - CmsBatchOperationProcessService.OPT_TYPE_PERMISSION, document.getId(), document.getId(), "导入新文档:ID=" + document.getId() ); - + flag = true; dataImportStatus.addDocumentId( document.getId() ); dataImportStatus.increaseSuccessTotal(1); System.out.println( "第" + curRow + "行数据导入成功,已经成功提交到数据库!导入成功共"+ excelReadRuntime.wo.getSuccess_count() +"条"); @@ -116,6 +112,12 @@ public class QueueDataRowImport extends AbstractQueue { dataImportStatus.increaseErrorTotal(1); e.printStackTrace(); } + + if(flag) { + new CmsBatchOperationPersistService().addOperation( + CmsBatchOperationProcessService.OPT_OBJ_DOCUMENT, + CmsBatchOperationProcessService.OPT_TYPE_PERMISSION, document.getId(), document.getId(), "导入新文档:ID=" + document.getId()); + } }else { System.out.println("数据导入不成功,propertyNames为空,无法识别数据列对应的属性!"); } diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationPersistService.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationPersistService.java index 6150e703a279dfabd6580b6142804ffa2a3047c0..f8ce4c97cb9f35d3b5a04baa0d824561a51e78f1 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationPersistService.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationPersistService.java @@ -41,13 +41,11 @@ public class CmsBatchOperationPersistService { } if( StringUtils.isEmpty( cmsBatchOperation.getDescription() )) { throw new Exception("description can not empty for save CmsBatchOperation!"); - } + } try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) { emc.beginTransaction( CmsBatchOperation.class ); emc.persist( cmsBatchOperation, CheckPersistType.all ); emc.commit(); - } catch ( Exception e ) { - throw e; } //将批量操作信息压入队列 ThisApplication.queueBatchOperation.send( cmsBatchOperation ); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationProcessService.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationProcessService.java index 74239dee9c11d8f8232a80eafbd3a62af7b2ed62..acc121aeb5dcb020c0d8876fc851a50394c6cf11 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationProcessService.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/CmsBatchOperationProcessService.java @@ -2,6 +2,7 @@ package com.x.cms.assemble.control.service; import java.util.List; +import com.x.base.core.project.cache.CacheManager; import org.apache.commons.lang3.StringUtils; import com.x.base.core.container.EntityManagerContainer; @@ -213,8 +214,8 @@ public class CmsBatchOperationProcessService { } catch (Exception e) { throw e; } - ApplicationCache.notify( Review.class ); - ApplicationCache.notify( Document.class ); + CacheManager.notify( Review.class ); + CacheManager.notify( Document.class ); } /** @@ -271,8 +272,8 @@ public class CmsBatchOperationProcessService { } catch (Exception e) { throw e; } - ApplicationCache.notify( Review.class ); - ApplicationCache.notify( Document.class ); + CacheManager.notify( Review.class ); + CacheManager.notify( Document.class ); } @@ -343,9 +344,9 @@ public class CmsBatchOperationProcessService { } catch (Exception e) { throw e; } - - ApplicationCache.notify( Document.class ); - ApplicationCache.notify( CategoryInfo.class ); + + CacheManager.notify( Document.class ); + CacheManager.notify( CategoryInfo.class ); } /** @@ -414,8 +415,8 @@ public class CmsBatchOperationProcessService { emc.commit(); } } - ApplicationCache.notify( Document.class ); - ApplicationCache.notify( CategoryInfo.class ); + CacheManager.notify( Document.class ); + CacheManager.notify( CategoryInfo.class ); } /** @@ -479,8 +480,8 @@ public class CmsBatchOperationProcessService { } catch (Exception e) { throw e; } - ApplicationCache.notify( CategoryInfo.class ); - ApplicationCache.notify( Document.class ); + CacheManager.notify( CategoryInfo.class ); + CacheManager.notify( Document.class ); } /** @@ -530,8 +531,8 @@ public class CmsBatchOperationProcessService { } catch (Exception e) { throw e; } - ApplicationCache.notify( Document.class ); - ApplicationCache.notify( CategoryInfo.class ); + CacheManager.notify( Document.class ); + CacheManager.notify( CategoryInfo.class ); } /** diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentPersistService.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentPersistService.java index 854639fae61c678c6e2251bd79c2d16a2056a1b7..952328fa978ed38a67963d69da5d01479df20502 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentPersistService.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentPersistService.java @@ -6,6 +6,7 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.annotation.CheckPersistType; import com.x.base.core.entity.dataitem.ItemCategory; import com.x.base.core.project.cache.ApplicationCache; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.tools.ListTools; import com.x.cms.assemble.control.DocumentDataHelper; import com.x.cms.assemble.control.jaxrs.document.ActionPersistBatchModifyData.WiDataChange; @@ -349,7 +350,7 @@ public class DocumentPersistService { } } } - ApplicationCache.notify(Document.class); + CacheManager.notify(Document.class); } } } diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentQueryService.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentQueryService.java index b69b4b5027dbcfae18e8b9327e86f92191b6d419..348c3a7f9e3d184e34b3bb78c44bdcecf407c92d 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentQueryService.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentQueryService.java @@ -569,6 +569,7 @@ public class DocumentQueryService { public boolean getFileInfoManagerAssess(EffectivePerson effectivePerson, Document doc, CategoryInfo category, AppInfo appInfo ) throws Exception { List setting_permissonNames = new ArrayList<>(); List own_permissonNames = new ArrayList<>(); + own_permissonNames.add(effectivePerson.getDistinguishedName()); own_permissonNames.addAll(userManagerService.listIdentitiesWithPerson( effectivePerson.getDistinguishedName())); own_permissonNames.addAll(userManagerService.listUnitNamesWithPerson( effectivePerson.getDistinguishedName())); own_permissonNames.addAll(userManagerService.listGroupNamesByPerson( effectivePerson.getDistinguishedName())); diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/FileInfoServiceAdv.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/FileInfoServiceAdv.java index 5409197431adbca9f3e6393aef9f2c77eb6b0778..1cca6b16f2443e125eb537bf96ef7ce8e36f3bb7 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/FileInfoServiceAdv.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/FileInfoServiceAdv.java @@ -243,7 +243,7 @@ public class FileInfoServiceAdv { Document document = emc.find( docId, Document.class ); FileInfo old_fileInfo = emc.find( old_attId, FileInfo.class ); if( document != null ){ - emc.beginTransaction( FileInfo.class ); + emc.beginTransaction( FileInfo.class ); old_fileInfo.setLastUpdateTime( new Date() ); old_fileInfo.setExtension( attachment.getExtension() ); old_fileInfo.setName( attachment.getName() ); @@ -260,6 +260,7 @@ public class FileInfoServiceAdv { old_fileInfo.setFilePath( attachment.getFilePath() ); old_fileInfo.setType( attachment.getType() ); old_fileInfo.setText( attachment.getText() ); + old_fileInfo.setLength( attachment.getLength() ); emc.check( old_fileInfo, CheckPersistType.all ); emc.commit(); } diff --git a/o2server/x_component_assemble_control/pom.xml b/o2server/x_component_assemble_control/pom.xml index c98384c25b43eb1ef18bb258d2665f5cd696706f..5ac9a444d8afb322df00effa9ab38ce994babae0 100644 --- a/o2server/x_component_assemble_control/pom.xml +++ b/o2server/x_component_assemble_control/pom.xml @@ -124,6 +124,12 @@ + + maven-deploy-plugin + + true + + \ No newline at end of file diff --git a/o2server/x_console/pom.xml b/o2server/x_console/pom.xml index abd501fa486d65f94484a2fbd9818ff17bc5d942..ad7eac0a118e0a56ed6f97f3d1dc7040b9390867 100644 --- a/o2server/x_console/pom.xml +++ b/o2server/x_console/pom.xml @@ -107,6 +107,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_console/src/main/java/com/x/server/console/Main.java b/o2server/x_console/src/main/java/com/x/server/console/Main.java index 2bd742b5fb173ba8339a7a9c7d223a5c1ea18c4f..2735241c5644958775aeded9627ada595e819819 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/Main.java +++ b/o2server/x_console/src/main/java/com/x/server/console/Main.java @@ -108,9 +108,8 @@ public class Main { scanWar(base); cleanTempDir(base); createTempClassesDirectory(base); - LogTools.setSlf4jSimple(); - // org.slf4j.impl.StaticLoggerBinder.getSingleton(); SystemOutErrorSideCopyBuilder.start(); + LogTools.setSlf4jSimple(); ResourceFactory.bind(); CommandFactory.printStartHelp(); } diff --git a/o2server/x_console/src/main/java/com/x/server/console/ResourceFactory.java b/o2server/x_console/src/main/java/com/x/server/console/ResourceFactory.java index a28145a619cf2693f5474567551237dac26c4b07..e25956636e6209a6f5a8bf5894a0da51f7e54454 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/ResourceFactory.java +++ b/o2server/x_console/src/main/java/com/x/server/console/ResourceFactory.java @@ -1,6 +1,8 @@ package com.x.server.console; import java.io.PrintStream; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -13,12 +15,13 @@ import java.util.concurrent.LinkedBlockingQueue; import org.apache.commons.collections.MapUtils; import org.apache.commons.collections4.ListUtils; -import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.filefilter.WildcardFileFilter; import org.apache.commons.lang3.BooleanUtils; import org.eclipse.jetty.plus.jndi.Resource; import org.eclipse.jetty.util.RolloverFileOutputStream; -import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSourceC3P0Adapter; import com.google.gson.JsonElement; import com.x.base.core.container.factory.SlicePropertiesBuilder; @@ -31,11 +34,11 @@ import com.x.base.core.project.config.DataServer; import com.x.base.core.project.config.ExternalDataSource; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.script.ScriptFactory; import com.x.base.core.project.tools.ClassLoaderTools; -import com.x.base.core.project.tools.Crypto; import com.x.base.core.project.tools.DefaultCharset; +import com.x.base.core.project.tools.JarTools; import com.x.base.core.project.tools.ListTools; +import com.x.base.core.project.tools.PathTools; import com.x.server.console.node.EventQueueExecutor; import io.github.classgraph.ClassGraph; @@ -51,13 +54,12 @@ public class ResourceFactory { } public static void bind() throws Exception { - try (ScanResult sr = new ClassGraph() - .addClassLoader(ClassLoaderTools.urlClassLoader(true, false, true, true, true)).enableAnnotationInfo() - .scan()) { - node(sr); - containerEntities(sr); - containerEntityNames(sr); - stroageContainerEntityNames(sr); + ClassLoader cl = ClassLoaderTools.urlClassLoader(true, false, true, true, true, unzipCustomWar()); + try (ScanResult sr = new ClassGraph().addClassLoader(cl).enableAnnotationInfo().scan()) { + node(cl, sr); + containerEntities(cl, sr); + containerEntityNames(cl, sr); + stroageContainerEntityNames(cl, sr); } if (BooleanUtils.isTrue(Config.logLevel().audit().enable())) { auditLog(); @@ -70,7 +72,24 @@ public class ResourceFactory { processPlatformExecutors(); } - private static void node(ScanResult sr) throws Exception { + private static Path[] unzipCustomWar() throws Exception { + FileUtils.cleanDirectory(Config.dir_local_temp_custom(true)); + List list = new ArrayList<>(); + for (String str : Config.dir_custom(true).list(new WildcardFileFilter("*" + PathTools.DOT_WAR))) { + list.add(FilenameUtils.getBaseName(str)); + } + list = ListTools.includesExcludesWildcard(list, Config.currentNode().getApplication().getIncludes(), + Config.currentNode().getApplication().getExcludes()); + List paths = new ArrayList<>(); + for (String str : list) { + Path path = Paths.get(Config.dir_custom().toString(), str + PathTools.DOT_WAR); + JarTools.unjar(path, "", Config.dir_local_temp_custom().toPath().resolve(str), true); + paths.add(Config.dir_local_temp_custom().toPath().resolve(str).resolve(PathTools.WEB_INF_CLASSES)); + } + return paths.toArray(new Path[paths.size()]); + } + + private static void node(ClassLoader classLoader, ScanResult sr) throws Exception { LinkedBlockingQueue eventQueue = new LinkedBlockingQueue<>(); EventQueueExecutor eventQueueExecutor = new EventQueueExecutor(eventQueue); eventQueueExecutor.start(); @@ -84,6 +103,34 @@ public class ResourceFactory { new Resource(Config.RESOURCE_NODE_CENTERSPRIMARYSSLENABLE, entry.getValue().getSslEnable()); } + private static void containerEntityNames(ClassLoader classLoader, ScanResult sr) throws Exception { + List list = new ArrayList<>(); + for (ClassInfo info : sr.getClassesWithAnnotation(ContainerEntity.class.getName())) { + list.add(info.getName()); + } + list = ListTools.trim(list, true, true); + new Resource(Config.RESOURCE_CONTAINERENTITYNAMES, ListUtils.unmodifiableList(list)); + } + + private static void stroageContainerEntityNames(ClassLoader classLoader, ScanResult sr) throws Exception { + List list = new ArrayList<>(); + for (ClassInfo info : sr.getClassesWithAnnotation(Storage.class.getName())) { + list.add(info.getName()); + } + list = ListTools.trim(list, true, true); + new Resource(Config.RESOURCE_STORAGECONTAINERENTITYNAMES, ListUtils.unmodifiableList(list)); + } + + private static void containerEntities(ClassLoader classLoader, ScanResult sr) throws Exception { + Map> map = new TreeMap<>(); + for (ClassInfo info : sr.getClassesWithAnnotation(Module.class.getName())) { + Class cls = classLoader.loadClass(info.getName()); + List os = ListTools.toList(cls.getAnnotation(Module.class).containerEntities()); + map.put(info.getName(), ListUtils.unmodifiableList(os)); + } + new Resource(Config.RESOURCE_CONTAINERENTITIES, MapUtils.unmodifiableMap(map)); + } + private static void external() throws Exception { external_druid_c3p0(); } @@ -102,8 +149,9 @@ public class ResourceFactory { dataSource.setMaxPoolSize(ds.getMaxTotal()); dataSource.setMinPoolSize(ds.getMaxIdle()); // 增加校验 - dataSource.setTestConnectionOnCheckin(true); - dataSource.setTestConnectionOnCheckout(true); + dataSource.setTestConnectionOnCheckin(ds.getTestConnectionOnCheckin()); + dataSource.setTestConnectionOnCheckout(ds.getTestConnectionOnCheckout()); + dataSource.setMaxIdleTime(ds.getMaxIdleTime()); dataSource.setAcquireIncrement(2); if (BooleanUtils.isTrue(ds.getStatEnable())) { dataSource.setFilters(ds.getStatFilter()); @@ -146,34 +194,6 @@ public class ResourceFactory { } } - private static void containerEntityNames(ScanResult sr) throws Exception { - List list = new ArrayList<>(); - for (ClassInfo info : sr.getClassesWithAnnotation(ContainerEntity.class.getName())) { - list.add(info.getName()); - } - list = ListTools.trim(list, true, true); - new Resource(Config.RESOURCE_CONTAINERENTITYNAMES, ListUtils.unmodifiableList(list)); - } - - private static void stroageContainerEntityNames(ScanResult sr) throws Exception { - List list = new ArrayList<>(); - for (ClassInfo info : sr.getClassesWithAnnotation(Storage.class.getName())) { - list.add(info.getName()); - } - list = ListTools.trim(list, true, true); - new Resource(Config.RESOURCE_STORAGECONTAINERENTITYNAMES, ListUtils.unmodifiableList(list)); - } - - private static void containerEntities(ScanResult sr) throws Exception { - Map> map = new TreeMap<>(); - for (ClassInfo info : sr.getClassesWithAnnotation(Module.class.getName())) { - Class cls = Class.forName(info.getName()); - List os = ListTools.toList(cls.getAnnotation(Module.class).containerEntities()); - map.put(info.getName(), ListUtils.unmodifiableList(os)); - } - new Resource(Config.RESOURCE_CONTAINERENTITIES, MapUtils.unmodifiableMap(map)); - } - private static void auditLog() throws Exception { RolloverFileOutputStream rolloverFileOutputStream = new RolloverFileOutputStream( Config.dir_logs(true).getAbsolutePath() + "/yyyy_mm_dd.audit.log", true, diff --git a/o2server/x_console/src/main/java/com/x/server/console/action/Ddl.java b/o2server/x_console/src/main/java/com/x/server/console/action/Ddl.java index 82ffc8da655745b782c7ead54e04c82b762b7af3..4682d4d502c310338e22a004b68f05f18f8961d8 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/action/Ddl.java +++ b/o2server/x_console/src/main/java/com/x/server/console/action/Ddl.java @@ -3,13 +3,6 @@ package com.x.server.console.action; import java.io.File; import java.util.ArrayList; import java.util.List; -import java.util.Objects; - -import com.x.base.core.container.factory.PersistenceXmlHelper; -import com.x.base.core.project.config.Config; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; import org.apache.commons.lang3.StringUtils; import org.apache.openjpa.jdbc.conf.JDBCConfiguration; @@ -19,6 +12,12 @@ import org.apache.openjpa.persistence.EntityManagerImpl; import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory; import org.apache.openjpa.persistence.OpenJPAPersistence; +import com.x.base.core.container.factory.PersistenceXmlHelper; +import com.x.base.core.project.config.Config; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.base.core.project.tools.ClassLoaderTools; + public class Ddl { private static Logger logger = LoggerFactory.getLogger(Ddl.class); @@ -26,66 +25,49 @@ public class Ddl { /* 初始化完成 */ public boolean execute(String type) throws Exception { - // List containerEntityNames = new ArrayList<>(); - // containerEntityNames.addAll((List) - // Config.resource(Config.RESOURCE_CONTAINERENTITYNAMES)); - // List classNames = - // ListTools.includesExcludesWildcard(containerEntityNames, - // Config.dumpRestoreData().getIncludes(), - // Config.dumpRestoreData().getExcludes()); - // File persistence = new File(Config.dir_local_temp_classes(), - // "META-INF/persistence.xml"); - // PersistenceXmlHelper.writeForDdl(persistence.getAbsolutePath()); - // String[] arguments = new String[4]; - // arguments[0] = "-schemaAction"; - // arguments[1] = StringUtils.equals(type ,"create")? "build":"add"; - // arguments[2] = "-sql"; - // arguments[3] = Config.dir_local_temp_sql(true) + "/" + type + ".sql"; - // MappingTool.main(arguments); - // return true; - String flag = "build"; - if (StringUtils.equalsIgnoreCase(type, "createDB")) { - flag = "createDB"; - } else if (StringUtils.equalsIgnoreCase(type, "dropDB")) { - flag = "dropDB"; - } else if (StringUtils.equalsIgnoreCase(type, "drop")) { - flag = "drop"; - // } else if (StringUtils.equalsIgnoreCase(type, "deleteTableContents")) { - // flag = "deleteTableContents"; - } - List containerEntityNames = new ArrayList<>(); - containerEntityNames.addAll((List) Config.resource(Config.RESOURCE_CONTAINERENTITYNAMES)); - List classNames = ListTools.includesExcludesWildcard(containerEntityNames, - Config.dumpRestoreData().getIncludes(), Config.dumpRestoreData().getExcludes()); - File persistence = new File(Config.dir_local_temp_classes(), "persistence_sql.xml"); - PersistenceXmlHelper.writeForDdl(persistence.getAbsolutePath()); - OpenJPAEntityManagerFactory emf = OpenJPAPersistence.createEntityManagerFactory("enhance", - persistence.getName()); - EntityManagerImpl em = (EntityManagerImpl) emf.createEntityManager(); - String[] arguments = null; - String[] args = null; - Options opts = new Options(); - if (StringUtils.equals(flag, "build") || StringUtils.equals(flag, "drop") - || StringUtils.equals(flag, "createDB") || StringUtils.equals(flag, "dropDB")) { - arguments = new String[4]; - File file = new File(Config.dir_local_temp_sql(true), flag + ".sql"); - arguments[0] = "-schemaAction"; - arguments[1] = flag; - arguments[2] = "-sql"; - arguments[3] = file.getAbsolutePath(); - args = opts.setFromCmdLine(arguments); - MappingTool.run((JDBCConfiguration) em.getConfiguration(), args, opts, null); - logger.print("file : {}.", file.getAbsolutePath()); - } else if (StringUtils.equals(flag, "deleteTableContents")) { - // arguments = new String[2]; - // arguments[0] = "-schemaAction"; - // arguments[1] = flag; - // args = opts.setFromCmdLine(arguments); - // MappingTool.run((JDBCConfiguration) em.getConfiguration(), args, opts, null); - // logger.print("delete all table contents."); - } - em.close(); - emf.close(); + new Thread(() -> { + try { + ClassLoader cl = ClassLoaderTools.urlClassLoader(true, true, true, true, true, + Config.dir_local_temp_classes().toPath()); + Thread.currentThread().setContextClassLoader(cl); + String flag = "build"; + if (StringUtils.equalsIgnoreCase(type, "createDB")) { + flag = "createDB"; + } else if (StringUtils.equalsIgnoreCase(type, "dropDB")) { + flag = "dropDB"; + } else if (StringUtils.equalsIgnoreCase(type, "drop")) { + flag = "drop"; + } + List containerEntityNames = new ArrayList<>(); + containerEntityNames.addAll((List) Config.resource(Config.RESOURCE_CONTAINERENTITYNAMES)); + File persistence = new File(Config.dir_local_temp_classes(), "META-INF/persistence_sql.xml"); + PersistenceXmlHelper.writeForDdl(persistence.getAbsolutePath()); + OpenJPAEntityManagerFactory emf = OpenJPAPersistence.createEntityManagerFactory("enhance", + persistence.getName()); + EntityManagerImpl em = (EntityManagerImpl) emf.createEntityManager(); + String[] arguments = null; + String[] args = null; + Options opts = new Options(); + if (StringUtils.equals(flag, "build") || StringUtils.equals(flag, "drop") + || StringUtils.equals(flag, "createDB") || StringUtils.equals(flag, "dropDB")) { + arguments = new String[4]; + File file = new File(Config.dir_local_temp_sql(true), flag + ".sql"); + arguments[0] = "-schemaAction"; + arguments[1] = flag; + arguments[2] = "-sql"; + arguments[3] = file.getAbsolutePath(); + args = opts.setFromCmdLine(arguments); + MappingTool.run((JDBCConfiguration) em.getConfiguration(), args, opts, null); + logger.print("file : {}.", file.getAbsolutePath()); + } else if (StringUtils.equals(flag, "deleteTableContents")) { + } + em.close(); + emf.close(); + + } catch (Exception e) { + logger.error(e); + } + }).start(); return true; } diff --git a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentBbs.java b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentBbs.java index a8c4ff8a585fc6294f7c7ebc9a4a3a61334237d0..2e0438ed87eead9466cce768dbb9a25b4d8d3415 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentBbs.java +++ b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentBbs.java @@ -1,6 +1,8 @@ package com.x.server.console.action; import com.x.base.core.entity.dataitem.ItemCategory; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; import com.x.bbs.entity.BBSOperationRecord; import com.x.bbs.entity.BBSReplyInfo; import com.x.bbs.entity.BBSSubjectAttachment; @@ -13,6 +15,8 @@ import com.x.bbs.entity.BBSVoteRecord; public class EraseContentBbs extends EraseContent { + private static Logger logger = LoggerFactory.getLogger(EraseContentBbs.class); + @Override public boolean execute() throws Exception { this.init("bbs", ItemCategory.bbs); diff --git a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentCms.java b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentCms.java index cb14d8cdf7460bd949249fdf6013ed499e8c37e2..5534896d4bf7821d1cb8d325007566e4ca7fc0c3 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentCms.java +++ b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentCms.java @@ -1,6 +1,8 @@ package com.x.server.console.action; import com.x.base.core.entity.dataitem.ItemCategory; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; import com.x.cms.core.entity.CmsBatchOperation; import com.x.cms.core.entity.Document; import com.x.cms.core.entity.DocumentCommend; @@ -16,6 +18,8 @@ import com.x.query.core.entity.Item; public class EraseContentCms extends EraseContent { + private static Logger logger = LoggerFactory.getLogger(EraseContentCms.class); + @Override public boolean execute() throws Exception { this.init("cms", ItemCategory.cms); diff --git a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentLog.java b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentLog.java index 97a572220c59bf0d17307549b8d7cd0f00e3bdd1..64e26c5c3efe2df9020e4216a5d04d81363d0dda 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentLog.java +++ b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentLog.java @@ -1,5 +1,7 @@ package com.x.server.console.action; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; import com.x.processplatform.core.entity.element.FormVersion; import com.x.processplatform.core.entity.element.ProcessVersion; import com.x.processplatform.core.entity.element.ScriptVersion; @@ -11,6 +13,8 @@ import com.x.program.center.core.entity.WarnLog; public class EraseContentLog extends EraseContent { + private static Logger logger = LoggerFactory.getLogger(EraseContentLog.class); + @Override public boolean execute() throws Exception { this.init("log", null); diff --git a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentMessage.java b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentMessage.java index 5e81c1cbc32ce0551d1902b6c16d8135fef3312d..bcc2dcb860c7976e715236aeb378b200ecee3acb 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentMessage.java +++ b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentMessage.java @@ -1,5 +1,7 @@ package com.x.server.console.action; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; import com.x.message.core.entity.IMConversation; import com.x.message.core.entity.IMConversationExt; import com.x.message.core.entity.IMMsg; @@ -10,6 +12,8 @@ import com.x.message.core.entity.Org; public class EraseContentMessage extends EraseContent { + private static Logger logger = LoggerFactory.getLogger(EraseContentMessage.class); + @Override public boolean execute() throws Exception { this.init("message", null); diff --git a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentOrg.java b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentOrg.java index dc186f1ae3b933e3b34a0520f9ca5d0d43a28ce5..8a2b97a8a54bc1a7e0bfa921205a633a07d34630 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentOrg.java +++ b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentOrg.java @@ -2,6 +2,8 @@ package com.x.server.console.action; import javax.wsdl.Definition; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; import com.x.organization.core.entity.Bind; import com.x.organization.core.entity.Custom; import com.x.organization.core.entity.Group; @@ -19,6 +21,8 @@ import com.x.organization.core.entity.accredit.EmpowerLog; public class EraseContentOrg extends EraseContent { + private static Logger logger = LoggerFactory.getLogger(EraseContentOrg.class); + @Override public boolean execute() throws Exception { this.init("org", null); diff --git a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentProcessPlatform.java b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentProcessPlatform.java index 3a505f1fa3e5fc38dc7ea857f6beed8e826d3d06..e5d3ae68cc584df6155b21f88a3285adf8a7d2a0 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentProcessPlatform.java +++ b/o2server/x_console/src/main/java/com/x/server/console/action/EraseContentProcessPlatform.java @@ -1,6 +1,8 @@ package com.x.server.console.action; import com.x.base.core.entity.dataitem.ItemCategory; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; import com.x.processplatform.core.entity.content.Attachment; import com.x.processplatform.core.entity.content.DocumentVersion; import com.x.processplatform.core.entity.content.Draft; @@ -19,6 +21,8 @@ import com.x.query.core.entity.Item; public class EraseContentProcessPlatform extends EraseContent { + private static Logger logger = LoggerFactory.getLogger(EraseContentProcessPlatform.class); + public boolean execute() throws Exception { this.init("processPlatform", ItemCategory.pp); addClass(Attachment.class); diff --git a/o2server/x_console/src/main/java/com/x/server/console/action/HttpStatus.java b/o2server/x_console/src/main/java/com/x/server/console/action/HttpStatus.java index eeb0757adb09c1de92ad37edbe239e50c2a76e36..058de64127c2d34c7795f85097f4e5593a466f7b 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/action/HttpStatus.java +++ b/o2server/x_console/src/main/java/com/x/server/console/action/HttpStatus.java @@ -1,20 +1,30 @@ package com.x.server.console.action; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; import java.util.ArrayList; +import java.util.Date; import java.util.List; -import com.x.server.console.server.Servers; - import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; +import com.x.base.core.project.config.Config; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.base.core.project.tools.DateTools; +import com.x.server.console.server.Servers; + /** * @author */ public class HttpStatus extends Thread { + private static Logger logger = LoggerFactory.getLogger(HttpStatus.class); + private Integer repeat; public HttpStatus(Integer repeat) { @@ -31,24 +41,41 @@ public class HttpStatus extends Thread { bean.getTotalStartedThreadCount(), bean.getThreadCount(), bean.getPeakThreadCount(), bean.getDaemonThreadCount(), deadLockedCount)); if (BooleanUtils.isTrue(Servers.centerServerIsRunning())) { - list.add(String.format(" +++ center server thread pool size:%d, idle:%d.", + File file = new File(Config.dir_logs(true), + "centerServer_" + DateTools.compact(new Date()) + ".txt"); + list.add(String.format(" +++ center server thread pool size:%d, idle:%d, detail:%s.", Servers.centerServer.getThreadPool().getThreads(), - Servers.centerServer.getThreadPool().getIdleThreads())); + Servers.centerServer.getThreadPool().getIdleThreads(), file.getAbsolutePath())); + try (FileOutputStream stream = new FileOutputStream(file); + OutputStreamWriter writer = new OutputStreamWriter(stream)) { + Servers.centerServer.dump(writer); + } } if (BooleanUtils.isTrue(Servers.applicationServerIsRunning())) { - list.add(String.format(" +++ application server thread pool size:%d, idle:%d.", + File file = new File(Config.dir_logs(true), + "applicationServer_" + DateTools.compact(new Date()) + ".txt"); + list.add(String.format(" +++ application server thread pool size:%d, idle:%d, detail:%s.", Servers.applicationServer.getThreadPool().getThreads(), - Servers.applicationServer.getThreadPool().getIdleThreads())); + Servers.applicationServer.getThreadPool().getIdleThreads(), file.getAbsolutePath())); + try (FileOutputStream stream = new FileOutputStream(file); + OutputStreamWriter writer = new OutputStreamWriter(stream)) { + Servers.applicationServer.dump(writer); + } } if (BooleanUtils.isTrue(Servers.webServerIsRunning())) { - list.add(String.format(" +++ web server thread pool size:%d, idle:%d.", + File file = new File(Config.dir_logs(true), "webServer_" + DateTools.compact(new Date()) + ".txt"); + list.add(String.format(" +++ web server thread pool size:%d, idle:%d, detail:%s.", Servers.webServer.getThreadPool().getThreads(), - Servers.webServer.getThreadPool().getIdleThreads())); + Servers.webServer.getThreadPool().getIdleThreads(), file.getAbsolutePath())); + try (FileOutputStream stream = new FileOutputStream(file); + OutputStreamWriter writer = new OutputStreamWriter(stream)) { + Servers.webServer.dump(writer); + } } System.out.println(StringUtils.join(list, StringUtils.LF)); Thread.sleep(2000); } - } catch (InterruptedException e) { + } catch (Exception e) { e.printStackTrace(); } } diff --git a/o2server/x_console/src/main/java/com/x/server/console/action/OperatingSystem.java b/o2server/x_console/src/main/java/com/x/server/console/action/OperatingSystem.java index 6a801437192dfcf6e11f2f42df00a8373861a170..1f7b80575f02fea50652f99895fc81fbfaf0e9e6 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/action/OperatingSystem.java +++ b/o2server/x_console/src/main/java/com/x/server/console/action/OperatingSystem.java @@ -8,7 +8,7 @@ import com.x.base.core.project.logger.LoggerFactory; public class OperatingSystem extends Thread { - private static Logger logger = LoggerFactory.getLogger(DumpData.class); + private static Logger logger = LoggerFactory.getLogger(OperatingSystem.class); private Integer count; diff --git a/o2server/x_console/src/main/java/com/x/server/console/action/ProcessPlatformExecutor.java b/o2server/x_console/src/main/java/com/x/server/console/action/ProcessPlatformExecutor.java index 7953ed09694b36775928f70df1cff3faf7663642..d4a941d07dff3e1a854b5c206707042995056220 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/action/ProcessPlatformExecutor.java +++ b/o2server/x_console/src/main/java/com/x/server/console/action/ProcessPlatformExecutor.java @@ -19,7 +19,7 @@ import org.apache.commons.lang3.StringUtils; */ public class ProcessPlatformExecutor { - private static Logger logger = LoggerFactory.getLogger(RestoreData.class); + private static Logger logger = LoggerFactory.getLogger(ProcessPlatformExecutor.class); public void execute() throws Exception { diff --git a/o2server/x_console/src/main/java/com/x/server/console/action/ThreadDump.java b/o2server/x_console/src/main/java/com/x/server/console/action/ThreadDump.java index 78b1998c6f88e1dce40eb4ac4e27b78aafc53048..fa110788c35a5911f51f24ae709789f62f912447 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/action/ThreadDump.java +++ b/o2server/x_console/src/main/java/com/x/server/console/action/ThreadDump.java @@ -1,143 +1,51 @@ package com.x.server.console.action; -import java.io.File; -import java.lang.Thread.State; -import java.util.Comparator; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.nio.file.Path; import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; + +import org.apache.commons.lang3.SystemUtils; import com.x.base.core.project.config.Config; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; import com.x.base.core.project.tools.DateTools; -import com.x.base.core.project.tools.DefaultCharset; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.ThreadUtils; public class ThreadDump { - private static Logger logger = LoggerFactory.getLogger(DumpData.class); + private static Logger logger = LoggerFactory.getLogger(ThreadDump.class); public void execute(Integer count) throws Exception { new Thread() { public void run() { try { - Map state_new = new HashMap<>(); - Map state_runable = new HashMap<>(); - Map state_blocked = new HashMap<>(); - Map state_waiting = new HashMap<>(); - Map state_timed_waiting = new HashMap<>(); - Map state_terminated = new HashMap<>(); - File startFile = null; - for (int i = 1; i <= count; i++) { - Date date = new Date(); - StringBuffer buffer = new StringBuffer(); - for (Thread thread : ThreadUtils.getAllThreads()) { - state(thread, state_new, state_runable, state_blocked, state_waiting, - state_timed_waiting, state_terminated); - dump(buffer, thread); - } - File file = new File(Config.dir_logs(true), fileName(i, count, date)); - if (i == 1) { - startFile = file; - } - if (i != count) { - FileUtils.write(file, buffer, DefaultCharset.charset_utf_8); - logger.print(String.format("thread dump to file(%d/%d): %s.", i, count, - file.getAbsolutePath())); - Thread.sleep(5000); + RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean(); + String jvmName = runtimeBean.getName(); + long pid = Long.parseLong(jvmName.split("@")[0]); + Path path = SystemUtils.getJavaHome().toPath(); + path = path.getParent().resolve("bin/jcmd").toAbsolutePath(); + for (int i = 0; i < count; i++) { + Path out = Config.dir_logs(true).toPath() + .resolve("jcmd_Thread.print_" + pid + "_" + + DateTools.format(new Date(), DateTools.formatCompact_yyyyMMddHHmmss) + ".txt") + .toAbsolutePath(); + String cmd = path.toString() + " " + pid + " Thread.print >" + out.toString(); + ProcessBuilder processBuilder = new ProcessBuilder(); + if (SystemUtils.IS_OS_WINDOWS) { + processBuilder.command("cmd", "/c", cmd); } else { - buffer.append(System.lineSeparator()).append("Thread state statistics:"); - buffer.append(" NEW(" + state_new.size() + "),"); - buffer.append(" RUNABLE(" + state_runable.size() + "),"); - buffer.append(" blocked(" + state_blocked.size() + "),"); - buffer.append(" waiting(" + state_waiting.size() + "),"); - buffer.append(" timed_waiting(" + state_timed_waiting.size() + "),"); - buffer.append(" terminated(" + state_terminated.size() + ")."); - buffer.append(System.lineSeparator()); - writeState(buffer, state_new, State.NEW, count); - writeState(buffer, state_runable, State.RUNNABLE, count); - writeState(buffer, state_blocked, State.BLOCKED, count); - writeState(buffer, state_waiting, State.WAITING, count); - writeState(buffer, state_timed_waiting, State.TIMED_WAITING, count); - writeState(buffer, state_terminated, State.TERMINATED, count); - FileUtils.write(file, buffer, DefaultCharset.charset_utf_8); - logger.print(String.format("thread dump to files: %s - %s.", - startFile.getAbsolutePath(), file.getAbsolutePath())); + processBuilder.command("sh", "-c", cmd); } + processBuilder.start(); + logger.print("thread dump to file:{}.", out.toString()); + Thread.sleep(1000); } + logger.print("{} thread dump completed.", count); } catch (Exception e) { e.printStackTrace(); } } }.start(); } - - private void writeState(StringBuffer buffer, Map map, State state, Integer count) { - buffer.append(state).append(", count:").append(map.size()).append(".").append(System.lineSeparator()); - map.entrySet().stream().sorted(Comparator.comparing(Entry::getValue, Comparator.reverseOrder())).forEach(o -> { - buffer.append("\t\t").append(o.getKey()).append(":").append(o.getValue()).append("/").append(count) - .append(System.lineSeparator()); - }); - } - - private void state(Thread thread, Map state_new, Map state_runable, - Map state_blocked, Map state_waiting, Map state_timed_waiting, - Map state_terminated) { - Map state; - switch (thread.getState()) { - case NEW: - state = state_new; - break; - case RUNNABLE: - state = state_runable; - break; - case BLOCKED: - state = state_blocked; - break; - case WAITING: - state = state_waiting; - break; - case TIMED_WAITING: - state = state_timed_waiting; - break; - case TERMINATED: - state = state_terminated; - break; - default: - state = state_terminated; - break; - } - state.compute(thread.getId(), (k, v) -> { - if (null == v) { - return 1; - } - return v + 1; - }); - } - - private void dump(StringBuffer buffer, Thread thread) { - this.title(buffer, thread); - for (StackTraceElement stackTrace : thread.getStackTrace()) { - this.stackTrace(buffer, stackTrace); - } - } - - private void title(StringBuffer buffer, Thread thread) { - buffer.append(String.format("id:%s, state:%s, threadGroup:%s, priority:%d.", thread.getId(), thread.getState(), - thread.getThreadGroup(), thread.getPriority())).append(System.lineSeparator()); - } - - private void stackTrace(StringBuffer buffer, StackTraceElement stackTraceElement) { - buffer.append("\t\t").append(stackTraceElement.toString()).append(System.lineSeparator()); - } - - private String fileName(int idx, int count, Date date) { - return "stack_" + DateTools.format(date, "yyyyMMddHHmmssSSS") + "_" - + StringUtils.repeat('0', ((count + "").length()) - ((idx + "").length())) + idx + "_" + count + ".txt"; - } } \ No newline at end of file diff --git a/o2server/x_console/src/main/java/com/x/server/console/server/JettySeverTools.java b/o2server/x_console/src/main/java/com/x/server/console/server/JettySeverTools.java index 1086c9c5dff1392b090c364bab13cb898f599d0a..a839e1af86500fb8bf46dd0003b10b6a3dc11ab2 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/server/JettySeverTools.java +++ b/o2server/x_console/src/main/java/com/x/server/console/server/JettySeverTools.java @@ -27,7 +27,8 @@ import com.x.base.core.project.config.Config; public abstract class JettySeverTools { - protected static void addHttpsConnector(Server server, Integer port) throws Exception { + protected static void addHttpsConnector(Server server, Integer port, boolean persistentConnectionsEnable) + throws Exception { SslContextFactory sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(Config.sslKeyStore().getAbsolutePath()); sslContextFactory.setKeyStorePassword(Config.token().getSslKeyStorePassword()); @@ -35,12 +36,11 @@ public abstract class JettySeverTools { sslContextFactory.setTrustAll(true); HttpConfiguration config = new HttpConfiguration(); config.setSecureScheme("https"); - config.setOutputBufferSize(1024 * 2048); + config.setPersistentConnectionsEnabled(persistentConnectionsEnable); config.setRequestHeaderSize(8192 * 2); config.setResponseHeaderSize(8192 * 2); - config.setSendServerVersion(true); + config.setSendServerVersion(false); config.setSendDateHeader(false); - ServerConnector https = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(config)); @@ -50,12 +50,14 @@ public abstract class JettySeverTools { server.addConnector(https); } - protected static void addHttpConnector(Server server, Integer port) throws Exception { + protected static void addHttpConnector(Server server, Integer port, boolean persistentConnectionsEnable) + throws Exception { HttpConfiguration config = new HttpConfiguration(); - config.setOutputBufferSize(1024 * 2048); + // config.setOutputBufferSize(1024 * 2048); + config.setPersistentConnectionsEnabled(persistentConnectionsEnable); config.setRequestHeaderSize(8192 * 2); config.setResponseHeaderSize(8192 * 2); - config.setSendServerVersion(true); + config.setSendServerVersion(false); config.setSendDateHeader(false); ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(config)); http.setAcceptQueueSize(-1); diff --git a/o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java b/o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java index 4c57b52ebd9e377833ceb3b65f6d17cd41150cef..2fc1182f048075b1bf6751741380177d5a439934 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java +++ b/o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java @@ -101,9 +101,8 @@ public class ApplicationServerTools extends JettySeverTools { x_portal_assemble_surface.class.getName(), x_attendance_assemble_control.class.getName(), x_bbs_assemble_control.class.getName(), x_file_assemble_control.class.getName(), x_meeting_assemble_control.class.getName(), x_mind_assemble_control.class.getName(), - x_hotpic_assemble_control.class.getName(), - x_query_service_processing.class.getName(), x_query_assemble_designer.class.getName(), - x_query_assemble_surface.class.getName()); + x_hotpic_assemble_control.class.getName(), x_query_service_processing.class.getName(), + x_query_assemble_designer.class.getName(), x_query_assemble_surface.class.getName()); public static Server start(ApplicationServer applicationServer) throws Exception { @@ -129,9 +128,9 @@ public class ApplicationServerTools extends JettySeverTools { server.setAttribute("maxFormContentSize", applicationServer.getMaxFormContent() * 1024 * 1024); if (BooleanUtils.isTrue(applicationServer.getSslEnable())) { - addHttpsConnector(server, applicationServer.getPort()); + addHttpsConnector(server, applicationServer.getPort(), applicationServer.getPersistentConnectionsEnable()); } else { - addHttpConnector(server, applicationServer.getPort()); + addHttpConnector(server, applicationServer.getPort(), applicationServer.getPersistentConnectionsEnable()); } GzipHandler gzipHandler = new GzipHandler(); @@ -185,8 +184,7 @@ public class ApplicationServerTools extends JettySeverTools { } if (BooleanUtils.isFalse(applicationServer.getExposeJest())) { FilterHolder denialOfServiceFilterHolder = new FilterHolder(new DenialOfServiceFilter()); - webApp.addFilter(denialOfServiceFilterHolder, "/jest/*", - EnumSet.of(DispatcherType.REQUEST)); + webApp.addFilter(denialOfServiceFilterHolder, "/jest/*", EnumSet.of(DispatcherType.REQUEST)); } handlers.addHandler(webApp); } else if (Files.exists(dir)) { diff --git a/o2server/x_console/src/main/java/com/x/server/console/server/center/CenterServerTools.java b/o2server/x_console/src/main/java/com/x/server/console/server/center/CenterServerTools.java index 09fd36664c447d047ec741c6e9bd75a421a2982b..5ad725d32d138a8d185d13e0bc57d86d7f0391e5 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/server/center/CenterServerTools.java +++ b/o2server/x_console/src/main/java/com/x/server/console/server/center/CenterServerTools.java @@ -89,9 +89,9 @@ public class CenterServerTools extends JettySeverTools { server.setAttribute("maxFormContentSize", centerServer.getMaxFormContent() * 1024 * 1024); if (BooleanUtils.isTrue(centerServer.getSslEnable())) { - addHttpsConnector(server, centerServer.getPort()); + addHttpsConnector(server, centerServer.getPort(), centerServer.getPersistentConnectionsEnable()); } else { - addHttpConnector(server, centerServer.getPort()); + addHttpConnector(server, centerServer.getPort(), centerServer.getPersistentConnectionsEnable()); } GzipHandler gzipHandler = new GzipHandler(); diff --git a/o2server/x_console/src/main/java/com/x/server/console/server/web/Proxy.java b/o2server/x_console/src/main/java/com/x/server/console/server/web/Proxy.java index dc074fd117e10e013d6c16a246779505736a79ee..4f842329c49a69ad7ad75415232e904b8dd2f72b 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/server/web/Proxy.java +++ b/o2server/x_console/src/main/java/com/x/server/console/server/web/Proxy.java @@ -2,6 +2,7 @@ package com.x.server.console.server.web; import javax.servlet.http.HttpServletRequest; +import com.x.base.core.project.tools.EscapeStringTools; import org.apache.commons.lang3.StringUtils; import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.http.HttpHeader; @@ -20,8 +21,14 @@ public class Proxy extends ProxyServlet { @Override protected String rewriteTarget(HttpServletRequest request) { - String url = request.getRequestURL().toString(); - String parameter = request.getQueryString(); + String url = EscapeStringTools.escapeURLQuery(request.getRequestURL().toString()); + if(url==null){ + url = request.getRequestURL().toString(); + } + String parameter = EscapeStringTools.escapeURLQuery(request.getQueryString()); + if (parameter == null){ + parameter = request.getQueryString(); + } return target(url, parameter, this.getServletConfig().getInitParameter("port")); } diff --git a/o2server/x_console/src/main/java/com/x/server/console/server/web/WebServerTools.java b/o2server/x_console/src/main/java/com/x/server/console/server/web/WebServerTools.java index ef66cf1ad07cca21814f642df8c7eecbc46dccea..4fb472631ac07d4372069fde3dc87a249516f1bb 100644 --- a/o2server/x_console/src/main/java/com/x/server/console/server/web/WebServerTools.java +++ b/o2server/x_console/src/main/java/com/x/server/console/server/web/WebServerTools.java @@ -1,6 +1,7 @@ package com.x.server.console.server.web; import java.io.File; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -31,6 +32,7 @@ import org.eclipse.jetty.webapp.WebAppContext; import com.alibaba.druid.support.http.StatViewServlet; import com.alibaba.druid.support.http.WebStatFilter; import com.google.gson.Gson; +import com.google.gson.JsonElement; import com.x.base.core.project.x_program_center; import com.x.base.core.project.config.Config; import com.x.base.core.project.config.WebServer; @@ -52,31 +54,25 @@ public class WebServerTools extends JettySeverTools { public static Server start(WebServer webServer) throws Exception { - /** - * 更新x_desktop的center指向 - */ + // 更新x_desktop的center指向 updateCenterConfigJson(); - /** - * 更新 favicon.ico - */ + // 更新 favicon.ico updateFavicon(); - /** - * 创建index.html - */ + // 创建index.html createIndexPage(); - /** - * copyDefaultHtml - */ + // copyDefaultHtml copyDefaultHtml(); + // 覆盖 webServer + coverToWebServer(); QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setMinThreads(WEBSERVER_THREAD_POOL_SIZE_MIN); threadPool.setMaxThreads(WEBSERVER_THREAD_POOL_SIZE_MAX); Server server = new Server(threadPool); if (webServer.getSslEnable()) { - addHttpsConnector(server, webServer.getPort()); + addHttpsConnector(server, webServer.getPort(), webServer.getPersistentConnectionsEnable()); } else { - addHttpConnector(server, webServer.getPort()); + addHttpConnector(server, webServer.getPort(), webServer.getPersistentConnectionsEnable()); } WebAppContext context = new WebAppContext(); context.setContextPath("/"); @@ -161,6 +157,11 @@ public class WebServerTools extends JettySeverTools { } } + private static void updateWeb() throws Exception { + Path path = Config.path_servers_webServer_x_desktop_res_config(true); + Files.write(path.resolve("web.json"), XGsonBuilder.toJson(Config.web()).getBytes(StandardCharsets.UTF_8)); + } + private static void updateFavicon() throws Exception { File file = new File(Config.dir_config(), "favicon.ico"); @@ -251,7 +252,9 @@ public class WebServerTools extends JettySeverTools { publicKey = new String(Base64.encodeBase64(publicKeyB)); map.put("publicKey", publicKey); } - + for (Entry en : Config.web().entrySet()) { + map.put(en.getKey(), en.getValue()); + } FileUtils.writeStringToFile(file, gson.toJson(map), DefaultCharset.charset); } } @@ -290,4 +293,11 @@ public class WebServerTools extends JettySeverTools { FileUtils.write(file, buffer.toString(), DefaultCharset.name); } } + + private static void coverToWebServer() throws Exception { + Path p = Config.path_config_coverToWebServer(true); + if (Files.exists(p)) { + FileUtils.copyDirectory(p.toFile(), Config.path_servers_webServer(true).toFile()); + } + } } \ No newline at end of file diff --git a/o2server/x_file_assemble_control/pom.xml b/o2server/x_file_assemble_control/pom.xml index 9fdda8fefae48a6b1979d5a23cca6aad4b4a84a7..5944d9f8172f6cc7f6a5a6522da73a3113855982 100644 --- a/o2server/x_file_assemble_control/pom.xml +++ b/o2server/x_file_assemble_control/pom.xml @@ -128,6 +128,12 @@ + + maven-deploy-plugin + + true + + \ No newline at end of file diff --git a/o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/PersistenceProperties.java b/o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/PersistenceProperties.java index 8dc40c44001177dc183121265a4dd92d20e882c4..1aa40d5e115b827b4b7ef4485253989c2e03b5f4 100644 --- a/o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/PersistenceProperties.java +++ b/o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/PersistenceProperties.java @@ -40,7 +40,7 @@ public final class PersistenceProperties extends AbstractPersistenceProperties { public static class Link { public static final String table = "FILE_LINK"; } - public static class Config { + public static class FileConfig { public static final String table = "FILE_CONFIG"; } diff --git a/o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/open/FileConfig.java b/o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/open/FileConfig.java index 3ed54d22bccd4de5903621f5c6eb90bb15531289..1699fed4b624873b258f5eca96b8bc5669acfec7 100644 --- a/o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/open/FileConfig.java +++ b/o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/open/FileConfig.java @@ -1,28 +1,37 @@ package com.x.file.core.entity.open; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.entity.SliceJpaObject; -import com.x.base.core.entity.annotation.*; -import com.x.base.core.project.annotation.FieldDescribe; -import com.x.file.core.entity.PersistenceProperties; -import org.apache.commons.lang3.StringUtils; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; +import javax.persistence.UniqueConstraint; + import org.apache.openjpa.persistence.Persistent; import org.apache.openjpa.persistence.jdbc.Index; import org.apache.openjpa.persistence.jdbc.Strategy; -import javax.persistence.*; +import com.x.base.core.entity.JpaObject; +import com.x.base.core.entity.SliceJpaObject; +import com.x.base.core.entity.annotation.CheckPersist; +import com.x.base.core.entity.annotation.CitationNotExist; +import com.x.base.core.entity.annotation.ContainerEntity; +import com.x.base.core.project.annotation.FieldDescribe; +import com.x.file.core.entity.PersistenceProperties; -@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) +@ContainerEntity(dumpSize = 100, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) @Entity -@Table(name = PersistenceProperties.Open.Config.table, uniqueConstraints = { - @UniqueConstraint(name = PersistenceProperties.Personal.Folder.table + JpaObject.IndexNameMiddle +@Table(name = PersistenceProperties.Open.FileConfig.table, uniqueConstraints = { + @UniqueConstraint(name = PersistenceProperties.Open.FileConfig.table + JpaObject.IndexNameMiddle + JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN, JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) }) @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public class FileConfig extends SliceJpaObject { private static final long serialVersionUID = -2266232193925155825L; - private static final String TABLE = PersistenceProperties.Open.Config.table; + private static final String TABLE = PersistenceProperties.Open.FileConfig.table; public String getId() { return id; @@ -40,7 +49,7 @@ public class FileConfig extends SliceJpaObject { /* 以上为 JpaObject 默认字段 */ public void onPersist() throws Exception { - if(this.properties == null){ + if (this.properties == null) { this.properties = new FileConfigProperties(); } } diff --git a/o2server/x_general_assemble_control/pom.xml b/o2server/x_general_assemble_control/pom.xml index 393ce3b2d7133a445bea83cd0c22b5296b41f9fc..a6c1176e21a0cb0bde9cc5f8abf6c15df23f98af 100644 --- a/o2server/x_general_assemble_control/pom.xml +++ b/o2server/x_general_assemble_control/pom.xml @@ -124,6 +124,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/ActionApplication.java b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/ActionApplication.java index 4f515376ebde8794e5b8fc49177a8caf75062113..0d766cf24b086d42125962a16bdefe84cad0f9fb 100644 --- a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/ActionApplication.java +++ b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/ActionApplication.java @@ -8,6 +8,7 @@ import com.x.base.core.project.jaxrs.AbstractActionApplication; import com.x.general.assemble.control.jaxrs.area.AreaAction; import com.x.general.assemble.control.jaxrs.ecnet.EcnetAction; import com.x.general.assemble.control.jaxrs.office.OfficeAction; +import com.x.general.assemble.control.jaxrs.worktime.WorkTimeAction; @ApplicationPath("jaxrs") public class ActionApplication extends AbstractActionApplication { @@ -16,6 +17,7 @@ public class ActionApplication extends AbstractActionApplication { classes.add(AreaAction.class); classes.add(EcnetAction.class); classes.add(OfficeAction.class); + classes.add(WorkTimeAction.class); return classes; } diff --git a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/WorkTimeJaxrsFilter.java b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/WorkTimeJaxrsFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..a552ca99dc85d02be5412d14376f2b702d319222 --- /dev/null +++ b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/WorkTimeJaxrsFilter.java @@ -0,0 +1,10 @@ +package com.x.general.assemble.control.jaxrs; + +import javax.servlet.annotation.WebFilter; + +import com.x.base.core.project.jaxrs.AnonymousCipherManagerUserJaxrsFilter; + +@WebFilter(urlPatterns = "/jaxrs/worktime/*", asyncSupported = true) +public class WorkTimeJaxrsFilter extends AnonymousCipherManagerUserJaxrsFilter { + +} diff --git a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionBetweenMinutes.java b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionBetweenMinutes.java new file mode 100644 index 0000000000000000000000000000000000000000..84d063ef12219eb561ed7e900f68f4522cb8d3b1 --- /dev/null +++ b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionBetweenMinutes.java @@ -0,0 +1,27 @@ +package com.x.general.assemble.control.jaxrs.worktime; + +import java.util.Date; + +import com.x.base.core.project.config.Config; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.WrapInteger; +import com.x.base.core.project.tools.DateTools; + +public class ActionBetweenMinutes extends BaseAction { + + ActionResult execute(EffectivePerson effectivePerson, String start, String end) throws Exception { + ActionResult result = new ActionResult<>(); + Date dateOfStart = DateTools.parse(start); + Date dateOfEnd = DateTools.parse(end); + Wo wo = new Wo(); + wo.setValue((int) Config.workTime().betweenMinutes(dateOfStart, dateOfEnd)); + result.setData(wo); + return result; + } + + public static class Wo extends WrapInteger { + + } + +} diff --git a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionForwardDays.java b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionForwardDays.java new file mode 100644 index 0000000000000000000000000000000000000000..d823b5486bfa501a265b9b6dda879c3723f6823a --- /dev/null +++ b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionForwardDays.java @@ -0,0 +1,27 @@ +package com.x.general.assemble.control.jaxrs.worktime; + +import java.util.Date; + +import com.x.base.core.project.config.Config; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.WrapString; +import com.x.base.core.project.tools.DateTools; + +public class ActionForwardDays extends BaseAction { + + ActionResult execute(EffectivePerson effectivePerson, String start, long days) throws Exception { + ActionResult result = new ActionResult<>(); + Date dateOfStart = DateTools.parse(start); + Wo wo = new Wo(); + wo.setValue(DateTools + .format(Config.workTime().forwardMinutes(dateOfStart, days * Config.workTime().minutesOfWorkDay()))); + result.setData(wo); + return result; + } + + public static class Wo extends WrapString { + + } + +} diff --git a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionForwardMinutes.java b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionForwardMinutes.java new file mode 100644 index 0000000000000000000000000000000000000000..39ce7cb5002e4913620d553a215d5ec87ae82a50 --- /dev/null +++ b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionForwardMinutes.java @@ -0,0 +1,26 @@ +package com.x.general.assemble.control.jaxrs.worktime; + +import java.util.Date; + +import com.x.base.core.project.config.Config; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.WrapString; +import com.x.base.core.project.tools.DateTools; + +public class ActionForwardMinutes extends BaseAction { + + ActionResult execute(EffectivePerson effectivePerson, String start, long minutes) throws Exception { + ActionResult result = new ActionResult<>(); + Date dateOfStart = DateTools.parse(start); + Wo wo = new Wo(); + wo.setValue(DateTools.format(Config.workTime().forwardMinutes(dateOfStart, minutes))); + result.setData(wo); + return result; + } + + public static class Wo extends WrapString { + + } + +} diff --git a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionIsWorkDay.java b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionIsWorkDay.java new file mode 100644 index 0000000000000000000000000000000000000000..e1ec07955fa8072eaba7022f4748162816738d5c --- /dev/null +++ b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionIsWorkDay.java @@ -0,0 +1,26 @@ +package com.x.general.assemble.control.jaxrs.worktime; + +import java.util.Date; + +import com.x.base.core.project.config.Config; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.WrapBoolean; +import com.x.base.core.project.tools.DateTools; + +public class ActionIsWorkDay extends BaseAction { + + ActionResult execute(EffectivePerson effectivePerson, String date) throws Exception { + ActionResult result = new ActionResult<>(); + Date dateObject = DateTools.parse(date); + Wo wo = new Wo(); + wo.setValue(Config.workTime().isWorkDay(dateObject)); + result.setData(wo); + return result; + } + + public static class Wo extends WrapBoolean { + + } + +} diff --git a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionIsWorkTime.java b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionIsWorkTime.java new file mode 100644 index 0000000000000000000000000000000000000000..dea53d20c07dbf76e955e74a5a2cf9826c0e5419 --- /dev/null +++ b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionIsWorkTime.java @@ -0,0 +1,26 @@ +package com.x.general.assemble.control.jaxrs.worktime; + +import java.util.Date; + +import com.x.base.core.project.config.Config; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.WrapBoolean; +import com.x.base.core.project.tools.DateTools; + +public class ActionIsWorkTime extends BaseAction { + + ActionResult execute(EffectivePerson effectivePerson, String date) throws Exception { + ActionResult result = new ActionResult<>(); + Date dateObject = DateTools.parse(date); + Wo wo = new Wo(); + wo.setValue(Config.workTime().isWorkTime(dateObject)); + result.setData(wo); + return result; + } + + public static class Wo extends WrapBoolean { + + } + +} diff --git a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionMinutesOfWorkDay.java b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionMinutesOfWorkDay.java new file mode 100644 index 0000000000000000000000000000000000000000..d39fcedee9463f97e482c8c443a21cc246e9c897 --- /dev/null +++ b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionMinutesOfWorkDay.java @@ -0,0 +1,22 @@ +package com.x.general.assemble.control.jaxrs.worktime; + +import com.x.base.core.project.config.Config; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.WrapInteger; + +public class ActionMinutesOfWorkDay extends BaseAction { + + ActionResult execute(EffectivePerson effectivePerson) throws Exception { + ActionResult result = new ActionResult<>(); + Wo wo = new Wo(); + wo.setValue((int) Config.workTime().minutesOfWorkDay()); + result.setData(wo); + return result; + } + + public static class Wo extends WrapInteger { + + } + +} diff --git a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/BaseAction.java b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/BaseAction.java new file mode 100644 index 0000000000000000000000000000000000000000..fae74447880396e20dab2ab2867be7012600d433 --- /dev/null +++ b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/BaseAction.java @@ -0,0 +1,7 @@ +package com.x.general.assemble.control.jaxrs.worktime; + +import com.x.base.core.project.jaxrs.StandardJaxrsAction; + +abstract class BaseAction extends StandardJaxrsAction { + +} diff --git a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/WorkTimeAction.java b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/WorkTimeAction.java new file mode 100644 index 0000000000000000000000000000000000000000..146e3ca0a3b4c65be1042a2c6e926b44dfd2da49 --- /dev/null +++ b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/WorkTimeAction.java @@ -0,0 +1,141 @@ +package com.x.general.assemble.control.jaxrs.worktime; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.container.AsyncResponse; +import javax.ws.rs.container.Suspended; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; + +import com.x.base.core.project.annotation.JaxrsDescribe; +import com.x.base.core.project.annotation.JaxrsMethodDescribe; +import com.x.base.core.project.annotation.JaxrsParameterDescribe; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.http.HttpMediaType; +import com.x.base.core.project.jaxrs.ResponseFactory; +import com.x.base.core.project.jaxrs.StandardJaxrsAction; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; + +@Path("worktime") +@JaxrsDescribe("工作时间") +public class WorkTimeAction extends StandardJaxrsAction { + + private static Logger logger = LoggerFactory.getLogger(WorkTimeAction.class); + + @JaxrsMethodDescribe(value = "计算开始时间和结束时间之间的工作时间间隔(分钟).", action = ActionBetweenMinutes.class) + @GET + @Path("betweenminutes/start/{start}/end/{end}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void betweenMinutes(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("开始时间") @PathParam("start") String start, + @JaxrsParameterDescribe("结束时间") @PathParam("end") String end) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionBetweenMinutes().execute(effectivePerson, start, end); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "计算开始时间前进指定分钟数后的工作时间.", action = ActionForwardMinutes.class) + @GET + @Path("forwardminutes/start/{start}/minutes/{minutes}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void forwardMinutes(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("开始时间") @PathParam("start") String start, + @JaxrsParameterDescribe("前进分钟数") @PathParam("minutes") int minutes) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionForwardMinutes().execute(effectivePerson, start, minutes); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "计算开始时间前进指定工作天数后的工作时间.", action = ActionForwardDays.class) + @GET + @Path("forwarddays/start/{start}/days/{days}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void forwardDays(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("开始时间") @PathParam("start") String start, + @JaxrsParameterDescribe("前进工作天数") @PathParam("days") int days) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionForwardDays().execute(effectivePerson, start, days); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "返回一个工作日的工作分钟数.", action = ActionMinutesOfWorkDay.class) + @GET + @Path("minutesofworkday") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void minutesOfWorkDay(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionMinutesOfWorkDay().execute(effectivePerson); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "返回指定时间是否是工作时间.", action = ActionIsWorkTime.class) + @GET + @Path("isworktime/{date}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void isWorkTime(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("指定时间") @PathParam("date") String date) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionIsWorkTime().execute(effectivePerson, date); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "返回指定时间是否是工作日.", action = ActionIsWorkDay.class) + @GET + @Path("isworkday/{date}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void isWorkDay(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("指定日期") @PathParam("date") String date) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionIsWorkDay().execute(effectivePerson, date); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + +} \ No newline at end of file diff --git a/o2server/x_general_core_entity/src/main/java/com/x/general/core/entity/file/GeneralFile.java b/o2server/x_general_core_entity/src/main/java/com/x/general/core/entity/file/GeneralFile.java index e3006523977717356e0adccc049fe4b57557770f..da014d449a3a69b7e6ee26b9e1b6769c8a13ee78 100644 --- a/o2server/x_general_core_entity/src/main/java/com/x/general/core/entity/file/GeneralFile.java +++ b/o2server/x_general_core_entity/src/main/java/com/x/general/core/entity/file/GeneralFile.java @@ -163,7 +163,7 @@ public class GeneralFile extends StorageObject { @FieldDescribe("文件名称.") @Column(length = length_255B, name = ColumnNamePrefix + name_FIELDNAME) @Index(name = TABLE + IndexNameMiddle + name_FIELDNAME) - @CheckPersist(allowEmpty = false, fileNameString = true) + @CheckPersist(allowEmpty = false) private String name; public static final String extension_FIELDNAME = "extension"; diff --git a/o2server/x_hotpic_assemble_control/pom.xml b/o2server/x_hotpic_assemble_control/pom.xml index 5f1fd520ae1c29c51ae5b032a0959ae49531f047..17982257b0c32f1ce1f27cda7a9ba2b2a75f9886 100644 --- a/o2server/x_hotpic_assemble_control/pom.xml +++ b/o2server/x_hotpic_assemble_control/pom.xml @@ -136,6 +136,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_jpush_assemble_control/pom.xml b/o2server/x_jpush_assemble_control/pom.xml index 9c7a59c02fce46fc2f7512576dc2ed4361c5ff23..a35ff14c9d549b0268359d8de67ce6f5e90ce1ad 100644 --- a/o2server/x_jpush_assemble_control/pom.xml +++ b/o2server/x_jpush_assemble_control/pom.xml @@ -133,6 +133,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_meeting_assemble_control/pom.xml b/o2server/x_meeting_assemble_control/pom.xml index d30c4eca07a3c85d20adc938e8c047332e8507f6..f62dac6656e67762dfa3ad28c421c4a5925796a6 100644 --- a/o2server/x_meeting_assemble_control/pom.xml +++ b/o2server/x_meeting_assemble_control/pom.xml @@ -128,6 +128,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_message_assemble_communicate/pom.xml b/o2server/x_message_assemble_communicate/pom.xml index c21e2d73b476a32e767c7062a037c693bdaa10d9..e619b39d8077b7f4d474ea740cc50395cb05eafc 100644 --- a/o2server/x_message_assemble_communicate/pom.xml +++ b/o2server/x_message_assemble_communicate/pom.xml @@ -153,6 +153,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/schedule/Clean.java b/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/schedule/Clean.java index cb1f6eb5bb0e5ba98d5918827e0755f15a411db4..defa2dc6d013638ea64079ff7f308e1912d0118a 100644 --- a/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/schedule/Clean.java +++ b/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/schedule/Clean.java @@ -98,7 +98,7 @@ public class Clean extends AbstractJob { Root root = cq.from(Message.class); Date limit = DateUtils.addDays(new Date(), -Config.communicate().clean().getKeep()); Predicate p = cb.lessThan(root.get(Message_.createTime), limit); - return em.createQuery(cq.select(root).where(p)).setMaxResults(2000).getResultList(); + return em.createQuery(cq.select(root).where(p)).setMaxResults(200).getResultList(); } } \ No newline at end of file diff --git a/o2server/x_mind_assemble_control/pom.xml b/o2server/x_mind_assemble_control/pom.xml index ca2dd094fcbcbe27cea4b668a98a48690edef162..dca6f8ccc7b84d002cc7bfa80ad59594662c50d3 100644 --- a/o2server/x_mind_assemble_control/pom.xml +++ b/o2server/x_mind_assemble_control/pom.xml @@ -124,6 +124,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_organization_assemble_authentication/pom.xml b/o2server/x_organization_assemble_authentication/pom.xml index c3aec802f84efe2ed8e281432a2e6e6df032f34b..025b9c3930eee977de94634d6ffe4dd2cfd2011e 100644 --- a/o2server/x_organization_assemble_authentication/pom.xml +++ b/o2server/x_organization_assemble_authentication/pom.xml @@ -120,6 +120,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/ActionInfo.java b/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/ActionInfo.java index 49efbc1ea9a5cd3795b546b4c6616f4eee8892dd..b2a2281d096bc3e0f02352108fa0f2686ff863ae 100644 --- a/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/ActionInfo.java +++ b/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/ActionInfo.java @@ -1,6 +1,5 @@ package com.x.organization.assemble.authentication.jaxrs.oauth; -import java.math.BigDecimal; import java.util.LinkedHashMap; import java.util.Objects; import java.util.Optional; @@ -10,6 +9,7 @@ import java.util.regex.Pattern; import javax.script.CompiledScript; import javax.script.ScriptContext; import javax.script.SimpleScriptContext; +import javax.servlet.http.HttpServletRequest; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.StringUtils; @@ -18,11 +18,15 @@ import org.apache.commons.text.StringEscapeUtils; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.annotation.CheckRemoveType; +import com.x.base.core.project.cache.Cache.CacheCategory; +import com.x.base.core.project.cache.Cache.CacheKey; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.config.Config; import com.x.base.core.project.config.Token.InitialManager; import com.x.base.core.project.config.Token.Oauth; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.http.HttpToken; import com.x.base.core.project.jaxrs.WoText; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; @@ -30,9 +34,6 @@ import com.x.base.core.project.script.ScriptFactory; import com.x.organization.assemble.authentication.Business; import com.x.organization.core.entity.OauthCode; import com.x.organization.core.entity.Person; -import com.x.base.core.project.cache.Cache.CacheCategory; -import com.x.base.core.project.cache.Cache.CacheKey; -import com.x.base.core.project.cache.CacheManager; class ActionInfo extends BaseAction { @@ -42,10 +43,17 @@ class ActionInfo extends BaseAction { private static CacheCategory cache = new CacheCategory(Person.class); - ActionResult execute(EffectivePerson effectivePerson, String accessToken) throws Exception { + ActionResult execute(HttpServletRequest request, EffectivePerson effectivePerson, String accessToken, + String contentType) throws Exception { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { ActionResult result = new ActionResult<>(); Business business = new Business(emc); + if (StringUtils.isEmpty(accessToken)) { + String bearer = request.getHeader(HttpToken.X_Authorization); + if (StringUtils.isNotEmpty(bearer)) { + accessToken = StringUtils.substringAfter(bearer, " "); + } + } if (StringUtils.isEmpty(accessToken)) { throw new ExceptionAccessTokenEmpty(); } @@ -63,6 +71,7 @@ class ActionInfo extends BaseAction { Info info = this.info(business, oauthCode, oauth); Wo wo = new Wo(); wo.setText(gson.toJson(info)); + wo.setContentType(contentType); result.setData(wo); return result; } diff --git a/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/ActionToken.java b/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/ActionToken.java index 46fdd4becfd03f2f74daf4095a93883921a22507..dd892820ab76c640f3fb93c29334007432e2a304 100644 --- a/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/ActionToken.java +++ b/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/ActionToken.java @@ -4,7 +4,6 @@ import org.apache.commons.lang3.StringUtils; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.config.Token.Oauth; import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; @@ -18,7 +17,8 @@ class ActionToken extends StandardJaxrsAction { private static Logger logger = LoggerFactory.getLogger(ActionToken.class); - ActionResult execute(EffectivePerson effectivePerson, String code, String grant_type) throws Exception { + ActionResult execute(EffectivePerson effectivePerson, String code, String grant_type, String contentType) + throws Exception { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { ActionResult result = new ActionResult<>(); if (StringUtils.isEmpty(code)) { @@ -44,6 +44,7 @@ class ActionToken extends StandardJaxrsAction { woToken.setExpires_in(3600); Wo wo = new Wo(); wo.setText(gson.toJson(woToken)); + wo.setContentType(contentType); result.setData(wo); return result; } @@ -52,6 +53,17 @@ class ActionToken extends StandardJaxrsAction { public static class WoToken extends GsonPropertyObject { private String access_token; private Integer expires_in; +// private String token_type = "bearer"; +// private String refresh_token = "123"; +// private String scope = "read"; + +// public String getToken_type() { +// return token_type; +// } +// +// public void setToken_type(String token_type) { +// this.token_type = token_type; +// } public String getAccess_token() { return access_token; diff --git a/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/OauthAction.java b/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/OauthAction.java index 5f7168448d1b91ab92c7fce5ba068c9d5951b322..cd71074c8184171e25d40a18edfcfcdd3f9299ea 100644 --- a/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/OauthAction.java +++ b/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/OauthAction.java @@ -7,7 +7,6 @@ import javax.ws.rs.FormParam; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; -import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.container.AsyncResponse; @@ -32,37 +31,6 @@ public class OauthAction extends StandardJaxrsAction { private static Logger logger = LoggerFactory.getLogger(OauthAction.class); - // response_type:表示授权类型,必选项,此处的值固定为"code" - // client_id:表示客户端的ID,必选项 - // client_secret:表示客户端的密钥,必选项 - // redirect_uri:表示重定向URI,可选项 - // scope:表示申请的权限范围,可选项 - // state:表示客户端的当前状态,可以指定任意值,认证服务器会原封不动地返回这个值。 - -// @JaxrsMethodDescribe(value = "POST方法实现oauth认证auth方法", action = ActionAuth.class) -// @POST -// @Path("auth") -// @Consumes({ MediaType.MULTIPART_FORM_DATA, MediaType.APPLICATION_FORM_URLENCODED }) -// public void postAuth(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, -// @Context HttpServletResponse response, -// @JaxrsParameterDescribe("表示授权类型,必选项,此处的值固定为code") @FormParam("response_type") String response_type, -// @JaxrsParameterDescribe("表示客户端的ID") @FormParam("client_id") String client_id, -// @JaxrsParameterDescribe("表示客户端的密钥") @FormParam("client_secret") String client_secret, -// @JaxrsParameterDescribe("表示重定向URI") @FormParam("redirect_uri") String redirect_uri, -// @JaxrsParameterDescribe("表示申请的权限范围") @FormParam("scope") String scope, -// @JaxrsParameterDescribe("表示客户端的当前状态,可以指定任意值,认证服务器会原封不动地返回这个值") @FormParam("state") String state) { -// ActionResult result = new ActionResult<>(); -// EffectivePerson effectivePerson = this.effectivePerson(request); -// try { -// result = new ActionAuth().execute(effectivePerson, response_type, client_id, client_secret, redirect_uri, -// scope, state); -// } catch (Exception e) { -// logger.error(e, effectivePerson, request, null); -// result.error(e); -// } -// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); -// } - @JaxrsMethodDescribe(value = "GET方法实现oauth认证auth方法", action = ActionAuth.class) @GET @Path("auth") @@ -90,11 +58,12 @@ public class OauthAction extends StandardJaxrsAction { @Consumes({ MediaType.MULTIPART_FORM_DATA, MediaType.APPLICATION_FORM_URLENCODED }) public void postToken(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @Context HttpServletResponse response, @FormParam("code") String code, - @FormParam("grant_type") String grant_type) { + @FormParam("grant_type") String grant_type, + @JaxrsParameterDescribe("response CONTENT_TYPE 设置 默认为text/plain; charset=UTF-8") @FormParam("contentType") String contentType) { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = new ActionToken().execute(effectivePerson, code, grant_type); + result = new ActionToken().execute(effectivePerson, code, grant_type, contentType); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -107,11 +76,12 @@ public class OauthAction extends StandardJaxrsAction { @Path("token") public void getToken(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("code") String code, - @QueryParam("grant_type") String grant_type) { + @QueryParam("grant_type") String grant_type, + @JaxrsParameterDescribe("response CONTENT_TYPE 设置 默认为text/plain; charset=UTF-8") @QueryParam("contentType") String contentType) { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = new ActionToken().execute(effectivePerson, code, grant_type); + result = new ActionToken().execute(effectivePerson, code, grant_type, contentType); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -124,11 +94,12 @@ public class OauthAction extends StandardJaxrsAction { @Path("info") @Consumes({ MediaType.MULTIPART_FORM_DATA, MediaType.APPLICATION_FORM_URLENCODED }) public void postInfo(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @Context HttpServletResponse response, @FormParam("access_token") String access_token) { + @Context HttpServletResponse response, @FormParam("access_token") String access_token, + @JaxrsParameterDescribe("response CONTENT_TYPE 设置 默认为text/plain; charset=UTF-8") @FormParam("contentType") String contentType) { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = new ActionInfo().execute(effectivePerson, access_token); + result = new ActionInfo().execute(request, effectivePerson, access_token, contentType); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); @@ -141,11 +112,12 @@ public class OauthAction extends StandardJaxrsAction { @Path("info") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) public void getInfo(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @Context HttpServletResponse response, @QueryParam("access_token") String access_token) { + @Context HttpServletResponse response, @QueryParam("access_token") String access_token, + @JaxrsParameterDescribe("response CONTENT_TYPE 设置 默认为text/plain; charset=UTF-8") @QueryParam("contentType") String contentType) { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = new ActionInfo().execute(effectivePerson, access_token); + result = new ActionInfo().execute(request, effectivePerson, access_token, contentType); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); diff --git a/o2server/x_organization_assemble_control/pom.xml b/o2server/x_organization_assemble_control/pom.xml index 9036dea2efd986fd14e28180f965b94fad259932..f5e4c41113f4e30ba25e065b318e53d260576bac 100644 --- a/o2server/x_organization_assemble_control/pom.xml +++ b/o2server/x_organization_assemble_control/pom.xml @@ -150,6 +150,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionGetResult.java b/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionGetResult.java index 43fcd67f17aa1daf94dca14c3a11319e5f66e9b7..5d22c2568fa0bb330c08eddc1132644540d2fee9 100644 --- a/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionGetResult.java +++ b/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionGetResult.java @@ -1,5 +1,9 @@ package com.x.organization.assemble.control.jaxrs.inputperson; +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.project.config.StorageMapping; +import com.x.base.core.project.exception.ExceptionAccessDenied; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoFile; @@ -7,6 +11,9 @@ import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; import com.x.base.core.project.cache.Cache.CacheKey; import com.x.base.core.project.cache.CacheManager; +import com.x.general.core.entity.file.GeneralFile; +import com.x.organization.assemble.control.ThisApplication; +import org.apache.commons.lang3.StringUtils; import java.util.Optional; @@ -17,13 +24,28 @@ public class ActionGetResult extends BaseAction { protected ActionResult execute(EffectivePerson effectivePerson, String flag) throws Exception { logger.debug(effectivePerson, "flag:{}.", flag); ActionResult result = new ActionResult<>(); - CacheKey cacheKey = new CacheKey(flag); - Optional optional = CacheManager.get(this.cache, cacheKey); - if (!optional.isPresent()) { - throw new ExceptionResultNotFound(flag); + Wo wo = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + GeneralFile generalFile = emc.find(flag, GeneralFile.class); + if(generalFile!=null){ + if (!StringUtils.equals(effectivePerson.getDistinguishedName(), generalFile.getPerson())) { + throw new ExceptionAccessDenied(effectivePerson); + } + StorageMapping gfMapping = ThisApplication.context().storageMappings().get(GeneralFile.class, + generalFile.getStorage()); + wo = new Wo(generalFile.readContent(gfMapping), this.contentType(true, generalFile.getName()), + this.contentDisposition(true, generalFile.getName())); + result.setData(wo); + + generalFile.deleteContent(gfMapping); + emc.beginTransaction(GeneralFile.class); + emc.delete(GeneralFile.class, generalFile.getId()); + emc.commit(); + } else { + throw new ExceptionInputResultObject(flag); + } + } - CacheInputResult o = (CacheInputResult) optional.get(); - Wo wo = new Wo(o.getBytes(), this.contentType(true, o.getName()), this.contentDisposition(true, o.getName())); result.setData(wo); return result; } diff --git a/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionInputAll.java b/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionInputAll.java index d9aa86ab93ead5068c21e9ac68e722b5eca98f78..a9771818e0b26d49ea92abaa879fdc03e6812c4c 100644 --- a/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionInputAll.java +++ b/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionInputAll.java @@ -22,7 +22,10 @@ import javax.script.Bindings; import javax.script.ScriptContext; import javax.script.SimpleScriptContext; +import com.x.base.core.entity.annotation.CheckPersistType; import com.x.base.core.project.cache.CacheManager; +import com.x.base.core.project.config.StorageMapping; +import com.x.general.core.entity.file.GeneralFile; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.StringEscapeUtils; @@ -97,12 +100,7 @@ class ActionInputAll extends BaseAction { this.scanUnit(business, workbook); String name = "person_input_" + DateTools.formatDate(new Date()) + ".xlsx"; workbook.write(os); - CacheInputResult cacheInputResult = new CacheInputResult(); - cacheInputResult.setName(name); - cacheInputResult.setBytes(os.toByteArray()); - String flag = StringTools.uniqueToken(); - CacheKey cacheKey = new CacheKey(flag); - CacheManager.put(this.cache, cacheKey, cacheInputResult); + String flag = saveAttachment(os.toByteArray(),name,effectivePerson); CacheManager.notify(Person.class); CacheManager.notify(Group.class); CacheManager.notify(Role.class); @@ -1228,6 +1226,18 @@ class ActionInputAll extends BaseAction { o.setPassword(Crypto.encrypt(o.getPassword(), Config.token().getKey())); } } + + private String saveAttachment(byte[] bytes,String attachmentName,EffectivePerson effectivePerson) throws Exception { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + StorageMapping gfMapping = ThisApplication.context().storageMappings().random(GeneralFile.class); + GeneralFile generalFile = new GeneralFile(gfMapping.getName(), attachmentName, effectivePerson.getDistinguishedName()); + generalFile.saveContent(gfMapping, bytes, attachmentName); + emc.beginTransaction(GeneralFile.class); + emc.persist(generalFile, CheckPersistType.all); + emc.commit(); + return generalFile.getId(); + } + } public static class Wo extends GsonPropertyObject { diff --git a/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ExceptionInputResultObject.java b/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ExceptionInputResultObject.java new file mode 100644 index 0000000000000000000000000000000000000000..05052c80df8542fca50416911b244887ddb26d5b --- /dev/null +++ b/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ExceptionInputResultObject.java @@ -0,0 +1,13 @@ +package com.x.organization.assemble.control.jaxrs.inputperson; + +import com.x.base.core.project.exception.PromptException; + +public class ExceptionInputResultObject extends PromptException { + + private static final long serialVersionUID = 9085364457175859374L; + + ExceptionInputResultObject(String flag) { + super("对象不存在:{}.", flag); + } + +} diff --git a/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/unit/ActionCreate.java b/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/unit/ActionCreate.java index 12b104c1c57826a0c3385992dc013d568d6483af..38fa7440ccbd19c8476dbe43311e68d39d530ac4 100644 --- a/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/unit/ActionCreate.java +++ b/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/unit/ActionCreate.java @@ -87,7 +87,7 @@ class ActionCreate extends BaseAction { private static final long serialVersionUID = -6314932919066148113L; static WrapCopier copier = WrapCopierFactory.wi(Wi.class, Unit.class, null, - ListTools.toList(JpaObject.FieldsUnmodify, Unit.superior_FIELDNAME, Unit.pinyin_FIELDNAME, + ListTools.toList(JpaObject.FieldsUnmodify, Unit.pinyin_FIELDNAME, Unit.pinyinInitial_FIELDNAME, Unit.level_FIELDNAME, Unit.levelName_FIELDNAME, Unit.inheritedControllerList_FIELDNAME)); } diff --git a/o2server/x_organization_assemble_express/pom.xml b/o2server/x_organization_assemble_express/pom.xml index 01e13ca6f4b2605ad0f11a68be5965280b8b8814..b855430f519710e940c21fa8e6589d7e437e8a79 100644 --- a/o2server/x_organization_assemble_express/pom.xml +++ b/o2server/x_organization_assemble_express/pom.xml @@ -116,6 +116,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPersonWithUnitObject.java b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPersonWithUnitObject.java index 7a06397b9d4dcb0ca58f92c0a4fdf4b7e114ec16..7c9792e0c24e3cdbf881aec2b3ad927fa1ee61af 100644 --- a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPersonWithUnitObject.java +++ b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPersonWithUnitObject.java @@ -64,12 +64,11 @@ class ActionListWithPersonWithUnitObject extends BaseAction { Root root = cq.from(Identity.class); Predicate p = cb.disjunction(); for (Pair o : cartesian) { - p = cb.or(cb.and(cb.equal(root.get(Identity_.unit), o.getUnit()), + p = cb.or(p, cb.and(cb.equal(root.get(Identity_.unit), o.getUnit()), cb.equal(root.get(Identity_.person), o.getPerson()))); } - List identityIds = em.createQuery(cq.select(root.get(Identity_.id)).where(p)) - .getResultList().stream().distinct().collect(Collectors.toList()); - identityIds = ListTools.trim(identityIds, true, true); + List identityIds = em.createQuery(cq.select(root.get(Identity_.id)).where(p)).getResultList().stream() + .distinct().collect(Collectors.toList()); List list = business.identity().pick(identityIds); for (Identity o : list) { wos.add(this.convert(business, o, Wo.class)); diff --git a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/ActionGetWithUnitWithName.java b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/ActionGetWithUnitWithName.java new file mode 100644 index 0000000000000000000000000000000000000000..65de4d4f643a862f5b0bad778168eca2cec059dc --- /dev/null +++ b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/ActionGetWithUnitWithName.java @@ -0,0 +1,104 @@ +package com.x.organization.assemble.express.jaxrs.unitduty; + +import com.google.gson.JsonElement; +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.entity.JpaObject; +import com.x.base.core.project.annotation.FieldDescribe; +import com.x.base.core.project.bean.WrapCopier; +import com.x.base.core.project.bean.WrapCopierFactory; +import com.x.base.core.project.cache.Cache.CacheKey; +import com.x.base.core.project.cache.CacheManager; +import com.x.base.core.project.gson.GsonPropertyObject; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.organization.assemble.express.Business; +import com.x.organization.core.entity.Unit; +import com.x.organization.core.entity.UnitDuty; +import com.x.organization.core.entity.UnitDuty_; +import org.apache.commons.lang3.StringUtils; + +import javax.persistence.EntityManager; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import java.util.List; +import java.util.Optional; + +class ActionGetWithUnitWithName extends BaseAction { + + ActionResult execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Wi wi = this.convertToWrapIn(jsonElement, Wi.class); + ActionResult result = new ActionResult<>(); + Business business = new Business(emc); + if(StringUtils.isBlank(wi.getName()) || StringUtils.isBlank(wi.getUnit())){ + return result; + } + CacheKey cacheKey = new CacheKey(this.getClass(), wi.getName(), wi.getUnit()); + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + result.setData((Wo) optional.get()); + } else { + Wo wo = this.getUnitDutity(business, wi.getName(), wi.getUnit()); + CacheManager.put(cacheCategory, cacheKey, wo); + result.setData(wo); + } + return result; + } + } + + public static class Wi extends GsonPropertyObject { + + @FieldDescribe("职务名称") + private String name; + @FieldDescribe("组织") + private String unit; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + } + + public static class Wo extends UnitDuty { + + private static final long serialVersionUID = -8346394290549763465L; + + static WrapCopier copier = WrapCopierFactory.wo(UnitDuty.class, Wo.class, null, + JpaObject.FieldsInvisible); + + } + + private Wo getUnitDutity(Business business, String name, String unitFlag) throws Exception { + Wo wo = null; + Unit unit = business.unit().pick(unitFlag); + if (null != unit) { + EntityManager em = business.entityManagerContainer().get(UnitDuty.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(UnitDuty.class); + Root root = cq.from(UnitDuty.class); + Predicate p = cb.equal(root.get(UnitDuty_.unit), unit.getId()); + p = cb.and(p, cb.equal(root.get(UnitDuty_.name), name)); + List os = em.createQuery(cq.select(root).where(p)).getResultList(); + if (!os.isEmpty()) { + wo = Wo.copier.copy(os.get(0)); + } + } + return wo; + } + +} \ No newline at end of file diff --git a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/ActionListIdentityWithUnitWithName.java b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/ActionListIdentityWithUnitWithName.java index ba38f9b18ae37d338876d698571f19100d7f81e2..523c129333b9a4b58e30bfa9db3aa471d298459c 100644 --- a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/ActionListIdentityWithUnitWithName.java +++ b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/ActionListIdentityWithUnitWithName.java @@ -10,6 +10,10 @@ import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; +import com.x.base.core.entity.JpaObject; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import com.google.gson.JsonElement; @@ -28,7 +32,7 @@ import com.x.organization.core.entity.UnitDuty; import com.x.organization.core.entity.UnitDuty_; class ActionListIdentityWithUnitWithName extends BaseAction { - + private static Logger logger = LoggerFactory.getLogger(ActionListIdentityWithUnitWithName.class); ActionResult execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { Wi wi = this.convertToWrapIn(jsonElement, Wi.class); @@ -50,12 +54,12 @@ class ActionListIdentityWithUnitWithName extends BaseAction { } names = ListTools.trim(names, true, true); units = ListTools.trim(units, true, true); - CacheKey cacheKey = new CacheKey(this.getClass(), names, units); + CacheKey cacheKey = new CacheKey(this.getClass(), names, units, wi.getRecursiveUnit()); Optional optional = CacheManager.get(cacheCategory, cacheKey); if (optional.isPresent()) { result.setData((Wo) optional.get()); } else { - Wo wo = this.list(business, names, units); + Wo wo = this.list(business, names, units, wi.getRecursiveUnit()); CacheManager.put(cacheCategory, cacheKey, wo); result.setData(wo); } @@ -65,17 +69,21 @@ class ActionListIdentityWithUnitWithName extends BaseAction { public static class Wi extends GsonPropertyObject { - @FieldDescribe("组织属性名称") + @FieldDescribe("组织职务名称") private String name; + @FieldDescribe("组织") private String unit; - @FieldDescribe("组织属性名称(多值)") + @FieldDescribe("组织职务名称(多值)") private List nameList; @FieldDescribe("组织(多值)") private List unitList; + @FieldDescribe("是否递归下级组织(默认false)") + private Boolean recursiveUnit; + public String getName() { return name; } @@ -108,6 +116,13 @@ class ActionListIdentityWithUnitWithName extends BaseAction { this.unitList = unitList; } + public Boolean getRecursiveUnit() { + return recursiveUnit; + } + + public void setRecursiveUnit(Boolean recursiveUnit) { + this.recursiveUnit = recursiveUnit; + } } public static class Wo extends GsonPropertyObject { @@ -125,27 +140,44 @@ class ActionListIdentityWithUnitWithName extends BaseAction { } - private Wo list(Business business, List names, List units) throws Exception { + private Wo list(Business business, List names, List units, Boolean recursiveUnit) throws Exception { Wo wo = new Wo(); - List identityIds = new ArrayList<>(); - for (String str : units) { - Unit unit = business.unit().pick(str); - if (null != unit) { + List os = new ArrayList<>(); + if(units.isEmpty()){ + EntityManager em = business.entityManagerContainer().get(UnitDuty.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(UnitDuty.class); + Root root = cq.from(UnitDuty.class); + Predicate p = root.get(UnitDuty_.name).in(names); + os = em.createQuery(cq.select(root).where(p)).getResultList(); + }else{ + List unitList = business.unit().pick(units); + if(!unitList.isEmpty()){ + units.clear(); + for(Unit unit : unitList){ + units.add(unit.getId()); + if(BooleanUtils.isTrue(recursiveUnit)){ + units.addAll(business.unit().listSubNested(unit.getId())); + } + } + units = ListTools.trim(units, true, true); EntityManager em = business.entityManagerContainer().get(UnitDuty.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(UnitDuty.class); Root root = cq.from(UnitDuty.class); - Predicate p = cb.equal(root.get(UnitDuty_.unit), unit.getId()); - p = cb.and(p, root.get(UnitDuty_.name).in(names)); - List os = em.createQuery(cq.select(root).where(p)).getResultList(); - if (!os.isEmpty()) { - for (UnitDuty o : os) { - identityIds.addAll(o.getIdentityList()); - } - } + Predicate p = root.get(UnitDuty_.name).in(names); + p = cb.and(p, root.get(UnitDuty_.unit).in(units)); + os = em.createQuery(cq.select(root).where(p)).getResultList(); + } + } + + List identityIds = new ArrayList<>(); + if (!os.isEmpty()) { + for (UnitDuty o : os) { + identityIds.addAll(o.getIdentityList()); } + identityIds = ListTools.trim(identityIds, true, true); } - identityIds = ListTools.trim(identityIds, true, true); List list = business.identity().listIdentityDistinguishedNameSorted(identityIds); wo.getIdentityList().addAll(list); return wo; diff --git a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/ActionListIdentityWithUnitWithNameObject.java b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/ActionListIdentityWithUnitWithNameObject.java index 2272e8b14ae347a8cbf2a8c9f8fe781bcc1c9b02..7142efa2da05274b9d64e6be31a478dfcae8fbcb 100644 --- a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/ActionListIdentityWithUnitWithNameObject.java +++ b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/ActionListIdentityWithUnitWithNameObject.java @@ -1,9 +1,9 @@ package com.x.organization.assemble.express.jaxrs.unitduty; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; +import java.util.*; +import com.x.organization.core.entity.*; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import com.google.gson.JsonElement; @@ -17,10 +17,12 @@ import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.tools.ListTools; import com.x.organization.assemble.express.Business; -import com.x.organization.core.entity.Identity; -import com.x.organization.core.entity.Person; -import com.x.organization.core.entity.Unit; -import com.x.organization.core.entity.UnitDuty; + +import javax.persistence.EntityManager; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; class ActionListIdentityWithUnitWithNameObject extends BaseAction { @@ -46,12 +48,12 @@ class ActionListIdentityWithUnitWithNameObject extends BaseAction { } names = ListTools.trim(names, true, true); units = ListTools.trim(units, true, true); - CacheKey cacheKey = new CacheKey(this.getClass(), names, units); + CacheKey cacheKey = new CacheKey(this.getClass(), names, units, wi.getRecursiveUnit()); Optional optional = CacheManager.get(cacheCategory, cacheKey); if (optional.isPresent()) { result.setData((List) optional.get()); } else { - List wos = this.list(business, names, units); + List wos = this.list(business, names, units, wi.getRecursiveUnit()); CacheManager.put(cacheCategory, cacheKey, wos); result.setData(wos); } @@ -61,17 +63,21 @@ class ActionListIdentityWithUnitWithNameObject extends BaseAction { public static class Wi extends GsonPropertyObject { - @FieldDescribe("组织属性名称") + @FieldDescribe("组织职务名称") private String name; + @FieldDescribe("组织") private String unit; - @FieldDescribe("组织属性名称(多值)") + @FieldDescribe("组织职务名称(多值)") private List nameList; @FieldDescribe("组织(多值)") private List unitList; + @FieldDescribe("是否递归下级组织(默认false)") + private Boolean recursiveUnit; + public String getName() { return name; } @@ -104,6 +110,14 @@ class ActionListIdentityWithUnitWithNameObject extends BaseAction { this.unitList = unitList; } + public Boolean getRecursiveUnit() { + return recursiveUnit; + } + + public void setRecursiveUnit(Boolean recursiveUnit) { + this.recursiveUnit = recursiveUnit; + } + } public static class Wo extends com.x.base.core.project.organization.Identity { @@ -138,21 +152,58 @@ class ActionListIdentityWithUnitWithNameObject extends BaseAction { } - private List list(Business business, List names, List units) throws Exception { + private List list(Business business, List names, List units, Boolean recursiveUnit) throws Exception { List wos = new ArrayList<>(); - for (String str : units) { - Unit matchUnit = business.unit().pick(str); - if (null != matchUnit) { - List os = business.entityManagerContainer().listEqualAndIn(UnitDuty.class, - UnitDuty.unit_FIELDNAME, matchUnit.getId(), UnitDuty.name_FIELDNAME, names); - for (UnitDuty o : os) { - for (Identity identity : business.identity().pick(o.getIdentityList())) { - Unit unit = business.unit().pick(identity.getUnit()); - Person person = business.person().pick(identity.getPerson()); - Wo wo = this.convertToIdentity(matchUnit, unit, person, identity); - wos.add(wo); + List os = new ArrayList<>(); + Map unitMap = new HashMap<>(); + if(units.isEmpty()){ + EntityManager em = business.entityManagerContainer().get(UnitDuty.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(UnitDuty.class); + Root root = cq.from(UnitDuty.class); + Predicate p = root.get(UnitDuty_.name).in(names); + os = em.createQuery(cq.select(root).where(p)).getResultList(); + }else{ + List unitList = business.unit().pick(units); + if(!unitList.isEmpty()){ + units.clear(); + for(Unit unit : unitList){ + units.add(unit.getId()); + unitMap.put(unit.getId(), unit); + if(BooleanUtils.isTrue(recursiveUnit)){ + List subUnitList = business.unit().listSubNestedObject(unit); + for (Unit subunit:subUnitList) { + unitMap.put(subunit.getId(), subunit); + units.add(subunit.getId()); + } } } + units = ListTools.trim(units, true, true); + EntityManager em = business.entityManagerContainer().get(UnitDuty.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(UnitDuty.class); + Root root = cq.from(UnitDuty.class); + Predicate p = root.get(UnitDuty_.name).in(names); + p = cb.and(p, root.get(UnitDuty_.unit).in(units)); + os = em.createQuery(cq.select(root).where(p)).getResultList(); + } + } + + for (UnitDuty o : os) { + for (Identity identity : business.identity().pick(o.getIdentityList())) { + Unit matchUnit = unitMap.get(o.getUnit()); + if(matchUnit == null){ + matchUnit = business.unit().pick(o.getUnit()); + unitMap.put(matchUnit.getId(), matchUnit); + } + Unit unit = unitMap.get(identity.getUnit()); + if(unit == null){ + unit = business.unit().pick(identity.getUnit()); + unitMap.put(unit.getId(), unit); + } + Person person = business.person().pick(identity.getPerson()); + Wo wo = this.convertToIdentity(matchUnit, unit, person, identity); + wos.add(wo); } } return wos; @@ -167,9 +218,13 @@ class ActionListIdentityWithUnitWithNameObject extends BaseAction { } if (null != unit) { wo.setUnit(unit.getDistinguishedName()); + }else{ + wo.setUnit(identity.getUnit()); } if (null != person) { wo.setPerson(person.getDistinguishedName()); + }else{ + wo.setPerson(identity.getPerson()); } if (null != identity) { wo.setDescription(identity.getDescription()); diff --git a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/BaseAction.java b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/BaseAction.java index bbdf1c69a75e5d214c23092345f3a751e4c8af6c..8e2abeed1f8695f254675421fd4101feb800f6c1 100644 --- a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/BaseAction.java +++ b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/BaseAction.java @@ -15,21 +15,15 @@ import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.jaxrs.StandardJaxrsAction; import com.x.base.core.project.tools.ListTools; import com.x.organization.assemble.express.Business; -import com.x.organization.core.entity.Group; import com.x.organization.core.entity.Identity; import com.x.organization.core.entity.Person; -import com.x.organization.core.entity.PersonAttribute; -import com.x.organization.core.entity.Role; import com.x.organization.core.entity.Unit; -import com.x.organization.core.entity.UnitAttribute; import com.x.organization.core.entity.UnitDuty; import com.x.organization.core.entity.UnitDuty_; -import com.x.organization.core.entity.accredit.Empower; class BaseAction extends StandardJaxrsAction { - CacheCategory cacheCategory = new CacheCategory(Identity.class, Unit.class, UnitAttribute.class, UnitDuty.class, - Role.class, Person.class, PersonAttribute.class, Group.class, Empower.class); + CacheCategory cacheCategory = new CacheCategory(Identity.class, Unit.class, UnitDuty.class); protected List listUnitDutyDistinguishedNameSorted(Business business, List unitDutyIds) throws Exception { diff --git a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/UnitDutyAction.java b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/UnitDutyAction.java index 19fc6df975dbf713951db7993d527186a60faf16..3c2edbd678471593a872aec57ee6d8f3a0ce3afd 100644 --- a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/UnitDutyAction.java +++ b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unitduty/UnitDutyAction.java @@ -137,4 +137,22 @@ public class UnitDutyAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "根据组织和职务名称获取职务信息.", action = ActionGetWithUnitWithName.class) + @POST + @Path("find/by/unit/name") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void getWithUnitWithName(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionGetWithUnitWithName().execute(effectivePerson, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + } \ No newline at end of file diff --git a/o2server/x_organization_assemble_personal/pom.xml b/o2server/x_organization_assemble_personal/pom.xml index ec410b43f9afd0100e35eb2667d0d214d9548373..41098bdcfef651e7642cd7c5e64220416f6bf397 100644 --- a/o2server/x_organization_assemble_personal/pom.xml +++ b/o2server/x_organization_assemble_personal/pom.xml @@ -116,6 +116,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/regist/ActionCreate.java b/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/regist/ActionCreate.java index f2ef504655a32b4b992b11e67b50dabcd249ca02..3a5b7194d91f72a405dc13e6e46d4f60ccf496d4 100644 --- a/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/regist/ActionCreate.java +++ b/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/regist/ActionCreate.java @@ -8,6 +8,7 @@ import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.annotation.CheckPersistType; import com.x.base.core.entity.type.GenderType; +import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.config.Config; import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.ActionResult; @@ -94,18 +95,25 @@ class ActionCreate extends BaseAction { public static class Wi extends GsonPropertyObject { + @FieldDescribe("用户名称.") private String name; - + + @FieldDescribe("性别.男:m,女:f,未知:d") private GenderType genderType; - + + @FieldDescribe("密码.") private String password; - + + @FieldDescribe("必填,手机号.") private String mobile; - + + @FieldDescribe("手机认证码") private String codeAnswer; - + + @FieldDescribe("图片认证码") private String captchaAnswer; - + + @FieldDescribe("图片认证编号") private String captcha; public String getName() { diff --git a/o2server/x_portal_assemble_designer/pom.xml b/o2server/x_portal_assemble_designer/pom.xml index 93fcd8871bcc4a2958ed2c820a37819697f056d6..d51d33033aadb01b16631ca3bf9f1bcb0eb17d32 100644 --- a/o2server/x_portal_assemble_designer/pom.xml +++ b/o2server/x_portal_assemble_designer/pom.xml @@ -120,6 +120,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/input/ActionCover.java b/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/input/ActionCover.java index 77e2bb446e6678ae3bab7c45158c4812391ed404..ce028cc5b545647a349f7fc8e7f9e033ae88c49a 100644 --- a/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/input/ActionCover.java +++ b/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/input/ActionCover.java @@ -64,7 +64,13 @@ class ActionCover extends BaseAction { portal.setName(this.idlePortalName(business, portal.getName(), portal.getId())); portal.setAlias(this.idlePortalAlias(business, portal.getAlias(), portal.getId())); persistObjects.add(portal); - }else if (!business.editable(effectivePerson, portal)) { + }else{ + WrapPortal.inCopier.copy(wi, portal); + portal.setName(this.idlePortalName(business, portal.getName(), portal.getId())); + portal.setAlias(this.idlePortalAlias(business, portal.getAlias(), portal.getId())); + } + + if (!business.editable(effectivePerson, portal)) { throw new ExceptionPortalAccessDenied(effectivePerson.getName(), portal.getName(), portal.getId()); } diff --git a/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/page/ActionCreate.java b/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/page/ActionCreate.java index b0a3cb16f1bf0e3c30b1fb3b80de5c95d2796390..ca958b54a8923fa353b161a569722be7dafb889c 100644 --- a/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/page/ActionCreate.java +++ b/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/page/ActionCreate.java @@ -1,5 +1,6 @@ package com.x.portal.assemble.designer.jaxrs.page; +import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.cache.CacheManager; import org.apache.commons.lang3.StringUtils; @@ -17,6 +18,11 @@ import com.x.portal.assemble.designer.Business; import com.x.portal.core.entity.Page; import com.x.portal.core.entity.Portal; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + class ActionCreate extends BaseAction { ActionResult execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception { @@ -32,6 +38,10 @@ class ActionCreate extends BaseAction { Page page = Wi.copier.copy(wi); this.checkName(business, page); this.checkAlias(business, page); + page.getProperties().setRelatedWidgetList(wi.getRelatedWidgetList()); + page.getProperties().setMobileRelatedWidgetList(wi.getMobileRelatedWidgetList()); + page.getProperties().setRelatedScriptMap(wi.getRelatedScriptMap()); + page.getProperties().setMobileRelatedScriptMap(wi.getMobileRelatedScriptMap()); emc.persist(page, CheckPersistType.all); /** 更新首页 */ if (this.isBecomeFirstPage(business, portal, page)) { @@ -59,6 +69,50 @@ class ActionCreate extends BaseAction { static WrapCopier copier = WrapCopierFactory.wi(Wi.class, Page.class, null, JpaObject.FieldsUnmodifyExcludeId); + + @FieldDescribe("关联Widget.") + private List relatedWidgetList = new ArrayList<>(); + + @FieldDescribe("移动端关联Widget.") + private List mobileRelatedWidgetList = new ArrayList<>(); + + @FieldDescribe("关联脚本.") + private Map relatedScriptMap = new LinkedHashMap<>(); + + @FieldDescribe("移动端关联脚本.") + private Map mobileRelatedScriptMap = new LinkedHashMap<>(); + + public List getRelatedWidgetList() { + return this.relatedWidgetList == null ? new ArrayList<>() : this.relatedWidgetList; + } + + public List getMobileRelatedWidgetList() { + return this.mobileRelatedWidgetList == null ? new ArrayList<>() : this.mobileRelatedWidgetList; + } + + public Map getRelatedScriptMap() { + return this.relatedScriptMap == null ? new LinkedHashMap<>() : this.relatedScriptMap; + } + + public Map getMobileRelatedScriptMap() { + return this.mobileRelatedScriptMap == null ? new LinkedHashMap<>() : this.mobileRelatedScriptMap; + } + + public void setRelatedWidgetList(List relatedWidgetList) { + this.relatedWidgetList = relatedWidgetList; + } + + public void setMobileRelatedWidgetList(List mobileRelatedWidgetList) { + this.mobileRelatedWidgetList = mobileRelatedWidgetList; + } + + public void setRelatedScriptMap(Map relatedScriptMap) { + this.relatedScriptMap = relatedScriptMap; + } + + public void setMobileRelatedScriptMap(Map mobileRelatedScriptMap) { + this.mobileRelatedScriptMap = mobileRelatedScriptMap; + } } public static class Wo extends WoId { diff --git a/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/page/ActionEdit.java b/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/page/ActionEdit.java index caad62585cb331d084a51f43c863d44e92ade28b..00b0abd0e9cc1401e4dd0226a7efaed5c656006d 100644 --- a/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/page/ActionEdit.java +++ b/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/page/ActionEdit.java @@ -1,5 +1,6 @@ package com.x.portal.assemble.designer.jaxrs.page; +import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.cache.CacheManager; import org.apache.commons.lang3.StringUtils; @@ -17,6 +18,11 @@ import com.x.portal.assemble.designer.Business; import com.x.portal.core.entity.Page; import com.x.portal.core.entity.Portal; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + class ActionEdit extends BaseAction { ActionResult execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception { ActionResult result = new ActionResult<>(); @@ -38,6 +44,10 @@ class ActionEdit extends BaseAction { Wi.copier.copy(wi, page); this.checkName(business, page); this.checkAlias(business, page); + page.getProperties().setRelatedWidgetList(wi.getRelatedWidgetList()); + page.getProperties().setMobileRelatedWidgetList(wi.getMobileRelatedWidgetList()); + page.getProperties().setRelatedScriptMap(wi.getRelatedScriptMap()); + page.getProperties().setMobileRelatedScriptMap(wi.getMobileRelatedScriptMap()); emc.check(page, CheckPersistType.all); /** 更新首页 */ if (this.isBecomeFirstPage(business, portal, page)) { @@ -64,6 +74,50 @@ class ActionEdit extends BaseAction { private static final long serialVersionUID = 6624639107781167248L; static WrapCopier copier = WrapCopierFactory.wi(Wi.class, Page.class, null, JpaObject.FieldsUnmodify); + + @FieldDescribe("关联Widget.") + private List relatedWidgetList = new ArrayList<>(); + + @FieldDescribe("移动端关联Widget.") + private List mobileRelatedWidgetList = new ArrayList<>(); + + @FieldDescribe("关联脚本.") + private Map relatedScriptMap = new LinkedHashMap<>(); + + @FieldDescribe("移动端关联脚本.") + private Map mobileRelatedScriptMap = new LinkedHashMap<>(); + + public List getRelatedWidgetList() { + return this.relatedWidgetList == null ? new ArrayList<>() : this.relatedWidgetList; + } + + public List getMobileRelatedWidgetList() { + return this.mobileRelatedWidgetList == null ? new ArrayList<>() : this.mobileRelatedWidgetList; + } + + public Map getRelatedScriptMap() { + return this.relatedScriptMap == null ? new LinkedHashMap<>() : this.relatedScriptMap; + } + + public Map getMobileRelatedScriptMap() { + return this.mobileRelatedScriptMap == null ? new LinkedHashMap<>() : this.mobileRelatedScriptMap; + } + + public void setRelatedWidgetList(List relatedWidgetList) { + this.relatedWidgetList = relatedWidgetList; + } + + public void setMobileRelatedWidgetList(List mobileRelatedWidgetList) { + this.mobileRelatedWidgetList = mobileRelatedWidgetList; + } + + public void setRelatedScriptMap(Map relatedScriptMap) { + this.relatedScriptMap = relatedScriptMap; + } + + public void setMobileRelatedScriptMap(Map mobileRelatedScriptMap) { + this.mobileRelatedScriptMap = mobileRelatedScriptMap; + } } public static class Wo extends WoId { diff --git a/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ActionEdit.java b/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ActionEdit.java index 3510aa6bcef594134450bba6644cf5a83c43e6c8..3219f7f0163c21510f72d6c949c1202e719f662c 100644 --- a/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ActionEdit.java +++ b/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/script/ActionEdit.java @@ -18,7 +18,7 @@ import com.x.portal.core.entity.Portal; import com.x.portal.core.entity.Script; class ActionEdit extends BaseAction { - + ActionResult execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception { ActionResult result = new ActionResult<>(); try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { diff --git a/o2server/x_portal_assemble_surface/pom.xml b/o2server/x_portal_assemble_surface/pom.xml index 7ada625a2b4b9e550f764012e3a51c3a35123bf5..1ae53f3d61dd44b36aefef77ac9a7840594a37fd 100644 --- a/o2server/x_portal_assemble_surface/pom.xml +++ b/o2server/x_portal_assemble_surface/pom.xml @@ -24,6 +24,14 @@ o2oa x_organization_core_express + + o2oa + x_processplatform_core_entity + + + o2oa + x_cms_core_entity + o2oa x_general_core_entity @@ -124,6 +132,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/Business.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/Business.java index 27779a126cb7313cebe7aa62a36c3f08392356a8..9dd8c5793f3c25feebc4327b7a151b8547fbd556 100644 --- a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/Business.java +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/Business.java @@ -7,6 +7,8 @@ import com.x.portal.assemble.surface.factory.PageFactory; import com.x.portal.assemble.surface.factory.PortalFactory; import com.x.portal.assemble.surface.factory.ScriptFactory; import com.x.portal.assemble.surface.factory.WidgetFactory; +import com.x.portal.assemble.surface.factory.cms.CmsFactory; +import com.x.portal.assemble.surface.factory.process.ProcessFactory; public class Business { @@ -74,4 +76,22 @@ public class Business { return file; } + private CmsFactory cms; + + public CmsFactory cms() throws Exception { + if (null == this.cms) { + this.cms = new CmsFactory(this); + } + return cms; + } + + private ProcessFactory process; + + public ProcessFactory process() throws Exception { + if (null == this.process) { + this.process = new ProcessFactory(this); + } + return process; + } + } \ No newline at end of file diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/ElementFactory.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/ElementFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..28ef1d2661d45fad9da96d8fb6a8a6b93063dfff --- /dev/null +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/ElementFactory.java @@ -0,0 +1,73 @@ +package com.x.portal.assemble.surface.factory; + +import com.x.base.core.entity.JpaObject; +import com.x.base.core.project.cache.Cache.CacheCategory; +import com.x.base.core.project.cache.Cache.CacheKey; +import com.x.base.core.project.cache.CacheManager; +import com.x.portal.assemble.surface.AbstractFactory; +import com.x.portal.assemble.surface.Business; +import com.x.portal.core.entity.Page; +import com.x.portal.core.entity.Portal; +import net.sf.ehcache.Ehcache; +import java.util.*; + +public abstract class ElementFactory extends AbstractFactory { + + protected Ehcache cache; + + public ElementFactory(Business abstractBusiness) throws Exception { + super(abstractBusiness); + } + + @SuppressWarnings("unchecked") + protected T pick(String flag, Class clz) throws Exception { + CacheCategory cacheCategory = new CacheCategory(clz); + CacheKey cacheKey = new CacheKey(flag); + T t = null; + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + t = (T) optional.get(); + } else { + t = this.entityManagerContainer().flag(flag, clz); + if (t != null) { + this.entityManagerContainer().get(clz).detach(t); + CacheManager.put(cacheCategory, cacheKey, t); + } + } + return t; + } + + protected List pick(Collection flags, Class clz) throws Exception { + List list = new ArrayList<>(); + for (String str : flags) { + T t = pick(str, clz); + if (null != t) { + list.add(t); + } + } + return list; + } + + @SuppressWarnings("unchecked") + protected T pick(Portal portal, String flag, Class clz) throws Exception { + if (null == portal) { + return null; + } + CacheCategory cacheCategory = new CacheCategory(clz); + CacheKey cacheKey = new CacheKey(portal.getId(), flag); + T t = null; + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + t = (T) optional.get(); + } else { + t = this.entityManagerContainer().restrictFlag(flag, clz, Page.portal_FIELDNAME, + portal.getId()); + if (t != null) { + this.entityManagerContainer().get(clz).detach(t); + CacheManager.put(cacheCategory, cacheKey, t); + } + } + return t; + } + +} \ No newline at end of file diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/cms/CmsFactory.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/cms/CmsFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..de1ed96d9abdb5fe306f23a7374adebc903a3764 --- /dev/null +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/cms/CmsFactory.java @@ -0,0 +1,21 @@ +package com.x.portal.assemble.surface.factory.cms; + +import com.x.portal.assemble.surface.AbstractFactory; +import com.x.portal.assemble.surface.Business; + +public class CmsFactory extends AbstractFactory { + + public CmsFactory(Business abstractBusiness) throws Exception { + super(abstractBusiness); + } + + private ScriptFactory script; + + public ScriptFactory script() throws Exception { + if (null == this.script) { + this.script = new ScriptFactory(this.business()); + } + return script; + } + +} diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/cms/ScriptFactory.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/cms/ScriptFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..f70b826bfb9dfde9eda9f4cbad20552597a45e4e --- /dev/null +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/cms/ScriptFactory.java @@ -0,0 +1,17 @@ +package com.x.portal.assemble.surface.factory.cms; + +import com.x.cms.core.entity.element.Script; +import com.x.portal.assemble.surface.Business; +import com.x.portal.assemble.surface.factory.ElementFactory; + +public class ScriptFactory extends ElementFactory { + + public ScriptFactory(Business abstractBusiness) throws Exception { + super(abstractBusiness); + } + + public Script pick(String flag) throws Exception { + return this.pick(flag, Script.class); + } + +} \ No newline at end of file diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/process/ProcessFactory.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/process/ProcessFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..894d6d3d5bde01b929ce41b596a101cc9a5a1065 --- /dev/null +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/process/ProcessFactory.java @@ -0,0 +1,21 @@ +package com.x.portal.assemble.surface.factory.process; + +import com.x.portal.assemble.surface.AbstractFactory; +import com.x.portal.assemble.surface.Business; + +public class ProcessFactory extends AbstractFactory { + + public ProcessFactory(Business abstractBusiness) throws Exception { + super(abstractBusiness); + } + + private ScriptFactory script; + + public ScriptFactory script() throws Exception { + if (null == this.script) { + this.script = new ScriptFactory(this.business()); + } + return script; + } + +} diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/process/ScriptFactory.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/process/ScriptFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..20d464ffe87ae89b1c0cacb77cd4137566f210e1 --- /dev/null +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/factory/process/ScriptFactory.java @@ -0,0 +1,17 @@ +package com.x.portal.assemble.surface.factory.process; + +import com.x.processplatform.core.entity.element.Script; +import com.x.portal.assemble.surface.Business; +import com.x.portal.assemble.surface.factory.ElementFactory; + +public class ScriptFactory extends ElementFactory { + + public ScriptFactory(Business abstractBusiness) throws Exception { + super(abstractBusiness); + } + + public Script pick(String flag) throws Exception { + return this.pick(flag, Script.class); + } + +} \ No newline at end of file diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/BaseAction.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/BaseAction.java index 64df05c8b7e55d2b9f6db94213959c6e3d03236b..901b291baabf8da69dd8008b83d368c9093daaa1 100644 --- a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/BaseAction.java +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/BaseAction.java @@ -1,5 +1,9 @@ package com.x.portal.assemble.surface.jaxrs.page; +import com.x.base.core.project.gson.GsonPropertyObject; +import com.x.base.core.project.jaxrs.WoMaxAgeFastETag; +import com.x.portal.core.entity.Script; +import com.x.portal.core.entity.Widget; import org.apache.commons.lang3.StringUtils; import com.x.base.core.project.config.Config; @@ -7,6 +11,9 @@ import com.x.base.core.project.jaxrs.StandardJaxrsAction; import com.x.portal.core.entity.Page; import com.x.base.core.project.cache.Cache.CacheCategory; +import java.util.HashMap; +import java.util.Map; + abstract class BaseAction extends StandardJaxrsAction { CacheCategory pageCache = new CacheCategory(Page.class); @@ -16,4 +23,271 @@ abstract class BaseAction extends StandardJaxrsAction { && StringUtils.equals(id, Config.portal().getIndexPage().getPage())); } + CacheCategory cacheCategory = new CacheCategory(Page.class, Widget.class, Script.class, com.x.processplatform.core.entity.element.Script.class, + com.x.cms.core.entity.element.Script.class); + + public static class AbstractWo extends WoMaxAgeFastETag { + + private static final long serialVersionUID = -246989645483328034L; + + private RelatedPage page; + + private Map relatedWidgetMap = new HashMap<>(); + + private Map relatedScriptMap = new HashMap<>(); + + public RelatedPage getPage() { + return page; + } + + public void setPage(RelatedPage page) { + this.page = page; + } + + public Map getRelatedWidgetMap() { + return relatedWidgetMap; + } + + public void setRelatedWidgetMap(Map relatedWidgetMap) { + this.relatedWidgetMap = relatedWidgetMap; + } + + public Map getRelatedScriptMap() { + return relatedScriptMap; + } + + public void setRelatedScriptMap(Map relatedScriptMap) { + this.relatedScriptMap = relatedScriptMap; + } + + } + + public static class RelatedPage extends GsonPropertyObject { + + private static final long serialVersionUID = 7525243539062813646L; + + public RelatedPage() { + + } + + public RelatedPage(Page page, String data) { + this.id = page.getId(); + this.alias = page.getAlias(); + this.name = page.getName(); + this.description = page.getDescription(); + this.portal = page.getPortal(); + this.hasMobile = page.getHasMobile(); + this.data = data; + } + + private String id; + private String alias; + private String name; + private String description; + private String portal; + private Boolean hasMobile; + private String data; + + public String getPortal() { + return portal; + } + + public void setPortal(String portal) { + this.portal = portal; + } + + public Boolean getHasMobile() { + return hasMobile; + } + + public void setHasMobile(Boolean hasMobile) { + this.hasMobile = hasMobile; + } + + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + } + + public static class RelatedWidget extends GsonPropertyObject { + + private static final long serialVersionUID = -6649777538891528958L; + + public RelatedWidget() { + + } + + public RelatedWidget(Widget widget, String data) { + this.id = widget.getId(); + this.alias = widget.getAlias(); + this.name = widget.getName(); + this.portal = widget.getPortal(); + this.hasMobile = widget.getHasMobile(); + this.data = data; + } + + private String id; + private String alias; + private String name; + private String portal; + private Boolean hasMobile; + private String data; + + public String getPortal() { + return portal; + } + + public void setPortal(String portal) { + this.portal = portal; + } + + public Boolean getHasMobile() { + return hasMobile; + } + + public void setHasMobile(Boolean hasMobile) { + this.hasMobile = hasMobile; + } + + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + } + + public static class RelatedScript extends GsonPropertyObject { + + private static final long serialVersionUID = -4465416667636529080L; + + public static final String TYPE_PROCESSPLATFORM = "processPlatform"; + public static final String TYPE_CMS = "cms"; + public static final String TYPE_PORTAL = "portal"; + + public RelatedScript() { + + } + + public RelatedScript(String id, String name, String alias, String text, String type) { + this.id = id; + this.alias = alias; + this.name = name; + this.text = text; + this.type = type; + } + + private String type; + + private String id; + + private String alias; + + private String name; + + private String text; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + } + } diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/PageAction.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/PageAction.java index 9030eee1f3a08596adba5b430efab80016dc7c76..65351608d4c858c72fd271b682a7170fb2846420 100644 --- a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/PageAction.java +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/PageAction.java @@ -121,4 +121,78 @@ public class PageAction extends StandardJaxrsAction { } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + + @JaxrsMethodDescribe(value = "获取Page.", action = V2Get.class) + @GET + @Path("v2/{id}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void V2Get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new V2Get().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "获取PageMobile.", action = V2GetMobile.class) + @GET + @Path("v2/{id}/mobile") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void V2GetMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new V2GetMobile().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "列示属于指定Portal的Page,其中Portal可以用name,alias和id标识,Page为在此Portal下的页面.", action = V2GetWithPortal.class) + @GET + @Path("v2/{flag}/portal/{portalFlag}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void V2GetWithPortal(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("flag") String flag, + @JaxrsParameterDescribe("门户标识") @PathParam("portalFlag") String portalFlag) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new V2GetWithPortal().execute(effectivePerson, flag, portalFlag); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "列示属于指定Portal的Page,其中Portal可以用name,alias和id标识,Page为在此Portal下的页面Mobile.", action = V2GetWithPortalMobile.class) + @GET + @Path("v2/{flag}/portal/{portalFlag}/mobile") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void V2GetWithPortalMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("flag") String flag, + @JaxrsParameterDescribe("门户标识") @PathParam("portalFlag") String portalFlag) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new V2GetWithPortalMobile().execute(effectivePerson, flag, portalFlag); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } } \ No newline at end of file diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2Get.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2Get.java new file mode 100644 index 0000000000000000000000000000000000000000..46b35909e7a7fa980210f6e6f18781eb8e421437 --- /dev/null +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2Get.java @@ -0,0 +1,133 @@ +package com.x.portal.assemble.surface.jaxrs.page; + +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.project.cache.Cache.CacheKey; +import com.x.base.core.project.cache.CacheManager; +import com.x.base.core.project.exception.ExceptionEntityNotExist; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.base.core.project.tools.ListTools; +import com.x.portal.assemble.surface.Business; +import com.x.portal.core.entity.Page; +import com.x.portal.core.entity.PageProperties; +import com.x.portal.core.entity.Script; +import com.x.portal.core.entity.Widget; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.TreeMap; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.stream.Collectors; + +class V2Get extends BaseAction { + + private static Logger logger = LoggerFactory.getLogger(V2Get.class); + + ActionResult execute(EffectivePerson effectivePerson, String id) throws Exception { + ActionResult result = new ActionResult<>(); + CacheKey cacheKey = new CacheKey(this.getClass(), id); + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + result.setData((Wo) optional.get()); + } else { + Wo wo = this.get(id); + CacheManager.put(cacheCategory, cacheKey, wo); + result.setData(wo); + } + return result; + } + + private Wo get(String id) throws Exception { + Page page; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + page = business.page().pick(id); + } + if (null == page) { + throw new ExceptionEntityNotExist(id, Page.class); + } + Wo wo = new Wo(); + final PageProperties properties = page.getProperties(); + wo.setPage(new RelatedPage(page, page.getDataOrMobileData())); + final List list = new CopyOnWriteArrayList<>(); + CompletableFuture> _relatedWidget = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if (ListTools.isNotEmpty(properties.getRelatedWidgetList())) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + Widget _f; + for (String _id : properties.getRelatedWidgetList()) { + _f = bus.widget().pick(_id); + if (null != _f) { + map.put(_id, new RelatedWidget(_f, _f.getDataOrMobileData())); + list.add(_f.getId() + _f.getUpdateTime().getTime()); + } + } + } catch (Exception e) { + logger.error(e); + } + } + return map; + }); + CompletableFuture> _relatedScript = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if ((null != properties.getRelatedScriptMap()) + && (properties.getRelatedScriptMap().size() > 0)) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + for (Entry entry : properties.getRelatedScriptMap().entrySet()) { + switch (entry.getValue()) { + case RelatedScript.TYPE_PROCESSPLATFORM: + com.x.processplatform.core.entity.element.Script _pp = bus.process().script().pick(entry.getKey()); + if (null != _pp) { + map.put(entry.getKey(), new RelatedScript(_pp.getId(), _pp.getName(), _pp.getAlias(), + _pp.getText(), entry.getValue())); + list.add(_pp.getId() + _pp.getUpdateTime().getTime()); + } + break; + case RelatedScript.TYPE_CMS: + com.x.cms.core.entity.element.Script _cms = bus.cms().script().pick(entry.getKey()); + if (null != _cms) { + map.put(entry.getKey(), new RelatedScript(_cms.getId(), _cms.getName(), _cms.getAlias(), + _cms.getText(), entry.getValue())); + list.add(_cms.getId() + _cms.getUpdateTime().getTime()); + } + break; + case RelatedScript.TYPE_PORTAL: + Script _p = bus.script().pick(entry.getKey()); + if (null != _p) { + map.put(entry.getKey(), new RelatedScript(_p.getId(), _p.getName(), _p.getAlias(), + _p.getText(), entry.getValue())); + list.add(_p.getId() + _p.getUpdateTime().getTime()); + } + break; + default: + break; + } + } + } catch (Exception e) { + logger.error(e); + } + } + return map; + }); + list.add(page.getId() + page.getUpdateTime().getTime()); + List sortList = list.stream().sorted().collect(Collectors.toList()); + wo.setFastETag(StringUtils.join(sortList, "#")); + wo.setRelatedWidgetMap(_relatedWidget.get()); + wo.setRelatedScriptMap(_relatedScript.get()); + return wo; + } + + public static class Wo extends AbstractWo { + + } + +} \ No newline at end of file diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2GetMobile.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2GetMobile.java new file mode 100644 index 0000000000000000000000000000000000000000..d64955f9affdd855451ddb9f7eee047818263e01 --- /dev/null +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2GetMobile.java @@ -0,0 +1,133 @@ +package com.x.portal.assemble.surface.jaxrs.page; + +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.project.cache.Cache.CacheKey; +import com.x.base.core.project.cache.CacheManager; +import com.x.base.core.project.exception.ExceptionEntityNotExist; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.base.core.project.tools.ListTools; +import com.x.portal.assemble.surface.Business; +import com.x.portal.core.entity.Page; +import com.x.portal.core.entity.PageProperties; +import com.x.portal.core.entity.Script; +import com.x.portal.core.entity.Widget; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.TreeMap; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.stream.Collectors; + +class V2GetMobile extends BaseAction { + + private static Logger logger = LoggerFactory.getLogger(V2GetMobile.class); + + ActionResult execute(EffectivePerson effectivePerson, String id) throws Exception { + ActionResult result = new ActionResult<>(); + CacheKey cacheKey = new CacheKey(this.getClass(), id); + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + result.setData((Wo) optional.get()); + } else { + Wo wo = this.get(id); + CacheManager.put(cacheCategory, cacheKey, wo); + result.setData(wo); + } + return result; + } + + private Wo get(String id) throws Exception { + Page page; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + page = business.page().pick(id); + } + if (null == page) { + throw new ExceptionEntityNotExist(id, Page.class); + } + Wo wo = new Wo(); + final PageProperties properties = page.getProperties(); + wo.setPage(new RelatedPage(page, page.getMobileDataOrData())); + final List list = new CopyOnWriteArrayList<>(); + CompletableFuture> _relatedWidget = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if (ListTools.isNotEmpty(properties.getMobileRelatedWidgetList())) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + Widget _f; + for (String _id : properties.getMobileRelatedWidgetList()) { + _f = bus.widget().pick(_id); + if (null != _f) { + map.put(_id, new RelatedWidget(_f, _f.getMobileDataOrData())); + list.add(_f.getId() + _f.getUpdateTime().getTime()); + } + } + } catch (Exception e) { + logger.error(e); + } + } + return map; + }); + CompletableFuture> _relatedScript = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if ((null != properties.getMobileRelatedScriptMap()) + && (properties.getMobileRelatedScriptMap().size() > 0)) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + for (Entry entry : properties.getMobileRelatedScriptMap().entrySet()) { + switch (entry.getValue()) { + case RelatedScript.TYPE_PROCESSPLATFORM: + com.x.processplatform.core.entity.element.Script _pp = bus.process().script().pick(entry.getKey()); + if (null != _pp) { + map.put(entry.getKey(), new RelatedScript(_pp.getId(), _pp.getName(), _pp.getAlias(), + _pp.getText(), entry.getValue())); + list.add(_pp.getId() + _pp.getUpdateTime().getTime()); + } + break; + case RelatedScript.TYPE_CMS: + com.x.cms.core.entity.element.Script _cms = bus.cms().script().pick(entry.getKey()); + if (null != _cms) { + map.put(entry.getKey(), new RelatedScript(_cms.getId(), _cms.getName(), _cms.getAlias(), + _cms.getText(), entry.getValue())); + list.add(_cms.getId() + _cms.getUpdateTime().getTime()); + } + break; + case RelatedScript.TYPE_PORTAL: + Script _p = bus.script().pick(entry.getKey()); + if (null != _p) { + map.put(entry.getKey(), new RelatedScript(_p.getId(), _p.getName(), _p.getAlias(), + _p.getText(), entry.getValue())); + list.add(_p.getId() + _p.getUpdateTime().getTime()); + } + break; + default: + break; + } + } + } catch (Exception e) { + logger.error(e); + } + } + return map; + }); + list.add(page.getId() + page.getUpdateTime().getTime()); + List sortList = list.stream().sorted().collect(Collectors.toList()); + wo.setFastETag(StringUtils.join(sortList, "#")); + wo.setRelatedWidgetMap(_relatedWidget.get()); + wo.setRelatedScriptMap(_relatedScript.get()); + return wo; + } + + public static class Wo extends AbstractWo { + + } + +} \ No newline at end of file diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2GetWithPortal.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2GetWithPortal.java new file mode 100644 index 0000000000000000000000000000000000000000..026f5046f1f1ad97e27994f6a12c3e4000fde0ab --- /dev/null +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2GetWithPortal.java @@ -0,0 +1,149 @@ +package com.x.portal.assemble.surface.jaxrs.page; + +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.project.cache.Cache.CacheKey; +import com.x.base.core.project.cache.CacheManager; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.base.core.project.tools.ListTools; +import com.x.portal.assemble.surface.Business; +import com.x.portal.core.entity.*; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.TreeMap; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.stream.Collectors; + +class V2GetWithPortal extends BaseAction { + + private static Logger logger = LoggerFactory.getLogger(V2GetWithPortal.class); + + ActionResult execute(EffectivePerson effectivePerson, String flag, String portalFlag) throws Exception { + ActionResult result = new ActionResult<>(); + Wo wo = null; + CacheKey cacheKey = new CacheKey(this.getClass(), flag, portalFlag); + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + wo = (Wo) optional.get(); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + Portal portal = business.portal().pick(portalFlag); + if (null == portal) { + throw new ExceptionPortalNotExist(portalFlag); + } + if (isNotLoginPage(flag) && (!business.portal().visible(effectivePerson, portal))) { + throw new ExceptionPortalAccessDenied(effectivePerson.getDistinguishedName(), portal.getName(), + portal.getId()); + } + } + } else { + wo = this.get(flag, portalFlag, effectivePerson); + CacheManager.put(cacheCategory, cacheKey, wo); + } + result.setData(wo); + return result; + } + + private Wo get(String flag, String portalFlag, EffectivePerson effectivePerson) throws Exception { + Page page = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + Portal portal = business.portal().pick(portalFlag); + if (null == portal) { + throw new ExceptionPortalNotExist(portalFlag); + } + if (isNotLoginPage(flag) && (!business.portal().visible(effectivePerson, portal))) { + throw new ExceptionPortalAccessDenied(effectivePerson.getDistinguishedName(), portal.getName(), + portal.getId()); + } + page = business.page().pick(portal, flag); + if (null == page) { + throw new ExceptionPageNotExist(flag); + } + } + Wo wo = new Wo(); + final PageProperties properties = page.getProperties(); + wo.setPage(new RelatedPage(page, page.getDataOrMobileData())); + final List list = new CopyOnWriteArrayList<>(); + CompletableFuture> _relatedWidget = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if (ListTools.isNotEmpty(properties.getRelatedWidgetList())) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + Widget _f; + for (String _id : properties.getRelatedWidgetList()) { + _f = bus.widget().pick(_id); + if (null != _f) { + map.put(_id, new RelatedWidget(_f, _f.getDataOrMobileData())); + list.add(_f.getId() + _f.getUpdateTime().getTime()); + } + } + } catch (Exception e) { + logger.error(e); + } + } + return map; + }); + CompletableFuture> _relatedScript = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if ((null != properties.getRelatedScriptMap()) + && (properties.getRelatedScriptMap().size() > 0)) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + for (Entry entry : properties.getRelatedScriptMap().entrySet()) { + switch (entry.getValue()) { + case RelatedScript.TYPE_PROCESSPLATFORM: + com.x.processplatform.core.entity.element.Script _pp = bus.process().script().pick(entry.getKey()); + if (null != _pp) { + map.put(entry.getKey(), new RelatedScript(_pp.getId(), _pp.getName(), _pp.getAlias(), + _pp.getText(), entry.getValue())); + list.add(_pp.getId() + _pp.getUpdateTime().getTime()); + } + break; + case RelatedScript.TYPE_CMS: + com.x.cms.core.entity.element.Script _cms = bus.cms().script().pick(entry.getKey()); + if (null != _cms) { + map.put(entry.getKey(), new RelatedScript(_cms.getId(), _cms.getName(), _cms.getAlias(), + _cms.getText(), entry.getValue())); + list.add(_cms.getId() + _cms.getUpdateTime().getTime()); + } + break; + case RelatedScript.TYPE_PORTAL: + Script _p = bus.script().pick(entry.getKey()); + if (null != _p) { + map.put(entry.getKey(), new RelatedScript(_p.getId(), _p.getName(), _p.getAlias(), + _p.getText(), entry.getValue())); + list.add(_p.getId() + _p.getUpdateTime().getTime()); + } + break; + default: + break; + } + } + } catch (Exception e) { + logger.error(e); + } + } + return map; + }); + list.add(page.getId() + page.getUpdateTime().getTime()); + List sortList = list.stream().sorted().collect(Collectors.toList()); + wo.setFastETag(StringUtils.join(sortList, "#")); + wo.setRelatedWidgetMap(_relatedWidget.get()); + wo.setRelatedScriptMap(_relatedScript.get()); + return wo; + } + + public static class Wo extends AbstractWo { + + } + +} \ No newline at end of file diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2GetWithPortalMobile.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2GetWithPortalMobile.java new file mode 100644 index 0000000000000000000000000000000000000000..d505fb8b25cc22bb386e9a9d6027fef7559ba4a0 --- /dev/null +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/jaxrs/page/V2GetWithPortalMobile.java @@ -0,0 +1,149 @@ +package com.x.portal.assemble.surface.jaxrs.page; + +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.project.cache.Cache.CacheKey; +import com.x.base.core.project.cache.CacheManager; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.base.core.project.tools.ListTools; +import com.x.portal.assemble.surface.Business; +import com.x.portal.core.entity.*; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.TreeMap; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.stream.Collectors; + +class V2GetWithPortalMobile extends BaseAction { + + private static Logger logger = LoggerFactory.getLogger(V2GetWithPortalMobile.class); + + ActionResult execute(EffectivePerson effectivePerson, String flag, String portalFlag) throws Exception { + ActionResult result = new ActionResult<>(); + Wo wo = null; + CacheKey cacheKey = new CacheKey(this.getClass(), flag, portalFlag); + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + wo = (Wo) optional.get(); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + Portal portal = business.portal().pick(portalFlag); + if (null == portal) { + throw new ExceptionPortalNotExist(portalFlag); + } + if (isNotLoginPage(flag) && (!business.portal().visible(effectivePerson, portal))) { + throw new ExceptionPortalAccessDenied(effectivePerson.getDistinguishedName(), portal.getName(), + portal.getId()); + } + } + } else { + wo = this.get(flag, portalFlag, effectivePerson); + CacheManager.put(cacheCategory, cacheKey, wo); + } + result.setData(wo); + return result; + } + + private Wo get(String flag, String portalFlag, EffectivePerson effectivePerson) throws Exception { + Page page; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + Portal portal = business.portal().pick(portalFlag); + if (null == portal) { + throw new ExceptionPortalNotExist(portalFlag); + } + if (isNotLoginPage(flag) && (!business.portal().visible(effectivePerson, portal))) { + throw new ExceptionPortalAccessDenied(effectivePerson.getDistinguishedName(), portal.getName(), + portal.getId()); + } + page = business.page().pick(portal, flag); + if (null == page) { + throw new ExceptionPageNotExist(flag); + } + } + Wo wo = new Wo(); + final PageProperties properties = page.getProperties(); + wo.setPage(new RelatedPage(page, page.getMobileDataOrData())); + final List list = new CopyOnWriteArrayList<>(); + CompletableFuture> _relatedWidget = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if (ListTools.isNotEmpty(properties.getMobileRelatedWidgetList())) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + Widget _f; + for (String _id : properties.getMobileRelatedWidgetList()) { + _f = bus.widget().pick(_id); + if (null != _f) { + map.put(_id, new RelatedWidget(_f, _f.getMobileDataOrData())); + list.add(_f.getId() + _f.getUpdateTime().getTime()); + } + } + } catch (Exception e) { + logger.error(e); + } + } + return map; + }); + CompletableFuture> _relatedScript = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if ((null != properties.getMobileRelatedScriptMap()) + && (properties.getMobileRelatedScriptMap().size() > 0)) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + for (Entry entry : properties.getMobileRelatedScriptMap().entrySet()) { + switch (entry.getValue()) { + case RelatedScript.TYPE_PROCESSPLATFORM: + com.x.processplatform.core.entity.element.Script _pp = bus.process().script().pick(entry.getKey()); + if (null != _pp) { + map.put(entry.getKey(), new RelatedScript(_pp.getId(), _pp.getName(), _pp.getAlias(), + _pp.getText(), entry.getValue())); + list.add(_pp.getId() + _pp.getUpdateTime().getTime()); + } + break; + case RelatedScript.TYPE_CMS: + com.x.cms.core.entity.element.Script _cms = bus.cms().script().pick(entry.getKey()); + if (null != _cms) { + map.put(entry.getKey(), new RelatedScript(_cms.getId(), _cms.getName(), _cms.getAlias(), + _cms.getText(), entry.getValue())); + list.add(_cms.getId() + _cms.getUpdateTime().getTime()); + } + break; + case RelatedScript.TYPE_PORTAL: + Script _p = bus.script().pick(entry.getKey()); + if (null != _p) { + map.put(entry.getKey(), new RelatedScript(_p.getId(), _p.getName(), _p.getAlias(), + _p.getText(), entry.getValue())); + list.add(_p.getId() + _p.getUpdateTime().getTime()); + } + break; + default: + break; + } + } + } catch (Exception e) { + logger.error(e); + } + } + return map; + }); + list.add(page.getId() + page.getUpdateTime().getTime()); + List sortList = list.stream().sorted().collect(Collectors.toList()); + wo.setFastETag(StringUtils.join(sortList, "#")); + wo.setRelatedWidgetMap(_relatedWidget.get()); + wo.setRelatedScriptMap(_relatedScript.get()); + return wo; + } + + public static class Wo extends AbstractWo { + + } + +} \ No newline at end of file diff --git a/o2server/x_portal_core_entity/src/main/java/com/x/portal/core/entity/Page.java b/o2server/x_portal_core_entity/src/main/java/com/x/portal/core/entity/Page.java index ece29592d128b3f142e3fbb2792165bcc84c3792..f5934ed7d1ea2df40bbd5c4fd6fe4695f96b8340 100644 --- a/o2server/x_portal_core_entity/src/main/java/com/x/portal/core/entity/Page.java +++ b/o2server/x_portal_core_entity/src/main/java/com/x/portal/core/entity/Page.java @@ -14,6 +14,7 @@ import javax.persistence.Table; import javax.persistence.UniqueConstraint; import org.apache.commons.lang3.StringUtils; +import org.apache.openjpa.persistence.Persistent; import org.apache.openjpa.persistence.jdbc.Index; import com.x.base.core.entity.JpaObject; @@ -26,6 +27,7 @@ import com.x.base.core.entity.annotation.Equal; import com.x.base.core.entity.annotation.IdReference; import com.x.base.core.entity.annotation.RestrictFlag; import com.x.base.core.project.annotation.FieldDescribe; +import org.apache.openjpa.persistence.jdbc.Strategy; @Entity @ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) @@ -58,6 +60,21 @@ public class Page extends SliceJpaObject { public void onPersist() throws Exception { } + public Page() { + this.properties = new PageProperties(); + } + + public PageProperties getProperties() { + if (null == this.properties) { + this.properties = new PageProperties(); + } + return this.properties; + } + + public void setProperties(PageProperties properties) { + this.properties = properties; + } + /* flag标志位 */ /* Entity 默认字段结束 */ @@ -136,6 +153,15 @@ public class Page extends SliceJpaObject { @Column(name = ColumnNamePrefix + hasMobile_FIELDNAME) private Boolean hasMobile; + public static final String properties_FIELDNAME = "properties"; + // @Basic(fetch = FetchType.EAGER) + @FieldDescribe("属性对象存储字段.") + @Persistent(fetch = FetchType.EAGER) + @Strategy(JsonPropertiesValueHandler) + @Column(length = JpaObject.length_10M, name = ColumnNamePrefix + properties_FIELDNAME) + @CheckPersist(allowEmpty = true) + private PageProperties properties; + // public static String[] FLA GS = new String[] { JpaObject.id_FIELDNAME }; // // public static String[] RESTRICTFLA GS = new String[] { name_FIELDNAME, diff --git a/o2server/x_portal_core_entity/src/main/java/com/x/portal/core/entity/PageProperties.java b/o2server/x_portal_core_entity/src/main/java/com/x/portal/core/entity/PageProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..caa94e8ad7082ae9f8e7c9d7e16bc6a22dc9bcab --- /dev/null +++ b/o2server/x_portal_core_entity/src/main/java/com/x/portal/core/entity/PageProperties.java @@ -0,0 +1,57 @@ +package com.x.portal.core.entity; + +import com.x.base.core.entity.JsonProperties; +import com.x.base.core.project.annotation.FieldDescribe; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class PageProperties extends JsonProperties { + + @FieldDescribe("关联Widget.") + private List relatedWidgetList = new ArrayList<>(); + + @FieldDescribe("移动端关联Widget.") + private List mobileRelatedWidgetList = new ArrayList<>(); + + @FieldDescribe("关联脚本.") + private Map relatedScriptMap = new LinkedHashMap<>(); + + @FieldDescribe("移动端关联脚本.") + private Map mobileRelatedScriptMap = new LinkedHashMap<>(); + + public List getRelatedWidgetList() { + return this.relatedWidgetList == null ? new ArrayList<>() : this.relatedWidgetList; + } + + public List getMobileRelatedWidgetList() { + return this.mobileRelatedWidgetList == null ? new ArrayList<>() : this.mobileRelatedWidgetList; + } + + public Map getRelatedScriptMap() { + return this.relatedScriptMap == null ? new LinkedHashMap<>() : this.relatedScriptMap; + } + + public Map getMobileRelatedScriptMap() { + return this.mobileRelatedScriptMap == null ? new LinkedHashMap<>() : this.mobileRelatedScriptMap; + } + + public void setRelatedWidgetList(List relatedWidgetList) { + this.relatedWidgetList = relatedWidgetList; + } + + public void setMobileRelatedWidgetList(List mobileRelatedWidgetList) { + this.mobileRelatedWidgetList = mobileRelatedWidgetList; + } + + public void setRelatedScriptMap(Map relatedScriptMap) { + this.relatedScriptMap = relatedScriptMap; + } + + public void setMobileRelatedScriptMap(Map mobileRelatedScriptMap) { + this.mobileRelatedScriptMap = mobileRelatedScriptMap; + } + +} diff --git a/o2server/x_processplatform_assemble_bam/pom.xml b/o2server/x_processplatform_assemble_bam/pom.xml index b176da212910d1300384bcda272909bf83d85997..285a9cd52275f2f5283e6fe9d459bc5a51592bb7 100644 --- a/o2server/x_processplatform_assemble_bam/pom.xml +++ b/o2server/x_processplatform_assemble_bam/pom.xml @@ -128,6 +128,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_processplatform_assemble_designer/pom.xml b/o2server/x_processplatform_assemble_designer/pom.xml index 7cee1ddadb101310b2661118106b491469d3e910..1adc5d68ee9a0c12181bc38a8a432052c25fa1bc 100644 --- a/o2server/x_processplatform_assemble_designer/pom.xml +++ b/o2server/x_processplatform_assemble_designer/pom.xml @@ -132,6 +132,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/input/ActionCover.java b/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/input/ActionCover.java index 122402f1231ce049a73973f7fc87653daa91a381..13260652889c5c12663c6fcef2a8d9378962c6a5 100644 --- a/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/input/ActionCover.java +++ b/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/input/ActionCover.java @@ -104,7 +104,12 @@ class ActionCover extends BaseAction { application.setName(this.idleApplicationName(business, application.getName(), application.getId())); application.setAlias(this.idleApplicationAlias(business, application.getAlias(), application.getId())); persistObjects.add(application); - }else if (!business.editable(effectivePerson, application)) { + }else{ + WrapProcessPlatform.inCopier.copy(wi, application); + application.setName(this.idleApplicationName(business, application.getName(), application.getId())); + application.setAlias(this.idleApplicationAlias(business, application.getAlias(), application.getId())); + } + if (!business.editable(effectivePerson, application)) { throw new ExceptionApplicationAccessDenied(effectivePerson.getName(), application.getName(), application.getId()); } diff --git a/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ActionEdit.java b/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ActionEdit.java index 9b48118d4fbc3f0d9cc68f579cea979b642bd228..bb7be1d578896871dc2f69205831f4989e45cb18 100644 --- a/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ActionEdit.java +++ b/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/script/ActionEdit.java @@ -16,6 +16,7 @@ import com.x.base.core.project.jaxrs.WoId; import com.x.processplatform.assemble.designer.Business; import com.x.processplatform.assemble.designer.ThisApplication; import com.x.processplatform.core.entity.element.Application; +import com.x.processplatform.core.entity.element.Form; import com.x.processplatform.core.entity.element.Script; import com.x.processplatform.core.entity.element.ScriptVersion; diff --git a/o2server/x_processplatform_assemble_surface/pom.xml b/o2server/x_processplatform_assemble_surface/pom.xml index 45392a98ce9b9bc92d12b2d2f68adb41013df49c..6a42c328db45c6ed66d6a30e9e2b88850fc5037f 100644 --- a/o2server/x_processplatform_assemble_surface/pom.xml +++ b/o2server/x_processplatform_assemble_surface/pom.xml @@ -147,6 +147,12 @@ + + maven-deploy-plugin + + true + + diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/Business.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/Business.java index 2fcf938f91fa33f254507b904649fcf858dad007..9ff698b55a2274e77820a472f5da5ffbb8b96c63 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/Business.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/Business.java @@ -1097,16 +1097,16 @@ public class Business { if (effectivePerson.isPerson(creatorPerson)) { return true; } - if (emc.countEqualAndEqual(TaskCompleted.class, TaskCompleted.person_FIELDNAME, - effectivePerson.getDistinguishedName(), TaskCompleted.job_FIELDNAME, job) == 0) { - if (emc.countEqualAndEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME, - effectivePerson.getDistinguishedName(), ReadCompleted.job_FIELDNAME, job) == 0) { - if (emc.countEqualAndEqual(Task.class, Task.person_FIELDNAME, effectivePerson.getDistinguishedName(), - Task.job_FIELDNAME, job) == 0) { - if (emc.countEqualAndEqual(Read.class, Read.person_FIELDNAME, - effectivePerson.getDistinguishedName(), Read.job_FIELDNAME, job) == 0) { - if (emc.countEqualAndEqual(Review.class, Review.person_FIELDNAME, - effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, job) == 0) { + if (emc.countEqualAndEqual(Review.class, Review.person_FIELDNAME, effectivePerson.getDistinguishedName(), + Review.job_FIELDNAME, job) == 0) { + if (emc.countEqualAndEqual(Task.class, Task.person_FIELDNAME, effectivePerson.getDistinguishedName(), + Task.job_FIELDNAME, job) == 0) { + if (emc.countEqualAndEqual(Read.class, Read.person_FIELDNAME, effectivePerson.getDistinguishedName(), + Read.job_FIELDNAME, job) == 0) { + if (emc.countEqualAndEqual(TaskCompleted.class, TaskCompleted.person_FIELDNAME, + effectivePerson.getDistinguishedName(), TaskCompleted.job_FIELDNAME, job) == 0) { + if (emc.countEqualAndEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME, + effectivePerson.getDistinguishedName(), ReadCompleted.job_FIELDNAME, job) == 0) { Application application = application().pick(applicationId); Process process = process().pick(processId); if (!canManageApplicationOrProcess(effectivePerson, application, process)) { @@ -1229,8 +1229,9 @@ public class Business { } try (ZipOutputStream zos = new ZipOutputStream(os)) { for (Map.Entry entry : filePathMap.entrySet()) { - zos.putNextEntry(new ZipEntry(new ZipEntry(StringUtils.replaceEach(entry.getKey(), - new String[] { "/", "\\" }, new String[] { "-", "-" })))); + zos.putNextEntry(new ZipEntry(StringUtils.replaceEach(entry.getKey(), + new String[] { "/", ":", "*", "?", "<<", ">>", "|", "<", ">", "\\" }, + new String[] { "", "", "", "", "", "", "", "", "", "" }))); StorageMapping mapping = ThisApplication.context().storageMappings().get(Attachment.class, entry.getValue().getStorage()); try (ByteArrayOutputStream os1 = new ByteArrayOutputStream()) { @@ -1243,8 +1244,9 @@ public class Business { if (otherAttMap != null) { for (Map.Entry entry : otherAttMap.entrySet()) { - zos.putNextEntry(new ZipEntry(StringUtils.replaceEach(entry.getKey(), new String[] { "/", "\\" }, - new String[] { "-", "-" }))); + zos.putNextEntry(new ZipEntry(StringUtils.replaceEach(entry.getKey(), + new String[] { "/", ":", "*", "?", "<<", ">>", "|", "<", ">", "\\" }, + new String[] { "", "", "", "", "", "", "", "", "", "" }))); zos.write(entry.getValue()); } } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/applicationdict/ApplicationDictAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/applicationdict/ApplicationDictAction.java index ca49ab6e8e3d6d8b6087c6ae0a8695620b59ad16..0d6dc442b79959a3b44d4566c1c3364b2539e2f4 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/applicationdict/ApplicationDictAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/applicationdict/ApplicationDictAction.java @@ -54,26 +54,6 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } -// @JaxrsMethodDescribe(value = "更新数据字典以及数据.", action = ActionUpdate.class) -// @PUT -// @Path("{applicationDictFlag}/application/{applicationFlag}") -// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) -// @Consumes(MediaType.APPLICATION_JSON) -// public void update(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, -// @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, -// @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, -// JsonElement jsonElement) { -// ActionResult result = new ActionResult<>(); -// EffectivePerson effectivePerson = this.effectivePerson(request); -// try { -// result = new ActionUpdate().execute(effectivePerson, applicationDictFlag, applicationFlag, jsonElement); -// } catch (Exception e) { -// logger.error(e, effectivePerson, request, null); -// result.error(e); -// } -// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); -// } - @JaxrsMethodDescribe(value = "获取Application的数据字典列表.", action = ActionListWithApplication.class) @GET @Path("list/application/{applicationFlag}") @@ -323,7 +303,28 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @JaxrsMethodDescribe(value = "根据字典和路径更新Application下的数据字典局部数据..", action = ActionUpdateDataPath1.class) + @JaxrsMethodDescribe(value = "Mock PUT to POST.", action = ActionUpdateDataPath0.class) + @POST + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/data/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateDataPath0MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateDataPath0().execute(applicationDictFlag, applicationFlag, path0, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "根据字典和路径更新Application下的数据字典局部数据.", action = ActionUpdateDataPath1.class) @PUT @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/data") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @@ -345,6 +346,29 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock PUT to POST.", action = ActionUpdateDataPath1.class) + @POST + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/data/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateDataPath1MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateDataPath1().execute(applicationDictFlag, applicationFlag, path0, path1, + jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典和路径更新Application下的数据字典局部数据.", action = ActionUpdateDataPath2.class) @PUT @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/data") @@ -368,6 +392,30 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock PUT to POST.", action = ActionUpdateDataPath2.class) + @POST + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/data/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateDataPath2MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateDataPath2().execute(applicationDictFlag, applicationFlag, path0, path1, path2, + jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典和路径更新Application下的数据字典局部数据.", action = ActionUpdateDataPath3.class) @PUT @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/data") @@ -392,6 +440,31 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock PUT to POST.", action = ActionUpdateDataPath3.class) + @POST + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/data/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateDataPath3MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateDataPath3().execute(applicationDictFlag, applicationFlag, path0, path1, path2, + path3, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典和路径更新Application下的数据字典局部数据.", action = ActionUpdateDataPath4.class) @PUT @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/data") @@ -417,6 +490,32 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock POST to PUT.", action = ActionUpdateDataPath4.class) + @POST + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/data/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateDataPath4MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateDataPath4().execute(applicationDictFlag, applicationFlag, path0, path1, path2, + path3, path4, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典和路径更新Application下的数据字典局部数据.", action = ActionUpdateDataPath5.class) @PUT @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/data") @@ -443,6 +542,33 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock POST to PUT.", action = ActionUpdateDataPath5.class) + @POST + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/data/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateDataPath5MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateDataPath5().execute(applicationDictFlag, applicationFlag, path0, path1, path2, + path3, path4, path5, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典和路径更新Application下的数据字典局部数据.", action = ActionUpdateDataPath6.class) @PUT @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/data") @@ -470,6 +596,34 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock POST to PUT.", action = ActionUpdateDataPath6.class) + @POST + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/data/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateDataPath6MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, + @JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateDataPath6().execute(applicationDictFlag, applicationFlag, path0, path1, path2, + path3, path4, path5, path6, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典和路径更新Application下的数据字典局部数据.", action = ActionUpdateDataPath7.class) @PUT @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/{path7}/data") @@ -498,6 +652,35 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock POST to PUT.", action = ActionUpdateDataPath7.class) + @POST + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/{path7}/data/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateDataPath7MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, + @JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6, + @JaxrsParameterDescribe("7级路径") @PathParam("path7") String path7, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateDataPath7().execute(applicationDictFlag, applicationFlag, path0, path1, path2, + path3, path4, path5, path6, path7, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典ID和路径添加Application下的新的局部数据.", action = ActionCreateDataPath0.class) @POST @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/data") @@ -713,6 +896,27 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get 2 Delete.", action = ActionDeleteDataPath0.class) + @GET + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/data/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteDataPath0MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteDataPath0().execute(applicationDictFlag, applicationFlag, path0); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典ID和路径删除Application下的数据字典局部数据.", action = ActionDeleteDataPath1.class) @DELETE @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/data") @@ -734,6 +938,28 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get 2 Delete.", action = ActionDeleteDataPath1.class) + @GET + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/data/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteDataPath1MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteDataPath1().execute(applicationDictFlag, applicationFlag, path0, path1); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典ID和路径删除Application下的数据字典局部数据.", action = ActionDeleteDataPath2.class) @DELETE @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/data") @@ -756,6 +982,29 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get 2 Delete.", action = ActionDeleteDataPath2.class) + @GET + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/data/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteDataPath2MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteDataPath2().execute(applicationDictFlag, applicationFlag, path0, path1, path2); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典ID和路径删除Application下的数据字典局部数据.", action = ActionDeleteDataPath3.class) @DELETE @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/data") @@ -780,6 +1029,31 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get 2 Delete.", action = ActionDeleteDataPath3.class) + @DELETE + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/data/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteDataPath3MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteDataPath3().execute(applicationDictFlag, applicationFlag, path0, path1, path2, + path3); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典ID和路径删除Application下的数据字典局部数据.", action = ActionDeleteDataPath4.class) @DELETE @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/data") @@ -805,6 +1079,32 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get 2 Delete.", action = ActionDeleteDataPath4.class) + @GET + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/data/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteDataPath4MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteDataPath4().execute(applicationDictFlag, applicationFlag, path0, path1, path2, + path3, path4); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典ID和路径删除Application下的数据字典局部数据.", action = ActionDeleteDataPath5.class) @DELETE @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/data") @@ -831,6 +1131,33 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get 2 Delete.", action = ActionDeleteDataPath5.class) + @GET + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/data/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteDataPath5MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteDataPath5().execute(applicationDictFlag, applicationFlag, path0, path1, path2, + path3, path4, path5); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典ID和路径删除Application下的数据字典局部数据.", action = ActionDeleteDataPath6.class) @DELETE @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/data") @@ -858,6 +1185,34 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get 2 Delete.", action = ActionDeleteDataPath6.class) + @GET + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/data/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteDataPath6MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, + @JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteDataPath6().execute(applicationDictFlag, applicationFlag, path0, path1, path2, + path3, path4, path5, path6); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据字典ID和路径删除Application下的数据字典局部数据.", action = ActionDeleteDataPath7.class) @DELETE @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/{path7}/data") @@ -886,4 +1241,33 @@ public class ApplicationDictAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get 2 Delete.", action = ActionDeleteDataPath7.class) + @GET + @Path("{applicationDictFlag}/application/{applicationFlag}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/{path7}/data/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteDataPath7MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("数据字典标识") @PathParam("applicationDictFlag") String applicationDictFlag, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, + @JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6, + @JaxrsParameterDescribe("7级路径") @PathParam("path7") String path7) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteDataPath7().execute(applicationDictFlag, applicationFlag, path0, path1, path2, + path3, path4, path5, path6, path7); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompleted.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompleted.java index c283a5034bdef996fd26f7f685285c6215ff6245..491dfefcf7b086ff157cf8e3bf7987694f17e704 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompleted.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompleted.java @@ -78,6 +78,9 @@ class ActionBatchDownloadWithWorkOrWorkCompleted extends BaseAction { } } if (StringUtils.isBlank(fileName)) { + if(title.length()>60){ + title = title.substring(0, 60); + } fileName = title + DateTools.format(new Date(), DateTools.formatCompact_yyyyMMddHHmmss) + ".zip"; } else { String extension = FilenameUtils.getExtension(fileName); @@ -100,7 +103,8 @@ class ActionBatchDownloadWithWorkOrWorkCompleted extends BaseAction { emc.commit(); } } - + fileName = StringUtils.replaceEach(fileName, + new String[] { "/",":","*","?","<<",">>","|","<",">","\\" }, new String[] { "","","","","","","","","","" }); logger.info("batchDown to {},att size {}, from work {}", fileName, attachmentList.size(), workId); try (ByteArrayOutputStream os = new ByteArrayOutputStream()) { business.downToZip(readableAttachmentList, os, map); diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompletedStream.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompletedStream.java index 1e37d3931066634a2b7f86b4bc49a64d90f8e466..5f006818c8c7a7fa547aa6b653a2c495d2ed9044 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompletedStream.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompletedStream.java @@ -78,6 +78,9 @@ class ActionBatchDownloadWithWorkOrWorkCompletedStream extends BaseAction { } } if (StringUtils.isBlank(fileName)) { + if(title.length()>60){ + title = title.substring(0, 60); + } fileName = title + DateTools.format(new Date(), DateTools.formatCompact_yyyyMMddHHmmss) + ".zip"; } else { String extension = FilenameUtils.getExtension(fileName); @@ -101,6 +104,8 @@ class ActionBatchDownloadWithWorkOrWorkCompletedStream extends BaseAction { } } + fileName = StringUtils.replaceEach(fileName, + new String[] { "/",":","*","?","<<",">>","|","<",">","\\" }, new String[] { "","","","","","","","","","" }); logger.info("batchDown to {},att size {}, from work {}, has form {}", fileName, attachmentList.size(), workId, map.size()); try (ByteArrayOutputStream os = new ByteArrayOutputStream()) { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithWorkOrWorkCompleted.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithWorkOrWorkCompleted.java index 12ac82803b71a43b2e27a98f81dd4de20644723d..885f2809de9fc97c985328d4169a594e8b18ef3d 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithWorkOrWorkCompleted.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithWorkOrWorkCompleted.java @@ -4,8 +4,11 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.Date; import java.util.List; +import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; +import org.apache.commons.lang3.BooleanUtils; + import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.JpaObject; @@ -26,50 +29,59 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction { private static Logger logger = LoggerFactory.getLogger(ActionListWithWorkOrWorkCompleted.class); ActionResult> execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult> result = new ActionResult<>(); - - Business business = new Business(emc); - - if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, - new ExceptionEntityNotExist(workOrWorkCompleted))) { - throw new ExceptionAccessDenied(effectivePerson); - } - - List identities = business.organization().identity().listWithPerson(effectivePerson); - - List units = business.organization().unit().listWithPerson(effectivePerson); - final String job = business.job().findWithWorkOrWorkCompleted(workOrWorkCompleted); + ActionResult> result = new ActionResult<>(); + CompletableFuture> _wos = CompletableFuture.supplyAsync(() -> { List wos = new ArrayList<>(); - - for (Attachment attachment : this.list(business, job)) { - Wo wo = Wo.copier.copy(attachment); - boolean canControl = this.control(attachment, effectivePerson, identities, units, business); - boolean canEdit = this.edit(attachment, effectivePerson, identities, units, business); - boolean canRead = this.read(attachment, effectivePerson, identities, units, business); - if (canRead) { - wo.getControl().setAllowRead(true); - wo.getControl().setAllowEdit(canEdit); - wo.getControl().setAllowControl(canControl); - wos.add(wo); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + List identities = business.organization().identity().listWithPerson(effectivePerson); + List units = business.organization().unit().listWithPerson(effectivePerson); + final String job = business.job().findWithWorkOrWorkCompleted(workOrWorkCompleted); + for (Attachment attachment : business.entityManagerContainer().listEqual(Attachment.class, + Attachment.job_FIELDNAME, job)) { + Wo wo = Wo.copier.copy(attachment); + boolean canControl = this.control(attachment, effectivePerson, identities, units, business); + boolean canEdit = this.edit(attachment, effectivePerson, identities, units, business); + boolean canRead = this.read(attachment, effectivePerson, identities, units, business); + if (canRead) { + wo.getControl().setAllowRead(true); + wo.getControl().setAllowEdit(canEdit); + wo.getControl().setAllowControl(canControl); + wos.add(wo); + } } + wos = wos.stream() + .sorted(Comparator.comparing(Wo::getOrderNumber, Comparator.nullsLast(Integer::compareTo)) + .thenComparing( + Comparator.comparing(Wo::getCreateTime, Comparator.nullsLast(Date::compareTo)))) + .collect(Collectors.toList()); + } catch (Exception e) { + logger.error(e); } + return wos; + }); + + CompletableFuture _control = CompletableFuture.supplyAsync(() -> { + Boolean value = false; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + value = business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, + new ExceptionEntityNotExist(workOrWorkCompleted)); + } catch (Exception e) { + logger.error(e); + } + return value; + }); - wos = wos.stream().sorted(Comparator.comparing(Wo::getOrderNumber, Comparator.nullsLast(Integer::compareTo)) - .thenComparing(Comparator.comparing(Wo::getCreateTime, Comparator.nullsLast(Date::compareTo)))) - .collect(Collectors.toList()); - - result.setData(wos); - return result; + if (BooleanUtils.isFalse(_control.get())) { + throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted); } - } - private List list(Business business, String job) throws Exception { - List os = business.entityManagerContainer().listEqual(Attachment.class, Attachment.job_FIELDNAME, - job); - return os; + result.setData(_wos.get()); + + return result; } public static class Wo extends Attachment { @@ -92,7 +104,7 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction { } public static class WoControl extends GsonPropertyObject { - + private static final long serialVersionUID = -7283783148043076205L; private Boolean allowRead = false; private Boolean allowEdit = false; private Boolean allowControl = false; diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionUploadWorkInfo.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionUploadWorkInfo.java index 4809dc3b1b66665967be5d535864d0159ad140a3..34506dd9e7f85c5850e15156d1c62b196d3104a2 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionUploadWorkInfo.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionUploadWorkInfo.java @@ -42,7 +42,7 @@ import com.x.processplatform.core.entity.content.WorkCompleted; class ActionUploadWorkInfo extends BaseAction { - private static Logger logger = LoggerFactory.getLogger(ActionEdit.class); + private static Logger logger = LoggerFactory.getLogger(ActionUploadWorkInfo.class); ActionResult execute(EffectivePerson effectivePerson, String workId, String flag, JsonElement jsonElement) throws Exception { @@ -89,6 +89,9 @@ class ActionUploadWorkInfo extends BaseAction { try { String name = ""; byte[] bytes; + if(title.length()>60){ + title = title.substring(0, 60); + } if ("word".equals(flag)) { try (POIFSFileSystem fs = new POIFSFileSystem(); InputStream is = new ByteArrayInputStream(workHtml.getBytes("UTF-8")); diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/AttachmentAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/AttachmentAction.java index 886ab6cc40b2ce0916cb11462b4ebc4da4878c98..4fc8f3db29563d9806edc3ce9ddbd69c5b4b7ed7 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/AttachmentAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/AttachmentAction.java @@ -192,6 +192,25 @@ public class AttachmentAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionDeleteWithWork.class) + @GET + @Path("{id}/work/{workId}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteWithWorkMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("附件标识") @PathParam("id") String id, + @JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteWithWork().execute(effectivePerson, id, workId); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "删除指定workCompleted下的附件. ", action = ActionDeleteWithWorkCompleted.class) @DELETE @Path("{id}/workcompleted/{workCompletedId}") @@ -211,6 +230,25 @@ public class AttachmentAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionDeleteWithWorkCompleted.class) + @GET + @Path("{id}/workcompleted/{workCompletedId}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteWithWorkCompletedMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("附件标识") @PathParam("id") String id, + @JaxrsParameterDescribe("已完成工作标识") @PathParam("workCompletedId") String workCompletedId) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteWithWorkCompleted().execute(effectivePerson, id, workCompletedId); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据Work下载附件", action = ActionDownloadWithWork.class) @GET @Path("download/{id}/work/{workId}") @@ -501,6 +539,42 @@ public class AttachmentAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionUpdate.class) + @POST + @Path("update/{id}/work/{workId}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.MULTIPART_FORM_DATA) + public void updateMockPutToPost(FormDataMultiPart form, @Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("附件标识") @PathParam("id") String id, + @JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId, + @JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName, + @JaxrsParameterDescribe("天印扩展字段") @FormDataParam("extraParam") String extraParam, + @FormDataParam(FILE_FIELD) byte[] bytes, + @JaxrsParameterDescribe("附件") @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + if (StringUtils.isEmpty(extraParam)) { + extraParam = this.request2Json(request); + } + if (bytes == null) { + Map> map = form.getFields(); + for (String key : map.keySet()) { + FormDataBodyPart part = map.get(key).get(0); + if ("application".equals(part.getMediaType().getType())) { + bytes = part.getValueAs(byte[].class); + break; + } + } + } + result = new ActionUpdate().execute(effectivePerson, id, workId, fileName, bytes, disposition, extraParam); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新Attachment信息", action = ActionUpdateContent.class) @PUT @Path("update/content/{id}/work/{workId}") @@ -520,6 +594,25 @@ public class AttachmentAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionUpdateContent.class) + @POST + @Path("update/content/{id}/work/{workId}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateContentMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("附件标识") @PathParam("id") String id, + @JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateContent().execute(effectivePerson, id, workId, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新附件,使用callback方式,为了与前台兼容使用POST方法.", action = ActionUpdateCallback.class) @POST @Path("update/{id}/work/{workId}/callback/{callback}") @@ -657,6 +750,25 @@ public class AttachmentAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionEdit.class) + @POST + @Path("edit/{id}/work/{workId}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void editMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("附件标识") @PathParam("id") String id, + @JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionEdit().execute(effectivePerson, id, workId, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "设置附件排序号.", action = ActionEdit.class) @GET @Path("{id}/work/{workId}/change/ordernumber/{orderNumber}") @@ -696,6 +808,25 @@ public class AttachmentAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionEditText.class) + @POST + @Path("edit/{id}/work/{workId}/text/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void exitTextMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("附件标识") @PathParam("id") String id, + @JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionEditText().execute(effectivePerson, id, workId, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "获取附件文本.", action = ActionGetText.class) @GET @Path("{id}/work/{workId}/text") @@ -871,7 +1002,7 @@ public class AttachmentAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @JaxrsMethodDescribe(value = "上传工单的表单、审批记录等html信息到缓存", action = ActionUploadWorkInfo.class) + @JaxrsMethodDescribe(value = "上传工单的表单、审批记录等html信息到缓存.", action = ActionUploadWorkInfo.class) @PUT @Path("upload/work/{workId}/save/as/{flag}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @@ -891,6 +1022,27 @@ public class AttachmentAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionUploadWorkInfo.class) + @POST + @Path("upload/work/{workId}/save/as/{flag}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void uploadWorkInfoMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, + @JaxrsParameterDescribe("Work或WorkCompleted的工作标识") @PathParam("workId") String workId, + @JaxrsParameterDescribe("另存为格式:(0)表示不转换|pdf表示转为pdf|word表示转为word") @PathParam("flag") String flag, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUploadWorkInfo().execute(effectivePerson, workId, flag, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "下载工单的表单、审批记录等html信息", action = ActionDownloadWorkInfo.class) @GET @Path("download/work/{workId}/att/{flag}") diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/control/ActionGetWorkOrWorkCompleted.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/control/ActionGetWorkOrWorkCompleted.java index 80b5d7c5df470776b23f7ce4c93a2bc9000758a6..c9e4a1d089ca75c45cea2c4d4405a93c1a488b2b 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/control/ActionGetWorkOrWorkCompleted.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/control/ActionGetWorkOrWorkCompleted.java @@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.control; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.CompletableFuture; import org.apache.commons.lang3.BooleanUtils; @@ -45,29 +46,44 @@ class ActionGetWorkOrWorkCompleted extends BaseAction { private Map hasTaskCompletedWithActivityToken = new HashMap<>(); ActionResult execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - - Business business = new Business(emc); - - if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, - new ExceptionEntityNotExist(workOrWorkCompleted))) { - throw new ExceptionAccessDenied(effectivePerson); - } - + ActionResult result = new ActionResult<>(); + CompletableFuture _wo = CompletableFuture.supplyAsync(() -> { Wo wo = null; - - Work work = emc.find(workOrWorkCompleted, Work.class); - - if (null != work) { - wo = this.work(business, effectivePerson, work); - } else { - wo = this.workCompleted(business, effectivePerson, emc.flag(workOrWorkCompleted, WorkCompleted.class)); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + Work work = emc.find(workOrWorkCompleted, Work.class); + if (null != work) { + wo = this.work(business, effectivePerson, work); + } else { + WorkCompleted workCompleted = emc.flag(workOrWorkCompleted, WorkCompleted.class); + if (null != workCompleted) { + wo = this.workCompleted(business, effectivePerson, workCompleted); + } + } + } catch (Exception e) { + logger.error(e); } + return wo; + }); + + CompletableFuture _control = CompletableFuture.supplyAsync(() -> { + Boolean value = false; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + value = business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, + new ExceptionEntityNotExist(workOrWorkCompleted)); + } catch (Exception e) { + logger.error(e); + } + return value; + }); - result.setData(wo); - return result; + if (BooleanUtils.isFalse(_control.get())) { + throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted); } + + result.setData(_wo.get()); + return result; } private Wo workCompleted(Business business, EffectivePerson effectivePerson, WorkCompleted workCompleted) diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/data/DataAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/data/DataAction.java index 1abaf2a8d2aa66dcdc4072aa869bc7b033763cc4..95635599ee54238a3436b0e4f08b67b50ca2e342 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/data/DataAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/data/DataAction.java @@ -690,6 +690,25 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock PUT to POST.", action = ActionUpdateWithWork.class) + @POST + @Path("work/{id}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWork().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定Work的Data数据.", action = ActionUpdateWithWorkPath0.class) @PUT @Path("work/{id}/{path0}") @@ -709,6 +728,25 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "更新指定Work的Data数据.", action = ActionUpdateWithWorkPath0.class) + @POST + @Path("work/{id}/{path0}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkPath0MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkPath0().execute(effectivePerson, id, path0, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定Work的Data数据.", action = ActionUpdateWithWorkPath1.class) @PUT @Path("work/{id}/{path0}/{path1}") @@ -729,6 +767,26 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock PUT To POST.", action = ActionUpdateWithWorkPath1.class) + @PUT + @Path("work/{id}/{path0}/{path1}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkPath1MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkPath1().execute(effectivePerson, id, path0, path1, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定Work的Data数据.", action = ActionUpdateWithWorkPath2.class) @PUT @Path("work/{id}/{path0}/{path1}/{path2}") @@ -750,6 +808,27 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock PUT to POST.", action = ActionUpdateWithWorkPath2.class) + @POST + @Path("work/{id}/{path0}/{path1}/{path2}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkPath2MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkPath2().execute(effectivePerson, id, path0, path1, path2, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定Work的Data数据.", action = ActionUpdateWithWorkPath3.class) @PUT @Path("work/{id}/{path0}/{path1}/{path2}/{path3}") @@ -773,6 +852,29 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock PUT to POST.", action = ActionUpdateWithWorkPath3.class) + @POST + @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkPath3MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkPath3().execute(effectivePerson, id, path0, path1, path2, path3, + jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定Work的Data数据.", action = ActionUpdateWithWorkPath4.class) @PUT @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}") @@ -797,6 +899,30 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock PUT to POST.", action = ActionUpdateWithWorkPath4.class) + @POST + @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkPath4MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkPath4().execute(effectivePerson, id, path0, path1, path2, path3, path4, + jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定Work的Data数据.", action = ActionUpdateWithWorkPath5.class) @PUT @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}") @@ -822,6 +948,31 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "更新指定Work的Data数据.", action = ActionUpdateWithWorkPath5.class) + @POST + @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkPath5MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkPath5().execute(effectivePerson, id, path0, path1, path2, path3, path4, + path5, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定Work的Data数据.", action = ActionUpdateWithWorkPath6.class) @PUT @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}") @@ -848,6 +999,32 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock PUT to POST.", action = ActionUpdateWithWorkPath6.class) + @POST + @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkPath6MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, + @JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkPath6().execute(effectivePerson, id, path0, path1, path2, path3, path4, + path5, path6, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定Work的Data数据.", action = ActionUpdateWithWorkPath7.class) @PUT @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/{path7}") @@ -875,6 +1052,33 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "更新指定Work的Data数据.", action = ActionUpdateWithWorkPath7.class) + @POST + @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/{path7}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkPath7MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, + @JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6, + @JaxrsParameterDescribe("7级路径") @PathParam("path7") String path7, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkPath7().execute(effectivePerson, id, path0, path1, path2, path3, path4, + path5, path6, path7, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompleted.class) @PUT @Path("workcompleted/{id}") @@ -894,6 +1098,25 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompleted.class) + @POST + @Path("workcompleted/{id}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkCompletedMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkCompleted().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath0.class) @PUT @Path("workcompleted/{id}/{path0}") @@ -913,6 +1136,25 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath0.class) + @POST + @Path("workcompleted/{id}/{path0}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkCompletedPath0MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkCompletedPath0().execute(effectivePerson, id, path0, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath1.class) @PUT @Path("workcompleted/{id}/{path0}/{path1}") @@ -933,6 +1175,26 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath1.class) + @POST + @Path("workcompleted/{id}/{path0}/{path1}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkCompletedPath1MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkCompletedPath1().execute(effectivePerson, id, path0, path1, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath2.class) @PUT @Path("workcompleted/{id}/{path0}/{path1}/{path2}") @@ -946,8 +1208,124 @@ public class DataAction extends StandardJaxrsAction { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = new ActionUpdateWithWorkCompletedPath2().execute(effectivePerson, id, path0, path1, path2, - jsonElement); + result = new ActionUpdateWithWorkCompletedPath2().execute(effectivePerson, id, path0, path1, path2, + jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath2.class) + @POST + @Path("workcompleted/{id}/{path0}/{path1}/{path2}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkCompletedPath2MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkCompletedPath2().execute(effectivePerson, id, path0, path1, path2, + jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath3.class) + @PUT + @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkCompletedPath3(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkCompletedPath3().execute(effectivePerson, id, path0, path1, path2, path3, + jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath3.class) + @POST + @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkCompletedPath3MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkCompletedPath3().execute(effectivePerson, id, path0, path1, path2, path3, + jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath4.class) + @PUT + @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}/{path4}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkCompletedPath4(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkCompletedPath4().execute(effectivePerson, id, path0, path1, path2, path3, + path4, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath4.class) + @POST + @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkCompletedPath4MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkCompletedPath4().execute(effectivePerson, id, path0, path1, path2, path3, + path4, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, jsonElement); result.error(e); @@ -955,22 +1333,24 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath3.class) + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath5.class) @PUT - @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}") + @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void updateWithWorkCompletedPath3(@Suspended final AsyncResponse asyncResponse, + public void updateWithWorkCompletedPath5(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, - @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, JsonElement jsonElement) { - ActionResult result = new ActionResult<>(); + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = new ActionUpdateWithWorkCompletedPath3().execute(effectivePerson, id, path0, path1, path2, path3, - jsonElement); + result = new ActionUpdateWithWorkCompletedPath5().execute(effectivePerson, id, path0, path1, path2, path3, + path4, path5, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, jsonElement); result.error(e); @@ -978,23 +1358,24 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath4.class) - @PUT - @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}/{path4}") + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath5.class) + @POST + @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/mockputtopost") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void updateWithWorkCompletedPath4(@Suspended final AsyncResponse asyncResponse, + public void updateWithWorkCompletedPath5MockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, - @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, JsonElement jsonElement) { - ActionResult result = new ActionResult<>(); + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = new ActionUpdateWithWorkCompletedPath4().execute(effectivePerson, id, path0, path1, path2, path3, - path4, jsonElement); + result = new ActionUpdateWithWorkCompletedPath5().execute(effectivePerson, id, path0, path1, path2, path3, + path4, path5, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, jsonElement); result.error(e); @@ -1002,24 +1383,25 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath5.class) + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath6.class) @PUT - @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}") + @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void updateWithWorkCompletedPath5(@Suspended final AsyncResponse asyncResponse, + public void updateWithWorkCompletedPath6(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, - @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, JsonElement jsonElement) { - ActionResult result = new ActionResult<>(); + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, + @JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { - result = new ActionUpdateWithWorkCompletedPath5().execute(effectivePerson, id, path0, path1, path2, path3, - path4, path5, jsonElement); + result = new ActionUpdateWithWorkCompletedPath6().execute(effectivePerson, id, path0, path1, path2, path3, + path4, path5, path6, jsonElement); } catch (Exception e) { logger.error(e, effectivePerson, request, jsonElement); result.error(e); @@ -1028,11 +1410,11 @@ public class DataAction extends StandardJaxrsAction { } @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath6.class) - @PUT - @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}") + @POST + @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/mockputtopost") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void updateWithWorkCompletedPath6(@Suspended final AsyncResponse asyncResponse, + public void updateWithWorkCompletedPath6MockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, @@ -1080,6 +1462,33 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "更新指定WorkCompleted的Data数据.", action = ActionUpdateWithWorkCompletedPath7.class) + @POST + @Path("workcompleted/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/{path7}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateWithWorkCompletedPath7MockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("完成工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, + @JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6, + @JaxrsParameterDescribe("7级路径") @PathParam("path7") String path7, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdateWithWorkCompletedPath7().execute(effectivePerson, id, path0, path1, path2, path3, + path4, path5, path6, path7, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "对指定的work添加局部data数据.", action = ActionCreateWithWork.class) @POST @Path("work/{id}") @@ -1301,6 +1710,24 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWork.class) + @GET + @Path("work/{id}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteWithWorkMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteWithWork().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath0.class) @DELETE @Path("work/{id}/{path0}") @@ -1320,6 +1747,25 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath0.class) + @GET + @Path("work/{id}/{path0}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteWithWorkPath0MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteWithWorkPath0().execute(effectivePerson, id, path0); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath1.class) @DELETE @Path("work/{id}/{path0}/{path1}") @@ -1340,6 +1786,26 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath1.class) + @GET + @Path("work/{id}/{path0}/{path1}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteWithWorkPath1MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteWithWorkPath1().execute(effectivePerson, id, path0, path1); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath2.class) @DELETE @Path("work/{id}/{path0}/{path1}/{path2}") @@ -1361,6 +1827,27 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath2.class) + @GET + @Path("work/{id}/{path0}/{path1}/{path2}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteWithWorkPath2MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteWithWorkPath2().execute(effectivePerson, id, path0, path1, path2); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath3.class) @DELETE @Path("work/{id}/{path0}/{path1}/{path2}/{path3}") @@ -1383,6 +1870,28 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath3.class) + @GET + @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteWithWorkPath3MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteWithWorkPath3().execute(effectivePerson, id, path0, path1, path2, path3); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath4.class) @DELETE @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}") @@ -1406,6 +1915,29 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath4.class) + @GET + @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteWithWorkPath4MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteWithWorkPath4().execute(effectivePerson, id, path0, path1, path2, path3, path4); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath5.class) @DELETE @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}") @@ -1431,6 +1963,31 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath5.class) + @GET + @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteWithWorkPath5MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteWithWorkPath5().execute(effectivePerson, id, path0, path1, path2, path3, path4, + path5); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath6.class) @DELETE @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}") @@ -1457,6 +2014,32 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath6.class) + @GET + @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteWithWorkPath6MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, + @JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteWithWorkPath6().execute(effectivePerson, id, path0, path1, path2, path3, path4, + path5, path6); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath7.class) @DELETE @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/{path7}") @@ -1484,6 +2067,33 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath7.class) + @GET + @Path("work/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/{path7}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteWithWorkPath7MockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, + @JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1, + @JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2, + @JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3, + @JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4, + @JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5, + @JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6, + @JaxrsParameterDescribe("7级路径") @PathParam("path7") String path7) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDeleteWithWorkPath7().execute(effectivePerson, id, path0, path1, path2, path3, path4, + path5, path6, path7); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "根据job获取指定路径的部分data数据.", action = ActionFetchWithJob.class) @POST @Path("fetch/job/{job}") @@ -1502,21 +2112,4 @@ public class DataAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } -// @JaxrsMethodDescribe(value = "更新指定Work的Data数据合并区段数据.", action = ActionUpdateWithWorkSection.class) -// @PUT -// @Path("section/work/{id}") -// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) -// @Consumes(MediaType.APPLICATION_JSON) -// public void updateWithWorkSection(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, -// @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, JsonElement jsonElement) { -// ActionResult result = new ActionResult<>(); -// EffectivePerson effectivePerson = this.effectivePerson(request); -// try { -// result = new ActionUpdateWithWorkSection().execute(effectivePerson, id, jsonElement); -// } catch (Exception e) { -// logger.error(e, effectivePerson, request, jsonElement); -// result.error(e); -// } -// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); -// } } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/DraftAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/DraftAction.java index 0dae4a493ed00fa73490aa938823cd9f514f7e15..edcf992802b6f95850277d3164e7875183194f92 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/DraftAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/DraftAction.java @@ -34,10 +34,10 @@ public class DraftAction extends StandardJaxrsAction { private static Logger logger = LoggerFactory.getLogger(DraftAction.class); - @POST @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) @Path("process/{processFlag}") + @POST @JaxrsMethodDescribe(value = "拟稿.", action = ActionDraw.class) public void draw(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("流程标识") @PathParam("processFlag") String processFlag, JsonElement jsonElement) { @@ -88,10 +88,28 @@ public class DraftAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @PUT + @JaxrsMethodDescribe(value = "Mock Get To Delete", action = ActionDelete.class) + @GET + @Path("{id}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("草稿标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDelete().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) @JaxrsMethodDescribe(value = "保存草稿.", action = ActionSave.class) + @PUT public void save(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement) { ActionResult result = new ActionResult<>(); @@ -105,6 +123,24 @@ public class DraftAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + @JaxrsMethodDescribe(value = "Mock Post 2 Put.", action = ActionSave.class) + @POST + @Path("mockputtopost") + public void saveMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionSave().execute(effectivePerson, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "列示当前用户创建的草稿,分页.", action = ActionListMyPaging.class) @POST @Path("list/my/paging/{page}/size/{size}") diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGet.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGet.java index 6182738b68b31ed467f419971cc5215e650f7834..7346330f1d96f0c6d3f00ff03edc1de22e04652a 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGet.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGet.java @@ -3,9 +3,9 @@ package com.x.processplatform.assemble.surface.jaxrs.form; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.WoMaxAgeFastETag; import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.core.entity.element.Form; @@ -21,12 +21,13 @@ class ActionGet extends BaseAction { } Wo wo = new Wo(); wo.setData(form.getDataOrMobileData()); + wo.setFastETag(form.getId() + form.getUpdateTime().getTime()); result.setData(wo); return result; } } - public static class Wo extends GsonPropertyObject { + public static class Wo extends WoMaxAgeFastETag { private String data; diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetMobile.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetMobile.java index 3538d98bdd16aa7c6dcb163f325f882cdbcedd2a..3cb17109aa60f46894dfb11772c990d3eb52beee 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetMobile.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetMobile.java @@ -3,9 +3,9 @@ package com.x.processplatform.assemble.surface.jaxrs.form; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.WoMaxAgeFastETag; import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.core.entity.element.Form; @@ -21,12 +21,13 @@ class ActionGetMobile extends BaseAction { } Wo wo = new Wo(); wo.setData(form.getMobileDataOrData()); + wo.setFastETag(form.getId() + form.getUpdateTime().getTime()); result.setData(wo); return result; } } - public static class Wo extends GsonPropertyObject { + public static class Wo extends WoMaxAgeFastETag { private String data; diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplication.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplication.java index d2d0fbb9bf2579ec8a9b59dba867fe5abda35610..8beb854a069083cd5e797998063094d0ad218048 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplication.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplication.java @@ -3,9 +3,9 @@ package com.x.processplatform.assemble.surface.jaxrs.form; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.WoMaxAgeFastETag; import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.core.entity.element.Application; import com.x.processplatform.core.entity.element.Form; @@ -21,23 +21,15 @@ class ActionGetWithApplication extends BaseAction { throw new ExceptionEntityNotExist(applicationFlag, Application.class); } Form form = business.form().pick(application, flag); - // Wo wo = Wo.copier.copy(form); Wo wo = new Wo(); wo.setData(form.getDataOrMobileData()); + wo.setFastETag(form.getId() + form.getUpdateTime().getTime()); result.setData(wo); return result; } } -// public static class Wo extends Form { -// -// private static final long serialVersionUID = 1541438199059150837L; -// -// static WrapCopier copier = WrapCopierFactory.wo(Form.class, Wo.class, null, -// JpaObject.FieldsInvisible); -// -// } - public static class Wo extends GsonPropertyObject { + public static class Wo extends WoMaxAgeFastETag { private String data; diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplicationMobile.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplicationMobile.java index 289ba61f2ec4c948c44ee033dde4a0690e24f047..6e9ca55cfe68744e9932bfef041b5f4895dfcd77 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplicationMobile.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplicationMobile.java @@ -2,13 +2,10 @@ package com.x.processplatform.assemble.surface.jaxrs.form; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.entity.JpaObject; -import com.x.base.core.project.bean.WrapCopier; -import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.WoMaxAgeFastETag; import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.core.entity.element.Application; import com.x.processplatform.core.entity.element.Form; @@ -24,15 +21,15 @@ class ActionGetWithApplicationMobile extends BaseAction { throw new ExceptionEntityNotExist(applicationFlag, Application.class); } Form form = business.form().pick(application, flag); - //Wo wo = Wo.copier.copy(form); Wo wo = new Wo(); wo.setData(form.getMobileDataOrData()); + wo.setFastETag(form.getId() + form.getUpdateTime().getTime()); result.setData(wo); return result; } } - public static class Wo extends GsonPropertyObject { + public static class Wo extends WoMaxAgeFastETag { private String data; diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java deleted file mode 100644 index 9d5f87bf8ae50dc5f2e80b4c498504589253ade7..0000000000000000000000000000000000000000 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompleted.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.x.processplatform.assemble.surface.jaxrs.form; - -import java.util.Map.Entry; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.exception.ExceptionAccessDenied; -import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Audit; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.PropertyTools; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.Work; -import com.x.processplatform.core.entity.content.WorkCompleted; -import com.x.processplatform.core.entity.content.WorkCompletedProperties; -import com.x.processplatform.core.entity.element.Activity; -import com.x.processplatform.core.entity.element.Form; -import com.x.processplatform.core.entity.element.Script; - -class ActionGetWithWorkOrWorkCompleted extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionGetWithWorkOrWorkCompleted.class); - - ActionResult execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Audit audit = logger.audit(effectivePerson); - ActionResult result = new ActionResult<>(); - - Business business = new Business(emc); - - if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, - new ExceptionEntityNotExist(workOrWorkCompleted))) { - throw new ExceptionAccessDenied(effectivePerson); - } - - JsonElement wo = null; - - Work work = emc.find(workOrWorkCompleted, Work.class); - - if (null != work) { - wo = gson.toJsonTree(this.work(business, work)); - } else { - wo = gson.toJsonTree(this.workCompleted(business, emc.flag(workOrWorkCompleted, WorkCompleted.class))); - } - audit.log(null, "查看"); - result.setData(wo); - return result; - } - } - - private Wo work(Business business, Work work) throws Exception { - Wo wo = new Wo(); - String id = work.getForm(); - if (StringUtils.isEmpty(id)) { - Activity activity = business.getActivity(work); - id = PropertyTools.getOrElse(activity, Activity.form_FIELDNAME, String.class, ""); - } - if (StringUtils.isNotEmpty(id)) { - Form form = business.form().pick(id); - if (null != form) { - wo.setForm(toWoFormDataOrMobileData(form)); - related(business, wo, form); - } - } - return wo; - } - - private Wo workCompleted(Business business, WorkCompleted workCompleted) throws Exception { - Wo wo = new Wo(); - // 先使用当前库的表单,如果不存在使用储存的表单. - if (StringUtils.isNotEmpty(workCompleted.getForm())) { - Form form = business.form().pick(workCompleted.getForm()); - if (null != form) { - wo.setForm(toWoFormDataOrMobileData(form)); - related(business, wo, form); - } - } else if (null != workCompleted.getProperties().getForm()) { - wo.setForm(toWoFormDataOrMobileData(workCompleted.getProperties().getForm())); - if (StringUtils.isNotBlank(workCompleted.getProperties().getForm().getData())) { - workCompleted.getProperties().getRelatedFormList() - .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormDataOrMobileData(o))); - } else { - workCompleted.getProperties().getMobileRelatedFormList() - .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormMobileDataOrData(o))); - } - } - workCompleted.getProperties().getRelatedScriptList().stream() - .forEach(o -> wo.getRelatedScriptMap().put(o.getId(), toWoScript(o))); - return wo; - } - - private void related(Business business, Wo wo, Form form) throws Exception { - if (StringUtils.isNotBlank(form.getData())) { - for (String relatedFormId : form.getProperties().getRelatedFormList()) { - Form relatedForm = business.form().pick(relatedFormId); - if (null != relatedForm) { - wo.getRelatedFormMap().put(relatedFormId, toWoFormDataOrMobileData(relatedForm)); - } - } - } else { - for (String mobileRelatedFormId : form.getProperties().getMobileRelatedFormList()) { - Form mobileRelatedForm = business.form().pick(mobileRelatedFormId); - if (null != mobileRelatedForm) { - wo.getRelatedFormMap().put(mobileRelatedFormId, toWoFormMobileDataOrData(mobileRelatedForm)); - } - } - } - relatedScript(business, wo, form); - } - - protected void relatedScript(Business business, AbstractWo wo, Form form) throws Exception { - for (Entry entry : form.getProperties().getRelatedScriptMap().entrySet()) { - switch (entry.getValue()) { - case WorkCompletedProperties.Script.TYPE_PROCESSPLATFORM: - Script relatedScript = business.script().pick(entry.getKey()); - if (null != relatedScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedScript)); - } - break; - case WorkCompletedProperties.Script.TYPE_CMS: - com.x.cms.core.entity.element.Script relatedCmsScript = business.cms().script().pick(entry.getKey()); - if (null != relatedCmsScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedCmsScript)); - } - break; - case WorkCompletedProperties.Script.TYPE_PORTAL: - com.x.portal.core.entity.Script relatedPortalScript = business.portal().script().pick(entry.getKey()); - if (null != relatedPortalScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedPortalScript)); - } - break; - default: - break; - } - } - } - - public static class Wo extends AbstractWo { - - } - -} \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java deleted file mode 100644 index 86d09da31ebf999f0e8682e8b1583a4964669acb..0000000000000000000000000000000000000000 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithWorkOrWorkCompletedMobile.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.x.processplatform.assemble.surface.jaxrs.form; - -import java.util.Map.Entry; - -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.exception.ExceptionAccessDenied; -import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Audit; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.PropertyTools; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.Work; -import com.x.processplatform.core.entity.content.WorkCompleted; -import com.x.processplatform.core.entity.content.WorkCompletedProperties; -import com.x.processplatform.core.entity.element.Activity; -import com.x.processplatform.core.entity.element.Form; -import com.x.processplatform.core.entity.element.Script; - -class ActionGetWithWorkOrWorkCompletedMobile extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionGetWithWorkOrWorkCompletedMobile.class); - - ActionResult execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Audit audit = logger.audit(effectivePerson); - ActionResult result = new ActionResult<>(); - - Business business = new Business(emc); - - if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, - new ExceptionEntityNotExist(workOrWorkCompleted))) { - throw new ExceptionAccessDenied(effectivePerson); - } - - JsonElement wo = null; - - Work work = emc.find(workOrWorkCompleted, Work.class); - - if (null != work) { - wo = gson.toJsonTree(this.work(business, work)); - } else { - wo = gson.toJsonTree(this.workCompleted(business, emc.flag(workOrWorkCompleted, WorkCompleted.class))); - } - audit.log(null, "查看"); - result.setData(wo); - return result; - } - } - - private Wo work(Business business, Work work) throws Exception { - Wo wo = new Wo(); - String id = work.getForm(); - if (StringUtils.isEmpty(id)) { - Activity activity = business.getActivity(work); - id = PropertyTools.getOrElse(activity, Activity.form_FIELDNAME, String.class, ""); - } - if (StringUtils.isNotEmpty(id)) { - Form form = business.form().pick(id); - if (null != form) { - wo.setForm(toWoFormMobileDataOrData(form)); - related(business, wo, form); - } - } - return wo; - } - - private Wo workCompleted(Business business, WorkCompleted workCompleted) throws Exception { - Wo wo = new Wo(); - // 先使用当前库的表单,如果不存在使用储存的表单. - if (StringUtils.isNotEmpty(workCompleted.getForm())) { - Form form = business.form().pick(workCompleted.getForm()); - if (null != form) { - wo.setForm(toWoFormMobileDataOrData(form)); - related(business, wo, form); - } - } else if (null != workCompleted.getProperties().getForm()) { - wo.setForm(toWoFormMobileDataOrData(workCompleted.getProperties().getForm())); - if (StringUtils.isNotBlank(workCompleted.getProperties().getForm().getMobileData())) { - workCompleted.getProperties().getMobileRelatedFormList() - .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormMobileDataOrData(o))); - } else { - workCompleted.getProperties().getRelatedFormList() - .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormDataOrMobileData(o))); - } - } - workCompleted.getProperties().getRelatedScriptList().stream() - .forEach(o -> wo.getRelatedScriptMap().put(o.getId(), toWoScript(o))); - return wo; - } - - private void related(Business business, Wo wo, Form form) throws Exception { - if (StringUtils.isNotBlank(form.getMobileData())) { - for (String mobileRelatedFormId : form.getProperties().getMobileRelatedFormList()) { - Form relatedForm = business.form().pick(mobileRelatedFormId); - if (null != relatedForm) { - wo.getRelatedFormMap().put(mobileRelatedFormId, toWoFormMobileDataOrData(relatedForm)); - } - } - } else { - for (String relatedFormId : form.getProperties().getRelatedFormList()) { - Form relatedForm = business.form().pick(relatedFormId); - if (null != relatedForm) { - wo.getRelatedFormMap().put(relatedFormId, toWoFormDataOrMobileData(relatedForm)); - } - } - } - relatedScript(business, wo, form); - } - - protected void relatedScript(Business business, AbstractWo wo, Form form) throws Exception { - for (Entry entry : form.getProperties().getMobileRelatedScriptMap().entrySet()) { - switch (entry.getValue()) { - case WorkCompletedProperties.Script.TYPE_PROCESSPLATFORM: - Script relatedScript = business.script().pick(entry.getKey()); - if (null != relatedScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedScript)); - } - break; - case WorkCompletedProperties.Script.TYPE_CMS: - com.x.cms.core.entity.element.Script relatedCmsScript = business.cms().script().pick(entry.getKey()); - if (null != relatedCmsScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedCmsScript)); - } - break; - case WorkCompletedProperties.Script.TYPE_PORTAL: - com.x.portal.core.entity.Script relatedPortalScript = business.portal().script().pick(entry.getKey()); - if (null != relatedPortalScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedPortalScript)); - } - break; - default: - break; - } - } - } - - public static class Wo extends AbstractWo { - - } - -} \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/BaseAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/BaseAction.java index b4d55bd0dc46ba5fd120dd607fb07fcb05fac555..fcd96f93084706c51d9aed271cde7f6eaa52c2dc 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/BaseAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/BaseAction.java @@ -2,233 +2,54 @@ package com.x.processplatform.assemble.surface.jaxrs.form; import java.util.HashMap; import java.util.Map; -import java.util.Map.Entry; -import com.x.base.core.project.cache.ApplicationCache; -import com.x.base.core.project.gson.GsonPropertyObject; +import com.x.base.core.project.cache.Cache.CacheCategory; import com.x.base.core.project.jaxrs.StandardJaxrsAction; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.WorkCompletedProperties; +import com.x.base.core.project.jaxrs.WoMaxAgeFastETag; +import com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedForm; +import com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedScript; import com.x.processplatform.core.entity.element.Form; import com.x.processplatform.core.entity.element.Script; -import net.sf.ehcache.Ehcache; - abstract class BaseAction extends StandardJaxrsAction { - protected static Ehcache CACHE = ApplicationCache.instance().getCache(Form.class, Script.class, - com.x.portal.core.entity.Script.class, com.x.cms.core.entity.element.Script.class); - - protected WoForm toWoFormDataOrMobileData(Form form) { - WoForm wo = new WoForm(); - wo.setId(form.getId()); - wo.setName(form.getName()); - wo.setAlias(form.getAlias()); - wo.setCategory(form.getCategory()); - wo.setApplication(form.getApplication()); - wo.setHasMobile(form.getHasMobile()); - wo.setData(form.getDataOrMobileData()); - return wo; - } + CacheCategory cacheCategory = new CacheCategory(Form.class, Script.class, com.x.portal.core.entity.Script.class, + com.x.cms.core.entity.element.Script.class); - protected WoForm toWoFormMobileDataOrData(Form form) { - WoForm wo = new WoForm(); - wo.setId(form.getId()); - wo.setName(form.getName()); - wo.setAlias(form.getAlias()); - wo.setCategory(form.getCategory()); - wo.setApplication(form.getApplication()); - wo.setHasMobile(form.getHasMobile()); - wo.setData(form.getMobileDataOrData()); - return wo; - } + public static class AbstractWo extends WoMaxAgeFastETag { - protected WoScript toWoScript(Script script) { - WoScript wo = new WoScript(); - wo.setId(script.getId()); - wo.setName(script.getName()); - wo.setAlias(script.getAlias()); - wo.setText(script.getText()); - return wo; - } + private static final long serialVersionUID = 9043017746047829883L; - protected WoScript toWoScript(com.x.cms.core.entity.element.Script script) { - WoScript wo = new WoScript(); - wo.setId(script.getId()); - wo.setName(script.getName()); - wo.setAlias(script.getAlias()); - wo.setText(script.getText()); - return wo; - } + private RelatedForm form; - protected WoScript toWoScript(com.x.portal.core.entity.Script script) { - WoScript wo = new WoScript(); - wo.setId(script.getId()); - wo.setName(script.getName()); - wo.setAlias(script.getAlias()); - wo.setText(script.getText()); - return wo; - } - - protected WoScript toWoScript(WorkCompletedProperties.Script script) { - WoScript wo = new WoScript(); - wo.setId(script.getId()); - wo.setName(script.getName()); - wo.setAlias(script.getAlias()); - wo.setText(script.getText()); - return wo; - } + private Map relatedFormMap = new HashMap<>(); - public static class WoForm extends GsonPropertyObject { - private String id; - private String alias; - private String name; - private String data; - private String category; - private String application; - private Boolean hasMobile; - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getApplication() { - return application; - } - - public void setApplication(String application) { - this.application = application; - } - - public Boolean getHasMobile() { - return hasMobile; - } - - public void setHasMobile(Boolean hasMobile) { - this.hasMobile = hasMobile; - } - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getData() { - return data; - } + private Map relatedScriptMap = new HashMap<>(); - public void setData(String data) { - this.data = data; - } - } - - public static class WoScript extends GsonPropertyObject { - - private String id; - private String alias; - private String name; - private String text; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - } - - public static class AbstractWo extends GsonPropertyObject { - - private String id; - - private WoForm form; - - private Map relatedFormMap = new HashMap<>(); - - private Map relatedScriptMap = new HashMap<>(); - - public WoForm getForm() { + public RelatedForm getForm() { return form; } - public void setForm(WoForm form) { + public void setForm(RelatedForm form) { this.form = form; } - public Map getRelatedFormMap() { + public Map getRelatedFormMap() { return relatedFormMap; } - public void setRelatedFormMap(Map relatedFormMap) { + public void setRelatedFormMap(Map relatedFormMap) { this.relatedFormMap = relatedFormMap; } - public Map getRelatedScriptMap() { + public Map getRelatedScriptMap() { return relatedScriptMap; } - public void setRelatedScriptMap(Map relatedScriptMap) { + public void setRelatedScriptMap(Map relatedScriptMap) { this.relatedScriptMap = relatedScriptMap; } - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - } } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/FormAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/FormAction.java index bcf4b0f561713aecfd67fa7e17713dfb83e97a38..9ae98eeddbedf5399e520f079ee5aa7f69d9bdf0 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/FormAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/FormAction.java @@ -11,7 +11,6 @@ import javax.ws.rs.container.Suspended; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; -import com.google.gson.JsonElement; import com.x.base.core.project.annotation.JaxrsDescribe; import com.x.base.core.project.annotation.JaxrsMethodDescribe; import com.x.base.core.project.annotation.JaxrsParameterDescribe; @@ -29,45 +28,7 @@ public class FormAction extends StandardJaxrsAction { private static Logger logger = LoggerFactory.getLogger(FormAction.class); - @JaxrsMethodDescribe(value = "根据工作或完成工作标识获取表单.", action = ActionGetWithWorkOrWorkCompleted.class) - @GET - @Path("workorworkcompleted/{workOrWorkCompleted}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void getWithWorkOrWorkCompleted(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("工作或完成工作标识") @PathParam("workOrWorkCompleted") String workOrWorkCompleted) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionGetWithWorkOrWorkCompleted().execute(effectivePerson, workOrWorkCompleted); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据工作或完成工作标识获取移动表单.", action = ActionGetWithWorkOrWorkCompletedMobile.class) - @GET - @Path("workorworkcompleted/{workOrWorkCompleted}/mobile") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void getWithWorkOrWorkCompletedMobile(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, - @JaxrsParameterDescribe("工作或完成工作标识") @PathParam("workOrWorkCompleted") String workOrWorkCompleted) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionGetWithWorkOrWorkCompletedMobile().execute(effectivePerson, workOrWorkCompleted); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "获取表单.", action = ActionGet.class) + @JaxrsMethodDescribe(value = "获取表单内容.", action = ActionGet.class) @GET @Path("{flag}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @@ -85,7 +46,7 @@ public class FormAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @JaxrsMethodDescribe(value = "获取移动端表单.", action = ActionGetMobile.class) + @JaxrsMethodDescribe(value = "获取移动端表单内容.", action = ActionGetMobile.class) @GET @Path("{flag}/mobile") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @@ -141,7 +102,7 @@ public class FormAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @JaxrsMethodDescribe(value = "查询表单,如果有表单那么返回表单id,如果使用的是combine的表单直接返回内容.", action = V2LookupWorkOrWorkCompleted.class) + @JaxrsMethodDescribe(value = "查询表单,如果有表单那么返回表单id,如果表单不存在且是已完成工作,那么返回storeForm.", action = V2LookupWorkOrWorkCompleted.class) @GET @Path("v2/lookup/workorworkcompleted/{workOrWorkCompleted}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @@ -160,7 +121,7 @@ public class FormAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @JaxrsMethodDescribe(value = "查询移动端表单,如果有表单那么返回表单id,如果使用的是combine的表单直接返回内容.", action = V2LookupWorkOrWorkCompletedMobile.class) + @JaxrsMethodDescribe(value = "查询表单,如果有表单那么返回表单id,如果表单不存在且是已完成工作,那么返回storeFormMobile.", action = V2LookupWorkOrWorkCompletedMobile.class) @GET @Path("v2/lookup/workorworkcompleted/{workOrWorkCompleted}/mobile") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2Get.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2Get.java index e16579125ff62d45e5c6b77234cd09bb997dab36..57d412c8ca43df8f3888a303564f185ad3f93d85 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2Get.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2Get.java @@ -1,20 +1,27 @@ package com.x.processplatform.assemble.surface.jaxrs.form; +import java.util.Map; import java.util.Map.Entry; -import java.util.Objects; - -import org.apache.commons.lang3.StringUtils; +import java.util.Optional; +import java.util.TreeMap; +import java.util.concurrent.CompletableFuture; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.project.cache.Cache.CacheKey; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.exception.ExceptionEntityNotExist; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.core.entity.content.WorkCompletedProperties; +import com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedForm; +import com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedScript; import com.x.processplatform.core.entity.element.Form; +import com.x.processplatform.core.entity.element.FormProperties; import com.x.processplatform.core.entity.element.Script; class V2Get extends BaseAction { @@ -22,65 +29,92 @@ class V2Get extends BaseAction { private static Logger logger = LoggerFactory.getLogger(V2Get.class); ActionResult execute(EffectivePerson effectivePerson, String id) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - Form form = emc.find(id, Form.class); - if (Objects.isNull(form)) { - throw new ExceptionEntityNotExist(id, Form.class); - } - Wo wo = new Wo(); - wo.setForm(toWoFormDataOrMobileData(form)); - related(business, wo, form); + ActionResult result = new ActionResult<>(); + CacheKey cacheKey = new CacheKey(this.getClass(), id); + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + result.setData((Wo) optional.get()); + } else { + Wo wo = this.get(id); + CacheManager.put(cacheCategory, cacheKey, wo); result.setData(wo); - return result; } + return result; } - private void related(Business business, Wo wo, Form form) throws Exception { - if (StringUtils.isNotBlank(form.getData())) { - for (String relatedFormId : form.getProperties().getRelatedFormList()) { - Form relatedForm = business.form().pick(relatedFormId); - if (null != relatedForm) { - wo.getRelatedFormMap().put(relatedFormId, toWoFormDataOrMobileData(relatedForm)); - } - } - } else { - for (String mobileRelatedFormId : form.getProperties().getMobileRelatedFormList()) { - Form mobileRelatedForm = business.form().pick(mobileRelatedFormId); - if (null != mobileRelatedForm) { - wo.getRelatedFormMap().put(mobileRelatedFormId, toWoFormMobileDataOrData(mobileRelatedForm)); - } - } + private Wo get(String id) throws Exception { + Form form = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + form = business.form().pick(id); } - relatedScript(business, wo, form); - } - - protected void relatedScript(Business business, AbstractWo wo, Form form) throws Exception { - for (Entry entry : form.getProperties().getRelatedScriptMap().entrySet()) { - switch (entry.getValue()) { - case WorkCompletedProperties.Script.TYPE_PROCESSPLATFORM: - Script relatedScript = business.script().pick(entry.getKey()); - if (null != relatedScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedScript)); - } - break; - case WorkCompletedProperties.Script.TYPE_CMS: - com.x.cms.core.entity.element.Script relatedCmsScript = business.cms().script().pick(entry.getKey()); - if (null != relatedCmsScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedCmsScript)); + if (null == form) { + throw new ExceptionEntityNotExist(id, Form.class); + } + Wo wo = new Wo(); + final FormProperties properties = form.getProperties(); + wo.setFastETag(form.getId() + form.getUpdateTime().getTime()); + wo.setForm(new RelatedForm(form, form.getDataOrMobileData())); + CompletableFuture> _relatedForm = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if (ListTools.isNotEmpty(properties.getRelatedFormList())) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + Form _f; + for (String _id : properties.getRelatedFormList()) { + _f = bus.form().pick(_id); + if (null != _f) { + map.put(_id, new RelatedForm(_f, _f.getDataOrMobileData())); + } + } + } catch (Exception e) { + logger.error(e); } - break; - case WorkCompletedProperties.Script.TYPE_PORTAL: - com.x.portal.core.entity.Script relatedPortalScript = business.portal().script().pick(entry.getKey()); - if (null != relatedPortalScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedPortalScript)); + } + return map; + }); + CompletableFuture> _relatedScript = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if ((null != properties.getRelatedScriptMap()) && (properties.getRelatedScriptMap().size() > 0)) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + for (Entry entry : properties.getRelatedScriptMap().entrySet()) { + switch (entry.getValue()) { + case WorkCompletedProperties.RelatedScript.TYPE_PROCESSPLATFORM: + Script _pp = bus.script().pick(entry.getKey()); + if (null != _pp) { + map.put(entry.getKey(), new RelatedScript(_pp.getId(), _pp.getName(), _pp.getAlias(), + _pp.getText(), entry.getValue())); + } + break; + case WorkCompletedProperties.RelatedScript.TYPE_CMS: + com.x.cms.core.entity.element.Script _cms = bus.cms().script().pick(entry.getKey()); + if (null != _cms) { + map.put(entry.getKey(), new RelatedScript(_cms.getId(), _cms.getName(), _cms.getAlias(), + _cms.getText(), entry.getValue())); + } + break; + case WorkCompletedProperties.RelatedScript.TYPE_PORTAL: + com.x.portal.core.entity.Script _p = bus.portal().script().pick(entry.getKey()); + if (null != _p) { + map.put(entry.getKey(), new RelatedScript(_p.getId(), _p.getName(), _p.getAlias(), + _p.getText(), entry.getValue())); + } + break; + default: + break; + } + } + } catch (Exception e) { + logger.error(e); } - break; - default: - break; } - } + return map; + }); + wo.setRelatedFormMap(_relatedForm.get()); + wo.setRelatedScriptMap(_relatedScript.get()); + wo.setMaxAge(3600 * 24); + return wo; } public static class Wo extends AbstractWo { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2GetMobile.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2GetMobile.java index d7dc78400abc48e7a4a2f1055241dc543dd47e4d..86c31dc744f5c4e14edeee0198c8bb78ea3da5d0 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2GetMobile.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2GetMobile.java @@ -1,29 +1,27 @@ package com.x.processplatform.assemble.surface.jaxrs.form; -import java.util.Objects; +import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; +import java.util.TreeMap; +import java.util.concurrent.CompletableFuture; -import org.apache.commons.lang3.StringUtils; - -import com.google.gson.JsonElement; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.exception.ExceptionAccessDenied; +import com.x.base.core.project.cache.Cache.CacheKey; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.exception.ExceptionEntityNotExist; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Audit; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.PropertyTools; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.assemble.surface.jaxrs.form.ActionGetWithWorkOrWorkCompletedMobile.Wo; -import com.x.processplatform.assemble.surface.jaxrs.form.BaseAction.AbstractWo; -import com.x.processplatform.core.entity.content.Work; -import com.x.processplatform.core.entity.content.WorkCompleted; import com.x.processplatform.core.entity.content.WorkCompletedProperties; -import com.x.processplatform.core.entity.element.Activity; +import com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedForm; +import com.x.processplatform.core.entity.content.WorkCompletedProperties.RelatedScript; import com.x.processplatform.core.entity.element.Form; +import com.x.processplatform.core.entity.element.FormProperties; import com.x.processplatform.core.entity.element.Script; class V2GetMobile extends BaseAction { @@ -31,65 +29,93 @@ class V2GetMobile extends BaseAction { private static Logger logger = LoggerFactory.getLogger(V2GetMobile.class); ActionResult execute(EffectivePerson effectivePerson, String id) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - Form form = emc.find(id, Form.class); - if (Objects.isNull(form)) { - throw new ExceptionEntityNotExist(id, Form.class); - } - Wo wo = new Wo(); - wo.setForm(toWoFormMobileDataOrData(form)); - related(business, wo, form); + ActionResult result = new ActionResult<>(); + CacheKey cacheKey = new CacheKey(this.getClass(), id); + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + result.setData((Wo) optional.get()); + } else { + Wo wo = this.get(id); + CacheManager.put(cacheCategory, cacheKey, wo); result.setData(wo); - return result; } + return result; } - private void related(Business business, Wo wo, Form form) throws Exception { - if (StringUtils.isNotBlank(form.getMobileData())) { - for (String mobileRelatedFormId : form.getProperties().getMobileRelatedFormList()) { - Form relatedForm = business.form().pick(mobileRelatedFormId); - if (null != relatedForm) { - wo.getRelatedFormMap().put(mobileRelatedFormId, toWoFormMobileDataOrData(relatedForm)); - } - } - } else { - for (String relatedFormId : form.getProperties().getRelatedFormList()) { - Form relatedForm = business.form().pick(relatedFormId); - if (null != relatedForm) { - wo.getRelatedFormMap().put(relatedFormId, toWoFormDataOrMobileData(relatedForm)); - } - } + private Wo get(String id) throws Exception { + Form form = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + form = business.form().pick(id); } - relatedScript(business, wo, form); - } - - protected void relatedScript(Business business, AbstractWo wo, Form form) throws Exception { - for (Entry entry : form.getProperties().getMobileRelatedScriptMap().entrySet()) { - switch (entry.getValue()) { - case WorkCompletedProperties.Script.TYPE_PROCESSPLATFORM: - Script relatedScript = business.script().pick(entry.getKey()); - if (null != relatedScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedScript)); - } - break; - case WorkCompletedProperties.Script.TYPE_CMS: - com.x.cms.core.entity.element.Script relatedCmsScript = business.cms().script().pick(entry.getKey()); - if (null != relatedCmsScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedCmsScript)); + if (null == form) { + throw new ExceptionEntityNotExist(id, Form.class); + } + Wo wo = new Wo(); + final FormProperties properties = form.getProperties(); + wo.setFastETag(form.getId() + form.getUpdateTime().getTime()); + wo.setForm(new RelatedForm(form, form.getMobileDataOrData())); + CompletableFuture> _relatedForm = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if (ListTools.isNotEmpty(properties.getMobileRelatedFormList())) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + Form _f; + for (String _id : properties.getMobileRelatedFormList()) { + _f = bus.form().pick(_id); + if (null != _f) { + map.put(_id, new RelatedForm(_f, _f.getMobileDataOrData())); + } + } + } catch (Exception e) { + logger.error(e); } - break; - case WorkCompletedProperties.Script.TYPE_PORTAL: - com.x.portal.core.entity.Script relatedPortalScript = business.portal().script().pick(entry.getKey()); - if (null != relatedPortalScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedPortalScript)); + } + return map; + }); + CompletableFuture> _relatedScript = CompletableFuture.supplyAsync(() -> { + Map map = new TreeMap<>(); + if ((null != properties.getMobileRelatedScriptMap()) + && (properties.getMobileRelatedScriptMap().size() > 0)) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business bus = new Business(emc); + for (Entry entry : properties.getMobileRelatedScriptMap().entrySet()) { + switch (entry.getValue()) { + case WorkCompletedProperties.RelatedScript.TYPE_PROCESSPLATFORM: + Script _pp = bus.script().pick(entry.getKey()); + if (null != _pp) { + map.put(entry.getKey(), new RelatedScript(_pp.getId(), _pp.getName(), _pp.getAlias(), + _pp.getText(), entry.getValue())); + } + break; + case WorkCompletedProperties.RelatedScript.TYPE_CMS: + com.x.cms.core.entity.element.Script _cms = bus.cms().script().pick(entry.getKey()); + if (null != _cms) { + map.put(entry.getKey(), new RelatedScript(_cms.getId(), _cms.getName(), _cms.getAlias(), + _cms.getText(), entry.getValue())); + } + break; + case WorkCompletedProperties.RelatedScript.TYPE_PORTAL: + com.x.portal.core.entity.Script _p = bus.portal().script().pick(entry.getKey()); + if (null != _p) { + map.put(entry.getKey(), new RelatedScript(_p.getId(), _p.getName(), _p.getAlias(), + _p.getText(), entry.getValue())); + } + break; + default: + break; + } + } + } catch (Exception e) { + logger.error(e); } - break; - default: - break; } - } + return map; + }); + wo.setRelatedFormMap(_relatedForm.get()); + wo.setRelatedScriptMap(_relatedScript.get()); + wo.setMaxAge(3600 * 24); + return wo; } public static class Wo extends AbstractWo { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompleted.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompleted.java index e4ed45319e92fa4ad9826fe2d82f93623293d289..49cabd4cdc8ee6dc1f5bd1886e4a10dd879b6807 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompleted.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompleted.java @@ -1,22 +1,34 @@ package com.x.processplatform.assemble.surface.jaxrs.form; +import java.util.List; import java.util.Map.Entry; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.stream.Collectors; +import java.util.zip.CRC32; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.entity.JpaObject; +import com.x.base.core.project.cache.Cache.CacheKey; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.exception.ExceptionAccessDenied; import com.x.base.core.project.exception.ExceptionEntityNotExist; +import com.x.base.core.project.gson.XGsonBuilder; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.PropertyTools; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.core.entity.content.Work; import com.x.processplatform.core.entity.content.WorkCompleted; import com.x.processplatform.core.entity.content.WorkCompletedProperties; +import com.x.processplatform.core.entity.content.WorkCompletedProperties.StoreForm; import com.x.processplatform.core.entity.element.Activity; import com.x.processplatform.core.entity.element.Form; import com.x.processplatform.core.entity.element.Script; @@ -26,106 +38,181 @@ class V2LookupWorkOrWorkCompleted extends BaseAction { private static Logger logger = LoggerFactory.getLogger(V2LookupWorkOrWorkCompleted.class); ActionResult execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, - new ExceptionEntityNotExist(workOrWorkCompleted))) { - throw new ExceptionAccessDenied(effectivePerson); - } + + ActionResult result = new ActionResult<>(); + + CompletableFuture _wo = CompletableFuture.supplyAsync(() -> { Wo wo = new Wo(); - Work work = emc.find(workOrWorkCompleted, Work.class); - if (null != work) { - this.work(business, work, wo); - } else { - this.workCompleted(business, emc.flag(workOrWorkCompleted, WorkCompleted.class), wo); + try { + Work work = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + work = emc.fetch(workOrWorkCompleted, Work.class, ListTools.toList(JpaObject.id_FIELDNAME, + Work.form_FIELDNAME, Work.activity_FIELDNAME, Work.activityType_FIELDNAME)); + } + if (null != work) { + wo = this.work(work); + } else { + WorkCompleted workCompleted = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + workCompleted = emc.flag(workOrWorkCompleted, WorkCompleted.class); + } + if (null != workCompleted) { + wo = this.workCompleted(workCompleted); + } + } + } catch (Exception e) { + logger.error(e); } - result.setData(wo); - return result; - } - } + return wo; + }); - private void work(Business business, Work work, Wo wo) throws Exception { - String id = work.getForm(); - if (!StringUtils.isEmpty(id)) { - wo.setId(id); - } else { - Activity activity = business.getActivity(work); - id = PropertyTools.getOrElse(activity, Activity.form_FIELDNAME, String.class, ""); + CompletableFuture _control = CompletableFuture.supplyAsync(() -> { + Boolean value = false; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + value = business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, + new ExceptionEntityNotExist(workOrWorkCompleted)); + } catch (Exception e) { + logger.error(e); + } + return value; + }); + + if (BooleanUtils.isFalse(_control.get())) { + throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted); } - wo.setId(id); + result.setData(_wo.get()); + return result; } - private void workCompleted(Business business, WorkCompleted workCompleted, Wo wo) throws Exception { - // 先使用当前库的表单,如果不存在使用储存的表单. - if (StringUtils.isNotEmpty(workCompleted.getForm())) { - Form form = business.form().pick(workCompleted.getForm()); - if (null != form) { - wo.setForm(toWoFormDataOrMobileData(form)); - related(business, wo, form); - } - } else if (null != workCompleted.getProperties().getForm()) { - wo.setForm(toWoFormDataOrMobileData(workCompleted.getProperties().getForm())); - if (StringUtils.isNotBlank(workCompleted.getProperties().getForm().getData())) { - workCompleted.getProperties().getRelatedFormList() - .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormDataOrMobileData(o))); - } else { - workCompleted.getProperties().getMobileRelatedFormList() - .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormMobileDataOrData(o))); + private Wo work(Work work) throws Exception { + Form form = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + form = business.form().pick(work.getForm()); + if (null == form) { + Activity activity = business.getActivity(work); + if (null != activity) { + form = business.form().pick(activity.getForm()); + } } } - workCompleted.getProperties().getRelatedScriptList().stream() - .forEach(o -> wo.getRelatedScriptMap().put(o.getId(), toWoScript(o))); + if (null != form) { + return this.get(form); + } + return new Wo(); } - private void related(Business business, Wo wo, Form form) throws Exception { - if (StringUtils.isNotBlank(form.getData())) { - for (String relatedFormId : form.getProperties().getRelatedFormList()) { - Form relatedForm = business.form().pick(relatedFormId); - if (null != relatedForm) { - wo.getRelatedFormMap().put(relatedFormId, toWoFormDataOrMobileData(relatedForm)); - } - } + private Wo get(Form form) throws Exception { + CacheKey cacheKey = new CacheKey(this.getClass(), form.getId()); + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + return (Wo) optional.get(); } else { - for (String mobileRelatedFormId : form.getProperties().getMobileRelatedFormList()) { - Form mobileRelatedForm = business.form().pick(mobileRelatedFormId); - if (null != mobileRelatedForm) { - wo.getRelatedFormMap().put(mobileRelatedFormId, toWoFormMobileDataOrData(mobileRelatedForm)); + final List list = new CopyOnWriteArrayList<>(); + CompletableFuture _relatedForm = CompletableFuture.runAsync(() -> { + if (ListTools.isNotEmpty(form.getProperties().getRelatedFormList())) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + Form _f; + for (String _id : form.getProperties().getRelatedFormList()) { + _f = business.form().pick(_id); + if (null != _f) { + list.add(_f.getId() + _f.getUpdateTime().getTime()); + } + } + } catch (Exception e) { + logger.error(e); + } } - } + }); + CompletableFuture _relatedScript = CompletableFuture.runAsync(() -> { + if ((null != form.getProperties().getRelatedScriptMap()) + && (form.getProperties().getRelatedScriptMap().size() > 0)) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + for (Entry entry : form.getProperties().getRelatedScriptMap().entrySet()) { + switch (entry.getValue()) { + case WorkCompletedProperties.RelatedScript.TYPE_PROCESSPLATFORM: + Script _pp = business.script().pick(entry.getKey()); + if (null != _pp) { + list.add(_pp.getId() + _pp.getUpdateTime().getTime()); + } + break; + case WorkCompletedProperties.RelatedScript.TYPE_CMS: + com.x.cms.core.entity.element.Script _cms = business.cms().script() + .pick(entry.getKey()); + if (null != _cms) { + list.add(_cms.getId() + _cms.getUpdateTime().getTime()); + } + break; + case WorkCompletedProperties.RelatedScript.TYPE_PORTAL: + com.x.portal.core.entity.Script _p = business.portal().script().pick(entry.getKey()); + if (null != _p) { + list.add(_p.getId() + _p.getUpdateTime().getTime()); + } + break; + default: + break; + } + } + } catch (Exception e) { + logger.error(e); + } + } + }); + _relatedForm.get(); + _relatedScript.get(); + list.add(form.getId() + form.getUpdateTime().getTime()); + List sortList = list.stream().sorted().collect(Collectors.toList()); + Wo wo = new Wo(); + wo.setId(form.getId()); + CRC32 crc = new CRC32(); + crc.update(StringUtils.join(sortList, "#").getBytes()); + wo.setCacheTag(crc.getValue() + ""); + return wo; } - relatedScript(business, wo, form); } - protected void relatedScript(Business business, AbstractWo wo, Form form) throws Exception { - for (Entry entry : form.getProperties().getRelatedScriptMap().entrySet()) { - switch (entry.getValue()) { - case WorkCompletedProperties.Script.TYPE_PROCESSPLATFORM: - Script relatedScript = business.script().pick(entry.getKey()); - if (null != relatedScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedScript)); - } - break; - case WorkCompletedProperties.Script.TYPE_CMS: - com.x.cms.core.entity.element.Script relatedCmsScript = business.cms().script().pick(entry.getKey()); - if (null != relatedCmsScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedCmsScript)); - } - break; - case WorkCompletedProperties.Script.TYPE_PORTAL: - com.x.portal.core.entity.Script relatedPortalScript = business.portal().script().pick(entry.getKey()); - if (null != relatedPortalScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedPortalScript)); - } - break; - default: - break; - } + private Wo workCompleted(WorkCompleted workCompleted) throws Exception { + // 先使用当前库的表单,如果不存在使用储存的表单. + Wo wo = new Wo(); + Form form = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + form = business.form().pick(workCompleted.getForm()); + } + if (null != form) { + return this.get(form); + } else if (null != workCompleted.getProperties().getStoreForm()) { + StoreForm storeForm = workCompleted.getProperties().getStoreForm(); + wo = XGsonBuilder.convert(storeForm, Wo.class); } + return wo; } public static class Wo extends AbstractWo { + private String id; + + private String cacheTag; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCacheTag() { + return cacheTag; + } + + public void setCacheTag(String cacheTag) { + this.cacheTag = cacheTag; + } + } } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompletedMobile.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompletedMobile.java index de34830b76f3d459e4b5dbc0516de68cf0ccd8c0..bb7bffb74628ac876390008f28ec99f3a5db2b27 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompletedMobile.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompletedMobile.java @@ -1,24 +1,34 @@ package com.x.processplatform.assemble.surface.jaxrs.form; +import java.util.List; import java.util.Map.Entry; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.stream.Collectors; +import java.util.zip.CRC32; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.entity.JpaObject; +import com.x.base.core.project.cache.Cache.CacheKey; +import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.exception.ExceptionAccessDenied; import com.x.base.core.project.exception.ExceptionEntityNotExist; +import com.x.base.core.project.gson.XGsonBuilder; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.PropertyTools; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.assemble.surface.jaxrs.form.ActionGetWithWorkOrWorkCompletedMobile.Wo; -import com.x.processplatform.assemble.surface.jaxrs.form.BaseAction.AbstractWo; import com.x.processplatform.core.entity.content.Work; import com.x.processplatform.core.entity.content.WorkCompleted; import com.x.processplatform.core.entity.content.WorkCompletedProperties; +import com.x.processplatform.core.entity.content.WorkCompletedProperties.StoreForm; import com.x.processplatform.core.entity.element.Activity; import com.x.processplatform.core.entity.element.Form; import com.x.processplatform.core.entity.element.Script; @@ -28,106 +38,182 @@ class V2LookupWorkOrWorkCompletedMobile extends BaseAction { private static Logger logger = LoggerFactory.getLogger(V2LookupWorkOrWorkCompletedMobile.class); ActionResult execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, - new ExceptionEntityNotExist(workOrWorkCompleted))) { - throw new ExceptionAccessDenied(effectivePerson); - } + + ActionResult result = new ActionResult<>(); + + CompletableFuture _wo = CompletableFuture.supplyAsync(() -> { Wo wo = new Wo(); - Work work = emc.find(workOrWorkCompleted, Work.class); - if (null != work) { - this.work(business, work, wo); - } else { - this.workCompleted(business, emc.flag(workOrWorkCompleted, WorkCompleted.class), wo); + try { + Work work = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + work = emc.fetch(workOrWorkCompleted, Work.class, ListTools.toList(JpaObject.id_FIELDNAME, + Work.form_FIELDNAME, Work.activity_FIELDNAME, Work.activityType_FIELDNAME)); + } + if (null != work) { + wo = this.work(work); + } else { + WorkCompleted workCompleted = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + workCompleted = emc.flag(workOrWorkCompleted, WorkCompleted.class); + } + if (null != workCompleted) { + wo = this.workCompleted(workCompleted); + } + } + } catch (Exception e) { + logger.error(e); } - result.setData(wo); - return result; - } - } + return wo; + }); - private void work(Business business, Work work, Wo wo) throws Exception { - String id = work.getForm(); - if (!StringUtils.isEmpty(id)) { - wo.setId(id); - } else { - Activity activity = business.getActivity(work); - id = PropertyTools.getOrElse(activity, Activity.form_FIELDNAME, String.class, ""); + CompletableFuture _control = CompletableFuture.supplyAsync(() -> { + Boolean value = false; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + value = business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, + new ExceptionEntityNotExist(workOrWorkCompleted)); + } catch (Exception e) { + logger.error(e); + } + return value; + }); + + if (BooleanUtils.isFalse(_control.get())) { + throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted); } - wo.setId(id); + result.setData(_wo.get()); + return result; } - private void workCompleted(Business business, WorkCompleted workCompleted, Wo wo) throws Exception { - // 先使用当前库的表单,如果不存在使用储存的表单. - if (StringUtils.isNotEmpty(workCompleted.getForm())) { - Form form = business.form().pick(workCompleted.getForm()); - if (null != form) { - wo.setForm(toWoFormDataOrMobileData(form)); - related(business, wo, form); - } - } else if (null != workCompleted.getProperties().getForm()) { - wo.setForm(toWoFormDataOrMobileData(workCompleted.getProperties().getForm())); - if (StringUtils.isNotBlank(workCompleted.getProperties().getForm().getData())) { - workCompleted.getProperties().getRelatedFormList() - .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormDataOrMobileData(o))); - } else { - workCompleted.getProperties().getMobileRelatedFormList() - .forEach(o -> wo.getRelatedFormMap().put(o.getId(), toWoFormMobileDataOrData(o))); + private Wo work(Work work) throws Exception { + Form form = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + form = business.form().pick(work.getForm()); + if (null == form) { + Activity activity = business.getActivity(work); + if (null != activity) { + form = business.form().pick(activity.getForm()); + } } } - workCompleted.getProperties().getRelatedScriptList().stream() - .forEach(o -> wo.getRelatedScriptMap().put(o.getId(), toWoScript(o))); + if (null != form) { + return this.get(form); + } + return new Wo(); } - private void related(Business business, Wo wo, Form form) throws Exception { - if (StringUtils.isNotBlank(form.getMobileData())) { - for (String mobileRelatedFormId : form.getProperties().getMobileRelatedFormList()) { - Form relatedForm = business.form().pick(mobileRelatedFormId); - if (null != relatedForm) { - wo.getRelatedFormMap().put(mobileRelatedFormId, toWoFormMobileDataOrData(relatedForm)); - } - } + private Wo get(Form form) throws Exception { + CacheKey cacheKey = new CacheKey(this.getClass(), form.getId()); + Optional optional = CacheManager.get(cacheCategory, cacheKey); + if (optional.isPresent()) { + return (Wo) optional.get(); } else { - for (String relatedFormId : form.getProperties().getRelatedFormList()) { - Form relatedForm = business.form().pick(relatedFormId); - if (null != relatedForm) { - wo.getRelatedFormMap().put(relatedFormId, toWoFormDataOrMobileData(relatedForm)); + final List list = new CopyOnWriteArrayList<>(); + CompletableFuture _relatedForm = CompletableFuture.runAsync(() -> { + if (ListTools.isNotEmpty(form.getProperties().getMobileRelatedFormList())) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + Form _f; + for (String _id : form.getProperties().getMobileRelatedFormList()) { + _f = business.form().pick(_id); + if (null != _f) { + list.add(_f.getId() + _f.getUpdateTime().getTime()); + } + } + } catch (Exception e) { + logger.error(e); + } } - } + }); + CompletableFuture _relatedScript = CompletableFuture.runAsync(() -> { + if ((null != form.getProperties().getMobileRelatedScriptMap()) + && (form.getProperties().getMobileRelatedScriptMap().size() > 0)) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + for (Entry entry : form.getProperties().getMobileRelatedScriptMap() + .entrySet()) { + switch (entry.getValue()) { + case WorkCompletedProperties.RelatedScript.TYPE_PROCESSPLATFORM: + Script _pp = business.script().pick(entry.getKey()); + if (null != _pp) { + list.add(_pp.getId() + _pp.getUpdateTime().getTime()); + } + break; + case WorkCompletedProperties.RelatedScript.TYPE_CMS: + com.x.cms.core.entity.element.Script _cms = business.cms().script() + .pick(entry.getKey()); + if (null != _cms) { + list.add(_cms.getId() + _cms.getUpdateTime().getTime()); + } + break; + case WorkCompletedProperties.RelatedScript.TYPE_PORTAL: + com.x.portal.core.entity.Script _p = business.portal().script().pick(entry.getKey()); + if (null != _p) { + list.add(_p.getId() + _p.getUpdateTime().getTime()); + } + break; + default: + break; + } + } + } catch (Exception e) { + logger.error(e); + } + } + }); + _relatedForm.get(); + _relatedScript.get(); + list.add(form.getId() + form.getUpdateTime().getTime()); + List sortList = list.stream().sorted().collect(Collectors.toList()); + Wo wo = new Wo(); + wo.setId(form.getId()); + CRC32 crc = new CRC32(); + crc.update(StringUtils.join(sortList, "#").getBytes()); + wo.setCacheTag(crc.getValue() + ""); + return wo; } - relatedScript(business, wo, form); } - protected void relatedScript(Business business, AbstractWo wo, Form form) throws Exception { - for (Entry entry : form.getProperties().getMobileRelatedScriptMap().entrySet()) { - switch (entry.getValue()) { - case WorkCompletedProperties.Script.TYPE_PROCESSPLATFORM: - Script relatedScript = business.script().pick(entry.getKey()); - if (null != relatedScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedScript)); - } - break; - case WorkCompletedProperties.Script.TYPE_CMS: - com.x.cms.core.entity.element.Script relatedCmsScript = business.cms().script().pick(entry.getKey()); - if (null != relatedCmsScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedCmsScript)); - } - break; - case WorkCompletedProperties.Script.TYPE_PORTAL: - com.x.portal.core.entity.Script relatedPortalScript = business.portal().script().pick(entry.getKey()); - if (null != relatedPortalScript) { - wo.getRelatedScriptMap().put(entry.getKey(), toWoScript(relatedPortalScript)); - } - break; - default: - break; - } + private Wo workCompleted(WorkCompleted workCompleted) throws Exception { + // 先使用当前库的表单,如果不存在使用储存的表单. + Wo wo = new Wo(); + Form form = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + form = business.form().pick(workCompleted.getForm()); + } + if (null != form) { + return this.get(form); + } else if (null != workCompleted.getProperties().getStoreFormMobile()) { + StoreForm storeForm = workCompleted.getProperties().getStoreFormMobile(); + wo = XGsonBuilder.convert(storeForm, Wo.class); } + return wo; } public static class Wo extends AbstractWo { + private String id; + + private String cacheTag; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCacheTag() { + return cacheTag; + } + + public void setCacheTag(String cacheTag) { + this.cacheTag = cacheTag; + } + } } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/keylock/KeyLockAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/keylock/KeyLockAction.java index e63bcea1a0555d401d8af052322cc0b80b33246b..3dc3a499846307d45e3b2c5fa2c1a39064ef5fcf 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/keylock/KeyLockAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/keylock/KeyLockAction.java @@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.keylock; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; +import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -44,4 +45,22 @@ public class KeyLockAction extends BaseAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionLock.class) + @POST + @Path("lock/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void lockMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionLock().execute(effectivePerson, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/process/ActionGet.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/process/ActionGet.java index 29bf1ef6f7c51420218561f1d12a885254f9ba5a..919a9197e622f91035e5ce7cc10d3c18e4436993 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/process/ActionGet.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/process/ActionGet.java @@ -1,7 +1,5 @@ package com.x.processplatform.assemble.surface.jaxrs.process; -import java.util.List; - import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.JpaObject; @@ -11,22 +9,7 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.element.Agent; -import com.x.processplatform.core.entity.element.Begin; -import com.x.processplatform.core.entity.element.Cancel; -import com.x.processplatform.core.entity.element.Choice; -import com.x.processplatform.core.entity.element.Delay; -import com.x.processplatform.core.entity.element.Embed; -import com.x.processplatform.core.entity.element.End; -import com.x.processplatform.core.entity.element.Invoke; -import com.x.processplatform.core.entity.element.Manual; -import com.x.processplatform.core.entity.element.Merge; -import com.x.processplatform.core.entity.element.Message; -import com.x.processplatform.core.entity.element.Parallel; import com.x.processplatform.core.entity.element.Process; -import com.x.processplatform.core.entity.element.Route; -import com.x.processplatform.core.entity.element.Service; -import com.x.processplatform.core.entity.element.Split; class ActionGet extends BaseAction { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/read/ActionCreateWithWork.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/read/ActionCreateWithWork.java index 8fab25ba734305cb71322d0ee4bd4b56be964694..035d2ed4c47debd5d83ad3a65da5b9b34add5de7 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/read/ActionCreateWithWork.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/read/ActionCreateWithWork.java @@ -1,12 +1,12 @@ package com.x.processplatform.assemble.surface.jaxrs.read; -import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import com.google.gson.JsonElement; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.project.Applications; import com.x.base.core.project.x_processplatform_service_processing; import com.x.base.core.project.annotation.FieldDescribe; import com.x.base.core.project.exception.ExceptionAccessDenied; @@ -15,7 +15,6 @@ import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.WoId; -import com.x.base.core.project.tools.DefaultCharset; import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.assemble.surface.ThisApplication; @@ -49,7 +48,7 @@ class ActionCreateWithWork extends BaseAction { List wos = ThisApplication.context().applications() .postQuery(effectivePerson.getDebugger(), x_processplatform_service_processing.class, - "read/work/" + URLEncoder.encode(work.getId(), DefaultCharset.name), wi, work.getJob()) + Applications.joinQueryUri("read", "work", work.getId()), wi, work.getJob()) .getDataAsList(Wo.class); result.setData(wos); return result; diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/read/ReadAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/read/ReadAction.java index 481232f8154b8f1b13f08b8939957a784342158a..f9caae66944c2c3a373d1a5e6efde11593c7b699 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/read/ReadAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/read/ReadAction.java @@ -317,6 +317,24 @@ public class ReadAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionEdit.class) + @POST + @Path("{id}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void editMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("待阅标识") @PathParam("id") String id, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionEdit().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "获取制定人员的待阅数量,没有权限限制.", action = ActionCountWithPerson.class) @GET @Path("count/{credential}") @@ -462,6 +480,24 @@ public class ReadAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "管理删除待阅.", action = ActionManageDelete.class) + @GET + @Path("{id}/manage/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageDeleteMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("待阅标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageDelete().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "管理待阅转已阅.", action = ActionManageProcessing.class) @PUT @Path("{id}/processing/manage") @@ -480,7 +516,26 @@ public class ReadAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @JaxrsMethodDescribe(value = "重置待阅,将之前的待办转为已办,opinion:办理意见,,identityList:新的待阅人.", action = ActionManageReset.class) + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionManageProcessing.class) + @POST + @Path("{id}/processing/manage/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageProcessingMockPostToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("待阅标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageProcessing().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "重置待阅,将之前的待办转为已办,opinion:办理意见,identityList:新的待阅人.", action = ActionManageReset.class) @PUT @Path("{id}/reset/manage") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @@ -498,6 +553,25 @@ public class ReadAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionManageReset.class) + @POST + @Path("{id}/reset/manage/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageReadMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("待阅标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageReset().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "管理修改意见.", action = ActionManageOpinion.class) @PUT @Path("{id}/opinion/manage") @@ -516,6 +590,25 @@ public class ReadAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionManageOpinion.class) + @POST + @Path("{id}/opinion/manage/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageOpinionMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("待阅标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageOpinion().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "列示当前用户的待阅,分页.", action = ActionListMyPaging.class) @GET @Path("list/my/paging/{page}/size/{size}") @@ -728,8 +821,8 @@ public class ReadAction extends StandardJaxrsAction { @Path("list/person/{person}/manage") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void manageListWithPerson(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, @JaxrsParameterDescribe("用户") @PathParam("person") String person) { + public void manageListWithPerson(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("用户") @PathParam("person") String person) { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { @@ -746,8 +839,8 @@ public class ReadAction extends StandardJaxrsAction { @Path("list/date/{date}/manage") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void manageListWithDate(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, @JaxrsParameterDescribe("日期(如:2020-09-11)") @PathParam("date") String date) { + public void manageListWithDate(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("日期(如:2020-09-11)") @PathParam("date") String date) { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/ReadCompletedAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/ReadCompletedAction.java index 2cb9f4078f1dc720a83ec7919b908e33cf283a10..f5a9fdf6ed697df7b431ebbc57a5cba9a7c6fda6 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/ReadCompletedAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/ReadCompletedAction.java @@ -389,6 +389,24 @@ public class ReadCompletedAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete", action = ActionManageDelete.class) + @GET + @Path("{id}/manage/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageDeleteMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("已阅标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageDelete().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "管理修改意见.", action = ActionManageOpinion.class) @PUT @Path("{id}/opinion/manage") @@ -407,6 +425,25 @@ public class ReadCompletedAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionManageOpinion.class) + @POST + @Path("{id}/opinion/manage/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageDeleteMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("已阅标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageOpinion().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "列示当前用户的已阅,分页.", action = ActionListMyPaging.class) @GET @Path("list/my/paging/{page}/size/{size}") @@ -619,8 +656,8 @@ public class ReadCompletedAction extends StandardJaxrsAction { @Path("list/date/{date}/manage") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void manageListWithDate(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, @JaxrsParameterDescribe("日期(如:2020-09-11)") @PathParam("date") String date) { + public void manageListWithDate(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("日期(如:2020-09-11)") @PathParam("date") String date) { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2Count.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2Count.java index eaa8f0a338e77c0462facea0fbd806f3832860e3..7ba461154b88a82031fb71a22b17778f226830ee 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2Count.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2Count.java @@ -25,8 +25,8 @@ import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.Task; -import com.x.processplatform.core.entity.content.Task_; +import com.x.processplatform.core.entity.content.ReadCompleted; +import com.x.processplatform.core.entity.content.ReadCompleted_; class V2Count extends V2Base { @@ -59,16 +59,16 @@ class V2Count extends V2Base { } private Long count(Business business, Predicate predicate) throws Exception { - return business.entityManagerContainer().count(Task.class, predicate); + return business.entityManagerContainer().count(ReadCompleted.class, predicate); } private List groupByApplication(Business business, Predicate predicate) throws Exception { - EntityManager em = business.entityManagerContainer().get(Task.class); + EntityManager em = business.entityManagerContainer().get(ReadCompleted.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(Tuple.class); - Root root = cq.from(Task.class); - Path pathApplication = root.get(Task_.application); - Path pathApplicationName = root.get(Task_.applicationName); + Root root = cq.from(ReadCompleted.class); + Path pathApplication = root.get(ReadCompleted_.application); + Path pathApplicationName = root.get(ReadCompleted_.applicationName); cq.multiselect(pathApplication, pathApplicationName, cb.count(root)).where(predicate).groupBy(pathApplication); List os = em.createQuery(cq).getResultList(); List list = new ArrayList<>(); @@ -85,12 +85,12 @@ class V2Count extends V2Base { } private List groupByProcess(Business business, Predicate predicate) throws Exception { - EntityManager em = business.entityManagerContainer().get(Task.class); + EntityManager em = business.entityManagerContainer().get(ReadCompleted.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(Tuple.class); - Root root = cq.from(Task.class); - Path pathProcess = root.get(Task_.process); - Path pathProcessName = root.get(Task_.processName); + Root root = cq.from(ReadCompleted.class); + Path pathProcess = root.get(ReadCompleted_.process); + Path pathProcessName = root.get(ReadCompleted_.processName); cq.multiselect(pathProcess, pathProcessName, cb.count(root)).where(predicate).groupBy(pathProcess); List os = em.createQuery(cq).getResultList(); List list = new ArrayList<>(); @@ -107,11 +107,11 @@ class V2Count extends V2Base { } private List groupByCreatorPerson(Business business, Predicate predicate) throws Exception { - EntityManager em = business.entityManagerContainer().get(Task.class); + EntityManager em = business.entityManagerContainer().get(ReadCompleted.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(Tuple.class); - Root root = cq.from(Task.class); - Path pathCreatorPerson = root.get(Task_.creatorPerson); + Root root = cq.from(ReadCompleted.class); + Path pathCreatorPerson = root.get(ReadCompleted_.creatorPerson); cq.multiselect(pathCreatorPerson, cb.count(root)).where(predicate).groupBy(pathCreatorPerson); List os = em.createQuery(cq).getResultList(); List list = new ArrayList<>(); @@ -128,11 +128,11 @@ class V2Count extends V2Base { } private List groupByCreatorUnit(Business business, Predicate predicate) throws Exception { - EntityManager em = business.entityManagerContainer().get(Task.class); + EntityManager em = business.entityManagerContainer().get(ReadCompleted.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(Tuple.class); - Root root = cq.from(Task.class); - Path pathCreatorUnit = root.get(Task_.creatorUnit); + Root root = cq.from(ReadCompleted.class); + Path pathCreatorUnit = root.get(ReadCompleted_.creatorUnit); cq.multiselect(pathCreatorUnit, cb.count(root)).where(predicate).groupBy(pathCreatorUnit); List os = em.createQuery(cq).getResultList(); List list = new ArrayList<>(); @@ -149,11 +149,11 @@ class V2Count extends V2Base { } private List groupByStartTimeMonth(Business business, Predicate predicate) throws Exception { - EntityManager em = business.entityManagerContainer().get(Task.class); + EntityManager em = business.entityManagerContainer().get(ReadCompleted.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(Tuple.class); - Root root = cq.from(Task.class); - Path pathStartTimeMonth = root.get(Task_.startTimeMonth); + Root root = cq.from(ReadCompleted.class); + Path pathStartTimeMonth = root.get(ReadCompleted_.startTimeMonth); cq.multiselect(pathStartTimeMonth, cb.count(root)).where(predicate).groupBy(pathStartTimeMonth); List os = em.createQuery(cq).getResultList(); List list = new ArrayList<>(); diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2List.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2List.java index 76bdbb6278a5150bd2cb86a59b86b7bf78b6c05b..b98845ab33df47d3069f55d4673e47979624a54f 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2List.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2List.java @@ -21,8 +21,8 @@ import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.Read; -import com.x.processplatform.core.entity.content.Read_; +import com.x.processplatform.core.entity.content.ReadCompleted; +import com.x.processplatform.core.entity.content.ReadCompleted_; class V2List extends V2Base { @@ -33,18 +33,18 @@ class V2List extends V2Base { if ((!wi.isEmptyFilter()) || ListTools.isNotEmpty(wi.getJobList()) || ListTools.isNotEmpty(wi.getIdList())) { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { Business business = new Business(emc); - EntityManager em = emc.get(Read.class); + EntityManager em = emc.get(ReadCompleted.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(Tuple.class); - Root root = cq.from(Read.class); + Root root = cq.from(ReadCompleted.class); Predicate p = this.toFilterPredicate(effectivePerson, business, wi); if (ListTools.isNotEmpty(wi.getJobList())) { - p = cb.and(p, root.get(Read_.job).in(wi.getJobList())); + p = cb.and(p, root.get(ReadCompleted_.job).in(wi.getJobList())); } if (ListTools.isNotEmpty(wi.getIdList())) { - p = cb.and(p, root.get(Read_.id).in(wi.getIdList())); + p = cb.and(p, root.get(ReadCompleted_.id).in(wi.getIdList())); } - wos = emc.fetch(Read.class, Wo.copier, p); + wos = emc.fetch(ReadCompleted.class, Wo.copier, p); this.relate(business, wos, wi); } } @@ -80,7 +80,7 @@ class V2List extends V2Base { public static class Wo extends AbstractWo { private static final long serialVersionUID = -4773789253221941109L; - static WrapCopier copier = WrapCopierFactory.wo(Read.class, Wo.class, - JpaObject.singularAttributeField(Read.class, true, false), JpaObject.FieldsInvisible); + static WrapCopier copier = WrapCopierFactory.wo(ReadCompleted.class, Wo.class, + JpaObject.singularAttributeField(ReadCompleted.class, true, false), JpaObject.FieldsInvisible); } } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListCreateNext.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListCreateNext.java index 60ea3f7797dfd31a022dc76dd7539b33cfca6050..fa2bed97fa8d6b0ff139e79e246982af6beead79 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListCreateNext.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListCreateNext.java @@ -18,8 +18,8 @@ import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.Read; -import com.x.processplatform.core.entity.content.Read_; +import com.x.processplatform.core.entity.content.ReadCompleted; +import com.x.processplatform.core.entity.content.ReadCompleted_; class V2ListCreateNext extends V2Base { @@ -28,11 +28,11 @@ class V2ListCreateNext extends V2Base { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { Wi wi = this.convertToWrapIn(jsonElement, Wi.class); Business business = new Business(emc); - EntityManager em = emc.get(Read.class); + EntityManager em = emc.get(ReadCompleted.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(Tuple.class); - Root root = cq.from(Read.class); - Predicate p = cb.equal(root.get(Read_.creatorPerson), effectivePerson.getDistinguishedName()); + Root root = cq.from(ReadCompleted.class); + Predicate p = cb.equal(root.get(ReadCompleted_.creatorPerson), effectivePerson.getDistinguishedName()); p = cb.and(p, this.toFilterPredicate(effectivePerson, business, wi)); ActionResult> result = this.standardListNext(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, p); @@ -47,7 +47,7 @@ class V2ListCreateNext extends V2Base { public static class Wo extends AbstractWo { private static final long serialVersionUID = -4773789253221941109L; - static WrapCopier copier = WrapCopierFactory.wo(Read.class, Wo.class, - JpaObject.singularAttributeField(Read.class, true, false), JpaObject.FieldsInvisible); + static WrapCopier copier = WrapCopierFactory.wo(ReadCompleted.class, Wo.class, + JpaObject.singularAttributeField(ReadCompleted.class, true, false), JpaObject.FieldsInvisible); } } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListCreatePrev.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListCreatePrev.java index 4ddd7ad144ece55d398ad5a0fb8fee7acef7a2e6..26a35c792f6879f01a7f4cfa76f289555b6be6cc 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListCreatePrev.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListCreatePrev.java @@ -18,8 +18,8 @@ import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.Read; -import com.x.processplatform.core.entity.content.Read_; +import com.x.processplatform.core.entity.content.ReadCompleted; +import com.x.processplatform.core.entity.content.ReadCompleted_; class V2ListCreatePrev extends V2Base { @@ -28,11 +28,11 @@ class V2ListCreatePrev extends V2Base { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { Wi wi = this.convertToWrapIn(jsonElement, Wi.class); Business business = new Business(emc); - EntityManager em = emc.get(Read.class); + EntityManager em = emc.get(ReadCompleted.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(Tuple.class); - Root root = cq.from(Read.class); - Predicate p = cb.equal(root.get(Read_.creatorPerson), effectivePerson.getDistinguishedName()); + Root root = cq.from(ReadCompleted.class); + Predicate p = cb.equal(root.get(ReadCompleted_.creatorPerson), effectivePerson.getDistinguishedName()); p = cb.and(p, this.toFilterPredicate(effectivePerson, business, wi)); ActionResult> result = this.standardListPrev(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, p); @@ -47,7 +47,7 @@ class V2ListCreatePrev extends V2Base { public static class Wo extends AbstractWo { private static final long serialVersionUID = -4773789253221941109L; - static WrapCopier copier = WrapCopierFactory.wo(Read.class, Wo.class, - JpaObject.singularAttributeField(Read.class, true, false), JpaObject.FieldsInvisible); + static WrapCopier copier = WrapCopierFactory.wo(ReadCompleted.class, Wo.class, + JpaObject.singularAttributeField(ReadCompleted.class, true, false), JpaObject.FieldsInvisible); } } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListNext.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListNext.java index fb7dbcfcfce15a032a49999201544c95705ca25d..dec4b15fb2b7a0e10c395109497af1f5c380f687 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListNext.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListNext.java @@ -13,7 +13,7 @@ import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.Read; +import com.x.processplatform.core.entity.content.ReadCompleted; class V2ListNext extends V2Base { @@ -36,7 +36,7 @@ class V2ListNext extends V2Base { public static class Wo extends AbstractWo { private static final long serialVersionUID = -4773789253221941109L; - static WrapCopier copier = WrapCopierFactory.wo(Read.class, Wo.class, - JpaObject.singularAttributeField(Read.class, true, false), JpaObject.FieldsInvisible); + static WrapCopier copier = WrapCopierFactory.wo(ReadCompleted.class, Wo.class, + JpaObject.singularAttributeField(ReadCompleted.class, true, false), JpaObject.FieldsInvisible); } } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListPaging.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListPaging.java index e84f29daad20ec5ffcf9514f62c096acea7d3f08..c9f193af99dfda98739dd9089ca6dbded071c97d 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListPaging.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListPaging.java @@ -13,7 +13,7 @@ import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.Read; +import com.x.processplatform.core.entity.content.ReadCompleted; class V2ListPaging extends V2Base { @@ -24,9 +24,9 @@ class V2ListPaging extends V2Base { ActionResult> result = new ActionResult<>(); Wi wi = this.convertToWrapIn(jsonElement, Wi.class); Predicate p = this.toFilterPredicate(effectivePerson, business, wi); - List wos = emc.fetchDescPaging(Read.class, Wo.copier, p, page, size, Read.sequence_FIELDNAME); + List wos = emc.fetchDescPaging(ReadCompleted.class, Wo.copier, p, page, size, ReadCompleted.sequence_FIELDNAME); result.setData(wos); - result.setCount(emc.count(Read.class, p)); + result.setCount(emc.count(ReadCompleted.class, p)); this.relate(business, result.getData(), wi); return result; } @@ -38,7 +38,7 @@ class V2ListPaging extends V2Base { public static class Wo extends AbstractWo { private static final long serialVersionUID = -4773789253221941109L; - static WrapCopier copier = WrapCopierFactory.wo(Read.class, Wo.class, - JpaObject.singularAttributeField(Read.class, true, false), JpaObject.FieldsInvisible); + static WrapCopier copier = WrapCopierFactory.wo(ReadCompleted.class, Wo.class, + JpaObject.singularAttributeField(ReadCompleted.class, true, false), JpaObject.FieldsInvisible); } } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListPrev.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListPrev.java index 73c7e7e1afa0ec1850f071d3f39c74a4b890bceb..d020d3a2c0333d5888001ee534111e1c9b305e4d 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListPrev.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/readcompleted/V2ListPrev.java @@ -13,7 +13,7 @@ import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.Read; +import com.x.processplatform.core.entity.content.ReadCompleted; class V2ListPrev extends V2Base { @@ -36,7 +36,7 @@ class V2ListPrev extends V2Base { public static class Wo extends AbstractWo { private static final long serialVersionUID = -4773789253221941109L; - static WrapCopier copier = WrapCopierFactory.wo(Read.class, Wo.class, - JpaObject.singularAttributeField(Read.class, true, false), JpaObject.FieldsInvisible); + static WrapCopier copier = WrapCopierFactory.wo(ReadCompleted.class, Wo.class, + JpaObject.singularAttributeField(ReadCompleted.class, true, false), JpaObject.FieldsInvisible); } } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompleted.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompleted.java index 9a7d2eefd3b2f935c7d47a2da12929427d8f035c..9aa11fcd20bb212adfeaab5e1df8bfc4f7f1cc30 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompleted.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompleted.java @@ -3,8 +3,11 @@ package com.x.processplatform.assemble.surface.jaxrs.record; import java.util.ArrayList; import java.util.Comparator; import java.util.List; +import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; +import org.apache.commons.lang3.BooleanUtils; + import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.JpaObject; @@ -27,43 +30,55 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction { private static Logger logger = LoggerFactory.getLogger(ActionListWithWorkOrWorkCompleted.class); ActionResult> execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult> result = new ActionResult<>(); - - Business business = new Business(emc); - - if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, - new ExceptionEntityNotExist(workOrWorkCompleted))) { - throw new ExceptionAccessDenied(effectivePerson); - } - - String job = business.job().findWithWork(workOrWorkCompleted); + ActionResult> result = new ActionResult<>(); + CompletableFuture> _wos = CompletableFuture.supplyAsync(() -> { List wos = new ArrayList<>(); - if (null != job) { - wos = emc.fetchEqual(Record.class, Wo.copier, Record.job_FIELDNAME, job); - } else { - job = business.job().findWithWorkCompleted(workOrWorkCompleted); - WorkCompleted workCompleted = emc.firstEqual(WorkCompleted.class, WorkCompleted.job_FIELDNAME, job); - if (ListTools.isNotEmpty(workCompleted.getProperties().getRecordList())) { - wos = Wo.copier.copy(workCompleted.getProperties().getRecordList()); - } else { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + String job = business.job().findWithWork(workOrWorkCompleted); + if (null != job) { wos = emc.fetchEqual(Record.class, Wo.copier, Record.job_FIELDNAME, job); + } else { + job = business.job().findWithWorkCompleted(workOrWorkCompleted); + WorkCompleted workCompleted = emc.firstEqual(WorkCompleted.class, WorkCompleted.job_FIELDNAME, job); + if (ListTools.isNotEmpty(workCompleted.getProperties().getRecordList())) { + wos = Wo.copier.copy(workCompleted.getProperties().getRecordList()); + } else { + wos = emc.fetchEqual(Record.class, Wo.copier, Record.job_FIELDNAME, job); + } + } + wos = wos.stream().sorted(Comparator.comparing(Wo::getOrder)).collect(Collectors.toList()); + for (Task task : emc.listEqual(Task.class, Task.job_FIELDNAME, job).stream() + .sorted(Comparator.comparing(Task::getStartTime)).collect(Collectors.toList())) { + Record record = this.taskToRecord(task); + wos.add(Wo.copier.copy(record)); } + } catch (Exception e) { + logger.error(e); } - - wos = wos.stream().sorted(Comparator.comparing(Wo::getOrder)).collect(Collectors.toList()); - - for (Task task : emc.listEqual(Task.class, Task.job_FIELDNAME, job).stream() - .sorted(Comparator.comparing(Task::getStartTime)).collect(Collectors.toList())) { - Record record = this.taskToRecord(task); - wos.add(Wo.copier.copy(record)); + return wos; + }); + + CompletableFuture _control = CompletableFuture.supplyAsync(() -> { + Boolean value = false; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + value = business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, + new ExceptionEntityNotExist(workOrWorkCompleted)); + } catch (Exception e) { + logger.error(e); } + return value; + }); - result.setData(wos); - return result; + if (BooleanUtils.isFalse(_control.get())) { + throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted); } + result.setData(_wos.get()); + return result; + } private Record taskToRecord(Task task) { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompletedPaging.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompletedPaging.java index 6d154a6b5241f1ada03380baa4c8a6ee2e6462fb..d3ff2c443f7f636c77f519691b12faecddca458f 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompletedPaging.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/ActionListWithWorkOrWorkCompletedPaging.java @@ -3,8 +3,11 @@ package com.x.processplatform.assemble.surface.jaxrs.record; import java.util.ArrayList; import java.util.Comparator; import java.util.List; +import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; +import org.apache.commons.lang3.BooleanUtils; + import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.JpaObject; @@ -28,47 +31,62 @@ class ActionListWithWorkOrWorkCompletedPaging extends BaseAction { ActionResult> execute(EffectivePerson effectivePerson, String workOrWorkCompleted, Integer page, Integer size) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult> result = new ActionResult<>(); - - Business business = new Business(emc); - if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, - new ExceptionEntityNotExist(workOrWorkCompleted))) { - throw new ExceptionAccessDenied(effectivePerson); - } - - String job = business.job().findWithWork(workOrWorkCompleted); + ActionResult> result = new ActionResult<>(); + CompletableFuture> _wos = CompletableFuture.supplyAsync(() -> { List wos = new ArrayList<>(); - if (null != job) { - wos = emc.fetchEqualAscPaging(Record.class, Wo.copier, Record.job_FIELDNAME, job, page, size, - Record.order_FIELDNAME); - } else { - job = business.job().findWithWorkCompleted(workOrWorkCompleted); - WorkCompleted workCompleted = emc.firstEqual(WorkCompleted.class, WorkCompleted.job_FIELDNAME, job); - if (ListTools.isNotEmpty(workCompleted.getProperties().getRecordList())) { - List os = workCompleted.getProperties().getRecordList(); - int start = (page - 1) * size; - start = Math.min(start, os.size()); - wos = Wo.copier.copy(os.stream().sorted(Comparator.comparing(Record::getOrder)).skip(start) - .limit(size).collect(Collectors.toList())); - } else { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + String job = business.job().findWithWork(workOrWorkCompleted); + if (null != job) { wos = emc.fetchEqualAscPaging(Record.class, Wo.copier, Record.job_FIELDNAME, job, page, size, Record.order_FIELDNAME); + } else { + job = business.job().findWithWorkCompleted(workOrWorkCompleted); + WorkCompleted workCompleted = emc.firstEqual(WorkCompleted.class, WorkCompleted.job_FIELDNAME, job); + if (ListTools.isNotEmpty(workCompleted.getProperties().getRecordList())) { + List os = workCompleted.getProperties().getRecordList(); + int start = (page - 1) * size; + start = Math.min(start, os.size()); + wos = Wo.copier.copy(os.stream().sorted(Comparator.comparing(Record::getOrder)).skip(start) + .limit(size).collect(Collectors.toList())); + } else { + wos = emc.fetchEqualAscPaging(Record.class, Wo.copier, Record.job_FIELDNAME, job, page, size, + Record.order_FIELDNAME); + } } - } - for (Task task : emc.listEqual(Task.class, Task.job_FIELDNAME, job).stream() - .sorted(Comparator.comparing(Task::getStartTime)).collect(Collectors.toList())) { - Record record = this.taskToRecord(task); - wos.add(Wo.copier.copy(record)); + for (Task task : emc.listEqual(Task.class, Task.job_FIELDNAME, job).stream() + .sorted(Comparator.comparing(Task::getStartTime)).collect(Collectors.toList())) { + Record record = this.taskToRecord(task); + wos.add(Wo.copier.copy(record)); + } + } catch (Exception e) { + logger.error(e); } + return wos; + }); + + CompletableFuture _control = CompletableFuture.supplyAsync(() -> { + Boolean value = false; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + value = business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, + new ExceptionEntityNotExist(workOrWorkCompleted)); + } catch (Exception e) { + logger.error(e); + } + return value; + }); - result.setData(wos); - return result; + if (BooleanUtils.isFalse(_control.get())) { + throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted); } + result.setData(_wos.get()); + return result; + } private Record taskToRecord(Task task) { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/RecordAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/RecordAction.java index 3d59d98832ae0a6b2be39de1da6e1d714fd875ac..63a93169f831b1755457c2fa8b026947387da99a 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/RecordAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/record/RecordAction.java @@ -131,6 +131,24 @@ public class RecordAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionManageDelete.class) + @GET + @Path("{id}/manage/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageDeleteMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageDelete().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "管理根据job创建记录.", action = ActionManageCreateWithJob.class) @POST @Path("job/{job}/manage") @@ -166,4 +184,23 @@ public class RecordAction extends StandardJaxrsAction { } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionManageEdit.class) + @POST + @Path("{id}/manage/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageEditMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageEdit().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/review/ReviewAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/review/ReviewAction.java index e22b5d01239398caf8f1baf337e3cd107d017718..bc4396b6ff375e68df9c593e3a52ff50233b3950 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/review/ReviewAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/review/ReviewAction.java @@ -179,6 +179,25 @@ public class ReviewAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionManageDelete.class) + @GET + @Path("{id}/application/{applicationFlag}/manage/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageDeleteMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("参阅标识") @PathParam("id") String id, + @JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageDelete().execute(effectivePerson, id, applicationFlag); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "列示当前用户创建的工作的参阅,分页.", action = V2ListCreatePaging.class) @POST @Path("v2/list/create/paging/{page}/size/{size}") @@ -335,8 +354,8 @@ public class ReviewAction extends StandardJaxrsAction { @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void V2ManageListPaging(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("分页") @PathParam("page") Integer page, - @JaxrsParameterDescribe("每页数量") @PathParam("size") Integer size, JsonElement jsonElement) { + @JaxrsParameterDescribe("分页") @PathParam("page") Integer page, + @JaxrsParameterDescribe("每页数量") @PathParam("size") Integer size, JsonElement jsonElement) { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/route/RouteAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/route/RouteAction.java index 7d4d73857398022e708711bec745528a914bc9f8..c1d4a2004eafecd329bad32c7c67983281c224cf 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/route/RouteAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/route/RouteAction.java @@ -5,6 +5,7 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.GET; +import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @@ -68,6 +69,24 @@ public class RouteAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionList.class) + @POST + @Path("list/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void listMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + JsonElement jsonElement) { + ActionResult> result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionList().execute(effectivePerson, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "获取选择人员配置.", action = ActionGetSelectConfig.class) @GET @Path("{id}/selectconfig") diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/serialnumber/SerialNumberAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/serialnumber/SerialNumberAction.java index 25103d0a309016751607fe605e2abde982c1cf96..d3f11241c87480fd710d8cae708cb1717b286992 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/serialnumber/SerialNumberAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/serialnumber/SerialNumberAction.java @@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; +import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @@ -87,6 +88,24 @@ public class SerialNumberAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionUpdate.class) + @POST + @Path("{id}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void updateMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionUpdate().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "删除SerialNumber内容.", action = ActionRemove.class) @DELETE @Path("{id}") @@ -105,4 +124,22 @@ public class SerialNumberAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionRemove.class) + @GET + @Path("{id}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionRemove().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ServiceAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ServiceAction.java index 28abd94e55ec3b749950e892df572f6528eac693..419a16bb70ed87b864ba78e4081ef8ef721a7a8b 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ServiceAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/service/ServiceAction.java @@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.service; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; +import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @@ -29,19 +30,37 @@ public class ServiceAction extends StandardJaxrsAction { private static Logger logger = LoggerFactory.getLogger(ServiceAction.class); - @JaxrsMethodDescribe(value = "访问服务", action = ActionTouch.class) + @JaxrsMethodDescribe(value = "访问服务.", action = ActionTouch.class) @PUT @Path("work/{id}/touch") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + public void touch(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, JsonElement jsonElement) { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { result = new ActionTouch().execute(effectivePerson, id, jsonElement); } catch (Exception e) { - logger.error(e, effectivePerson, request, null); + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionTouch.class) + @POST + @Path("work/{id}/touch/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void touchMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionTouch().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionGet.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionGet.java new file mode 100644 index 0000000000000000000000000000000000000000..bfe76f9e3e223719ca8f6c25833af7ae8da67b51 --- /dev/null +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionGet.java @@ -0,0 +1,51 @@ +package com.x.processplatform.assemble.surface.jaxrs.snap; + +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.entity.JpaObject; +import com.x.base.core.project.bean.WrapCopier; +import com.x.base.core.project.bean.WrapCopierFactory; +import com.x.base.core.project.exception.ExceptionAccessDenied; +import com.x.base.core.project.exception.ExceptionEntityNotExist; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.core.entity.content.Snap; + +class ActionGet extends BaseAction { + + private static Logger logger = LoggerFactory.getLogger(ActionGet.class); + + ActionResult execute(EffectivePerson effectivePerson, String id) throws Exception { + ActionResult result = new ActionResult<>(); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + Snap snap = emc.find(id, Snap.class); + if (null == snap) { + throw new ExceptionEntityNotExist(id, Snap.class); + } + if (!allow(effectivePerson, business, snap)) { + throw new ExceptionAccessDenied(effectivePerson, snap); + } + result.setData(Wo.copier.copy(snap)); + } + return result; + } + + private boolean allow(EffectivePerson effectivePerson, Business business, Snap snap) throws Exception { + return (business.canManageApplicationOrProcess(effectivePerson, snap.getApplication(), snap.getProcess()) + || effectivePerson.isNotPerson(snap.getPerson())); + } + + public static class Wo extends Snap { + + private static final long serialVersionUID = -2577413577740827608L; + + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, + JpaObject.FieldsInvisible); + + } + +} diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListMyFilterPaging.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListMyFilterPaging.java index cc1f47022f22480f22a5911136aa259cab8d27ca..f229d4e0e4ec7cf1acec363c653c71198fe3fcf8 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListMyFilterPaging.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListMyFilterPaging.java @@ -17,6 +17,7 @@ import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.core.entity.content.Snap; @@ -68,7 +69,7 @@ class ActionListMyFilterPaging extends BaseAction { private static final long serialVersionUID = 2279846765261247910L; static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, - JpaObject.singularAttributeField(Snap.class, true, true), null); + JpaObject.singularAttributeField(Snap.class, true, true), ListTools.toList(Snap.properties_FIELDNAME)); } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListMyPaging.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListMyPaging.java index 1bf0e224ae5b2db264902436c83147e2698e9067..840ebb0df033a2f8454573d0191e5bad1a8e53ab 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListMyPaging.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListMyPaging.java @@ -11,7 +11,9 @@ import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; class ActionListMyPaging extends BaseAction { @@ -31,8 +33,8 @@ class ActionListMyPaging extends BaseAction { private static final long serialVersionUID = 2279846765261247910L; - static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, - JpaObject.FieldsInvisibleIncludeProperites); + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, + JpaObject.singularAttributeField(Snap.class, true, true), ListTools.toList(Snap.properties_FIELDNAME)); } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNext.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNext.java index 3cb7ff38f01d30d442706e3d0c9f409958801c70..8350caef1478bd474f4b5e83f3a9bf8c8eb02e9d 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNext.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNext.java @@ -11,7 +11,9 @@ import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; class ActionListNext extends BaseAction { @@ -28,8 +30,8 @@ class ActionListNext extends BaseAction { public static class Wo extends RankWo { private static final long serialVersionUID = 6502735971303449356L; - static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, - JpaObject.FieldsInvisibleIncludeProperites); + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, + JpaObject.singularAttributeField(Snap.class, true, true), ListTools.toList(Snap.properties_FIELDNAME)); } } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithApplication.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithApplication.java index 5ba69e3acef67bcd8879ad4d2ad1181f1956a937..a196cb94fac3319c06944132de6cad17a3b1968f 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithApplication.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithApplication.java @@ -16,7 +16,9 @@ import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.exception.ExceptionEntityNotExist; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; import com.x.processplatform.core.entity.content.Snap; import com.x.processplatform.core.entity.element.Application; @@ -42,8 +44,8 @@ class ActionListNextWithApplication extends BaseAction { private static final long serialVersionUID = 3075270584151179370L; - static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, - JpaObject.FieldsInvisibleIncludeProperites); + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, + JpaObject.singularAttributeField(Snap.class, true, true), ListTools.toList(Snap.properties_FIELDNAME)); } } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithProcess.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithProcess.java index 965c6b401785481693774c46c9680faca75c69b9..68b43b00dab6349430d6579bf654bd873adaa996 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithProcess.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListNextWithProcess.java @@ -12,7 +12,9 @@ import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.exception.ExceptionEntityNotExist; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; import com.x.processplatform.core.entity.element.Process; @@ -36,8 +38,8 @@ class ActionListNextWithProcess extends BaseAction { private static final long serialVersionUID = 2988668146783909521L; - static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, - JpaObject.FieldsInvisibleIncludeProperites); + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, + JpaObject.singularAttributeField(Snap.class, true, true), ListTools.toList(Snap.properties_FIELDNAME)); } } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrev.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrev.java index 6cdd7ce24a22de20bf8354bf6d197fa3f0e17b87..dc29f206a0cbc74ee2fd1c286959992b9e5b9bc2 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrev.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrev.java @@ -11,7 +11,9 @@ import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; class ActionListPrev extends BaseAction { @@ -28,8 +30,8 @@ class ActionListPrev extends BaseAction { public static class Wo extends RankWo { private static final long serialVersionUID = 6502735971303449356L; - static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, - JpaObject.FieldsInvisibleIncludeProperites); + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, + JpaObject.singularAttributeField(Snap.class, true, true), ListTools.toList(Snap.properties_FIELDNAME)); } } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithApplication.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithApplication.java index 6149c7570348f8802576b77b4eb2a7736f747790..e55f8e8d9b6956bce9b9162b7c493d82a2a4cb82 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithApplication.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithApplication.java @@ -12,7 +12,9 @@ import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.exception.ExceptionEntityNotExist; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; import com.x.processplatform.core.entity.element.Application; @@ -36,8 +38,8 @@ class ActionListPrevWithApplication extends BaseAction { private static final long serialVersionUID = 3075270584151179370L; - static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, - JpaObject.FieldsInvisibleIncludeProperites); + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, + JpaObject.singularAttributeField(Snap.class, true, true), ListTools.toList(Snap.properties_FIELDNAME)); } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithProcess.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithProcess.java index f80dfb927cee5864ccdfd0f42424b2f6625d350d..46b1638317c8a49a3097e1e743d92c5809134ee7 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithProcess.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionListPrevWithProcess.java @@ -12,7 +12,9 @@ import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.exception.ExceptionEntityNotExist; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; import com.x.processplatform.core.entity.element.Process; @@ -36,8 +38,8 @@ class ActionListPrevWithProcess extends BaseAction { private static final long serialVersionUID = 2988668146783909521L; - static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, - JpaObject.FieldsInvisibleIncludeProperites); + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, + JpaObject.singularAttributeField(Snap.class, true, true), ListTools.toList(Snap.properties_FIELDNAME)); } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListFilterPaging.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListFilterPaging.java index 790789b61fc3b569417107ae19d71fdf88cb96c6..c5bb54ee3989390946ba1efffe58f94d0e47de62 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListFilterPaging.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListFilterPaging.java @@ -21,6 +21,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; class ActionManageListFilterPaging extends BaseAction { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNext.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNext.java index 1f1b69510427a3942d49d46e205699a6f7ef1509..3e2350f427f0cf00e503fb7a423b9745b6cfc8c3 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNext.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNext.java @@ -13,6 +13,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; class ActionManageListNext extends BaseAction { @@ -31,8 +32,8 @@ class ActionManageListNext extends BaseAction { private static final long serialVersionUID = 7593097665520980060L; - static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, - JpaObject.FieldsInvisible); + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, + JpaObject.singularAttributeField(Snap.class, true, true), null); } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNextFilter.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNextFilter.java index 8a41103fa8bc43fb2d732efbc8d533f91f94cd7b..32b8f75cf0a321fb2c610ca8e72d7aa94d527bef 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNextFilter.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListNextFilter.java @@ -16,6 +16,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; class ActionManageListNextFilter extends BaseAction { @@ -42,8 +43,8 @@ class ActionManageListNextFilter extends BaseAction { private static final long serialVersionUID = 2279846765261247910L; - static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, - JpaObject.FieldsInvisible); + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, + JpaObject.singularAttributeField(Snap.class, true, true), null); } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrev.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrev.java index 55c492ff2b2c67ee1dd321fa8fe80d88022d70ce..88d15e61830c2b73d95d142bee9c859af9c9f184 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrev.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrev.java @@ -13,6 +13,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; class ActionManageListPrev extends BaseAction { @@ -31,8 +32,8 @@ class ActionManageListPrev extends BaseAction { private static final long serialVersionUID = 7593097665520980060L; - static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, - JpaObject.FieldsInvisible); + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, + JpaObject.singularAttributeField(Snap.class, true, true), null); } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrevFilter.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrevFilter.java index fd48822d40b0fa68358afd844bedd3e8d0562d41..51c31315be5c44669549b5843db741623f2017a0 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrevFilter.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionManageListPrevFilter.java @@ -16,6 +16,7 @@ import com.x.base.core.project.exception.ExceptionAccessDenied; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo; import com.x.processplatform.core.entity.content.Snap; class ActionManageListPrevFilter extends BaseAction { @@ -42,8 +43,8 @@ class ActionManageListPrevFilter extends BaseAction { private static final long serialVersionUID = 2279846765261247910L; - static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, null, - JpaObject.FieldsInvisible); + static WrapCopier copier = WrapCopierFactory.wo(Snap.class, Wo.class, + JpaObject.singularAttributeField(Snap.class, true, true), null); } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionTypeAbandoned.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionTypeAbandoned.java index e70296710ae7d93eaf7b97fc83fa48def20e391a..f36bb6d30c9fbb077933a5a6dd85d7ab8fb8b7d3 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionTypeAbandoned.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/ActionTypeAbandoned.java @@ -15,8 +15,8 @@ import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.assemble.surface.ThisApplication; +import com.x.processplatform.assemble.surface.WorkControl; import com.x.processplatform.core.entity.content.Work; -import com.x.processplatform.core.entity.element.Activity; class ActionTypeAbandoned extends BaseAction { @@ -30,14 +30,11 @@ class ActionTypeAbandoned extends BaseAction { if (null == work) { throw new ExceptionEntityNotExist(workId, Work.class); } - job = work.getJob(); - Activity activity = business.getActivity(work.getActivity(), work.getActivityType()); - if (BooleanUtils.isNotTrue( - business.canManageApplicationOrProcess(effectivePerson, work.getApplication(), work.getProcess())) - && ((!business.editable(effectivePerson, work)) - || (BooleanUtils.isNotTrue(activity.getAllowSuspend())))) { + WoControl control = business.getControl(effectivePerson, work, WoControl.class); + if (BooleanUtils.isNotTrue(control.getAllowDelete())) { throw new ExceptionAccessDenied(effectivePerson, work); } + job = work.getJob(); } Wo wo = ThisApplication.context().applications() @@ -56,4 +53,7 @@ class ActionTypeAbandoned extends BaseAction { } + public static class WoControl extends WorkControl { + } + } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/BaseAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/BaseAction.java index 64b4e970d4bfdc00688c860d4d4fc44944a1f27f..cf26bfe5967c1693dfc43929c61cdfcff7a563cf 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/BaseAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/BaseAction.java @@ -11,7 +11,6 @@ import javax.persistence.criteria.Root; import org.apache.commons.lang3.StringUtils; import com.x.base.core.project.annotation.FieldDescribe; -import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.StandardJaxrsAction; import com.x.base.core.project.tools.ListTools; @@ -89,8 +88,9 @@ abstract class BaseAction extends StandardJaxrsAction { p = cb.and(p, cb.equal(root.get(Snap_.application), application.getId())); return p; } - - protected Predicate myProcessFilter(EffectivePerson effectivePerson, Business business, Process process) throws Exception { + + protected Predicate myProcessFilter(EffectivePerson effectivePerson, Business business, Process process) + throws Exception { EntityManager em = business.entityManagerContainer().get(Snap.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(Snap.class); @@ -100,7 +100,6 @@ abstract class BaseAction extends StandardJaxrsAction { return p; } - protected class FilterWi { @FieldDescribe("应用id") @@ -149,10 +148,20 @@ abstract class BaseAction extends StandardJaxrsAction { } - protected abstract static class RankWo extends GsonPropertyObject { + protected abstract static class RankWo extends Snap { + + private Long rank; private static final long serialVersionUID = 2279846765261247910L; + public Long getRank() { + return rank; + } + + public void setRank(Long rank) { + this.rank = rank; + } + } } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/SnapAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/SnapAction.java index a97225a83d55cf71165c1a60d498ccfc058db4da..96a417b3afae039a43c6f776fa0ead4b6d5784b0 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/SnapAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/snap/SnapAction.java @@ -51,6 +51,24 @@ public class SnapAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "对工作进行快照,并标记为废弃", action = ActionTypeAbandoned.class) + @GET + @Path("work/{workId}/type/abandoned") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void typeAbandoned(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionTypeAbandoned().execute(effectivePerson, workId); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "挂起工作", action = ActionTypeSuspend.class) @GET @Path("work/{workId}/type/suspend") @@ -69,6 +87,24 @@ public class SnapAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "获取快照对象.", action = ActionGet.class) + @GET + @Path("{id}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionGet().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "删除快照", action = ActionDelete.class) @DELETE @Path("{id}") @@ -87,6 +123,24 @@ public class SnapAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "删除快照", action = ActionDelete.class) + @GET + @Path("{id}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteMockGet2Delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDelete().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "恢复快照", action = ActionRestore.class) @GET @Path("{id}/restore") diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/TaskAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/TaskAction.java index 01188dfd3da5e4f08f712853c81bc72f911566b5..3d8aa5cc3bacc9af042dae9b828df4f9d52ef3e5 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/TaskAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/task/TaskAction.java @@ -357,7 +357,25 @@ public class TaskAction extends StandardJaxrsAction { @Path("{id}") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void update(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + public void edit(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionEdit().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionEdit.class) + @POST + @Path("{id}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void editMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) { ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); @@ -388,6 +406,24 @@ public class TaskAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "重置待办,将之前的待办转为已办,opinion:办理意见,routeName:选择路由,identityList:新的办理人.", action = ActionReset.class) + @POST + @Path("{id}/reset/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void resetMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionReset().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "预计下一活动处理状态及处理人.", action = ActionWill.class) @GET @Path("{id}/will") @@ -478,6 +514,24 @@ public class TaskAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionManageDelete.class) + @GET + @Path("{id}/manage/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageDeleteMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageDelete().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "待办转已办.", action = ActionManageProcessing.class) @PUT @Path("{id}/processing/manage") @@ -496,6 +550,25 @@ public class TaskAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionManageProcessing.class) + @POST + @Path("{id}/processing/manage/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageProcessingMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("待办标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageProcessing().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "管理修改意见.", action = ActionManageOpinion.class) @PUT @Path("{id}/opinion/manage") @@ -514,6 +587,25 @@ public class TaskAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionManageOpinion.class) + @POST + @Path("{id}/opinion/manage/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageOpinionMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("待办标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageOpinion().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "重置待办,将之前的待办转为已办,opinion:办理意见,routeName:选择路由,identityList:新的办理人.", action = ActionManageReset.class) @PUT @Path("{id}/reset/manage") @@ -532,6 +624,25 @@ public class TaskAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "重置待办,将之前的待办转为已办,opinion:办理意见,routeName:选择路由,identityList:新的办理人.", action = ActionManageReset.class) + @POST + @Path("{id}/reset/manage/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageResetMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageReset().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "列示当前用户的待办,分页.", action = ActionListMyPaging.class) @GET @Path("list/my/paging/{page}/size/{size}") @@ -833,6 +944,24 @@ public class TaskAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = V2Reset.class) + @POST + @Path("v2/{id}/reset/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void V2ResetMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new V2Reset().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "待办提醒,message类型:task_press.", action = ActionManagePress.class) @GET @Path("{id}/press/manage") @@ -856,8 +985,8 @@ public class TaskAction extends StandardJaxrsAction { @Path("list/person/{person}/manage") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) - public void manageListWithPerson(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, @JaxrsParameterDescribe("用户") @PathParam("person") String person) { + public void manageListWithPerson(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("用户") @PathParam("person") String person) { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { @@ -875,8 +1004,9 @@ public class TaskAction extends StandardJaxrsAction { @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void manageListWithDateHour(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, @JaxrsParameterDescribe("日期(如:2020-09-11)") @PathParam("date") String date, - @JaxrsParameterDescribe("小时(0-23)") @PathParam("hour") Integer hour) { + @Context HttpServletRequest request, + @JaxrsParameterDescribe("日期(如:2020-09-11)") @PathParam("date") String date, + @JaxrsParameterDescribe("小时(0-23)") @PathParam("hour") Integer hour) { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/taskcompleted/TaskCompletedAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/taskcompleted/TaskCompletedAction.java index 1cb2b8f6fc7f853ac8f9b062db86f03093a2db5d..427eac31c68c2f857f27a9149c59c726b5562dd2 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/taskcompleted/TaskCompletedAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/taskcompleted/TaskCompletedAction.java @@ -407,6 +407,24 @@ public class TaskCompletedAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionManageDelete.class) + @GET + @Path("{id}/manage/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageDeleteMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageDelete().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "管理修改意见.", action = ActionManageOpinion.class) @PUT @Path("{id}/opinion/manage") @@ -425,6 +443,25 @@ public class TaskCompletedAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionManageOpinion.class) + @POST + @Path("{id}/opinion/manage/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageOpinionMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("已办标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageOpinion().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "提醒.", action = ActionPress.class) @GET @Path("press/work/{work}") @@ -674,8 +711,9 @@ public class TaskCompletedAction extends StandardJaxrsAction { @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) public void manageListWithDateHour(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, @JaxrsParameterDescribe("日期(如:2020-09-11)") @PathParam("date") String date, - @JaxrsParameterDescribe("小时(0-23)") @PathParam("hour") Integer hour) { + @Context HttpServletRequest request, + @JaxrsParameterDescribe("日期(如:2020-09-11)") @PathParam("date") String date, + @JaxrsParameterDescribe("小时(0-23)") @PathParam("hour") Integer hour) { ActionResult> result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); try { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCloseCheck.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCloseCheck.java index 568443b8b2a42420d10eef80696bf7bf8526cf3c..38b79a49324cd16e84ebaf4a5bcf0c496bd7ff19 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCloseCheck.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCloseCheck.java @@ -62,35 +62,10 @@ class ActionCloseCheck extends BaseAction { return wo; } -// private WoGrabRelease grabRelease(Business business, EffectivePerson effectivePerson, Work work) throws Exception { -// WoGrabRelease wo = new WoGrabRelease(); -// if ((null != work) && (Objects.equals(work.getActivityType(), ActivityType.manual))) { -// Manual manual = business.manual().pick(work.getActivity()); -// if ((null != manual) && Objects.equals(ManualMode.grab, manual.getManualMode())) { -// if (ListTools.isEmpty(work.getManualTaskIdentityList()) -// || (work.getManualTaskIdentityList().size() == 1)) { -// business.entityManagerContainer().beginTransaction(Work.class); -// work.getManualTaskIdentityList().clear(); -// business.entityManagerContainer().commit(); -// ThisApplication.context().applications().putQuery(effectivePerson.getDebugger(), -// x_processplatform_service_processing.class, -// Applications.joinQueryUri("work", work.getId(), "processing"), null); -// List tasks = business.entityManagerContainer().fetchEqual(Task.class, -// ListTools.toList(Task.identity_FIELDNAME), Task.work_FIELDNAME, work.getId()); -// wo.setRelease(true); -// wo.setTaskList(tasks); -// } -// } -// } -// return wo; -// } - public static class Wo extends GsonPropertyObject { @FieldDescribe("检查删除草稿结果") private WoDraft draft; -// @FieldDescribe("检查抢办释放结果") -// private WoGrabRelease grabRelease; public WoDraft getDraft() { return draft; @@ -100,14 +75,6 @@ class ActionCloseCheck extends BaseAction { this.draft = draft; } -// public WoGrabRelease getGrabRelease() { -// return grabRelease; -// } -// -// public void setGrabRelease(WoGrabRelease grabRelease) { -// this.grabRelease = grabRelease; -// } - } public static class WoDraft extends WrapBoolean { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplex.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplex.java index 08a294dd964901e6f3d5edd7fd1b02d6e653c4df..11076d53a648ce72cb6e6c7e2a2766d05de001c1 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplex.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplex.java @@ -1,54 +1,54 @@ -package com.x.processplatform.assemble.surface.jaxrs.work; - -import org.apache.commons.lang3.BooleanUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.Work; -import com.x.processplatform.core.entity.element.Form; - -class ActionComplex extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionComplex.class); - - ActionResult execute(EffectivePerson effectivePerson, String id) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - Work work = emc.find(id, Work.class); - if (null == work) { - throw new ExceptionWorkNotExist(id); - } - Wo wo = this.get(business, effectivePerson, work, Wo.class); - WoControl control = wo.getControl(); - if (BooleanUtils.isNotTrue(control.getAllowVisit())) { - throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), - work.getId()); - } - wo.setForm(this.referenceForm(business, work)); - result.setData(wo); - return result; - } - } - - private WoForm referenceForm(Business business, Work work) throws Exception { - Form form = business.form().pick(work.getForm()); - if (null == form) { - logger.info("work title:{}, id:{}, can not find form:{}.", work.getTitle(), work.getId(), work.getForm()); - return null; - } - WoForm woForm = new WoForm(); - form.copyTo(woForm, "data", "mobileData"); - woForm.setData(form.getDataOrMobileData()); - return woForm; - } - - public static class Wo extends AbstractWo { - } - -} \ No newline at end of file +//package com.x.processplatform.assemble.surface.jaxrs.work; +// +//import org.apache.commons.lang3.BooleanUtils; +// +//import com.x.base.core.container.EntityManagerContainer; +//import com.x.base.core.container.factory.EntityManagerContainerFactory; +//import com.x.base.core.project.http.ActionResult; +//import com.x.base.core.project.http.EffectivePerson; +//import com.x.base.core.project.logger.Logger; +//import com.x.base.core.project.logger.LoggerFactory; +//import com.x.processplatform.assemble.surface.Business; +//import com.x.processplatform.core.entity.content.Work; +//import com.x.processplatform.core.entity.element.Form; +// +//class ActionComplex extends BaseAction { +// +// private static Logger logger = LoggerFactory.getLogger(ActionComplex.class); +// +// ActionResult execute(EffectivePerson effectivePerson, String id) throws Exception { +// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { +// ActionResult result = new ActionResult<>(); +// Business business = new Business(emc); +// Work work = emc.find(id, Work.class); +// if (null == work) { +// throw new ExceptionWorkNotExist(id); +// } +// Wo wo = this.get(business, effectivePerson, work, Wo.class); +// WoControl control = wo.getControl(); +// if (BooleanUtils.isNotTrue(control.getAllowVisit())) { +// throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), +// work.getId()); +// } +// wo.setForm(this.referenceForm(business, work)); +// result.setData(wo); +// return result; +// } +// } +// +// private WoForm referenceForm(Business business, Work work) throws Exception { +// Form form = business.form().pick(work.getForm()); +// if (null == form) { +// logger.info("work title:{}, id:{}, can not find form:{}.", work.getTitle(), work.getId(), work.getForm()); +// return null; +// } +// WoForm woForm = new WoForm(); +// form.copyTo(woForm, "data", "mobileData"); +// woForm.setData(form.getDataOrMobileData()); +// return woForm; +// } +// +// public static class Wo extends AbstractWo { +// } +// +//} \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexAppointForm.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexAppointForm.java index bd9f505157b043a92e86c825ae6c31eb3706ccf4..c533e2d8e28f0cdecf9fe222bcd24da0abdfb6c8 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexAppointForm.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexAppointForm.java @@ -1,54 +1,54 @@ -package com.x.processplatform.assemble.surface.jaxrs.work; - -import org.apache.commons.lang3.BooleanUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.assemble.surface.jaxrs.work.BaseAction.AbstractWo; -import com.x.processplatform.core.entity.content.Work; -import com.x.processplatform.core.entity.element.Form; - -class ActionComplexAppointForm extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionComplexAppointForm.class); - - ActionResult execute(EffectivePerson effectivePerson, String id, String formFlag) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - Work work = emc.find(id, Work.class); - if (null == work) { - throw new ExceptionWorkNotExist(id); - } - Wo wo = this.get(business, effectivePerson, work, Wo.class); - WoControl control = wo.getControl(); - if (BooleanUtils.isNotTrue(control.getAllowVisit())) { - throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), - work.getId()); - } - wo.setForm(this.referenceForm(business, work, formFlag)); - result.setData(wo); - return result; - } - } - - private WoForm referenceForm(Business business, Work work, String formFlag) throws Exception { - Form form = business.form().pick(formFlag); - if (null == form) { - logger.info("work title:{}, id:{}, can not find form:{}.", work.getTitle(), work.getId(), work.getForm()); - return null; - } - WoForm woForm = new WoForm(); - form.copyTo(woForm, "data", "mobileData"); - woForm.setData(form.getDataOrMobileData()); - return woForm; - } - - public static class Wo extends AbstractWo { - } -} \ No newline at end of file +//package com.x.processplatform.assemble.surface.jaxrs.work; +// +//import org.apache.commons.lang3.BooleanUtils; +// +//import com.x.base.core.container.EntityManagerContainer; +//import com.x.base.core.container.factory.EntityManagerContainerFactory; +//import com.x.base.core.project.http.ActionResult; +//import com.x.base.core.project.http.EffectivePerson; +//import com.x.base.core.project.logger.Logger; +//import com.x.base.core.project.logger.LoggerFactory; +//import com.x.processplatform.assemble.surface.Business; +//import com.x.processplatform.assemble.surface.jaxrs.work.BaseAction.AbstractWo; +//import com.x.processplatform.core.entity.content.Work; +//import com.x.processplatform.core.entity.element.Form; +// +//class ActionComplexAppointForm extends BaseAction { +// +// private static Logger logger = LoggerFactory.getLogger(ActionComplexAppointForm.class); +// +// ActionResult execute(EffectivePerson effectivePerson, String id, String formFlag) throws Exception { +// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { +// ActionResult result = new ActionResult<>(); +// Business business = new Business(emc); +// Work work = emc.find(id, Work.class); +// if (null == work) { +// throw new ExceptionWorkNotExist(id); +// } +// Wo wo = this.get(business, effectivePerson, work, Wo.class); +// WoControl control = wo.getControl(); +// if (BooleanUtils.isNotTrue(control.getAllowVisit())) { +// throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), +// work.getId()); +// } +// wo.setForm(this.referenceForm(business, work, formFlag)); +// result.setData(wo); +// return result; +// } +// } +// +// private WoForm referenceForm(Business business, Work work, String formFlag) throws Exception { +// Form form = business.form().pick(formFlag); +// if (null == form) { +// logger.info("work title:{}, id:{}, can not find form:{}.", work.getTitle(), work.getId(), work.getForm()); +// return null; +// } +// WoForm woForm = new WoForm(); +// form.copyTo(woForm, "data", "mobileData"); +// woForm.setData(form.getDataOrMobileData()); +// return woForm; +// } +// +// public static class Wo extends AbstractWo { +// } +//} \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexAppointFormMobile.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexAppointFormMobile.java index 794ed9b1d5471b41ab118f419d528cf38a16b156..b78c7a78de5f737e5f688a7943503ec880727c43 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexAppointFormMobile.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexAppointFormMobile.java @@ -1,54 +1,54 @@ -package com.x.processplatform.assemble.surface.jaxrs.work; - -import org.apache.commons.lang3.BooleanUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.core.entity.content.Work; -import com.x.processplatform.core.entity.element.Form; - -class ActionComplexAppointFormMobile extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionComplexAppointFormMobile.class); - - ActionResult execute(EffectivePerson effectivePerson, String id, String formFlag) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - Work work = emc.find(id, Work.class); - if (null == work) { - throw new ExceptionWorkNotExist(id); - } - Wo wo = this.get(business, effectivePerson, work, Wo.class); - WoControl control = wo.getControl(); - if (BooleanUtils.isNotTrue(control.getAllowVisit())) { - throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), - work.getId()); - } - wo.setForm(this.referenceForm(business, work, formFlag)); - result.setData(wo); - return result; - } - } - - public static class Wo extends AbstractWo { - } - - private WoForm referenceForm(Business business, Work work, String formFlag) throws Exception { - Form form = business.form().pick(formFlag); - if (null == form) { - logger.info("work title:{}, id:{}, can not find form:{}.", work.getTitle(), work.getId(), work.getForm()); - return null; - } - WoForm woForm = new WoForm(); - form.copyTo(woForm, "data", "mobileData"); - woForm.setData(form.getMobileDataOrData()); - return woForm; - } - -} \ No newline at end of file +//package com.x.processplatform.assemble.surface.jaxrs.work; +// +//import org.apache.commons.lang3.BooleanUtils; +// +//import com.x.base.core.container.EntityManagerContainer; +//import com.x.base.core.container.factory.EntityManagerContainerFactory; +//import com.x.base.core.project.http.ActionResult; +//import com.x.base.core.project.http.EffectivePerson; +//import com.x.base.core.project.logger.Logger; +//import com.x.base.core.project.logger.LoggerFactory; +//import com.x.processplatform.assemble.surface.Business; +//import com.x.processplatform.core.entity.content.Work; +//import com.x.processplatform.core.entity.element.Form; +// +//class ActionComplexAppointFormMobile extends BaseAction { +// +// private static Logger logger = LoggerFactory.getLogger(ActionComplexAppointFormMobile.class); +// +// ActionResult execute(EffectivePerson effectivePerson, String id, String formFlag) throws Exception { +// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { +// ActionResult result = new ActionResult<>(); +// Business business = new Business(emc); +// Work work = emc.find(id, Work.class); +// if (null == work) { +// throw new ExceptionWorkNotExist(id); +// } +// Wo wo = this.get(business, effectivePerson, work, Wo.class); +// WoControl control = wo.getControl(); +// if (BooleanUtils.isNotTrue(control.getAllowVisit())) { +// throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), +// work.getId()); +// } +// wo.setForm(this.referenceForm(business, work, formFlag)); +// result.setData(wo); +// return result; +// } +// } +// +// public static class Wo extends AbstractWo { +// } +// +// private WoForm referenceForm(Business business, Work work, String formFlag) throws Exception { +// Form form = business.form().pick(formFlag); +// if (null == form) { +// logger.info("work title:{}, id:{}, can not find form:{}.", work.getTitle(), work.getId(), work.getForm()); +// return null; +// } +// WoForm woForm = new WoForm(); +// form.copyTo(woForm, "data", "mobileData"); +// woForm.setData(form.getMobileDataOrData()); +// return woForm; +// } +// +//} \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexMobile.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexMobile.java index a443fadf987c26395a83596ec1e052f43711192a..361e5bc63a0588ca34752920f85a2bb8570f278a 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexMobile.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionComplexMobile.java @@ -1,55 +1,55 @@ -package com.x.processplatform.assemble.surface.jaxrs.work; - -import org.apache.commons.lang3.BooleanUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.base.core.project.logger.Logger; -import com.x.base.core.project.logger.LoggerFactory; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.assemble.surface.jaxrs.work.BaseAction.AbstractWo; -import com.x.processplatform.core.entity.content.Work; -import com.x.processplatform.core.entity.element.Form; - -class ActionComplexMobile extends BaseAction { - - private static Logger logger = LoggerFactory.getLogger(ActionComplexMobile.class); - - ActionResult execute(EffectivePerson effectivePerson, String id) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - Work work = emc.find(id, Work.class); - if (null == work) { - throw new ExceptionWorkNotExist(id); - } - Wo wo = this.get(business, effectivePerson, work, Wo.class); - WoControl control = wo.getControl(); - if (BooleanUtils.isNotTrue(control.getAllowVisit())) { - throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), - work.getId()); - } - wo.setForm(this.referenceForm(business, work)); - result.setData(wo); - return result; - } - } - - public static class Wo extends AbstractWo { - } - - private WoForm referenceForm(Business business, Work work) throws Exception { - Form form = business.form().pick(work.getForm()); - if (null == form) { - logger.info("work title:{}, id:{}, can not find form:{}.", work.getTitle(), work.getId(), work.getForm()); - return null; - } - WoForm wo = new WoForm(); - form.copyTo(wo, "data", "mobileData"); - wo.setData(form.getMobileDataOrData()); - return wo; - } - -} \ No newline at end of file +//package com.x.processplatform.assemble.surface.jaxrs.work; +// +//import org.apache.commons.lang3.BooleanUtils; +// +//import com.x.base.core.container.EntityManagerContainer; +//import com.x.base.core.container.factory.EntityManagerContainerFactory; +//import com.x.base.core.project.http.ActionResult; +//import com.x.base.core.project.http.EffectivePerson; +//import com.x.base.core.project.logger.Logger; +//import com.x.base.core.project.logger.LoggerFactory; +//import com.x.processplatform.assemble.surface.Business; +//import com.x.processplatform.assemble.surface.jaxrs.work.BaseAction.AbstractWo; +//import com.x.processplatform.core.entity.content.Work; +//import com.x.processplatform.core.entity.element.Form; +// +//class ActionComplexMobile extends BaseAction { +// +// private static Logger logger = LoggerFactory.getLogger(ActionComplexMobile.class); +// +// ActionResult execute(EffectivePerson effectivePerson, String id) throws Exception { +// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { +// ActionResult result = new ActionResult<>(); +// Business business = new Business(emc); +// Work work = emc.find(id, Work.class); +// if (null == work) { +// throw new ExceptionWorkNotExist(id); +// } +// Wo wo = this.get(business, effectivePerson, work, Wo.class); +// WoControl control = wo.getControl(); +// if (BooleanUtils.isNotTrue(control.getAllowVisit())) { +// throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), +// work.getId()); +// } +// wo.setForm(this.referenceForm(business, work)); +// result.setData(wo); +// return result; +// } +// } +// +// public static class Wo extends AbstractWo { +// } +// +// private WoForm referenceForm(Business business, Work work) throws Exception { +// Form form = business.form().pick(work.getForm()); +// if (null == form) { +// logger.info("work title:{}, id:{}, can not find form:{}.", work.getTitle(), work.getId(), work.getForm()); +// return null; +// } +// WoForm wo = new WoForm(); +// form.copyTo(wo, "data", "mobileData"); +// wo.setData(form.getMobileDataOrData()); +// return wo; +// } +// +//} \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCountWithPerson.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCountWithPerson.java index c4e6aa47b87a18bc6141f1fdfadb4645c5db14fd..9a0fd8d5c92ba8793c8ce3ce40262c3a3c779e37 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCountWithPerson.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionCountWithPerson.java @@ -26,71 +26,73 @@ import com.x.processplatform.core.entity.content.Task; import com.x.processplatform.core.entity.content.TaskCompleted; import com.x.processplatform.core.entity.content.TaskCompleted_; -class ActionCountWithPerson extends ActionComplex { +class ActionCountWithPerson extends BaseAction { private static Logger logger = LoggerFactory.getLogger(ActionCountWithPerson.class); ActionResult execute(String credential) throws Exception { + + ActionResult result = new ActionResult<>(); + Wo wo = new Wo(); + String person = null; try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Wo wo = new Wo(); Business business = new Business(emc); - String person = business.organization().person().get(credential); - if (StringUtils.isNotEmpty(person)) { - CompletableFuture future_task = CompletableFuture.runAsync(() -> { - try { - wo.setTask(emc.countEqual(Task.class, Task.person_FIELDNAME, person)); - } catch (Exception e) { - logger.error(e); - } - }); - /* 已办仅取latest */ - CompletableFuture future_taskCompleted = CompletableFuture.runAsync(() -> { + person = business.organization().person().get(credential); + } + if (StringUtils.isNotEmpty(person)) { + final String dn = person; + CompletableFuture future_task = CompletableFuture.runAsync(() -> { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + wo.setTask(emc.countEqual(Task.class, Task.person_FIELDNAME, dn)); + } catch (Exception e) { + logger.error(e); + } + }); + /* 已办仅取latest */ + CompletableFuture future_taskCompleted = CompletableFuture.runAsync(() -> { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { EntityManager em; - try { - em = business.entityManagerContainer().get(TaskCompleted.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Long.class); - Root root = cq.from(TaskCompleted.class); - Predicate p = cb.equal(root.get(TaskCompleted_.person), person); - p = cb.and(p, cb.or(cb.equal(root.get(TaskCompleted_.latest), true), - cb.isNull(root.get(TaskCompleted_.latest)))); - wo.setTaskCompleted(em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult()); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_read = CompletableFuture.runAsync(() -> { - try { - wo.setRead(emc.countEqual(Read.class, Read.person_FIELDNAME, person)); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_readCompleted = CompletableFuture.runAsync(() -> { - try { - wo.setReadCompleted( - emc.countEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME, person)); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_review = CompletableFuture.runAsync(() -> { - try { - wo.setReview(emc.countEqual(Review.class, Review.person_FIELDNAME, person)); - } catch (Exception e) { - logger.error(e); - } - }); - future_task.get(300, TimeUnit.SECONDS); - future_taskCompleted.get(300, TimeUnit.SECONDS); - future_read.get(300, TimeUnit.SECONDS); - future_readCompleted.get(300, TimeUnit.SECONDS); - future_review.get(300, TimeUnit.SECONDS); - } - result.setData(wo); - return result; + em = emc.get(TaskCompleted.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Long.class); + Root root = cq.from(TaskCompleted.class); + Predicate p = cb.equal(root.get(TaskCompleted_.person), dn); + p = cb.and(p, cb.or(cb.equal(root.get(TaskCompleted_.latest), true), + cb.isNull(root.get(TaskCompleted_.latest)))); + wo.setTaskCompleted(em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult()); + } catch (Exception e) { + logger.error(e); + } + }); + CompletableFuture future_read = CompletableFuture.runAsync(() -> { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + wo.setRead(emc.countEqual(Read.class, Read.person_FIELDNAME, dn)); + } catch (Exception e) { + logger.error(e); + } + }); + CompletableFuture future_readCompleted = CompletableFuture.runAsync(() -> { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + wo.setReadCompleted(emc.countEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME, dn)); + } catch (Exception e) { + logger.error(e); + } + }); + CompletableFuture future_review = CompletableFuture.runAsync(() -> { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + wo.setReview(emc.countEqual(Review.class, Review.person_FIELDNAME, dn)); + } catch (Exception e) { + logger.error(e); + } + }); + future_task.get(300, TimeUnit.SECONDS); + future_taskCompleted.get(300, TimeUnit.SECONDS); + future_read.get(300, TimeUnit.SECONDS); + future_readCompleted.get(300, TimeUnit.SECONDS); + future_review.get(300, TimeUnit.SECONDS); } + result.setData(wo); + return result; } public static class Wo extends GsonPropertyObject { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionGetWithWorkOrWorkCompleted.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionGetWithWorkOrWorkCompleted.java index 50d92e1aae9db3338b513d43f14e8fda21c76159..a28072c196d10319c057b21de8a11fdf0fbbb029 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionGetWithWorkOrWorkCompleted.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionGetWithWorkOrWorkCompleted.java @@ -25,7 +25,6 @@ import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.core.entity.content.Data; import com.x.processplatform.core.entity.content.Read; @@ -42,37 +41,64 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction { private static Logger logger = LoggerFactory.getLogger(ActionGetWithWorkOrWorkCompleted.class); ActionResult execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, - new ExceptionEntityNotExist(workOrWorkCompleted))) { - throw new ExceptionAccessDenied(effectivePerson); - } + + ActionResult result = new ActionResult<>(); + CompletableFuture _wo = CompletableFuture.supplyAsync(() -> { Wo wo = null; - Work work = emc.find(workOrWorkCompleted, Work.class); - if (null != work) { - wo = this.work(business, effectivePerson, work); - } else { - wo = this.workCompleted(business, effectivePerson, emc.flag(workOrWorkCompleted, WorkCompleted.class)); + try { + Work work = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + work = emc.find(workOrWorkCompleted, Work.class); + } + if (null != work) { + wo = this.work(effectivePerson, work); + } else { + WorkCompleted workCompleted = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + workCompleted = emc.flag(workOrWorkCompleted, WorkCompleted.class); + } + if (null != workCompleted) { + wo = this.workCompleted(effectivePerson, workCompleted); + } + } + } catch (Exception e) { + logger.error(e); + } + return wo; + }); + + CompletableFuture _control = CompletableFuture.supplyAsync(() -> { + Boolean value = false; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + value = business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, + new ExceptionEntityNotExist(workOrWorkCompleted)); + } catch (Exception e) { + logger.error(e); } - result.setData(wo); - return result; + return value; + }); + + if (BooleanUtils.isFalse(_control.get())) { + throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted); } + + result.setData(_wo.get()); + return result; } - private Wo work(Business business, EffectivePerson effectivePerson, Work work) throws Exception { + private Wo work(EffectivePerson effectivePerson, Work work) throws Exception { Wo wo = new Wo(); wo.setWork(gson.toJsonTree(WoWork.copier.copy(work))); - wo.setActivity(this.activity(business, work)); + wo.setActivity(this.activity(work)); CompletableFuture future_data = CompletableFuture.supplyAsync(() -> { - return this.data(business, work.getJob()); + return this.data(work.getJob()); }); CompletableFuture> future_task = CompletableFuture.supplyAsync(() -> { - return this.tasks(business, work.getId()); + return this.tasks(work.getId()); }); CompletableFuture> future_read = CompletableFuture.supplyAsync(() -> { - return this.reads(business, work.getJob()); + return this.reads(work.getJob()); }); wo.setData(future_data.get()); wo.setTaskList(future_task.get()); @@ -82,8 +108,7 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction { return wo; } - private Wo workCompleted(Business business, EffectivePerson effectivePerson, WorkCompleted workCompleted) - throws Exception { + private Wo workCompleted(EffectivePerson effectivePerson, WorkCompleted workCompleted) throws Exception { Wo wo = new Wo(); wo.setWork(gson.toJsonTree(WoWorkCompleted.copier.copy(workCompleted))); CompletableFuture future_data = CompletableFuture.supplyAsync(() -> { @@ -91,11 +116,11 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction { /* 如果data已经merged */ return workCompleted.getProperties().getData(); } else { - return this.data(business, workCompleted.getJob()); + return this.data(workCompleted.getJob()); } }); CompletableFuture> future_read = CompletableFuture.supplyAsync(() -> { - return this.reads(business, workCompleted.getJob()); + return this.reads(workCompleted.getJob()); }); wo.setData(future_data.get()); wo.setReadList(future_read.get()); @@ -103,29 +128,26 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction { return wo; } - private Data data(Business business, String job) { - try { - try { - EntityManager em = business.entityManagerContainer().get(Item.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Item.class); - Root root = cq.from(Item.class); - Predicate p = cb.equal(root.get(Item_.bundle), job); - p = cb.and(p, cb.equal(root.get(Item_.itemCategory), ItemCategory.pp)); - List list = em.createQuery(cq.where(p)).getResultList(); - if (list.isEmpty()) { - return new Data(); + private Data data(String job) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + EntityManager em = business.entityManagerContainer().get(Item.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Item.class); + Root root = cq.from(Item.class); + Predicate p = cb.equal(root.get(Item_.bundle), job); + p = cb.and(p, cb.equal(root.get(Item_.itemCategory), ItemCategory.pp)); + List list = em.createQuery(cq.where(p)).getResultList(); + if (list.isEmpty()) { + return new Data(); + } else { + JsonElement jsonElement = itemConverter.assemble(list); + if (jsonElement.isJsonObject()) { + return gson.fromJson(jsonElement, Data.class); } else { - JsonElement jsonElement = itemConverter.assemble(list); - if (jsonElement.isJsonObject()) { - return gson.fromJson(jsonElement, Data.class); - } else { - /* 如果不是Object强制返回一个Map对象 */ - return new Data(); - } + /* 如果不是Object强制返回一个Map对象 */ + return new Data(); } - } catch (Exception e) { - throw new ExceptionData(e, job); } } catch (Exception e) { logger.error(e); @@ -133,32 +155,34 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction { return null; } - private List tasks(Business business, String workId) { - try { - return WoTask.copier - .copy(business.entityManagerContainer().listEqual(Task.class, Task.work_FIELDNAME, workId)); + private List tasks(String workId) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + return WoTask.copier.copy(emc.listEqual(Task.class, Task.work_FIELDNAME, workId)); } catch (Exception e) { logger.error(e); } return null; } - private List reads(Business business, String job) { - try { - return WoRead.copier.copy(business.entityManagerContainer().listEqual(Read.class, Read.job_FIELDNAME, job)); + private List reads(String job) { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + return WoRead.copier.copy(emc.listEqual(Read.class, Read.job_FIELDNAME, job)); } catch (Exception e) { logger.error(e); } return null; } - private WoActivity activity(Business business, Work work) throws Exception { + private WoActivity activity(Work work) throws Exception { WoActivity woActivity = new WoActivity(); - Activity activity = business.getActivity(work); - if (null != activity) { - activity.copyTo(woActivity); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + Activity activity = business.getActivity(work); + if (null != activity) { + activity.copyTo(woActivity); + } + return woActivity; } - return woActivity; } private void setCurrentTaskIndex(EffectivePerson effectivePerson, Wo wo) { @@ -274,8 +298,7 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction { private static final long serialVersionUID = -1772642962691214007L; static WrapCopier copier = WrapCopierFactory.wo(WorkCompleted.class, - WoWorkCompleted.class, null, ListTools.toList(JpaObject.FieldsInvisible, - WorkCompleted.formData_FIELDNAME, WorkCompleted.formMobileData_FIELDNAME)); + WoWorkCompleted.class, null, JpaObject.FieldsInvisible); } public static class WoTask extends Task { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionRefer.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionRefer.java index b5a1df44e3629398585bd522b4bdb3b45ed524f3..8336989f7d9d1804f94a72670236d87513036b01 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionRefer.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/ActionRefer.java @@ -28,12 +28,11 @@ class ActionRefer extends BaseAction { private static Logger logger = LoggerFactory.getLogger(ActionRefer.class); ActionResult execute(EffectivePerson effectivePerson, String workId) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - TimeStamp stamp = new TimeStamp(); + ActionResult result = new ActionResult<>(); Wo wo = new Wo(); CompletableFuture future_task = CompletableFuture.runAsync(() -> { - try { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { List os = emc.listEqualAndEqual(Task.class, Task.work_FIELDNAME, workId, Task.person_FIELDNAME, effectivePerson.getDistinguishedName()); wo.getTaskList().addAll(WoTask.copier.copy(os)); @@ -43,7 +42,7 @@ class ActionRefer extends BaseAction { } }); CompletableFuture future_taskCompleted = CompletableFuture.runAsync(() -> { - try { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { List os = emc.listEqualAndEqual(TaskCompleted.class, TaskCompleted.work_FIELDNAME, workId, TaskCompleted.person_FIELDNAME, effectivePerson.getDistinguishedName()); wo.getTaskCompletedList().addAll(WoTaskCompleted.copier.copy(os)); @@ -53,7 +52,7 @@ class ActionRefer extends BaseAction { } }); CompletableFuture future_read = CompletableFuture.runAsync(() -> { - try { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { List os = emc.listEqualAndEqual(Read.class, Read.work_FIELDNAME, workId, Read.person_FIELDNAME, effectivePerson.getDistinguishedName()); wo.getReadList().addAll(WoRead.copier.copy(os)); @@ -63,7 +62,7 @@ class ActionRefer extends BaseAction { } }); CompletableFuture future_readCompleted = CompletableFuture.runAsync(() -> { - try { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { List os = emc.listEqualAndEqual(ReadCompleted.class, ReadCompleted.work_FIELDNAME, workId, ReadCompleted.person_FIELDNAME, effectivePerson.getDistinguishedName()); wo.getReadCompletedList().addAll(WoReadCompleted.copier.copy(os)); @@ -73,7 +72,7 @@ class ActionRefer extends BaseAction { } }); CompletableFuture future_review = CompletableFuture.runAsync(() -> { - try { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { List os = emc.listEqualAndEqual(Review.class, Review.work_FIELDNAME, workId, Review.person_FIELDNAME, effectivePerson.getDistinguishedName()); wo.getReviewList().addAll(WoReview.copier.copy(os)); @@ -90,7 +89,6 @@ class ActionRefer extends BaseAction { result.setData(wo); return result; - } } public static class Wo extends GsonPropertyObject { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/BaseAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/BaseAction.java index 089a347bef345176c3251707678ee0b7dbcd2756..ca71252630af26424f30a6f16e443ddf0170a311 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/BaseAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/BaseAction.java @@ -4,10 +4,6 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.Date; import java.util.List; -import java.util.Objects; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; import javax.persistence.EntityManager; import javax.persistence.criteria.CriteriaBuilder; @@ -15,10 +11,7 @@ import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; -import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.collections4.ListUtils; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.StringUtils; import com.google.gson.JsonElement; import com.x.base.core.container.EntityManagerContainer; @@ -33,24 +26,19 @@ import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.jaxrs.StandardJaxrsAction; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; -import com.x.base.core.project.organization.OrganizationDefinition; import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.core.entity.content.Attachment; import com.x.processplatform.core.entity.content.Data; import com.x.processplatform.core.entity.content.Read; import com.x.processplatform.core.entity.content.ReadCompleted; -import com.x.processplatform.core.entity.content.Review; import com.x.processplatform.core.entity.content.Task; import com.x.processplatform.core.entity.content.TaskCompleted; import com.x.processplatform.core.entity.content.Work; import com.x.processplatform.core.entity.content.WorkLog; import com.x.processplatform.core.entity.content.Work_; -import com.x.processplatform.core.entity.element.Activity; -import com.x.processplatform.core.entity.element.ActivityType; import com.x.processplatform.core.entity.element.Application; import com.x.processplatform.core.entity.element.Form; -import com.x.processplatform.core.entity.element.Manual; import com.x.processplatform.core.entity.element.Process; import com.x.query.core.entity.Item; import com.x.query.core.entity.Item_; @@ -593,299 +581,299 @@ abstract class BaseAction extends StandardJaxrsAction { } - protected T get(Business business, EffectivePerson effectivePerson, Work work, Class cls) - throws Exception { - T t = cls.newInstance(); - List woTaskCompleteds = new ArrayList<>(); - List woReadCompleteds = new ArrayList<>(); - Application application = null; - Process process = null; - Activity activity = null; - Long reviewCount = 0L; - - CompletableFuture future_tasks = CompletableFuture.runAsync(() -> { - try { - List os = business.entityManagerContainer() - .listEqual(Task.class, WoTask.job_FIELDNAME, work.getJob()).stream() - .sorted(Comparator.comparing(Task::getStartTime, Comparator.nullsLast(Date::compareTo))) - .collect(Collectors.toList()); - t.getTaskList().addAll(WoTask.copier.copy(os)); - t.setCurrentTaskIndex(-1); - for (int i = 0; i < t.getTaskList().size(); i++) { - if (StringUtils.equals(t.getTaskList().get(i).getPerson(), - effectivePerson.getDistinguishedName())) { - t.setCurrentTaskIndex(i); - break; - } - } - } catch (Exception e) { - logger.error(e); - } - }); - - CompletableFuture future_taskCompleteds = CompletableFuture.runAsync(() -> { - try { - List os = business.entityManagerContainer() - .listEqual(TaskCompleted.class, TaskCompleted.job_FIELDNAME, work.getJob()).stream() - .sorted(Comparator.comparing(TaskCompleted::getStartTime, - Comparator.nullsLast(Date::compareTo))) - .collect(Collectors.toList()); - woTaskCompleteds.addAll(WoTaskCompleted.copier.copy(os)); - } catch (Exception e) { - logger.error(e); - } - }); - - CompletableFuture future_reads = CompletableFuture.runAsync(() -> { - try { - List os = business.entityManagerContainer() - .listEqual(Read.class, Read.job_FIELDNAME, work.getJob()).stream() - .sorted(Comparator.comparing(Read::getStartTime, Comparator.nullsLast(Date::compareTo))) - .collect(Collectors.toList()); - t.getReadList().addAll(WoRead.copier.copy(os)); - t.setCurrentReadIndex(-1); - for (int i = 0; i < t.getReadList().size(); i++) { - if (StringUtils.equals(t.getReadList().get(i).getPerson(), - effectivePerson.getDistinguishedName())) { - t.setCurrentReadIndex(i); - break; - } - } - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_readCompleteds = CompletableFuture.runAsync(() -> { - try { - List os = business.entityManagerContainer() - .listEqual(ReadCompleted.class, ReadCompleted.job_FIELDNAME, work.getJob()).stream() - .sorted(Comparator.comparing(ReadCompleted::getStartTime, - Comparator.nullsLast(Date::compareTo))) - .collect(Collectors.toList()); - woReadCompleteds.addAll(WoReadCompleted.copier.copy(os)); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_attachments = CompletableFuture.runAsync(() -> { - try { - List os = business.entityManagerContainer() - .listEqual(Attachment.class, Attachment.job_FIELDNAME, work.getJob()).stream() - .sorted(Comparator.comparing(Attachment::getCreateTime, Comparator.nullsLast(Date::compareTo))) - .collect(Collectors.toList()); - t.setAttachmentList(WoAttachment.copier.copy(os)); - /* 创建附件类型字段 */ - // for (WoAttachment a : t.getAttachmentList()) { - // a.contentType(); - // } - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_workLogs = CompletableFuture.runAsync(() -> { - try { - List os = business.entityManagerContainer() - .listEqual(WorkLog.class, WorkLog.job_FIELDNAME, work.getJob()).stream() - .sorted(Comparator.comparing(WorkLog::getCreateTime, Comparator.nullsLast(Date::compareTo))) - .collect(Collectors.toList()); - t.setWorkLogList(WoWorkLog.copier.copy(os)); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_data = CompletableFuture.runAsync(() -> { - try { - t.setData(this.loadData(business, work)); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_application = CompletableFuture.supplyAsync(() -> { - Application o = null; - try { - o = business.application().pick(work.getApplication()); - } catch (Exception e) { - logger.error(e); - } - return o; - }); - CompletableFuture future_process = CompletableFuture.supplyAsync(() -> { - Process o = null; - try { - o = business.process().pick(work.getProcess()); - } catch (Exception e) { - logger.error(e); - } - return o; - }); - CompletableFuture future_activity = CompletableFuture.supplyAsync(() -> { - Activity o = null; - try { - o = business.getActivity(work); - if (null != o) { - /** 这里由于Activity是个抽象类,没有具体的Field字段,所以无法用WrapCoiper进行拷贝 */ - WoActivity woActivity = new WoActivity(); - o.copyTo(woActivity); - t.setActivity(woActivity); - } - } catch (Exception e) { - logger.error(e); - } - return o; - }); - CompletableFuture future_reviewCount = CompletableFuture.supplyAsync(() -> { - Long o = 0L; - try { - o = business.entityManagerContainer().countEqualAndEqual(Review.class, Review.person_FIELDNAME, - effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, work.getJob()); - } catch (Exception e) { - logger.error(e); - } - return o; - }); - future_tasks.get(300, TimeUnit.SECONDS); - future_taskCompleteds.get(300, TimeUnit.SECONDS); - future_reads.get(300, TimeUnit.SECONDS); - future_readCompleteds.get(300, TimeUnit.SECONDS); - future_attachments.get(300, TimeUnit.SECONDS); - future_workLogs.get(300, TimeUnit.SECONDS); - future_data.get(300, TimeUnit.SECONDS); - application = future_application.get(300, TimeUnit.SECONDS); - process = future_process.get(300, TimeUnit.SECONDS); - activity = future_activity.get(300, TimeUnit.SECONDS); - reviewCount = future_reviewCount.get(300, TimeUnit.SECONDS); - - t.setWork(WoWork.copier.copy(work)); - this.arrangeWorkLog(business, t, woTaskCompleteds, woReadCompleteds); - // this.referenceActivityTaskReadControl(business, effectivePerson, work, t); - - WoControl control = new WoControl(); - /** 工作是否可以打开(管理员 或 有task,taskCompleted,read,readCompleted,review的人) */ - control.setAllowVisit(false); - /** 工作是否可以流转(有task的人) */ - control.setAllowProcessing(false); - /** 工作是否可以处理待阅(有read的人) */ - control.setAllowReadProcessing(false); - /** 工作是否可保存(管理员 或者 有本人的task) */ - control.setAllowSave(false); - /** 工作是否可重置(有本人待办 并且 活动设置允许重置 */ - control.setAllowReset(false); - /** 工作是否可以撤回(当前人是上一个处理人 并且 还没有其他人处理过) */ - control.setAllowRetract(false); - /** 工作是否可调度(管理员 并且 此活动在流程设计中允许调度) */ - control.setAllowReroute(false); - /** 工作是否可删除(管理员 或者 此活动在流程设计中允许删除且当前待办人是文件的创建者) */ - control.setAllowDelete(false); - /** 是否可以添加拆分分支 */ - control.setAllowAddSplit(false); - /** 设置allowVisit */ - if ((t.getCurrentTaskIndex() > -1) || (t.getCurrentReadIndex() > -1) || (woTaskCompleteds.stream() - .filter(o -> StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())).count() > 0) - || (woReadCompleteds.stream() - .filter(o -> StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())) - .count() > 0) - || (reviewCount > 0)) { - control.setAllowVisit(true); - } else if (effectivePerson.isPerson(work.getCreatorPerson())) { - control.setAllowVisit(true); - } else if (business.canManageApplicationOrProcess(effectivePerson, application, process)) { - control.setAllowVisit(true); - } - /** 设置allowProcessing */ - if (t.getCurrentTaskIndex() > -1) { - control.setAllowProcessing(true); - } - /** 设置allowReadProcessing */ - if (t.getCurrentReadIndex() > -1) { - control.setAllowReadProcessing(true); - } - /** 设置 allowSave */ - if (t.getCurrentTaskIndex() > -1) { - control.setAllowSave(true); - } else if (business.canManageApplicationOrProcess(effectivePerson, application, process)) { - control.setAllowSave(true); - } - /** 设置 allowReset */ - if (BooleanUtils.isTrue((Boolean) PropertyUtils.getProperty(t.getActivity(), Manual.allowReset_FIELDNAME)) - && (t.getCurrentTaskIndex() > -1)) { - control.setAllowReset(true); - } - /** 设置 allowRetract */ - if (Objects.equals(activity.getActivityType(), ActivityType.manual) - && BooleanUtils.isTrue(activity.get(Manual.allowRetract_FIELDNAME, Boolean.class))) { - /** 标志文件还没有处理过 */ - if (woTaskCompleteds.stream() - .filter(o -> StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName()) - && StringUtils.equals(o.getActivityToken(), work.getActivityToken())) - .count() == 0) { - /** 找到到达当前活动的workLog */ - WoWorkLog currentWorkLog = t.getWorkLogList().stream() - .filter(o -> StringUtils.equals(o.getArrivedActivityToken(), work.getActivityToken())) - .findFirst().orElse(null); - if (null != currentWorkLog) { - /** 查找上一个环节的已办,如果只有一个,且正好是当前人的,那么可以召回 */ - if (woTaskCompleteds.stream().filter( - o -> StringUtils.equals(o.getActivityToken(), currentWorkLog.getFromActivityToken())) - .count() == 1) { - if (woTaskCompleteds.stream().filter( - o -> StringUtils.equals(currentWorkLog.getFromActivityToken(), o.getActivityToken()) - && StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())) - .count() == 1) { - control.setAllowRetract(true); - } - } - } - } - } - /** 设置 allowReroute */ - if (BooleanUtils.isTrue(activity.getAllowReroute())) { - /** 如果活动设置了可以调度 */ - if (effectivePerson.isManager()) { - /** 管理员可以调度 */ - control.setAllowReroute(true); - } else if (business.organization().person().hasRole(effectivePerson, - OrganizationDefinition.ProcessPlatformManager)) { - /** 有流程管理角色的可以 */ - control.setAllowReroute(true); - } else if ((null != process) && effectivePerson.isPerson(process.getControllerList())) { - /** 如果是流程的管理员那么可以调度 */ - control.setAllowReroute(true); - } else if ((null != application) && effectivePerson.isPerson(application.getControllerList())) { - /** 如果是应用的管理员那么可以调度 */ - control.setAllowReroute(true); - } - } - /* 设置 allowDelete */ - if (business.canManageApplicationOrProcess(effectivePerson, application, process)) { - control.setAllowDelete(true); - } else if (Objects.equals(activity.getActivityType(), ActivityType.manual) - && BooleanUtils.isTrue(activity.get(Manual.allowDeleteWork_FIELDNAME, Boolean.class))) { - if (t.getCurrentTaskIndex() > -1 - || StringUtils.equals(work.getCreatorPerson(), effectivePerson.getDistinguishedName())) { - control.setAllowDelete(true); - } - } - /* 设置 allowAddSplit */ - if (Objects.equals(activity.getActivityType(), ActivityType.manual) - && BooleanUtils.isTrue(activity.get(Manual.allowAddSplit_FIELDNAME, Boolean.class))) { - control.setAllowAddSplit(true); - } - t.setControl(control); - return t; - } - - private void arrangeWorkLog(Business business, AbstractWo wo, List woTaskCompleteds, - List woReadCompleteds) throws Exception { - ListTools.groupStick(wo.getWorkLogList(), wo.getTaskList(), WorkLog.fromActivityToken_FIELDNAME, - Task.activityToken_FIELDNAME, "taskList"); - ListTools.groupStick(wo.getWorkLogList(), woTaskCompleteds, WorkLog.fromActivityToken_FIELDNAME, - TaskCompleted.activityToken_FIELDNAME, "taskCompletedList"); - ListTools.groupStick(wo.getWorkLogList(), wo.getReadList(), WorkLog.fromActivityToken_FIELDNAME, - Read.activityToken_FIELDNAME, "readList"); - ListTools.groupStick(wo.getWorkLogList(), woReadCompleteds, WorkLog.fromActivityToken_FIELDNAME, - ReadCompleted.activityToken_FIELDNAME, "readCompletedList"); - } - +// protected T get(Business business, EffectivePerson effectivePerson, Work work, Class cls) +// throws Exception { +// T t = cls.newInstance(); +// List woTaskCompleteds = new ArrayList<>(); +// List woReadCompleteds = new ArrayList<>(); +// Application application = null; +// Process process = null; +// Activity activity = null; +// Long reviewCount = 0L; +// +// CompletableFuture111111 future_tasks = CompletableFuture111111.runAsync(() -> { +// try { +// List os = business.entityManagerContainer() +// .listEqual(Task.class, WoTask.job_FIELDNAME, work.getJob()).stream() +// .sorted(Comparator.comparing(Task::getStartTime, Comparator.nullsLast(Date::compareTo))) +// .collect(Collectors.toList()); +// t.getTaskList().addAll(WoTask.copier.copy(os)); +// t.setCurrentTaskIndex(-1); +// for (int i = 0; i < t.getTaskList().size(); i++) { +// if (StringUtils.equals(t.getTaskList().get(i).getPerson(), +// effectivePerson.getDistinguishedName())) { +// t.setCurrentTaskIndex(i); +// break; +// } +// } +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// +// CompletableFuture111111 future_taskCompleteds = CompletableFuture111111.runAsync(() -> { +// try { +// List os = business.entityManagerContainer() +// .listEqual(TaskCompleted.class, TaskCompleted.job_FIELDNAME, work.getJob()).stream() +// .sorted(Comparator.comparing(TaskCompleted::getStartTime, +// Comparator.nullsLast(Date::compareTo))) +// .collect(Collectors.toList()); +// woTaskCompleteds.addAll(WoTaskCompleted.copier.copy(os)); +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// +// CompletableFuture111111 future_reads = CompletableFuture111111.runAsync(() -> { +// try { +// List os = business.entityManagerContainer() +// .listEqual(Read.class, Read.job_FIELDNAME, work.getJob()).stream() +// .sorted(Comparator.comparing(Read::getStartTime, Comparator.nullsLast(Date::compareTo))) +// .collect(Collectors.toList()); +// t.getReadList().addAll(WoRead.copier.copy(os)); +// t.setCurrentReadIndex(-1); +// for (int i = 0; i < t.getReadList().size(); i++) { +// if (StringUtils.equals(t.getReadList().get(i).getPerson(), +// effectivePerson.getDistinguishedName())) { +// t.setCurrentReadIndex(i); +// break; +// } +// } +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// CompletableFuture111111 future_readCompleteds = CompletableFuture111111.runAsync(() -> { +// try { +// List os = business.entityManagerContainer() +// .listEqual(ReadCompleted.class, ReadCompleted.job_FIELDNAME, work.getJob()).stream() +// .sorted(Comparator.comparing(ReadCompleted::getStartTime, +// Comparator.nullsLast(Date::compareTo))) +// .collect(Collectors.toList()); +// woReadCompleteds.addAll(WoReadCompleted.copier.copy(os)); +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// CompletableFuture111111 future_attachments = CompletableFuture111111.runAsync(() -> { +// try { +// List os = business.entityManagerContainer() +// .listEqual(Attachment.class, Attachment.job_FIELDNAME, work.getJob()).stream() +// .sorted(Comparator.comparing(Attachment::getCreateTime, Comparator.nullsLast(Date::compareTo))) +// .collect(Collectors.toList()); +// t.setAttachmentList(WoAttachment.copier.copy(os)); +// /* 创建附件类型字段 */ +// // for (WoAttachment a : t.getAttachmentList()) { +// // a.contentType(); +// // } +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// CompletableFuture111111 future_workLogs = CompletableFuture111111.runAsync(() -> { +// try { +// List os = business.entityManagerContainer() +// .listEqual(WorkLog.class, WorkLog.job_FIELDNAME, work.getJob()).stream() +// .sorted(Comparator.comparing(WorkLog::getCreateTime, Comparator.nullsLast(Date::compareTo))) +// .collect(Collectors.toList()); +// t.setWorkLogList(WoWorkLog.copier.copy(os)); +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// CompletableFuture111111 future_data = CompletableFuture111111.runAsync(() -> { +// try { +// t.setData(this.loadData(business, work)); +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// CompletableFuture111111 future_application = CompletableFuture111111.supplyAsync(() -> { +// Application o = null; +// try { +// o = business.application().pick(work.getApplication()); +// } catch (Exception e) { +// logger.error(e); +// } +// return o; +// }); +// CompletableFuture111111 future_process = CompletableFuture111111.supplyAsync(() -> { +// Process o = null; +// try { +// o = business.process().pick(work.getProcess()); +// } catch (Exception e) { +// logger.error(e); +// } +// return o; +// }); +// CompletableFuture111111 future_activity = CompletableFuture111111.supplyAsync(() -> { +// Activity o = null; +// try { +// o = business.getActivity(work); +// if (null != o) { +// /** 这里由于Activity是个抽象类,没有具体的Field字段,所以无法用WrapCoiper进行拷贝 */ +// WoActivity woActivity = new WoActivity(); +// o.copyTo(woActivity); +// t.setActivity(woActivity); +// } +// } catch (Exception e) { +// logger.error(e); +// } +// return o; +// }); +// CompletableFuture111111 future_reviewCount = CompletableFuture111111.supplyAsync(() -> { +// Long o = 0L; +// try { +// o = business.entityManagerContainer().countEqualAndEqual(Review.class, Review.person_FIELDNAME, +// effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, work.getJob()); +// } catch (Exception e) { +// logger.error(e); +// } +// return o; +// }); +// future_tasks.get(300, TimeUnit.SECONDS); +// future_taskCompleteds.get(300, TimeUnit.SECONDS); +// future_reads.get(300, TimeUnit.SECONDS); +// future_readCompleteds.get(300, TimeUnit.SECONDS); +// future_attachments.get(300, TimeUnit.SECONDS); +// future_workLogs.get(300, TimeUnit.SECONDS); +// future_data.get(300, TimeUnit.SECONDS); +// application = future_application.get(300, TimeUnit.SECONDS); +// process = future_process.get(300, TimeUnit.SECONDS); +// activity = future_activity.get(300, TimeUnit.SECONDS); +// reviewCount = future_reviewCount.get(300, TimeUnit.SECONDS); +// +// t.setWork(WoWork.copier.copy(work)); +// this.arrangeWorkLog(business, t, woTaskCompleteds, woReadCompleteds); +// // this.referenceActivityTaskReadControl(business, effectivePerson, work, t); +// +// WoControl control = new WoControl(); +// /** 工作是否可以打开(管理员 或 有task,taskCompleted,read,readCompleted,review的人) */ +// control.setAllowVisit(false); +// /** 工作是否可以流转(有task的人) */ +// control.setAllowProcessing(false); +// /** 工作是否可以处理待阅(有read的人) */ +// control.setAllowReadProcessing(false); +// /** 工作是否可保存(管理员 或者 有本人的task) */ +// control.setAllowSave(false); +// /** 工作是否可重置(有本人待办 并且 活动设置允许重置 */ +// control.setAllowReset(false); +// /** 工作是否可以撤回(当前人是上一个处理人 并且 还没有其他人处理过) */ +// control.setAllowRetract(false); +// /** 工作是否可调度(管理员 并且 此活动在流程设计中允许调度) */ +// control.setAllowReroute(false); +// /** 工作是否可删除(管理员 或者 此活动在流程设计中允许删除且当前待办人是文件的创建者) */ +// control.setAllowDelete(false); +// /** 是否可以添加拆分分支 */ +// control.setAllowAddSplit(false); +// /** 设置allowVisit */ +// if ((t.getCurrentTaskIndex() > -1) || (t.getCurrentReadIndex() > -1) || (woTaskCompleteds.stream() +// .filter(o -> StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())).count() > 0) +// || (woReadCompleteds.stream() +// .filter(o -> StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())) +// .count() > 0) +// || (reviewCount > 0)) { +// control.setAllowVisit(true); +// } else if (effectivePerson.isPerson(work.getCreatorPerson())) { +// control.setAllowVisit(true); +// } else if (business.canManageApplicationOrProcess(effectivePerson, application, process)) { +// control.setAllowVisit(true); +// } +// /** 设置allowProcessing */ +// if (t.getCurrentTaskIndex() > -1) { +// control.setAllowProcessing(true); +// } +// /** 设置allowReadProcessing */ +// if (t.getCurrentReadIndex() > -1) { +// control.setAllowReadProcessing(true); +// } +// /** 设置 allowSave */ +// if (t.getCurrentTaskIndex() > -1) { +// control.setAllowSave(true); +// } else if (business.canManageApplicationOrProcess(effectivePerson, application, process)) { +// control.setAllowSave(true); +// } +// /** 设置 allowReset */ +// if (BooleanUtils.isTrue((Boolean) PropertyUtils.getProperty(t.getActivity(), Manual.allowReset_FIELDNAME)) +// && (t.getCurrentTaskIndex() > -1)) { +// control.setAllowReset(true); +// } +// /** 设置 allowRetract */ +// if (Objects.equals(activity.getActivityType(), ActivityType.manual) +// && BooleanUtils.isTrue(activity.get(Manual.allowRetract_FIELDNAME, Boolean.class))) { +// /** 标志文件还没有处理过 */ +// if (woTaskCompleteds.stream() +// .filter(o -> StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName()) +// && StringUtils.equals(o.getActivityToken(), work.getActivityToken())) +// .count() == 0) { +// /** 找到到达当前活动的workLog */ +// WoWorkLog currentWorkLog = t.getWorkLogList().stream() +// .filter(o -> StringUtils.equals(o.getArrivedActivityToken(), work.getActivityToken())) +// .findFirst().orElse(null); +// if (null != currentWorkLog) { +// /** 查找上一个环节的已办,如果只有一个,且正好是当前人的,那么可以召回 */ +// if (woTaskCompleteds.stream().filter( +// o -> StringUtils.equals(o.getActivityToken(), currentWorkLog.getFromActivityToken())) +// .count() == 1) { +// if (woTaskCompleteds.stream().filter( +// o -> StringUtils.equals(currentWorkLog.getFromActivityToken(), o.getActivityToken()) +// && StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())) +// .count() == 1) { +// control.setAllowRetract(true); +// } +// } +// } +// } +// } +// /** 设置 allowReroute */ +// if (BooleanUtils.isTrue(activity.getAllowReroute())) { +// /** 如果活动设置了可以调度 */ +// if (effectivePerson.isManager()) { +// /** 管理员可以调度 */ +// control.setAllowReroute(true); +// } else if (business.organization().person().hasRole(effectivePerson, +// OrganizationDefinition.ProcessPlatformManager)) { +// /** 有流程管理角色的可以 */ +// control.setAllowReroute(true); +// } else if ((null != process) && effectivePerson.isPerson(process.getControllerList())) { +// /** 如果是流程的管理员那么可以调度 */ +// control.setAllowReroute(true); +// } else if ((null != application) && effectivePerson.isPerson(application.getControllerList())) { +// /** 如果是应用的管理员那么可以调度 */ +// control.setAllowReroute(true); +// } +// } +// /* 设置 allowDelete */ +// if (business.canManageApplicationOrProcess(effectivePerson, application, process)) { +// control.setAllowDelete(true); +// } else if (Objects.equals(activity.getActivityType(), ActivityType.manual) +// && BooleanUtils.isTrue(activity.get(Manual.allowDeleteWork_FIELDNAME, Boolean.class))) { +// if (t.getCurrentTaskIndex() > -1 +// || StringUtils.equals(work.getCreatorPerson(), effectivePerson.getDistinguishedName())) { +// control.setAllowDelete(true); +// } +// } +// /* 设置 allowAddSplit */ +// if (Objects.equals(activity.getActivityType(), ActivityType.manual) +// && BooleanUtils.isTrue(activity.get(Manual.allowAddSplit_FIELDNAME, Boolean.class))) { +// control.setAllowAddSplit(true); +// } +// t.setControl(control); +// return t; +// } +// +// private void arrangeWorkLog(Business business, AbstractWo wo, List woTaskCompleteds, +// List woReadCompleteds) throws Exception { +// ListTools.groupStick(wo.getWorkLogList(), wo.getTaskList(), WorkLog.fromActivityToken_FIELDNAME, +// Task.activityToken_FIELDNAME, "taskList"); +// ListTools.groupStick(wo.getWorkLogList(), woTaskCompleteds, WorkLog.fromActivityToken_FIELDNAME, +// TaskCompleted.activityToken_FIELDNAME, "taskCompletedList"); +// ListTools.groupStick(wo.getWorkLogList(), wo.getReadList(), WorkLog.fromActivityToken_FIELDNAME, +// Read.activityToken_FIELDNAME, "readList"); +// ListTools.groupStick(wo.getWorkLogList(), woReadCompleteds, WorkLog.fromActivityToken_FIELDNAME, +// ReadCompleted.activityToken_FIELDNAME, "readCompletedList"); +// } +// /* 启动工作时查找有没有此人创建的工作并且没有流转的 */ protected String latest(Business business, Process process, String identity) throws Exception { EntityManagerContainer emc = business.entityManagerContainer(); diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/V2GetWorkOrWorkCompleted.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/V2GetWorkOrWorkCompleted.java index 9acb64ad67f36e3a9c3f67a75a794049a00ccb9f..3fea68c12bf3cc2e675a210f391a72055941ecc9 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/V2GetWorkOrWorkCompleted.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/V2GetWorkOrWorkCompleted.java @@ -35,6 +35,7 @@ import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.core.entity.content.Attachment; import com.x.processplatform.core.entity.content.Data; import com.x.processplatform.core.entity.content.Read; +import com.x.processplatform.core.entity.content.Record; import com.x.processplatform.core.entity.content.Task; import com.x.processplatform.core.entity.content.Work; import com.x.processplatform.core.entity.content.WorkCompleted; @@ -50,48 +51,86 @@ class V2GetWorkOrWorkCompleted extends BaseAction { private static Logger logger = LoggerFactory.getLogger(V2GetWorkOrWorkCompleted.class); ActionResult execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, - new ExceptionEntityNotExist(workOrWorkCompleted))) { - throw new ExceptionAccessDenied(effectivePerson); - } + ActionResult result = new ActionResult<>(); + + CompletableFuture _wo = CompletableFuture.supplyAsync(() -> { Wo wo = null; - Work work = business.entityManagerContainer().find(workOrWorkCompleted, Work.class); - if (null != work) { - wo = this.work(effectivePerson, business, work); - } else { - WorkCompleted workCompleted = emc.flag(workOrWorkCompleted, WorkCompleted.class); - if (null != workCompleted) { - wo = this.workCompleted(business, effectivePerson, workCompleted); + Work work = null; + try { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + work = emc.find(workOrWorkCompleted, Work.class); } + if (null != work) { + wo = this.work(effectivePerson, work); + } else { + WorkCompleted workCompleted = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + workCompleted = emc.flag(workOrWorkCompleted, WorkCompleted.class); + if (null != workCompleted) { + wo = this.workCompleted(effectivePerson, workCompleted); + } + } + } + } catch (Exception e) { + logger.error(e); } - result.setData(wo); - return result; + return wo; + }); + + CompletableFuture _control = CompletableFuture.supplyAsync(() -> { + Boolean value = false; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + value = business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, + new ExceptionEntityNotExist(workOrWorkCompleted)); + } catch (Exception e) { + logger.error(e); + } + return value; + }); + + if (BooleanUtils.isFalse(_control.get())) { + throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted); } + result.setData(_wo.get()); + return result; } - private Wo work(EffectivePerson effectivePerson, Business business, Work work) - throws InterruptedException, ExecutionException { + private Wo work(EffectivePerson effectivePerson, Work work) throws InterruptedException, ExecutionException { Wo wo = new Wo(); - // Date s = new Date(); - CompletableFuture.allOf(workJson(work, wo), activity(business, work, wo), data(business, work, wo), - task(effectivePerson, business, work, wo), read(effectivePerson, business, work.getJob(), wo), - creatorIdentity(business, work.getCreatorIdentity(), wo), - creatorPerson(business, work.getCreatorPerson(), wo), creatorUnit(business, work.getCreatorUnit(), wo), - attachment(effectivePerson, business, work.getJob(), wo)).get(); - // System.out.println("!!!!!!!!!!!!!!!!work:" + ((new Date()).getTime() - - // s.getTime())); + CompletableFuture + .allOf(workJson(work, wo), activity(work, wo), data(work, wo), task(effectivePerson, work, wo), + read(effectivePerson, work.getJob(), wo), creatorIdentity(work.getCreatorIdentity(), wo), + creatorPerson(work.getCreatorPerson(), wo), creatorUnit(work.getCreatorUnit(), wo), + attachment(effectivePerson, work.getJob(), wo), record(effectivePerson, work.getJob(), wo)) + .get(); + for (WoTask woTask : wo.getTaskList()) { + wo.getRecordList().add(taskToRecord(woTask)); + } return wo; } - private CompletableFuture data(Business business, Work work, Wo wo) { + private WoRecord taskToRecord(WoTask woTask) { + WoRecord o = new WoRecord(); + o.setType(Record.TYPE_CURRENTTASK); + o.setFromActivity(woTask.getActivity()); + o.setFromActivityAlias(woTask.getActivityAlias()); + o.setFromActivityName(woTask.getActivityName()); + o.setFromActivityToken(woTask.getActivityToken()); + o.setFromActivityType(woTask.getActivityType()); + o.setPerson(woTask.getPerson()); + o.setIdentity(o.getIdentity()); + o.setUnit(woTask.getUnit()); + o.getProperties().setStartTime(woTask.getStartTime()); + o.getProperties().setEmpowerFromIdentity(woTask.getEmpowerFromIdentity()); + return o; + } + + private CompletableFuture data(Work work, Wo wo) { return CompletableFuture.runAsync(() -> { - try { - // Date s = new Date(); - List list = business.entityManagerContainer().listEqualAndEqual(Item.class, - DataItem.bundle_FIELDNAME, work.getJob(), DataItem.itemCategory_FIELDNAME, ItemCategory.pp); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + List list = emc.listEqualAndEqual(Item.class, DataItem.bundle_FIELDNAME, work.getJob(), + DataItem.itemCategory_FIELDNAME, ItemCategory.pp); if (!list.isEmpty()) { JsonElement jsonElement = itemConverter.assemble(list); // 必须是Object对象 @@ -99,56 +138,76 @@ class V2GetWorkOrWorkCompleted extends BaseAction { wo.setData(gson.fromJson(jsonElement, Data.class)); } } - // System.out.println("!!!!!!!!!!!!!!!!data:" + ((new Date()).getTime() - - // s.getTime())); } catch (Exception e) { logger.error(e); } }); } - private CompletableFuture activity(Business business, Work work, Wo wo) { + private CompletableFuture record(EffectivePerson effectivePerson, String job, Wo wo) { return CompletableFuture.runAsync(() -> { - try { - // Date s = new Date(); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + wo.setRecordList(emc.fetchEqual(Record.class, WoRecord.copier, Record.job_FIELDNAME, job).stream() + .sorted(Comparator.comparing(WoRecord::getOrder)).collect(Collectors.toList())); + } catch (Exception e) { + logger.error(e); + } + }); + } + + private CompletableFuture completedRecord(EffectivePerson effectivePerson, WorkCompleted workCompleted, + Wo wo) { + return CompletableFuture.runAsync(() -> { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + if (ListTools.isNotEmpty(workCompleted.getProperties().getRecordList())) { + wo.setRecordList(WoRecord.copier.copy(workCompleted.getProperties().getRecordList()).stream() + .sorted(Comparator.comparing(WoRecord::getOrder)).collect(Collectors.toList())); + } else { + wo.setRecordList(emc + .fetchEqual(Record.class, WoRecord.copier, Record.job_FIELDNAME, workCompleted.getJob()) + .stream().sorted(Comparator.comparing(WoRecord::getOrder)).collect(Collectors.toList())); + } + } catch (Exception e) { + logger.error(e); + } + }); + } + + private CompletableFuture activity(Work work, Wo wo) { + return CompletableFuture.runAsync(() -> { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); Activity activity = business.getActivity(work); if (null != activity) { WoActivity woActivity = new WoActivity(); activity.copyTo(woActivity); wo.setActivity(woActivity); if (Objects.equals(ActivityType.manual, activity.getActivityType())) { - wo.setRouteList(business.entityManagerContainer().fetchIn(Route.class, WoRoute.copier, - JpaObject.id_FIELDNAME, ((Manual) activity).getRouteList())); + wo.setRouteList(WoRoute.copier.copy(business.route().pick(((Manual) activity).getRouteList()))); } } - // System.out.println("!!!!!!!!!!!!!!!!activity:" + ((new Date()).getTime() - - // s.getTime())); } catch (Exception e) { logger.error(e); } }); } - private CompletableFuture task(EffectivePerson effectivePerson, Business business, Work work, Wo wo) { + private CompletableFuture task(EffectivePerson effectivePerson, Work work, Wo wo) { return CompletableFuture.runAsync(() -> { - try { - // Date s = new Date(); - wo.setTaskList(WoTask.copier.copy( - business.entityManagerContainer().listEqual(Task.class, Task.work_FIELDNAME, work.getId()))); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + wo.setTaskList(WoTask.copier.copy(emc.listEqual(Task.class, Task.job_FIELDNAME, work.getJob()))); wo.setCurrentTaskIndex( ListUtils.indexOf(wo.getTaskList(), e -> effectivePerson.isPerson(e.getPerson()))); - // System.out.println("!!!!!!!!!!!!!!!!task:" + ((new Date()).getTime() - - // s.getTime())); } catch (Exception e) { logger.error(e); } }); } - private CompletableFuture attachment(EffectivePerson effectivePerson, Business business, String job, Wo wo) { + private CompletableFuture attachment(EffectivePerson effectivePerson, String job, Wo wo) { return CompletableFuture.runAsync(() -> { - try { - // Date s = new Date(); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); List identities = business.organization().identity().listWithPerson(effectivePerson); List units = business.organization().unit().listWithPerson(effectivePerson); List wos = new ArrayList<>(); @@ -172,24 +231,18 @@ class V2GetWorkOrWorkCompleted extends BaseAction { Comparator.nullsLast(Date::compareTo)))) .collect(Collectors.toList()); wo.setAttachmentList(wos); - // System.out.println("!!!!!!!!!!!!!!!!attachment:" + ((new Date()).getTime() - - // s.getTime())); } catch (Exception e) { logger.error(e); } }); } - private CompletableFuture read(EffectivePerson effectivePerson, Business business, String job, Wo wo) { + private CompletableFuture read(EffectivePerson effectivePerson, String job, Wo wo) { return CompletableFuture.runAsync(() -> { - try { - // Date s = new Date(); - wo.setReadList(WoRead.copier - .copy(business.entityManagerContainer().listEqual(Read.class, Read.job_FIELDNAME, job))); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + wo.setReadList(WoRead.copier.copy(emc.listEqual(Read.class, Read.job_FIELDNAME, job))); wo.setCurrentReadIndex( ListUtils.indexOf(wo.getReadList(), e -> effectivePerson.isPerson(e.getPerson()))); - // System.out.println("!!!!!!!!!!!!!!!!read:" + ((new Date()).getTime() - - // s.getTime())); } catch (Exception e) { logger.error(e); } @@ -199,64 +252,55 @@ class V2GetWorkOrWorkCompleted extends BaseAction { private CompletableFuture workJson(Work work, Wo wo) { return CompletableFuture.runAsync(() -> { try { - // Date s = new Date(); wo.setWork(gson.toJsonTree(WoWork.copier.copy(work))); - // System.out.println("!!!!!!!!!!!!!!!!workJson:" + ((new Date()).getTime() - - // s.getTime())); } catch (Exception e) { logger.error(e); } }); } - private CompletableFuture creatorIdentity(Business business, String creatorIdentity, Wo wo) { + private CompletableFuture creatorIdentity(String creatorIdentity, Wo wo) { return CompletableFuture.runAsync(() -> { - try { - // Date s = new Date(); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); wo.setCreatorIdentity(business.organization().identity().getObject(creatorIdentity)); - // System.out.println("!!!!!!!!!!!!!!!!creatorIdentity:" + ((new - // Date()).getTime() - s.getTime())); } catch (Exception e) { logger.error(e); } }); } - private CompletableFuture creatorPerson(Business business, String creatorPerson, Wo wo) { + private CompletableFuture creatorPerson(String creatorPerson, Wo wo) { return CompletableFuture.runAsync(() -> { - try { - // Date s = new Date(); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); wo.setCreatorPerson(business.organization().person().getObject(creatorPerson)); - // System.out.println("!!!!!!!!!!!!!!!!creatorPerson:" + ((new Date()).getTime() - // - s.getTime())); } catch (Exception e) { logger.error(e); } }); } - private CompletableFuture creatorUnit(Business business, String creatorUnit, Wo wo) { + private CompletableFuture creatorUnit(String creatorUnit, Wo wo) { return CompletableFuture.runAsync(() -> { - try { - // Date s = new Date(); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); wo.setCreatorUnit(business.organization().unit().getObject(creatorUnit)); - // System.out.println("!!!!!!!!!!!!!!!!creatorUnit:" + ((new Date()).getTime() - - // s.getTime())); } catch (Exception e) { logger.error(e); } }); } - private Wo workCompleted(Business business, EffectivePerson effectivePerson, WorkCompleted workCompleted) + private Wo workCompleted(EffectivePerson effectivePerson, WorkCompleted workCompleted) throws InterruptedException, ExecutionException { Wo wo = new Wo(); - CompletableFuture.allOf(completedJson(workCompleted, wo), completedData(business, workCompleted, wo), - read(effectivePerson, business, workCompleted.getJob(), wo), - creatorIdentity(business, workCompleted.getCreatorIdentity(), wo), - creatorPerson(business, workCompleted.getCreatorPerson(), wo), - creatorUnit(business, workCompleted.getCreatorUnit(), wo), - attachment(effectivePerson, business, workCompleted.getJob(), wo)).get(); + CompletableFuture.allOf(completedJson(workCompleted, wo), completedData(workCompleted, wo), + read(effectivePerson, workCompleted.getJob(), wo), + creatorIdentity(workCompleted.getCreatorIdentity(), wo), + creatorPerson(workCompleted.getCreatorPerson(), wo), creatorUnit(workCompleted.getCreatorUnit(), wo), + attachment(effectivePerson, workCompleted.getJob(), wo), + completedRecord(effectivePerson, workCompleted, wo)).get(); return wo; } @@ -270,15 +314,14 @@ class V2GetWorkOrWorkCompleted extends BaseAction { }); } - private CompletableFuture completedData(Business business, WorkCompleted workCompleted, Wo wo) { + private CompletableFuture completedData(WorkCompleted workCompleted, Wo wo) { return CompletableFuture.runAsync(() -> { if (BooleanUtils.isTrue(workCompleted.getMerged())) { wo.setData(workCompleted.getProperties().getData()); } else { - try { - List list = business.entityManagerContainer().listEqualAndEqual(Item.class, - DataItem.bundle_FIELDNAME, workCompleted.getJob(), DataItem.itemCategory_FIELDNAME, - ItemCategory.pp); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + List list = emc.listEqualAndEqual(Item.class, DataItem.bundle_FIELDNAME, + workCompleted.getJob(), DataItem.itemCategory_FIELDNAME, ItemCategory.pp); if (!list.isEmpty()) { JsonElement jsonElement = itemConverter.assemble(list); // 必须是Object对象 @@ -373,6 +416,9 @@ class V2GetWorkOrWorkCompleted extends BaseAction { // work和workCompleted都有 private List attachmentList; + // work和workCompleted都有 + private List recordList; + // 只有work有 private WoActivity activity; // 只有work有 @@ -478,6 +524,14 @@ class V2GetWorkOrWorkCompleted extends BaseAction { this.attachmentList = attachmentList; } + public List getRecordList() { + return recordList; + } + + public void setRecordList(List recordList) { + this.recordList = recordList; + } + } public static class WoWork extends Work { @@ -494,8 +548,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { private static final long serialVersionUID = -1772642962691214007L; static WrapCopier copier = WrapCopierFactory.wo(WorkCompleted.class, - WoWorkCompleted.class, null, ListTools.toList(JpaObject.FieldsInvisibleIncludeProperites, - WorkCompleted.formData_FIELDNAME, WorkCompleted.formMobileData_FIELDNAME)); + WoWorkCompleted.class, null, JpaObject.FieldsInvisibleIncludeProperites); } public static class WoTask extends Task { @@ -503,7 +556,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { private static final long serialVersionUID = 5244996549744746585L; static WrapCopier copier = WrapCopierFactory.wo(Task.class, WoTask.class, null, - JpaObject.FieldsInvisibleIncludeProperites); + JpaObject.FieldsInvisible); } @@ -512,7 +565,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { private static final long serialVersionUID = 5244996549744746585L; static WrapCopier copier = WrapCopierFactory.wo(Read.class, WoRead.class, null, - JpaObject.FieldsInvisibleIncludeProperites); + JpaObject.FieldsInvisible); } @@ -616,11 +669,14 @@ class V2GetWorkOrWorkCompleted extends BaseAction { } - public static class WoRoute extends GsonPropertyObject { - static WrapCopier copier = WrapCopierFactory.wo(Route.class, WoRoute.class, - ListTools.toList(JpaObject.id_FIELDNAME, Route.name_FIELDNAME, Route.description_FIELDNAME, - Route.alias_FIELDNAME), - null); + public static class WoRoute extends Route { + + private static final long serialVersionUID = 556378904185283486L; + + static WrapCopier copier = WrapCopierFactory.wo(Route.class, WoRoute.class, null, + ListTools.toList(Route.createTime_FIELDNAME, Route.edition_FIELDNAME, Route.position_FIELDNAME, + Route.process_FIELDNAME, Route.updateTime_FIELDNAME, Route.track_FIELDNAME, + Route.properties_FIELDNAME)); } public static class WoAttachment extends Attachment { @@ -636,7 +692,6 @@ class V2GetWorkOrWorkCompleted extends BaseAction { public void setControl(WoAttachmentControl control) { this.control = control; } - } public static class WoAttachmentControl extends GsonPropertyObject { @@ -671,4 +726,13 @@ class V2GetWorkOrWorkCompleted extends BaseAction { } + public static class WoRecord extends Record { + + private static final long serialVersionUID = -7666329770246726197L; + + static WrapCopier copier = WrapCopierFactory.wo(Record.class, WoRecord.class, + JpaObject.singularAttributeField(Record.class, true, false), JpaObject.FieldsInvisible); + + } + } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/WorkAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/WorkAction.java index bcdd03961b408a0832f2f29811b43c2fbea09a6b..d8aa35ff657bab1302987f2b18bd15b3f6ab579f 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/WorkAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/WorkAction.java @@ -1,6 +1,5 @@ package com.x.processplatform.assemble.surface.jaxrs.work; -import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; @@ -36,23 +35,23 @@ public class WorkAction extends StandardJaxrsAction { private static Logger logger = LoggerFactory.getLogger(WorkAction.class); - @JaxrsMethodDescribe(value = "根据Work Id获取基本的work内容,仅用于服务器来取得work内容.", action = ActionComplex.class) - @GET - @Path("{id}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplex().execute(effectivePerson, id); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } +// @JaxrsMethodDescribe(value = "根据Work Id获取基本的work内容,仅用于服务器来取得work内容.", action = ActionComplex.class) +// @GET +// @Path("{id}") +// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) +// @Consumes(MediaType.APPLICATION_JSON) +// public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, +// @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { +// ActionResult result = new ActionResult<>(); +// EffectivePerson effectivePerson = this.effectivePerson(request); +// try { +// result = new ActionComplex().execute(effectivePerson, id); +// } catch (Exception e) { +// logger.error(e, effectivePerson, request, null); +// result.error(e); +// } +// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); +// } @JaxrsMethodDescribe(value = "根据Work或workCompleted取得内容.", action = ActionGetWithWorkOrWorkCompleted.class) @GET @@ -73,79 +72,79 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @JaxrsMethodDescribe(value = "根据Work Id获取组装的Work内容.", action = ActionComplex.class) - @GET - @Path("{id}/complex") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void complex(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplex().execute(effectivePerson, id); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } +// @JaxrsMethodDescribe(value = "根据Work Id获取组装的Work内容.", action = ActionComplex.class) +// @GET +// @Path("{id}/complex") +// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) +// @Consumes(MediaType.APPLICATION_JSON) +// public void complex(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, +// @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { +// ActionResult result = new ActionResult<>(); +// EffectivePerson effectivePerson = this.effectivePerson(request); +// try { +// result = new ActionComplex().execute(effectivePerson, id); +// } catch (Exception e) { +// logger.error(e, effectivePerson, request, null); +// result.error(e); +// } +// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); +// } - @JaxrsMethodDescribe(value = "根据Work Id获取组装的Work内容,同时装载Mobile使用的Form.", action = ActionComplexMobile.class) - @GET - @Path("{id}/complex/mobile") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void complexMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplexMobile().execute(effectivePerson, id); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } +// @JaxrsMethodDescribe(value = "根据Work Id获取组装的Work内容,同时装载Mobile使用的Form.", action = ActionComplexMobile.class) +// @GET +// @Path("{id}/complex/mobile") +// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) +// @Consumes(MediaType.APPLICATION_JSON) +// public void complexMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, +// @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { +// ActionResult result = new ActionResult<>(); +// EffectivePerson effectivePerson = this.effectivePerson(request); +// try { +// result = new ActionComplexMobile().execute(effectivePerson, id); +// } catch (Exception e) { +// logger.error(e, effectivePerson, request, null); +// result.error(e); +// } +// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); +// } - @JaxrsMethodDescribe(value = "根据Work Id获取组装的Work内容同时返回指定的Form,其中application和form可以指定id,name或者alias.", action = ActionComplexAppointForm.class) - @GET - @Path("{id}/complex/appoint/form/{formFlag}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void complexAppointForm(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, - @JaxrsParameterDescribe("表单标识") @PathParam("formFlag") String formFlag) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplexAppointForm().execute(effectivePerson, id, formFlag); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } +// @JaxrsMethodDescribe(value = "根据Work Id获取组装的Work内容同时返回指定的Form,其中application和form可以指定id,name或者alias.", action = ActionComplexAppointForm.class) +// @GET +// @Path("{id}/complex/appoint/form/{formFlag}") +// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) +// @Consumes(MediaType.APPLICATION_JSON) +// public void complexAppointForm(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, +// @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, +// @JaxrsParameterDescribe("表单标识") @PathParam("formFlag") String formFlag) { +// ActionResult result = new ActionResult<>(); +// EffectivePerson effectivePerson = this.effectivePerson(request); +// try { +// result = new ActionComplexAppointForm().execute(effectivePerson, id, formFlag); +// } catch (Exception e) { +// logger.error(e, effectivePerson, request, null); +// result.error(e); +// } +// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); +// } - @JaxrsMethodDescribe(value = "根据Work Id获取组装的Work内容.", action = ActionComplexAppointFormMobile.class) - @GET - @Path("{id}/complex/appoint/form/{formFlag}/mobile") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void complexAppointFormMobile(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, - @JaxrsParameterDescribe("表单标识") @PathParam("formFlag") String formFlag) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplexAppointFormMobile().execute(effectivePerson, id, formFlag); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } +// @JaxrsMethodDescribe(value = "根据Work Id获取组装的Work内容.", action = ActionComplexAppointFormMobile.class) +// @GET +// @Path("{id}/complex/appoint/form/{formFlag}/mobile") +// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) +// @Consumes(MediaType.APPLICATION_JSON) +// public void complexAppointFormMobile(@Suspended final AsyncResponse asyncResponse, +// @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, +// @JaxrsParameterDescribe("表单标识") @PathParam("formFlag") String formFlag) { +// ActionResult result = new ActionResult<>(); +// EffectivePerson effectivePerson = this.effectivePerson(request); +// try { +// result = new ActionComplexAppointFormMobile().execute(effectivePerson, id, formFlag); +// } catch (Exception e) { +// logger.error(e, effectivePerson, request, null); +// result.error(e); +// } +// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); +// } @JaxrsMethodDescribe(value = "获取指定人员的Task,TaskCompleted,Read,ReadCompleted,Review.没有权限限制", action = ActionCountWithPerson.class) @GET @@ -201,9 +200,27 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionProcessing.class) @POST + @Path("{id}/processing/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void processingMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionProcessing().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) + @POST @Path("process/{processFlag}") @JaxrsMethodDescribe(value = "创建工作(创建启动版本的流程).", action = ActionCreate.class) public void create(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @@ -219,10 +236,10 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @POST @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) @Path("process/{processFlag}/force") + @POST @JaxrsMethodDescribe(value = "创建工作(强制创建存在的流程).", action = ActionCreateForce.class) public void createForce(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("流程标识") @PathParam("processFlag") String processFlag, JsonElement jsonElement) { @@ -297,6 +314,24 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionDelete.class) + @GET + @Path("{id}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDelete().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "完成工作关闭时候的检查,1.检查是否要删除处于草稿状态的工作,没有保存过任何数据将被认为是草稿.2.检查是否需要释放抢办.", action = ActionCloseCheck.class) @GET @Path("{id}/close/check") @@ -319,7 +354,7 @@ public class WorkAction extends StandardJaxrsAction { @POST @Path("{id}/close/check") @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - // @Consumes(MediaType.APPLICATION_JSON) + // 不需要申明,这里使用的是chrome在onunload事件运行有特殊的限制@Consumes(MediaType.APPLICATION_JSON) public void closeCheckPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { ActionResult result = new ActionResult<>(); @@ -600,6 +635,24 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionRetract.class) + @POST + @Path("{id}/retract/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void retractMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionRetract().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "将工作调度。", action = ActionReroute.class) @PUT @Path("{id}/reroute/activity/{activityId}/activitytype/{activityType}") @@ -621,6 +674,27 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "将工作调度。", action = ActionReroute.class) + @POST + @Path("{id}/reroute/activity/{activityId}/activitytype/{activityType}/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void rerouteMockPost2Put(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("活动标识") @PathParam("activityId") String activityId, + @JaxrsParameterDescribe("活动类型") @PathParam("activityType") ActivityType activityType, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionReroute().execute(effectivePerson, id, activityId, activityType, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "增加一个会签分支", action = ActionAddSplit.class) @PUT @Path("{id}/add/split") @@ -639,6 +713,24 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionAddSplit.class) + @POST + @Path("{id}/add/split/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void addSplitMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, JsonElement jsonElement) { + ActionResult> result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionAddSplit().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "回滚工作到指定的workLog", action = ActionRollback.class) @PUT @Path("{id}/rollback") @@ -657,6 +749,24 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionRollback.class) + @POST + @Path("{id}/rollback/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void rollbackMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionRollback().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "列示当前用户创建的工作,可以根据条件过滤,分页.", action = ActionListMyPaging.class) @POST @Path("list/my/paging/{page}/size/{size}") @@ -825,6 +935,24 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionManageDeleteSingleWork.class) + @GET + @Path("{id}/single/manage/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageDeleteSingleWorkMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { + ActionResult> result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageDeleteSingleWork().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "删除所有相关联的工作.", action = ActionManageDeleteRelativeWork.class) @DELETE @Path("{id}/relative/manage") @@ -843,6 +971,24 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionManageDeleteRelativeWork.class) + @GET + @Path("{id}/relative/manage/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageDeleteRelativeWorkMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id) { + ActionResult> result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageDeleteRelativeWork().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "获取用于过滤的可选属性值", action = ActionManageFilterAttribute.class) @GET @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @@ -942,6 +1088,25 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = V2Reroute.class) + @POST + @Path("v2/{id}/reroute/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void V2RerouteMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new V2Reroute().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "V2_工作召回。", action = V2Retract.class) @PUT @Path("v2/{id}/retract") @@ -960,6 +1125,25 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = V2Retract.class) + @POST + @Path("v2/{id}/retract/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void V2RetractMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new V2Retract().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "V2_回滚工作.", action = V2Rollback.class) @PUT @Path("v2/{id}/rollback") @@ -978,6 +1162,25 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = V2Rollback.class) + @POST + @Path("v2/{id}/rollback/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void V2RollbackMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new V2Rollback().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "V2_增加一个会签分支", action = ActionAddSplit.class) @PUT @Path("v2/{id}/add/split") @@ -996,6 +1199,25 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionAddSplit.class) + @POST + @Path("v2/{id}/add/split/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void V2AddSplitMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new V2AddSplit().execute(effectivePerson, id, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "管理员替代person操作工作召回。", action = V2ManageRetract.class) @PUT @Path("v2/{id}/person/{person}/retract/manage") @@ -1015,6 +1237,25 @@ public class WorkAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = V2ManageRetract.class) + @POST + @Path("v2/{id}/person/{person}/retract/manage/mockputtopost") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void V2ManageRetractMockPutToPost(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("id") String id, + @JaxrsParameterDescribe("召回工作已办人员(根据流转记录确认)") @PathParam("person") String person, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new V2ManageRetract().execute(effectivePerson, id, person); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "V2_根据Work或workCompleted取得内容.", action = V2GetWorkOrWorkCompleted.class) @GET @Path("v2/workorworkcompleted/{workOrWorkCompleted}") @@ -1023,22 +1264,15 @@ public class WorkAction extends StandardJaxrsAction { public void V2GetWorkOrWorkCompleted(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("工作标识") @PathParam("workOrWorkCompleted") String workOrWorkCompleted) { - // Date s = new Date(); ActionResult result = new ActionResult<>(); EffectivePerson effectivePerson = this.effectivePerson(request); - // System.out.println("!!!!!!!!!!!!!!!!V2GetWorkOrWorkCompleted1:" + ((new - // Date()).getTime() - s.getTime())); try { result = new V2GetWorkOrWorkCompleted().execute(effectivePerson, workOrWorkCompleted); - // System.out.println("!!!!!!!!!!!!!!!!V2GetWorkOrWorkCompleted2:" + ((new - // Date()).getTime() - s.getTime())); } catch (Exception e) { logger.error(e, effectivePerson, request, null); result.error(e); } asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - // System.out.println("!!!!!!!!!!!!!!!!V2GetWorkOrWorkCompleted3:" + ((new - // Date()).getTime() - s.getTime())); } } \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplex.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplex.java index 1d79cd99996c5db8a780aff67c8f52603f212a53..427b6cb10249b3ab4211390f98ef453c033382c2 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplex.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplex.java @@ -1,49 +1,49 @@ -package com.x.processplatform.assemble.surface.jaxrs.workcompleted; - -import org.apache.commons.lang3.BooleanUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.assemble.surface.WorkCompletedControl; -import com.x.processplatform.core.entity.content.WorkCompleted; -import com.x.processplatform.core.entity.element.Form; - -class ActionComplex extends BaseAction { - - ActionResult execute(String id, EffectivePerson effectivePerson) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); - if (null == workCompleted) { - throw new ExceptionEntityNotExist(id, WorkCompleted.class); - } - Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class); - wo.setForm(this.getForm(business, workCompleted)); - WorkCompletedControl control = wo.getControl(); - if (BooleanUtils.isNotTrue(control.getAllowVisit())) { - throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id); - } - result.setData(wo); - return result; - } - } - - public static class Wo extends AbstractWo { - } - - private WoForm getForm(Business business, WorkCompleted workCompleted) throws Exception { - Form form = business.form().pick(workCompleted.getForm()); - if (null == form) { - return null; - } - WoForm wo = WoForm.copier.copy(form); - wo.setData(form.getDataOrMobileData()); - return wo; - } - -} +//package com.x.processplatform.assemble.surface.jaxrs.workcompleted; +// +//import org.apache.commons.lang3.BooleanUtils; +// +//import com.x.base.core.container.EntityManagerContainer; +//import com.x.base.core.container.factory.EntityManagerContainerFactory; +//import com.x.base.core.project.exception.ExceptionEntityNotExist; +//import com.x.base.core.project.http.ActionResult; +//import com.x.base.core.project.http.EffectivePerson; +//import com.x.processplatform.assemble.surface.Business; +//import com.x.processplatform.assemble.surface.WorkCompletedControl; +//import com.x.processplatform.core.entity.content.WorkCompleted; +//import com.x.processplatform.core.entity.element.Form; +// +//class ActionComplex extends BaseAction { +// +// ActionResult execute(String id, EffectivePerson effectivePerson) throws Exception { +// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { +// ActionResult result = new ActionResult<>(); +// Business business = new Business(emc); +// WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); +// if (null == workCompleted) { +// throw new ExceptionEntityNotExist(id, WorkCompleted.class); +// } +// Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class); +// wo.setForm(this.getForm(business, workCompleted)); +// WorkCompletedControl control = wo.getControl(); +// if (BooleanUtils.isNotTrue(control.getAllowVisit())) { +// throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id); +// } +// result.setData(wo); +// return result; +// } +// } +// +// public static class Wo extends AbstractWo { +// } +// +// private WoForm getForm(Business business, WorkCompleted workCompleted) throws Exception { +// Form form = business.form().pick(workCompleted.getForm()); +// if (null == form) { +// return null; +// } +// WoForm wo = WoForm.copier.copy(form); +// wo.setData(form.getDataOrMobileData()); +// return wo; +// } +// +//} diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexAppointForm.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexAppointForm.java index 25643f6715a6e63a5989e0cf974a40a6b20b2ce7..f90e86cc186dd538173a1923dba5961cdbd6c873 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexAppointForm.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexAppointForm.java @@ -1,49 +1,49 @@ -package com.x.processplatform.assemble.surface.jaxrs.workcompleted; - -import org.apache.commons.lang3.BooleanUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.assemble.surface.WorkCompletedControl; -import com.x.processplatform.core.entity.content.WorkCompleted; -import com.x.processplatform.core.entity.element.Form; - -class ActionComplexAppointForm extends BaseAction { - - ActionResult execute(EffectivePerson effectivePerson, String id, String formFlag) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); - if (null == workCompleted) { - throw new ExceptionEntityNotExist(id, WorkCompleted.class); - } - Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class); - wo.setForm(this.getForm(business, formFlag)); - WorkCompletedControl control = wo.getControl(); - if (BooleanUtils.isNotTrue(control.getAllowVisit())) { - throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id); - } - result.setData(wo); - return result; - } - } - - public static class Wo extends AbstractWo { - } - - private WoForm getForm(Business business, String formFlag) throws Exception { - Form form = business.form().pick(formFlag); - if (null == form) { - return null; - } - WoForm wo = WoForm.copier.copy(form); - wo.setData(form.getDataOrMobileData()); - return wo; - } - -} \ No newline at end of file +//package com.x.processplatform.assemble.surface.jaxrs.workcompleted; +// +//import org.apache.commons.lang3.BooleanUtils; +// +//import com.x.base.core.container.EntityManagerContainer; +//import com.x.base.core.container.factory.EntityManagerContainerFactory; +//import com.x.base.core.project.exception.ExceptionEntityNotExist; +//import com.x.base.core.project.http.ActionResult; +//import com.x.base.core.project.http.EffectivePerson; +//import com.x.processplatform.assemble.surface.Business; +//import com.x.processplatform.assemble.surface.WorkCompletedControl; +//import com.x.processplatform.core.entity.content.WorkCompleted; +//import com.x.processplatform.core.entity.element.Form; +// +//class ActionComplexAppointForm extends BaseAction { +// +// ActionResult execute(EffectivePerson effectivePerson, String id, String formFlag) throws Exception { +// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { +// ActionResult result = new ActionResult<>(); +// Business business = new Business(emc); +// WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); +// if (null == workCompleted) { +// throw new ExceptionEntityNotExist(id, WorkCompleted.class); +// } +// Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class); +// wo.setForm(this.getForm(business, formFlag)); +// WorkCompletedControl control = wo.getControl(); +// if (BooleanUtils.isNotTrue(control.getAllowVisit())) { +// throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id); +// } +// result.setData(wo); +// return result; +// } +// } +// +// public static class Wo extends AbstractWo { +// } +// +// private WoForm getForm(Business business, String formFlag) throws Exception { +// Form form = business.form().pick(formFlag); +// if (null == form) { +// return null; +// } +// WoForm wo = WoForm.copier.copy(form); +// wo.setData(form.getDataOrMobileData()); +// return wo; +// } +// +//} \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexAppointFormMobile.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexAppointFormMobile.java index db23962409b6d5be282fcbe5dc3c52e0ea1060a1..426a9fc78427f2545b0627c5b024334b2bc84064 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexAppointFormMobile.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexAppointFormMobile.java @@ -1,48 +1,48 @@ -package com.x.processplatform.assemble.surface.jaxrs.workcompleted; - -import org.apache.commons.lang3.BooleanUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.assemble.surface.WorkCompletedControl; -import com.x.processplatform.core.entity.content.WorkCompleted; -import com.x.processplatform.core.entity.element.Form; - -class ActionComplexAppointFormMobile extends BaseAction { - - ActionResult execute(EffectivePerson effectivePerson, String id, String formFlag) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); - if (null == workCompleted) { - throw new ExceptionEntityNotExist(id, WorkCompleted.class); - } - Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class); - wo.setForm(this.getForm(business, formFlag)); - WorkCompletedControl control = wo.getControl(); - if (BooleanUtils.isNotTrue(control.getAllowVisit())) { - throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id); - } - result.setData(wo); - return result; - } - } - - public static class Wo extends AbstractWo { - } - - private WoForm getForm(Business business, String formFlag) throws Exception { - Form form = business.form().pick(formFlag); - if (null == form) { - return null; - } - WoForm wo = WoForm.copier.copy(form); - wo.setData(form.getMobileDataOrData()); - return wo; - } -} \ No newline at end of file +//package com.x.processplatform.assemble.surface.jaxrs.workcompleted; +// +//import org.apache.commons.lang3.BooleanUtils; +// +//import com.x.base.core.container.EntityManagerContainer; +//import com.x.base.core.container.factory.EntityManagerContainerFactory; +//import com.x.base.core.project.exception.ExceptionEntityNotExist; +//import com.x.base.core.project.http.ActionResult; +//import com.x.base.core.project.http.EffectivePerson; +//import com.x.processplatform.assemble.surface.Business; +//import com.x.processplatform.assemble.surface.WorkCompletedControl; +//import com.x.processplatform.core.entity.content.WorkCompleted; +//import com.x.processplatform.core.entity.element.Form; +// +//class ActionComplexAppointFormMobile extends BaseAction { +// +// ActionResult execute(EffectivePerson effectivePerson, String id, String formFlag) throws Exception { +// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { +// ActionResult result = new ActionResult<>(); +// Business business = new Business(emc); +// WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); +// if (null == workCompleted) { +// throw new ExceptionEntityNotExist(id, WorkCompleted.class); +// } +// Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class); +// wo.setForm(this.getForm(business, formFlag)); +// WorkCompletedControl control = wo.getControl(); +// if (BooleanUtils.isNotTrue(control.getAllowVisit())) { +// throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id); +// } +// result.setData(wo); +// return result; +// } +// } +// +// public static class Wo extends AbstractWo { +// } +// +// private WoForm getForm(Business business, String formFlag) throws Exception { +// Form form = business.form().pick(formFlag); +// if (null == form) { +// return null; +// } +// WoForm wo = WoForm.copier.copy(form); +// wo.setData(form.getMobileDataOrData()); +// return wo; +// } +//} \ No newline at end of file diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexMobile.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexMobile.java index 6a61aca06d82663f19ab5c9d591aa1ffb77c58bc..889b37a26fc55e51d9a3968bdea8aa7684a9b24e 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexMobile.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexMobile.java @@ -1,49 +1,49 @@ -package com.x.processplatform.assemble.surface.jaxrs.workcompleted; - -import org.apache.commons.lang3.BooleanUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.assemble.surface.WorkCompletedControl; -import com.x.processplatform.core.entity.content.WorkCompleted; -import com.x.processplatform.core.entity.element.Form; - -class ActionComplexMobile extends BaseAction { - - ActionResult execute(String id, EffectivePerson effectivePerson) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); - if (null == workCompleted) { - throw new ExceptionEntityNotExist(id, WorkCompleted.class); - } - Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class); - wo.setForm(this.getForm(business, workCompleted)); - WorkCompletedControl control = wo.getControl(); - if (BooleanUtils.isNotTrue(control.getAllowVisit())) { - throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id); - } - result.setData(wo); - return result; - } - } - - public static class Wo extends AbstractWo { - } - - private WoForm getForm(Business business, WorkCompleted workCompleted) throws Exception { - Form form = business.form().pick(workCompleted.getForm()); - if (null == form) { - return null; - } - WoForm wo = WoForm.copier.copy(form); - wo.setData(form.getMobileDataOrData()); - return wo; - } - -} +//package com.x.processplatform.assemble.surface.jaxrs.workcompleted; +// +//import org.apache.commons.lang3.BooleanUtils; +// +//import com.x.base.core.container.EntityManagerContainer; +//import com.x.base.core.container.factory.EntityManagerContainerFactory; +//import com.x.base.core.project.exception.ExceptionEntityNotExist; +//import com.x.base.core.project.http.ActionResult; +//import com.x.base.core.project.http.EffectivePerson; +//import com.x.processplatform.assemble.surface.Business; +//import com.x.processplatform.assemble.surface.WorkCompletedControl; +//import com.x.processplatform.core.entity.content.WorkCompleted; +//import com.x.processplatform.core.entity.element.Form; +// +//class ActionComplexMobile extends BaseAction { +// +// ActionResult execute(String id, EffectivePerson effectivePerson) throws Exception { +// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { +// ActionResult result = new ActionResult<>(); +// Business business = new Business(emc); +// WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); +// if (null == workCompleted) { +// throw new ExceptionEntityNotExist(id, WorkCompleted.class); +// } +// Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class); +// wo.setForm(this.getForm(business, workCompleted)); +// WorkCompletedControl control = wo.getControl(); +// if (BooleanUtils.isNotTrue(control.getAllowVisit())) { +// throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id); +// } +// result.setData(wo); +// return result; +// } +// } +// +// public static class Wo extends AbstractWo { +// } +// +// private WoForm getForm(Business business, WorkCompleted workCompleted) throws Exception { +// Form form = business.form().pick(workCompleted.getForm()); +// if (null == form) { +// return null; +// } +// WoForm wo = WoForm.copier.copy(form); +// wo.setData(form.getMobileDataOrData()); +// return wo; +// } +// +//} diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexSnapForm.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexSnapForm.java deleted file mode 100644 index 5948415fcd4559eca6f39e7cd70011eb502d30c5..0000000000000000000000000000000000000000 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexSnapForm.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.x.processplatform.assemble.surface.jaxrs.workcompleted; - -import org.apache.commons.lang3.BooleanUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.assemble.surface.WorkCompletedControl; -import com.x.processplatform.core.entity.content.WorkCompleted; - -class ActionComplexSnapForm extends BaseAction { - - ActionResult execute(String id, EffectivePerson effectivePerson) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); - if (null == workCompleted) { - throw new ExceptionEntityNotExist(id, WorkCompleted.class); - } - Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class); - wo.setForm(this.getForm(business, workCompleted)); - WorkCompletedControl control = wo.getControl(); - if (BooleanUtils.isNotTrue(control.getAllowVisit())) { - throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id); - } - result.setData(wo); - return result; - } - } - - public static class Wo extends AbstractWo { - } - - private WoForm getForm(Business business, WorkCompleted workCompleted) throws Exception { - WoForm wo = new WoForm(); - wo.setData(workCompleted.getFormData()); - return wo; - } - -} diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexSnapFormMobile.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexSnapFormMobile.java deleted file mode 100644 index bc6a1e3d02cc4cce0111fbbd2321d9c78d1221f5..0000000000000000000000000000000000000000 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionComplexSnapFormMobile.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.x.processplatform.assemble.surface.jaxrs.workcompleted; - -import org.apache.commons.lang3.BooleanUtils; - -import com.x.base.core.container.EntityManagerContainer; -import com.x.base.core.container.factory.EntityManagerContainerFactory; -import com.x.base.core.project.exception.ExceptionEntityNotExist; -import com.x.base.core.project.http.ActionResult; -import com.x.base.core.project.http.EffectivePerson; -import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.assemble.surface.WorkCompletedControl; -import com.x.processplatform.core.entity.content.WorkCompleted; - -class ActionComplexSnapFormMobile extends BaseAction { - - ActionResult execute(String id, EffectivePerson effectivePerson) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Business business = new Business(emc); - WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); - if (null == workCompleted) { - throw new ExceptionEntityNotExist(id, WorkCompleted.class); - } - Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class); - wo.setForm(this.getForm(business, workCompleted)); - WorkCompletedControl control = wo.getControl(); - if (BooleanUtils.isNotTrue(control.getAllowVisit())) { - throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id); - } - result.setData(wo); - return result; - } - } - - public static class Wo extends AbstractWo { - } - - private WoForm getForm(Business business, WorkCompleted workCompleted) throws Exception { - WoForm wo = new WoForm(); - wo.setData(workCompleted.getFormMobileData()); - return wo; - } - -} diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionManageGetAssignment.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionManageGetAssignment.java index 60fbf3d9c2fa0a64f18ed2ce986d9586ea406ab5..cb0b5d13d42dceafb48f6758cc6e86e6bcca23ff 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionManageGetAssignment.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/ActionManageGetAssignment.java @@ -37,97 +37,97 @@ class ActionManageGetAssignment extends BaseAction { private static Logger logger = LoggerFactory.getLogger(ActionManageGetAssignment.class); ActionResult execute(EffectivePerson effectivePerson, String id) throws Exception { + WorkCompleted workCompleted = null; + WoControl control = null; + Wo wo = new Wo(); + ActionResult result = new ActionResult<>(); try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Wo wo = new Wo(); Business business = new Business(emc); - WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); + workCompleted = emc.find(id, WorkCompleted.class); Process process = business.process().pick(workCompleted.getProcess()); Application application = business.application().pick(workCompleted.getApplication()); // 需要对这个应用的管理权限 if (!business.canManageApplicationOrProcess(effectivePerson, application, process)) { throw new ExceptionAccessDenied(effectivePerson); } - WoControl control = business.getControl(effectivePerson, workCompleted, WoControl.class); + control = business.getControl(effectivePerson, workCompleted, WoControl.class); wo.setControl(control); - - CompletableFuture future_taskCompleted = CompletableFuture.runAsync(() -> { - try { - emc.listEqual(TaskCompleted.class, TaskCompleted.job_FIELDNAME, workCompleted.getJob()).stream() - .sorted(Comparator.comparing(TaskCompleted::getStartTime, - Comparator.nullsLast(Date::compareTo))) - .forEach(o -> { - try { - WoTaskCompleted w = WoTaskCompleted.copier.copy(o); - w.setControl(control); - wo.getTaskCompletedList().add(w); - } catch (Exception e) { - logger.error(e); - } - }); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_read = CompletableFuture.runAsync(() -> { - try { - emc.listEqual(Read.class, Read.job_FIELDNAME, workCompleted.getJob()).stream() - .sorted(Comparator.comparing(Read::getStartTime, Comparator.nullsLast(Date::compareTo))) - .forEach(o -> { - try { - WoRead w = WoRead.copier.copy(o); - w.setControl(control); - wo.getReadList().add(w); - } catch (Exception e) { - logger.error(e); - } - }); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_readCompleted = CompletableFuture.runAsync(() -> { - try { - emc.listEqual(ReadCompleted.class, ReadCompleted.job_FIELDNAME, workCompleted.getJob()).stream() - .sorted(Comparator.comparing(ReadCompleted::getStartTime, - Comparator.nullsLast(Date::compareTo))) - .forEach(o -> { - try { - WoReadCompleted w = WoReadCompleted.copier.copy(o); - w.setControl(control); - wo.getReadCompletedList().add(w); - } catch (Exception e) { - logger.error(e); - } - }); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_review = CompletableFuture.runAsync(() -> { - try { - emc.listEqual(Review.class, Review.job_FIELDNAME, workCompleted.getJob()).stream() - .sorted(Comparator.comparing(Review::getStartTime, Comparator.nullsLast(Date::compareTo))) - .forEach(o -> { - try { - WoReview w = WoReview.copier.copy(o); - w.setControl(control); - wo.getReviewList().add(w); - } catch (Exception e) { - logger.error(e); - } - }); - } catch (Exception e) { - logger.error(e); - } - }); - future_taskCompleted.get(300, TimeUnit.SECONDS); - future_read.get(300, TimeUnit.SECONDS); - future_readCompleted.get(300, TimeUnit.SECONDS); - future_review.get(300, TimeUnit.SECONDS); - result.setData(wo); - return result; } + final String job = workCompleted.getJob(); + CompletableFuture future_taskCompleted = CompletableFuture.runAsync(() -> { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + emc.listEqual(TaskCompleted.class, TaskCompleted.job_FIELDNAME, job).stream().sorted( + Comparator.comparing(TaskCompleted::getStartTime, Comparator.nullsLast(Date::compareTo))) + .forEach(o -> { + try { + WoTaskCompleted w = WoTaskCompleted.copier.copy(o); + // w.setControl(control); + wo.getTaskCompletedList().add(w); + } catch (Exception e) { + logger.error(e); + } + }); + } catch (Exception e) { + logger.error(e); + } + }); + CompletableFuture future_read = CompletableFuture.runAsync(() -> { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + emc.listEqual(Read.class, Read.job_FIELDNAME, job).stream() + .sorted(Comparator.comparing(Read::getStartTime, Comparator.nullsLast(Date::compareTo))) + .forEach(o -> { + try { + WoRead w = WoRead.copier.copy(o); + //w.setControl(control); + wo.getReadList().add(w); + } catch (Exception e) { + logger.error(e); + } + }); + } catch (Exception e) { + logger.error(e); + } + }); + CompletableFuture future_readCompleted = CompletableFuture.runAsync(() -> { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + emc.listEqual(ReadCompleted.class, ReadCompleted.job_FIELDNAME, job).stream().sorted( + Comparator.comparing(ReadCompleted::getStartTime, Comparator.nullsLast(Date::compareTo))) + .forEach(o -> { + try { + WoReadCompleted w = WoReadCompleted.copier.copy(o); + //w.setControl(control); + wo.getReadCompletedList().add(w); + } catch (Exception e) { + logger.error(e); + } + }); + } catch (Exception e) { + logger.error(e); + } + }); + CompletableFuture future_review = CompletableFuture.runAsync(() -> { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + emc.listEqual(Review.class, Review.job_FIELDNAME, job).stream() + .sorted(Comparator.comparing(Review::getStartTime, Comparator.nullsLast(Date::compareTo))) + .forEach(o -> { + try { + WoReview w = WoReview.copier.copy(o); + //w.setControl(control); + wo.getReviewList().add(w); + } catch (Exception e) { + logger.error(e); + } + }); + } catch (Exception e) { + logger.error(e); + } + }); + future_taskCompleted.get(300, TimeUnit.SECONDS); + future_read.get(300, TimeUnit.SECONDS); + future_readCompleted.get(300, TimeUnit.SECONDS); + future_review.get(300, TimeUnit.SECONDS); + result.setData(wo); + return result; } public static class Wo extends GsonPropertyObject { diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/BaseAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/BaseAction.java index 58c9dda965c9b6e640bdb30ce47497772f433384..a7bbdf2e957fe19d63060163db265e74942eb0b5 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/BaseAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/BaseAction.java @@ -1,13 +1,7 @@ package com.x.processplatform.assemble.surface.jaxrs.workcompleted; import java.util.ArrayList; -import java.util.Comparator; -import java.util.Date; import java.util.List; -import java.util.Objects; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; import javax.persistence.EntityManager; import javax.persistence.criteria.CriteriaBuilder; @@ -15,8 +9,6 @@ import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; -import org.apache.commons.lang3.StringUtils; - import com.google.gson.JsonElement; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.entity.JpaObject; @@ -36,17 +28,13 @@ import com.x.processplatform.core.entity.content.Attachment; import com.x.processplatform.core.entity.content.Data; import com.x.processplatform.core.entity.content.Read; import com.x.processplatform.core.entity.content.ReadCompleted; -import com.x.processplatform.core.entity.content.Review; import com.x.processplatform.core.entity.content.Task; import com.x.processplatform.core.entity.content.TaskCompleted; import com.x.processplatform.core.entity.content.WorkCompleted; import com.x.processplatform.core.entity.content.WorkCompleted_; import com.x.processplatform.core.entity.content.WorkLog; -import com.x.processplatform.core.entity.element.Activity; -import com.x.processplatform.core.entity.element.ActivityType; import com.x.processplatform.core.entity.element.Application; import com.x.processplatform.core.entity.element.Form; -import com.x.processplatform.core.entity.element.Process; import com.x.query.core.entity.Item; import com.x.query.core.entity.Item_; @@ -350,196 +338,196 @@ abstract class BaseAction extends StandardJaxrsAction { JpaObject.singularAttributeField(Form.class, true, true), null); } - protected T get(Business business, EffectivePerson effectivePerson, - WorkCompleted workCompleted, Class cls) throws Exception { - T t = cls.newInstance(); - List woTaskCompleteds = new ArrayList<>(); - List woReadCompleteds = new ArrayList<>(); - Application application = null; - Process process = null; - Activity activity = null; - Long reviewCount = 0L; - - CompletableFuture future_taskCompleteds = CompletableFuture.runAsync(() -> { - try { - List os = business.entityManagerContainer() - .listEqual(TaskCompleted.class, TaskCompleted.job_FIELDNAME, workCompleted.getJob()).stream() - .sorted(Comparator.comparing(TaskCompleted::getStartTime, - Comparator.nullsLast(Date::compareTo))) - .collect(Collectors.toList()); - woTaskCompleteds.addAll(WoTaskCompleted.copier.copy(os)); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_reads = CompletableFuture.runAsync(() -> { - try { - List os = business.entityManagerContainer() - .listEqual(Read.class, Read.job_FIELDNAME, workCompleted.getJob()).stream() - .sorted(Comparator.comparing(Read::getStartTime, Comparator.nullsLast(Date::compareTo))) - .collect(Collectors.toList()); - t.getReadList().addAll(WoRead.copier.copy(os)); - t.setCurrentReadIndex(-1); - for (int i = 0; i < t.getReadList().size(); i++) { - if (StringUtils.equals(t.getReadList().get(i).getPerson(), - effectivePerson.getDistinguishedName())) { - t.setCurrentReadIndex(i); - break; - } - } - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_readCompleteds = CompletableFuture.runAsync(() -> { - try { - List os = business.entityManagerContainer() - .listEqual(ReadCompleted.class, ReadCompleted.job_FIELDNAME, workCompleted.getJob()).stream() - .sorted(Comparator.comparing(ReadCompleted::getStartTime, - Comparator.nullsLast(Date::compareTo))) - .collect(Collectors.toList()); - woReadCompleteds.addAll(WoReadCompleted.copier.copy(os)); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_attachments = CompletableFuture.runAsync(() -> { - try { - List os = business.entityManagerContainer() - .listEqual(Attachment.class, Attachment.job_FIELDNAME, workCompleted.getJob()).stream() - .sorted(Comparator.comparing(Attachment::getCreateTime, Comparator.nullsLast(Date::compareTo))) - .collect(Collectors.toList()); - t.setAttachmentList(WoAttachment.copier.copy(os)); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_workLogs = CompletableFuture.runAsync(() -> { - try { - List os = business.entityManagerContainer() - .listEqual(WorkLog.class, WorkLog.job_FIELDNAME, workCompleted.getJob()).stream() - .sorted(Comparator.comparing(WorkLog::getCreateTime, Comparator.nullsLast(Date::compareTo))) - .collect(Collectors.toList()); - t.setWorkLogList(WoWorkLog.copier.copy(os)); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_data = CompletableFuture.runAsync(() -> { - try { - t.setData(this.loadData(business, workCompleted)); - } catch (Exception e) { - logger.error(e); - } - }); - CompletableFuture future_application = CompletableFuture.supplyAsync(() -> { - Application o = null; - try { - o = business.application().pick(workCompleted.getApplication()); - } catch (Exception e) { - logger.error(e); - } - return o; - }); - CompletableFuture future_process = CompletableFuture.supplyAsync(() -> { - Process o = null; - try { - o = business.process().pick(workCompleted.getProcess()); - } catch (Exception e) { - logger.error(e); - } - return o; - }); - CompletableFuture future_reviewCount = CompletableFuture.supplyAsync(() -> { - Long o = 0L; - try { - o = business.entityManagerContainer().countEqualAndEqual(Review.class, Review.person_FIELDNAME, - effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, workCompleted.getJob()); - } catch (Exception e) { - logger.error(e); - } - return o; - }); - - future_taskCompleteds.get(300, TimeUnit.SECONDS); - future_reads.get(300, TimeUnit.SECONDS); - future_readCompleteds.get(300, TimeUnit.SECONDS); - future_attachments.get(300, TimeUnit.SECONDS); - future_workLogs.get(300, TimeUnit.SECONDS); - future_data.get(300, TimeUnit.SECONDS); - application = future_application.get(300, TimeUnit.SECONDS); - process = future_process.get(300, TimeUnit.SECONDS); - reviewCount = future_reviewCount.get(300, TimeUnit.SECONDS); - - t.setWorkCompleted(WoWorkCompleted.copier.copy(workCompleted)); - this.arrangeWorkLog(business, t, woTaskCompleteds, woReadCompleteds); - - WoControl control = new WoControl(); - /** 工作是否可以打开(管理员 或 有task,taskCompleted,read,readCompleted,review的人) */ - control.setAllowVisit(false); - /** 工作是否可以处理待阅(有read的人) */ - control.setAllowReadProcessing(false); - /** 工作是否可删除(管理员 或者 此活动在流程设计中允许删除且当前待办人是文件的创建者) */ - control.setAllowDelete(false); - /** 设置allowVisit */ - if ((t.getCurrentReadIndex() > -1) || (woTaskCompleteds.stream() - .filter(o -> StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())).count() > 0) - || (woReadCompleteds.stream() - .filter(o -> StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())) - .count() > 0) - || (reviewCount > 0)) { - control.setAllowVisit(true); - } else if (effectivePerson.isPerson(workCompleted.getCreatorPerson())) { - control.setAllowVisit(true); - } else if (business.canManageApplicationOrProcess(effectivePerson, application, process)) { - control.setAllowVisit(true); - } - /* 设置allowReadProcessing */ - if (t.getCurrentReadIndex() > -1) { - control.setAllowReadProcessing(true); - } - /* 设置 allowDelete */ - if (business.canManageApplicationOrProcess(effectivePerson, application, process)) { - control.setAllowDelete(true); - } - t.setControl(control); - return t; - } - - /* 如果通过已完成工作发送的已办有可能activityToken为空 */ - private void arrangeWorkLog(Business business, AbstractWo wo, List woTaskCompleteds, - List woReadCompleteds) throws Exception { - /* read 和 readCompleted 的 workLog o.getActivityToken 有可能为空 */ - ListTools.groupStick(wo.getWorkLogList(), - woTaskCompleteds.stream().filter(o -> StringUtils.isNotEmpty(o.getActivityToken())) - .collect(Collectors.toList()), - WorkLog.fromActivityToken_FIELDNAME, TaskCompleted.activityToken_FIELDNAME, "taskCompletedList"); - /* read 和 readCompleted 的 workLog o.getActivityToken 有可能为空 */ - ListTools.groupStick(wo.getWorkLogList(), - wo.getReadList().stream().filter(o -> StringUtils.isNotEmpty(o.getActivityToken())) - .collect(Collectors.toList()), - WorkLog.fromActivityToken_FIELDNAME, Read.activityToken_FIELDNAME, "readList"); - /* read 和 readCompleted 的 workLog o.getActivityToken 有可能为空 */ - ListTools.groupStick(wo.getWorkLogList(), - woReadCompleteds.stream().filter(o -> StringUtils.isNotEmpty(o.getActivityToken())) - .collect(Collectors.toList()), - WorkLog.fromActivityToken_FIELDNAME, ReadCompleted.activityToken_FIELDNAME, "readCompletedList"); - /* 将没有actiivityToken对应的已办或者待办绑定到最后一个end节点 */ - List tokens = ListTools.extractProperty(wo.getWorkLogList(), WorkLog.fromActivityToken_FIELDNAME, - String.class, true, true); - WoWorkLog latestEnd = wo.getWorkLogList().stream() - .filter(o -> Objects.equals(o.getArrivedActivityType(), ActivityType.end)).sorted(Comparator - .comparing(WorkLog::getArrivedTime, Comparator.nullsFirst(Date::compareTo)).reversed()) - .findFirst().orElse(null); - if (null != latestEnd) { - latestEnd.getReadList() - .addAll(wo.getReadList().stream().filter(o -> !tokens.contains(o.getActivityToken())).sorted( - Comparator.comparing(Read::getStartTime, Comparator.nullsFirst(Date::compareTo)).reversed()) - .collect(Collectors.toList())); - latestEnd.getReadCompletedList().addAll(woReadCompleteds.stream() - .filter(o -> !tokens.contains(o.getActivityToken())).sorted(Comparator - .comparing(ReadCompleted::getStartTime, Comparator.nullsFirst(Date::compareTo)).reversed()) - .collect(Collectors.toList())); - } - } +// protected T get(Business business, EffectivePerson effectivePerson, +// WorkCompleted workCompleted, Class cls) throws Exception { +// T t = cls.newInstance(); +// List woTaskCompleteds = new ArrayList<>(); +// List woReadCompleteds = new ArrayList<>(); +// Application application = null; +// Process process = null; +// Activity activity = null; +// Long reviewCount = 0L; +// +// CompletableFuture111111 future_taskCompleteds = CompletableFuture111111.runAsync(() -> { +// try { +// List os = business.entityManagerContainer() +// .listEqual(TaskCompleted.class, TaskCompleted.job_FIELDNAME, workCompleted.getJob()).stream() +// .sorted(Comparator.comparing(TaskCompleted::getStartTime, +// Comparator.nullsLast(Date::compareTo))) +// .collect(Collectors.toList()); +// woTaskCompleteds.addAll(WoTaskCompleted.copier.copy(os)); +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// CompletableFuture111111 future_reads = CompletableFuture111111.runAsync(() -> { +// try { +// List os = business.entityManagerContainer() +// .listEqual(Read.class, Read.job_FIELDNAME, workCompleted.getJob()).stream() +// .sorted(Comparator.comparing(Read::getStartTime, Comparator.nullsLast(Date::compareTo))) +// .collect(Collectors.toList()); +// t.getReadList().addAll(WoRead.copier.copy(os)); +// t.setCurrentReadIndex(-1); +// for (int i = 0; i < t.getReadList().size(); i++) { +// if (StringUtils.equals(t.getReadList().get(i).getPerson(), +// effectivePerson.getDistinguishedName())) { +// t.setCurrentReadIndex(i); +// break; +// } +// } +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// CompletableFuture111111 future_readCompleteds = CompletableFuture111111.runAsync(() -> { +// try { +// List os = business.entityManagerContainer() +// .listEqual(ReadCompleted.class, ReadCompleted.job_FIELDNAME, workCompleted.getJob()).stream() +// .sorted(Comparator.comparing(ReadCompleted::getStartTime, +// Comparator.nullsLast(Date::compareTo))) +// .collect(Collectors.toList()); +// woReadCompleteds.addAll(WoReadCompleted.copier.copy(os)); +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// CompletableFuture111111 future_attachments = CompletableFuture111111.runAsync(() -> { +// try { +// List os = business.entityManagerContainer() +// .listEqual(Attachment.class, Attachment.job_FIELDNAME, workCompleted.getJob()).stream() +// .sorted(Comparator.comparing(Attachment::getCreateTime, Comparator.nullsLast(Date::compareTo))) +// .collect(Collectors.toList()); +// t.setAttachmentList(WoAttachment.copier.copy(os)); +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// CompletableFuture111111 future_workLogs = CompletableFuture111111.runAsync(() -> { +// try { +// List os = business.entityManagerContainer() +// .listEqual(WorkLog.class, WorkLog.job_FIELDNAME, workCompleted.getJob()).stream() +// .sorted(Comparator.comparing(WorkLog::getCreateTime, Comparator.nullsLast(Date::compareTo))) +// .collect(Collectors.toList()); +// t.setWorkLogList(WoWorkLog.copier.copy(os)); +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// CompletableFuture111111 future_data = CompletableFuture111111.runAsync(() -> { +// try { +// t.setData(this.loadData(business, workCompleted)); +// } catch (Exception e) { +// logger.error(e); +// } +// }); +// CompletableFuture111111 future_application = CompletableFuture111111.supplyAsync(() -> { +// Application o = null; +// try { +// o = business.application().pick(workCompleted.getApplication()); +// } catch (Exception e) { +// logger.error(e); +// } +// return o; +// }); +// CompletableFuture111111 future_process = CompletableFuture111111.supplyAsync(() -> { +// Process o = null; +// try { +// o = business.process().pick(workCompleted.getProcess()); +// } catch (Exception e) { +// logger.error(e); +// } +// return o; +// }); +// CompletableFuture111111 future_reviewCount = CompletableFuture111111.supplyAsync(() -> { +// Long o = 0L; +// try { +// o = business.entityManagerContainer().countEqualAndEqual(Review.class, Review.person_FIELDNAME, +// effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, workCompleted.getJob()); +// } catch (Exception e) { +// logger.error(e); +// } +// return o; +// }); +// +// future_taskCompleteds.get(300, TimeUnit.SECONDS); +// future_reads.get(300, TimeUnit.SECONDS); +// future_readCompleteds.get(300, TimeUnit.SECONDS); +// future_attachments.get(300, TimeUnit.SECONDS); +// future_workLogs.get(300, TimeUnit.SECONDS); +// future_data.get(300, TimeUnit.SECONDS); +// application = future_application.get(300, TimeUnit.SECONDS); +// process = future_process.get(300, TimeUnit.SECONDS); +// reviewCount = future_reviewCount.get(300, TimeUnit.SECONDS); +// +// t.setWorkCompleted(WoWorkCompleted.copier.copy(workCompleted)); +// this.arrangeWorkLog(business, t, woTaskCompleteds, woReadCompleteds); +// +// WoControl control = new WoControl(); +// /** 工作是否可以打开(管理员 或 有task,taskCompleted,read,readCompleted,review的人) */ +// control.setAllowVisit(false); +// /** 工作是否可以处理待阅(有read的人) */ +// control.setAllowReadProcessing(false); +// /** 工作是否可删除(管理员 或者 此活动在流程设计中允许删除且当前待办人是文件的创建者) */ +// control.setAllowDelete(false); +// /** 设置allowVisit */ +// if ((t.getCurrentReadIndex() > -1) || (woTaskCompleteds.stream() +// .filter(o -> StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())).count() > 0) +// || (woReadCompleteds.stream() +// .filter(o -> StringUtils.equals(o.getPerson(), effectivePerson.getDistinguishedName())) +// .count() > 0) +// || (reviewCount > 0)) { +// control.setAllowVisit(true); +// } else if (effectivePerson.isPerson(workCompleted.getCreatorPerson())) { +// control.setAllowVisit(true); +// } else if (business.canManageApplicationOrProcess(effectivePerson, application, process)) { +// control.setAllowVisit(true); +// } +// /* 设置allowReadProcessing */ +// if (t.getCurrentReadIndex() > -1) { +// control.setAllowReadProcessing(true); +// } +// /* 设置 allowDelete */ +// if (business.canManageApplicationOrProcess(effectivePerson, application, process)) { +// control.setAllowDelete(true); +// } +// t.setControl(control); +// return t; +// } +// +// /* 如果通过已完成工作发送的已办有可能activityToken为空 */ +// private void arrangeWorkLog(Business business, AbstractWo wo, List woTaskCompleteds, +// List woReadCompleteds) throws Exception { +// /* read 和 readCompleted 的 workLog o.getActivityToken 有可能为空 */ +// ListTools.groupStick(wo.getWorkLogList(), +// woTaskCompleteds.stream().filter(o -> StringUtils.isNotEmpty(o.getActivityToken())) +// .collect(Collectors.toList()), +// WorkLog.fromActivityToken_FIELDNAME, TaskCompleted.activityToken_FIELDNAME, "taskCompletedList"); +// /* read 和 readCompleted 的 workLog o.getActivityToken 有可能为空 */ +// ListTools.groupStick(wo.getWorkLogList(), +// wo.getReadList().stream().filter(o -> StringUtils.isNotEmpty(o.getActivityToken())) +// .collect(Collectors.toList()), +// WorkLog.fromActivityToken_FIELDNAME, Read.activityToken_FIELDNAME, "readList"); +// /* read 和 readCompleted 的 workLog o.getActivityToken 有可能为空 */ +// ListTools.groupStick(wo.getWorkLogList(), +// woReadCompleteds.stream().filter(o -> StringUtils.isNotEmpty(o.getActivityToken())) +// .collect(Collectors.toList()), +// WorkLog.fromActivityToken_FIELDNAME, ReadCompleted.activityToken_FIELDNAME, "readCompletedList"); +// /* 将没有actiivityToken对应的已办或者待办绑定到最后一个end节点 */ +// List tokens = ListTools.extractProperty(wo.getWorkLogList(), WorkLog.fromActivityToken_FIELDNAME, +// String.class, true, true); +// WoWorkLog latestEnd = wo.getWorkLogList().stream() +// .filter(o -> Objects.equals(o.getArrivedActivityType(), ActivityType.end)).sorted(Comparator +// .comparing(WorkLog::getArrivedTime, Comparator.nullsFirst(Date::compareTo)).reversed()) +// .findFirst().orElse(null); +// if (null != latestEnd) { +// latestEnd.getReadList() +// .addAll(wo.getReadList().stream().filter(o -> !tokens.contains(o.getActivityToken())).sorted( +// Comparator.comparing(Read::getStartTime, Comparator.nullsFirst(Date::compareTo)).reversed()) +// .collect(Collectors.toList())); +// latestEnd.getReadCompletedList().addAll(woReadCompleteds.stream() +// .filter(o -> !tokens.contains(o.getActivityToken())).sorted(Comparator +// .comparing(ReadCompleted::getStartTime, Comparator.nullsFirst(Date::compareTo)).reversed()) +// .collect(Collectors.toList())); +// } +// } } diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/WorkCompletedAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/WorkCompletedAction.java index 4a20934f8857e88c2f5df95d3d1f4c77c3bf2968..8829025c6f4e33fc676f76c07e7a70b7146815ff 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/WorkCompletedAction.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/workcompleted/WorkCompletedAction.java @@ -95,115 +95,81 @@ public class WorkCompletedAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @JaxrsMethodDescribe(value = "获取复合的WorkCompleted.", action = ActionComplex.class) - @GET - @Path("{id}/complex") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void getComplex(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplex().execute(id, effectivePerson); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "获取复合的WorkCompleted.", action = ActionComplexMobile.class) - @GET - @Path("{id}/complex/mobile") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void getComplexMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplexMobile().execute(id, effectivePerson); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "获取复合的WorkCompleted,使用最后记录的表单。", action = ActionComplexSnapForm.class) - @GET - @Path("{id}/complex/snap/form") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void getComplexSnapForm(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplexSnapForm().execute(id, effectivePerson); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "获取复合的WorkCompleted,使用最后记录的Mobile表单。", action = ActionComplexSnapForm.class) - @GET - @Path("{id}/complex/snap/form/mobile") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void getComplexMobileSnapForm(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplexSnapForm().execute(id, effectivePerson); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据WorkCompleted Id获取组装的WorkCompleted内容同时返回指定的Form.", action = ActionComplexAppointForm.class) - @GET - @Path("{id}/complex/appoint/form/{formFlag}") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void getComplexAppointForm(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, - @JaxrsParameterDescribe("标识") @PathParam("id") String id, - @JaxrsParameterDescribe("表单标识") @PathParam("formFlag") String formFlag) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplexAppointForm().execute(effectivePerson, id, formFlag); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } - - @JaxrsMethodDescribe(value = "根据WorkCompleted Id获取组装的WorkCompleted内容.", action = ActionComplexAppointFormMobile.class) - @GET - @Path("{id}/complex/appoint/form/{formFlag}/mobile") - @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - @Consumes(MediaType.APPLICATION_JSON) - public void getComplexAppointFormMobile(@Suspended final AsyncResponse asyncResponse, - @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id, - @JaxrsParameterDescribe("表单标识") @PathParam("formFlag") String formFlag) { - ActionResult result = new ActionResult<>(); - EffectivePerson effectivePerson = this.effectivePerson(request); - try { - result = new ActionComplexAppointFormMobile().execute(effectivePerson, id, formFlag); - } catch (Exception e) { - logger.error(e, effectivePerson, request, null); - result.error(e); - } - asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - } +// @JaxrsMethodDescribe(value = "获取复合的WorkCompleted.", action = ActionComplex.class) +// @GET +// @Path("{id}/complex") +// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) +// @Consumes(MediaType.APPLICATION_JSON) +// public void getComplex(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, +// @JaxrsParameterDescribe("标识") @PathParam("id") String id) { +// ActionResult result = new ActionResult<>(); +// EffectivePerson effectivePerson = this.effectivePerson(request); +// try { +// result = new ActionComplex().execute(id, effectivePerson); +// } catch (Exception e) { +// logger.error(e, effectivePerson, request, null); +// result.error(e); +// } +// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); +// } + +// @JaxrsMethodDescribe(value = "获取复合的WorkCompleted.", action = ActionComplexMobile.class) +// @GET +// @Path("{id}/complex/mobile") +// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) +// @Consumes(MediaType.APPLICATION_JSON) +// public void getComplexMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, +// @JaxrsParameterDescribe("标识") @PathParam("id") String id) { +// ActionResult result = new ActionResult<>(); +// EffectivePerson effectivePerson = this.effectivePerson(request); +// try { +// result = new ActionComplexMobile().execute(id, effectivePerson); +// } catch (Exception e) { +// logger.error(e, effectivePerson, request, null); +// result.error(e); +// } +// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); +// } + + + +// @JaxrsMethodDescribe(value = "根据WorkCompleted Id获取组装的WorkCompleted内容同时返回指定的Form.", action = ActionComplexAppointForm.class) +// @GET +// @Path("{id}/complex/appoint/form/{formFlag}") +// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) +// @Consumes(MediaType.APPLICATION_JSON) +// public void getComplexAppointForm(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, +// @JaxrsParameterDescribe("标识") @PathParam("id") String id, +// @JaxrsParameterDescribe("表单标识") @PathParam("formFlag") String formFlag) { +// ActionResult result = new ActionResult<>(); +// EffectivePerson effectivePerson = this.effectivePerson(request); +// try { +// result = new ActionComplexAppointForm().execute(effectivePerson, id, formFlag); +// } catch (Exception e) { +// logger.error(e, effectivePerson, request, null); +// result.error(e); +// } +// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); +// } + +// @JaxrsMethodDescribe(value = "根据WorkCompleted Id获取组装的WorkCompleted内容.", action = ActionComplexAppointFormMobile.class) +// @GET +// @Path("{id}/complex/appoint/form/{formFlag}/mobile") +// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) +// @Consumes(MediaType.APPLICATION_JSON) +// public void getComplexAppointFormMobile(@Suspended final AsyncResponse asyncResponse, +// @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id, +// @JaxrsParameterDescribe("表单标识") @PathParam("formFlag") String formFlag) { +// ActionResult result = new ActionResult<>(); +// EffectivePerson effectivePerson = this.effectivePerson(request); +// try { +// result = new ActionComplexAppointFormMobile().execute(effectivePerson, id, formFlag); +// } catch (Exception e) { +// logger.error(e, effectivePerson, request, null); +// result.error(e); +// } +// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); +// } @JaxrsMethodDescribe(value = "统计当前用户创建的WorkCompleted,按应用分类.", action = ActionListCountWithApplication.class) @GET @@ -305,28 +271,6 @@ public class WorkCompletedAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - // @JaxrsMethodDescribe(value = "更新WorkCompleted中的extension字段.", action = - // ActionUpdateExtension.class) - // @PUT - // @Path("update/extension") - // @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) - // @Consumes(MediaType.APPLICATION_JSON) - // public void updateExtension(@Suspended final AsyncResponse asyncResponse, - // @Context HttpServletRequest request, - // @JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement - // jsonElement) { - // ActionResult result = new ActionResult<>(); - // EffectivePerson effectivePerson = this.effectivePerson(request); - // try { - // result = new ActionUpdateExtension().execute(effectivePerson, id, - // jsonElement); - // } catch (Exception e) { - // logger.error(e, effectivePerson, request, jsonElement); - // result.error(e); - // } - // asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); - // } - @JaxrsMethodDescribe(value = "获取工作内容.", action = ActionManageGet.class) @GET @Path("{id}/manage") @@ -441,6 +385,24 @@ public class WorkCompletedAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Get To Delete.", action = ActionManageDelete.class) + @GET + @Path("{id}/delete/manage/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageDeleteMockDeleteToGet(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult> result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageDelete().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "获取用于过滤的可选属性值", action = ActionManageFilterAttribute.class) @GET @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @@ -501,10 +463,10 @@ public class WorkCompletedAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @POST @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) @Path("process/{processFlag}") + @POST @JaxrsMethodDescribe(value = "创建已完成工作.", action = ActionCreate.class) public void create(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("流程标识") @PathParam("processFlag") String processFlag, JsonElement jsonElement) { @@ -519,11 +481,11 @@ public class WorkCompletedAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } - @PUT + @JaxrsMethodDescribe(value = "完成工作重新回滚.", action = ActionRollback.class) @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) @Consumes(MediaType.APPLICATION_JSON) @Path("{flag}/rollback") - @JaxrsMethodDescribe(value = "完成工作重新回滚.", action = ActionRollback.class) + @PUT public void rollback(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("流程标识") @PathParam("flag") String flag, JsonElement jsonElement) { ActionResult result = new ActionResult<>(); @@ -537,6 +499,24 @@ public class WorkCompletedAction extends StandardJaxrsAction { asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); } + @JaxrsMethodDescribe(value = "Mock Post To Put.", action = ActionRollback.class) + @Path("{flag}/rollback/mockputtopost") + @POST + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void rollbackMockPutToPost(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("流程标识") @PathParam("flag") String flag, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionRollback().execute(effectivePerson, flag, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + @JaxrsMethodDescribe(value = "按条件对WorkCompleted分页显示.", action = ActionManageListFilterPaging.class) @POST @Path("list/filter/{page}/size/{size}/manage") diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListRollbackWithWorkOrWorkCompleted.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListRollbackWithWorkOrWorkCompleted.java index c05c09697149740e034dc2ac26b066af72df8d3c..4c4a3e37b70944b57946497c71357b6e442c504f 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListRollbackWithWorkOrWorkCompleted.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListRollbackWithWorkOrWorkCompleted.java @@ -23,9 +23,6 @@ import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; import com.x.base.core.project.tools.ListTools; import com.x.processplatform.assemble.surface.Business; -import com.x.processplatform.assemble.surface.jaxrs.worklog.ActionListWithWorkOrWorkCompleted.WoRead; -import com.x.processplatform.assemble.surface.jaxrs.worklog.ActionListWithWorkOrWorkCompleted.WoReadCompleted; -import com.x.processplatform.assemble.surface.jaxrs.worklog.ActionListWithWorkOrWorkCompleted.WoTask; import com.x.processplatform.core.entity.content.Read; import com.x.processplatform.core.entity.content.ReadCompleted; import com.x.processplatform.core.entity.content.Task; @@ -40,9 +37,10 @@ class ActionListRollbackWithWorkOrWorkCompleted extends BaseAction { private final static String taskCompletedList_FIELDNAME = "taskCompletedList"; ActionResult> execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception { - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult> result = new ActionResult<>(); + ActionResult> result = new ActionResult<>(); + String job = null; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { Business business = new Business(emc); if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, @@ -50,29 +48,30 @@ class ActionListRollbackWithWorkOrWorkCompleted extends BaseAction { throw new ExceptionAccessDenied(effectivePerson); } - final String job = business.job().findWithWorkOrWorkCompleted(workOrWorkCompleted); - - CompletableFuture> future_taskCompleteds = CompletableFuture.supplyAsync(() -> { - return this.taskCompleteds(business, job); - }); - - CompletableFuture> future_workLogs = CompletableFuture.supplyAsync(() -> { - return this.workLogs(business, job); - }); - List taskCompleteds = future_taskCompleteds.get(); - List wos = future_workLogs.get(); - ListTools.groupStick(wos, taskCompleteds, WorkLog.fromActivityToken_FIELDNAME, - TaskCompleted.activityToken_FIELDNAME, taskCompletedList_FIELDNAME); - result.setData(wos); - return result; + job = business.job().findWithWorkOrWorkCompleted(workOrWorkCompleted); } + + final String workLogJob = job; + + CompletableFuture> future_taskCompleteds = CompletableFuture.supplyAsync(() -> { + return this.taskCompleteds(workLogJob); + }); + + CompletableFuture> future_workLogs = CompletableFuture.supplyAsync(() -> { + return this.workLogs(workLogJob); + }); + List taskCompleteds = future_taskCompleteds.get(); + List wos = future_workLogs.get(); + ListTools.groupStick(wos, taskCompleteds, WorkLog.fromActivityToken_FIELDNAME, + TaskCompleted.activityToken_FIELDNAME, taskCompletedList_FIELDNAME); + result.setData(wos); + return result; } - private List taskCompleteds(Business business, String job) { + private List taskCompleteds(String job) { List os = new ArrayList<>(); - try { - os = business.entityManagerContainer() - .fetchEqual(TaskCompleted.class, WoTaskCompleted.copier, TaskCompleted.job_FIELDNAME, job).stream() + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = emc.fetchEqual(TaskCompleted.class, WoTaskCompleted.copier, TaskCompleted.job_FIELDNAME, job).stream() .sorted(Comparator.comparing(TaskCompleted::getStartTime, Comparator.nullsLast(Date::compareTo))) .collect(Collectors.toList()); } catch (Exception e) { @@ -81,11 +80,10 @@ class ActionListRollbackWithWorkOrWorkCompleted extends BaseAction { return os; } - private List workLogs(Business business, String job) { + private List workLogs(String job) { List os = new ArrayList<>(); - try { - os = business.entityManagerContainer().fetchEqual(WorkLog.class, Wo.copier, WorkLog.job_FIELDNAME, job) - .stream() + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = emc.fetchEqual(WorkLog.class, Wo.copier, WorkLog.job_FIELDNAME, job).stream() .filter(o -> (!BooleanUtils.isTrue(o.getSplitting())) && (Objects.equals(o.getArrivedActivityType(), ActivityType.manual))) .sorted(Comparator.comparing(WorkLog::getCreateTime, Comparator.nullsLast(Date::compareTo))) diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListWithJob.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListWithJob.java index 30faa9d49d24298e5cdb756f57e52873fc787093..b06d683dc94215c4007def346b97e1fecb8e67db 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListWithJob.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListWithJob.java @@ -13,7 +13,6 @@ import com.x.base.core.entity.JpaObject; import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.exception.ExceptionAccessDenied; -import com.x.base.core.project.exception.ExceptionEntityNotExist; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.logger.Logger; @@ -36,53 +35,53 @@ class ActionListWithJob extends BaseAction { private final static String readCompletedList_FIELDNAME = "readCompletedList"; ActionResult> execute(EffectivePerson effectivePerson, String job) throws Exception { + ActionResult> result = new ActionResult<>(); try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult> result = new ActionResult<>(); Business business = new Business(emc); if (!business.readableWithJob(effectivePerson, job)) { throw new ExceptionAccessDenied(effectivePerson); } - - CompletableFuture> future_tasks = CompletableFuture.supplyAsync(() -> { - return this.tasks(business, job); - }); - CompletableFuture> future_taskCompleteds = CompletableFuture.supplyAsync(() -> { - return this.taskCompleteds(business, job); - }); - CompletableFuture> future_reads = CompletableFuture.supplyAsync(() -> { - return this.reads(business, job); - }); - CompletableFuture> future_readCompleteds = CompletableFuture.supplyAsync(() -> { - return this.readCompleteds(business, job); - }); - CompletableFuture> future_workLogs = CompletableFuture.supplyAsync(() -> { - return this.workLogs(business, job); - }); - List tasks = future_tasks.get(); - List taskCompleteds = future_taskCompleteds.get(); - List reads = future_reads.get(); - List readCompleteds = future_readCompleteds.get(); - List wos = future_workLogs.get(); - ListTools.groupStick(wos, tasks, WorkLog.fromActivityToken_FIELDNAME, Task.activityToken_FIELDNAME, - taskList_FIELDNAME); - ListTools.groupStick(wos, taskCompleteds, WorkLog.fromActivityToken_FIELDNAME, - TaskCompleted.activityToken_FIELDNAME, taskCompletedList_FIELDNAME); - ListTools.groupStick(wos, reads, WorkLog.fromActivityToken_FIELDNAME, Read.activityToken_FIELDNAME, - readList_FIELDNAME); - ListTools.groupStick(wos, readCompleteds, WorkLog.fromActivityToken_FIELDNAME, - ReadCompleted.activityToken_FIELDNAME, readCompletedList_FIELDNAME); - result.setData(wos); - return result; } + + CompletableFuture> future_tasks = CompletableFuture.supplyAsync(() -> { + return this.tasks(job); + }); + CompletableFuture> future_taskCompleteds = CompletableFuture.supplyAsync(() -> { + return this.taskCompleteds(job); + }); + CompletableFuture> future_reads = CompletableFuture.supplyAsync(() -> { + return this.reads(job); + }); + CompletableFuture> future_readCompleteds = CompletableFuture.supplyAsync(() -> { + return this.readCompleteds(job); + }); + CompletableFuture> future_workLogs = CompletableFuture.supplyAsync(() -> { + return this.workLogs(job); + }); + List tasks = future_tasks.get(); + List taskCompleteds = future_taskCompleteds.get(); + List reads = future_reads.get(); + List readCompleteds = future_readCompleteds.get(); + List wos = future_workLogs.get(); + ListTools.groupStick(wos, tasks, WorkLog.fromActivityToken_FIELDNAME, Task.activityToken_FIELDNAME, + taskList_FIELDNAME); + ListTools.groupStick(wos, taskCompleteds, WorkLog.fromActivityToken_FIELDNAME, + TaskCompleted.activityToken_FIELDNAME, taskCompletedList_FIELDNAME); + ListTools.groupStick(wos, reads, WorkLog.fromActivityToken_FIELDNAME, Read.activityToken_FIELDNAME, + readList_FIELDNAME); + ListTools.groupStick(wos, readCompleteds, WorkLog.fromActivityToken_FIELDNAME, + ReadCompleted.activityToken_FIELDNAME, readCompletedList_FIELDNAME); + result.setData(wos); + return result; } - private List tasks(Business business, String job) { + private List tasks(String job) { List os = new ArrayList<>(); - try { - os = business.entityManagerContainer().fetchEqual(Task.class, WoTask.copier, WoTask.job_FIELDNAME, job) - .stream().sorted(Comparator.comparing(Task::getStartTime, Comparator.nullsLast(Date::compareTo))) + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = emc.fetchEqual(Task.class, WoTask.copier, WoTask.job_FIELDNAME, job).stream() + .sorted(Comparator.comparing(Task::getStartTime, Comparator.nullsLast(Date::compareTo))) .collect(Collectors.toList()); } catch (Exception e) { logger.error(e); @@ -90,11 +89,10 @@ class ActionListWithJob extends BaseAction { return os; } - private List taskCompleteds(Business business, String job) { + private List taskCompleteds(String job) { List os = new ArrayList<>(); - try { - os = business.entityManagerContainer() - .fetchEqual(TaskCompleted.class, WoTaskCompleted.copier, TaskCompleted.job_FIELDNAME, job).stream() + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = emc.fetchEqual(TaskCompleted.class, WoTaskCompleted.copier, TaskCompleted.job_FIELDNAME, job).stream() .sorted(Comparator.comparing(TaskCompleted::getStartTime, Comparator.nullsLast(Date::compareTo))) .collect(Collectors.toList()); } catch (Exception e) { @@ -103,11 +101,11 @@ class ActionListWithJob extends BaseAction { return os; } - private List reads(Business business, String job) { + private List reads(String job) { List os = new ArrayList<>(); - try { - os = business.entityManagerContainer().fetchEqual(Read.class, WoRead.copier, Read.job_FIELDNAME, job) - .stream().sorted(Comparator.comparing(Read::getStartTime, Comparator.nullsLast(Date::compareTo))) + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = emc.fetchEqual(Read.class, WoRead.copier, Read.job_FIELDNAME, job).stream() + .sorted(Comparator.comparing(Read::getStartTime, Comparator.nullsLast(Date::compareTo))) .collect(Collectors.toList()); } catch (Exception e) { logger.error(e); @@ -115,11 +113,10 @@ class ActionListWithJob extends BaseAction { return os; } - private List readCompleteds(Business business, String job) { + private List readCompleteds(String job) { List os = new ArrayList<>(); - try { - os = business.entityManagerContainer() - .fetchEqual(ReadCompleted.class, WoReadCompleted.copier, ReadCompleted.job_FIELDNAME, job).stream() + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = emc.fetchEqual(ReadCompleted.class, WoReadCompleted.copier, ReadCompleted.job_FIELDNAME, job).stream() .sorted(Comparator.comparing(ReadCompleted::getStartTime, Comparator.nullsLast(Date::compareTo))) .collect(Collectors.toList()); } catch (Exception e) { @@ -128,10 +125,10 @@ class ActionListWithJob extends BaseAction { return os; } - private List workLogs(Business business, String job) { + private List workLogs(String job) { List os = new ArrayList<>(); - try { - os = business.entityManagerContainer().fetchEqual(WorkLog.class, Wo.copier, WorkLog.job_FIELDNAME, job); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = emc.fetchEqual(WorkLog.class, Wo.copier, WorkLog.job_FIELDNAME, job); return os.stream() .sorted(Comparator.comparing(Wo::getFromTime, Comparator.nullsLast(Date::compareTo)) .thenComparing(Wo::getArrivedTime, Comparator.nullsLast(Date::compareTo))) diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListWithWorkOrWorkCompleted.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListWithWorkOrWorkCompleted.java index 9b8b7a73aa6938af265a50d751078ec9cfa60c0b..e5e015dc097da66c5bfa6931ae2576b14a61c0d0 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListWithWorkOrWorkCompleted.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/worklog/ActionListWithWorkOrWorkCompleted.java @@ -44,41 +44,53 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction { private final static String READCOMPLETEDLIST_FIELDNAME = "readCompletedList"; ActionResult> execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception { + ActionResult> result = new ActionResult<>(); + String job = null; try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult> result = new ActionResult<>(); - Business business = new Business(emc); + job = business.job().findWithWorkOrWorkCompleted(workOrWorkCompleted); + } - if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, - new ExceptionEntityNotExist(workOrWorkCompleted))) { - throw new ExceptionAccessDenied(effectivePerson); + final String workLogJob = job; + + CompletableFuture> _tasks = CompletableFuture.supplyAsync(() -> { + return this.tasks(workLogJob); + }); + CompletableFuture> _taskCompleteds = CompletableFuture.supplyAsync(() -> { + return this.taskCompleteds(workLogJob); + }); + CompletableFuture> _reads = CompletableFuture.supplyAsync(() -> { + return this.reads(workLogJob); + }); + CompletableFuture> _readCompleteds = CompletableFuture.supplyAsync(() -> { + return this.readCompleteds(workLogJob); + }); + CompletableFuture> _workLogs = CompletableFuture.supplyAsync(() -> { + return this.workLogs(workLogJob); + }); + CompletableFuture _control = CompletableFuture.supplyAsync(() -> { + Boolean value = false; + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + value = business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted, + new ExceptionEntityNotExist(workOrWorkCompleted)); + } catch (Exception e) { + logger.error(e); } + return value; + }); - final String job = business.job().findWithWorkOrWorkCompleted(workOrWorkCompleted); - - CompletableFuture> future_tasks = CompletableFuture.supplyAsync(() -> { - return this.tasks(business, job); - }); - CompletableFuture> future_taskCompleteds = CompletableFuture.supplyAsync(() -> { - return this.taskCompleteds(business, job); - }); - CompletableFuture> future_reads = CompletableFuture.supplyAsync(() -> { - return this.reads(business, job); - }); - CompletableFuture> future_readCompleteds = CompletableFuture.supplyAsync(() -> { - return this.readCompleteds(business, job); - }); - CompletableFuture> future_workLogs = CompletableFuture.supplyAsync(() -> { - return this.workLogs(business, job); - }); - List tasks = future_tasks.get(); - List taskCompleteds = future_taskCompleteds.get(); - List reads = future_reads.get(); - List readCompleteds = future_readCompleteds.get(); - List workLogs = future_workLogs.get(); + if (BooleanUtils.isFalse(_control.get())) { + throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted); + } + List tasks = _tasks.get(); + List taskCompleteds = _taskCompleteds.get(); + List reads = _reads.get(); + List readCompleteds = _readCompleteds.get(); + List workLogs = _workLogs.get(); + if (!workLogs.isEmpty()) { WorkLogTree tree = new WorkLogTree(workLogs); - List wos = new ArrayList<>(); for (WorkLog o : workLogs.stream().filter(o -> Objects.equals(ActivityType.manual, o.getFromActivityType())) .collect(Collectors.toList())) { @@ -129,21 +141,15 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction { ListTools.groupStick(wos, readCompleteds, WorkLog.fromActivityToken_FIELDNAME, ReadCompleted.activityToken_FIELDNAME, READCOMPLETEDLIST_FIELDNAME); result.setData(wos); - result.setData(wos); - return result; } + return result; } - private List tasks(Business business, String job) { + private List tasks(String job) { List os = new ArrayList<>(); - try { - // os = business.entityManagerContainer().fetchEqual(Task.class, WoTask.copier, - // WoTask.job_FIELDNAME, job) - // .stream().sorted(Comparator.comparing(Task::getStartTime, - // Comparator.nullsLast(Date::compareTo))) - // .collect(Collectors.toList()); - os = WoTask.copier.copy(business.entityManagerContainer().listEqual(Task.class, Task.job_FIELDNAME, job) - .stream().sorted(Comparator.comparing(Task::getStartTime, Comparator.nullsLast(Date::compareTo))) + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = WoTask.copier.copy(emc.listEqual(Task.class, Task.job_FIELDNAME, job).stream() + .sorted(Comparator.comparing(Task::getStartTime, Comparator.nullsLast(Date::compareTo))) .collect(Collectors.toList())); } catch (Exception e) { logger.error(e); @@ -151,11 +157,10 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction { return os; } - private List taskCompleteds(Business business, String job) { + private List taskCompleteds(String job) { List os = new ArrayList<>(); - try { - os = business.entityManagerContainer() - .fetchEqual(TaskCompleted.class, WoTaskCompleted.copier, TaskCompleted.job_FIELDNAME, job).stream() + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = emc.fetchEqual(TaskCompleted.class, WoTaskCompleted.copier, TaskCompleted.job_FIELDNAME, job).stream() .sorted(Comparator.comparing(TaskCompleted::getStartTime, Comparator.nullsLast(Date::compareTo))) .collect(Collectors.toList()); } catch (Exception e) { @@ -164,11 +169,11 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction { return os; } - private List reads(Business business, String job) { + private List reads(String job) { List os = new ArrayList<>(); - try { - os = business.entityManagerContainer().fetchEqual(Read.class, WoRead.copier, Read.job_FIELDNAME, job) - .stream().sorted(Comparator.comparing(Read::getStartTime, Comparator.nullsLast(Date::compareTo))) + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = emc.fetchEqual(Read.class, WoRead.copier, Read.job_FIELDNAME, job).stream() + .sorted(Comparator.comparing(Read::getStartTime, Comparator.nullsLast(Date::compareTo))) .collect(Collectors.toList()); } catch (Exception e) { logger.error(e); @@ -176,11 +181,10 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction { return os; } - private List readCompleteds(Business business, String job) { + private List readCompleteds(String job) { List os = new ArrayList<>(); - try { - os = business.entityManagerContainer() - .fetchEqual(ReadCompleted.class, WoReadCompleted.copier, ReadCompleted.job_FIELDNAME, job).stream() + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = emc.fetchEqual(ReadCompleted.class, WoReadCompleted.copier, ReadCompleted.job_FIELDNAME, job).stream() .sorted(Comparator.comparing(ReadCompleted::getStartTime, Comparator.nullsLast(Date::compareTo))) .collect(Collectors.toList()); } catch (Exception e) { @@ -189,10 +193,10 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction { return os; } - private List workLogs(Business business, String job) { + private List workLogs(String job) { List os = new ArrayList<>(); - try { - os = business.entityManagerContainer().listEqual(WorkLog.class, WorkLog.job_FIELDNAME, job); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + os = emc.listEqual(WorkLog.class, WorkLog.job_FIELDNAME, job); return os.stream() .sorted(Comparator.comparing(WorkLog::getFromTime, Comparator.nullsLast(Date::compareTo)) .thenComparing(WorkLog::getArrivedTime, Comparator.nullsLast(Date::compareTo))) diff --git a/o2server/x_processplatform_assemble_surface/src/test/resources/lob.json b/o2server/x_processplatform_assemble_surface/src/test/resources/lob.json deleted file mode 100644 index 64d5b9c5b880f46362fc4082c307666c16e6fc81..0000000000000000000000000000000000000000 --- a/o2server/x_processplatform_assemble_surface/src/test/resources/lob.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "data1": "asddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfas11", - "data2": "asddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfasasddfasdfas22" -} \ No newline at end of file diff --git a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompleted.java b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompleted.java index e91c84d34864913a7d5ad5e611da9755676a231b..8201f2c86e03f6f1b80c7f26a8f5d147e11e7cd8 100644 --- a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompleted.java +++ b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompleted.java @@ -98,7 +98,7 @@ public class WorkCompleted extends SliceJpaObject implements ProjectionInterface /** * 通过Work创建WorkCompleted */ - public WorkCompleted(Work work, Date completedTime, Long duration, String formData, String formMobileData) { + public WorkCompleted(Work work, Date completedTime, Long duration) { this(); this.job = work.getJob(); this.setTitle(work.getTitle()); @@ -117,8 +117,8 @@ public class WorkCompleted extends SliceJpaObject implements ProjectionInterface this.processAlias = work.getProcessAlias(); this.serial = work.getSerial(); this.form = work.getForm(); - this.formData = formData; - this.formMobileData = formMobileData; +// this.formData = formData; +// this.formMobileData = formMobileData; this.work = work.getId(); this.expireTime = work.getExpireTime(); if ((null != expireTime) && (completedTime.after(expireTime))) { @@ -281,21 +281,21 @@ public class WorkCompleted extends SliceJpaObject implements ProjectionInterface @CheckPersist(allowEmpty = true) private String form; - public static final String formData_FIELDNAME = "formData"; - @FieldDescribe("文本内容.") - @Lob - @Basic(fetch = FetchType.EAGER) - @Column(length = JpaObject.length_10M, name = ColumnNamePrefix + formData_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String formData; - - public static final String formMobileData_FIELDNAME = "formMobileData"; - @FieldDescribe("移动端文本内容.") - @Lob - @Basic(fetch = FetchType.EAGER) - @Column(length = JpaObject.length_10M, name = ColumnNamePrefix + formMobileData_FIELDNAME) - @CheckPersist(allowEmpty = true) - private String formMobileData; +// public static final String formData_FIELDNAME = "formData"; +// @FieldDescribe("文本内容.") +// @Lob +// @Basic(fetch = FetchType.EAGER) +// @Column(length = JpaObject.length_10M, name = ColumnNamePrefix + formData_FIELDNAME) +// @CheckPersist(allowEmpty = true) +// private String formData; + +// public static final String formMobileData_FIELDNAME = "formMobileData"; +// @FieldDescribe("移动端文本内容.") +// @Lob +// @Basic(fetch = FetchType.EAGER) +// @Column(length = JpaObject.length_10M, name = ColumnNamePrefix + formMobileData_FIELDNAME) +// @CheckPersist(allowEmpty = true) +// private String formMobileData; public static final String work_FIELDNAME = "work"; @Flag @@ -714,21 +714,21 @@ public class WorkCompleted extends SliceJpaObject implements ProjectionInterface this.completedTimeMonth = completedTimeMonth; } - public String getFormData() { - return formData; - } - - public void setFormData(String formData) { - this.formData = formData; - } - - public String getFormMobileData() { - return formMobileData; - } - - public void setFormMobileData(String formMobileData) { - this.formMobileData = formMobileData; - } +// public String getFormData() { +// return formData; +// } +// +// public void setFormData(String formData) { +// this.formData = formData; +// } +// +// public String getFormMobileData() { +// return formMobileData; +// } +// +// public void setFormMobileData(String formMobileData) { +// this.formMobileData = formMobileData; +// } public Long getDuration() { return duration; diff --git a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompletedProperties.java b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompletedProperties.java index 92f8a345f7638b7d4998fa9cfcf0d8cc583420c0..b997d27fbbc57c72ef4fea5549ced300af843285 100644 --- a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompletedProperties.java +++ b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/WorkCompletedProperties.java @@ -1,11 +1,15 @@ package com.x.processplatform.core.entity.content; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import com.x.base.core.entity.JsonProperties; import com.x.base.core.project.annotation.FieldDescribe; +import com.x.base.core.project.gson.GsonPropertyObject; import com.x.processplatform.core.entity.element.Form; +import com.x.processplatform.core.entity.element.Script; public class WorkCompletedProperties extends JsonProperties { @@ -28,19 +32,10 @@ public class WorkCompletedProperties extends JsonProperties { private List workLogList = new ArrayList<>(); @FieldDescribe("合并工作Form") - private Form form; + private StoreForm storeForm; - @FieldDescribe("合并工作relatedFormList") - private List
relatedFormList = new ArrayList<>(); - - @FieldDescribe("合并工作relatedScriptList") - private List - - - + @@ -23,5 +19,10 @@
+ + + + + diff --git a/o2web/source/x_desktop/portalmobile.html b/o2web/source/x_desktop/portalmobile.html index 7ee2305478287da233bb59e7231850c59c819240..ba8230343388165a3187480779d5f1c1c4e93ea5 100644 --- a/o2web/source/x_desktop/portalmobile.html +++ b/o2web/source/x_desktop/portalmobile.html @@ -2,14 +2,10 @@ - - - - - - - - + + + + @@ -23,6 +19,12 @@
-
+
+ + + + + + diff --git a/o2web/source/x_desktop/printWork.html b/o2web/source/x_desktop/printWork.html index a008c1b3ad066e84aeaa88a598e4598f5ea8b855..2568bd39a0ae87f6dcef2b05bc71eaf6a6504c2f 100644 --- a/o2web/source/x_desktop/printWork.html +++ b/o2web/source/x_desktop/printWork.html @@ -6,9 +6,8 @@ - + - WORK diff --git a/o2web/source/x_desktop/smapsso.html b/o2web/source/x_desktop/smapsso.html index 8f817a2eee00a9db4f988af0cbdd354927eaf56b..6719123659378439f532901eea4f31f560b8774a 100644 --- a/o2web/source/x_desktop/smapsso.html +++ b/o2web/source/x_desktop/smapsso.html @@ -38,7 +38,7 @@ requests.push( getServiceAddressConfigObject(function(address){ requests.each(function(res){ - if (res.isRunning()){res.cancel();} + if (res.isRunning && res.isRunning()){res.cancel();} }); if (callback) callback(address); }.bind(this), center) @@ -74,12 +74,17 @@ window.layout = {}; window.layout.config = config; getServiceAddress(config, function(address){ + debugger; var uri = new URI(window.location.toString()); var xtoken = uri.getData("SMAP_SESSION_DATA"); var appID = uri.getData("appID"); var uniqueId = uri.getData("uniqueId"); + var flushPortalUrl = uri.getData("flushPortalUrl") || ""; + if( flushPortalUrl && flushPortalUrl.indexOf("%2F") === -1 ){ + flushPortalUrl = encodeURIComponent(flushPortalUrl); + } var redirect = uri.getData("redirect"); - redirect = redirect + "&uniqueId=" + uniqueId; + redirect = redirect + "&uniqueId=" + uniqueId + "&flushPortalUrl="+flushPortalUrl; if (xtoken){ var res = new Request.JSON({ url: o2.filterUrl(address+"?SMAP_SESSION_DATA="+encodeURIComponent(xtoken)+"&appID="+appID+"&date="+(new Date()).getTime()), @@ -91,7 +96,7 @@ var result = responseJSON.data.value; if(result){ if (redirect){ - window.location = redirect; + window.location = redirect; }else{ window.location = "/"; } diff --git a/o2web/source/x_desktop/work.html b/o2web/source/x_desktop/work.html index 1d6ccdf91411dbf6b220ffbc474f0d9b8aeaf77a..c7f89c1e2fe1f39578f9d5bbe21d48957a186378 100644 --- a/o2web/source/x_desktop/work.html +++ b/o2web/source/x_desktop/work.html @@ -3,7 +3,7 @@ - + WORK @@ -15,5 +15,6 @@ + diff --git a/o2web/source/x_desktop/workmobile.html b/o2web/source/x_desktop/workmobile.html index 6c6de2c62040f169e35a5ff1391e2ffc62d2b94b..ad82b99d9d2ad7aa38df7c80f0923b0852e7655a 100644 --- a/o2web/source/x_desktop/workmobile.html +++ b/o2web/source/x_desktop/workmobile.html @@ -5,13 +5,8 @@ + - - - - - - @@ -25,5 +20,12 @@
+ + + + + + + diff --git a/o2web/source/x_desktop/workmobilewithaction.html b/o2web/source/x_desktop/workmobilewithaction.html index a3e3ec5e6dfa63819ffa85b33f0d086ffae55974..e9f2fb8e8af7351eb2f4efb77a02e27033df6eee 100644 --- a/o2web/source/x_desktop/workmobilewithaction.html +++ b/o2web/source/x_desktop/workmobilewithaction.html @@ -6,13 +6,7 @@ - - - - - - - + @@ -36,7 +30,13 @@ - + + + + + + + - \ No newline at end of file + diff --git a/package.json b/package.json index 29527ac75a79993a40c20aba85015e819f56deca..b6531a76a242ef92bdb18e9dce8cd7e97192fd39 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "preperation:arm": "gulp preperation --e arm", "preperation:macos": "gulp preperation --e macos", "preperation:risc": "gulp preperation --e risc", - "preperation:rpi": "gulp preperation --e raspberrypi", + "preperation:rpi": "gulp preperation --e raspi", "build_server": "gulp build_server", "build_server_script": "cd o2server && mvn clean && mvn install", "build_web": "gulp build_web", @@ -23,7 +23,7 @@ "deploy:arm": "gulp deploy --e arm", "deploy:macos": "gulp deploy --e macos", "deploy:risc": "gulp deploy --e risc", - "deploy:rpi": "gulp deploy --e raspberrypi", + "deploy:rpi": "gulp deploy --e raspi", "typeInfor": "type welcome && echo Your server is build success: target/o2server/", "clear": "gulp clear_build", "clear_deploy": "gulp clear_deploy",