一、初始化
public ModuleResultexecute(NewRecordDTO contextDTO) {
if ("init".equals(contextDTO.getAction())) {
return this.init(contextDTO);
} else {
return this.addRecord(contextDTO);
}
}
保存测试后 contextDTO.getAction() 值为 "do"
问题1:啥时候是init,走 init() 方法
答:点击修改按钮后,进入页面初始化方法。
二、解析 addRecord(contextDTO) 方法
/**
*
* <p>新增记录</p>
*
* @param contextDTO 数据传输上下文DTO
* @return 操作结果
* @author zhou_xy
* @version 1.0, Apr 28, 2014
* @since NDA 2.0
*
*/
public ModuleResult addRecord(NewRecordDTO contextDTO) {
String parentId = "";
String objectTypeId = "";
String libId = contextDTO.getLibId();
objectTypeId = contextDTO.getObjectTypeId();
// 如果指定了类型,则增加指定类型的记录
if (StringUtils.isNotEmpty(contextDTO.getObjectTypeId())) {
objectTypeId = contextDTO.getObjectTypeId();
}
// 如果指定父id
if(StringUtils.isNotEmpty(contextDTO.getParentId())) {
parentId = contextDTO.getParentId();
} else {
parentId = "";
}
List<ObjectBeanDTO> objects = contextDTO.getObjectBeans();
ModuleParameters moduleParam = contextDTO.getParameters();
String[] hiddenFields = moduleParam.getStrings(RecordConstants.PARAM_HIDDEN_FIELDS + objectTypeId);
List<String> skipFieldList = recordManagerService.createSkipFileds(hiddenFields);
String objectId = recordManagerService.addOrUpdateRecord(libId, objectTypeId, objects, parentId, skipFieldList, contextDTO.getParam());
log.biz("新增一卷/件档案");
ModuleResult result = new ModuleResult();
result.setResult(objectId);
return result;
}
传参例子
[
{
"key":"newrecord",
"operation":"newrecord",
"moduleInstanceId":"52d842a30c8d4717991b79704e12b6c7",
"libId":"b9a51a0eaf33452bad6583db837df47f",
"objectTypeId":"39dd6d799b2044efab14b73a92620bde",
"target":"this",
"functionId":"47e7efc6c090403285e20f5993ebab07",
"parentId":"",
"fondsId":"07b445ce64ac4fa480d368e88ad5912a",
"param":"ARRANGE:00$SJLY:1$TRANSFEROUTSTATUS",
"objects":[
],
"moduleContext":true,
"operateTime":1700115074659,
"objectFilters":[
{
"filterName":"function",
"filterTag":"47e7efc6c090403285e20f5993ebab07"
},
{
"filterName":"sysSecurityLevel",
"filterTag":"47e7efc6c090403285e20f5993ebab07"
}
],
"action":"do",
"objecttypeId":null,
"objectBeans":[
{
"objectTypeId":null,
"fieldList":[
{
"name":"父记录ID",
"id":"6bb4e68f5122445a8e9383852c439ecb",
"format":"",
"fieldName":"C_PARENT",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"档案馆名称",
"id":"11663355c4514b16ba9a517389fa779b",
"format":"",
"fieldName":"DAGMC",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"档号",
"id":"580d6a2c1b97443e95136b43cd74b4e6",
"format":"",
"fieldName":"DH",
"editType":2,
"dataType":1,
"value":"xy 测试 002"
},
{
"name":"档案馆代码",
"id":"925e8ccdc20a4e47b13dd7967390773f",
"format":"",
"fieldName":"DAGDM",
"editType":2,
"dataType":1,
"value":"001"
},
{
"name":"立档单位名称",
"id":"648a83788f834622b1e4aed3af212f36",
"format":"",
"fieldName":"LDDW",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"全宗名称",
"id":"af7f2f36aa5f46b5b8829e9203929c60",
"format":"",
"fieldName":"QZMC",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"电子文件号(文件编号)",
"id":"4e742bf8a1ff4d18bdb292eb5dda7b54",
"format":"",
"fieldName":"DZWJH",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"全宗号",
"id":"9c8ceb16cf0f46b0b4f7b15fd3556a5e",
"format":"",
"fieldName":"QZH",
"editType":2,
"dataType":1,
"value":"893910"
},
{
"name":"目录号",
"id":"695592a9bab448b7b62ab4bac90be964",
"format":"",
"fieldName":"MLH",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"档案门类代码",
"id":"e5053de660e0421b8dc79bc5c4e57427",
"format":"",
"fieldName":"ML",
"editType":3,
"dataType":1,
"value":"WS"
},
{
"name":"年度",
"id":"44487213ce8a40978824b4944edd3b45",
"format":"",
"fieldName":"ND",
"editType":2,
"dataType":3,
"value":"2023"
},
{
"name":"保管期限",
"id":"82d393c46b2047b896cc5ecd35802d10",
"format":"",
"fieldName":"BGQX",
"editType":3,
"dataType":1,
"value":null
},
{
"name":"机构或问题",
"id":"7626e15be033478abf180ab838e1b122",
"format":"",
"fieldName":"JGHWT",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"类别号",
"id":"ce2bcb86dec448bd86a5d841e9336415",
"format":"",
"fieldName":"LBH",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"馆编件号",
"id":"93a087f3c17142d68d3e2416737c2705",
"format":"",
"fieldName":"GBJH",
"editType":2,
"dataType":3,
"value":""
},
{
"name":"页号",
"id":"6dcd7cd3e8434ac8bebbdc2ed0b98a8d",
"format":"",
"fieldName":"ZYH",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"题名",
"id":"8668edbdf5ba4c57aa45ffcc04182833",
"format":"",
"fieldName":"TM",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"并列题名",
"id":"dbdb26915f2a4c538c1a5f57c1d07879",
"format":"",
"fieldName":"BLTM",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"副题名",
"id":"be650cda82bb4b4aaed033c7dd4fd7ee",
"format":"",
"fieldName":"FTM",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"说明题名文字",
"id":"34f90c5c254846499b7bab74ab0b58e1",
"format":"",
"fieldName":"SMTMWZ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"主题词",
"id":"b61aabec58284189ab9d1fd963e6e944",
"format":"",
"fieldName":"ZTC",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"关键词",
"id":"bd05ea197f4b4bca9981ad9ec69b18f3",
"format":"",
"fieldName":"GJC",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"人名",
"id":"e47068cc42d04d609682358b63a63584",
"format":"",
"fieldName":"RM",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"摘要",
"id":"681bf9615921432488690ce5d8c47954",
"format":"",
"fieldName":"TY",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"分类号",
"id":"2073dc7530384e1bba69a4df698d2306",
"format":"",
"fieldName":"FLH",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"文号",
"id":"eb4a42adb641494ba4ccaa4061298d04",
"format":"",
"fieldName":"WJBH",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"责任者",
"id":"48b66f97d7fd459e87c61dfd979b65d7",
"format":"",
"fieldName":"ZRZ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"日期",
"id":"6ae9e3030cc7418487aad145c84fc053",
"format":"",
"fieldName":"RQ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"归档日期",
"id":"fb9ab205796a46b39743b037be8813cf",
"format":"",
"fieldName":"GDRQ",
"editType":2,
"dataType":2,
"value":""
},
{
"name":"归档部门",
"id":"a872bc3ce49447f9b288eda64b007dc5",
"format":"",
"fieldName":"JGDM",
"editType":3,
"dataType":1,
"value":"归档部门"
},
{
"name":"文种",
"id":"a98706f8d4184fc09ea3e0bc487d4afe",
"format":"",
"fieldName":"WZ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"紧急程度",
"id":"c44b6afa29694e54a77e161018a17fab",
"format":"",
"fieldName":"JJCD",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"主送",
"id":"43e3726db4504e32b2764fd2c6a855b0",
"format":"",
"fieldName":"ZS",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"抄送",
"id":"17e704c27e4e4535ab8c630c7e95b097",
"format":"",
"fieldName":"CS",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"密级",
"id":"16a4e71031af4413a792f575d599efa5",
"format":"",
"fieldName":"MJ",
"editType":3,
"dataType":1,
"value":null
},
{
"name":"保密期限",
"id":"a852d79e6d1143299d7985e7f4fc8f15",
"format":"",
"fieldName":"BMQX",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"页数",
"id":"633f36a0d3ac4346974af5f35d0ffa82",
"format":"",
"fieldName":"YS",
"editType":2,
"dataType":3,
"value":""
},
{
"name":"附注",
"id":"71fa1e0e527f4daea3069c7c8c963ece",
"format":"",
"fieldName":"FZ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"盒号",
"id":"72315bc41d2f45999275434680cfddc6",
"format":"",
"fieldName":"HH",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"件号",
"id":"46a0db152c0a47c9b088599a4ffe2a32",
"format":"",
"fieldName":"LSH",
"editType":2,
"dataType":6,
"value":null
},
{
"name":"成文时间",
"id":"6fdc1fe4714845abbd5e223a8c1c35f5",
"format":"",
"fieldName":"CWSJ",
"editType":2,
"dataType":2,
"value":""
},
{
"name":"稿本",
"id":"f86ce72d413f4fa19372c36a64dabf27",
"format":"",
"fieldName":"GB",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"移交状态",
"id":"53b9203b93024e3197858d177b8dcdf1",
"format":"",
"fieldName":"TRANSFERPERSTATUS",
"editType":3,
"dataType":1,
"value":"01"
},
{
"name":"包含电子文件",
"id":"b492076ed6a94326936b4dce97ca2b18",
"format":"",
"fieldName":"DZWJ",
"editType":2,
"dataType":1,
"value":"否"
},
{
"name":"缩微号",
"id":"453a7e59714a45c7b6ba93da6e172e0c",
"format":"",
"fieldName":"SWH",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"备注",
"id":"06f617fff3d34eb18bcb8ba3fdb129b0",
"format":"",
"fieldName":"BZ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"移交人",
"id":"1be8490258fc4bbb8bcf116cb716c8c4",
"format":"",
"fieldName":"YJR",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"宗外移交",
"id":"0e310b9af4094126a03f67316dd43462",
"format":"",
"fieldName":"TRANSFEROUTSTATUS",
"editType":3,
"dataType":1,
"value":null
},
{
"name":"宗内移交部门",
"id":"235eba94316a433aba59e513d675229b",
"format":"",
"fieldName":"TRANSFERDEPARTMENT",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"宗内移交日期",
"id":"5a548d73b3474c4ebc764902a36efa83",
"format":"",
"fieldName":"TRANSFERDATE",
"editType":2,
"dataType":2,
"value":""
},
{
"name":"宗内退回意见",
"id":"7ecf8d9f489b49049d9dcc1cc9555a71",
"format":"",
"fieldName":"RETURNVIEWS",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"整理状态",
"id":"32c5a36ded454f4a877d2dd754750fb0",
"format":"",
"fieldName":"ARRANGE",
"editType":3,
"dataType":1,
"value":null
},
{
"name":"宗外打回原因",
"id":"05aee9b6e69b40b29d49c7f375b06881",
"format":"",
"fieldName":"CALLBACKREASION",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"出库状态",
"id":"094e2d32a3b14aafa000941897380169",
"format":"",
"fieldName":"CKZT",
"editType":3,
"dataType":1,
"value":"03"
},
{
"name":"宗内接收人",
"id":"73722ce7386b40e6bc883e28cfe8ba92",
"format":"",
"fieldName":"TRANSFERRECEIVEPERSON",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"期限状态",
"id":"ffa99a242cd84dbea38b52b6d64c07b5",
"format":"",
"fieldName":"QXZT",
"editType":3,
"dataType":1,
"value":"01"
},
{
"name":"监控状态",
"id":"32312cc154ae48c8a6e43588d62659d1",
"format":"",
"fieldName":"C_MONITOR_STATE",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"监控文件名称",
"id":"d5d90c081ee94857b5a707e76a5f96f2",
"format":"",
"fieldName":"C_MONITOR_ITEMNAME",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"宗内移交人",
"id":"25639d389187432588bf30ca29ba7a33",
"format":"",
"fieldName":"TRANSFERPERSONNAME",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"存放位置",
"id":"7cd1bd84ae594c93b1552c34476d35fe",
"format":"",
"fieldName":"CFWZ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"控制标识",
"id":"f6959a749498432fae3779d8acc31e6b",
"format":"",
"fieldName":"KZBS",
"editType":3,
"dataType":1,
"value":"01"
},
{
"name":"整改情况说明",
"id":"686553dc3eb94c1e9d7804c247f446e0",
"format":"",
"fieldName":"ZGQKSM",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"整改截止时间",
"id":"22dbec664aca42fa8a48c4ed25cd0feb",
"format":"",
"fieldName":"ZGJZSJ",
"editType":2,
"dataType":2,
"value":""
},
{
"name":"移交进馆状态",
"id":"d857bc46ec5245e9815516d94bda8153",
"format":"",
"fieldName":"TRANSFERINSTATUS",
"editType":3,
"dataType":1,
"value":"0"
},
{
"name":"格式转换状态",
"id":"e726b335eb5e4fd3ab427d4da954c075",
"format":"",
"fieldName":"C_CONVETSTATUS",
"editType":3,
"dataType":1,
"value":"02"
},
{
"name":"归档范围ID",
"id":"64358cd9c62b4ec3b2432af1c482b3b6",
"format":"",
"fieldName":"C_ARCHIVING_SCOPEID",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"是否归档",
"id":"af605dea415b4ce7a6eccf96a8d098ef",
"format":"",
"fieldName":"C_ISARCHIVING",
"editType":3,
"dataType":1,
"value":null
},
{
"name":"归档范围鉴定状态",
"id":"bcbbd3a9c976478eac9f5010a7397876",
"format":"",
"fieldName":"GDFWJDZT",
"editType":3,
"dataType":1,
"value":"0"
},
{
"name":"法律效力",
"id":"2cde94bf6ecb4f08b2dd5ae4862458ca",
"format":"",
"fieldName":"FLXL",
"editType":3,
"dataType":1,
"value":null
},
{
"name":"划控结果",
"id":"080881741367457f81f7bb336b8ff89c",
"format":"",
"fieldName":"HKJG",
"editType":3,
"dataType":1,
"value":null
},
{
"name":"数据来源",
"id":"6b75ac22b3764aa7b9174e948206d883",
"format":"",
"fieldName":"SJLY",
"editType":3,
"dataType":1,
"value":null
},
{
"name":"检查结果",
"id":"5a50b1362bd5422e9eb0cf4dcc10e960",
"format":"",
"fieldName":"CHECKRESULT",
"editType":3,
"dataType":1,
"value":null
},
{
"name":"移交鉴定审批结果",
"id":"bc915c12eff14bf09c39a91fb9a5ea2e",
"format":"",
"fieldName":"YJJDSPJG",
"editType":3,
"dataType":1,
"value":null
},
{
"name":"销毁状态",
"id":"4616c5b6768a4c958a0d53915c672f56",
"format":"",
"fieldName":"XHZT",
"editType":3,
"dataType":1,
"value":null
},
{
"name":"聚合层次",
"id":"79f1e6069ba640b28a05b0ab6e855ccd",
"format":"",
"fieldName":"JHCC",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"子件号",
"id":"7706035bd1c9439e9c836ddbd1d72d7a",
"format":"",
"fieldName":"ZJH",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"文件组合类型",
"id":"22580acadf3740a5bbe2e64cdef95cef",
"format":"",
"fieldName":"WJZHLX",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"格式信息",
"id":"ab498fe10a574184a321d5c2de8c4e55",
"format":"",
"fieldName":"GSXX",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"计算机文件名",
"id":"60f627d682d14945a20fbc5cde7614a0",
"format":"",
"fieldName":"JSJWJM",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"计算机文件大小",
"id":"625b0412bed74ed9ace6041a32fc8daa",
"format":"",
"fieldName":"JSJWJDX",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"文档创建程序",
"id":"bb8b9bb86d424cb9b2c83706045b5686",
"format":"",
"fieldName":"WDCJCX",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"信息系统描述",
"id":"91bf78e2dc4c45368420315c9113b12f",
"format":"",
"fieldName":"XXXTMS",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"当前位置",
"id":"40345280a56c49d49bec157c164e2e4f",
"format":"",
"fieldName":"DQWZ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"脱机载体编号",
"id":"77485814327a47a1bacd8ff9566d29e4",
"format":"",
"fieldName":"TJZTBH",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"脱机载体存址",
"id":"b479edd82fb64442bcb13b44706627c6",
"format":"",
"fieldName":"TJZTCZ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"签名规则",
"id":"d0c4b05aafc9491cb1c4391691bd7b9e",
"format":"",
"fieldName":"QMGZ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"签名时间",
"id":"aa893ea34bf24b568a90d108ef403310",
"format":"",
"fieldName":"QMSJ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"签名人",
"id":"39eaaec645d34efb91a94e3fc61bb1b0",
"format":"",
"fieldName":"QMR",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"签名结果",
"id":"9235dbafdd7e40f29024afca91cb6016",
"format":"",
"fieldName":"QMJG",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"证书",
"id":"657aa8f559ff4df38ecbaf9e1e90c7a1",
"format":"",
"fieldName":"ZHENGSHU",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"证书引证",
"id":"fdf17750954145e78bdba1ac289b8fef",
"format":"",
"fieldName":"ZSYZ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"签名算法标识",
"id":"f7bedce0f966461caa8a84ed104346e8",
"format":"",
"fieldName":"QMSFBS",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"数字化时间",
"id":"8b68a5af0a934a1dae1770d2d93cdc50",
"format":"",
"fieldName":"SZHSJ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"数字化对象描述",
"id":"9fa1d13205ae4a238015d2c978ac15ac",
"format":"",
"fieldName":"SZHDXMS",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"数字化授权信息",
"id":"f48adbabc7724e0199fbd06737711452",
"format":"",
"fieldName":"SZHSQXX",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"色彩空间",
"id":"c426d8ac998f447696ed2cb0d0ddb440",
"format":"",
"fieldName":"SCKJ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"扫描分辨率",
"id":"d37bdac459cf401b841df342ed5da79b",
"format":"",
"fieldName":"SMFBL",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"扫描色彩模式",
"id":"9b740cec33594abf8c187b8fc65dd27b",
"format":"",
"fieldName":"SMSCMS",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"存储格式",
"id":"d2f0af9da8034808bad85e8ab920bef1",
"format":"",
"fieldName":"CCGS",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"存储路径",
"id":"b7086595fefd4674af2d5812c876d17e",
"format":"",
"fieldName":"CCLJ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"扫描设备类型",
"id":"1ae8688e3b134af0880d063fe27af262",
"format":"",
"fieldName":"SMSBLX",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"扫描设备制造商",
"id":"3074de2ed8ab43dba8fb1a1e5cef82d4",
"format":"",
"fieldName":"SMSBZZS",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"扫描设备型号",
"id":"9299bddfee9f4a97a01a58cd81221967",
"format":"",
"fieldName":"SMSBXH",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"数字化软件名称",
"id":"d969e3870e144787a2d54b40f0874b90",
"format":"",
"fieldName":"SZHRJMC",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"数字化软件版本",
"id":"4abb745e8cda48f8a1b1651ac9f740bc",
"format":"",
"fieldName":"SZHRJBB",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"数字化软件生产商",
"id":"a440590a6cf84e1b82e874ed010f0898",
"format":"",
"fieldName":"SZHRJSCS",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"阅读所需软硬件条件",
"id":"6bf17f38bf474780ada329439d810497",
"format":"",
"fieldName":"YDSXRYJTJ",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"数字化成果移交接收信息",
"id":"2bf8182012cd42608291b2b974e3d979",
"format":"",
"fieldName":"SZHCGYJJSXX",
"editType":2,
"dataType":1,
"value":null
},
{
"name":"删除人",
"id":"a1a95a1146094299a711f4af59e68760",
"format":"",
"fieldName":"SCR",
"editType":2,
"dataType":1,
"value":null
}
]
}
]
}
]
获取基础值
libId (库id) 例:b9a51a0eaf33452bad6583db837df47f
objectTypeId (类型id、文档记录的唯一标识) 例:39dd6d799b2044efab14b73a92620bde
parentId (父记录id(如果不是记录是则为空))
以上值都是才传参中获取
获取ObjectBeanDTO,内容为表单值
List<ObjectBeanDTO> objects = contextDTO.getObjectBeans();
获取隐藏字段集合
ModuleParameters moduleParam = contextDTO.getParameters();
String[] hiddenFields = moduleParam.getStrings(RecordConstants.PARAM_HIDDEN_FIELDS + objectTypeId);
List<String> skipFieldList = recordManagerService.createSkipFileds(hiddenFields);
2.1 保存与修改
String objectId = recordManagerService.addOrUpdateRecord(libId, objectTypeId, objects, parentId, skipFieldList, contextDTO.getParam());
public String addOrUpdateRecord(String libId, String objectTypeId, List<ObjectBeanDTO> objects, String parentId, List<String> skipFieldList, String param) {
String objId = null;
OMContextDTO omContext = new OMContextDTO(libId, objectTypeId);
IObjectManager om = ObjectManagerFactory.load(omContext);
IVerification iVerification = om.getInstance(ActionTypeConst.VERIFICATION);
ObjectTypeDTO objectTypeDTO = ObjectTypeManager.getInstance().getCopy(libId, objectTypeId);
ObjectDTO objectDTO = null;
ObjectBeanDTO objectBeanDTO = null;
ObjectBean objectbean = null;
RecordFieldDTO fieldDTO = null;
List<RecordFieldDTO> fieldDTOList = null;
ObjectDTO updateObject = null;
String updateValue = null;
FieldDTO skipFieldDTO = null;
String param1 = "";
String arrenger = "";
//2021.03.23修改 【利用反馈】-【修改】,点击【保存】弹出系统错误。(由于LibDTO强转是时发生错误,以下没有使用该变量所以注释 掉) start
// 记录业务过程元数据
//LibDTO libsDTO = (LibDTO) ObjectUtil.getObject(null, libId);
//List<String> objectTypeIds = libsDTO.getObjectTypeIds();
List<String> objectTypeIds = new ArrayList<String>();
//2021.03.23修改 【利用反馈】-【修改】,点击【保存】弹出系统错误。 end
String ywgcTypeId = null;
// ArchiveNumberRuleShowDTO archiveNumberRuleShowDTO = archiveNumberRuleService.getArchiveNumberDTObyObjectAndType(libId, objectTypeId);
// if(archiveNumberRuleShowDTO == null)
// {
// // 取得模板配置
// String templateId = libRelationCacheService.getTemplate(libId);
// archiveNumberRuleShowDTO = archiveNumberRuleService.getArchiveNumberDTObyObjectAndType(templateId, objectTypeId);
// }
for (int i = 0, len = objects.size(); i < len; i++) {
objectDTO = new ObjectDTO();
objectBeanDTO = objects.get(i);
if (null == objectBeanDTO) {
continue;
}
objectbean = new ObjectBean();
objectbean.setString(DefaultFieldConst.OBJECT_ID, objectBeanDTO.getObjectId());
fieldDTOList = objectBeanDTO.getFieldList();
// if (archiveNumberRuleShowDTO != null)
// {
// // 計算檔號
// archiveNumberRuleService.saveArchiveNumberValue(archiveNumberRuleShowDTO, objectbean);
// }
objectDTO.setBean(objectbean);
// if (iVerification.validate(objectDTO, skipFieldList))
// {
if (StringUtils.isEmpty(objectDTO.getId()) || "0".equals(objectDTO.getId())) {
objectbean.setFields(objectTypeDTO.getFieldList());
for (int t = 0, fieldLen = fieldDTOList.size(); t < fieldLen; t++) {
fieldDTO = fieldDTOList.get(t);
this.setField(libId, objectTypeId, objectbean, fieldDTO, fieldDTOList, true);
}
if (!StringUtils.isEmpty(parentId)) {
objectbean.setString(DefaultFieldConst.OBJECT_PARENT_ID, parentId);
}
objectbean.setString(DefaultFieldConst.OBJECT_LIB_ID, libId);
//-------------制度相关-----------
List<FieldDTO> fieldList = new ArrayList<FieldDTO>();
fieldList = objectTypeDTO.getFieldList();
int fieldSize = fieldList.size();
boolean updateFlag = false;
if (fieldList != null && fieldSize > 0) {
for (FieldDTO fieldaDTO : fieldList) {
String fieldName = fieldaDTO.getFieldName();
if ("BBH".equals(fieldName)) {
updateFlag = true;
break;
}
}
}
if (updateFlag) {
//初始版本号
String version = "00000000000000000000000000000001";
objectDTO.getBean().setString("C_VERSION", version);
objectDTO.getBean().setString("BBH", "V" + VersionUtil.getInstance().getDisplay(version));
}
//-------------------------------
Map<String, String> fieldValues = this.parseParam(param);
BusinessUtil.modifyArrangementDefaultValue(objectDTO, fieldValues);
if (iVerification.validate(objectDTO, skipFieldList)) {
objId = om.add(objectDTO);
param1 = "add";
arrenger = objectDTO.getBean().getString("ARRANGE");
for (String typeid : objectTypeIds) {
//20201207 去掉新增和修改保存业务过程 元数据
//BusinessUtil.saveYwgcTool(libId, typeid, objId, objectTypeId, param1, arrenger);
}
//String libId, String objectTypeId, String archiveId,String param
//saveYwgcInfo(libId, objectTypeId,objId,"add");
}
Map<String, Object> paramY = new HashMap<String, Object>();
paramY.put("objectId", objId);
paramY.put("YWXW", "新增");
paramY.put("XWYJ", "新增");
paramY.put("XWMS", "新增");
BusinessProcessUtil.saveBusinessProcess(paramY);
} else {
List<String> updateFieldNames = new ArrayList<String>();
for (RecordFieldDTO recordFieldDTO : fieldDTOList) {
updateFieldNames.add(recordFieldDTO.getFieldName());
}
List<FieldDTO> updateFields = new ArrayList<FieldDTO>();
for (FieldDTO field : objectTypeDTO.getFieldList()) {
if (updateFieldNames.contains(field.getFieldName())) {
updateFields.add(field);
}
}
objectbean.setFields(updateFields);
for (int t = 0, fieldLen = fieldDTOList.size(); t < fieldLen; t++) {
fieldDTO = fieldDTOList.get(t);
this.setField(libId, objectTypeId, objectbean, fieldDTO, fieldDTOList, true);
}
objId = objectDTO.getId();
if (skipFieldList != null && skipFieldList.size() > 0) {
// 处理列表类型在不显示在页面的情况下,带不上原始值
for (int j = 0, skipLen = skipFieldList.size(); j < skipLen; j++) {
skipFieldDTO = ObjectUtil.getFieldByName(libId, objectTypeId, skipFieldList.get(j));
if (skipFieldDTO != null && skipFieldDTO.getDataType() == DataType.STRING && (skipFieldDTO.getEditType() == EditType.LIST || skipFieldDTO.getEditType() == EditType.EDIT_LIST || skipFieldDTO.getEditType() == EditType.MULTI_EDIT_LIST || skipFieldDTO.getEditType() == EditType.MULTI_LIST)) {
updateObject = ObjectUtil.getObject(libId, objId);
updateValue = updateObject.getProperty(skipFieldList.get(j));
if (!StringUtils.isEmpty(updateValue)) {
objectDTO.getBean().setString(skipFieldList.get(j), updateValue);
}
}
}
}
if (iVerification.validate(objectDTO, skipFieldList)) {
om.update(objectDTO);
param1 = "update";
arrenger = objectDTO.getBean().getString("ARRANGE");
for (String typeid : objectTypeIds) {
//20201207 去掉新增和修改保存业务过程 元数据
//BusinessUtil.saveYwgcTool(libId, typeid, objectDTO.getId(), objectTypeId, param1, arrenger);
}
//saveYwgcInfo(libId, objectTypeId,objId,"update");
}
Map<String, Object> paramY = null;
paramY = new HashMap<String, Object>();
paramY.put("objectId", objId);
paramY.put("YWXW", "修改");
paramY.put("XWYJ", "修改");
paramY.put("XWMS", "修改");
BusinessProcessUtil.saveBusinessProcess(paramY);
}
}
2.1.1 初始化声明与赋值
String objId = null;
OMContextDTO omContext = new OMContextDTO(libId, objectTypeId);
IObjectManager om = ObjectManagerFactory.load(omContext);
IVerification iVerification = om.getInstance(ActionTypeConst.VERIFICATION);
ObjectTypeDTO objectTypeDTO = ObjectTypeManager.getInstance().getCopy(libId, objectTypeId);
ObjectDTO objectDTO = null;
ObjectBeanDTO objectBeanDTO = null;
ObjectBean objectbean = null;
RecordFieldDTO fieldDTO = null;
List<RecordFieldDTO> fieldDTOList = null;
ObjectDTO updateObject = null;
String updateValue = null;
FieldDTO skipFieldDTO = null;
String param1 = "";
String arrenger = "";
通过 libId, objectTypeId 获取omContext (对象管理类相关信息)
OMContextDTO omContext = new OMContextDTO(libId, objectTypeId);
获取校验的对象解析
IVerification iVerification = om.getInstance(ActionTypeConst.VERIFICATION);
可同时存储多个
for (int i = 0, len = objects.size(); i < len; i++) {
// 新的数据对象
objectDTO = new ObjectDTO();
// 前台传过来的数据对象
objectBeanDTO = objects.get(i);
if (null == objectBeanDTO) {
continue;
}
objectbean = new ObjectBean();
objectbean.setString(DefaultFieldConst.OBJECT_ID, objectBeanDTO.getObjectId());
// 字段值集合
fieldDTOList = objectBeanDTO.getFieldList();
判断保存还是修改
if (StringUtils.isEmpty(objectDTO.getId()) || "0".equals(objectDTO.getId()))
2.1.2 保存
根据字段设置字段值
objectbean.setFields(objectTypeDTO.getFieldList());
for (int t = 0, fieldLen = fieldDTOList.size(); t < fieldLen; t++) {
fieldDTO = fieldDTOList.get(t);
// 主要方法
this.setField(libId, objectTypeId, objectbean, fieldDTO, fieldDTOList, true);
}
if (!StringUtils.isEmpty(parentId)) {
objectbean.setString(DefaultFieldConst.OBJECT_PARENT_ID, parentId);
}
objectbean.setString(DefaultFieldConst.OBJECT_LIB_ID, libId);
制度相关
若返回字段中有字段名为 BBH 的,则修改版本号
//-------------制度相关-----------
List<FieldDTO> fieldList = new ArrayList<FieldDTO>();
fieldList = objectTypeDTO.getFieldList();
int fieldSize = fieldList.size();
boolean updateFlag = false;
if (fieldList != null && fieldSize > 0) {
for (FieldDTO fieldaDTO : fieldList) {
String fieldName = fieldaDTO.getFieldName();
if ("BBH".equals(fieldName)) {
updateFlag = true;
break;
}
}
}
if (updateFlag) {
//初始版本号
String version = "00000000000000000000000000000001";
objectDTO.getBean().setString("C_VERSION", version);
objectDTO.getBean().setString("BBH", "V" + VersionUtil.getInstance().getDisplay(version));
}
//-------------------------------
解析前端传过来的参数
转换成 Map
Map<String, String> fieldValues = this.parseParam(param);
整理默认字段值
根据角色等判断默认值
BusinessUtil.modifyArrangementDefaultValue(objectDTO, fieldValues);
添加存储过程记录
Map<String, Object> paramY = null;
paramY = new HashMap<String, Object>();
paramY.put("objectId", objId);
paramY.put("YWXW", "新增");
paramY.put("XWYJ", "新增");
paramY.put("XWMS", "新增");
BusinessProcessUtil.saveBusinessProcess(paramY);
2.1.3 修改
获取修改字段值
List<String> updateFieldNames = new ArrayList<String>();
for (RecordFieldDTO recordFieldDTO : fieldDTOList) {
updateFieldNames.add(recordFieldDTO.getFieldName());
}
List<FieldDTO> updateFields = new ArrayList<FieldDTO>();
for (FieldDTO field : objectTypeDTO.getFieldList()) {
if (updateFieldNames.contains(field.getFieldName())) {
updateFields.add(field);
}
}
objectbean.setFields(updateFields);
根据字段的类型,设置字段值
for (int t = 0, fieldLen = fieldDTOList.size(); t < fieldLen; t++) {
fieldDTO = fieldDTOList.get(t);
this.setField(libId, objectTypeId, objectbean, fieldDTO, fieldDTOList, true);
}
处理隐藏字段
if (skipFieldList != null && skipFieldList.size() > 0) {
// 处理列表类型在不显示在页面的情况下,带不上原始值
for (int j = 0, skipLen = skipFieldList.size(); j < skipLen; j++) {
skipFieldDTO = ObjectUtil.getFieldByName(libId, objectTypeId, skipFieldList.get(j));
if (skipFieldDTO != null && skipFieldDTO.getDataType() == DataType.STRING && (skipFieldDTO.getEditType() == EditType.LIST || skipFieldDTO.getEditType() == EditType.EDIT_LIST || skipFieldDTO.getEditType() == EditType.MULTI_EDIT_LIST || skipFieldDTO.getEditType() == EditType.MULTI_LIST)) {
updateObject = ObjectUtil.getObject(libId, objId);
// 获取属性值
updateValue = updateObject.getProperty(skipFieldList.get(j));
if (!StringUtils.isEmpty(updateValue)) {
objectDTO.getBean().setString(skipFieldList.get(j), updateValue);
}
}
}
}
来自修改电子文件元数据的保存,对隐藏项做合法校验
if (iVerification.validate(objectDTO, skipFieldList)) {
om.update(objectDTO);
param1 = "update";
arrenger = objectDTO.getBean().getString("ARRANGE");
for (String typeid : objectTypeIds) {
//20201207 去掉新增和修改保存业务过程 元数据
//BusinessUtil.saveYwgcTool(libId, typeid, objectDTO.getId(), objectTypeId, param1, arrenger);
}
//saveYwgcInfo(libId, objectTypeId,objId,"update");
}
添加存储过程记录
Map<String, Object> paramY = null;
paramY = new HashMap<String, Object>();
paramY.put("objectId", objId);
paramY.put("YWXW", "新增");
paramY.put("XWYJ", "新增");
paramY.put("XWMS", "新增");
BusinessProcessUtil.saveBusinessProcess(paramY);
2.1.4 返回值
返回存值ID
return objId;