From cee9fb0e42ca5ec3fcde6e4315379ea9ce084552 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Thu, 10 Jul 2025 20:24:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8F=AD=E6=AC=A1=E7=BB=9F=E8=AE=A1=E3=80=81?= =?UTF-8?q?=E7=8F=AD=E6=AC=A1=E5=8F=91=E8=B5=B7=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../seconddev/attend/entity/po/ReportCol.java | 15 +++++++++ .../mapper/AttendanceSchedulingMapper.java | 10 ++++++ .../impl/AttendanceSchedulingServiceImpl.java | 19 +++++++++++- .../attend/summary/AttendCustomHook002.java | 31 ++++++++++++++++--- .../mapper/AttendanceSchedulingMapper.xml | 4 +++ 5 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/weaver/seconddev/attend/entity/po/ReportCol.java diff --git a/src/main/java/com/weaver/seconddev/attend/entity/po/ReportCol.java b/src/main/java/com/weaver/seconddev/attend/entity/po/ReportCol.java new file mode 100644 index 0000000..00042b6 --- /dev/null +++ b/src/main/java/com/weaver/seconddev/attend/entity/po/ReportCol.java @@ -0,0 +1,15 @@ +package com.weaver.seconddev.attend.entity.po; + +import lombok.Data; + +/** + * @author:dxfeng + * @createTime: 2025/07/10 + * @version: 1.0 + */ +@Data +public class ReportCol { + private Long id; + private String colName; + private String customFormula; +} diff --git a/src/main/java/com/weaver/seconddev/attend/mapper/AttendanceSchedulingMapper.java b/src/main/java/com/weaver/seconddev/attend/mapper/AttendanceSchedulingMapper.java index 4b41a1f..7d26621 100644 --- a/src/main/java/com/weaver/seconddev/attend/mapper/AttendanceSchedulingMapper.java +++ b/src/main/java/com/weaver/seconddev/attend/mapper/AttendanceSchedulingMapper.java @@ -2,6 +2,7 @@ package com.weaver.seconddev.attend.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.weaver.seconddev.attend.entity.po.PreSchedulingDetailPo; +import com.weaver.seconddev.attend.entity.po.ReportCol; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -15,4 +16,13 @@ import java.util.List; @Mapper public interface AttendanceSchedulingMapper extends BaseMapper { List getDetailList(@Param("formDataId") Long formDataId, @Param("tenantKey") String tenantKey); + + /** + * 获取自定义报表列 + * + * @param tenantKey + * @param customFormula + * @return + */ + ReportCol getReportCol(@Param("tenantKey") String tenantKey, @Param("customFormula") String customFormula); } diff --git a/src/main/java/com/weaver/seconddev/attend/service/impl/AttendanceSchedulingServiceImpl.java b/src/main/java/com/weaver/seconddev/attend/service/impl/AttendanceSchedulingServiceImpl.java index 9f32d82..6b819e8 100644 --- a/src/main/java/com/weaver/seconddev/attend/service/impl/AttendanceSchedulingServiceImpl.java +++ b/src/main/java/com/weaver/seconddev/attend/service/impl/AttendanceSchedulingServiceImpl.java @@ -18,6 +18,7 @@ import com.weaver.common.hrm.dao.HrmCommonEmployeeDao; import com.weaver.datasecurity.util.DateUtil; import com.weaver.framework.rpc.annotation.RpcReference; import com.weaver.seconddev.attend.entity.param.SummaryApprovalParam; +import com.weaver.seconddev.attend.entity.po.ReportCol; import com.weaver.seconddev.attend.entity.po.SchedulingStatusPo; import com.weaver.seconddev.attend.mapper.AttendanceSchedulingMapper; import com.weaver.seconddev.attend.mapper.SchedulingStatusMapper; @@ -583,7 +584,23 @@ public class AttendanceSchedulingServiceImpl implements AttendanceSchedulingServ summaryApprovalParams.add(new SummaryApprovalParam("未签到次数", "wqdcs", 1144950543713460227L, "absenseNumOfMonth")); summaryApprovalParams.add(new SummaryApprovalParam("未签退次数", "wqtcs", 1144950543713460228L, "unSignOutNumOfMonth")); summaryApprovalParams.add(new SummaryApprovalParam("未打卡次数", "wdkcs", 1144950818599755777L, "unSignNum")); - //TODO 班次统计 + + ReportCol ATTEND_CUSTOM_HOOK_001 = schedulingMapper.getReportCol(UserContext.getCurrentUser().getTenantKey(), "ATTEND_CUSTOM_HOOK_001"); + if (null != ATTEND_CUSTOM_HOOK_001) { + summaryApprovalParams.add(new SummaryApprovalParam("白班", "bb", 1149047276637143041L, ATTEND_CUSTOM_HOOK_001.getId().toString())); + } + ReportCol ATTEND_CUSTOM_HOOK_002 = schedulingMapper.getReportCol(UserContext.getCurrentUser().getTenantKey(), "ATTEND_CUSTOM_HOOK_002"); + if (null != ATTEND_CUSTOM_HOOK_002) { + summaryApprovalParams.add(new SummaryApprovalParam("中班", "zb", 1149047276637143042L, ATTEND_CUSTOM_HOOK_002.getId().toString())); + } + ReportCol ATTEND_CUSTOM_HOOK_003 = schedulingMapper.getReportCol(UserContext.getCurrentUser().getTenantKey(), "ATTEND_CUSTOM_HOOK_003"); + if (null != ATTEND_CUSTOM_HOOK_003) { + summaryApprovalParams.add(new SummaryApprovalParam("夜班", "yb", 1149047276637143043L, ATTEND_CUSTOM_HOOK_003.getId().toString())); + } + ReportCol ATTEND_CUSTOM_HOOK_004 = schedulingMapper.getReportCol(UserContext.getCurrentUser().getTenantKey(), "ATTEND_CUSTOM_HOOK_004"); + if (null != ATTEND_CUSTOM_HOOK_004) { + summaryApprovalParams.add(new SummaryApprovalParam("大夜", "dy", 1149047276637143044L, ATTEND_CUSTOM_HOOK_004.getId().toString())); + } // 每日统计数据 diff --git a/src/main/java/com/weaver/seconddev/attend/summary/AttendCustomHook002.java b/src/main/java/com/weaver/seconddev/attend/summary/AttendCustomHook002.java index b44a71d..9fc2a6a 100644 --- a/src/main/java/com/weaver/seconddev/attend/summary/AttendCustomHook002.java +++ b/src/main/java/com/weaver/seconddev/attend/summary/AttendCustomHook002.java @@ -9,11 +9,17 @@ import com.weaver.loom.context.domain.AppInfo; import com.weaver.loom.context.domain.WeaHookRequest; import com.weaver.loom.context.domain.WeaHookResponse; import com.weaver.loom.context.register.RegHookEvent; +import com.weaver.seconddev.attend.entity.po.ShiftStatistics; import com.weaver.seconddev.attend.mapper.ShiftStatisticMapper; +import com.weaver.workflow.common.entity.org.WeaUser; +import com.weaver.workflow.common.util.OrgUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; import java.util.Map; /** @@ -33,13 +39,28 @@ public class AttendCustomHook002 extends RegHookEvent { public WeaHookResponse handle(WeaHookRequest request, WeaHookResponse response, AppInfo appInfo) throws Exception { //入参,修改入参并不会影响到埋点的原始数据 Map params = request.getParams(); - log.error("ATTEND_CUSTOM_HOOK_002获取入参,params==" + JSON.toJSONString(params)); - + String attendDate = String.valueOf(params.get("attendDate")); + log.error("ATTEND_CUSTOM_HOOK_002,params==" + JSON.toJSONString(params)); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Date newD = new Date(attendDate); + String kqdate = sdf.format(newD); + List empIdsList = (List) params.get("empIds"); Table result = HashBasedTable.create(); - log.error("result111=="+JSON.toJSONString(result)); + for (int i = 0, n = empIdsList.size(); i < n; i++) { + String id = String.valueOf(empIdsList.get(i)); + WeaUser user = OrgUtil.getUser(Long.parseLong(id)); + String tenantKey = user.getTenantKey(); + log.error("tenantKey==" + tenantKey + ",id==" + id + ",kqdate==" + kqdate + ",attendDate==" + attendDate); + ShiftStatistics shiftStatistics = shiftStatisticMapper.getShiftStatistics(tenantKey, Long.valueOf(id), kqdate); + Double value = 0.0; + log.error("shiftStatistics==" + JSON.toJSONString(shiftStatistics)); + if (null != shiftStatistics && "白班".equals(shiftStatistics.getName())) { + value = 1.0; + } + log.error("value==" + value); + result.put(Long.parseLong(id), Long.parseLong(id), value); - result.put(1L, 1L, 1D); - log.error("result222=="+JSON.toJSONString(result)); + } response.setResult(result); return response; } diff --git a/src/main/resources/mapper/AttendanceSchedulingMapper.xml b/src/main/resources/mapper/AttendanceSchedulingMapper.xml index 72b28a5..c65f86f 100644 --- a/src/main/resources/mapper/AttendanceSchedulingMapper.xml +++ b/src/main/resources/mapper/AttendanceSchedulingMapper.xml @@ -24,4 +24,8 @@ and t.tenant_key = #{tenantKey} and t.form_data_id=#{formDataId} +