1.新增入职管理统计 2.新增入职管理岗位等级字段

This commit is contained in:
lw 2024-07-27 17:45:38 +08:00
parent dea36a610d
commit 2e0699b8fd
11 changed files with 169 additions and 16 deletions

View File

@ -5,14 +5,14 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
# master:
# url: jdbc:mysql://192.168.1.165:3306/zeoa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: zeoa
# password: dHahLWNYB7tD2Mia
master:
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: zero
url: jdbc:mysql://192.168.1.165:3306/zeoa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: zeoa
password: dHahLWNYB7tD2Mia
# master:
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: zero
# 从库数据源
slave:
# 从数据源开关/默认关闭

View File

@ -7,8 +7,8 @@ ruoyi:
# 版权年份
copyrightYear: 2024
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/zeroerr/uploadPath
#profile: /home/zeroerr_oa/uploadPath
#profile: D:/zeroerr/uploadPath
profile: /home/zeroerr_oa/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
@ -69,15 +69,15 @@ spring:
# redis 配置
redis:
# 地址
#host: 192.168.1.189
host: localhost
host: 192.168.1.189
#host: localhost
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
#password: 123456
password:
password: 123456
#password:
# 连接超时时间
timeout: 10s
lettuce:

View File

@ -35,6 +35,11 @@
<artifactId>zeroerr_oa-common</artifactId>
</dependency>
<dependency>
<groupId>cn.zeroerr</groupId>
<artifactId>zeroerr_oa-recruit</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,8 +1,20 @@
package cn.zeroerr.quartz.task;
import cn.zeroerr.domain.entity.PostGrade;
import cn.zeroerr.service.PostGradeService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import cn.zeroerr.common.utils.StringUtils;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 定时任务调度测试
*
@ -11,6 +23,8 @@ import cn.zeroerr.common.utils.StringUtils;
@Component("ryTask")
public class RyTask
{
@Autowired
private PostGradeService postGradeService;
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
{
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
@ -25,4 +39,45 @@ public class RyTask
{
System.out.println("执行无参方法");
}
public void handleGrade(){
LocalDate now = LocalDate.now();
// 获取上个月的日期
LocalDate lastMonth = now.minusMonths(1);
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
// 格式化日期
String lastMonthData = lastMonth.format(formatter);
String currentMonthData = lastMonth.format(formatter);
//获取上个月的所有岗位评级
List<PostGrade> lastList = postGradeService.list(
new LambdaQueryWrapper<PostGrade>()
.eq(PostGrade::getMonth, lastMonthData)
);
//获取这个月的所有岗位评级
List<PostGrade> currentList = postGradeService.list(
new LambdaQueryWrapper<PostGrade>()
.eq(PostGrade::getMonth, currentMonthData)
);
List<PostGrade> postGradeList=new ArrayList<>();
if (!CollectionUtils.isEmpty(lastList)) {
// 获取这个月所有的postId
List<Long> currentPostIds = currentList.stream()
.map(PostGrade::getPostId)
.collect(Collectors.toList());
for (PostGrade last : lastList) {
if (!currentPostIds.contains(last.getPostId())) {
last.setMonth(currentMonthData);
postGradeList.add(last);
}
}
}
//将收集到需要添加的当月评级数据导入
postGradeService.saveBatch(postGradeList);
}
}

View File

@ -11,6 +11,7 @@ import cn.zeroerr.common.utils.poi.ExcelUtil;
import cn.zeroerr.domain.dto.EntryManagerDTO;
import cn.zeroerr.domain.entity.EntryManage;
import cn.zeroerr.domain.entity.ResumeFollowRecord;
import cn.zeroerr.domain.vo.EntryStatisticsVO;
import cn.zeroerr.domain.vo.UserVO;
import cn.zeroerr.service.EntryManageService;
import cn.zeroerr.service.ResumeFollowRecordService;
@ -27,10 +28,15 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/recruit/entryManage")
@ -120,4 +126,45 @@ public class EntryManageController extends BaseController {
util.exportExcel(response, entryManageList, "入职管理数据");
}
@GetMapping("/getStatistics/{year}")
@PreAuthorize("@ss.hasAnyPermi('recruit:entry:statistics')")
@ApiOperation(value = "查看入职管理统计")
public AjaxResult getStatistics(@PathVariable("year") String year) {
EntryStatisticsVO entryStatisticsVO = new EntryStatisticsVO();
List<Integer> expectEntryCounts=new ArrayList<>();
List<Integer> confirmEntryCounts=new ArrayList<>();
List<Integer> refuseEntryCounts=new ArrayList<>();
//找出所有该年份的入职信息预计入职不为空的
List<EntryManage> entryList = entryManageService.listByYear(year);
//根据月份进行分组
if (!CollectionUtils.isEmpty(entryList)) {
Map<Integer, List<EntryManage>> listByMonth = entryList.stream().collect(Collectors.groupingBy(x -> x.getJoinDate().getMonthValue()));
//从1月份开始因为防止有月份没有数据导致错乱
for(int month =1 ;month<=12 ;month++){
List<EntryManage> entryManageList = listByMonth.get(month);
//如果该月份有数据
if(!CollectionUtils.isEmpty(entryManageList)){
//统计该月份的预计入职人数
expectEntryCounts.add(entryManageList.size());
//统计该月份实际入职人数
confirmEntryCounts.add((int) entryManageList.stream().filter(x -> x.getIsEntry().equals("1")).count());
//统计该月份拒绝入职人数
refuseEntryCounts.add((int) entryManageList.stream().filter(x -> x.getIsEntry().equals("0")).count());
}
//如果该月份没有数据
else {
expectEntryCounts.add(null);
confirmEntryCounts.add(null);
refuseEntryCounts.add(null);
}
}
}
entryStatisticsVO.setExpectEntryCounts(expectEntryCounts);
entryStatisticsVO.setConfirmEntryCounts(confirmEntryCounts);
entryStatisticsVO.setRefuseEntryCounts(refuseEntryCounts);
return AjaxResult.success(entryStatisticsVO);
}
}

