You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
6.3 KiB
Java
161 lines
6.3 KiB
Java
package com.customization.meeting;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.engine.core.cfg.annotation.CommandDynamicProxy;
|
|
import com.engine.core.interceptor.AbstractCommandProxy;
|
|
import com.engine.core.interceptor.Command;
|
|
import com.engine.meeting.cmd.meetingbase.NewMeetingCmd;
|
|
import com.weaver.formmodel.util.DateHelper;
|
|
import weaver.conn.RecordSet;
|
|
import weaver.formmode.setup.ModeRightInfo;
|
|
import weaver.general.BaseBean;
|
|
import weaver.general.TimeUtil;
|
|
import weaver.general.Util;
|
|
import weaver.hrm.User;
|
|
import weaver.hrm.company.SubCompanyComInfo;
|
|
import weaver.soa.workflow.request.MainTableInfo;
|
|
import weaver.soa.workflow.request.Property;
|
|
import weaver.soa.workflow.request.RequestInfo;
|
|
import weaver.soa.workflow.request.RequestService;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @Classname CustomGetCalendarListCmd
|
|
* @Description TODO()
|
|
* @Author wanxq
|
|
* @Date 2019年10月25日10:23:37
|
|
**/
|
|
@CommandDynamicProxy(target = NewMeetingCmd.class, desc="创建会议触发用车流程")
|
|
public class CustomNewMeetingCmd extends AbstractCommandProxy<Map<String,Object>> {
|
|
|
|
@Override
|
|
public Map<String, Object> execute(Command<Map<String, Object>> targetCommand) {
|
|
|
|
//获取到被代理对象
|
|
NewMeetingCmd newMeetingCmd = (NewMeetingCmd)targetCommand;
|
|
//获取被代理对象的参数
|
|
Map<String, Object> params = newMeetingCmd.getParams();
|
|
//参数回写
|
|
//System.out.println("newmeeting params========="+params);
|
|
|
|
//执行标准的业务处理
|
|
Map<String, Object> result = nextExecute(targetCommand);
|
|
//对返回值做加工处理
|
|
User user = newMeetingCmd.getUser();
|
|
|
|
boolean status = (boolean) result.get("status");
|
|
String meetingid = (String) result.get("meetingid");
|
|
if(status){
|
|
RecordSet rs = new RecordSet();
|
|
String sfyc = (String) params.get("sfyc");//是否用车
|
|
if("1".equals(sfyc)){
|
|
String title = params.get("name")+"用车申请";
|
|
String creater = user.getUID()+"";
|
|
String caller = (String) params.get("caller");
|
|
|
|
rs.execute(" select * from hrmresource where id="+caller);
|
|
rs.next();
|
|
String subcompanyid = rs.getString("subcompanyid1");
|
|
|
|
//触发会议用车流程
|
|
Map<String,String> requestMainMap = new HashMap<String,String>();
|
|
requestMainMap.put("ycly","2");
|
|
requestMainMap.put("sqr",caller);
|
|
if(!"".equals(subcompanyid)){
|
|
requestMainMap.put("sqdw",subcompanyid);
|
|
}
|
|
requestMainMap.put("sqrq", DateHelper.getCurrentDate());
|
|
int requestid = createWorkflow(requestMainMap,title,"531",creater,"0");
|
|
//System.out.println("car application requestid======"+requestid);
|
|
|
|
}
|
|
|
|
//新建建模数据,给会议管理员添加参会人员
|
|
String hrmSubCompanys = (String) params.get("hrmSubCompanys");//参会分部
|
|
//System.out.println("hrmSubCompanys========="+hrmSubCompanys);
|
|
String name = (String) params.get("name");//会议名称
|
|
String currentdate = TimeUtil.getCurrentDateString();
|
|
String currenttime = TimeUtil.getOnlyCurrentTimeString();
|
|
if(!"".equals(hrmSubCompanys)){
|
|
String[] hrmSubCompanysArr = hrmSubCompanys.split(",");
|
|
for(int i=0;i<hrmSubCompanysArr.length;i++){
|
|
rs.execute(" select ejdwhygly from uf_ejdwhygly where ejdw="+hrmSubCompanysArr[i]);
|
|
rs.next();
|
|
String ejdwhygly = Util.null2String(rs.getString("ejdwhygly"));
|
|
|
|
String insertSql = " insert into uf_chry(meetingid,hymc,chdw,chdwgly,modedatacreater,modedatacreatedate,modedatacreatetime,formmodeid) "+
|
|
" values("+meetingid+",'"+name+"','"+hrmSubCompanysArr[i]+"','"+ejdwhygly+"','"+user.getUID()+"','"+currentdate+"','"+currenttime+"',24501)";
|
|
//System.out.println("insertSql========="+insertSql);
|
|
boolean insertResult = rs.execute(insertSql);
|
|
if(insertResult){
|
|
rs.execute("select id from uf_chry where chdw="+hrmSubCompanysArr[i]+" and modedatacreatetime='"+currenttime+"' ");
|
|
rs.next();
|
|
int id = rs.getInt("id");
|
|
|
|
ModeRightInfo moderight = new ModeRightInfo();
|
|
moderight.editModeDataShare(user.getUID(), 24501, id);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
return result;
|
|
}
|
|
|
|
|
|
/**
|
|
* 创建流程
|
|
* @param requestMainMap
|
|
* @param title
|
|
* @param workflowid
|
|
* @param isNextFlow
|
|
* @return requestid
|
|
*/
|
|
public int createWorkflow(Map<String,String> requestMainMap,String title,String workflowid,String creater,String isNextFlow){
|
|
|
|
String requestid = "-1";
|
|
RequestInfo requestInfo = new RequestInfo();
|
|
requestInfo.setCreatorid(creater);//创建人Id
|
|
requestInfo.setWorkflowid(workflowid);//工作流Id
|
|
requestInfo.setDescription(title);//请求标题
|
|
requestInfo.setIsNextFlow(isNextFlow);
|
|
|
|
//主表字段
|
|
MainTableInfo mainTableInfo = new MainTableInfo();
|
|
Property[] propertyArray = new Property[requestMainMap.size()];
|
|
int p = 0;
|
|
for (Map.Entry<String, String> entry : requestMainMap.entrySet()){
|
|
String key = Util.null2String(entry.getKey());
|
|
String value = entry.getValue();
|
|
System.out.println("key:"+key+" value:"+value);
|
|
if(value!=null || !"".equals(value)){
|
|
propertyArray[p] = new Property();
|
|
propertyArray[p].setName(key);
|
|
propertyArray[p].setValue(value);
|
|
p++;
|
|
}
|
|
}
|
|
mainTableInfo.setProperty(propertyArray);
|
|
requestInfo.setMainTableInfo(mainTableInfo);
|
|
|
|
RequestService service = new RequestService();
|
|
try {
|
|
requestid = service.createRequest(requestInfo);//创建请求id;
|
|
}catch (Exception e) {
|
|
new BaseBean().writeLog("创建流程异常:" + e);
|
|
}
|
|
return Integer.parseInt(requestid);
|
|
}
|
|
|
|
|
|
|
|
}
|