pruple_boy 1 year ago
parent
commit
acc09cc21b

+ 112 - 0
mjava-shanghaishiwei/src/test/resources/sample/上海市委-列表.cs

@@ -0,0 +1,112 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using H3;
+
+public class D2796247609923b101140e689622d8b39651b39_ListViewController: H3.SmartForm.ListViewController
+{
+    public D2796247609923b101140e689622d8b39651b39_ListViewController(H3.SmartForm.ListViewRequest request): base(request)
+    {
+    }
+
+    protected override void OnLoad(H3.SmartForm.LoadListViewResponse response)
+    {
+        base.OnLoad(response);
+    }
+
+    protected override void OnSubmit(string actionName, H3.SmartForm.ListViewPostValue postValue, H3.SmartForm.SubmitListViewResponse response)
+    {
+        if(actionName == "Remove")
+        {
+            // 删除数据ID:氚云列表页面,批量删除只能监听后端事件【最终执行】且若执行代码报错,删除会自动回滚。前端只能监听到点击删除,但监听不到确认、取消的回调。
+            Dictionary < string, object > data = postValue.Data;
+            object selectIds = null; // 获取勾选ID集合
+            if(data.TryGetValue("ObjectIds", out selectIds))
+            {
+                Dictionary < string, object > bodys = new Dictionary<string, object>();
+                bodys.Add("actionName", actionName); // 动作名称
+                // 处理氚云sql格式,in查询实例必须添加单引号,否则不能匹配
+                string[] objectIds = (string[]) selectIds;
+                List < string > fIds = new List<string>();
+                foreach(string objectId in objectIds)
+                {
+                    fIds.Add(string.Format("'{0}'", objectId));
+                }
+                System.Data.DataTable records = this.Engine.Query.QueryTable(string.Format("select origionContractCode, SeqNo, fileNames, Status from i_D2796247609923b101140e689622d8b39651b39 where ObjectId in ({0})", string.Join(",", fIds)), null);
+                bodys.Add("bizObjects", this.Serialize(records));  // 合同记录【生效数据过滤,代码处理】
+                // 氚云默认字段冲突: sOrigionContractCode as origionContractCode [select * 后,两个字段都会同时存在,若字段相同则会被 * 覆盖, 如 DATE_FORMAT,需要另开一个字段]
+                System.Data.DataTable terms = this.Engine.Query.QueryTable(string.Format("select DATE_FORMAT(cDateTime,'%Y-%m-%d') dateTime, agreementType from i_D279624F24d78c5510764cba928395c32b9406d6 where ParentObjectId in ({0})", string.Join(",", fIds)), null);
+                bodys.Add("termsObject", this.Serialize(terms));  // 合同条款
+                List < H3.BizBus.ItemSchema > structures = new List<H3.BizBus.ItemSchema>(); // 响应类型
+                this.invokeVendorService("delete", bodys, structures); // 请求处理
+            }
+        }
+        base.OnSubmit(actionName, postValue, response);
+    }
+
+    /**
+     * 氚云HTTP
+     * 1. code 公用请求,code区分业务逻辑
+     * 2. bodys 请求参数,默认POST,application/json
+     * 3. structures 返回数据格式定义, 统一使用对象响应
+     */
+    private H3.BizBus.BizStructure invokeVendorService(string code, Dictionary < string, object > bodys, List < H3.BizBus.ItemSchema > structures) {
+
+        H3.IEngine engine = this.Engine;
+
+        // 请求信息
+        Dictionary < string, string > headers = new Dictionary<string, string>();
+        Dictionary < string, string > querys = new Dictionary<string, string>();
+        querys.Add("code", code);
+
+        // 定义响应数据整体结构体
+        H3.BizBus.BizStructureSchema structureSchema = new H3.BizBus.BizStructureSchema();
+        structureSchema.Add(new H3.BizBus.ItemSchema("code", "结果状态码", H3.Data.BizDataType.Int, null));
+        structureSchema.Add(new H3.BizBus.ItemSchema("success", "请求状态位", H3.Data.BizDataType.Bool, null));
+        structureSchema.Add(new H3.BizBus.ItemSchema("message", "描述信息", H3.Data.BizDataType.String, null));
+        // 定义响应数据的 data 属性 的结构体
+        H3.BizBus.BizStructureSchema dataSchema = new H3.BizBus.BizStructureSchema();
+        foreach(H3.BizBus.ItemSchema itemSchame in structures)
+        {
+            dataSchema.Add(itemSchame);
+        }
+        //将 data 属性的结构体添加进整体的响应数据结构体 [H3.Data.BizDataType.BizStructureArray 集合,H3.Data.BizDataType.BizStructure 对象]
+        structureSchema.Add(new H3.BizBus.ItemSchema("data", "响应数据", H3.Data.BizDataType.BizStructure, dataSchema));
+
+        //调用Invoke接口,系统底层访问第三方接口的Invoke方法
+        H3.BizBus.InvokeResult response = engine.BizBus.InvokeApi(
+            H3.Organization.User.SystemUserId, //固定值,无需改变
+            H3.BizBus.AccessPointType.ThirdConnection, //固定值,无需改变
+            "h3yun-http", //连接编码,对应 插件中心 中配置的连接的编码
+            "POST", //请求方式,取值:GET / POST
+            "application/json", //请求数据类型: json - "application/json";xml - "text/html;charset=utf-8"
+            headers, querys, bodys, structureSchema);
+        if(response != null)
+        {
+            // 氚云调用是否成功
+            if(response.Code == 0)
+            {
+                // 获取返回数据,此实例对应完整的响应JSON
+                H3.BizBus.BizStructure rspData = response.Data;
+                if(((bool) rspData["success"]) == true)
+                {
+                    // 对象响应【氚云自定义字段,需要通过[]直接取值才有效,序列化后返回前端,仅会保留结构】
+                    // H3.BizBus.BizStructure[] datas = rspData["data"] as H3.BizBus.BizStructure[]; // 集合解析
+                    // H3.BizBus.BizStructure data = rspData["data"] as H3.BizBus.BizStructure; // 对象解析
+                    return rspData["data"] as H3.BizBus.BizStructure;
+                } else
+                {
+                    throw new Exception("接口异常," + rspData["message"]);
+                }
+            }
+            else
+            {
+                throw new Exception("氚云异常," + response.Message);
+            }
+        } else
+        {
+            throw new Exception("系统异常,接口无响应");
+        }
+    }
+}

