控制流程推送
This commit is contained in:
parent
5468b1e6d4
commit
561dc7a82c
|
@ -27,6 +27,8 @@ import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static shkd.sys.sys.midservice.utils.MobApproveListServiceHelper.allowMobApprove;
|
||||||
|
|
||||||
public class ToDoResendTack extends AbstractTask {
|
public class ToDoResendTack extends AbstractTask {
|
||||||
private static final Log logger = LogFactory.getLog(ToDoResendTack.class);
|
private static final Log logger = LogFactory.getLog(ToDoResendTack.class);
|
||||||
|
|
||||||
|
@ -186,6 +188,11 @@ public class ToDoResendTack extends AbstractTask {
|
||||||
ErrorCode errorCode = new ErrorCode("error_code", "AES加密出现异常,请联系运维人员排查!");
|
ErrorCode errorCode = new ErrorCode("error_code", "AES加密出现异常,请联系运维人员排查!");
|
||||||
throw new KDException(errorCode, e);
|
throw new KDException(errorCode, e);
|
||||||
}
|
}
|
||||||
|
//判断是否移动端
|
||||||
|
boolean allowMobApprove = allowMobApprove(next.get("fid"));
|
||||||
|
if(allowMobApprove){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
switch (t_status) {
|
switch (t_status) {
|
||||||
case "0":
|
case "0":
|
||||||
//标题
|
//标题
|
||||||
|
@ -233,7 +240,6 @@ public class ToDoResendTack extends AbstractTask {
|
||||||
form.append("\"pendingAttr\":");
|
form.append("\"pendingAttr\":");
|
||||||
form.append("\"0\"");
|
form.append("\"0\"");
|
||||||
form.append("}");
|
form.append("}");
|
||||||
CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(),title,next.getLong("fid").toString(),userName,next.getString("fbillno"));
|
|
||||||
if(Objects.equals(shkd_type,"0")){
|
if(Objects.equals(shkd_type,"0")){
|
||||||
//旧 eoss 环境
|
//旧 eoss 环境
|
||||||
CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(),title,next.getLong("fid").toString(),userName,next.getString("fbillno"));
|
CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(),title,next.getLong("fid").toString(),userName,next.getString("fbillno"));
|
||||||
|
|
|
@ -22,6 +22,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static shkd.sys.sys.midservice.utils.MobApproveListServiceHelper.allowMobApprove;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description:
|
* @Description:
|
||||||
* @Author: FangShiXiao
|
* @Author: FangShiXiao
|
||||||
|
@ -37,19 +39,24 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
||||||
|
|
||||||
public void createToDo(MessageContext ctx, ToDoInfo todoInfo) {
|
public void createToDo(MessageContext ctx, ToDoInfo todoInfo) {
|
||||||
logger.info("###创建待办_createToDo");
|
logger.info("###创建待办_createToDo");
|
||||||
Object shkd_type = SystemParamServiceHelper.getPublicParameter("shkd_type");
|
//判断是否需要发送待办链接、true为不推送,false为推送
|
||||||
if(Objects.equals(shkd_type,"0")){
|
boolean b = allowMobApprove(ctx, todoInfo);
|
||||||
//旧 eoss 环境
|
logger.info("###推送结果为:"+b+"(true为不推送,false为推送)");
|
||||||
getToDoFormal(ctx,todoInfo);
|
if(!b){
|
||||||
}else if(Objects.equals(shkd_type,"1")){
|
Object shkd_type = SystemParamServiceHelper.getPublicParameter("shkd_type");
|
||||||
//新eoss 环境
|
if(Objects.equals(shkd_type,"0")){
|
||||||
getToDoNew(ctx,todoInfo);
|
//旧 eoss 环境
|
||||||
}else if(Objects.equals(shkd_type,"2")){
|
getToDoFormal(ctx,todoInfo);
|
||||||
//二套环境
|
}else if(Objects.equals(shkd_type,"1")){
|
||||||
getToDoNew(ctx,todoInfo);
|
//新eoss 环境
|
||||||
getToDoFormal(ctx,todoInfo);
|
getToDoNew(ctx,todoInfo);
|
||||||
|
}else if(Objects.equals(shkd_type,"2")){
|
||||||
|
//二套环境
|
||||||
|
getToDoNew(ctx,todoInfo);
|
||||||
|
getToDoFormal(ctx,todoInfo);
|
||||||
|
}
|
||||||
|
logger.info("###结束待办_createToDo");
|
||||||
}
|
}
|
||||||
logger.info("###结束待办_createToDo");
|
|
||||||
/* //几个待办
|
/* //几个待办
|
||||||
List<Long> userIds = todoInfo.getUserIds();
|
List<Long> userIds = todoInfo.getUserIds();
|
||||||
DynamicObjectCollection query = QueryServiceHelper.query("bos_user", "id,name,number" +
|
DynamicObjectCollection query = QueryServiceHelper.query("bos_user", "id,name,number" +
|
||||||
|
@ -107,36 +114,42 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
||||||
//已办
|
//已办
|
||||||
public void dealToDo(MessageContext ctx, ToDoInfo info){
|
public void dealToDo(MessageContext ctx, ToDoInfo info){
|
||||||
logger.info("###创建已办_dealToDo");
|
logger.info("###创建已办_dealToDo");
|
||||||
Object shkd_type = SystemParamServiceHelper.getPublicParameter("shkd_type");
|
boolean b = allowMobApprove(ctx, info);
|
||||||
if(Objects.equals(shkd_type,"0")){
|
logger.info("###推送结果为:"+b+"(true为不推送,false为推送)");
|
||||||
//旧 eoss 环境
|
if(!b){
|
||||||
getDealFormal(ctx,info);
|
Object shkd_type = SystemParamServiceHelper.getPublicParameter("shkd_type");
|
||||||
}else if(Objects.equals(shkd_type,"1")){
|
if(Objects.equals(shkd_type,"0")){
|
||||||
//新 eoss 环境
|
//旧 eoss 环境
|
||||||
getDealNew(ctx,info);
|
getDealFormal(ctx,info);
|
||||||
}else if(Objects.equals(shkd_type,"2")){
|
}else if(Objects.equals(shkd_type,"1")){
|
||||||
//二套环境
|
//新 eoss 环境
|
||||||
getDealNew(ctx,info);
|
getDealNew(ctx,info);
|
||||||
getDealFormal(ctx,info);
|
}else if(Objects.equals(shkd_type,"2")){
|
||||||
|
//二套环境
|
||||||
|
getDealNew(ctx,info);
|
||||||
|
getDealFormal(ctx,info);
|
||||||
|
}
|
||||||
|
logger.info("###结束已办_dealToDo");
|
||||||
}
|
}
|
||||||
logger.info("###结束已办_dealToDo");
|
|
||||||
}
|
}
|
||||||
//撤销
|
//撤销
|
||||||
public void deleteToDo(MessageContext ctx, ToDoInfo info){
|
public void deleteToDo(MessageContext ctx, ToDoInfo info){
|
||||||
|
|
||||||
logger.info("###创建撤销_deleteToDo");
|
logger.info("###创建撤销_deleteToDo");
|
||||||
Object shkd_type = SystemParamServiceHelper.getPublicParameter("shkd_type");
|
boolean b = allowMobApprove(ctx, info);
|
||||||
if(Objects.equals(shkd_type,"0")){
|
logger.info("###推送结果为:"+b+"(true为不推送,false为推送)");
|
||||||
//旧 eoss 环境
|
if(!b){
|
||||||
getDeleteFormal(ctx,info);
|
Object shkd_type = SystemParamServiceHelper.getPublicParameter("shkd_type");
|
||||||
}else if(Objects.equals(shkd_type,"1")){
|
if(Objects.equals(shkd_type,"0")){
|
||||||
//新 eoss 环境
|
//旧 eoss 环境
|
||||||
getDeleteNew(ctx,info);
|
getDeleteFormal(ctx,info);
|
||||||
}else if(Objects.equals(shkd_type,"2")){
|
}else if(Objects.equals(shkd_type,"1")){
|
||||||
//二套环境
|
//新 eoss 环境
|
||||||
getDeleteNew(ctx,info);
|
getDeleteNew(ctx,info);
|
||||||
getDeleteFormal(ctx,info);
|
}else if(Objects.equals(shkd_type,"2")){
|
||||||
}
|
//二套环境
|
||||||
|
getDeleteNew(ctx,info);
|
||||||
|
getDeleteFormal(ctx,info);
|
||||||
|
}
|
||||||
/* List<Long> userIds = info.getUserIds();
|
/* List<Long> userIds = info.getUserIds();
|
||||||
DynamicObjectCollection query = QueryServiceHelper.query("bos_user", "id,name,phone,username", new QFilter[]{new QFilter("id", "in", userIds)});
|
DynamicObjectCollection query = QueryServiceHelper.query("bos_user", "id,name,phone,username", new QFilter[]{new QFilter("id", "in", userIds)});
|
||||||
DynamicObject dynamicObject = QueryServiceHelper.queryOne("wf_hitaskinst", "billno",
|
DynamicObject dynamicObject = QueryServiceHelper.queryOne("wf_hitaskinst", "billno",
|
||||||
|
@ -152,7 +165,8 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
||||||
|
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
logger.info("###结束撤销_deleteToDo");
|
logger.info("###结束撤销_deleteToDo");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
package shkd.sys.sys.midservice.utils;
|
||||||
|
|
||||||
|
import com.bes.admin.jeemx.util.ObjectUtil;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.workflow.engine.msg.ctx.MessageContext;
|
||||||
|
import kd.bos.workflow.engine.msg.info.ToDoInfo;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author 方世筱
|
||||||
|
* @Date 2025/6/20 0020 13:46
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public class MobApproveListServiceHelper {
|
||||||
|
public static boolean allowMobApprove(String entityNumber,String billType,String procDefNumber,String nodeKey){
|
||||||
|
QFilter[] qFilters = new QFilter[]{
|
||||||
|
//实体编码=传入参数
|
||||||
|
//生效
|
||||||
|
new QFilter("shkd_entitynumber","=",entityNumber),
|
||||||
|
new QFilter("shkd_enable","=",true)
|
||||||
|
};
|
||||||
|
Map<Object, DynamicObject> objectDynamicObjectMap = BusinessDataServiceHelper.loadFromCache(
|
||||||
|
"shkd_mobapprovelist", "id,shkd_nolimitbilltype,shkd_nolimitprocess," +
|
||||||
|
"shkd_nolimitnode,shkd_billtype,shkd_processnum,shkd_nodenum", qFilters);
|
||||||
|
if(objectDynamicObjectMap != null && objectDynamicObjectMap.size()>0){
|
||||||
|
Iterator<Map.Entry<Object, DynamicObject>> iterator = objectDynamicObjectMap.entrySet().iterator();
|
||||||
|
while(iterator.hasNext()){
|
||||||
|
Map.Entry<Object, DynamicObject> next = iterator.next();
|
||||||
|
DynamicObject config = next.getValue();
|
||||||
|
//限定单据类型且不一致
|
||||||
|
if(!config.getBoolean("shkd_nolimitbilltype") && !ObjectUtil.equals(billType,config.getString("shkd_billtype"))){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//限定流程且不一致
|
||||||
|
if(!config.getBoolean("shkd_nolimitprocess") && !ObjectUtil.equals(procDefNumber,config.getString("shkd_processnum"))){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//限定节点且不一致
|
||||||
|
if(!config.getBoolean("shkd_nolimitnode") && !ObjectUtil.equals(nodeKey,config.getString("shkd_nodenum"))){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//符合条件
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean allowMobApprove(MessageContext ctx, ToDoInfo todoInfo){
|
||||||
|
String entityNumber=ctx.getEntityNumber();
|
||||||
|
String billType = "";
|
||||||
|
DynamicObject object = BusinessDataServiceHelper.loadSingleFromCache("wf_hitaskinst", "entityname",
|
||||||
|
new QFilter[]{new QFilter("id", "=", todoInfo.getTaskId())});
|
||||||
|
if(object != null){
|
||||||
|
billType = object.getString("entityname");
|
||||||
|
}
|
||||||
|
String elementId = ctx.getElementId();
|
||||||
|
int i = elementId.lastIndexOf("_");
|
||||||
|
//流程
|
||||||
|
String procDefNumber = elementId.substring(0, i);
|
||||||
|
//节点
|
||||||
|
String nodeKey = elementId.substring(i + 1);
|
||||||
|
return allowMobApprove(entityNumber,billType,procDefNumber,nodeKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean allowMobApprove(Object taskId){
|
||||||
|
DynamicObject object = BusinessDataServiceHelper.loadSingleFromCache("wf_hitaskinst",
|
||||||
|
"entitynumber,entityname,taskdefkey",
|
||||||
|
new QFilter[]{new QFilter("id", "=", taskId)});
|
||||||
|
if(object != null){
|
||||||
|
String entityNumber = object.getString("entitynumber");
|
||||||
|
String billType = object.getString("entityname");
|
||||||
|
String elementId = object.getString("taskdefkey");
|
||||||
|
int i = elementId.lastIndexOf("_");
|
||||||
|
//流程
|
||||||
|
String procDefNumber = elementId.substring(0, i);
|
||||||
|
//节点
|
||||||
|
String nodeKey = elementId.substring(i + 1);
|
||||||
|
|
||||||
|
return allowMobApprove(entityNumber,billType,procDefNumber,nodeKey);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue