Compare commits

..

No commits in common. "main" and "lee-dev" have entirely different histories.

32 changed files with 246 additions and 1265 deletions

View File

@ -1,163 +0,0 @@
package com.weaver.seconddev.entry.action;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.common.hrm.dao.HrmCommonEmployeeDao;
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuOpenIdUtil;
import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuSendMessageUtil;
import com.weaver.seconddev.entry.entity.MessageSendConfig;
import com.weaver.seconddev.entry.mapper.SendMessageMapper;
import com.weaver.seconddev.portal.entity.param.BaseParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author:dxfeng
* @createTime: 2025/08/26
* @version: 1.0
*/
@Slf4j
@Service("SendMessageAction")
public class SendMessageAction implements EsbServerlessRpcRemoteInterface {
@Autowired
Esb2FeishuSendMessageUtil esb2FeishuSendMessageUtil;
@Autowired
SendMessageMapper sendMessageMapper;
@Autowired
HrmCommonEmployeeDao hrmCommonEmployeeDao;
@Autowired
Esb2FeishuOpenIdUtil esb2FeishuOpenIdUtil;
@Override
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
// ID
String employeeId = Convert.toStr(params.get("employeeId"), "");
//if(null==employeeId){
// return WeaResult.fail("动作流配置[employeeId]参数获取异常",true);
//}
// 当前部门ID
String departmentId = Convert.toStr(params.get("departmentId"), "");
String templateId = (String) params.get("templateId");
String templateVersionName = (String) params.get("templateVersionName");
String content = (String) params.get("content");
log.error("params===" + JSON.toJSONString(params));
BaseParam baseParam = new BaseParam();
MessageSendConfig messageSendConfig = sendMessageMapper.getMessageSendConfig(baseParam, departmentId);
while (messageSendConfig == null && StringUtils.isNotBlank(departmentId)) {
String parentDepartmentId = sendMessageMapper.getParentDepartmentId(baseParam, departmentId);
// 防止无限循环如果parentDepartmentId为空或与当前departmentId相同则跳出循环
if (StringUtils.isBlank(parentDepartmentId) || parentDepartmentId.equals(departmentId)) {
log.error("部门上下级数据异常departmentId==" + departmentId);
break;
}
departmentId = parentDepartmentId;
messageSendConfig = sendMessageMapper.getMessageSendConfig(baseParam, departmentId);
}
if (null == messageSendConfig) {
return WeaResult.success();
}
log.error("messageSendConfig===" + JSON.toJSONString(messageSendConfig));
Set<String> userIdList = new HashSet<>();
if (1 == messageSendConfig.getZjsj() && StringUtils.isNotBlank(employeeId)) {
// 发送消息给直接上级
String superior = sendMessageMapper.getSuperior(baseParam, employeeId);
if (StringUtils.isBlank(superior)) {
superior = sendMessageMapper.getSuperiorFromEntry(baseParam, employeeId);
}
userIdList.add(superior);
}
if (1 == messageSendConfig.getJgsjzjssj() && StringUtils.isNotBlank(employeeId)) {
// 发送消息给间接上级
String superior = sendMessageMapper.getSuperior(baseParam, employeeId);
if (StringUtils.isBlank(superior)) {
superior = sendMessageMapper.getSuperiorFromEntry(baseParam, employeeId);
if (StringUtils.isNotBlank(superior)) {
superior = sendMessageMapper.getSuperiorFromEntry(baseParam, superior);
}
} else {
superior = sendMessageMapper.getSuperior(baseParam, superior);
}
userIdList.add(superior);
}
if (1 == messageSendConfig.getXxsj() && StringUtils.isNotBlank(employeeId)) {
// 发送消息给虚线上级
String otherSuperior = sendMessageMapper.getOtherSuperior(baseParam, employeeId);
if (StringUtils.isBlank(otherSuperior)) {
otherSuperior = sendMessageMapper.getOtherSuperiorFromEntry(baseParam, employeeId);
}
userIdList.add(otherSuperior);
}
Map<String, Object> departmentCustomData = sendMessageMapper.getDepartmentCustomData(baseParam, departmentId);
if (1 == messageSendConfig.getBmfzr()) {
// 发送消息给部门负责人
String bmfzr = Convert.toStr(departmentCustomData.get("bmfzr"), "");
userIdList.add(bmfzr);
}
if (1 == messageSendConfig.getTbmyg()) {
// 发送消息给同部门员工
List<String> employeeIdsByDeptId = sendMessageMapper.getEmployeeIdsByDeptId(baseParam, departmentId);
userIdList.addAll(employeeIdsByDeptId);
}
if (1 == messageSendConfig.getHrbp()) {
// 发送消息给HRBP
String hrbp = Convert.toStr(departmentCustomData.get("hrbp"), "");
userIdList.add(hrbp);
}
if (1 == messageSendConfig.getFgld()) {
// 发送消息给分管领导
String fgld = Convert.toStr(departmentCustomData.get("fgld"), "");
userIdList.add(fgld);
}
for (String userId : userIdList) {
if (StringUtils.isBlank(userId)) {
continue;
}
// 获取飞书ID
String openId = this.esb2FeishuOpenIdUtil.queryFeishuOpenId(userId);
if (StringUtils.isBlank(openId)) {
log.error("userId=={},未获取到飞书openId", userId);
}
// 发送消息
if (0 == messageSendConfig.getXxlx()) {
// 文本消息
esb2FeishuSendMessageUtil.senTextMessage(content, openId);
} else if (1 == messageSendConfig.getXxlx()) {
// 卡片消息
esb2FeishuSendMessageUtil.senCardMessage(templateId, templateVersionName, openId, params);
}
}
return WeaResult.success();
}
}

View File