+ 178 - 0
mjava-shanghaishiwei/src/test/resources/sample/上海市委.cs

@@ -0,0 +1,178 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using H3;
+
+public class D2796247609923b101140e689622d8b39651b39: H3.SmartForm.SmartFormController
+{
+    public D2796247609923b101140e689622d8b39651b39(H3.SmartForm.SmartFormRequest request): base(request)
+    {
+    }
+
+    protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response)
+    {
+        // 获取、工号、姓名;委托人姓名[默认登录人]
+        if(this.Request.IsCreateMode)
+        {
+            this.Request.BizObject["inputPersonName"] = this.Request.UserContext.User.Name;
+            this.Request.BizObject["inputPersonCode"] = this.Request.UserContext.User.EmployeeNumber;
+            this.Request.BizObject["agentPerson"] = this.Request.UserContext.User.Name;
+        }
+        base.OnLoad(response);
+    }
+
+    protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response)
+    {
+        // 默认值处理
+        if((actionName == "Submit" || actionName == "Save") && this.Request.IsCreateMode)
+        {
+            if(postValue.Data["inputPersonCode"] + string.Empty == "")
+            {
+                response.Infos.Add("未维护工号信息,请联系管理员!");
+            }
+            // 赋值兼容,避免数据丢失
+            string[] compIds = { "inputPersonName", "inputPersonCode", "agentPerson" };
+            foreach(string compId in compIds)
+            {
+                this.Request.BizObject[compId] = postValue.Data[compId] + string.Empty;
+            }
+        }
+        // 审批通过
+        if(this.Request.ActivityCode == "Activity23" && actionName == "Submit")
+        {
+            this.syncContract(actionName, this.Request.ActivityCode, true);
+        }
+        // 类型列表
+        if(actionName == "types")
+        {
+            Dictionary < string, object > bodys = new Dictionary<string, object>();
+            List < H3.BizBus.ItemSchema > structures = new List<H3.BizBus.ItemSchema>(); // 响应类型
+            structures.Add(new H3.BizBus.ItemSchema("types", "合同类型", H3.Data.BizDataType.String, null));
+            H3.BizBus.BizStructure data = this.invokeVendorService("types", bodys, structures); // 请求处理
+            response.ReturnData = new Dictionary<string, object>();
+            response.ReturnData.Add("types", data["types"]);
+        }
+        // 所属部门【返所属部门列表】
+        if(actionName == "purchaseDepart")
+        {
+            //根据人员Id查询其所有的部门Id
+            H3.Organization.User user = (H3.Organization.User) this.Engine.Organization.GetUnit(this.Request.UserContext.UserId);
+            string[] pIds = user.ParentIds;
+            List < string > fIds = new List<string>();
+            foreach(string pId in pIds)
+            {
+                fIds.Add(string.Format("'{0}'", pId));
+            }
+            System.Data.DataTable depts = this.Engine.Query.QueryTable(string.Format("select Name from H_Organizationunit where ObjectId in ({0})", string.Join(",", fIds)), null);
+            response.ReturnData = new Dictionary<string, object>();
+            response.ReturnData.Add("purchaseDepart", this.Serialize(depts));
+        }
+        // 代理人
+        if(actionName == "agentPerson")
+        {
+            System.Data.DataTable user = this.Engine.Query.QueryTable(string.Format("select * from h_user where ObjectId = '{0}'", this.Request["agentId"]), null);
+            response.ReturnData = new Dictionary<string, object>();
+            response.ReturnData.Add("agentPerson", this.Serialize(user));
+        }
+        base.OnSubmit(actionName, postValue, response);
+    }
+
+    // 盖章附件【后补】流程事件:只有审批人变更才会触发,发起、自动通过不会
+    protected override void OnWorkflowInstanceStateChanged(H3.Workflow.Instance.WorkflowInstanceState   oldState, H3.Workflow.Instance.WorkflowInstanceState newState)
+    {
+        // 流程审批结束事件(先执行业务规则,在执行该方法)
+        if(oldState == H3.Workflow.Instance.WorkflowInstanceState.Running && newState == H3.Workflow.Instance.WorkflowInstanceState.Finished)
+        {		/** 执行业务代码逻辑 **/
+            this.syncContract("OnWorkflowInstanceStateChanged", "Finished", false);
+        }
+        //流程审批结束后,重新激活事件(先执行业务规则,在执行该方法)
+        if(oldState == H3.Workflow.Instance.WorkflowInstanceState.Finished && newState == H3.Workflow.Instance.WorkflowInstanceState.Running) {		/** 执行业务代码逻辑 **/	}
+        base.OnWorkflowInstanceStateChanged(oldState, newState);
+    }
+
+    // 同步合同【公共】
+    private void syncContract(string actionName, string activityCode, bool isApprove) {
+        Dictionary < string, object > bodys = new Dictionary<string, object>();
+        bodys.Add("actionName", actionName); // 动作名称
+        bodys.Add("activityCode", activityCode); // 流程节点
+        // 氚云默认字段冲突: cSummary as summary, cTelephone as telephone [select * 后,两个字段都会同时存在, 若字段相同则会被 * 覆盖, 如 DATE_FORMAT,需要另开一个字段]
+        System.Data.DataTable records = this.Engine.Query.QueryTable(string.Format("select *, cSummary as cummary, cTelephone as telephone, DATE_FORMAT(cOrderTime,'%Y-%m-%d') orderTime, DATE_FORMAT(cCompletionDate,'%Y-%m-%d') completionDate from i_D2796247609923b101140e689622d8b39651b39 where ObjectId = '{0}'", this.Request.BizObjectId), null);
+        bodys.Add("bizObject", this.Serialize(records));  // 合同记录
+        System.Data.DataTable terms = this.Engine.Query.QueryTable(string.Format("select *, DATE_FORMAT(cDateTime,'%Y-%m-%d') dateTime from i_D279624F24d78c5510764cba928395c32b9406d6 where ParentObjectId = '{0}'", this.Request.BizObjectId), null);
+        bodys.Add("termsObject", this.Serialize(terms));  // 合同条款
+        H3.DataModel.BizObjectFileHeader[] files = (H3.DataModel.BizObjectFileHeader[]) this.Request.BizObject[isApprove ? "attachment" : "F0000002"]; // 附件控件 [注意:新增的时候获取不了ID,新增包含审批节点]
+        bodys.Add("attachments", this.Serialize(files));  // 合同附件
+        bodys.Add("fileNames", this.Request.BizObject["fileNames"]);  // 盖章附件
+        List < H3.BizBus.ItemSchema > structures = new List<H3.BizBus.ItemSchema>(); // 响应类型
+        structures.Add(new H3.BizBus.ItemSchema("fileNames", "文件名称", H3.Data.BizDataType.String, null));
+        H3.BizBus.BizStructure data = this.invokeVendorService(isApprove ? "approve" : "file", bodys, structures); // 请求处理
+        // 拼接与氚云记录, 服务删除逻辑
+        this.Engine.Query.QueryTable(string.Format("update i_D2796247609923b101140e689622d8b39651b39 set fileNames = '{0}' where ObjectId = '{1}'", data["fileNames"], this.Request.BizObjectId), null);
+    }
+
+    /**
+     * 氚云HTTP
+     * 1. code 公用请求,code区分业务逻辑
+     * 2. bodys 请求参数,默认POST,application/json
+     * 3. structures 返回数据格式定义, 统一使用对象响应
+     */
+    private H3.BizBus.BizStructure invokeVendorService(string code, Dictionary < string, object > bodys, List < H3.BizBus.ItemSchema > structures) {
+
+        H3.IEngine engine = this.Engine;
+
+        // 请求信息
+        Dictionary < string, string > headers = new Dictionary<string, string>();
+        Dictionary < string, string > querys = new Dictionary<string, string>();
+        querys.Add("code", code);
+
+        // 定义响应数据整体结构体
+        H3.BizBus.BizStructureSchema structureSchema = new H3.BizBus.BizStructureSchema();
+        structureSchema.Add(new H3.BizBus.ItemSchema("code", "结果状态码", H3.Data.BizDataType.Int, null));
+        structureSchema.Add(new H3.BizBus.ItemSchema("success", "请求状态位", H3.Data.BizDataType.Bool, null));
+        structureSchema.Add(new H3.BizBus.ItemSchema("message", "描述信息", H3.Data.BizDataType.String, null));
+        // 定义响应数据的 data 属性 的结构体
+        H3.BizBus.BizStructureSchema dataSchema = new H3.BizBus.BizStructureSchema();
+        foreach(H3.BizBus.ItemSchema itemSchame in structures)
+        {
+            dataSchema.Add(itemSchame);
+        }
+        //将 data 属性的结构体添加进整体的响应数据结构体 [H3.Data.BizDataType.BizStructureArray 集合,H3.Data.BizDataType.BizStructure 对象]
+        structureSchema.Add(new H3.BizBus.ItemSchema("data", "响应数据", H3.Data.BizDataType.BizStructure, dataSchema));
+
+        //调用Invoke接口,系统底层访问第三方接口的Invoke方法
+        H3.BizBus.InvokeResult response = engine.BizBus.InvokeApi(
+            H3.Organization.User.SystemUserId, //固定值,无需改变
+            H3.BizBus.AccessPointType.ThirdConnection, //固定值,无需改变
+            "h3yun-http", //连接编码,对应 插件中心 中配置的连接的编码
+            "POST", //请求方式,取值:GET / POST
+            "application/json", //请求数据类型: json - "application/json";xml - "text/html;charset=utf-8"
+            headers, querys, bodys, structureSchema);
+        if(response != null)
+        {
+            // 氚云调用是否成功
+            if(response.Code == 0)
+            {
+                // 获取返回数据,此实例对应完整的响应JSON
+                H3.BizBus.BizStructure rspData = response.Data;
+                if(((bool) rspData["success"]) == true)
+                {
+                    // 对象响应【氚云自定义字段,需要通过[]直接取值才有效,序列化后返回前端,仅会保留结构】
+                    // H3.BizBus.BizStructure[] datas = rspData["data"] as H3.BizBus.BizStructure[]; // 集合解析
+                    // H3.BizBus.BizStructure data = rspData["data"] as H3.BizBus.BizStructure; // 对象解析
+                    return rspData["data"] as H3.BizBus.BizStructure;
+                } else
+                {
+                    throw new Exception("响应异常," + rspData["message"]);
+                }
+            }
+            else
+            {
+                throw new Exception("氚云异常," + response.Message);
+            }
+        } else
+        {
+            throw new Exception("系统异常,接口无响应");
+        }
+    }
+}

