@ -1,7 +1,6 @@
package com.customization.qc2563600 ;
import com.cloudstore.dev.api.bean.MessageType ;
import com.engine.workflow.biz.requestForm.RequestRemindBiz ;
import weaver.conn.RecordSet ;
import weaver.general.Util ;
import weaver.hrm.User ;
@ -10,9 +9,7 @@ import weaver.workflow.msg.entity.MsgEntity;
import weaver.workflow.msg.entity.MsgNoticeType ;
import java.text.SimpleDateFormat ;
import java.util.ArrayList ;
import java.util.Date ;
import java.util.List ;
import java.util.* ;
public class CCOperatorUtil {
@ -20,23 +17,23 @@ public class CCOperatorUtil {
* 添 加 抄 送 人
* /
public static void sendMessage ( int requestid , List < String > userIds , String nodeid , MessageType messageType , MsgNoticeType msgNoticeType , User user ) {
List < MsgEntity > requestMsgEntity = requestFlowMsg ( requestid , userIds , nodeid , requestid + "" , messageType , msgNoticeType , true ) ;
List < MsgEntity > requestMsgEntity = requestFlowMsg ( requestid , userIds , nodeid , requestid + "" , messageType , msgNoticeType , user . getUID ( ) ) ;
//发送消息提醒
new MsgPushUtil ( ) . pushMsg ( requestMsgEntity ) ;
//先判断是否开启了流程邮件提醒功能,如果开启了则发送邮件提醒
RecordSet recordSet = new RecordSet ( ) ;
recordSet . executeQuery ( "select a.isemailremind,a.id from workflow_base a left join workflow_requestbase b on b.workflowid = a.id where b.requestid = ?" , requestid ) ;
if ( recordSet . next ( ) ) {
if ( "1" . equals ( recordSet . getString ( "isemailremind" ) ) ) {
int workflowid = recordSet . getInt ( "id" ) ;
String src = "submit" ;
RequestRemindBiz requestRemindBiz = new RequestRemindBiz ( user , requestid , workflowid , src ) ;
requestRemindBiz . doRemind ( requestid , user . getUID ( ) , workflowid , src , "0" , "1" ) ;
}
}
// RecordSet recordSet = new RecordSet();
// recordSet.executeQuery("select a.isemailremind,a.id from workflow_base a left join workflow_requestbase b on b.workflowid = a.id where b.requestid = ?",requestid);
// if(recordSet.next()) {
// new BaseBean().writeLog("qc2563600===>>isemailremind:" + recordSet.getString("isemailremind"));
// if("1".equals(recordSet.getString("isemailremind"))){
// String workflowid = recordSet.getString("id");
// SendEmailCustomUtil util = new SendEmailCustomUtil(user,Util.getIntValue(workflowid),requestid,"submit");
// util.sendEmailCustom(workflowid,nodeid,requestid + "",user,String.join(",",userIds));
// }
// }
}
public static List < MsgEntity > requestFlowMsg ( int requestId , List < String > userIds , String current_node , String targetid , MessageType messageType , MsgNoticeType msgNoticeType , boolean isRejectCC ) {
public static List < MsgEntity > requestFlowMsg ( int requestId , List < String > userIds , String current_node , String targetid , MessageType messageType , MsgNoticeType msgNoticeType , int currentUserId ) {
List < MsgEntity > innerMsg = new ArrayList < > ( ) ;
try {
@ -50,6 +47,13 @@ public class CCOperatorUtil {
baseEntity . addAllUserId ( userIds ) ;
baseEntity . setDetailTitleParams ( "current_node" , current_node ) ; //当前节点
baseEntity . setDetailId ( targetid ) ;
baseEntity . setOperatorId ( String . valueOf ( currentUserId ) ) ;
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select userid,id from workflow_currentoperator where (isremark = 8 or isremark = 9) " +
" and usertype = 0 and requestid = ? and nodeid = ?" , requestId , current_node ) ;
if ( rs . getCounts ( ) > 0 ) {
addOperatorId ( rs , baseEntity ) ;
}
innerMsg . add ( baseEntity ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
@ -92,6 +96,38 @@ public class CCOperatorUtil {
return msgEntity ;
}
/ * *
* 人 员 ID 与 操 作 者 ID 映 射 处 理
* @param rs
* @param msgEntity
* /
private static MsgEntity addOperatorId ( RecordSet rs , MsgEntity msgEntity ) {
Map < String , List < String > > userOperatorIds = new HashMap < > ( ) ;
while ( rs . next ( ) ) {
String userId = Util . null2String ( rs . getString ( 1 ) ) ;
String operatorId = Util . null2String ( rs . getString ( 2 ) ) ;
String nodeId = Util . null2String ( rs . getString ( 3 ) ) ;
msgEntity . addUserId ( userId ) ;
msgEntity . addCurrentOperatorNode ( operatorId , nodeId ) ;
List < String > OperatorIds = userOperatorIds . get ( userId ) ;
if ( OperatorIds = = null ) {
OperatorIds = new ArrayList < > ( ) ;
OperatorIds . add ( operatorId ) ;
userOperatorIds . put ( userId , OperatorIds ) ;
} else {
OperatorIds . add ( operatorId ) ;
}
}
for ( String userId : userOperatorIds . keySet ( ) ) {
msgEntity . addCurrentOperatorId ( userId , String . join ( "," , userOperatorIds . get ( userId ) ) ) ;
}
return msgEntity ;
}
public static void insert ( String requestid , List < String > addUsers , String nodeid , String isremark , User user ) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
@ -135,9 +171,6 @@ public class CCOperatorUtil {
list . add ( rs . getString ( "needwfback" ) ) ;
list . add ( isremark ) ;
list . add ( isremark ) ;
// list.add(takid);
// list.add(2);
// list.add(rs.getString("multiTakLevel"));
lists . add ( list ) ;
rs3 . executeUpdate ( "update workflow_currentoperator set islasttimes = 0 where requestid = ? and userid = ?" , requestid , userIdTemp ) ;