@ -27,8 +27,8 @@ public class EntryManageController {
HrComEstService hrComEstService;
@GetMapping("/checkJobNum")
public WeaResult<Map<String, Object>> checkJobNum(@RequestParam("jobNum") String jobNum,@RequestParam("userName") String userName) {
return entryManageService.checkJobNum(jobNum,userName);
public WeaResult<Map<String, Object>> checkJobNum(@RequestParam("jobNum") String jobNum) {
return entryManageService.checkJobNum(jobNum);
}
@PostMapping("/uploadFiles")

View File

@ -1,31 +0,0 @@
package com.weaver.seconddev.entry.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author:dxfeng
* @createTime: 2025/08/26
* @version: 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class MessageSendConfig {
private String bm;
private Long ry;
private int xxlx;
private String ms;
private int zjsj;
private int jgsjzjssj;
private int xxsj;
private int bmfzr;
private int tbmyg;
private int hrbp;
private int fgld;
}

View File

@ -21,8 +21,6 @@ public interface EntryManageMapper {
*/
Long getEntryRecordIdByJobNum(@Param("param") BaseParam param, @Param("jobNum") String jobNum);
Long getEntryRecordIdByJobNumAndName(@Param("param") BaseParam param, @Param("jobNum") String jobNum,@Param("userName") String userName);
Long updateFilesInfo(@Param("param") BaseParam param, @Param("employeeId") Long employeeId);
}

View File

@ -1,34 +0,0 @@
package com.weaver.seconddev.entry.mapper;
import com.weaver.seconddev.entry.entity.MessageSendConfig;
import com.weaver.seconddev.portal.entity.param.BaseParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2025/08/26
* @version: 1.0
*/
@Mapper
public interface SendMessageMapper {
String getParentDepartmentId(@Param("param") BaseParam param, @Param("departmentId") String departmentId);
MessageSendConfig getMessageSendConfig(@Param("param") BaseParam param, @Param("departmentId") String departmentId);
String getSuperior(@Param("param") BaseParam param, @Param("employeeId") String employeeId);
String getOtherSuperior(@Param("param") BaseParam param, @Param("employeeId") String employeeId);
String getSuperiorFromEntry(@Param("param") BaseParam param, @Param("employeeId") String employeeId);
String getOtherSuperiorFromEntry(@Param("param") BaseParam param, @Param("employeeId") String employeeId);
Map<String, Object> getDepartmentCustomData(@Param("param") BaseParam param, @Param("departmentId") String departmentId);
List<String> getEmployeeIdsByDeptId(@Param("param") BaseParam param, @Param("departmentId") String departmentId);
}

View File

@ -15,10 +15,9 @@ public interface EntryManageService {
* 校验工号
*
* @param jobNum 工号
* @param userName 姓名
* @return
*/
WeaResult<Map<String, Object>> checkJobNum(String jobNum,String userName);
WeaResult<Map<String, Object>> checkJobNum(String jobNum);
/**
* 上传文件

View File

@ -60,14 +60,14 @@ public class EntryManageServiceImpl implements EntryManageService {
BaseParam baseParam = new BaseParam();
@Override
public WeaResult<Map<String, Object>> checkJobNum(String jobNum,String userName) {
public WeaResult<Map<String, Object>> checkJobNum(String jobNum) {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("isExist", false);
if (StringUtils.isBlank(jobNum)) {
return WeaResult.fail("工号获取异常", true);
}
Long empIdByJobNum = entryManageMapper.getEntryRecordIdByJobNumAndName(baseParam, jobNum,userName);
Long empIdByJobNum = entryManageMapper.getEntryRecordIdByJobNum(baseParam, jobNum);
dataMap.put("isExist", null != empIdByJobNum);
dataMap.put("empId", empIdByJobNum);
return WeaResult.success(dataMap);

View File

@ -2,11 +2,13 @@ package com.weaver.seconddev.portal.controller;
import com.weaver.common.authority.annotation.WeaPermission;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.seconddev.portal.entity.po.PortalPO;
import com.weaver.seconddev.portal.service.LeaderCockpitService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
@ -39,12 +41,12 @@ public class LeaderCockpitController {
}
@PostMapping("/getAttendanceRate")
private WeaResult<Map<String, Object>> getAttendanceRate(@RequestBody Map<String, String> params) {
private WeaResult<List<PortalPO>> getAttendanceRate(@RequestBody Map<String, String> params) {
return leaderCockpitService.getAttendanceRate(params);
}
@PostMapping("/getFullStaffingRate")
private WeaResult<Map<String, Object>> getFullStaffingRate(@RequestHeader Map<String, String> header, @RequestBody Map<String, String> params) {
private WeaResult<List<PortalPO>> getFullStaffingRate(@RequestHeader Map<String, String> header, @RequestBody Map<String, String> params) {
return leaderCockpitService.getFullStaffingRate(header, params);
}

View File

@ -21,7 +21,7 @@ import java.util.Map;
*/
@Slf4j
@RestController
@RequestMapping("/api/secondev/portal/manager")
@RequestMapping("/api/secondev/portal/manager")
@WeaPermission(publicPermission = true)
public class ManagerPortalController {

View File

@ -26,17 +26,9 @@ public class SscPortalController {
@Autowired
SscPortalService sscPortalService;
@PostMapping("/getToDo")
private WeaResult<Map<String, Object>> getToDo(@RequestBody Map<String, String> params) {
return sscPortalService.getToDo(params);
}
@PostMapping("/getExpirationReminder")
private WeaResult<ExpirationReminderPo> getExpirationReminder(@RequestBody Map<String, String> params) {
return sscPortalService.getExpirationReminder(params);
}
@PostMapping("/getEmployeeData")
private WeaResult<Map<String, Object>> getEmployeeData(@RequestBody Map<String, String> params) {
return sscPortalService.getEmployeeData(params);
}
}

View File

@ -15,14 +15,6 @@ public class BaseParam {
private String e10_other_business = "e10_other_business";
private String ec_secondev = "ec_secondev";
private String eteams = "eteams";
/**
* hrbp矩阵id
*/
private String hrbp_matrix_id = "1174700317532454913";
/**
* hrbp矩阵hrbp字段id
*/
private String hrbp_matrix_value_config_id = "1174700536634507265";
/**
* 部门自定义表
@ -37,10 +29,10 @@ public class BaseParam {
* 请假表单
*/
private String leaveFormCus = "ft_1151420254779654145";
/**
* 员工自定义表
*/
private String table_emp_cus = "ft_1152026012537184302";
///**
// * 员工自定义表
// */
//private String table_emp_cus = "ft_1152026012537184302";
/**
* 人事档案-个人信息表

View File

@ -3,7 +3,6 @@ package com.weaver.seconddev.portal.entity.param;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.Set;
/**
@ -14,7 +13,7 @@ import java.util.Set;
@Data
@EqualsAndHashCode(callSuper = false)
public class BasicPersonnelParam extends BaseParam {
private Set<String> departmentIdList;
private Set<Long> departmentIdList;
private String searchType;
private String startDate;
private String endDate;
@ -22,7 +21,6 @@ public class BasicPersonnelParam extends BaseParam {
private Integer startIndex;
private Integer endIndex;
private String belongYear;
private Date paramDate;
/*分页查询*/
@ -31,4 +29,8 @@ public class BasicPersonnelParam extends BaseParam {
private Integer current;
private Integer offset;
private Integer pageSize;
public Integer getOffset() {
return (current - 1) * pageSize;
}
}

View File

@ -3,7 +3,6 @@ package com.weaver.seconddev.portal.entity.param;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.Set;
/**
@ -13,8 +12,9 @@ import java.util.Set;
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class HrbpParam extends BaseParam {
private Set<String> departmentIdList;
private String userId;
private Date paramDate;
public class HrbpParam extends com.weaver.seconddev.portal.entity.param.BaseParam {
private Set<Long> departmentIdList;
private Long matrixId;
private Long matrixValueConfigId;
private Long userId;
}

View File

@ -14,7 +14,7 @@ import java.util.Set;
@EqualsAndHashCode(callSuper = false)
public class SearchConditionParam extends BaseParam{
private String departmentId;
private Set<String> departmentIdList;
private Set<Long> departmentIdList;
private String searchDate;
private String startDate;
private String endDate;

View File

@ -29,7 +29,6 @@ public class EmployeeBasicInfoPo {
*/
private String companyName;
private String departmentName;
private String positionName;
/**
* 入职日期
*/
@ -92,7 +91,4 @@ public class EmployeeBasicInfoPo {
*/
private String exceptionalAttendance;
private String exceptionalAttendanceUrl;
private String reissueCardNum;
private String reissueCardNumUrl;
}

View File

@ -3,8 +3,6 @@ package com.weaver.seconddev.portal.mapper.portal;
import com.weaver.seconddev.portal.entity.param.HrbpParam;
import org.apache.ibatis.annotations.Mapper;
import java.util.Set;
/**
* @author:dxfeng
* @createTime: 2025/07/10
@ -132,27 +130,4 @@ public interface HrbpPortalMapper {
*/
int getKqRequireByBp(HrbpParam param);
/**
* 部门矩阵可查看的所有今日有打卡人数
* @param param
* @return
*/
int getTodayAllSignByBp(HrbpParam param);
/**
* 部门矩阵可查看的某日迟到人数
* @param param
* @return
*/
int getTotalLateByBp(HrbpParam param);
int getTodayNoSign(HrbpParam hrbpParam);
/**
* 部门矩阵可查看的某日休假人数
* @param param
* @return
*/
int getTotalVacationByBp(HrbpParam param);
Set<String> getAllDeptIdsByHrbp(HrbpParam param);
}

View File

@ -44,7 +44,7 @@ public interface LeaderCockpitMapper {
* @param endDate
* @return
*/
int getEmploymentCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<String> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
int getEmploymentCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
/**
* 查询入职人数列表
@ -55,7 +55,7 @@ public interface LeaderCockpitMapper {
* @param endDate
* @return
*/
List<PortalPO> getEmploymentListByPosition(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<String> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
List<PortalPO> getEmploymentListByPosition(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
/**
* 查询关键入职人数
@ -66,7 +66,7 @@ public interface LeaderCockpitMapper {
* @param endDate
* @return
*/
int getKeyEmploymentCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<String> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
int getKeyEmploymentCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
/**
@ -78,7 +78,7 @@ public interface LeaderCockpitMapper {
* @param endDate
* @return
*/
int getResignCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<String> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
int getResignCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
/**
* 查询关键离职人数
@ -89,7 +89,7 @@ public interface LeaderCockpitMapper {
* @param endDate
* @return
*/
int getKeyResignCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<String> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
int getKeyResignCount(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
/**
* 查询离职人数列表
@ -100,7 +100,7 @@ public interface LeaderCockpitMapper {
* @param endDate
* @return
*/
List<PortalPO> getResignListByPosition(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<String> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
List<PortalPO> getResignListByPosition(@Param("param") SearchConditionParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
Position getPositionById(@Param("param") SearchConditionParam param, @Param("positionId") String positionId);

View File

@ -65,7 +65,7 @@ public interface ManagerPortalMapper {
* @param emdId
* @return
*/
List<Long> getManageDeptIds(@Param("param") BasicPersonnelParam param, @Param("empId") String emdId);
List<Long> getManageDeptIds(@Param("param") BasicPersonnelParam param, @Param("empId") Long emdId);
/**
* 获取生日人数
@ -111,7 +111,7 @@ public interface ManagerPortalMapper {
* @param endIndex
* @return
*/
Integer getAgeCount(@Param("param") BasicPersonnelParam param, @Param("departmentIdList") Collection<String> departmentIdList, @Param("startIndex") Integer startIndex, @Param("endIndex") Integer endIndex);
Integer getAgeCount(@Param("param") BasicPersonnelParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startIndex") Integer startIndex, @Param("endIndex") Integer endIndex);
/**
* 获取司龄统计数据
@ -122,7 +122,7 @@ public interface ManagerPortalMapper {
* @param endIndex
* @return
*/
Integer getComapnyCount(@Param("param") BasicPersonnelParam param, @Param("departmentIdList") Collection<String> departmentIdList, @Param("startIndex") Integer startIndex, @Param("endIndex") Integer endIndex);
Integer getComapnyCount(@Param("param") BasicPersonnelParam param, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startIndex") Integer startIndex, @Param("endIndex") Integer endIndex);
/**
* 饼状图配置信息
@ -178,24 +178,4 @@ public interface ManagerPortalMapper {
//Integer sumAnnualLeaveCount(@Param("param") BasicPersonnelParam param,@Param("holidayIds") Collection<Long> holidayIds);
Integer sumAnnualLeaveDuration(BasicPersonnelParam param);
Integer getKqRequire(@Param("param") BasicPersonnelParam param, @Param("userId") String userId);
Integer getKqRequireByCondition(BasicPersonnelParam basicPersonnelParam);
Integer getTodayAllSign(@Param("param") BasicPersonnelParam param, @Param("userId") String userId);
Integer getAllSignByCondition(BasicPersonnelParam basicPersonnelParam);
Integer getTotalLate(@Param("param") BasicPersonnelParam param, @Param("userId") String userId);
Integer getLateByCondition(BasicPersonnelParam basicPersonnelParam);
Integer getTotalVacation(@Param("param") BasicPersonnelParam param, @Param("userId") String userId);
Integer getTodayNoSign(@Param("param") BasicPersonnelParam param, @Param("userId") String userId);
Integer getNoSignByCondition(BasicPersonnelParam basicPersonnelParam);
List<PortalPO> getGradeDistribution(BasicPersonnelParam basicPersonnelParam);
}

View File

@ -1,7 +1,9 @@
package com.weaver.seconddev.portal.service;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.seconddev.portal.entity.po.PortalPO;
import java.util.List;
import java.util.Map;
/**
@ -43,7 +45,7 @@ public interface LeaderCockpitService {
* @param params
* @return
*/
WeaResult<Map<String, Object>> getAttendanceRate(Map<String, String> params);
WeaResult<List<PortalPO>> getAttendanceRate(Map<String, String> params);
/**
* 获取满编率
@ -52,7 +54,7 @@ public interface LeaderCockpitService {
* @param header
* @return
*/
WeaResult<Map<String, Object>> getFullStaffingRate(Map<String, String> header, Map<String, String> params);
WeaResult<List<PortalPO>> getFullStaffingRate(Map<String, String> header, Map<String, String> params);
/**
* 获取入职情况

View File

@ -18,13 +18,4 @@ public interface SscPortalService {
* @return
*/
WeaResult<ExpirationReminderPo> getExpirationReminder(Map<String, String> params);
/**
* 员工数据
* @param params
* @return
*/
WeaResult<Map<String, Object>> getEmployeeData(Map<String, String> params);
WeaResult<Map<String, Object>> getToDo(Map<String, String> params);
}

View File

@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.common.cache.tablecache.impl.ComInfoCache;
import com.weaver.common.hr.util.Util;
import com.weaver.common.hrm.cache.HrmEmployeeComInfo;
import com.weaver.common.hrm.cache.HrmPositionComInfo;
import com.weaver.common.hrm.dao.HrmCommonEmployeeDao;
import com.weaver.seconddev.portal.entity.po.EmployeeBasicInfoPo;
import com.weaver.seconddev.portal.entity.po.PortalUrlDetail;
@ -48,8 +45,6 @@ public class EmployeePortalServiceImpl implements EmployeePortalService {
@Autowired
DepartMentService departMentService;
@Autowired
private ComInfoCache comInfoCache;
@Autowired
PortalMapper portalMapper;
@ -82,13 +77,7 @@ public class EmployeePortalServiceImpl implements EmployeePortalService {
employeeBasicInfoPo.setWorkCode(byId.getJobNum());
//WeaDepartMent departmentById = departMentService.getDepartMentById(byId.getDepartmentId());
//employeeBasicInfoPo.setCompanyName(null != departmentById ? departmentById.getDepartMentName() : "");
HrmEmployeeComInfo hrmEmployeeInfo =
comInfoCache.getCacheById(HrmEmployeeComInfo.class, currentUser.getEmployeeId());
HrmPositionComInfo positionComInfo = comInfoCache.getCacheById(HrmPositionComInfo.class, hrmEmployeeInfo.getPosition());
employeeBasicInfoPo.setPositionName(positionComInfo != null ? positionComInfo.getName() : "");
employeeBasicInfoPo.setDepartmentName(null == department ? "" : department.getName());
employeeBasicInfoPo.setDepartmentName(null==department?"":department.getName());
employeeBasicInfoPo.setHireDate(cn.hutool.core.date.DateUtil.formatDate(byId.getHiredate()));
employeeBasicInfoPo.setEmployeeStatus(PersonnelStatusEnum.getShowNameByValue(byId.getPersonnelStatus()));
@ -114,7 +103,6 @@ public class EmployeePortalServiceImpl implements EmployeePortalService {
employeeBasicInfoPo.setOvertimeUrl(urlMap.get("overtime"));
employeeBasicInfoPo.setPublicLeaveUrl(urlMap.get("publicLeave"));
employeeBasicInfoPo.setExceptionalAttendanceUrl(urlMap.get("exceptionalAttendance"));
employeeBasicInfoPo.setReissueCardNumUrl(urlMap.get("reissueCardNum"));
return WeaResult.success(employeeBasicInfoPo);
@ -178,9 +166,6 @@ public class EmployeePortalServiceImpl implements EmployeePortalService {
case "OVERTIME":
employeeBasicInfoPo.setOvertime(value);
break;
case "REISSUECARDNUM":
employeeBasicInfoPo.setReissueCardNum(value);
break;
default:
break;
}

View File

@ -1,7 +1,6 @@
package com.weaver.seconddev.portal.service.impl;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.eb.common.util.TimeUtils;
import com.weaver.seconddev.portal.entity.param.HrbpParam;
import com.weaver.seconddev.portal.entity.po.PortalUrlDetail;
import com.weaver.seconddev.portal.mapper.portal.HrbpPortalMapper;
@ -9,11 +8,12 @@ import com.weaver.seconddev.portal.mapper.portal.PortalMapper;
import com.weaver.seconddev.portal.service.HrbpPortalService;
import com.weaver.teams.security.context.UserContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -40,10 +40,7 @@ public class HrbpPortalServiceImpl implements HrbpPortalService {
HrbpParam hrbpParam = new HrbpParam();
hrbpParam.setTenantKey(UserContext.getCurrentUser().getTenantKey());
// 权限条件
getAllDepartmentIdsByHrbp(hrbpParam, UserContext.getCurrentUser().getEmployeeId());
if (CollectionUtils.isEmpty(hrbpParam.getDepartmentIdList())) {
return WeaResult.success(map);
}
int toEntryCount = hrbpPortalMapper.getToEntryCount(hrbpParam);
int toRegularCount = hrbpPortalMapper.getToRegularCount(hrbpParam);
@ -81,10 +78,8 @@ public class HrbpPortalServiceImpl implements HrbpPortalService {
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(hrbpParam.getTenantKey(), PORTAL_KEY, "getEmployeeData");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
getAllDepartmentIdsByHrbp(hrbpParam, UserContext.getCurrentUser().getEmployeeId());
if (CollectionUtils.isEmpty(hrbpParam.getDepartmentIdList())) {
return WeaResult.success(map);
}
// 员工人数
int allEmployeeCount = hrbpPortalMapper.getAllEmployeeCount(hrbpParam);
map.put("allEmployee", allEmployeeCount);
@ -117,54 +112,19 @@ public class HrbpPortalServiceImpl implements HrbpPortalService {
return WeaResult.success(map);
}
private void getAllDepartmentIdsByHrbp(HrbpParam hrbpParam, Long employeeId) {
hrbpParam.setUserId(String.valueOf(employeeId));
Set<String> allDeptIdsByHrbp = hrbpPortalMapper.getAllDeptIdsByHrbp(hrbpParam);
hrbpParam.setDepartmentIdList(allDeptIdsByHrbp);
}
@Override
public WeaResult<Map<String, Object>> getTodayOverview(Map<String, String> params) {
Map<String, Object> resultMap = new HashMap<>();
Date todayDate = TimeUtils.getString2Date(TimeUtils.getCurrentDateString(), "yyyy-MM-dd");
if (params.get("date") != null) {
String date = params.get("date");
todayDate = TimeUtils.getString2Date(date, "yyyy-MM-dd");
}
//部门矩阵中hrbp负责的部门
//应出勤人数部门在职人数
HrbpParam hrbpParam = new HrbpParam();
hrbpParam.setTenantKey(UserContext.getCurrentUser().getTenantKey());
hrbpParam.setUserId(String.valueOf(UserContext.getCurrentUser().getEmployeeId()));
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(UserContext.getCurrentUser().getTenantKey(), PORTAL_KEY, "getTodayOverview");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
//应出勤人数
hrbpParam.setMatrixId(Long.valueOf(matrixId));
hrbpParam.setMatrixValueConfigId(Long.valueOf(matrixValueConfigId));
hrbpParam.setUserId(UserContext.getCurrentUser().getUserId());
int totalRequire = hrbpPortalMapper.getKqRequireByBp(hrbpParam);
resultMap.put("totalRequire", totalRequire);
resultMap.put("totalRequireUrl", urlMap.get("totalRequire"));
//今日实际打卡人数
int todayAllSignByBp = hrbpPortalMapper.getTodayAllSignByBp(hrbpParam);
resultMap.put("totalSign", todayAllSignByBp);
resultMap.put("totalSignUrl", urlMap.get("totalSign"));
//今日未打卡人数
int todayNoSign = hrbpPortalMapper.getTodayNoSign(hrbpParam);
resultMap.put("totalNoSign", todayNoSign);
resultMap.put("totalNoSignUrl", urlMap.get("totalNoSign"));
//今日迟到人数
hrbpParam.setParamDate(todayDate);
int totalLate = hrbpPortalMapper.getTotalLateByBp(hrbpParam);
resultMap.put("totalLate", totalLate);
resultMap.put("totalLateUrl", urlMap.get("totalLate"));
//今日休假人数
int totalVacation = hrbpPortalMapper.getTotalVacationByBp(hrbpParam);
resultMap.put("totalVacation", totalVacation);
resultMap.put("totalVacationUrl", urlMap.get("totalVacation"));
return WeaResult.success(resultMap);
}
}

View File

@ -6,20 +6,15 @@ import com.alibaba.fastjson.JSON;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.common.hrm.dao.HrmCommonEmployeeDao;
import com.weaver.seconddev.portal.entity.bo.EmployeeStaffBo;
import com.weaver.seconddev.portal.entity.param.BasicPersonnelParam;
import com.weaver.seconddev.portal.entity.param.SearchConditionParam;
import com.weaver.seconddev.portal.entity.po.PortalData;
import com.weaver.seconddev.portal.entity.po.PortalPO;
import com.weaver.seconddev.portal.entity.po.PortalUrlDetail;
import com.weaver.seconddev.portal.entity.po.cfg.*;
import com.weaver.seconddev.portal.mapper.portal.LeaderCockpitMapper;
import com.weaver.seconddev.portal.mapper.portal.ManagerPortalMapper;
import com.weaver.seconddev.portal.mapper.portal.PortalMapper;
import com.weaver.seconddev.portal.service.LeaderCockpitService;
import com.weaver.seconddev.portal.util.DateUtil;
import com.weaver.teams.security.StringUtils;
import com.weaver.teams.security.context.UserContext;
import com.weaver.teams.security.user.User;
import com.weaver.workflow.common.cfg.org.service.DepartMentService;
import com.weaver.workflow.common.entity.org.WeaDepartMent;
import lombok.extern.slf4j.Slf4j;
@ -27,10 +22,8 @@ import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
/**
* 领导驾驶舱门户
@ -51,41 +44,25 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
@Autowired
DepartMentService departMentService;
@Autowired
PortalMapper portalMapper;
@Autowired
ManagerPortalMapper managerPortalMapper;
private static final String PORTAL_KEY = "leadershipCockpit";
@Override
public WeaResult<Map<String, Object>> getOnJobNumber(Map<String, String> params) {
SearchConditionParam searchConditionParam = new SearchConditionParam();
initSearchConditionParam(searchConditionParam, params, null);
log.error("getOnJobNumber==={}", JSON.toJSONString(searchConditionParam));
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
List<PortalPO> onJobNumber = leaderCockpitMapper.getOnJobNumber(searchConditionParam);
Map<String, Object> returnMap = new HashMap<>();
returnMap.put("data", onJobNumber);
returnMap.put("total", onJobNumber.stream().mapToInt(item -> Convert.toInt(item.getValue(), 0)).sum());
User currentUser = UserContext.getCurrentUser();
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "leaderCockpit");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
returnMap.put("onJobNumberUrl", urlMap.get("onJobNumber"));
return WeaResult.success(returnMap);
}
@Override
public WeaResult<Map<String, Object>> getLaborCost(Map<String, String> params) {
public WeaResult<Map<String, Object> > getLaborCost(Map<String, String> params) {
SearchConditionParam searchConditionParam = new SearchConditionParam();
initSearchConditionParam(searchConditionParam, params, null);
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
Map<String, Object> laborCost = leaderCockpitMapper.getLaborCost(searchConditionParam);
if (laborCost == null) {
laborCost = new HashMap<>();
}
User currentUser = UserContext.getCurrentUser();
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "leaderCockpit");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
laborCost.put("laborCostUrl", urlMap.get("laborCost"));
return WeaResult.success(laborCost);
}
@ -93,6 +70,7 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
public WeaResult<Map<String, Object>> getTurnoverRate(Map<String, String> params) {
SearchConditionParam searchConditionParam = new SearchConditionParam();
initSearchConditionParam(searchConditionParam, params, null);
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
// 查询范围内在职人员
int onJobCount = leaderCockpitMapper.getOnJobCount(searchConditionParam);
// 查询范围内离职人员
@ -107,103 +85,16 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
Map<String, Object> returnMap = new HashMap<>(2);
returnMap.put("turnoverRate", formatPercentage(turnoverRate));
returnMap.put("keyTurnoverRate", formatPercentage(keyTurnoverRate));
User currentUser = UserContext.getCurrentUser();
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "leaderCockpit");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
returnMap.put("turnoverRateUrl", urlMap.get("turnoverRate"));
return WeaResult.success(returnMap);
}
@Override
public WeaResult<Map<String, Object>> getAttendanceRate(Map<String, String> params) {
Map<String, Object> returnMap = new HashMap<>(2);
User currentUser = UserContext.getCurrentUser();
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
//指定日期和部门
String searchDeptIds = params.get("departmentId");
getAllBelongDept(currentUser, basicPersonnelParam, searchDeptIds);
initSearchConditionParam(basicPersonnelParam, params);
ArrayList<Map<String, Object>> mapArrayList = new ArrayList<>();
//应出勤人数
Integer totalRequire = managerPortalMapper.getKqRequireByCondition(basicPersonnelParam);
returnMap.put("totalRequire", totalRequire);
//实际出勤人数
Integer todayAllSign = managerPortalMapper.getAllSignByCondition(basicPersonnelParam);
// 计算考勤率并保留两位小数
HashMap<String, Object> attendanceRateMap = new HashMap<>();
attendanceRateMap.put("name", "出勤率");
calculateRate(mapArrayList, totalRequire, todayAllSign, attendanceRateMap);
//迟到人数
Integer totalLate = managerPortalMapper.getLateByCondition(basicPersonnelParam);
//迟到比例
HashMap<String, Object> LateRateMap = new HashMap<>();
LateRateMap.put("name", "迟到占比");
returnMap.put("totalLate", totalLate);
calculateRate(mapArrayList, totalRequire, totalLate, LateRateMap);
// //未打卡人数
// Integer noSign = managerPortalMapper.getNoSignByCondition(basicPersonnelParam);
// //未打卡比例
// HashMap<String, Object> noSignRateMap = new HashMap<>();
// noSignRateMap.put("name", "未打卡");
// calculateRate(mapArrayList, totalRequire, noSign, noSignRateMap);
returnMap.put("data", mapArrayList);
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "leaderCockpit");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
returnMap.put("attendanceRateUrl", urlMap.get("attendanceRate"));
return WeaResult.success(returnMap);
public WeaResult<List<PortalPO>> getAttendanceRate(Map<String, String> params) {
return null;
}
private static void calculateRate(ArrayList<Map<String, Object>> mapArrayList, Integer total, Integer todayCondition, HashMap<String, Object> rateMap) {
BigDecimal rate;
if (total != null && total != 0) {
// 使用BigDecimal进行精确计算
BigDecimal sign = new BigDecimal(todayCondition != null ? todayCondition : 0);
BigDecimal require = new BigDecimal(total);
// 计算百分比并保留两位小数
rate = sign.divide(require, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP);
rateMap.put("value", rate + "%");
} else {
// 如果总数为0或null设置为0
rate = BigDecimal.ZERO;
rateMap.put("value", rate + "%");
}
mapArrayList.add(rateMap);
}
private void getAllBelongDept(User currentUser, BasicPersonnelParam basicPersonnelParam, String searchDeptIds) {
// 获取部门下的所有子部门
if (StringUtils.isNotBlank(searchDeptIds)) {
Set<String> deptIdSet = new HashSet<>();
Set<String> selectDepartmentId = new HashSet<>();
String[] split = searchDeptIds.split(",");
for (String s : split) {
if (StringUtils.isBlank(s)) {
continue;
}
long parseLong = Long.parseLong(s);
selectDepartmentId.add(s);
List<Long> beLongDeps = departMentService.getBeLongDeps(parseLong, currentUser.getTenantKey(), false);
beLongDeps.add(parseLong);
Set<String> collect = beLongDeps.stream().map(dept -> String.valueOf(dept)).collect(Collectors.toSet());
deptIdSet.addAll(collect);
}
basicPersonnelParam.setDepartmentIdList(deptIdSet);
}
}
@Override
public WeaResult<Map<String, Object>> getFullStaffingRate(Map<String, String> header, Map<String, String> params) {
HashMap<String, Object> returnMap = new HashMap<>();
public WeaResult<List<PortalPO>> getFullStaffingRate(Map<String, String> header, Map<String, String> params) {
String origin = header.get("origin");
// 人员编制
String employeeStaffUrl = origin + "/api/bs/hr/est/cfg/table";
@ -214,17 +105,14 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
String endDate = DateUtil.getLastDayOfMonth();
SearchConditionParam searchConditionParam = new SearchConditionParam();
initSearchConditionParam(searchConditionParam, params, null);
// postEmployeeStaff(employeeStaffUrl, header, searchConditionParam.getDepartmentIdList(), month);
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
//postEmployeeStaff(employeeStaffUrl, header, searchConditionParam.getDepartmentIdList(), month);
User currentUser = UserContext.getCurrentUser();
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "leaderCockpit");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
returnMap.put("fullStaffingRateUrl", urlMap.get("fullStaffingRate"));
return WeaResult.success(returnMap);
return null;
}
private void postEmployeeStaff(String employeeStaffUrl, Map<String, String> header, Set<Long> departmentIdList, String month) {
private void postEmployeeStaff(String employeeStaffUrl,Map<String, String> header, Set<Long> departmentIdList, String month) {
FormDatas formDatas = new FormDatas();
FormDatasDetail formDatasDetail = new FormDatasDetail();
@ -246,7 +134,8 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
formDatasDetail.setOverCtrl(Collections.singletonList(overCtrlWrapper));
String resultStr = HttpRequest.post(employeeStaffUrl).headerMap(header, true).body(JSON.toJSONString(formDatas)).execute().body();
String resultStr = HttpRequest.post(employeeStaffUrl).headerMap(header, true)
.body(JSON.toJSONString(formDatas)).execute().body();
List<EmployeeStaff> employeeStaffs = EmployeeStaffBo.mapEmployeeStaffData(resultStr);
@ -257,14 +146,28 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
public WeaResult<Map<String, Object>> getEmploymentStatus(Map<String, String> params) {
SearchConditionParam searchConditionParam = new SearchConditionParam();
initSearchConditionParam(searchConditionParam, params, 0);
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
String searchDate = params.get("searchDate");
if (StringUtils.isBlank(searchDate)) {
searchDate = DateUtil.getCurrentDateStr();
}
LocalDate localDate = DateUtil.parseDate(searchDate);
String month = DateUtil.formatToYearMonth_ZH(localDate);
Map<String, Integer> allDataMap = new LinkedHashMap<>(3);
Map<String, Integer> keyDataMap = new LinkedHashMap<>(3);
Map<String, String> monthlyDateRanges = DateUtil.getMonthlyDateRanges(searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
for (String month : monthlyDateRanges.keySet()) {
String dateStr = monthlyDateRanges.get(month);
String[] split = dateStr.split(",");
allDataMap.put(month, leaderCockpitMapper.getEmploymentCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), split[0], split[1]));
keyDataMap.put(month, leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), split[0], split[1]));
allDataMap.put(month, leaderCockpitMapper.getEmploymentCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
keyDataMap.put(month, leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
String firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate());
String lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate());
// 前面5个月
for (int i = 1; i < 7; i++) {
allDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getEmploymentCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
keyDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate(), i);
lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate(), i);
}
// 查询台账
@ -287,11 +190,10 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
PortalData portalData = new PortalData();
portalData.setDate(currentMonth);
portalData.setDepart(departMentById.getDepartMentName());
Set<String> belongDprStrs = beLongDeps.stream().map(deptId -> String.valueOf(deptId)).collect(Collectors.toSet());
// 关键
int keyEmploymentCount = leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam, belongDprStrs, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
int keyEmploymentCount = leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam, beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
// 非关键
int employmentCount = leaderCockpitMapper.getEmploymentCount(searchConditionParam, belongDprStrs, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
int employmentCount = leaderCockpitMapper.getEmploymentCount(searchConditionParam, beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
portalData.setKey(keyEmploymentCount);
portalData.setAll(employmentCount);
portalList.add(portalData);
@ -304,10 +206,6 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
returnMap.put("dataSource", portalList);
returnMap.put("all", allDataMap);
returnMap.put("key", keyDataMap);
User currentUser = UserContext.getCurrentUser();
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "leaderCockpit");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
returnMap.put("employmentStatusUrl", urlMap.get("employmentStatus"));
return WeaResult.success(returnMap);
}
@ -315,16 +213,32 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
public WeaResult<Map<String, Object>> getResignationSituation(Map<String, String> params) {
SearchConditionParam searchConditionParam = new SearchConditionParam();
initSearchConditionParam(searchConditionParam, params, 0);
log.error("searchConditionParam===" + JSON.toJSONString(searchConditionParam));
String searchDate = params.get("searchDate");
if (StringUtils.isBlank(searchDate)) {
searchDate = DateUtil.getCurrentDateStr();
}
LocalDate localDate = DateUtil.parseDate(searchDate);
String month = DateUtil.formatToYearMonth_ZH(localDate);
Map<String, Integer> allDataMap = new LinkedHashMap<>(3);
Map<String, Integer> keyDataMap = new LinkedHashMap<>(3);
Map<String, String> monthlyDateRanges = DateUtil.getMonthlyDateRanges(searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
for (String month : monthlyDateRanges.keySet()) {
String dateStr = monthlyDateRanges.get(month);
String[] split = dateStr.split(",");
allDataMap.put(month, leaderCockpitMapper.getResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), split[0], split[1]));
keyDataMap.put(month, leaderCockpitMapper.getKeyResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), split[0], split[1]));
allDataMap.put(month, leaderCockpitMapper.getResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
keyDataMap.put(month, leaderCockpitMapper.getKeyResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
String firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate());
String lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate());
// 前五个月
for (int i = 1; i < 7; i++) {
allDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
keyDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getKeyResignCount(searchConditionParam, searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate(), i);
lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate(), i);
}
String currentMonth = DateUtil.formatToYearMonth(searchConditionParam.getStartDate());
Set<Long> selectDepartmentId = searchConditionParam.getSelectDepartmentId();
log.error("selectDepartmentId===" + JSON.toJSONString(selectDepartmentId));
@ -342,11 +256,10 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
PortalData portalData = new PortalData();
portalData.setDate(currentMonth);
portalData.setDepart(departMentById.getDepartMentName());
Set<String> belongDprStrs = beLongDeps.stream().map(deptId -> String.valueOf(deptId)).collect(Collectors.toSet());
// 关键
int keyEmploymentCount = leaderCockpitMapper.getKeyResignCount(searchConditionParam, belongDprStrs, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
int keyEmploymentCount = leaderCockpitMapper.getKeyResignCount(searchConditionParam, beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
// 非关键
int employmentCount = leaderCockpitMapper.getResignCount(searchConditionParam, belongDprStrs, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
int employmentCount = leaderCockpitMapper.getResignCount(searchConditionParam, beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
portalData.setKey(keyEmploymentCount);
portalData.setAll(employmentCount);
portalList.add(portalData);
@ -360,34 +273,9 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
returnMap.put("dataSource", portalList);
returnMap.put("all", allDataMap);
returnMap.put("key", keyDataMap);
User currentUser = UserContext.getCurrentUser();
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "leaderCockpit");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
returnMap.put("resignationSituationUrl", urlMap.get("resignationSituation"));
return WeaResult.success(returnMap);
}
private void initSearchConditionParam(BasicPersonnelParam searchConditionParam, Map<String, String> params) {
String startDate = params.get("startDate");
String endDate = params.get("endDate");
// 租户
searchConditionParam.setTenantKey(UserContext.getCurrentUser().getTenantKey());
if (StringUtils.isNotEmpty(endDate)) {
searchConditionParam.setEndDate(endDate);
} else {
searchConditionParam.setEndDate(DateUtil.getCurrentDateStr());
}
if (StringUtils.isNotEmpty(startDate)) {
searchConditionParam.setStartDate(startDate);
} else {
// LocalDate endDateLocal = LocalDate.parse(searchConditionParam.getEndDate());
// searchConditionParam.setStartDate(DateUtil.getFirstDayOfYearStr(DateUtil.formatDate(endDateLocal)));
searchConditionParam.setStartDate("1999-01-01");
}
}
/**
* 构建查询对象
@ -399,16 +287,15 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
private void initSearchConditionParam(SearchConditionParam searchConditionParam, Map<String, String> params, Integer beforeMonth) {
String searchDate = params.get("searchDate");
String departmentId = params.get("departmentId");
String startDate = params.get("startDate");
String endDate = params.get("endDate");
// 租户
searchConditionParam.setTenantKey(UserContext.getCurrentUser().getTenantKey());
// 部门
//searchConditionParam.setDepartmentId(departmentId);
// 获取部门下的所有子部门
if (StringUtils.isNotBlank(departmentId)) {
Set<String> deptIdSet = new HashSet<>();
deptIdSet.add(departmentId);
Set<Long> deptIdSet = new HashSet<>();
Set<Long> selectDepartmentId = new HashSet<>();
String[] split = departmentId.split(",");
for (String s : split) {
@ -416,26 +303,46 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
continue;
}
long parseLong = Long.parseLong(s);
log.error("parseLong===" + parseLong);
selectDepartmentId.add(parseLong);
List<Long> beLongDeps = departMentService.getBeLongDeps(parseLong, searchConditionParam.getTenantKey(), false);
beLongDeps.add(parseLong);
Set<String> collect = beLongDeps.stream().map(dept -> String.valueOf(dept)).collect(Collectors.toSet());
deptIdSet.addAll(collect);
log.error("beLongDeps===" + JSON.toJSONString(beLongDeps));
deptIdSet.addAll(beLongDeps);
}
searchConditionParam.setDepartmentIdList(deptIdSet);
searchConditionParam.setSelectDepartmentId(selectDepartmentId);
}
if (StringUtils.isNotEmpty(endDate)) {
searchConditionParam.setEndDate(endDate);
// 处理截止日期
String endDateStr;
if (StringUtils.isBlank(searchDate)) {
endDateStr = DateUtil.getCurrentDateStr();
} else {
searchConditionParam.setEndDate(DateUtil.getCurrentDateStr());
try {
// 验证日期格式是否合法
endDateStr = searchDate;
} catch (Exception e) {
log.error("日期格式错误,使用当前日期: {}", searchDate, e);
endDateStr = DateUtil.getCurrentDateStr();
}
}
searchConditionParam.setEndDate(endDateStr);
if (StringUtils.isNotEmpty(startDate)) {
searchConditionParam.setStartDate(startDate);
// 处理开始日期
if (beforeMonth == null) {
// 查询当前年度数据
searchConditionParam.setStartDate(DateUtil.getFirstDayOfYearStr(searchConditionParam.getEndDate()));
} else {
searchConditionParam.setStartDate("1999-01-01");
// 查询前N个月数据
try {
LocalDate endDate = LocalDate.parse(endDateStr);
LocalDate startDate = endDate.minusMonths(beforeMonth);
searchConditionParam.setStartDate(DateUtil.getFirstDayOfMonthStr(DateUtil.formatDate(startDate)));
} catch (Exception e) {
log.error("计算开始日期失败,使用所选日期年度第一天", e);
searchConditionParam.setStartDate(searchConditionParam.getEndDate());
}
}
}

View File

@ -10,7 +10,6 @@ import com.weaver.common.hrm.cache.HrmDepartmentComInfo;
import com.weaver.common.hrm.dao.HrmCommonDepartmentDao;
import com.weaver.common.hrm.dao.HrmCommonEmployeeDao;
import com.weaver.common.hrm.manage.HrmComInfoCacheHandler;
import com.weaver.eb.common.util.TimeUtils;
import com.weaver.seconddev.portal.entity.component.Option;
import com.weaver.seconddev.portal.entity.param.BasicPersonnelParam;
import com.weaver.seconddev.portal.entity.po.*;
@ -75,13 +74,15 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
User currentUser = UserContext.getCurrentUser();
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
List<Long> manageDeptIds = managerPortalMapper.getManageDeptIds(basicPersonnelParam, String.valueOf(currentUser.getEmployeeId()));
List<HrmDepartmentComInfo> departmentList = hrmComInfoCacheHandler.getCacheList(HrmDepartmentComInfo.class, manageDeptIds);
Set<Long> allDepartmentIds = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
List<HrmDepartmentComInfo> departmentList = hrmComInfoCacheHandler.getCacheList(HrmDepartmentComInfo.class, allDepartmentIds);
// 获取顶级部门
// List<HrmDepartmentComInfo> topDepartmentList = departmentList.stream()
// .filter(dept -> !allDepartmentIds.contains(dept.getParent()))
// .collect(Collectors.toList());
List<String> departmentNames = departmentList.stream().map(HrmDepartmentComInfo::getName).collect(Collectors.toList());
List<HrmDepartmentComInfo> topDepartmentList = departmentList.stream()
.filter(dept -> !allDepartmentIds.contains(dept.getParent()))
.collect(Collectors.toList());
List<String> departmentNames = topDepartmentList.stream().map(HrmDepartmentComInfo::getName).collect(Collectors.toList());
Map<String, Object> returnMap = new HashMap<>();
returnMap.put("deptNames", StringUtils.join(departmentNames, ""));
returnMap.put("userName", currentUser.getUsername());
@ -90,47 +91,8 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
@Override
public WeaResult<Map<String, Object>> getTodayOverview(Map<String, String> params) {
HashMap<String, Object> resultMap = new HashMap<>();
Date todayDate = TimeUtils.getString2Date(TimeUtils.getCurrentDateString(), "yyyy-MM-dd");
if (params.get("date") != null) {
String date = params.get("date");
todayDate = TimeUtils.getString2Date(date, "yyyy-MM-dd");
}
User currentUser = UserContext.getCurrentUser();
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(currentUser.getTenantKey(), PORTAL_KEY, "getTodayOverview");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
//应出勤人数
Integer totalRequire = managerPortalMapper.getKqRequire(basicPersonnelParam, String.valueOf(currentUser.getEmployeeId()));
resultMap.put("totalRequire", totalRequire);
resultMap.put("totalRequireUrl", urlMap.get("totalRequire"));
//今日实际打卡人数
Integer todayAllSign = managerPortalMapper.getTodayAllSign(basicPersonnelParam, String.valueOf(currentUser.getEmployeeId()));
resultMap.put("totalSign", todayAllSign);
resultMap.put("totalSignUrl", urlMap.get("totalSign"));
//今日未打卡人数
Integer todayNoSign = managerPortalMapper.getTodayNoSign(basicPersonnelParam, String.valueOf(currentUser.getEmployeeId()));
resultMap.put("totalNoSign", todayNoSign);
resultMap.put("totalNoSignUrl", urlMap.get("totalNoSign"));
//今日迟到人数
basicPersonnelParam.setParamDate(todayDate);
Integer totalLate = managerPortalMapper.getTotalLate(basicPersonnelParam, String.valueOf(currentUser.getEmployeeId()));
resultMap.put("totalLate", totalLate);
resultMap.put("totalLateUrl", urlMap.get("totalLate"));
//今日休假人数
int totalVacation = managerPortalMapper.getTotalVacation(basicPersonnelParam, String.valueOf(currentUser.getEmployeeId()));
resultMap.put("totalVacation", totalVacation);
resultMap.put("totalVacationUrl", urlMap.get("totalVacation"));
return WeaResult.success(resultMap);
return null;
}
@Override
@ -142,7 +104,7 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
User currentUser = UserContext.getCurrentUser();
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
Set<String> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
// 设置部门范围ID集合
basicPersonnelParam.setDepartmentIdList(allDepartmentIdList);
@ -200,7 +162,7 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
User currentUser = UserContext.getCurrentUser();
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
Set<String> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
StringJoiner andCondition = new StringJoiner(" and ");
switch (dataKey) {
case "onJobNumber":
@ -264,11 +226,10 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
User currentUser = UserContext.getCurrentUser();
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
Set<String> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
// 设置部门范围ID集合
basicPersonnelParam.setDepartmentIdList(allDepartmentIdList);
log.error("getTeamMemorialDay:{}", JSON.toJSONString(allDepartmentIdList));
int birthdayNum = managerPortalMapper.getBirthdayNum(basicPersonnelParam);
int regularEmployeeNum = managerPortalMapper.getRegularEmployeeNum(basicPersonnelParam);
@ -300,7 +261,7 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
User currentUser = UserContext.getCurrentUser();
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
Set<String> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
StringJoiner andCondition = new StringJoiner(" and ");
switch (dataKey) {
case "birthdayNum":
@ -322,10 +283,7 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
case "employmentAnniversary":
// 入职周年提醒
if (CollectionUtils.isNotEmpty(allDepartmentIdList)) {
StringBuilder deptIdStr = new StringBuilder();
allDepartmentIdList.stream().forEach(departmentId -> deptIdStr.append("'").append(departmentId).append("',"));
deptIdStr.deleteCharAt(deptIdStr.lastIndexOf(","));
andCondition.add(" t1.department in (" + deptIdStr + ") ");
andCondition.add(" t1.department in (" + StringUtils.join(allDepartmentIdList, ",") + ") ");
}
andCondition.add(" ( ( DATE_FORMAT(t1.hiredate, '%m-%d') between DATE_FORMAT(CURDATE(), '%m-%d') and DATE_FORMAT(DATE_ADD(CURDATE(), interval 7 day), '%m-%d') ) or ( DATE_FORMAT(CURDATE(), '%m-%d') &gt; DATE_FORMAT(DATE_ADD(CURDATE(), interval 7 day), '%m-%d') and ( DATE_FORMAT(t1.hiredate, '%m-%d') &gt;= DATE_FORMAT(CURDATE(), '%m-%d') or DATE_FORMAT(t1.hiredate, '%m-%d') &lt;= DATE_FORMAT(DATE_ADD(CURDATE(), interval 7 day), '%m-%d') ) ) ) ");
break;
@ -350,7 +308,7 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
User currentUser = UserContext.getCurrentUser();
BasicPersonnelParam basicPersonnelParam = new BasicPersonnelParam();
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
Set<String> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
// 设置部门范围ID集合
basicPersonnelParam.setDepartmentIdList(allDepartmentIdList);
basicPersonnelParam.setPieType(type);
@ -373,7 +331,6 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
break;
case "grade":
// 职级
dealGradeInfo(basicPersonnelParam, returnList);
returnMap.put("url", urlMap.get("grade"));
break;
case "company":
@ -393,11 +350,6 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
return WeaResult.success(returnMap);
}
private void dealGradeInfo(BasicPersonnelParam basicPersonnelParam, List<PortalPO> returnList) {
List<PortalPO> gradeDistribution = managerPortalMapper.getGradeDistribution(basicPersonnelParam);
returnList.addAll(gradeDistribution);
}
@Override
public WeaResult<Map<String, Object>> getAttendanceInfo(Map<String, String> params) {
String type = params.get("type");
@ -411,7 +363,7 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
basicPersonnelParam.setStartDate(DateUtil.getFirstDayOfMonth());
basicPersonnelParam.setEndDate(DateUtil.getLastDayOfMonth());
Set<String> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
// 设置部门范围ID集合
basicPersonnelParam.setDepartmentIdList(allDepartmentIdList);
@ -440,7 +392,7 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
map3.put("url", urlMap.get("leaveType"));
return WeaResult.success(map3);
default:
return WeaResult.fail("不支持的统计类型", true);
return WeaResult.fail("不支持的统计类型",true);
}
}
@ -457,23 +409,26 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
basicPersonnelParam.setTenantKey(currentUser.getTenantKey());
basicPersonnelParam.setCurrent(current);
basicPersonnelParam.setPageSize(pageSize);
basicPersonnelParam.setOffset((current - 1) * pageSize);
basicPersonnelParam.setSearchKey(searchKey);
//log.error("departmentId==={}", departmentId);
basicPersonnelParam.setDepartmentId(departmentId);
Set<String> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
Set<Long> allDepartmentIdList = getAllDepartmentIdList(basicPersonnelParam, currentUser.getEmployeeId());
//log.error("allDepartmentIdList111==={}", JSON.toJSONString(allDepartmentIdList));
basicPersonnelParam.setDepartmentIdList(allDepartmentIdList);
if (StringUtils.isNotBlank(departmentId)) {
List<WeaDepartMent> beLongDeps = departMentService.getBeLongDeps(Long.parseLong(departmentId));
Set<String> collect = beLongDeps.stream().map(weaDepartMent -> String.valueOf(weaDepartMent.getDepartMentId())).collect(Collectors.toSet());
collect.add(departmentId);
Set<Long> collect = beLongDeps.stream().map(WeaDepartMent::getDepartMentId).collect(Collectors.toSet());
collect.add(Long.parseLong(departmentId));
// 两个set取交集
allDepartmentIdList.retainAll(collect);
//log.error("collect==={}", JSON.toJSONString(collect));
if (CollectionUtils.isEmpty(allDepartmentIdList)) {
allDepartmentIdList.add("-1");
allDepartmentIdList.add(-1L);
}
}
basicPersonnelParam.setDepartmentIdList(allDepartmentIdList);
log.error("basicPersonnelParam==={}", JSON.toJSONString(basicPersonnelParam));
//log.error("allDepartmentIdList222==={}", JSON.toJSONString(allDepartmentIdList));
List<TeamEmployeePo> teamEmployee = managerPortalMapper.getTeamEmployee(basicPersonnelParam);
int total = managerPortalMapper.getTeamEmployeeTotal(basicPersonnelParam);
@ -682,14 +637,15 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
}
/**
* 获取用户当前所负责的所有的部门以及下级部门
*
* @return
*/
private Set<String> getAllDepartmentIdList(BasicPersonnelParam basicPersonnelParam, Long employeeId) {
private Set<Long> getAllDepartmentIdList(BasicPersonnelParam basicPersonnelParam, Long employeeId) {
// 查询所负责的部门
List<Long> manageDeptIds = managerPortalMapper.getManageDeptIds(basicPersonnelParam, String.valueOf(employeeId));
List<Long> manageDeptIds = managerPortalMapper.getManageDeptIds(basicPersonnelParam, employeeId);
// 查询所有的部门子部门信息
Set<WeaDepartMent> allDepartmentList = new HashSet<>();
for (Long manageDeptId : manageDeptIds) {
@ -699,11 +655,6 @@ public class ManagerPortalServiceImpl implements ManagerPortalService {
allDepartmentList.addAll(beLongDeps);
}
// TODO 判断集合如果为空不展示数据
if (CollectionUtils.isEmpty(allDepartmentList)) {
Set<String> set = new HashSet<>();
set.add("-1");
return set;
}
return allDepartmentList.stream().map(weaDepartMent -> String.valueOf(weaDepartMent.getDepartMentId())).collect(Collectors.toSet());
return allDepartmentList.stream().map(WeaDepartMent::getDepartMentId).collect(Collectors.toSet());
}
}

View File

@ -1,23 +1,18 @@
package com.weaver.seconddev.portal.service.impl;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.seconddev.portal.entity.param.HrbpParam;
import com.weaver.seconddev.portal.entity.param.SscParam;
import com.weaver.seconddev.portal.entity.po.ExpirationReminderPo;
import com.weaver.seconddev.portal.entity.po.PortalUrlDetail;
import com.weaver.seconddev.portal.mapper.portal.HrbpPortalMapper;
import com.weaver.seconddev.portal.mapper.portal.ManagerPortalMapper;
import com.weaver.seconddev.portal.mapper.portal.PortalMapper;
import com.weaver.seconddev.portal.mapper.portal.SscPortalMapper;
import com.weaver.seconddev.portal.service.SscPortalService;
import com.weaver.teams.security.context.UserContext;
import com.weaver.teams.security.user.User;
import com.weaver.workflow.common.cfg.org.service.DepartMentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -37,21 +32,12 @@ public class SscPortalServiceImpl implements SscPortalService {
@Autowired
PortalMapper portalMapper;
@Autowired
HrbpPortalMapper hrbpPortalMapper;
@Autowired
DepartMentService departMentService;
@Autowired
ManagerPortalMapper managerPortalMapper;
@Override
public WeaResult<ExpirationReminderPo> getExpirationReminder(Map<String, String> params) {
User currentUser = UserContext.getCurrentUser();
SscParam sscParam = new SscParam();
sscParam.setTenantKey(currentUser.getTenantKey());
// Set<String> allDepartmentIdList = getAllDepartmentIdList(sscParam, currentUser.getEmployeeId());
// sscParam.setDepartmentIdList();
ExpirationReminderPo expirationReminderPo = new ExpirationReminderPo();
@ -76,79 +62,4 @@ public class SscPortalServiceImpl implements SscPortalService {
return WeaResult.success(expirationReminderPo);
}
@Override
public WeaResult<Map<String, Object>> getEmployeeData(Map<String, String> params) {
Map<String, Object> map = new HashMap<>();
HrbpParam hrbpParam = new HrbpParam();
hrbpParam.setTenantKey(UserContext.getCurrentUser().getTenantKey());
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(hrbpParam.getTenantKey(), PORTAL_KEY, "getEmployeeData");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
// 员工人数
int allEmployeeCount = hrbpPortalMapper.getAllEmployeeCount(hrbpParam);
map.put("allEmployee", allEmployeeCount);
map.put("allEmployeeUrl", urlMap.get("allEmployee"));
// 正式员工
int formalEmployeeCount = hrbpPortalMapper.getFormalEmployeeCount(hrbpParam);
map.put("formalEmployee", formalEmployeeCount);
map.put("formalEmployeeUrl", urlMap.get("formalEmployee"));
// 实习生
map.put("internEmployee", hrbpPortalMapper.getInternEmployeeCount(hrbpParam));
map.put("internEmployeeUrl", urlMap.get("internEmployee"));
// 外包
map.put("outsourcing", hrbpPortalMapper.getOutsourcingCount(hrbpParam));
map.put("outsourcingUrl", urlMap.get("outsourcing"));
// 劳务
map.put("labor", hrbpPortalMapper.getLaborCount(hrbpParam));
map.put("laborUrl", urlMap.get("labor"));
// 试用
map.put("probation", hrbpPortalMapper.getProbationCount(hrbpParam));
map.put("probationUrl", urlMap.get("probation"));
// 正式
map.put("formal", hrbpPortalMapper.getFormalCount(hrbpParam));
map.put("formalUrl", urlMap.get("formal"));
// 实习
map.put("intern", hrbpPortalMapper.getInternCount(hrbpParam));
map.put("internUrl", urlMap.get("intern"));
// 离职
map.put("leave", hrbpPortalMapper.getLeaveCount(hrbpParam));
map.put("leaveUrl", urlMap.get("leave"));
return WeaResult.success(map);
}
@Override
public WeaResult<Map<String, Object>> getToDo(Map<String, String> params) {
Map<String, Object> map = new HashMap<>();
HrbpParam hrbpParam = new HrbpParam();
hrbpParam.setTenantKey(UserContext.getCurrentUser().getTenantKey());
int toEntryCount = hrbpPortalMapper.getToEntryCount(hrbpParam);
int toRegularCount = hrbpPortalMapper.getToRegularCount(hrbpParam);
int toLeaveCount = hrbpPortalMapper.getToLeaveCount(hrbpParam);
int toSignCount = hrbpPortalMapper.getToSignCount(hrbpParam);
int toProxyCount = hrbpPortalMapper.getToProxyCount(hrbpParam);
List<PortalUrlDetail> portalUrlDetails = portalMapper.getPortalUrlDetail(hrbpParam.getTenantKey(), PORTAL_KEY, "getToDo");
Map<String, String> urlMap = portalUrlDetails.stream().collect(Collectors.toMap(PortalUrlDetail::getDetailKey, PortalUrlDetail::getUrlAddress));
// 待入职
map.put("entry", toEntryCount);
map.put("entryUrl", urlMap.get("entry"));
// 待转正
map.put("regular", toRegularCount);
map.put("regularUrl", urlMap.get("regular"));
// 待离职
map.put("leave", toLeaveCount);
map.put("leaveUrl", urlMap.get("leave"));
// 待签订
map.put("sign", toSignCount);
map.put("signUrl", urlMap.get("sign"));
// 代理期转正
map.put("proxy", toProxyCount);
map.put("proxyUrl", urlMap.get("proxy"));
return WeaResult.success(map);
}
}

View File

@ -7,8 +7,6 @@ import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author:dxfeng
@ -219,7 +217,7 @@ public class DateUtil {
if (date == null) {
return null;
}
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
return date.toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDate();
}
public static LocalDateTime toLocalDateTime(Date date) {
@ -291,43 +289,6 @@ public class DateUtil {
return formatDate(lastDayOfPrevMonth);
}
public static Map<String, String> getMonthlyDateRanges(String startDateStr, String endDateStr) {
// 将字符串解析为日期对象
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
DateTimeFormatter monthFormatter = DateTimeFormatter.ofPattern("yyyy-MM");
LocalDate startDate = LocalDate.parse(startDateStr, formatter);
LocalDate endDate = LocalDate.parse(endDateStr, formatter);
Map<String, String> rangesMap = new LinkedHashMap<>(); // 使用LinkedHashMap保持插入顺序
// 从开始日期所在月份的第一天开始
LocalDate current = startDate.withDayOfMonth(1);
while (!current.isAfter(endDate)) {
// 当前月的第一天
LocalDate monthStart = current;
// 当前月的最后一天
LocalDate monthEnd = current.with(TemporalAdjusters.lastDayOfMonth());
// 确定该月实际的开始日期
LocalDate rangeStart = monthStart.isBefore(startDate) ? startDate : monthStart;
// 确定该月实际的结束日期
LocalDate rangeEnd = monthEnd.isAfter(endDate) ? endDate : monthEnd;
// 只有当开始日期不大于结束日期时才添加避免无效范围
if (!rangeStart.isAfter(rangeEnd)) {
String monthKey = rangeStart.format(monthFormatter);
String dateRange = rangeStart.format(formatter) + "," + rangeEnd.format(formatter);
rangesMap.put(monthKey, dateRange);
}
// 移动到下个月的第一天
current = monthEnd.plusDays(1);
}
return rangesMap;
}
/**
* LocalDate 格式化为 yyyy-MM 字符串
*

View File

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.weaver.seconddev.entry.mapper.SendMessageMapper">
<select id="getParentDepartmentId" resultType="java.lang.String">
select parent
from ${param.eteams}.department t1
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
and id = #{departmentId}
</select>
<select id="getMessageSendConfig" resultType="com.weaver.seconddev.entry.entity.MessageSendConfig">
select bm,ry,xxlx,ms,zjsj,jgsjzjssj,xxsj,bmfzr,tbmyg,hrbp,fgld
from ${param.eteams}.uf_xxgzb t1 where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
and FIND_IN_SET(#{departmentId}, bm) > 0
</select>
<select id="getSuperior" resultType="java.lang.String">
select t1.superior from ${param.e10_common}.uf_jcl_employee_information t1
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
and t1.id = #{employeeId}
</select>
<select id="getOtherSuperior" resultType="java.lang.String">
select t1.other_superior from ${param.e10_common}.uf_jcl_employee_information t1
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
and t1.id = #{employeeId}
</select>
<select id="getSuperiorFromEntry" resultType="java.lang.String">
select t1.superior from ${param.e10_common}.uf_jcl_rzgl t1
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
and t1.id = #{employeeId}
</select>
<select id="getOtherSuperiorFromEntry" resultType="java.lang.String">
select t1.other_superior from ${param.e10_common}.uf_jcl_rzgl t1
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
and t1.id = #{employeeId}
</select>
<select id="getDepartmentCustomData" resultType="java.util.Map">
select t2.id as departmentId,t1.* from ${param.eteams}.${param.table_dept_cus} t1
inner join ${param.eteams}.department t2 on t1.ID =t2.formdata
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
and t2.tenant_key = #{param.tenantKey} and t2.delete_type = 0
and t2.id = #{departmentId}
</select>
<select id="getEmployeeIdsByDeptId" resultType="java.lang.String">
select t1.id from ${param.e10_common}.uf_jcl_employee_information t1
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
and t1.department = #{employeeId}
</select>
</mapper>

View File

@ -26,10 +26,4 @@
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
and t1.job_num = #{jobNum}
</select>
<select id="getEntryRecordIdByJobNumAndName" resultType="java.lang.Long">
select t1.id from ${param.e10_common}.uf_jcl_employee_information t1
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
and t1.job_num = #{jobNum}
and t1.username = #{userName}
</select>
</mapper>

View File

@ -56,7 +56,7 @@
select count(t.id) from ${e10_common}.uf_dlqgl t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.dlqbm IN
AND t.ssbm IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
@ -176,109 +176,20 @@
</select>
<select id="getKqRequireByBp" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM ${e10_other_business}.ATTEND_STATUS_DETAIL a
JOIN ${eteams}.employee b ON a.employee = b.id
JOIN (SELECT DISTINCT matrix_data_id as id
FROM ${eteams}.hrm_matrix_value_data a
WHERE a.matrix_id = #{hrbp_matrix_id}
AND a.matrix_value_config_id = #{hrbp_matrix_value_config_id}
AND a.delete_type = 0
AND a.relate_id = #{userId}) alias ON alias.id = b.department
WHERE a.attend_date = CURDATE()
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
</select>
<select id="getTodayAllSignByBp" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM ${e10_other_business}.ATTEND_STATUS_DETAIL a
INNER JOIN ${eteams}.employee b ON a.employee = b.id
INNER JOIN (SELECT DISTINCT matrix_data_id as id
FROM ${eteams}.hrm_matrix_value_data a
WHERE a.matrix_id = #{hrbp_matrix_id}
AND a.matrix_value_config_id = #{hrbp_matrix_value_config_id}
AND a.delete_type = 0
AND a.relate_id = #{userId}) alias
ON alias.id = b.department
LEFT JOIN ${eteams}.${table_emp_cus} c ON c.form_data_id = b.formdata
LEFT JOIN ${e10_other_business}.timecard d ON d.id = a.SIGN_IN_RECORD
LEFT JOIN ${e10_other_business}.timecard e ON e.id = a.SIGN_OUT_RECORD
WHERE a.attend_date = CURDATE()
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
AND (a.SIGN_RANGE_START IS NOT NULL OR a.SIGN_RANGE_END IS NOT NULL)
</select>
<select id="getTotalLateByBp" resultType="java.lang.Integer">
SELECT COUNT(0)
FROM ${e10_other_business}.ATTEND_STATUS_DETAIL a
INNER JOIN ${eteams}.employee b ON a.employee = b.id
INNER JOIN (SELECT DISTINCT matrix_data_id as id
FROM ${eteams}.hrm_matrix_value_data a
WHERE a.matrix_id = #{hrbp_matrix_id}
AND a.matrix_value_config_id = #{hrbp_matrix_value_config_id}
AND a.delete_type = 0
AND a.relate_id = #{userId}) alias
ON alias.id = b.department
LEFT JOIN ${eteams}.${table_emp_cus} c ON c.form_data_id = b.formdata
LEFT JOIN ${e10_other_business}.timecard d ON d.id = a.SIGN_IN_RECORD
LEFT JOIN ${e10_other_business}.timecard e ON e.id = a.SIGN_OUT_RECORD
LEFT JOIN ${e10_other_business}.attend_status_detail_link f
ON f.employee = a.employee AND f.attend_date = a.attend_date
WHERE a.attend_date = CURDATE()
AND a.SIGN_IN_RECORD IS NOT NULL
AND a.PERIOD_RANGE_START &lt; a.SIGN_RANGE_START
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
</select>
<select id="getTodayNoSign" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT a.EMPLOYEE)
FROM ${e10_other_business}.ATTEND_STATUS_DETAIL a
INNER JOIN ${eteams}.employee b ON a.employee = b.id
INNER JOIN (SELECT DISTINCT matrix_data_id as id
FROM ${eteams}.hrm_matrix_value_data a
WHERE a.matrix_id = #{hrbp_matrix_id}
AND a.matrix_value_config_id = #{hrbp_matrix_value_config_id}
AND a.delete_type = 0
AND a.relate_id = #{userId}) alias
ON alias.id = b.department
LEFT JOIN ${eteams}.${table_emp_cus} c ON c.form_data_id = b.formdata
LEFT JOIN ${e10_other_business}.timecard d ON d.id = a.SIGN_IN_RECORD
LEFT JOIN ${e10_other_business}.timecard e ON e.id = a.SIGN_OUT_RECORD
LEFT JOIN ${e10_other_business}.attend_status_detail_link f
ON f.employee = a.employee AND f.attend_date = a.attend_date
WHERE a.attend_date = CURDATE()
AND a.SIGN_IN_RECORD IS NULL
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
</select>
<select id="getTotalVacationByBp" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT a.EMPLOYEE)
FROM ${e10_other_business}.ATTEND_STATUS_DETAIL a
JOIN ${eteams}.employee b ON a.employee = b.id
JOIN ${eteams}.${table_emp_cus} c ON c.form_data_id = b.formdata
JOIN ${e10_other_business}.attend_status_detail_link d
ON d.employee = a.employee AND d.attend_date = a.attend_date
JOIN ${e10_other_business}.attend_vacation_setting e ON e.id = d.VACATION_TYPE
JOIN (SELECT DISTINCT matrix_data_id as id
FROM ${eteams}.hrm_matrix_value_data a
WHERE a.matrix_id = #{hrbp_matrix_id}
AND a.matrix_value_config_id = #{hrbp_matrix_value_config_id}
AND a.delete_type = 0
AND a.relate_id = #{userId}) alias ON alias.id = b.department
WHERE a.attend_date = CURDATE()
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
AND d.APPEAL_TYPE = 'leave'
</select>
<select id="getAllDeptIdsByHrbp" resultType="java.lang.String">
SELECT DISTINCT CAST(matrix_data_id as CHAR) as id
FROM ${eteams}.hrm_matrix_value_data a
WHERE a.matrix_id = #{hrbp_matrix_id}
AND a.matrix_value_config_id = #{hrbp_matrix_value_config_id}
AND a.delete_type = 0
AND a.relate_id = #{userId}
SELECT
COUNT(DISTINCT b.ID )
FROM
${eteams}.hrm_matrix_value_data a
LEFT JOIN ${eteams}.employee b ON b.DEPARTMENT = a.matrix_data_id
WHERE
<!-- 部门矩阵id -->
a.matrix_id = #{matrixId}
<!-- 矩阵配置id(hrbp字段id) hrbpId -->
AND a.matrix_value_config_id = #{matrixValueConfigId}
<!-- 当前人员id -->
AND a.relate_id=#{userId}
AND a.delete_type = 0
AND b.accounttype = 0
AND b.STATUS = 'normal'
</select>
</mapper>

View File

@ -5,7 +5,7 @@
<select id="getOnJobNumber" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
select count(t.id) as value ,b.yglxmc as name from ${e10_common}.uf_jcl_employee_information t
LEFT join ${e10_common}.uf_jcl_yglx b on t.yglx = b.id
inner join ${e10_common}.uf_jcl_yglx b on t.yglx = b.id
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
@ -14,10 +14,9 @@
</foreach>
</if>
<!--开始日期 <= 结束查询日期-->
AND t.personnel_status not in (5,6)
AND t.hiredate between #{startDate} and #{endDate}
AND t.hiredate &lt;= #{endDate}
<!--最后工作日期 > 开始查询日期 OR 最后工作日期为空-->
and (t.zhgzr ='' or t.zhgzr is null or t.zhgzr between #{startDate} and #{endDate})
and (t.zhgzr ='' or t.zhgzr is null or t.zhgzr &gt; #{endDate})
group by b.yglxmc
</select>
@ -30,11 +29,10 @@
#{departmentId}
</foreach>
</if>
AND t.personnel_status not in (5,6)
<!--开始日期 <= 结束查询日期-->
AND t.hiredate between #{startDate} and #{endDate}
AND t.hiredate &lt;= #{endDate}
<!--最后工作日期 > 开始查询日期 OR 最后工作日期为空-->
AND (t.zhgzr ='' or t.zhgzr is null or t.zhgzr between #{startDate} and #{endDate})
and (t.zhgzr ='' or t.zhgzr is null or t.zhgzr &gt; #{endDate})
</select>
<select id="getResignCount" resultType="java.lang.Integer">
@ -47,21 +45,23 @@
#{departmentId}
</foreach>
</if>
AND t.zhgzr between #{startDate} and #{endDate}
and t.zhgzr &gt;= #{startDate}
and t.zhgzr &lt;= #{endDate}
</select>
<select id="getKeyResignCount" resultType="java.lang.Integer">
select count(id) as value from ${param.e10_common}.uf_jcl_lzxxjl t
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
AND t.lzzt = 1
and t.lzzt = 1
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.lzqbm IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
AND t.sfgjrc = 1
AND t.zhgzr between #{startDate} and #{endDate}
and t.sfgjrc = 1
and t.zhgzr &gt;= #{startDate}
and t.zhgzr &lt;= #{endDate}
</select>
<select id="getEmploymentCount" resultType="java.lang.Integer">
select count(id) as value from ${param.e10_common}.uf_jcl_rzgl t
@ -73,7 +73,8 @@
#{departmentId}
</foreach>
</if>
and t.hiredate between #{startDate} and #{endDate}
and t.hiredate &gt;= #{startDate}
and t.hiredate &lt;= #{endDate}
</select>
<select id="getKeyEmploymentCount" resultType="java.lang.Integer">
select count(id) as value from ${param.e10_common}.uf_jcl_rzgl t
@ -86,7 +87,8 @@
</foreach>
</if>
and t.sfgjrc = 1
and t.hiredate between #{startDate} and #{endDate}
and t.hiredate &gt;= #{startDate}
and t.hiredate &lt;= #{endDate}
</select>
<select id="getEmploymentListByPosition" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
@ -99,24 +101,21 @@
#{departmentId}
</foreach>
</if>
and t.hiredate between #{startDate} and #{endDate}
and t.hiredate &gt;= #{startDate}
and t.hiredate &lt;= #{endDate}
and position !='' and position is not null
group by position order by value
</select>
<select id="getPositionById" resultType="com.weaver.seconddev.portal.entity.po.Position">
select p.id as position_id,
p.name as position_name,
d.id as department_id,
d.name as department_name,
g.id as grade_id,
g.name as grade_name
select p.id as position_id, p.name as position_name,
d.id as department_id, d.name as department_name,
g.id as grade_id, g.name as grade_name
from ${param.eteams}.position p
left join ${param.eteams}.department d on p.department = d.id
left join ${param.eteams}.grade g on p.grade_id = g.id
where p.id = #{positionId}
and p.delete_type = 0
and p.tenant_key = #{param.tenantKey} limit 1
left join ${param.eteams}.department d on p.department = d.id
left join ${param.eteams}.grade g on p.grade_id = g.id
where p.id = #{positionId} and p.delete_type = 0
and p.tenant_key = #{param.tenantKey} limit 1
</select>
<select id="getResignListByPosition" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
@ -137,23 +136,20 @@
<select id="getTopDepartmentIds" resultType="java.lang.Long">
select t.id
from ${param.eteams}.department t
inner join ${param.eteams}.department t1 on t.parent = t1.id
inner join ${param.eteams}.department t1 on t.parent = t1.id
where t.type = 'department'
and t1.type = 'subcompany'
and t.delete_type = 0
and t.status = 1
and t.tenant_key = #{param.tenantKey}
and t1.delete_type = 0
and t1.status = 1
and t1.tenant_key = #{param.tenantKey}
and t1.type = 'subcompany'
and t.delete_type = 0
and t.status = 1
and t.tenant_key = #{param.tenantKey}
and t1.delete_type = 0
and t1.status = 1
and t1.tenant_key = #{param.tenantKey}
</select>
<select id="getLaborCost" resultType="java.util.Map">
select t.yscb, t.sjcb
from ${e10_common}.uf_rlcb t
where t.delete_type = 0
and t.tenant_key = #{tenantKey}
and t.ny BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(#{endDate}, '%Y-%m')
ORDER BY t.ny desc LIMIT 1
select t.yscb,t.sjcb from ${e10_common}.uf_rlcb t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
and t.ny = DATE_FORMAT(#{endDate}, '%Y-%m')
</select>
</mapper>

View File

@ -86,14 +86,14 @@
<select id="getManageDeptIds" resultType="java.lang.Long">
select t.id
from ${param.eteams}.department t
inner join ${param.eteams}.${param.table_dept_cus} t2 on t.formdata = t2.id
inner join ${param.eteams}.${param.table_dept_cus} t2 on t.formdata = t2.id
where t.type = 'department'
and t.delete_type = 0
and t.status = 1
and t.tenant_key = #{param.tenantKey}
and t2.tenant_key = #{param.tenantKey}
and t2.delete_type = 0
and t2.bmfzr = #{empId}
and t.delete_type = 0
and t.status = 1
and t.tenant_key = #{param.tenantKey}
and t2.tenant_key = #{param.tenantKey}
and t2.delete_type = 0
and t2.bmfzr = #{empId}
</select>
<select id="getBirthdayNum" resultType="java.lang.Integer">
@ -181,18 +181,11 @@
</select>
<select id="getPieTypeConfig" resultType="com.weaver.seconddev.portal.entity.po.PieChartConfig">
select t.lx as type,
t.flmc as name,
t.xlfl as educationIds,
t.qsw as startIndex,
t.jzw as endIndex,
t.zj as gradeIds,
t.zssx as orderNum
select t.lx as type,t.flmc as name,t.xlfl as educationIds,
t.qsw as startIndex,t.jzw as endIndex,t.zj as gradeIds,t.zssx as orderNum
from ${e10_common}.uf_xlfb t
where t.delete_type = 0
and t.tenant_key = #{tenantKey}
and t.lx = #{pieType}
order by t.zssx
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
and t.lx = #{pieType} order by t.zssx
</select>
<select id="getAgeCount" resultType="java.lang.Integer">
@ -236,6 +229,10 @@
#{departmentId}
</foreach>
</if>
<!-- <if test="departmentId != null and departmentId != ''">-->
<!-- and t.department = #{departmentId}-->
<!-- </if>-->
<if test="searchKey != null and searchKey != ''">
and (t.username like concat('%',#{searchKey},'%') or t.job_num like concat('%',#{searchKey},'%'))
</if>
@ -339,8 +336,7 @@
</select>
<select id="getLateAndEarlyRankList" resultType="com.weaver.seconddev.portal.entity.po.LateAndEarlyRankPo">
select t1.xm as empId,sum(ifnull(t1.cdcs,0) + ifnull(t1.ztcs,0)) as times,sum(ifnull(t1.cdfzs,0) +
ifnull(t1.ztfzs,0)) as minutes
select t1.xm as empId,sum(ifnull(t1.cdcs,0) + ifnull(t1.ztcs,0)) as times,sum(ifnull(t1.cdfzs,0) + ifnull(t1.ztfzs,0)) as minutes
from ${e10_common}.uf_attend_day_report t1
where t1.delete_type = 0 and t1.tenant_key = #{tenantKey}
<if test="departmentIdList != null and departmentIdList.size() > 0">
@ -447,235 +443,5 @@
and t1.zt = 1
</select>
<select id="getKqRequire" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM ${param.e10_other_business}.ATTEND_STATUS_DETAIL a
JOIN ${param.eteams}.employee b ON a.employee = b.id
JOIN (SELECT DISTINCT id
FROM (WITH RECURSIVE SubDepartments AS (SELECT id
FROM ${param.eteams}.department
WHERE formdata IN (SELECT CAST(id AS CHAR)
FROM ${param.eteams}.${param.table_dept_cus}
WHERE bmfzr = #{userId})
UNION ALL
SELECT d.id
FROM ${param.eteams}.department d
JOIN SubDepartments sd ON d.parent = sd.id
WHERE d.IS_DELETE = 0
AND d.`type` = 'department'
AND d.STATUS = 1)
SELECT id
FROM SubDepartments) as subquery_alias) alias ON alias.id = b.department
WHERE a.attend_date = CURDATE()
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
</select>
<select id="getTodayAllSign" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM ${param.e10_other_business}.ATTEND_STATUS_DETAIL a
INNER JOIN ${param.eteams}.employee b ON a.employee = b.id
INNER JOIN (SELECT DISTINCT id
FROM (WITH RECURSIVE SubDepartments AS (SELECT id
FROM ${param.eteams}.department
WHERE formdata IN (SELECT CAST(id AS CHAR)
FROM ${param.eteams}.${param.table_dept_cus}
WHERE bmfzr = #{userId})
UNION ALL
SELECT d.id
FROM ${param.eteams}.department d
INNER JOIN SubDepartments sd ON d.parent = sd.id
WHERE d.IS_DELETE = 0
AND d.`type` = 'department'
AND d.STATUS = 1)
SELECT id
FROM SubDepartments) depts) alias ON alias.id = b.department
LEFT JOIN ${param.eteams}.${param.table_emp_cus} c ON c.form_data_id = b.formdata
LEFT JOIN ${param.e10_other_business}.timecard d ON d.id = a.SIGN_IN_RECORD
LEFT JOIN ${param.e10_other_business}.timecard e ON e.id = a.SIGN_OUT_RECORD
WHERE a.attend_date = CURDATE()
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
AND (a.SIGN_RANGE_START IS NOT NULL OR a.SIGN_RANGE_END IS NOT NULL)
</select>
<select id="getTotalLate" resultType="java.lang.Integer">
SELECT COUNT(0)
FROM ${param.e10_other_business}.ATTEND_STATUS_DETAIL a
INNER JOIN ${param.eteams}.employee b ON a.employee = b.id
INNER JOIN (SELECT DISTINCT id
FROM (WITH RECURSIVE SubDepartments AS (SELECT id
FROM ${param.eteams}.department
WHERE formdata IN (SELECT CAST(id AS CHAR)
FROM ${param.eteams}.${param.table_dept_cus}
WHERE bmfzr = #{userId})
UNION ALL
SELECT d.id
FROM ${param.eteams}.department d
INNER JOIN SubDepartments sd ON d.parent = sd.id
WHERE d.IS_DELETE = 0
AND d.`type` = 'department'
AND d.STATUS = 1)
SELECT id
FROM SubDepartments) depts) alias ON alias.id = b.department
LEFT JOIN ${param.eteams}.${param.table_emp_cus} c ON c.form_data_id = b.formdata
LEFT JOIN ${param.e10_other_business}.timecard d ON d.id = a.SIGN_IN_RECORD
LEFT JOIN ${param.e10_other_business}.timecard e ON e.id = a.SIGN_OUT_RECORD
LEFT JOIN ${param.e10_other_business}.attend_status_detail_link f
ON f.employee = a.employee AND f.attend_date = a.attend_date
WHERE a.attend_date = CURDATE()
AND a.SIGN_IN_RECORD IS NOT NULL
AND a.PERIOD_RANGE_START &lt; a.SIGN_RANGE_START
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
</select>
<select id="getTodayNoSign" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT a.EMPLOYEE)
FROM ${param.e10_other_business}.ATTEND_STATUS_DETAIL a
INNER JOIN ${param.eteams}.employee b ON a.employee = b.id
INNER JOIN (SELECT DISTINCT id
FROM (WITH RECURSIVE SubDepartments AS (SELECT id
FROM ${param.eteams}.department
WHERE formdata IN (SELECT CAST(id AS CHAR)
FROM ${param.eteams}.${param.table_dept_cus}
WHERE bmfzr = #{userId})
UNION ALL
SELECT d.id
FROM ${param.eteams}.department d
INNER JOIN SubDepartments sd ON d.parent = sd.id
WHERE d.IS_DELETE = 0
AND d.`type` = 'department'
AND d.STATUS = 1)
SELECT id
FROM SubDepartments) depts) alias ON alias.id = b.department
LEFT JOIN ${param.eteams}.${param.table_emp_cus} c ON c.form_data_id = b.formdata
LEFT JOIN ${param.e10_other_business}.timecard d ON d.id = a.SIGN_IN_RECORD
LEFT JOIN ${param.e10_other_business}.timecard e ON e.id = a.SIGN_OUT_RECORD
LEFT JOIN ${param.e10_other_business}.attend_status_detail_link f
ON f.employee = a.employee AND f.attend_date = a.attend_date
WHERE a.attend_date = CURDATE()
AND a.SIGN_IN_RECORD IS NULL
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
</select>
<select id="getTotalVacation" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT a.EMPLOYEE)
FROM ${param.e10_other_business}.ATTEND_STATUS_DETAIL a
JOIN ${param.eteams}.employee b ON a.employee = b.id
JOIN ${param.eteams}.${param.table_emp_cus} c ON c.form_data_id = b.formdata
JOIN ${param.e10_other_business}.attend_status_detail_link d
ON d.employee = a.employee AND d.attend_date = a.attend_date
JOIN ${param.e10_other_business}.attend_vacation_setting e ON e.id = d.VACATION_TYPE
JOIN (SELECT DISTINCT id
FROM (WITH RECURSIVE SubDepartments AS (SELECT id
FROM ${param.eteams}.department
WHERE formdata IN (SELECT CAST(id AS CHAR)
FROM ${param.eteams}.${param.table_dept_cus}
WHERE bmfzr = #{userId})
UNION ALL
SELECT d.id
FROM ${param.eteams}.department d
INNER JOIN SubDepartments sd ON d.parent = sd.id
WHERE d.IS_DELETE = 0
AND d.`type` = 'department'
AND d.STATUS = 1)
SELECT id
FROM SubDepartments) AS subquery_alias) alias ON alias.id = b.department
WHERE a.attend_date = CURDATE()
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
AND d.APPEAL_TYPE = 'leave'
</select>
<select id="getKqRequireByCondition" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM ${e10_other_business}.ATTEND_STATUS_DETAIL a
JOIN ${eteams}.employee b ON a.employee = b.id
WHERE a.attend_date between #{startDate} and #{endDate}
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND b.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
</select>
<select id="getAllSignByCondition" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM ${e10_other_business}.ATTEND_STATUS_DETAIL a
INNER JOIN ${eteams}.employee b ON a.employee = b.id
LEFT JOIN ${eteams}.${table_emp_cus} c ON c.form_data_id = b.formdata
LEFT JOIN ${e10_other_business}.timecard d ON d.id = a.SIGN_IN_RECORD
LEFT JOIN ${e10_other_business}.timecard e ON e.id = a.SIGN_OUT_RECORD
WHERE a.attend_date between #{startDate} and #{endDate}
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
AND a.WORK_LENGTH_DAY > 0
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND b.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
</select>
<select id="getLateByCondition" resultType="java.lang.Integer">
SELECT COUNT(0)
FROM ${e10_other_business}.ATTEND_STATUS_DETAIL a
INNER JOIN ${eteams}.employee b ON a.employee = b.id
LEFT JOIN ${eteams}.${table_emp_cus} c ON c.form_data_id = b.formdata
LEFT JOIN ${e10_other_business}.timecard d ON d.id = a.SIGN_IN_RECORD
LEFT JOIN ${e10_other_business}.timecard e ON e.id = a.SIGN_OUT_RECORD
LEFT JOIN ${e10_other_business}.attend_status_detail_link f
ON f.employee = a.employee AND f.attend_date = a.attend_date
WHERE a.attend_date between #{startDate} and #{endDate}
AND a.FINAL_SIGN_IN_STATUS ='SIGN_IN_LATE'
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND b.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
</select>
<select id="getNoSignByCondition" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT a.EMPLOYEE)
FROM ${e10_other_business}.ATTEND_STATUS_DETAIL a
INNER JOIN ${eteams}.employee b ON a.employee = b.id
LEFT JOIN ${eteams}.${table_emp_cus} c ON c.form_data_id = b.formdata
LEFT JOIN ${e10_other_business}.timecard d ON d.id = a.SIGN_IN_RECORD
LEFT JOIN ${e10_other_business}.timecard e ON e.id = a.SIGN_OUT_RECORD
LEFT JOIN ${e10_other_business}.attend_status_detail_link f
ON f.employee = a.employee AND f.attend_date = a.attend_date
WHERE a.attend_date between #{startDate} and #{endDate}
AND a.SIGN_IN_RECORD IS NULL
AND a.DAY_TYPE = 'WORK'
AND a.delete_type = 0
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND b.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
</select>
<select id="getGradeDistribution" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
SELECT
a.grade,
case WHEN b.name is null then '无' ELSE b.name end as name,
count(0) as value
FROM ${e10_common}.uf_jcl_employee_information a
LEFT JOIN ${eteams}.grade b ON a.grade = b.id
WHERE a.personnel_status NOT IN (5,6)
AND a.DELETE_TYPE=0
AND a.username != '外部联系人(系统)'
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND a.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
GROUP BY a.grade,b.name
</select>
</mapper>

View File

@ -3,15 +3,15 @@
<mapper namespace="com.weaver.seconddev.portal.mapper.portal.SscPortalMapper">
<select id="getExpirationReminderCount" resultType="java.lang.Integer">
select count(t.id) as value from ${e10_common}.uf_jcl_rshtgl t
select count(t.id) as value from ${e10_common}.uf_jcl_employee_information t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.ssbm IN
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.zzrq BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 7 DAY)
and t.htzzrq <![CDATA[ <= ]]> DATE_ADD(CURDATE(), INTERVAL 30 DAY)
</select>
<select id="getIdCardExpirationCount" resultType="java.lang.Integer">
@ -23,8 +23,7 @@
#{departmentId}
</foreach>
</if>
AND t.sfzyxjsrq BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 7 DAY)
AND t.personnel_status not in(5,6)
and t.sfzyxjsrq <![CDATA[ <= ]]> DATE_ADD(CURDATE(), INTERVAL 7 DAY)
</select>
<select id="getHealthCertificateExpirationCount" resultType="java.lang.Integer">
@ -36,9 +35,7 @@
#{departmentId}
</foreach>
</if>
and t.jkzdqrq BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 7 DAY)
AND t.personnel_status not in(5,6)
and t.jkzdqrq <![CDATA[ <= ]]> DATE_ADD(CURDATE(), INTERVAL 7 DAY)
</select>
<select id="getEmploymentAnniversaryCount" resultType="java.lang.Integer">