+ 76 - 0
mjava-shanghaishiwei/src/test/resources/sample/上海市委.js

@@ -0,0 +1,76 @@
+/* 控件接口说明:
+ * 1. 读取控件: this.***,*号输入控件编码;
+ * 2. 读取控件的值: this.***.GetValue();
+ * 3. 设置控件的值: this.***.SetValue(???);
+ * 4. 绑定控件值变化事件: this.***.BindChange(key,function(){}),key是定义唯一的方法名;
+ * 5. 解除控件值变化事件: this.***.UnbindChange(key);
+ * 6. CheckboxList、DropDownList、RadioButtonList: $.***.AddItem(value,text),$.***.ClearItems();
+ */
+/* 公共接口:
+ * 1. ajax:$.SmartForm.PostForm(actionName,data,callBack,errorBack,async),
+ *          actionName:提交的ActionName;data:提交后台的数据;callback:回调函数;errorBack:错误回调函数;async:是否异步;
+ * 2. 打开表单:$.IShowForm(schemaCode, objectId, checkIsChange),
+ *          schemaCode:表单编码;objectId;表单数据Id;checkIsChange:关闭时,是否感知变化;
+ * 3. 定位接口:$.ILocation();
+ */
+
+// 表单插件代码
+$.extend($.JForm, {
+    // 加载事件
+    OnLoad: function () {
+
+        // 页面状态:0为审批/办理 1为办理完结 2为创建 4为查阅
+        if ($.SmartForm.ResponseContext.FormMode == 2) {
+            // 合同类型
+            this.typeName.ClearItems()
+            $.SmartForm.PostForm("types", {}, rsp => {
+                JSON.parse(rsp.ReturnData.types).forEach(item => {
+                    if (!item.typeName.includes("测试")) {
+                        this.typeName.AddItem(item.typeName)
+                    }
+                })
+            });
+
+            // 所属部门【仅一个部门,直接赋值;多个部门,下拉框手动选择】
+            this.purchaseDepart.ClearItems()
+            $.SmartForm.PostForm("purchaseDepart", {}, rsp => {
+                const depts = JSON.parse(rsp.ReturnData.purchaseDepart);
+                console.log(depts)
+                depts.forEach(item => {
+                    this.purchaseDepart.AddItem(item.Name)
+                })
+                if (depts.length == 1) {
+                    this.purchaseDepart.SetValue(depts[0].Name)
+                }
+            });
+
+            // 代理人姓名
+            this.cAgentPerson.BindChange("cAgentPerson", () => {
+                const agentPerson = this.cAgentPerson.GetValue()
+                if (agentPerson.length) {
+                    $.SmartForm.PostForm("agentPerson", {agentId: agentPerson[0]}, rsp => {
+                        console.log(JSON.parse(rsp.ReturnData.agentPerson))
+                        this.agentPerson.SetValue(JSON.parse(rsp.ReturnData.agentPerson)[0].Name)
+                    });
+                }
+            })
+        }
+    },
+
+    // 按钮事件
+    OnLoadActions: function (actions) {
+    },
+
+    // 提交校验
+    OnValidate: function (actionControl) {
+        return true;
+    },
+
+    // 提交前事件
+    BeforeSubmit: function (action, postValue) {
+    },
+
+    // 提交后事件
+    AfterSubmit: function (action, responseValue) {
+    }
+});

