历史二开项目代码(svn上已备案源码)
This commit is contained in:
commit
cb71f0c22d
|
|
@ -0,0 +1 @@
|
|||
12
|
||||
|
|
@ -0,0 +1 @@
|
|||
12
|
||||
|
|
@ -0,0 +1,241 @@
|
|||
package com.engine.gainway.service.impl;
|
||||
|
||||
import com.api.hrm.util.HrmReportDetachUtil;
|
||||
import com.cloudstore.eccom.pc.table.WeaTable;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.gainway.entity.EducationLevelPo;
|
||||
import com.engine.gainway.entity.ProvinceNamePo;
|
||||
import com.engine.gainway.service.BasicResourceTableService;
|
||||
import com.engine.gainway.util.BasicResourceUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.PageIdConst;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.appdetach.AppDetachComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/12/11 2:27 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class BasicResourceTableServiceImpl extends Service implements BasicResourceTableService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> linkTable(Map<String, Object> params) {
|
||||
Map<String, Object> resultMap = new HashMap<>(4);
|
||||
BaseBean bb = new BaseBean();
|
||||
|
||||
String cmd = Util.null2String(params.get("cmd"));
|
||||
String name = Util.null2String(params.get("name"));
|
||||
String dateselect = Util.null2String(params.get("dateselect"));
|
||||
String fromdate = Util.null2String(params.get("fromdate"));
|
||||
String enddate = Util.null2String(params.get("enddate"));
|
||||
String department =Util.null2String(params.get("departmentid"));
|
||||
String subcompany =Util.null2String(params.get("subcompanyid"));
|
||||
String location =Util.null2String(params.get("location"));
|
||||
String status =Util.null2String(params.get("workstatus"));
|
||||
String agearea =Util.null2String(params.get("agearea"));
|
||||
HrmReportDetachUtil hrmReportDetachUtil = new HrmReportDetachUtil();
|
||||
String startdateselect =Util.fromScreen(dateselect,user.getLanguage());
|
||||
if(!"".equals(startdateselect) && !"0".equals(startdateselect) && !"6".equals(startdateselect)){
|
||||
fromdate = TimeUtil.getDateByOption(startdateselect,"0");
|
||||
enddate = TimeUtil.getDateByOption(startdateselect,"1");
|
||||
}
|
||||
|
||||
String field1 = bb.getPropValue("gwsecond", "deptOne");
|
||||
String field2 = bb.getPropValue("gwsecond", "deptTwo");
|
||||
String field3 = bb.getPropValue("gwsecond", "deptThree");
|
||||
String field4 = bb.getPropValue("gwsecond", "deptFour");
|
||||
String scopeId = bb.getPropValue("gwsecond", "scopeId");
|
||||
String nativeplace = bb.getPropValue("gwsecond", "nativeplace");
|
||||
|
||||
|
||||
WeaTable table = new WeaTable();
|
||||
String pageId = "7036b679-029d-411f-b885-8e1720514f83";
|
||||
table.setPageID(pageId);
|
||||
table.setPageUID(String.format("%s_%s",pageId,user.getUID()));
|
||||
String pageSize = PageIdConst.getPageSize(pageId, user.getUID());
|
||||
table.setPagesize(pageSize);
|
||||
|
||||
String fields = "a.subcompanyid1,b."+field1+",b."+field2+",b."+field3+",b."+field4+",c."+nativeplace+",a.workcode,a.lastname,a.jobtitle,\n" +
|
||||
" a.companystartdate,a.sex,a.birthday,a.birthday as age,a.educationlevel,a.companystartdate as companyworkyear";
|
||||
table.setBackfields(fields);
|
||||
String fromSql = "from hrmresource a left join cus_fielddata b on a.id = b.id and b.scope = 'HrmCustomFieldByInfoType' " +
|
||||
" and b.scopeid = "+scopeId+" left join cus_fielddata c on a.id = c.id and c.scope = 'HrmCustomFieldByInfoType' and c.scopeid = 1";
|
||||
table.setSqlform(fromSql);
|
||||
|
||||
String sqlWhere = "where (accounttype is null or accounttype = 0) ";
|
||||
//查询条件筛选
|
||||
if (!"".equals(fromdate) && !"0".equals(fromdate)) {
|
||||
sqlWhere += " and a.companystartdate>= '"+fromdate+"'";
|
||||
}
|
||||
|
||||
if(!"".equals(enddate) && !"0".equals(enddate)) {
|
||||
sqlWhere += " and (a.companystartdate<='"+enddate+"' or a.companystartdate is null)";
|
||||
}
|
||||
|
||||
if(!"".equals(location) && !"0".equals(location)){
|
||||
sqlWhere += " and a.locationid ="+location;
|
||||
}
|
||||
|
||||
if(!"".equals(department) && !"0".equals(department)){
|
||||
sqlWhere += " and a.departmentid in ("+department+") ";
|
||||
}
|
||||
|
||||
if(!"".equals(subcompany) && !"0".equals(subcompany)){
|
||||
sqlWhere += " and a.subcompanyid1 in ("+subcompany+") ";
|
||||
}
|
||||
|
||||
if(!("".equals(status) || "9".equals(status))){
|
||||
if("8".equals(status)){
|
||||
sqlWhere += " and a.status <= 3";
|
||||
}else{
|
||||
sqlWhere += " and a.status ="+status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String innerResourceSql = AppDetachComInfo.getInnerResourceSql();
|
||||
innerResourceSql = innerResourceSql.replace("hrmresource", "a");
|
||||
//只查询行政纬度人员
|
||||
sqlWhere += " and "+innerResourceSql;
|
||||
|
||||
//按照pie图点击查询
|
||||
String s = buildSqlwhere(cmd, name);
|
||||
sqlWhere = sqlWhere+s;
|
||||
|
||||
// todo 分权不做 该项目未开启分权
|
||||
String detachSqlWhere = hrmReportDetachUtil.getDetachSqlWhere(user.getUID(), "hrmresource");
|
||||
|
||||
table.setSqlwhere(sqlWhere);
|
||||
table.setSqlprimarykey("a.id");
|
||||
table.getColumns().add(new WeaTableColumn("10%", "分部", "subcompanyid1").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectSubCompanyName"));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "一级部门", field1));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "二级部门", field2));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "三级部门", field3));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "四级部门", field4));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "编号", "workcode"));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "姓名", "lastname"));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "岗位", "jobtitle").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectJobName"));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "入职日期", "companystartDate"));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "性别", "sex").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectSexName"));
|
||||
if ("AgeRp".equals(cmd)) {
|
||||
table.getColumns().add(new WeaTableColumn("10%", "出生日期", "birthday"));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "年龄", "age").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectAge"));
|
||||
}
|
||||
|
||||
if ("EduRp".equals(cmd)) {
|
||||
table.getColumns().add(new WeaTableColumn("10%", "学历", "educationlevel").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectEducation"));
|
||||
}
|
||||
|
||||
if ("SeniorityRp".equals(cmd)) {
|
||||
table.getColumns().add(new WeaTableColumn("10%", "司龄", "companyworkyear").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectCompanyYear"));
|
||||
}
|
||||
|
||||
if ("JobCallRp".equals(cmd)) {
|
||||
table.getColumns().add(new WeaTableColumn("10%", "籍贯(省)", nativeplace).setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectNativeplace").setOtherpara(String.valueOf(user.getUID())));
|
||||
}
|
||||
|
||||
table.setTableType(WeaTableType.NONE);
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
resultMap.putAll(result.getResultMap());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
private String buildSqlwhere(String cmd,String name) {
|
||||
String nativeplace = new BaseBean().getPropValue("gwsecond", "nativeplace");
|
||||
String sql = "";
|
||||
if ("AgeRp".equals(cmd)) {
|
||||
if (SystemEnv.getHtmlLabelName(15863,user.getLanguage()).equals(name)) {
|
||||
sql += " and (a.birthday is null or a.birthday ='')";
|
||||
}else {
|
||||
Map<String,String> map = BasicResourceUtil.selectRangeSet(name);
|
||||
String fromDate = map.get("fromDate");
|
||||
String toDate = map.get("toDate");
|
||||
sql += " and a.birthday >'"+fromDate+"' and a.birthday <='"+toDate+"' and a.birthday is not null";
|
||||
}
|
||||
}else if("SexRp".equals(cmd)) {
|
||||
if (SystemEnv.getHtmlLabelName(15808,user.getLanguage()).equals(name)) {
|
||||
sql += " and (a.sex is null or a.sex ='')";
|
||||
}else if (SystemEnv.getHtmlLabelName(28473,user.getLanguage()).equals(name)){
|
||||
sql += " and a.sex = 0";
|
||||
}else {
|
||||
sql += " and a.sex = 1";
|
||||
}
|
||||
}else if ("SeniorityRp".equals(cmd)) {
|
||||
if (SystemEnv.getHtmlLabelName(15863,user.getLanguage()).equals(name)) {
|
||||
sql += " and (a.companystartdate is null or a.companystartdate ='')";
|
||||
}else {
|
||||
Map<String,String> map = BasicResourceUtil.companyYearRangeSet(name);
|
||||
String fromDate = map.get("fromDate");
|
||||
String toDate = map.get("toDate");
|
||||
sql += " and a.companystartdate >'"+fromDate+"' and a.companystartdate <='"+toDate+"' and a.companystartdate is not null";
|
||||
}
|
||||
|
||||
} else if ("EduRp".equals(cmd)) {
|
||||
if (SystemEnv.getHtmlLabelName(21381,user.getLanguage()).equals(name)) {
|
||||
sql += " and (a.educationlevel is null or a.educationlevel < 2)";
|
||||
}else {
|
||||
List<EducationLevelPo> educationLevel = new ArrayList<>();
|
||||
//获取学历数据
|
||||
getEduLevel(educationLevel);
|
||||
Integer levelId = educationLevel.stream()
|
||||
.filter(edu -> name.equals(edu.getLevelName()))
|
||||
.map(EducationLevelPo::getId)
|
||||
.findFirst()
|
||||
.orElse(-1);
|
||||
sql += " and a.educationlevel = "+levelId;
|
||||
}
|
||||
}else if("JobCallRp".equals(cmd)) {
|
||||
if (SystemEnv.getHtmlLabelName(15863,user.getLanguage()).equals(name)) {
|
||||
sql += " and (c."+nativeplace+" is null or c."+nativeplace+" ='')";
|
||||
} else {
|
||||
List<ProvinceNamePo> provinceNames = new ArrayList<>();
|
||||
getNativeplace(provinceNames);
|
||||
Integer provinceId = provinceNames.stream()
|
||||
.filter(edu -> name.equals(edu.getProvinceName()))
|
||||
.map(ProvinceNamePo::getId)
|
||||
.findFirst()
|
||||
.orElse(-1);
|
||||
sql += " and c."+nativeplace+"= "+provinceId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
||||
private void getEduLevel(List<EducationLevelPo> educationLevel) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id,name from hrmeducationlevel");
|
||||
while (rs.next()) {
|
||||
Integer id = Util.getIntValue(rs.getString("id"));
|
||||
String name = Util.formatMultiLang(Util.null2String(rs.getString("name")),String.valueOf(user.getLanguage()));
|
||||
educationLevel.add(EducationLevelPo.builder().id(id).levelName(name).build());
|
||||
}
|
||||
}
|
||||
|
||||
private void getNativeplace(List<ProvinceNamePo> provinceNames) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id,provincename from hrmprovince");
|
||||
while (rs.next()) {
|
||||
Integer id = Util.getIntValue(rs.getString("id"));
|
||||
String name = Util.formatMultiLang(Util.null2String(rs.getString("provincename")),String.valueOf(user.getLanguage()));
|
||||
provinceNames.add(ProvinceNamePo.builder().id(id).provinceName(name).build());
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,744 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportDailyExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")),",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.add("kqdate");
|
||||
showColumns.add("serialid");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("signin1")){
|
||||
cascadekey = "signout1";
|
||||
}else if(showColumn.equals("signin2")){
|
||||
cascadekey = "signout2";
|
||||
}else if(showColumn.equals("signin3")){
|
||||
cascadekey = "signout3";
|
||||
}else if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
toDate = today;
|
||||
}
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String,Object>> constraintList = null;
|
||||
Map<String,Object> constraint = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
if("kqdate".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width",30*256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan",childColumns.size());
|
||||
}else{
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "2");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
String backFields = " b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb," +
|
||||
"(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb,(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb," +
|
||||
"(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs,(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts," +
|
||||
"(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts,(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts," +
|
||||
"(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts,(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"(select sum(sch) from uf_jbsqhz where sqr = a.id and ksrq = b.kqdate and jblx in (1,2)) as jbsq,a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins,b.beLate," +
|
||||
" b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins,b.graveLeaveEarly," +
|
||||
" b.graveLeaveEarlyMins,b.absenteeism,b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
//考勤异常状态
|
||||
String KQstatus = Util.null2String(jsonObj.get("KQstatus"));
|
||||
if ("5".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0 or b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0 or absenteeismMins > 0 or forgotCheck > 0)";
|
||||
}else if ("1".equals(KQstatus)){
|
||||
sqlWhere += " and absenteeismMins > 0 ";
|
||||
}else if ("2".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0) ";
|
||||
}else if ("3".equals(KQstatus)){
|
||||
sqlWhere += " and (b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0) ";
|
||||
}else if ("4".equals(KQstatus)){
|
||||
sqlWhere +=" and forgotCheck > 0";
|
||||
}
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc , b.kqDate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select "+backFields + sqlFrom + sqlWhere+orderBy;
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
|
||||
new BaseBean().writeLog("每日导出:" + JSON.toJSONString(sql));
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
String tmpkey = id+"|"+kqdate+"|";
|
||||
// Map<String,Object> signDetailInfo = this.getSignDetailInfo(id,kqdate);
|
||||
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if(fieldName.equals("cardOvertime")){
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + Math.round(Util.getDoubleValue(fieldValue) / 60.0 * 2) / 2.0));
|
||||
} else if(fieldName.equals("xqNew")){
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
} else if(fieldName.equals("serialid")){
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
if(serialid.length()>0){
|
||||
// fieldValue = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(serialid)){
|
||||
fieldValue = serialdata.get(serialid);
|
||||
}else{
|
||||
String tmpserialname = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
fieldValue = tmpserialname;
|
||||
serialdata.put(serialid,tmpserialname);
|
||||
}
|
||||
}
|
||||
} else if(fieldName.equals("signin1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("leave")){
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
fieldValue = Util.null2String(flowData.get(id+"|"+kqdate+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(fieldValue);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
writeLog("ExportDailyExcelCmd:fieldValue" + fieldValue + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(fieldValue, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
fieldValue = flowLeaveData;
|
||||
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else if(fieldName.equals("kqdate")){
|
||||
fieldValue=kqdate+" "+com.engine.portal.util.DateUtil.getDayWeekOfDate1(DateUtil.parseToDate(kqdate));
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
|
||||
if(!fieldName.equals("leave") && !fieldName.equals("kqdate")) {
|
||||
fieldValue = Util.formatMultiLang(fieldValue, "" + user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList",constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390352, user.getLanguage())+" "+fromDate+" "+toDate;;
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
title = new HashMap<>();
|
||||
title.put("title",name+"("+
|
||||
((KQUnitBiz.isLeaveHour(unitType))?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()))+")");
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title",SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+
|
||||
(KQReportBiz.getUnitType(kqReportFieldComInfo, user).length()>0?"("+ KQReportBiz.getUnitType(kqReportFieldComInfo, user)+")":""));
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
int workMins = rs.getInt("workMins");
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(serialid.length()>0){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.engine.gainway.transmethod;
|
||||
|
||||
import com.engine.gainway.util.BasicResourceUtil;
|
||||
import com.engine.hrm.biz.HrmFieldManager;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.EducationLevelComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/12/12 9:33 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class BasicResourceTrans {
|
||||
|
||||
public static String selectSubCompanyName(String subcompanyid) {
|
||||
SubCompanyComInfo sub = new SubCompanyComInfo();
|
||||
return sub.getSubCompanyname(subcompanyid);
|
||||
}
|
||||
|
||||
public static String selectJobName(String jobId) {
|
||||
JobTitlesComInfo jc = new JobTitlesComInfo();
|
||||
return jc.getJobTitlesname(jobId);
|
||||
}
|
||||
|
||||
public static String selectSexName(String sex) {
|
||||
if (StringUtils.isEmpty(sex)) {
|
||||
return "未设置";
|
||||
}else {
|
||||
return "0".equals(sex) ? "男" : "女";
|
||||
}
|
||||
}
|
||||
|
||||
public static String selectAge(String birthday) {
|
||||
String age = "";
|
||||
if (StringUtils.isNotEmpty(birthday)) {
|
||||
age = String.valueOf(BasicResourceUtil.calculateAge(birthday));
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
public static String selectEducation(String educationlevel) {
|
||||
EducationLevelComInfo edu = new EducationLevelComInfo();
|
||||
String eduName = edu.getEducationLevelname(educationlevel);
|
||||
if (StringUtils.isEmpty(eduName)) {
|
||||
eduName = "空";
|
||||
}
|
||||
return eduName;
|
||||
}
|
||||
|
||||
public static String selectCompanyYear(String companydate) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int currentYear = calendar.get(Calendar.YEAR);
|
||||
String yearDifference = "";
|
||||
if (StringUtils.isNotEmpty(companydate)) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate date = LocalDate.parse(companydate, formatter);
|
||||
int dateYear = date.getYear();
|
||||
yearDifference = String.valueOf(currentYear - dateYear);
|
||||
}
|
||||
return yearDifference;
|
||||
}
|
||||
|
||||
|
||||
public static String selectNativeplace(String nativeplace,String userId) {
|
||||
HrmFieldManager hrmFieldManager = new HrmFieldManager();
|
||||
String title = "";
|
||||
User user = new User();
|
||||
try {
|
||||
user.setUid(Integer.parseInt(userId));
|
||||
title = hrmFieldManager.getFieldvalue(user, null, 0, 3, 2222, nativeplace, 0);
|
||||
title = Util.formatMultiLang(title, Util.null2String(user.getLanguage()));
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,215 @@
|
|||
package com.engine.jgkq.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.jgkq.service.JgkqService;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.EncodingUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.constant.DBConstant;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 京贵投资考勤二开接口
|
||||
* Created by dengjp on 2024/4/11.
|
||||
*/
|
||||
public class JgkqServiceImpl extends Service implements JgkqService {
|
||||
|
||||
/**
|
||||
* 招聘进度表数据拼接
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> recruitmentProgress(Map<String, Object> params, User user) {
|
||||
Map<String,Object> resutl = new HashMap<String,Object>();
|
||||
List<Map<String,Object>> backList = new ArrayList<>();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("recruitmentProgress ==>");
|
||||
RecordSet rs = new RecordSet();
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
String curDate = localDateTime.format(dateFormatter);
|
||||
String deptid = null;
|
||||
String testDate1 = null;
|
||||
String testDate2 = null;
|
||||
String userId = null;
|
||||
|
||||
try {
|
||||
String deptidP = Util.null2String(params.get("deptid"));
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
String toDate = Util.null2String(params.get("toDate"));
|
||||
userId = String.valueOf(user.getUID());
|
||||
bb.writeLog("userId:"+userId);
|
||||
if(StringUtils.isNotBlank(deptidP)){
|
||||
deptid = deptidP;
|
||||
}
|
||||
if(StringUtils.isNotBlank(fromDate)){
|
||||
testDate1 = fromDate;
|
||||
}
|
||||
if(StringUtils.isNotBlank(toDate)){
|
||||
testDate2 = toDate;
|
||||
}
|
||||
|
||||
char separator = Util.getSeparator();
|
||||
String para = deptid + separator + testDate1 + separator +
|
||||
testDate2 + separator + userId;
|
||||
rs.executeProc2("hrmzpjdb", para,null);
|
||||
while (rs.next()) {
|
||||
Map<String,Object> objZp = new HashMap<>();
|
||||
String xh = rs.getString("xh");
|
||||
String bm = rs.getString("bm");
|
||||
String gwmc = rs.getString("gwmc");
|
||||
String jjcd = rs.getString("jjcd");
|
||||
String zt = rs.getString("zt");
|
||||
String zpyy = rs.getString("zpyy");
|
||||
String sqsj = rs.getString("sqsj");
|
||||
String qwdgsj = rs.getString("qwdgsj");
|
||||
String zprs = rs.getString("zprs");
|
||||
String wcsl = rs.getString("wcsl");
|
||||
String wcl = rs.getString("wcl");
|
||||
String jltj = rs.getString("jltj");
|
||||
String msrs = rs.getString("msrs");
|
||||
String mstg = rs.getString("mstg");
|
||||
String offers = rs.getString("offers");
|
||||
String offerdc = rs.getString("offerdc");
|
||||
String rzrs = rs.getString("rzrs");
|
||||
objZp.put("xh",xh);
|
||||
objZp.put("bm",bm);
|
||||
objZp.put("gwmc",gwmc);
|
||||
objZp.put("jjcd",jjcd);
|
||||
objZp.put("zt",zt);
|
||||
objZp.put("zpyy",zpyy);
|
||||
objZp.put("sqsj",sqsj);
|
||||
objZp.put("qwdgsj",qwdgsj);
|
||||
objZp.put("zprs",zprs);
|
||||
objZp.put("wcsl",wcsl);
|
||||
objZp.put("wcl",wcl);
|
||||
objZp.put("jltj",jltj);
|
||||
objZp.put("msrs",msrs);
|
||||
objZp.put("mstg",mstg);
|
||||
objZp.put("offers",offers);
|
||||
objZp.put("offerdc",offerdc);
|
||||
objZp.put("rzrs",rzrs);
|
||||
backList.add(objZp);
|
||||
}
|
||||
|
||||
resutl.put("code","200");
|
||||
resutl.put("msg","招聘进度表数据获取成功");
|
||||
resutl.put("backList",backList);
|
||||
}catch (Exception e) {
|
||||
bb.writeLog("recruitmentProgress Exception: "+e);
|
||||
resutl.put("code","500");
|
||||
resutl.put("msg","接口异常");
|
||||
return resutl;
|
||||
}
|
||||
return resutl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 面试人员记录表数据拼接
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> interviewRecord(Map<String, Object> params, User user) {
|
||||
Map<String,Object> resutl = new HashMap<String,Object>();
|
||||
List<Map<String,Object>> backList = new ArrayList<>();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("interviewRecord ==>");
|
||||
RecordSet rs = new RecordSet();
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
String curDate = localDateTime.format(dateFormatter);
|
||||
String deptid = null;
|
||||
String testDate1 = null;
|
||||
String testDate2 = null;
|
||||
String userId = null;
|
||||
|
||||
try {
|
||||
String deptidP = Util.null2String(params.get("deptid"));
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
String toDate = Util.null2String(params.get("toDate"));
|
||||
userId = String.valueOf(user.getUID());
|
||||
bb.writeLog("userId:"+userId);
|
||||
if(StringUtils.isNotBlank(deptidP)){
|
||||
deptid = deptidP;
|
||||
}
|
||||
if(StringUtils.isNotBlank(fromDate)){
|
||||
testDate1 = fromDate;
|
||||
}
|
||||
if(StringUtils.isNotBlank(toDate)){
|
||||
testDate2 = toDate;
|
||||
}
|
||||
|
||||
char separator = Util.getSeparator();
|
||||
String para = deptid + separator + testDate1 + separator +
|
||||
testDate2 + separator + userId;
|
||||
rs.executeProc2("msryjlb", para,null);
|
||||
while (rs.next()) {
|
||||
Map<String,Object> objZp = new HashMap<>();
|
||||
String xh = rs.getString("xh");
|
||||
String xm = rs.getString("xm");
|
||||
String lxfs = rs.getString("lxfs");
|
||||
String ypbm = rs.getString("ypbm");
|
||||
String xxnr = rs.getString("xxnr");
|
||||
String zpgw = rs.getString("zpgw");
|
||||
String lb = rs.getString("lb");
|
||||
String bsrq = rs.getString("bsrq");
|
||||
String bsjg = rs.getString("bsjg");
|
||||
String csmsg = rs.getString("csmsg");
|
||||
String csrq = rs.getString("csrq");
|
||||
String csjg = rs.getString("csjg");
|
||||
String fsmsg = rs.getString("fsmsg");
|
||||
String fsrq = rs.getString("fsrq");
|
||||
String fsjg = rs.getString("fsjg");
|
||||
String zsmsg = rs.getString("zsmsg");
|
||||
String zsrq = rs.getString("zsrq");
|
||||
String zsjg = rs.getString("zsjg");
|
||||
String offwdcyc = rs.getString("offwdcyc");
|
||||
objZp.put("xh",xh);
|
||||
objZp.put("xm",xm);
|
||||
objZp.put("lxfs",lxfs);
|
||||
objZp.put("ypbm",ypbm);
|
||||
objZp.put("xxnr",xxnr);
|
||||
objZp.put("zpgw",zpgw);
|
||||
objZp.put("lb",lb);
|
||||
objZp.put("bsrq",bsrq);
|
||||
objZp.put("bsjg",bsjg);
|
||||
objZp.put("csmsg",csmsg);
|
||||
objZp.put("csrq",csrq);
|
||||
objZp.put("csjg",csjg);
|
||||
objZp.put("fsmsg",fsmsg);
|
||||
objZp.put("fsrq",fsrq);
|
||||
objZp.put("fsjg",fsjg);
|
||||
objZp.put("zsmsg",zsmsg);
|
||||
objZp.put("zsrq",zsrq);
|
||||
objZp.put("zsjg",zsjg);
|
||||
objZp.put("offwdcyc",offwdcyc);
|
||||
backList.add(objZp);
|
||||
}
|
||||
|
||||
resutl.put("code","200");
|
||||
resutl.put("msg","面试人员记录表数据获取成功");
|
||||
resutl.put("backList",backList);
|
||||
}catch (Exception e) {
|
||||
bb.writeLog("interviewRecord Exception: "+e);
|
||||
resutl.put("code","500");
|
||||
resutl.put("msg","接口异常");
|
||||
return resutl;
|
||||
}
|
||||
return resutl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,125 @@
|
|||
package com.api.hrm.web;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.api.hrm.service.HrmBaseStateRpService;
|
||||
import com.api.hrm.service.HrmDepartmentRpService;
|
||||
import com.api.hrm.service.HrmJobRpService;
|
||||
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 人力资源人员状况报表action
|
||||
*/
|
||||
@Path("/hrm/resourceState")
|
||||
public class HrmStateReportAction extends BaseBean {
|
||||
/**
|
||||
* 查询条件
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getSearchCondition")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String getAdvanceSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> data = null;
|
||||
String cmd = Util.null2String(request.getParameter("cmd"));
|
||||
if (cmd.equals("baseStatus")) {
|
||||
data = new com.api.hrm.service.HrmBaseStateRpService().getSearchCondition(request, response);
|
||||
}
|
||||
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询结果
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/getSearchResult")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> data = null;
|
||||
String cmd = Util.null2String(request.getParameter("cmd"));
|
||||
if (cmd.equals("DepartmentRp")) { //部门top
|
||||
data = new com.api.hrm.service.HrmDepartmentRpService().getDepartmentRpResult(request, response);
|
||||
} else if (cmd.equals("DepartmentRpAll")) { //部门All
|
||||
data = new com.api.hrm.service.HrmDepartmentRpService().getSearchResultList(request, response);
|
||||
} else if (cmd.equals("JobRp")) { //岗位top
|
||||
data = new com.api.hrm.service.HrmJobRpService().getJobRpResult(request, response);
|
||||
} else if (cmd.equals("JobRpAll")) { //岗位All
|
||||
data = new com.api.hrm.service.HrmJobRpService().getSearchResultList(request, response);
|
||||
} else if (cmd.equals("JobActivityAndGroupRp")) { //职务和职务类别
|
||||
data = new com.api.hrm.service.HrmBaseStateRpService().getJobActivityAndGroupRp(request, response);
|
||||
} else if (cmd.equals("JobActivityRpDetail")) { //职务更多
|
||||
data = new com.api.hrm.service.HrmBaseStateRpService().getJobActivityDetail(request, response);
|
||||
} else if (cmd.equals("JobGroupRpDetail")) { //职务类别更多
|
||||
data = new com.api.hrm.service.HrmBaseStateRpService().getJobGroupDetail(request, response);
|
||||
} else { //人员状态相关
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Boolean hasRight= HrmUserVarify.checkUserRight("HrmResourceEdit:Edit", user);
|
||||
writeLog("HrmBaseStateUtil="+hasRight);
|
||||
if (!hasRight) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
|
||||
return JSONObject.toJSONString(retmap);
|
||||
}
|
||||
data = new com.api.hrm.service.HrmBaseStateRpService().getRpResult(request, response);
|
||||
}
|
||||
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Eexcel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
|
||||
@GET
|
||||
@Path("/downloadExcel")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public String getExcelFile(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
String cmd = Util.null2String(request.getParameter("cmd"));
|
||||
if (cmd.equals("DepartmentRp")) { //部门人数Excel
|
||||
new HrmDepartmentRpService().getDepartmentExcel(request, response);
|
||||
} else if (cmd.equals("JobRp")) { //岗位人数Excel
|
||||
new HrmJobRpService().getJobExcel(request, response);
|
||||
} else if (cmd.equals("JobActivityRp")) { //职务人数Excel
|
||||
new HrmBaseStateRpService().getJobActivityExcel(request, response);
|
||||
} else if (cmd.equals("JobGroupRp")) { //职务类别人数Excel
|
||||
new HrmBaseStateRpService().getJobGroupExcel(request, response);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
package weaver.interfaces.jgkq.action;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kq.biz.KQHolidaySetBiz;
|
||||
import com.engine.kq.biz.KQWorkTime;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class AutoScheduMonthJob extends BaseCronJob {
|
||||
|
||||
private String fromDate;
|
||||
private String toDate;
|
||||
|
||||
public String getFromDate() {
|
||||
return fromDate;
|
||||
}
|
||||
|
||||
public String getToDate() {
|
||||
return toDate;
|
||||
}
|
||||
|
||||
public void setFromDate(String fromDate) {
|
||||
this.fromDate = fromDate;
|
||||
}
|
||||
|
||||
public void setToDate(String toDate) {
|
||||
this.toDate = toDate;
|
||||
}
|
||||
BaseBean bb= new BaseBean();
|
||||
private final List<String> LIST = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
bb.writeLog("AutoSchedulJob Start");
|
||||
try {
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
boolean b = false;
|
||||
String sql = "insert into kq_shiftschedule(kqdate,serialid,resourceid,groupid,isdelete)values(?,?,?,?,?)";
|
||||
//考勤组字段
|
||||
String field31 = bb.getPropValue("jgKq_main","kqz");
|
||||
//平时班次
|
||||
String field32 = bb.getPropValue("jgKq_main","psbc");
|
||||
//周末班次
|
||||
String field33 = bb.getPropValue("jgKq_main","zmbc");
|
||||
List<Map<String,String>> userList = new ArrayList<>();
|
||||
//查询指定和考勤组成员
|
||||
String query_sql = "select a.id,"+field31+","+field32+","+field33+" from hrmresource a left join cus_fielddata b on a.id=b.id and b.scope='HrmCustomFieldByInfoType' and b.scopeid=3\n" +
|
||||
"where b."+field31+" is not null and b."+field32+" is not null";
|
||||
rs.execute(query_sql);
|
||||
while (rs.next()) {
|
||||
Map<String,String> map = new HashMap<>();
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String kqz = Util.null2String(rs.getString(field31));
|
||||
String psbc = Util.null2String(rs.getString(field32));
|
||||
String zmbc = Util.null2String(rs.getString(field33));
|
||||
map.put("id",id);
|
||||
map.put("kqz",kqz);
|
||||
map.put("psbc",psbc);
|
||||
map.put("zmbc",zmbc);
|
||||
userList.add(map);
|
||||
}
|
||||
bb.writeLog("AutoScheduNextMonthJob.userList: " + JSONObject.toJSONString(userList));
|
||||
//查询这个月的全部日期
|
||||
List<String> thisMonthDates = getThisMonthDates();
|
||||
//排默认班次
|
||||
for (Map<String,String> user: userList) {
|
||||
String userId = user.get("id");
|
||||
String psbc = user.get("psbc");
|
||||
String zmbc = user.get("zmbc");
|
||||
for (String thisDate : thisMonthDates) {
|
||||
//已排班了不做任何操作
|
||||
Boolean checkPb = checkPb(userId,thisDate);
|
||||
if(!checkPb){
|
||||
WorkTimeEntity workTimeEntity = new KQWorkTime().getWorkTime(userId, thisDate);
|
||||
boolean holiday = KQHolidaySetBiz.isHoliday(userId, thisDate, true);
|
||||
if (holiday) {
|
||||
//节假日休息班
|
||||
b = rs.executeUpdate(sql, thisDate, zmbc, userId, workTimeEntity.getGroupId(), "0");
|
||||
} else {
|
||||
b = rs.executeUpdate(sql, thisDate, psbc, userId, workTimeEntity.getGroupId(), "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bb.writeLog("AutoScheduNextMonthJob.b: " + b);
|
||||
}catch (Exception e) {
|
||||
bb.writeLog("AutoScheduNextMonthJob Exception: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取这个月所有日期
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getThisMonthDates() {
|
||||
// 获取当前时间的Calendar实例
|
||||
List<String> list = new ArrayList<>();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
// 将Calendar实例中的月份加1,得到下个月的Calendar实例
|
||||
// cal.add(Calendar.MONTH, 1);
|
||||
// 获取下个月的天数
|
||||
int daysInMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
// 循环获取下个月中的每一天的日期
|
||||
for (int i = 1; i <= daysInMonth; i++) {
|
||||
// 将Calendar实例中的日期设置为循环变量i的值
|
||||
cal.set(Calendar.DATE, i);
|
||||
// 获取日期并格式化
|
||||
Date date = cal.getTime();
|
||||
String dateString = new SimpleDateFormat("yyyy-MM-dd").format(date);
|
||||
list.add(dateString);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验对应日期是否已经排班
|
||||
* @param userId
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static Boolean checkPb(String userId,String date){
|
||||
Boolean check = false;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select resourceid from kq_shiftschedule where isdelete = 0 and resourceid = "+userId+" and kqdate = '"+date+"'";
|
||||
rs.executeQuery(sql);
|
||||
if(rs.getCounts()>0){
|
||||
check = true;
|
||||
}
|
||||
return check;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,638 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.UtilKQ;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.common.StringUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect = Util.null2String(jsonObj.get("typeselect"));
|
||||
if (typeselect.length() == 0) typeselect = "3";
|
||||
if (!typeselect.equals("") && !typeselect.equals("0") && !typeselect.equals("6")) {
|
||||
if (typeselect.equals("1")) {
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
} else {
|
||||
fromDate = TimeUtil.getDateByOption(typeselect, "0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect, "1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")), ",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("1", "" + user.getUID(), "a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String, Object>> constraintList = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (Util.null2String(kqReportFieldComInfo.getParentid()).length() > 0) continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))
|
||||
continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width", 30 * 256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(), user);
|
||||
childColumns = (List<Object>) mapChildColumnInfo.get("childColumns");
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
} else {
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
|
||||
titleList.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if (DateUtil.compDate(today, toDate) > 0) {//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// }
|
||||
|
||||
if(showColumns.contains("kqCalendar")) {
|
||||
childColumns = new ArrayList<>();
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
title = new HashMap<>();
|
||||
title.put("title", UtilKQ.getWeekDayShort(DateUtil.getWeek(date)-1,user.getLanguage()) +"\r\n"+ DateUtil.geDayOfMonth(date));
|
||||
title.put("width", 30 * 256);
|
||||
childColumns.add(title);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
title = new HashMap();
|
||||
title.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
String backFields = " (select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc," +
|
||||
"(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb," +
|
||||
"(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb," +
|
||||
"(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and u.ksrq>='"+fromDate+"' and u.ksrq<= '"+toDate+"') as zlxs," +
|
||||
"(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts," +
|
||||
"(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts," +
|
||||
"(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
|
||||
if (subCompanyId.length() > 0) {
|
||||
sqlWhere += " and a.subcompanyid1 in(" + subCompanyId + ") ";
|
||||
}
|
||||
|
||||
if (departmentId.length() > 0) {
|
||||
sqlWhere += " and a.departmentid in(" + departmentId + ") ";
|
||||
}
|
||||
|
||||
if (resourceId.length() > 0) {
|
||||
sqlWhere += " and a.id in(" + resourceId + ") ";
|
||||
}
|
||||
|
||||
if (viewScope.equals("4")) {//我的下属
|
||||
if (allLevel.equals("1")) {//所有下属
|
||||
sqlWhere += " and a.managerstr like '%," + user.getUID() + ",%'";
|
||||
} else {
|
||||
sqlWhere += " and a.managerid=" + user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select " + backFields + sqlFrom + sqlWhere + groupBy + orderBy;
|
||||
|
||||
//System.out.println("start" + DateUtil.getFullDate());
|
||||
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String, Object> flowData = new KQReportBiz().getFlowData(params, user);
|
||||
//System.out.println("end" + DateUtil.getFullDate());
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if (tmpSubcompanyId.length() == 0) {
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if (tmpDepartmentId.length() == 0) {
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if (tmpJobtitleId.length() == 0) {
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if (fieldName.equals("attendanceSerial")) {
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.add(kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else{
|
||||
data.add("");
|
||||
}
|
||||
continue;
|
||||
} else if (fieldName.equals("leave")) {//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.add(flowLeaveData);
|
||||
}
|
||||
continue;
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
} else if(Util.null2String(kqReportFieldComInfo.getCascadekey(fieldid)).length()>0){
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
|
||||
List<String> lsCascadekey = Util.splitString2List(kqReportFieldComInfo.getCascadekey(fieldid),",");
|
||||
for(int i=0;i<lsCascadekey.size();i++){
|
||||
if(Util.null2String(rs.getString(lsCascadekey.get(i))).length()>0){
|
||||
fieldid = KQReportFieldComInfo.field2Id.get(lsCascadekey.get(i));
|
||||
fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)),kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}else{
|
||||
fieldValue = "0";
|
||||
}
|
||||
data.add(fieldValue);
|
||||
}
|
||||
continue;
|
||||
}else {
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
fieldValue = Util.formatMultiLang(fieldValue,""+user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
if(showColumns.contains("kqCalendar")) {
|
||||
// Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true);
|
||||
Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true,uintType,show_card_source);
|
||||
isEnd = false;
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
if (DateUtil.compDate(today, date) > 0) {
|
||||
data.add("");
|
||||
} else {
|
||||
if (detialDatas.get(id + "|" + date) != null) {
|
||||
data.add(((Map<String, Object>) detialDatas.get(id + "|" + date)).get("text"));
|
||||
} else {
|
||||
data.add(SystemEnv.getHtmlLabelName(26593, user.getLanguage()));
|
||||
}
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
}
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList", constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390351, user.getLanguage())+" "+fromDate+" "+toDate;
|
||||
workbook.put("fileName", fileName);
|
||||
ExcelUtil ExcelUtil = new ExcelUtil();
|
||||
Map<String, Object> exportMap = ExcelUtil.export(workbook, request, response,true);
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String, Object> getChildColumnsInfo(String parentid, User user) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if (parentid.equals("attendanceSerial")) {//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
}
|
||||
for (int i = 0; serialIds != null && i < serialIds.size(); i++) {
|
||||
title = new HashMap<>();
|
||||
title.put("title", Util.formatMultiLang(kqShiftManagementComInfo.getSerial(serialIds.get(i)),""+user.getLanguage()));
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
} else if (parentid.equals("leave")) {
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for (int i = 0; leaveRules != null && i < leaveRules.size(); i++) {
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
String unitName = (KQUnitBiz.isLeaveHour(unitType)) ? SystemEnv.getHtmlLabelName(391, user.getLanguage()) : SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
title = new HashMap<>();
|
||||
title.put("title", name + "(" + unitName + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else {
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns", titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return titleList;
|
||||
}
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
title = new HashMap<>();
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
return titleList;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,680 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetKQReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
String isFromMyAttendance = Util.null2String(jsonObj.get("isFromMyAttendance"));//是否是来自我的考勤的请求,如果是,不加载考勤报表权限共享的限制,不然我的考勤会提示无权限
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
|
||||
String rightSql = kqReportBiz.getReportRight("1",""+user.getUID(),"a");
|
||||
if(isFromMyAttendance.equals("1")){
|
||||
rightSql = "";
|
||||
}
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0)continue;
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("type", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
columns.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束日期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){//结束日期不大于今天
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
|
||||
childColumns = new ArrayList<>();
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
column = new HashMap();
|
||||
column.put("title", DateUtil.geDayOfMonth(date));
|
||||
column.put("dataIndex", date);
|
||||
column.put("key", date);
|
||||
column.put("type", date);
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", 90);
|
||||
column.put("isCalendar", 1);
|
||||
childColumns.add(column);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
column.put("dataIndex", "kqCalendar");
|
||||
column.put("key", "kqCalendar");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", childColumns.size()*90);
|
||||
column.put("children", childColumns);
|
||||
}
|
||||
columns.add(column);
|
||||
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
String backFields = " (select sum(xchu) as xcqts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xcqts,(select sum(jjrbtjia*60) as jjrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrbtjb,(select sum(jjrdksc*60) as jjrdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrdksc,(select sum(xxb) as xxb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xxb,(select sum(zrbtjbzdx*60) as zrbtjbztx from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjbztx,(select sum(gzsc) as gzsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gzsc,(select sum(psjbshic*60) as psjbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as psjbsc,(select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc,(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb,(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb,(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and u.ksrq>='"+fromDate+"' and u.ksrq<= '"+toDate+"') as zlxs,(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts,(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts,(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
sqlWhere += " and 1=2 ";
|
||||
}
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+groupBy+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by t.dsporder asc, t.lastname asc ";
|
||||
String descOrderBy = " order by t.dsporder desc, t.lastname desc ";
|
||||
|
||||
//默认排序设置 start,有性能问题,先取消,后面再看看有没有好的方式
|
||||
// String orderBySql = "select * from kq_report_order where userId=? and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql, user.getUID());
|
||||
// if (rs.getCounts() <= 0) {
|
||||
// orderBySql = "select * from kq_report_order where userId=0 and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql);
|
||||
// }
|
||||
// while (rs.next()) {
|
||||
// String dataIndex = rs.getString("dataIndex");
|
||||
// String ascOrDesc = rs.getString("ascOrDesc");
|
||||
// String ascOrDesc1 = (ascOrDesc.equals("")||ascOrDesc.equals("asc"))?"desc":"asc";
|
||||
// if (dataIndex.equals("organization")) {
|
||||
// orderBy += ",showOrderOfDeptTree " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += ",showOrderOfDeptTree " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// }
|
||||
// if (dataIndex.equalsIgnoreCase("dspOrder") || dataIndex.equalsIgnoreCase("lastName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("deptShowOrder") || dataIndex.equalsIgnoreCase("deptName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("subcomShowOrder") || dataIndex.equalsIgnoreCase("subcomName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",subcom_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",subcom_id " + ascOrDesc1;
|
||||
// }
|
||||
// }
|
||||
// orderBy = orderBy.startsWith(",") ? orderBy.substring(1) : orderBy;
|
||||
// descOrderBy = descOrderBy.startsWith(",") ? descOrderBy.substring(1) : descOrderBy;
|
||||
// orderBy = orderBy.equals("") ? " t.dspOrder,t.id " : orderBy;
|
||||
// descOrderBy = descOrderBy.equals("") ? " t.dspOrder,t.id " : descOrderBy;
|
||||
// orderBy = "order by "+orderBy;
|
||||
|
||||
sql = backFields + sqlFrom + sqlWhere + groupBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " +pageSize + " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql + orderBy+ " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql+orderBy;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
|
||||
|
||||
bb.writeLog("getKqReportCmd:"+sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
String id = rs.getString("id");
|
||||
data.put("resourceId",id);
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1"))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
data.put("subcompanyId",tmpSubcompanyId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
data.put("departmentId",tmpDepartmentId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
data.put("jobtitleId",tmpJobtitleId);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
}else if(fieldName.equals("cdfz")){
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins"));
|
||||
fieldValue = beLateMins;
|
||||
}else if(fieldName.equals("ztfz")){
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins"));
|
||||
fieldValue = graveBeLateMins;
|
||||
}else if(fieldName.equals("attendanceSerial")){
|
||||
List<String> serialIds = null;
|
||||
if(attendanceSerial.length()>0){
|
||||
serialIds = Util.splitString2List(attendanceSerial,",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
if(fieldName.equals("overtimeTotal")){
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else{
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id+"|"+fieldName)));
|
||||
}
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if(Util.null2String(kqReportFieldComInfo.getUnittype()).length()>0) {
|
||||
if(fieldValue.length() == 0){
|
||||
fieldValue="0";
|
||||
}else{
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
data.put(fieldName,fieldValue);
|
||||
}
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_"+leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+flowLeaveBackType)),"0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(leaveData.length() == 0){
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if(leavebackData.length() == 0){
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if(b_flowLeaveData.length() > 0){
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
}else{
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0)));
|
||||
}
|
||||
data.put(flowType,flowLeaveData);
|
||||
}
|
||||
|
||||
Map<String,Object> detialDatas = kqReportBiz.getDetialDatas(id,fromDate,toDate,user,flowData,false,uintType,show_card_source);
|
||||
// new KQLog().info("id:"+id+":detialDatas:"+detialDatas);
|
||||
isEnd = false;
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
if(DateUtil.compDate(today, date)>0){
|
||||
data.put(date,"");
|
||||
}else{
|
||||
// new KQLog().info("id:date:"+(id+"|"+date)+":detialDatas.get:"+detialDatas.get(id+"|"+date));
|
||||
data.put(date,detialDatas.get(id+"|"+date)==null?SystemEnv.getHtmlLabelName(26593, user.getLanguage()):detialDatas.get(id+"|"+date));
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("attendanceSerial")){//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if(Util.null2String(jsonObj.get("attendanceSerial")).length()>0){
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")),",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
column = new HashMap();
|
||||
column.put("title", kqShiftManagementComInfo.getSerial(serialIds.get(i)));
|
||||
column.put("unit", "");
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", serialIds.get(i));
|
||||
column.put("key", serialIds.get(i));
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return lsChildColumns;
|
||||
}
|
||||
Map<String,Object> column = null;
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lsChildColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
package com.engine.jgkq.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.jgkq.service.JgkqService;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.EncodingUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.constant.DBConstant;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 京贵投资考勤二开接口
|
||||
* Created by dengjp on 2024/4/11.
|
||||
*/
|
||||
public class JgkqServiceImpl extends Service implements JgkqService {
|
||||
|
||||
/**
|
||||
* 招聘进度表数据拼接
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> recruitmentProgress(Map<String, Object> params, User user) {
|
||||
Map<String,Object> resutl = new HashMap<String,Object>();
|
||||
List<Map<String,Object>> backList = new ArrayList<>();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("recruitmentProgress ==>");
|
||||
RecordSet rs = new RecordSet();
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
String curDate = localDateTime.format(dateFormatter);
|
||||
String deptid = null;
|
||||
String testDate1 = null;
|
||||
String testDate2 = null;
|
||||
String userId = null;
|
||||
|
||||
try {
|
||||
String deptidP = Util.null2String(params.get("deptid"));
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
String toDate = Util.null2String(params.get("toDate"));
|
||||
userId = String.valueOf(user.getUID());
|
||||
bb.writeLog("userId:"+userId);
|
||||
if(StringUtils.isNotBlank(deptidP)){
|
||||
deptid = deptidP;
|
||||
}
|
||||
if(StringUtils.isNotBlank(fromDate)){
|
||||
testDate1 = fromDate;
|
||||
}
|
||||
if(StringUtils.isNotBlank(toDate)){
|
||||
testDate2 = toDate;
|
||||
}
|
||||
|
||||
char separator = Util.getSeparator();
|
||||
String para = deptid + separator + testDate1 + separator +
|
||||
testDate2 + separator + userId;
|
||||
rs.executeProc2("hrmzpjdb", para,null);
|
||||
while (rs.next()) {
|
||||
Map<String,Object> objZp = new HashMap<>();
|
||||
String xh = rs.getString("xh");
|
||||
String bm = rs.getString("bm");
|
||||
String gwmc = rs.getString("gwmc");
|
||||
String jjcd = rs.getString("jjcd");
|
||||
String zt = rs.getString("zt");
|
||||
String zpyy = rs.getString("zpyy");
|
||||
String sqsj = rs.getString("sqsj");
|
||||
String qwdgsj = rs.getString("qwdgsj");
|
||||
String zprs = rs.getString("zprs");
|
||||
String wcsl = rs.getString("wcsl");
|
||||
String wcl = rs.getString("wcl");
|
||||
String jltj = rs.getString("jltj");
|
||||
String msrs = rs.getString("msrs");
|
||||
String mstg = rs.getString("mstg");
|
||||
String offers = rs.getString("offers");
|
||||
String offerdc = rs.getString("offerdc");
|
||||
String rzrs = rs.getString("rzrs");
|
||||
objZp.put("xh",xh);
|
||||
objZp.put("bm",bm);
|
||||
objZp.put("gwmc",gwmc);
|
||||
objZp.put("jjcd",jjcd);
|
||||
objZp.put("zt",zt);
|
||||
objZp.put("zpyy",zpyy);
|
||||
objZp.put("sqsj",sqsj);
|
||||
objZp.put("qwdgsj",qwdgsj);
|
||||
objZp.put("zprs",zprs);
|
||||
objZp.put("wcsl",wcsl);
|
||||
objZp.put("wcl",wcl);
|
||||
objZp.put("jltj",jltj);
|
||||
objZp.put("msrs",msrs);
|
||||
objZp.put("mstg",mstg);
|
||||
objZp.put("offers",offers);
|
||||
objZp.put("offerdc",offerdc);
|
||||
objZp.put("rzrs",rzrs);
|
||||
backList.add(objZp);
|
||||
}
|
||||
|
||||
resutl.put("code","200");
|
||||
resutl.put("msg","招聘进度表数据获取成功");
|
||||
resutl.put("backList",backList);
|
||||
}catch (Exception e) {
|
||||
bb.writeLog("createStaffApplyBatch Exception: "+e);
|
||||
resutl.put("code","500");
|
||||
resutl.put("msg","接口异常");
|
||||
return resutl;
|
||||
}
|
||||
return resutl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析存储过程参数
|
||||
*
|
||||
*/
|
||||
private static String[] parseArgument(String s) {
|
||||
|
||||
String args[];
|
||||
char separator = Util.getSeparator();
|
||||
boolean needTransCode = false;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
if (s.trim().equals("")) {
|
||||
args = new String[0];
|
||||
return args;
|
||||
}
|
||||
for (j = 0; j < s.length(); j++)
|
||||
if (s.charAt(j) == separator)
|
||||
i++;
|
||||
|
||||
args = new String[i + 1];
|
||||
j = 0;
|
||||
i = 0;
|
||||
while ((j = s.indexOf(separator)) != -1) {
|
||||
// fix by caoyun 支持Mysql数字类型传入null
|
||||
String a = s.substring(0, j);
|
||||
if (needTransCode) {
|
||||
a = EncodingUtils.toUNICODE(a);
|
||||
}
|
||||
args[i++] = a;
|
||||
s = s.substring(j + 1);
|
||||
}
|
||||
if (needTransCode) {
|
||||
s = EncodingUtils.toUNICODE(s);
|
||||
}
|
||||
|
||||
args[i] = s;
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,639 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import java.math.BigDecimal;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public GetKQDailyReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQDailyReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
boolean isDaily = kqReportFieldComInfo.getReportType().equals("daily");
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !isDaily)continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
if(kqReportFieldComInfo.getReportType1().equals("daily")){
|
||||
column.put("isdaily", "1");
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
// String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")&&!Util.null2String(rs.getOrgindbtype()).equals("jc")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
String backFields = " a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
|
||||
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
|
||||
" b.signdays,b.signmins, "+
|
||||
" b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism ,b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc, b.kqdate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc, b.kqdate desc ";
|
||||
sql = backFields + sqlFrom + sqlWhere + orderBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + pageSize+ " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc, kqdate asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc, kqdate desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql+" ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(id, kqdate);
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1")) continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))
|
||||
continue;
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String fieldValueID = rs.getString("subcompanyid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
//fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getSubCompanyID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String fieldValueID = rs.getString("departmentid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
//fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getDepartmentID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String fieldValueID = rs.getString("jobtitle");
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle"));
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getJobTitle(id);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (kqReportFieldComInfo.getParentid().equals("overtime") || kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
|
||||
if (fieldName.equals("overtimeTotal")) {
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave < 0 ? 0 : restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
} else {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("serialid")) {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (fieldValue.length()>0) {//弹性工作制没有班次
|
||||
// data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(fieldValue)){
|
||||
data.put("serialid", serialdata.get(fieldValue));
|
||||
}else{
|
||||
String tmpserialname = shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage());
|
||||
serialdata.put(fieldValue,tmpserialname);
|
||||
data.put("serialid", tmpserialname);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
data.putAll(this.getSignDetailInfo(id, kqdate));
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
kqLog.info("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.put(flowType, flowLeaveData);
|
||||
}
|
||||
|
||||
data.put("resourceId", id);
|
||||
data.put("kqdate", kqdate);
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
private String getUnitType(String unitType, User user){
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
return unitTypeName;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily")?"1":"0");
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,day_type,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
String dayType = Util.null2s(rs.getString("day_type"),"");
|
||||
int workMins = rs.getInt("workMins");
|
||||
boolean isNonWork = false;
|
||||
if(dayType.length() > 0){
|
||||
if("holiday".equals(dayType) || "playday".equals(dayType)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}else{
|
||||
if(workMins<=0){
|
||||
isNonWork = true;
|
||||
}else{
|
||||
if(serialid.length() > 0){
|
||||
String isRest = Util.null2s(kqShiftManagementComInfo.getIsRest(serialid),"");
|
||||
if("1".equals(isRest)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(!isNonWork){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,756 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import java.math.BigDecimal;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public GetKQDailyReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQDailyReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
boolean isDaily = kqReportFieldComInfo.getReportType().equals("daily");
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !isDaily)continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
if(kqReportFieldComInfo.getReportType1().equals("daily")){
|
||||
column.put("isdaily", "1");
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
// String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")&&!Util.null2String(rs.getOrgindbtype()).equals("jc")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
|
||||
String backFields = "(select zjbxs*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zjbxs,(select jjrbtjia*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrbtjb,(select jjrdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrdksc,(select xxb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as xxb,(select zrbtjbzdx*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjbztx,(select gzsc from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as gzsc,(select psjbshic*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as psjbsc,b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb,(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb," +
|
||||
"(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb,(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs," +
|
||||
"(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts,(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts," +
|
||||
"(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts,(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts," +
|
||||
"(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs,(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm,(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm,(select sum(sch*60) from uf_jbsqhz where sqr = a.id and sqrq = b.kqdate and jblx in (0,1,2,3)) as jbsq," +
|
||||
"a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
|
||||
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
|
||||
" b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism ,b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
//考勤异常状态
|
||||
String KQstatus = Util.null2String(jsonObj.get("KQstatus"));
|
||||
if ("5".equals(KQstatus)){
|
||||
|
||||
}else if ("1".equals(KQstatus)){
|
||||
sqlWhere += " and (absenteeismMins > 0 or forgotCheck > 0 or forgotBeginWorkCheckMins>0) ";
|
||||
}else if ("2".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0) ";
|
||||
}else if ("3".equals(KQstatus)){
|
||||
sqlWhere += " and (b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0) ";
|
||||
}else if ("4".equals(KQstatus)){
|
||||
sqlWhere +=" and (forgotCheck > 0 or forgotBeginWorkCheckMins>0)";
|
||||
}else if ("6".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins = 0 and b.graveBeLateMins = 0 and b.leaveEarlyMins = 0 and b.graveLeaveEarlyMins = 0 and absenteeismMins = 0 and forgotCheck = 0)";
|
||||
}else if ("7".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0 or b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0 or absenteeismMins > 0 or forgotCheck > 0 or forgotBeginWorkCheckMins > 0)";
|
||||
}
|
||||
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc, b.kqdate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc, b.kqdate desc ";
|
||||
sql = backFields + sqlFrom + sqlWhere + orderBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + pageSize+ " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc, kqdate asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc, kqdate desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql+" ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(id, kqdate);
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1")) continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))
|
||||
continue;
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String fieldValueID = rs.getString("subcompanyid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
//fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getSubCompanyID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String fieldValueID = rs.getString("departmentid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
//fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getDepartmentID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String fieldValueID = rs.getString("jobtitle");
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle"));
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getJobTitle(id);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("cardOvertime")) {
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
Double zlMinsNew = Util.getDoubleValue(fieldValue);
|
||||
String skjbcsy = divide(String.valueOf(changeBxs(zlMinsNew.intValue())),"60");
|
||||
fieldValue = skjbcsy;
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if(fieldName.equals("cdfz")){
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins"));
|
||||
data.put(fieldName, beLateMins);
|
||||
} else if(fieldName.equals("ztfz")){
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins"));
|
||||
data.put(fieldName, graveBeLateMins);
|
||||
} else if (fieldName.equals("xqNew")) {
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (kqReportFieldComInfo.getParentid().equals("overtime") || kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
|
||||
if (fieldName.equals("overtimeTotal")) {
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave < 0 ? 0 : restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
} else {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("serialid")) {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (fieldValue.length()>0) {//弹性工作制没有班次
|
||||
// data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(fieldValue)){
|
||||
data.put("serialid", serialdata.get(fieldValue));
|
||||
}else{
|
||||
String tmpserialname = shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage());
|
||||
serialdata.put(fieldValue,tmpserialname);
|
||||
data.put("serialid", tmpserialname);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
data.putAll(this.getSignDetailInfo(id, kqdate));
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
kqLog.info("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.put(flowType, flowLeaveData);
|
||||
}
|
||||
|
||||
data.put("resourceId", id);
|
||||
data.put("kqdate", kqdate);
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
private String getUnitType(String unitType, User user){
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
return unitTypeName;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily")?"1":"0");
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,day_type,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
String dayType = Util.null2s(rs.getString("day_type"),"");
|
||||
int workMins = rs.getInt("workMins");
|
||||
boolean isNonWork = false;
|
||||
if(dayType.length() > 0){
|
||||
if("holiday".equals(dayType) || "playday".equals(dayType)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}else{
|
||||
if(workMins<=0){
|
||||
isNonWork = true;
|
||||
}else{
|
||||
if(serialid.length() > 0){
|
||||
String isRest = Util.null2s(kqShiftManagementComInfo.getIsRest(serialid),"");
|
||||
if("1".equals(isRest)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(!isNonWork){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}else {
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 半小时转换
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static Integer changeBxs(Integer value){
|
||||
return (value / 30)*30 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的除法运算。
|
||||
* @param v1 被加数
|
||||
* @param v2 加数
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static String divide(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.divide(b2,2,BigDecimal.ROUND_HALF_UP).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,895 @@
|
|||
package weaver.interfaces.jgkq.action;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.time.util.DateUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 信息完善员工 、信息完善职员的建模数据需要帮忙做个定时任务,把数据更新到对应的表里面,主表字段更新hrmresource和cus_fielddata表
|
||||
* 明细表字段分表更新
|
||||
* uf_lz 在本公司工作的亲属及朋友
|
||||
* uf_zc 培训经历
|
||||
* uf_gzjl 工作经历
|
||||
* uf_jyjl 教育经历
|
||||
* uf_jtcy 家庭关系
|
||||
*
|
||||
* @author wangj
|
||||
* @version 1.00版本
|
||||
* @Date 2024-11-21
|
||||
*/
|
||||
|
||||
public class UpdateHrmInfoJob extends BaseCronJob {
|
||||
private String cerno;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
updateUfzyInfo();
|
||||
updateUfygInfo();
|
||||
}
|
||||
|
||||
private void updateUfzyInfo() {
|
||||
List<Map<String, String>> mainlist = new ArrayList(200);
|
||||
RecordSet rs = new RecordSet();
|
||||
//xb,csrq,jg,stzk,mz,hyzk,jtzz,xjdz,sj,dzyj,qq,wx,jjlxrxm,ybrgx,dz,dh,jsjnl,xl,jgs,zy
|
||||
|
||||
String sqlwhere = " 1=1 ";
|
||||
if (StringUtils.isNotBlank(cerno)) {
|
||||
sqlwhere = sqlwhere + " and sfzhm = '" + cerno + "'";
|
||||
}else{
|
||||
sqlwhere = sqlwhere + " and shzt = 1 ";
|
||||
|
||||
}
|
||||
|
||||
//审核状态:已审核数据
|
||||
String sql = "select id,sfzhm,xm,xb,csrq,jg,stzk,mz,hyzk,jtzz,xjdz,sj,dzyj,qq,wx,jjlxrxm,ybrgx,dz,dh,jsjnl,xl,jgs,zy from uf_xxwszy where " + sqlwhere;
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String sfzhm = Util.null2String(rs.getString("sfzhm"));
|
||||
String xm = Util.null2String(rs.getString("xm"));
|
||||
|
||||
String xb = getSelectNullValue(Util.null2String(rs.getString("xb")));
|
||||
String csrq = getSelectNullValue(Util.null2String(rs.getString("csrq")));
|
||||
String jg = getSelectNullValue(Util.null2String(rs.getString("jg")));
|
||||
String stzk = getSelectNullValue(Util.null2String(rs.getString("stzk")));
|
||||
String mz = getSelectNullValue(Util.null2String(rs.getString("mz")));
|
||||
String hyzk = getSelectNullValue(Util.null2String(rs.getString("hyzk")));
|
||||
String jtzz = getSelectNullValue(Util.null2String(rs.getString("jtzz")));
|
||||
String xjdz = getSelectNullValue(Util.null2String(rs.getString("xjdz")));
|
||||
String sj = getSelectNullValue(Util.null2String(rs.getString("sj")));
|
||||
String dzyj = getSelectNullValue(Util.null2String(rs.getString("dzyj")));
|
||||
String qq = getSelectNullValue(Util.null2String(rs.getString("qq")));
|
||||
String wx = getSelectNullValue(Util.null2String(rs.getString("wx")));
|
||||
String jjlxrxm = getSelectNullValue(Util.null2String(rs.getString("jjlxrxm")));
|
||||
String ybrgx = getSelectNullValue(Util.null2String(rs.getString("ybrgx")));
|
||||
String dz = getSelectNullValue(Util.null2String(rs.getString("dz")));
|
||||
String dh = getSelectNullValue(Util.null2String(rs.getString("dh")));
|
||||
String jsjnl = getSelectNullValue(Util.null2String(rs.getString("jsjnl")));
|
||||
String xl = getSelectNullValue(Util.null2String(rs.getString("xl")));
|
||||
String jgs = getSelectNullValue(Util.null2String(rs.getString("jgs")));
|
||||
String zy = getSelectNullValue(Util.null2String(rs.getString("zy")));
|
||||
|
||||
updatezyHrmData(sfzhm, xb, csrq, jg, stzk, mz, hyzk, jtzz, xjdz, sj, dzyj, qq, wx, jjlxrxm, ybrgx, dz, dh, jsjnl, xl, jgs, zy);
|
||||
|
||||
Map<String, String> main = new HashMap<>(10);
|
||||
main.put("id", id);
|
||||
main.put("sfzhm", sfzhm);
|
||||
main.put("xm", xm);
|
||||
mainlist.add(main);
|
||||
}
|
||||
|
||||
for (Map main : mainlist) {
|
||||
String id = Util.null2String(main.get("id"));
|
||||
String xm = Util.null2String(main.get("xm"));
|
||||
String sfzhm = Util.null2String(main.get("sfzhm"));
|
||||
//教育经历
|
||||
updatezyDt1(id, xm, sfzhm);
|
||||
|
||||
//工作经历
|
||||
updatezyDt2(id, xm, sfzhm);
|
||||
|
||||
//家庭信息
|
||||
updatezyDt3(id, xm, sfzhm);
|
||||
|
||||
|
||||
//在本公司工作的亲属及朋友
|
||||
updatezyDt4(id, xm, sfzhm);
|
||||
|
||||
|
||||
//培训经历
|
||||
updatezyDt5(id, xm, sfzhm);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUfygInfo() {
|
||||
List<Map<String, String>> mainlist = new ArrayList(200);
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String sqlwhere = " 1=1 ";
|
||||
if (StringUtils.isNotBlank(cerno)) {
|
||||
sqlwhere = sqlwhere + " and sfzhm = '" + cerno + "'";
|
||||
}else{
|
||||
sqlwhere = sqlwhere + " and shzt = 1 ";
|
||||
|
||||
}
|
||||
|
||||
//审核状态:已审核数据
|
||||
//jg2,xb,stzk,csrq,sfzhm,mz,sg,hyzk,lxdh,sfzdz,sfzs,xzzs,jsjyysp,whcd,yy1,yy,qzfs,qtyy,jsr,lrgx,jntc,bm,jjlxr,jjlxrgx,jjlxrdh,zy,jsrlxfs,jjlxrdz,jjlxrybrgx
|
||||
String sql = "select id,xm,jg2,xb,stzk,csrq,sfzhm,mz,sg,hyzk,lxdh,sfzdz,sfzs,xzzs,jsjyysp,whcd,yy1,yy,qzfs,qtyy,jsr,lrgx,jntc,bm,jjlxr,jjlxrgx,jjlxrdh,zy,jsrlxfs,jjlxrdz,jjlxrybrgx from uf_xxwsyg where " + sqlwhere;
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String sfzhm = Util.null2String(rs.getString("sfzhm"));
|
||||
String xm = Util.null2String(rs.getString("xm"));
|
||||
|
||||
String jg2 = getSelectNullValue(Util.null2String(rs.getString("jg2")));
|
||||
String xb = getSelectNullValue(Util.null2String(rs.getString("xb")));
|
||||
String stzk = getSelectNullValue(Util.null2String(rs.getString("stzk")));
|
||||
String csrq = getSelectNullValue(Util.null2String(rs.getString("csrq")));
|
||||
String mz = getSelectNullValue(Util.null2String(rs.getString("mz")));
|
||||
String sg = getSelectNullValue(Util.null2String(rs.getString("sg")));
|
||||
String hyzk = getSelectNullValue(Util.null2String(rs.getString("hyzk")));
|
||||
String lxdh = getSelectNullValue(Util.null2String(rs.getString("lxdh")));
|
||||
String sfzdz = getSelectNullValue(Util.null2String(rs.getString("sfzdz")));
|
||||
String sfzs = getSelectNullValue(Util.null2String(rs.getString("sfzs")));
|
||||
String xzzs = getSelectNullValue(Util.null2String(rs.getString("xzzs")));
|
||||
String jsjyysp = getSelectNullValue(Util.null2String(rs.getString("jsjyysp")));
|
||||
String whcd = getSelectNullValue(Util.null2String(rs.getString("whcd")));
|
||||
String yy1 = getSelectNullValue(Util.null2String(rs.getString("yy1")));
|
||||
String yy = getSelectNullValue(Util.null2String(rs.getString("yy")));
|
||||
String qzfs = getSelectNullValue(Util.null2String(rs.getString("qzfs")));
|
||||
String qtyy = getSelectNullValue(Util.null2String(rs.getString("qtyy")));
|
||||
String jsr = getSelectNullValue(Util.null2String(rs.getString("jsr")));
|
||||
String lrgx = getSelectNullValue(Util.null2String(rs.getString("lrgx")));
|
||||
String jntc = getSelectNullValue(Util.null2String(rs.getString("jntc")));
|
||||
String bm = getSelectNullValue(Util.null2String(rs.getString("bm")));
|
||||
String jjlxr = getSelectNullValue(Util.null2String(rs.getString("jjlxr")));
|
||||
String jjlxrgx = getSelectNullValue(Util.null2String(rs.getString("jjlxrgx")));
|
||||
String jjlxrdh = getSelectNullValue(Util.null2String(rs.getString("jjlxrdh")));
|
||||
String zy = getSelectNullValue(Util.null2String(rs.getString("zy")));
|
||||
String jsrlxfs = getSelectNullValue(Util.null2String(rs.getString("jsrlxfs")));
|
||||
String jjlxrdz = getSelectNullValue(Util.null2String(rs.getString("jjlxrdz")));
|
||||
String jjlxrybrgx = getSelectNullValue(Util.null2String(rs.getString("jjlxrybrgx")));
|
||||
|
||||
updateygHrmData(jg2, xb, stzk, csrq, sfzhm, mz, sg, hyzk, lxdh, sfzdz, sfzs, xzzs, jsjyysp, whcd, yy1, yy, qzfs, qtyy, jsr, lrgx, jntc, bm, jjlxr, jjlxrgx, jjlxrdh, zy, jsrlxfs, jjlxrdz, jjlxrybrgx);
|
||||
|
||||
|
||||
Map<String, String> main = new HashMap<>(10);
|
||||
main.put("id", id);
|
||||
main.put("sfzhm", sfzhm);
|
||||
main.put("xm", xm);
|
||||
mainlist.add(main);
|
||||
}
|
||||
|
||||
for (Map main : mainlist) {
|
||||
String id = Util.null2String(main.get("id"));
|
||||
String xm = Util.null2String(main.get("xm"));
|
||||
String sfzhm = Util.null2String(main.get("sfzhm"));
|
||||
//教育经历
|
||||
updateygDt1(id, xm, sfzhm);
|
||||
|
||||
//工作经历
|
||||
updateygDt2(id, xm, sfzhm);
|
||||
|
||||
//家庭信息
|
||||
updateygDt3(id, xm, sfzhm);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 教育经历(职员)
|
||||
*
|
||||
* @param id
|
||||
* @param sfzh
|
||||
*/
|
||||
private void updatezyDt1(String id, String xm, String sfzh) {
|
||||
BaseBean bb = new BaseBean();
|
||||
String formmodeid = Util.null2String(bb.getPropValue("formmodeid_config", "uf_jyjl_formmodeid"));
|
||||
String modedatacreater = "1"; //模块创建人id
|
||||
String modedatacreatertype = "0"; //创建人类型(插入默认值0即可)
|
||||
String modedatacreatedate = DateUtil.getCurrentTime("yyyy-MM-dd");
|
||||
String modedatacreatetime = DateUtil.getCurrentTime("HH:mm:ss");
|
||||
String modeuuid = UUID.randomUUID().toString();
|
||||
|
||||
List<List> p = new ArrayList<List>();
|
||||
String sql = "select kssj,jssj,xxmc,xxdz,xxfs,xl,xw,zy from uf_xxwszy_dt1 where mainid = '" + id + "'";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String kssj = Util.null2String(rs.getString("kssj"));
|
||||
String jssj = Util.null2String(rs.getString("jssj"));
|
||||
String xxmc = Util.null2String(rs.getString("xxmc"));
|
||||
String xxdz = Util.null2String(rs.getString("xxdz"));
|
||||
String xxfs = Util.null2String(rs.getString("xxfs"));
|
||||
String xl = Util.null2String(rs.getString("xl"));
|
||||
String xw = Util.null2String(rs.getString("xw"));
|
||||
String zy = Util.null2String(rs.getString("zy"));
|
||||
|
||||
List<Object> list = new ArrayList<>();
|
||||
list.add(modeuuid);
|
||||
list.add(formmodeid);
|
||||
list.add(modedatacreater);
|
||||
list.add(modedatacreatertype);
|
||||
list.add(modedatacreatedate);
|
||||
list.add(modedatacreatetime);
|
||||
|
||||
list.add(xm);
|
||||
list.add(sfzh);
|
||||
list.add(kssj);
|
||||
list.add(jssj);
|
||||
list.add(xxmc);
|
||||
list.add(xxdz);
|
||||
list.add(xxfs);
|
||||
list.add(xl);
|
||||
list.add(xw);
|
||||
list.add(zy);
|
||||
p.add(list);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(p)) {
|
||||
updateUfjyjlInfo(sfzh, p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新uf_jyjl 教育经历建模表
|
||||
*/
|
||||
private void updateUfjyjlInfo(String sfzh, List<List> p) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute("delete from uf_jyjl where sfzh = '" + sfzh + "'");
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into uf_jyjl(");
|
||||
sb.append("modeuuid,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,");
|
||||
sb.append("xm,sfzh,kssj,jssj,byyx,xxdz,xxxs,xl,xw,zy");
|
||||
sb.append(")values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
rs.executeBatchSql(sb.toString(), p);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 工作经历(职员)
|
||||
*
|
||||
* @param id
|
||||
* @param sfzh
|
||||
*/
|
||||
private void updatezyDt2(String id, String xm, String sfzh) {
|
||||
BaseBean bb = new BaseBean();
|
||||
String formmodeid = Util.null2String(bb.getPropValue("formmodeid_config", "uf_gzjl_formmodeid"));
|
||||
String modedatacreater = "1"; //模块创建人id
|
||||
String modedatacreatertype = "0"; //创建人类型(插入默认值0即可)
|
||||
String modedatacreatedate = DateUtil.getCurrentTime("yyyy-MM-dd");
|
||||
String modedatacreatetime = DateUtil.getCurrentTime("HH:mm:ss");
|
||||
String modeuuid = UUID.randomUUID().toString();
|
||||
|
||||
List<List> p = new ArrayList<List>();
|
||||
String sql = "select gsmc,dh,gsrs,bmrs,kssj,jssj,zw,zz,zhxj,lzyy,zmr,lxfs,sfyqyrdwyjjcldgx,sfyqyrdwywjdflsy,sfyqyrdwydlbmxyyjyxztk from uf_xxwszy_dt2 where mainid = '" + id + "'";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String gzdw = Util.null2String(rs.getString("gsmc"));
|
||||
String dh = Util.null2String(rs.getString("dh"));
|
||||
String ksrq = Util.null2String(rs.getString("kssj"));
|
||||
String jsrq = Util.null2String(rs.getString("jssj"));
|
||||
String zw = Util.null2String(rs.getString("zw"));
|
||||
String zz = Util.null2String(rs.getString("zz"));
|
||||
String lzxc = Util.null2String(rs.getString("zhxj"));
|
||||
String lzyy = Util.null2String(rs.getString("lzyy"));
|
||||
String zmr = Util.null2String(rs.getString("zmr"));
|
||||
String zmrlxfs = Util.null2String(rs.getString("lxfs"));
|
||||
String sfyqyrdwyjjcldgx = Util.null2String(rs.getString("sfyqyrdwyjjcldgx"));
|
||||
String sfyqyrdwywjdflsy = Util.null2String(rs.getString("sfyqyrdwywjdflsy"));
|
||||
String sfyqyrdwydlbmxyyjyxztk = Util.null2String(rs.getString("sfyqyrdwydlbmxyyjyxztk"));
|
||||
|
||||
List<Object> list = new ArrayList<>();
|
||||
list.add(modeuuid);
|
||||
list.add(formmodeid);
|
||||
list.add(modedatacreater);
|
||||
list.add(modedatacreatertype);
|
||||
list.add(modedatacreatedate);
|
||||
list.add(modedatacreatetime);
|
||||
|
||||
list.add(xm);
|
||||
list.add(sfzh);
|
||||
|
||||
list.add(gzdw);
|
||||
list.add(dh);
|
||||
list.add(ksrq);
|
||||
list.add(jsrq);
|
||||
list.add(zw);
|
||||
list.add(zz);
|
||||
list.add(lzxc);
|
||||
list.add(lzyy);
|
||||
|
||||
list.add(zmr);
|
||||
list.add(zmrlxfs);
|
||||
list.add(sfyqyrdwyjjcldgx);
|
||||
list.add(sfyqyrdwywjdflsy);
|
||||
list.add(sfyqyrdwydlbmxyyjyxztk);
|
||||
p.add(list);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(p)) {
|
||||
updateUfgzjlInfo(sfzh, p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新uf_gzjl 工作经历建模表
|
||||
*/
|
||||
private void updateUfgzjlInfo(String sfzh, List<List> p) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute("delete from uf_gzjl where sfzh = '" + sfzh + "'");
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into uf_gzjl(");
|
||||
sb.append("modeuuid,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,");
|
||||
sb.append("xm,sfzh,gzdw,dh,ksrq,jsrq,zw,zz,lzxc,lzyy,zmr,zmrlxfs,sfyqyrdwyjjcldgx,sfyqyrdwywjdflsy,sfyqyrdwydlbmxyyjyxztk");
|
||||
sb.append(")values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
rs.executeBatchSql(sb.toString(), p);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 家庭信息(职员)
|
||||
*
|
||||
* @param id
|
||||
* @param sfzh
|
||||
*/
|
||||
private void updatezyDt3(String id, String ygxm, String sfzh) {
|
||||
BaseBean bb = new BaseBean();
|
||||
String formmodeid = Util.null2String(bb.getPropValue("formmodeid_config", "uf_jtcy_formmodeid"));
|
||||
String modedatacreater = "1"; //模块创建人id
|
||||
String modedatacreatertype = "0"; //创建人类型(插入默认值0即可)
|
||||
String modedatacreatedate = DateUtil.getCurrentTime("yyyy-MM-dd");
|
||||
String modedatacreatetime = DateUtil.getCurrentTime("HH:mm:ss");
|
||||
String modeuuid = UUID.randomUUID().toString();
|
||||
|
||||
List<List> p = new ArrayList<List>();
|
||||
String sql = "select xm,gx,nl,rzdwdzdh from uf_xxwszy_dt3 where mainid = '" + id + "'";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String xm = Util.null2String(rs.getString("xm"));
|
||||
String gx = Util.null2String(rs.getString("gx"));
|
||||
String rzzw = Util.null2String(rs.getString("nl"));
|
||||
String gzdw = Util.null2String(rs.getString("rzdwdzdh"));
|
||||
|
||||
|
||||
List<Object> list = new ArrayList<>();
|
||||
list.add(modeuuid);
|
||||
list.add(formmodeid);
|
||||
list.add(modedatacreater);
|
||||
list.add(modedatacreatertype);
|
||||
list.add(modedatacreatedate);
|
||||
list.add(modedatacreatetime);
|
||||
|
||||
list.add(ygxm);
|
||||
list.add(sfzh);
|
||||
list.add(xm);
|
||||
list.add(gx);
|
||||
list.add(rzzw);
|
||||
list.add(gzdw);
|
||||
p.add(list);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(p)) {
|
||||
updateUfjtcyInfo(sfzh, p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新uf_jtcy 家庭成员建模表
|
||||
*/
|
||||
private void updateUfjtcyInfo(String sfzh, List<List> p) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute("delete from uf_jtcy where sfzh = '" + sfzh + "'");
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into uf_jtcy(");
|
||||
sb.append("modeuuid,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,");
|
||||
sb.append("ygxm,sfzh,xm,gx,rzzw,gzdw");
|
||||
sb.append(")values(?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
rs.executeBatchSql(sb.toString(), p);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 在本公司工作的亲属及朋友(职员)
|
||||
*
|
||||
* @param id
|
||||
* @param sfzh
|
||||
*/
|
||||
private void updatezyDt4(String id, String ygxm, String sfzh) {
|
||||
BaseBean bb = new BaseBean();
|
||||
String formmodeid = Util.null2String(bb.getPropValue("formmodeid_config", "uf_lz_formmodeid"));
|
||||
String modedatacreater = "1"; //模块创建人id
|
||||
String modedatacreatertype = "0"; //创建人类型(插入默认值0即可)
|
||||
String modedatacreatedate = DateUtil.getCurrentTime("yyyy-MM-dd");
|
||||
String modedatacreatetime = DateUtil.getCurrentTime("HH:mm:ss");
|
||||
String modeuuid = UUID.randomUUID().toString();
|
||||
|
||||
List<List> p = new ArrayList<List>();
|
||||
String sql = "select xm,bm,zw,ybrgx from uf_xxwszy_dt4 where mainid = '" + id + "'";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String xm = Util.null2String(rs.getString("xm"));
|
||||
String jxdf = Util.null2String(rs.getString("bm"));
|
||||
String jxjb = Util.null2String(rs.getString("zw"));
|
||||
String jxgjd = Util.null2String(rs.getString("ybrgx"));
|
||||
|
||||
|
||||
List<Object> list = new ArrayList<>();
|
||||
list.add(modeuuid);
|
||||
list.add(formmodeid);
|
||||
list.add(modedatacreater);
|
||||
list.add(modedatacreatertype);
|
||||
list.add(modedatacreatedate);
|
||||
list.add(modedatacreatetime);
|
||||
|
||||
list.add(ygxm);
|
||||
list.add(sfzh);
|
||||
list.add(xm);
|
||||
list.add(jxdf);
|
||||
list.add(jxjb);
|
||||
list.add(jxgjd);
|
||||
p.add(list);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(p)) {
|
||||
updateUflzInfo(sfzh, p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新uf_lz 在本公司工作的亲属及朋友
|
||||
*/
|
||||
private void updateUflzInfo(String sfzh, List<List> p) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute("delete from uf_lz where sfzh = '" + sfzh + "'");
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into uf_lz(");
|
||||
sb.append("modeuuid,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,");
|
||||
sb.append("ygxm,sfzh,xm,jxdf,jxjb,jxgjd");
|
||||
sb.append(")values(?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
rs.executeBatchSql(sb.toString(), p);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 培训经历(职员)
|
||||
*
|
||||
* @param id
|
||||
* @param sfzh
|
||||
*/
|
||||
private void updatezyDt5(String id, String xm, String sfzh) {
|
||||
BaseBean bb = new BaseBean();
|
||||
String formmodeid = Util.null2String(bb.getPropValue("formmodeid_config", "uf_zc_formmodeid"));
|
||||
String modedatacreater = "1"; //模块创建人id
|
||||
String modedatacreatertype = "0"; //创建人类型(插入默认值0即可)
|
||||
String modedatacreatedate = DateUtil.getCurrentTime("yyyy-MM-dd");
|
||||
String modedatacreatetime = DateUtil.getCurrentTime("HH:mm:ss");
|
||||
String modeuuid = UUID.randomUUID().toString();
|
||||
|
||||
List<List> p = new ArrayList<List>();
|
||||
String sql = "select kssj,jssj,dd,pxnr,pxjg,shzs,fjsc from uf_xxwszy_dt5 where mainid = '" + id + "'";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String zchdsj = Util.null2String(rs.getString("kssj"));
|
||||
String jssj = Util.null2String(rs.getString("jssj"));
|
||||
String pxdd = Util.null2String(rs.getString("dd"));
|
||||
String pxsj = Util.null2String(rs.getString("pxnr"));
|
||||
String pxjg = Util.null2String(rs.getString("pxjg"));
|
||||
String shzs = Util.null2String(rs.getString("shzs"));
|
||||
String fj = Util.null2String(rs.getString("fjsc"));
|
||||
|
||||
List<Object> list = new ArrayList<>();
|
||||
list.add(modeuuid);
|
||||
list.add(formmodeid);
|
||||
list.add(modedatacreater);
|
||||
list.add(modedatacreatertype);
|
||||
list.add(modedatacreatedate);
|
||||
list.add(modedatacreatetime);
|
||||
|
||||
list.add(xm);
|
||||
list.add(sfzh);
|
||||
list.add(zchdsj);
|
||||
list.add(jssj);
|
||||
list.add(pxdd);
|
||||
list.add(pxsj);
|
||||
list.add(pxjg);
|
||||
list.add(shzs);
|
||||
list.add(fj);
|
||||
p.add(list);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(p)) {
|
||||
updateUfzcInfo(sfzh, p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新uf_zc 培训经历
|
||||
*/
|
||||
private void updateUfzcInfo(String sfzh, List<List> p) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute("delete from uf_zc where sfzh = '" + sfzh + "'");
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into uf_zc(");
|
||||
sb.append("modeuuid,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,");
|
||||
sb.append("xm,sfzh,zchdsj,jssj,pxdd,pxsj,pxjg,shzs,fj");
|
||||
sb.append(")values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
rs.executeBatchSql(sb.toString(), p);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 教育经历(员工)
|
||||
*
|
||||
* @param id
|
||||
* @param sfzh
|
||||
*/
|
||||
private void updateygDt1(String id, String xm, String sfzh) {
|
||||
BaseBean bb = new BaseBean();
|
||||
String formmodeid = Util.null2String(bb.getPropValue("formmodeid_config", "uf_jyjl_formmodeid"));
|
||||
String modedatacreater = "1"; //模块创建人id
|
||||
String modedatacreatertype = "0"; //创建人类型(插入默认值0即可)
|
||||
String modedatacreatedate = DateUtil.getCurrentTime("yyyy-MM-dd");
|
||||
String modedatacreatetime = DateUtil.getCurrentTime("HH:mm:ss");
|
||||
String modeuuid = UUID.randomUUID().toString();
|
||||
|
||||
List<List> p = new ArrayList<List>();
|
||||
String sql = "select kssj,jssj,xxmc,xxfs,xl,xw,zy from uf_xxwsyg_dt1 where mainid = '" + id + "'";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String kssj = Util.null2String(rs.getString("kssj"));
|
||||
String jssj = Util.null2String(rs.getString("jssj"));
|
||||
String xxmc = Util.null2String(rs.getString("xxmc"));
|
||||
String xxdz = "";
|
||||
String xxfs = Util.null2String(rs.getString("xxfs"));
|
||||
String xl = Util.null2String(rs.getString("xl"));
|
||||
String xw = Util.null2String(rs.getString("xw"));
|
||||
String zy = Util.null2String(rs.getString("zy"));
|
||||
|
||||
List<Object> list = new ArrayList<>();
|
||||
list.add(modeuuid);
|
||||
list.add(formmodeid);
|
||||
list.add(modedatacreater);
|
||||
list.add(modedatacreatertype);
|
||||
list.add(modedatacreatedate);
|
||||
list.add(modedatacreatetime);
|
||||
|
||||
list.add(xm);
|
||||
list.add(sfzh);
|
||||
list.add(kssj);
|
||||
list.add(jssj);
|
||||
list.add(xxmc);
|
||||
list.add(xxdz);
|
||||
list.add(xxfs);
|
||||
list.add(xl);
|
||||
list.add(xw);
|
||||
list.add(zy);
|
||||
p.add(list);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(p)) {
|
||||
updateUfjyjlInfo(sfzh, p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 工作经历(员工)
|
||||
*
|
||||
* @param id
|
||||
* @param sfzh
|
||||
*/
|
||||
private void updateygDt2(String id, String xm, String sfzh) {
|
||||
BaseBean bb = new BaseBean();
|
||||
String formmodeid = Util.null2String(bb.getPropValue("formmodeid_config", "uf_gzjl_formmodeid"));
|
||||
String modedatacreater = "1"; //模块创建人id
|
||||
String modedatacreatertype = "0"; //创建人类型(插入默认值0即可)
|
||||
String modedatacreatedate = DateUtil.getCurrentTime("yyyy-MM-dd");
|
||||
String modedatacreatetime = DateUtil.getCurrentTime("HH:mm:ss");
|
||||
String modeuuid = UUID.randomUUID().toString();
|
||||
|
||||
List<List> p = new ArrayList<List>();
|
||||
String sql = "select gzdwmcdz,dh,kssj,jssj,zw,lzyy,zhxj from uf_xxwsyg_dt2 where mainid = '" + id + "'";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String gzdw = Util.null2String(rs.getString("gzdwmcdz"));
|
||||
String dh = Util.null2String(rs.getString("dh"));
|
||||
String ksrq = Util.null2String(rs.getString("kssj"));
|
||||
String jsrq = Util.null2String(rs.getString("jssj"));
|
||||
String zw = Util.null2String(rs.getString("zw"));
|
||||
String zz = "";
|
||||
String lzxc = Util.null2String(rs.getString("zhxj"));
|
||||
String lzyy = Util.null2String(rs.getString("lzyy"));
|
||||
String zmr = "";
|
||||
String zmrlxfs = "";
|
||||
String sfyqyrdwyjjcldgx = "";
|
||||
String sfyqyrdwywjdflsy = "";
|
||||
String sfyqyrdwydlbmxyyjyxztk = "";
|
||||
|
||||
List<Object> list = new ArrayList<>();
|
||||
list.add(modeuuid);
|
||||
list.add(formmodeid);
|
||||
list.add(modedatacreater);
|
||||
list.add(modedatacreatertype);
|
||||
list.add(modedatacreatedate);
|
||||
list.add(modedatacreatetime);
|
||||
|
||||
list.add(xm);
|
||||
list.add(sfzh);
|
||||
|
||||
list.add(gzdw);
|
||||
list.add(dh);
|
||||
list.add(ksrq);
|
||||
list.add(jsrq);
|
||||
list.add(zw);
|
||||
list.add(zz);
|
||||
list.add(lzxc);
|
||||
list.add(lzyy);
|
||||
|
||||
list.add(zmr);
|
||||
list.add(zmrlxfs);
|
||||
list.add(sfyqyrdwyjjcldgx);
|
||||
list.add(sfyqyrdwywjdflsy);
|
||||
list.add(sfyqyrdwydlbmxyyjyxztk);
|
||||
p.add(list);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(p)) {
|
||||
updateUfgzjlInfo(sfzh, p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 家庭信息(员工)
|
||||
*
|
||||
* @param id
|
||||
* @param sfzh
|
||||
*/
|
||||
private void updateygDt3(String id, String ygxm, String sfzh) {
|
||||
BaseBean bb = new BaseBean();
|
||||
String formmodeid = Util.null2String(bb.getPropValue("formmodeid_config", "uf_jtcy_formmodeid"));
|
||||
String modedatacreater = "1"; //模块创建人id
|
||||
String modedatacreatertype = "0"; //创建人类型(插入默认值0即可)
|
||||
String modedatacreatedate = DateUtil.getCurrentTime("yyyy-MM-dd");
|
||||
String modedatacreatetime = DateUtil.getCurrentTime("HH:mm:ss");
|
||||
String modeuuid = UUID.randomUUID().toString();
|
||||
|
||||
List<List> p = new ArrayList<List>();
|
||||
String sql = "select xm,gx,nl,rzdwdzdh from uf_xxwsyg_dt3 where mainid = '" + id + "'";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String xm = Util.null2String(rs.getString("xm"));
|
||||
String gx = Util.null2String(rs.getString("gx"));
|
||||
String rzzw = Util.null2String(rs.getString("nl"));
|
||||
String gzdw = Util.null2String(rs.getString("rzdwdzdh"));
|
||||
|
||||
|
||||
List<Object> list = new ArrayList<>();
|
||||
list.add(modeuuid);
|
||||
list.add(formmodeid);
|
||||
list.add(modedatacreater);
|
||||
list.add(modedatacreatertype);
|
||||
list.add(modedatacreatedate);
|
||||
list.add(modedatacreatetime);
|
||||
|
||||
list.add(ygxm);
|
||||
list.add(sfzh);
|
||||
list.add(xm);
|
||||
list.add(gx);
|
||||
list.add(rzzw);
|
||||
list.add(gzdw);
|
||||
p.add(list);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(p)) {
|
||||
updateUfjtcyInfo(sfzh, p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新职员 人力资源数据
|
||||
*
|
||||
* @param sfzhm
|
||||
* @param sex
|
||||
* @param birthday
|
||||
* @param jg
|
||||
* @param healthinfo
|
||||
* @param folk
|
||||
* @param maritalstatus
|
||||
* @param jtzz
|
||||
* @param residentplace
|
||||
* @param mobile
|
||||
* @param email
|
||||
* @param qq
|
||||
* @param wx
|
||||
* @param jjlxrxm
|
||||
* @param ybrgx
|
||||
* @param dz
|
||||
* @param dh
|
||||
* @param jsjnl
|
||||
* @param educationlevel
|
||||
* @param jgs
|
||||
* @param zy
|
||||
*/
|
||||
private void updatezyHrmData(String sfzhm, String sex, String birthday, String jg, String healthinfo, String folk, String maritalstatus, String jtzz, String residentplace, String mobile, String email, String qq, String wx, String jjlxrxm, String ybrgx, String dz, String dh, String jsjnl, String educationlevel, String jgs, String zy) {
|
||||
if (StringUtils.isBlank(sfzhm)) return;
|
||||
String userid = getUserId(sfzhm);
|
||||
if (StringUtils.isBlank(userid)) return;
|
||||
RecordSet rs = new RecordSet();
|
||||
int age = countAge(sfzhm);
|
||||
String sql = "update hrmresource set sex = ?,birthday = ?,healthinfo = ?,folk = ?,maritalstatus = ?,residentplace = ?,mobile = ?,email = ?,educationlevel = ? where id = ?";
|
||||
rs.executeUpdate(sql, sex, birthday, healthinfo, folk, maritalstatus, residentplace, mobile, email, educationlevel, userid);
|
||||
//基本信息-自定义字段
|
||||
int count = 0;
|
||||
sql = "select count(1) as sl from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid= -1 and id = '" + userid + "'";
|
||||
rs.execute(sql);
|
||||
rs.next();
|
||||
count = Util.getIntValue(rs.getString("sl"));
|
||||
if (count > 0) {
|
||||
sql = "update cus_fielddata set field7 = ?,field8 = ?,field10 = ? where scope='HrmCustomFieldByInfoType' and scopeid= -1 and id = '" + userid + "'";
|
||||
rs.executeUpdate(sql, birthday, qq, wx);
|
||||
} else {
|
||||
sql = "insert into cus_fielddata (id,scope,scopeid,field7,field8,field10) values (?,?,?,?,?,?)";
|
||||
rs.executeUpdate(sql, userid, "HrmCustomFieldByInfoType", "-1", birthday, qq, wx);
|
||||
}
|
||||
|
||||
//个人信息-自定义字段
|
||||
sql = "select count(1) as sl from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid= 1 and id = '" + userid + "'";
|
||||
rs.execute(sql);
|
||||
rs.next();
|
||||
count = Util.getIntValue(rs.getString("sl"));
|
||||
if (count > 0) {
|
||||
sql = "update cus_fielddata set field45 = ?,field42 = ?,field15 = ?,field6 = ?,field8 = ?,field9 = ?,field10 = ?,field34 = ?,field64 = ?,field23 = ? where scope='HrmCustomFieldByInfoType' and scopeid= 1 and id = '" + userid + "'";
|
||||
rs.executeUpdate(sql, age, jg, jtzz, jjlxrxm, ybrgx, dz, dh, jsjnl, jgs, zy);
|
||||
} else {
|
||||
sql = "insert into cus_fielddata (id,scope,scopeid,field42,field15,field6,field8,field9,field10,field34,field64,field23,field45) values (?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
rs.executeUpdate(sql, userid, "HrmCustomFieldByInfoType", "1", jg, jtzz, jjlxrxm, ybrgx, dz, dh, jsjnl, jgs, zy, age);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 身份证号获取用户id
|
||||
*
|
||||
* @param sfzh
|
||||
* @return
|
||||
*/
|
||||
private String getUserId(String sfzh) {
|
||||
String sql = "select id from hrmresource where certificatenum = '" + sfzh + "' and status not in (4,5,6,7)";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
rs.next();
|
||||
String userid = Util.null2String(rs.getString("id"));
|
||||
return userid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新员工人力资源信息
|
||||
*
|
||||
* @param jg2
|
||||
* @param sex
|
||||
* @param healthinfo
|
||||
* @param birthday
|
||||
* @param certificatenum
|
||||
* @param folk
|
||||
* @param sg
|
||||
* @param maritalstatus
|
||||
* @param mobile
|
||||
* @param sfzdz
|
||||
* @param sfzs
|
||||
* @param residentplace
|
||||
* @param jsjyysp
|
||||
* @param educationlevel
|
||||
* @param yy1
|
||||
* @param yy
|
||||
* @param qzfs
|
||||
* @param qtyy
|
||||
* @param jsr
|
||||
* @param lrgx
|
||||
* @param jntc
|
||||
* @param bm
|
||||
* @param jjlxr
|
||||
* @param jjlxrgx
|
||||
* @param jjlxrdh
|
||||
* @param zy
|
||||
* @param jsrlxfs
|
||||
* @param jjlxrdz
|
||||
* @param jjlxrybrgx
|
||||
*/
|
||||
|
||||
private void updateygHrmData(String jg2, String sex, String healthinfo, String birthday, String certificatenum, String folk, String sg, String maritalstatus, String mobile, String sfzdz, String sfzs, String residentplace, String jsjyysp, String educationlevel, String yy1, String yy, String qzfs, String qtyy, String jsr, String lrgx, String jntc, String bm, String jjlxr, String jjlxrgx, String jjlxrdh, String zy, String jsrlxfs, String jjlxrdz, String jjlxrybrgx) {
|
||||
if (StringUtils.isBlank(certificatenum)) return;
|
||||
String userid = getUserId(certificatenum);
|
||||
if (StringUtils.isBlank(userid)) return;
|
||||
|
||||
|
||||
int age = countAge(certificatenum);
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "update hrmresource set sex = ?,healthinfo = ?,birthday = ?,folk = ?,maritalstatus = ?,mobile = ?,residentplace = ?,educationlevel = ? where id = ?";
|
||||
rs.executeUpdate(sql, sex, healthinfo, birthday, folk, maritalstatus, mobile, residentplace, educationlevel, userid);
|
||||
|
||||
//基本信息-自定义字段
|
||||
int count = 0;
|
||||
sql = "select count(1) as sl from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid= -1 and id = '" + userid + "'";
|
||||
rs.execute(sql);
|
||||
rs.next();
|
||||
count = weaver.general.Util.getIntValue(rs.getString("sl"));
|
||||
if (count > 0) {
|
||||
sql = "update cus_fielddata set field7 = ? where scope='HrmCustomFieldByInfoType' and scopeid= -1 and id = '" + userid + "'";
|
||||
rs.executeUpdate(sql, birthday);
|
||||
} else {
|
||||
sql = "insert into cus_fielddata (id,scope,scopeid,field7) values (?,?,?,?)";
|
||||
rs.executeUpdate(sql, userid, "HrmCustomFieldByInfoType", "-1", birthday);
|
||||
}
|
||||
|
||||
|
||||
//个人信息-自定义字段
|
||||
sql = "select count(1) as sl from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid= 1 and id = '" + userid + "'";
|
||||
rs.execute(sql);
|
||||
rs.next();
|
||||
count = weaver.general.Util.getIntValue(rs.getString("sl"));
|
||||
if (count > 0) {
|
||||
//field42,field43,field15,field40,field34,field35,field36,field39,field14,field11,field13,field16,field41,field6,field8,field10,field23,field12,field9,field8,,,,,,,,,,,,,,,,,,,,,
|
||||
sql = "update cus_fielddata set field45 = ?,field42 = ?,field43 = ?,field15 = ?,field40 = ?,field34 = ?,field35 = ?,field36 = ?,field39 = ?,field14 = ?,field11 = ?,field13 = ?,field16 = ?,field41 = ?,field6 = ?,field10 = ?,field23 = ?,field12 = ?,field9 = ?,field8 = ? where scope='HrmCustomFieldByInfoType' and scopeid= 1 and id = '" + userid + "'";
|
||||
rs.executeUpdate(sql, age, jg2, sg, sfzdz, sfzs, jsjyysp, yy1, yy, qzfs, qtyy, jsr, lrgx, jntc, bm, jjlxr, jjlxrdh, zy, jsrlxfs, jjlxrdz, jjlxrybrgx);
|
||||
} else {
|
||||
sql = "insert into cus_fielddata (id,scope,scopeid,field42,field43,field15,field40,field34,field35,field36,field39,field14,field11,field13,field16,field41,field6,field10,field23,field12,field9,field8,field45) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
rs.executeUpdate(sql, userid, "HrmCustomFieldByInfoType", "1", jg2, sg, sfzdz, sfzs, jsjyysp, yy1, yy, qzfs, qtyy, jsr, lrgx, jntc, bm, jjlxr, jjlxrdh, zy, jsrlxfs, jjlxrdz, jjlxrybrgx, age);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String getSelectNullValue(String value) {
|
||||
if ("".equals(value)) {
|
||||
return null;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 身份证号 获取年龄
|
||||
*
|
||||
* @param idCard
|
||||
* @return
|
||||
*/
|
||||
private int countAge(String idCard) {
|
||||
if (idCard.length() != 18 && idCard.length() != 15) {
|
||||
throw new IllegalArgumentException("身份证号长度错误");
|
||||
}
|
||||
String year;
|
||||
String monthDay;
|
||||
if (idCard.length() == 18) {
|
||||
year = idCard.substring(6, 10);
|
||||
monthDay = idCard.substring(10, 14);
|
||||
} else {
|
||||
year = "19" + idCard.substring(6, 8);
|
||||
monthDay = idCard.substring(8, 12);
|
||||
}
|
||||
//获取当前时间字符串如:2022-1128
|
||||
String nowTimeStr = new SimpleDateFormat("yyyy-MMdd").format(new Date());
|
||||
String yearNow = nowTimeStr.substring(0, 4);// 当前年份
|
||||
String monthDayNow = nowTimeStr.substring(5, 9);// 当前月日
|
||||
int age = Integer.parseInt(yearNow) - Integer.parseInt(year);
|
||||
//age减一的情况 :用户月日大于当前月日(开头可以为0的4位数int)
|
||||
if (Integer.parseInt(monthDay) > Integer.parseInt(monthDayNow)) {
|
||||
age = age - 1;
|
||||
}
|
||||
return age;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,521 @@
|
|||
package com.engine.kq.biz.chain.cominfo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ShiftInfoCominfoBean implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -1735765502081116461L;
|
||||
|
||||
/**
|
||||
* 当前班次如果是作为前一个班次存在,跨到次日的工作时段
|
||||
*/
|
||||
private List<String[]> preWorkTime;
|
||||
|
||||
/**
|
||||
* 当前班次作为当前班次存在,在0-24小时内的工作时段
|
||||
*/
|
||||
private List<String[]> workTime;
|
||||
|
||||
/**
|
||||
* 当前班次作为当前班次存在,如果存在跨天的话,包含跨天的工作时段,显示成0-24小时的
|
||||
*/
|
||||
private List<String[]> workAcrossTime;
|
||||
|
||||
|
||||
/**
|
||||
* 当前班次如果是作为前一个班次存在,跨到次日的工作时段
|
||||
*/
|
||||
private List<int[]> preWorkTimeIndex;
|
||||
|
||||
/**
|
||||
* 当前班次作为当前班次存在,在0-24小时内的工作时段
|
||||
*/
|
||||
private List<int[]> workTimeIndex;
|
||||
|
||||
/**
|
||||
* 当前班次作为当前班次存在,在0-48小时内的工作时段下标
|
||||
*/
|
||||
private List<int[]> workLongTimeIndex;
|
||||
|
||||
/**
|
||||
* 当前班次作为当前班次存在,在0-48小时内的工作时段下标
|
||||
*/
|
||||
private List<int[]> restLongTimeIndex;
|
||||
|
||||
/**
|
||||
* 存储所有的工作时间 48小时制休息时段
|
||||
*/
|
||||
private List<String> allLongWorkTime;
|
||||
|
||||
/**
|
||||
* 当前班次作为当前班次存在,如果存在跨天的话,包含跨天的工作时段,显示成0-24小时的
|
||||
*/
|
||||
private List<int[]> workAcrossTimeIndex;
|
||||
|
||||
/**
|
||||
* 考勤报表用的 48小时制工作时段
|
||||
*/
|
||||
private List<Map<String,String>> workAcrossLongTime;
|
||||
|
||||
/**
|
||||
* 当天打卡时段时间:多少分钟可以开始签到签退的
|
||||
*/
|
||||
private List<String[][]> workPunchMins;
|
||||
|
||||
/**
|
||||
* 当前班次如果是作为前一个班次存在,跨到次日的休息时段
|
||||
*/
|
||||
private List<String[]> preRestTime;
|
||||
|
||||
/**
|
||||
* 当前班次作为当前班次存在,在0-24小时内的休息时段
|
||||
*/
|
||||
private List<String[]> restTime;
|
||||
|
||||
/**
|
||||
* 当前班次作为当前班次存在,如果存在跨r天的话,包含跨天的休息时段,显示成0-24小时的
|
||||
*/
|
||||
private List<String[]> restAcrossTime;
|
||||
/**
|
||||
* 当前班次如果是作为前一个班次存在,跨到次日的休息时段
|
||||
*/
|
||||
private List<int[]> preRestTimeIndex;
|
||||
|
||||
/**
|
||||
* 当前班次作为当前班次存在,在0-24小时内的休息时段
|
||||
*/
|
||||
private List<int[]> restTimeIndex;
|
||||
|
||||
/**
|
||||
* 当前班次作为当前班次存在,如果存在跨r天的话,包含跨天的休息时段,显示成0-24小时的
|
||||
*/
|
||||
private List<int[]> restAcrossTimeIndex;
|
||||
|
||||
/**
|
||||
* 考勤报表用的 48小时制休息时段
|
||||
*/
|
||||
private List<Map<String,String>> restAcrossLongTime;
|
||||
|
||||
/**
|
||||
* 要返回的半天规则时间区间对应的数组下标
|
||||
* 这里有值的话是三个,最早的开始时间 中间时间 最晚的下班时间
|
||||
*/
|
||||
private List<String> halfWorkTime;
|
||||
|
||||
/**
|
||||
* 要返回的半天规则时间区间对应的数组下标
|
||||
* 这里有值的话是三个,最早的开始时间 中间时间 最晚的下班时间
|
||||
*/
|
||||
private List<int[]> halfWorkIndex;
|
||||
|
||||
/**
|
||||
* 存储所有的工作时间
|
||||
*/
|
||||
private List<String> allWorkTime;
|
||||
|
||||
/**
|
||||
* 存储所有的跨天时间
|
||||
*/
|
||||
private List<String> allAcrossWorkTime;
|
||||
/**
|
||||
* 存储所有的休息时间
|
||||
*/
|
||||
private List<String> allRestTime;
|
||||
|
||||
/**
|
||||
* 存储所有的休息时间
|
||||
*/
|
||||
private List<String> allAcrossRestTime;
|
||||
|
||||
/**
|
||||
* 存储每一段工作时段内的工作时长
|
||||
*/
|
||||
private List<Integer> eachWorkMins;
|
||||
|
||||
/**
|
||||
* 工作时长
|
||||
*/
|
||||
private int workmins;
|
||||
|
||||
/**
|
||||
* 当前日期的班次
|
||||
*/
|
||||
private String serialid;
|
||||
|
||||
/**
|
||||
* 判断当前班次是否存在跨天
|
||||
*/
|
||||
private String isAcross;
|
||||
|
||||
/**
|
||||
* 半天计算规则
|
||||
*/
|
||||
private String halfcalrule;
|
||||
|
||||
/**
|
||||
* 自定义 半天计算规则 时间点
|
||||
*/
|
||||
private String halfcalpoint;
|
||||
|
||||
private String halfcalpoint2cross;
|
||||
|
||||
private List<Object> timelineList;
|
||||
|
||||
/**
|
||||
* 允许签到签退的时段范围
|
||||
*/
|
||||
private List<Map<String,String>> signWorkTime;
|
||||
|
||||
/**
|
||||
* 存储所有的工作时间是否跨天 和allWorkTime对应
|
||||
*/
|
||||
private List<String> allWorkTimeisAcross;
|
||||
|
||||
private String uuid = "";
|
||||
|
||||
/**
|
||||
* 应出勤折算天数
|
||||
*/
|
||||
private String convertAttendDay = "";
|
||||
|
||||
public ShiftInfoCominfoBean() {
|
||||
|
||||
this.preWorkTime = new ArrayList<>();
|
||||
this.workTime = new ArrayList<>();
|
||||
this.workAcrossTime = new ArrayList<>();
|
||||
this.preWorkTimeIndex = new ArrayList<>();
|
||||
this.workTimeIndex = new ArrayList<>();
|
||||
this.workAcrossTimeIndex = new ArrayList<>();
|
||||
this.workAcrossLongTime = new ArrayList<>();
|
||||
this.workPunchMins = new ArrayList<>();
|
||||
this.preRestTime = new ArrayList<>();
|
||||
this.restTime = new ArrayList<>();
|
||||
this.restAcrossTime = new ArrayList<>();
|
||||
this.preRestTimeIndex = new ArrayList<>();
|
||||
this.restTimeIndex = new ArrayList<>();
|
||||
this.restAcrossTimeIndex = new ArrayList<>();
|
||||
this.restAcrossLongTime = new ArrayList<>();
|
||||
this.halfWorkTime = new ArrayList<>();
|
||||
this.allWorkTime = new ArrayList<>();
|
||||
this.allAcrossWorkTime = new ArrayList<>();
|
||||
this.allRestTime = new ArrayList<>();
|
||||
this.allAcrossRestTime = new ArrayList<>();
|
||||
this.eachWorkMins = new ArrayList<>();
|
||||
this.workmins = 0;
|
||||
this.serialid = "";
|
||||
this.isAcross = "0";
|
||||
this.halfcalrule = "0";
|
||||
this.halfWorkIndex = new ArrayList<>();
|
||||
|
||||
this.timelineList = new ArrayList<>();
|
||||
|
||||
this.workLongTimeIndex = new ArrayList<>();
|
||||
this.restLongTimeIndex = new ArrayList<>();
|
||||
this.allLongWorkTime = new ArrayList<>();
|
||||
this.signWorkTime = new ArrayList<>();
|
||||
this.allWorkTimeisAcross = new ArrayList<>();
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.halfcalpoint = "0";
|
||||
this.halfcalpoint2cross = "0";
|
||||
}
|
||||
|
||||
public List<String[]> getPreWorkTime() {
|
||||
return preWorkTime;
|
||||
}
|
||||
|
||||
public void setPreWorkTime(List<String[]> preWorkTime) {
|
||||
this.preWorkTime = preWorkTime;
|
||||
}
|
||||
|
||||
public List<String[]> getWorkTime() {
|
||||
return workTime;
|
||||
}
|
||||
|
||||
public void setWorkTime(List<String[]> workTime) {
|
||||
this.workTime = workTime;
|
||||
}
|
||||
|
||||
public List<String[]> getWorkAcrossTime() {
|
||||
return workAcrossTime;
|
||||
}
|
||||
|
||||
public void setWorkAcrossTime(List<String[]> workAcrossTime) {
|
||||
this.workAcrossTime = workAcrossTime;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getWorkAcrossLongTime() {
|
||||
return workAcrossLongTime;
|
||||
}
|
||||
|
||||
public void setWorkAcrossLongTime(
|
||||
List<Map<String, String>> workAcrossLongTime) {
|
||||
this.workAcrossLongTime = workAcrossLongTime;
|
||||
}
|
||||
|
||||
public List<String[][]> getWorkPunchMins() {
|
||||
return workPunchMins;
|
||||
}
|
||||
|
||||
public void setWorkPunchMins(List<String[][]> workPunchMins) {
|
||||
this.workPunchMins = workPunchMins;
|
||||
}
|
||||
|
||||
public List<String> getHalfWorkTime() {
|
||||
return halfWorkTime;
|
||||
}
|
||||
|
||||
public void setHalfWorkTime(List<String> halfWorkTime) {
|
||||
this.halfWorkTime = halfWorkTime;
|
||||
}
|
||||
|
||||
public int getWorkmins() {
|
||||
return workmins;
|
||||
}
|
||||
|
||||
public void setWorkmins(int workmins) {
|
||||
this.workmins = workmins;
|
||||
}
|
||||
|
||||
public String getSerialid() {
|
||||
return serialid;
|
||||
}
|
||||
|
||||
public void setSerialid(String serialid) {
|
||||
this.serialid = serialid;
|
||||
}
|
||||
|
||||
public List<String> getAllWorkTime() {
|
||||
return allWorkTime;
|
||||
}
|
||||
|
||||
public void setAllWorkTime(List<String> allWorkTime) {
|
||||
this.allWorkTime = allWorkTime;
|
||||
}
|
||||
|
||||
public List<String> getAllAcrossWorkTime() {
|
||||
return allAcrossWorkTime;
|
||||
}
|
||||
|
||||
public void setAllAcrossWorkTime(List<String> allAcrossWorkTime) {
|
||||
this.allAcrossWorkTime = allAcrossWorkTime;
|
||||
}
|
||||
|
||||
public List<String[]> getRestTime() {
|
||||
return restTime;
|
||||
}
|
||||
|
||||
public void setRestTime(List<String[]> restTime) {
|
||||
this.restTime = restTime;
|
||||
}
|
||||
|
||||
public String getIsAcross() {
|
||||
return isAcross;
|
||||
}
|
||||
|
||||
public void setIsAcross(String isAcross) {
|
||||
this.isAcross = isAcross;
|
||||
}
|
||||
|
||||
public List<String[]> getPreRestTime() {
|
||||
return preRestTime;
|
||||
}
|
||||
|
||||
public void setPreRestTime(List<String[]> preRestTime) {
|
||||
this.preRestTime = preRestTime;
|
||||
}
|
||||
|
||||
public List<String[]> getRestAcrossTime() {
|
||||
return restAcrossTime;
|
||||
}
|
||||
|
||||
public void setRestAcrossTime(List<String[]> restAcrossTime) {
|
||||
this.restAcrossTime = restAcrossTime;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getRestAcrossLongTime() {
|
||||
return restAcrossLongTime;
|
||||
}
|
||||
|
||||
public void setRestAcrossLongTime(
|
||||
List<Map<String, String>> restAcrossLongTime) {
|
||||
this.restAcrossLongTime = restAcrossLongTime;
|
||||
}
|
||||
|
||||
public List<String> getAllRestTime() {
|
||||
return allRestTime;
|
||||
}
|
||||
|
||||
public void setAllRestTime(List<String> allRestTime) {
|
||||
this.allRestTime = allRestTime;
|
||||
}
|
||||
|
||||
public List<String> getAllAcrossRestTime() {
|
||||
return allAcrossRestTime;
|
||||
}
|
||||
|
||||
public void setAllAcrossRestTime(List<String> allAcrossRestTime) {
|
||||
this.allAcrossRestTime = allAcrossRestTime;
|
||||
}
|
||||
|
||||
public List<Integer> getEachWorkMins() {
|
||||
return eachWorkMins;
|
||||
}
|
||||
|
||||
public void setEachWorkMins(List<Integer> eachWorkMins) {
|
||||
this.eachWorkMins = eachWorkMins;
|
||||
}
|
||||
|
||||
public List<int[]> getPreWorkTimeIndex() {
|
||||
return preWorkTimeIndex;
|
||||
}
|
||||
|
||||
public void setPreWorkTimeIndex(List<int[]> preWorkTimeIndex) {
|
||||
this.preWorkTimeIndex = preWorkTimeIndex;
|
||||
}
|
||||
|
||||
public List<int[]> getWorkTimeIndex() {
|
||||
return workTimeIndex;
|
||||
}
|
||||
|
||||
public void setWorkTimeIndex(List<int[]> workTimeIndex) {
|
||||
this.workTimeIndex = workTimeIndex;
|
||||
}
|
||||
|
||||
public List<int[]> getWorkAcrossTimeIndex() {
|
||||
return workAcrossTimeIndex;
|
||||
}
|
||||
|
||||
public void setWorkAcrossTimeIndex(List<int[]> workAcrossTimeIndex) {
|
||||
this.workAcrossTimeIndex = workAcrossTimeIndex;
|
||||
}
|
||||
|
||||
public List<int[]> getPreRestTimeIndex() {
|
||||
return preRestTimeIndex;
|
||||
}
|
||||
|
||||
public void setPreRestTimeIndex(List<int[]> preRestTimeIndex) {
|
||||
this.preRestTimeIndex = preRestTimeIndex;
|
||||
}
|
||||
|
||||
public List<int[]> getRestTimeIndex() {
|
||||
return restTimeIndex;
|
||||
}
|
||||
|
||||
public void setRestTimeIndex(List<int[]> restTimeIndex) {
|
||||
this.restTimeIndex = restTimeIndex;
|
||||
}
|
||||
|
||||
public List<int[]> getRestAcrossTimeIndex() {
|
||||
return restAcrossTimeIndex;
|
||||
}
|
||||
|
||||
public void setRestAcrossTimeIndex(List<int[]> restAcrossTimeIndex) {
|
||||
this.restAcrossTimeIndex = restAcrossTimeIndex;
|
||||
}
|
||||
|
||||
public List<int[]> getHalfWorkIndex() {
|
||||
return halfWorkIndex;
|
||||
}
|
||||
|
||||
public void setHalfWorkIndex(List<int[]> halfWorkIndex) {
|
||||
this.halfWorkIndex = halfWorkIndex;
|
||||
}
|
||||
|
||||
public List<Object> getTimelineList() {
|
||||
return timelineList;
|
||||
}
|
||||
|
||||
public void setTimelineList(List<Object> timelineList) {
|
||||
this.timelineList = timelineList;
|
||||
}
|
||||
|
||||
public List<int[]> getWorkLongTimeIndex() {
|
||||
return workLongTimeIndex;
|
||||
}
|
||||
|
||||
public void setWorkLongTimeIndex(List<int[]> workLongTimeIndex) {
|
||||
this.workLongTimeIndex = workLongTimeIndex;
|
||||
}
|
||||
|
||||
public List<int[]> getRestLongTimeIndex() {
|
||||
return restLongTimeIndex;
|
||||
}
|
||||
|
||||
public void setRestLongTimeIndex(List<int[]> restLongTimeIndex) {
|
||||
this.restLongTimeIndex = restLongTimeIndex;
|
||||
}
|
||||
|
||||
public List<String> getAllLongWorkTime() {
|
||||
return allLongWorkTime;
|
||||
}
|
||||
|
||||
public void setAllLongWorkTime(List<String> allLongWorkTime) {
|
||||
this.allLongWorkTime = allLongWorkTime;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getSignWorkTime() {
|
||||
return signWorkTime;
|
||||
}
|
||||
|
||||
public void setSignWorkTime(
|
||||
List<Map<String, String>> signWorkTime) {
|
||||
this.signWorkTime = signWorkTime;
|
||||
}
|
||||
|
||||
public List<String> getAllWorkTimeisAcross() {
|
||||
return allWorkTimeisAcross;
|
||||
}
|
||||
|
||||
public void setAllWorkTimeisAcross(List<String> allWorkTimeisAcross) {
|
||||
this.allWorkTimeisAcross = allWorkTimeisAcross;
|
||||
}
|
||||
|
||||
public String getHalfcalrule() {
|
||||
return halfcalrule;
|
||||
}
|
||||
|
||||
public void setHalfcalrule(String halfcalrule) {
|
||||
this.halfcalrule = halfcalrule;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getHalfcalpoint() {
|
||||
return halfcalpoint;
|
||||
}
|
||||
|
||||
public void setHalfcalpoint(String halfcalpoint) {
|
||||
this.halfcalpoint = halfcalpoint;
|
||||
}
|
||||
|
||||
public String getHalfcalpoint2cross() {
|
||||
return halfcalpoint2cross;
|
||||
}
|
||||
|
||||
public void setHalfcalpoint2cross(String halfcalpoint2cross) {
|
||||
this.halfcalpoint2cross = halfcalpoint2cross;
|
||||
}
|
||||
|
||||
public String getConvertAttendDay() {
|
||||
return convertAttendDay;
|
||||
}
|
||||
|
||||
public void setConvertAttendDay(String convertAttendDay) {
|
||||
this.convertAttendDay = convertAttendDay;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,745 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import java.math.BigDecimal;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public GetKQDailyReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQDailyReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
boolean isDaily = kqReportFieldComInfo.getReportType().equals("daily");
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !isDaily)continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
if(kqReportFieldComInfo.getReportType1().equals("daily")){
|
||||
column.put("isdaily", "1");
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
// String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")&&!Util.null2String(rs.getOrgindbtype()).equals("jc")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
|
||||
String backFields = "(select xxb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as xxb,(select zrbtjbzdx*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjbztx,(select gzsc from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as gzsc,(select psjbshic*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as psjbsc,b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb,(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb," +
|
||||
"(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb,(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs," +
|
||||
"(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts,(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts," +
|
||||
"(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts,(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts," +
|
||||
"(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs,(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm,(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm,(select sum(sch*60) from uf_jbsqhz where sqr = a.id and ksrq = b.kqdate and jblx in (0,1,2,3)) as jbsq," +
|
||||
"a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
|
||||
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
|
||||
" b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism ,b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
//考勤异常状态
|
||||
String KQstatus = Util.null2String(jsonObj.get("KQstatus"));
|
||||
if ("5".equals(KQstatus)){
|
||||
|
||||
}else if ("1".equals(KQstatus)){
|
||||
sqlWhere += " and (absenteeismMins > 0 or forgotCheck > 0) ";
|
||||
}else if ("2".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0) ";
|
||||
}else if ("3".equals(KQstatus)){
|
||||
sqlWhere += " and (b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0) ";
|
||||
}else if ("4".equals(KQstatus)){
|
||||
sqlWhere +=" and forgotCheck > 0 ";
|
||||
}else if ("6".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins = 0 and b.graveBeLateMins = 0 and b.leaveEarlyMins = 0 and b.graveLeaveEarlyMins = 0 and absenteeismMins = 0 and forgotCheck = 0)";
|
||||
}else if ("7".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0 or b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0 or absenteeismMins > 0 or forgotCheck > 0)";
|
||||
}
|
||||
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc, b.kqdate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc, b.kqdate desc ";
|
||||
sql = backFields + sqlFrom + sqlWhere + orderBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + pageSize+ " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc, kqdate asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc, kqdate desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql+" ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(id, kqdate);
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1")) continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))
|
||||
continue;
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String fieldValueID = rs.getString("subcompanyid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
//fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getSubCompanyID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String fieldValueID = rs.getString("departmentid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
//fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getDepartmentID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String fieldValueID = rs.getString("jobtitle");
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle"));
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getJobTitle(id);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("cardOvertime")) {
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
Double zlMinsNew = Util.getDoubleValue(fieldValue);
|
||||
String skjbcsy = divide(String.valueOf(changeBxs(zlMinsNew.intValue())),"60");
|
||||
fieldValue = skjbcsy;
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("xqNew")) {
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (kqReportFieldComInfo.getParentid().equals("overtime") || kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
|
||||
if (fieldName.equals("overtimeTotal")) {
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave < 0 ? 0 : restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
} else {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("serialid")) {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (fieldValue.length()>0) {//弹性工作制没有班次
|
||||
// data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(fieldValue)){
|
||||
data.put("serialid", serialdata.get(fieldValue));
|
||||
}else{
|
||||
String tmpserialname = shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage());
|
||||
serialdata.put(fieldValue,tmpserialname);
|
||||
data.put("serialid", tmpserialname);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
data.putAll(this.getSignDetailInfo(id, kqdate));
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
kqLog.info("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.put(flowType, flowLeaveData);
|
||||
}
|
||||
|
||||
data.put("resourceId", id);
|
||||
data.put("kqdate", kqdate);
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
private String getUnitType(String unitType, User user){
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
return unitTypeName;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily")?"1":"0");
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,day_type,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
String dayType = Util.null2s(rs.getString("day_type"),"");
|
||||
int workMins = rs.getInt("workMins");
|
||||
boolean isNonWork = false;
|
||||
if(dayType.length() > 0){
|
||||
if("holiday".equals(dayType) || "playday".equals(dayType)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}else{
|
||||
if(workMins<=0){
|
||||
isNonWork = true;
|
||||
}else{
|
||||
if(serialid.length() > 0){
|
||||
String isRest = Util.null2s(kqShiftManagementComInfo.getIsRest(serialid),"");
|
||||
if("1".equals(isRest)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(!isNonWork){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 半小时转换
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static Integer changeBxs(Integer value){
|
||||
return (value / 30)*30 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的除法运算。
|
||||
* @param v1 被加数
|
||||
* @param v2 加数
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static String divide(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.divide(b2,2,BigDecimal.ROUND_HALF_UP).toString();
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,238 @@
|
|||
package com.engine.kq.cmd.holidaySet;
|
||||
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
import com.api.hrm.bean.HrmFieldBean;
|
||||
import com.api.hrm.util.HrmFieldSearchConditionComInfo;
|
||||
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 weaver.conn.RecordSet;
|
||||
import weaver.filter.XssUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.country.CountryComInfo;
|
||||
import weaver.hrm.moduledetach.ManageDetachComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import weaver.systeminfo.systemright.CheckSubCompanyRight;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 节假日设置--新建或编辑的表单
|
||||
*/
|
||||
public class GetHolidaySetFormCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetHolidaySetFormCmd(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>();
|
||||
String id = Util.null2String(params.get("id"));//ID
|
||||
String groupId = Util.null2String(params.get("groupId"));//考勤组的ID
|
||||
String holidayDate = Util.null2String(params.get("holidayDate"));//节假日日期
|
||||
String holidayDesc = "";//说明
|
||||
String changeType = "1";//类型:1-公众假日、2-调配工作日、3-调配休息日
|
||||
String relatedDay = "";//对应工作日:0-星期一、1-星期二、2-星期三、3-星期四、4-星期五、5-星期六、6-星期日
|
||||
String shiftId = "";//班次ID
|
||||
|
||||
/*参数有误*/
|
||||
if (id.equals("") && groupId.equals("")) {
|
||||
resultMap.put("status", "-1");
|
||||
resultMap.put("message", SystemEnv.getHtmlLabelName(388858, user.getLanguage()));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/*是否具有编辑的权限*/
|
||||
boolean canEdit = HrmUserVarify.checkUserRight("KQHolidaySetEdit:Edit", user);
|
||||
if (!canEdit) {
|
||||
resultMap.put("status", "-1");
|
||||
resultMap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
List<Map<String, Object>> groupList = new ArrayList<Map<String, Object>>();
|
||||
Map<String, Object> groupItem = new HashMap<String, Object>();
|
||||
List<Object> itemList = new ArrayList<Object>();
|
||||
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
|
||||
SearchConditionItem searchConditionItem = null;
|
||||
HrmFieldBean hrmFieldBean = null;
|
||||
List<Map<String, Object>> replaceDatas = new ArrayList<Map<String, Object>>();
|
||||
Map<String, Object> datas = new HashMap<String, Object>();
|
||||
|
||||
boolean isEdit = false;
|
||||
if (!id.equals("")) {
|
||||
String sql = "select * from kq_HolidaySet where id=" + id;
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeQuery(sql);
|
||||
if (recordSet.next()) {
|
||||
isEdit = true;
|
||||
holidayDate = recordSet.getString("holidayDate");
|
||||
groupId = recordSet.getString("groupId");
|
||||
holidayDesc = recordSet.getString("holidayDesc");
|
||||
changeType = recordSet.getString("changeType");
|
||||
relatedDay = recordSet.getString("relatedDay");
|
||||
shiftId = recordSet.getString("shiftId");
|
||||
}
|
||||
}
|
||||
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldname("groupId");//考勤组
|
||||
hrmFieldBean.setFieldlabel("390221");
|
||||
hrmFieldBean.setFieldhtmltype("3");
|
||||
hrmFieldBean.setType("kqgroup");
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
hrmFieldBean.setViewAttr(1);
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
KQGroupComInfo kqGroupComInfo = new KQGroupComInfo();
|
||||
replaceDatas = new ArrayList<Map<String, Object>>();
|
||||
datas = new HashMap<String, Object>();
|
||||
datas.put("id", groupId);
|
||||
datas.put("name", kqGroupComInfo.getGroupname(groupId));
|
||||
replaceDatas.add(datas);
|
||||
searchConditionItem.getBrowserConditionParam().setReplaceDatas(replaceDatas);
|
||||
Map<String, Object> OtherParamsMap = new HashMap<String, Object>();
|
||||
OtherParamsMap.put("hasBorder", true);
|
||||
searchConditionItem.setOtherParams(OtherParamsMap);
|
||||
searchConditionItem.setRules("required|string");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
if (isEdit) {
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldname("holidayDate");//日期
|
||||
hrmFieldBean.setFieldlabel("97");
|
||||
hrmFieldBean.setFieldhtmltype("3");
|
||||
hrmFieldBean.setType("2");
|
||||
hrmFieldBean.setFieldvalue(holidayDate);
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
hrmFieldBean.setViewAttr(1);
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
OtherParamsMap = new HashMap<String, Object>();
|
||||
OtherParamsMap.put("hasBorder", true);
|
||||
searchConditionItem.setOtherParams(OtherParamsMap);
|
||||
searchConditionItem.setRules("required|string");
|
||||
itemList.add(searchConditionItem);
|
||||
} else {
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldname("startDate");//开始日期
|
||||
hrmFieldBean.setFieldlabel("740");
|
||||
hrmFieldBean.setFieldhtmltype("3");
|
||||
hrmFieldBean.setType("2");
|
||||
hrmFieldBean.setFieldvalue(holidayDate);
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
hrmFieldBean.setViewAttr(3);
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
searchConditionItem.setRules("required|string");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldname("endDate");//结束日期
|
||||
hrmFieldBean.setFieldlabel("741");
|
||||
hrmFieldBean.setFieldhtmltype("3");
|
||||
hrmFieldBean.setType("2");
|
||||
hrmFieldBean.setFieldvalue(holidayDate);
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
hrmFieldBean.setViewAttr(3);
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
searchConditionItem.setRules("required|string");
|
||||
itemList.add(searchConditionItem);
|
||||
}
|
||||
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldname("holidayDesc");//说明
|
||||
hrmFieldBean.setFieldlabel("85");
|
||||
hrmFieldBean.setFieldhtmltype("1");
|
||||
hrmFieldBean.setType("1");
|
||||
hrmFieldBean.setFieldvalue(holidayDesc);
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
if (hrmFieldBean.getViewAttr() == 1) {
|
||||
OtherParamsMap = new HashMap<String, Object>();
|
||||
OtherParamsMap.put("hasBorder", true);
|
||||
searchConditionItem.setOtherParams(OtherParamsMap);
|
||||
}
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldname("changeType");//类型
|
||||
hrmFieldBean.setFieldlabel("132033");
|
||||
hrmFieldBean.setFieldhtmltype("5");
|
||||
hrmFieldBean.setType("1");
|
||||
hrmFieldBean.setFieldvalue(changeType);
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
List statusOptions = new ArrayList<SearchConditionOption>();
|
||||
statusOptions.add(new SearchConditionOption("1", SystemEnv.getHtmlLabelName(16478, user.getLanguage()), changeType.equals("1")));
|
||||
statusOptions.add(new SearchConditionOption("3", SystemEnv.getHtmlLabelName(16752, user.getLanguage()), changeType.equals("3")));
|
||||
if (!Util.null2String(kqGroupComInfo.getKqtype(groupId)).equals("2")) {
|
||||
statusOptions.add(new SearchConditionOption("2", SystemEnv.getHtmlLabelName(16751, user.getLanguage()), changeType.equals("2")));
|
||||
}
|
||||
searchConditionItem.setOptions(statusOptions);
|
||||
searchConditionItem.setHelpfulTip(SystemEnv.getHtmlLabelName(529901, user.getLanguage()));
|
||||
searchConditionItem.setDetailtype(3);
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldname("relatedDay");//对应工作日
|
||||
hrmFieldBean.setFieldlabel("16754");
|
||||
hrmFieldBean.setFieldhtmltype("5");
|
||||
hrmFieldBean.setType("1");
|
||||
hrmFieldBean.setFieldvalue(relatedDay);
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
statusOptions = new ArrayList<SearchConditionOption>();
|
||||
statusOptions.add(new SearchConditionOption("0", SystemEnv.getHtmlLabelName(392, user.getLanguage()), relatedDay.equals("0") || relatedDay.equals("")));
|
||||
statusOptions.add(new SearchConditionOption("1", SystemEnv.getHtmlLabelName(393, user.getLanguage()), relatedDay.equals("1")));
|
||||
statusOptions.add(new SearchConditionOption("2", SystemEnv.getHtmlLabelName(394, user.getLanguage()), relatedDay.equals("2")));
|
||||
statusOptions.add(new SearchConditionOption("3", SystemEnv.getHtmlLabelName(395, user.getLanguage()), relatedDay.equals("3")));
|
||||
statusOptions.add(new SearchConditionOption("4", SystemEnv.getHtmlLabelName(396, user.getLanguage()), relatedDay.equals("4")));
|
||||
statusOptions.add(new SearchConditionOption("5", SystemEnv.getHtmlLabelName(397, user.getLanguage()), relatedDay.equals("5")));
|
||||
statusOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(398, user.getLanguage()), relatedDay.equals("6")));
|
||||
searchConditionItem.setOptions(statusOptions);
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldname("isSync");//同步到其他考勤组
|
||||
hrmFieldBean.setFieldlabel("506392");
|
||||
hrmFieldBean.setFieldhtmltype("4");
|
||||
hrmFieldBean.setType("1");
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
Map<String, Object> otherParamsMap = new HashMap<String, Object>();
|
||||
otherParamsMap.put("display", "switch");
|
||||
searchConditionItem.setOtherParams(otherParamsMap);
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
// XssUtil xssUtil = new XssUtil();
|
||||
hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldname("syncGroupIds");//同步到考勤组--多选
|
||||
hrmFieldBean.setFieldlabel("390664");
|
||||
hrmFieldBean.setFieldhtmltype("3");
|
||||
hrmFieldBean.setType("mkqgroup");
|
||||
hrmFieldBean.setIsFormField(true);
|
||||
hrmFieldBean.setViewAttr(3);
|
||||
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
searchConditionItem.setRules("required|string");
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
// dataMap.put("sqlWhere",xssUtil.put(" kqtype!=2 "));
|
||||
searchConditionItem.getBrowserConditionParam().setDataParams(dataMap);
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
groupItem.put("items", itemList);
|
||||
groupList.add(groupItem);
|
||||
resultMap.put("condition", groupList);
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,863 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.tools.ant.util.DateUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetKQReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
String isFromMyAttendance = Util.null2String(jsonObj.get("isFromMyAttendance"));//是否是来自我的考勤的请求,如果是,不加载考勤报表权限共享的限制,不然我的考勤会提示无权限
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
|
||||
String rightSql = kqReportBiz.getReportRight("1",""+user.getUID(),"a");
|
||||
if(isFromMyAttendance.equals("1")){
|
||||
rightSql = "";
|
||||
}
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0)continue;
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("type", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
columns.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束日期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){//结束日期不大于今天
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
|
||||
childColumns = new ArrayList<>();
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
column = new HashMap();
|
||||
column.put("title", DateUtil.geDayOfMonth(date));
|
||||
column.put("dataIndex", date);
|
||||
column.put("key", date);
|
||||
column.put("type", date);
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", 90);
|
||||
column.put("isCalendar", 1);
|
||||
childColumns.add(column);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
column.put("dataIndex", "kqCalendar");
|
||||
column.put("key", "kqCalendar");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", childColumns.size()*90);
|
||||
column.put("children", childColumns);
|
||||
}
|
||||
columns.add(column);
|
||||
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
String backFields = " a.companystartdate,(select sum(gxbts) as gxbts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gxbts,(select sum(xchu) as xcqts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xcqts,(select sum(jjrbtjia*60) as jjrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrbtjb,(select sum(jjrdksc*60) as jjrdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrdksc,(select sum(xxb) as xxb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xxb,(select sum(zrbtjbzdx*60) as zrbtjbztx from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjbztx,(select sum(gzsc) as gzsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gzsc,(select sum(psjbshic*60) as psjbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as psjbsc,(select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc,(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb,(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb,(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and sxzt is null and u.ksrq>='"+fromDate+"' and u.ksrq<= '"+toDate+"') as zlxs,(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts,(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts,(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle, " +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle,a.companystartdate ";
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
sqlWhere += " and 1=2 ";
|
||||
}
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+groupBy+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by t.dsporder asc, t.lastname asc ";
|
||||
String descOrderBy = " order by t.dsporder desc, t.lastname desc ";
|
||||
|
||||
//默认排序设置 start,有性能问题,先取消,后面再看看有没有好的方式
|
||||
// String orderBySql = "select * from kq_report_order where userId=? and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql, user.getUID());
|
||||
// if (rs.getCounts() <= 0) {
|
||||
// orderBySql = "select * from kq_report_order where userId=0 and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql);
|
||||
// }
|
||||
// while (rs.next()) {
|
||||
// String dataIndex = rs.getString("dataIndex");
|
||||
// String ascOrDesc = rs.getString("ascOrDesc");
|
||||
// String ascOrDesc1 = (ascOrDesc.equals("")||ascOrDesc.equals("asc"))?"desc":"asc";
|
||||
// if (dataIndex.equals("organization")) {
|
||||
// orderBy += ",showOrderOfDeptTree " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += ",showOrderOfDeptTree " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// }
|
||||
// if (dataIndex.equalsIgnoreCase("dspOrder") || dataIndex.equalsIgnoreCase("lastName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("deptShowOrder") || dataIndex.equalsIgnoreCase("deptName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("subcomShowOrder") || dataIndex.equalsIgnoreCase("subcomName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",subcom_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",subcom_id " + ascOrDesc1;
|
||||
// }
|
||||
// }
|
||||
// orderBy = orderBy.startsWith(",") ? orderBy.substring(1) : orderBy;
|
||||
// descOrderBy = descOrderBy.startsWith(",") ? descOrderBy.substring(1) : descOrderBy;
|
||||
// orderBy = orderBy.equals("") ? " t.dspOrder,t.id " : orderBy;
|
||||
// descOrderBy = descOrderBy.equals("") ? " t.dspOrder,t.id " : descOrderBy;
|
||||
// orderBy = "order by "+orderBy;
|
||||
|
||||
sql = backFields + sqlFrom + sqlWhere + groupBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " +pageSize + " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql + orderBy+ " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql+orderBy;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
|
||||
|
||||
bb.writeLog("getKqReportCmd:"+sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
String id = rs.getString("id");
|
||||
data.put("resourceId",id);
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1"))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
data.put("subcompanyId",tmpSubcompanyId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
data.put("departmentId",tmpDepartmentId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
data.put("jobtitleId",tmpJobtitleId);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
}else if(fieldName.equals("cdfz")){
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins"));
|
||||
fieldValue = beLateMins;
|
||||
}else if(fieldName.equals("ztfz")){
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins"));
|
||||
fieldValue = graveBeLateMins;
|
||||
}else if(fieldName.equals("xcqts")){
|
||||
String xcqtsDays = getXcqts(fromDate,id);
|
||||
fieldValue = xcqtsDays;
|
||||
}else if(fieldName.equals("attendanceSerial")){
|
||||
List<String> serialIds = null;
|
||||
if(attendanceSerial.length()>0){
|
||||
serialIds = Util.splitString2List(attendanceSerial,",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
if(fieldName.equals("overtimeTotal")){
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else{
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id+"|"+fieldName)));
|
||||
}
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if(Util.null2String(kqReportFieldComInfo.getUnittype()).length()>0) {
|
||||
if(fieldValue.length() == 0){
|
||||
fieldValue="0";
|
||||
}else{
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
data.put(fieldName,fieldValue);
|
||||
}
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_"+leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+flowLeaveBackType)),"0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(leaveData.length() == 0){
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if(leavebackData.length() == 0){
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if(b_flowLeaveData.length() > 0){
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
}else{
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0)));
|
||||
}
|
||||
data.put(flowType,flowLeaveData);
|
||||
}
|
||||
|
||||
Map<String,Object> detialDatas = kqReportBiz.getDetialDatas(id,fromDate,toDate,user,flowData,false,uintType,show_card_source);
|
||||
// new KQLog().info("id:"+id+":detialDatas:"+detialDatas);
|
||||
isEnd = false;
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
if(DateUtil.compDate(today, date)>0){
|
||||
data.put(date,"");
|
||||
}else{
|
||||
// new KQLog().info("id:date:"+(id+"|"+date)+":detialDatas.get:"+detialDatas.get(id+"|"+date));
|
||||
data.put(date,detialDatas.get(id+"|"+date)==null?SystemEnv.getHtmlLabelName(26593, user.getLanguage()):detialDatas.get(id+"|"+date));
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("attendanceSerial")){//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if(Util.null2String(jsonObj.get("attendanceSerial")).length()>0){
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")),",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
column = new HashMap();
|
||||
column.put("title", kqShiftManagementComInfo.getSerial(serialIds.get(i)));
|
||||
column.put("unit", "");
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", serialIds.get(i));
|
||||
column.put("key", serialIds.get(i));
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return lsChildColumns;
|
||||
}
|
||||
Map<String,Object> column = null;
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lsChildColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getXcqts(String dateOri,String userId){
|
||||
//本月第一天
|
||||
String fromDate = TimeUtil.getMonthBeginDay(dateOri);
|
||||
//本月最后一天
|
||||
String toDate = TimeUtil.getMonthEndDay(dateOri);
|
||||
Set<String> all = new HashSet<>();
|
||||
all.add(fromDate);
|
||||
List<String> back = days(fromDate,toDate);
|
||||
all.addAll(back);
|
||||
all.add(toDate);
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//需出勤天数
|
||||
Integer xcqtsAll = 0;
|
||||
//考勤组大小周A
|
||||
String dxzA = bb.getPropValue("jgKq_main","dxzA");
|
||||
//考勤组大小周B
|
||||
String dxzB = bb.getPropValue("jgKq_main","dxzB");
|
||||
String rykqz = getCusFieldData(Integer.valueOf(userId),"field31",3);
|
||||
|
||||
for (String date : all) {
|
||||
KQHolidaySetComInfo holidaySetComInfo = new KQHolidaySetComInfo();
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
/*获取考勤组的ID,因为考勤组有有效期,所以需要传入日期*/
|
||||
String groupId = kqGroupMemberComInfo.getKQGroupId(userId, toDate);
|
||||
String changeTypeNew = holidaySetComInfo.getChangeType(groupId, date);
|
||||
String rzlxZdy = findRqlx(userId,date);
|
||||
//日期类型,0是工作日、1是周六、2是周日
|
||||
Integer rqlx = -1;
|
||||
if("0".equals(rzlxZdy)){
|
||||
rqlx = 0;
|
||||
}else if("1".equals(rzlxZdy)){
|
||||
rqlx = 1;
|
||||
}else if("2".equals(rzlxZdy)){
|
||||
rqlx = 2;
|
||||
}else if(DateUtil.getWeek(date) == 6){
|
||||
rqlx = 1;
|
||||
}else if(DateUtil.getWeek(date) == 7){
|
||||
rqlx = 2;
|
||||
}else {
|
||||
rqlx = 0;
|
||||
}
|
||||
Integer xcqts = 0;
|
||||
if("4".equals(rykqz)){
|
||||
//单休判断是不是周日,是的话不计
|
||||
if(rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}else if ("8".equals(rykqz)){
|
||||
//双休判断是不是周六周日,是的话不计
|
||||
if(rqlx == 1 || rqlx == 2){
|
||||
if("1".equals(changeTypeNew)){
|
||||
//节假日的话统计
|
||||
xcqts = 1;
|
||||
}else{
|
||||
xcqts = 0;
|
||||
}
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}else if(dxzA.equals(rykqz) || dxzB.equals(rykqz)){
|
||||
//双休判断是不是周六周日,是的话不计
|
||||
if(rqlx == 2){
|
||||
if("1".equals(changeTypeNew)){
|
||||
//节假日的话统计
|
||||
xcqts = 1;
|
||||
}else{
|
||||
xcqts = 0;
|
||||
}
|
||||
}else if (rqlx == 1){
|
||||
//周六是工作日的话计
|
||||
if("2".equals(changeTypeNew)||"1".equals(changeTypeNew)){
|
||||
xcqts = 1;
|
||||
}else{
|
||||
xcqts = 0;
|
||||
}
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}
|
||||
xcqtsAll = xcqtsAll+xcqts;
|
||||
}
|
||||
|
||||
return String.valueOf(xcqtsAll);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取两个日期之间所有的日期
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList days(String date1, String date2) {
|
||||
String dateFormat = "yyyy-MM-dd";
|
||||
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
ArrayList L = new ArrayList();
|
||||
if (date1.equals(date2)) {
|
||||
System.out.println("两个日期相等!");
|
||||
return L;
|
||||
}
|
||||
|
||||
String tmp;
|
||||
if (date1.compareTo(date2) > 0) { // 确保 date1的日期不晚于date2
|
||||
tmp = date1;
|
||||
date1 = date2;
|
||||
date2 = tmp;
|
||||
}
|
||||
|
||||
tmp = format.format(str2Date(date1).getTime() + 3600 * 24 * 1000);
|
||||
|
||||
int num = 0;
|
||||
while (tmp.compareTo(date2) < 0) {
|
||||
L.add(tmp);
|
||||
num++;
|
||||
tmp = format.format(str2Date(tmp).getTime() + 3600 * 24 * 1000);
|
||||
}
|
||||
|
||||
if (num == 0)
|
||||
System.out.println("两个日期相邻!");
|
||||
return L;
|
||||
}
|
||||
|
||||
private static Date str2Date(String str) {
|
||||
String dateFormat = "yyyy-MM-dd";
|
||||
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
return format.parse(str);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义日期类型判断
|
||||
* @param userId
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String findRqlx(String userId,String date){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select rqlx from uf_rqzdygs where CONCAT(xm,',') like('%"+userId+",%') and rq = '"+date+"'";
|
||||
rs.executeQuery(sql);
|
||||
String rqlx = "-1";
|
||||
if(rs.next()){
|
||||
rqlx = Util.null2String(rs.getString("rqlx"));
|
||||
}
|
||||
return StringUtils.isBlank(rqlx)?"-1":rqlx;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义字段的值
|
||||
* @param id
|
||||
* @param fieldname
|
||||
* @param scopeid
|
||||
* @return
|
||||
*/
|
||||
public static String getCusFieldData(Integer id,String fieldname,int scopeid){
|
||||
String fieldVal = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select "+fieldname+" from cus_fielddata where id=? and scopeid=? and scope='HrmCustomFieldByInfoType' ";
|
||||
rs.executeQuery(sql,id,scopeid);
|
||||
if(rs.next()){
|
||||
fieldVal = Util.null2String(rs.getString(fieldname));
|
||||
}
|
||||
return fieldVal;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,431 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="com.weaver.general.Util" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONArray" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
|
||||
<%--
|
||||
User: wangj
|
||||
Design Ideas:
|
||||
更新应聘登记表非普工(职员) 信息
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
Map<String, Object> res = new HashMap<>(100);
|
||||
RecordSet rs = new RecordSet();
|
||||
String billid = Util.null2String(request.getParameter("billid"));
|
||||
String mainStr = Util.null2String(request.getParameter("main"));
|
||||
String dt1Str = Util.null2String(request.getParameter("dt1"));
|
||||
String dt2Str = Util.null2String(request.getParameter("dt2"));
|
||||
String dt3Str = Util.null2String(request.getParameter("dt3"));
|
||||
String dt4Str = Util.null2String(request.getParameter("dt4"));
|
||||
String dt5Str = Util.null2String(request.getParameter("dt5"));
|
||||
JSONObject main = JSONObject.parseObject(mainStr);
|
||||
JSONArray dt1 = JSONArray.parseArray(dt1Str);
|
||||
JSONArray dt2 = JSONArray.parseArray(dt2Str);
|
||||
JSONArray dt3 = JSONArray.parseArray(dt3Str);
|
||||
JSONArray dt4 = JSONArray.parseArray(dt4Str);
|
||||
JSONArray dt5 = JSONArray.parseArray(dt5Str);
|
||||
|
||||
String yprq = getSelectNullValue(Util.null2String(main.getString("yprq")));
|
||||
String ypbm = getSelectNullValue(Util.null2String(main.getString("ypbm")));
|
||||
String ypzw = getSelectNullValue(Util.null2String(main.getString("ypzw")));
|
||||
String qwxz = getSelectNullValue(Util.null2String(main.getString("qwxz")));
|
||||
String zptj = getSelectNullValue(Util.null2String(main.getString("zptj")));
|
||||
|
||||
String xm = getSelectNullValue(Util.null2String(main.getString("xm")));
|
||||
String xb = getSelectNullValue(Util.null2String(main.getString("xb")));
|
||||
String jg = getSelectNullValue(Util.null2String(main.getString("jg")));
|
||||
String csrq = getSelectNullValue(Util.null2String(main.getString("csrq")));
|
||||
String mz = getSelectNullValue(Util.null2String(main.getString("mz")));
|
||||
String xl = getSelectNullValue(Util.null2String(main.getString("xl")));
|
||||
String zy = getSelectNullValue(Util.null2String(main.getString("zy")));
|
||||
String sj = getSelectNullValue(Util.null2String(main.getString("sj")));
|
||||
String dzyj = getSelectNullValue(Util.null2String(main.getString("dzyj")));
|
||||
String sfzhm = getSelectNullValue(Util.null2String(main.getString("sfzhm")));
|
||||
String hyzk = getSelectNullValue(Util.null2String(main.getString("hyzk")));
|
||||
String jtzz = getSelectNullValue(Util.null2String(main.getString("jtzz")));
|
||||
String xjdz = getSelectNullValue(Util.null2String(main.getString("xjdz")));
|
||||
String stzk = getSelectNullValue(Util.null2String(main.getString("stzk")));
|
||||
String gycm = getSelectNullValue(Util.null2String(main.getString("gycm")));
|
||||
String sfzs = getSelectNullValue(Util.null2String(main.getString("sfzs")));
|
||||
String jjlxrxm = getSelectNullValue(Util.null2String(main.getString("jjlxrxm")));
|
||||
String ybrgx = getSelectNullValue(Util.null2String(main.getString("ybrgx")));
|
||||
String dz = getSelectNullValue(Util.null2String(main.getString("dz")));
|
||||
String dh = getSelectNullValue(Util.null2String(main.getString("dh")));
|
||||
String jsrxm = getSelectNullValue(Util.null2String(main.getString("jsrxm")));
|
||||
String jsrbm = getSelectNullValue(Util.null2String(main.getString("jsrbm")));
|
||||
String ybrgx1 = getSelectNullValue(Util.null2String(main.getString("ybrgx1")));
|
||||
String lxdh = getSelectNullValue(Util.null2String(main.getString("lxdh")));
|
||||
String Ey = getSelectNullValue(Util.null2String(main.getString("Ey")));
|
||||
String yy = getSelectNullValue(Util.null2String(main.getString("yy")));
|
||||
String yny = getSelectNullValue(Util.null2String(main.getString("yny")));
|
||||
String mdy = getSelectNullValue(Util.null2String(main.getString("mdy")));
|
||||
String jsjnl = getSelectNullValue(Util.null2String(main.getString("jsjnl")));
|
||||
String qtyz = getSelectNullValue(Util.null2String(main.getString("qtyz")));
|
||||
String zwpj = getSelectNullValue(Util.null2String(main.getString("zwpj")));
|
||||
|
||||
|
||||
String sql = "update uf_ypdjb set yprq = ?, ypbm = ?, ypzw = ?, qwxz = ?, zptj = ?,xm = ?,xb = ?, jg = ?, csrq = ?,mz = ?, xl = ?, zy = ?, sj = ?,dzyj = ?, sfzhm = ?, hyzk = ?, jtzz = ?, xjdz = ?, stzk = ?, gycm = ?, sfzs = ?, jjlxrxm=?, ybrgx = ?, dz = ?, dh = ?, jsrxm = ?, jsrbm = ?, ybrgx1 = ?, lxdh = ?, Ey = ?, yy = ?, yny = ?, mdy = ?, jsjnl = ?, qtyz = ?, zwpj = ? where id = ?";
|
||||
boolean flag = rs.executeUpdate(sql, yprq, ypbm, ypzw, qwxz, zptj, xm, xb, jg, csrq, mz, xl, zy, sj, dzyj, sfzhm, hyzk, jtzz, xjdz, stzk, gycm, sfzs, jjlxrxm, ybrgx, dz, dh, jsrxm, jsrbm, ybrgx1, lxdh, Ey, yy, yny, mdy, jsjnl, qtyz, zwpj, billid);
|
||||
updateDt1(dt1, billid);
|
||||
updateDt2(dt2, billid);
|
||||
updateDt3(dt3, billid);
|
||||
updateDt4(dt4, billid);
|
||||
updateDt5(dt5, billid);
|
||||
|
||||
|
||||
res.put("status", flag);
|
||||
out.print(JSONObject.toJSONString(res));
|
||||
%>
|
||||
|
||||
|
||||
<%!
|
||||
private String getSelectNullValue(String value) {
|
||||
if ("".equals(value)) {
|
||||
return null;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private void updateDt1(JSONArray data, String billid) {
|
||||
List<String> idlist = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select id from uf_ypdjb_dt1 where mainid = '" + billid + "' order by id asc";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
idlist.add(id);
|
||||
}
|
||||
String updateSql = "update uf_ypdjb_dt1 set kssj = ?, jssj = ?, xxmc = ?, xxdz = ?, xxfs = ?, xl = ?, xw = ?, zy = ? where id = ?";
|
||||
String insertSql = "insert into uf_ypdjb_dt1 (mainid ,kssj , jssj , xxmc , xxdz , xxfs , xl , xw , zy) values (?,?,?,?,?,?,?,?,?)";
|
||||
String deleteSql = "delete uf_ypdjb_dt1 where id = ?";
|
||||
//数量相等更新数据
|
||||
if (idlist.size() == data.size()) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String xxmc = getSelectNullValue(Util.null2String(obj.getString("xxmc")));
|
||||
String xxdz = getSelectNullValue(Util.null2String(obj.getString("xxdz")));
|
||||
String xxfs = getSelectNullValue(Util.null2String(obj.getString("xxfs")));
|
||||
String xl = getSelectNullValue(Util.null2String(obj.getString("xl")));
|
||||
String xw = getSelectNullValue(Util.null2String(obj.getString("xw")));
|
||||
String zy = getSelectNullValue(Util.null2String(obj.getString("zy")));
|
||||
rs.executeUpdate(updateSql, kssj, jssj, xxmc, xxdz, xxfs, xl, xw, zy, id);
|
||||
}
|
||||
} else if (idlist.size() < data.size()) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String xxmc = getSelectNullValue(Util.null2String(obj.getString("xxmc")));
|
||||
String xxdz = getSelectNullValue(Util.null2String(obj.getString("xxdz")));
|
||||
String xxfs = getSelectNullValue(Util.null2String(obj.getString("xxfs")));
|
||||
String xl = getSelectNullValue(Util.null2String(obj.getString("xl")));
|
||||
String xw = getSelectNullValue(Util.null2String(obj.getString("xw")));
|
||||
String zy = getSelectNullValue(Util.null2String(obj.getString("zy")));
|
||||
if (i < idlist.size()) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
rs.executeUpdate(updateSql, kssj, jssj, xxmc, xxdz, xxfs, xl, xw, zy, id);
|
||||
} else {
|
||||
rs.executeUpdate(insertSql, billid, kssj, jssj, xxmc, xxdz, xxfs, xl, xw, zy);
|
||||
}
|
||||
}
|
||||
} else if (idlist.size() > data.size()) {
|
||||
for (int i = 0; i < idlist.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
if (i < data.size()) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String xxmc = getSelectNullValue(Util.null2String(obj.getString("xxmc")));
|
||||
String xxdz = getSelectNullValue(Util.null2String(obj.getString("xxdz")));
|
||||
String xxfs = getSelectNullValue(Util.null2String(obj.getString("xxfs")));
|
||||
String xl = getSelectNullValue(Util.null2String(obj.getString("xl")));
|
||||
String xw = getSelectNullValue(Util.null2String(obj.getString("xw")));
|
||||
String zy = getSelectNullValue(Util.null2String(obj.getString("zy")));
|
||||
rs.executeUpdate(updateSql, kssj, jssj, xxmc, xxdz, xxfs, xl, xw, zy, id);
|
||||
} else {
|
||||
rs.executeUpdate(deleteSql, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private void updateDt2(JSONArray data, String billid) {
|
||||
List<String> idlist = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select id from uf_ypdjb_dt2 where mainid = '" + billid + "' order by id asc";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
idlist.add(id);
|
||||
}
|
||||
String updateSql = "update uf_ypdjb_dt2 set gsmc = ?,dh = ?,gsrs = ?,bmrs = ?,kssj = ?,jssj = ?,zw = ?,zz = ?,zhxj = ?,lzyy = ?,zmr = ?,lxfs = ?,sfyqyrdwyjjcldgx = ?,sfyqyrdwywjdflsy = ?,sfyqyrdwydlbmxyyjyxztk = ? where id = ?";
|
||||
String insertSql = "insert into uf_ypdjb_dt2 (mainid ,gsmc,dh,gsrs,bmrs,kssj,jssj,zw,zz,zhxj,lzyy,zmr,lxfs,sfyqyrdwyjjcldgx,sfyqyrdwywjdflsy,sfyqyrdwydlbmxyyjyxztk) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
String deleteSql = "delete uf_ypdjb_dt2 where id = ?";
|
||||
//数量相等更新数据
|
||||
if (idlist.size() == data.size()) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String gsmc = getSelectNullValue(Util.null2String(obj.getString("gsmc")));
|
||||
String dh = getSelectNullValue(Util.null2String(obj.getString("dh")));
|
||||
String gsrs = getSelectNullValue(Util.null2String(obj.getString("gsrs")));
|
||||
String bmrs = getSelectNullValue(Util.null2String(obj.getString("bmrs")));
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String zw = getSelectNullValue(Util.null2String(obj.getString("zw")));
|
||||
String zz = getSelectNullValue(Util.null2String(obj.getString("zz")));
|
||||
String zhxj = getSelectNullValue(Util.null2String(obj.getString("zhxj")));
|
||||
String lzyy = getSelectNullValue(Util.null2String(obj.getString("lzyy")));
|
||||
String zmr = getSelectNullValue(Util.null2String(obj.getString("zmr")));
|
||||
String lxfs = getSelectNullValue(Util.null2String(obj.getString("lxfs")));
|
||||
String sfyqyrdwyjjcldgx = getSelectNullValue(Util.null2String(obj.getString("sfyqyrdwyjjcldgx")));
|
||||
String sfyqyrdwywjdflsy = getSelectNullValue(Util.null2String(obj.getString("sfyqyrdwywjdflsy")));
|
||||
String sfyqyrdwydlbmxyyjyxztk = getSelectNullValue(Util.null2String(obj.getString("sfyqyrdwydlbmxyyjyxztk")));
|
||||
|
||||
rs.executeUpdate(updateSql, gsmc, dh, gsrs, bmrs, kssj, jssj, zw, zz, zhxj, lzyy, zmr, lxfs, sfyqyrdwyjjcldgx, sfyqyrdwywjdflsy, sfyqyrdwydlbmxyyjyxztk, id);
|
||||
}
|
||||
} else if (idlist.size() < data.size()) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String gsmc = getSelectNullValue(Util.null2String(obj.getString("gsmc")));
|
||||
String dh = getSelectNullValue(Util.null2String(obj.getString("dh")));
|
||||
String gsrs = getSelectNullValue(Util.null2String(obj.getString("gsrs")));
|
||||
String bmrs = getSelectNullValue(Util.null2String(obj.getString("bmrs")));
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String zw = getSelectNullValue(Util.null2String(obj.getString("zw")));
|
||||
String zz = getSelectNullValue(Util.null2String(obj.getString("zz")));
|
||||
String zhxj = getSelectNullValue(Util.null2String(obj.getString("zhxj")));
|
||||
String lzyy = getSelectNullValue(Util.null2String(obj.getString("lzyy")));
|
||||
String zmr = getSelectNullValue(Util.null2String(obj.getString("zmr")));
|
||||
String lxfs = getSelectNullValue(Util.null2String(obj.getString("lxfs")));
|
||||
String sfyqyrdwyjjcldgx = getSelectNullValue(Util.null2String(obj.getString("sfyqyrdwyjjcldgx")));
|
||||
String sfyqyrdwywjdflsy = getSelectNullValue(Util.null2String(obj.getString("sfyqyrdwywjdflsy")));
|
||||
String sfyqyrdwydlbmxyyjyxztk = getSelectNullValue(Util.null2String(obj.getString("sfyqyrdwydlbmxyyjyxztk")));
|
||||
|
||||
if (i < idlist.size()) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
rs.executeUpdate(updateSql, gsmc, dh, gsrs, bmrs, kssj, jssj, zw, zz, zhxj, lzyy, zmr, lxfs, sfyqyrdwyjjcldgx, sfyqyrdwywjdflsy, sfyqyrdwydlbmxyyjyxztk, id);
|
||||
} else {
|
||||
rs.executeUpdate(insertSql, billid, gsmc, dh, gsrs, bmrs, kssj, jssj, zw, zz, zhxj, lzyy, zmr, lxfs, sfyqyrdwyjjcldgx, sfyqyrdwywjdflsy, sfyqyrdwydlbmxyyjyxztk);
|
||||
}
|
||||
}
|
||||
} else if (idlist.size() > data.size()) {
|
||||
for (int i = 0; i < idlist.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
if (i < data.size()) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String gsmc = getSelectNullValue(Util.null2String(obj.getString("gsmc")));
|
||||
String dh = getSelectNullValue(Util.null2String(obj.getString("dh")));
|
||||
String gsrs = getSelectNullValue(Util.null2String(obj.getString("gsrs")));
|
||||
String bmrs = getSelectNullValue(Util.null2String(obj.getString("bmrs")));
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String zw = getSelectNullValue(Util.null2String(obj.getString("zw")));
|
||||
String zz = getSelectNullValue(Util.null2String(obj.getString("zz")));
|
||||
String zhxj = getSelectNullValue(Util.null2String(obj.getString("zhxj")));
|
||||
String lzyy = getSelectNullValue(Util.null2String(obj.getString("lzyy")));
|
||||
String zmr = getSelectNullValue(Util.null2String(obj.getString("zmr")));
|
||||
String lxfs = getSelectNullValue(Util.null2String(obj.getString("lxfs")));
|
||||
String sfyqyrdwyjjcldgx = getSelectNullValue(Util.null2String(obj.getString("sfyqyrdwyjjcldgx")));
|
||||
String sfyqyrdwywjdflsy = getSelectNullValue(Util.null2String(obj.getString("sfyqyrdwywjdflsy")));
|
||||
String sfyqyrdwydlbmxyyjyxztk = getSelectNullValue(Util.null2String(obj.getString("sfyqyrdwydlbmxyyjyxztk")));
|
||||
|
||||
rs.executeUpdate(updateSql, gsmc, dh, gsrs, bmrs, kssj, jssj, zw, zz, zhxj, lzyy, zmr, lxfs, sfyqyrdwyjjcldgx, sfyqyrdwywjdflsy, sfyqyrdwydlbmxyyjyxztk, id);
|
||||
} else {
|
||||
rs.executeUpdate(deleteSql, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private void updateDt3(JSONArray data, String billid) {
|
||||
List<String> idlist = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select id from uf_ypdjb_dt3 where mainid = '" + billid + "' order by id asc";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
idlist.add(id);
|
||||
}
|
||||
String updateSql = "update uf_ypdjb_dt3 set xm = ?, gx = ?, nl = ?, rzdwdzdh = ? where id = ?";
|
||||
String insertSql = "insert into uf_ypdjb_dt3 (mainid,xm ,gx ,nl ,rzdwdzdh) values (?,?,?,?,?)";
|
||||
String deleteSql = "delete uf_ypdjb_dt3 where id = ?";
|
||||
//数量相等更新数据
|
||||
if (idlist.size() == data.size()) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String xm = getSelectNullValue(Util.null2String(obj.getString("xm")));
|
||||
String gx = getSelectNullValue(Util.null2String(obj.getString("gx")));
|
||||
String nl = getSelectNullValue(Util.null2String(obj.getString("nl")));
|
||||
String rzdwdzdh = getSelectNullValue(Util.null2String(obj.getString("rzdwdzdh")));
|
||||
|
||||
rs.executeUpdate(updateSql, xm, gx, nl, rzdwdzdh, id);
|
||||
}
|
||||
} else if (idlist.size() < data.size()) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String xm = getSelectNullValue(Util.null2String(obj.getString("xm")));
|
||||
String gx = getSelectNullValue(Util.null2String(obj.getString("gx")));
|
||||
String nl = getSelectNullValue(Util.null2String(obj.getString("nl")));
|
||||
String rzdwdzdh = getSelectNullValue(Util.null2String(obj.getString("rzdwdzdh")));
|
||||
if (i < idlist.size()) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
rs.executeUpdate(updateSql, xm, gx, nl, rzdwdzdh, id);
|
||||
} else {
|
||||
rs.executeUpdate(insertSql, billid, xm, gx, nl, rzdwdzdh);
|
||||
}
|
||||
}
|
||||
} else if (idlist.size() > data.size()) {
|
||||
for (int i = 0; i < idlist.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
if (i < data.size()) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String xm = getSelectNullValue(Util.null2String(obj.getString("xm")));
|
||||
String gx = getSelectNullValue(Util.null2String(obj.getString("gx")));
|
||||
String nl = getSelectNullValue(Util.null2String(obj.getString("nl")));
|
||||
String rzdwdzdh = getSelectNullValue(Util.null2String(obj.getString("rzdwdzdh")));
|
||||
rs.executeUpdate(updateSql, xm, gx, nl, rzdwdzdh, id);
|
||||
} else {
|
||||
rs.executeUpdate(deleteSql, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateDt4(JSONArray data, String billid) {
|
||||
List<String> idlist = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select id from uf_ypdjb_dt4 where mainid = '" + billid + "' order by id asc";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
idlist.add(id);
|
||||
}
|
||||
String updateSql = "update uf_ypdjb_dt4 set xm = ?, bm = ?, zw = ?, ybrgx = ? where id = ?";
|
||||
String insertSql = "insert into uf_ypdjb_dt4 (mainid,xm , bm , zw , ybrgx) values (?,?,?,?,?)";
|
||||
String deleteSql = "delete uf_ypdjb_dt4 where id = ?";
|
||||
//数量相等更新数据
|
||||
if (idlist.size() == data.size()) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String xm = getSelectNullValue(Util.null2String(obj.getString("xm")));
|
||||
String bm = getSelectNullValue(Util.null2String(obj.getString("bm")));
|
||||
String zw = getSelectNullValue(Util.null2String(obj.getString("zw")));
|
||||
String ybrgx = getSelectNullValue(Util.null2String(obj.getString("ybrgx")));
|
||||
|
||||
rs.executeUpdate(updateSql, xm, bm, zw, ybrgx, id);
|
||||
}
|
||||
} else if (idlist.size() < data.size()) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String xm = getSelectNullValue(Util.null2String(obj.getString("xm")));
|
||||
String bm = getSelectNullValue(Util.null2String(obj.getString("bm")));
|
||||
String zw = getSelectNullValue(Util.null2String(obj.getString("zw")));
|
||||
String ybrgx = getSelectNullValue(Util.null2String(obj.getString("ybrgx")));
|
||||
if (i < idlist.size()) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
rs.executeUpdate(updateSql, xm, bm, zw, ybrgx, id);
|
||||
} else {
|
||||
rs.executeUpdate(insertSql, billid, xm, bm, zw, ybrgx);
|
||||
}
|
||||
}
|
||||
} else if (idlist.size() > data.size()) {
|
||||
for (int i = 0; i < idlist.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
if (i < data.size()) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String xm = getSelectNullValue(Util.null2String(obj.getString("xm")));
|
||||
String bm = getSelectNullValue(Util.null2String(obj.getString("bm")));
|
||||
String zw = getSelectNullValue(Util.null2String(obj.getString("zw")));
|
||||
String ybrgx = getSelectNullValue(Util.null2String(obj.getString("ybrgx")));
|
||||
rs.executeUpdate(updateSql, xm, bm, zw, ybrgx, id);
|
||||
} else {
|
||||
rs.executeUpdate(deleteSql, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateDt5(JSONArray data, String billid) {
|
||||
List<String> idlist = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select id from uf_ypdjb_dt5 where mainid = '" + billid + "' order by id asc";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
idlist.add(id);
|
||||
}
|
||||
String updateSql = "update uf_ypdjb_dt5 set kssj = ?, jssj = ?, dd = ?, pxnr = ?, pxjg = ?, shzs = ?, fjsc = ? where id = ?";
|
||||
String insertSql = "insert into uf_ypdjb_dt5 (mainid, kssj, jssj, dd, pxnr, pxjg, shzs, fjsc) values (?,?,?,?,?,?,?,?)";
|
||||
String deleteSql = "delete uf_ypdjb_dt5 where id = ?";
|
||||
//数量相等更新数据
|
||||
if (idlist.size() == data.size()) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String dd = getSelectNullValue(Util.null2String(obj.getString("dd")));
|
||||
String pxnr = getSelectNullValue(Util.null2String(obj.getString("pxnr")));
|
||||
String pxjg = getSelectNullValue(Util.null2String(obj.getString("pxjg")));
|
||||
String shzs = getSelectNullValue(Util.null2String(obj.getString("shzs")));
|
||||
String fjsc = getSelectNullValue(Util.null2String(obj.getString("fjsc")));
|
||||
rs.executeUpdate(updateSql, kssj, jssj, dd, pxnr, pxjg, shzs, fjsc, id);
|
||||
}
|
||||
} else if (idlist.size() < data.size()) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String dd = getSelectNullValue(Util.null2String(obj.getString("dd")));
|
||||
String pxnr = getSelectNullValue(Util.null2String(obj.getString("pxnr")));
|
||||
String pxjg = getSelectNullValue(Util.null2String(obj.getString("pxjg")));
|
||||
String shzs = getSelectNullValue(Util.null2String(obj.getString("shzs")));
|
||||
String fjsc = getSelectNullValue(Util.null2String(obj.getString("fjsc")));
|
||||
if (i < idlist.size()) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
rs.executeUpdate(updateSql, kssj, jssj, dd, pxnr, pxjg, shzs, fjsc, id);
|
||||
} else {
|
||||
rs.executeUpdate(insertSql, billid, kssj, jssj, dd, pxnr, pxjg, shzs, fjsc);
|
||||
}
|
||||
}
|
||||
} else if (idlist.size() > data.size()) {
|
||||
for (int i = 0; i < idlist.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
if (i < data.size()) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String dd = getSelectNullValue(Util.null2String(obj.getString("dd")));
|
||||
String pxnr = getSelectNullValue(Util.null2String(obj.getString("pxnr")));
|
||||
String pxjg = getSelectNullValue(Util.null2String(obj.getString("pxjg")));
|
||||
String shzs = getSelectNullValue(Util.null2String(obj.getString("shzs")));
|
||||
String fjsc = getSelectNullValue(Util.null2String(obj.getString("fjsc")));
|
||||
rs.executeUpdate(updateSql, kssj, jssj, dd, pxnr, pxjg, shzs, fjsc, id);
|
||||
} else {
|
||||
rs.executeUpdate(deleteSql, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
|
@ -0,0 +1,663 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportDailyExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")),",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.add("kqdate");
|
||||
showColumns.add("serialid");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("signin1")){
|
||||
cascadekey = "signout1";
|
||||
}else if(showColumn.equals("signin2")){
|
||||
cascadekey = "signout2";
|
||||
}else if(showColumn.equals("signin3")){
|
||||
cascadekey = "signout3";
|
||||
}else if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
toDate = today;
|
||||
}
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String,Object>> constraintList = null;
|
||||
Map<String,Object> constraint = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width",30*256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan",childColumns.size());
|
||||
}else{
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "2");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
String backFields = " a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins,b.beLate," +
|
||||
" b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins,b.graveLeaveEarly," +
|
||||
" b.graveLeaveEarlyMins,b.absenteeism,b.signdays,b.signmins, "+
|
||||
" b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc , b.kqDate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select "+backFields + sqlFrom + sqlWhere+orderBy;
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
String tmpkey = id+"|"+kqdate+"|";
|
||||
// Map<String,Object> signDetailInfo = this.getSignDetailInfo(id,kqdate);
|
||||
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if(fieldName.equals("serialid")){
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
if(serialid.length()>0){
|
||||
// fieldValue = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(serialid)){
|
||||
fieldValue = serialdata.get(serialid);
|
||||
}else{
|
||||
String tmpserialname = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
fieldValue = tmpserialname;
|
||||
serialdata.put(serialid,tmpserialname);
|
||||
}
|
||||
}
|
||||
} else if(fieldName.equals("signin1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("leave")){
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
fieldValue = Util.null2String(flowData.get(id+"|"+kqdate+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(fieldValue);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
writeLog("ExportDailyExcelCmd:fieldValue" + fieldValue + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(fieldValue, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
fieldValue = flowLeaveData;
|
||||
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else if(fieldName.equals("kqdate")){
|
||||
fieldValue=kqdate+" "+com.engine.portal.util.DateUtil.getDayWeekOfDate1(DateUtil.parseToDate(kqdate));
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
|
||||
if(!fieldName.equals("leave")) {
|
||||
fieldValue = Util.formatMultiLang(fieldValue, "" + user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList",constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390352, user.getLanguage())+" "+fromDate+" "+toDate;;
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
title = new HashMap<>();
|
||||
title.put("title",name+"("+
|
||||
((KQUnitBiz.isLeaveHour(unitType))?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()))+")");
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title",SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+
|
||||
(KQReportBiz.getUnitType(kqReportFieldComInfo, user).length()>0?"("+ KQReportBiz.getUnitType(kqReportFieldComInfo, user)+")":""));
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
int workMins = rs.getInt("workMins");
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(serialid.length()>0){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,704 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import java.math.BigDecimal;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public GetKQDailyReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQDailyReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
boolean isDaily = kqReportFieldComInfo.getReportType().equals("daily");
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !isDaily)continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
if(kqReportFieldComInfo.getReportType1().equals("daily")){
|
||||
column.put("isdaily", "1");
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
// String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")&&!Util.null2String(rs.getOrgindbtype()).equals("jc")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
|
||||
String backFields = "b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb,(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb," +
|
||||
"(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb,(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs," +
|
||||
"(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts,(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts," +
|
||||
"(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts,(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts," +
|
||||
"(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs,(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm,(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm,(select sum(sch*60) from uf_jbsqhz where sqr = a.id and ksrq = b.kqdate and jblx in (1,2)) as jbsq," +
|
||||
"a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
|
||||
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
|
||||
" b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism ,b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc, b.kqdate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc, b.kqdate desc ";
|
||||
sql = backFields + sqlFrom + sqlWhere + orderBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + pageSize+ " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc, kqdate asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc, kqdate desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql+" ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(id, kqdate);
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1")) continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))
|
||||
continue;
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String fieldValueID = rs.getString("subcompanyid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
//fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getSubCompanyID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String fieldValueID = rs.getString("departmentid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
//fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getDepartmentID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String fieldValueID = rs.getString("jobtitle");
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle"));
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getJobTitle(id);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("cardOvertime")) {
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + Math.round(Util.getDoubleValue(fieldValue) / 60.0 * 2) / 2.0));
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("xqNew")) {
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (kqReportFieldComInfo.getParentid().equals("overtime") || kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
|
||||
if (fieldName.equals("overtimeTotal")) {
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave < 0 ? 0 : restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
} else {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("serialid")) {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (fieldValue.length()>0) {//弹性工作制没有班次
|
||||
// data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(fieldValue)){
|
||||
data.put("serialid", serialdata.get(fieldValue));
|
||||
}else{
|
||||
String tmpserialname = shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage());
|
||||
serialdata.put(fieldValue,tmpserialname);
|
||||
data.put("serialid", tmpserialname);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
data.putAll(this.getSignDetailInfo(id, kqdate));
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
kqLog.info("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.put(flowType, flowLeaveData);
|
||||
}
|
||||
|
||||
data.put("resourceId", id);
|
||||
data.put("kqdate", kqdate);
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
private String getUnitType(String unitType, User user){
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
return unitTypeName;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily")?"1":"0");
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,day_type,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
String dayType = Util.null2s(rs.getString("day_type"),"");
|
||||
int workMins = rs.getInt("workMins");
|
||||
boolean isNonWork = false;
|
||||
if(dayType.length() > 0){
|
||||
if("holiday".equals(dayType) || "playday".equals(dayType)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}else{
|
||||
if(workMins<=0){
|
||||
isNonWork = true;
|
||||
}else{
|
||||
if(serialid.length() > 0){
|
||||
String isRest = Util.null2s(kqShiftManagementComInfo.getIsRest(serialid),"");
|
||||
if("1".equals(isRest)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(!isNonWork){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
package com.api.login.cmd.login;
|
||||
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.login.Account;
|
||||
import weaver.login.VerifyLogin;
|
||||
|
||||
import java.util.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class GetAccountListCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
HttpServletRequest request = null;
|
||||
|
||||
public GetAccountListCmd(Map<String, Object> params, User user) {
|
||||
this.params = params;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public GetAccountListCmd(Map<String, Object> params, User user, HttpServletRequest request) {
|
||||
this.params = params;
|
||||
this.user = user;
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
ResourceComInfo rci = new ResourceComInfo();
|
||||
SubCompanyComInfo scci = new SubCompanyComInfo();
|
||||
DepartmentComInfo dci = new DepartmentComInfo();
|
||||
JobTitlesComInfo jtci = new JobTitlesComInfo();
|
||||
|
||||
List<Map<String, Object>> accountlist = new ArrayList<Map<String, Object>>();
|
||||
if (GCONST.getMOREACCOUNTLANDING()) {
|
||||
if (user.getUID() != 1) {
|
||||
VerifyLogin VerifyLogin = new VerifyLogin();
|
||||
List accounts = VerifyLogin.getAccountsById(user.getUID());
|
||||
request.getSession(true).setAttribute("accounts", accounts);
|
||||
if (accounts != null && accounts.size() > 1) {
|
||||
Iterator<Map<String, Object>> iterator = accounts.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Account a = (Account) iterator.next();
|
||||
Map<String, Object> item = new HashMap<String, Object>();
|
||||
item.put("userid", "" + a.getId());
|
||||
item.put("usertype", "" + a.getType());
|
||||
item.put("username", rci.getResourcename("" + a.getId()));
|
||||
item.put("icon", rci.getMessagerUrls("" + a.getId()));
|
||||
item.put("jobs", jtci.getJobTitlesname("" + a.getJobtitleid()));
|
||||
item.put("subcompanyid", a.getSubcompanyid());
|
||||
item.put("subcompanyname", scci.getSubCompanyname("" + a.getSubcompanyid()));
|
||||
item.put("deptid", a.getDepartmentid());
|
||||
item.put("deptname", dci.getDepartmentname("" + a.getDepartmentid()));
|
||||
item.put("iscurrent", user.getUID() == a.getId() ? "1" : "0");
|
||||
accountlist.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (accountlist.size() == 0) {
|
||||
Map<String, Object> item = new HashMap<String, Object>();
|
||||
item.put("userid", "" + user.getUID());
|
||||
item.put("username", rci.getResourcename("" + user.getUID()));
|
||||
item.put("icon", rci.getMessagerUrls("" + user.getUID()));
|
||||
item.put("jobs", jtci.getJobTitlesname(rci.getJobTitle(user.getUID()+"")));
|
||||
item.put("subcompanyid", rci.getSubCompanyID("" +user.getUID()));
|
||||
item.put("subcompanyname", scci.getSubCompanyname(rci.getSubCompanyID("" +user.getUID()) ));
|
||||
item.put("deptid", rci.getDepartmentID("" +user.getUID()));
|
||||
item.put("deptname", dci.getDepartmentname(rci.getDepartmentID("" +user.getUID())));
|
||||
item.put("iscurrent", "1");
|
||||
accountlist.add(item);
|
||||
}
|
||||
|
||||
data.put("userid", "" + user.getUID());
|
||||
data.put("username", rci.getResourcename("" + user.getUID()));
|
||||
data.put("icon", rci.getMessagerUrls("" + user.getUID()));
|
||||
data.put("jobs", jtci.getJobTitlesname(rci.getJobTitle(user.getUID()+"")));
|
||||
data.put("subcompanyid", rci.getSubCompanyID("" +user.getUID()));
|
||||
data.put("subcompanyname", scci.getSubCompanyname(rci.getSubCompanyID("" +user.getUID()) ));
|
||||
data.put("deptid", rci.getDepartmentID("" +user.getUID()));
|
||||
data.put("deptname", dci.getDepartmentname(rci.getDepartmentID("" +user.getUID())));
|
||||
data.put("iscurrent", "1");
|
||||
data.put("accountlist", accountlist);
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
String showMore = Util.null2String(bb.getPropValue("ThemeConfig", "frontend.showAccountMore"));
|
||||
String showSearch = Util.null2String(bb.getPropValue("ThemeConfig", "frontend.showAccountSearch"));
|
||||
String fontSetting = Util.null2String(bb.getPropValue("ThemeConfig", "frontend.fontSetting"));
|
||||
data.put("showMore", !"0".equals(showMore));
|
||||
data.put("showSearch", "1".equals(showSearch));
|
||||
data.put("fontSetting", "1".equals(fontSetting));
|
||||
data.put("userLanguage", "" + user.getLanguage());
|
||||
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
|
||||
result.put("data", data);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,190 @@
|
|||
package com.engine.kq.cmd.holidaySet;
|
||||
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.biz.SimpleBizLogger;
|
||||
import com.engine.common.constant.BizLogSmallType4Hrm;
|
||||
import com.engine.common.constant.BizLogType;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.kq.biz.*;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class AddHolidaySetCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private SimpleBizLogger logger;
|
||||
|
||||
public AddHolidaySetCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.logger = new SimpleBizLogger();
|
||||
|
||||
String groupId = Util.null2String(params.get("groupId"));//考勤组ID
|
||||
String syncGroupIds = Util.null2String(params.get("syncGroupIds"));//需要同步的考勤组ID
|
||||
String groupIds = groupId + (syncGroupIds.equals("") ? "" : ("," + syncGroupIds));
|
||||
BizLogContext bizLogContext = new BizLogContext();
|
||||
bizLogContext.setLogType(BizLogType.HRM_ENGINE);//模块类型
|
||||
bizLogContext.setBelongType(BizLogSmallType4Hrm.HRM_ENGINE_KQ_HOLIDAYSET);//所属大类型
|
||||
bizLogContext.setLogSmallType(BizLogSmallType4Hrm.HRM_ENGINE_KQ_HOLIDAYSET);//当前小类型
|
||||
bizLogContext.setParams(params);//当前request请求参数
|
||||
logger.setUser(user);//当前操作人
|
||||
String mainSql = "select * from kq_HolidaySet where groupId in (" + groupIds + ")";
|
||||
logger.setMainSql(mainSql, "id");//主表sql
|
||||
logger.setMainPrimarykey("id");//主日志表唯一key
|
||||
logger.setMainTargetNameMethod("com.engine.kq.util.KQTransMethod.getTargetName4HolidaySet","column:groupId+column:holidayDate+"+user.getLanguage());//当前targetName对应的列(对应日志中的对象名)
|
||||
logger.before(bizLogContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BizLogContext> getLogContexts() {
|
||||
return logger.getBizLogContexts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
String groupId = Util.null2String(params.get("groupId"));//考勤组ID
|
||||
String startDate = Util.null2String(params.get("startDate"));//开始日期
|
||||
String endDate = Util.null2String(params.get("endDate"));//结束日期
|
||||
String changeType = Util.null2String(params.get("changeType"));//类型:1-公众假日、2-调配工作日、3-调配休息日
|
||||
String holidayDesc = Util.null2String(params.get("holidayDesc"));//说明
|
||||
int relatedDay = Util.getIntValue((String) params.get("relatedDay"), -1);//对应工作日:0-星期一、1-星期二、2-星期三、3-星期四、4-星期五、5-星期六、6-星期日
|
||||
String isSync = Util.null2String(params.get("isSync"));//是否需要同步到其他考勤组
|
||||
String syncGroupIds = Util.null2String(params.get("syncGroupIds"));//需要同步的考勤组ID
|
||||
|
||||
try {
|
||||
boolean canAdd = HrmUserVarify.checkUserRight("KQHolidaySetAdd:Add", user);
|
||||
if (!canAdd) {
|
||||
resultMap.put("status", "-1");
|
||||
resultMap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
boolean flag = true;
|
||||
|
||||
String deleteSql = "delete from kq_HolidaySet where groupId=? and holidayDate=?";
|
||||
String insertSql = " insert into kq_HolidaySet(groupId,holidayDate,changeType,holidayDesc,relatedDay) values(?,?,?,?,?)";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
int days = Util.dayDiff(startDate, endDate);
|
||||
for (int i = 0; i < days; i++) {
|
||||
String holidayDate = getDateDel(startDate, i);
|
||||
/**
|
||||
* 如果这一天已经设置过数据,删除掉后再重新插入
|
||||
*/
|
||||
recordSet.executeUpdate(deleteSql, groupId, holidayDate);
|
||||
|
||||
flag = recordSet.executeUpdate(insertSql, groupId, holidayDate, changeType, holidayDesc, relatedDay);
|
||||
if (flag) {
|
||||
resultMap.put("sign", "1");
|
||||
resultMap.put("message", SystemEnv.getHtmlLabelName(83551, user.getLanguage()));//保存成功
|
||||
} else {
|
||||
resultMap.put("sign", "-1");
|
||||
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步到其他考勤组
|
||||
* 如果这一天已经设置过数据,删除掉后再重新插入
|
||||
*/
|
||||
KQGroupComInfo kqGroupComInfo = new KQGroupComInfo();
|
||||
if (isSync.equals("1") || isSync.equals("true")) {
|
||||
List<String> syncGroupIdList = Util.TokenizerString(syncGroupIds, ",");
|
||||
for (int j = 0; j < syncGroupIdList.size(); j++) {
|
||||
String tempGroupId = syncGroupIdList.get(j);
|
||||
|
||||
if (Util.null2String(kqGroupComInfo.getKqtype(tempGroupId)).equals("2") && changeType.equals("2")) {
|
||||
continue;
|
||||
}
|
||||
recordSet.executeUpdate(deleteSql, tempGroupId, holidayDate);
|
||||
flag = recordSet.executeUpdate(insertSql, tempGroupId, holidayDate, changeType, holidayDesc, relatedDay);
|
||||
if (!flag) {
|
||||
resultMap.put("sign", "-1");
|
||||
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
resultMap.put("sign", "1");
|
||||
resultMap.put("message", SystemEnv.getHtmlLabelName(83551, user.getLanguage()));//保存成功
|
||||
} else {
|
||||
resultMap.put("sign", "-1");
|
||||
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
|
||||
}
|
||||
} catch (Exception e) {
|
||||
resultMap.put("sign", "-1");
|
||||
resultMap.put("message", SystemEnv.getHtmlLabelName(382661, user.getLanguage()));
|
||||
writeLog(e);
|
||||
} finally {
|
||||
/*刷新缓存*/
|
||||
KQHolidaySetComInfo holidaySetComInfo = new KQHolidaySetComInfo();
|
||||
holidaySetComInfo.removeCache();
|
||||
|
||||
/*刷新报表*/
|
||||
List<String> groupIdList = new ArrayList<String>();
|
||||
if (isSync.equals("1") || isSync.equals("true")) {
|
||||
groupIdList = Util.TokenizerString(syncGroupIds, ",");
|
||||
if (groupIdList == null) {
|
||||
groupIdList = new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
groupIdList.add(groupId);
|
||||
List<String> holidayDateList = new ArrayList<String>();
|
||||
boolean isEnd = false;
|
||||
for (String holidayDate = startDate; !isEnd; holidayDate = DateUtil.getDate(holidayDate, 1)) {
|
||||
if (holidayDate.equals(endDate)) {
|
||||
isEnd = true;
|
||||
}
|
||||
if (!holidayDateList.contains(holidayDate)) {
|
||||
holidayDateList.add(holidayDate);
|
||||
}
|
||||
}
|
||||
new KQHolidaySetThread(groupIdList,holidayDateList).start();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取与data相隔num天的日期
|
||||
*
|
||||
* @param date
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private static String getDateDel(String date, int num) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
Date tempDate = null;
|
||||
try {
|
||||
tempDate = simpleDateFormat.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
calendar.setTime(tempDate);
|
||||
calendar.add(Calendar.DATE, num);
|
||||
tempDate = calendar.getTime();
|
||||
date = simpleDateFormat.format(tempDate);
|
||||
return date;
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,144 @@
|
|||
package com.engine.kq.cmd.attendanceEvent;
|
||||
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.kq.biz.KQGroupMemberComInfo;
|
||||
import com.engine.kq.biz.KQHolidaySetComInfo;
|
||||
import com.engine.kq.biz.KQOvertimeRulesBiz;
|
||||
import com.engine.kq.biz.KQWorkTime;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.enums.DurationTypeEnum;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 加班用的时长计算
|
||||
*/
|
||||
public class GetOverTimeWorkDurationCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetOverTimeWorkDurationCmd(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 resourceId = Util.null2String(params.get("resourceId"));
|
||||
String fromDate = Util.null2String(params.get("fromDate"));
|
||||
String toDate = Util.null2String(params.get("toDate"));
|
||||
String fromTime = Util.null2String(params.get("fromTime"));
|
||||
String toTime = Util.null2String(params.get("toTime"));
|
||||
String overtime_type = Util.null2String(params.get("overtime_type"));
|
||||
String timestamp = Util.null2String(params.get("timestamp"));
|
||||
|
||||
int minimumUnit = KQOvertimeRulesBiz.getMinimumUnit();
|
||||
//
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity kqWorkTimeEntity = kqWorkTime.getWorkTime(resourceId,fromDate);
|
||||
if(kqWorkTimeEntity != null){
|
||||
String kqType = Util.null2String(kqWorkTimeEntity.getKQType());
|
||||
if("3".equalsIgnoreCase(kqType)){
|
||||
writeLog("自由班制不计算加班");
|
||||
retmap.put("status", "1");
|
||||
retmap.put("message", ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005330,weaver.general.ThreadVarLanguage.getLang())+"");
|
||||
return retmap;
|
||||
}
|
||||
}
|
||||
ResourceComInfo rci = new ResourceComInfo();
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
String groupid = kqGroupMemberComInfo.getKQGroupId(resourceId,fromDate);
|
||||
if(resourceId.length() > 0 && groupid.length() == 0){
|
||||
retmap.put("status", "-1");
|
||||
retmap.put("message", rci.getLastname(resourceId)+","+fromDate+""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005329,weaver.general.ThreadVarLanguage.getLang())+"");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
//加班默认是工作日加班
|
||||
KQDurationCalculatorUtil kqDurationCalculatorUtil =new KQDurationCalculatorUtil.DurationParamBuilder(resourceId).
|
||||
fromDateParam(fromDate).toDateParam(toDate).fromTimeParam(fromTime).toTimeParam(toTime).computingModeParam("1").
|
||||
durationRuleParam(minimumUnit+"").durationTypeEnumParam(DurationTypeEnum.OVERTIME).
|
||||
overtime_typeParam(overtime_type).build();
|
||||
|
||||
Map<String,Object> durationMap = kqDurationCalculatorUtil.getWorkDuration();
|
||||
|
||||
String duration = Util.null2String(durationMap.get("duration"));
|
||||
|
||||
//二开工作日直接日期差值计算加班时长
|
||||
if("04:30".equals(fromTime)){
|
||||
//夜班加班,归属到前一天
|
||||
String fromDateN = DateUtil.addDate(fromDate, -1);
|
||||
WorkTimeEntity kqWorkTimeEntityN = kqWorkTime.getWorkTime(resourceId,fromDateN);
|
||||
int changeTypeNew = KQOvertimeRulesBiz.getChangeType(resourceId, fromDateN);
|
||||
new BaseBean().writeLog("二开工作日直接日期差值计算加班时长夜班groupid:"+groupid+"changeTypeNew:"+changeTypeNew);
|
||||
if(changeTypeNew == 2 && kqWorkTimeEntityN.getNonWorkShift() != 1){
|
||||
String fromDateTime = fromDate +" "+fromTime+":00";
|
||||
String toDateTime = toDate +" "+toTime+":00";
|
||||
String checkMins = String.valueOf(TimeUtil.timeInterval(fromDateTime,toDateTime));
|
||||
duration = String.valueOf(divide(checkMins,"3600"));
|
||||
}
|
||||
}else{
|
||||
int changeTypeNew = KQOvertimeRulesBiz.getChangeType(resourceId, fromDate);
|
||||
new BaseBean().writeLog("二开工作日直接日期差值计算加班时长groupid:"+groupid+"changeTypeNew:"+changeTypeNew);
|
||||
if(changeTypeNew == 2 && kqWorkTimeEntity.getNonWorkShift() != 1){
|
||||
String fromDateTime = fromDate +" "+fromTime+":00";
|
||||
String toDateTime = toDate +" "+toTime+":00";
|
||||
String checkMins = String.valueOf(TimeUtil.timeInterval(fromDateTime,toDateTime));
|
||||
duration = String.valueOf(divide(checkMins,"3600"));
|
||||
}
|
||||
}
|
||||
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
String fbid = resourceComInfo.getSubCompanyID(resourceId);
|
||||
if("1".equals(fbid) || "3".equals(fbid)){
|
||||
if(Double.parseDouble(duration)>=7.5){
|
||||
duration = "7.5";
|
||||
}
|
||||
}
|
||||
|
||||
retmap.put("duration", duration);
|
||||
retmap.put("timestamp", timestamp);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提供精确的除法运算。
|
||||
* @param v1 被加数
|
||||
* @param v2 加数
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static Double divide(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.divide(b2,2,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,728 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportDailyExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")),",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.add("kqdate");
|
||||
showColumns.add("serialid");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("signin1")){
|
||||
cascadekey = "signout1";
|
||||
}else if(showColumn.equals("signin2")){
|
||||
cascadekey = "signout2";
|
||||
}else if(showColumn.equals("signin3")){
|
||||
cascadekey = "signout3";
|
||||
}else if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
toDate = today;
|
||||
}
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String,Object>> constraintList = null;
|
||||
Map<String,Object> constraint = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
if("kqdate".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width",30*256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan",childColumns.size());
|
||||
}else{
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "2");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
String backFields = " b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb," +
|
||||
"(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb,(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb," +
|
||||
"(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs,(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts," +
|
||||
"(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts,(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts," +
|
||||
"(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts,(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"(select sum(sch) from uf_jbsqhz where sqr = a.id and ksrq = b.kqdate and jblx in (1,2)) as jbsq,a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins,b.beLate," +
|
||||
" b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins,b.graveLeaveEarly," +
|
||||
" b.graveLeaveEarlyMins,b.absenteeism,b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc , b.kqDate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select "+backFields + sqlFrom + sqlWhere+orderBy;
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
String tmpkey = id+"|"+kqdate+"|";
|
||||
// Map<String,Object> signDetailInfo = this.getSignDetailInfo(id,kqdate);
|
||||
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if(fieldName.equals("cardOvertime")){
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + Math.round(Util.getDoubleValue(fieldValue) / 60.0 * 2) / 2.0));
|
||||
} else if(fieldName.equals("xqNew")){
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
} else if(fieldName.equals("serialid")){
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
if(serialid.length()>0){
|
||||
// fieldValue = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(serialid)){
|
||||
fieldValue = serialdata.get(serialid);
|
||||
}else{
|
||||
String tmpserialname = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
fieldValue = tmpserialname;
|
||||
serialdata.put(serialid,tmpserialname);
|
||||
}
|
||||
}
|
||||
} else if(fieldName.equals("signin1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("leave")){
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
fieldValue = Util.null2String(flowData.get(id+"|"+kqdate+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(fieldValue);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
writeLog("ExportDailyExcelCmd:fieldValue" + fieldValue + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(fieldValue, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
fieldValue = flowLeaveData;
|
||||
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else if(fieldName.equals("kqdate")){
|
||||
fieldValue=kqdate+" "+com.engine.portal.util.DateUtil.getDayWeekOfDate1(DateUtil.parseToDate(kqdate));
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
|
||||
if(!fieldName.equals("leave") && !fieldName.equals("kqdate")) {
|
||||
fieldValue = Util.formatMultiLang(fieldValue, "" + user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList",constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390352, user.getLanguage())+" "+fromDate+" "+toDate;;
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
title = new HashMap<>();
|
||||
title.put("title",name+"("+
|
||||
((KQUnitBiz.isLeaveHour(unitType))?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()))+")");
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title",SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+
|
||||
(KQReportBiz.getUnitType(kqReportFieldComInfo, user).length()>0?"("+ KQReportBiz.getUnitType(kqReportFieldComInfo, user)+")":""));
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
int workMins = rs.getInt("workMins");
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(serialid.length()>0){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,638 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.UtilKQ;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.common.StringUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect = Util.null2String(jsonObj.get("typeselect"));
|
||||
if (typeselect.length() == 0) typeselect = "3";
|
||||
if (!typeselect.equals("") && !typeselect.equals("0") && !typeselect.equals("6")) {
|
||||
if (typeselect.equals("1")) {
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
} else {
|
||||
fromDate = TimeUtil.getDateByOption(typeselect, "0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect, "1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")), ",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("1", "" + user.getUID(), "a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String, Object>> constraintList = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (Util.null2String(kqReportFieldComInfo.getParentid()).length() > 0) continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))
|
||||
continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width", 30 * 256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(), user);
|
||||
childColumns = (List<Object>) mapChildColumnInfo.get("childColumns");
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
} else {
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
|
||||
titleList.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if (DateUtil.compDate(today, toDate) > 0) {//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// }
|
||||
|
||||
if(showColumns.contains("kqCalendar")) {
|
||||
childColumns = new ArrayList<>();
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
title = new HashMap<>();
|
||||
title.put("title", UtilKQ.getWeekDayShort(DateUtil.getWeek(date)-1,user.getLanguage()) +"\r\n"+ DateUtil.geDayOfMonth(date));
|
||||
title.put("width", 30 * 256);
|
||||
childColumns.add(title);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
title = new HashMap();
|
||||
title.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
String backFields = " (select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc," +
|
||||
"(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb," +
|
||||
"(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb," +
|
||||
"(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and u.sqrq>='"+fromDate+"' and u.sqrq<= '"+toDate+"') as zlxs," +
|
||||
"(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts," +
|
||||
"(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts," +
|
||||
"(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
|
||||
if (subCompanyId.length() > 0) {
|
||||
sqlWhere += " and a.subcompanyid1 in(" + subCompanyId + ") ";
|
||||
}
|
||||
|
||||
if (departmentId.length() > 0) {
|
||||
sqlWhere += " and a.departmentid in(" + departmentId + ") ";
|
||||
}
|
||||
|
||||
if (resourceId.length() > 0) {
|
||||
sqlWhere += " and a.id in(" + resourceId + ") ";
|
||||
}
|
||||
|
||||
if (viewScope.equals("4")) {//我的下属
|
||||
if (allLevel.equals("1")) {//所有下属
|
||||
sqlWhere += " and a.managerstr like '%," + user.getUID() + ",%'";
|
||||
} else {
|
||||
sqlWhere += " and a.managerid=" + user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select " + backFields + sqlFrom + sqlWhere + groupBy + orderBy;
|
||||
|
||||
//System.out.println("start" + DateUtil.getFullDate());
|
||||
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String, Object> flowData = new KQReportBiz().getFlowData(params, user);
|
||||
//System.out.println("end" + DateUtil.getFullDate());
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if (tmpSubcompanyId.length() == 0) {
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if (tmpDepartmentId.length() == 0) {
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if (tmpJobtitleId.length() == 0) {
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if (fieldName.equals("attendanceSerial")) {
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.add(kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else{
|
||||
data.add("");
|
||||
}
|
||||
continue;
|
||||
} else if (fieldName.equals("leave")) {//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.add(flowLeaveData);
|
||||
}
|
||||
continue;
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
} else if(Util.null2String(kqReportFieldComInfo.getCascadekey(fieldid)).length()>0){
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
|
||||
List<String> lsCascadekey = Util.splitString2List(kqReportFieldComInfo.getCascadekey(fieldid),",");
|
||||
for(int i=0;i<lsCascadekey.size();i++){
|
||||
if(Util.null2String(rs.getString(lsCascadekey.get(i))).length()>0){
|
||||
fieldid = KQReportFieldComInfo.field2Id.get(lsCascadekey.get(i));
|
||||
fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)),kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}else{
|
||||
fieldValue = "0";
|
||||
}
|
||||
data.add(fieldValue);
|
||||
}
|
||||
continue;
|
||||
}else {
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
fieldValue = Util.formatMultiLang(fieldValue,""+user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
if(showColumns.contains("kqCalendar")) {
|
||||
// Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true);
|
||||
Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true,uintType,show_card_source);
|
||||
isEnd = false;
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
if (DateUtil.compDate(today, date) > 0) {
|
||||
data.add("");
|
||||
} else {
|
||||
if (detialDatas.get(id + "|" + date) != null) {
|
||||
data.add(((Map<String, Object>) detialDatas.get(id + "|" + date)).get("text"));
|
||||
} else {
|
||||
data.add(SystemEnv.getHtmlLabelName(26593, user.getLanguage()));
|
||||
}
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
}
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList", constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390351, user.getLanguage())+" "+fromDate+" "+toDate;
|
||||
workbook.put("fileName", fileName);
|
||||
ExcelUtil ExcelUtil = new ExcelUtil();
|
||||
Map<String, Object> exportMap = ExcelUtil.export(workbook, request, response,true);
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String, Object> getChildColumnsInfo(String parentid, User user) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if (parentid.equals("attendanceSerial")) {//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
}
|
||||
for (int i = 0; serialIds != null && i < serialIds.size(); i++) {
|
||||
title = new HashMap<>();
|
||||
title.put("title", Util.formatMultiLang(kqShiftManagementComInfo.getSerial(serialIds.get(i)),""+user.getLanguage()));
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
} else if (parentid.equals("leave")) {
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for (int i = 0; leaveRules != null && i < leaveRules.size(); i++) {
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
String unitName = (KQUnitBiz.isLeaveHour(unitType)) ? SystemEnv.getHtmlLabelName(391, user.getLanguage()) : SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
title = new HashMap<>();
|
||||
title.put("title", name + "(" + unitName + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else {
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns", titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return titleList;
|
||||
}
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
title = new HashMap<>();
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
return titleList;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,760 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import java.math.BigDecimal;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public GetKQDailyReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQDailyReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
boolean isDaily = kqReportFieldComInfo.getReportType().equals("daily");
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !isDaily)continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
if(kqReportFieldComInfo.getReportType1().equals("daily")){
|
||||
column.put("isdaily", "1");
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
// String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")&&!Util.null2String(rs.getOrgindbtype()).equals("jc")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
|
||||
String backFields = "(select zjbxs*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zjbxs,(select jjrbtjia*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrbtjb,(select jjrdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrdksc,(select xxb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as xxb,(select zrbtjbzdx*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjbztx,(select gzsc from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as gzsc,(select psjbshic*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as psjbsc,b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb,(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb," +
|
||||
"(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb,(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs," +
|
||||
"(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts,(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts," +
|
||||
"(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts,(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts," +
|
||||
"(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs,(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm,(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm,(select sum(sch*60) from uf_jbsqhz where sqr = a.id and sqrq = b.kqdate and sxzt is null and jblx in (0,1,2,3)) as jbsq," +
|
||||
"a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
|
||||
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
|
||||
" b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism ,b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
//考勤异常状态
|
||||
String KQstatus = Util.null2String(jsonObj.get("KQstatus"));
|
||||
if ("5".equals(KQstatus)){
|
||||
|
||||
}else if ("1".equals(KQstatus)){
|
||||
sqlWhere += " and (absenteeismMins > 0 or forgotCheck > 0 or forgotBeginWorkCheckMins>0) ";
|
||||
}else if ("2".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0) ";
|
||||
}else if ("3".equals(KQstatus)){
|
||||
sqlWhere += " and (b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0) ";
|
||||
}else if ("4".equals(KQstatus)){
|
||||
sqlWhere +=" and (forgotCheck > 0 or forgotBeginWorkCheckMins>0)";
|
||||
}else if ("6".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins = 0 and b.graveBeLateMins = 0 and b.leaveEarlyMins = 0 and b.graveLeaveEarlyMins = 0 and absenteeismMins = 0 and forgotCheck = 0)";
|
||||
}else if ("7".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0 or b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0 or absenteeismMins > 0 or forgotCheck > 0 or forgotBeginWorkCheckMins > 0)";
|
||||
}
|
||||
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc, b.kqdate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc, b.kqdate desc ";
|
||||
sql = backFields + sqlFrom + sqlWhere + orderBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + pageSize+ " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc, kqdate asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc, kqdate desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql+" ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(id, kqdate);
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1")) continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))
|
||||
continue;
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String fieldValueID = rs.getString("subcompanyid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
//fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getSubCompanyID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String fieldValueID = rs.getString("departmentid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
//fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getDepartmentID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String fieldValueID = rs.getString("jobtitle");
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle"));
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getJobTitle(id);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("cardOvertime")) {
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
Double zlMinsNew = Util.getDoubleValue(fieldValue);
|
||||
String skjbcsy = divide(String.valueOf(changeBxs(zlMinsNew.intValue())),"60");
|
||||
fieldValue = skjbcsy;
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if(fieldName.equals("cdfz")){
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins"));
|
||||
data.put(fieldName, beLateMins);
|
||||
} else if(fieldName.equals("ztfz")){
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins"));
|
||||
data.put(fieldName, graveBeLateMins);
|
||||
} else if (fieldName.equals("xqNew")) {
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (kqReportFieldComInfo.getParentid().equals("overtime") || kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
|
||||
if (fieldName.equals("overtimeTotal")) {
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave < 0 ? 0 : restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
} else {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("serialid")) {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (fieldValue.length()>0) {//弹性工作制没有班次
|
||||
// data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(fieldValue)){
|
||||
data.put("serialid", serialdata.get(fieldValue));
|
||||
}else{
|
||||
String tmpserialname = shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage());
|
||||
serialdata.put(fieldValue,tmpserialname);
|
||||
data.put("serialid", tmpserialname);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
data.putAll(this.getSignDetailInfo(id, kqdate));
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
kqLog.info("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.put(flowType, flowLeaveData);
|
||||
}
|
||||
|
||||
data.put("resourceId", id);
|
||||
data.put("kqdate", kqdate);
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
private String getUnitType(String unitType, User user){
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
return unitTypeName;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily")?"1":"0");
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,day_type,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
String dayType = Util.null2s(rs.getString("day_type"),"");
|
||||
int workMins = rs.getInt("workMins");
|
||||
boolean isNonWork = false;
|
||||
if(dayType.length() > 0){
|
||||
if("holiday".equals(dayType) || "playday".equals(dayType)){
|
||||
isNonWork = true;
|
||||
}
|
||||
if(serialid.length() == 0){
|
||||
//弹性班制,会存在dayType是work但是没有班次的情况
|
||||
isNonWork = true;
|
||||
}
|
||||
}else{
|
||||
if(workMins<=0){
|
||||
isNonWork = true;
|
||||
}else{
|
||||
if(serialid.length() > 0){
|
||||
String isRest = Util.null2s(kqShiftManagementComInfo.getIsRest(serialid),"");
|
||||
if("1".equals(isRest)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(!isNonWork){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}else {
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 半小时转换
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static Integer changeBxs(Integer value){
|
||||
return (value / 30)*30 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的除法运算。
|
||||
* @param v1 被加数
|
||||
* @param v2 加数
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static String divide(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.divide(b2,2,BigDecimal.ROUND_HALF_UP).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.engine.gainway.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.gainway.service.BasicResourceTableService;
|
||||
import com.engine.gainway.service.impl.BasicResourceTableServiceImpl;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/12/11 2:25 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class BasicResourceTableAction {
|
||||
|
||||
private BasicResourceTableService getService(User user) {
|
||||
return ServiceUtil.getService(BasicResourceTableServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/linkTable")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String linkTable(@Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
Map<String, Object> data = new HashMap<>(8);
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
data.put("datas",getService(user).linkTable(ParamUtil.request2Map(request)));
|
||||
data.put("api_status", true);
|
||||
} catch (Exception e) {
|
||||
data.put("api_status", false);
|
||||
data.put("msg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,853 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.tools.ant.util.DateUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetKQReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
String isFromMyAttendance = Util.null2String(jsonObj.get("isFromMyAttendance"));//是否是来自我的考勤的请求,如果是,不加载考勤报表权限共享的限制,不然我的考勤会提示无权限
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
|
||||
String rightSql = kqReportBiz.getReportRight("1",""+user.getUID(),"a");
|
||||
if(isFromMyAttendance.equals("1")){
|
||||
rightSql = "";
|
||||
}
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0)continue;
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("type", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
columns.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束日期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){//结束日期不大于今天
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
|
||||
childColumns = new ArrayList<>();
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
column = new HashMap();
|
||||
column.put("title", DateUtil.geDayOfMonth(date));
|
||||
column.put("dataIndex", date);
|
||||
column.put("key", date);
|
||||
column.put("type", date);
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", 90);
|
||||
column.put("isCalendar", 1);
|
||||
childColumns.add(column);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
column.put("dataIndex", "kqCalendar");
|
||||
column.put("key", "kqCalendar");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", childColumns.size()*90);
|
||||
column.put("children", childColumns);
|
||||
}
|
||||
columns.add(column);
|
||||
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
String backFields = " a.companystartdate,(select sum(gxbts) as gxbts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gxbts,(select sum(xchu) as xcqts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xcqts,(select sum(jjrbtjia*60) as jjrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrbtjb,(select sum(jjrdksc*60) as jjrdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrdksc,(select sum(xxb) as xxb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xxb,(select sum(zrbtjbzdx*60) as zrbtjbztx from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjbztx,(select sum(gzsc) as gzsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gzsc,(select sum(psjbshic*60) as psjbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as psjbsc,(select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc,(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb,(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb,(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and u.ksrq>='"+fromDate+"' and u.ksrq<= '"+toDate+"') as zlxs,(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts,(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts,(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle, " +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle,a.companystartdate ";
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
sqlWhere += " and 1=2 ";
|
||||
}
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+groupBy+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by t.dsporder asc, t.lastname asc ";
|
||||
String descOrderBy = " order by t.dsporder desc, t.lastname desc ";
|
||||
|
||||
//默认排序设置 start,有性能问题,先取消,后面再看看有没有好的方式
|
||||
// String orderBySql = "select * from kq_report_order where userId=? and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql, user.getUID());
|
||||
// if (rs.getCounts() <= 0) {
|
||||
// orderBySql = "select * from kq_report_order where userId=0 and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql);
|
||||
// }
|
||||
// while (rs.next()) {
|
||||
// String dataIndex = rs.getString("dataIndex");
|
||||
// String ascOrDesc = rs.getString("ascOrDesc");
|
||||
// String ascOrDesc1 = (ascOrDesc.equals("")||ascOrDesc.equals("asc"))?"desc":"asc";
|
||||
// if (dataIndex.equals("organization")) {
|
||||
// orderBy += ",showOrderOfDeptTree " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += ",showOrderOfDeptTree " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// }
|
||||
// if (dataIndex.equalsIgnoreCase("dspOrder") || dataIndex.equalsIgnoreCase("lastName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("deptShowOrder") || dataIndex.equalsIgnoreCase("deptName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("subcomShowOrder") || dataIndex.equalsIgnoreCase("subcomName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",subcom_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",subcom_id " + ascOrDesc1;
|
||||
// }
|
||||
// }
|
||||
// orderBy = orderBy.startsWith(",") ? orderBy.substring(1) : orderBy;
|
||||
// descOrderBy = descOrderBy.startsWith(",") ? descOrderBy.substring(1) : descOrderBy;
|
||||
// orderBy = orderBy.equals("") ? " t.dspOrder,t.id " : orderBy;
|
||||
// descOrderBy = descOrderBy.equals("") ? " t.dspOrder,t.id " : descOrderBy;
|
||||
// orderBy = "order by "+orderBy;
|
||||
|
||||
sql = backFields + sqlFrom + sqlWhere + groupBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " +pageSize + " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql + orderBy+ " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql+orderBy;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
|
||||
|
||||
bb.writeLog("getKqReportCmd:"+sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
String id = rs.getString("id");
|
||||
data.put("resourceId",id);
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1"))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
data.put("subcompanyId",tmpSubcompanyId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
data.put("departmentId",tmpDepartmentId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
data.put("jobtitleId",tmpJobtitleId);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
}else if(fieldName.equals("cdfz")){
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins"));
|
||||
fieldValue = beLateMins;
|
||||
}else if(fieldName.equals("ztfz")){
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins"));
|
||||
fieldValue = graveBeLateMins;
|
||||
}else if(fieldName.equals("xcqts")){
|
||||
String xcqtsDays = getXcqts(fromDate,id);
|
||||
fieldValue = xcqtsDays;
|
||||
}else if(fieldName.equals("attendanceSerial")){
|
||||
List<String> serialIds = null;
|
||||
if(attendanceSerial.length()>0){
|
||||
serialIds = Util.splitString2List(attendanceSerial,",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
if(fieldName.equals("overtimeTotal")){
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else{
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id+"|"+fieldName)));
|
||||
}
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if(Util.null2String(kqReportFieldComInfo.getUnittype()).length()>0) {
|
||||
if(fieldValue.length() == 0){
|
||||
fieldValue="0";
|
||||
}else{
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
data.put(fieldName,fieldValue);
|
||||
}
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_"+leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+flowLeaveBackType)),"0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(leaveData.length() == 0){
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if(leavebackData.length() == 0){
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if(b_flowLeaveData.length() > 0){
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
}else{
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0)));
|
||||
}
|
||||
data.put(flowType,flowLeaveData);
|
||||
}
|
||||
|
||||
Map<String,Object> detialDatas = kqReportBiz.getDetialDatas(id,fromDate,toDate,user,flowData,false,uintType,show_card_source);
|
||||
// new KQLog().info("id:"+id+":detialDatas:"+detialDatas);
|
||||
isEnd = false;
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
if(DateUtil.compDate(today, date)>0){
|
||||
data.put(date,"");
|
||||
}else{
|
||||
// new KQLog().info("id:date:"+(id+"|"+date)+":detialDatas.get:"+detialDatas.get(id+"|"+date));
|
||||
data.put(date,detialDatas.get(id+"|"+date)==null?SystemEnv.getHtmlLabelName(26593, user.getLanguage()):detialDatas.get(id+"|"+date));
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("attendanceSerial")){//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if(Util.null2String(jsonObj.get("attendanceSerial")).length()>0){
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")),",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
column = new HashMap();
|
||||
column.put("title", kqShiftManagementComInfo.getSerial(serialIds.get(i)));
|
||||
column.put("unit", "");
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", serialIds.get(i));
|
||||
column.put("key", serialIds.get(i));
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return lsChildColumns;
|
||||
}
|
||||
Map<String,Object> column = null;
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lsChildColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getXcqts(String dateOri,String userId){
|
||||
//本月第一天
|
||||
String fromDate = TimeUtil.getMonthBeginDay(dateOri);
|
||||
//本月最后一天
|
||||
String toDate = TimeUtil.getMonthEndDay(dateOri);
|
||||
Set<String> all = new HashSet<>();
|
||||
all.add(fromDate);
|
||||
List<String> back = days(fromDate,toDate);
|
||||
all.addAll(back);
|
||||
all.add(toDate);
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//需出勤天数
|
||||
Integer xcqtsAll = 0;
|
||||
//考勤组大小周A
|
||||
String dxzA = bb.getPropValue("jgKq_main","dxzA");
|
||||
//考勤组大小周B
|
||||
String dxzB = bb.getPropValue("jgKq_main","dxzB");
|
||||
String rykqz = getCusFieldData(Integer.valueOf(userId),"field31",3);
|
||||
|
||||
for (String date : all) {
|
||||
KQHolidaySetComInfo holidaySetComInfo = new KQHolidaySetComInfo();
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
/*获取考勤组的ID,因为考勤组有有效期,所以需要传入日期*/
|
||||
String groupId = kqGroupMemberComInfo.getKQGroupId(userId, date);
|
||||
String changeTypeNew = holidaySetComInfo.getChangeType(groupId, date);
|
||||
String rzlxZdy = findRqlx(userId,date);
|
||||
//日期类型,0是工作日、1是周六、2是周日
|
||||
Integer rqlx = -1;
|
||||
if("0".equals(rzlxZdy)){
|
||||
rqlx = 0;
|
||||
}else if("1".equals(rzlxZdy)){
|
||||
rqlx = 1;
|
||||
}else if("2".equals(rzlxZdy)){
|
||||
rqlx = 2;
|
||||
}else if(DateUtil.getWeek(date) == 6){
|
||||
rqlx = 1;
|
||||
}else if(DateUtil.getWeek(date) == 7){
|
||||
rqlx = 2;
|
||||
}else {
|
||||
rqlx = 0;
|
||||
}
|
||||
Integer xcqts = 0;
|
||||
if("4".equals(rykqz)){
|
||||
//单休判断是不是周日,是的话不计
|
||||
if(rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}else if ("8".equals(rykqz)){
|
||||
//双休判断是不是周六周日,是的话不计
|
||||
if(rqlx == 1 || rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}else if(dxzA.equals(rykqz) || dxzB.equals(rykqz)){
|
||||
//双休判断是不是周六周日,是的话不计
|
||||
if(rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else if (rqlx == 1){
|
||||
//周六是工作日的话计
|
||||
if("2".equals(changeTypeNew)){
|
||||
xcqts = 1;
|
||||
}else{
|
||||
xcqts = 0;
|
||||
}
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}
|
||||
xcqtsAll = xcqtsAll+xcqts;
|
||||
}
|
||||
|
||||
return String.valueOf(xcqtsAll);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取两个日期之间所有的日期
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList days(String date1, String date2) {
|
||||
String dateFormat = "yyyy-MM-dd";
|
||||
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
ArrayList L = new ArrayList();
|
||||
if (date1.equals(date2)) {
|
||||
System.out.println("两个日期相等!");
|
||||
return L;
|
||||
}
|
||||
|
||||
String tmp;
|
||||
if (date1.compareTo(date2) > 0) { // 确保 date1的日期不晚于date2
|
||||
tmp = date1;
|
||||
date1 = date2;
|
||||
date2 = tmp;
|
||||
}
|
||||
|
||||
tmp = format.format(str2Date(date1).getTime() + 3600 * 24 * 1000);
|
||||
|
||||
int num = 0;
|
||||
while (tmp.compareTo(date2) < 0) {
|
||||
L.add(tmp);
|
||||
num++;
|
||||
tmp = format.format(str2Date(tmp).getTime() + 3600 * 24 * 1000);
|
||||
}
|
||||
|
||||
if (num == 0)
|
||||
System.out.println("两个日期相邻!");
|
||||
return L;
|
||||
}
|
||||
|
||||
private static Date str2Date(String str) {
|
||||
String dateFormat = "yyyy-MM-dd";
|
||||
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
return format.parse(str);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义日期类型判断
|
||||
* @param userId
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String findRqlx(String userId,String date){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select rqlx from uf_rqzdygs where CONCAT(xm,',') like('%"+userId+",%') and rq = '"+date+"'";
|
||||
rs.executeQuery(sql);
|
||||
String rqlx = "-1";
|
||||
if(rs.next()){
|
||||
rqlx = Util.null2String(rs.getString("rqlx"));
|
||||
}
|
||||
return StringUtils.isBlank(rqlx)?"-1":rqlx;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义字段的值
|
||||
* @param id
|
||||
* @param fieldname
|
||||
* @param scopeid
|
||||
* @return
|
||||
*/
|
||||
public static String getCusFieldData(Integer id,String fieldname,int scopeid){
|
||||
String fieldVal = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select "+fieldname+" from cus_fielddata where id=? and scopeid=? and scope='HrmCustomFieldByInfoType' ";
|
||||
rs.executeQuery(sql,id,scopeid);
|
||||
if(rs.next()){
|
||||
fieldVal = Util.null2String(rs.getString(fieldname));
|
||||
}
|
||||
return fieldVal;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,338 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.jucailin.genid.IdGenerator;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.engine.kq.enums.FlowReportTypeEnum;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
import static com.engine.kq.biz.KQFormatData.createSignInfoMo;
|
||||
|
||||
/**
|
||||
* 格式化自由工时数据
|
||||
*/
|
||||
public class KQFormatFreeData extends BaseBean{
|
||||
private static DecimalFormat df = new DecimalFormat("0.00");
|
||||
protected KQLog kqLog = new KQLog();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @param kqDate
|
||||
* @param workFlowInfo
|
||||
* @return
|
||||
*/
|
||||
public List<List<Object>> format(String userId, String kqDate, Map<String,Object> workFlowInfo){
|
||||
List<List<Object>> lsParam = new ArrayList<>();
|
||||
List<Object> params = new ArrayList<>();
|
||||
try{
|
||||
Timestamp date = new Timestamp(System.currentTimeMillis());
|
||||
int workMins = 0;
|
||||
String signInId = "";
|
||||
String signInDate = "";
|
||||
String signInTime = "";
|
||||
String signOutId = "";
|
||||
String signOutDate = "";
|
||||
String signOutTime = "";
|
||||
|
||||
String temp_signInDate = "";
|
||||
String temp_signInTime = "";
|
||||
String temp_signOutDate = "";
|
||||
String temp_signOutTime = "";
|
||||
|
||||
String cal_signInId = "";
|
||||
String cal_signInDate = "";
|
||||
String cal_signInTime = "";
|
||||
String cal_signOutId = "";
|
||||
String cal_signOutDate = "";
|
||||
String cal_signOutTime = "";
|
||||
|
||||
int signMins = 0;
|
||||
int attendanceMins=0;
|
||||
String serialid = "";
|
||||
String groupid = "";
|
||||
int beLateMins = 0;
|
||||
int graveBeLateMins = 0;
|
||||
int leaveEarlyMins =0;
|
||||
int graveLeaveEarlyMins =0;
|
||||
int absenteeismMins =0;
|
||||
int leaveMins = 0;//请假时长
|
||||
int evectionMins = 0;//出差时长
|
||||
int outMins = 0;//公出时长
|
||||
Map<String,Integer> leaveInfo = new HashMap<>();//请假信息
|
||||
Map<String,Object> otherinfo = new HashMap<>();//存一些用得到的信息
|
||||
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
|
||||
int workBeginIdx = 0;
|
||||
int beginIdx = 0;
|
||||
int endIdx = 0;
|
||||
String dateKey = userId +"|"+ kqDate;
|
||||
String nextDate = DateUtil.addDate(kqDate, 1);
|
||||
|
||||
List<Object> workFlow = null;
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId,kqDate);
|
||||
String signstart = "";
|
||||
String calmethod = "2";
|
||||
if(workTime!=null) {
|
||||
groupid = Util.null2String(workTime.getGroupId());
|
||||
signstart = Util.null2String(workTime.getSignStart());//签到开始时间
|
||||
workMins = Util.getIntValue(Util.null2String(workTime.getWorkMins()));//工作时长
|
||||
workBeginIdx = kqTimesArrayComInfo.getArrayindexByTimes(signstart);
|
||||
calmethod = Util.null2s(workTime.getCalmethod(),"1");//自由班制计算方式
|
||||
}
|
||||
// 弹性工作制是否可以跨天
|
||||
boolean isFreezeAcross = KQSettingsBiz.is_freeAcross();
|
||||
|
||||
int kqSize = 1440;
|
||||
if(isFreezeAcross){
|
||||
kqSize = kqTimesArrayComInfo.getIndexSize();
|
||||
}
|
||||
int[] dayMins = new int[kqSize];//一天所有分钟数
|
||||
|
||||
if(workFlowInfo.get(dateKey)!=null){
|
||||
workFlow = (List<Object>)workFlowInfo.get(dateKey);
|
||||
}
|
||||
|
||||
for(int j=0;workFlow!=null&&j<workFlow.size();j++) {
|
||||
Map<String, Object> data = (Map<String, Object>) workFlow.get(j);
|
||||
String flowType = Util.null2String(data.get("flowtype"));
|
||||
String newLeaveType = Util.null2String(data.get("newleavetype"));
|
||||
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("begintime")));
|
||||
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("endtime")));
|
||||
if(flowType.equals(FlowReportTypeEnum.EVECTION.getFlowType())){
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 7);//出差抵扣时段标识 7
|
||||
}else if(flowType.equals(FlowReportTypeEnum.OUT.getFlowType())){
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 8);//公出抵扣时段标识 8
|
||||
}else{
|
||||
if (endIdx > beginIdx) {
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 5);//流程抵扣时段标识 5
|
||||
if(flowType.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())){
|
||||
int tmpBeginIdx = beginIdx;
|
||||
int tmpEndIdx = endIdx;
|
||||
int val = 0;
|
||||
if(leaveInfo.get(newLeaveType)==null){
|
||||
leaveInfo.put(newLeaveType,val);
|
||||
}else{
|
||||
val = leaveInfo.get(newLeaveType);
|
||||
}
|
||||
if(beginIdx<workBeginIdx)tmpBeginIdx=workBeginIdx;
|
||||
if(tmpEndIdx>tmpBeginIdx){
|
||||
leaveInfo.put(newLeaveType,val+(tmpEndIdx-tmpBeginIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String signBeginDateTime = kqDate + " "+ signstart+":00";
|
||||
String signEndDateTime = kqDate + " 23:59:59";
|
||||
if(isFreezeAcross){
|
||||
signEndDateTime = nextDate + " "+ signstart+":00";
|
||||
}
|
||||
String workBeginDateTime = "";
|
||||
String workEndDateTime = "";
|
||||
List<Object> lsCheckInfo = new KQFormatSignData().getSignInfoForAll(userId,signBeginDateTime,signEndDateTime,workBeginDateTime,workEndDateTime);
|
||||
|
||||
if("2".equalsIgnoreCase(calmethod)){
|
||||
//成对出现
|
||||
if(!lsCheckInfo.isEmpty()) {
|
||||
if(lsCheckInfo.size()%2==1 && lsCheckInfo.size() > 1){
|
||||
lsCheckInfo.remove(lsCheckInfo.size()-1);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(!lsCheckInfo.isEmpty()) {
|
||||
List<Object> tmplsCheckInfo = Lists.newArrayList();
|
||||
tmplsCheckInfo.add(lsCheckInfo.get(0));
|
||||
if(lsCheckInfo.size()>1) {
|
||||
tmplsCheckInfo.add(lsCheckInfo.get(lsCheckInfo.size() - 1));
|
||||
}
|
||||
lsCheckInfo.clear();
|
||||
lsCheckInfo.addAll(tmplsCheckInfo);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i<lsCheckInfo.size(); i++) {//有签到签退才算出勤,漏签无法统计出勤时间
|
||||
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(i);
|
||||
String signId = Util.null2String(checkInfo.get("signId"));
|
||||
String signDate = Util.null2String(checkInfo.get("signDate"));
|
||||
String signTime = Util.null2String(checkInfo.get("signTime"));
|
||||
if (signTime.length() > 8) {
|
||||
signTime = signTime.substring(0, 8);
|
||||
}
|
||||
|
||||
//用于计算打卡时长
|
||||
if (checkInfo.get("signType").equals("1")) {//签到
|
||||
temp_signInDate = signDate;
|
||||
if(temp_signInDate.compareTo(kqDate) > 0){
|
||||
temp_signInTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}else{
|
||||
temp_signInTime = signTime;
|
||||
}
|
||||
} else if (checkInfo.get("signType").equals("2")) {//签退
|
||||
temp_signOutDate = signDate;
|
||||
if(temp_signOutDate.compareTo(kqDate) > 0){
|
||||
temp_signOutTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}else{
|
||||
temp_signOutTime = signTime;
|
||||
}
|
||||
}
|
||||
|
||||
if (i==0 && checkInfo.get("signType").equals("1")) {//签到
|
||||
signInId = signId;
|
||||
signInDate = signDate;
|
||||
signInTime = signTime;
|
||||
if(temp_signInDate.compareTo(kqDate) > 0){
|
||||
temp_signInTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}else{
|
||||
temp_signInTime = signTime;
|
||||
}
|
||||
} else if (i==lsCheckInfo.size()-1&&checkInfo.get("signType").equals("2")) {//签退
|
||||
signOutId = signId;
|
||||
signOutDate = signDate;
|
||||
signOutTime = signTime;
|
||||
}
|
||||
|
||||
if("2".equalsIgnoreCase(calmethod)){
|
||||
if(i%2==1){
|
||||
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(temp_signInTime);
|
||||
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(temp_signOutTime);
|
||||
if(endIdx>beginIdx) {
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 1);//工作时段标识 1
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(i == 0){
|
||||
cal_signInId = signId;
|
||||
cal_signInDate = signDate;
|
||||
cal_signInTime = signTime;
|
||||
}else {
|
||||
cal_signOutId = signId;
|
||||
cal_signOutDate = signDate;
|
||||
cal_signOutTime = signTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if("1".equalsIgnoreCase(calmethod)){
|
||||
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(cal_signInTime);
|
||||
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(cal_signOutTime);
|
||||
if(cal_signInDate.compareTo(kqDate) > 0){
|
||||
beginIdx = kqTimesArrayComInfo.turn24to48TimeIndex(beginIdx);
|
||||
}
|
||||
if(cal_signOutDate.compareTo(kqDate) > 0){
|
||||
endIdx = kqTimesArrayComInfo.turn24to48TimeIndex(endIdx);
|
||||
}
|
||||
if(endIdx>beginIdx) {
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 1);//工作时段标识 1
|
||||
}
|
||||
signInId = cal_signInId;
|
||||
signInDate = cal_signInDate;
|
||||
signInTime = cal_signInTime;
|
||||
signOutId = cal_signOutId;
|
||||
signOutDate = cal_signOutDate;
|
||||
signOutTime = cal_signOutTime;
|
||||
}
|
||||
|
||||
int workFlowMins = 0;
|
||||
for(int i=workBeginIdx;i<kqSize;i++) {
|
||||
switch(dayMins[i]){
|
||||
case 1://出勤分钟数
|
||||
attendanceMins++;
|
||||
break;
|
||||
case 5:
|
||||
leaveMins++;//请假分钟数
|
||||
break;
|
||||
case 7:
|
||||
evectionMins++;
|
||||
break;
|
||||
case 8:
|
||||
outMins++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//计算实际出勤时间(打卡、出差、公出算出勤)
|
||||
signMins = attendanceMins;
|
||||
attendanceMins = attendanceMins+evectionMins+outMins;
|
||||
if(attendanceMins>workMins)attendanceMins=workMins;
|
||||
|
||||
absenteeismMins = workMins - attendanceMins-leaveMins;
|
||||
if(absenteeismMins<0){
|
||||
absenteeismMins=0;
|
||||
}
|
||||
|
||||
if (workTime.getIsExclude()) {//无需考勤人员没有异常状态
|
||||
attendanceMins = workMins;
|
||||
beLateMins = 0;
|
||||
graveBeLateMins = 0;
|
||||
leaveEarlyMins = 0;
|
||||
graveLeaveEarlyMins = 0;
|
||||
absenteeismMins = 0;
|
||||
}
|
||||
|
||||
createSignInfoMo(userId,kqDate,signMins,signInTime,signOutTime);
|
||||
|
||||
params.add(userId);
|
||||
params.add(kqDate);
|
||||
params.add(groupid.length() == 0 ? null : groupid);
|
||||
params.add(serialid.length() == 0 ? null : serialid);
|
||||
params.add(0);
|
||||
params.add(null);
|
||||
params.add(null);
|
||||
params.add(null);
|
||||
params.add(null);
|
||||
params.add(workMins);
|
||||
params.add(signInDate);
|
||||
params.add(signInTime);
|
||||
params.add(signInId.length() == 0 ? null : signInId);
|
||||
params.add(signOutDate);
|
||||
params.add(signOutTime);
|
||||
params.add(signOutId.length() == 0 ? null : signOutId);
|
||||
params.add(signMins);
|
||||
params.add(attendanceMins);
|
||||
params.add(beLateMins);
|
||||
params.add(graveBeLateMins);
|
||||
params.add(leaveEarlyMins);
|
||||
params.add(graveLeaveEarlyMins);
|
||||
params.add(absenteeismMins);
|
||||
params.add(null);
|
||||
params.add(leaveMins);
|
||||
params.add(JSONObject.toJSONString(leaveInfo));
|
||||
params.add(evectionMins);
|
||||
params.add(outMins);
|
||||
params.add(null);
|
||||
params.add(0);
|
||||
params.add(JSONObject.toJSONString(otherinfo));
|
||||
Long id = IdGenerator.generate();
|
||||
params.add(workTime.getDayType());
|
||||
params.add(date);
|
||||
params.add(date);
|
||||
params.add(id);
|
||||
lsParam.add(params);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
kqLog.info(e);
|
||||
}
|
||||
return lsParam;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,853 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.tools.ant.util.DateUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetKQReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
String isFromMyAttendance = Util.null2String(jsonObj.get("isFromMyAttendance"));//是否是来自我的考勤的请求,如果是,不加载考勤报表权限共享的限制,不然我的考勤会提示无权限
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
|
||||
String rightSql = kqReportBiz.getReportRight("1",""+user.getUID(),"a");
|
||||
if(isFromMyAttendance.equals("1")){
|
||||
rightSql = "";
|
||||
}
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0)continue;
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("type", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
columns.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束日期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){//结束日期不大于今天
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
|
||||
childColumns = new ArrayList<>();
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
column = new HashMap();
|
||||
column.put("title", DateUtil.geDayOfMonth(date));
|
||||
column.put("dataIndex", date);
|
||||
column.put("key", date);
|
||||
column.put("type", date);
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", 90);
|
||||
column.put("isCalendar", 1);
|
||||
childColumns.add(column);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
column.put("dataIndex", "kqCalendar");
|
||||
column.put("key", "kqCalendar");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", childColumns.size()*90);
|
||||
column.put("children", childColumns);
|
||||
}
|
||||
columns.add(column);
|
||||
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
String backFields = " a.companystartdate,(select sum(gxbts) as gxbts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gxbts,(select sum(xchu) as xcqts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xcqts,(select sum(jjrbtjia*60) as jjrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrbtjb,(select sum(jjrdksc*60) as jjrdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrdksc,(select sum(xxb) as xxb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xxb,(select sum(zrbtjbzdx*60) as zrbtjbztx from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjbztx,(select sum(gzsc) as gzsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gzsc,(select sum(psjbshic*60) as psjbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as psjbsc,(select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc,(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb,(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb,(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and u.ksrq>='"+fromDate+"' and u.ksrq<= '"+toDate+"') as zlxs,(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts,(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts,(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle, " +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle,a.companystartdate ";
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
sqlWhere += " and 1=2 ";
|
||||
}
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+groupBy+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by t.dsporder asc, t.lastname asc ";
|
||||
String descOrderBy = " order by t.dsporder desc, t.lastname desc ";
|
||||
|
||||
//默认排序设置 start,有性能问题,先取消,后面再看看有没有好的方式
|
||||
// String orderBySql = "select * from kq_report_order where userId=? and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql, user.getUID());
|
||||
// if (rs.getCounts() <= 0) {
|
||||
// orderBySql = "select * from kq_report_order where userId=0 and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql);
|
||||
// }
|
||||
// while (rs.next()) {
|
||||
// String dataIndex = rs.getString("dataIndex");
|
||||
// String ascOrDesc = rs.getString("ascOrDesc");
|
||||
// String ascOrDesc1 = (ascOrDesc.equals("")||ascOrDesc.equals("asc"))?"desc":"asc";
|
||||
// if (dataIndex.equals("organization")) {
|
||||
// orderBy += ",showOrderOfDeptTree " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += ",showOrderOfDeptTree " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// }
|
||||
// if (dataIndex.equalsIgnoreCase("dspOrder") || dataIndex.equalsIgnoreCase("lastName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("deptShowOrder") || dataIndex.equalsIgnoreCase("deptName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("subcomShowOrder") || dataIndex.equalsIgnoreCase("subcomName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",subcom_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",subcom_id " + ascOrDesc1;
|
||||
// }
|
||||
// }
|
||||
// orderBy = orderBy.startsWith(",") ? orderBy.substring(1) : orderBy;
|
||||
// descOrderBy = descOrderBy.startsWith(",") ? descOrderBy.substring(1) : descOrderBy;
|
||||
// orderBy = orderBy.equals("") ? " t.dspOrder,t.id " : orderBy;
|
||||
// descOrderBy = descOrderBy.equals("") ? " t.dspOrder,t.id " : descOrderBy;
|
||||
// orderBy = "order by "+orderBy;
|
||||
|
||||
sql = backFields + sqlFrom + sqlWhere + groupBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " +pageSize + " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql + orderBy+ " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql+orderBy;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
|
||||
|
||||
bb.writeLog("getKqReportCmd:"+sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
String id = rs.getString("id");
|
||||
data.put("resourceId",id);
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1"))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
data.put("subcompanyId",tmpSubcompanyId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
data.put("departmentId",tmpDepartmentId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
data.put("jobtitleId",tmpJobtitleId);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
}else if(fieldName.equals("cdfz")){
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins"));
|
||||
fieldValue = beLateMins;
|
||||
}else if(fieldName.equals("ztfz")){
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins"));
|
||||
fieldValue = graveBeLateMins;
|
||||
}else if(fieldName.equals("xcqts")){
|
||||
String xcqtsDays = getXcqts(fromDate,id);
|
||||
fieldValue = xcqtsDays;
|
||||
}else if(fieldName.equals("attendanceSerial")){
|
||||
List<String> serialIds = null;
|
||||
if(attendanceSerial.length()>0){
|
||||
serialIds = Util.splitString2List(attendanceSerial,",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
if(fieldName.equals("overtimeTotal")){
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else{
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id+"|"+fieldName)));
|
||||
}
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if(Util.null2String(kqReportFieldComInfo.getUnittype()).length()>0) {
|
||||
if(fieldValue.length() == 0){
|
||||
fieldValue="0";
|
||||
}else{
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
data.put(fieldName,fieldValue);
|
||||
}
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_"+leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+flowLeaveBackType)),"0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(leaveData.length() == 0){
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if(leavebackData.length() == 0){
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if(b_flowLeaveData.length() > 0){
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
}else{
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0)));
|
||||
}
|
||||
data.put(flowType,flowLeaveData);
|
||||
}
|
||||
|
||||
Map<String,Object> detialDatas = kqReportBiz.getDetialDatas(id,fromDate,toDate,user,flowData,false,uintType,show_card_source);
|
||||
// new KQLog().info("id:"+id+":detialDatas:"+detialDatas);
|
||||
isEnd = false;
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
if(DateUtil.compDate(today, date)>0){
|
||||
data.put(date,"");
|
||||
}else{
|
||||
// new KQLog().info("id:date:"+(id+"|"+date)+":detialDatas.get:"+detialDatas.get(id+"|"+date));
|
||||
data.put(date,detialDatas.get(id+"|"+date)==null?SystemEnv.getHtmlLabelName(26593, user.getLanguage()):detialDatas.get(id+"|"+date));
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("attendanceSerial")){//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if(Util.null2String(jsonObj.get("attendanceSerial")).length()>0){
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")),",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
column = new HashMap();
|
||||
column.put("title", kqShiftManagementComInfo.getSerial(serialIds.get(i)));
|
||||
column.put("unit", "");
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", serialIds.get(i));
|
||||
column.put("key", serialIds.get(i));
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return lsChildColumns;
|
||||
}
|
||||
Map<String,Object> column = null;
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lsChildColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getXcqts(String dateOri,String userId){
|
||||
//本月第一天
|
||||
String fromDate = TimeUtil.getMonthBeginDay(dateOri);
|
||||
//本月最后一天
|
||||
String toDate = TimeUtil.getMonthEndDay(dateOri);
|
||||
Set<String> all = new HashSet<>();
|
||||
all.add(fromDate);
|
||||
List<String> back = days(fromDate,toDate);
|
||||
all.addAll(back);
|
||||
all.add(toDate);
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//需出勤天数
|
||||
Integer xcqtsAll = 0;
|
||||
//考勤组大小周A
|
||||
String dxzA = bb.getPropValue("jgKq_main","dxzA");
|
||||
//考勤组大小周B
|
||||
String dxzB = bb.getPropValue("jgKq_main","dxzB");
|
||||
String rykqz = getCusFieldData(Integer.valueOf(userId),"field31",3);
|
||||
|
||||
for (String date : all) {
|
||||
KQHolidaySetComInfo holidaySetComInfo = new KQHolidaySetComInfo();
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
/*获取考勤组的ID,因为考勤组有有效期,所以需要传入日期*/
|
||||
String groupId = kqGroupMemberComInfo.getKQGroupId(userId, toDate);
|
||||
String changeTypeNew = holidaySetComInfo.getChangeType(groupId, date);
|
||||
String rzlxZdy = findRqlx(userId,date);
|
||||
//日期类型,0是工作日、1是周六、2是周日
|
||||
Integer rqlx = -1;
|
||||
if("0".equals(rzlxZdy)){
|
||||
rqlx = 0;
|
||||
}else if("1".equals(rzlxZdy)){
|
||||
rqlx = 1;
|
||||
}else if("2".equals(rzlxZdy)){
|
||||
rqlx = 2;
|
||||
}else if(DateUtil.getWeek(date) == 6){
|
||||
rqlx = 1;
|
||||
}else if(DateUtil.getWeek(date) == 7){
|
||||
rqlx = 2;
|
||||
}else {
|
||||
rqlx = 0;
|
||||
}
|
||||
Integer xcqts = 0;
|
||||
if("4".equals(rykqz)){
|
||||
//单休判断是不是周日,是的话不计
|
||||
if(rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}else if ("8".equals(rykqz)){
|
||||
//双休判断是不是周六周日,是的话不计
|
||||
if(rqlx == 1 || rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}else if(dxzA.equals(rykqz) || dxzB.equals(rykqz)){
|
||||
//双休判断是不是周六周日,是的话不计
|
||||
if(rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else if (rqlx == 1){
|
||||
//周六是工作日的话计
|
||||
if("2".equals(changeTypeNew)){
|
||||
xcqts = 1;
|
||||
}else{
|
||||
xcqts = 0;
|
||||
}
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}
|
||||
xcqtsAll = xcqtsAll+xcqts;
|
||||
}
|
||||
|
||||
return String.valueOf(xcqtsAll);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取两个日期之间所有的日期
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList days(String date1, String date2) {
|
||||
String dateFormat = "yyyy-MM-dd";
|
||||
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
ArrayList L = new ArrayList();
|
||||
if (date1.equals(date2)) {
|
||||
System.out.println("两个日期相等!");
|
||||
return L;
|
||||
}
|
||||
|
||||
String tmp;
|
||||
if (date1.compareTo(date2) > 0) { // 确保 date1的日期不晚于date2
|
||||
tmp = date1;
|
||||
date1 = date2;
|
||||
date2 = tmp;
|
||||
}
|
||||
|
||||
tmp = format.format(str2Date(date1).getTime() + 3600 * 24 * 1000);
|
||||
|
||||
int num = 0;
|
||||
while (tmp.compareTo(date2) < 0) {
|
||||
L.add(tmp);
|
||||
num++;
|
||||
tmp = format.format(str2Date(tmp).getTime() + 3600 * 24 * 1000);
|
||||
}
|
||||
|
||||
if (num == 0)
|
||||
System.out.println("两个日期相邻!");
|
||||
return L;
|
||||
}
|
||||
|
||||
private static Date str2Date(String str) {
|
||||
String dateFormat = "yyyy-MM-dd";
|
||||
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
return format.parse(str);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义日期类型判断
|
||||
* @param userId
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String findRqlx(String userId,String date){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select rqlx from uf_rqzdygs where CONCAT(xm,',') like('%"+userId+",%') and rq = '"+date+"'";
|
||||
rs.executeQuery(sql);
|
||||
String rqlx = "-1";
|
||||
if(rs.next()){
|
||||
rqlx = Util.null2String(rs.getString("rqlx"));
|
||||
}
|
||||
return StringUtils.isBlank(rqlx)?"-1":rqlx;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义字段的值
|
||||
* @param id
|
||||
* @param fieldname
|
||||
* @param scopeid
|
||||
* @return
|
||||
*/
|
||||
public static String getCusFieldData(Integer id,String fieldname,int scopeid){
|
||||
String fieldVal = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select "+fieldname+" from cus_fielddata where id=? and scopeid=? and scope='HrmCustomFieldByInfoType' ";
|
||||
rs.executeQuery(sql,id,scopeid);
|
||||
if(rs.next()){
|
||||
fieldVal = Util.null2String(rs.getString(fieldname));
|
||||
}
|
||||
return fieldVal;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,650 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
|
||||
import com.engine.kq.entity.TimeScopeEntity;
|
||||
import com.engine.kq.entity.TimeSignScopeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.UtilKQ;
|
||||
import com.engine.kq.wfset.util.KQSignUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 获取班次打卡数据
|
||||
*/
|
||||
public class KQFormatSignData extends BaseBean {
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public List<Object> getSignInfo(String userId, TimeScopeEntity signTimeScope,
|
||||
TimeScopeEntity workTimeScope, String kqDate, String preDate,
|
||||
String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo) {
|
||||
return getSignInfo(userId, signTimeScope, workTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo,
|
||||
Lists.newArrayList(), "");
|
||||
}
|
||||
|
||||
public List<Object> getSignInfo(String userId, TimeScopeEntity signTimeScope,
|
||||
TimeScopeEntity workTimeScope, String kqDate, String preDate,
|
||||
String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo,ArrayList<String> hostIps,String uuid) {
|
||||
return getSignInfo(userId, signTimeScope, workTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo, hostIps, uuid, 0, 0);
|
||||
|
||||
}
|
||||
/***
|
||||
* 获取班次打卡数据
|
||||
* @param userId
|
||||
* @param signTimeScope
|
||||
* @param workTimeScope
|
||||
* @param kqDate
|
||||
* @param preDate
|
||||
* @param nextDate
|
||||
* @param kqTimesArrayComInfo
|
||||
* @return
|
||||
*/
|
||||
public List<Object> getSignInfo(String userId, TimeScopeEntity signTimeScope,
|
||||
TimeScopeEntity workTimeScope, String kqDate, String preDate,
|
||||
String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo,ArrayList<String> hostIps,String uuid, int shiftCount, int shiftI) {
|
||||
kqLog.info("in getSignInfo ::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid+" in ");
|
||||
List<Object> lsCheckInfo = new ArrayList<>();
|
||||
String count4NoonStartDateTime = "";
|
||||
String count4NoonEndDateTime = "";
|
||||
try{
|
||||
Map<String, Object> checkInfo = null;
|
||||
String base_sql = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
String dbtype = rs.getDBType();
|
||||
|
||||
//获取工作上下班时间
|
||||
String workBeginDateTime = workTimeScope.getBeginTimeAcross() ? nextDate : kqDate;
|
||||
workBeginDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(workTimeScope.getBeginTime())+":00";
|
||||
kqLog.info("in getSignInfo ::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid+"::workBeginDateTime::"+workBeginDateTime);
|
||||
|
||||
//获取工作上下班时间
|
||||
String workEndDateTime = workTimeScope.getEndTimeAcross() ? nextDate : kqDate;
|
||||
workEndDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(workTimeScope.getEndTime())+":00";
|
||||
kqLog.info("in getSignInfo ::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid+"::workEndDateTime::"+workEndDateTime);
|
||||
|
||||
Map<String,String> flow_deduct_card_map = getflowDeductCardSql(userId,kqDate,workTimeScope.getBeginTime(),workTimeScope.getEndTime());
|
||||
|
||||
kqLog.info("in getSignInfo ::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid+"::flow_deduct_card_map::"+flow_deduct_card_map);
|
||||
kqLog.info("in getSignInfo ::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid+"::signTimeScope::"+JSON.toJSONString(signTimeScope));
|
||||
|
||||
List<Map<String,String>> sqlConditions = getCanSignInfo(signTimeScope,kqDate,preDate,nextDate,kqTimesArrayComInfo,workTimeScope, shiftCount, shiftI);
|
||||
base_sql = signSignSql(rs);
|
||||
new KQLog().info("sqlConditions:(userId:"+userId+":base_sql"+base_sql+":::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid+"::flow_deduct_card_map::"+flow_deduct_card_map);
|
||||
if(sqlConditions != null && !sqlConditions.isEmpty()){
|
||||
if(shiftCount == 2) {
|
||||
String fieldName = "";
|
||||
if(shiftI == 0) {
|
||||
fieldName = "signEndDateTime";
|
||||
} else if(shiftI == 1) {
|
||||
fieldName = "signBeginDateTime";
|
||||
}
|
||||
Map<String, String> sqlMap = sqlConditions.get(0);
|
||||
count4NoonStartDateTime = Util.null2String(sqlMap.get(fieldName));
|
||||
if (count4NoonStartDateTime.length() == 19) {
|
||||
count4NoonStartDateTime = count4NoonStartDateTime.substring(0, 17) + "00";
|
||||
}
|
||||
sqlMap = sqlConditions.get(0);
|
||||
count4NoonEndDateTime = Util.null2String(sqlMap.get(fieldName));
|
||||
if (sqlConditions.size() >= 2) {
|
||||
sqlMap = sqlConditions.get(1);
|
||||
count4NoonEndDateTime = Util.null2String(sqlMap.get(fieldName));
|
||||
}
|
||||
}
|
||||
|
||||
for(Map<String,String> sqlMap : sqlConditions){
|
||||
String sql = "";
|
||||
String orderSql = "";
|
||||
int idx = 0;
|
||||
String signBeginDateTime = Util.null2String(sqlMap.get("signBeginDateTime"));
|
||||
String signEndDateTime = Util.null2String(sqlMap.get("signEndDateTime"));
|
||||
String type = Util.null2String(sqlMap.get("type"));
|
||||
if(type.length() > 0){
|
||||
if("signoff".equalsIgnoreCase(type)){
|
||||
orderSql = " order by signdate desc, signtime desc ";
|
||||
}else if("signin".equalsIgnoreCase(type)){
|
||||
orderSql = " order by signdate asc, signtime asc ";
|
||||
}
|
||||
if("oracle".equalsIgnoreCase(dbtype)){
|
||||
sql = "select * from ("+base_sql+" "+orderSql+") a where rownum=1";
|
||||
}else if("mysql".equalsIgnoreCase(dbtype)){
|
||||
sql = "select * from ("+base_sql+" "+orderSql+") a limit 0,1";
|
||||
}
|
||||
else if("postgresql".equalsIgnoreCase(dbtype)){
|
||||
sql = "select * from ("+base_sql+" "+orderSql+") a limit 1 offset 0";
|
||||
}
|
||||
else if("sqlserver".equalsIgnoreCase(dbtype)){
|
||||
sql = "select top 1 * from ("+base_sql+") a "+" "+orderSql;
|
||||
}else{
|
||||
sql = "select * from ("+base_sql+" "+orderSql+") a where rownum=1";
|
||||
}
|
||||
}else{
|
||||
orderSql = " order by signdate asc, signtime asc ";
|
||||
sql = base_sql+" "+orderSql;
|
||||
}
|
||||
rs.executeQuery(sql, userId, signBeginDateTime, signEndDateTime);
|
||||
new KQLog().info("getSignInfo:(userId:"+userId+":signBeginDateTime:"+
|
||||
signBeginDateTime+":signEndDateTime:"+signEndDateTime+"):sql"+sql+":counts:"+rs.getCounts()+":::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid+"::flow_deduct_card_map::"+flow_deduct_card_map);
|
||||
while (rs.next()) {
|
||||
String signId = Util.null2String(rs.getString("id"));
|
||||
String signdate = Util.null2String(rs.getString("signdate"));
|
||||
String signtime = Util.null2String(rs.getString("signtime"));
|
||||
|
||||
checkInfo = new HashMap<>();
|
||||
checkInfo.put("signId", signId);//签到签退标识
|
||||
checkInfo.put("signDate", signdate);//签到签退日期
|
||||
checkInfo.put("signTime", signtime);//签到签退时间
|
||||
String signDateTime = signdate + " " + signtime;
|
||||
idx++;
|
||||
if(type.length() > 0){
|
||||
if("signin".equalsIgnoreCase(type)){
|
||||
checkInfo.put("signType", "1");
|
||||
if(workBeginDateTime.length()>0) {
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("1", signDateTime, workBeginDateTime));
|
||||
}
|
||||
if(!Util.null2String(checkInfo.get("signStatus")).equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())){
|
||||
if(flow_deduct_card_map.containsKey("signin")){
|
||||
String deduct_signintime = Util.null2String(flow_deduct_card_map.get("signin"));
|
||||
if(deduct_signintime.length() > 0){
|
||||
signDateTime = signdate + " " + deduct_signintime;
|
||||
checkInfo.put("deduct_signintime", deduct_signintime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("1", signDateTime, workBeginDateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}else {
|
||||
checkInfo.put("signType", "2");
|
||||
if(workEndDateTime.length()>0) {
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("2", signDateTime, workEndDateTime));
|
||||
}
|
||||
if(!Util.null2String(checkInfo.get("signStatus")).equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())){
|
||||
if(flow_deduct_card_map.containsKey("signoff")){
|
||||
String deduct_signofftime = Util.null2String(flow_deduct_card_map.get("signoff"));
|
||||
if(deduct_signofftime.length() > 0){
|
||||
signDateTime = signdate + " " + deduct_signofftime;
|
||||
checkInfo.put("deduct_signofftime", deduct_signofftime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("2", signDateTime, workEndDateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}else{
|
||||
if(idx==1){//第一条算签到
|
||||
checkInfo.put("signType", "1");
|
||||
if(workBeginDateTime.length()>0) {
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("1", signDateTime, workBeginDateTime));
|
||||
}
|
||||
if(!Util.null2String(checkInfo.get("signStatus")).equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())){
|
||||
if(flow_deduct_card_map.containsKey("signin")){
|
||||
String deduct_signintime = Util.null2String(flow_deduct_card_map.get("signin"));
|
||||
if(deduct_signintime.length() > 0){
|
||||
signDateTime = signdate + " " + deduct_signintime;
|
||||
checkInfo.put("deduct_signintime", deduct_signintime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("1", signDateTime, workBeginDateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}else if(idx==rs.getCounts()){//最后一条算签退
|
||||
checkInfo.put("signType", "2");
|
||||
if(workEndDateTime.length()>0) {
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("2", signDateTime, workEndDateTime));
|
||||
}
|
||||
if(!Util.null2String(checkInfo.get("signStatus")).equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())){
|
||||
if(flow_deduct_card_map.containsKey("signoff")){
|
||||
String deduct_signofftime = Util.null2String(flow_deduct_card_map.get("signoff"));
|
||||
if(deduct_signofftime.length() > 0){
|
||||
signDateTime = signdate + " " + deduct_signofftime;
|
||||
checkInfo.put("deduct_signofftime", deduct_signofftime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", UtilKQ.getSignStatus("2", signDateTime, workEndDateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//如果签到,签退不成对,流程抵扣异常存在,那么需要判断下是不是可以补足
|
||||
if(lsCheckInfo.size() < 2 && !flow_deduct_card_map.isEmpty()){
|
||||
if(lsCheckInfo.isEmpty()){
|
||||
if(flow_deduct_card_map.containsKey("signin")){
|
||||
String deduct_signintime = Util.null2String(flow_deduct_card_map.get("signin"));
|
||||
if(deduct_signintime.length() > 0){
|
||||
checkInfo = new HashMap<>();
|
||||
String[] workBeginDateTimes = workBeginDateTime.split(" ");
|
||||
String tmp_workBeginDate = workBeginDateTimes[0];
|
||||
String tmp_workBeginTime = workBeginDateTimes[1];
|
||||
checkInfo.put("signType", "1");
|
||||
checkInfo.put("signDate", tmp_workBeginDate);//签到签退日期
|
||||
checkInfo.put("signTime", "");//签到签退时间
|
||||
checkInfo.put("deduct_signintime", tmp_workBeginTime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
if(flow_deduct_card_map.containsKey("signoff")){
|
||||
String deduct_signofftime = Util.null2String(flow_deduct_card_map.get("signoff"));
|
||||
if(deduct_signofftime.length() > 0){
|
||||
checkInfo = new HashMap<>();
|
||||
String[] workEndDateTimes = workEndDateTime.split(" ");
|
||||
String tmp_workEndDate = workEndDateTimes[0];
|
||||
String tmp_workEndTime = workEndDateTimes[1];
|
||||
checkInfo.put("signType", "2");
|
||||
checkInfo.put("signDate", tmp_workEndDate);//签到签退日期
|
||||
checkInfo.put("signTime", "");//签到签退时间
|
||||
checkInfo.put("deduct_signofftime", tmp_workEndTime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Map<String, Object> checkCardMap = (Map<String, Object>) lsCheckInfo.get(0);
|
||||
if(!checkCardMap.isEmpty()){
|
||||
String signType = Util.null2String(checkCardMap.get("signType"));
|
||||
if("1".equalsIgnoreCase(signType)){
|
||||
//如果签到数据有了,检测下是不是有签退的流程抵扣打卡
|
||||
if(flow_deduct_card_map.containsKey("signoff")){
|
||||
String deduct_signofftime = Util.null2String(flow_deduct_card_map.get("signoff"));
|
||||
if(deduct_signofftime.length() > 0){
|
||||
checkInfo = new HashMap<>();
|
||||
String[] workEndDateTimes = workEndDateTime.split(" ");
|
||||
String tmp_workEndDate = workEndDateTimes[0];
|
||||
String tmp_workEndTime = workEndDateTimes[1];
|
||||
checkInfo.put("signType", "2");
|
||||
checkInfo.put("signDate", tmp_workEndDate);//签到签退日期
|
||||
checkInfo.put("signTime", "");//签到签退时间
|
||||
checkInfo.put("deduct_signofftime", tmp_workEndTime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(flow_deduct_card_map.containsKey("signin")){
|
||||
String deduct_signintime = Util.null2String(flow_deduct_card_map.get("signin"));
|
||||
if(deduct_signintime.length() > 0){
|
||||
checkInfo = new HashMap<>();
|
||||
String[] workBeginDateTimes = workBeginDateTime.split(" ");
|
||||
String tmp_workBeginDate = workBeginDateTimes[0];
|
||||
String tmp_workBeginTime = workBeginDateTimes[1];
|
||||
checkInfo.put("signType", "1");
|
||||
checkInfo.put("signDate", tmp_workBeginDate);//签到签退日期
|
||||
checkInfo.put("signTime", "");//签到签退时间
|
||||
checkInfo.put("deduct_signintime", tmp_workBeginTime);//流程抵扣作为打卡时间
|
||||
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 上午的签退取中间时段的第一次打卡
|
||||
if(shiftCount == 2 && shiftI == 0) {
|
||||
String noonSignTimeSql = KQSignUtil.buildSignSql(count4NoonStartDateTime,count4NoonEndDateTime);
|
||||
String baseSql = "select * from hrmschedulesign where 1=1 and isInCom='1' and userid="+userId+" ";
|
||||
String sql = baseSql;
|
||||
sql += " and "+noonSignTimeSql + " order by signdate, signtime";
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()) {
|
||||
String signId = Util.null2String(rs.getString("id"));
|
||||
String signDate = Util.null2String(rs.getString("signdate"));
|
||||
String signTime = Util.null2String(rs.getString("signtime"));
|
||||
String signDateTime = signDate+" "+signTime;
|
||||
for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) {
|
||||
Map<String, Object> checkInfoInner = (Map<String, Object>) lsCheckInfo.get(j);
|
||||
if (checkInfoInner.get("signType").equals("2")) {//签退
|
||||
String signDateInner = Util.null2String(checkInfoInner.get("signDate"));
|
||||
String signTimeInner = Util.null2String(checkInfoInner.get("signTime"));
|
||||
String deduct_signofftime = Util.null2String(checkInfoInner.get("deduct_signofftime"));
|
||||
if(!"".equals(signTimeInner)) {
|
||||
String signDateTimeInner = signDateInner+" "+signTimeInner;
|
||||
if(signDateTime.compareTo(signDateTimeInner) < 0) {
|
||||
checkInfoInner.put("signId", signId);//签到签退标识
|
||||
checkInfoInner.put("signType", "2");
|
||||
checkInfoInner.put("signDate", signDateInner);//签到签退日期
|
||||
checkInfoInner.put("signTime", signTime);//签到签退时间
|
||||
checkInfoInner.put("deduct_signofftime", deduct_signofftime);//流程抵扣作为打卡时间
|
||||
checkInfoInner.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(shiftCount == 2 && shiftI == 1) { // 下午的签到取中间时段的第二次打卡
|
||||
String noonSignTimeSql = KQSignUtil.buildSignSql(count4NoonStartDateTime,count4NoonEndDateTime);
|
||||
String baseSql = "select * from hrmschedulesign where 1=1 and isInCom='1' and userid="+userId+" ";
|
||||
String sql = baseSql;
|
||||
sql += " and "+noonSignTimeSql + " order by signdate, signtime";
|
||||
rs.executeQuery(sql);
|
||||
int count=0;
|
||||
int counts=rs.getCounts();
|
||||
if(counts==1){
|
||||
lsCheckInfo.clear();
|
||||
}
|
||||
while (rs.next()) {
|
||||
if(count == 0) {
|
||||
count++;
|
||||
continue;
|
||||
}
|
||||
String signId = Util.null2String(rs.getString("id"));
|
||||
String signTime = Util.null2String(rs.getString("signtime"));
|
||||
for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) {
|
||||
Map<String, Object> checkInfoInner = (Map<String, Object>) lsCheckInfo.get(j);
|
||||
if (checkInfoInner.get("signType").equals("1")) {//签退
|
||||
String signDateInner = Util.null2String(checkInfoInner.get("signDate"));
|
||||
String signTimeInner = Util.null2String(checkInfoInner.get("signTime"));
|
||||
String deduct_signofftime = Util.null2String(checkInfoInner.get("deduct_signofftime"));
|
||||
checkInfoInner.put("signId", signId);//签到签退标识
|
||||
checkInfoInner.put("signType", "1");
|
||||
checkInfoInner.put("signDate", signDateInner);//签到签退日期
|
||||
checkInfoInner.put("signTime", signTime);//签到签退时间
|
||||
checkInfoInner.put("deduct_signofftime", deduct_signofftime);//流程抵扣作为打卡时间
|
||||
checkInfoInner.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
kqLog.info("报表错:getSignInfo:");
|
||||
StringWriter errorsWriter = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(errorsWriter));
|
||||
kqLog.info(errorsWriter.toString());
|
||||
}
|
||||
|
||||
//writeLog(sql,userId +"=="+ signBeginDateTime+"=="+signEndDateTime);
|
||||
return lsCheckInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据上下班时间获取到是否有流程抵扣打卡的数据
|
||||
* @param userId
|
||||
* @param kqDate
|
||||
* @param workBeginDateTime
|
||||
* @param workEndDateTime
|
||||
*/
|
||||
public Map<String,String> getflowDeductCardSql(String userId, String kqDate, String workBeginDateTime, String workEndDateTime) {
|
||||
Map<String,String> flow_deduct_card_map = new HashMap<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String flow_deduct_card_sql = "select * from kq_flow_deduct_card where 1=1 and (isclear is null or isclear<>1) ";
|
||||
if(userId.length() > 0){
|
||||
flow_deduct_card_sql += " and resourceid="+userId;
|
||||
}
|
||||
if(kqDate.length() > 0){
|
||||
flow_deduct_card_sql += " and belongDate='"+kqDate+"'";
|
||||
}
|
||||
if(workBeginDateTime.length() > 0){
|
||||
flow_deduct_card_sql += " and workBeginTime='"+workBeginDateTime+"'";
|
||||
}
|
||||
if(workEndDateTime.length() > 0){
|
||||
flow_deduct_card_sql += " and workEndTime='"+workEndDateTime+"'";
|
||||
}
|
||||
rs.executeQuery(flow_deduct_card_sql);
|
||||
while (rs.next()){
|
||||
String signtype = rs.getString("signtype");
|
||||
if("1".equalsIgnoreCase(signtype)){
|
||||
flow_deduct_card_map.put("signin",workBeginDateTime);
|
||||
}
|
||||
if("2".equalsIgnoreCase(signtype)){
|
||||
flow_deduct_card_map.put("signoff",workEndDateTime);
|
||||
}
|
||||
}
|
||||
return flow_deduct_card_map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据打卡的范围生成上班,下班数据获取的sql
|
||||
* @param signTimeScope
|
||||
* @param kqDate
|
||||
* @param preDate
|
||||
* @param nextDate
|
||||
* @param kqTimesArrayComInfo
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,String>> getCanSignInfo(TimeScopeEntity signTimeScope, String kqDate, String preDate, String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo) {
|
||||
return getCanSignInfo(signTimeScope,kqDate,preDate,nextDate,kqTimesArrayComInfo,null);
|
||||
}
|
||||
public List<Map<String,String>> getCanSignInfo(TimeScopeEntity signTimeScope, String kqDate, String preDate, String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo,TimeScopeEntity workTimeScope) {
|
||||
return getCanSignInfo(signTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo,workTimeScope, 0, 0);
|
||||
}
|
||||
public List<Map<String,String>> getCanSignInfo(TimeScopeEntity signTimeScope, String kqDate, String preDate, String nextDate, KQTimesArrayComInfo kqTimesArrayComInfo,TimeScopeEntity workTimeScope, int shiftCount, int shiftI) {
|
||||
|
||||
List<Map<String,String>> sqlConditions = new ArrayList<>();
|
||||
Map<String,String> conditionMap = new HashMap<>();
|
||||
|
||||
TimeSignScopeEntity timeSignScopeEntity = signTimeScope.getTimeSignScopeEntity();
|
||||
|
||||
String signBeginDateTime = "";
|
||||
String signEndDateTime = "";
|
||||
signBeginDateTime = signTimeScope.getBeginTimeAcross() ? nextDate : kqDate;
|
||||
if(signTimeScope.isBeginTimePreAcross()){
|
||||
signBeginDateTime = preDate;
|
||||
}
|
||||
signBeginDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(signTimeScope.getBeginTime())+":00";
|
||||
|
||||
signEndDateTime = signTimeScope.getEndTimeAcross() ? nextDate : kqDate;
|
||||
|
||||
// if (workTimeScope != null && workTimeScope.getEndTimeAcross() && signTimeScope.getEndTimeAcross() ) {
|
||||
// if(workTimeScope.getEndTime().compareTo(signTimeScope.getEndTime())>=0){
|
||||
// signEndDateTime = DateUtil.addDate(kqDate, 2);//下下一天日期;
|
||||
// }
|
||||
// }
|
||||
signEndDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(signTimeScope.getEndTime())+":59";
|
||||
|
||||
|
||||
|
||||
if(timeSignScopeEntity == null){
|
||||
//没有设置 签到最晚时间和签退最早时间
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signBeginDateTime);
|
||||
conditionMap.put("signEndDateTime", signEndDateTime);
|
||||
sqlConditions.add(conditionMap);
|
||||
}else{
|
||||
String beginTimeEnd = timeSignScopeEntity.getBeginTimeEnd();
|
||||
boolean beginTimeEndAcross = timeSignScopeEntity.isBeginTimeEndAcross();
|
||||
|
||||
String endTimeStart = timeSignScopeEntity.getEndTimeStart();
|
||||
boolean endTimeStartAcross = timeSignScopeEntity.isEndTimeStartAcross();
|
||||
|
||||
if(beginTimeEnd.length() > 0){
|
||||
//如果设置了 上班结束时间
|
||||
if(endTimeStart.length() > 0){
|
||||
//设置了下班开始时间
|
||||
String signBeginDateEndTime = "";
|
||||
String signEndDateStartTime = "";
|
||||
signBeginDateEndTime = beginTimeEndAcross ? nextDate : kqDate;
|
||||
signBeginDateEndTime+=" "+kqTimesArrayComInfo.turn48to24Time(beginTimeEnd)+":59";
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signBeginDateTime);
|
||||
conditionMap.put("signEndDateTime", signBeginDateEndTime);
|
||||
conditionMap.put("type", "signin");
|
||||
sqlConditions.add(conditionMap);
|
||||
|
||||
signEndDateStartTime = endTimeStartAcross ? nextDate : kqDate;
|
||||
signEndDateStartTime+=" "+kqTimesArrayComInfo.turn48to24Time(endTimeStart)+":00";
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signEndDateStartTime);
|
||||
conditionMap.put("signEndDateTime", signEndDateTime);
|
||||
conditionMap.put("type", "signoff");
|
||||
sqlConditions.add(conditionMap);
|
||||
}else{
|
||||
//没有设置下班开始时间
|
||||
String signBeginDateEndTime = "";
|
||||
String signEndDateStartTime = "";
|
||||
signBeginDateEndTime = beginTimeEndAcross ? nextDate : kqDate;
|
||||
signBeginDateEndTime+=" "+kqTimesArrayComInfo.turn48to24Time(beginTimeEnd)+":59";
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signBeginDateTime);
|
||||
conditionMap.put("signEndDateTime", signBeginDateEndTime);
|
||||
conditionMap.put("type", "signin");
|
||||
sqlConditions.add(conditionMap);
|
||||
|
||||
//如果设置了上班结束时间,相当于下班开始时间也被限定了
|
||||
String endTimeByBeginTime = kqTimesArrayComInfo.getTimesByArrayindex(kqTimesArrayComInfo.getArrayindexByTimes(beginTimeEnd)+1);
|
||||
signEndDateStartTime = beginTimeEndAcross ? nextDate : kqDate;
|
||||
signEndDateStartTime+=" "+kqTimesArrayComInfo.turn48to24Time(endTimeByBeginTime)+":00";
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signEndDateStartTime);
|
||||
conditionMap.put("signEndDateTime", signEndDateTime);
|
||||
conditionMap.put("type", "signoff");
|
||||
sqlConditions.add(conditionMap);
|
||||
}
|
||||
}else if(endTimeStart.length() > 0){
|
||||
//如果没有设置上班结束时间,设置了下班开始时间
|
||||
String signBeginDateEndTime = "";
|
||||
String signEndDateStartTime = "";
|
||||
|
||||
//如果设置了下班开始时间,相当于上班结束时间也被限定了
|
||||
String BeginTimeByendTime = kqTimesArrayComInfo.getTimesByArrayindex(kqTimesArrayComInfo.getArrayindexByTimes(endTimeStart)-1);
|
||||
signBeginDateEndTime = endTimeStartAcross ? nextDate : kqDate;
|
||||
signBeginDateEndTime+=" "+kqTimesArrayComInfo.turn48to24Time(BeginTimeByendTime)+":59";
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signBeginDateTime);
|
||||
conditionMap.put("signEndDateTime", signBeginDateEndTime);
|
||||
conditionMap.put("type", "signin");
|
||||
sqlConditions.add(conditionMap);
|
||||
|
||||
signEndDateStartTime = endTimeStartAcross ? nextDate : kqDate;
|
||||
signEndDateStartTime+=" "+kqTimesArrayComInfo.turn48to24Time(endTimeStart)+":00";
|
||||
|
||||
conditionMap = new HashMap<>();
|
||||
conditionMap.put("signBeginDateTime", signEndDateStartTime);
|
||||
conditionMap.put("signEndDateTime", signEndDateTime);
|
||||
conditionMap.put("type", "signoff");
|
||||
sqlConditions.add(conditionMap);
|
||||
}
|
||||
}
|
||||
return sqlConditions;
|
||||
}
|
||||
|
||||
public String signSignSql(RecordSet rs){
|
||||
String sql = "";
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and signdate||' '||signtime >= ? and signdate||' '||signtime <= ? " +
|
||||
" ";
|
||||
}else if("sqlserver".equals(rs.getDBType())){
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and signdate + ' ' + signtime >= ? and signdate + ' ' + signtime <= ? " +
|
||||
" ";
|
||||
}else{
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and concat(signdate,' ',signtime) >= ? and concat(signdate,' ',signtime) <= ? " +
|
||||
" ";
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
public List<Object> getSignInfoForAll(String userId, String signBeginDateTime, String signEndDateTime, String workBeginDateTime, String workEndDateTime) {
|
||||
List<Object> lsCheckInfo = new ArrayList<>();
|
||||
Map<String, Object> checkInfo = null;
|
||||
String sql = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
int idx = 0;
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and signdate||' '||signtime >= ? and signdate||' '||signtime <= ? " +
|
||||
" order by signdate asc, signtime asc ";
|
||||
}else if("sqlserver".equals(rs.getDBType())){
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and signdate + ' ' + signtime >= ? and signdate + ' ' + signtime <= ? " +
|
||||
" order by signdate asc, signtime asc ";
|
||||
}else{
|
||||
sql = " select id,signdate,signtime from hrmschedulesign where isincom=1 and userid = ? and concat(signdate,' ',signtime) >= ? and concat(signdate,' ',signtime) <= ? " +
|
||||
" order by signdate asc, signtime asc ";
|
||||
}
|
||||
rs.executeQuery(sql, userId, signBeginDateTime, signEndDateTime);
|
||||
//writeLog(sql,userId +"=="+ signBeginDateTime+"=="+signEndDateTime);
|
||||
while (rs.next()) {
|
||||
String signId = Util.null2String(rs.getString("id"));
|
||||
String signdate = Util.null2String(rs.getString("signdate"));
|
||||
String signtime = Util.null2String(rs.getString("signtime"));
|
||||
|
||||
checkInfo = new HashMap<>();
|
||||
checkInfo.put("signId", signId);//签到签退标识
|
||||
checkInfo.put("signDate", signdate);//签到签退日期
|
||||
checkInfo.put("signTime", signtime);//签到签退时间
|
||||
String signDateTime = signdate + " " + signtime;
|
||||
|
||||
idx++;
|
||||
if(idx%2==1){
|
||||
checkInfo.put("signType", "1");
|
||||
}else{
|
||||
checkInfo.put("signType", "2");
|
||||
}
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
return lsCheckInfo;
|
||||
}
|
||||
|
||||
public List<Object> getNonWorkSignInfo(String userId, String preDate, String kqDate,
|
||||
List<TimeScopeEntity> pre_lsSignTime,
|
||||
List<TimeScopeEntity> next_lsSignTime) {
|
||||
List<Object> lsCheckInfo = new ArrayList<>();
|
||||
Map<String, Object> checkInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String pre_Worktime4Today = "";
|
||||
if(!pre_lsSignTime.isEmpty()){
|
||||
TimeScopeEntity pre_signTimeScope = pre_lsSignTime.get(pre_lsSignTime.size()-1);
|
||||
if(pre_signTimeScope.getEndTimeAcross()){
|
||||
pre_Worktime4Today = pre_signTimeScope.getEndTime();
|
||||
}
|
||||
}
|
||||
String next_Worktime4Today = "";
|
||||
if(!next_lsSignTime.isEmpty()){
|
||||
TimeScopeEntity next_signTimeScope = next_lsSignTime.get(next_lsSignTime.size()-1);
|
||||
if(next_signTimeScope.isBeginTimePreAcross()){
|
||||
next_Worktime4Today = next_signTimeScope.getBeginTime();
|
||||
}
|
||||
}
|
||||
String sql = "select * from hrmschedulesign where userid="+userId+" and signdate = '"+kqDate+"' ";
|
||||
if(pre_Worktime4Today.length() > 0){
|
||||
if(pre_Worktime4Today.length() == 5){
|
||||
pre_Worktime4Today += ":59";
|
||||
}
|
||||
sql += " and signtime > '"+pre_Worktime4Today+"'";
|
||||
}
|
||||
if(next_Worktime4Today.length() > 0){
|
||||
if(next_Worktime4Today.length() == 5){
|
||||
next_Worktime4Today += ":00";
|
||||
}
|
||||
sql += " and signtime < '"+next_Worktime4Today+"'";
|
||||
}
|
||||
sql += " order by signdate asc,signtime asc ";
|
||||
rs.executeQuery(sql);
|
||||
int idx = 0;
|
||||
while (rs.next()){
|
||||
String signId = Util.null2String(rs.getString("id"));
|
||||
String signdate = Util.null2String(rs.getString("signdate"));
|
||||
String signtime = Util.null2String(rs.getString("signtime"));
|
||||
|
||||
checkInfo = new HashMap<>();
|
||||
checkInfo.put("signId", signId);//签到签退标识
|
||||
checkInfo.put("signDate", signdate);//签到签退日期
|
||||
checkInfo.put("signTime", signtime);//签到签退时间
|
||||
idx++;
|
||||
if(idx==1){//第一条算签到
|
||||
checkInfo.put("signType", "1");
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}else if(idx==rs.getCounts()){//最后一条算签退
|
||||
checkInfo.put("signType", "2");
|
||||
lsCheckInfo.add(checkInfo);
|
||||
}
|
||||
}
|
||||
return lsCheckInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,724 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportDailyExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")),",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.add("kqdate");
|
||||
showColumns.add("serialid");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("signin1")){
|
||||
cascadekey = "signout1";
|
||||
}else if(showColumn.equals("signin2")){
|
||||
cascadekey = "signout2";
|
||||
}else if(showColumn.equals("signin3")){
|
||||
cascadekey = "signout3";
|
||||
}else if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
toDate = today;
|
||||
}
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String,Object>> constraintList = null;
|
||||
Map<String,Object> constraint = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width",30*256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan",childColumns.size());
|
||||
}else{
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "2");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
String backFields = " b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb," +
|
||||
"(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb,(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb," +
|
||||
"(select sum(sch*60) from uf_lbjbsq where sqr = a.id and sqrq = b.kqdate) as zlxs,(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts," +
|
||||
"(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts,(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts," +
|
||||
"(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts,(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"(select sum(sch) from uf_jbsqhz where sqr = a.id and sqrq = b.kqdate and jblx in (1,2)) as jbsq,a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins,b.beLate," +
|
||||
" b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins,b.graveLeaveEarly," +
|
||||
" b.graveLeaveEarlyMins,b.absenteeism,b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc , b.kqDate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select "+backFields + sqlFrom + sqlWhere+orderBy;
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
String tmpkey = id+"|"+kqdate+"|";
|
||||
// Map<String,Object> signDetailInfo = this.getSignDetailInfo(id,kqdate);
|
||||
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if(fieldName.equals("cardOvertime")){
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + Math.round(Util.getDoubleValue(fieldValue) / 60.0 * 2) / 2.0));
|
||||
} else if(fieldName.equals("xqNew")){
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
} else if(fieldName.equals("serialid")){
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
if(serialid.length()>0){
|
||||
// fieldValue = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(serialid)){
|
||||
fieldValue = serialdata.get(serialid);
|
||||
}else{
|
||||
String tmpserialname = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
fieldValue = tmpserialname;
|
||||
serialdata.put(serialid,tmpserialname);
|
||||
}
|
||||
}
|
||||
} else if(fieldName.equals("signin1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("leave")){
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
fieldValue = Util.null2String(flowData.get(id+"|"+kqdate+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(fieldValue);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
writeLog("ExportDailyExcelCmd:fieldValue" + fieldValue + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(fieldValue, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
fieldValue = flowLeaveData;
|
||||
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else if(fieldName.equals("kqdate")){
|
||||
fieldValue=kqdate+" "+com.engine.portal.util.DateUtil.getDayWeekOfDate1(DateUtil.parseToDate(kqdate));
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
|
||||
if(!fieldName.equals("leave")) {
|
||||
fieldValue = Util.formatMultiLang(fieldValue, "" + user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList",constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390352, user.getLanguage())+" "+fromDate+" "+toDate;;
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
title = new HashMap<>();
|
||||
title.put("title",name+"("+
|
||||
((KQUnitBiz.isLeaveHour(unitType))?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()))+")");
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title",SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+
|
||||
(KQReportBiz.getUnitType(kqReportFieldComInfo, user).length()>0?"("+ KQReportBiz.getUnitType(kqReportFieldComInfo, user)+")":""));
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
int workMins = rs.getInt("workMins");
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(serialid.length()>0){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.engine.jgkq.service;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Title ecology-9
|
||||
* @Company 泛微软件
|
||||
* @CreateDate 2024/4/24
|
||||
* @Description
|
||||
* @Author AdminZm
|
||||
*/
|
||||
public interface ZkPushService {
|
||||
|
||||
String initOptions(String sn, String PushOptionsFlag);
|
||||
}
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
package com.engine.kq.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* 工作时间
|
||||
*/
|
||||
public class WorkTimeEntity {
|
||||
private String groupId;//所属考勤组
|
||||
private String groupName;//所属考勤组
|
||||
private String kqType;//考勤类型
|
||||
private String serialId;//班次
|
||||
private Map<String,Object> shiftRuleInfo;//班次人性化规则
|
||||
private List<TimeScopeEntity> signTime;//允许打卡时间
|
||||
private List<TimeScopeEntity> workTime;//工作时间
|
||||
private List<TimeScopeEntity> restTime;//休息时间
|
||||
private int workMins;//工作时长
|
||||
private String isAcross;//是否跨天
|
||||
private String signstart;//自由工时开始打卡时间
|
||||
private boolean isExclude;//无需考勤人员
|
||||
private String calmethod;//自由班制计算方式
|
||||
|
||||
/**
|
||||
* 是否是非工作日 1表示是非工作日班次
|
||||
*/
|
||||
private int nonWorkShift;
|
||||
/**
|
||||
* 当前日期类型
|
||||
* playday 休息日
|
||||
* work 工作日
|
||||
* holiday 节假日
|
||||
*/
|
||||
private String dayType;
|
||||
|
||||
/**
|
||||
* 应出勤折算天数
|
||||
*/
|
||||
private String convertAttendDay = "";
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public String getKQType() {
|
||||
return kqType;
|
||||
}
|
||||
|
||||
public void setKQType(String kqType) {
|
||||
this.kqType = kqType;
|
||||
}
|
||||
|
||||
public String getSerialId() {
|
||||
return serialId;
|
||||
}
|
||||
|
||||
public void setSerialId(String serialId) {
|
||||
this.serialId = serialId;
|
||||
}
|
||||
|
||||
public Map<String, Object> getShiftRuleInfo() {
|
||||
return shiftRuleInfo;
|
||||
}
|
||||
|
||||
public void setShiftRuleInfo(Map<String, Object> shiftRuleInfo) {
|
||||
this.shiftRuleInfo = shiftRuleInfo;
|
||||
}
|
||||
|
||||
public List<TimeScopeEntity> getWorkTime() {
|
||||
return workTime;
|
||||
}
|
||||
|
||||
public void setWorkTime(List<TimeScopeEntity> workTime) {
|
||||
this.workTime = workTime;
|
||||
}
|
||||
|
||||
public List<TimeScopeEntity> getRestTime() {
|
||||
return restTime;
|
||||
}
|
||||
|
||||
public void setRestTime(List<TimeScopeEntity> restTime) {
|
||||
this.restTime = restTime;
|
||||
}
|
||||
|
||||
public int getWorkMins() {
|
||||
return workMins;
|
||||
}
|
||||
|
||||
public void setWorkMins(int workMins) {
|
||||
this.workMins = workMins;
|
||||
}
|
||||
|
||||
public String getIsAcross() {
|
||||
return isAcross;
|
||||
}
|
||||
|
||||
public void setIsAcross(String isAcross) {
|
||||
this.isAcross = isAcross;
|
||||
}
|
||||
|
||||
public String getSignStart() {
|
||||
return signstart;
|
||||
}
|
||||
|
||||
public void setSignStart(String signstart) {
|
||||
this.signstart = signstart;
|
||||
}
|
||||
|
||||
public List<TimeScopeEntity> getSignTime() {
|
||||
return signTime;
|
||||
}
|
||||
|
||||
public void setSignTime(List<TimeScopeEntity> signTime) {
|
||||
this.signTime = signTime;
|
||||
}
|
||||
|
||||
public boolean getIsExclude() {
|
||||
return isExclude;
|
||||
}
|
||||
|
||||
public void setIsExclude(boolean isExclude) {
|
||||
this.isExclude = isExclude;
|
||||
}
|
||||
|
||||
public String getCalmethod() {
|
||||
return calmethod;
|
||||
}
|
||||
|
||||
public void setCalmethod(String calmethod) {
|
||||
this.calmethod = calmethod;
|
||||
}
|
||||
|
||||
public int getNonWorkShift() {
|
||||
return nonWorkShift;
|
||||
}
|
||||
|
||||
public void setNonWorkShift(int restShift) {
|
||||
this.nonWorkShift = restShift;
|
||||
}
|
||||
|
||||
public String getDayType() {
|
||||
return dayType;
|
||||
}
|
||||
|
||||
public void setDayType(String dayType) {
|
||||
this.dayType = dayType;
|
||||
}
|
||||
|
||||
public String getConvertAttendDay() {
|
||||
return convertAttendDay;
|
||||
}
|
||||
|
||||
public void setConvertAttendDay(String convertAttendDay) {
|
||||
this.convertAttendDay = convertAttendDay;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,674 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetKQReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
String isFromMyAttendance = Util.null2String(jsonObj.get("isFromMyAttendance"));//是否是来自我的考勤的请求,如果是,不加载考勤报表权限共享的限制,不然我的考勤会提示无权限
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
|
||||
String rightSql = kqReportBiz.getReportRight("1",""+user.getUID(),"a");
|
||||
if(isFromMyAttendance.equals("1")){
|
||||
rightSql = "";
|
||||
}
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0)continue;
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("type", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
columns.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束日期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){//结束日期不大于今天
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
|
||||
childColumns = new ArrayList<>();
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
column = new HashMap();
|
||||
column.put("title", DateUtil.geDayOfMonth(date));
|
||||
column.put("dataIndex", date);
|
||||
column.put("key", date);
|
||||
column.put("type", date);
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", 90);
|
||||
column.put("isCalendar", 1);
|
||||
childColumns.add(column);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
column.put("dataIndex", "kqCalendar");
|
||||
column.put("key", "kqCalendar");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", childColumns.size()*90);
|
||||
column.put("children", childColumns);
|
||||
}
|
||||
columns.add(column);
|
||||
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
String backFields = " (select sum(xxb) as xxb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xxb,(select sum(zrbtjbzdx*60) as zrbtjbztx from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjbztx,(select sum(gzsc) as gzsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gzsc,(select sum(psjbshic*60) as psjbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as psjbsc,(select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc,(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb,(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb,(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and u.ksrq>='"+fromDate+"' and u.ksrq<= '"+toDate+"') as zlxs,(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts,(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts,(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
sqlWhere += " and 1=2 ";
|
||||
}
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+groupBy+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by t.dsporder asc, t.lastname asc ";
|
||||
String descOrderBy = " order by t.dsporder desc, t.lastname desc ";
|
||||
|
||||
//默认排序设置 start,有性能问题,先取消,后面再看看有没有好的方式
|
||||
// String orderBySql = "select * from kq_report_order where userId=? and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql, user.getUID());
|
||||
// if (rs.getCounts() <= 0) {
|
||||
// orderBySql = "select * from kq_report_order where userId=0 and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql);
|
||||
// }
|
||||
// while (rs.next()) {
|
||||
// String dataIndex = rs.getString("dataIndex");
|
||||
// String ascOrDesc = rs.getString("ascOrDesc");
|
||||
// String ascOrDesc1 = (ascOrDesc.equals("")||ascOrDesc.equals("asc"))?"desc":"asc";
|
||||
// if (dataIndex.equals("organization")) {
|
||||
// orderBy += ",showOrderOfDeptTree " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += ",showOrderOfDeptTree " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// }
|
||||
// if (dataIndex.equalsIgnoreCase("dspOrder") || dataIndex.equalsIgnoreCase("lastName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("deptShowOrder") || dataIndex.equalsIgnoreCase("deptName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("subcomShowOrder") || dataIndex.equalsIgnoreCase("subcomName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",subcom_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",subcom_id " + ascOrDesc1;
|
||||
// }
|
||||
// }
|
||||
// orderBy = orderBy.startsWith(",") ? orderBy.substring(1) : orderBy;
|
||||
// descOrderBy = descOrderBy.startsWith(",") ? descOrderBy.substring(1) : descOrderBy;
|
||||
// orderBy = orderBy.equals("") ? " t.dspOrder,t.id " : orderBy;
|
||||
// descOrderBy = descOrderBy.equals("") ? " t.dspOrder,t.id " : descOrderBy;
|
||||
// orderBy = "order by "+orderBy;
|
||||
|
||||
sql = backFields + sqlFrom + sqlWhere + groupBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " +pageSize + " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql + orderBy+ " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql+orderBy;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
|
||||
|
||||
bb.writeLog("getKqReportCmd:"+sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
String id = rs.getString("id");
|
||||
data.put("resourceId",id);
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1"))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
data.put("subcompanyId",tmpSubcompanyId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
data.put("departmentId",tmpDepartmentId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
data.put("jobtitleId",tmpJobtitleId);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
}else if(fieldName.equals("attendanceSerial")){
|
||||
List<String> serialIds = null;
|
||||
if(attendanceSerial.length()>0){
|
||||
serialIds = Util.splitString2List(attendanceSerial,",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
if(fieldName.equals("overtimeTotal")){
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else{
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id+"|"+fieldName)));
|
||||
}
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if(Util.null2String(kqReportFieldComInfo.getUnittype()).length()>0) {
|
||||
if(fieldValue.length() == 0){
|
||||
fieldValue="0";
|
||||
}else{
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
data.put(fieldName,fieldValue);
|
||||
}
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_"+leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+flowLeaveBackType)),"0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(leaveData.length() == 0){
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if(leavebackData.length() == 0){
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if(b_flowLeaveData.length() > 0){
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
}else{
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0)));
|
||||
}
|
||||
data.put(flowType,flowLeaveData);
|
||||
}
|
||||
|
||||
Map<String,Object> detialDatas = kqReportBiz.getDetialDatas(id,fromDate,toDate,user,flowData,false,uintType,show_card_source);
|
||||
// new KQLog().info("id:"+id+":detialDatas:"+detialDatas);
|
||||
isEnd = false;
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
if(DateUtil.compDate(today, date)>0){
|
||||
data.put(date,"");
|
||||
}else{
|
||||
// new KQLog().info("id:date:"+(id+"|"+date)+":detialDatas.get:"+detialDatas.get(id+"|"+date));
|
||||
data.put(date,detialDatas.get(id+"|"+date)==null?SystemEnv.getHtmlLabelName(26593, user.getLanguage()):detialDatas.get(id+"|"+date));
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("attendanceSerial")){//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if(Util.null2String(jsonObj.get("attendanceSerial")).length()>0){
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")),",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
column = new HashMap();
|
||||
column.put("title", kqShiftManagementComInfo.getSerial(serialIds.get(i)));
|
||||
column.put("unit", "");
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", serialIds.get(i));
|
||||
column.put("key", serialIds.get(i));
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return lsChildColumns;
|
||||
}
|
||||
Map<String,Object> column = null;
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lsChildColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,750 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import java.math.BigDecimal;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public GetKQDailyReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQDailyReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
boolean isDaily = kqReportFieldComInfo.getReportType().equals("daily");
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !isDaily)continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
if(kqReportFieldComInfo.getReportType1().equals("daily")){
|
||||
column.put("isdaily", "1");
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
// String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")&&!Util.null2String(rs.getOrgindbtype()).equals("jc")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
|
||||
String backFields = "(select jjrbtjia*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrbtjb,(select jjrdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrdksc,(select xxb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as xxb,(select zrbtjbzdx*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjbztx,(select gzsc from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as gzsc,(select psjbshic*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as psjbsc,b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb,(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb," +
|
||||
"(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb,(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs," +
|
||||
"(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts,(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts," +
|
||||
"(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts,(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts," +
|
||||
"(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs,(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm,(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm,(select sum(sch*60) from uf_jbsqhz where sqr = a.id and ksrq = b.kqdate and jblx in (0,1,2,3)) as jbsq," +
|
||||
"a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
|
||||
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
|
||||
" b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism ,b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
//考勤异常状态
|
||||
String KQstatus = Util.null2String(jsonObj.get("KQstatus"));
|
||||
if ("5".equals(KQstatus)){
|
||||
|
||||
}else if ("1".equals(KQstatus)){
|
||||
sqlWhere += " and (absenteeismMins > 0 or forgotCheck > 0) ";
|
||||
}else if ("2".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0) ";
|
||||
}else if ("3".equals(KQstatus)){
|
||||
sqlWhere += " and (b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0) ";
|
||||
}else if ("4".equals(KQstatus)){
|
||||
sqlWhere +=" and forgotCheck > 0 ";
|
||||
}else if ("6".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins = 0 and b.graveBeLateMins = 0 and b.leaveEarlyMins = 0 and b.graveLeaveEarlyMins = 0 and absenteeismMins = 0 and forgotCheck = 0)";
|
||||
}else if ("7".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0 or b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0 or absenteeismMins > 0 or forgotCheck > 0)";
|
||||
}
|
||||
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc, b.kqdate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc, b.kqdate desc ";
|
||||
sql = backFields + sqlFrom + sqlWhere + orderBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + pageSize+ " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc, kqdate asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc, kqdate desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql+" ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(id, kqdate);
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1")) continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))
|
||||
continue;
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String fieldValueID = rs.getString("subcompanyid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
//fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getSubCompanyID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String fieldValueID = rs.getString("departmentid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
//fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getDepartmentID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String fieldValueID = rs.getString("jobtitle");
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle"));
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getJobTitle(id);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("cardOvertime")) {
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
Double zlMinsNew = Util.getDoubleValue(fieldValue);
|
||||
String skjbcsy = divide(String.valueOf(changeBxs(zlMinsNew.intValue())),"60");
|
||||
fieldValue = skjbcsy;
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("xqNew")) {
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (kqReportFieldComInfo.getParentid().equals("overtime") || kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
|
||||
if (fieldName.equals("overtimeTotal")) {
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave < 0 ? 0 : restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
} else {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("serialid")) {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (fieldValue.length()>0) {//弹性工作制没有班次
|
||||
// data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(fieldValue)){
|
||||
data.put("serialid", serialdata.get(fieldValue));
|
||||
}else{
|
||||
String tmpserialname = shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage());
|
||||
serialdata.put(fieldValue,tmpserialname);
|
||||
data.put("serialid", tmpserialname);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
data.putAll(this.getSignDetailInfo(id, kqdate));
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
kqLog.info("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.put(flowType, flowLeaveData);
|
||||
}
|
||||
|
||||
data.put("resourceId", id);
|
||||
data.put("kqdate", kqdate);
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
private String getUnitType(String unitType, User user){
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
return unitTypeName;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily")?"1":"0");
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,day_type,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
String dayType = Util.null2s(rs.getString("day_type"),"");
|
||||
int workMins = rs.getInt("workMins");
|
||||
boolean isNonWork = false;
|
||||
if(dayType.length() > 0){
|
||||
if("holiday".equals(dayType) || "playday".equals(dayType)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}else{
|
||||
if(workMins<=0){
|
||||
isNonWork = true;
|
||||
}else{
|
||||
if(serialid.length() > 0){
|
||||
String isRest = Util.null2s(kqShiftManagementComInfo.getIsRest(serialid),"");
|
||||
if("1".equals(isRest)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(!isNonWork){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}else {
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 半小时转换
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static Integer changeBxs(Integer value){
|
||||
return (value / 30)*30 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的除法运算。
|
||||
* @param v1 被加数
|
||||
* @param v2 加数
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static String divide(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.divide(b2,2,BigDecimal.ROUND_HALF_UP).toString();
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,40 @@
|
|||
package com.api.customization.qc3110945.web;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.api.customization.qc3110945.util.KQCustomUtil;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Path("/kqcustom/util")
|
||||
public class KQCustomWeb {
|
||||
|
||||
/**
|
||||
* 获取排班考勤组班次信息
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/upSignCard")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String getserial(@Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
KQCustomUtil KQCustomUtil = new KQCustomUtil();
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
apidatas = KQCustomUtil.upSignCard(ParamUtil.request2Map(request),user);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return JSON.toJSONString(apidatas);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,770 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportDailyExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")),",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.add("kqdate");
|
||||
showColumns.add("serialid");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("signin1")){
|
||||
cascadekey = "signout1";
|
||||
}else if(showColumn.equals("signin2")){
|
||||
cascadekey = "signout2";
|
||||
}else if(showColumn.equals("signin3")){
|
||||
cascadekey = "signout3";
|
||||
}else if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
toDate = today;
|
||||
}
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String,Object>> constraintList = null;
|
||||
Map<String,Object> constraint = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
if("kqdate".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width",30*256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan",childColumns.size());
|
||||
}else{
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "2");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
String backFields = " (select xxb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as xxb,(select zrbtjbzdx*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjbztx,(select gzsc from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as gzsc,(select psjbshic*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as psjbsc,b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb," +
|
||||
"(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb,(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb," +
|
||||
"(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs,(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts," +
|
||||
"(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts,(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts," +
|
||||
"(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts,(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"(select sum(sch) from uf_jbsqhz where sqr = a.id and ksrq = b.kqdate and jblx in (0,1,2,3)) as jbsq,a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins,b.beLate," +
|
||||
" b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins,b.graveLeaveEarly," +
|
||||
" b.graveLeaveEarlyMins,b.absenteeism,b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
//考勤异常状态
|
||||
String KQstatus = Util.null2String(jsonObj.get("KQstatus"));
|
||||
if ("5".equals(KQstatus)){
|
||||
|
||||
}else if ("1".equals(KQstatus)){
|
||||
sqlWhere += " and absenteeismMins > 0 ";
|
||||
}else if ("2".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0) ";
|
||||
}else if ("3".equals(KQstatus)){
|
||||
sqlWhere += " and (b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0) ";
|
||||
}else if ("4".equals(KQstatus)){
|
||||
sqlWhere +=" and forgotCheck > 0";
|
||||
}else if ("6".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins = 0 and b.graveBeLateMins = 0 and b.leaveEarlyMins = 0 and b.graveLeaveEarlyMins = 0 and absenteeismMins = 0 and forgotCheck = 0)";
|
||||
}else if ("7".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0 or b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0 or absenteeismMins > 0 or forgotCheck > 0)";
|
||||
}
|
||||
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc , b.kqDate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select "+backFields + sqlFrom + sqlWhere+orderBy;
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
String tmpkey = id+"|"+kqdate+"|";
|
||||
// Map<String,Object> signDetailInfo = this.getSignDetailInfo(id,kqdate);
|
||||
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if(fieldName.equals("cardOvertime")){
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
Double zlMinsNew = Util.getDoubleValue(fieldValue);
|
||||
String skjbcsy = divide(String.valueOf(changeBxs(zlMinsNew.intValue())),"60");
|
||||
fieldValue = skjbcsy;
|
||||
} else if(fieldName.equals("xqNew")){
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
} else if(fieldName.equals("serialid")){
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
if(serialid.length()>0){
|
||||
// fieldValue = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(serialid)){
|
||||
fieldValue = serialdata.get(serialid);
|
||||
}else{
|
||||
String tmpserialname = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
fieldValue = tmpserialname;
|
||||
serialdata.put(serialid,tmpserialname);
|
||||
}
|
||||
}
|
||||
} else if(fieldName.equals("signin1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("leave")){
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
fieldValue = Util.null2String(flowData.get(id+"|"+kqdate+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(fieldValue);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
writeLog("ExportDailyExcelCmd:fieldValue" + fieldValue + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(fieldValue, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
fieldValue = flowLeaveData;
|
||||
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else if(fieldName.equals("kqdate")){
|
||||
fieldValue=kqdate+" "+com.engine.portal.util.DateUtil.getDayWeekOfDate1(DateUtil.parseToDate(kqdate));
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
|
||||
if(!fieldName.equals("leave") && !fieldName.equals("kqdate")) {
|
||||
fieldValue = Util.formatMultiLang(fieldValue, "" + user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList",constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390352, user.getLanguage())+" "+fromDate+" "+toDate;;
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
title = new HashMap<>();
|
||||
title.put("title",name+"("+
|
||||
((KQUnitBiz.isLeaveHour(unitType))?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()))+")");
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title",SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+
|
||||
(KQReportBiz.getUnitType(kqReportFieldComInfo, user).length()>0?"("+ KQReportBiz.getUnitType(kqReportFieldComInfo, user)+")":""));
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
int workMins = rs.getInt("workMins");
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(serialid.length()>0){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 半小时转换
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static Integer changeBxs(Integer value){
|
||||
return (value / 30)*30 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的除法运算。
|
||||
* @param v1 被加数
|
||||
* @param v2 加数
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static String divide(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.divide(b2,2,BigDecimal.ROUND_HALF_UP).toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.api.customization.qc3110945.util;
|
||||
|
||||
import com.engine.kq.biz.KQFormatBiz;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class KQCustomUtil {
|
||||
|
||||
public Map<String,Object> upSignCard(Map<String, Object> params, User user){
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs1 = new RecordSet();
|
||||
String userId = Util.null2String(params.get("userId"));
|
||||
String kqDate = Util.null2String(params.get("kqDate"));
|
||||
String kqTime = Util.null2String(params.get("kqTime"));
|
||||
String signFrom = Util.null2String(params.get("signFrom"));
|
||||
String isIncom = Util.null2String(params.get("isIncom"));
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = sdf.parse(kqDate);
|
||||
String preDate =sdf.format(DateUtils.addDays(date, -1));
|
||||
String nextDate =sdf.format(DateUtils.addDays(date, 1));
|
||||
|
||||
String sql = "update HrmScheduleSign set isInCom = ? where userId=? and signDate=? and signTime=? and signFrom=?";
|
||||
boolean isSucess = rs.executeUpdate(sql, isIncom , userId, kqDate, kqTime, signFrom);
|
||||
|
||||
String signInTimesNew = StringUtils.isNotBlank(kqTime)?kqTime.substring(0,5):"";
|
||||
//二开删除
|
||||
String deleteSql = "delete from uf_dksc where xm = ? and dkrq = ? and sbk = ?";
|
||||
rs1.executeUpdate(deleteSql,userId,kqDate,signInTimesNew);
|
||||
|
||||
deleteSql = "delete from uf_dksc where xm = ? and dkrq = ? and xbk = ?";
|
||||
rs1.executeUpdate(deleteSql,userId,kqDate,signInTimesNew);
|
||||
|
||||
if (isSucess){
|
||||
//前天今天后天都重新格式化下
|
||||
new KQFormatBiz().formatDate(""+userId, preDate);
|
||||
new KQFormatBiz().formatDate(""+userId, kqDate);
|
||||
new KQFormatBiz().formatDate(""+userId, nextDate);
|
||||
result.put("status","1");
|
||||
result.put("msg","保存成功");
|
||||
return result;
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
result.put("status","0");
|
||||
result.put("msg",e);
|
||||
return result;
|
||||
}
|
||||
result.put("status","0");
|
||||
result.put("msg","保存失败");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,18 @@
|
|||
package com.engine.jgkq.service;
|
||||
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Auther: chenxu
|
||||
* @Date: 2021/11/30/15:29
|
||||
* @Description:
|
||||
*/
|
||||
public interface JgkqService {
|
||||
public Map<String, Object> recruitmentProgress(Map<String, Object> params, User user);
|
||||
|
||||
public Map<String, Object> interviewRecord(Map<String, Object> params, User user);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,480 @@
|
|||
package com.engine.portal.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.email.util.EmailCommonUtils;
|
||||
import weaver.email.MailCommonMethod;
|
||||
import weaver.email.MailReciveStatusUtils;
|
||||
import weaver.email.po.Mailconfigureinfo;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 邮件左侧菜单数据
|
||||
*/
|
||||
@Path("/portal/emailmenu")
|
||||
public class EmailMenuAction {
|
||||
|
||||
/**
|
||||
* 邮件模块 左侧菜单 数据
|
||||
*/
|
||||
@POST
|
||||
@Path("/emailmenu")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String getEmailMenuJson(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
// 内外部邮件是否启用
|
||||
Mailconfigureinfo mailconfigureinfo = MailReciveStatusUtils.getMailconfigureinfoFromCache(EmailCommonUtils.getSubcompanyidByDetach(user));
|
||||
boolean isUseInnerMail = mailconfigureinfo.getInnerMail() == 1;
|
||||
boolean isUseOutterMail = mailconfigureinfo.getOutterMail() == 1;
|
||||
|
||||
JSONArray emailArray = new JSONArray();
|
||||
MailCommonMethod mcm = new MailCommonMethod();
|
||||
// 顶部"我的邮件"菜单id
|
||||
String emailMenuId = "536";
|
||||
|
||||
// 写信
|
||||
JSONObject writeObject = new JSONObject();
|
||||
writeObject.put("id", emailMenuId + "01");
|
||||
writeObject.put("parentId", emailMenuId);
|
||||
writeObject.put("levelid", emailMenuId + "01");
|
||||
writeObject.put("name", SystemEnv.getHtmlLabelName(521846, user.getLanguage()));
|
||||
writeObject.put("icon", "");
|
||||
writeObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/new");
|
||||
writeObject.put("routeurl", "");
|
||||
writeObject.put("mobxrouteurl", "/email/new");
|
||||
|
||||
JSONArray writeChildArray = new JSONArray();
|
||||
if (isUseInnerMail) {
|
||||
// 内部邮件
|
||||
JSONObject writeChildObject = new JSONObject();
|
||||
writeChildObject.put("id", emailMenuId + "0101");
|
||||
writeChildObject.put("parentId", emailMenuId + "01");
|
||||
writeChildObject.put("levelid", emailMenuId + "0101");
|
||||
writeChildObject.put("name", SystemEnv.getHtmlLabelName(24714, user.getLanguage()));
|
||||
writeChildObject.put("icon", "");
|
||||
writeChildObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/new?isInternal=1");
|
||||
writeChildObject.put("routeurl", "");
|
||||
writeChildObject.put("mobxrouteurl", "/email/new?isInternal=1");
|
||||
writeChildObject.put("child", new JSONArray());
|
||||
writeChildArray.add(writeChildObject);
|
||||
}
|
||||
if (isUseOutterMail) {
|
||||
// 外部邮件
|
||||
JSONObject writeChildObject = new JSONObject();
|
||||
writeChildObject.put("id", emailMenuId + "0102");
|
||||
writeChildObject.put("parentId", emailMenuId + "01");
|
||||
writeChildObject.put("levelid", emailMenuId + "0102");
|
||||
writeChildObject.put("name", SystemEnv.getHtmlLabelName(31139, user.getLanguage()));
|
||||
writeChildObject.put("icon", "");
|
||||
writeChildObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/new?isInternal=0");
|
||||
writeChildObject.put("routeurl", "");
|
||||
writeChildObject.put("mobxrouteurl", "/email/new?isInternal=0");
|
||||
writeChildObject.put("child", new JSONArray());
|
||||
writeChildArray.add(writeChildObject);
|
||||
|
||||
|
||||
}
|
||||
writeObject.put("child", writeChildArray);
|
||||
emailArray.add(writeObject);
|
||||
// 接收
|
||||
JSONObject receiveObject = new JSONObject();
|
||||
receiveObject.put("id", emailMenuId + "02");
|
||||
receiveObject.put("parentId", emailMenuId);
|
||||
receiveObject.put("levelid", emailMenuId + "02");
|
||||
receiveObject.put("name", SystemEnv.getHtmlLabelName(18526, user.getLanguage()));
|
||||
receiveObject.put("icon", "");
|
||||
receiveObject.put("url", "/email/inbox?folderid=0&receivemail=true&receivemailid=0");
|
||||
receiveObject.put("routeurl", "");
|
||||
receiveObject.put("mobxrouteurl", "/email/inbox?folderid=0&receivemail=true&receivemailid=0");
|
||||
JSONArray receiveChildArray = new JSONArray();
|
||||
if (isUseOutterMail) {
|
||||
List receiveList = mcm.getMailAccountList(user);
|
||||
for (int i = 0; i < receiveList.size(); i++) {
|
||||
Map map = (Map) receiveList.get(i);
|
||||
JSONObject receiveChildObject = new JSONObject();
|
||||
receiveChildObject.put("id", emailMenuId + "02" + i);
|
||||
receiveChildObject.put("parentId", emailMenuId + "02");
|
||||
receiveChildObject.put("levelid", emailMenuId + "02" + i);
|
||||
receiveChildObject.put("name", (String) map.get("name"));
|
||||
receiveChildObject.put("icon", "");
|
||||
receiveChildObject.put("url", (String) map.get("singleurl"));
|
||||
receiveChildObject.put("routeurl", "");
|
||||
receiveChildObject.put("mobxrouteurl", (String) map.get("mobxurl"));
|
||||
receiveChildObject.put("child", new JSONArray());
|
||||
receiveChildArray.add(receiveChildObject);
|
||||
}
|
||||
}
|
||||
receiveObject.put("child", receiveChildArray);
|
||||
emailArray.add(receiveObject);
|
||||
|
||||
// --------------------------------------------------
|
||||
// 收件箱
|
||||
JSONObject inboxObject = new JSONObject();
|
||||
inboxObject.put("id", emailMenuId + "03");
|
||||
inboxObject.put("parentId", emailMenuId);
|
||||
inboxObject.put("levelid", emailMenuId + "03");
|
||||
inboxObject.put("name", SystemEnv.getHtmlLabelName(19816, user.getLanguage()));
|
||||
inboxObject.put("icon", "");
|
||||
inboxObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/inbox?menu_folderid=0&folderid=0&receivemail=true&receivemailid=0");
|
||||
inboxObject.put("routeurl", "");
|
||||
inboxObject.put("mobxrouteurl", "/email/inbox?menu_folderid=0&folderid=0&receivemail=true&receivemailid=0");
|
||||
inboxObject.put("child", new JSONArray());
|
||||
//inboxObject.put("count", mcm.getComnCount(user, "folderid=0"));
|
||||
inboxObject.put("countId", "inboxUnreadCount");
|
||||
emailArray.add(inboxObject);
|
||||
|
||||
// 已发送
|
||||
JSONObject outboxObject = new JSONObject();
|
||||
outboxObject.put("id", emailMenuId + "04");
|
||||
outboxObject.put("parentId", emailMenuId);
|
||||
outboxObject.put("levelid", emailMenuId + "04");
|
||||
outboxObject.put("name", SystemEnv.getHtmlLabelName(19558, user.getLanguage()));
|
||||
outboxObject.put("icon", "");
|
||||
outboxObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/sent?menu_folderid=-1&folderid=-1");
|
||||
outboxObject.put("routeurl", "");
|
||||
outboxObject.put("mobxrouteurl", "/email/sent?menu_folderid=-1&folderid=-1");
|
||||
outboxObject.put("child", new JSONArray());
|
||||
outboxObject.put("countId", "sendUnreadCount");
|
||||
emailArray.add(outboxObject);
|
||||
|
||||
// 草稿箱
|
||||
JSONObject drafboxObject = new JSONObject();
|
||||
drafboxObject.put("id", emailMenuId + "05");
|
||||
drafboxObject.put("parentId", emailMenuId);
|
||||
drafboxObject.put("levelid", emailMenuId + "05");
|
||||
drafboxObject.put("name", SystemEnv.getHtmlLabelName(2039, user.getLanguage()));
|
||||
drafboxObject.put("icon", "");
|
||||
drafboxObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/draft?menu_folderid=-2&folderid=-2");
|
||||
drafboxObject.put("routeurl", "");
|
||||
drafboxObject.put("mobxrouteurl", "/email/draft?menu_folderid=-2&folderid=-2");
|
||||
drafboxObject.put("child", new JSONArray());
|
||||
drafboxObject.put("countId", "draftUnreadCount");
|
||||
emailArray.add(drafboxObject);
|
||||
|
||||
// 垃圾箱
|
||||
JSONObject delboxObject = new JSONObject();
|
||||
delboxObject.put("id", emailMenuId + "06");
|
||||
delboxObject.put("parentId", emailMenuId);
|
||||
delboxObject.put("levelid", emailMenuId + "06");
|
||||
delboxObject.put("name", SystemEnv.getHtmlLabelName(2040, user.getLanguage()));
|
||||
delboxObject.put("icon", "");
|
||||
delboxObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/deleted?menu_folderid=-3&folderid=-3");
|
||||
delboxObject.put("routeurl", "");
|
||||
delboxObject.put("mobxrouteurl", "/email/deleted?menu_folderid=-3&folderid=-3");
|
||||
delboxObject.put("child", new JSONArray());
|
||||
delboxObject.put("countId", "deletedUnreadCount");
|
||||
delboxObject.put("titleUrlIcon", weaver.general.GCONST.getContextPath() + "/email/images/clear_wev8.png");
|
||||
emailArray.add(delboxObject);
|
||||
|
||||
// 待办邮件
|
||||
JSONObject waitdealObject = new JSONObject();
|
||||
waitdealObject.put("id", emailMenuId + "07");
|
||||
waitdealObject.put("parentId", emailMenuId);
|
||||
waitdealObject.put("levelid", emailMenuId + "07");
|
||||
waitdealObject.put("name", SystemEnv.getHtmlLabelName(83090, user.getLanguage()));
|
||||
waitdealObject.put("icon", "");
|
||||
waitdealObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/doing?menu_waitdeal=1&waitdeal=1");
|
||||
waitdealObject.put("routeurl", "");
|
||||
waitdealObject.put("mobxrouteurl", "/email/doing?menu_waitdeal=1&waitdeal=1");
|
||||
waitdealObject.put("child", new JSONArray());
|
||||
// waitdealObject.put("count", mcm.getComnCount(user, "waitdeal=1"));
|
||||
waitdealObject.put("countId", "waitDealCount");
|
||||
emailArray.add(waitdealObject);
|
||||
|
||||
// 标星邮件
|
||||
JSONObject starObject = new JSONObject();
|
||||
starObject.put("id", emailMenuId + "09");
|
||||
starObject.put("parentId", emailMenuId);
|
||||
starObject.put("levelid", emailMenuId + "09");
|
||||
starObject.put("name", SystemEnv.getHtmlLabelName(81337, user.getLanguage()));
|
||||
starObject.put("icon", "");
|
||||
starObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/star?menu_star=1&star=1");
|
||||
starObject.put("routeurl", "");
|
||||
starObject.put("mobxrouteurl", "/email/star?menu_star=1&star=1");
|
||||
starObject.put("child", new JSONArray());
|
||||
starObject.put("countId", "starCount");
|
||||
emailArray.add(starObject);
|
||||
|
||||
//所有邮件
|
||||
JSONObject AllMailObject = new JSONObject();
|
||||
AllMailObject.put("id", emailMenuId + "16");
|
||||
AllMailObject.put("parentId", emailMenuId);
|
||||
AllMailObject.put("levelid", emailMenuId + "16");
|
||||
AllMailObject.put("name", SystemEnv.getHtmlLabelName(33212, user.getLanguage()));
|
||||
AllMailObject.put("icon", "");
|
||||
AllMailObject.put("url", "");
|
||||
AllMailObject.put("routeurl", "");
|
||||
AllMailObject.put("mobxrouteurl", "");
|
||||
JSONArray AllMailChildArray = new JSONArray();
|
||||
if (isUseInnerMail) {
|
||||
// 内部邮件
|
||||
JSONObject internalObject = new JSONObject();
|
||||
internalObject.put("id", emailMenuId + "08");
|
||||
internalObject.put("parentId", emailMenuId);
|
||||
internalObject.put("levelid", emailMenuId + "08");
|
||||
internalObject.put("name", SystemEnv.getHtmlLabelName(24714, user.getLanguage()));
|
||||
internalObject.put("icon", "");
|
||||
internalObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/inner?menu_isInternal=1&isInternal=1");
|
||||
internalObject.put("routeurl", "");
|
||||
internalObject.put("mobxrouteurl", "/email/inner?menu_isInternal=1&isInternal=1");
|
||||
internalObject.put("child", new JSONArray());
|
||||
internalObject.put("countId", "unreadCount_Internal");
|
||||
AllMailChildArray.add(internalObject);
|
||||
}
|
||||
if (isUseOutterMail) {
|
||||
//外部邮件
|
||||
JSONObject outterObject = new JSONObject();
|
||||
outterObject.put("id", emailMenuId + "17");
|
||||
outterObject.put("parentId", emailMenuId);
|
||||
outterObject.put("levelid", emailMenuId + "17");
|
||||
outterObject.put("name", SystemEnv.getHtmlLabelName(31139, user.getLanguage()));
|
||||
outterObject.put("icon", "");
|
||||
outterObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/outter?menu_isInternal=1&isInternal=0");
|
||||
outterObject.put("routeurl", "");
|
||||
outterObject.put("mobxrouteurl", "/email/outter?menu_isInternal=0&isInternal=0");
|
||||
outterObject.put("child", new JSONArray());
|
||||
outterObject.put("countId", "unreadCount_Outter");
|
||||
AllMailChildArray.add(outterObject);
|
||||
}
|
||||
AllMailObject.put("child", AllMailChildArray);
|
||||
AllMailObject.put("countId", "unreadCount_all");
|
||||
AllMailObject.put("titleUrlIcon", "");
|
||||
AllMailObject.put("titleUrl", "");
|
||||
AllMailObject.put("hasTopLine", "true");
|
||||
emailArray.add(AllMailObject);
|
||||
|
||||
// --------------------------------------------------
|
||||
// 我的文件夹
|
||||
JSONObject folderObject = new JSONObject();
|
||||
folderObject.put("id", emailMenuId + "10");
|
||||
folderObject.put("parentId", emailMenuId);
|
||||
folderObject.put("levelid", emailMenuId + "10");
|
||||
folderObject.put("name", SystemEnv.getHtmlLabelName(81348, user.getLanguage()));
|
||||
folderObject.put("icon", "");
|
||||
folderObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/setting/folderManage");
|
||||
folderObject.put("routeurl", "");
|
||||
folderObject.put("mobxrouteurl", "");
|
||||
JSONArray folderChildArray = new JSONArray();
|
||||
List folderList = mcm.getMyFileList4Menu(user, "folderManage");
|
||||
for (int i = 0; i < folderList.size(); i++) {
|
||||
Map map = (Map) folderList.get(i);
|
||||
JSONObject folderChildObject = new JSONObject();
|
||||
folderChildObject.put("id", emailMenuId + "10" + i);
|
||||
folderChildObject.put("parentId", emailMenuId + "10");
|
||||
folderChildObject.put("levelid", emailMenuId + "10" + i);
|
||||
folderChildObject.put("name", (String) map.get("name"));
|
||||
folderChildObject.put("icon", "");
|
||||
folderChildObject.put("url", (String) map.get("singleurl"));
|
||||
folderChildObject.put("routeurl", "");
|
||||
folderChildObject.put("mobxrouteurl", (String) map.get("mobxurl"));
|
||||
folderChildObject.put("child", new JSONArray());
|
||||
folderChildObject.put("countId", "folderUnreadCount_" + (String) map.get("id"));
|
||||
folderChildArray.add(folderChildObject);
|
||||
}
|
||||
folderObject.put("countId", "folderUnreadCount_all");
|
||||
folderObject.put("child", folderChildArray);
|
||||
folderObject.put("titleUrlIcon", weaver.general.GCONST.getContextPath() + "/email/images/manage_wev8.png");
|
||||
folderObject.put("titleUrl", "/email/setting/folderManage");
|
||||
folderObject.put("titleUrlName", SystemEnv.getHtmlLabelName(81343, user.getLanguage()));//文件夹管理
|
||||
folderObject.put("hasTopLine", "true");
|
||||
emailArray.add(folderObject);
|
||||
|
||||
// 我的标签
|
||||
JSONObject tagObject = new JSONObject();
|
||||
tagObject.put("id", emailMenuId + "11");
|
||||
tagObject.put("parentId", emailMenuId);
|
||||
tagObject.put("levelid", emailMenuId + "11");
|
||||
tagObject.put("name", SystemEnv.getHtmlLabelName(521848, user.getLanguage()));
|
||||
tagObject.put("icon", "");
|
||||
tagObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/setting/labelManage");
|
||||
tagObject.put("routeurl", "");
|
||||
tagObject.put("mobxrouteurl", "");
|
||||
JSONArray tagChildArray = new JSONArray();
|
||||
List tagList = mcm.getMyFileList4Menu(user, "tagManage");
|
||||
for (int i = 0; i < tagList.size(); i++) {
|
||||
Map map = (Map) tagList.get(i);
|
||||
JSONObject tagChildObject = new JSONObject();
|
||||
tagChildObject.put("id", emailMenuId + "11" + i);
|
||||
tagChildObject.put("parentId", emailMenuId + "11");
|
||||
tagChildObject.put("levelid", emailMenuId + "11" + i);
|
||||
tagChildObject.put("name", (String) map.get("name"));
|
||||
tagChildObject.put("icon", "");
|
||||
tagChildObject.put("url", (String) map.get("singleurl"));
|
||||
tagChildObject.put("routeurl", "");
|
||||
tagChildObject.put("mobxrouteurl", (String) map.get("mobxurl"));
|
||||
tagChildObject.put("child", new JSONArray());
|
||||
tagChildObject.put("tagColor", (String) map.get("color"));
|
||||
tagChildObject.put("countId", "tagUnreadCount_" + (String) map.get("id"));
|
||||
tagChildArray.add(tagChildObject);
|
||||
}
|
||||
tagObject.put("countId", "tagUnreadCount_all");
|
||||
tagObject.put("child", tagChildArray);
|
||||
tagObject.put("titleUrlIcon", weaver.general.GCONST.getContextPath() + "/email/images/manage_wev8.png");
|
||||
tagObject.put("titleUrl", "/email/setting/labelManage");
|
||||
tagObject.put("titleUrlName", SystemEnv.getHtmlLabelName(81342, user.getLanguage()));//标签管理
|
||||
emailArray.add(tagObject);
|
||||
|
||||
// --------------------------------------------------
|
||||
if (isUseOutterMail) {
|
||||
// 联系人
|
||||
JSONObject contactsObject = new JSONObject();
|
||||
contactsObject.put("id", emailMenuId + "12");
|
||||
contactsObject.put("parentId", emailMenuId);
|
||||
contactsObject.put("levelid", emailMenuId + "12");
|
||||
contactsObject.put("name", SystemEnv.getHtmlLabelName(572, user.getLanguage()));
|
||||
contactsObject.put("icon", "");
|
||||
contactsObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/contacts");
|
||||
contactsObject.put("routeurl", "");
|
||||
contactsObject.put("mobxrouteurl", "/email/contacts");
|
||||
contactsObject.put("child", new JSONArray());
|
||||
contactsObject.put("hasTopLine", "true");
|
||||
emailArray.add(contactsObject);
|
||||
}
|
||||
|
||||
// 附件中心
|
||||
JSONObject attachmentObject = new JSONObject();
|
||||
attachmentObject.put("id", emailMenuId + "13");
|
||||
attachmentObject.put("parentId", emailMenuId);
|
||||
attachmentObject.put("levelid", emailMenuId + "13");
|
||||
attachmentObject.put("name", SystemEnv.getHtmlLabelName(500738, user.getLanguage()));
|
||||
attachmentObject.put("icon", "");
|
||||
attachmentObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/attachment");
|
||||
attachmentObject.put("routeurl", "");
|
||||
attachmentObject.put("mobxrouteurl", "/email/attachment");
|
||||
attachmentObject.put("child", new JSONArray());
|
||||
emailArray.add(attachmentObject);
|
||||
|
||||
// --------------------------------------------------
|
||||
// 邮件设置
|
||||
JSONObject settingObject = new JSONObject();
|
||||
settingObject.put("id", emailMenuId + "14");
|
||||
settingObject.put("parentId", emailMenuId);
|
||||
settingObject.put("levelid", emailMenuId + "14");
|
||||
settingObject.put("name", SystemEnv.getHtmlLabelName(24751, user.getLanguage()));
|
||||
settingObject.put("icon", "");
|
||||
settingObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/setting");
|
||||
settingObject.put("routeurl", "");
|
||||
settingObject.put("mobxrouteurl", "/email/setting");
|
||||
settingObject.put("child", new JSONArray());
|
||||
settingObject.put("hasTopLine", "true");
|
||||
emailArray.add(settingObject);
|
||||
|
||||
if (HrmUserVarify.checkUserRight("Email:monitor", user)) {
|
||||
// 邮件监控
|
||||
JSONObject monitorObject = new JSONObject();
|
||||
monitorObject.put("id", emailMenuId + "15");
|
||||
monitorObject.put("parentId", emailMenuId);
|
||||
monitorObject.put("levelid", emailMenuId + "15");
|
||||
monitorObject.put("name", SystemEnv.getHtmlLabelName(384307, user.getLanguage()));
|
||||
monitorObject.put("icon", "");
|
||||
monitorObject.put("url", weaver.general.GCONST.getContextPath() + "/spa/email/static/index.html#/main/email/monitor");
|
||||
monitorObject.put("routeurl", "");
|
||||
monitorObject.put("mobxrouteurl", "/email/monitor");
|
||||
monitorObject.put("child", new JSONArray());
|
||||
emailArray.add(monitorObject);
|
||||
}
|
||||
|
||||
return emailArray.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮件菜单 各个文件夹 未读数 或 草稿箱邮件数 或 待办邮件数量 接口
|
||||
*/
|
||||
@GET
|
||||
@Path("/unreadCount")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String unreadCountBymenu(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
MailCommonMethod mcm = new MailCommonMethod();
|
||||
//收件箱
|
||||
int inboxUnreadCount = mcm.getComnCount(user, "folderid=0");
|
||||
apidatas.put("inboxUnreadCount", mcm.formatUnreadCountStr(inboxUnreadCount));
|
||||
|
||||
//已发送
|
||||
int sendUnreadCount = mcm.getComnCount(user, "folderid=-1");
|
||||
apidatas.put("sendUnreadCount", mcm.formatUnreadCountStr(sendUnreadCount));
|
||||
|
||||
//草稿箱
|
||||
int draftUnreadCount = mcm.getComnCount(user, "draft");
|
||||
apidatas.put("draftUnreadCount", mcm.formatUnreadCountStr(draftUnreadCount));
|
||||
|
||||
//待办邮件
|
||||
int waitDealCount = mcm.getComnCount(user, "waitdeal=1");
|
||||
apidatas.put("waitDealCount", mcm.formatUnreadCountStr(waitDealCount));
|
||||
|
||||
//垃圾箱
|
||||
int deletedUnreadCount = mcm.getComnCount(user, "folderid=-3");
|
||||
apidatas.put("deletedUnreadCount", mcm.formatUnreadCountStr(deletedUnreadCount));
|
||||
|
||||
//标星
|
||||
int starCount = mcm.getComnCount(user, "star=1");
|
||||
apidatas.put("starCount", mcm.formatUnreadCountStr(starCount));
|
||||
|
||||
//内部
|
||||
int internalUnreadCount = mcm.getComnCount(user, "isInternal=1");
|
||||
apidatas.put("unreadCount_Internal", mcm.formatUnreadCountStr(internalUnreadCount));
|
||||
|
||||
//外部
|
||||
int outterUnreadCount = mcm.getComnCount(user, "isInternal=0");
|
||||
apidatas.put("unreadCount_Outter", mcm.formatUnreadCountStr(outterUnreadCount));
|
||||
|
||||
//全部
|
||||
//int allUnreadCount = mcm.getComnCount(user, "isInternal=-1");
|
||||
|
||||
// 内外部邮件是否启用
|
||||
Mailconfigureinfo mailconfigureinfo = MailReciveStatusUtils.getMailconfigureinfoFromCache(EmailCommonUtils.getSubcompanyidByDetach(user));
|
||||
boolean isUseInnerMail = mailconfigureinfo.getInnerMail() == 1;
|
||||
boolean isUseOutterMail = mailconfigureinfo.getOutterMail() == 1;
|
||||
int allUnreadCount = 0;
|
||||
if (isUseInnerMail) {
|
||||
allUnreadCount += internalUnreadCount;
|
||||
}
|
||||
if (isUseOutterMail) {
|
||||
allUnreadCount += outterUnreadCount;
|
||||
}
|
||||
apidatas.put("unreadCount_all", mcm.formatUnreadCountStr(allUnreadCount));
|
||||
|
||||
|
||||
//文件夹
|
||||
int totalFolderUnreadCounts = 0;
|
||||
List folderList = mcm.getMyFileList4Menu(user, "folderManage");
|
||||
for (int i = 0; i < folderList.size(); i++) {
|
||||
Map map = (Map) folderList.get(i);
|
||||
JSONObject folderChildObject = new JSONObject();
|
||||
int folderMailUnreadCount = mcm.getComnCount(user, "folderid=" + (String) map.get("id"));
|
||||
apidatas.put("folderUnreadCount_" + (String) map.get("id"), mcm.formatUnreadCountStr(folderMailUnreadCount));
|
||||
totalFolderUnreadCounts += folderMailUnreadCount;
|
||||
}
|
||||
apidatas.put("folderUnreadCount_all", mcm.formatUnreadCountStr(totalFolderUnreadCounts));
|
||||
|
||||
//标签
|
||||
int totalTagUnreadCounts = 0;
|
||||
List tagList = mcm.getMyFileList4Menu(user, "tagManage");
|
||||
for (int i = 0; i < tagList.size(); i++) {
|
||||
Map map = (Map) tagList.get(i);
|
||||
JSONObject tagChildObject = new JSONObject();
|
||||
int tagMailUnreadCount = mcm.getComnCount(user, "tagid=" + (String) map.get("id"));
|
||||
apidatas.put("tagUnreadCount_" + (String) map.get("id"), mcm.formatUnreadCountStr(tagMailUnreadCount));
|
||||
totalTagUnreadCounts += tagMailUnreadCount;
|
||||
}
|
||||
apidatas.put("tagUnreadCount_all", mcm.formatUnreadCountStr(totalTagUnreadCounts));
|
||||
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,769 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportDailyExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")),",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.add("kqdate");
|
||||
showColumns.add("serialid");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("signin1")){
|
||||
cascadekey = "signout1";
|
||||
}else if(showColumn.equals("signin2")){
|
||||
cascadekey = "signout2";
|
||||
}else if(showColumn.equals("signin3")){
|
||||
cascadekey = "signout3";
|
||||
}else if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
toDate = today;
|
||||
}
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String,Object>> constraintList = null;
|
||||
Map<String,Object> constraint = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
if("kqdate".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width",30*256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan",childColumns.size());
|
||||
}else{
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "2");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
String backFields = " (select xxb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as xxb,(select zrbtjbzdx*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjbztx,(select gzsc from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as gzsc,(select psjbshic*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as psjbsc,b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb," +
|
||||
"(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb,(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb," +
|
||||
"(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs,(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts," +
|
||||
"(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts,(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts," +
|
||||
"(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts,(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"(select sum(sch) from uf_jbsqhz where sqr = a.id and ksrq = b.kqdate and jblx in (0,1,2,3)) as jbsq,a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins,b.beLate," +
|
||||
" b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins,b.graveLeaveEarly," +
|
||||
" b.graveLeaveEarlyMins,b.absenteeism,b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
//考勤异常状态
|
||||
String KQstatus = Util.null2String(jsonObj.get("KQstatus"));
|
||||
if ("5".equals(KQstatus)){
|
||||
|
||||
}else if ("1".equals(KQstatus)){
|
||||
sqlWhere += " and (absenteeismMins > 0 or forgotCheck > 0) ";
|
||||
}else if ("2".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0) ";
|
||||
}else if ("3".equals(KQstatus)){
|
||||
sqlWhere += " and (b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0) ";
|
||||
}else if ("4".equals(KQstatus)){
|
||||
sqlWhere +=" and forgotCheck > 0";
|
||||
}else if ("6".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins = 0 and b.graveBeLateMins = 0 and b.leaveEarlyMins = 0 and b.graveLeaveEarlyMins = 0 and absenteeismMins = 0 and forgotCheck = 0)";
|
||||
}else if ("7".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0 or b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0 or absenteeismMins > 0 or forgotCheck > 0)";
|
||||
}
|
||||
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc , b.kqDate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select "+backFields + sqlFrom + sqlWhere+orderBy;
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
String tmpkey = id+"|"+kqdate+"|";
|
||||
// Map<String,Object> signDetailInfo = this.getSignDetailInfo(id,kqdate);
|
||||
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if(fieldName.equals("cardOvertime")){
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
Double zlMinsNew = Util.getDoubleValue(fieldValue);
|
||||
String skjbcsy = divide(String.valueOf(changeBxs(zlMinsNew.intValue())),"60");
|
||||
fieldValue = skjbcsy;
|
||||
} else if(fieldName.equals("xqNew")){
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
} else if(fieldName.equals("serialid")){
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
if(serialid.length()>0){
|
||||
// fieldValue = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(serialid)){
|
||||
fieldValue = serialdata.get(serialid);
|
||||
}else{
|
||||
String tmpserialname = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
fieldValue = tmpserialname;
|
||||
serialdata.put(serialid,tmpserialname);
|
||||
}
|
||||
}
|
||||
} else if(fieldName.equals("signin1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("leave")){
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
fieldValue = Util.null2String(flowData.get(id+"|"+kqdate+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(fieldValue);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
writeLog("ExportDailyExcelCmd:fieldValue" + fieldValue + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(fieldValue, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
fieldValue = flowLeaveData;
|
||||
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else if(fieldName.equals("kqdate")){
|
||||
fieldValue=kqdate+" "+com.engine.portal.util.DateUtil.getDayWeekOfDate1(DateUtil.parseToDate(kqdate));
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
|
||||
if(!fieldName.equals("leave") && !fieldName.equals("kqdate")) {
|
||||
fieldValue = Util.formatMultiLang(fieldValue, "" + user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList",constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390352, user.getLanguage())+" "+fromDate+" "+toDate;;
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
title = new HashMap<>();
|
||||
title.put("title",name+"("+
|
||||
((KQUnitBiz.isLeaveHour(unitType))?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()))+")");
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title",SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+
|
||||
(KQReportBiz.getUnitType(kqReportFieldComInfo, user).length()>0?"("+ KQReportBiz.getUnitType(kqReportFieldComInfo, user)+")":""));
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
int workMins = rs.getInt("workMins");
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
if(serialid.length()>0){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 半小时转换
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static Integer changeBxs(Integer value){
|
||||
return (value / 30)*30 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的除法运算。
|
||||
* @param v1 被加数
|
||||
* @param v2 加数
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static String divide(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.divide(b2,2,BigDecimal.ROUND_HALF_UP).toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<meta name="format-detection" content="telephone=no,email=no">
|
||||
<link rel="stylesheet" id='main-default_css' href="/mobilemode/mobile/dist/css/main-default.css?v=96abdabb64">
|
||||
<script type="text/javascript">
|
||||
window.convertPath = function(path) {
|
||||
if (path && window.ecologyContentPath && path.startsWith("/") && !path.startsWith(window.ecologyContentPath)) {
|
||||
path = window.ecologyContentPath + path;
|
||||
}
|
||||
return path;
|
||||
};
|
||||
(function() {
|
||||
var search = window.location.search;
|
||||
var params = search.replace('?', '').match(/([^&]*?)=([^&]*?)(?=&)|([^&]*?)=([^&]*)/g);
|
||||
var param = {};
|
||||
|
||||
params && params.forEach(function (paramStr) {
|
||||
var arr = paramStr.split('=');
|
||||
var key = arr[0];
|
||||
var value = arr[1];
|
||||
|
||||
var skip = (key == 'appid' && param.appHomepageId);
|
||||
if (!skip && !param[key]) {
|
||||
param[key] = value;
|
||||
}
|
||||
});
|
||||
|
||||
window.__meta__ = {
|
||||
appid: param.appid || '',
|
||||
appHomepageId: param.appHomepageId || '',
|
||||
pageParams: {},
|
||||
globalVars: {},
|
||||
user: {},
|
||||
mToken: param.mToken || "",
|
||||
mTokenFrom: param.mTokenFrom || "",
|
||||
wechatUser: {
|
||||
openid: "#EB_USERKEY#",
|
||||
nickname: "#EB_USERNAME#",
|
||||
avatar: "#EB_USERAVATAR#"
|
||||
},
|
||||
unloadjem: param.unloadjem || "",
|
||||
sysId: param.outsysid || "",
|
||||
clientTheme: decodeURIComponent(param.mTheme || "") || "#393F9D"
|
||||
};
|
||||
}())
|
||||
</script>
|
||||
<script>
|
||||
if (!window.Promise) {
|
||||
document.writeln('<script src="/cloudstore/resource/mobile/es6-promise/es6-promise.min.js"><\/script>')
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<script src="/mobilemode/mobile/dist/js/loader.js?v=47570bbc30" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
Loader({
|
||||
require: {
|
||||
name: "require",
|
||||
path: "/mobilemode/mobile/dist/js/lib/require/require.min_wev8.js?v=7eb8e3066f"
|
||||
},
|
||||
module: {
|
||||
name: "main",
|
||||
path: "/mobilemode/mobile/dist/js/main/main.js?v=1be0fb1aa6"
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,111 @@
|
|||
package com.api.hrm.util;
|
||||
|
||||
import com.engine.common.service.HrmCommonService;
|
||||
import com.engine.common.service.impl.HrmCommonServiceImpl;
|
||||
import com.engine.hrm.biz.HrmSanyuanAdminBiz;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.appdetach.AppDetachComInfo;
|
||||
import weaver.hrm.moduledetach.ManageDetachComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
|
||||
import java.util.StringJoiner;
|
||||
|
||||
public class HrmReportDetachUtil extends BaseBean {
|
||||
|
||||
private char flag = Util.getSeparator();
|
||||
|
||||
private String rightStr = "HrmResourceAdd:Add";
|
||||
|
||||
|
||||
|
||||
public String getDetachSqlWhere(int userId, String alias){
|
||||
String sqlWhere = "";
|
||||
String manageDetachSqlWhere = this.getManageDetachSqlWhere(userId, alias);
|
||||
String appDetachSqlWhere = "";
|
||||
AppDetachComInfo appDetachComInfo = new AppDetachComInfo();
|
||||
try {
|
||||
appDetachSqlWhere = appDetachComInfo.getScopeSqlByHrmResourceSearch("" + userId, true, "resource_" + alias);
|
||||
} catch (Exception e){
|
||||
writeLog("获取应用分权SQL片段异常");
|
||||
writeLog(e);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(manageDetachSqlWhere) && StringUtils.isNotBlank(appDetachSqlWhere)){
|
||||
sqlWhere = manageDetachSqlWhere + " and " + appDetachSqlWhere;
|
||||
} else if (StringUtils.isNotBlank(manageDetachSqlWhere) && StringUtils.isBlank(appDetachSqlWhere)){
|
||||
sqlWhere = manageDetachSqlWhere;
|
||||
} else if (StringUtils.isBlank(manageDetachSqlWhere) && StringUtils.isNotBlank(appDetachSqlWhere)){
|
||||
sqlWhere = appDetachSqlWhere;
|
||||
}
|
||||
|
||||
writeLog("分权sqlwhere:" + sqlWhere);
|
||||
|
||||
return sqlWhere;
|
||||
}
|
||||
|
||||
private String getManageDetachSqlWhere(int userId, String alias){
|
||||
String sqlWhere = "";
|
||||
|
||||
try {
|
||||
ManageDetachComInfo manageDetachComInfo = new ManageDetachComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
RecordSet recordSet = new RecordSet();
|
||||
|
||||
|
||||
// 是否开启了管理分权
|
||||
if (manageDetachComInfo.isUseManageDetach()){
|
||||
// 是否启用了人力资源管理分权
|
||||
if (manageDetachComInfo.isUseHrmManageDetach()){
|
||||
// 系统管理员和大三员可以看所有机构
|
||||
boolean canView = HrmSanyuanAdminBiz.canViewAllSubCompany(userId);
|
||||
if (userId == 1 || canView){
|
||||
return sqlWhere;
|
||||
}
|
||||
StringJoiner stringJoiner = new StringJoiner(",");
|
||||
writeLog("启用人力资源管理分权");
|
||||
recordSet.executeProc("HrmRoleSR_SeByURId", "" + userId + flag + rightStr);
|
||||
while (recordSet.next()) {
|
||||
if (recordSet.getInt("rightlevel") > -1) {
|
||||
stringJoiner.add(String.valueOf(recordSet.getInt("subcompanyid")));
|
||||
} else if (recordSet.getInt("rightlevel") == -1) {
|
||||
stringJoiner.add(String.valueOf(-1 * recordSet.getInt("subcompanyid")));
|
||||
}
|
||||
}
|
||||
String subCompanyIds = stringJoiner.toString();
|
||||
if (subCompanyIds.length() == 0){
|
||||
// 没有机构权限,查看不了任何分部
|
||||
sqlWhere = " 1= 2";
|
||||
} else {
|
||||
sqlWhere = alias + ".subcompanyid1 in (" + subCompanyIds + ")";
|
||||
}
|
||||
} else {
|
||||
writeLog("未启用人力资源管理分权");
|
||||
if (resourceComInfo.isAdmin("" + userId)){
|
||||
return sqlWhere;
|
||||
}
|
||||
HrmCommonService hrmCommonService = new HrmCommonServiceImpl();
|
||||
int roleLevel = hrmCommonService.getMaxRoleLevel(userId, rightStr);
|
||||
if (roleLevel < 0){
|
||||
sqlWhere = " 1=2 ";
|
||||
} else if (roleLevel == 0){
|
||||
// 成员级别为部门
|
||||
String departmentId = resourceComInfo.getDepartmentID("" + userId);
|
||||
sqlWhere = alias + ".departmentid = " + departmentId;
|
||||
} else if (roleLevel == 1){
|
||||
// 成员级别为分部
|
||||
String subCompanyId = resourceComInfo.getSubCompanyID("" + userId);
|
||||
sqlWhere = alias + ".subcompanyid1 = " + subCompanyId;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
writeLog("获取管理分权SQL片段异常");
|
||||
writeLog(e);
|
||||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,274 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="com.weaver.general.Util" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONArray" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
|
||||
<%--
|
||||
User: wangj
|
||||
Design Ideas:
|
||||
更新应聘登记表普工 信息
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
Map<String,Object> res = new HashMap<>(100);
|
||||
RecordSet rs = new RecordSet();
|
||||
String billid = Util.null2String(request.getParameter("billid"));
|
||||
String mainStr = Util.null2String(request.getParameter("main"));
|
||||
String dt1Str = Util.null2String(request.getParameter("dt1"));
|
||||
String dt2Str = Util.null2String(request.getParameter("dt2"));
|
||||
String dt3Str = Util.null2String(request.getParameter("dt3"));
|
||||
JSONObject main = JSONObject.parseObject(mainStr);
|
||||
JSONArray dt1 = JSONArray.parseArray(dt1Str);
|
||||
JSONArray dt2 = JSONArray.parseArray(dt2Str);
|
||||
JSONArray dt3 = JSONArray.parseArray(dt3Str);
|
||||
|
||||
//{"xm":"徐乐乐","xb":"0","jg":"822","csrq":"1998-05-19","stzk":"0","mz":"汉族","sfzhm":"321323199905193936",
|
||||
// "hyzk":"1","sg":"","gycm":"","sfzdz":"","lxdh":"15358673859","xzzs":"","sfzs":"","whcd":"","zy":"","qzfs":"",
|
||||
// "qwxz":"","jntc":"","jsjyysp":"","yy":"","yy1":"","qtyy":"","sfyjsr":"","jsr":"","bm":"",
|
||||
// "lrgx":"","jsrlxfs":"","jjlxr":"","jjlxrybrgx":"","jjlxrdh":"","jjlxrdz":""}
|
||||
String xm = getSelectNullValue(Util.null2String(main.getString("xm")));
|
||||
String xb = getSelectNullValue(Util.null2String(main.getString("xb")));
|
||||
String jg2 = getSelectNullValue(Util.null2String(main.getString("jg2")));
|
||||
String csrq = getSelectNullValue(Util.null2String(main.getString("csrq")));
|
||||
String stzk = getSelectNullValue(Util.null2String(main.getString("stzk")));
|
||||
String mz = getSelectNullValue(Util.null2String(main.getString("mz")));
|
||||
String sfzhm = getSelectNullValue(Util.null2String(main.getString("sfzhm")));
|
||||
String hyzk = getSelectNullValue(Util.null2String(main.getString("hyzk")));
|
||||
String sg = getSelectNullValue(Util.null2String(main.getString("sg")));
|
||||
String gycm = getSelectNullValue(Util.null2String(main.getString("gycm")));
|
||||
String sfzdz = getSelectNullValue(Util.null2String(main.getString("sfzdz")));
|
||||
String lxdh = getSelectNullValue(Util.null2String(main.getString("lxdh")));
|
||||
String xzzs = getSelectNullValue(Util.null2String(main.getString("xzzs")));
|
||||
String sfzs = getSelectNullValue(Util.null2String(main.getString("sfzs")));
|
||||
String whcd = getSelectNullValue(Util.null2String(main.getString("whcd")));
|
||||
String zy = getSelectNullValue(Util.null2String(main.getString("zy")));
|
||||
String qzfs = getSelectNullValue(Util.null2String(main.getString("qzfs")));
|
||||
String qwxz = getSelectNullValue(Util.null2String(main.getString("qwxz")));
|
||||
String jntc = getSelectNullValue(Util.null2String(main.getString("jntc")));
|
||||
String jsjyysp = getSelectNullValue(Util.null2String(main.getString("jsjyysp")));
|
||||
String yy = getSelectNullValue(Util.null2String(main.getString("yy")));
|
||||
String yy1 = getSelectNullValue(Util.null2String(main.getString("yy1")));
|
||||
String qtyy = getSelectNullValue(Util.null2String(main.getString("qtyy")));
|
||||
String sfyjsr = getSelectNullValue(Util.null2String(main.getString("sfyjsr")));
|
||||
String jsr = getSelectNullValue(Util.null2String(main.getString("jsr")));
|
||||
String bm = getSelectNullValue(Util.null2String(main.getString("bm")));
|
||||
String lrgx = getSelectNullValue(Util.null2String(main.getString("lrgx")));
|
||||
String jsrlxfs = getSelectNullValue(Util.null2String(main.getString("jsrlxfs")));
|
||||
String jjlxr = getSelectNullValue(Util.null2String(main.getString("jjlxr")));
|
||||
String jjlxrybrgx = getSelectNullValue(Util.null2String(main.getString("jjlxrybrgx")));
|
||||
String jjlxrdh = getSelectNullValue(Util.null2String(main.getString("jjlxrdh")));
|
||||
String jjlxrdz = getSelectNullValue(Util.null2String(main.getString("jjlxrdz")));
|
||||
|
||||
|
||||
String sql = "update uf_ypdjpg set xm = ?,xb = ?,jg2 = ?,csrq = ?,stzk = ?,mz = ?,sfzhm = ?,hyzk = ?,sg = ?,gycm = ?,sfzdz = ?,lxdh = ?,xzzs = ?,sfzs = ?,whcd = ?,zy = ?,qzfs = ?,qwxz = ?,jntc = ?,jsjyysp = ?,yy = ?,yy1 = ?,qtyy = ?,sfyjsr = ?,jsr = ?,bm = ?,lrgx = ?,jsrlxfs = ?,jjlxr = ?,jjlxrybrgx = ?,jjlxrdh = ?,jjlxrdz = ? where id = ?";
|
||||
boolean flag = rs.executeUpdate(sql,xm,xb,jg2,csrq,stzk,mz,sfzhm,hyzk,sg,gycm,sfzdz,lxdh,xzzs,sfzs,whcd,zy,qzfs,qwxz,jntc,jsjyysp,yy,yy1,qtyy,sfyjsr,jsr,bm,lrgx,jsrlxfs,jjlxr,jjlxrybrgx,jjlxrdh,jjlxrdz,billid);
|
||||
updateDt1(dt1,billid);
|
||||
updateDt2(dt2,billid);
|
||||
updateDt3(dt3,billid);
|
||||
|
||||
|
||||
res.put("status",flag);
|
||||
out.print(JSONObject.toJSONString(res));
|
||||
%>
|
||||
|
||||
|
||||
<%!
|
||||
private String getSelectNullValue (String value){
|
||||
if("".equals(value)){
|
||||
return null;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private void updateDt1(JSONArray data,String billid){
|
||||
List<String> idlist = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select id from uf_ypdjpg_dt1 where mainid = '"+billid+"' order by id asc";
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
idlist.add(id);
|
||||
}
|
||||
String updateSql = "update uf_ypdjpg_dt1 set kssj = ?,jssj = ?,xxmc = ?,zy = ?,xl = ?,xw = ?,xxfs = ? where id = ?";
|
||||
String insertSql = "insert into uf_ypdjpg_dt1 (mainid ,kssj ,jssj ,xxmc ,zy ,xl ,xw ,xxfs) values (?,?,?,?,?,?,?,?)";
|
||||
String deleteSql = "delete uf_ypdjpg_dt1 where id = ?";
|
||||
//数量相等更新数据
|
||||
if(idlist.size() == data.size()){
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String xxmc = getSelectNullValue(Util.null2String(obj.getString("xxmc")));
|
||||
String zy = getSelectNullValue(Util.null2String(obj.getString("zy")));
|
||||
String xl = getSelectNullValue(Util.null2String(obj.getString("xl")));
|
||||
String xw = getSelectNullValue(Util.null2String(obj.getString("xw")));
|
||||
String xxfs = getSelectNullValue(Util.null2String(obj.getString("xxfs")));
|
||||
rs.executeUpdate(updateSql,kssj ,jssj ,xxmc ,zy ,xl ,xw ,xxfs,id);
|
||||
}
|
||||
}else if(idlist.size() < data.size()){
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String xxmc = getSelectNullValue(Util.null2String(obj.getString("xxmc")));
|
||||
String zy = getSelectNullValue(Util.null2String(obj.getString("zy")));
|
||||
String xl = getSelectNullValue(Util.null2String(obj.getString("xl")));
|
||||
String xw = getSelectNullValue(Util.null2String(obj.getString("xw")));
|
||||
String xxfs = getSelectNullValue(Util.null2String(obj.getString("xxfs")));
|
||||
if(i < idlist.size()){
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
rs.executeUpdate(updateSql,kssj ,jssj ,xxmc ,zy ,xl ,xw ,xxfs,id);
|
||||
}else{
|
||||
rs.executeUpdate(insertSql,billid ,kssj ,jssj ,xxmc ,zy ,xl ,xw ,xxfs);
|
||||
}
|
||||
}
|
||||
}else if(idlist.size() > data.size()){
|
||||
for (int i = 0; i < idlist.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
if(i < data.size()) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String xxmc = getSelectNullValue(Util.null2String(obj.getString("xxmc")));
|
||||
String zy = getSelectNullValue(Util.null2String(obj.getString("zy")));
|
||||
String xl = getSelectNullValue(Util.null2String(obj.getString("xl")));
|
||||
String xw = getSelectNullValue(Util.null2String(obj.getString("xw")));
|
||||
String xxfs = getSelectNullValue(Util.null2String(obj.getString("xxfs")));
|
||||
rs.executeUpdate(updateSql,kssj ,jssj ,xxmc ,zy ,xl ,xw ,xxfs,id);
|
||||
}else{
|
||||
rs.executeUpdate(deleteSql,id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private void updateDt2(JSONArray data,String billid){
|
||||
List<String> idlist = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select id from uf_ypdjpg_dt2 where mainid = '"+billid+"' order by id asc";
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
idlist.add(id);
|
||||
}
|
||||
String updateSql = "update uf_ypdjpg_dt2 set kssj = ?,jssj = ?,gzdwmcdz = ?,dh = ?,lzyy = ?,zw = ?,zhxj= ? where id = ?";
|
||||
String insertSql = "insert into uf_ypdjpg_dt2 (mainid ,kssj ,jssj ,gzdwmcdz ,dh ,lzyy ,zw ,zhxj) values (?,?,?,?,?,?,?,?)";
|
||||
String deleteSql = "delete uf_ypdjpg_dt2 where id = ?";
|
||||
//数量相等更新数据
|
||||
if(idlist.size() == data.size()){
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String gzdwmcdz = getSelectNullValue(Util.null2String(obj.getString("gzdwmcdz")));
|
||||
String dh = getSelectNullValue(Util.null2String(obj.getString("dh")));
|
||||
String lzyy = getSelectNullValue(Util.null2String(obj.getString("lzyy")));
|
||||
String zw = getSelectNullValue(Util.null2String(obj.getString("zw")));
|
||||
String zhxj = getSelectNullValue(Util.null2String(obj.getString("zhxj")));
|
||||
rs.executeUpdate(updateSql,kssj ,jssj ,gzdwmcdz ,dh ,lzyy ,zw ,zhxj,id);
|
||||
}
|
||||
}else if(idlist.size() < data.size()){
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String gzdwmcdz = getSelectNullValue(Util.null2String(obj.getString("gzdwmcdz")));
|
||||
String dh = getSelectNullValue(Util.null2String(obj.getString("dh")));
|
||||
String lzyy = getSelectNullValue(Util.null2String(obj.getString("lzyy")));
|
||||
String zw = getSelectNullValue(Util.null2String(obj.getString("zw")));
|
||||
String zhxj = getSelectNullValue(Util.null2String(obj.getString("zhxj")));
|
||||
if(i < idlist.size()){
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
rs.executeUpdate(updateSql,kssj ,jssj ,gzdwmcdz ,dh ,lzyy ,zw ,zhxj,id);
|
||||
}else{
|
||||
rs.executeUpdate(insertSql,billid,kssj ,jssj ,gzdwmcdz ,dh ,lzyy ,zw ,zhxj);
|
||||
}
|
||||
}
|
||||
}else if(idlist.size() > data.size()){
|
||||
for (int i = 0; i < idlist.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
if(i < data.size()) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String kssj = getSelectNullValue(Util.null2String(obj.getString("kssj")));
|
||||
String jssj = getSelectNullValue(Util.null2String(obj.getString("jssj")));
|
||||
String gzdwmcdz = getSelectNullValue(Util.null2String(obj.getString("gzdwmcdz")));
|
||||
String dh = getSelectNullValue(Util.null2String(obj.getString("dh")));
|
||||
String lzyy = getSelectNullValue(Util.null2String(obj.getString("lzyy")));
|
||||
String zw = getSelectNullValue(Util.null2String(obj.getString("zw")));
|
||||
String zhxj = getSelectNullValue(Util.null2String(obj.getString("zhxj")));
|
||||
rs.executeUpdate(updateSql,kssj ,jssj ,gzdwmcdz ,dh ,lzyy ,zw ,zhxj,id);
|
||||
}else{
|
||||
rs.executeUpdate(deleteSql,id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private void updateDt3(JSONArray data,String billid){
|
||||
List<String> idlist = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select id from uf_ypdjpg_dt3 where mainid = '"+billid+"' order by id asc";
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
idlist.add(id);
|
||||
}
|
||||
String updateSql = "update uf_ypdjpg_dt3 set xm = ?,gx = ?,nl = ?,rzdwdzdh = ? where id = ?";
|
||||
String insertSql = "insert into uf_ypdjpg_dt3 (mainid,xm ,gx ,nl ,rzdwdzdh) values (?,?,?,?,?)";
|
||||
String deleteSql = "delete uf_ypdjpg_dt3 where id = ?";
|
||||
//数量相等更新数据
|
||||
if(idlist.size() == data.size()){
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String xm = getSelectNullValue(Util.null2String(obj.getString("xm")));
|
||||
String gx = getSelectNullValue(Util.null2String(obj.getString("gx")));
|
||||
String nl = getSelectNullValue(Util.null2String(obj.getString("nl")));
|
||||
String rzdwdzdh = getSelectNullValue(Util.null2String(obj.getString("rzdwdzdh")));
|
||||
|
||||
rs.executeUpdate(updateSql,xm ,gx ,nl ,rzdwdzdh,id);
|
||||
}
|
||||
}else if(idlist.size() < data.size()){
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String xm = getSelectNullValue(Util.null2String(obj.getString("xm")));
|
||||
String gx = getSelectNullValue(Util.null2String(obj.getString("gx")));
|
||||
String nl = getSelectNullValue(Util.null2String(obj.getString("nl")));
|
||||
String rzdwdzdh = getSelectNullValue(Util.null2String(obj.getString("rzdwdzdh")));
|
||||
if(i < idlist.size()){
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
rs.executeUpdate(updateSql,xm ,gx ,nl ,rzdwdzdh,id);
|
||||
}else{
|
||||
rs.executeUpdate(insertSql,billid,xm ,gx ,nl ,rzdwdzdh);
|
||||
}
|
||||
}
|
||||
}else if(idlist.size() > data.size()){
|
||||
for (int i = 0; i < idlist.size(); i++) {
|
||||
String id = Util.null2String(idlist.get(i));
|
||||
if(i < data.size()) {
|
||||
JSONObject obj = (JSONObject) data.get(i);
|
||||
String xm = getSelectNullValue(Util.null2String(obj.getString("xm")));
|
||||
String gx = getSelectNullValue(Util.null2String(obj.getString("gx")));
|
||||
String nl = getSelectNullValue(Util.null2String(obj.getString("nl")));
|
||||
String rzdwdzdh = getSelectNullValue(Util.null2String(obj.getString("rzdwdzdh")));
|
||||
rs.executeUpdate(updateSql,xm ,gx ,nl ,rzdwdzdh,id);
|
||||
}else{
|
||||
rs.executeUpdate(deleteSql,id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,55 @@
|
|||
package com.engine.jgkq.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.jgkq.service.ZkPushService;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Title ecology-9
|
||||
* @Company 泛微软件
|
||||
* @CreateDate 2024/4/24
|
||||
* @Description
|
||||
* @Author AdminZm
|
||||
*/
|
||||
public class ZkPushServiceImpl extends Service implements ZkPushService {
|
||||
|
||||
@Override
|
||||
public String initOptions(String sn, String PushOptionsFlag) {
|
||||
StringBuffer devOptions = new StringBuffer();
|
||||
devOptions.append("GET OPTION FROM: " + sn);
|
||||
// + "\nStamp=" + devInfo.devInfoJson.getString("Stamp")
|
||||
devOptions.append("\nATTLOGStamp=0");
|
||||
// devOptions.append("\nOPERLOGStamp=0");
|
||||
// devOptions.append("\nBIODATAStamp=0");
|
||||
// devOptions.append("\nATTPHOTOStamp=0");
|
||||
devOptions.append("\nErrorDelay=30");//断网重连
|
||||
devOptions.append("\nDelay=10");// 心跳间隔
|
||||
devOptions.append("\nTransTimes=10:00;11:00;12:00;14:00;15:00;16:00;17:00;18:00");// 时区
|
||||
devOptions.append("\nTransInterval=1");// 时区
|
||||
devOptions.append("\nTimeZone=8");// 时区
|
||||
devOptions.append("\nRealtime=1");// 实时上传
|
||||
devOptions.append("\nServerVer=3.0.1");// 服务器支持的协议版本号 这个必须填写
|
||||
devOptions.append("\nPushProtVer=2.4.1"); // 服务端依据哪个协议版本开发的
|
||||
devOptions.append("\nSupportPing=1"); //ping接口参数
|
||||
// 1 考勤记录
|
||||
// 2 操作日志
|
||||
// 3 考勤照片
|
||||
// 4 登记新指纹
|
||||
// 5 登记新用户
|
||||
// 6 指纹图片
|
||||
// 7 修改用户信息
|
||||
// 8 修改指纹
|
||||
// 9 新登记人脸
|
||||
// 10 用户照片
|
||||
// 11 工作号码
|
||||
// 12 比对照片
|
||||
devOptions.append("\nTransFlag=100000000000");// 1-12二进制位 分别代表以上含义
|
||||
System.out.println("PushOptionsFlag·============="+PushOptionsFlag);
|
||||
if (PushOptionsFlag != null && PushOptionsFlag.equals("1")) {
|
||||
// 支持参数单独获取的才要把需要获取的参数回传给设备 modifeid by max 20170926
|
||||
devOptions.append("\nPushOptions=RegDeviceType,FingerFunOn,FaceFunOn,FPVersion,FaceVersion,NetworkType,HardwareId3,HardwareId5,HardwareId56,LicenseStatus3,LicenseStatus5,LicenseStatus56");
|
||||
}
|
||||
devOptions.append("\n");
|
||||
return devOptions.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,724 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import java.math.BigDecimal;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public GetKQDailyReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQDailyReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
boolean isDaily = kqReportFieldComInfo.getReportType().equals("daily");
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !isDaily)continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
if(kqReportFieldComInfo.getReportType1().equals("daily")){
|
||||
column.put("isdaily", "1");
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
// String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")&&!Util.null2String(rs.getOrgindbtype()).equals("jc")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
|
||||
String backFields = " b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb,(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb," +
|
||||
"(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb,(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs," +
|
||||
"(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts,(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts," +
|
||||
"(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts,(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts," +
|
||||
"(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs,(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm,(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm,(select sum(sch*60) from uf_jbsqhz where sqr = a.id and ksrq = b.kqdate and jblx in (1,2)) as jbsq," +
|
||||
"a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
|
||||
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
|
||||
" b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism ,b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
//考勤异常状态
|
||||
String KQstatus = Util.null2String(jsonObj.get("KQstatus"));
|
||||
if ("5".equals(KQstatus)){
|
||||
|
||||
}else if ("1".equals(KQstatus)){
|
||||
sqlWhere += " and absenteeismMins > 0 ";
|
||||
}else if ("2".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0) ";
|
||||
}else if ("3".equals(KQstatus)){
|
||||
sqlWhere += " and (b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0) ";
|
||||
}else if ("4".equals(KQstatus)){
|
||||
sqlWhere +=" and forgotCheck > 0";
|
||||
}else if ("6".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins = 0 and b.graveBeLateMins = 0 and b.leaveEarlyMins = 0 and b.graveLeaveEarlyMins = 0 and absenteeismMins = 0 and forgotCheck = 0)";
|
||||
}else if ("7".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0 or b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0 or absenteeismMins > 0 or forgotCheck > 0)";
|
||||
}
|
||||
|
||||
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc, b.kqdate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc, b.kqdate desc ";
|
||||
sql = backFields + sqlFrom + sqlWhere + orderBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + pageSize+ " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc, kqdate asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc, kqdate desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql+" ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
new BaseBean().writeLog("每日显示(新):" + JSON.toJSONString(sql));
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(id, kqdate);
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1")) continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))
|
||||
continue;
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String fieldValueID = rs.getString("subcompanyid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
//fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getSubCompanyID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String fieldValueID = rs.getString("departmentid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
//fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getDepartmentID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String fieldValueID = rs.getString("jobtitle");
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle"));
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getJobTitle(id);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("cardOvertime")) {
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + Math.round(Util.getDoubleValue(fieldValue) / 60.0 * 2) / 2.0));
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("xqNew")) {
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (kqReportFieldComInfo.getParentid().equals("overtime") || kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
|
||||
if (fieldName.equals("overtimeTotal")) {
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave < 0 ? 0 : restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
} else {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("serialid")) {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (fieldValue.length()>0) {//弹性工作制没有班次
|
||||
// data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(fieldValue)){
|
||||
data.put("serialid", serialdata.get(fieldValue));
|
||||
}else{
|
||||
String tmpserialname = shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage());
|
||||
serialdata.put(fieldValue,tmpserialname);
|
||||
data.put("serialid", tmpserialname);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
data.putAll(this.getSignDetailInfo(id, kqdate));
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
kqLog.info("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.put(flowType, flowLeaveData);
|
||||
}
|
||||
|
||||
data.put("resourceId", id);
|
||||
data.put("kqdate", kqdate);
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
private String getUnitType(String unitType, User user){
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
return unitTypeName;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily")?"1":"0");
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,day_type,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
String dayType = Util.null2s(rs.getString("day_type"),"");
|
||||
int workMins = rs.getInt("workMins");
|
||||
boolean isNonWork = false;
|
||||
if(dayType.length() > 0){
|
||||
if("holiday".equals(dayType) || "playday".equals(dayType)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}else{
|
||||
if(workMins<=0){
|
||||
isNonWork = true;
|
||||
}else{
|
||||
if(serialid.length() > 0){
|
||||
String isRest = Util.null2s(kqShiftManagementComInfo.getIsRest(serialid),"");
|
||||
if("1".equals(isRest)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(!isNonWork){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,775 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportDailyExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")),",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.add("kqdate");
|
||||
showColumns.add("serialid");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("signin1")){
|
||||
cascadekey = "signout1";
|
||||
}else if(showColumn.equals("signin2")){
|
||||
cascadekey = "signout2";
|
||||
}else if(showColumn.equals("signin3")){
|
||||
cascadekey = "signout3";
|
||||
}else if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
toDate = today;
|
||||
}
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String,Object>> constraintList = null;
|
||||
Map<String,Object> constraint = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName( 390352, user.getLanguage()));
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
if("kqdate".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width",30*256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan",childColumns.size());
|
||||
}else{
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "2");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
String backFields = " (select jjrbtjia*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrbtjb,(select jjrdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrdksc,(select xxb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as xxb,(select zrbtjbzdx*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjbztx,(select gzsc from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as gzsc,(select psjbshic*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as psjbsc,b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb," +
|
||||
"(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb,(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb," +
|
||||
"(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs,(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts," +
|
||||
"(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts,(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts," +
|
||||
"(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts,(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"(select sum(sch) from uf_jbsqhz where sqr = a.id and ksrq = b.kqdate and jblx in (0,1,2,3)) as jbsq,a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins,b.beLate," +
|
||||
" b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins,b.graveLeaveEarly," +
|
||||
" b.graveLeaveEarlyMins,b.absenteeism,b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
//考勤异常状态
|
||||
String KQstatus = Util.null2String(jsonObj.get("KQstatus"));
|
||||
if ("5".equals(KQstatus)){
|
||||
|
||||
}else if ("1".equals(KQstatus)){
|
||||
sqlWhere += " and (absenteeismMins > 0 or forgotCheck > 0) ";
|
||||
}else if ("2".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0) ";
|
||||
}else if ("3".equals(KQstatus)){
|
||||
sqlWhere += " and (b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0) ";
|
||||
}else if ("4".equals(KQstatus)){
|
||||
sqlWhere +=" and forgotCheck > 0";
|
||||
}else if ("6".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins = 0 and b.graveBeLateMins = 0 and b.leaveEarlyMins = 0 and b.graveLeaveEarlyMins = 0 and absenteeismMins = 0 and forgotCheck = 0)";
|
||||
}else if ("7".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0 or b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0 or absenteeismMins > 0 or forgotCheck > 0)";
|
||||
}
|
||||
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc , b.kqDate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select "+backFields + sqlFrom + sqlWhere+orderBy;
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
String tmpkey = id+"|"+kqdate+"|";
|
||||
// Map<String,Object> signDetailInfo = this.getSignDetailInfo(id,kqdate);
|
||||
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if(fieldName.equals("cardOvertime")){
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
Double zlMinsNew = Util.getDoubleValue(fieldValue);
|
||||
String skjbcsy = divide(String.valueOf(changeBxs(zlMinsNew.intValue())),"60");
|
||||
fieldValue = skjbcsy;
|
||||
} else if(fieldName.equals("xqNew")){
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
} else if(fieldName.equals("serialid")){
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
if(serialid.length()>0){
|
||||
// fieldValue = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(serialid)){
|
||||
fieldValue = serialdata.get(serialid);
|
||||
}else{
|
||||
String tmpserialname = Util.formatMultiLang(shiftManagementToolKit.getShiftOnOffWorkSections(serialid, user.getLanguage()));
|
||||
fieldValue = tmpserialname;
|
||||
serialdata.put(serialid,tmpserialname);
|
||||
}
|
||||
}
|
||||
} else if(fieldName.equals("signin1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signin3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signintime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signinstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout1")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime1"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus1"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout2")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime2"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus2"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("signout3")){
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signouttime3"));
|
||||
data.add(fieldValue);
|
||||
fieldValue = Util.null2String(flowData.get(tmpkey+"signoutstatus3"));
|
||||
data.add(fieldValue);
|
||||
continue;
|
||||
} else if(fieldName.equals("leave")){
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
fieldValue = Util.null2String(flowData.get(id+"|"+kqdate+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(fieldValue);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
writeLog("ExportDailyExcelCmd:fieldValue" + fieldValue + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(fieldValue, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
fieldValue = flowLeaveData;
|
||||
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id +"|"+kqdate+ "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|"+kqdate+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+kqdate+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else if(fieldName.equals("kqdate")){
|
||||
fieldValue=kqdate+" "+com.engine.portal.util.DateUtil.getDayWeekOfDate1(DateUtil.parseToDate(kqdate));
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
|
||||
if(!fieldName.equals("leave") && !fieldName.equals("kqdate")) {
|
||||
fieldValue = Util.formatMultiLang(fieldValue, "" + user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList",constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390352, user.getLanguage())+" "+fromDate+" "+toDate;;
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String,Object> title = null;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
title = new HashMap<>();
|
||||
title.put("title",name+"("+
|
||||
((KQUnitBiz.isLeaveHour(unitType))?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()))+")");
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title",SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+
|
||||
(KQReportBiz.getUnitType(kqReportFieldComInfo, user).length()>0?"("+ KQReportBiz.getUnitType(kqReportFieldComInfo, user)+")":""));
|
||||
title.put("width",30*256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
int workMins = rs.getInt("workMins");
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(serialid.length()>0){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}else {
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 半小时转换
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static Integer changeBxs(Integer value){
|
||||
return (value / 30)*30 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的除法运算。
|
||||
* @param v1 被加数
|
||||
* @param v2 加数
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static String divide(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.divide(b2,2,BigDecimal.ROUND_HALF_UP).toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,273 @@
|
|||
package com.api.browser.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.browser.bean.BrowserBean;
|
||||
import com.api.browser.service.Browser;
|
||||
import com.api.browser.util.BrowserConfigComInfo;
|
||||
import com.api.browser.util.BrowserConstant;
|
||||
import com.api.browser.util.BrowserInitUtil;
|
||||
import com.api.browser.util.DeviceTypeAttr;
|
||||
import com.engine.systeminfo.util.BrowserConfigManager;
|
||||
import com.engine.workflow.biz.wfPathAdvanceSet.BrowserDataDefinitionBiz;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.filter.XssUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 浏览框接口
|
||||
* @author jhy Mar 29, 2017
|
||||
*
|
||||
*/
|
||||
@Path("/public/browser")
|
||||
public class BrowserAction {
|
||||
|
||||
/**
|
||||
* 设置浏览框的默认配置
|
||||
* @param browser
|
||||
* @param params
|
||||
*/
|
||||
public void setBrowserStatus(Browser browser,Map<String, Object> params)
|
||||
{
|
||||
String deviceType=Util.null2String(params.get("_ec_device"));
|
||||
String isMobile=Util.null2String(params.get("_ec_ismobile"));
|
||||
browser.setDeviceType(DeviceTypeAttr.PC);
|
||||
//pc mobile_ec mobile_dingding
|
||||
if (StringUtils.isNotBlank(deviceType))
|
||||
{
|
||||
DeviceTypeAttr dt=DeviceTypeAttr.valueOf(deviceType.toUpperCase());
|
||||
browser.setDeviceType(dt);
|
||||
}
|
||||
|
||||
browser.setMobile("true".equals(isMobile));
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/data/{type}")
|
||||
@Produces("text/plain;charset=utf-8")
|
||||
public String getBrowserData2(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
return getBrowserData(type,request,response);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/data/{type}")
|
||||
@Produces("text/plain;charset=utf-8")
|
||||
public String getBrowserData(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
BrowserConfigComInfo browserConfigComInfo = new BrowserConfigComInfo();
|
||||
Map<String, Object> params = getRequestParams(request,response);
|
||||
String browserClassName = browserConfigComInfo.getClazz(type);
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
try {
|
||||
Browser browser = (Browser) Class.forName(browserClassName).newInstance();
|
||||
browser.setBrowserType(type);
|
||||
setBrowserStatus(browser,params);
|
||||
|
||||
//获取测试预览设置的用户
|
||||
if (params.get("operatoruser_" + params.get("currenttime")) != null) {
|
||||
browser.setUser(this.getPreviewUser(request));
|
||||
} else {
|
||||
browser.setUser(this.getUserByRequest(request, response));
|
||||
}
|
||||
|
||||
String sqlWhere = Util.null2String(browser.spellSqlWhere(params));
|
||||
String _tempSqlWhere = Util.null2String(params.get(BrowserConstant.SPELL_SQL_WHERE));
|
||||
if(!"".equals(sqlWhere) || !_tempSqlWhere.equals(sqlWhere)){
|
||||
params.put(BrowserConstant.SPELL_SQL_WHERE, _tempSqlWhere + " " + sqlWhere);
|
||||
}
|
||||
|
||||
//建模快捷搜索 处理 con_传参 的问题 用于浏览数据定义
|
||||
String isFromMode = Util.null2o(Util.null2String(params.get("isFromMode")));
|
||||
if("1".equals(isFromMode)){
|
||||
Map<String, Object> params2=params.entrySet().stream()
|
||||
.collect(Collectors.toMap(
|
||||
entry->entry.getKey().replaceAll("con_","field"),
|
||||
Map.Entry::getValue));
|
||||
|
||||
params.putAll(params2);
|
||||
}
|
||||
|
||||
|
||||
apidatas.putAll(browser.getBrowserData(params));
|
||||
/*String countData=BrowserConfigManager.getValue("pageSize","browser");
|
||||
if(StringUtils.isNotBlank(countData))
|
||||
apidatas.put("pageSize",countData);*/
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
apidatas.put("status", false);
|
||||
apidatas.put("error", e.getMessage());
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/destData/{type}")
|
||||
public String getDestData(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> params = getRequestParams(request,response);
|
||||
String browserClassName = new BrowserConfigComInfo().getClazz(type);
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
try {
|
||||
Browser browser = (Browser) Class.forName(browserClassName).newInstance();
|
||||
setBrowserStatus(browser,params);
|
||||
browser.setBrowserType(type);
|
||||
browser.setUser(this.getUserByRequest(request, response));
|
||||
apidatas = browser.getMultBrowserDestData(params);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/destData/{type}")
|
||||
public String getDestData2(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> params = getRequestParams(request,response);
|
||||
String browserClassName = new BrowserConfigComInfo().getClazz(type);
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
try {
|
||||
Browser browser = (Browser) Class.forName(browserClassName).newInstance();
|
||||
setBrowserStatus(browser,params);
|
||||
browser.setBrowserType(type);
|
||||
browser.setUser(this.getUserByRequest(request, response));
|
||||
apidatas = browser.getMultBrowserDestData(params);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/complete/{type}")
|
||||
public String browserAutoComplete2(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
return browserAutoComplete(type,request,response);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/complete/{type}")
|
||||
public String browserAutoComplete(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
String browserClassName = new BrowserConfigComInfo().getClazz(type);
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
Map<String, Object> params = getRequestParams(request,response);
|
||||
try {
|
||||
User user = null;
|
||||
//获取测试预览设置的用户
|
||||
if (params.get("operatoruser_" + params.get("currenttime")) != null) {
|
||||
user = this.getPreviewUser(request);
|
||||
} else {
|
||||
user = this.getUserByRequest(request, response);
|
||||
}
|
||||
Browser browser = (Browser) Class.forName(browserClassName).newInstance();
|
||||
browser.setBrowserType(type);
|
||||
setBrowserStatus(browser,params);
|
||||
browser.setUser(user);
|
||||
String sqlWhere = Util.null2String(browser.spellSqlWhere(getRequestParams(request,response)));
|
||||
//XssUtil xssUtil=new XssUtil();
|
||||
|
||||
//对 sqlwhere 做解密处理
|
||||
//String sqlwhereParam=Util.null2String(params.get("sqlwhere"));
|
||||
//sqlwhereParam=xssUtil.get(sqlwhereParam);
|
||||
//params.put("sqlwhere",sqlwhereParam);
|
||||
|
||||
String _tempSqlWhere = Util.null2String(request.getParameter(BrowserConstant.SPELL_SQL_WHERE));
|
||||
|
||||
if(!"".equals(sqlWhere) || !_tempSqlWhere.equals(sqlWhere)){
|
||||
request.setAttribute(BrowserConstant.SPELL_SQL_WHERE, _tempSqlWhere + " " + sqlWhere);
|
||||
}
|
||||
BrowserDataDefinitionBiz.getDataDefinitionParams(params,type,user);
|
||||
browser.setAutoCompleteDataDefinitionParams(params);
|
||||
apidatas = browser.browserAutoComplete(request,response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return Util.fromScreen4(JSONObject.toJSONString(apidatas),7);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/condition/{type}")
|
||||
public String getBrowserConditionInfo(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
Map<String, Object> params = getRequestParams(request,response);
|
||||
String browserClassName = new BrowserConfigComInfo().getClazz(type);
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
try {
|
||||
User user = null;
|
||||
//获取测试预览设置的用户
|
||||
if (params.get("operatoruser_" + params.get("currenttime")) != null) {
|
||||
user = this.getPreviewUser(request);
|
||||
} else {
|
||||
user = this.getUserByRequest(request, response);
|
||||
}
|
||||
Browser browser = (Browser) Class.forName(browserClassName).newInstance();
|
||||
browser.setBrowserType(type);
|
||||
browser.setUser(user);
|
||||
setBrowserStatus(browser,params);
|
||||
|
||||
apidatas = browser.getBrowserConditionInfo(params);
|
||||
BrowserDataDefinitionBiz.markBrowserConditionDefinition(apidatas,params,type,user);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
|
||||
private Map<String,Object> getRequestParams(HttpServletRequest request,HttpServletResponse response){
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Enumeration<String> em = request.getParameterNames();
|
||||
while(em.hasMoreElements()){
|
||||
String paramname = em.nextElement();
|
||||
params.put(paramname, request.getParameter(paramname));
|
||||
}
|
||||
return params;
|
||||
}
|
||||
@GET
|
||||
@Path("/prop/{type}")
|
||||
public String getBrowserProps(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
User user = HrmUserVarify.getUser(request, response);// 需要增加的代码
|
||||
BrowserInitUtil browserInitUtil = new BrowserInitUtil();
|
||||
BrowserBean browserProp = new BrowserBean(type);
|
||||
browserInitUtil.initBrowser(browserProp,user.getLanguage());
|
||||
return JSONObject.toJSONString(browserProp);
|
||||
}
|
||||
|
||||
private User getUserByRequest(HttpServletRequest request, HttpServletResponse response){
|
||||
String f_weaver_belongto_userid = Util.null2String(request.getParameter("f_weaver_belongto_userid"));
|
||||
String f_weaver_belongto_usertype = Util.null2String(request.getParameter("f_weaver_belongto_usertype"));
|
||||
User user = HrmUserVarify.getUser(request, response, f_weaver_belongto_userid, f_weaver_belongto_usertype);
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取测试预览操作用户
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private User getPreviewUser(HttpServletRequest request){
|
||||
String f_weaver_belongto_userid = Util.null2String(request.getParameter("f_weaver_belongto_userid"));
|
||||
String f_weaver_belongto_usertype = Util.null2String(request.getParameter("f_weaver_belongto_usertype"));
|
||||
User user = User.getUser(Integer.parseInt(f_weaver_belongto_userid),Integer.parseInt(f_weaver_belongto_usertype));
|
||||
return user;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,786 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean;
|
||||
import com.engine.kq.entity.KQOvertimeRulesDetailEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.wfset.bean.OvertimeBalanceTimeBean;
|
||||
import com.engine.kq.wfset.bean.SplitBean;
|
||||
import com.engine.kq.wfset.util.KQFlowUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import weaver.common.StringUtil;
|
||||
import weaver.general.Util;
|
||||
|
||||
/**
|
||||
* 加班流程 非工作时长计算 重新搞一把
|
||||
* 现在是根据归属来拆分流程
|
||||
*/
|
||||
public class KQOverTimeFlowBiz {
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
/**
|
||||
* 之前的加班拆分是根据每一天进行拆分的,但是我们是有个默认归属的,就是上班前是属于前一天的,再加上这次标准改造,加了临界点,
|
||||
* 加班的拆分改造一下,改成和请假拆分一样,根据归属区间来拆分
|
||||
* 未设置加班归属的逻辑是
|
||||
* 工作日A-工作日B ,从工作日A的上班时间往后加24小时,都算工作日A的加班区间
|
||||
* 工作日A-非工作日,从工作日A的上班时间往后加24小时,都算工作日A的加班区间
|
||||
* 非工作日-工作日A,从非工作日的0点到工作日A的上班前,都属于非工作日的区间
|
||||
*
|
||||
* 计算加班逻辑很特殊,
|
||||
* 需要知道昨日,今日和明日的类型,是工作日还是非工作日
|
||||
* @param splitBean
|
||||
* @param splitBeans
|
||||
*/
|
||||
public void getSplitDurationBean_new(SplitBean splitBean,List<SplitBean> splitBeans) {
|
||||
try{
|
||||
long a = System.currentTimeMillis();
|
||||
|
||||
double oneDayHour = KQFlowUtil.getOneDayHour(splitBean.getDurationTypeEnum(),"");
|
||||
int workmins = (int)(oneDayHour * 60);
|
||||
String resourceid = splitBean.getResourceId();
|
||||
String fromDate = splitBean.getFromdatedb();
|
||||
String toDate = splitBean.getTodatedb();
|
||||
|
||||
LocalDate localFromDate = LocalDate.parse(fromDate);
|
||||
LocalDate localToDate = LocalDate.parse(toDate);
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate preFromDate = localFromDate.minusDays(1);
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String overtimePoint = Util.null2String(kqSettingsComInfo.getMain_val("overtime_point"),"0");
|
||||
KQOverTimeRuleCalBiz kqOverTimeRuleCalBiz = new KQOverTimeRuleCalBiz();
|
||||
Map<String,Integer> changeTypeMap = Maps.newHashMap();
|
||||
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap = Maps.newHashMap();
|
||||
Map<String,List<String[]>> restTimeMap = Maps.newHashMap();
|
||||
Map<String,Integer> computingModeMap = Maps.newHashMap();
|
||||
long b1 = System.currentTimeMillis();
|
||||
kqOverTimeRuleCalBiz.getOverTimeDataMap(resourceid, fromDate, toDate, dateFormatter,changeTypeMap,overRulesDetailMap,restTimeMap,computingModeMap);
|
||||
|
||||
long b2 = System.currentTimeMillis();
|
||||
kqLog.info(":getOverTimeDataMap_count b2-b1:"+(b2-b1));
|
||||
if(overRulesDetailMap.isEmpty()){
|
||||
return;
|
||||
}
|
||||
boolean is_flow_humanized = KQSettingsBiz.is_flow_humanized();
|
||||
String fromTime = splitBean.getFromtimedb();
|
||||
String toTime = splitBean.getTotimedb();
|
||||
long betweenDays = localToDate.toEpochDay() - preFromDate.toEpochDay();
|
||||
long b3 = System.currentTimeMillis();
|
||||
kqLog.info(":getOverTimeDataMap_count b3-b1:"+(b3-b1));
|
||||
//默认是从加班开始日期的前一天开始计算 需要特殊处理的就三个情况,i=0的时候,i=1的时候就是加班流程开始日期那一天,i=最后一天就是加班流程结束日期那一天
|
||||
for (int i = 0; i <= betweenDays; i++) {
|
||||
long c0 = System.currentTimeMillis();
|
||||
SplitBean overSplitBean = new SplitBean();
|
||||
//然后把bean重新赋值下,根据拆分后的时间
|
||||
BeanUtils.copyProperties(splitBean, overSplitBean);
|
||||
|
||||
//从加班流程开始的前一天开始算归属
|
||||
LocalDate curLocalDate = preFromDate.plusDays(i);
|
||||
String splitDate = curLocalDate.format(dateFormatter);
|
||||
String preSplitDate = LocalDate.parse(splitDate).minusDays(1).format(dateFormatter);
|
||||
LocalDate nextLocalDate = curLocalDate.plusDays(1);
|
||||
String nextSplitDate = nextLocalDate.format(dateFormatter);
|
||||
String change_key = splitDate+"_"+resourceid;
|
||||
String pre_change_key = preSplitDate+"_"+resourceid;
|
||||
String next_change_key = nextSplitDate+"_"+resourceid;
|
||||
int changeType = Util.getIntValue(""+changeTypeMap.get(change_key),-1);
|
||||
int preChangeType = Util.getIntValue(""+changeTypeMap.get(pre_change_key),-1);
|
||||
int next_changeType = Util.getIntValue(""+changeTypeMap.get(next_change_key),-1);
|
||||
|
||||
boolean shouldAcross = false;
|
||||
String changeType_key = splitDate+"_"+changeType;
|
||||
String preChangeType_key = preSplitDate+"_"+preChangeType;
|
||||
String nextChangeType_key = nextSplitDate+"_"+next_changeType;
|
||||
if(!computingModeMap.containsKey(changeType_key)){
|
||||
continue;
|
||||
}
|
||||
int computingMode = computingModeMap.get(changeType_key);
|
||||
if(computingMode == 3){
|
||||
//如果是纯打卡为主的不生成加班
|
||||
continue;
|
||||
}
|
||||
|
||||
int[] initArrays = kqTimesArrayComInfo.getInitArr();
|
||||
//当前日期的加班分割点 分割点都是次日的
|
||||
String overtime_cut_point = "";
|
||||
int before_startTime = 0;
|
||||
int startTime = 0;
|
||||
int curMins = 0 ;
|
||||
//排除休息类型
|
||||
int restTimeType = -1;
|
||||
long c0_1 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c0_1-c0:"+(c0_1-c0));
|
||||
//需要知道明日的类型:如果今天是工作日的话,那么今天的加班临界点可能和明日的上班时间冲突,需要知道明日的上班时间进行比较,
|
||||
String next_beginwork_time = getNextBeginworkTime(resourceid,nextSplitDate,next_changeType,splitBean,is_flow_humanized,kqTimesArrayComInfo);
|
||||
// 如果今天是休息日,那么明天如果是工作日的话,默认规则下,明天的上班前都是属于今天的加班区间
|
||||
String cur_beginwork_time = getCurBeginworkTime(resourceid,splitDate,changeType,splitBean,is_flow_humanized,kqTimesArrayComInfo);
|
||||
String serialid = "";
|
||||
long c1 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c1-c0:"+(c1-c0));
|
||||
List<OvertimeBalanceTimeBean> overtimeBalanceTimeBeans = Lists.newArrayList();
|
||||
KQOvertimeRulesDetailEntity curKqOvertimeRulesDetailEntity = overRulesDetailMap.get(changeType_key);
|
||||
if(curKqOvertimeRulesDetailEntity != null){
|
||||
int has_cut_point = curKqOvertimeRulesDetailEntity.getHas_cut_point();
|
||||
before_startTime = curKqOvertimeRulesDetailEntity.getBefore_startTime();
|
||||
int overtimeEnable = curKqOvertimeRulesDetailEntity.getOvertimeEnable();
|
||||
if(overtimeEnable != 1){
|
||||
continue;
|
||||
}
|
||||
if(has_cut_point != 1){
|
||||
before_startTime = -1;
|
||||
}
|
||||
startTime = curKqOvertimeRulesDetailEntity.getStartTime();
|
||||
restTimeType = curKqOvertimeRulesDetailEntity.getRestTimeType();
|
||||
if(has_cut_point == 0){
|
||||
if(changeType == 2){
|
||||
overtime_cut_point = cur_beginwork_time;
|
||||
if(next_beginwork_time.length() > 0){
|
||||
if(next_beginwork_time.compareTo(cur_beginwork_time) < 0){
|
||||
overtime_cut_point = next_beginwork_time;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if(next_beginwork_time.length() > 0){
|
||||
overtime_cut_point = next_beginwork_time;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
overtime_cut_point = curKqOvertimeRulesDetailEntity.getCut_point();
|
||||
if(next_beginwork_time.length() > 0){
|
||||
int next_beginwork_time_index = kqTimesArrayComInfo.getArrayindexByTimes(next_beginwork_time);
|
||||
int overtime_cut_point_index = kqTimesArrayComInfo.getArrayindexByTimes(overtime_cut_point);
|
||||
if(overtime_cut_point_index > next_beginwork_time_index){
|
||||
overtime_cut_point = next_beginwork_time;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(overtime_cut_point.length() == 0){
|
||||
overtime_cut_point = "00:00";
|
||||
}
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
int fromTime_index = 0;
|
||||
int toTime_index = 0;
|
||||
long c1_0 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c1_0-c0:"+(c1_0-c0));
|
||||
if(i == 0){
|
||||
//i=0就是加班开始日期的前一天,只有当加班临界点超过了加班流程开始时间的话,i=0才会有可能计算出时长
|
||||
if(overtime_cut_point.compareTo(fromTime) > 0){
|
||||
fromTime_index = kqTimesArrayComInfo.getArrayindexByTimes(kqTimesArrayComInfo.turn24to48Time(fromTime));
|
||||
toTime_index = kqTimesArrayComInfo.getArrayindexByTimes(kqTimesArrayComInfo.turn24to48Time(overtime_cut_point));
|
||||
if(fromDate.equalsIgnoreCase(toDate)){
|
||||
//如果开始日期和结束日期是同一天,还需要比较流程的结束时间和归属点的大小
|
||||
int oriTotime_index = kqTimesArrayComInfo.getArrayindexByTimes(kqTimesArrayComInfo.turn24to48Time(toTime));
|
||||
if(toTime_index > oriTotime_index){
|
||||
toTime_index = oriTotime_index;
|
||||
}
|
||||
}
|
||||
long c1_1 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c1_1-c0:"+(c1_1-c0));
|
||||
Arrays.fill(initArrays, fromTime_index, toTime_index, 0);
|
||||
//处理下昨日的工作日,可能跨天到今日的情况
|
||||
if(preChangeType == 2){
|
||||
boolean isok = handlePrechangeType2(initArrays, resourceid, preSplitDate, preChangeType_key,overRulesDetailMap,kqTimesArrayComInfo,splitBean,is_flow_humanized);
|
||||
}
|
||||
long c1_2 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c1_2-c0:"+(c1_2-c0));
|
||||
// 1-节假日、2-工作日、3-休息日
|
||||
if(changeType == 1){
|
||||
handle_changeType_1(initArrays,overRulesDetailMap,nextChangeType_key,next_changeType,next_beginwork_time);
|
||||
}else if(changeType == 2){
|
||||
boolean isok = handle_changeType_2(initArrays, resourceid, splitDate, before_startTime, startTime, fromTime_index,kqTimesArrayComInfo,splitBean,
|
||||
toTime_index,is_flow_humanized,curKqOvertimeRulesDetailEntity);
|
||||
serialid = splitBean.getSerialid();
|
||||
if(!isok){
|
||||
continue;
|
||||
}
|
||||
}else if(changeType == 3){
|
||||
handle_changeType_3(initArrays,overRulesDetailMap,nextChangeType_key,next_changeType,next_beginwork_time);
|
||||
}
|
||||
long c1_3 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c1_3-c0:"+(c1_3-c0));
|
||||
if(restTimeType == 1){
|
||||
//如果排除设置的休息时间
|
||||
handle_resttime(restTimeMap,changeType_key,kqTimesArrayComInfo,shouldAcross,initArrays);
|
||||
}
|
||||
long c1_5 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c1_5-c0:"+(c1_5-c0));
|
||||
curMins = kqTimesArrayComInfo.getCnt(initArrays, fromTime_index,toTime_index,0);
|
||||
if(restTimeType == 2){
|
||||
//如果排除休息时间是扣除时长
|
||||
curMins = handle_restlength(curMins,restTimeMap,changeType_key);
|
||||
}
|
||||
long c1_6 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c1_6c0:"+(c1_6-c0));
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else{
|
||||
//除了i=0的情况,其他的每一天都是要获取一下昨日的临界点的
|
||||
String pre_overtime_cut_point = get_pre_overtime_cut_point(overRulesDetailMap,preChangeType_key,resourceid,preSplitDate,splitDate,preChangeType,kqTimesArrayComInfo,splitBean,changeType,is_flow_humanized);
|
||||
//计算区间加班开始日期和加班结束日期这两天都是要特殊处理的
|
||||
fromTime_index = kqTimesArrayComInfo.getArrayindexByTimes(pre_overtime_cut_point);
|
||||
if(i == 1){
|
||||
if(fromTime.compareTo(pre_overtime_cut_point) > 0){
|
||||
fromTime_index = kqTimesArrayComInfo.getArrayindexByTimes(fromTime);
|
||||
}
|
||||
}
|
||||
if(i == betweenDays){
|
||||
toTime_index = kqTimesArrayComInfo.getArrayindexByTimes(toTime);
|
||||
}else{
|
||||
toTime_index = kqTimesArrayComInfo.turn24to48TimeIndex(kqTimesArrayComInfo.getArrayindexByTimes(overtime_cut_point));
|
||||
if(next_beginwork_time.length() > 0){
|
||||
int overtime_cut_point_index = kqTimesArrayComInfo.getArrayindexByTimes(overtime_cut_point);
|
||||
int next_beginwork_time_index = kqTimesArrayComInfo.getArrayindexByTimes(next_beginwork_time);
|
||||
//如果临界点都已经超过第二天上班的开始时间了,要相应的缩短成第二天上班时间
|
||||
if(overtime_cut_point_index > next_beginwork_time_index){
|
||||
toTime_index = kqTimesArrayComInfo.turn24to48TimeIndex(next_beginwork_time_index);
|
||||
}
|
||||
}
|
||||
if(i == betweenDays-1){
|
||||
int ori_totime_index = kqTimesArrayComInfo.turn48to24TimeIndex(toTime_index);
|
||||
int last_toTime_index = kqTimesArrayComInfo.getArrayindexByTimes(toTime);
|
||||
if(ori_totime_index > last_toTime_index){
|
||||
toTime_index = kqTimesArrayComInfo.turn24to48TimeIndex(last_toTime_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
long c1_1 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c1_1-c0:"+(c1_1-c0));
|
||||
|
||||
if(fromTime_index > toTime_index){
|
||||
continue;
|
||||
}
|
||||
Arrays.fill(initArrays, fromTime_index, toTime_index, 0);
|
||||
|
||||
long c2 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c2-c0:"+(c2-c0));
|
||||
//处理下昨日的工作日,可能跨天到今日的情况
|
||||
if(preChangeType == 2){
|
||||
boolean isok = handlePrechangeType2(initArrays, resourceid, preSplitDate, preChangeType_key,overRulesDetailMap,kqTimesArrayComInfo,splitBean,is_flow_humanized);
|
||||
}
|
||||
long c2_1 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c2_1-c0:"+(c2_1-c0));
|
||||
if(changeType == 1){
|
||||
handle_changeType_1(initArrays, overRulesDetailMap, nextChangeType_key, next_changeType,
|
||||
next_beginwork_time);
|
||||
}else if(changeType == 2){
|
||||
serialid = splitBean.getSerialid();
|
||||
boolean isok = handle_changeType_2(initArrays, resourceid, splitDate, before_startTime, startTime, fromTime_index,
|
||||
kqTimesArrayComInfo, splitBean, toTime_index,is_flow_humanized,
|
||||
curKqOvertimeRulesDetailEntity);
|
||||
if(!isok){
|
||||
continue;
|
||||
}
|
||||
}else if(changeType == 3){
|
||||
handle_changeType_3(initArrays, overRulesDetailMap, nextChangeType_key, next_changeType,
|
||||
overtime_cut_point);
|
||||
}
|
||||
long c2_2 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c2_2-c0:"+(c2_2-c0));
|
||||
if(restTimeType == 1) {
|
||||
//如果排除设置的休息时间
|
||||
handle_resttime(restTimeMap, changeType_key, kqTimesArrayComInfo, shouldAcross,initArrays);
|
||||
}
|
||||
long c2_3 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c2_3-c0:"+(c2_3-c0));
|
||||
curMins = kqTimesArrayComInfo.getCnt(initArrays, fromTime_index,toTime_index,0);
|
||||
|
||||
long c2_4 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c2_4-c0:"+(c2_4-c0));
|
||||
if(restTimeType == 2){
|
||||
//如果排除休息时间是扣除时长
|
||||
curMins = handle_restlength(curMins,restTimeMap,changeType_key);
|
||||
}
|
||||
long c2_5 = System.currentTimeMillis();
|
||||
kqLog.info(i+":getOverTimeDataMap_count:betweenDays c2_5-c0:"+(c2_5-c0));
|
||||
}
|
||||
int minimumUnit = curKqOvertimeRulesDetailEntity.getMinimumLen();
|
||||
if(curMins < minimumUnit){
|
||||
continue;
|
||||
}
|
||||
|
||||
long c3 = System.currentTimeMillis();
|
||||
kqLog.info(":getOverTimeDataMap_count:betweenDays c3-c0:"+(c3-c0));
|
||||
curMins = (int) kqOverTimeRuleCalBiz.getD_MinsByUnit(curMins);
|
||||
overSplitBean.setChangeType(changeType);
|
||||
overSplitBean.setPreChangeType(preChangeType);
|
||||
overSplitBean.setOneDayHour(oneDayHour);
|
||||
overSplitBean.setWorkmins(workmins);
|
||||
overSplitBean.setComputingMode(computingMode+"");
|
||||
overSplitBean.setChangeType(changeType);
|
||||
overSplitBean.setFromDate(splitDate);
|
||||
overSplitBean.setFromTime(kqTimesArrayComInfo.getTimesByArrayindex(fromTime_index));
|
||||
overSplitBean.setToDate(splitDate);
|
||||
overSplitBean.setToTime(kqTimesArrayComInfo.getTimesByArrayindex(toTime_index));
|
||||
overSplitBean.setBelongDate(splitDate);
|
||||
overSplitBean.setD_Mins(curMins);
|
||||
overSplitBean.setOvertimeBalanceTimeBeans(overtimeBalanceTimeBeans);
|
||||
overSplitBean.setSerialid(serialid);
|
||||
getDurationByRule(overSplitBean);
|
||||
splitBeans.add(overSplitBean);
|
||||
long c4 = System.currentTimeMillis();
|
||||
kqLog.info(":getOverTimeDataMap_count:betweenDays c4-c0:"+(c4-c0));
|
||||
}
|
||||
|
||||
long b = System.currentTimeMillis();
|
||||
kqLog.info(":getOverTimeDataMap_count_all b-a:"+(b-a));
|
||||
|
||||
}catch (Exception e){
|
||||
StringWriter errorsWriter = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(errorsWriter));
|
||||
kqLog.info(errorsWriter.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handlePrechangeType2(int[] initArrays, String resourceid, String preSplitDate, String preChangeTypeKey, Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap,
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo, SplitBean splitBean, boolean is_flow_humanized) {
|
||||
KQOvertimeRulesDetailEntity preOverRulesDetail = overRulesDetailMap.get(preChangeTypeKey);
|
||||
int startTime = 0;
|
||||
if(preOverRulesDetail != null){
|
||||
startTime = preOverRulesDetail.getStartTime();
|
||||
}
|
||||
ShiftInfoBean pre_shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(resourceid, preSplitDate, false);
|
||||
if(pre_shiftInfoBean != null){
|
||||
int restShift = pre_shiftInfoBean.getRestShift();
|
||||
if(1 != restShift){
|
||||
List<int[]> workLongTimeIndex = pre_shiftInfoBean.getWorkLongTimeIndex();
|
||||
List<int[]> real_workLongTimeIndex = Lists.newArrayList();
|
||||
get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,pre_shiftInfoBean,kqTimesArrayComInfo,splitBean,is_flow_humanized);
|
||||
|
||||
if(real_workLongTimeIndex != null && !real_workLongTimeIndex.isEmpty()){
|
||||
int all_firstworktime = -1;
|
||||
int all_lastworktime = -1;
|
||||
boolean need_middle_time = false;
|
||||
//午休加班
|
||||
int isovertimecal = preOverRulesDetail.getIsOvertimeCal();
|
||||
if(isovertimecal==1){
|
||||
need_middle_time = true;
|
||||
}//----午休加班
|
||||
for(int k = 0 ; k < real_workLongTimeIndex.size() ; k++){
|
||||
int workLongTimeStartIndex = real_workLongTimeIndex.get(k)[0];
|
||||
int workLongTimeEndIndex = real_workLongTimeIndex.get(k)[1];
|
||||
workLongTimeStartIndex = workLongTimeStartIndex - 1440;
|
||||
workLongTimeEndIndex = workLongTimeEndIndex - 1440;
|
||||
if(workLongTimeStartIndex < 0){
|
||||
workLongTimeStartIndex = 0;
|
||||
}
|
||||
if(workLongTimeEndIndex < 0){
|
||||
workLongTimeEndIndex = 0;
|
||||
}
|
||||
if(workLongTimeStartIndex >= workLongTimeEndIndex){
|
||||
continue;
|
||||
}
|
||||
if(all_firstworktime > -1){
|
||||
//最早开始时间已经赋值了就不处理了
|
||||
}else{
|
||||
all_firstworktime = workLongTimeStartIndex;
|
||||
}
|
||||
if(k == real_workLongTimeIndex.size()-1){
|
||||
if(startTime > -1){
|
||||
int after_workLongTimeEndIndex = workLongTimeEndIndex+startTime;
|
||||
if(workLongTimeEndIndex < after_workLongTimeEndIndex){
|
||||
Arrays.fill(initArrays, workLongTimeEndIndex,after_workLongTimeEndIndex,-1);
|
||||
}
|
||||
}
|
||||
all_lastworktime = workLongTimeEndIndex;
|
||||
}
|
||||
if(!need_middle_time){
|
||||
//目前标准加班,一天多次打卡的话是不算中间时间的,只算上班前和下班后的加班
|
||||
}else{
|
||||
//这个里面是可以算一天多次打卡的话是中间时间的
|
||||
Arrays.fill(initArrays, workLongTimeStartIndex,workLongTimeEndIndex,1);
|
||||
}
|
||||
}
|
||||
if(!need_middle_time){
|
||||
if(all_lastworktime > all_firstworktime){
|
||||
Arrays.fill(initArrays, all_firstworktime,all_lastworktime,1);
|
||||
}
|
||||
}
|
||||
List<int[]> restLongTimeIndex = pre_shiftInfoBean.getRestLongTimeIndex();
|
||||
if(restLongTimeIndex != null && !restLongTimeIndex.isEmpty()){
|
||||
for (int k = 0; k < restLongTimeIndex.size(); k++) {
|
||||
int restLongTimeStartIndex = restLongTimeIndex.get(k)[0];
|
||||
int restLongTimeEndIndex = restLongTimeIndex.get(k)[1];
|
||||
restLongTimeStartIndex = restLongTimeStartIndex - 1440;
|
||||
restLongTimeEndIndex = restLongTimeEndIndex - 1440;
|
||||
if(restLongTimeStartIndex < 0){
|
||||
restLongTimeStartIndex = 0;
|
||||
}
|
||||
if(restLongTimeEndIndex < 0){
|
||||
restLongTimeEndIndex = 0;
|
||||
}
|
||||
if(restLongTimeStartIndex >= restLongTimeEndIndex){
|
||||
continue;
|
||||
}
|
||||
//午休加班----
|
||||
if(isovertimecal==1){
|
||||
Arrays.fill(initArrays, restLongTimeIndex.get(k)[0], restLongTimeIndex.get(k)[1], 0);
|
||||
}else{
|
||||
Arrays.fill(initArrays, restLongTimeIndex.get(k)[0], restLongTimeIndex.get(k)[1], 2);
|
||||
}//---午休加班
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getCurBeginworkTime(String resourceid, String splitDate, int changeType,
|
||||
SplitBean splitBean, boolean isFlowHumanized, KQTimesArrayComInfo kqTimesArrayComInfo) {
|
||||
String cur_beginwork_time = "";
|
||||
long dc = System.currentTimeMillis();
|
||||
ShiftInfoBean cur_shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(resourceid, splitDate, false);
|
||||
|
||||
long dc1 = System.currentTimeMillis();
|
||||
kqLog.info(":getOverTimeDataMap_count:betweenDays getCurBeginworkTime dc1-dc:"+(dc1-dc));
|
||||
if(cur_shiftInfoBean != null){
|
||||
List<int[]> workLongTimeIndex = cur_shiftInfoBean.getWorkLongTimeIndex();
|
||||
List<int[]> real_workLongTimeIndex = Lists.newArrayList();
|
||||
get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,cur_shiftInfoBean,kqTimesArrayComInfo,splitBean,isFlowHumanized);
|
||||
|
||||
if(real_workLongTimeIndex != null && !real_workLongTimeIndex.isEmpty()){
|
||||
cur_beginwork_time = kqTimesArrayComInfo.getTimesByArrayindex(real_workLongTimeIndex.get(0)[0]);
|
||||
}
|
||||
}
|
||||
long dc2 = System.currentTimeMillis();
|
||||
kqLog.info(":getOverTimeDataMap_count:betweenDays getCurBeginworkTime dc2-dc:"+(dc2-dc));
|
||||
return cur_beginwork_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取第二天的上班时间
|
||||
*/
|
||||
private String getNextBeginworkTime(String resourceid, String nextSplitDate, int nextChangeType,
|
||||
SplitBean splitBean, boolean isFlowHumanized, KQTimesArrayComInfo kqTimesArrayComInfo) {
|
||||
String next_beginwork_time = "";
|
||||
long d = System.currentTimeMillis();
|
||||
ShiftInfoBean next_shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(resourceid, nextSplitDate, false);
|
||||
long d1 = System.currentTimeMillis();
|
||||
kqLog.info(":getOverTimeDataMap_count:betweenDays getNextBeginworkTime d1-d:"+(d1-d));
|
||||
if(next_shiftInfoBean != null){
|
||||
List<int[]> workLongTimeIndex = next_shiftInfoBean.getWorkLongTimeIndex();
|
||||
List<int[]> real_workLongTimeIndex = Lists.newArrayList();
|
||||
get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,next_shiftInfoBean,kqTimesArrayComInfo,splitBean,isFlowHumanized);
|
||||
|
||||
if(real_workLongTimeIndex != null && !real_workLongTimeIndex.isEmpty()){
|
||||
next_beginwork_time = kqTimesArrayComInfo.getTimesByArrayindex(real_workLongTimeIndex.get(0)[0]);
|
||||
}
|
||||
}
|
||||
long d2 = System.currentTimeMillis();
|
||||
kqLog.info(":getOverTimeDataMap_count:betweenDays getNextBeginworkTime d2d:"+(d2-d));
|
||||
return next_beginwork_time;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 被个性化设置处理下 得到实际的上下班时间
|
||||
* @param workLongTimeIndex
|
||||
* @param real_workLongTimeIndex
|
||||
* @param shiftInfoBean
|
||||
* @param kqTimesArrayComInfo
|
||||
* @param splitBean
|
||||
*/
|
||||
public void get_real_workLongTimeIndex(List<int[]> workLongTimeIndex,
|
||||
List<int[]> real_workLongTimeIndex,
|
||||
ShiftInfoBean shiftInfoBean, KQTimesArrayComInfo kqTimesArrayComInfo,
|
||||
SplitBean splitBean) {
|
||||
boolean is_flow_humanized = KQSettingsBiz.is_flow_humanized();
|
||||
get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,shiftInfoBean,kqTimesArrayComInfo,splitBean,is_flow_humanized);
|
||||
}
|
||||
|
||||
public void get_real_workLongTimeIndex(List<int[]> workLongTimeIndex,
|
||||
List<int[]> real_workLongTimeIndex,
|
||||
ShiftInfoBean shiftInfoBean, KQTimesArrayComInfo kqTimesArrayComInfo,
|
||||
SplitBean splitBean,boolean is_flow_humanized) {
|
||||
|
||||
//list带数组,这里要深拷贝
|
||||
for(int[] tmp : workLongTimeIndex){
|
||||
int[] real_tmp = new int[tmp.length];
|
||||
System.arraycopy(tmp, 0, real_tmp, 0, tmp.length);
|
||||
real_workLongTimeIndex.add(real_tmp);
|
||||
}
|
||||
if(real_workLongTimeIndex.size() == 1){
|
||||
//个性化设置只支持一次打卡的
|
||||
KQShiftRuleInfoBiz kqShiftRuleInfoBiz = new KQShiftRuleInfoBiz();
|
||||
// boolean is_flow_humanized = KQSettingsBiz.is_flow_humanized();
|
||||
kqShiftRuleInfoBiz.rest_workLongTimeIndex(shiftInfoBean,splitBean,real_workLongTimeIndex,kqTimesArrayComInfo,null,is_flow_humanized);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一下昨日的临界点
|
||||
* @param overRulesDetailMap
|
||||
* @param preChangeType_key
|
||||
* @param resourceid
|
||||
* @param preSplitDate
|
||||
* @param splitDate
|
||||
* @param preChangeType
|
||||
* @param kqTimesArrayComInfo
|
||||
* @param splitBean
|
||||
* @param changeType
|
||||
* @return
|
||||
*/
|
||||
private String get_pre_overtime_cut_point(
|
||||
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap,
|
||||
String preChangeType_key, String resourceid, String preSplitDate, String splitDate,
|
||||
int preChangeType, KQTimesArrayComInfo kqTimesArrayComInfo,
|
||||
SplitBean splitBean, int changeType) {
|
||||
boolean is_flow_humanized = KQSettingsBiz.is_flow_humanized();
|
||||
return get_pre_overtime_cut_point(overRulesDetailMap,preChangeType_key,resourceid,preSplitDate,splitDate,preChangeType,kqTimesArrayComInfo,splitBean,changeType,is_flow_humanized);
|
||||
}
|
||||
|
||||
private String get_pre_overtime_cut_point(
|
||||
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap,
|
||||
String preChangeType_key, String resourceid, String preSplitDate, String splitDate,
|
||||
int preChangeType, KQTimesArrayComInfo kqTimesArrayComInfo,
|
||||
SplitBean splitBean, int changeType,boolean is_flow_humanized) {
|
||||
|
||||
String pre_overtime_cut_point = "";
|
||||
KQOvertimeRulesDetailEntity preKqOvertimeRulesDetailEntity = overRulesDetailMap.get(preChangeType_key);
|
||||
if(preKqOvertimeRulesDetailEntity != null){
|
||||
int has_cut_point = preKqOvertimeRulesDetailEntity.getHas_cut_point();
|
||||
if(has_cut_point == 0){
|
||||
ShiftInfoBean pre_shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(resourceid, preSplitDate, false);
|
||||
boolean hasNoSerial = false;
|
||||
if(pre_shiftInfoBean != null){
|
||||
String serialid = Util.null2s(pre_shiftInfoBean.getSerialid(),"");
|
||||
if(StringUtil.isNull(serialid)){
|
||||
hasNoSerial = true;
|
||||
}
|
||||
}
|
||||
if(preChangeType == 2 && hasNoSerial){
|
||||
if(pre_shiftInfoBean != null){
|
||||
List<int[]> workLongTimeIndex = pre_shiftInfoBean.getWorkLongTimeIndex();
|
||||
List<int[]> real_workLongTimeIndex = Lists.newArrayList();
|
||||
get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,pre_shiftInfoBean,kqTimesArrayComInfo,splitBean,is_flow_humanized);
|
||||
|
||||
if(real_workLongTimeIndex != null && !real_workLongTimeIndex.isEmpty()){
|
||||
pre_overtime_cut_point = kqTimesArrayComInfo.getTimesByArrayindex(real_workLongTimeIndex.get(0)[0]);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
String next_beginwork_time = "";
|
||||
ShiftInfoBean next_shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(resourceid, splitDate, false);
|
||||
if(next_shiftInfoBean != null){
|
||||
List<int[]> workLongTimeIndex = next_shiftInfoBean.getWorkLongTimeIndex();
|
||||
List<int[]> real_workLongTimeIndex = Lists.newArrayList();
|
||||
get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,next_shiftInfoBean,kqTimesArrayComInfo,splitBean,is_flow_humanized);
|
||||
|
||||
if(real_workLongTimeIndex != null && !real_workLongTimeIndex.isEmpty()){
|
||||
next_beginwork_time = kqTimesArrayComInfo.getTimesByArrayindex(real_workLongTimeIndex.get(0)[0]);
|
||||
}
|
||||
}
|
||||
if(next_beginwork_time.length() > 0){
|
||||
pre_overtime_cut_point = next_beginwork_time;
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
pre_overtime_cut_point = preKqOvertimeRulesDetailEntity.getCut_point();
|
||||
}
|
||||
}
|
||||
if(pre_overtime_cut_point.length() == 0){
|
||||
pre_overtime_cut_point = "00:00";
|
||||
}
|
||||
return pre_overtime_cut_point;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理节假日的加班
|
||||
* @param initArrays
|
||||
* @param overRulesDetailMap
|
||||
* @param nextChangeType_key
|
||||
* @param next_changeType
|
||||
* @param next_beginwork_time
|
||||
*/
|
||||
public void handle_changeType_1(int[] initArrays,
|
||||
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap,
|
||||
String nextChangeType_key, int next_changeType, String next_beginwork_time){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 排除休息时间 现在工作日,节假日和休息日都可以设置排除休息时间
|
||||
*/
|
||||
public void handle_resttime(Map<String, List<String[]>> restTimeMap, String changeType_key, KQTimesArrayComInfo kqTimesArrayComInfo, boolean shouldAcross, int[] initArrays) {
|
||||
|
||||
if(restTimeMap.containsKey(changeType_key)){
|
||||
List<String[]> restTimeList = restTimeMap.get(changeType_key);
|
||||
//再把休息时间填充上去
|
||||
if(!restTimeList.isEmpty()){
|
||||
for(int k =0 ; k < restTimeList.size() ; k++){
|
||||
String[] restTimes = restTimeList.get(k);
|
||||
if(restTimes.length == 2){
|
||||
int restStart = kqTimesArrayComInfo.getArrayindexByTimes(restTimes[0]);
|
||||
int restEnd = kqTimesArrayComInfo.getArrayindexByTimes(restTimes[1]);
|
||||
// if(shouldAcross && restEnd == 1439){
|
||||
if(restEnd == 1439){
|
||||
//针对跨天的休息时段单独处理排除掉23:59-00:00的时间
|
||||
restEnd = 1440;
|
||||
}
|
||||
Arrays.fill(initArrays, restStart, restEnd, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 排除休息时长 根据加班时长排除指定时长
|
||||
* @param curMins
|
||||
* @param restTimeMap
|
||||
* @param changeType_key
|
||||
* @return
|
||||
*/
|
||||
public int handle_restlength(int curMins, Map<String, List<String[]>> restTimeMap, String changeType_key) {
|
||||
if(restTimeMap.containsKey(changeType_key)) {
|
||||
List<String[]> restTimeList = restTimeMap.get(changeType_key);
|
||||
//再把休息时间填充上去
|
||||
if (!restTimeList.isEmpty()) {
|
||||
for(int k = restTimeList.size()-1 ; k >= 0 ; k--) {
|
||||
String[] restTimes = restTimeList.get(k);
|
||||
if (restTimes.length == 2) {
|
||||
//overlength 是满多少小时 cutlength是减去多少小时
|
||||
double overlength = Util.getDoubleValue(restTimes[0],-1);
|
||||
double cutlength = Util.getDoubleValue(restTimes[1],-1);
|
||||
if(overlength > -1 && cutlength > -1){
|
||||
double min_overlength = overlength * 60;
|
||||
double min_cutlength = cutlength * 60;
|
||||
if(curMins >= min_overlength){
|
||||
curMins = (int) (curMins-min_cutlength);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return curMins;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理工作日的加班
|
||||
*/
|
||||
public boolean handle_changeType_2(int[] initArrays, String resourceid, String splitDate,
|
||||
int before_startTime, int startTime, int fromTime_index,
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo, SplitBean splitBean, int toTime_index,boolean is_flow_humanized,
|
||||
KQOvertimeRulesDetailEntity curKqOvertimeRulesDetailEntity){
|
||||
|
||||
boolean isok = true;
|
||||
ShiftInfoBean cur_shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(resourceid, splitDate, false);
|
||||
|
||||
if(cur_shiftInfoBean != null){
|
||||
splitBean.setSerialid(cur_shiftInfoBean.getSerialid());
|
||||
List<int[]> workLongTimeIndex = cur_shiftInfoBean.getWorkLongTimeIndex();
|
||||
List<int[]> real_workLongTimeIndex = Lists.newArrayList();
|
||||
get_real_workLongTimeIndex(workLongTimeIndex,real_workLongTimeIndex,cur_shiftInfoBean,kqTimesArrayComInfo,splitBean,is_flow_humanized);
|
||||
if(real_workLongTimeIndex != null && !real_workLongTimeIndex.isEmpty()){
|
||||
int all_firstworktime = 0;
|
||||
int all_lastworktime = 0;
|
||||
boolean need_middle_time = false;
|
||||
//午休加班
|
||||
int isovertimecal = curKqOvertimeRulesDetailEntity.getIsOvertimeCal();
|
||||
if(isovertimecal==1){
|
||||
need_middle_time = true;
|
||||
}//----午休加班
|
||||
for(int k = 0 ; k < real_workLongTimeIndex.size() ; k++){
|
||||
int workLongTimeStartIndex = real_workLongTimeIndex.get(k)[0];
|
||||
int workLongTimeEndIndex = real_workLongTimeIndex.get(k)[1];
|
||||
if(k == 0){
|
||||
if(before_startTime > -1){
|
||||
int before_workLongTimeStartIndex = workLongTimeStartIndex-before_startTime;
|
||||
if(before_workLongTimeStartIndex > 0){
|
||||
//从前一天的加班归属点到今天的上班前开始加班点,这段时间属于两不靠。需要排除
|
||||
if(fromTime_index < before_workLongTimeStartIndex){
|
||||
Arrays.fill(initArrays, fromTime_index,before_workLongTimeStartIndex,-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
all_firstworktime = workLongTimeStartIndex;
|
||||
}
|
||||
if(k == real_workLongTimeIndex.size()-1){
|
||||
if(startTime > -1){
|
||||
int after_workLongTimeEndIndex = workLongTimeEndIndex+startTime;
|
||||
if(workLongTimeEndIndex < after_workLongTimeEndIndex){
|
||||
Arrays.fill(initArrays, workLongTimeEndIndex,after_workLongTimeEndIndex,-1);
|
||||
}
|
||||
}
|
||||
all_lastworktime = workLongTimeEndIndex;
|
||||
}
|
||||
if(!need_middle_time){
|
||||
//目前标准加班,一天多次打卡的话是不算中间时间的,只算上班前和下班后的加班
|
||||
}else{
|
||||
//这个里面是可以算一天多次打卡的话是中间时间的
|
||||
Arrays.fill(initArrays, workLongTimeStartIndex,workLongTimeEndIndex,1);
|
||||
}
|
||||
}
|
||||
if(!need_middle_time){
|
||||
Arrays.fill(initArrays, all_firstworktime,all_lastworktime,1);
|
||||
}
|
||||
List<int[]> restLongTimeIndex = cur_shiftInfoBean.getRestLongTimeIndex();
|
||||
if(restLongTimeIndex != null && !restLongTimeIndex.isEmpty()){
|
||||
for (int k = 0; k < restLongTimeIndex.size(); k++) {
|
||||
//午休加班----
|
||||
if(isovertimecal==1){
|
||||
Arrays.fill(initArrays, restLongTimeIndex.get(k)[0], restLongTimeIndex.get(k)[1], 0);
|
||||
}else{
|
||||
Arrays.fill(initArrays, restLongTimeIndex.get(k)[0], restLongTimeIndex.get(k)[1], 2);
|
||||
}//---午休加班
|
||||
}
|
||||
}
|
||||
}else {
|
||||
kqLog.info("error");
|
||||
isok = false;
|
||||
}
|
||||
}else {
|
||||
kqLog.info("error");
|
||||
isok = false;
|
||||
}
|
||||
|
||||
return isok;
|
||||
}
|
||||
/**
|
||||
* 处理休息日的加班
|
||||
* @param restTimeMap
|
||||
* @param initArrays
|
||||
* @param overRulesDetailMap
|
||||
* @param nextChangeType_key
|
||||
* @param next_changeType
|
||||
* @param next_beginwork_time
|
||||
*/
|
||||
public void handle_changeType_3(int[] initArrays,
|
||||
Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap,
|
||||
String nextChangeType_key, int next_changeType, String next_beginwork_time) {
|
||||
|
||||
}
|
||||
|
||||
public void getDurationByRule(SplitBean splitBean) {
|
||||
double D_Mins = splitBean.getD_Mins();
|
||||
int workmins = splitBean.getWorkmins();
|
||||
String durationrule = splitBean.getDurationrule();
|
||||
if("3".equalsIgnoreCase(durationrule) || "5".equalsIgnoreCase(durationrule)
|
||||
|| "6".equalsIgnoreCase(durationrule)){
|
||||
double d_hour = D_Mins/60.0;
|
||||
splitBean.setDuration(KQDurationCalculatorUtil.getDurationRound5(""+d_hour));
|
||||
}else if("1".equalsIgnoreCase(durationrule)){
|
||||
double d_day = D_Mins/workmins;
|
||||
splitBean.setDuration(KQDurationCalculatorUtil.getDurationRound5(""+d_day));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,638 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.UtilKQ;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.common.StringUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect = Util.null2String(jsonObj.get("typeselect"));
|
||||
if (typeselect.length() == 0) typeselect = "3";
|
||||
if (!typeselect.equals("") && !typeselect.equals("0") && !typeselect.equals("6")) {
|
||||
if (typeselect.equals("1")) {
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
} else {
|
||||
fromDate = TimeUtil.getDateByOption(typeselect, "0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect, "1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")), ",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("1", "" + user.getUID(), "a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String, Object>> constraintList = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (Util.null2String(kqReportFieldComInfo.getParentid()).length() > 0) continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))
|
||||
continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width", 30 * 256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(), user);
|
||||
childColumns = (List<Object>) mapChildColumnInfo.get("childColumns");
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
} else {
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
|
||||
titleList.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if (DateUtil.compDate(today, toDate) > 0) {//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// }
|
||||
|
||||
if(showColumns.contains("kqCalendar")) {
|
||||
childColumns = new ArrayList<>();
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
title = new HashMap<>();
|
||||
title.put("title", UtilKQ.getWeekDayShort(DateUtil.getWeek(date)-1,user.getLanguage()) +"\r\n"+ DateUtil.geDayOfMonth(date));
|
||||
title.put("width", 30 * 256);
|
||||
childColumns.add(title);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
title = new HashMap();
|
||||
title.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
String backFields = " (select sum(xxb) as xxb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xxb,(select sum(zrbtjbzdx*60) as zrbtjbztx from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjbztx,(select sum(gzsc) as gzsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gzsc,(select sum(psjbshic*60) as psjbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as psjbsc,(select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc," +
|
||||
"(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb," +
|
||||
"(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb," +
|
||||
"(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and u.ksrq>='"+fromDate+"' and u.ksrq<= '"+toDate+"') as zlxs," +
|
||||
"(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts," +
|
||||
"(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts," +
|
||||
"(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
|
||||
if (subCompanyId.length() > 0) {
|
||||
sqlWhere += " and a.subcompanyid1 in(" + subCompanyId + ") ";
|
||||
}
|
||||
|
||||
if (departmentId.length() > 0) {
|
||||
sqlWhere += " and a.departmentid in(" + departmentId + ") ";
|
||||
}
|
||||
|
||||
if (resourceId.length() > 0) {
|
||||
sqlWhere += " and a.id in(" + resourceId + ") ";
|
||||
}
|
||||
|
||||
if (viewScope.equals("4")) {//我的下属
|
||||
if (allLevel.equals("1")) {//所有下属
|
||||
sqlWhere += " and a.managerstr like '%," + user.getUID() + ",%'";
|
||||
} else {
|
||||
sqlWhere += " and a.managerid=" + user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select " + backFields + sqlFrom + sqlWhere + groupBy + orderBy;
|
||||
|
||||
//System.out.println("start" + DateUtil.getFullDate());
|
||||
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String, Object> flowData = new KQReportBiz().getFlowData(params, user);
|
||||
//System.out.println("end" + DateUtil.getFullDate());
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if (tmpSubcompanyId.length() == 0) {
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if (tmpDepartmentId.length() == 0) {
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if (tmpJobtitleId.length() == 0) {
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if (fieldName.equals("attendanceSerial")) {
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.add(kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else{
|
||||
data.add("");
|
||||
}
|
||||
continue;
|
||||
} else if (fieldName.equals("leave")) {//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.add(flowLeaveData);
|
||||
}
|
||||
continue;
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
} else if(Util.null2String(kqReportFieldComInfo.getCascadekey(fieldid)).length()>0){
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
|
||||
List<String> lsCascadekey = Util.splitString2List(kqReportFieldComInfo.getCascadekey(fieldid),",");
|
||||
for(int i=0;i<lsCascadekey.size();i++){
|
||||
if(Util.null2String(rs.getString(lsCascadekey.get(i))).length()>0){
|
||||
fieldid = KQReportFieldComInfo.field2Id.get(lsCascadekey.get(i));
|
||||
fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)),kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}else{
|
||||
fieldValue = "0";
|
||||
}
|
||||
data.add(fieldValue);
|
||||
}
|
||||
continue;
|
||||
}else {
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
fieldValue = Util.formatMultiLang(fieldValue,""+user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
if(showColumns.contains("kqCalendar")) {
|
||||
// Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true);
|
||||
Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true,uintType,show_card_source);
|
||||
isEnd = false;
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
if (DateUtil.compDate(today, date) > 0) {
|
||||
data.add("");
|
||||
} else {
|
||||
if (detialDatas.get(id + "|" + date) != null) {
|
||||
data.add(((Map<String, Object>) detialDatas.get(id + "|" + date)).get("text"));
|
||||
} else {
|
||||
data.add(SystemEnv.getHtmlLabelName(26593, user.getLanguage()));
|
||||
}
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
}
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList", constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390351, user.getLanguage())+" "+fromDate+" "+toDate;
|
||||
workbook.put("fileName", fileName);
|
||||
ExcelUtil ExcelUtil = new ExcelUtil();
|
||||
Map<String, Object> exportMap = ExcelUtil.export(workbook, request, response,true);
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String, Object> getChildColumnsInfo(String parentid, User user) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if (parentid.equals("attendanceSerial")) {//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
}
|
||||
for (int i = 0; serialIds != null && i < serialIds.size(); i++) {
|
||||
title = new HashMap<>();
|
||||
title.put("title", Util.formatMultiLang(kqShiftManagementComInfo.getSerial(serialIds.get(i)),""+user.getLanguage()));
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
} else if (parentid.equals("leave")) {
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for (int i = 0; leaveRules != null && i < leaveRules.size(); i++) {
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
String unitName = (KQUnitBiz.isLeaveHour(unitType)) ? SystemEnv.getHtmlLabelName(391, user.getLanguage()) : SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
title = new HashMap<>();
|
||||
title.put("title", name + "(" + unitName + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else {
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns", titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return titleList;
|
||||
}
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
title = new HashMap<>();
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
return titleList;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,287 @@
|
|||
package com.api.browser.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.browser.bean.BrowserBean;
|
||||
import com.api.browser.service.Browser;
|
||||
import com.api.browser.util.BrowserConfigComInfo;
|
||||
import com.api.browser.util.BrowserConstant;
|
||||
import com.api.browser.util.BrowserInitUtil;
|
||||
import com.api.browser.util.DeviceTypeAttr;
|
||||
import com.engine.systeminfo.util.BrowserConfigManager;
|
||||
import com.engine.workflow.biz.wfPathAdvanceSet.BrowserDataDefinitionBiz;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.filter.XssUtil;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 浏览框接口
|
||||
* @author jhy Mar 29, 2017
|
||||
*
|
||||
*/
|
||||
@Path("/public/browser")
|
||||
public class BrowserAction {
|
||||
|
||||
/**
|
||||
* 设置浏览框的默认配置
|
||||
* @param browser
|
||||
* @param params
|
||||
*/
|
||||
public void setBrowserStatus(Browser browser,Map<String, Object> params)
|
||||
{
|
||||
String deviceType=Util.null2String(params.get("_ec_device"));
|
||||
String isMobile=Util.null2String(params.get("_ec_ismobile"));
|
||||
browser.setDeviceType(DeviceTypeAttr.PC);
|
||||
//pc mobile_ec mobile_dingding
|
||||
if (StringUtils.isNotBlank(deviceType))
|
||||
{
|
||||
DeviceTypeAttr dt=DeviceTypeAttr.valueOf(deviceType.toUpperCase());
|
||||
browser.setDeviceType(dt);
|
||||
}
|
||||
|
||||
browser.setMobile("true".equals(isMobile));
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/data/{type}")
|
||||
@Produces("text/plain;charset=utf-8")
|
||||
public String getBrowserData2(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
return getBrowserData(type,request,response);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/data/{type}")
|
||||
@Produces("text/plain;charset=utf-8")
|
||||
public String getBrowserData(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
BrowserConfigComInfo browserConfigComInfo = new BrowserConfigComInfo();
|
||||
Map<String, Object> params = getRequestParams(request,response);
|
||||
String browserClassName = browserConfigComInfo.getClazz(type);
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
Object xswq_jf_zm = params.get("xswq_jf_zm");
|
||||
if (xswq_jf_zm != null && StringUtils.equals("xswq", Objects.toString(xswq_jf_zm))) {
|
||||
RecordSet rsTemp = new RecordSet();
|
||||
rsTemp.execute("select count(*) as cnt from hrmresource ");
|
||||
String count = "0";
|
||||
if (rsTemp.next()) {
|
||||
count = rsTemp.getString("cnt");
|
||||
}
|
||||
params.put("max", Integer.parseInt(count));
|
||||
}
|
||||
new BaseBean().writeLog("getBrowserData params:" + JSONObject.toJSONString(params));
|
||||
try {
|
||||
Browser browser = (Browser) Class.forName(browserClassName).newInstance();
|
||||
browser.setBrowserType(type);
|
||||
setBrowserStatus(browser,params);
|
||||
|
||||
//获取测试预览设置的用户
|
||||
if (params.get("operatoruser_" + params.get("currenttime")) != null) {
|
||||
browser.setUser(this.getPreviewUser(request));
|
||||
} else {
|
||||
browser.setUser(this.getUserByRequest(request, response));
|
||||
}
|
||||
|
||||
String sqlWhere = Util.null2String(browser.spellSqlWhere(params));
|
||||
String _tempSqlWhere = Util.null2String(params.get(BrowserConstant.SPELL_SQL_WHERE));
|
||||
if(!"".equals(sqlWhere) || !_tempSqlWhere.equals(sqlWhere)){
|
||||
params.put(BrowserConstant.SPELL_SQL_WHERE, _tempSqlWhere + " " + sqlWhere);
|
||||
}
|
||||
|
||||
//建模快捷搜索 处理 con_传参 的问题 用于浏览数据定义
|
||||
String isFromMode = Util.null2o(Util.null2String(params.get("isFromMode")));
|
||||
if("1".equals(isFromMode)){
|
||||
Map<String, Object> params2=params.entrySet().stream()
|
||||
.collect(Collectors.toMap(
|
||||
entry->entry.getKey().replaceAll("con_","field"),
|
||||
Map.Entry::getValue));
|
||||
|
||||
params.putAll(params2);
|
||||
}
|
||||
|
||||
|
||||
apidatas.putAll(browser.getBrowserData(params));
|
||||
/*String countData=BrowserConfigManager.getValue("pageSize","browser");
|
||||
if(StringUtils.isNotBlank(countData))
|
||||
apidatas.put("pageSize",countData);*/
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
apidatas.put("status", false);
|
||||
apidatas.put("error", e.getMessage());
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/destData/{type}")
|
||||
public String getDestData(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> params = getRequestParams(request,response);
|
||||
String browserClassName = new BrowserConfigComInfo().getClazz(type);
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
try {
|
||||
Browser browser = (Browser) Class.forName(browserClassName).newInstance();
|
||||
setBrowserStatus(browser,params);
|
||||
browser.setBrowserType(type);
|
||||
browser.setUser(this.getUserByRequest(request, response));
|
||||
apidatas = browser.getMultBrowserDestData(params);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/destData/{type}")
|
||||
public String getDestData2(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> params = getRequestParams(request,response);
|
||||
String browserClassName = new BrowserConfigComInfo().getClazz(type);
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
try {
|
||||
Browser browser = (Browser) Class.forName(browserClassName).newInstance();
|
||||
setBrowserStatus(browser,params);
|
||||
browser.setBrowserType(type);
|
||||
browser.setUser(this.getUserByRequest(request, response));
|
||||
apidatas = browser.getMultBrowserDestData(params);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/complete/{type}")
|
||||
public String browserAutoComplete2(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
return browserAutoComplete(type,request,response);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/complete/{type}")
|
||||
public String browserAutoComplete(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
String browserClassName = new BrowserConfigComInfo().getClazz(type);
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
Map<String, Object> params = getRequestParams(request,response);
|
||||
try {
|
||||
User user = null;
|
||||
//获取测试预览设置的用户
|
||||
if (params.get("operatoruser_" + params.get("currenttime")) != null) {
|
||||
user = this.getPreviewUser(request);
|
||||
} else {
|
||||
user = this.getUserByRequest(request, response);
|
||||
}
|
||||
Browser browser = (Browser) Class.forName(browserClassName).newInstance();
|
||||
browser.setBrowserType(type);
|
||||
setBrowserStatus(browser,params);
|
||||
browser.setUser(user);
|
||||
String sqlWhere = Util.null2String(browser.spellSqlWhere(getRequestParams(request,response)));
|
||||
//XssUtil xssUtil=new XssUtil();
|
||||
|
||||
//对 sqlwhere 做解密处理
|
||||
//String sqlwhereParam=Util.null2String(params.get("sqlwhere"));
|
||||
//sqlwhereParam=xssUtil.get(sqlwhereParam);
|
||||
//params.put("sqlwhere",sqlwhereParam);
|
||||
|
||||
String _tempSqlWhere = Util.null2String(request.getParameter(BrowserConstant.SPELL_SQL_WHERE));
|
||||
|
||||
if(!"".equals(sqlWhere) || !_tempSqlWhere.equals(sqlWhere)){
|
||||
request.setAttribute(BrowserConstant.SPELL_SQL_WHERE, _tempSqlWhere + " " + sqlWhere);
|
||||
}
|
||||
BrowserDataDefinitionBiz.getDataDefinitionParams(params,type,user);
|
||||
browser.setAutoCompleteDataDefinitionParams(params);
|
||||
apidatas = browser.browserAutoComplete(request,response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return Util.fromScreen4(JSONObject.toJSONString(apidatas),7);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/condition/{type}")
|
||||
public String getBrowserConditionInfo(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
Map<String, Object> params = getRequestParams(request,response);
|
||||
String browserClassName = new BrowserConfigComInfo().getClazz(type);
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
try {
|
||||
User user = null;
|
||||
//获取测试预览设置的用户
|
||||
if (params.get("operatoruser_" + params.get("currenttime")) != null) {
|
||||
user = this.getPreviewUser(request);
|
||||
} else {
|
||||
user = this.getUserByRequest(request, response);
|
||||
}
|
||||
Browser browser = (Browser) Class.forName(browserClassName).newInstance();
|
||||
browser.setBrowserType(type);
|
||||
browser.setUser(user);
|
||||
setBrowserStatus(browser,params);
|
||||
|
||||
apidatas = browser.getBrowserConditionInfo(params);
|
||||
BrowserDataDefinitionBiz.markBrowserConditionDefinition(apidatas,params,type,user);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
|
||||
private Map<String,Object> getRequestParams(HttpServletRequest request,HttpServletResponse response){
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Enumeration<String> em = request.getParameterNames();
|
||||
while(em.hasMoreElements()){
|
||||
String paramname = em.nextElement();
|
||||
params.put(paramname, request.getParameter(paramname));
|
||||
}
|
||||
return params;
|
||||
}
|
||||
@GET
|
||||
@Path("/prop/{type}")
|
||||
public String getBrowserProps(@PathParam("type") String type, @Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
User user = HrmUserVarify.getUser(request, response);// 需要增加的代码
|
||||
BrowserInitUtil browserInitUtil = new BrowserInitUtil();
|
||||
BrowserBean browserProp = new BrowserBean(type);
|
||||
browserInitUtil.initBrowser(browserProp,user.getLanguage());
|
||||
return JSONObject.toJSONString(browserProp);
|
||||
}
|
||||
|
||||
private User getUserByRequest(HttpServletRequest request, HttpServletResponse response){
|
||||
String f_weaver_belongto_userid = Util.null2String(request.getParameter("f_weaver_belongto_userid"));
|
||||
String f_weaver_belongto_usertype = Util.null2String(request.getParameter("f_weaver_belongto_usertype"));
|
||||
User user = HrmUserVarify.getUser(request, response, f_weaver_belongto_userid, f_weaver_belongto_usertype);
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取测试预览操作用户
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private User getPreviewUser(HttpServletRequest request){
|
||||
String f_weaver_belongto_userid = Util.null2String(request.getParameter("f_weaver_belongto_userid"));
|
||||
String f_weaver_belongto_usertype = Util.null2String(request.getParameter("f_weaver_belongto_usertype"));
|
||||
User user = User.getUser(Integer.parseInt(f_weaver_belongto_userid),Integer.parseInt(f_weaver_belongto_usertype));
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,853 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.tools.ant.util.DateUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetKQReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
String isFromMyAttendance = Util.null2String(jsonObj.get("isFromMyAttendance"));//是否是来自我的考勤的请求,如果是,不加载考勤报表权限共享的限制,不然我的考勤会提示无权限
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
|
||||
String rightSql = kqReportBiz.getReportRight("1",""+user.getUID(),"a");
|
||||
if(isFromMyAttendance.equals("1")){
|
||||
rightSql = "";
|
||||
}
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0)continue;
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("type", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
columns.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束日期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){//结束日期不大于今天
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
|
||||
childColumns = new ArrayList<>();
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
column = new HashMap();
|
||||
column.put("title", DateUtil.geDayOfMonth(date));
|
||||
column.put("dataIndex", date);
|
||||
column.put("key", date);
|
||||
column.put("type", date);
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", 90);
|
||||
column.put("isCalendar", 1);
|
||||
childColumns.add(column);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
column.put("dataIndex", "kqCalendar");
|
||||
column.put("key", "kqCalendar");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", childColumns.size()*90);
|
||||
column.put("children", childColumns);
|
||||
}
|
||||
columns.add(column);
|
||||
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
String backFields = " a.companystartdate,(select sum(gxbts) as gxbts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gxbts,(select sum(xchu) as xcqts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xcqts,(select sum(jjrbtjia*60) as jjrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrbtjb,(select sum(jjrdksc*60) as jjrdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrdksc,(select sum(xxb) as xxb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xxb,(select sum(zrbtjbzdx*60) as zrbtjbztx from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjbztx,(select sum(gzsc) as gzsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gzsc,(select sum(psjbshic*60) as psjbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as psjbsc,(select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc,(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb,(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb,(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and u.ksrq>='"+fromDate+"' and u.ksrq<= '"+toDate+"') as zlxs,(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts,(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts,(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle,a.companystartdate " +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
sqlWhere += " and 1=2 ";
|
||||
}
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+groupBy+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by t.dsporder asc, t.lastname asc ";
|
||||
String descOrderBy = " order by t.dsporder desc, t.lastname desc ";
|
||||
|
||||
//默认排序设置 start,有性能问题,先取消,后面再看看有没有好的方式
|
||||
// String orderBySql = "select * from kq_report_order where userId=? and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql, user.getUID());
|
||||
// if (rs.getCounts() <= 0) {
|
||||
// orderBySql = "select * from kq_report_order where userId=0 and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql);
|
||||
// }
|
||||
// while (rs.next()) {
|
||||
// String dataIndex = rs.getString("dataIndex");
|
||||
// String ascOrDesc = rs.getString("ascOrDesc");
|
||||
// String ascOrDesc1 = (ascOrDesc.equals("")||ascOrDesc.equals("asc"))?"desc":"asc";
|
||||
// if (dataIndex.equals("organization")) {
|
||||
// orderBy += ",showOrderOfDeptTree " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += ",showOrderOfDeptTree " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// }
|
||||
// if (dataIndex.equalsIgnoreCase("dspOrder") || dataIndex.equalsIgnoreCase("lastName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("deptShowOrder") || dataIndex.equalsIgnoreCase("deptName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("subcomShowOrder") || dataIndex.equalsIgnoreCase("subcomName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",subcom_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",subcom_id " + ascOrDesc1;
|
||||
// }
|
||||
// }
|
||||
// orderBy = orderBy.startsWith(",") ? orderBy.substring(1) : orderBy;
|
||||
// descOrderBy = descOrderBy.startsWith(",") ? descOrderBy.substring(1) : descOrderBy;
|
||||
// orderBy = orderBy.equals("") ? " t.dspOrder,t.id " : orderBy;
|
||||
// descOrderBy = descOrderBy.equals("") ? " t.dspOrder,t.id " : descOrderBy;
|
||||
// orderBy = "order by "+orderBy;
|
||||
|
||||
sql = backFields + sqlFrom + sqlWhere + groupBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " +pageSize + " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql + orderBy+ " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql+orderBy;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
|
||||
|
||||
bb.writeLog("getKqReportCmd:"+sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
String id = rs.getString("id");
|
||||
data.put("resourceId",id);
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1"))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
data.put("subcompanyId",tmpSubcompanyId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
data.put("departmentId",tmpDepartmentId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
data.put("jobtitleId",tmpJobtitleId);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
}else if(fieldName.equals("cdfz")){
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins"));
|
||||
fieldValue = beLateMins;
|
||||
}else if(fieldName.equals("ztfz")){
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins"));
|
||||
fieldValue = graveBeLateMins;
|
||||
}else if(fieldName.equals("xcqts")){
|
||||
String xcqtsDays = getXcqts(fromDate,id);
|
||||
fieldValue = xcqtsDays;
|
||||
}else if(fieldName.equals("attendanceSerial")){
|
||||
List<String> serialIds = null;
|
||||
if(attendanceSerial.length()>0){
|
||||
serialIds = Util.splitString2List(attendanceSerial,",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
if(fieldName.equals("overtimeTotal")){
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else{
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id+"|"+fieldName)));
|
||||
}
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if(Util.null2String(kqReportFieldComInfo.getUnittype()).length()>0) {
|
||||
if(fieldValue.length() == 0){
|
||||
fieldValue="0";
|
||||
}else{
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
data.put(fieldName,fieldValue);
|
||||
}
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_"+leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+flowLeaveBackType)),"0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(leaveData.length() == 0){
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if(leavebackData.length() == 0){
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if(b_flowLeaveData.length() > 0){
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
}else{
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0)));
|
||||
}
|
||||
data.put(flowType,flowLeaveData);
|
||||
}
|
||||
|
||||
Map<String,Object> detialDatas = kqReportBiz.getDetialDatas(id,fromDate,toDate,user,flowData,false,uintType,show_card_source);
|
||||
// new KQLog().info("id:"+id+":detialDatas:"+detialDatas);
|
||||
isEnd = false;
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
if(DateUtil.compDate(today, date)>0){
|
||||
data.put(date,"");
|
||||
}else{
|
||||
// new KQLog().info("id:date:"+(id+"|"+date)+":detialDatas.get:"+detialDatas.get(id+"|"+date));
|
||||
data.put(date,detialDatas.get(id+"|"+date)==null?SystemEnv.getHtmlLabelName(26593, user.getLanguage()):detialDatas.get(id+"|"+date));
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("attendanceSerial")){//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if(Util.null2String(jsonObj.get("attendanceSerial")).length()>0){
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")),",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
column = new HashMap();
|
||||
column.put("title", kqShiftManagementComInfo.getSerial(serialIds.get(i)));
|
||||
column.put("unit", "");
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", serialIds.get(i));
|
||||
column.put("key", serialIds.get(i));
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return lsChildColumns;
|
||||
}
|
||||
Map<String,Object> column = null;
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lsChildColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getXcqts(String dateOri,String userId){
|
||||
//本月第一天
|
||||
String fromDate = TimeUtil.getMonthBeginDay(dateOri);
|
||||
//本月最后一天
|
||||
String toDate = TimeUtil.getMonthEndDay(dateOri);
|
||||
Set<String> all = new HashSet<>();
|
||||
all.add(fromDate);
|
||||
List<String> back = days(fromDate,toDate);
|
||||
all.addAll(back);
|
||||
all.add(toDate);
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//需出勤天数
|
||||
Integer xcqtsAll = 0;
|
||||
//考勤组大小周A
|
||||
String dxzA = bb.getPropValue("jgKq_main","dxzA");
|
||||
//考勤组大小周B
|
||||
String dxzB = bb.getPropValue("jgKq_main","dxzB");
|
||||
String rykqz = getCusFieldData(Integer.valueOf(userId),"field31",3);
|
||||
|
||||
for (String date : all) {
|
||||
KQHolidaySetComInfo holidaySetComInfo = new KQHolidaySetComInfo();
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
/*获取考勤组的ID,因为考勤组有有效期,所以需要传入日期*/
|
||||
String groupId = kqGroupMemberComInfo.getKQGroupId(userId, date);
|
||||
String changeTypeNew = holidaySetComInfo.getChangeType(groupId, date);
|
||||
String rzlxZdy = findRqlx(userId,date);
|
||||
//日期类型,0是工作日、1是周六、2是周日
|
||||
Integer rqlx = -1;
|
||||
if("0".equals(rzlxZdy)){
|
||||
rqlx = 0;
|
||||
}else if("1".equals(rzlxZdy)){
|
||||
rqlx = 1;
|
||||
}else if("2".equals(rzlxZdy)){
|
||||
rqlx = 2;
|
||||
}else if(DateUtil.getWeek(date) == 6){
|
||||
rqlx = 1;
|
||||
}else if(DateUtil.getWeek(date) == 7){
|
||||
rqlx = 2;
|
||||
}else {
|
||||
rqlx = 0;
|
||||
}
|
||||
Integer xcqts = 0;
|
||||
if("4".equals(rykqz)){
|
||||
//单休判断是不是周日,是的话不计
|
||||
if(rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}else if ("8".equals(rykqz)){
|
||||
//双休判断是不是周六周日,是的话不计
|
||||
if(rqlx == 1 || rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}else if(dxzA.equals(rykqz) || dxzB.equals(rykqz)){
|
||||
//双休判断是不是周六周日,是的话不计
|
||||
if(rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else if (rqlx == 1){
|
||||
//周六是工作日的话计
|
||||
if("2".equals(changeTypeNew)){
|
||||
xcqts = 1;
|
||||
}else{
|
||||
xcqts = 0;
|
||||
}
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}
|
||||
xcqtsAll = xcqtsAll+xcqts;
|
||||
}
|
||||
|
||||
return String.valueOf(xcqtsAll);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取两个日期之间所有的日期
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList days(String date1, String date2) {
|
||||
String dateFormat = "yyyy-MM-dd";
|
||||
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
ArrayList L = new ArrayList();
|
||||
if (date1.equals(date2)) {
|
||||
System.out.println("两个日期相等!");
|
||||
return L;
|
||||
}
|
||||
|
||||
String tmp;
|
||||
if (date1.compareTo(date2) > 0) { // 确保 date1的日期不晚于date2
|
||||
tmp = date1;
|
||||
date1 = date2;
|
||||
date2 = tmp;
|
||||
}
|
||||
|
||||
tmp = format.format(str2Date(date1).getTime() + 3600 * 24 * 1000);
|
||||
|
||||
int num = 0;
|
||||
while (tmp.compareTo(date2) < 0) {
|
||||
L.add(tmp);
|
||||
num++;
|
||||
tmp = format.format(str2Date(tmp).getTime() + 3600 * 24 * 1000);
|
||||
}
|
||||
|
||||
if (num == 0)
|
||||
System.out.println("两个日期相邻!");
|
||||
return L;
|
||||
}
|
||||
|
||||
private static Date str2Date(String str) {
|
||||
String dateFormat = "yyyy-MM-dd";
|
||||
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
return format.parse(str);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义日期类型判断
|
||||
* @param userId
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String findRqlx(String userId,String date){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select rqlx from uf_rqzdygs where CONCAT(xm,',') like('%"+userId+",%') and rq = '"+date+"'";
|
||||
rs.executeQuery(sql);
|
||||
String rqlx = "-1";
|
||||
if(rs.next()){
|
||||
rqlx = Util.null2String(rs.getString("rqlx"));
|
||||
}
|
||||
return StringUtils.isBlank(rqlx)?"-1":rqlx;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义字段的值
|
||||
* @param id
|
||||
* @param fieldname
|
||||
* @param scopeid
|
||||
* @return
|
||||
*/
|
||||
public static String getCusFieldData(Integer id,String fieldname,int scopeid){
|
||||
String fieldVal = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select "+fieldname+" from cus_fielddata where id=? and scopeid=? and scope='HrmCustomFieldByInfoType' ";
|
||||
rs.executeQuery(sql,id,scopeid);
|
||||
if(rs.next()){
|
||||
fieldVal = Util.null2String(rs.getString(fieldname));
|
||||
}
|
||||
return fieldVal;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,333 @@
|
|||
package com.engine.kq.biz;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.jucailin.genid.IdGenerator;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.engine.kq.enums.FlowReportTypeEnum;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
/**
|
||||
* 格式化自由工时数据
|
||||
*/
|
||||
public class KQFormatFreeData extends BaseBean{
|
||||
private static DecimalFormat df = new DecimalFormat("0.00");
|
||||
protected KQLog kqLog = new KQLog();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @param kqDate
|
||||
* @param workFlowInfo
|
||||
* @return
|
||||
*/
|
||||
public List<List<Object>> format(String userId, String kqDate, Map<String,Object> workFlowInfo){
|
||||
List<List<Object>> lsParam = new ArrayList<>();
|
||||
List<Object> params = new ArrayList<>();
|
||||
try{
|
||||
Timestamp date = new Timestamp(System.currentTimeMillis());
|
||||
int workMins = 0;
|
||||
String signInId = "";
|
||||
String signInDate = "";
|
||||
String signInTime = "";
|
||||
String signOutId = "";
|
||||
String signOutDate = "";
|
||||
String signOutTime = "";
|
||||
|
||||
String temp_signInDate = "";
|
||||
String temp_signInTime = "";
|
||||
String temp_signOutDate = "";
|
||||
String temp_signOutTime = "";
|
||||
|
||||
String cal_signInId = "";
|
||||
String cal_signInDate = "";
|
||||
String cal_signInTime = "";
|
||||
String cal_signOutId = "";
|
||||
String cal_signOutDate = "";
|
||||
String cal_signOutTime = "";
|
||||
|
||||
int signMins = 0;
|
||||
int attendanceMins=0;
|
||||
String serialid = "";
|
||||
String groupid = "";
|
||||
int beLateMins = 0;
|
||||
int graveBeLateMins = 0;
|
||||
int leaveEarlyMins =0;
|
||||
int graveLeaveEarlyMins =0;
|
||||
int absenteeismMins =0;
|
||||
int leaveMins = 0;//请假时长
|
||||
int evectionMins = 0;//出差时长
|
||||
int outMins = 0;//公出时长
|
||||
Map<String,Integer> leaveInfo = new HashMap<>();//请假信息
|
||||
Map<String,Object> otherinfo = new HashMap<>();//存一些用得到的信息
|
||||
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
|
||||
int workBeginIdx = 0;
|
||||
int beginIdx = 0;
|
||||
int endIdx = 0;
|
||||
String dateKey = userId +"|"+ kqDate;
|
||||
String nextDate = DateUtil.addDate(kqDate, 1);
|
||||
|
||||
List<Object> workFlow = null;
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId,kqDate);
|
||||
String signstart = "";
|
||||
String calmethod = "2";
|
||||
if(workTime!=null) {
|
||||
groupid = Util.null2String(workTime.getGroupId());
|
||||
signstart = Util.null2String(workTime.getSignStart());//签到开始时间
|
||||
workMins = Util.getIntValue(Util.null2String(workTime.getWorkMins()));//工作时长
|
||||
workBeginIdx = kqTimesArrayComInfo.getArrayindexByTimes(signstart);
|
||||
calmethod = Util.null2s(workTime.getCalmethod(),"1");//自由班制计算方式
|
||||
}
|
||||
// 弹性工作制是否可以跨天
|
||||
boolean isFreezeAcross = KQSettingsBiz.is_freeAcross();
|
||||
|
||||
int kqSize = 1440;
|
||||
if(isFreezeAcross){
|
||||
kqSize = kqTimesArrayComInfo.getIndexSize();
|
||||
}
|
||||
int[] dayMins = new int[kqSize];//一天所有分钟数
|
||||
|
||||
if(workFlowInfo.get(dateKey)!=null){
|
||||
workFlow = (List<Object>)workFlowInfo.get(dateKey);
|
||||
}
|
||||
|
||||
for(int j=0;workFlow!=null&&j<workFlow.size();j++) {
|
||||
Map<String, Object> data = (Map<String, Object>) workFlow.get(j);
|
||||
String flowType = Util.null2String(data.get("flowtype"));
|
||||
String newLeaveType = Util.null2String(data.get("newleavetype"));
|
||||
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("begintime")));
|
||||
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("endtime")));
|
||||
if(flowType.equals(FlowReportTypeEnum.EVECTION.getFlowType())){
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 7);//出差抵扣时段标识 7
|
||||
}else if(flowType.equals(FlowReportTypeEnum.OUT.getFlowType())){
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 8);//公出抵扣时段标识 8
|
||||
}else{
|
||||
if (endIdx > beginIdx) {
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 5);//流程抵扣时段标识 5
|
||||
if(flowType.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())){
|
||||
int tmpBeginIdx = beginIdx;
|
||||
int tmpEndIdx = endIdx;
|
||||
int val = 0;
|
||||
if(leaveInfo.get(newLeaveType)==null){
|
||||
leaveInfo.put(newLeaveType,val);
|
||||
}else{
|
||||
val = leaveInfo.get(newLeaveType);
|
||||
}
|
||||
if(beginIdx<workBeginIdx)tmpBeginIdx=workBeginIdx;
|
||||
if(tmpEndIdx>tmpBeginIdx){
|
||||
leaveInfo.put(newLeaveType,val+(tmpEndIdx-tmpBeginIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String signBeginDateTime = kqDate + " "+ signstart+":00";
|
||||
String signEndDateTime = kqDate + " 23:59:59";
|
||||
if(isFreezeAcross){
|
||||
signEndDateTime = nextDate + " "+ signstart+":00";
|
||||
}
|
||||
String workBeginDateTime = "";
|
||||
String workEndDateTime = "";
|
||||
List<Object> lsCheckInfo = new KQFormatSignData().getSignInfoForAll(userId,signBeginDateTime,signEndDateTime,workBeginDateTime,workEndDateTime);
|
||||
|
||||
if("2".equalsIgnoreCase(calmethod)){
|
||||
//成对出现
|
||||
if(!lsCheckInfo.isEmpty()) {
|
||||
if(lsCheckInfo.size()%2==1 && lsCheckInfo.size() > 1){
|
||||
lsCheckInfo.remove(lsCheckInfo.size()-1);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(!lsCheckInfo.isEmpty()) {
|
||||
List<Object> tmplsCheckInfo = Lists.newArrayList();
|
||||
tmplsCheckInfo.add(lsCheckInfo.get(0));
|
||||
if(lsCheckInfo.size()>1) {
|
||||
tmplsCheckInfo.add(lsCheckInfo.get(lsCheckInfo.size() - 1));
|
||||
}
|
||||
lsCheckInfo.clear();
|
||||
lsCheckInfo.addAll(tmplsCheckInfo);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i<lsCheckInfo.size(); i++) {//有签到签退才算出勤,漏签无法统计出勤时间
|
||||
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(i);
|
||||
String signId = Util.null2String(checkInfo.get("signId"));
|
||||
String signDate = Util.null2String(checkInfo.get("signDate"));
|
||||
String signTime = Util.null2String(checkInfo.get("signTime"));
|
||||
if (signTime.length() > 8) {
|
||||
signTime = signTime.substring(0, 8);
|
||||
}
|
||||
|
||||
//用于计算打卡时长
|
||||
if (checkInfo.get("signType").equals("1")) {//签到
|
||||
temp_signInDate = signDate;
|
||||
if(temp_signInDate.compareTo(kqDate) > 0){
|
||||
temp_signInTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}else{
|
||||
temp_signInTime = signTime;
|
||||
}
|
||||
} else if (checkInfo.get("signType").equals("2")) {//签退
|
||||
temp_signOutDate = signDate;
|
||||
if(temp_signOutDate.compareTo(kqDate) > 0){
|
||||
temp_signOutTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}else{
|
||||
temp_signOutTime = signTime;
|
||||
}
|
||||
}
|
||||
|
||||
if (i==0 && checkInfo.get("signType").equals("1")) {//签到
|
||||
signInId = signId;
|
||||
signInDate = signDate;
|
||||
signInTime = signTime;
|
||||
if(temp_signInDate.compareTo(kqDate) > 0){
|
||||
temp_signInTime = kqTimesArrayComInfo.turn24to48Time(signTime);
|
||||
}else{
|
||||
temp_signInTime = signTime;
|
||||
}
|
||||
} else if (i==lsCheckInfo.size()-1&&checkInfo.get("signType").equals("2")) {//签退
|
||||
signOutId = signId;
|
||||
signOutDate = signDate;
|
||||
signOutTime = signTime;
|
||||
}
|
||||
|
||||
if("2".equalsIgnoreCase(calmethod)){
|
||||
if(i%2==1){
|
||||
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(temp_signInTime);
|
||||
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(temp_signOutTime);
|
||||
if(endIdx>beginIdx) {
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 1);//工作时段标识 1
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(i == 0){
|
||||
cal_signInId = signId;
|
||||
cal_signInDate = signDate;
|
||||
cal_signInTime = signTime;
|
||||
}else {
|
||||
cal_signOutId = signId;
|
||||
cal_signOutDate = signDate;
|
||||
cal_signOutTime = signTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if("1".equalsIgnoreCase(calmethod)){
|
||||
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(cal_signInTime);
|
||||
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(cal_signOutTime);
|
||||
if(cal_signInDate.compareTo(kqDate) > 0){
|
||||
beginIdx = kqTimesArrayComInfo.turn24to48TimeIndex(beginIdx);
|
||||
}
|
||||
if(cal_signOutDate.compareTo(kqDate) > 0){
|
||||
endIdx = kqTimesArrayComInfo.turn24to48TimeIndex(endIdx);
|
||||
}
|
||||
if(endIdx>beginIdx) {
|
||||
Arrays.fill(dayMins, beginIdx, endIdx, 1);//工作时段标识 1
|
||||
}
|
||||
signInId = cal_signInId;
|
||||
signInDate = cal_signInDate;
|
||||
signInTime = cal_signInTime;
|
||||
signOutId = cal_signOutId;
|
||||
signOutDate = cal_signOutDate;
|
||||
signOutTime = cal_signOutTime;
|
||||
}
|
||||
|
||||
int workFlowMins = 0;
|
||||
for(int i=workBeginIdx;i<kqSize;i++) {
|
||||
switch(dayMins[i]){
|
||||
case 1://出勤分钟数
|
||||
attendanceMins++;
|
||||
break;
|
||||
case 5:
|
||||
leaveMins++;//请假分钟数
|
||||
break;
|
||||
case 7:
|
||||
evectionMins++;
|
||||
break;
|
||||
case 8:
|
||||
outMins++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//计算实际出勤时间(打卡、出差、公出算出勤)
|
||||
signMins = attendanceMins;
|
||||
attendanceMins = attendanceMins+evectionMins+outMins;
|
||||
if(attendanceMins>workMins)attendanceMins=workMins;
|
||||
|
||||
absenteeismMins = workMins - attendanceMins-leaveMins;
|
||||
if(absenteeismMins<0){
|
||||
absenteeismMins=0;
|
||||
}
|
||||
|
||||
if (workTime.getIsExclude()) {//无需考勤人员没有异常状态
|
||||
attendanceMins = workMins;
|
||||
beLateMins = 0;
|
||||
graveBeLateMins = 0;
|
||||
leaveEarlyMins = 0;
|
||||
graveLeaveEarlyMins = 0;
|
||||
absenteeismMins = 0;
|
||||
}
|
||||
|
||||
params.add(userId);
|
||||
params.add(kqDate);
|
||||
params.add(groupid.length() == 0 ? null : groupid);
|
||||
params.add(serialid.length() == 0 ? null : serialid);
|
||||
params.add(0);
|
||||
params.add(null);
|
||||
params.add(null);
|
||||
params.add(null);
|
||||
params.add(null);
|
||||
params.add(workMins);
|
||||
params.add(signInDate);
|
||||
params.add(signInTime);
|
||||
params.add(signInId.length() == 0 ? null : signInId);
|
||||
params.add(signOutDate);
|
||||
params.add(signOutTime);
|
||||
params.add(signOutId.length() == 0 ? null : signOutId);
|
||||
params.add(signMins);
|
||||
params.add(attendanceMins);
|
||||
params.add(beLateMins);
|
||||
params.add(graveBeLateMins);
|
||||
params.add(leaveEarlyMins);
|
||||
params.add(graveLeaveEarlyMins);
|
||||
params.add(absenteeismMins);
|
||||
params.add(null);
|
||||
params.add(leaveMins);
|
||||
params.add(JSONObject.toJSONString(leaveInfo));
|
||||
params.add(evectionMins);
|
||||
params.add(outMins);
|
||||
params.add(null);
|
||||
params.add(JSONObject.toJSONString(otherinfo));
|
||||
Long id = IdGenerator.generate();
|
||||
params.add(workTime.getDayType());
|
||||
params.add(date);
|
||||
params.add(date);
|
||||
params.add(id);
|
||||
lsParam.add(params);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
kqLog.info(e);
|
||||
}
|
||||
return lsParam;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,853 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.tools.ant.util.DateUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetKQReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
String isFromMyAttendance = Util.null2String(jsonObj.get("isFromMyAttendance"));//是否是来自我的考勤的请求,如果是,不加载考勤报表权限共享的限制,不然我的考勤会提示无权限
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
|
||||
String rightSql = kqReportBiz.getReportRight("1",""+user.getUID(),"a");
|
||||
if(isFromMyAttendance.equals("1")){
|
||||
rightSql = "";
|
||||
}
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0)continue;
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("type", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
columns.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束日期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){//结束日期不大于今天
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
|
||||
childColumns = new ArrayList<>();
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
column = new HashMap();
|
||||
column.put("title", DateUtil.geDayOfMonth(date));
|
||||
column.put("dataIndex", date);
|
||||
column.put("key", date);
|
||||
column.put("type", date);
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", 90);
|
||||
column.put("isCalendar", 1);
|
||||
childColumns.add(column);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
column.put("dataIndex", "kqCalendar");
|
||||
column.put("key", "kqCalendar");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", childColumns.size()*90);
|
||||
column.put("children", childColumns);
|
||||
}
|
||||
columns.add(column);
|
||||
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
String backFields = " a.companystartdate,(select sum(gxbts) as gxbts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gxbts,(select sum(xchu) as xcqts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xcqts,(select sum(jjrbtjia*60) as jjrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrbtjb,(select sum(jjrdksc*60) as jjrdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrdksc,(select sum(xxb) as xxb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xxb,(select sum(zrbtjbzdx*60) as zrbtjbztx from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjbztx,(select sum(gzsc) as gzsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gzsc,(select sum(psjbshic*60) as psjbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as psjbsc,(select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc,(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb,(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb,(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and u.ksrq>='"+fromDate+"' and u.ksrq<= '"+toDate+"') as zlxs,(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts,(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts,(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm,(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm,(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle " +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle,a.companystartdate ";
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
sqlWhere += " and 1=2 ";
|
||||
}
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+groupBy+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by t.dsporder asc, t.lastname asc ";
|
||||
String descOrderBy = " order by t.dsporder desc, t.lastname desc ";
|
||||
|
||||
//默认排序设置 start,有性能问题,先取消,后面再看看有没有好的方式
|
||||
// String orderBySql = "select * from kq_report_order where userId=? and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql, user.getUID());
|
||||
// if (rs.getCounts() <= 0) {
|
||||
// orderBySql = "select * from kq_report_order where userId=0 and sort=1 order by orders";
|
||||
// rs.executeQuery(orderBySql);
|
||||
// }
|
||||
// while (rs.next()) {
|
||||
// String dataIndex = rs.getString("dataIndex");
|
||||
// String ascOrDesc = rs.getString("ascOrDesc");
|
||||
// String ascOrDesc1 = (ascOrDesc.equals("")||ascOrDesc.equals("asc"))?"desc":"asc";
|
||||
// if (dataIndex.equals("organization")) {
|
||||
// orderBy += ",showOrderOfDeptTree " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += ",showOrderOfDeptTree " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// }
|
||||
// if (dataIndex.equalsIgnoreCase("dspOrder") || dataIndex.equalsIgnoreCase("lastName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("deptShowOrder") || dataIndex.equalsIgnoreCase("deptName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",dept_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",dept_id " + ascOrDesc1;
|
||||
// } else if (dataIndex.equalsIgnoreCase("subcomShowOrder") || dataIndex.equalsIgnoreCase("subcomName")) {
|
||||
// orderBy += "," + dataIndex + " " + ascOrDesc + ",subcom_id " + ascOrDesc;
|
||||
// descOrderBy += "," + dataIndex + " " + ascOrDesc1 + ",subcom_id " + ascOrDesc1;
|
||||
// }
|
||||
// }
|
||||
// orderBy = orderBy.startsWith(",") ? orderBy.substring(1) : orderBy;
|
||||
// descOrderBy = descOrderBy.startsWith(",") ? descOrderBy.substring(1) : descOrderBy;
|
||||
// orderBy = orderBy.equals("") ? " t.dspOrder,t.id " : orderBy;
|
||||
// descOrderBy = descOrderBy.equals("") ? " t.dspOrder,t.id " : descOrderBy;
|
||||
// orderBy = "order by "+orderBy;
|
||||
|
||||
sql = backFields + sqlFrom + sqlWhere + groupBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select * from (select " + sql+") t "+orderBy;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " +pageSize + " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql + orderBy+ " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql+orderBy;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
|
||||
|
||||
bb.writeLog("getKqReportCmd:"+sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
String id = rs.getString("id");
|
||||
data.put("resourceId",id);
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1"))continue;
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if(fieldName.equals("subcompany")){
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if(tmpSubcompanyId.length()==0){
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
data.put("subcompanyId",tmpSubcompanyId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
}else if(fieldName.equals("department")){
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if(tmpDepartmentId.length()==0){
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
data.put("departmentId",tmpDepartmentId);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
}else if(fieldName.equals("jobtitle")){
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if(tmpJobtitleId.length()==0){
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
data.put("jobtitleId",tmpJobtitleId);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
}else if(fieldName.equals("cdfz")){
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins"));
|
||||
fieldValue = beLateMins;
|
||||
}else if(fieldName.equals("ztfz")){
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins"));
|
||||
fieldValue = graveBeLateMins;
|
||||
}else if(fieldName.equals("xcqts")){
|
||||
String xcqtsDays = getXcqts(fromDate,id);
|
||||
fieldValue = xcqtsDays;
|
||||
}else if(fieldName.equals("attendanceSerial")){
|
||||
List<String> serialIds = null;
|
||||
if(attendanceSerial.length()>0){
|
||||
serialIds = Util.splitString2List(attendanceSerial,",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
if(fieldName.equals("overtimeTotal")){
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
}else{
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id+"|"+fieldName)));
|
||||
}
|
||||
} else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if(Util.null2String(kqReportFieldComInfo.getUnittype()).length()>0) {
|
||||
if(fieldValue.length() == 0){
|
||||
fieldValue="0";
|
||||
}else{
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
data.put(fieldName,fieldValue);
|
||||
}
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for(int i=0;allLeaveRules!=null&&i<allLeaveRules.size();i++){
|
||||
leaveRule = (Map<String, Object>)allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_"+leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id+"|"+flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_"+leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+flowLeaveBackType)),"0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(leaveData.length() == 0){
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if(leavebackData.length() == 0){
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if(b_flowLeaveData.length() > 0){
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
}else{
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0)));
|
||||
}
|
||||
data.put(flowType,flowLeaveData);
|
||||
}
|
||||
|
||||
Map<String,Object> detialDatas = kqReportBiz.getDetialDatas(id,fromDate,toDate,user,flowData,false,uintType,show_card_source);
|
||||
// new KQLog().info("id:"+id+":detialDatas:"+detialDatas);
|
||||
isEnd = false;
|
||||
for(String date=fromDate; !isEnd;) {
|
||||
if(date.equals(toDate)) isEnd = true;
|
||||
if(DateUtil.compDate(today, date)>0){
|
||||
data.put(date,"");
|
||||
}else{
|
||||
// new KQLog().info("id:date:"+(id+"|"+date)+":detialDatas.get:"+detialDatas.get(id+"|"+date));
|
||||
data.put(date,detialDatas.get(id+"|"+date)==null?SystemEnv.getHtmlLabelName(26593, user.getLanguage()):detialDatas.get(id+"|"+date));
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("attendanceSerial")){//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if(Util.null2String(jsonObj.get("attendanceSerial")).length()>0){
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")),",");
|
||||
}
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
column = new HashMap();
|
||||
column.put("title", kqShiftManagementComInfo.getSerial(serialIds.get(i)));
|
||||
column.put("unit", "");
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", serialIds.get(i));
|
||||
column.put("key", serialIds.get(i));
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return lsChildColumns;
|
||||
}
|
||||
Map<String,Object> column = null;
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 1);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
column.put("isSystem", kqReportFieldComInfo.getIsSystem());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lsChildColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getXcqts(String dateOri,String userId){
|
||||
//本月第一天
|
||||
String fromDate = TimeUtil.getMonthBeginDay(dateOri);
|
||||
//本月最后一天
|
||||
String toDate = TimeUtil.getMonthEndDay(dateOri);
|
||||
Set<String> all = new HashSet<>();
|
||||
all.add(fromDate);
|
||||
List<String> back = days(fromDate,toDate);
|
||||
all.addAll(back);
|
||||
all.add(toDate);
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//需出勤天数
|
||||
Integer xcqtsAll = 0;
|
||||
//考勤组大小周A
|
||||
String dxzA = bb.getPropValue("jgKq_main","dxzA");
|
||||
//考勤组大小周B
|
||||
String dxzB = bb.getPropValue("jgKq_main","dxzB");
|
||||
String rykqz = getCusFieldData(Integer.valueOf(userId),"field31",3);
|
||||
|
||||
for (String date : all) {
|
||||
KQHolidaySetComInfo holidaySetComInfo = new KQHolidaySetComInfo();
|
||||
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
|
||||
/*获取考勤组的ID,因为考勤组有有效期,所以需要传入日期*/
|
||||
String groupId = kqGroupMemberComInfo.getKQGroupId(userId, date);
|
||||
String changeTypeNew = holidaySetComInfo.getChangeType(groupId, date);
|
||||
String rzlxZdy = findRqlx(userId,date);
|
||||
//日期类型,0是工作日、1是周六、2是周日
|
||||
Integer rqlx = -1;
|
||||
if("0".equals(rzlxZdy)){
|
||||
rqlx = 0;
|
||||
}else if("1".equals(rzlxZdy)){
|
||||
rqlx = 1;
|
||||
}else if("2".equals(rzlxZdy)){
|
||||
rqlx = 2;
|
||||
}else if(DateUtil.getWeek(date) == 6){
|
||||
rqlx = 1;
|
||||
}else if(DateUtil.getWeek(date) == 7){
|
||||
rqlx = 2;
|
||||
}else {
|
||||
rqlx = 0;
|
||||
}
|
||||
Integer xcqts = 0;
|
||||
if("4".equals(rykqz)){
|
||||
//单休判断是不是周日,是的话不计
|
||||
if(rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}else if ("8".equals(rykqz)){
|
||||
//双休判断是不是周六周日,是的话不计
|
||||
if(rqlx == 1 || rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}else if(dxzA.equals(rykqz) || dxzB.equals(rykqz)){
|
||||
//双休判断是不是周六周日,是的话不计
|
||||
if(rqlx == 2){
|
||||
xcqts = 0;
|
||||
}else if (rqlx == 1){
|
||||
//周六是工作日的话计
|
||||
if("2".equals(changeTypeNew)){
|
||||
xcqts = 1;
|
||||
}else{
|
||||
xcqts = 0;
|
||||
}
|
||||
}else{
|
||||
xcqts = 1;
|
||||
}
|
||||
}
|
||||
xcqtsAll = xcqtsAll+xcqts;
|
||||
}
|
||||
|
||||
return String.valueOf(xcqtsAll);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取两个日期之间所有的日期
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList days(String date1, String date2) {
|
||||
String dateFormat = "yyyy-MM-dd";
|
||||
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
ArrayList L = new ArrayList();
|
||||
if (date1.equals(date2)) {
|
||||
System.out.println("两个日期相等!");
|
||||
return L;
|
||||
}
|
||||
|
||||
String tmp;
|
||||
if (date1.compareTo(date2) > 0) { // 确保 date1的日期不晚于date2
|
||||
tmp = date1;
|
||||
date1 = date2;
|
||||
date2 = tmp;
|
||||
}
|
||||
|
||||
tmp = format.format(str2Date(date1).getTime() + 3600 * 24 * 1000);
|
||||
|
||||
int num = 0;
|
||||
while (tmp.compareTo(date2) < 0) {
|
||||
L.add(tmp);
|
||||
num++;
|
||||
tmp = format.format(str2Date(tmp).getTime() + 3600 * 24 * 1000);
|
||||
}
|
||||
|
||||
if (num == 0)
|
||||
System.out.println("两个日期相邻!");
|
||||
return L;
|
||||
}
|
||||
|
||||
private static Date str2Date(String str) {
|
||||
String dateFormat = "yyyy-MM-dd";
|
||||
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
return format.parse(str);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义日期类型判断
|
||||
* @param userId
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String findRqlx(String userId,String date){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select rqlx from uf_rqzdygs where CONCAT(xm,',') like('%"+userId+",%') and rq = '"+date+"'";
|
||||
rs.executeQuery(sql);
|
||||
String rqlx = "-1";
|
||||
if(rs.next()){
|
||||
rqlx = Util.null2String(rs.getString("rqlx"));
|
||||
}
|
||||
return StringUtils.isBlank(rqlx)?"-1":rqlx;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义字段的值
|
||||
* @param id
|
||||
* @param fieldname
|
||||
* @param scopeid
|
||||
* @return
|
||||
*/
|
||||
public static String getCusFieldData(Integer id,String fieldname,int scopeid){
|
||||
String fieldVal = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select "+fieldname+" from cus_fielddata where id=? and scopeid=? and scope='HrmCustomFieldByInfoType' ";
|
||||
rs.executeQuery(sql,id,scopeid);
|
||||
if(rs.next()){
|
||||
fieldVal = Util.null2String(rs.getString(fieldname));
|
||||
}
|
||||
return fieldVal;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,471 @@
|
|||
package weaver.interfaces.jgkq.action;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.kq.biz.KQReportBiz;
|
||||
import com.engine.kq.service.KQReportService;
|
||||
import com.engine.kq.service.impl.KQReportServiceImpl;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.BatchRecordSet;
|
||||
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.interfaces.schedule.BaseCronJob;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* 考勤每月汇总信息生成
|
||||
* @Auther: chenxu
|
||||
* @Date: 2024/05/28/14:03
|
||||
* @Description:
|
||||
*/
|
||||
public class KqBaseInfoCreateEveryMonth extends BaseCronJob {
|
||||
|
||||
static String dateFormat = "yyyy-MM-dd";
|
||||
static SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
|
||||
private KQReportService getService(User user) {
|
||||
return (KQReportService) ServiceUtil.getService(KQReportServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
new BaseBean();
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
bb.writeLog("考勤每月汇总信息生成!!!");
|
||||
String fromDate = TimeUtil.getDateByOption("3", "0");
|
||||
String toDate = fromDate.substring(0,7)+"-31";
|
||||
try {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
User userLcc = new User(1);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("reportType","month");
|
||||
Map<String, Object> paramsData = new HashMap<String, Object>();
|
||||
paramsData.put("pageIndex",0);
|
||||
paramsData.put("typeselect","3");
|
||||
paramsData.put("viewScope","0");
|
||||
paramsData.put("status","9");
|
||||
paramsData.put("isNoAccount","1");
|
||||
paramsData.put("attendanceSerial","");
|
||||
params.put("data",JSONObject.toJSONString(paramsData));
|
||||
apidatas = getService(userLcc).getKQReport(params, userLcc);
|
||||
// bb.writeLog("apidatas:"+JSONObject.toJSONString(apidatas));
|
||||
JSONArray jsonArray = JSON.parseArray(Util.null2String(JSONObject.toJSONString(apidatas.get("datas"))));
|
||||
bb.writeLog("jsonArray:"+JSONObject.toJSONString(jsonArray));
|
||||
for (Iterator<Object> iterator = jsonArray.iterator(); iterator.hasNext(); ) {
|
||||
List<List<Object>> lsParams = new ArrayList<>();
|
||||
List<List<Object>> lsDelParams = new ArrayList<>();
|
||||
JSONObject next = (JSONObject) iterator.next();
|
||||
//人员id
|
||||
String resourceId = next.getString("resourceId");
|
||||
//编号
|
||||
String workcode = next.getString("workcode");
|
||||
//岗位
|
||||
String jobtitleId = next.getString("jobtitleId");
|
||||
//部门
|
||||
String departmentId = next.getString("departmentId");
|
||||
//应出勤天数
|
||||
String workdays = next.getString("workdays");
|
||||
//应工作时长
|
||||
String workmins = next.getString("workmins");
|
||||
//实际出勤天数
|
||||
String attendancedays = next.getString("attendancedays");
|
||||
//实际工作时长
|
||||
String attendanceMins = next.getString("attendanceMins");
|
||||
//迟到次数
|
||||
String beLate = next.getString("beLate");
|
||||
//迟到时长
|
||||
String beLateMins = next.getString("beLateMins");
|
||||
//严重迟到
|
||||
String graveBeLate = next.getString("graveBeLate");
|
||||
//严重迟到时长
|
||||
String graveBeLateMins = next.getString("graveBeLateMins");
|
||||
//早退
|
||||
String leaveEearly = next.getString("leaveEearly");
|
||||
//早退时长
|
||||
String leaveEarlyMins = next.getString("leaveEarlyMins");
|
||||
//严重早退
|
||||
String graveLeaveEarly = next.getString("graveLeaveEarly");
|
||||
//严重早退时长
|
||||
String graveLeaveEarlyMins = next.getString("graveLeaveEarlyMins");
|
||||
//缺勤
|
||||
String absenteeism = next.getString("absenteeism");
|
||||
//缺勤时长
|
||||
String absenteeismMins = next.getString("absenteeismMins");
|
||||
//漏签
|
||||
String forgotCheck = next.getString("forgotCheck");
|
||||
//夜班次数
|
||||
String ybcs = next.getString("ybts");
|
||||
//事假
|
||||
String sj = next.getString("leaveType_5");
|
||||
//病假
|
||||
String dxbj = next.getString("leaveType_12");
|
||||
//调休假
|
||||
String txpsjb = next.getString("leaveType_2");
|
||||
//休息登记
|
||||
String xxdj = next.getString("leaveType_4");
|
||||
//婚假
|
||||
String hj = next.getString("leaveType_6");
|
||||
//丧假
|
||||
String sangj = next.getString("leaveType_7");
|
||||
//工伤假
|
||||
String gsj = next.getString("leaveType_8");
|
||||
//哺乳假
|
||||
String brj = next.getString("leaveType_3");
|
||||
//孕检假
|
||||
String yjj = next.getString("leaveType_9");
|
||||
//产假
|
||||
String canj = next.getString("leaveType_10");
|
||||
//陪产假
|
||||
String pcj = next.getString("leaveType_11");
|
||||
//出差
|
||||
String cc = next.getString("businessLeave");
|
||||
//年假
|
||||
String nianj = next.getString("leaveType_13");
|
||||
|
||||
//一级部门
|
||||
String yjbm = next.getString("yjbm");
|
||||
//二级部门
|
||||
String ejbm = next.getString("ejbm");
|
||||
//三级部门
|
||||
String sjbm = next.getString("sjbm");
|
||||
//四级部门
|
||||
String sijbm = next.getString("sijbm");
|
||||
//工作时长
|
||||
String gzsc = next.getString("gzsc");
|
||||
//工作日加班
|
||||
String psjbsc = next.getString("psjbsc");
|
||||
//周六白天
|
||||
String zlbtjb = next.getString("zlbtjb");
|
||||
//周六晚上
|
||||
String zlwsjb = next.getString("zlwsjb");
|
||||
//周日白天
|
||||
String zrbtjb = next.getString("zrbtjb");
|
||||
//周日晚上
|
||||
String zrwsjb = next.getString("zrwsjb");
|
||||
//有薪假天数
|
||||
String yxjts = next.getString("yxjts");
|
||||
//节假日天数
|
||||
String jjrts = next.getString("jjrts");
|
||||
//直落小时
|
||||
String zlxs = next.getString("zlxs");
|
||||
|
||||
bb.writeLog("userId:"+resourceId+"workdays:"+workdays);
|
||||
|
||||
List<Object> par = new ArrayList<>();
|
||||
List<Object> parDel = new ArrayList<>();
|
||||
par.add(resourceId);
|
||||
par.add(workcode);
|
||||
par.add(jobtitleId);
|
||||
par.add(departmentId);
|
||||
par.add(workdays);
|
||||
par.add(workmins);
|
||||
|
||||
|
||||
par.add(attendancedays);
|
||||
par.add(attendanceMins);
|
||||
par.add(beLate);
|
||||
par.add(beLateMins);
|
||||
par.add(graveBeLate);
|
||||
par.add(graveBeLateMins);
|
||||
par.add(leaveEearly);
|
||||
par.add(leaveEarlyMins);
|
||||
par.add(graveLeaveEarly);
|
||||
par.add(graveLeaveEarlyMins);
|
||||
|
||||
par.add(absenteeism);
|
||||
par.add(absenteeismMins);
|
||||
par.add(forgotCheck);
|
||||
par.add(ybcs);
|
||||
par.add(sj);
|
||||
par.add(dxbj);
|
||||
par.add(txpsjb);
|
||||
par.add(xxdj);
|
||||
par.add(hj);
|
||||
par.add(sangj);
|
||||
|
||||
par.add(gsj);
|
||||
par.add(brj);
|
||||
par.add(yjj);
|
||||
par.add(canj);
|
||||
par.add(pcj);
|
||||
par.add(cc);
|
||||
par.add(yjbm);
|
||||
par.add(ejbm);
|
||||
par.add(sjbm);
|
||||
par.add(sijbm);
|
||||
|
||||
par.add(gzsc);
|
||||
par.add(psjbsc);
|
||||
par.add(zlbtjb);
|
||||
par.add(zlwsjb);
|
||||
par.add(zrbtjb);
|
||||
par.add(zrwsjb);
|
||||
par.add(yxjts);
|
||||
par.add(jjrts);
|
||||
par.add(zlxs);
|
||||
//年月
|
||||
String ny = fromDate.substring(0,7);
|
||||
par.add(ny);
|
||||
//入职日期
|
||||
String rzrq = findRzrq(resourceId);
|
||||
//转正日期
|
||||
String zzrq = getField18(resourceId);
|
||||
//离职日期
|
||||
String lzrq = getField82(resourceId);
|
||||
par.add(rzrq);
|
||||
par.add(zzrq);
|
||||
par.add(lzrq);
|
||||
//人员状态
|
||||
String ryzt = getStatus(resourceId);
|
||||
par.add(ryzt);
|
||||
//考勤月
|
||||
String kqy = ny+"-01";
|
||||
par.add(kqy);
|
||||
par.add(nianj);
|
||||
|
||||
parDel.add(resourceId);
|
||||
parDel.add(ny);
|
||||
lsDelParams.add(parDel);
|
||||
|
||||
BatchRecordSet bRs = new BatchRecordSet();
|
||||
bb.writeLog("开始同步数据");
|
||||
bb.writeLog("lsDelParams:"+JSON.toJSONString(lsDelParams));
|
||||
|
||||
String sql = "";
|
||||
//删除本次同步数据
|
||||
sql = " delete from uf_kqhzbx where xm = ? and ny = ?";
|
||||
bRs.executeBatchSql(sql, lsDelParams);
|
||||
|
||||
int modeid = getFormModeIdByCubeName("uf_kqhzbx");
|
||||
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdfTime = new SimpleDateFormat("HH:mm:ss");
|
||||
String modedatacreatedate = sdfDate.format(new Date());
|
||||
String modedatacreatetime = sdfTime.format(new Date());
|
||||
|
||||
par.add(modeid);
|
||||
par.add(resourceId);
|
||||
par.add("0");
|
||||
par.add(modedatacreatedate);
|
||||
par.add(modedatacreatetime);
|
||||
lsParams.add(par);
|
||||
|
||||
sql = " insert into uf_kqhzbx (xm, bh, gw, bm, ycqtst, ygzscxs, " +
|
||||
"sjcqtst,sjgzscxs,cdc,cdscxs,yzcdc,yzcdscxs,ztc,ztscxs,yzztc,yzztscxs," +
|
||||
"qqc,qqscxs,lqc,ybcsc,sjxs,bjt,dxjt,xxdjt,hjt,sjt," +
|
||||
"gsjt,brjxs,yjjt,cjt,pcjt,cct,yjbm,ejbm,sjbm,sijbm," +
|
||||
"gzsc,gzrjb,zlbtjb,zlwsjb,zrbtjb,zrwsjb,yxjts,jjrts,zlxs,ny," +
|
||||
"rzrq,zzrq,lzrq,ryzt,kqy,njxs,FORMMODEID,MODEDATACREATER,MODEDATACREATERTYPE,MODEDATACREATEDATE,MODEDATACREATETIME) "
|
||||
+ " values(?,?,?,?,?,?," +
|
||||
"?,?,?,?,?,?,?,?,?,?," +
|
||||
"?,?,?,?,?,?,?,?,?,?," +
|
||||
"?,?,?,?,?,?,?,?,?,?," +
|
||||
"?,?,?,?,?,?,?,?,?,?," +
|
||||
"?,?,?,?,?,?,?,?,?,?,?)";
|
||||
bRs.executeBatchSql(sql,lsParams);
|
||||
|
||||
String idNew = "";
|
||||
RecordSet findNew = new RecordSet();
|
||||
String sqlFindnew ="select Id from uf_kqhzbx where xm = "+resourceId+" and ny = '"+ny+"' order by" +
|
||||
" modedatacreatedate desc,modedatacreatetime desc";
|
||||
findNew.execute(sqlFindnew);
|
||||
bb.writeLog("findSqlNew:"+sqlFindnew);
|
||||
if (findNew.next()){
|
||||
idNew = Util.null2String(findNew.getString("id"));
|
||||
}
|
||||
bb.writeLog("idNew:"+idNew);
|
||||
// 权限重构
|
||||
int dataId = Integer.valueOf(idNew);
|
||||
ModeRightInfo modeRightInfo = new ModeRightInfo();
|
||||
modeRightInfo.editModeDataShare(Integer.valueOf(resourceId), modeid, dataId);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
bb.writeLog(e);
|
||||
bb.writeLog("新入职员工当天打卡数据生成--error"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据建模表名获取formModeId
|
||||
*
|
||||
* @param cubeName 建模表明
|
||||
* @return int formModeId
|
||||
*/
|
||||
private static int getFormModeIdByCubeName(String cubeName) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select t1.id from modeinfo t1\n" +
|
||||
" left join workflow_bill t2\n" +
|
||||
" on t1.formid=t2.id\n" +
|
||||
" where t2.tablename='" + cubeName + "'");
|
||||
rs.next();
|
||||
return rs.getInt("id");
|
||||
}
|
||||
|
||||
/**
|
||||
* 找到人员入职日期
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String findRzrq(String jbr) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select id,companystartdate from hrmresource where id ="+jbr;
|
||||
rs.executeQuery(sql);
|
||||
String companystartdate = "";
|
||||
if (rs.next()) {
|
||||
companystartdate = Util.null2String(rs.getString("companystartdate"));
|
||||
}
|
||||
return companystartdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取转正日期
|
||||
* @param userid
|
||||
* @return
|
||||
*/
|
||||
private static String getField18(String userid){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select field18 from cus_fielddata where id = "+userid+" and scope = 'HrmCustomFieldByInfoType' and scopeid = 3";
|
||||
rs.executeQuery(sql);
|
||||
String field18 = "";
|
||||
if (rs.next()){
|
||||
field18 = Util.null2String(rs.getString("field18"));
|
||||
}
|
||||
return field18;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取离职日期
|
||||
* @param userid
|
||||
* @return
|
||||
*/
|
||||
private static String getField82(String userid){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select field82 from cus_fielddata where id = "+userid+" and scope = 'HrmCustomFieldByInfoType' and scopeid = 3";
|
||||
rs.executeQuery(sql);
|
||||
String field82 = "";
|
||||
if (rs.next()){
|
||||
field82 = Util.null2String(rs.getString("field82"));
|
||||
}
|
||||
return field82;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人员状态
|
||||
* @param userid
|
||||
* @return
|
||||
*/
|
||||
private static String getStatus(String userid){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select status from hrmresource where id = "+userid;
|
||||
rs.executeQuery(sql);
|
||||
String status = "";
|
||||
if (rs.next()){
|
||||
status = Util.null2String(rs.getString("status"));
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String fromDate = TimeUtil.getDateByOption("3", "0");
|
||||
String toDate = fromDate.substring(0,7)+"-31";
|
||||
Map<String, Object> detialDatas = new HashMap<>();
|
||||
Map<String, Object> detialOvtimeDatas = new HashMap<>();
|
||||
detialDatas.put("432|2024-06-02","0.0");
|
||||
detialDatas.put("432|2024-06-01","0.0");
|
||||
boolean isEnd = false;
|
||||
List<Object> data = new ArrayList<>();
|
||||
String today = DateUtil.getCurrentDate();
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
List<String> all = new ArrayList<>();
|
||||
all.add(fromDate);
|
||||
List<String> back = days(fromDate,toDate);
|
||||
all.addAll(back);
|
||||
all.add(toDate);
|
||||
for(String date:all){
|
||||
if (DateUtil.compDate(today, date) > 0) {
|
||||
data.add("");
|
||||
} else {
|
||||
if (detialDatas.get("432" + "|" + date) != null) {
|
||||
double atttime = Util.getDoubleValue((String) detialDatas.get("432" + "|" + date),0);
|
||||
if(detialOvtimeDatas.get("432" + "|" + date) !=null ){
|
||||
atttime += (double) detialOvtimeDatas.get("432" + "|" + date);
|
||||
}
|
||||
data.add(atttime);
|
||||
} else {
|
||||
data.add("other");
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("dataText:"+JSONObject.toJSONString(data));
|
||||
List<Object> par = new ArrayList<>();
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
par.add(data.get(i));
|
||||
}
|
||||
System.out.println(par.toString());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取两个日期之间所有的日期
|
||||
* @param date1
|
||||
* @param date2
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList days(String date1, String date2) {
|
||||
ArrayList L = new ArrayList();
|
||||
if (date1.equals(date2)) {
|
||||
System.out.println("两个日期相等!");
|
||||
return L;
|
||||
}
|
||||
|
||||
String tmp;
|
||||
if (date1.compareTo(date2) > 0) { // 确保 date1的日期不晚于date2
|
||||
tmp = date1;
|
||||
date1 = date2;
|
||||
date2 = tmp;
|
||||
}
|
||||
|
||||
tmp = format.format(str2Date(date1).getTime() + 3600 * 24 * 1000);
|
||||
|
||||
int num = 0;
|
||||
while (tmp.compareTo(date2) < 0) {
|
||||
L.add(tmp);
|
||||
num++;
|
||||
tmp = format.format(str2Date(tmp).getTime() + 3600 * 24 * 1000);
|
||||
}
|
||||
|
||||
if (num == 0)
|
||||
System.out.println("两个日期相邻!");
|
||||
return L;
|
||||
}
|
||||
|
||||
private static Date str2Date(String str) {
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
return format.parse(str);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
import {
|
||||
WeaTools
|
||||
} from 'ecCom'
|
||||
|
||||
export const getHasRight = (params) => {
|
||||
return WeaTools.callApi('/api/kq/originalpunchrp/getHasRight', 'GET', params);
|
||||
}
|
||||
|
||||
export const getMenus = (params) => {
|
||||
return WeaTools.callApi('/api/kq/originalpunchrp/getRightMenu', 'GET', params);
|
||||
}
|
||||
|
||||
export const getSearchCondition = (params) => {
|
||||
return WeaTools.callApi('/api/kq/originalpunchrp/getSearchCondition', 'GET', params);
|
||||
}
|
||||
|
||||
export const getSearchList = (params) => {
|
||||
return WeaTools.callApi('/api/kq/originalpunchrp/getSearchList', 'GET', params);
|
||||
}
|
||||
|
||||
export const exportExcel = (params) => {
|
||||
return WeaTools.callApi('/api/kq/originalpunchrp/exportExcel', 'POST', params);
|
||||
}
|
||||
|
||||
export const upSignCard = (params) => {
|
||||
return WeaTools.callApi('/api/kqcustom/util/upSignCard', 'POST', params);
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.engine.hrm.cmd.teamportrait;
|
||||
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.hrm.util.HrmTeamPortraitUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 团队画像
|
||||
*/
|
||||
public class GetComprehensiveExperienceCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public GetComprehensiveExperienceCmd(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) {
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
Map<String, Object> data = new HashMap();//data数据
|
||||
List lsData = new ArrayList();//返回的datas数据
|
||||
Map<String, Object> root = new HashMap();//返回的root数据
|
||||
Map<String, Object> rootdata = new HashMap();//返回的root数据
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
HrmTeamPortraitUtil hrmTeamPortraitUtil = new HrmTeamPortraitUtil();
|
||||
String sqlWhere = hrmTeamPortraitUtil.getParamSqlWhere(params);
|
||||
|
||||
int personCount = 0;
|
||||
int workyear010 = 0;
|
||||
int workyear1120 = 0;
|
||||
int workyear2130 = 0;
|
||||
int workyear3140 = 0;
|
||||
sql = " select workyear,companyworkyear from hrmresource where status in (0,1,2,3) " + sqlWhere;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
double workyear = rs.getDouble("workyear")<=0?rs.getDouble("companyworkyear"):rs.getDouble("workyear");
|
||||
if (workyear > 0 && workyear <= 10) {
|
||||
workyear010++;
|
||||
} else if (workyear > 10 && workyear <= 20) {
|
||||
workyear1120++;
|
||||
} else if (workyear > 20 && workyear <= 30) {
|
||||
workyear2130++;
|
||||
} else if (workyear > 30 && workyear <= 40) {
|
||||
workyear3140++;
|
||||
}
|
||||
}
|
||||
personCount = workyear010 + workyear1120 + workyear2130 + workyear3140;
|
||||
data = new HashMap<>();
|
||||
data.put("item", "0-10");
|
||||
data.put("count", workyear010);
|
||||
data.put("totalcount", personCount);
|
||||
data.put("percent", personCount > 0 ? df.format(workyear010 / (personCount * 1.0)) : "0");
|
||||
lsData.add(data);
|
||||
|
||||
data = new HashMap<>();
|
||||
data.put("item", "11-20");
|
||||
data.put("count", workyear1120);
|
||||
data.put("totalcount", personCount);
|
||||
data.put("percent", personCount > 0 ? df.format(workyear1120 / (personCount * 1.0)) : "0");
|
||||
lsData.add(data);
|
||||
|
||||
data = new HashMap<>();
|
||||
data.put("item", "21-30");
|
||||
data.put("count", workyear2130);
|
||||
data.put("totalcount", personCount);
|
||||
data.put("percent", personCount > 0 ? df.format(workyear2130 / (personCount * 1.0)) : "0");
|
||||
lsData.add(data);
|
||||
|
||||
data = new HashMap<>();
|
||||
data.put("item", "31-40");
|
||||
data.put("count", workyear3140);
|
||||
data.put("totalcount", personCount);
|
||||
data.put("percent", personCount > 0 ? df.format(workyear3140 / (personCount * 1.0)) : "0");
|
||||
lsData.add(data);
|
||||
|
||||
rootdata.put("data", lsData);
|
||||
root.put("root", rootdata);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
return root;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,208 @@
|
|||
import React, {
|
||||
Component
|
||||
} from 'react';
|
||||
import {
|
||||
observer
|
||||
} from 'mobx-react';
|
||||
import {
|
||||
WeaDialog,
|
||||
WeaTable,
|
||||
WeaTab,
|
||||
WeaSelect
|
||||
} from 'ecCom';
|
||||
import {
|
||||
Button,message
|
||||
} from 'antd';
|
||||
import {
|
||||
WeaTableNew
|
||||
} from 'comsMobx';
|
||||
import {
|
||||
i18n
|
||||
} from '../../../public/i18n';
|
||||
import { addContentPath } from '../../../util/index.js'
|
||||
import * as apis from '../../../apis/dailyReport.js'
|
||||
|
||||
@observer
|
||||
export default class Detail extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
export = () => {
|
||||
const {
|
||||
store
|
||||
} = this.props;
|
||||
const {
|
||||
detailTable
|
||||
} = store;
|
||||
detailTable.exportAll();
|
||||
}
|
||||
|
||||
getNewColumns = (columns) => {
|
||||
let newColumns = [...columns]
|
||||
|
||||
newColumns = newColumns.map(i => {
|
||||
if (i.dataIndex === 'KQstatus') {
|
||||
i.render = (text, record) => {
|
||||
let {KQstatus,signfrom,signTime,signDate,signfromtext} = record
|
||||
const {detailParams} = this.props.store
|
||||
const {resourceId,kqDate} = detailParams
|
||||
|
||||
if(signTime === '未打卡'){
|
||||
return <div></div>
|
||||
}
|
||||
|
||||
const selectBoxStyle = {
|
||||
display:'flex',
|
||||
padding:'10px 0px',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
}
|
||||
|
||||
return <div style={selectBoxStyle}>
|
||||
<Button type="primary" onClick={()=>{
|
||||
const params = {
|
||||
userId:resourceId,
|
||||
kqDate:signDate,
|
||||
kqTime:signTime,
|
||||
signFrom:signfromtext,
|
||||
isIncom: '0'
|
||||
}
|
||||
|
||||
apis.upSignCard(params).then((res) => {
|
||||
if (res.status == '1') {
|
||||
message.success(res.msg)
|
||||
} else {
|
||||
message.error(res.msg)
|
||||
}
|
||||
})
|
||||
}}>失效</Button>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
return i
|
||||
})
|
||||
|
||||
|
||||
return newColumns;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
store
|
||||
} = this.props;
|
||||
const {
|
||||
dialogParams,
|
||||
detailTable,
|
||||
detail,
|
||||
hasOnlyTable,
|
||||
handleDetailTabChange,
|
||||
} = store, {
|
||||
userInfo,
|
||||
signInfo,
|
||||
columns,
|
||||
datas,
|
||||
tableStore,
|
||||
tabDatas,
|
||||
selectedKey,
|
||||
} = detail;
|
||||
|
||||
const generateDialogParams = () => {
|
||||
const props = {
|
||||
...dialogParams
|
||||
};
|
||||
let buttons = []; //[<Button type='primary' op='save' onClick={this.export}>{i18n.label.export()}</Button>];
|
||||
Object.assign(props, {
|
||||
buttons,
|
||||
moreBtn: {
|
||||
datas: store.convertToMenus(buttons)
|
||||
},
|
||||
})
|
||||
return props;
|
||||
}
|
||||
|
||||
const UserInfo = props => {
|
||||
const {
|
||||
userInfo
|
||||
} = props, {
|
||||
messagerurl,
|
||||
shortname,
|
||||
shiftInfo,
|
||||
lastname,
|
||||
schedual
|
||||
} = userInfo;
|
||||
|
||||
return (
|
||||
<div className='daily-userInfo'>
|
||||
<div className='daily-userInfo-avatar'>
|
||||
<img src={addContentPath(messagerurl)} alt={shortname} />
|
||||
</div>
|
||||
<div className='daily-userInfo-brief'>
|
||||
<p>{lastname}</p>
|
||||
<p>
|
||||
<span>{shiftInfo}</span>
|
||||
<span>{schedual}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const SignInfo = props => {
|
||||
const {
|
||||
signInfo
|
||||
} = props;
|
||||
|
||||
return <p className='daily-signInfo'>{signInfo}</p>
|
||||
}
|
||||
|
||||
const DetailTable = props => {
|
||||
const {
|
||||
columns,
|
||||
datas
|
||||
} = props;
|
||||
const newColumns = this.getNewColumns(columns)
|
||||
|
||||
return (<div className='daily-detail'>
|
||||
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@6q9a90`}
|
||||
bordered
|
||||
columns={newColumns}
|
||||
dataSource={datas}
|
||||
pagination={false}
|
||||
scroll={{ y: 300 }}
|
||||
/>
|
||||
</div>)
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@ki9ac9`} {...generateDialogParams()}>
|
||||
{
|
||||
hasOnlyTable ? (
|
||||
<div>
|
||||
{
|
||||
tabDatas.length > 0 && (
|
||||
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@61ghdp`} datas={tabDatas} keyParam='key' selectedKey={selectedKey} onChange={handleDetailTabChange} />
|
||||
)
|
||||
}
|
||||
<WeaTableNew.WeaTable ecId={`${this && this.props && this.props.ecId || ''}_undefined@cq5s2z`}
|
||||
comsWeaTableStore={tableStore}
|
||||
hasOrder
|
||||
needScroll
|
||||
scroll={{ y: 360 }}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<UserInfo ecId={`${this && this.props && this.props.ecId || ''}_UserInfo@q8gq3x`} userInfo={userInfo} />
|
||||
<SignInfo ecId={`${this && this.props && this.props.ecId || ''}_SignInfo@962uet`} signInfo={signInfo} />
|
||||
<DetailTable ecId={`${this && this.props && this.props.ecId || ''}_DetailTable@0outj5`} columns={columns} datas={datas} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</WeaDialog>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package weaver.hrm.pm.action;
|
||||
|
||||
import com.engine.hrm.util.face.HrmFaceCheckManager;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import weaver.common.StringUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.common.DbFunctionUtil;
|
||||
import weaver.hrm.tools.HrmDateCheck;
|
||||
import weaver.rtx.OrganisationCom;
|
||||
import weaver.system.SysRemindWorkflow;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
/**
|
||||
* 人员转正
|
||||
* @author wcd
|
||||
* @version 1.0 2015-07-07
|
||||
*/
|
||||
public class HrmResourceHireAction extends PmAction {
|
||||
|
||||
protected int todo() {
|
||||
return HRM_RESOURCE_HIRE;
|
||||
}
|
||||
|
||||
protected void parse() throws Exception {
|
||||
Date newdate = new Date();
|
||||
long datetime = newdate.getTime();
|
||||
Timestamp timestamp = new Timestamp(datetime);
|
||||
String CurrentDate = (timestamp.toString()).substring(0, 4) + "-" + (timestamp.toString()).substring(5, 7) + "-" + (timestamp.toString()).substring(8, 10);
|
||||
|
||||
String id = StringUtil.vString(rsdt.getString("resource_n"));
|
||||
String name = StringUtil.vString(rsdt.getString("hrmLastname"));
|
||||
String oldjobtitleid = StringUtil.vString(rsdt.getString("hrmJobtitle"));
|
||||
String changedate = StringUtil.vString(rsdt.getString("hiredate"));
|
||||
String changereason = StringUtil.vString(rsdt.getString("hirereason"));
|
||||
String infoman = StringUtil.vString(rsdt.getString("pmanager"));
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeSql("select id from hrmresource where status in (0,2,3) and id="+id);
|
||||
if(!rs.next()){
|
||||
this.reqManager.setMessagecontent(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(538079,weaver.general.ThreadVarLanguage.getLang())+"");
|
||||
throw new Exception("人员不是试用、临时或试用延期状态,无法转正!");
|
||||
}
|
||||
|
||||
if (!new HrmDateCheck().hasStatueChanged(id, changedate)) {
|
||||
}else{
|
||||
this.reqManager.setMessagecontent(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10003659,weaver.general.ThreadVarLanguage.getLang())+"");
|
||||
throw new Exception("人员状态变更无效,在变更日期之后已经有变更操作!");
|
||||
}
|
||||
|
||||
String para = id + separator + changedate + separator + changereason + separator + infoman + separator + oldjobtitleid + separator + "2" + separator + creater;
|
||||
RecordSet rss = new RecordSet();
|
||||
rs.executeProc("HrmResource_Hire", para);
|
||||
|
||||
String subject = "", title = "", remark = "";
|
||||
if (!infoman.equals("")) {
|
||||
subject = SystemEnv.getHtmlLabelName(16120, user.getLanguage());
|
||||
subject += ":" + name;
|
||||
title = SystemEnv.getHtmlLabelName(16120, user.getLanguage());
|
||||
title += ":" + name;
|
||||
title += "-" + createrName;
|
||||
title += "-" + currentDate;
|
||||
if (request.getRequestManager().isComeE9()) {
|
||||
remark = "<a href='"+weaver.general.GCONST.getContextPath()+"/spa/hrm/index_mobx.html#/main/hrm/card/cardInfo/" + id + "'>" + Util.fromScreen2(subject, user.getLanguage()) + "</a><br>" + SystemEnv.getHtmlLabelName(454, user.getLanguage()) + ":" + changereason;
|
||||
} else {
|
||||
remark = "<a href='"+weaver.general.GCONST.getContextPath()+"/hrm/resource/HrmResource.jsp?id=" + id + "'>" + Util.fromScreen2(subject, user.getLanguage()) + "</a><br>" + SystemEnv.getHtmlLabelName(454, user.getLanguage()) + ":" + changereason;
|
||||
}
|
||||
RemindWorkflowThreadUtil.remindWorkflowPool.submit(new RemindWorkflowThread(title, 0, creater, infoman, remark));
|
||||
}
|
||||
|
||||
if (Util.dayDiff(currentDate, changedate) <= 1) {
|
||||
if (!new HrmDateCheck().hasStatueChanged(id, changedate)) {
|
||||
rs.executeSql("update HrmResource set status = 1,lastmoddate='"+CurrentDate+"',lastmodid='"+creater+"' where id = " + id);
|
||||
rs.executeSql("update HrmStatusHistory set isdispose = 1 where id = (select max(id) from HrmStatusHistory)");
|
||||
|
||||
//更新人员最后修改日期
|
||||
String sqla = "update hrmresource set " + DbFunctionUtil.getUpdateSetSql(rss.getDBType(), creater) + " where id = ? ";
|
||||
rss = new RecordSet();
|
||||
rss.executeUpdate(sqla, id);
|
||||
|
||||
HrmFaceCheckManager.sync(id,HrmFaceCheckManager.getOptUpdate(),this.getClass().getName(),HrmFaceCheckManager.getOaResource());
|
||||
}else{
|
||||
this.reqManager.setMessagecontent(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10003659,weaver.general.ThreadVarLanguage.getLang())+"");
|
||||
throw new Exception("人员状态变更无效,在变更日期之后已经有变更操作!");
|
||||
}
|
||||
}
|
||||
new OrganisationCom().checkUser(Integer.parseInt(id));
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,644 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.UtilKQ;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.common.StringUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect = Util.null2String(jsonObj.get("typeselect"));
|
||||
if (typeselect.length() == 0) typeselect = "3";
|
||||
if (!typeselect.equals("") && !typeselect.equals("0") && !typeselect.equals("6")) {
|
||||
if (typeselect.equals("1")) {
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
} else {
|
||||
fromDate = TimeUtil.getDateByOption(typeselect, "0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect, "1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")), ",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("1", "" + user.getUID(), "a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String, Object>> constraintList = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (Util.null2String(kqReportFieldComInfo.getParentid()).length() > 0) continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))
|
||||
continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width", 30 * 256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(), user);
|
||||
childColumns = (List<Object>) mapChildColumnInfo.get("childColumns");
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
} else {
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
|
||||
titleList.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if (DateUtil.compDate(today, toDate) > 0) {//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// }
|
||||
|
||||
if(showColumns.contains("kqCalendar")) {
|
||||
childColumns = new ArrayList<>();
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
title = new HashMap<>();
|
||||
title.put("title", UtilKQ.getWeekDayShort(DateUtil.getWeek(date)-1,user.getLanguage()) +"\r\n"+ DateUtil.geDayOfMonth(date));
|
||||
title.put("width", 30 * 256);
|
||||
childColumns.add(title);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
title = new HashMap();
|
||||
title.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
String backFields = " a.companystartdate,(select sum(gxbts) as gxbts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gxbts,(select sum(xchu) as xcqts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xcqts,(select sum(jjrbtjia*60) as jjrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrbtjb,(select sum(jjrdksc*60) as jjrdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrdksc,(select sum(xxb) as xxb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xxb,(select sum(zrbtjbzdx*60) as zrbtjbztx from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjbztx,(select sum(gzsc) as gzsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gzsc,(select sum(psjbshic*60) as psjbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as psjbsc,(select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc," +
|
||||
"(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb," +
|
||||
"(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb," +
|
||||
"(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and u.ksrq>='"+fromDate+"' and u.ksrq<= '"+toDate+"') as zlxs," +
|
||||
"(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts," +
|
||||
"(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts," +
|
||||
"(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle,a.companystartdate ";
|
||||
if (subCompanyId.length() > 0) {
|
||||
sqlWhere += " and a.subcompanyid1 in(" + subCompanyId + ") ";
|
||||
}
|
||||
|
||||
if (departmentId.length() > 0) {
|
||||
sqlWhere += " and a.departmentid in(" + departmentId + ") ";
|
||||
}
|
||||
|
||||
if (resourceId.length() > 0) {
|
||||
sqlWhere += " and a.id in(" + resourceId + ") ";
|
||||
}
|
||||
|
||||
if (viewScope.equals("4")) {//我的下属
|
||||
if (allLevel.equals("1")) {//所有下属
|
||||
sqlWhere += " and a.managerstr like '%," + user.getUID() + ",%'";
|
||||
} else {
|
||||
sqlWhere += " and a.managerid=" + user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select " + backFields + sqlFrom + sqlWhere + groupBy + orderBy;
|
||||
|
||||
//System.out.println("start" + DateUtil.getFullDate());
|
||||
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String, Object> flowData = new KQReportBiz().getFlowData(params, user);
|
||||
//System.out.println("end" + DateUtil.getFullDate());
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if (tmpSubcompanyId.length() == 0) {
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if (tmpDepartmentId.length() == 0) {
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
} else if(fieldName.equals("cdfz")){
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins"));
|
||||
fieldValue = beLateMins;
|
||||
}else if(fieldName.equals("ztfz")){
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins"));
|
||||
fieldValue = graveBeLateMins;
|
||||
}else if (fieldName.equals("jobtitle")) {
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if (tmpJobtitleId.length() == 0) {
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if (fieldName.equals("attendanceSerial")) {
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.add(kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else{
|
||||
data.add("");
|
||||
}
|
||||
continue;
|
||||
} else if (fieldName.equals("leave")) {//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.add(flowLeaveData);
|
||||
}
|
||||
continue;
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
} else if(Util.null2String(kqReportFieldComInfo.getCascadekey(fieldid)).length()>0){
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
|
||||
List<String> lsCascadekey = Util.splitString2List(kqReportFieldComInfo.getCascadekey(fieldid),",");
|
||||
for(int i=0;i<lsCascadekey.size();i++){
|
||||
if(Util.null2String(rs.getString(lsCascadekey.get(i))).length()>0){
|
||||
fieldid = KQReportFieldComInfo.field2Id.get(lsCascadekey.get(i));
|
||||
fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)),kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}else{
|
||||
fieldValue = "0";
|
||||
}
|
||||
data.add(fieldValue);
|
||||
}
|
||||
continue;
|
||||
}else {
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
fieldValue = Util.formatMultiLang(fieldValue,""+user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
if(showColumns.contains("kqCalendar")) {
|
||||
// Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true);
|
||||
Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true,uintType,show_card_source);
|
||||
isEnd = false;
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
if (DateUtil.compDate(today, date) > 0) {
|
||||
data.add("");
|
||||
} else {
|
||||
if (detialDatas.get(id + "|" + date) != null) {
|
||||
data.add(((Map<String, Object>) detialDatas.get(id + "|" + date)).get("text"));
|
||||
} else {
|
||||
data.add(SystemEnv.getHtmlLabelName(26593, user.getLanguage()));
|
||||
}
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
}
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList", constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390351, user.getLanguage())+" "+fromDate+" "+toDate;
|
||||
workbook.put("fileName", fileName);
|
||||
ExcelUtil ExcelUtil = new ExcelUtil();
|
||||
Map<String, Object> exportMap = ExcelUtil.export(workbook, request, response,true);
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String, Object> getChildColumnsInfo(String parentid, User user) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if (parentid.equals("attendanceSerial")) {//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
}
|
||||
for (int i = 0; serialIds != null && i < serialIds.size(); i++) {
|
||||
title = new HashMap<>();
|
||||
title.put("title", Util.formatMultiLang(kqShiftManagementComInfo.getSerial(serialIds.get(i)),""+user.getLanguage()));
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
} else if (parentid.equals("leave")) {
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for (int i = 0; leaveRules != null && i < leaveRules.size(); i++) {
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
String unitName = (KQUnitBiz.isLeaveHour(unitType)) ? SystemEnv.getHtmlLabelName(391, user.getLanguage()) : SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
title = new HashMap<>();
|
||||
title.put("title", name + "(" + unitName + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else {
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns", titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return titleList;
|
||||
}
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
title = new HashMap<>();
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
return titleList;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,749 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kq.log.KQLog;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.PageUidFactory;
|
||||
import java.math.BigDecimal;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private KQLog kqLog = new KQLog();
|
||||
|
||||
public GetKQDailyReportCmd(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 pageUid = PageUidFactory.getHrmPageUid("KQDailyReport");
|
||||
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("2",""+user.getUID(),"a");
|
||||
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect =Util.null2String(jsonObj.get("typeselect"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
|
||||
if(typeselect.equals("1")){
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
}else{
|
||||
fromDate = TimeUtil.getDateByOption(typeselect,"0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect,"1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
if(typeselect.length()==0)typeselect = "3";
|
||||
int pageIndex = Util.getIntValue(Util.null2String(jsonObj.get("pageIndex")), 1);
|
||||
int pageSize = KQReportBiz.getPageSize(Util.null2String(jsonObj.get("pageSize")),pageUid,user.getUID());
|
||||
int count = 0;
|
||||
int pageCount = 0;
|
||||
int isHavePre = 0;
|
||||
int isHaveNext = 0;
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
List<Object> columns = new ArrayList();
|
||||
Map<String,Object> column = null;
|
||||
List<Object> datas = new ArrayList();
|
||||
Map<String,Object> data = null;
|
||||
Map<String,Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue;
|
||||
boolean isDaily = kqReportFieldComInfo.getReportType().equals("daily");
|
||||
if(!kqReportFieldComInfo.getReportType().equals("all") && !isDaily)continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(),user);
|
||||
childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("rowSpan", 1);
|
||||
column.put("width", mapChildColumnInfo.get("sumChildColumnWidth"));
|
||||
column.put("children", childColumns);
|
||||
}else{
|
||||
column.put("rowSpan", 3);
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
}
|
||||
if(kqReportFieldComInfo.getReportType1().equals("daily")){
|
||||
column.put("isdaily", "1");
|
||||
}
|
||||
column.put("showDetial",kqReportFieldComInfo.getShowDetial());
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
// String today = DateUtil.getCurrentDate();
|
||||
// if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// if(DateUtil.compDate(today, fromDate)>0){
|
||||
// fromDate = today;
|
||||
// }
|
||||
// }
|
||||
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")&&!Util.null2String(rs.getOrgindbtype()).equals("jc")) {
|
||||
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " ifnull(b.forgotBeginWorkCheck,0) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
|
||||
}
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
|
||||
|
||||
String backFields = "(select xxb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as xxb,(select zrbtjbzdx*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjbztx,(select gzsc from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as gzsc,(select psjbshic*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as psjbsc,b.kqdate as xqNew,b.kqdate as rqNew,(select cb from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as cb,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlzbsc,(select zrbtdksj*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtdksc,(select zlbtdksc*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtdksc," +
|
||||
"(select zrwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrwsjb,(select zlwsjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlwsjb,(select zrbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zrbtjb," +
|
||||
"(select zlbtjb*60 from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zlbtjb,(select sum(sch*60) from uf_lbjbsq where sqr = a.id and ksrq = b.kqdate) as zlxs," +
|
||||
"(select ybts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as ybts,(select jjrts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as jjrts," +
|
||||
"(select yxjts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as yxjts,(select zcgzts from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as zcgzts," +
|
||||
"(select bkcs from uf_gshsj u where u.xm = a.id and u.rq = b.kqdate) as bkcs,(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm,(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm,(select sum(sch*60) from uf_jbsqhz where sqr = a.id and ksrq = b.kqdate and jblx in (0,1,2,3)) as jbsq," +
|
||||
"a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
|
||||
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
|
||||
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
|
||||
" b.signdays,b.signmins,b.cardOvertime, "+
|
||||
" b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism ,b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
|
||||
String sqlWhere = rightSql;
|
||||
if(subCompanyId.length()>0){
|
||||
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
|
||||
}
|
||||
|
||||
if(departmentId.length()>0){
|
||||
sqlWhere +=" and a.departmentid in("+departmentId+") ";
|
||||
}
|
||||
|
||||
if(resourceId.length()>0){
|
||||
sqlWhere +=" and a.id in("+resourceId+") ";
|
||||
}
|
||||
|
||||
if(viewScope.equals("4")){//我的下属
|
||||
if(allLevel.equals("1")){//所有下属
|
||||
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
|
||||
}else{
|
||||
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
|
||||
}
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
//考勤异常状态
|
||||
String KQstatus = Util.null2String(jsonObj.get("KQstatus"));
|
||||
if ("5".equals(KQstatus)){
|
||||
|
||||
}else if ("1".equals(KQstatus)){
|
||||
sqlWhere += " and (absenteeismMins > 0 or forgotCheck > 0) ";
|
||||
}else if ("2".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0) ";
|
||||
}else if ("3".equals(KQstatus)){
|
||||
sqlWhere += " and (b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0) ";
|
||||
}else if ("4".equals(KQstatus)){
|
||||
sqlWhere +=" and forgotCheck > 0 ";
|
||||
}else if ("6".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins = 0 and b.graveBeLateMins = 0 and b.leaveEarlyMins = 0 and b.graveLeaveEarlyMins = 0 and absenteeismMins = 0 and forgotCheck = 0)";
|
||||
}else if ("7".equals(KQstatus)){
|
||||
sqlWhere += " and (b.beLateMins > 0 or b.graveBeLateMins > 0 or b.leaveEarlyMins > 0 or b.graveLeaveEarlyMins > 0 or absenteeismMins > 0 or forgotCheck > 0)";
|
||||
}
|
||||
|
||||
sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+") t";
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
count = rs.getInt("c");
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
pageCount = 0;
|
||||
}
|
||||
|
||||
pageCount = count / pageSize + ((count % pageSize > 0) ? 1 : 0);
|
||||
|
||||
isHaveNext = (pageIndex + 1 <= pageCount) ? 1 : 0;
|
||||
|
||||
isHavePre = (pageIndex - 1 >= 1) ? 1 : 0;
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc, b.kqdate asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc, b.kqdate desc ";
|
||||
sql = backFields + sqlFrom + sqlWhere + orderBy;
|
||||
|
||||
if (pageIndex > 0 && pageSize > 0) {
|
||||
if (rs.getDBType().equals("oracle")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= "
|
||||
+ (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize);
|
||||
} else if (rs.getDBType().equals("mysql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize;
|
||||
}
|
||||
else if (rs.getDBType().equals("postgresql")) {
|
||||
sql = " select " + sql;
|
||||
sql = "select t1.* from (" + sql + ") t1 limit " + pageSize+ " offset " + ((pageIndex - 1) * pageSize);
|
||||
}
|
||||
else {
|
||||
orderBy = " order by dsporder asc, lastname asc, kqdate asc ";
|
||||
descOrderBy = " order by dsporder desc, lastname desc, kqdate desc ";
|
||||
if (pageIndex > 1) {
|
||||
int topSize = pageSize;
|
||||
if (pageSize * pageIndex > count) {
|
||||
topSize = count - (pageSize * (pageIndex - 1));
|
||||
}
|
||||
sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top "
|
||||
+ (pageIndex * pageSize) + sql+" ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy;
|
||||
} else {
|
||||
sql = " select top " + pageSize + sql;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sql = " select " + sql;
|
||||
}
|
||||
boolean isneedcal = KQSettingsBiz.getKqformatAccurate();
|
||||
params.put("isneedcal",isneedcal?"1":"0");
|
||||
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
|
||||
Map<String,String> serialdata = new HashMap<>();
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String id = rs.getString("id");
|
||||
String kqdate = rs.getString("kqdate");
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(id, kqdate);
|
||||
data = new HashMap<>();
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1")) continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("daily"))
|
||||
continue;
|
||||
String fieldName = kqReportFieldComInfo.getFieldname();
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String fieldValueID = rs.getString("subcompanyid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
//fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getSubCompanyID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(fieldValueID, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String fieldValueID = rs.getString("departmentid");
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
//fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getDepartmentID(id);
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(fieldValueID, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(fieldValueID);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("jobtitle")) {
|
||||
String fieldValueID = rs.getString("jobtitle");
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle"));
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValueID = resourceComInfo.getJobTitle(id);
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(fieldValueID);
|
||||
}
|
||||
data.put(fieldName + "Id", fieldValueID);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("cardOvertime")) {
|
||||
fieldValue = Util.null2String(rs.getString("cardOvertime"));
|
||||
Double zlMinsNew = Util.getDoubleValue(fieldValue);
|
||||
String skjbcsy = divide(String.valueOf(changeBxs(zlMinsNew.intValue())),"60");
|
||||
fieldValue = skjbcsy;
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("xqNew")) {
|
||||
fieldValue = Util.null2String(rs.getString("xqNew"));
|
||||
fieldValue = dateWeekday(fieldValue);
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (kqReportFieldComInfo.getParentid().equals("overtime") || kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|
||||
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
|
||||
if (fieldName.equals("overtimeTotal")) {
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave < 0 ? 0 : restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave < 0 ? 0 : holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave < 0 ? 0 : workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave < 0 ? 0 : restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave < 0 ? 0 : holidayOvertime_nonleave;
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
|
||||
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
|
||||
} else {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
} else if (fieldName.equals("serialid")) {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (fieldValue.length()>0) {//弹性工作制没有班次
|
||||
// data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage()));
|
||||
|
||||
if(null != serialdata && serialdata.containsKey(fieldValue)){
|
||||
data.put("serialid", serialdata.get(fieldValue));
|
||||
}else{
|
||||
String tmpserialname = shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage());
|
||||
serialdata.put(fieldValue,tmpserialname);
|
||||
data.put("serialid", tmpserialname);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
fieldValue = Util.null2String(rs.getString(fieldName));
|
||||
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
data.put(fieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
data.putAll(this.getSignDetailInfo(id, kqdate));
|
||||
|
||||
//请假
|
||||
List<Map<String, Object>> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = (Map<String, Object>) allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
kqLog.info("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
//考虑下冻结的数据
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.put(flowType, flowLeaveData);
|
||||
}
|
||||
|
||||
data.put("resourceId", id);
|
||||
data.put("kqdate", kqdate);
|
||||
datas.add(data);
|
||||
}
|
||||
|
||||
List<Object> lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate);
|
||||
retmap.put("holidays", lsHolidays);
|
||||
retmap.put("columns",columns);
|
||||
retmap.put("datas",datas);
|
||||
retmap.put("pagesize", pageSize);
|
||||
retmap.put("pageindex", pageIndex);
|
||||
retmap.put("count", count);
|
||||
retmap.put("pagecount", pageCount);
|
||||
retmap.put("ishavepre", isHavePre);
|
||||
retmap.put("ishavenext", isHaveNext);
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
private String getUnitType(String unitType, User user){
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
return unitTypeName;
|
||||
}
|
||||
|
||||
private Map<String,Object> getChildColumnsInfo(String parentid, User user){
|
||||
Map<String,Object> returnMap = new HashMap<>();
|
||||
List<Object> lsChildColumns = new ArrayList<>();
|
||||
Map column = null;
|
||||
int sumChildColumnWidth = 0;
|
||||
if(parentid.equals("leave")){
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for(int i=0;leaveRules!=null&&i<leaveRules.size();i++){
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String id = "leaveType_"+Util.null2String(leaveRule.get("id"));
|
||||
String name = Util.null2String(leaveRule.get("name"));
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
column = new HashMap();
|
||||
column.put("title", name);
|
||||
column.put("unit", KQUnitBiz.isLeaveHour(unitType) ?SystemEnv.getHtmlLabelName(391, user.getLanguage()):SystemEnv.getHtmlLabelName(1925, user.getLanguage()));
|
||||
column.put("width", 65);
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("showDetial","1");
|
||||
sumChildColumnWidth+=65;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
column = new HashMap();
|
||||
String fieldlabel = "";
|
||||
column.put("unit", "");
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
column.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
column.put("unit", unitTypeName);
|
||||
}
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
column.put("dataIndex", id);
|
||||
column.put("key", id);
|
||||
column.put("rowSpan", 1);
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
column.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
column.put("width", childWidth+"");
|
||||
sumChildColumnWidth+=childWidth;
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}else{
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()){
|
||||
if(kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
|
||||
column = new HashMap();
|
||||
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
|
||||
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
|
||||
column.put("dataIndex", kqReportFieldComInfo.getFieldname());
|
||||
column.put("key", kqReportFieldComInfo.getFieldname());
|
||||
column.put("rowSpan", 2);
|
||||
column.put("colSpan", 1);
|
||||
column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily")?"1":"0");
|
||||
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
|
||||
lsChildColumns.add(column);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns",lsChildColumns);
|
||||
returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getSignDetailInfo(String resourceId, String kqDate){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String,Object> signStatusInfo = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
|
||||
try{
|
||||
sql = " select kqdate,resourceid,day_type,serialid,serialnumber,workbegindate,workbegintime, " +
|
||||
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
|
||||
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
|
||||
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
|
||||
" from kq_format_detail b \n" +
|
||||
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
|
||||
" order by serialnumber \n";
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
String serialid = Util.null2String(rs.getString("serialid"));
|
||||
String dayType = Util.null2s(rs.getString("day_type"),"");
|
||||
int workMins = rs.getInt("workMins");
|
||||
boolean isNonWork = false;
|
||||
if(dayType.length() > 0){
|
||||
if("holiday".equals(dayType) || "playday".equals(dayType)){
|
||||
isNonWork = true;
|
||||
}
|
||||
if(serialid.length() == 0){
|
||||
//弹性班制,会存在dayType是work但是没有班次的情况
|
||||
isNonWork = true;
|
||||
}
|
||||
}else{
|
||||
if(workMins<=0){
|
||||
isNonWork = true;
|
||||
}else{
|
||||
if(serialid.length() > 0){
|
||||
String isRest = Util.null2s(kqShiftManagementComInfo.getIsRest(serialid),"");
|
||||
if("1".equals(isRest)){
|
||||
isNonWork = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int serialnumber = rs.getInt("serialnumber")+1;
|
||||
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
|
||||
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
|
||||
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
|
||||
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
|
||||
String signintime = Util.null2String(rs.getString("signintime")).trim();
|
||||
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
|
||||
int attendanceMins = rs.getInt("attendanceMins");
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
|
||||
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
|
||||
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
|
||||
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
|
||||
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
|
||||
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
|
||||
String signinid = Util.null2String(rs.getString("signinid")).trim();
|
||||
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
|
||||
int leaveMins = rs.getInt("leaveMins");
|
||||
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
|
||||
int evectionMins = rs.getInt("evectionMins");
|
||||
int outMins = rs.getInt("outMins");
|
||||
|
||||
|
||||
if(!isNonWork){
|
||||
if (workbegintime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workbegindate);
|
||||
signStatusInfo.put("worktime",workbegintime);
|
||||
signStatusInfo.put("beLateMins",beLateMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
|
||||
if (workendtime.length() > 0) {
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("workdate",workenddate);
|
||||
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
|
||||
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
|
||||
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
|
||||
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
|
||||
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
|
||||
signStatusInfo.put("absenteeismMins",absenteeismMins);
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
if(workMins>0){
|
||||
//弹性工时打卡时间取自签到签退数据
|
||||
}
|
||||
signStatusInfo = new HashMap();
|
||||
signStatusInfo.put("leaveMins",leaveMins);
|
||||
signStatusInfo.put("leaveInfo",leaveInfo);
|
||||
signStatusInfo.put("evectionMins",evectionMins);
|
||||
signStatusInfo.put("outMins",outMins);
|
||||
|
||||
if(signinid.length() > 0){
|
||||
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
if(signoutid.length() > 0){
|
||||
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
|
||||
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
|
||||
}
|
||||
}else{
|
||||
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
writeLog(e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期返回星期
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String dateWeekday(String date) {
|
||||
Calendar calendar = TimeUtil.getCalendar(date) ;
|
||||
if(calendar == null) return "" ;
|
||||
Integer num = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
String xqName = "";
|
||||
switch (num){
|
||||
case 0:
|
||||
xqName = "星期日";
|
||||
break;
|
||||
case 1:
|
||||
xqName = "星期一";
|
||||
break;
|
||||
case 2:
|
||||
xqName = "星期二";
|
||||
break;
|
||||
case 3:
|
||||
xqName = "星期三";
|
||||
break;
|
||||
case 4:
|
||||
xqName = "星期四";
|
||||
break;
|
||||
case 5:
|
||||
xqName = "星期五";
|
||||
break;
|
||||
case 6:
|
||||
xqName = "星期六";
|
||||
break;
|
||||
}
|
||||
|
||||
return xqName ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 半小时转换
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static Integer changeBxs(Integer value){
|
||||
return (value / 30)*30 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的除法运算。
|
||||
* @param v1 被加数
|
||||
* @param v2 加数
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static String divide(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.divide(b2,2,BigDecimal.ROUND_HALF_UP).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
|
||||
package weaver.interfaces.jgkq.action;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.hrm.service.OrganizationService;
|
||||
import com.engine.hrm.service.impl.OrganizationServiceImpl;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import com.engine.kq.biz.KQFormatBiz;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 事假改休息登记Action
|
||||
*/
|
||||
public class LeaveTypeChangeAction implements Action {
|
||||
|
||||
static String dateFormat = "yyyy-MM-dd";
|
||||
static SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
|
||||
public OrganizationService getOrganizationService(User user) {
|
||||
return ServiceUtil.getService(OrganizationServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public LeaveTypeChangeAction() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo info) {
|
||||
new BaseBean();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("事假改休息登记Action进入");
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rsUpdate = new RecordSet();
|
||||
String reqid = info.getRequestid();
|
||||
try {
|
||||
String findSql = "select id,belongdate,newleavetype from kq_flow_split_leave where requestid = "+reqid;
|
||||
rs.execute(findSql);
|
||||
List<String> ids = new ArrayList<>();
|
||||
while (rs.next()){
|
||||
//全称
|
||||
String idLeave = Util.null2String(rs.getString("id"));
|
||||
String belongdate = Util.null2String(rs.getString("belongdate"));
|
||||
String newleavetype = Util.null2String(rs.getString("newleavetype"));
|
||||
String resourceid = Util.null2String(rs.getString("resourceid"));
|
||||
bb.writeLog("idLeave:"+idLeave+"belongdate:"+belongdate+"newleavetype:"+newleavetype+"resourceid:"+resourceid);
|
||||
if("5".equals(newleavetype) && DateUtil.getWeek(belongdate) == 6){
|
||||
//如果是事假并且是周六,需要改成休息登记
|
||||
ids.add(idLeave);
|
||||
}
|
||||
}
|
||||
if(ids.size()>0){
|
||||
String updateSql = "update kq_flow_split_leave set newleavetype = 4 where id in ("+ StringUtils.join(ids,",")+")";
|
||||
bb.writeLog("updateSql:"+updateSql);
|
||||
rsUpdate.executeUpdate(updateSql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
bb.writeLog(e);
|
||||
bb.writeLog("事假改休息登记error" + e.getMessage());
|
||||
info.getRequestManager().setMessageid("2000");
|
||||
info.getRequestManager().setMessagecontent("事假改休息登记error");
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,15 @@
|
|||
package com.api.jf.controller;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Title ecology-9
|
||||
* @Company 泛微软件
|
||||
* @CreateDate 2024/7/19
|
||||
* @Description
|
||||
* @Author AdminZm
|
||||
*/
|
||||
@Path("/jf/common")
|
||||
public class JfCommonController extends com.engine.jf.controller.JfCommonController {
|
||||
}
|
||||
|
|
@ -0,0 +1,644 @@
|
|||
package com.engine.kq.cmd.report;
|
||||
|
||||
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.*;
|
||||
import com.engine.kq.util.ExcelUtil;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import com.engine.kq.util.UtilKQ;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.common.StringUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
private List<String> lsFieldDataKey;
|
||||
|
||||
public ExportExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
this.lsFieldDataKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
new KQReportBiz().insertKqReportExportLog(params, user);
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
|
||||
String fromDate = Util.null2String(jsonObj.get("fromDate"));
|
||||
String toDate = Util.null2String(jsonObj.get("toDate"));
|
||||
String typeselect = Util.null2String(jsonObj.get("typeselect"));
|
||||
if (typeselect.length() == 0) typeselect = "3";
|
||||
if (!typeselect.equals("") && !typeselect.equals("0") && !typeselect.equals("6")) {
|
||||
if (typeselect.equals("1")) {
|
||||
fromDate = TimeUtil.getCurrentDateString();
|
||||
toDate = TimeUtil.getCurrentDateString();
|
||||
} else {
|
||||
fromDate = TimeUtil.getDateByOption(typeselect, "0");
|
||||
toDate = TimeUtil.getDateByOption(typeselect, "1");
|
||||
}
|
||||
}
|
||||
//人员状态
|
||||
String status = Util.null2String(jsonObj.get("status"));
|
||||
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(jsonObj.get("departmentId"));
|
||||
String resourceId = Util.null2String(jsonObj.get("resourceId"));
|
||||
String allLevel = Util.null2String(jsonObj.get("allLevel"));
|
||||
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
|
||||
String viewScope = Util.null2String(jsonObj.get("viewScope"));
|
||||
List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")), ",");
|
||||
showColumns.add("lastname");
|
||||
showColumns.removeIf(showColumn->showColumn.trim().equals(""));
|
||||
|
||||
List<String> tmpShowColumns = new ArrayList<>();
|
||||
for(String showColumn:showColumns){
|
||||
tmpShowColumns.add(showColumn);
|
||||
String cascadekey = "";
|
||||
if(showColumn.equals("beLate")){
|
||||
cascadekey = "beLateMins";
|
||||
}else if(showColumn.equals("leaveEearly")){
|
||||
cascadekey = "leaveEarlyMins";
|
||||
}else if(showColumn.equals("graveBeLate")){
|
||||
cascadekey = "graveBeLateMins";
|
||||
}else if(showColumn.equals("graveLeaveEarly")){
|
||||
cascadekey = "graveLeaveEarlyMins";
|
||||
}else if(showColumn.equals("absenteeism")){
|
||||
cascadekey = "absenteeismMins";
|
||||
}else if(showColumn.equals("overtime")){
|
||||
tmpShowColumns.add("overtime_4leave");
|
||||
tmpShowColumns.add("overtime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_nonleave");
|
||||
tmpShowColumns.add("workingDayOvertime_4leave");
|
||||
tmpShowColumns.add("restDayOvertime_nonleave");
|
||||
tmpShowColumns.add("restDayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_4leave");
|
||||
tmpShowColumns.add("holidayOvertime_nonleave");
|
||||
}
|
||||
if(cascadekey.length()>0){
|
||||
tmpShowColumns.add(cascadekey);
|
||||
}
|
||||
}
|
||||
showColumns = tmpShowColumns;
|
||||
|
||||
String rightSql = new KQReportBiz().getReportRight("1", "" + user.getUID(), "a");
|
||||
|
||||
LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
|
||||
List<Object> lsSheet = new ArrayList<>();
|
||||
Map<String, Object> sheet = null;
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
List<Object> data = null;
|
||||
List<Map<String, Object>> constraintList = null;
|
||||
|
||||
sheet = new HashMap<>();
|
||||
sheet.put("sheetName", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
sheet.put("sheetTitle", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
|
||||
boolean isEnd = false;
|
||||
Calendar cal = DateUtil.getCalendar();
|
||||
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> mapChildColumnInfo = null;
|
||||
List<Object> childColumns = null;
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (Util.null2String(kqReportFieldComInfo.getParentid()).length() > 0) continue;
|
||||
if(kqReportFieldComInfo.getFieldname().equals("kqCalendar"))continue;
|
||||
if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue;
|
||||
if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))
|
||||
continue;
|
||||
if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
|
||||
if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
|
||||
continue;
|
||||
}
|
||||
title = new HashMap<>();
|
||||
String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
|
||||
if(unitType.length()>0){
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
|
||||
}else{
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
|
||||
}
|
||||
title.put("width", 30 * 256);
|
||||
this.lsFieldDataKey.add(kqReportFieldComInfo.getFieldname());
|
||||
mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(), user);
|
||||
childColumns = (List<Object>) mapChildColumnInfo.get("childColumns");
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
} else {
|
||||
title.put("rowSpan", 3);
|
||||
}
|
||||
titleList.add(title);
|
||||
|
||||
titleList.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user));
|
||||
}
|
||||
|
||||
String today = DateUtil.getCurrentDate();
|
||||
// if (DateUtil.compDate(today, toDate) > 0) {//结束如期不大于今天
|
||||
// toDate = today;
|
||||
// }
|
||||
|
||||
if(showColumns.contains("kqCalendar")) {
|
||||
childColumns = new ArrayList<>();
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
title = new HashMap<>();
|
||||
title.put("title", UtilKQ.getWeekDayShort(DateUtil.getWeek(date)-1,user.getLanguage()) +"\r\n"+ DateUtil.geDayOfMonth(date));
|
||||
title.put("width", 30 * 256);
|
||||
childColumns.add(title);
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
|
||||
title = new HashMap();
|
||||
title.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
|
||||
if (childColumns.size() > 0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
title.put("colSpan", childColumns.size());
|
||||
}
|
||||
titleList.add(title);
|
||||
}
|
||||
sheet.put("titleList", titleList);
|
||||
|
||||
// 没有权限的人最大只支持查询本季
|
||||
Map<String, String> getRealDate = new KQReportBiz().realDate(fromDate, toDate, user, "1");
|
||||
fromDate = getRealDate.get("fromDate");
|
||||
toDate = getRealDate.get("toDate");
|
||||
if("-1".equals(fromDate) || "-1".equals(toDate)) {
|
||||
retmap.put("status", "1");
|
||||
return retmap;
|
||||
}
|
||||
|
||||
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
|
||||
|
||||
if(rs.getDBType().equalsIgnoreCase("oracle")) {
|
||||
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
|
||||
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
|
||||
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}else {
|
||||
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
|
||||
}
|
||||
|
||||
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
|
||||
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
|
||||
BaseBean bb = new BaseBean();
|
||||
//一级部门字段
|
||||
String yjbm = bb.getPropValue("jgKq_main","yjbm");
|
||||
//二级部门字段
|
||||
String ejbm = bb.getPropValue("jgKq_main","ejbm");
|
||||
//三级部门字段
|
||||
String sjbm = bb.getPropValue("jgKq_main","sjbm");
|
||||
//四级部门字段
|
||||
String sijbm = bb.getPropValue("jgKq_main","sijbm");
|
||||
String backFields = " (select sum(gxbts) as gxbts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gxbts,(select sum(xchu) as xcqts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xcqts,(select sum(jjrbtjia*60) as jjrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrbtjb,(select sum(jjrdksc*60) as jjrdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrdksc,(select sum(xxb) as xxb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as xxb,(select sum(zrbtjbzdx*60) as zrbtjbztx from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjbztx,(select sum(gzsc) as gzsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as gzsc,(select sum(psjbshic*60) as psjbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as psjbsc,(select sum(cb) as cb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as cb,(select sum(zlbtdksc*60) as zlzbsc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlzbsc,(select sum(zrbtdksj*60) as zrbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtdksc," +
|
||||
"(select sum(zlbtdksc*60) as zlbtdksc from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtdksc," +
|
||||
"(select sum(zrwsjb*60) as zrwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrwsjb," +
|
||||
"(select sum(zlwsjb*60) as zlwsjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlwsjb," +
|
||||
"(select sum(zrbtjb*60) as zrbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zrbtjb," +
|
||||
"(select sum(zlbtjb*60) as zlbtjb from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zlbtjb," +
|
||||
"(select sum(sch*60) as zlxs from uf_lbjbsq u where u.sqr = a.id and u.ksrq>='"+fromDate+"' and u.ksrq<= '"+toDate+"') as zlxs," +
|
||||
"(select sum(ybts) as ybts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as ybts," +
|
||||
"(select sum(jjrts) as jjrts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as jjrts," +
|
||||
"(select sum(yxjts) as yxjts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as yxjts," +
|
||||
"(select sum(zcgzts) as zcgzts from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as zcgzts," +
|
||||
"(select sum(bkcs) as bkcs from uf_gshsj u where u.xm = a.id and u.rq>='"+fromDate+"' and u.rq<= '"+toDate+"') as bkcs," +
|
||||
"(select "+sijbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sijbm," +
|
||||
"(select "+sjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as sjbm," +
|
||||
"(select "+ejbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as ejbm," +
|
||||
"(select "+yjbm+" from cus_fielddata cu where scope='HrmCustomFieldByInfoType' and scopeid=-1 and cu.id = a.id) as yjbm," +
|
||||
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," +
|
||||
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
|
||||
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
|
||||
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
|
||||
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
|
||||
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
|
||||
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
|
||||
" sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
|
||||
if(rs.getDBType().equals("oracle")){
|
||||
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
|
||||
}
|
||||
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'";
|
||||
String sqlWhere = rightSql;
|
||||
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
|
||||
if (subCompanyId.length() > 0) {
|
||||
sqlWhere += " and a.subcompanyid1 in(" + subCompanyId + ") ";
|
||||
}
|
||||
|
||||
if (departmentId.length() > 0) {
|
||||
sqlWhere += " and a.departmentid in(" + departmentId + ") ";
|
||||
}
|
||||
|
||||
if (resourceId.length() > 0) {
|
||||
sqlWhere += " and a.id in(" + resourceId + ") ";
|
||||
}
|
||||
|
||||
if (viewScope.equals("4")) {//我的下属
|
||||
if (allLevel.equals("1")) {//所有下属
|
||||
sqlWhere += " and a.managerstr like '%," + user.getUID() + ",%'";
|
||||
} else {
|
||||
sqlWhere += " and a.managerid=" + user.getUID();//直接下属
|
||||
}
|
||||
}
|
||||
if (!"1".equals(isNoAccount)) {
|
||||
sqlWhere += " and a.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and a.loginid<>'' ");
|
||||
}
|
||||
|
||||
if(status.length()>0){
|
||||
if (!status.equals("8") && !status.equals("9")) {
|
||||
sqlWhere += " and a.status = "+status+ "";
|
||||
}else if (status.equals("8")) {
|
||||
sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) ";
|
||||
}
|
||||
}
|
||||
|
||||
String orderBy = " order by a.dsporder asc, a.lastname asc ";
|
||||
String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
|
||||
sql = "select " + backFields + sqlFrom + sqlWhere + groupBy + orderBy;
|
||||
|
||||
//System.out.println("start" + DateUtil.getFullDate());
|
||||
|
||||
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
|
||||
String show_card_source = Util.null2String(kqSettingsComInfo.getMain_val("show_card_source"),"0");//是否显示打卡数据,以及打卡数据来源
|
||||
params.put("show_card_source",show_card_source);
|
||||
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
||||
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
||||
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
||||
params.put("uintType",uintType);
|
||||
params.put("hoursToDay",hoursToDay);
|
||||
Map<String, Object> flowData = new KQReportBiz().getFlowData(params, user);
|
||||
//System.out.println("end" + DateUtil.getFullDate());
|
||||
|
||||
// #1475814-概述:满足考勤报分部部门显示及导出时显示全路径
|
||||
String fullPathMainKey = "show_full_path";
|
||||
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
|
||||
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()) {
|
||||
data = new ArrayList<>();
|
||||
String id = rs.getString("id");
|
||||
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
|
||||
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
|
||||
String fieldid = KQReportFieldComInfo.field2Id.get(fieldName);
|
||||
String fieldValue = "";
|
||||
if (fieldName.equals("subcompany")) {
|
||||
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
|
||||
if (tmpSubcompanyId.length() == 0) {
|
||||
tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
SubCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId, "/", "0") :
|
||||
subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
|
||||
// fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
|
||||
} else if (fieldName.equals("department")) {
|
||||
String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
|
||||
if (tmpDepartmentId.length() == 0) {
|
||||
tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
|
||||
}
|
||||
|
||||
fieldValue = "1".equals(isShowFullPath) ?
|
||||
departmentComInfo.getDepartmentRealPath(tmpDepartmentId, "/", "0") :
|
||||
departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
|
||||
// fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
|
||||
} else if(fieldName.equals("cdfz")){
|
||||
String beLateMins = Util.null2String(rs.getString("beLateMins"));
|
||||
fieldValue = beLateMins;
|
||||
}else if(fieldName.equals("ztfz")){
|
||||
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins"));
|
||||
fieldValue = graveBeLateMins;
|
||||
}else if (fieldName.equals("jobtitle")) {
|
||||
String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
|
||||
if (tmpJobtitleId.length() == 0) {
|
||||
tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
|
||||
}
|
||||
fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
|
||||
} else if (fieldName.equals("attendanceSerial")) {
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
for(int i=0;serialIds!=null&&i<serialIds.size();i++){
|
||||
data.add(kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
|
||||
}
|
||||
}else{
|
||||
data.add("");
|
||||
}
|
||||
continue;
|
||||
} else if (fieldName.equals("leave")) {//请假
|
||||
List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
Map<String, Object> leaveRule = null;
|
||||
for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
|
||||
leaveRule = allLeaveRules.get(i);
|
||||
String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
|
||||
String leaveData = Util.null2String(flowData.get(id + "|" + flowType));
|
||||
String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id"));
|
||||
String leavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + flowLeaveBackType)), "0.0");
|
||||
String b_flowLeaveData = "";
|
||||
String flowLeaveData = "";
|
||||
try {
|
||||
//以防止出现精度问题
|
||||
if (leaveData.length() == 0) {
|
||||
leaveData = "0.0";
|
||||
}
|
||||
if (leavebackData.length() == 0) {
|
||||
leavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_leaveData = new BigDecimal(leaveData);
|
||||
BigDecimal b_leavebackData = new BigDecimal(leavebackData);
|
||||
b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString();
|
||||
if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){
|
||||
b_flowLeaveData = "0.0";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeLog("GetKQReportCmd:leaveData" + leaveData + ":leavebackData:" + leavebackData + ":" + e);
|
||||
}
|
||||
|
||||
if (b_flowLeaveData.length() > 0) {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData);
|
||||
} else {
|
||||
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
|
||||
}
|
||||
data.add(flowLeaveData);
|
||||
}
|
||||
continue;
|
||||
}else if(fieldName.equals("overtime")){
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_nonleave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_nonleave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|workingDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("workingDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|restDayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("restDayOvertime_4leave"))));
|
||||
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|holidayOvertime_4leave")));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("holidayOvertime_4leave"))));
|
||||
|
||||
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
|
||||
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
|
||||
double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
|
||||
restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
|
||||
double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
|
||||
holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;
|
||||
|
||||
double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
|
||||
workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
|
||||
double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
|
||||
restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
|
||||
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
|
||||
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
|
||||
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
|
||||
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
|
||||
continue;
|
||||
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
|
||||
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0");
|
||||
String backType = fieldName+"_back";
|
||||
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0");
|
||||
String businessLeave = "";
|
||||
try{
|
||||
//以防止出现精度问题
|
||||
if(businessLeaveData.length() == 0){
|
||||
businessLeaveData = "0.0";
|
||||
}
|
||||
if(businessLeavebackData.length() == 0){
|
||||
businessLeavebackData = "0.0";
|
||||
}
|
||||
BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData);
|
||||
BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData);
|
||||
businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString();
|
||||
if(Util.getDoubleValue(businessLeave, -1) < 0){
|
||||
businessLeave = "0.0";
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
|
||||
} else if(Util.null2String(kqReportFieldComInfo.getCascadekey(fieldid)).length()>0){
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
|
||||
List<String> lsCascadekey = Util.splitString2List(kqReportFieldComInfo.getCascadekey(fieldid),",");
|
||||
for(int i=0;i<lsCascadekey.size();i++){
|
||||
if(Util.null2String(rs.getString(lsCascadekey.get(i))).length()>0){
|
||||
fieldid = KQReportFieldComInfo.field2Id.get(lsCascadekey.get(i));
|
||||
fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)),kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}else{
|
||||
fieldValue = "0";
|
||||
}
|
||||
data.add(fieldValue);
|
||||
}
|
||||
continue;
|
||||
}else {
|
||||
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
|
||||
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
|
||||
}
|
||||
fieldValue = Util.formatMultiLang(fieldValue,""+user.getLanguage());
|
||||
data.add(fieldValue);
|
||||
}
|
||||
if(showColumns.contains("kqCalendar")) {
|
||||
// Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true);
|
||||
Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user,flowData,true,uintType,show_card_source);
|
||||
isEnd = false;
|
||||
for (String date = fromDate; !isEnd; ) {
|
||||
if (date.equals(toDate)) isEnd = true;
|
||||
if (DateUtil.compDate(today, date) > 0) {
|
||||
data.add("");
|
||||
} else {
|
||||
if (detialDatas.get(id + "|" + date) != null) {
|
||||
data.add(((Map<String, Object>) detialDatas.get(id + "|" + date)).get("text"));
|
||||
} else {
|
||||
data.add(SystemEnv.getHtmlLabelName(26593, user.getLanguage()));
|
||||
}
|
||||
}
|
||||
cal.setTime(DateUtil.parseToDate(date));
|
||||
date = DateUtil.getDate(cal.getTime(), 1);
|
||||
}
|
||||
}
|
||||
dataList.add(data);
|
||||
}
|
||||
sheet.put("dataList", dataList);
|
||||
sheet.put("constraintList", constraintList);
|
||||
sheet.put("createFile", "1");
|
||||
lsSheet.add(sheet);
|
||||
|
||||
workbook.put("sheet", lsSheet);
|
||||
String fileName = SystemEnv.getHtmlLabelName(390351, user.getLanguage())+" "+fromDate+" "+toDate;
|
||||
workbook.put("fileName", fileName);
|
||||
ExcelUtil ExcelUtil = new ExcelUtil();
|
||||
Map<String, Object> exportMap = ExcelUtil.export(workbook, request, response,true);
|
||||
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;
|
||||
}
|
||||
|
||||
private Map<String, Object> getChildColumnsInfo(String parentid, User user) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if (parentid.equals("attendanceSerial")) {//考勤班次
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
|
||||
List<String> serialIds = null;
|
||||
if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
|
||||
serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
|
||||
}
|
||||
for (int i = 0; serialIds != null && i < serialIds.size(); i++) {
|
||||
title = new HashMap<>();
|
||||
title.put("title", Util.formatMultiLang(kqShiftManagementComInfo.getSerial(serialIds.get(i)),""+user.getLanguage()));
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
} else if (parentid.equals("leave")) {
|
||||
KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
|
||||
List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
|
||||
for (int i = 0; leaveRules != null && i < leaveRules.size(); i++) {
|
||||
Map<String, Object> leaveRule = leaveRules.get(i);
|
||||
String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
|
||||
String unitType = Util.null2String(leaveRule.get("unitType"));
|
||||
String unitName = (KQUnitBiz.isLeaveHour(unitType)) ? SystemEnv.getHtmlLabelName(391, user.getLanguage()) : SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
title = new HashMap<>();
|
||||
title.put("title", name + "(" + unitName + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}else if(parentid.equals("overtime")){
|
||||
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
|
||||
for(int i=0;i<overtimeChild.length;i++){
|
||||
String id = overtimeChild[i];
|
||||
title = new HashMap();
|
||||
String fieldlabel = "";
|
||||
if("overtime_nonleave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125805";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else if("overtime_4leave".equalsIgnoreCase(id)){
|
||||
fieldlabel = "125804";
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
|
||||
title.put("rowSpan","2");
|
||||
}else{
|
||||
fieldlabel = "523";
|
||||
title.put("showDetial","1");
|
||||
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
|
||||
String unitTypeName = "";
|
||||
if(Util.null2String(unitType).length()>0){
|
||||
if(unitType.equals("1")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
|
||||
}else if(unitType.equals("2")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
|
||||
}else if(unitType.equals("3")){
|
||||
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
|
||||
}
|
||||
}
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
|
||||
}
|
||||
|
||||
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
|
||||
int childWidth = 65;
|
||||
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
|
||||
if(childColumns.size()>0) {//跨列width取子列的width
|
||||
title.put("children", childColumns);
|
||||
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
|
||||
}
|
||||
title.put("width", childWidth+"");
|
||||
titleList.add(title);
|
||||
}
|
||||
} else {
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if (kqReportFieldComInfo.getParentid().equals(parentid)) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
title = new HashMap<>();
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnMap.put("childColumns", titleList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private List<Object> getCascadeKeyColumnsInfo(String cascadeKey, User user){
|
||||
List<Object> titleList = new ArrayList<>();
|
||||
Map<String, Object> title = null;
|
||||
if(Util.null2String(cascadeKey).length()==0){
|
||||
return titleList;
|
||||
}
|
||||
List<String> lsCascadeKey = Util.splitString2List(cascadeKey,",");
|
||||
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
|
||||
for(int i=0;i<lsCascadeKey.size();i++){
|
||||
kqReportFieldComInfo.setTofirstRow();
|
||||
while (kqReportFieldComInfo.next()) {
|
||||
if(!kqReportFieldComInfo.getReportType().equals("month"))continue;
|
||||
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))){
|
||||
title = new HashMap<>();
|
||||
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
|
||||
title.put("width", 30 * 256);
|
||||
titleList.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
return titleList;
|
||||
}
|
||||
|
||||
private String getFieldValueByUnitType(String fieldValue,String unittype){
|
||||
if (Util.null2String(unittype).length() > 0) {
|
||||
if (fieldValue.length() == 0) {
|
||||
fieldValue = "0";
|
||||
} else {
|
||||
if (unittype.equals("2")) {
|
||||
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="com.weaver.general.Util" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
|
||||
<%--
|
||||
User: wangj
|
||||
Design Ideas:
|
||||
更新应聘登记表普工 信息
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
boolean flag = false;
|
||||
Map<String,Object> res = new HashMap<>(100);
|
||||
RecordSet rs = new RecordSet();
|
||||
String sfzhm = Util.null2String(request.getParameter("sfzhm"));
|
||||
String sql = "select max(id) as id from uf_ypdjpg where sfzhm = '"+sfzhm+"'";
|
||||
String maxid = "";
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
maxid = Util.null2String(rs.getString("id"));
|
||||
if(!"".equals(maxid)){
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
res.put("billid",maxid);
|
||||
res.put("flag",flag);
|
||||
out.print(JSONObject.toJSONString(res));
|
||||
|
||||
%>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,463 @@
|
|||
package com.engine.jgkq.util;
|
||||
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.RegionUtil;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class ExcelExpUtil extends BaseBean {
|
||||
|
||||
BaseBean baseBean=new BaseBean();
|
||||
|
||||
/*
|
||||
* 导出数据
|
||||
* */
|
||||
public Integer createSheetBz(SXSSFWorkbook workbook, Map<String, Object> workBook) throws Exception {
|
||||
Integer back = 0;
|
||||
try {
|
||||
// 创建工作簿对象
|
||||
List<Object> lsSheet = (List<Object>) workBook.get("sheet");
|
||||
String fileName = Util.null2String(workBook.get("fileName"));
|
||||
if (fileName.length() == 0||true) {
|
||||
fileName = "" + UUID.randomUUID();//解决lunix下中文文件无法生成问题
|
||||
}
|
||||
for (int sheetNum = 0; sheetNum < lsSheet.size(); sheetNum++) {
|
||||
Map<String, Object> mySheet = (Map<String, Object>) lsSheet.get(sheetNum);
|
||||
String mySheetName = Util.null2String(mySheet.get("sheetName"));
|
||||
String sheetTitle = Util.null2String(mySheet.get("sheetTitle"));
|
||||
List<Object> sheetMemo = (List<Object>) mySheet.get("sheetMemo");
|
||||
List<Object> titleList = (List<Object>) mySheet.get("titleList");
|
||||
List<Object> dataList = (List<Object>) mySheet.get("dataList");
|
||||
|
||||
|
||||
Sheet sheet = workbook.createSheet(mySheetName); // 创建工作表
|
||||
|
||||
int rowIdx = 0;
|
||||
// 产生表格标题行
|
||||
Row rowm = sheet.createRow(rowIdx);
|
||||
Cell cellTiltle = rowm.createCell(0);
|
||||
|
||||
CellStyle titleStyle = this.getTitleStyle(workbook);//获取列头样式对象
|
||||
CellStyle memoStyle = this.getMemoStyle(workbook);//获取备注样式对象
|
||||
CellStyle columnTopStyle = this.getColumnTopStyle(workbook);//获取列头样式对象
|
||||
CellStyle cellStyle = this.getCellStyle(workbook); //单元格样式对象
|
||||
|
||||
int mergedRegion = titleList.size() - 1;
|
||||
if (mergedRegion > 15) {
|
||||
mergedRegion = 15;
|
||||
}
|
||||
mergedRegion = getColLength(titleList);
|
||||
|
||||
CellRangeAddress region = new CellRangeAddress(rowIdx, ++rowIdx, 0, mergedRegion);
|
||||
RegionUtil.setBorderBottom(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderLeft(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderRight(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderTop(BorderStyle.THIN, region, sheet);
|
||||
sheet.addMergedRegion(region);
|
||||
cellTiltle.setCellStyle(titleStyle);
|
||||
cellTiltle.setCellValue(sheetTitle);
|
||||
|
||||
for (int i = 0; sheetMemo != null && i < sheetMemo.size(); i++) {
|
||||
rowm = sheet.createRow(++rowIdx);
|
||||
Cell cellMemo = rowm.createCell(0);
|
||||
region = new CellRangeAddress(rowIdx, ++rowIdx, 0, mergedRegion);
|
||||
RegionUtil.setBorderBottom(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderLeft(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderRight(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderTop(BorderStyle.THIN, region, sheet);
|
||||
sheet.addMergedRegion(region);
|
||||
cellMemo.setCellStyle(memoStyle);
|
||||
cellMemo.setCellValue(Util.null2String(sheetMemo.get(i)));
|
||||
}
|
||||
|
||||
rowIdx = this.initDynamicTitle(sheet, titleList, columnTopStyle, rowIdx);
|
||||
|
||||
//将查询出的数据设置到sheet对应的单元格中
|
||||
for (int i = 0; dataList != null && i < dataList.size(); i++) {
|
||||
List<Object> obj = (List<Object>) dataList.get(i);//遍历每个对象
|
||||
Row row = sheet.createRow(i + rowIdx + 1);//创建所需的行数
|
||||
|
||||
for (int j = 0; j < obj.size(); j++) {
|
||||
Cell cell = null; //设置单元格的数据类型
|
||||
cell = row.createCell(j, CellType.STRING);
|
||||
cell.setCellValue(Util.null2String(obj.get(j))); //设置单元格的值
|
||||
cell.setCellStyle(cellStyle); //设置单元格样式
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (workbook != null) {
|
||||
back = 1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return back;
|
||||
}
|
||||
|
||||
/*
|
||||
* 列头单元格样式
|
||||
*/
|
||||
private CellStyle getTitleStyle(SXSSFWorkbook workbook) {
|
||||
// 设置字体
|
||||
Font font = workbook.createFont();
|
||||
//设置字体大小
|
||||
font.setFontHeightInPoints((short) 14);
|
||||
//字体加粗
|
||||
font.setBold(true);
|
||||
//设置字体名字
|
||||
font.setFontName("宋体");
|
||||
//设置样式;
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
//设置底边框;
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
//设置底边框颜色;
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.index);
|
||||
//设置左边框;
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
//设置左边框颜色;
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.index);
|
||||
//设置右边框;
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
//设置右边框颜色;
|
||||
style.setRightBorderColor(IndexedColors.BLACK.index);
|
||||
//设置顶边框;
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
//设置顶边框颜色;
|
||||
style.setTopBorderColor(IndexedColors.BLACK.index);
|
||||
//在样式用应用设置的字体;
|
||||
style.setFont(font);
|
||||
//设置自动换行;
|
||||
style.setWrapText(false);
|
||||
//设置水平对齐的样式为居中对齐;
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
//设置垂直对齐的样式为居中对齐;
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
return style;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 列头单元格样式
|
||||
*/
|
||||
private CellStyle getMemoStyle(SXSSFWorkbook workbook) {
|
||||
// 设置字体
|
||||
Font font = workbook.createFont();
|
||||
//设置字体大小
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
//字体加粗
|
||||
font.setBold(true);
|
||||
//设置字体名字
|
||||
font.setFontName("宋体");
|
||||
//设置样式;
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
//设置底边框;
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
//设置底边框颜色;
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.index);
|
||||
//设置左边框;
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
//设置左边框颜色;
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.index);
|
||||
//设置右边框;
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
//设置右边框颜色;
|
||||
style.setRightBorderColor(IndexedColors.BLACK.index);
|
||||
//设置顶边框;
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
//设置顶边框颜色;
|
||||
style.setTopBorderColor(IndexedColors.BLACK.index);
|
||||
//在样式用应用设置的字体;
|
||||
style.setFont(font);
|
||||
//设置自动换行;
|
||||
style.setWrapText(false);
|
||||
//设置水平对齐的样式为居中对齐;
|
||||
style.setAlignment(HorizontalAlignment.LEFT);
|
||||
//设置垂直对齐的样式为居中对齐;
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
||||
return style;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 列头单元格样式
|
||||
*/
|
||||
private CellStyle getColumnTopStyle(SXSSFWorkbook workbook) {
|
||||
// 设置字体
|
||||
Font font = workbook.createFont();
|
||||
//设置字体大小
|
||||
font.setFontHeightInPoints((short) 11);
|
||||
//字体加粗
|
||||
font.setBold(true);
|
||||
//设置字体名字
|
||||
font.setFontName("宋体");
|
||||
//设置样式;
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
//设置底边框;
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
//设置底边框颜色;
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.index);
|
||||
//设置左边框;
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
//设置左边框颜色;
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.index);
|
||||
//设置右边框;
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
//设置右边框颜色;
|
||||
style.setRightBorderColor(IndexedColors.BLACK.index);
|
||||
//设置顶边框;
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
//设置顶边框颜色;
|
||||
style.setTopBorderColor(IndexedColors.BLACK.index);
|
||||
//在样式用应用设置的字体;
|
||||
style.setFont(font);
|
||||
//设置自动换行;
|
||||
style.setWrapText(true);
|
||||
//设置水平对齐的样式为居中对齐;
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
//设置垂直对齐的样式为居中对齐;
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
||||
return style;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 列数据信息单元格样式
|
||||
*/
|
||||
private CellStyle getCellStyle(SXSSFWorkbook workbook) {
|
||||
// 设置字体
|
||||
Font font = workbook.createFont();
|
||||
//设置字体大小
|
||||
//font.setFontHeightInPoints((short)10);
|
||||
//字体加粗
|
||||
//font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
|
||||
//设置字体名字
|
||||
font.setFontName("宋体");
|
||||
//设置样式;
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
//设置底边框;
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
//设置底边框颜色;
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.index);
|
||||
//设置左边框;
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
//设置左边框颜色;
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.index);
|
||||
//设置右边框;
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
//设置右边框颜色;
|
||||
style.setRightBorderColor(IndexedColors.BLACK.index);
|
||||
//设置顶边框;
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
//设置顶边框颜色;
|
||||
style.setTopBorderColor(IndexedColors.BLACK.index);
|
||||
//在样式用应用设置的字体;
|
||||
style.setFont(font);
|
||||
//设置自动换行;
|
||||
style.setWrapText(false);
|
||||
//设置水平对齐的样式为居中对齐;
|
||||
style.setAlignment(HorizontalAlignment.LEFT);
|
||||
//设置垂直对齐的样式为居中对齐;
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
||||
return style;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取具体总共有多少列
|
||||
* @param columns
|
||||
* @return
|
||||
*/
|
||||
private int getColLength(List<Object> columns) {
|
||||
int length = -1;// 从0开始计算单元格的
|
||||
for(int i =0 ; i < columns.size() ; i++){
|
||||
Map<String,Object> column = (Map<String, Object>) columns.get(i);
|
||||
if (column.get("children") != null) {
|
||||
List<Object> childchildColumns = (List<Object>) column.get("children");
|
||||
length += getColLength(childchildColumns) + 1;
|
||||
} else {
|
||||
length++;
|
||||
}
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
public int initDynamicTitle(Sheet sheet, List<Object> columns, CellStyle columnTopStyle, int rowIdx) {
|
||||
int cur_rowIndx = rowIdx+1;
|
||||
//title 总行数
|
||||
int title_rows = cur_rowIndx+getRowNums(columns)-1;
|
||||
createHeaderRow(sheet, cur_rowIndx, 0,columns,columnTopStyle,title_rows);
|
||||
return title_rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取具体总共有多少行
|
||||
*/
|
||||
public int getRowNums(List<Object> columns) {
|
||||
int cnt = 1;
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
Map<String,Object> column = (Map<String, Object>) columns.get(i);
|
||||
if (column.get("children") != null) {
|
||||
List<Object> childchildColumns = (List<Object>) column.get("children");
|
||||
int tmpcnt = 1+getRowNums(childchildColumns);
|
||||
if(tmpcnt > cnt){
|
||||
cnt = tmpcnt;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cnt > 1){
|
||||
return cnt;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建表头
|
||||
*/
|
||||
private int createHeaderRow(Sheet sheet, int index, int cellIndex,
|
||||
List<Object> columnName, CellStyle columnTopStyle, int title_rows) {
|
||||
Row row = sheet.getRow(index) == null ? sheet.createRow(index) : sheet.getRow(index);
|
||||
int rows = getRowNums(columnName);
|
||||
for (int i = 0, exportFieldTitleSize = columnName.size(); i < exportFieldTitleSize; i++) {
|
||||
Map<String,Object> column = (Map<String, Object>) columnName.get(i);
|
||||
String title = Util.null2String(column.get("title"));
|
||||
createStringCell(row, cellIndex, title, columnTopStyle);
|
||||
// sheet.setColumnWidth(i,Util.getIntValue(Util.null2String(column.get("width"))));
|
||||
// sheet.setColumnWidth(i,200);
|
||||
// 设置列宽自适应内容
|
||||
for (int colNum = 0; colNum < 20; colNum++) {
|
||||
sheet.setColumnWidth(colNum,20*256);
|
||||
}
|
||||
if (column.get("children") != null) {
|
||||
List<Object> childchildColumns = (List<Object>) column.get("children");
|
||||
// 保持原来的
|
||||
int tempCellIndex = cellIndex;
|
||||
cellIndex = createHeaderRow(sheet, rows == 1 ? index : index + 1, cellIndex, childchildColumns,columnTopStyle,
|
||||
title_rows);
|
||||
if (childchildColumns.size() > 1) {
|
||||
addMergedRegion(sheet, index, index, tempCellIndex, cellIndex - 1);
|
||||
}
|
||||
cellIndex--;
|
||||
}else{
|
||||
addMergedRegion(sheet, index, title_rows, cellIndex, cellIndex);
|
||||
}
|
||||
cellIndex++;
|
||||
}
|
||||
|
||||
return cellIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文本类型的Cell
|
||||
*/
|
||||
public void createStringCell(Row row, int cellIndex, String title, CellStyle columnTopStyle) {
|
||||
Cell cellRowName = row.createCell(cellIndex); //创建列头对应个数的单元格
|
||||
cellRowName.setCellType(CellType.STRING); //设置列头单元格的数据类型
|
||||
cellRowName.setCellValue(title); //设置列头单元格的值
|
||||
cellRowName.setCellStyle(columnTopStyle); //设置列头单元格样式
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并单元格
|
||||
* @param sheet
|
||||
* @param firstRow
|
||||
* @param lastRow
|
||||
* @param firstCol
|
||||
* @param lastCol
|
||||
*/
|
||||
public void addMergedRegion(Sheet sheet, int firstRow, int lastRow, int firstCol, int lastCol) {
|
||||
try {
|
||||
if(firstRow == lastRow && firstCol == lastCol){
|
||||
return ;
|
||||
}
|
||||
CellRangeAddress region = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol);
|
||||
RegionUtil.setBorderBottom(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderLeft(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderRight(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderTop(BorderStyle.THIN, region, sheet);
|
||||
sheet.addMergedRegion(region);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Map<String,Object> readColumn(Workbook workbook, String templateType){
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
try {
|
||||
Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表
|
||||
if ("0".equals(templateType)){
|
||||
//获取第一列
|
||||
for (int i=3;i<sheet.getLastRowNum();i++) {
|
||||
Row row = sheet.getRow(i);
|
||||
Cell cell = row.getCell(0);
|
||||
String cellValue = cell.getStringCellValue();
|
||||
result.put(i+"",cellValue);
|
||||
}
|
||||
}else if ("1".equals(templateType)){
|
||||
for (int i=3;i<sheet.getLastRowNum();i++) {
|
||||
Row row = sheet.getRow(i);
|
||||
Cell cell0 = row.getCell(0);
|
||||
Cell cell1 = row.getCell(1);
|
||||
String cell0Value = cell0.getStringCellValue();//部门
|
||||
String cell1Value = cell1.getStringCellValue();//岗位
|
||||
List<Object> cells = new ArrayList<>();
|
||||
cells.add(cell0Value);
|
||||
cells.add(cell1Value);
|
||||
result.put(i+"",cells);
|
||||
}
|
||||
}else if ("2".equals(templateType)){
|
||||
for (int i=3;i<sheet.getLastRowNum();i++) {
|
||||
Row row = sheet.getRow(i);
|
||||
Cell cell0 = row.getCell(0);
|
||||
Cell cell1 = row.getCell(1);
|
||||
Cell cell2 = row.getCell(2);
|
||||
Cell cell3 = row.getCell(3);
|
||||
String cell0Value = cell0.getStringCellValue();
|
||||
String cell1Value = cell1.getStringCellValue();
|
||||
double cell2Value = cell2.getNumericCellValue();
|
||||
double cell3Value = cell3.getNumericCellValue();
|
||||
List<Object> cells = new ArrayList<>();
|
||||
cells.add(cell0Value);
|
||||
cells.add(cell1Value);
|
||||
cells.add(cell2Value);
|
||||
cells.add(cell3Value);
|
||||
result.put(i+"",cells);
|
||||
}
|
||||
}else if ("3".equals(templateType)){
|
||||
for (int i=3;i<sheet.getLastRowNum();i++) {
|
||||
Row row = sheet.getRow(i);
|
||||
Cell cell0 = row.getCell(0);
|
||||
Cell cell1 = row.getCell(1);
|
||||
Cell cell2 = row.getCell(2);
|
||||
String cell0Value = cell0.getStringCellValue();
|
||||
String cell1Value = cell1.getStringCellValue();
|
||||
String cell2Value = cell2.getStringCellValue();
|
||||
List<Object> cells = new ArrayList<>();
|
||||
cells.add(cell0Value);
|
||||
cells.add(cell1Value);
|
||||
cells.add(cell2Value);
|
||||
result.put(i+"",cells);
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
baseBean.writeLog("readColumn exception: "+e);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,741 @@
|
|||
package com.engine.kq.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||
import org.apache.poi.ss.util.RegionUtil;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class ExcelUtil extends BaseBean {
|
||||
/*
|
||||
* 导出数据
|
||||
* */
|
||||
public Map export(Map<String, Object> workBook, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
return export(workBook, request, response,false);
|
||||
}
|
||||
public Map export(Map<String, Object> workBook, HttpServletRequest request, HttpServletResponse response,boolean isWrap) throws Exception {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
String createFile = "";
|
||||
try {
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook(); // 创建工作簿对象
|
||||
List<Object> lsSheet = (List<Object>) workBook.get("sheet");
|
||||
String fileName = Util.null2String(workBook.get("fileName"));
|
||||
if (fileName.length() == 0) fileName = "" + UUID.randomUUID();//解决lunix下中文文件无法生成问题
|
||||
for (int sheetNum = 0; sheetNum < lsSheet.size(); sheetNum++) {
|
||||
Map<String, Object> mySheet = (Map<String, Object>) lsSheet.get(sheetNum);
|
||||
String mySheetName = Util.null2String(mySheet.get("sheetName"));
|
||||
String sheetTitle = Util.null2String(mySheet.get("sheetTitle"));
|
||||
List<Object> sheetMemo = (List<Object>) mySheet.get("sheetMemo");
|
||||
List<Object> titleList = (List<Object>) mySheet.get("titleList");
|
||||
List<Object> dataList = (List<Object>) mySheet.get("dataList");
|
||||
List<Map<String, Object>> constraintList = (List<Map<String, Object>>) mySheet.get("constraintList");
|
||||
createFile = Util.null2String(mySheet.get("createFile"));
|
||||
|
||||
Sheet sheet = workbook.createSheet(mySheetName); // 创建工作表
|
||||
|
||||
int rowIdx = 0;
|
||||
// 产生表格标题行
|
||||
Row rowm = sheet.createRow(rowIdx);
|
||||
Cell cellTiltle = rowm.createCell(0);
|
||||
|
||||
CellStyle titleStyle = this.getTitleStyle(workbook);//获取列头样式对象
|
||||
CellStyle memoStyle = this.getMemoStyle(workbook);//获取备注样式对象
|
||||
CellStyle columnTopStyle = this.getColumnTopStyle(workbook);//获取列头样式对象
|
||||
CellStyle cellStyle = this.getCellStyle(workbook,isWrap); //单元格样式对象
|
||||
|
||||
int mergedRegion = titleList.size() - 1;
|
||||
if (mergedRegion > 15) mergedRegion = 15;
|
||||
mergedRegion = getColLength(titleList);
|
||||
|
||||
CellRangeAddress region = new CellRangeAddress(rowIdx, ++rowIdx, 0, mergedRegion);
|
||||
RegionUtil.setBorderBottom(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderLeft(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderRight(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderTop(BorderStyle.THIN, region, sheet);
|
||||
sheet.addMergedRegion(region);
|
||||
cellTiltle.setCellStyle(titleStyle);
|
||||
cellTiltle.setCellValue(sheetTitle);
|
||||
|
||||
for (int i = 0; sheetMemo != null && i < sheetMemo.size(); i++) {
|
||||
rowm = sheet.createRow(++rowIdx);
|
||||
Cell cellMemo = rowm.createCell(0);
|
||||
region = new CellRangeAddress(rowIdx, ++rowIdx, 0, mergedRegion);
|
||||
RegionUtil.setBorderBottom(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderLeft(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderRight(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderTop(BorderStyle.THIN, region, sheet);
|
||||
sheet.addMergedRegion(region);
|
||||
cellMemo.setCellStyle(memoStyle);
|
||||
cellMemo.setCellValue(Util.null2String(sheetMemo.get(i)));
|
||||
}
|
||||
|
||||
// // 定义所需列数
|
||||
// int columnNum = titleList.size();
|
||||
// HSSFRow rowRowName = sheet.createRow(++rowIdx); // 在索引2的位置创建行(最顶端的行开始的第二行)
|
||||
//
|
||||
// // 将列头设置到sheet的单元格中
|
||||
// for (int n = 0; n < columnNum; n++) {
|
||||
// Map title = (Map) titleList.get(n);
|
||||
//
|
||||
// HSSFCell cellRowName = rowRowName.createCell(n); //创建列头对应个数的单元格
|
||||
// cellRowName.setCellType(HSSFCell.CELL_TYPE_STRING); //设置列头单元格的数据类型
|
||||
// HSSFRichTextString text = new HSSFRichTextString(Util.null2String(title.get("title")));
|
||||
// cellRowName.setCellValue(text); //设置列头单元格的值
|
||||
// cellRowName.setCellStyle(columnTopStyle); //设置列头单元格样式
|
||||
// if (n == 0) {
|
||||
// sheet.setColumnWidth(n, Util.getIntValue(Util.null2String(title.get("width"))));
|
||||
// } else {
|
||||
// sheet.setColumnWidth(n, Util.getIntValue(Util.null2String(title.get("width"))));
|
||||
// }
|
||||
// }
|
||||
|
||||
rowIdx = this.initDynamicTitle(sheet, titleList, columnTopStyle, rowIdx);
|
||||
|
||||
//将查询出的数据设置到sheet对应的单元格中
|
||||
for (int i = 0; dataList != null && i < dataList.size(); i++) {
|
||||
List<Object> obj = (List<Object>) dataList.get(i);//遍历每个对象
|
||||
Row row = sheet.createRow(i + rowIdx + 1);//创建所需的行数
|
||||
|
||||
for (int j = 0; j < obj.size(); j++) {
|
||||
Cell cell = null; //设置单元格的数据类型
|
||||
cell = row.createCell(j, CellType.STRING);
|
||||
cell.setCellValue(Util.null2String(obj.get(j))); //设置单元格的值
|
||||
cell.setCellStyle(cellStyle); //设置单元格样式
|
||||
}
|
||||
}
|
||||
|
||||
// int columnNum = this.getColumnLength(titleList);
|
||||
// //让列宽随着导出的列长自动适应
|
||||
// for (int colNum = 0; colNum < columnNum; colNum++) {
|
||||
// int columnWidth = sheet.getColumnWidth(colNum) / 256;
|
||||
// for (int rowNum = 0; rowNum < sheet.getLastRowNum(); rowNum++) {
|
||||
// HSSFRow currentRow;
|
||||
// //当前行未被使用过
|
||||
// if (sheet.getRow(rowNum) == null) {
|
||||
// currentRow = sheet.createRow(rowNum);
|
||||
// } else {
|
||||
// currentRow = sheet.getRow(rowNum);
|
||||
// }
|
||||
// if (currentRow.getCell(colNum) != null) {
|
||||
// //取得当前的单元格
|
||||
// HSSFCell currentCell = currentRow.getCell(colNum);
|
||||
// //如果当前单元格类型为字符串
|
||||
// if (currentCell.getCellTypeEnum() == CellType.STRING) {
|
||||
// int length = currentCell.getStringCellValue().getBytes().length;
|
||||
// if (columnWidth < length) {
|
||||
// //将单元格里面值大小作为列宽度
|
||||
// columnWidth = length;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //再根据不同列单独做下处理
|
||||
// if (colNum == 0) {
|
||||
// sheet.setColumnWidth(colNum, (columnWidth - 2) * 256);
|
||||
// } else {
|
||||
// sheet.setColumnWidth(colNum, (columnWidth + 4) * 256);
|
||||
// }
|
||||
// }
|
||||
for (int i = 0; constraintList != null && i < constraintList.size(); i++) {
|
||||
Map<String, Object> constraint = constraintList.get(i);
|
||||
int firstRow = Util.getIntValue(Util.null2String(constraint.get("firstRow")), 0);
|
||||
int endRow = Util.getIntValue(Util.null2String(constraint.get("endRow")), 0);
|
||||
int firstCol = Util.getIntValue(Util.null2String(constraint.get("firstCol")), 0);
|
||||
int endCol = Util.getIntValue(Util.null2String(constraint.get("endCol")), 0);
|
||||
//设置下拉框数据
|
||||
String[] datas = (String[]) constraint.get("constraintDatas");
|
||||
String hiddenSheetName = "constraintDataSheet"+i;
|
||||
Sheet hiddenSheet = workbook.createSheet(hiddenSheetName);
|
||||
workbook.setSheetHidden(workbook.getSheetIndex(hiddenSheet), true);
|
||||
for (int j = 0; j< datas.length; j++) {
|
||||
hiddenSheet.createRow(j).createCell(0).setCellValue(datas[j]);
|
||||
}
|
||||
DataValidationHelper helper = sheet.getDataValidationHelper();
|
||||
String formulaId = hiddenSheetName + "!$A$1:$A$" + datas.length;
|
||||
DataValidationConstraint dataValidationConstraint = helper.createFormulaListConstraint(formulaId);
|
||||
CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
|
||||
DataValidation dataValidation = helper.createValidation(dataValidationConstraint, cellRangeAddressList);
|
||||
//处理Excel兼容性问题
|
||||
if (dataValidation instanceof DataValidation) {
|
||||
dataValidation.setSuppressDropDownArrow(true);
|
||||
dataValidation.setShowErrorBox(true);
|
||||
} else {
|
||||
dataValidation.setSuppressDropDownArrow(false);
|
||||
}
|
||||
sheet.addValidationData(dataValidation);
|
||||
}
|
||||
|
||||
|
||||
// for (int i = 0; constraintList != null && i < constraintList.size(); i++) {
|
||||
// Map<String, Object> constraint = constraintList.get(i);
|
||||
// int firstRow = Util.getIntValue(Util.null2String(constraint.get("firstRow")), 0);
|
||||
// int endRow = Util.getIntValue(Util.null2String(constraint.get("endRow")), 0);
|
||||
// int firstCol = Util.getIntValue(Util.null2String(constraint.get("firstCol")), 0);
|
||||
// int endCol = Util.getIntValue(Util.null2String(constraint.get("endCol")), 0);
|
||||
//
|
||||
// //设置下拉框数据
|
||||
// String[] datas = (String[]) constraint.get("constraintDatas");
|
||||
// DataValidationHelper helper = sheet.getDataValidationHelper();
|
||||
// DataValidationConstraint dataValidationConstraint = helper.createExplicitListConstraint(datas);
|
||||
// CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
|
||||
// DataValidation dataValidation = helper.createValidation(dataValidationConstraint, cellRangeAddressList);
|
||||
// //处理Excel兼容性问题
|
||||
// if (dataValidation instanceof DataValidation) {
|
||||
// dataValidation.setSuppressDropDownArrow(true);
|
||||
// dataValidation.setShowErrorBox(true);
|
||||
// } else {
|
||||
// dataValidation.setSuppressDropDownArrow(false);
|
||||
// }
|
||||
// sheet.addValidationData(dataValidation);
|
||||
// }
|
||||
}
|
||||
|
||||
if (workbook != null) {
|
||||
if (createFile.equals("1")) {
|
||||
String filePath = GCONST.getRootPath() + "/hrm/kq/tmpFile/";
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
|
||||
fileName = fileName +"("+DateUtil.getNowDateTimeStr()+")";
|
||||
String url = filePath + fileName + ".xlsx";
|
||||
String realUrl = "/hrm/kq/tmpFile/" + fileName + ".xlsx";
|
||||
FileOutputStream fOut = new FileOutputStream(url);
|
||||
workbook.write(fOut);
|
||||
fOut.flush();
|
||||
fOut.close();
|
||||
returnMap.put("url", realUrl);
|
||||
} else {
|
||||
response.reset();
|
||||
response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String header = request.getHeader("User-Agent").toUpperCase();
|
||||
if (header.contains("MSIE") || header.contains("TRIDENT") || header.contains("EDGE")) {
|
||||
fileName = URLEncoder.encode(fileName, "utf-8");
|
||||
fileName = fileName.replace("+", "%20"); //IE下载文件名空格变+号问题
|
||||
} else {
|
||||
fileName = new String(fileName.getBytes("utf-8"), "ISO_8859_1");
|
||||
}
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
response.setContentType("application/msexcel");
|
||||
response.setContentType("application/x-msdownload");
|
||||
OutputStream responseOutput = response.getOutputStream();
|
||||
workbook.write(responseOutput);
|
||||
responseOutput.flush();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
/*
|
||||
* 列头单元格样式
|
||||
*/
|
||||
private CellStyle getMemoStyle(SXSSFWorkbook workbook) {
|
||||
// 设置字体
|
||||
Font font = workbook.createFont();
|
||||
//设置字体大小
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
//字体加粗
|
||||
font.setBold(true);
|
||||
//设置字体名字
|
||||
font.setFontName("宋体");
|
||||
//设置样式;
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
//设置底边框;
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
//设置底边框颜色;
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.index);
|
||||
//设置左边框;
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
//设置左边框颜色;
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.index);
|
||||
//设置右边框;
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
//设置右边框颜色;
|
||||
style.setRightBorderColor(IndexedColors.BLACK.index);
|
||||
//设置顶边框;
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
//设置顶边框颜色;
|
||||
style.setTopBorderColor(IndexedColors.BLACK.index);
|
||||
//在样式用应用设置的字体;
|
||||
style.setFont(font);
|
||||
//设置自动换行;
|
||||
style.setWrapText(false);
|
||||
//设置水平对齐的样式为居中对齐;
|
||||
style.setAlignment(HorizontalAlignment.LEFT);
|
||||
//设置垂直对齐的样式为居中对齐;
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
||||
return style;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 列头单元格样式
|
||||
*/
|
||||
private CellStyle getTitleStyle(SXSSFWorkbook workbook) {
|
||||
// 设置字体
|
||||
Font font = workbook.createFont();
|
||||
//设置字体大小
|
||||
font.setFontHeightInPoints((short) 14);
|
||||
//字体加粗
|
||||
font.setBold(true);
|
||||
//设置字体名字
|
||||
font.setFontName("宋体");
|
||||
//设置样式;
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
//设置底边框;
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
//设置底边框颜色;
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.index);
|
||||
//设置左边框;
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
//设置左边框颜色;
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.index);
|
||||
//设置右边框;
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
//设置右边框颜色;
|
||||
style.setRightBorderColor(IndexedColors.BLACK.index);
|
||||
//设置顶边框;
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
//设置顶边框颜色;
|
||||
style.setTopBorderColor(IndexedColors.BLACK.index);
|
||||
//在样式用应用设置的字体;
|
||||
style.setFont(font);
|
||||
//设置自动换行;
|
||||
style.setWrapText(false);
|
||||
//设置水平对齐的样式为居中对齐;
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
//设置垂直对齐的样式为居中对齐;
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
return style;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 列头单元格样式
|
||||
*/
|
||||
private CellStyle getColumnTopStyle(SXSSFWorkbook workbook) {
|
||||
// 设置字体
|
||||
Font font = workbook.createFont();
|
||||
//设置字体大小
|
||||
font.setFontHeightInPoints((short) 11);
|
||||
//字体加粗
|
||||
font.setBold(true);
|
||||
//设置字体名字
|
||||
font.setFontName("宋体");
|
||||
//设置样式;
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
//设置底边框;
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
//设置底边框颜色;
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.index);
|
||||
//设置左边框;
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
//设置左边框颜色;
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.index);
|
||||
//设置右边框;
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
//设置右边框颜色;
|
||||
style.setRightBorderColor(IndexedColors.BLACK.index);
|
||||
//设置顶边框;
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
//设置顶边框颜色;
|
||||
style.setTopBorderColor(IndexedColors.BLACK.index);
|
||||
//在样式用应用设置的字体;
|
||||
style.setFont(font);
|
||||
//设置自动换行;
|
||||
style.setWrapText(true);
|
||||
//设置水平对齐的样式为居中对齐;
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
//设置垂直对齐的样式为居中对齐;
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
||||
return style;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 列数据信息单元格样式
|
||||
*/
|
||||
private CellStyle getCellStyle(SXSSFWorkbook workbook,boolean isWrap) {
|
||||
// 设置字体
|
||||
Font font = workbook.createFont();
|
||||
//设置字体大小
|
||||
//font.setFontHeightInPoints((short)10);
|
||||
//字体加粗
|
||||
//font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
|
||||
//设置字体名字
|
||||
font.setFontName("宋体");
|
||||
//设置样式;
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
//设置底边框;
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
//设置底边框颜色;
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.index);
|
||||
//设置左边框;
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
//设置左边框颜色;
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.index);
|
||||
//设置右边框;
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
//设置右边框颜色;
|
||||
style.setRightBorderColor(IndexedColors.BLACK.index);
|
||||
//设置顶边框;
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
//设置顶边框颜色;
|
||||
style.setTopBorderColor(IndexedColors.BLACK.index);
|
||||
//在样式用应用设置的字体;
|
||||
style.setFont(font);
|
||||
//设置自动换行;
|
||||
// style.setWrapText(false);
|
||||
if(isWrap){
|
||||
style.setWrapText(true);
|
||||
}else{
|
||||
style.setWrapText(false);
|
||||
}
|
||||
//设置水平对齐的样式为居中对齐;
|
||||
style.setAlignment(HorizontalAlignment.LEFT);
|
||||
//设置垂直对齐的样式为居中对齐;
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
||||
return style;
|
||||
|
||||
}
|
||||
|
||||
private CellStyle getCellStyle(SXSSFWorkbook workbook) {
|
||||
// 设置字体
|
||||
Font font = workbook.createFont();
|
||||
//设置字体大小
|
||||
//font.setFontHeightInPoints((short)10);
|
||||
//字体加粗
|
||||
//font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
|
||||
//设置字体名字
|
||||
font.setFontName("宋体");
|
||||
//设置样式;
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
//设置底边框;
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
//设置底边框颜色;
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.index);
|
||||
//设置左边框;
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
//设置左边框颜色;
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.index);
|
||||
//设置右边框;
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
//设置右边框颜色;
|
||||
style.setRightBorderColor(IndexedColors.BLACK.index);
|
||||
//设置顶边框;
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
//设置顶边框颜色;
|
||||
style.setTopBorderColor(IndexedColors.BLACK.index);
|
||||
//在样式用应用设置的字体;
|
||||
style.setFont(font);
|
||||
//设置自动换行;
|
||||
style.setWrapText(false);
|
||||
//设置水平对齐的样式为居中对齐;
|
||||
style.setAlignment(HorizontalAlignment.LEFT);
|
||||
//设置垂直对齐的样式为居中对齐;
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
||||
return style;
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String groupid = "1";
|
||||
String filename = "c://33e2a90d-3347-490c-afff-21de0ef3e3af.xlsx";
|
||||
int startRow = 3;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "";
|
||||
try {
|
||||
//必要的权限判断
|
||||
List<List> lsParams = null;
|
||||
List params = null;
|
||||
|
||||
Workbook workbook = WorkbookFactory.create(new FileInputStream(filename));
|
||||
for (int idx = 0; idx < workbook.getNumberOfSheets(); idx++) {
|
||||
Sheet sheet = workbook.getSheetAt(idx);
|
||||
Row row = null;
|
||||
Cell cell = null;
|
||||
lsParams = new ArrayList();
|
||||
for (int i = startRow; startRow <= sheet.getLastRowNum() && i <= sheet.getLastRowNum(); i++) {
|
||||
row = sheet.getRow(i);
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
params = new ArrayList();
|
||||
for (int cellIndex = 0; cellIndex < row.getLastCellNum(); cellIndex++) {
|
||||
cell = row.getCell((short) cellIndex);
|
||||
if (cell == null) continue;
|
||||
params.add(getCellValue(cell).trim());
|
||||
}
|
||||
params.add(groupid);
|
||||
if (Util.null2String(params.get(0)).length() > 0) {
|
||||
lsParams.add(params);
|
||||
}
|
||||
}
|
||||
if (idx == 0) {
|
||||
sql = "insert into kq_loaction (loactionname,longitude,latitude,address,groupid) values (?,?,?,?,?) ";
|
||||
} else {
|
||||
sql = "insert into kq_wifi (wifiname,mac,groupid) values (?,?,?) ";
|
||||
}
|
||||
rs.executeBatchSql(sql, lsParams);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog(e);
|
||||
}
|
||||
}
|
||||
|
||||
public int initDynamicTitle(Sheet sheet, List<Object> columns, CellStyle columnTopStyle, int rowIdx) {
|
||||
int cur_rowIndx = rowIdx+1;
|
||||
//title 总行数
|
||||
int title_rows = cur_rowIndx+getRowNums(columns)-1;
|
||||
createHeaderRow(sheet, cur_rowIndx, 0,columns,columnTopStyle,title_rows);
|
||||
return title_rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建表头
|
||||
*/
|
||||
private int createHeaderRow(Sheet sheet, int index, int cellIndex,
|
||||
List<Object> columnName, CellStyle columnTopStyle, int title_rows) {
|
||||
Row row = sheet.getRow(index) == null ? sheet.createRow(index) : sheet.getRow(index);
|
||||
int rows = getRowNums(columnName);
|
||||
for (int i = 0, exportFieldTitleSize = columnName.size(); i < exportFieldTitleSize; i++) {
|
||||
Map<String,Object> column = (Map<String, Object>) columnName.get(i);
|
||||
String title = Util.null2String(column.get("title"));
|
||||
createStringCell(row, cellIndex, title, columnTopStyle);
|
||||
if (column.get("children") != null) {
|
||||
List<Object> childchildColumns = (List<Object>) column.get("children");
|
||||
// 保持原来的
|
||||
int tempCellIndex = cellIndex;
|
||||
cellIndex = createHeaderRow(sheet, rows == 1 ? index : index + 1, cellIndex, childchildColumns,columnTopStyle,
|
||||
title_rows);
|
||||
if (childchildColumns.size() > 1) {
|
||||
addMergedRegion(sheet, index, index, tempCellIndex, cellIndex - 1);
|
||||
}
|
||||
cellIndex--;
|
||||
}else{
|
||||
addMergedRegion(sheet, index, title_rows, cellIndex, cellIndex);
|
||||
}
|
||||
cellIndex++;
|
||||
}
|
||||
return cellIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并单元格
|
||||
* @param sheet
|
||||
* @param firstRow
|
||||
* @param lastRow
|
||||
* @param firstCol
|
||||
* @param lastCol
|
||||
*/
|
||||
public void addMergedRegion(Sheet sheet, int firstRow, int lastRow, int firstCol, int lastCol) {
|
||||
try {
|
||||
if(firstRow == lastRow && firstCol == lastCol){
|
||||
return ;
|
||||
}
|
||||
CellRangeAddress region = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol);
|
||||
RegionUtil.setBorderBottom(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderLeft(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderRight(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderTop(BorderStyle.THIN, region, sheet);
|
||||
sheet.addMergedRegion(region);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 创建文本类型的Cell
|
||||
*/
|
||||
public void createStringCell(Row row, int cellIndex, String title, CellStyle columnTopStyle) {
|
||||
Cell cellRowName = row.createCell(cellIndex); //创建列头对应个数的单元格
|
||||
cellRowName.setCellType(CellType.STRING); //设置列头单元格的数据类型
|
||||
cellRowName.setCellValue(title); //设置列头单元格的值
|
||||
cellRowName.setCellStyle(columnTopStyle); //设置列头单元格样式
|
||||
}
|
||||
|
||||
public int initTitle(Sheet sheet, List<Object> columns, CellStyle columnTopStyle, int rowIdx) {
|
||||
List<Object> lsMergedRegion = new ArrayList<>();
|
||||
Map<String, Object> mergedRegion = null;
|
||||
int firstTitleRow = rowIdx + 1;
|
||||
int lastTitleRow = rowIdx + 2;
|
||||
Row rowRowName = sheet.createRow(++rowIdx); // 在索引2的位置创建行(最顶端的行开始的第二行)
|
||||
Row childRowRowName = null;
|
||||
// 定义所需列数
|
||||
Map<String, Object> column = null;
|
||||
List<Object> childColumn = null;
|
||||
int colIdx = 0;
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
column = (Map<String, Object>) columns.get(i);
|
||||
childColumn = (List<Object>) column.get("children");
|
||||
Cell cellRowName = rowRowName.createCell(colIdx++); //创建列头对应个数的单元格
|
||||
cellRowName.setCellType(CellType.STRING); //设置列头单元格的数据类型
|
||||
cellRowName.setCellValue(Util.null2String(column.get("title"))); //设置列头单元格的值
|
||||
cellRowName.setCellStyle(columnTopStyle); //设置列头单元格样式
|
||||
|
||||
if (Util.getIntValue(Util.null2String(column.get("rowSpan"))) == 2) {
|
||||
if (childRowRowName == null) {
|
||||
childRowRowName = sheet.createRow(++rowIdx);
|
||||
}
|
||||
mergedRegion = new HashMap<String, Object>();
|
||||
mergedRegion.put("startRow", firstTitleRow);
|
||||
mergedRegion.put("overRow", lastTitleRow);
|
||||
mergedRegion.put("startCol", colIdx - 1);
|
||||
mergedRegion.put("overCol", colIdx - 1);
|
||||
lsMergedRegion.add(mergedRegion);
|
||||
}
|
||||
|
||||
if (childColumn != null) {
|
||||
colIdx--;
|
||||
mergedRegion = new HashMap<String, Object>();
|
||||
mergedRegion.put("startRow", firstTitleRow);
|
||||
mergedRegion.put("overRow", firstTitleRow);
|
||||
mergedRegion.put("startCol", colIdx);
|
||||
for (int j = 0; j < childColumn.size(); j++) {
|
||||
column = (Map<String, Object>) childColumn.get(j);
|
||||
cellRowName = childRowRowName.createCell(colIdx++); //创建列头对应个数的单元格
|
||||
cellRowName.setCellType(CellType.STRING); //设置列头单元格的数据类型
|
||||
cellRowName.setCellValue(Util.null2String(column.get("title"))); //设置列头单元格的值
|
||||
cellRowName.setCellStyle(columnTopStyle);
|
||||
}
|
||||
mergedRegion.put("overCol", colIdx - 1);
|
||||
if (childColumn.size() > 1) {
|
||||
lsMergedRegion.add(mergedRegion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < lsMergedRegion.size(); i++) {
|
||||
mergedRegion = (Map<String, Object>) lsMergedRegion.get(i);
|
||||
Integer startrow = Util.getIntValue(Util.null2String(mergedRegion.get("startRow")));
|
||||
Integer overrow = Util.getIntValue(Util.null2String(mergedRegion.get("overRow")));
|
||||
Integer startcol = Util.getIntValue(Util.null2String(mergedRegion.get("startCol")));
|
||||
Integer overcol = Util.getIntValue(Util.null2String(mergedRegion.get("overCol")));
|
||||
CellRangeAddress region = new CellRangeAddress(startrow, overrow, startcol, overcol);
|
||||
RegionUtil.setBorderBottom(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderLeft(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderRight(BorderStyle.THIN, region, sheet);
|
||||
RegionUtil.setBorderTop(BorderStyle.THIN, region, sheet);
|
||||
sheet.addMergedRegion(region);
|
||||
}
|
||||
return rowIdx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取具体总共有多少列
|
||||
* @param columns
|
||||
* @return
|
||||
*/
|
||||
private int getColLength(List<Object> columns) {
|
||||
int length = -1;// 从0开始计算单元格的
|
||||
for(int i =0 ; i < columns.size() ; i++){
|
||||
Map<String,Object> column = (Map<String, Object>) columns.get(i);
|
||||
if (column.get("children") != null) {
|
||||
List<Object> childchildColumns = (List<Object>) column.get("children");
|
||||
length += getColLength(childchildColumns) + 1;
|
||||
} else {
|
||||
length++;
|
||||
}
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取具体总共有多少行
|
||||
*/
|
||||
public int getRowNums(List<Object> columns) {
|
||||
int cnt = 1;
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
Map<String,Object> column = (Map<String, Object>) columns.get(i);
|
||||
if (column.get("children") != null) {
|
||||
List<Object> childchildColumns = (List<Object>) column.get("children");
|
||||
int tmpcnt = 1+getRowNums(childchildColumns);
|
||||
if(tmpcnt > cnt){
|
||||
cnt = tmpcnt;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cnt > 1){
|
||||
return cnt;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public int getColumnLength(List<Object> columns) {
|
||||
int columnLength = 0;
|
||||
Map<String, Object> column = null;
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
column = (Map<String, Object>) columns.get(i);
|
||||
if (column.get("colSpan") != null) {
|
||||
columnLength += Util.getIntValue(Util.null2String(column.get("colSpan")));
|
||||
} else {
|
||||
columnLength++;
|
||||
}
|
||||
}
|
||||
return columnLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* /**
|
||||
* 获取excel单元格值
|
||||
*
|
||||
* @param cell 要读取的单元格对象
|
||||
* @return
|
||||
*/
|
||||
public static String getCellValue(Cell cell) {
|
||||
String cellValue = "";
|
||||
if (cell == null)
|
||||
return "";
|
||||
switch (cell.getCellType()) {
|
||||
case BOOLEAN: // 得到Boolean对象的方法
|
||||
cellValue = String.valueOf(cell.getBooleanCellValue());
|
||||
break;
|
||||
case NUMERIC:
|
||||
if (org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(cell)) {// 先看是否是日期格式
|
||||
SimpleDateFormat sft = new SimpleDateFormat("yyyy-MM-dd");
|
||||
cellValue = String.valueOf(sft.format(cell.getDateCellValue())); // 读取日期格式
|
||||
} else {
|
||||
cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字
|
||||
if (cellValue.endsWith(".0"))
|
||||
cellValue = cellValue.substring(0, cellValue.indexOf("."));
|
||||
}
|
||||
break;
|
||||
case FORMULA: // 读取公式
|
||||
cellValue = cell.getCellFormula();
|
||||
break;
|
||||
case STRING: // 读取String
|
||||
cellValue = cell.getStringCellValue();
|
||||
break;
|
||||
}
|
||||
|
||||
return cellValue;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue