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.
204 lines
11 KiB
Java
204 lines
11 KiB
Java
3 years ago
|
package com.customization.meeting;
|
||
|
|
||
|
import com.api.meeting.util.PageUidFactory;
|
||
|
import com.api.workplan.util.TimeZoneCastUtil;
|
||
|
import com.cloudstore.dev.api.util.Util_TableMap;
|
||
|
import com.engine.core.cfg.annotation.CommandDynamicProxy;
|
||
|
import com.engine.core.interceptor.AbstractCommandProxy;
|
||
|
import com.engine.core.interceptor.Command;
|
||
|
import com.engine.core.interceptor.CommandContext;
|
||
|
import com.engine.meeting.cmd.calendar.GetCalendarListCmd;
|
||
|
import weaver.conn.RecordSet;
|
||
|
import weaver.general.PageIdConst;
|
||
|
import weaver.general.Util;
|
||
|
import weaver.hrm.User;
|
||
|
import weaver.meeting.MeetingShareUtil;
|
||
|
import weaver.meeting.MeetingUtil;
|
||
|
import weaver.meeting.defined.MeetingFieldComInfo;
|
||
|
import weaver.systeminfo.SystemEnv;
|
||
|
|
||
|
import java.text.SimpleDateFormat;
|
||
|
import java.util.Calendar;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/**
|
||
|
* @Classname CustomGetCalendarListCmd
|
||
|
* @Description TODO()
|
||
|
* @Author wanxq
|
||
|
* @Date 2019-09-04 15:52
|
||
|
**/
|
||
|
@CommandDynamicProxy(target = GetCalendarListCmd.class, desc="修改会议状态")
|
||
|
public class CustomGetCalendarListCmd extends AbstractCommandProxy<Map<String,Object>> {
|
||
|
|
||
|
@Override
|
||
|
public Map<String, Object> execute(Command<Map<String, Object>> targetCommand) {
|
||
|
|
||
|
//获取到被代理对象
|
||
|
GetCalendarListCmd getCalendarListCmd = (GetCalendarListCmd)targetCommand;
|
||
|
//获取被代理对象的参数
|
||
|
Map<String, Object> params = getCalendarListCmd.getParams();
|
||
|
//参数回写
|
||
|
//getCalendarListCmd.setParams(params);
|
||
|
//执行标准的业务处理
|
||
|
Map<String, Object> result = nextExecute(targetCommand);
|
||
|
//对返回值做加工处理
|
||
|
User user = getCalendarListCmd.getUser();
|
||
|
|
||
|
result = getCalendarListDatas(user,params);
|
||
|
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
|
||
|
public Map<String, Object> getCalendarListDatas(User user, Map<String, Object> params) {
|
||
|
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||
|
Calendar selectCalendar = Calendar.getInstance(); //用于显示的日期
|
||
|
|
||
|
String selectUser = Util.null2String(params.get("selectUser")); //被选择用户Id
|
||
|
String selectDateString = Util.null2String(params.get("selectdate")); //被选择日期
|
||
|
String meetingType = Util.null2String(params.get("meetingType")); //会议的进行状态
|
||
|
int offsetDays = 0; //相对显示显示第一天的偏移天数
|
||
|
|
||
|
String beginDate = "";
|
||
|
String endDate = "";
|
||
|
String beginYear = "";
|
||
|
String beginMonth = "";
|
||
|
String beginDay = "";
|
||
|
|
||
|
String endYear = "";
|
||
|
String endMonth = "";
|
||
|
String endDay = "";
|
||
|
|
||
|
//参数传递
|
||
|
String userId = String.valueOf(user.getUID()); //当前用户Id
|
||
|
|
||
|
SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm") ;
|
||
|
Calendar calendar = Calendar.getInstance() ;
|
||
|
String currenttime = SDF.format(calendar.getTime()) ;
|
||
|
|
||
|
if ("".equals(selectUser) || userId.equals(selectUser)) {
|
||
|
selectUser = userId;
|
||
|
}
|
||
|
selectUser = selectUser.replaceAll(",", "");
|
||
|
|
||
|
String allUser= MeetingShareUtil.getAllUser(user);
|
||
|
|
||
|
if (!"".equals(selectDateString))
|
||
|
//当选择日期
|
||
|
{
|
||
|
int selectYear = Util.getIntValue(selectDateString.substring(0,
|
||
|
4)); //被选择年
|
||
|
int selectMonth = Util.getIntValue(selectDateString.substring(
|
||
|
5, 7)) - 1; //被选择月
|
||
|
int selectDay = Util.getIntValue(selectDateString.substring(8,
|
||
|
10)); //被选择日
|
||
|
selectCalendar.set(selectYear, selectMonth, selectDay);
|
||
|
}
|
||
|
String selectDayOfMonth = Util.add0((selectCalendar.get(Calendar.DAY_OF_MONTH)), 2); //日
|
||
|
//月显示
|
||
|
selectCalendar.set(Calendar.DATE, 1); //设置为月第一天
|
||
|
int offsetDayOfWeek = selectCalendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||
|
offsetDays = Integer.parseInt(selectDayOfMonth) - 1
|
||
|
+ offsetDayOfWeek;
|
||
|
selectCalendar.add(Calendar.DAY_OF_WEEK, -1 * offsetDayOfWeek); //设置为月首日那周的第一天
|
||
|
|
||
|
beginYear = Util.add0(selectCalendar.get(Calendar.YEAR), 4); //年
|
||
|
beginMonth = Util.add0(selectCalendar.get(Calendar.MONTH) + 1, 2); // 月
|
||
|
beginDay = Util.add0(selectCalendar.get(Calendar.DAY_OF_MONTH), 2); //日
|
||
|
beginDate = beginYear + "-" + beginMonth + "-" + beginDay;
|
||
|
//月计划显示
|
||
|
selectCalendar.add(Calendar.DATE, offsetDays);
|
||
|
selectCalendar.set(Calendar.DATE, 1); //设置为月第一天
|
||
|
selectCalendar.add(Calendar.MONTH, 1);
|
||
|
selectCalendar.add(Calendar.DATE, -1);
|
||
|
int offsetDayOfWeekEnd = 7 - selectCalendar
|
||
|
.get(Calendar.DAY_OF_WEEK);
|
||
|
selectCalendar.add(Calendar.DAY_OF_WEEK, offsetDayOfWeekEnd); //设置为月末日那周的最后一天
|
||
|
endYear = Util.add0(selectCalendar.get(Calendar.YEAR), 4); //年
|
||
|
endMonth = Util.add0(selectCalendar.get(Calendar.MONTH) + 1, 2); // 月
|
||
|
endDay = Util.add0(selectCalendar.get(Calendar.DAY_OF_MONTH), 2); //日
|
||
|
endDate = endYear + "-" + endMonth + "-" + endDay;
|
||
|
|
||
|
String backfields = "t1.id,t1.name,t1.address,t1.customizeAddress,t1.caller,t1.contacter,t1.begindate,t1.begintime,t1.enddate,t1.endtime,t1.meetingstatus,t1.isdecision, t3.status as status";
|
||
|
String fromSql = " Meeting_ShareDetail t2, Meeting t1 left join Meeting_View_Status t3 on t3.meetingId = t1.id and t3.userId = " + userId + "";
|
||
|
|
||
|
String sqlWhere = " where t1.repeatType = 0 ";
|
||
|
|
||
|
if(!sqlWhere.equals(""))
|
||
|
{
|
||
|
sqlWhere +=" AND (";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
sqlWhere =" WHERE (";
|
||
|
}
|
||
|
sqlWhere +=" (t1.id = t2.meetingId) AND t2.shareLevel <> 5 and t2.shareType = 5 AND ";
|
||
|
//待审批,审批退回的会议,召集人 联系人 创建人 审批人都可以看
|
||
|
sqlWhere +=" ((t1.meetingStatus in (1, 3) AND t2.userId in (" + allUser + ") AND t2.shareLevel in (1,4))" ;
|
||
|
//草稿中的创建人可以看见
|
||
|
sqlWhere +=" OR (t1.meetingStatus = 0 AND t1.creater in (" + allUser + ") AND t2.userId in(" + allUser + ") ) ";
|
||
|
//正常和取消的会议所有参会人员都可见
|
||
|
sqlWhere +=" OR (t1.meetingStatus IN (2, 4) AND (t2.userId in(" + allUser + "))))";
|
||
|
sqlWhere +=") ";
|
||
|
StringBuffer sqlStringBuffer = new StringBuffer();
|
||
|
//sqlStringBuffer.append(" and (t1.cancel <> 1 or t1.cancel is null) ");
|
||
|
sqlStringBuffer.append(TimeZoneCastUtil.getDateTimeSql(6,beginDate,endDate,"t1"));
|
||
|
|
||
|
String btimeStr = "t1.beginDate+' '+t1.begintime ";
|
||
|
String etimeStr = "t1.endDate+' '+t1.endtime ";
|
||
|
if ((new RecordSet().getDBType()).equals("oracle")) {
|
||
|
btimeStr = "t1.beginDate||' '||t1.begintime ";
|
||
|
etimeStr = "t1.endDate||' '||t1.endtime ";
|
||
|
}else if ((new RecordSet().getDBType()).equals("mysql")) {
|
||
|
btimeStr = "concat(t1.beginDate,' ',t1.begintime) ";
|
||
|
etimeStr = "concat(t1.endDate,' ',t1.endtime) ";
|
||
|
}
|
||
|
if("1".equals(meetingType)){
|
||
|
sqlStringBuffer.append(" AND ("+etimeStr+" < '"+ currenttime + "' ");
|
||
|
sqlStringBuffer.append(" or t1.isdecision = 2 ) ");
|
||
|
} else if("2".equals(meetingType)){
|
||
|
sqlStringBuffer.append(" AND ("+btimeStr+" <= '"+ currenttime + "' ");
|
||
|
sqlStringBuffer.append(" AND "+etimeStr+" >= '"+ currenttime + "' and t1.isdecision <> 2) ");
|
||
|
|
||
|
} else if("3".equals(meetingType)){
|
||
|
sqlStringBuffer.append(" AND "+btimeStr+" > '"+ currenttime + "' and t1.isdecision <> 2");
|
||
|
}
|
||
|
|
||
|
if(!userId.equals(selectUser)){
|
||
|
//人员
|
||
|
sqlStringBuffer.append(" AND ( exists ( select 1 from Meeting_Member2 where t1.id = Meeting_Member2.meetingid and Meeting_Member2.membertype = 1 and Meeting_Member2.memberid = "+ selectUser +") or t1.caller = "+ selectUser +" or t1.contacter = "+ selectUser +") ");
|
||
|
}
|
||
|
sqlStringBuffer.append(MeetingUtil.getSecretSql(user,"t1."));
|
||
|
sqlWhere += sqlStringBuffer.toString();
|
||
|
|
||
|
String transClass="com.api.meeting.util.MeetingTransMethod";
|
||
|
MeetingFieldComInfo meetingFieldComInfo=new MeetingFieldComInfo();
|
||
|
|
||
|
String orderby="t1.beginDate ,t1.begintime ";
|
||
|
String pageUid = PageUidFactory.getPageUid("meetingCalendarList");
|
||
|
String pageSize = PageIdConst.getPageSize(pageUid, user.getUID());
|
||
|
String temptableString = " <sql backfields=\""+ backfields+ "\" sqlform=\""+ Util.toHtmlForSplitPage(fromSql)+ "\" sqlwhere=\""+ Util.toHtmlForSplitPage(sqlWhere)+ "\" sqlorderby=\""+ orderby+ "\" sqlprimarykey=\"id\" sqlsortway=\"Desc\" sqlisdistinct=\"true\" />";
|
||
|
String operateString = "<operates></operates>";
|
||
|
String tableString = " <table instanceid=\"meetingCalendarTable_e9\" tabletype=\"none\" pageId=\""+ pageUid+ "\" pageUid=\""+ pageUid+ "\" cssHandler=\"com.weaver.cssRenderHandler.request.CheckboxColorRender\" pagesize=\""+ pageSize + "\" >";
|
||
|
tableString += temptableString;
|
||
|
tableString += operateString + "<head>";
|
||
|
tableString +=
|
||
|
//"<col width=\"24%\" text=\""+SystemEnv.getHtmlLabelName(Util.getIntValue(meetingFieldComInfo.getLabel(""+2)),user.getLanguage())+"\" column=\"name\" orderkey=\"t1.name\" transmethod=\""+transClass+".getMeetingName\" otherpara=\"column:id+column:status\" />"+
|
||
|
"<col hide=\"true\" text=\"\" column=\"id\" orderkey=\"id\" />"+
|
||
|
"<col width=\"24%\" text=\""+ SystemEnv.getHtmlLabelName(Util.getIntValue(meetingFieldComInfo.getLabel(""+2)),user.getLanguage())+"\" column=\"name\" orderkey=\"t1.name\" otherpara=\"column:id+column:status\" />"+
|
||
|
"<col width=\"16%\" text=\""+SystemEnv.getHtmlLabelName(Util.getIntValue(meetingFieldComInfo.getLabel(""+5)),user.getLanguage())+"\" column=\"address\" orderkey=\"address\" otherpara=\""+user.getLanguage()+"+column:customizeaddress\" transmethod=\""+transClass+".getMeetingAddress\" />"+
|
||
|
"<col width=\"30%\" text=\""+SystemEnv.getHtmlLabelName(81901,user.getLanguage())+"\" column=\"begindate\" orderkey=\"begindate,begintime\" otherpara=\"column:begintime+column:enddate+column:endtime\" transmethod=\""+transClass+".getMeetingTime\"/>"+
|
||
|
"<col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(Util.getIntValue(meetingFieldComInfo.getLabel(""+3)),user.getLanguage())+"\" column=\"caller\" orderkey=\"caller\" transmethod=\""+transClass+".getMeetingResource\" />"+
|
||
|
"<col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(Util.getIntValue(meetingFieldComInfo.getLabel(""+4)),user.getLanguage())+"\" column=\"contacter\" orderkey=\"contacter\" transmethod=\""+transClass+".getMeetingResource\" />"+
|
||
|
"<col width=\"10%\" text=\""+SystemEnv.getHtmlLabelName(602,user.getLanguage())+"\" column=\"meetingstatus\" otherpara=\""+user.getLanguage()+"+column:endDate+column:endTime+column:isdecision\" orderkey=\"meetingstatus\" transmethod=\""+transClass+".getMeetingStatus\" />"+
|
||
|
"</head>"+
|
||
|
"</table>";
|
||
|
String sessionkey = pageUid + "_" + Util.getEncrypt(Util.getRandom());
|
||
|
Util_TableMap.setVal(sessionkey, tableString);
|
||
|
apidatas.put("sessionkey", sessionkey);
|
||
|
apidatas.put("ret", "true");
|
||
|
return apidatas;
|
||
|
}
|
||
|
}
|