+ 5 - 0
mjava-shanghaishiwei/target/maven-archiver/pom.properties

@@ -0,0 +1,5 @@
+#Generated by Maven
+#Thu Nov 09 07:56:06 CST 2023
+version=1.0-SNAPSHOT
+groupId=com.malk
+artifactId=mjava-shanghaishiwei

+ 0 - 0
mjava-shanghaishiwei/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst


+ 8 - 0
mjava-shanghaishiwei/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -0,0 +1,8 @@
+/Users/malk/server/java-mcli-2/mjava-shanghaishiwei/src/main/java/com/malk/shanghaishiwei/service/HTClient.java
+/Users/malk/server/java-mcli-2/mjava-shanghaishiwei/src/main/java/com/malk/shanghaishiwei/service/impl/HTImplClient.java
+/Users/malk/server/java-mcli-2/mjava-shanghaishiwei/src/main/java/com/malk/shanghaishiwei/service/HTService.java
+/Users/malk/server/java-mcli-2/mjava-shanghaishiwei/src/main/java/com/malk/shanghaishiwei/server/HTConf.java
+/Users/malk/server/java-mcli-2/mjava-shanghaishiwei/src/main/java/com/malk/shanghaishiwei/service/impl/HTImplService.java
+/Users/malk/server/java-mcli-2/mjava-shanghaishiwei/src/main/java/com/malk/shanghaishiwei/controller/SHHWController.java
+/Users/malk/server/java-mcli-2/mjava-shanghaishiwei/src/main/java/com/malk/shanghaishiwei/server/HTR.java
+/Users/malk/server/java-mcli-2/mjava-shanghaishiwei/src/main/java/com/malk/shanghaishiwei/Boot.java

