平台升级打包
平台在开发服务器上开发完成后需要部署到生产服务器上. 此功能把开发完成的功能打包成更新包.然后通过[平台更新]功能上传更新包并执行. 这样就完成了开发到生产的部署过程
选择资源
选择表模型文件
使用场景
- 二开项目上需要新增一些无表单依赖的表模型 (如果是有菜单依赖的表模型无需选择)
- 数据维护更新补丁
注意:
表模型的更新是不支持表数据删除操作,如果需要删除数据请使用[选择脚本文件]
选择jar文件
- 使用场景
- 二开项目
- 平台的新版本发布
选择脚本文件
- 使用场景
- 需要个性的新增/修改/删除数据库的某些记录,数据维护更新补丁
- 例子 5.0.2script.groovy
import groovy.ui.SystemOutputInterceptor
import com.kdayun.z1.core.context.Context
import com.kdayun.z1.core.util.SqlExecutor
import com.kdayun.z1.core.util.FileUitls
import com.kdayun.z1.core.message.MessageUtil
import org.springframework.util.StringUtils
import com.kdayun.manager.common.CoreMsgUpdate
public void start() {
SqlExecutor sqlExecutor=Context.getInstance().getBean("sqlExecutor")
if(sqlExecutor==null) {
throw new Exception("更新失败,无法获取sqlExecutor类的bean实例");
}
def sqls="""UPDATE core_model_design SET MODELD_VALUE = replace(MODELD_VALUE, 'zheling', 'kdayun') ;
UPDATE core_dictionarymx SET ZDZ_ZIDZ = replace(ZDZ_ZIDZ, 'zheling', 'kdayun') ;
UPDATE core_plan SET BEANCLASS = replace(BEANCLASS, 'zheling', 'kdayun') ;
UPDATE core_plugin SET TUPDZ = replace(TUPDZ, 'zheling', 'kdayun'),CHAJLJ = replace(CHAJLJ, 'zheling', 'kdayun'),XINXZLJ = replace(XINXZLJ, 'zheling', 'kdayun'),SHEZLJ = replace(SHEZLJ, 'zheling', 'kdayun') ;
UPDATE core_res SET RES_ACTION = replace(RES_ACTION, 'zheling', 'kdayun') ;
UPDATE act_ge_bytearray SET BYTES_ = replace(BYTES_, 'zheling', 'kdayun') ;
UPDATE core_sysopt SET XTYPE = replace(XTYPE, 'zheling', 'kdayun') ;
UPDATE bd_org SET JIANC='所有机构' ,OBJNAME='所有机构' where RWID='9C876276D8884BFF94DF343E2A4EED7D';
UPDATE core_res SET OBJNAME='机构管理' where RWID='698431E0B2A049169864086DE67DAF1D';
UPDATE core_res SET OBJNAME='机构管理' where RWID='73EBEC07002340DBB927C9BF9F45ECEA';
UPDATE core_filesres SET WJZY_MINGC='机构管理' where RWID='02763F4988DA42B082FFB019DD584CCA';
UPDATE core_filesres set WJZY_ZIYLJ=replace(WJZY_ZIYLJ, '/filesres/', '/static/filesres/') WHERE WJZY_ZIYLJ LIKE '/filesres/%';
UPDATE core_sysopt set V = replace(V, '/filesres/', '/static/filesres/') WHERE V LIKE '%filesres/%' AND V NOT LIKE '%/static/filesres/%';
UPDATE core_sysoptmx set V = replace(V, '/filesres/', '/static/filesres/') WHERE V LIKE '%filesres/%';
UPDATE core_user set TOUX = replace(TOUX, '/filesres/', '/static/filesres/') WHERE TOUX LIKE '/filesres/%';
UPDATE core_model_design set MODELD_VALUE=replace(MODELD_VALUE, '/filesres/', '/static/filesres/') WHERE MODELD_VALUE LIKE '%/filesres/%';
delete FROM core_tables_columns a where a.MXZD_TABLEID IN ( SELECT RWID from core_tables where MX_BIANH='core_model_event');
delete FROM core_tables_indexs a where a.MXSY_TABLEID IN ( SELECT RWID from core_tables where MX_BIANH='core_model_event');
delete FROM core_tables_links a where a.MXYS_TABLEID IN ( SELECT RWID from core_tables where MX_BIANH='core_model_event');
delete FROM core_tables_columns a where a.MXZD_TABLEID IN ( SELECT RWID from core_tables where MX_BIANH='core_model_default');
delete FROM core_tables_indexs a where a.MXSY_TABLEID IN ( SELECT RWID from core_tables where MX_BIANH='core_model_default');
delete FROM core_tables_links a where a.MXYS_TABLEID IN ( SELECT RWID from core_tables where MX_BIANH='core_model_default');
DROP TABLE IF EXISTS `core_model_event`;
DROP TABLE IF EXISTS `core_model_default`;"""
String[] sqlarry=sqls.split(";");
System.out.println(sqlarry)
for(int i=0;i<sqlarry.length;i++) {
sqlExecutor.execSqlBatch(sqlarry[i]);
}
Context.getInstance().logService.info("execSqlBatch:"+sqls)
//删除了一些不需要的文件
def delFile=[
"static/framework/dbtable.js",
"static/framework/echarts.1.js",
"static/framework/echarts.js",
"static/framework/echartsTheme.js",
"static/framework/echartTooltipExt.js",
"static/framework/editform.json",
"static/framework/PageForm.json",
"static/framework/zlDataSet.js",
"static/framework/zlDigitalCardFlipper.js",
"static/framework/zlEditform.js",
"static/framework/zlFrame.js",
"static/framework/zlGridEditForm.js",
"static/framework/zlGridPage.js",
"static/framework/zlImgList.js",
"static/framework/zlRollTable.js",
"static/appdata/filesres/excelTemplate/BsBudChengzjxx.xls",
"static/appdata/filesres/excelTemplate/BsBudFangwdj.xls",
"static/appdata/filesres/excelTemplate/BsBudFangwdjDaor.xls",
"static/appdata/filesres/excelTemplate/BsBudShebxx.xls",
"static/appdata/filesres/excelTemplate/BsBudShebxxdj.xls",
"static/image/adoutbc.png",
"static/image/China.jpg",
"static/image/datasource.png",
"static/image/home.png",
"static/image/page.png",
"static/image/phone.png",
"static/image/shadow-left.png",
"static/image/shadow-right.png",
"static/image/version.png",
"static/image/video.png",
"static/image/wechat.png",
"static/image/zlwc.png",
"static/image/鍙橀噺.png",
"static/libs/formdesign/libs/ztree/js/jquery.ztree.all.min11.js",
"static/libs/formdesign/static/image/bigscreen/earth-rotate.d4a0f112.gif",
"static/libs/formdesign/static/image/blue/dark",
"static/libs/layui/lay/modules/table - 鍓湰 (2).js",
"static/libs/layui/lay/modules/table - 鍓湰.js",
"static/modules/manager/coretable/dbtable.html",
"update/datas.groovy",
"update/update_main.groovy",
"view/manager/coretables/dbtable.html"
]
Context.getInstance().logService.info("script delFile size[{}]",delFile.size())
for(int i=0;i<delFile.size();i++) {
try {
def file=FileUitls.getClassRealPath(delFile[i]);
Context.getInstance().logService.info("script delFile [{}]",file)
FileUitls.deleteFile(file)
}catch(Exception e){
Context.getInstance().logService.info("script delFile error:{}",e.toString())
}
}
//删除目录
def deldir = [
"view/manager/test",
"static/libs/easyui",
"static/debug",
"static/modules/manager/datas",
"static/modules/manager/functions",
"static/modules/web/layuiadmin",
]
Context.getInstance().logService.info("script deldir size[{}]",deldir.size())
for(int i=0;i<deldir.size();i++) {
try {
def dir=FileUitls.getClassRealPath(deldir[i]);
Context.getInstance().logService.info("script deldir [{}]",dir)
FileUitls.deleteDirectory(dir)
}catch(Exception e){
Context.getInstance().logService.info("script deldir error:{}",e.toString())
}
}
}
//执行脚本
start();
选择资源文件
使用场景
- 二开项目的个性静态文件文件(js,css,图片…等)
选择菜单打包
使用场景
- 一般的开发都会用到.(菜单的依赖资源有:表单,功能,资源,权限,流程,报表,静态文件….等等)
执行打包/下载更新包
注意:
该功能存在脚本注入的风险.必须严格控制生产环境的[平台更新]功能权限.
作者:texbox 创建时间:2023-10-17 15:34
最后编辑:texbox 更新时间:2024-10-17 08:28
最后编辑:texbox 更新时间:2024-10-17 08:28