|
|
|
@ -430,6 +430,12 @@ public class KQReportBiz extends BaseBean {
|
|
|
|
|
//考勤二开--异常考勤转事假
|
|
|
|
|
|
|
|
|
|
datas.putAll(getAbnAttToComLeaveData(params,user));
|
|
|
|
|
//考勤二开--上月请假
|
|
|
|
|
datas.putAll(getFlowLastLeaveData(params,user));
|
|
|
|
|
//考勤二开--上月销假
|
|
|
|
|
datas.putAll(getFlowLeaveLastBackData(params,user));
|
|
|
|
|
//考勤二开--上月加班
|
|
|
|
|
datas.putAll(getFlowLastOverTimeDataNew(params,user));
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
writeLog(e);
|
|
|
|
@ -1303,14 +1309,14 @@ public class KQReportBiz extends BaseBean {
|
|
|
|
|
}
|
|
|
|
|
//再查批量加班申请流程
|
|
|
|
|
String overtimeBatchTableName = basebean.getPropValue("project_sskj","overtimeBatchTableName");
|
|
|
|
|
String acqOverTimeBatchSql = "select jbry, ksrq, kssj, jsrq, jssj from ( " +
|
|
|
|
|
" select a.jbry, a.ksrq, a.kssj, a.jsrq, a.jssj, b.subcompanyid1, b.departmentid, b.managerstr, b.managerid, b.loginid " +
|
|
|
|
|
String acqOverTimeBatchSql = "select resourceid, ksrq, kssj, jsrq, jssj from ( " +
|
|
|
|
|
" select a.jbry as resourceid, a.ksrq, a.kssj, a.jsrq, a.jssj, b.subcompanyid1, b.departmentid, b.managerstr, b.managerid, b.loginid " +
|
|
|
|
|
" FROM "+overtimeBatchTableName+"_dt1 a " +
|
|
|
|
|
" left join hrmresource b on b.id = a.jbry " +
|
|
|
|
|
" ) c where c.ksrq >= '"+fromDate+"' and c.jsrq <='" + toDate + "' " + sqlWhere;
|
|
|
|
|
rs.executeQuery(acqOverTimeBatchSql);
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String resourceid = Util.null2String(rs.getString("jbry"));
|
|
|
|
|
String resourceid = Util.null2String(rs.getString("resourceid"));
|
|
|
|
|
String fromdate = Util.null2String(rs.getString("ksrq"));
|
|
|
|
|
String fromtime = Util.null2String(rs.getString("kssj"));
|
|
|
|
|
String todate = Util.null2String(rs.getString("jsrq"));
|
|
|
|
@ -1727,6 +1733,100 @@ public class KQReportBiz extends BaseBean {
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取上月请假数据
|
|
|
|
|
* @param params
|
|
|
|
|
* @param user
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String,Object> getFlowLastLeaveData(Map<String,Object> params, User user){
|
|
|
|
|
Map<String,Object> datas = new HashMap<>();;
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String sql = "";
|
|
|
|
|
String sqlWhere = " ";
|
|
|
|
|
try{
|
|
|
|
|
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
|
|
|
|
|
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 ="7";
|
|
|
|
|
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 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(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 b.resourceid 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<>'' ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+
|
|
|
|
|
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere +
|
|
|
|
|
" group by resourceid, newleavetype, durationrule ";
|
|
|
|
|
rs.execute(sql);
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String resourceid = rs.getString("resourceid");
|
|
|
|
|
String newleavetype = rs.getString("newleavetype");
|
|
|
|
|
String durationrule = rs.getString("durationrule");
|
|
|
|
|
double value = rs.getDouble("val")<0?0:rs.getDouble("val");
|
|
|
|
|
if( !newleavetype.equals("5")){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double proportion = Util.getDoubleValue(kqLeaveRulesComInfo.getProportion(newleavetype));
|
|
|
|
|
if(KQUnitBiz.isLeaveHour(newleavetype, kqLeaveRulesComInfo)){//按小时
|
|
|
|
|
if(!KQUnitBiz.isLeaveHour(durationrule)){
|
|
|
|
|
if(proportion>0) value = value*proportion;
|
|
|
|
|
}
|
|
|
|
|
}else{//按天
|
|
|
|
|
if(KQUnitBiz.isLeaveHour(durationrule)){
|
|
|
|
|
if(proportion>0) value = value/proportion;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String key = resourceid+"|lastleaveType_"+newleavetype;
|
|
|
|
|
if(datas.containsKey(key)){
|
|
|
|
|
value += Util.getDoubleValue(Util.null2String(datas.get(key)));
|
|
|
|
|
}
|
|
|
|
|
//df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了
|
|
|
|
|
df.setMaximumFractionDigits(5);
|
|
|
|
|
datas.put(key,format(value));
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
writeLog(e);
|
|
|
|
|
}
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取打卡数据用于判断外勤,补卡等信息===============================
|
|
|
|
|
public Map<String,Object> getCardMap(Map<String,Object> params, User user){
|
|
|
|
@ -1903,6 +2003,97 @@ public class KQReportBiz extends BaseBean {
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取上月销假数据
|
|
|
|
|
* @param params
|
|
|
|
|
* @param user
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String,Object> getFlowLeaveLastBackData(Map<String,Object> params, User user){
|
|
|
|
|
Map<String,Object> datas = new HashMap<>();;
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String sql = "";
|
|
|
|
|
String sqlWhere = " ";
|
|
|
|
|
try{
|
|
|
|
|
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
|
|
|
|
|
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 ="7";
|
|
|
|
|
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 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(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 b.resourceid 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<>'' ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+
|
|
|
|
|
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere +
|
|
|
|
|
" group by resourceid, newleavetype, durationrule ";
|
|
|
|
|
rs.execute(sql);
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String resourceid = rs.getString("resourceid");
|
|
|
|
|
String newleavetype = rs.getString("newleavetype");
|
|
|
|
|
String durationrule = rs.getString("durationrule");
|
|
|
|
|
double value = rs.getDouble("val")<0?0:rs.getDouble("val");
|
|
|
|
|
|
|
|
|
|
double proportion = Util.getDoubleValue(kqLeaveRulesComInfo.getProportion(newleavetype));
|
|
|
|
|
if(KQUnitBiz.isLeaveHour(newleavetype,kqLeaveRulesComInfo)){//按小时
|
|
|
|
|
if(!KQUnitBiz.isLeaveHour(durationrule)){
|
|
|
|
|
if(proportion>0) value = value*proportion;
|
|
|
|
|
}
|
|
|
|
|
}else{//按天
|
|
|
|
|
if(KQUnitBiz.isLeaveHour(durationrule)){
|
|
|
|
|
if(proportion>0) value = value/proportion;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String key = resourceid+"|lastleavebackType_"+newleavetype;
|
|
|
|
|
if(datas.containsKey(key)){
|
|
|
|
|
value += Util.getDoubleValue(Util.null2String(datas.get(key)));
|
|
|
|
|
}
|
|
|
|
|
//df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了
|
|
|
|
|
df.setMaximumFractionDigits(5);
|
|
|
|
|
datas.put(key,format(value));
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
writeLog(e);
|
|
|
|
|
}
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取考勤变更流程数据
|
|
|
|
|
* @param params
|
|
|
|
@ -2476,6 +2667,113 @@ public class KQReportBiz extends BaseBean {
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取上月实际加班数据,包括流程,打卡生成的
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String,Object> getFlowLastOverTimeDataNew(Map<String,Object> params, User user){
|
|
|
|
|
Map<String,Object> datas = new HashMap<>();;
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String sql = "";
|
|
|
|
|
String sqlWhere = " ";
|
|
|
|
|
try{
|
|
|
|
|
KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz();
|
|
|
|
|
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 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(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<>'' ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位
|
|
|
|
|
double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系
|
|
|
|
|
|
|
|
|
|
String valueField = "";
|
|
|
|
|
|
|
|
|
|
sql = " select resourceid,changeType, sum(cast(duration_min as decimal(18,4))) as val,paidLeaveEnable "+
|
|
|
|
|
" from hrmresource a, kq_flow_overtime b "+
|
|
|
|
|
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+
|
|
|
|
|
" group by resourceid,changeType,paidLeaveEnable ";
|
|
|
|
|
rs.execute(sql);
|
|
|
|
|
kqLog.info("getFlowOverTimeDataNew:sql:"+sql);
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String resourceid = rs.getString("resourceid");
|
|
|
|
|
String paidLeaveEnable = rs.getString("paidLeaveEnable");
|
|
|
|
|
int changeType =rs.getInt("changeType");//1-节假日、2-工作日、3-休息日
|
|
|
|
|
double value = rs.getDouble("val")<0?0:rs.getDouble("val");
|
|
|
|
|
if(uintType==3 || uintType== 5 || uintType== 6){//按小时计算
|
|
|
|
|
value = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(value/(60.0)+""));
|
|
|
|
|
}else{//按天计算
|
|
|
|
|
value = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(value/(60.0*hoursToDay)+""));
|
|
|
|
|
}
|
|
|
|
|
String flowType = "";
|
|
|
|
|
if(changeType==1){
|
|
|
|
|
flowType = "holidayOvertime";
|
|
|
|
|
}else if(changeType==2){
|
|
|
|
|
flowType = "workingDayOvertime";
|
|
|
|
|
}else if(changeType==3){
|
|
|
|
|
flowType = "restDayOvertime";
|
|
|
|
|
}
|
|
|
|
|
if("1".equalsIgnoreCase(paidLeaveEnable)){
|
|
|
|
|
//1表示关联调休
|
|
|
|
|
flowType += "_4leave";
|
|
|
|
|
}else{
|
|
|
|
|
//0表示不关联调休
|
|
|
|
|
flowType += "_nonleave";
|
|
|
|
|
}
|
|
|
|
|
String key = resourceid+"|"+flowType+"last";
|
|
|
|
|
//df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了
|
|
|
|
|
df.setMaximumFractionDigits(5);
|
|
|
|
|
if(datas.containsKey(key)){
|
|
|
|
|
double tmpVal = Util.getDoubleValue(Util.null2String(datas.get(key)),0.0);
|
|
|
|
|
tmpVal += value;
|
|
|
|
|
datas.put(key,format(tmpVal));
|
|
|
|
|
}else{
|
|
|
|
|
datas.put(key,format(value));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
writeLog(e);
|
|
|
|
|
}
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取加班数据
|
|
|
|
|