View File

@ -139,6 +139,13 @@ public class EntryManage implements Serializable {
@Excel(name = "档案", cellType = Excel.ColumnType.TEXT)
private String dossier;
/**
* 岗位等级
*/
@TableField(value = "rank")
@Excel(name = "岗位等级",dictType = "recruit_post_rank")
private String rank;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,20 @@
package cn.zeroerr.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel
public class EntryStatisticsVO {
@ApiModelProperty(value = "预计入职人数")
List<Integer> expectEntryCounts;
@ApiModelProperty(value = "确认入职人数")
List<Integer> confirmEntryCounts;
@ApiModelProperty(value = "拒绝入职人数")
List<Integer> refuseEntryCounts;
}

View File

@ -23,6 +23,8 @@ public interface EntryManageMapper extends BaseMapper<EntryManage> {
List<EntryManage> getList(@Param("firstDay") LocalDate firstDay, @Param("lastDay") LocalDate lastDay);
List<EntryManage> getListByWeek(@Param("now") LocalDate now, @Param("plusDays") LocalDate plusDays);
List<EntryManage> listByYear(@Param("year") String year);
}

View File

@ -20,4 +20,6 @@ public interface EntryManageService extends IService<EntryManage> {
List<EntryManage> getList(LocalDate firstDay, LocalDate lastDay);
List<EntryManage> getListByWeek(LocalDate now, LocalDate plusDays);
List<EntryManage> listByYear(String year);
}

View File

@ -33,6 +33,11 @@ public class EntryManageServiceImpl extends ServiceImpl<EntryManageMapper, Entry
public List<EntryManage> getListByWeek(LocalDate now, LocalDate plusDays) {
return this.baseMapper.getListByWeek(now,plusDays);
}
@Override
public List<EntryManage> listByYear(String year) {
return this.baseMapper.listByYear(year);
}
}

View File

@ -20,6 +20,7 @@
<result property="actualJoinDate" column="actual_join_date" jdbcType="DATE"/>
<result property="entryFailReason" column="entry_fail_reason" />
<result property="isEntry" column="is_entry" />
<result property="rank" column="rank" />
</resultMap>
<sql id="Base_Column_List">
@ -27,7 +28,7 @@
post_id,post_name,
user_name,hr_id,hr_name,
final_pass_date,join_date,actual_join_date,
entry_fail_reason,is_entry,file,dossier
entry_fail_reason,is_entry,file,dossier,rank
</sql>
<select id="listBySelect" resultMap="BaseResultMap">
@ -64,6 +65,15 @@
where join_date is not null
<if test="now!=null"> and join_date <![CDATA[>=]]> #{now}</if>
<if test="plusDays!=null"> and join_date <![CDATA[<=]]> #{plusDays}</if>
and is_entry !=0
and is_entry =1
</select>
<select id="listByYear" parameterType="String" resultMap="BaseResultMap">
SELECT *
FROM entry_manage
WHERE join_date BETWEEN
CONCAT(#{year}, '-01-01') AND
CONCAT(#{year}, '-12-31')
AND join_date is not null
</select>
</mapper>