BIN
mjava-shanghaishiwei/target/mjava-shanghaishiwei.jar.original


+ 112 - 0
mjava-shanghaishiwei/target/test-classes/sample/上海市委-列表.cs

@@ -0,0 +1,112 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using H3;
+
+public class D2796247609923b101140e689622d8b39651b39_ListViewController: H3.SmartForm.ListViewController
+{
+    public D2796247609923b101140e689622d8b39651b39_ListViewController(H3.SmartForm.ListViewRequest request): base(request)
+    {
+    }
+
+    protected override void OnLoad(H3.SmartForm.LoadListViewResponse response)
+    {
+        base.OnLoad(response);
+    }
+
+    protected override void OnSubmit(string actionName, H3.SmartForm.ListViewPostValue postValue, H3.SmartForm.SubmitListViewResponse response)
+    {
+        if(actionName == "Remove")
+        {
+            // 删除数据ID:氚云列表页面,批量删除只能监听后端事件【最终执行】且若执行代码报错,删除会自动回滚。前端只能监听到点击删除,但监听不到确认、取消的回调。
+            Dictionary < string, object > data = postValue.Data;
+            object selectIds = null; // 获取勾选ID集合
+            if(data.TryGetValue("ObjectIds", out selectIds))
+            {
+                Dictionary < string, object > bodys = new Dictionary<string, object>();
+                bodys.Add("actionName", actionName); // 动作名称
+                // 处理氚云sql格式,in查询实例必须添加单引号,否则不能匹配
+                string[] objectIds = (string[]) selectIds;
+                List < string > fIds = new List<string>();
+                foreach(string objectId in objectIds)
+                {
+                    fIds.Add(string.Format("'{0}'", objectId));
+                }
+                System.Data.DataTable records = this.Engine.Query.QueryTable(string.Format("select origionContractCode, SeqNo, fileNames, Status from i_D2796247609923b101140e689622d8b39651b39 where ObjectId in ({0})", string.Join(",", fIds)), null);
+                bodys.Add("bizObjects", this.Serialize(records));  // 合同记录【生效数据过滤,代码处理】
+                // 氚云默认字段冲突: sOrigionContractCode as origionContractCode [select * 后,两个字段都会同时存在,若字段相同则会被 * 覆盖, 如 DATE_FORMAT,需要另开一个字段]
+                System.Data.DataTable terms = this.Engine.Query.QueryTable(string.Format("select DATE_FORMAT(cDateTime,'%Y-%m-%d') dateTime, agreementType from i_D279624F24d78c5510764cba928395c32b9406d6 where ParentObjectId in ({0})", string.Join(",", fIds)), null);
+                bodys.Add("termsObject", this.Serialize(terms));  // 合同条款
+                List < H3.BizBus.ItemSchema > structures = new List<H3.BizBus.ItemSchema>(); // 响应类型
+                this.invokeVendorService("delete", bodys, structures); // 请求处理
+            }
+        }
+        base.OnSubmit(actionName, postValue, response);
+    }
+
+    /**
+     * 氚云HTTP
+     * 1. code 公用请求,code区分业务逻辑
+     * 2. bodys 请求参数,默认POST,application/json
+     * 3. structures 返回数据格式定义, 统一使用对象响应
+     */
+    private H3.BizBus.BizStructure invokeVendorService(string code, Dictionary < string, object > bodys, List < H3.BizBus.ItemSchema > structures) {
+
+        H3.IEngine engine = this.Engine;
+
+        // 请求信息
+        Dictionary < string, string > headers = new Dictionary<string, string>();
+        Dictionary < string, string > querys = new Dictionary<string, string>();
+        querys.Add("code", code);
+
+        // 定义响应数据整体结构体
+        H3.BizBus.BizStructureSchema structureSchema = new H3.BizBus.BizStructureSchema();
+        structureSchema.Add(new H3.BizBus.ItemSchema("code", "结果状态码", H3.Data.BizDataType.Int, null));
+        structureSchema.Add(new H3.BizBus.ItemSchema("success", "请求状态位", H3.Data.BizDataType.Bool, null));
+        structureSchema.Add(new H3.BizBus.ItemSchema("message", "描述信息", H3.Data.BizDataType.String, null));
+        // 定义响应数据的 data 属性 的结构体
+        H3.BizBus.BizStructureSchema dataSchema = new H3.BizBus.BizStructureSchema();
+        foreach(H3.BizBus.ItemSchema itemSchame in structures)
+        {
+            dataSchema.Add(itemSchame);
+        }
+        //将 data 属性的结构体添加进整体的响应数据结构体 [H3.Data.BizDataType.BizStructureArray 集合,H3.Data.BizDataType.BizStructure 对象]
+        structureSchema.Add(new H3.BizBus.ItemSchema("data", "响应数据", H3.Data.BizDataType.BizStructure, dataSchema));
+
+        //调用Invoke接口,系统底层访问第三方接口的Invoke方法
+        H3.BizBus.InvokeResult response = engine.BizBus.InvokeApi(
+            H3.Organization.User.SystemUserId, //固定值,无需改变
+            H3.BizBus.AccessPointType.ThirdConnection, //固定值,无需改变
+            "h3yun-http", //连接编码,对应 插件中心 中配置的连接的编码
+            "POST", //请求方式,取值:GET / POST
+            "application/json", //请求数据类型: json - "application/json";xml - "text/html;charset=utf-8"
+            headers, querys, bodys, structureSchema);
+        if(response != null)
+        {
+            // 氚云调用是否成功
+            if(response.Code == 0)
+            {
+                // 获取返回数据,此实例对应完整的响应JSON
+                H3.BizBus.BizStructure rspData = response.Data;
+                if(((bool) rspData["success"]) == true)
+                {
+                    // 对象响应【氚云自定义字段,需要通过[]直接取值才有效,序列化后返回前端,仅会保留结构】
+                    // H3.BizBus.BizStructure[] datas = rspData["data"] as H3.BizBus.BizStructure[]; // 集合解析
+                    // H3.BizBus.BizStructure data = rspData["data"] as H3.BizBus.BizStructure; // 对象解析
+                    return rspData["data"] as H3.BizBus.BizStructure;
+                } else
+                {
+                    throw new Exception("接口异常," + rspData["message"]);
+                }
+            }
+            else
+            {
+                throw new Exception("氚云异常," + response.Message);
+            }
+        } else
+        {
+            throw new Exception("系统异常,接口无响应");
+        }
+    }
+}

