出差流程没有外勤打卡不计算考勤
parent
bb8fb2ae0a
commit
d38ea317e5
@ -0,0 +1,128 @@
|
||||
package com.engine.kq.cmd.balanceofleavedetail;
|
||||
|
||||
import com.cloudstore.dev.api.util.Util_TableMap;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.kq.biz.KQLeaveRulesBiz;
|
||||
import com.engine.kq.biz.KQLeaveRulesComInfo;
|
||||
import weaver.general.PageIdConst;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 加班生成调休的明细
|
||||
*/
|
||||
public class GetSearchListCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetSearchListCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
try {
|
||||
/*人员ID*/
|
||||
String resourceId = Util.null2String(params.get("resourceId"));
|
||||
/*搜索条件中的年份*/
|
||||
String searchYearSelect = Util.null2String(params.get("searchYearSelect"));//日期控件的选择值
|
||||
String searchYear = Util.null2String(params.get("searchYear"));//年份
|
||||
if (searchYearSelect.equals("5") || searchYearSelect.equals("8")) {
|
||||
searchYear = TimeUtil.getDateByOption(searchYearSelect, "0").substring(0, 4);
|
||||
}
|
||||
//假期类型的ID
|
||||
String leaveRulesId = Util.null2String(params.get("ruleId"));
|
||||
|
||||
if (resourceId.equals("") || searchYear.equals("") || leaveRulesId.equals("")) {
|
||||
resultMap.put("status", "-1");
|
||||
resultMap.put("message", SystemEnv.getHtmlLabelName(388858, user.getLanguage()));//参数有误
|
||||
return resultMap;
|
||||
}
|
||||
boolean isTiaoXiu = KQLeaveRulesBiz.isTiaoXiu(leaveRulesId);
|
||||
|
||||
KQLeaveRulesComInfo rulesComInfo = new KQLeaveRulesComInfo();
|
||||
//调休的单位
|
||||
String unitName = rulesComInfo.getUnitName(leaveRulesId, user.getLanguage());
|
||||
|
||||
/**********************************************************************************************************/
|
||||
|
||||
boolean canEdit = HrmUserVarify.checkUserRight("KQLeaveRulesEdit:Edit", user);//是否具有编辑权限
|
||||
boolean canDelete = HrmUserVarify.checkUserRight("KQLeaveRulesDelete:Delete", user);//是否具有删除权限
|
||||
boolean canLog = HrmUserVarify.checkUserRight("KQLeaveRules:Log", user);//是否具有查看日志的权限
|
||||
|
||||
/**********************************************************************************************************/
|
||||
|
||||
String backFields = " b.id,a.lastName,b.belongYear,b.belongMonth,b.overtimeType,b.baseAmount,b.extraAmount,b.usedAmount,0 as invalidAmount,0 as restAmount,b.effectiveDate,b.expirationDate,b.tiaoxiuamount,CASE " +
|
||||
" WHEN c.changetype = 1 THEN '节假日' " +
|
||||
" WHEN c.changetype = 2 THEN '工作日' " +
|
||||
" WHEN c.changetype = 3 THEN '休息日' " +
|
||||
" ELSE '未知' END as changetype ";
|
||||
String sqlFrom = " from HrmResource a,KQ_BalanceOfLeave b, kq_flow_overtime c ";
|
||||
String sqlWhere = " where 1=1 and a.id=b.resourceId and (isDelete is null or isDelete<>1) ";
|
||||
String orderBy = " b.belongYear asc,b.expirationDate asc,b.id asc ";
|
||||
|
||||
if (!resourceId.equals("")) {
|
||||
sqlWhere += " and a.id in (" + resourceId + ")";
|
||||
}
|
||||
if (!searchYear.equals("")) {
|
||||
sqlWhere += " and b.belongYear='" + searchYear + "' ";
|
||||
}
|
||||
if (!leaveRulesId.equals("")) {
|
||||
sqlWhere += " and b.leaveRulesId=" + leaveRulesId;
|
||||
}
|
||||
|
||||
String pageUid = "b29847fa-6877-f7bd-f12b-5d3a35183b25";
|
||||
String operateString = "";
|
||||
operateString = "<operates width=\"20%\">";
|
||||
operateString += "<popedom transmethod=\"weaver.hrm.common.SplitPageTagOperate.getBasicOperate\" otherpara=\"" + canEdit + ":" + canDelete + ":" + canLog + "\"></popedom> ";
|
||||
operateString += " <operate href=\"javascript:openDialog();\" text=\"" + SystemEnv.getHtmlLabelName(93, user.getLanguage()) + "\" index=\"0\"/>";
|
||||
operateString += " <operate href=\"javascript:doDel()\" text=\"" + SystemEnv.getHtmlLabelName(91, user.getLanguage()) + "\" index=\"1\"/>";
|
||||
operateString += " <operate href=\"javascript:onLog()\" text=\"" + SystemEnv.getHtmlLabelName(83, user.getLanguage()) + "\" index=\"2\"/>";
|
||||
operateString += "</operates>";
|
||||
String tiaoxiuColString = "";
|
||||
if(isTiaoXiu){
|
||||
tiaoxiuColString =" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(126739, user.getLanguage()) + "\" column=\"tiaoxiuamount\" transmethod=\"com.engine.kq.util.KQTransMethod.getTiaoxiuamountShow\" />";
|
||||
tiaoxiuColString = tiaoxiuColString + " <col width=\"10%\" text=\"" + "加班类型" + "\" column=\"changetype\" />";
|
||||
}
|
||||
String tableString = "" +
|
||||
"<table pageId=\"KQ:BalanceDetailList\" pageUid=\"" + pageUid + "\" tabletype=\"checkbox\" pagesize=\"" + PageIdConst.getPageSize("KQ:BalanceDetailList", user.getUID(), PageIdConst.HRM) + "\" >" +
|
||||
"<sql backfields=\"" + backFields + "\" sqlform=\"" + sqlFrom + "\" sqlwhere=\"" + Util.toHtmlForSplitPage(sqlWhere) + "\" sqlorderby=\"" + orderBy + "\" sqlprimarykey=\"id\" sqlsortway=\"asc\" sqlisdistinct=\"false\"/>"
|
||||
+ operateString +
|
||||
" <head>" +
|
||||
" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(413, user.getLanguage()) + "\" column=\"lastname\" />" +
|
||||
" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(15933, user.getLanguage()) + "\" column=\"belongYear\"/>" +
|
||||
" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(887, user.getLanguage()) + "\" column=\"belongMonth\"/>" +
|
||||
//" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(510282, user.getLanguage()) + "\" column=\"overtimeType\" transmethod=\"com.engine.kq.util.KQTransMethod.getOvertimeTypeShow\" otherpara=\"" + user.getLanguage() + "\"/>" +
|
||||
" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(130286, user.getLanguage()) + unitName + "\" column=\"baseAmount\" transmethod=\"com.engine.kq.util.KQTransMethod.getTotalAmountShow\" otherpara=\"column:extraAmount\"/>" +
|
||||
" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(26642, user.getLanguage()) + unitName + "\" column=\"usedAmount\" transmethod=\"com.engine.kq.util.KQTransMethod.getOriginalShow\"/>" +
|
||||
" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(389611, user.getLanguage()) + unitName + "\" column=\"invalidAmount\" transmethod=\"com.engine.kq.util.KQTransMethod.getInvalidAmountShow\" otherpara=\"column:baseAmount+column:extraAmount+column:usedAmount+column:expirationDate+column:tiaoxiuamount\" />" +
|
||||
tiaoxiuColString+
|
||||
" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(25723, user.getLanguage()) + unitName + "\" column=\"restAmount\" transmethod=\"com.engine.kq.util.KQTransMethod.getRestAmountShow\" otherpara=\"column:baseAmount+column:extraAmount+column:usedAmount+column:expirationDate+column:tiaoxiuamount\"/>" +
|
||||
" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(508169, user.getLanguage()) + "\" column=\"effectiveDate\"/>" +
|
||||
" <col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(19547, user.getLanguage()) + "\" column=\"expirationDate\" transmethod=\"com.engine.kq.util.KQTransMethod.getExpirationDateShow\" otherpara=\"" + user.getLanguage() + "\"/>" +
|
||||
" </head>" +
|
||||
"</table>";
|
||||
String sessionKey = pageUid + "_" + Util.getEncrypt(Util.getRandom());
|
||||
Util_TableMap.setVal(sessionKey, tableString);
|
||||
resultMap.put("sessionkey", sessionKey);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
resultMap.put("status", "-1");
|
||||
resultMap.put("message", e.getMessage());
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.engine.kq.cmd.reportdetial;
|
||||
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.kq.biz.KQAttFlowSetBiz;
|
||||
import com.engine.kq.enums.KqSplitFlowTypeEnum;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* 请假信息
|
||||
*/
|
||||
public class GetLeaveInfoCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetLeaveInfoCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try{
|
||||
|
||||
String dialogTitle = "";
|
||||
String type = Util.null2String(params.get("type"));
|
||||
if(type.equals("leave")||type.startsWith("leaveType_")){//请假
|
||||
dialogTitle = SystemEnv.getHtmlLabelName(20092, user.getLanguage());
|
||||
if(type.startsWith("leaveType_")) {
|
||||
String[] typeInfo = Util.splitString(type, "_");
|
||||
if (typeInfo[0].equals("leaveType")) {
|
||||
params.put("kqtype", KqSplitFlowTypeEnum.LEAVE.getFlowtype());
|
||||
}
|
||||
params.put("newleavetype", typeInfo[1]);
|
||||
}else{
|
||||
params.put("kqtype", KqSplitFlowTypeEnum.LEAVE.getFlowtype());
|
||||
}
|
||||
}else{
|
||||
if(type.equals("overtimeTotal")){//加班
|
||||
dialogTitle = SystemEnv.getHtmlLabelName(33501, user.getLanguage());
|
||||
params.put("kqtype",KqSplitFlowTypeEnum.OVERTIME.getFlowtype());
|
||||
}else if(type.equals("businessLeave")){//出差
|
||||
dialogTitle = SystemEnv.getHtmlLabelName(20093, user.getLanguage());
|
||||
params.put("kqtype",KqSplitFlowTypeEnum.EVECTION.getFlowtype());
|
||||
}else if(type.equals("officialBusiness")){//公出
|
||||
dialogTitle = SystemEnv.getHtmlLabelName(20094, user.getLanguage());
|
||||
params.put("kqtype",KqSplitFlowTypeEnum.OUT.getFlowtype());
|
||||
}else if(type.equals("leaveDeduction")){//异常冲抵
|
||||
dialogTitle = SystemEnv.getHtmlLabelName(391404, user.getLanguage());
|
||||
params.put("kqtype",KqSplitFlowTypeEnum.OTHER.getFlowtype());
|
||||
}
|
||||
}
|
||||
|
||||
retmap.put("dialogTitle",dialogTitle);
|
||||
retmap.put("sessionkey",new KQAttFlowSetBiz().buildFlowSetTableString(params, user));
|
||||
retmap.put("status", "1");
|
||||
}catch (Exception e) {
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,359 @@
|
||||
package com.engine.kq.cmd.shiftschedule;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.kq.biz.KQGroupComInfo;
|
||||
import com.engine.kq.biz.KQShiftManagementComInfo;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
|
||||
public ExportExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
if (!HrmUserVarify.checkUserRight("HrmKQGroup:Add", user)) {
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
|
||||
return retmap;
|
||||
}
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String groupId = Util.null2String(jsonObj.get("groupId"));//考勤组id
|
||||
String kqMonth = Util.null2String(jsonObj.get("kqMonth"));//年月
|
||||
String viewscope = Util.null2String(jsonObj.get("viewscope"));
|
||||
String startDate = DateUtil.getFirstDayOfMonth(kqMonth+"-01");
|
||||
String endDate = DateUtil.getLastDayOfMonth(kqMonth+"-01");
|
||||
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
KQGroupComInfo kqGroupComInfo = new KQGroupComInfo();
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = null;
|
||||
Map<String,Object> title = null;
|
||||
List<List<Object>> dataList = null;
|
||||
List<Object> data = null;
|
||||
List<Map<String,Object>> constraintList = null;
|
||||
Map<String,Object> constraint = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName(389516, user.getLanguage()));
|
||||
sheet.put("sheetTitle", Util.formatMultiLang(kqGroupComInfo.getGroupname(groupId), user.getLanguage() + "")+SystemEnv.getHtmlLabelName(389516, user.getLanguage()));
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
|
||||
//部门 工号 姓名
|
||||
titleList = new ArrayList<>();
|
||||
title = new HashMap<>();
|
||||
title.put("title",SystemEnv.getHtmlLabelName(124, user.getLanguage()));
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
|
||||
title = new HashMap<>();
|
||||
title.put("title",SystemEnv.getHtmlLabelName(714, user.getLanguage()));
|
||||
title.put("width",15*256);
|
||||
titleList.add(title);
|
||||
|
||||
title = new HashMap<>();
|
||||
title.put("title",SystemEnv.getHtmlLabelName(413, user.getLanguage()));
|
||||
title.put("width",15*256);
|
||||
titleList.add(title);
|
||||
|
||||
int firstRow = 6;
|
||||
int endRow = 0;
|
||||
int firstCol = 3;
|
||||
int endCol = 0;
|
||||
|
||||
for(String date=startDate; !isEnd;) {
|
||||
if (date.equals(endDate)) isEnd = true;
|
||||
title = new HashMap<>();
|
||||
title.put("title",date);
|
||||
title.put("width",16*256);
|
||||
titleList.add(title);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
endCol = titleList.size()+firstCol;
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
Map<String,Object> mapShiftSchedule = new HashMap<>();
|
||||
String tmpSerialids = "";
|
||||
sql = " select serialid, resourceid, kqdate from kq_shiftschedule where (isdelete is null or isdelete <> '1') and groupid=? ";
|
||||
rs.executeQuery(sql,groupId);
|
||||
while(rs.next()){
|
||||
mapShiftSchedule.put(rs.getString("kqdate")+"|"+rs.getString("resourceid"),rs.getString("serialid"));
|
||||
if((","+tmpSerialids+",").indexOf(","+rs.getString("serialid")+",")==-1 && rs.getInt("serialid")>0) {
|
||||
if (tmpSerialids.length() > 0) tmpSerialids += ",";
|
||||
tmpSerialids += rs.getString("serialid");
|
||||
}
|
||||
}
|
||||
List<Object> sheetMemo = new ArrayList<>();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
sheetMemo.add(SystemEnv.getHtmlLabelName(390620, user.getLanguage()));
|
||||
List<String> tmpserialids = Util.splitString2List( Util.null2String(kqGroupComInfo.getSerialids(groupId)),",");
|
||||
tmpSerialids = "" ;
|
||||
if(tmpSerialids != null){
|
||||
for(String ts : tmpserialids){
|
||||
if(tmpSerialids.length() > 0) tmpSerialids += "," ;
|
||||
tmpSerialids += ts ;
|
||||
}
|
||||
}
|
||||
sheetMemo.add( Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(tmpSerialids,user.getLanguage()), user.getLanguage()+"")+" "+SystemEnv.getHtmlLabelName(390605, user.getLanguage()));
|
||||
sheet.put("sheetMemo",sheetMemo);
|
||||
|
||||
|
||||
String sqlWhere = " ";
|
||||
|
||||
//考勤二开--权限处理
|
||||
sqlWhere += getViewDepts(user);
|
||||
bb.writeLog("schedule exportExcelCmd sqlWhere: " + sqlWhere);
|
||||
|
||||
if(viewscope.length()>0){
|
||||
if(viewscope.equals("1")){//分部
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
sqlWhere += " and t.subcompanyid1 in ("+subCompanyId+") ";
|
||||
}else if(viewscope.equals("2")){//部门
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
sqlWhere += " and t.departmentid in ("+departmentId+") ";
|
||||
}else if(viewscope.equals("3")){//人员
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
sqlWhere += " and t.resourceid in ("+resourceId+") ";
|
||||
}
|
||||
}
|
||||
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));// 是否显示无账号人员
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and status in(0,1,2,3) and loginid is not null "+(rs.getDBType().equals("oracle")?"":" and loginid<>'' ");
|
||||
}
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and t.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (t.status = 0 or t.status = 1 or t.status = 2 or t.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
if(!Util.null2String(kqGroupComInfo.getExcludecount(groupId)).equals("1")) {
|
||||
//剔除无需排班人员
|
||||
String excludeid = Util.null2String(kqGroupComInfo.getExcludeid(groupId));
|
||||
if (excludeid.length() > 0) {
|
||||
sqlWhere += " and t.resourceid not in (" + excludeid + ")";
|
||||
}
|
||||
}
|
||||
|
||||
dataList = new ArrayList<>();
|
||||
List<String> resList = new ArrayList<>();
|
||||
|
||||
sql = " select b.id, b.kqdate, b.serialid, t.resourceid, t.subcompanyid1, t.departmentid, t.loginid from (\n" +
|
||||
" SELECT distinct t.resourceid, t.groupid, t.status, t.dsporder,t.lastname,t.subcompanyid1, t.departmentid, t.loginid FROM ( \n" +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status,a.dsporder,a.lastname,a.subcompanyid1, a.departmentid, a.loginid FROM HrmResource a, kq_groupmember b \n" +
|
||||
" WHERE (a.id=b.typevalue and b.type =1) and (b.isdelete is null or b.isdelete <> '1') \n" +
|
||||
" UNION ALL \n" +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status,a.dsporder,a.lastname,a.subcompanyid1, a.departmentid, a.loginid FROM HrmResource a, kq_groupmember b \n" +
|
||||
" WHERE (a.subcompanyid1 = b.typevalue AND a.seclevel>=b.seclevel AND a.seclevel<=b.seclevelto AND b.type=2) and (b.isdelete is null or b.isdelete <> '1') \n" +
|
||||
" UNION ALL \n" +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status,a.dsporder,a.lastname,a.subcompanyid1, a.departmentid, a.loginid FROM HrmResource a, kq_groupmember b \n" +
|
||||
" WHERE (a.departmentid = b.typevalue AND a.seclevel>=b.seclevel AND a.seclevel<=b.seclevelto AND b.type=3) and (b.isdelete is null or b.isdelete <> '1') \n" +
|
||||
" UNION ALL \n" +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status,a.dsporder,a.lastname,a.subcompanyid1, a.departmentid, a.loginid FROM HrmResource a, kq_groupmember b \n" +
|
||||
" WHERE (a.jobtitle = b.typevalue AND b.type=5 and (b.isdelete is null or b.isdelete <> '1') AND (b.jobtitlelevel=1 OR (b.jobtitlelevel=2 AND a.subcompanyid1 IN(b.jobtitlelevelvalue)) OR (b.jobtitlelevel=3 AND a.departmentid IN(b.jobtitlelevelvalue)))) \n" +
|
||||
" UNION ALL \n" +
|
||||
" SELECT a.id AS resourceid, b.groupid, a.status,a.dsporder,a.lastname,a.subcompanyid1, a.departmentid, a.loginid FROM HrmResource a, kq_groupmember b \n" +
|
||||
" WHERE b.type=6 AND a.seclevel>=b.seclevel AND a.seclevel<=b.seclevelto and (b.isdelete is null or b.isdelete <> '1'))t) t left join kq_shiftschedule b on t.resourceid=b.resourceid " +
|
||||
" and t.groupid=b.groupid and (b.isdelete is null or b.isdelete <> '1') and b.kqdate>=? and b.kqdate<=? where t.groupid=? \n " +
|
||||
sqlWhere +
|
||||
" order by t.dsporder,t.lastname";
|
||||
new KQLog().info("ExportExcelCmd:"+sql);
|
||||
bb.writeLog("schedule ExportExcelCmd sql: " + sql);
|
||||
rs.executeQuery(sql,startDate,startDate,groupId);
|
||||
while(rs.next()){
|
||||
data = new ArrayList<>();
|
||||
String resourceid = rs.getString("resourceid");
|
||||
if(resList.contains(resourceid)){
|
||||
continue;
|
||||
}
|
||||
resList.add(resourceid);
|
||||
data.add(Util.formatMultiLang(departmentComInfo.getDepartmentName(resourceComInfo.getDepartmentID(resourceid)),""+user.getLanguage()));
|
||||
data.add(Util.formatMultiLang(resourceComInfo.getWorkcode(resourceid),""+user.getLanguage()));
|
||||
data.add(Util.formatMultiLang(resourceComInfo.getLastname(resourceid),""+user.getLanguage()));
|
||||
isEnd = false;
|
||||
for(String date=startDate; !isEnd;) {
|
||||
if (date.equals(endDate)) isEnd = true;
|
||||
String serialId = Util.null2String(mapShiftSchedule.get(date+"|"+resourceid));
|
||||
String serialName = "";
|
||||
if(serialId.equals("-1")){
|
||||
serialName = SystemEnv.getHtmlLabelName(26593, user.getLanguage());
|
||||
}else{
|
||||
serialName = Util.formatMultiLang(kqShiftManagementComInfo.getSerial(serialId),""+user.getLanguage());
|
||||
}
|
||||
data.add(serialName);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
dataList.add(data);
|
||||
}
|
||||
endRow = dataList.size()+firstRow;
|
||||
sheet.put("dataList", dataList);
|
||||
|
||||
//增加数据有效性校验
|
||||
constraintList = new ArrayList<>();
|
||||
constraint = new HashMap<>();
|
||||
constraint.put("firstRow",firstRow);
|
||||
constraint.put("endRow",endRow);
|
||||
constraint.put("firstCol",firstCol);
|
||||
constraint.put("endCol",endCol);
|
||||
List<String> serialids = Util.splitString2List( Util.null2String(kqGroupComInfo.getSerialids(groupId)),",");
|
||||
serialids.add("-1");
|
||||
String[] serialnames = new String[serialids.size()];
|
||||
for(int i=0;i<serialids.size();i++){
|
||||
if(serialids.get(i).equals("-1")){
|
||||
serialnames[i] = SystemEnv.getHtmlLabelName(26593, user.getLanguage());
|
||||
}else{
|
||||
serialnames[i] = Util.formatMultiLang(kqShiftManagementComInfo.getSerial(serialids.get(i)),""+user.getLanguage());
|
||||
}
|
||||
}
|
||||
constraint.put("constraintDatas", serialnames);
|
||||
constraintList.add(constraint);
|
||||
|
||||
sheet.put("constraintList",constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = "";//SystemEnv.getHtmlLabelName(389978, user.getLanguage()).replace("$groupName$",kqGroupComInfo.getGroupname(groupId));
|
||||
fileName = fileName.replace("$date$",startDate.replace("-","")+"-"+endDate.replace("-",""));
|
||||
workbook.put("fileName", fileName);
|
||||
ExcelUtil ExcelUtil = new ExcelUtil();
|
||||
Map<String, Object> exportMap = ExcelUtil.export(workbook, request, response);
|
||||
retmap.putAll(exportMap);
|
||||
retmap.put("status", "1");
|
||||
} catch (Exception e) {
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", SystemEnv.getHtmlLabelName(382661, user.getLanguage()));
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*考勤二开--权限处理start*/
|
||||
private String getViewDepts(User user) {
|
||||
String result = " and 1=1 ";
|
||||
|
||||
try {
|
||||
int userId = user.getUID();
|
||||
if (userId == 1 ) {
|
||||
return result;
|
||||
} else {
|
||||
List<String> temp = new ArrayList<>();
|
||||
String acqDeptsSql = "select department from uf_scheauthority where resourceid = ? ";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery(acqDeptsSql, userId);
|
||||
while (rs.next()) {
|
||||
String department = Util.null2String(rs.getString("department"));
|
||||
if (StringUtils.isNotBlank(department)) {
|
||||
temp.add(department);
|
||||
}
|
||||
}
|
||||
if (temp != null & temp.size() > 0) {
|
||||
String sqlWhere = queryDepartmentSubordinate(temp);
|
||||
result += " and departmentid in (" + sqlWhere + ")";
|
||||
}
|
||||
}
|
||||
|
||||
}catch (Exception e) {
|
||||
bb.writeLog("getViewDepts exception: " +e);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public String queryDepartmentSubordinate(List<String> deptids){
|
||||
|
||||
bb.writeLog("queryDepartmentSubordinate start");
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
List<String> list = new ArrayList<String>();
|
||||
if(deptids != null && deptids.size() > 0) {
|
||||
String sql = " select * from hrmdepartment where id in ("+ String.join(",", deptids) +")";
|
||||
bb.writeLog("sql: " + sql);
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
list.add(id);
|
||||
bb.writeLog("id: " + id);
|
||||
bb.writeLog("list: " + list);
|
||||
addChildDept(list,id);
|
||||
}
|
||||
}
|
||||
bb.writeLog("-=-=-list: " + list);
|
||||
if(list !=null && list.size()> 0){
|
||||
String sqlWhere = String.join(",", list);
|
||||
return sqlWhere;
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void addChildDept(List<String> datasList, String parentid){
|
||||
bb.writeLog("addChildDept start");
|
||||
String sql = " select id from hrmdepartment where supdepid="+parentid;
|
||||
bb.writeLog("sql: " + sql);
|
||||
List<Map<String,Object>> dataList = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
while(rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
bb.writeLog("id: " + id);
|
||||
|
||||
if(!datasList.contains(id)){
|
||||
datasList.add(id);
|
||||
}
|
||||
bb.writeLog("datasList: " + datasList);
|
||||
|
||||
addChildDept(datasList,id);
|
||||
}
|
||||
}
|
||||
|
||||
/*考勤二开--权限处理end*/
|
||||
|
||||
}
|
Loading…
Reference in New Issue