班次统计、班次发起流程

This commit is contained in:
dxfeng 2025-07-10 20:24:33 +08:00
parent 3f9fd19504
commit cee9fb0e42
5 changed files with 73 additions and 6 deletions

View File

@ -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;
}

View File

@ -2,6 +2,7 @@ package com.weaver.seconddev.attend.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.weaver.seconddev.attend.entity.po.PreSchedulingDetailPo; 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.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -15,4 +16,13 @@ import java.util.List;
@Mapper @Mapper
public interface AttendanceSchedulingMapper extends BaseMapper<PreSchedulingDetailPo> { public interface AttendanceSchedulingMapper extends BaseMapper<PreSchedulingDetailPo> {
List<PreSchedulingDetailPo> getDetailList(@Param("formDataId") Long formDataId, @Param("tenantKey") String tenantKey); List<PreSchedulingDetailPo> getDetailList(@Param("formDataId") Long formDataId, @Param("tenantKey") String tenantKey);
/**
* 获取自定义报表列
*
* @param tenantKey
* @param customFormula
* @return
*/
ReportCol getReportCol(@Param("tenantKey") String tenantKey, @Param("customFormula") String customFormula);
} }

View File

@ -18,6 +18,7 @@ import com.weaver.common.hrm.dao.HrmCommonEmployeeDao;
import com.weaver.datasecurity.util.DateUtil; import com.weaver.datasecurity.util.DateUtil;
import com.weaver.framework.rpc.annotation.RpcReference; import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.attend.entity.param.SummaryApprovalParam; 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.entity.po.SchedulingStatusPo;
import com.weaver.seconddev.attend.mapper.AttendanceSchedulingMapper; import com.weaver.seconddev.attend.mapper.AttendanceSchedulingMapper;
import com.weaver.seconddev.attend.mapper.SchedulingStatusMapper; 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("未签到次数", "wqdcs", 1144950543713460227L, "absenseNumOfMonth"));
summaryApprovalParams.add(new SummaryApprovalParam("未签退次数", "wqtcs", 1144950543713460228L, "unSignOutNumOfMonth")); summaryApprovalParams.add(new SummaryApprovalParam("未签退次数", "wqtcs", 1144950543713460228L, "unSignOutNumOfMonth"));
summaryApprovalParams.add(new SummaryApprovalParam("未打卡次数", "wdkcs", 1144950818599755777L, "unSignNum")); 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()));
}
// 每日统计数据 // 每日统计数据

View File

@ -9,11 +9,17 @@ import com.weaver.loom.context.domain.AppInfo;
import com.weaver.loom.context.domain.WeaHookRequest; import com.weaver.loom.context.domain.WeaHookRequest;
import com.weaver.loom.context.domain.WeaHookResponse; import com.weaver.loom.context.domain.WeaHookResponse;
import com.weaver.loom.context.register.RegHookEvent; 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.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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -33,13 +39,28 @@ public class AttendCustomHook002 extends RegHookEvent {
public WeaHookResponse handle(WeaHookRequest request, WeaHookResponse response, AppInfo appInfo) throws Exception { public WeaHookResponse handle(WeaHookRequest request, WeaHookResponse response, AppInfo appInfo) throws Exception {
//入参修改入参并不会影响到埋点的原始数据 //入参修改入参并不会影响到埋点的原始数据
Map<String, Object> params = request.getParams(); Map<String, Object> 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<Long, Long, Double> result = HashBasedTable.create(); Table<Long, Long, Double> 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); response.setResult(result);
return response; return response;
} }

View File

@ -24,4 +24,8 @@
and t.tenant_key = #{tenantKey} and t.tenant_key = #{tenantKey}
and t.form_data_id=#{formDataId} and t.form_data_id=#{formDataId}
</select> </select>
<select id="getReportCol" resultType="com.weaver.seconddev.attend.entity.po.ReportCol">
select id, col_name as colName, custom_formula as customFormula from attend_report_col_customize where
delete_type = 0 and tenant_key = #{tenantKey} and custom_formula = #{customFormula}
</select>
</mapper> </mapper>