根据矩阵信息可以查看对应部门或人员的出勤数据 (包括对应日期的班次筛选)

AISIN
Chengliang 6 months ago
parent bc69c9e7e9
commit bc9712fd84

@ -0,0 +1,34 @@
package com.engine.aisin.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Author liang.cheng
* @Date 2024/11/18 10:26 AM
* @Description: TODO
* @Version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class KqStatisticsItemVo {
private String name;
private String id;
private String title;
private String type;
private String value;
}

@ -0,0 +1,34 @@
package com.engine.aisin.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Author liang.cheng
* @Date 2024/11/18 10:26 AM
* @Description: TODO
* @Version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class KqStatisticsVo {
private String name;
private String id;
private String title;
private String value;
private List<KqStatisticsItemVo> items;
}

@ -1,6 +1,8 @@
package com.engine.aisin.service;
import com.engine.aisin.entity.KqStatisticsVo;
import java.util.Map;
/**
@ -26,5 +28,5 @@ public interface AccessCustomService {
* @param: []
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
Map<String,Object> getKqAccess();
KqStatisticsVo getKqAccess(Map<String,Object> params);
}

@ -56,7 +56,7 @@ public class AccessCustomAction {
Map<String, Object> data = new HashMap<>(8);
try {
User user = HrmUserVarify.getUser(request, response);
data.put("datas",getService(user).getKqAccess());
data.put("datas",getService(user).getKqAccess(ParamUtil.request2Map(request)));
data.put("api_status", true);
} catch (Exception e) {
data.put("api_status", false);

@ -400,6 +400,7 @@ public class KQFlowUtil {
}
}else if(flowTypeEnum == KqSplitFlowTypeEnum.OVERTIME){
// 强制归档,加班数据第一第二种规则都需要处理
kqLog.info("强制归档:"+requestId);
SplitActionUtil.handleOverTimeAction(splitBeans, ""+requestId,true, "");
}
}else{

@ -2,6 +2,8 @@ package test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.aisin.entity.KqStatisticsItemVo;
import com.engine.aisin.entity.KqStatisticsVo;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.interfaces.aisin.cron.KqConfirmWfCrob;
@ -9,7 +11,9 @@ import weaver.interfaces.aisin.cron.KqConfirmWfCrob;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -21,19 +25,31 @@ import java.util.Map;
public class MainTest {
public static void main(String[] args) {
String sql_b = "";
String sql_c = "";
String ruleId = "4";
String searchYear ="2024";
String currentDate = "10";
sql_b = "select resourceId,sum(tiaoxiuamount) alltiaoxiuamountB,sum(extraAmount) allExtraAmountB,sum(baseAmount) allBaseAmountB,sum(usedAmount) allUsedAmountB from KQ_BalanceOfLeave where (isDelete is null or isDelete<>1) and leaveRulesId=" + ruleId + " and belongYear='" + searchYear + "' and (expirationDate is null or expirationDate='' or expirationDate>='" + currentDate + "') group by resourceId,leaveRulesId,belongYear ";
sql_c = "select resourceId,sum(tiaoxiuamount) alltiaoxiuamountC,sum(extraAmount) allExtraAmountC,sum(baseAmount) allBaseAmountC,sum(usedAmount) allUsedAmountC from KQ_BalanceOfLeave where (isDelete is null or isDelete<>1) and leaveRulesId=" + ruleId + " and belongYear='" + searchYear + "' and (expirationDate is not null and expirationDate<>'' and expirationDate<'" + currentDate + "') group by resourceId,leaveRulesId,belongYear ";
String backFields = " a.id,a.dspOrder,a.lastName,a.workcode,a.subCompanyId1,a.departmentId,a.companyStartDate,a.workStartDate,a.id resourceId," + ruleId + " as leaveRulesId,0 as allTotalAmount,0 as allUsedAmount,0 as allInvalidAmount,0 as allRestAmount,0 as detailShow," +
"b.allBaseAmountB,b.alltiaoxiuamountB,b.allExtraAmountB,b.allUsedAmountB,c.alltiaoxiuamountC,c.allBaseAmountC,c.allExtraAmountC,c.allUsedAmountC ";
String sqlFrom = " from HrmResource a left join (" + sql_b + ") b on a.id=b.resourceId left join (" + sql_c + ") c on a.id=c.resourceId ";
String sqlWhere = " where 1=1 and a.status in (0,1,2,3) ";
System.out.println("select "+backFields+sqlFrom+sqlWhere);
List<KqStatisticsItemVo> kqStatisticsItemVoList = new ArrayList<>();
kqStatisticsItemVoList.add(KqStatisticsItemVo.builder()
.name("未出勤人数")
.id("leavePersons")
.title("未出勤人数")
.type("ABSENT")
.value("0")
.build());
kqStatisticsItemVoList.add(KqStatisticsItemVo.builder()
.name("实际出勤人数")
.id("realPersons")
.title("实际出勤人数")
.type("REALPERSONS")
.value("0")
.build());
KqStatisticsVo build = KqStatisticsVo.builder()
.name("应出勤(人)")
.id("workPersons")
.title("出勤统计")
.value("0")
.items(kqStatisticsItemVoList)
.build();
System.out.println(build.toString());
}
public static String firstDayOfMonth(String yearMonthStr) {

@ -136,7 +136,7 @@ public class KqConfirmWfCrob extends BaseCronJob {
//2.1 明细表1班次
List<ScheDetailTableInfo> scheDetails = new ArrayList<>();
rs.executeQuery("select kqdate,serialid from kq_shiftschedule where kqdate >= '"+firstDayOfMonth+"' and kqdate <= '"+lastDayOfMonth+"' \n" +
" and resourceid = ? and isdelete = 0",e.getResourceId());
" and resourceid = ? and isdelete = 0 order by kqdate asc",e.getResourceId());
while (rs.next()) {
scheDetails.add(ScheDetailTableInfo.builder().date(Util.null2String(rs.getString("kqdate")))
.serialId(Util.null2String(rs.getString("serialid"))).build());
@ -147,7 +147,7 @@ public class KqConfirmWfCrob extends BaseCronJob {
//2.2 明细表2加班
List<FlowDetailTableInfo> flowDetails = new ArrayList<>();
rs.executeQuery("select belongdate,duration_min from KQ_FLOW_OVERTIME where belongdate >= '"+firstDayOfMonth+"' and belongdate <= '"+lastDayOfMonth+"' \n" +
" and resourceid = ?",e.getResourceId());
" and resourceid = ? order by belongdate asc",e.getResourceId());
while (rs.next()){
String belongdate = Util.null2String(rs.getString("belongdate"));
String duration_min = Util.null2String(rs.getString("duration_min"));
@ -166,7 +166,7 @@ public class KqConfirmWfCrob extends BaseCronJob {
//2.3 明细表3请假
List<LeaveDetailTableInfo> leaveDetails = new ArrayList<>();
rs.executeQuery("select belongDate,newleavetype,d_mins,serialid,leavebackrequestid from kq_flow_split_leave where belongDate >= '"+firstDayOfMonth+"' and belongDate <= '"+lastDayOfMonth+"' \n" +
" and resourceid = ?",e.getResourceId());
" and resourceid = ? order by belongdate asc",e.getResourceId());
while (rs.next()) {
String belongDate = Util.null2String(rs.getString("belongDate"));
String serialId = Util.null2String(rs.getString("serialid"));
@ -179,10 +179,6 @@ public class KqConfirmWfCrob extends BaseCronJob {
leaveBackMins = leaveBack(leavebackrequestid, e.getResourceId(), belongDate);
}
String reduce = getReduce(d_mins, leaveBackMins);
//test
if ("8595".equals(e.getResourceId())) {
bb.writeLog("测试请假仙女14 =>" +d_mins+","+leaveBackMins);
}
if (!d_mins.equals(leaveBackMins)) {
leaveDetails.add(LeaveDetailTableInfo.builder()
.date(belongDate)
@ -244,9 +240,15 @@ public class KqConfirmWfCrob extends BaseCronJob {
*/
private String leaveBack(String leavebackrequestid,String resourceId,String belongDate){
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
//leavebackrequestid 格式 ,123456,123467
List<String> strings = Arrays.asList(leavebackrequestid.split(","));
String join = CollectionUtil.join(strings, ",");
//去除空字符串
List<String> filteredStrings = strings.stream()
.filter(str -> !str.isEmpty())
.collect(Collectors.toList());
String join = CollectionUtil.join(filteredStrings, ",");
bb.writeLog("销假requestid =>"+leavebackrequestid+"=>"+join);
List<Integer> list = new ArrayList<>();
rs.executeQuery("select D_Mins from kq_flow_split_leaveback where resourceid = ? and requestid in ("+join+") " +
" and belongDate = '"+belongDate+"'",resourceId);

Loading…
Cancel
Save