+ 178 - 0
mjava-shanghaishiwei/target/test-classes/sample/上海市委.cs

@@ -0,0 +1,178 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using H3;
+
+public class D2796247609923b101140e689622d8b39651b39: H3.SmartForm.SmartFormController
+{
+    public D2796247609923b101140e689622d8b39651b39(H3.SmartForm.SmartFormRequest request): base(request)
+    {
+    }
+
+    protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response)
+    {
+        // 获取、工号、姓名;委托人姓名[默认登录人]
+        if(this.Request.IsCreateMode)
+        {
+            this.Request.BizObject["inputPersonName"] = this.Request.UserContext.User.Name;
+            this.Request.BizObject["inputPersonCode"] = this.Request.UserContext.User.EmployeeNumber;
+            this.Request.BizObject["agentPerson"] = this.Request.UserContext.User.Name;
+        }
+        base.OnLoad(response);
+    }
+
+    protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response)
+    {
+        // 默认值处理
+        if((actionName == "Submit" || actionName == "Save") && this.Request.IsCreateMode)
+        {
+            if(postValue.Data["inputPersonCode"] + string.Empty == "")
+            {
+                response.Infos.Add("未维护工号信息,请联系管理员!");
+            }
+            // 赋值兼容,避免数据丢失
+            string[] compIds = { "inputPersonName", "inputPersonCode", "agentPerson" };
+            foreach(string compId in compIds)
+            {
+                this.Request.BizObject[compId] = postValue.Data[compId] + string.Empty;
+            }
+        }
+        // 审批通过
+        if(this.Request.ActivityCode == "Activity23" && actionName == "Submit")
+        {
+            this.syncContract(actionName, this.Request.ActivityCode, true);
+        }
+        // 类型列表
+        if(actionName == "types")
+        {
+            Dictionary < string, object > bodys = new Dictionary<string, object>();
+            List < H3.BizBus.ItemSchema > structures = new List<H3.BizBus.ItemSchema>(); // 响应类型
+            structures.Add(new H3.BizBus.ItemSchema("types", "合同类型", H3.Data.BizDataType.String, null));
+            H3.BizBus.BizStructure data = this.invokeVendorService("types", bodys, structures); // 请求处理
+            response.ReturnData = new Dictionary<string, object>();
+            response.ReturnData.Add("types", data["types"]);
+        }
+        // 所属部门【返所属部门列表】
+        if(actionName == "purchaseDepart")
+        {
+            //根据人员Id查询其所有的部门Id
+            H3.Organization.User user = (H3.Organization.User) this.Engine.Organization.GetUnit(this.Request.UserContext.UserId);
+            string[] pIds = user.ParentIds;
+            List < string > fIds = new List<string>();
+            foreach(string pId in pIds)
+            {
+                fIds.Add(string.Format("'{0}'", pId));
+            }
+            System.Data.DataTable depts = this.Engine.Query.QueryTable(string.Format("select Name from H_Organizationunit where ObjectId in ({0})", string.Join(",", fIds)), null);
+            response.ReturnData = new Dictionary<string, object>();
+            response.ReturnData.Add("purchaseDepart", this.Serialize(depts));
+        }
+        // 代理人
+        if(actionName == "agentPerson")
+        {
+            System.Data.DataTable user = this.Engine.Query.QueryTable(string.Format("select * from h_user where ObjectId = '{0}'", this.Request["agentId"]), null);
+            response.ReturnData = new Dictionary<string, object>();
+            response.ReturnData.Add("agentPerson", this.Serialize(user));
+        }
+        base.OnSubmit(actionName, postValue, response);
+    }
+
+    // 盖章附件【后补】流程事件:只有审批人变更才会触发,发起、自动通过不会
+    protected override void OnWorkflowInstanceStateChanged(H3.Workflow.Instance.WorkflowInstanceState   oldState, H3.Workflow.Instance.WorkflowInstanceState newState)
+    {
+        // 流程审批结束事件(先执行业务规则,在执行该方法)
+        if(oldState == H3.Workflow.Instance.WorkflowInstanceState.Running && newState == H3.Workflow.Instance.WorkflowInstanceState.Finished)
+        {		/** 执行业务代码逻辑 **/
+            this.syncContract("OnWorkflowInstanceStateChanged", "Finished", false);
+        }
+        //流程审批结束后,重新激活事件(先执行业务规则,在执行该方法)
+        if(oldState == H3.Workflow.Instance.WorkflowInstanceState.Finished && newState == H3.Workflow.Instance.WorkflowInstanceState.Running) {		/** 执行业务代码逻辑 **/	}
+        base.OnWorkflowInstanceStateChanged(oldState, newState);
+    }
+
+    // 同步合同【公共】
+    private void syncContract(string actionName, string activityCode, bool isApprove) {
+        Dictionary < string, object > bodys = new Dictionary<string, object>();
+        bodys.Add("actionName", actionName); // 动作名称
+        bodys.Add("activityCode", activityCode); // 流程节点
+        // 氚云默认字段冲突: cSummary as summary, cTelephone as telephone [select * 后,两个字段都会同时存在, 若字段相同则会被 * 覆盖, 如 DATE_FORMAT,需要另开一个字段]
+        System.Data.DataTable records = this.Engine.Query.QueryTable(string.Format("select *, cSummary as cummary, cTelephone as telephone, DATE_FORMAT(cOrderTime,'%Y-%m-%d') orderTime, DATE_FORMAT(cCompletionDate,'%Y-%m-%d') completionDate from i_D2796247609923b101140e689622d8b39651b39 where ObjectId = '{0}'", this.Request.BizObjectId), null);
+        bodys.Add("bizObject", this.Serialize(records));  // 合同记录
+        System.Data.DataTable terms = this.Engine.Query.QueryTable(string.Format("select *, DATE_FORMAT(cDateTime,'%Y-%m-%d') dateTime from i_D279624F24d78c5510764cba928395c32b9406d6 where ParentObjectId = '{0}'", this.Request.BizObjectId), null);
+        bodys.Add("termsObject", this.Serialize(terms));  // 合同条款
+        H3.DataModel.BizObjectFileHeader[] files = (H3.DataModel.BizObjectFileHeader[]) this.Request.BizObject[isApprove ? "attachment" : "F0000002"]; // 附件控件 [注意:新增的时候获取不了ID,新增包含审批节点]
+        bodys.Add("attachments", this.Serialize(files));  // 合同附件
+        bodys.Add("fileNames", this.Request.BizObject["fileNames"]);  // 盖章附件
+        List < H3.BizBus.ItemSchema > structures = new List<H3.BizBus.ItemSchema>(); // 响应类型
+        structures.Add(new H3.BizBus.ItemSchema("fileNames", "文件名称", H3.Data.BizDataType.String, null));
+        H3.BizBus.BizStructure data = this.invokeVendorService(isApprove ? "approve" : "file", bodys, structures); // 请求处理
+        // 拼接与氚云记录, 服务删除逻辑
+        this.Engine.Query.QueryTable(string.Format("update i_D2796247609923b101140e689622d8b39651b39 set fileNames = '{0}' where ObjectId = '{1}'", data["fileNames"], this.Request.BizObjectId), null);
+    }
+
+    /**
+     * 氚云HTTP
+     * 1. code 公用请求,code区分业务逻辑
+     * 2. bodys 请求参数,默认POST,application/json
+     * 3. structures 返回数据格式定义, 统一使用对象响应
+     */
+    private H3.BizBus.BizStructure invokeVendorService(string code, Dictionary < string, object > bodys, List < H3.BizBus.ItemSchema > structures) {
+
+        H3.IEngine engine = this.Engine;
+
+        // 请求信息
+        Dictionary < string, string > headers = new Dictionary<string, string>();
+        Dictionary < string, string > querys = new Dictionary<string, string>();
+        querys.Add("code", code);
+
+        // 定义响应数据整体结构体
+        H3.BizBus.BizStructureSchema structureSchema = new H3.BizBus.BizStructureSchema();
+        structureSchema.Add(new H3.BizBus.ItemSchema("code", "结果状态码", H3.Data.BizDataType.Int, null));
+        structureSchema.Add(new H3.BizBus.ItemSchema("success", "请求状态位", H3.Data.BizDataType.Bool, null));
+        structureSchema.Add(new H3.BizBus.ItemSchema("message", "描述信息", H3.Data.BizDataType.String, null));
+        // 定义响应数据的 data 属性 的结构体
+        H3.BizBus.BizStructureSchema dataSchema = new H3.BizBus.BizStructureSchema();
+        foreach(H3.BizBus.ItemSchema itemSchame in structures)
+        {
+            dataSchema.Add(itemSchame);
+        }
+        //将 data 属性的结构体添加进整体的响应数据结构体 [H3.Data.BizDataType.BizStructureArray 集合,H3.Data.BizDataType.BizStructure 对象]
+        structureSchema.Add(new H3.BizBus.ItemSchema("data", "响应数据", H3.Data.BizDataType.BizStructure, dataSchema));
+
+        //调用Invoke接口,系统底层访问第三方接口的Invoke方法
+        H3.BizBus.InvokeResult response = engine.BizBus.InvokeApi(
+            H3.Organization.User.SystemUserId, //固定值,无需改变
+            H3.BizBus.AccessPointType.ThirdConnection, //固定值,无需改变
+            "h3yun-http", //连接编码,对应 插件中心 中配置的连接的编码
+            "POST", //请求方式,取值:GET / POST
+            "application/json", //请求数据类型: json - "application/json";xml - "text/html;charset=utf-8"
+            headers, querys, bodys, structureSchema);
+        if(response != null)
+        {
+            // 氚云调用是否成功
+            if(response.Code == 0)
+            {
+                // 获取返回数据,此实例对应完整的响应JSON
+                H3.BizBus.BizStructure rspData = response.Data;
+                if(((bool) rspData["success"]) == true)
+                {
+                    // 对象响应【氚云自定义字段,需要通过[]直接取值才有效,序列化后返回前端,仅会保留结构】
+                    // H3.BizBus.BizStructure[] datas = rspData["data"] as H3.BizBus.BizStructure[]; // 集合解析
+                    // H3.BizBus.BizStructure data = rspData["data"] as H3.BizBus.BizStructure; // 对象解析
+                    return rspData["data"] as H3.BizBus.BizStructure;
+                } else
+                {
+                    throw new Exception("响应异常," + rspData["message"]);
+                }
+            }
+            else
+            {
+                throw new Exception("氚云异常," + response.Message);
+            }
+        } else
+        {
+            throw new Exception("系统异常,接口无响应");
+        }
+    }
+}

