- 在线表单新增对应控件
- java获取本机MAC地址
- 设置表格在翻页时记住选中状态
- 子页面传值给父页面
- 单表查询
- 首页点击切换账号
- Redis注册到本地服务
- 谷歌页面设为安全页面
- 树结构后台代码
- 方式一:
- 方式二:
- 左树右表联动
- 全文检索
- 从数据库查询数据设置成下拉框、按钮等数据
- 正常下拉列表
- 数据表格
- 1、新增一行
- 2、数据表格html代码
- 3、新的页面弹出html树结构,js获取选择的树
- 后台声明方法变量
- 判断List是否为空
- 数组排序
- 多线程
java获取本机MAC地址将【控件英文名】配置到 【allextcontrol.js】文件中。
try {
//获取想要查看的ip地址,这个地址唯一对应一个网卡信息
InetAddress localHost = InetAddress.getLocalHost();
//根据ip地址获得对应的网卡信息
NetworkInterface byInetAddress = NetworkInterface.getByInetAddress(localHost);
//获取网卡的mac地址字节数组,这个字节数组的长度是6
byte[] macAddr = byInetAddress.getHardwareAddress();
//将字节数组转成16进制表示
StringBuilder sb = new StringBuilder();
for (int i = 0; i < macAddr.length; i++) {
//将每个字节的值转为16进制数
String byteToHex = Integer.toHexString(macAddr[i] & 0xff);
sb.append(byteToHex);
//使用-来区分每个字节的16进制数表示
if (i!= macAddr.length-1){
sb.append("-");
}
}
System.out.println(sb.toString());
}catch (Exception e){
throw new RuntimeException("获取MAC地址错误",e);
}
设置表格在翻页时记住选中状态
mini.get("id").setHoldSelectedStatus(true); //id 是表格所属id
子页面传值给父页面
-
子页面
//渲染标题为可点击 function onItemNameRenderer(e){ var title=e.row.itemname; var guid=e.row.rowguid; var tg=title+";"+guid; var str="+tg+"');return false;">"+title+""; return str; } function onTitleClick(rtnValue){ alert(rtnValue) epoint.closeDialog(rtnValue); } -
父页面
//打开考核指标页面
function khzb(){
epoint.openDialog("考试指标",'./lkgruleitemsearchcopy.html',function (data){
if (data&&data!="close"){
var val=data.split(";");
mini.get('khzb').setText(val[0]);
mini.get('khzb').setValue(val[1]);
}
},{
'width': 1070,
'height': 650
})
}
单表查询
首页点击切换账号
- 首页页面信息修改(grace.html)
- data-id:所要登录的用户ID
2、页面对应js修改(grace.js)
else if ($this.hasClass('UserChange')) {
var id = id = $this.data('id')
epoint.execute('gxhframeuserlistaction.getLoginUrl', null,
id, function(e) {
var url = Util.getRootPath() + e.url;
epoint.confirm('确认切换账号?', '系统提醒', function() {
top.location.href = url;
});
});
}
3、java后台代码
package com.epoint.cns.hwtest.action;
import java.net.URLEncoder;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.RestController;
import com.epoint.basic.controller.orga.user.FrameUserListAction;
import com.epoint.core.utils.config.ConfigUtil;
import com.epoint.core.utils.container.ContainerFactory;
import com.epoint.core.utils.security.TokenUtils;
import com.epoint.core.utils.string.StringUtil;
import com.epoint.core.utils.web.WebUtil;
import com.epoint.frame.service.organ.user.api.IUserServiceInternal;
import com.epoint.frame.service.organ.user.entity.FrameUser;
@RestController("gxhframeuserlistaction")
@Scope("request")
public class GxhFrameUserListAction extends FrameUserListAction
{
@Autowired
private IUserServiceInternal userService;
public void getLoginUrl(String id) {
if (StringUtil.isNotBlank(id)) {
FrameUser user = userService.getUserByUserField("userGuid", id);
String file = "epointframe";
String appKey = ConfigUtil.getConfigValue(file, "AppKey");
if (StringUtil.isBlank(appKey)) {
file = "EpointSecurityConfig";
appKey = ConfigUtil.getConfigValue(file, "AppKey");
}
if (appKey.contains(";")) {
appKey = appKey.split(";")[0];
}
String url = "";
try {
if (user != null) {
// 获取上下文路径
HttpServletRequest req = ContainerFactory.getContainInfo().getCurrentRequest();
String path = WebUtil.getRequestURL(req).substring(0,
WebUtil.getRequestURL(req).indexOf(req.getRequestURI()));
url = "rest/logout?isCommondto=true&login_uri=" + URLEncoder.encode(
(WebUtil.getRequestCompleteUrl(req, "frame/pages/login/loginbyid") + "?" + "loginid="
+ user.getLoginId() + "&token=" + TokenUtils.createToken(appKey)).replace(path, ""),
"utf-8");
}
}
catch (Exception e) {
e.printStackTrace();
}
addCallbackParam("url", url);
}
}
}
4、配置文件修改(EpointSecurityConfig.properties)
- 账号和密码顺序一一对应
- appKey:账号
- appSecret:密码
//进入Redis安装目录 redis-server.exe --service-install redis.windows.conf谷歌页面设为安全页面
- 临时解决方案
打开chrome://flags
1.1-搜索Insecure origins treated as secure,添加袋鼠云的地址
http://218.4.136.116:8001
1.2-搜索Block insecure private network requests,设置为Disabled
private TreeModel treeModel;
@Autowired
private IModuleService moduleservice;
private ICodeItemsService itemsService = (ICodeItemsService) SpringContextUtil.getBean(ICodeItemsService.class);
@Override
public void pageLoad() {
}
public TreeModel getTreeModel() {
if (this.treeModel == null) {
this.treeModel = new TreeModel() {
private static final long serialVersionUID = -157667420169155978L;
public List fetch(TreeNode treeNode) {
List nodes = new ArrayList();
if (treeNode == null) {
TreeNode rNode = new TreeNode();
rNode.setId("f9root");
rNode.setText("所有主体");
rNode.setExpanded(true);
rNode.getColumns().put("nodeType", "rootNode");
nodes.add(rNode);
List itemList = itemsService.listCodeItemsByCodeName("所有主体");
Iterator var5 = itemList.iterator();
while(var5.hasNext()) {
TreeNode node = new TreeNode();
CodeItems items = (CodeItems)var5.next();
String item=null;
if (items.getItemValue().toString().length()==2){
item=items.getItemValue();
node.setPid("f9root");
node.setId(items.getItemValue());
node.setText(items.getItemText());
node.setExpanded(true);
node.setLeaf(true);
}else if(items.getItemValue().toString().length()==4){
item=items.getItemValue().substring(0, 2);
node.setPid(item);
node.setId(items.getItemValue());
node.setText(items.getItemText());
node.setLeaf(true);
}else {
item=items.getItemValue().substring(0, 4);
node.setPid(item);
node.setId(items.getItemValue());
node.setText(items.getItemText());
node.setLeaf(true);
}
nodes.add(node);
}
}
return nodes;
}
};
}
return this.treeModel;
}
方式二:
public LazyTreeModal9 getTreeModal9() {
if (treeModal9==null){
treeModal9=new LazyTreeModal9(new CodeTreeHandler("XXX[代码项]",false));
treeModal9.setRootName("全部");
}
return this.treeModal9;
}
左树右表联动
//树节点的点击事件
function onTreeNodeClick(e) {
var parentTypeGuid = e.node.id;
var isleaf = e.isLeaf;
mini.get("parentTypeGuid").setValue(parentTypeGuid);
epoint.refresh(['datagrid', 'parentTypeGuid']);
}
全文检索
and isenable="1" and kstatus="30" and isdel="0" and begindate <=sysdate() and ( disabledate >sysdate() or disabledate is null)
public List正常下拉列表getRqstTagsModel() { if (rqstTagsModel == null) { rqstTagsModel = new ArrayList<>(); // 关联对象为城运工单的标签 List onmSourceRfPropertyList = rfPropertyApi.getListByOneField("rowguid,propertyname", "resourcestagname", OnmConstValue.LINK_TYPE_CYGD); if (onmSourceRfPropertyList != null && !onmSourceRfPropertyList.isEmpty()) { for (OnmSourceRfProperty onmSourceRfProperty : onmSourceRfPropertyList) { rqstTagsModel.add( new SelectItem(onmSourceRfProperty.getRowguid(), onmSourceRfProperty.getPropertyname())); } } } return rqstTagsModel; }
public List数据表格 1、新增一行getKhdwModel() { caseselectItems = DataUtil .convertMap2ComboBox((List
//点击数据需求配置的新增按钮
function addbqRow(){
epoint.openDialog('新增数据资产', "frame/pages/fxyj/ejgfxyjpeizhi/ejgfxyjshxq",function(data){
var newRow = { name: "New Row" };//声明新的一行
grid1.addRow(newRow, 0);//将新的一行放进表格
$.ajax({
url: "../data.txt",
type: "post",
success: function (text) {
//text数据格式[{filed1:"",filed2:""},{}]
var data = mini.decode(text);
var data1 = new Array();
for (let i = 0; i < num; i++) {
data1.push(data[i])
}
if (data.length > num) {
num++;
}
grid1.setData(data1)
}
});
}, {
'width': 450,
'height': 450
});
}
2、数据表格html代码
3、新的页面弹出html树结构,js获取选择的树序数据资产目录数据项类
后台声明方法变量
private IOnmItemcenterItems itemsApi = ContainerFactory.getContainInfo().getComponent(IOnmItemcenterItems.class);判断List是否为空
List<> btnList = null; EpointCollectionUtils.isNotEmpty(btnList)数组排序
// 按钮排序
List list = JSONArray.parseArray(actionArray.toJSONString(), JSONObject.class);
list.sort((o1, o2) -> (o2.get("ordernum") == null) ? 0
: o2.getLong("ordernum").compareTo(o1.get("ordernum") == null ? 0 : o1.getLong("ordernum")));
多线程
corePoolSize & maximumPoolSize:
核心线程数(corePoolSize)和最大线程数(maximumPoolSize)是线程池中非常重要的两个概念,希望同学们能够掌握。
当一个新任务被提交到池中,如果当前运行线程小于核心线程数(corePoolSize),即使当前有空闲线程,也会新建一个线程来处理新提交的任务;如果当前运行线程数大于核心线程数(corePoolSize)并小于最大线程数(maximumPoolSize),只有当等待队列已满的情况下才会新建线程。
keepAliveTime & unit
keepAliveTime 为超过 corePoolSize 线程数量的线程最大空闲时间,unit 为时间单位。
等待队列
任何阻塞队列(BlockingQueue)都可以用来转移或保存提交的任务,线程池大小和阻塞队列相互约束线程池:
- 如果运行线程数小于corePoolSize,提交新任务时就会新建一个线程来运行;
- 如果运行线程数大于或等于corePoolSize,新提交的任务就会入列等待;如果队列已满,并且运行线程数小于maximumPoolSize,也将会新建一个线程来运行;
- 如果线程数大于maximumPoolSize,新提交的任务将会根据拒绝策略来处理。
三种通用的入队策略:
- 直接传递:通过 SynchronousQueue 直接把任务传递给线程。如果当前没可用线程,尝试入队操作会失败,然后再创建一个新的线程。当处理可能具有内部依赖性的请求时,该策略会避免请求被锁定。直接传递通常需要无界的最大线程数(maximumPoolSize),避免拒绝新提交的任务。当任务持续到达的平均速度超过可处理的速度时,可能导致线程的无限增长。
- 无界队列:使用无界队列(如 LinkedBlockingQueue)作为等待队列,当所有的核心线程都在处理任务时, 新提交的任务都会进入队列等待。因此,不会有大于 corePoolSize 的线程会被创建(maximumPoolSize 也将失去作用)。这种策略适合每个任务都完全独立于其他任务的情况;例如网站服务器。这种类型的等待队列可以使瞬间爆发的高频请求变得平滑。当任务持续到达的平均速度超过可处理速度时,可能导致等待队列无限增长。
- 有界队列:当使用有限的最大线程数时,有界队列(如 ArrayBlockingQueue)可以防止资源耗尽,但是难以调整和控制。队列大小和线程池大小可以相互作用:使用大的队列和小的线程数可以减少CPU使用率、系统资源和上下文切换的开销,但是会导致吞吐量变低,如果任务频繁地阻塞(例如被I/O限制),系统就能为更多的线程调度执行时间。使用小的队列通常需要更多的线程数,这样可以最大化CPU使用率,但可能会需要更大的调度开销,从而降低吞吐量。
拒绝策略
当线程池已经关闭或达到饱和(最大线程和队列都已满)状态时,新提交的任务将会被拒绝。 ThreadPoolExecutor 定义了四种拒绝策略:
- AbortPolicy:默认策略,在需要拒绝任务时抛出RejectedExecutionException;
- CallerRunsPolicy:直接在 execute 方法的调用线程中运行被拒绝的任务,如果线程池已经关闭,任务将被丢弃;
- DiscardPolicy:直接丢弃任务;
- DiscardOldestPolicy:丢弃队列中等待时间最长的任务,并执行当前提交的任务,如果线程池已经关闭,任务将被丢弃。
我们也可以自定义拒绝策略,只需要实现 RejectedExecutionHandler; 需要注意的是,拒绝策略的运行需要指定线程池和队列的容量。
//核心线程数
int corePoolSize=3;
//最大线程数
int maximumPoolSize=6;
//超过 corePoolSize 线程数量的线程最大空闲时间
int keepAliveTime=2;
//以秒为时间单位
TimeUnit unit=TimeUnit.SECONDS;
//创建工作队列,用于存放提交的等待执行任务
BlockingQueue workQueue = new ArrayBlockingQueue(2);
ThreadPoolExecutor threadPoolExecutor=null;
try {
//创建线程池
threadPoolExecutor = new ThreadPoolExecutor(corePoolSize,
maximumPoolSize,
keepAliveTime,
unit,
workQueue,
//AbortPolicy:默认策略,在需要拒绝任务时抛出RejectedExecutionException;
new ThreadPoolExecutor.AbortPolicy()
//CallerRunsPolicy:直接在 execute 方法的调用线程中运行被拒绝的任务,如果线程池已经关闭,任务将被丢弃;
new ThreadPoolExecutor.CallerRunsPolicy()
//DiscardPolicy:直接抛弃任务,不抛出异常
new ThreadPoolExecutor.DiscardPolicy()
//DiscardOldestPolicy:丢弃队列中等待时间最长的任务,并执行当前提交的任务,如果线程池已经关闭,任务将被丢弃;
new ThreadPoolExecutor.DiscardOldestPolicy()
);
//循环提交任务
for (int i = 0; i < 8; i++) {
final int index=(i+1);
threadPoolExecutor.submit(()->{
//线程打印输出
System.out.println("我是线程"+index);
try {
//模拟线程执行时间,10s
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
});
//每个任务提交后休眠500ms提交下一个任务,用于保证提交顺序
Thread.sleep(500);
}
} catch (InterruptedException e) {
e.printStackTrace();
}finally {
threadPoolExecutor.shutdown();
}
执行的流程:
- 首先通过 ThreadPoolExecutor 构造函数创建线程池;
- 执行 for 循环,提交 8 个任务(恰好等于maximumPoolSize[最大线程数] + capacity[队列大小]);
- 通过 threadPoolExecutor.submit 提交 Runnable 接口实现的执行任务;
- 提交第1个任务时,由于当前线程池中正在执行的任务为 0 ,小于 3(corePoolSize 指定),所以会创建一个线程用来执行提交的任务1;
- 提交第 2, 3 个任务的时候,由于当前线程池中正在执行的任务数量小于等于 3 (corePoolSize 指定),所以会为每一个提交的任务创建一个线程来执行任务;
- 当提交第4个任务的时候,由于当前正在执行的任务数量为 3 (因为每个线程任务执行时间为10s,所以提交第4个任务的时候,前面3个线程都还在执行中),此时会将第4个任务存放到 workQueue 队列中等待执行;
- 由于 workQueue 队列的大小为 2 ,所以该队列中也就只能保存 2 个等待执行的任务,所以第5个任务也会保存到任务队列中;
- 当提交第6个任务的时候,因为当前线程池正在执行的任务数量为3,workQueue 队列中存储的任务数量也满了,这时会判断当前线程池中正在执行的任务的数量是否小于6(maximumPoolSize指定);
- 如果小于 6 ,那么就会新创建一个线程来执行提交的任务 6;
- 执行第7,8个任务的时候,也要判断当前线程池中正在执行的任务数是否小于6(maximumPoolSize指定),如果小于6,那么也会立即新建线程来执行这些提交的任务;
- 此时,6个任务都已经提交完毕,那 workQueue 队列中的等待 任务4 和 任务5 什么时候执行呢?
- 当任务1执行完毕后(10s后),执行任务1的线程并没有被销毁掉,而是获取 workQueue 中的任务4来执行;
- 当任务2执行完毕后,执行任务2的线程也没有被销毁,而是获取 workQueue 中的任务5来执行;
线程池中会线程执行完毕后,并不会被立刻销毁,线程池中会保留 corePoolSize 数量的线程,当 workQueue 队列中存在任务或者有新提交任务时,那么会通过线程池中已有的线程来执行任务,避免了频繁的线程创建与销毁,而大于 corePoolSize 小于等于 maximumPoolSize 创建的线程,则会在空闲指定时间(keepAliveTime)后进行回收。
//自动派单
public void autoDispatch(String data) {
String result = null;
System.out.println(data);
JSONArray objects = JSONArray.parseArray(data);
JSONObject hashMap = new JSONObject();
List list=new ArrayList<>();
for (int i = 0; i < objects.size(); i++) {
Object o = JSON.toJSONString(objects.get(i));
hashMap = JSON.parseObject(o.toString());
String ouname = hashMap.get("OUName").toString();
String ouguid = hashMap.getString("ouGuid");
FrameOu frameOu = ouService.getOuByOuGuid(ouguid);
list.add(frameOu);
}
// if (frameOu == null) {
// addCallbackParam("msg", "该部门不存在!");
// return;
// }
if (list.size() == 0) {
addCallbackParam("msg", "该部门不存在!");
return;
}
// 获取流程当前可用pvguid,获取项目的processguid
subcaseInfo.setManagetype(1);
// subcaseInfo.setSendoutype(1);
// subcaseInfo.setHandleou(ouname);
// subcaseInfo.setHandleouguid(ouguid);
String ouname=null;
String ouguid=null;
for (FrameOu frame:list){
if (ouguid==null){
ouguid=frame.getOuguid();
ouname=frame.getOuname();
}else {
ouguid+=","+frame.getOuguid();
ouname+=","+frame.getOuname();
}
}
//设置为多部门
subcaseInfo.setSendoutype(2);
subcaseInfo.setHandlemanyouguidlist(ouguid);
subcaseInfo.setHandlemanyoulist(ouname);
subCaseInfoService.update(subcaseInfo);
String processGuid = "";
processGuid = workflowService.getProcessGuidByCenter(
LkgUserSession.getInstance().getCenterGuid(), LkgConstValue.LKG_Workflow_Center.IsLD);
FrameUser sendUser = frameUserService.getUserByUserField("userguid", userSession.getUserGuid());
Date date = new Date();
caseinfoextendGrid.setRefreshdate(date);
gridExtendService.update(caseinfoextendGrid);
if (StringUtil.isBlank(caseinfo.getRegisterguid())) {
caseinfo.setRegisterguid(userSession.getUserGuid());
caseinfo.setRegistername(userSession.getDisplayName());
caseinfo.setRegistertime(date);
}
String handleOpinion = caseinfo.getTempopinion();
if (StringUtil.isNotBlank(processVersionInstanceGuid)) {
LkgBusinessSubcaseinfo subCaseInfo = null;
subCaseInfo = subCaseInfoService.getByCaseByPviguid(processVersionInstanceGuid);
String operationguid = "";
List operations = new WorkflowActivityOperationService9()
.selectByActivityGuid(item.getActivityGuid());
for (WorkflowActivityOperation operation : operations) {
if (LkgConstValue.LKG_OPERATION_NOTE.REGISTER_SEND_AUDIT.equals(operation.getNote())) {
operationguid = operation.getOperationGuid();
break;
}
}
// 根据角色和areacode获取下一步处理人的列表
List userList = new ArrayList();
if (LkgConstValue.CNS_ZERO_STR.equals(caseinfo.getCasetype())) {
// 获取热线初审岗
userList = lkgUserService.getUserByRoleName(LkgConstValue.LkgRole.AUDIT_FIRST);
} else {
// 获取联动派遣员
if (StringUtil.isBlank(LkgUserSession.getInstance().getCenterGuid())) {
userList = lkgUserService.getUserByRoleName(LkgConstValue.LkgRole.CASE_SENDER);
} else {
userList = lkgUserService.getUserListByOu(LkgUserSession.getInstance().getCenterGuid(),
LkgConstValue.LkgRole.CASE_SENDER, 3);
}
}
lkgBusinessCaseinfoService.update(caseinfo);
lkgWorkflowService.handleOperate(caseinfo.getRowguid(), processVersionInstanceGuid,
workitemGuid, operationguid, WorkflowKeyNames9.OperationType_Pass,
userSession.getUserGuid(), handleOpinion, userList, "", "", cliengguid);
// 设置为自动派单
subCaseInfo.set("dispatchtype","1");
subCaseInfo.setSubstatus(LkgConstValue.LKG_CaseStatus.DEPT_HANDLE);
subCaseInfoService.update(subCaseInfo);
//send2Ou(subCaseInfo, frameOu, handleOpinion);
send2Ou(subCaseInfo, list, handleOpinion);
}
// else {
// LkgBusinessSubcaseinfo subCaseInfo = null;
//
// // 设置状态为部门初办中
// caseinfo.setCstatus(LkgConstValue.LKG_CaseStatus.DEPT_HANDLE);
//
// caseinfo.setAcceptedguid(userSession.getUserGuid());
// caseinfo.setAcceptedname(userSession.getDisplayName());
// caseinfo.setAcceptedtime(date);
//
// List subCaseInfoList = subCaseInfoService.getListByOneField("caseguid",
// caseinfo.getRowguid());
// if (subCaseInfoList != null && !subCaseInfoList.isEmpty()) {
// subCaseInfo = subCaseInfoList.get(0);
// }
// if (subCaseInfo != null) {
// subCaseInfoService.updateCaseStatus(subCaseInfo, LkgConstValue.LKG_CaseStatus.DEPT_HANDLE);
// subCaseInfoService.updateCaseStatus(subCaseInfo.getRowguid(),
// LkgConstValue.LKG_CaseStatus.DEPT_HANDLE);
// subCaseInfo.setRqstcontent(caseinfo.getRqstcontent());
// subCaseInfo.setRqsttitle(caseinfo.getRqsttitle());
// subCaseInfo.setRqsttype(caseinfo.getRqsttype());
// } else {
// subCaseInfo = subCaseInfoService.createSubCaseInfo(caseinfo,
// LkgConstValue.LKG_CaseStatus.DEPT_HANDLE,
// LkgUserSession.getInstance().getCenterGuid(),
// LkgUserSession.getInstance().getCenterName(), "", userSession.getUserGuid(),
// userSession.getDisplayName(), LkgUserSession.getInstance().getCenterGuid(), false,
// null, "");
// }
// if (StringUtil.isBlank(subCaseInfo.getCenterguid())) {
// subCaseInfo.setCenterguid(LkgUserSession.getInstance().getCenterGuid());
// }
// List cnsCinfoSparetimes = new ArrayList();
// String[] busynesstype = new String[] {LkgConstValue.LKG_BUSINESS_TYPE.SENDOU,
// LkgConstValue.LKG_BUSINESS_TYPE.FINISH };
// LkgEfficiencyCsparetime cnsCinfoSparetime = lkgEfficiencyCsparetimeService.addCaseSpareTimeBf(
// busynesstype, LkgConstValue.GRID_SYSTEM_CASE_TRPE, caseinfo);
// cnsCinfoSparetime.setRegistertime(date);
// cnsCinfoSparetime.setOperatetype(LkgConstValue.LKG_WorkflowNew_OperateType.UPDATE);
// cnsCinfoSparetimes.add(cnsCinfoSparetime);
// // 同时产生下级工单的时限
// String[] subbusynesstype = new String[] {LkgConstValue.LKG_BUSINESS_TYPE.SENDOU,
// LkgConstValue.LKG_BUSINESS_TYPE.FINISH };
// LkgEfficiencyCsparetime cnsCinfoSubSparetime = lkgEfficiencyCsparetimeService
// .createSubCaseSpareTime(subbusynesstype, LkgConstValue.GRID_SYSTEM_CASE_TRPE,
// subCaseInfo);
// cnsCinfoSubSparetime.setOperatetype(LkgConstValue.LKG_WorkflowNew_OperateType.ADD);
// cnsCinfoSparetimes.add(cnsCinfoSubSparetime);
//
// String cinfoSparetimesJson = lkgWorkflowMqSendService.buildCinfoSpareJson(cnsCinfoSparetimes);
// // 设置为自动派单
// subCaseInfo.set("dispatchtype", frameOu.getOuguid());
// LkgWorkflowJson lkgWorkflowJson = lkgWorkflowBusinessService.caseStartSendAudit(
// caseinfo, subCaseInfo, processGuid, sendUser, handleOpinion, cliengguid);
// if (lkgWorkflowJson != null) {
// LkgBusinessCaseinfo info = lkgBusinessCaseinfoService
// .find(caseinfo.getRowguid());
// if (info != null) {
// lkgWorkflowJson.setCasejson(lkgWorkflowMqSendService.buildCaseJson(caseinfo,
// LkgConstValue.LKG_WorkflowNew_OperateType.UPDATE));
// } else {
// lkgWorkflowJson.setCasejson(lkgWorkflowMqSendService.buildCaseJson(caseinfo,
// LkgConstValue.LKG_WorkflowNew_OperateType.ADD));
// }
// LkgBusinessSubcaseinfo subinfo = subCaseInfoService.find(subCaseInfo.getRowguid());
// if (subinfo != null) {
// lkgWorkflowJson.setSubcasejson(lkgWorkflowMqSendService.buildSubCaseJson(subCaseInfo,
// LkgConstValue.LKG_WorkflowNew_OperateType.UPDATE));
// } else {
// lkgWorkflowJson.setSubcasejson(lkgWorkflowMqSendService.buildSubCaseJson(subCaseInfo,
// LkgConstValue.LKG_WorkflowNew_OperateType.ADD));
// }
// // 设置时限
// lkgWorkflowJson.setCasesparejson(cinfoSparetimesJson);
//
// JSONObject autoObject = new JSONObject();
// autoObject.put("ouguid", frameOu.getOuguid());
// autoObject.put("ouname", frameOu.getOuname());
// autoObject.put("userguid", "39ae01a2-f27b-40a2-87b7-65469a6515ed");
// autoObject.put("username", "凤凰镇派遣员");
// autoObject.put("subcaseguid", subCaseInfo.getRowguid());
// autoObject.put("opinion", handleOpinion);
//
// // 自动派送的部门guid
// lkgWorkflowJson.set("autoDispatchJson", autoObject.toJSONString());
//
// // 发送消息
// lkgWorkflowMqSendService.sendMqMessage(caseinfo, subCaseInfo, lkgWorkflowJson,
// null);
// } else {
//
// result="流程启动失败!请检查流程相关配置!";
// }
// }
//个性化修改其他两个工单的状态为部门处办中
//1、[ce90f30d-56db-4075-bced-29a7696df1ca]
//2、[9c26a1ee-5367-48a8-9b96-f77546c69a9c]
//1、从系统参数中获取对应工单rowguid
String zyrm1 = configService.getFrameConfigValue("ZYRM1");
String zyrm2 = configService.getFrameConfigValue("ZYRM2");
List stringList = new ArrayList<>();
stringList.add(zyrm1);
stringList.add(zyrm2);
for (String zyrm:stringList){
//2、根据工单rowguid查找数据
LkgBusinessSubcaseinfo lkgBusinessSubcaseinfo = lkgBusinessSubcaseinfoService.find(zyrm);
//3、修改cstatus状态为部门处办中 【LkgConstValue.LKG_CaseStatus.DEPT_HANDLE】(40)
lkgBusinessSubcaseinfo.setSubstatus(LkgConstValue.LKG_CaseStatus.DEPT_HANDLE);
//4、更新lkg_business_caseinfo表
lkgBusinessSubcaseinfoService.update(lkgBusinessSubcaseinfo);
}
this.addCallbackParam("msg", result);
}
public void send2Ou(LkgBusinessSubcaseinfo businessSubcaseinfo, List list, String opinion) {
FrameOu frameOu=new FrameOu();
String ouguid=null;
String ouname=null;
if (businessSubcaseinfo != null) {
for (FrameOu frame:list){
if (ouguid==null){
ouguid=frame.getOuguid();
ouname=frame.getOuname();
}else {
ouguid+=","+frame.getOuguid();
ouname+=","+frame.getOuname();
}
}
// 默认处办方式为交办部门
businessSubcaseinfo.setManagetype(1);
// 默认主协办
// businessSubcaseinfo.setSendoutype(1);
// businessSubcaseinfo.setHandleouguid(frameOu.getOuguid());
// businessSubcaseinfo.setHandleou(frameOu.getOuname());
//设置为多部门
businessSubcaseinfo.setSendoutype(2);
businessSubcaseinfo.setHandlemanyouguidlist(ouguid);
businessSubcaseinfo.setHandlemanyoulist(ouname);
businessSubcaseinfo.setHandleusername(userSession.getDisplayName());
businessSubcaseinfo.setHandleuserguid(userSession.getUserGuid());
businessSubcaseinfo.setHandledate(new Date());
businessSubcaseinfo.setHandleopnion(opinion);
subCaseInfoService.update(businessSubcaseinfo);
IWFInstanceAPI9 wfapi = ContainerFactory.getContainInfo().getComponent(IWFInstanceAPI9.class);
WorkflowWorkItemService9 workItemService9 = new WorkflowWorkItemService9();
List workItems = workItemService9.getWorkItembyPviGuid(wfapi.getProcessVersionInstance(processVersionInstanceGuid),
"39ae01a2-f27b-40a2-87b7-65469a6515ed");
workItems = workItems.stream().filter(s -> s.getStatus() < 80).collect(Collectors.toList());
if (EpointCollectionUtils.isNotEmpty(workItems)) {
WorkflowWorkItem workflowWorkItem = workItems.get(0);
lkgWorkflowService.handleOperate(caseinfo.getRowguid(), processVersionInstanceGuid,
workflowWorkItem.getWorkItemGuid(), null, WorkflowKeyNames9.OperationType_Pass,
userSession.getUserGuid(), opinion, null, "", "", cliengguid);
}
}
}
nInfo().getComponent(IWFInstanceAPI9.class);
WorkflowWorkItemService9 workItemService9 = new WorkflowWorkItemService9();
List workItems = workItemService9.getWorkItembyPviGuid(wfapi.getProcessVersionInstance(processVersionInstanceGuid),
"39ae01a2-f27b-40a2-87b7-65469a6515ed");
workItems = workItems.stream().filter(s -> s.getStatus() < 80).collect(Collectors.toList());
if (EpointCollectionUtils.isNotEmpty(workItems)) {
WorkflowWorkItem workflowWorkItem = workItems.get(0);
lkgWorkflowService.handleOperate(caseinfo.getRowguid(), processVersionInstanceGuid,
workflowWorkItem.getWorkItemGuid(), null, WorkflowKeyNames9.OperationType_Pass,
userSession.getUserGuid(), opinion, null, "", "", cliengguid);
}
}
}