+ 76 - 0
mjava-shanghaishiwei/target/test-classes/sample/上海市委.js

@@ -0,0 +1,76 @@
+/* 控件接口说明:
+ * 1. 读取控件: this.***,*号输入控件编码;
+ * 2. 读取控件的值: this.***.GetValue();
+ * 3. 设置控件的值: this.***.SetValue(???);
+ * 4. 绑定控件值变化事件: this.***.BindChange(key,function(){}),key是定义唯一的方法名;
+ * 5. 解除控件值变化事件: this.***.UnbindChange(key);
+ * 6. CheckboxList、DropDownList、RadioButtonList: $.***.AddItem(value,text),$.***.ClearItems();
+ */
+/* 公共接口:
+ * 1. ajax:$.SmartForm.PostForm(actionName,data,callBack,errorBack,async),
+ *          actionName:提交的ActionName;data:提交后台的数据;callback:回调函数;errorBack:错误回调函数;async:是否异步;
+ * 2. 打开表单:$.IShowForm(schemaCode, objectId, checkIsChange),
+ *          schemaCode:表单编码;objectId;表单数据Id;checkIsChange:关闭时,是否感知变化;
+ * 3. 定位接口:$.ILocation();
+ */
+
+// 表单插件代码
+$.extend($.JForm, {
+    // 加载事件
+    OnLoad: function () {
+
+        // 页面状态:0为审批/办理 1为办理完结 2为创建 4为查阅
+        if ($.SmartForm.ResponseContext.FormMode == 2) {
+            // 合同类型
+            this.typeName.ClearItems()
+            $.SmartForm.PostForm("types", {}, rsp => {
+                JSON.parse(rsp.ReturnData.types).forEach(item => {
+                    if (!item.typeName.includes("测试")) {
+                        this.typeName.AddItem(item.typeName)
+                    }
+                })
+            });
+
+            // 所属部门【仅一个部门,直接赋值;多个部门,下拉框手动选择】
+            this.purchaseDepart.ClearItems()
+            $.SmartForm.PostForm("purchaseDepart", {}, rsp => {
+                const depts = JSON.parse(rsp.ReturnData.purchaseDepart);
+                console.log(depts)
+                depts.forEach(item => {
+                    this.purchaseDepart.AddItem(item.Name)
+                })
+                if (depts.length == 1) {
+                    this.purchaseDepart.SetValue(depts[0].Name)
+                }
+            });
+
+            // 代理人姓名
+            this.cAgentPerson.BindChange("cAgentPerson", () => {
+                const agentPerson = this.cAgentPerson.GetValue()
+                if (agentPerson.length) {
+                    $.SmartForm.PostForm("agentPerson", {agentId: agentPerson[0]}, rsp => {
+                        console.log(JSON.parse(rsp.ReturnData.agentPerson))
+                        this.agentPerson.SetValue(JSON.parse(rsp.ReturnData.agentPerson)[0].Name)
+                    });
+                }
+            })
+        }
+    },
+
+    // 按钮事件
+    OnLoadActions: function (actions) {
+    },
+
+    // 提交校验
+    OnValidate: function (actionControl) {
+        return true;
+    },
+
+    // 提交前事件
+    BeforeSubmit: function (action, postValue) {
+    },
+
+    // 提交后事件
+    AfterSubmit: function (action, responseValue) {
+    }
+});

+ 5 - 0
mjava-xintianlong/target/maven-archiver/pom.properties

@@ -0,0 +1,5 @@
+#Generated by Maven
+#Wed Oct 11 07:16:12 CST 2023
+version=1.0-SNAPSHOT
+groupId=com.malk
+artifactId=mjava-xintianlong

+ 2 - 0
mjava-xintianlong/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

@@ -0,0 +1,2 @@
+com/malk/xintianlong/controller/HSController.class
+com/malk/xintianlong/repository/entity/primary/QHSApproveRecordPo.class

+ 13 - 0
mjava-xintianlong/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -0,0 +1,13 @@
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/repository/dao/primary/HSApproveRecordDao.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/Boot.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/target/generated-sources/java/com/malk/xintianlong/repository/entity/primary/QHSApproveRecordPo.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/controller/HSController.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/delegate/DDDelegate.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/schedule/HSScheduleTask.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/server/HSConf.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/repository/entity/primary/HSApproveRecordPo.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/repository/dao/primary/HSViewDao.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/controller/DDController.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/service/impl/HSServiceImpl.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/repository/dao/slave/HSViewDao.java
+/Users/malk/server/java-mcli-2/mjava-xintianlong/src/main/java/com/malk/xintianlong/service/HSService.java

BIN
mjava-xintianlong/target/mjava-xintianlong.jar.original