Commit acee334c authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.4' into MVP1.4

parents e79eaa88 972909f7
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TBusinessEmployeeExtendInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import lombok.Data;
......@@ -18,6 +19,8 @@ public class TSettleDomainListVo {
private Map<String,TSettleDomain> mapVO;
private List<TBusinessEmployeeExtendInfo> extendInfo;
/**
* 合同主体IDS
*/
......
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TBusinessEmployeeExtendInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TBusinessEmployeeExtendInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.UpdateEmployeeExtendRedundancyDTO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
......@@ -203,35 +206,38 @@ public class EmployeeBusinessController {
// return this.businessEmployeeExtendInfoService.getNotLeaveExtendList();
// }
//
// /**
// * 查询-列表:内部服务调用,获取所有员工拓展表信息
// * @description: 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
// * @return: R<List<TBusinessEmployeeExtendInfo>>
// * @author: wangweiguo
// * @date: 2021/8/25
// */
// @Inner
// @GetMapping("/inner/getAllExtendList")
// public R<List<TBusinessEmployeeExtendInfo>> getAllExtendList() {
// List<TBusinessEmployeeExtendInfo> list = this.businessEmployeeExtendInfoService.list();
// return R.success(CommonConstants.SEARCH_SUCCESS, list);
// }
//
// /**
// * 查询-列表:内部服务调用,根据电工编号查询扩展表信息
// * @return: R<TBusinessEmployeeExtendInfo>
// * @author: wangweiguo
// * @date: 2021/8/31
// */
// @GetMapping("/inner/getExtendByBusinessTelecomNumber")
// R<TBusinessEmployeeExtendInfo> getExtendByBusinessTelecomNumber(@RequestParam("businessTelecomNumber") String businessTelecomNumber) {
// TBusinessEmployeeExtendInfo businessEmployeeExtendInfo = this.businessEmployeeExtendInfoService.lambdaQuery()
// .eq(TBusinessEmployeeExtendInfo::getBusinessTelecomNumber, businessTelecomNumber)
// .last(CommonConstants.SQL_LIMIT_ONE)
// .one();
// return R.success(CommonConstants.SEARCH_SUCCESS, businessEmployeeExtendInfo);
// }
//
/**
* 查询-列表:内部服务调用,获取所有员工拓展表信息
* @description: 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
* @return: R<List<TBusinessEmployeeExtendInfo>>
* @author: wangweiguo
* @date: 2021/8/25
*/
@Inner
@PostMapping("/inner/getAllExtendList")
public TSettleDomainListVo getAllExtendList() {
TSettleDomainListVo vo = new TSettleDomainListVo();
List<TBusinessEmployeeExtendInfo> list = this.businessEmployeeExtendInfoService.list();
vo.setExtendInfo(list);
return vo;
}
/**
* 查询-列表:内部服务调用,根据电工编号查询扩展表信息
* @return: R<TBusinessEmployeeExtendInfo>
* @author: wangweiguo
* @date: 2021/8/31
*/
@Inner
@PostMapping("/inner/getExtendByBusinessTelecomNumber")
R<TBusinessEmployeeExtendInfo> getExtendByBusinessTelecomNumber(@RequestParam("businessTelecomNumber") String businessTelecomNumber) {
TBusinessEmployeeExtendInfo businessEmployeeExtendInfo = this.businessEmployeeExtendInfoService.lambdaQuery()
.eq(TBusinessEmployeeExtendInfo::getBusinessTelecomNumber, businessTelecomNumber)
.last(CommonConstants.LAST_ONE_SQL)
.one();
return R.ok(businessEmployeeExtendInfo,CommonConstants.SEARCH_SUCCESS);
}
// /**
// * @param
// * @Description: 获取所有附属信息
......
package com.yifu.cloud.plus.v1.business.dto.vacation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* @description: 新增假期
* @author: wangweiguo
* @date: 2021/8/13
*/
@Getter
@Setter
@ToString
public class AddOrSaveVacationRuleDTO implements Serializable {
/**
* 主键
*/
@Schema(description = "主键,更新时该值必传")
private Integer id;
/**
* 假期类型 1年假
*/
@NotBlank(message = "假期类型,不能为空")
@Schema(description = "假期类型 1年假")
private String type;
/**
* 是否自动发放假期时间 0否 1是
*/
@Schema(description = "是否自动发放假期时间 0否 1是")
@NotBlank(message = "是否自动发放假期时间,不能为空")
private String vacationAutoInit;
/**
* 假期初始化时间
*/
@Schema(description = "假期初始化时间")
@NotNull(message = "假期初始化时间,不能为空")
private LocalDate vacationInitDate;
/**
* 时间刻度 1按小时(和TIME_VALUE字段一起保证一天可以被不同单位数量的时间转换)
*/
@Schema(description = "时间刻度 1按小时(和TIME_VALUE字段一起保证一天可以被不同单位数量的时间转换)")
@NotBlank(message = "时间刻度,不能为空")
private String timeScale;
/**
* 以时间刻度为单位的时间值(和TIME_SCALE字段一起保证一天可以被不同单位数量的时间转换)
*/
@Schema(description = "以时间刻度为单位的时间值(和TIME_SCALE字段一起保证一天可以被不同单位数量的时间转换)")
@NotNull(message = "时间值,不能为空")
@Digits(integer = 5, fraction = 1, message = "整数不超过5位,小数不超过1位")
private BigDecimal timeValue;
}
package com.yifu.cloud.plus.v1.business.dto.vacation;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* @description: 假勤信息表 新增或更新记录dto
* @author: wangweiguo
* @date: 2021-08-20
*/
@Setter
@Getter
@ToString
public class AddOrUpdateTVacationInfoDTO implements Serializable {
/**
* b端员工工号
*/
@Schema(description = "电信工号")
@NotBlank(message = "电信工号不能为空")
@Length(max = 20, message = "电信工号不能超过20字符")
private String businessTelecomNumber;
/**
* 人员姓名
*/
@Schema(description = "人员姓名")
@NotBlank(message = "人员姓名不能为空")
@Length(max = 32, message = "人员姓名不能超过32字符")
private String empName;
/**
* 身份证号码
*/
@Schema(description = "身份证号码")
@NotBlank(message = "身份证号码不能为空")
@Length(max = 32, message = "身份证号码不能超过32字符")
private String empIdcard;
/**
* 部门id
*/
@Schema(description = "部门id")
private Integer departId;
/**
* 部门名称
*/
@Schema(description = "部门名称")
private String departName;
/**
* b端岗位
*/
@Schema(description = "岗位")
@Length(max = 32, message = "岗位不能超过32字符")
private String businessPost;
/**
* 假勤类型(字典值)
*/
@Schema(description = "假勤类型(字典值)")
@NotBlank(message = "假勤类型不能为空")
private String vacationType;
/**
* 假勤开始时间
*/
@Schema(description = "假勤开始时间")
@NotNull(message = "假勤开始时间不能为空")
private LocalDateTime vacationStartTime;
/**
* 假勤结束时间
*/
@Schema(description = "假勤结束时间")
@NotNull(message = "假勤结束时间不能为空")
private LocalDateTime vacationEndTime;
/**
* 假勤时长
*/
@Schema(description = "假勤时长")
@NotNull(message = "假勤时长不能为空")
private BigDecimal vacationDuration;
/**
* 假勤事由
*/
@Schema(description = "假勤事由")
@Length(max = 200, message = "假勤事由不能超过200字符")
private String vacationReason;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
package com.yifu.cloud.plus.v1.business.dto.vacation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @description: 假期监控清零日志表 新增或更新记录dto
* @author: wangweiguo
* @date: 2021-08-16
*/
@Setter
@Getter
@ToString
public class AddVacationMonitorClearLogDTO implements Serializable {
/**
* 年假监控id
*/
@NotNull(message = "年假监控id不能为空")
@Schema(description = "年假监控id")
Integer vacationMonitorId;
/**
* 清零说明
*/
@Schema(description = "清零说明")
String clearNote;
}
package com.yifu.cloud.plus.v1.business.dto.vacation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @description: ChangeVacationStatusDTO
* @author: wangweiguo
* @date: 2021/8/24
*/
@Getter
@Setter
@ToString
public class ChangeVacationStatusDTO implements Serializable {
/**
* 主键
*/
@Schema(description = "主键")
@NotNull(message = "主键不能为空")
private String id;
/**
* 销假说明
*/
@Schema(description = "销假说明")
private String vacationNote;
/**
* 假勤实际结束时间
*/
@Schema(description = "假勤实际结束时间")
private LocalDateTime acturalVacationEndTime;
}
package com.yifu.cloud.plus.v1.business.dto.vacation;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* @description: ImportVacationInfoDTO
* @author: wangweiguo
* @date: 2021/8/24
*/
@Setter
@Getter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class ImportVacationInfoDTO implements Serializable {
/**
* 电信工号
*/
@NotBlank(message = "电信工号不能为空")
@Length(max = 20, message = "电信工号不能超过20个字符")
@Schema(description = "电信工号")
private String businessTelecomNumber;
/**
* 人员姓名
*/
@Length(max = 20, message = "姓名不能超过20个字符")
@Schema(description = "姓名")
private String empName;
/**
* 所属部门部门名称
*/
@Schema(description = "所属部门")
@Length(max = 32, message = "所属部门名称不能超过32个字符")
private String departName;
/**
* 假勤类型
*/
@Schema(description = "假勤类型")
@NotBlank(message = "假勤类型不能为空")
@Length(max = 32, message = "假勤类型不能超过32个字符")
private String vacationType;
/**
* 假勤事由
*/
@Schema(description = "假勤事由")
@Length(max = 200, message = "假勤事由不能超过200个字符")
private String vacationReason;
/**
* 假勤开始时间
*/
@Schema(description = "假勤开始时间")
@NotNull(message = "假勤开始时间不能为空")
private LocalDate vacationStartTime;
/**
* 假勤结束时间
*/
@Schema(description = "假勤结束时间")
@NotNull(message = "假勤结束时间不能为空")
private LocalDate vacationEndTime;
/**
* 假勤时长
*/
@Schema(description = "假勤时长")
@NotNull(message = "假勤时长不能为空")
@Digits(integer = 5, fraction = 1, message = "假勤时长整数部分不超过5位,小数部分不超过1位")
@DecimalMin(value = "0.0", message = "假勤时长不能为负数")
private BigDecimal vacationDuration;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
package com.yifu.cloud.plus.v1.business.dto.vacation;
import lombok.*;
import java.io.Serializable;
/**
* @description: UpdateVacationMonitorRedundancyDTO
* @author: wangweiguo
* @date: 2021/8/23
*/
@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class UpdateVacationRedundancyDTO implements Serializable {
/**
* 身份证号
*/
private String empIdcard;
/**
* 姓名
*/
private String empName;
/**
* 电信工号
*/
private String businessTelecomNumber;
/**
* 岗位
*/
private String businessPost;
/**
* 部门id
*/
private Integer departId;
/**
* 标签
*/
private String label;
}
package com.yifu.cloud.plus.v1.business.query.vacation;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* @description: 假勤信息表 分页查询query
* @author: wangweiguo
* @date: 2021-08-20
*/
@Setter
@Getter
@ToString
public class TVacationInfoQuery implements Serializable {
/**
* b端员工工号
*/
@Schema(description = "b端员工工号")
private String businessTelecomNumber;
/**
* 人员姓名
*/
@Schema(description = "人员姓名")
private String empName;
/**
* 身份证号码
*/
@Schema(description = "身份证号码")
private String empIdcard;
/**
* b端岗位
*/
@Schema(description = "岗位")
private String businessPost;
/**
* 部门id
*/
@Schema(description = "部门id")
private Integer departId;
/**
* 假勤类型(字典值)
*/
@Schema(description = "假勤类型(字典值)")
private String vacationType;
/**
* 假勤开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "假勤开始时间 yyyy-MM-dd HH:mm:ss")
private LocalDateTime vacationStartTime;
/**
* 假勤结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "假勤结束时间 yyyy-MM-dd HH:mm:ss")
private LocalDateTime vacationEndTime;
/**
* 假勤状态 0待休 1休假中 2到期待销假 3已销假
*/
@Schema(description = "假勤状态 0待休 1休假中 2到期待销假 3已销假")
private String vacationStatus;
/**
* 当前页码 默认为1
*/
@Schema(description = "当前页码 默认为1")
long current = 1;
/**
* 每页数量 默认为10
*/
@Schema(description = "每页数量 默认为10")
long size = 10;
/**
* 排序字段
*/
@Schema(description = "排序字段")
List<OrderItem> orders;
}
package com.yifu.cloud.plus.v1.business.query.vacation;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.util.List;
/**
* @description: 假期监控清零日志表 分页查询query
* @author: wangweiguo
* @date: 2021-08-16
*/
@Setter
@Getter
@ToString
public class TVacationMonitorClearLogQuery implements Serializable {
/**
* 当前页码 默认为1
*/
@Schema(description = "当前页码 默认为1")
long current = 1;
/**
* 每页数量 默认为10
*/
@Schema(description = "每页数量 默认为10")
long size = 10;
/**
* 排序字段
*/
@Schema(description = "排序字段")
List<OrderItem> orders;
}
package com.yifu.cloud.plus.v1.business.query.vacation;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.util.List;
/**
* @description: 假期监控表 分页查询query
* @author: wangweiguo
* @date: 2021-08-13
*/
@Setter
@Getter
@ToString
public class TVacationMonitorQuery implements Serializable {
/**
* 电信工号
*/
@Schema(description = "电信工号")
private String businessTelecomNumber;
/**
* 姓名
*/
@Schema(description = "姓名")
private String empName;
/**
* 身份证号码
*/
@Schema(description = "身份证号码")
private String empIdcard;
/**
* b端岗位
*/
@Schema(description = "岗位")
private String businessPost;
/**
* 部门id
*/
@Schema(description = "所属部门treeLogo")
private Integer departId;
/**
* 年份
*/
@Schema(description = "年份")
private String vacationYear;
/**
* 休假状态 0剩余未休 1已休
*/
@Schema(description = "休假状态 0剩余未休 1已休")
private String vacationStatus;
/**
* 当前页码 默认为1
*/
@Schema(description = "当前页码 默认为1")
long current = 1;
/**
* 每页数量 默认为10
*/
@Schema(description = "每页数量 默认为10")
long size = 10;
/**
* 排序字段
*/
@Schema(description = "排序字段")
List<OrderItem> orders;
}
package com.yifu.cloud.plus.v1.business.vo.vacation;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* @description: 假勤信息表 分页查询展示 vo
* @author: wangweiguo
* @date: 2021-08-20
*/
@Setter
@Getter
@ToString
public class TVacationInfoVO implements Serializable {
/**
* 主键
*/
@Schema(description = "主键")
private String id;
/**
* b端员工工号
*/
@Schema(description = "电信工号")
private String businessTelecomNumber;
/**
* 人员姓名
*/
@Schema(description = "人员姓名")
private String empName;
/**
* 身份证号码
*/
@Schema(description = "身份证号码")
private String empIdcard;
/**
* 部门id
*/
@Schema(description = "部门id")
private Integer departId;
/**
* 部门名称
*/
@Schema(description = "部门名称")
private String departName;
/**
* 假勤状态
*/
@Schema(description = "假勤状态 0待休 1休假中 2到期待销假 3已销假")
private String vacationStatus;
/**
* b端岗位
*/
@Schema(description = "岗位")
private String businessPost;
/**
* 假勤类型(字典值)
*/
@Schema(description = "假勤类型(字典值)")
private String vacationType;
/**
* 假勤开始时间
*/
@Schema(description = "假勤开始时间")
private LocalDateTime vacationStartTime;
/**
* 假勤结束时间
*/
@Schema(description = "假勤结束时间")
private LocalDateTime vacationEndTime;
/**
* 假勤时长
*/
@Schema(description = "假勤时长")
private BigDecimal vacationDuration;
/**
* 假勤事由
*/
@Schema(description = "假勤事由")
private String vacationReason;
/**
* 假勤实际结束时间
*/
@Schema(description = "假勤实际结束时间")
private LocalDateTime acturalVacationEndTime;
/**
* 销假说明
*/
@Schema(description = "销假说明")
private String vacationNote;
/**
* 剩余年假时长
*/
@Schema(description = "剩余年假时长")
private BigDecimal vacationNotUsedDuration;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
package com.yifu.cloud.plus.v1.business.vo.vacation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* @description: 假期监控清零日志表 分页查询展示 vo
* @author: wangweiguo
* @date: 2021-08-16
*/
@Setter
@Getter
@ToString
public class TVacationMonitorClearLogVO implements Serializable {
/**
* 主键
*/
@Schema(description = "主键")
private String id;
/**
* 清零说明
*/
@Schema(description = "清零说明")
private String clearNote;
/**
* 清零时长
*/
@Schema(description = "清零时长")
private BigDecimal clearDuration;
/**
* 年份
*/
@Schema(description = "年份")
private String vacationYear;
/**
* 清零人姓名
*/
@Schema(description = "清零人姓名")
private String clearUser;
/**
* 清零时间
*/
@Schema(description = "清零时间")
private LocalDateTime clearTime;
private static final long serialVersionUID = 1L;
}
package com.yifu.cloud.plus.v1.business.vo.vacation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* @description: 假期监控表 分页查询展示 vo
* @author: wangweiguo
* @date: 2021-08-13
*/
@Setter
@Getter
@ToString
public class TVacationMonitorVO implements Serializable {
/**
* 主键
*/
@Schema(description = "主键")
private Integer id;
/**
* 年份
*/
@Schema(description = "年份")
private String vacationYear;
/**
* 电信工号
*/
@Schema(description = "电信工号")
private String businessTelecomNumber;
/**
* 身份证号码
*/
@Schema(description = "身份证号")
private String empIdcard;
/**
* 姓名
*/
@Schema(description = "姓名")
private String empName;
/**
* 部门编码
*/
@Schema(description = "所属部门编码")
private String departCode;
/**
* 部门名称
*/
@Schema(description = "所属部门名称")
private String departName;
/**
* 部门id
*/
@Schema(description = "部门id")
private Integer departId;
/**
* b端岗位
*/
@Schema(description = "岗位")
private String businessPost;
/**
* 假期时长
*/
@Schema(description = "年假时长")
private BigDecimal vacationDuration;
/**
* 未使用假期时长
*/
@Schema(description = "未休时长")
private BigDecimal notUsedVacationDuration;
/**
* 入职时间
*/
@Schema(description = "入职时间")
private LocalDateTime businessEnjoinDate;
/**
* 在岗工龄
*/
@Schema(description = "在岗工龄")
private BigDecimal workingAge;
/**
* 休假状态 0未休完 1已休完
*/
@Schema(description = "休假状态 0未休完 1已休完")
private String vacationStatus;
private static final long serialVersionUID = 1L;
}
package com.yifu.cloud.plus.v1.business.vo.vacation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* @description: 假期配置规则VO
* @author: wangweiguo
* @date: 2021/8/13
*/
@Getter
@Setter
@ToString
public class VacationRuleConfigVO implements Serializable {
/**
* 主键
*/
@Schema(description = "主键")
private Integer id;
/**
* 假期类型 1年假
*/
@Schema(description = "假期类型 1年假")
private String type;
/**
* 是否自动发放假期时间 0否 1是
*/
@Schema(description = "是否自动发放假期时间 0否 1是")
private String vacationAutoInit;
/**
* 假期初始化时间
*/
@Schema(description = "假期初始化时间")
private LocalDate vacationInitDate;
/**
* 时间刻度 1按小时(和TIME_VALUE字段一起保证一天可以被不同单位数量的时间转换)
*/
@Schema(description = "时间刻度 1按小时(和TIME_VALUE字段一起保证一天可以被不同单位数量的时间转换")
private String timeScale;
/**
* 以时间刻度为单位的时间值(和TIME_SCALE字段一起保证一天可以被不同单位数量的时间转换)
*/
@Schema(description = "以时间刻度为单位的时间值(和TIME_SCALE字段一起保证一天可以被不同单位数量的时间转换)")
private BigDecimal timeValue;
}
package com.yifu.cloud.plus.v1.business.controller.vacation;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yifu.cloud.plus.v1.business.dto.vacation.AddOrUpdateTVacationInfoDTO;
import com.yifu.cloud.plus.v1.business.dto.vacation.ChangeVacationStatusDTO;
import com.yifu.cloud.plus.v1.business.dto.vacation.UpdateVacationRedundancyDTO;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationInfo;
import com.yifu.cloud.plus.v1.business.query.vacation.TVacationInfoQuery;
import com.yifu.cloud.plus.v1.business.service.vacation.TVacationInfoService;
import com.yifu.cloud.plus.v1.business.vo.vacation.TVacationInfoVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* 假勤信息表 controller
* @author: wangweiguo
* @date: 2021-08-20
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/vacationInfo")
@Tag(name = "假勤信息表相关api")
public class TVacationInfoController {
private final TVacationInfoService tVacationInfoService;
/**
* 分页查询: 条件分页查询
* @param query 查询条件
* @return: R<IPage<TVacationInfoVO>>
* @author: wangweiguo
* @date: 2021-08-20
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/getListByPage")
public R<IPage<TVacationInfoVO>> getListByPage(TVacationInfoQuery query) {
return this.tVacationInfoService.getListByPage(query);
}
/**
* 导入: 通过json串格式导入假勤信息
* @param jsonStr json字符串数据
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/24
*/
@Operation(summary = "导入: 通过json串格式导入假勤信息", description = "导入: 通过json串格式导入假勤信息")
@PostMapping("/batchImportByJsonStr")
public R<List<ErrorMessage>> batchImportByJsonStr(@RequestBody String jsonStr) {
return this.tVacationInfoService.batchImportByJsonStr(jsonStr);
}
/**
* 查询:根据条件出列表
* @param query 查询条件
* @return: IPage<com.yifu.cloud.v1.hrobusiness.api.vo.vacation.TVacationInfoVO>>
* @author: wangweiguo
* @date: 2021/8/24
*/
@Operation(summary = "查询:根据条件出列表", description = "查询:根据条件出列表")
@GetMapping("/getList")
public R<List<TVacationInfoVO>> getList(TVacationInfoQuery query) {
return this.tVacationInfoService.getList(query);
}
/**
* 查询-详情:根据id查询数据
* @param id
* @return: R<TVacationInfoVO>
* @author: wangweiguo
* @date: 2021-08-24
*/
@Operation(summary = "查询-详情:根据id查询数据", description = "查询-详情:根据id查询数据")
@GetMapping("/{id}")
public R<TVacationInfoVO> getById(@PathVariable("id") String id) {
return this.tVacationInfoService.getDataById(id);
}
/**
* 添加:新增-单条-添加一条记录
* @param dto
* @return: R<TVacationInfo>
* @author: wangweiguo
* @date: 2021-08-24
*/
@Operation(summary = "添加:新增-单条-添加一条记录", description = "添加:新增-单条-添加一条记录")
@PostMapping
public R<TVacationInfo> save(@RequestBody @Valid AddOrUpdateTVacationInfoDTO dto) {
return this.tVacationInfoService.saveData(dto);
}
/**
* 销假:单条-根据id更新记录
* @param dto dto
* @return: R<Boolean>
* @author: wangweiguo
* @date: 2021-08-24
*/
@Operation(summary = "销假:单条-根据id更新", description = "销假:单条-根据id更新")
@PostMapping("/vacationEnd/{id}")
public R<Boolean> vacationEnd(@RequestBody @Valid ChangeVacationStatusDTO dto) {
return this.tVacationInfoService.vacationEnd(dto);
}
/**
* 删除-单条:根据id删除记录
* @param id
* @return: R<Boolean>
* @author: wangweiguo
* @date: 2021-08-20
*/
@Operation(summary = "根据id删除记录", description = "根据id删除记录")
@DeleteMapping("/{id}")
public R<Boolean> delById(@PathVariable("id") String id) {
return this.tVacationInfoService.removeDataById(id);
}
/**
* @author wangweiguo
* @description 更新假勤信息中的冗余信息
* @date 20:32 2021/8/24
* @param dtoList 更新冗余字段dto集合
* @return com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
**/
@Inner
@PostMapping("/inner/updateRedundancyEmployeeFields")
public R<Boolean> updateRedundancyEmployeeFields(@RequestBody List<UpdateVacationRedundancyDTO> dtoList) {
return this.tVacationInfoService.updateRedundancyEmployeeFields(dtoList);
}
}
package com.yifu.cloud.plus.v1.business.controller.vacation;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yifu.cloud.plus.v1.business.dto.vacation.UpdateVacationRedundancyDTO;
import com.yifu.cloud.plus.v1.business.query.vacation.TVacationMonitorQuery;
import com.yifu.cloud.plus.v1.business.service.vacation.TVacationMonitorService;
import com.yifu.cloud.plus.v1.business.vo.vacation.TVacationMonitorVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.List;
/**
* @description: 假期监控表 controller
* @author: wangweiguo
* @date: 2021-08-13
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/vacationMonitor")
@Tag(name = "假期监控表相关api")
public class TVacationMonitorController {
private final TVacationMonitorService tVacationMonitorService;
/**
* @description: 分页查询: 条件分页查询
* @param query 查询条件
* @return: R<IPage<TVacationMonitorVO>>
* @author: wangweiguo
* @date: 2021-08-13
*/
@Operation(summary = "分页查询: 条件分页查询", description = "分页查询: 条件分页查询")
@GetMapping("/getListByPage")
public R<IPage<TVacationMonitorVO>> getListByPage(TVacationMonitorQuery query) {
return this.tVacationMonitorService.getListByPage(query);
}
/**
* @description: 导出:根据查询条件导出
* @param query 查询条件
* @return: R<List<TVacationMonitorVO>>
* @author: wangweiguo
* @date: 2021-08-13
*/
@Operation(summary = "导出:根据查询条件导出", description = "导出:根据查询条件导出")
@GetMapping("/exportByParams")
public R<List<TVacationMonitorVO>> exportByParams(TVacationMonitorQuery query) {
return this.tVacationMonitorService.exportByParams(query);
}
/**
* @description: 查询-剩余年假:根据身份证号查询剩余年假
* @param idcard
* @return: com.yifu.cloud.v1.common.core.util.R<java.math.BigDecimal>
* @author: wangweiguo
* @date: 2021/8/17
*/
@Operation(summary = "查询-剩余年假:根据身份证号查询剩余年假", description = "查询-剩余年假:根据身份证号查询剩余年假")
@GetMapping("getNotUsedVacationDurationByIdCard")
public R<BigDecimal> getNotUsedVacationDurationByIdCard(@RequestParam("idcard") String idcard) {
return this.tVacationMonitorService.getNotUsedVacationDurationByIdCard(idcard);
}
/**
* @description: 定时任务:内部服务调用,每天初始化员工年假信息
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/17
*/
@Inner
@PostMapping("/inner/buildMonitorDataForCurrentYear")
public R<Boolean> buildMonitorData() {
return this.tVacationMonitorService.buildMonitorData();
}
/**
* @description: 冗余更新:更新监控表中冗余的员工信息,电信工号和岗位
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/23
*/
@Inner
@PostMapping("/inner/updateRedundancyEmployeeFields")
public R<Boolean> updateRedundancyEmployeeFields(@RequestBody List<UpdateVacationRedundancyDTO> dtoList) {
return this.tVacationMonitorService.updateRedundancyEmployeeFields(dtoList);
}
}
package com.yifu.cloud.plus.v1.business.mapper.vacation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationInfo;
import com.yifu.cloud.plus.v1.business.query.vacation.TVacationInfoQuery;
import com.yifu.cloud.plus.v1.business.vo.vacation.TVacationInfoVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @description: 假勤信息表 mapper
* @Entity com.yifu.cloud.v1.hrobusiness.api.entity.vacation.TVacationInfo
* @author: wangweiguo
* @date: 2021-08-20
*/
public interface TVacationInfoMapper extends BaseMapper<TVacationInfo> {
/**
* @description: 分页查询: 条件分页查询
* @param query 查询条件
* @return: R<IPage<TVacationInfoVO>>
* @author: wangweiguo
* @date: 2021-08-20
*/
Page<TVacationInfoVO> getListByPage(Page<TVacationInfoVO> page, @Param("query") TVacationInfoQuery query);
/**
* @description: 列表查询查询: 条件列表查询
* @param query 查询条件
* @return: List<TVacationInfoVO>
* @author: wangweiguo
* @date: 2021-08-24
*/
List<TVacationInfoVO> getListByPage(@Param("query") TVacationInfoQuery query);
TVacationInfoVO getDataById(@Param("id") String id);
}
package com.yifu.cloud.plus.v1.business.mapper.vacation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationMonitor;
import com.yifu.cloud.plus.v1.business.query.vacation.TVacationMonitorQuery;
import com.yifu.cloud.plus.v1.business.vo.vacation.TVacationMonitorVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @description: 假期监控表 mapper
* @Entity generator.domain.TVacationMonitor
* @author: wangweiguo
* @date: 2021-08-13
*/
public interface TVacationMonitorMapper extends BaseMapper<TVacationMonitor> {
Page<TVacationMonitorVO> getListByPage(Page<TVacationMonitorVO> page, @Param("query") TVacationMonitorQuery query);
List<TVacationMonitorVO> getList(@Param("query")TVacationMonitorQuery query);
}
package com.yifu.cloud.plus.v1.business.service.vacation;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.business.dto.vacation.AddOrUpdateTVacationInfoDTO;
import com.yifu.cloud.plus.v1.business.dto.vacation.ChangeVacationStatusDTO;
import com.yifu.cloud.plus.v1.business.dto.vacation.UpdateVacationRedundancyDTO;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationInfo;
import com.yifu.cloud.plus.v1.business.query.vacation.TVacationInfoQuery;
import com.yifu.cloud.plus.v1.business.vo.vacation.TVacationInfoVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.List;
/**
* 假勤信息表 service层
* @author: wangweiguo
* @date: 2021-08-20
*/
public interface TVacationInfoService extends IService<TVacationInfo> {
/**
* 分页查询: 条件分页查询
* @param query 查询条件
* @return: R<IPage<TVacationInfoVO>>
* @author: wangweiguo
* @date: 2021-08-20
*/
R<IPage<TVacationInfoVO>> getListByPage(TVacationInfoQuery query);
/**
* 查询:根据条件出列表
* @param query 查询条件
* @return: IPage<com.yifu.cloud.v1.hrobusiness.api.vo.vacation.TVacationInfoVO>>
* @author: wangweiguo
* @date: 2021/8/24
*/
R<List<TVacationInfoVO>> getList(TVacationInfoQuery query);
/**
* 查询-详情:根据id查询数据
* @param id
* @return: R<TVacationInfoVO>
* @author: wangweiguo
* @date: 2021-08-24
*/
R<TVacationInfoVO> getDataById(String id);
/**
* 销假:单条-根据id更新记录
* @param dto dto
* @return: R<Boolean>
* @author: wangweiguo
* @date: 2021-08-24
*/
R<Boolean> vacationEnd(ChangeVacationStatusDTO dto);
/**
* 导入: 通过json串格式导入假勤信息
* @param jsonStr json字符串数据
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/24
*/
R<List<ErrorMessage>> batchImportByJsonStr(String jsonStr);
/**
* 删除-单条:根据id删除记录
* @param id
* @return: R<Boolean>
* @author: wangweiguo
* @date: 2021-08-20
*/
R<Boolean> removeDataById(String id);
/**
* 添加:新增-单条-添加一条记录
* @param dto
* @return: R<TVacationInfo>
* @author: wangweiguo
* @date: 2021-08-24
*/
R<TVacationInfo> saveData(AddOrUpdateTVacationInfoDTO dto);
/**
* @author wangweiguo
* @description 更新假勤信息中的冗余信息
* @date 20:32 2021/8/24
* @param dtoList 更新冗余字段dto集合
* @return com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
**/
R<Boolean> updateRedundancyEmployeeFields(List<UpdateVacationRedundancyDTO> dtoList);
}
package com.yifu.cloud.plus.v1.business.service.vacation;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.business.dto.vacation.UpdateVacationRedundancyDTO;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationMonitor;
import com.yifu.cloud.plus.v1.business.query.vacation.TVacationMonitorQuery;
import com.yifu.cloud.plus.v1.business.vo.vacation.TVacationMonitorVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.math.BigDecimal;
import java.util.List;
/**
* @description: 假期监控表 service层
* @author: wangweiguo
* @date: 2021-08-13
*/
public interface TVacationMonitorService extends IService<TVacationMonitor> {
/**
* @description: 分页查询: 条件分页查询
* @param query 查询条件
* @return: R<IPage<TVacationMonitorVO>>
* @author: wangweiguo
* @date: 2021-08-13
*/
R<IPage<TVacationMonitorVO>> getListByPage(TVacationMonitorQuery query);
/**
* @description: 导出:根据查询条件导出
* @param query 查询条件
* @return: R<List<TVacationMonitorVO>>
* @author: wangweiguo
* @date: 2021-08-13
*/
R<List<TVacationMonitorVO>> exportByParams(TVacationMonitorQuery query);
/**
* @description: 保存或者更新监控记录
* @param entity
* @return: boolean
* @author: wangweiguo
* @date: 2021/8/16
*/
boolean saveOrUpdateData(TVacationMonitor entity);
/**
* @description: 批量保存 OR 新增
* @param list
* @return: boolean
* @author: wangweiguo
* @date: 2021/8/16
*/
boolean batchSaveOrUpdateData(List<TVacationMonitor> list);
/**
* @description: 查询:根据身份证号查询剩余年假
* @param idcard
* @return: com.yifu.cloud.v1.common.core.util.R<java.math.BigDecimal>
* @author: wangweiguo
* @date: 2021/8/17
*/
R<BigDecimal> getNotUsedVacationDurationByIdCard(String idcard);
/**
* @description: 定时任务:内部服务调用,每天初始化员工年假信息
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/17
*/
R<Boolean> buildMonitorData();
/**
* @description: 冗余更新:更新监控表中冗余的员工信息,电信工号和岗位
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/23
*/
R<Boolean> updateRedundancyEmployeeFields(List<UpdateVacationRedundancyDTO> dtoList);
/**
* @description: 释放假期时长
* @param empIdcard 身份证号
* @param vacationDuration 假期时长
* @param year 年份
* @return: boolean
* @author: wangweiguo
* @date: 2021/8/24
*/
boolean releaseVacationDuration(String empIdcard, BigDecimal vacationDuration, String year);
/**
* @description: 消耗假期时长
* @param empIdcard 身份证号
* @param vacationDuration 假期时长
* @param year 年份
* @return: boolean
* @author: wangweiguo
* @date: 2021/8/24
*/
boolean consumeVacationDuration(String empIdcard, BigDecimal vacationDuration, String year);
/**
* @description: 根据假勤年份和身份证号查询年假监控信息
* @param empIdcard 身份证号
* @param year 假勤年份
* @return: com.yifu.cloud.v1.hrobusiness.api.entity.vacation.TVacationMonitor
* @author: wangweiguo
* @date: 2021/8/24
*/
TVacationMonitor getMonitorByEmpIdcardAndYear(String empIdcard, String year);
}
package com.yifu.cloud.plus.v1.business.service.vacation.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.util.StringUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
import com.yifu.cloud.plus.v1.business.dto.vacation.AddOrUpdateTVacationInfoDTO;
import com.yifu.cloud.plus.v1.business.dto.vacation.ChangeVacationStatusDTO;
import com.yifu.cloud.plus.v1.business.dto.vacation.ImportVacationInfoDTO;
import com.yifu.cloud.plus.v1.business.dto.vacation.UpdateVacationRedundancyDTO;
import com.yifu.cloud.plus.v1.business.entity.system.TBusDept;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationInfo;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationMonitor;
import com.yifu.cloud.plus.v1.business.mapper.vacation.TVacationInfoMapper;
import com.yifu.cloud.plus.v1.business.query.vacation.TVacationInfoQuery;
import com.yifu.cloud.plus.v1.business.service.system.TBusDeptService;
import com.yifu.cloud.plus.v1.business.service.vacation.TVacationInfoService;
import com.yifu.cloud.plus.v1.business.service.vacation.TVacationMonitorService;
import com.yifu.cloud.plus.v1.business.util.BusinessCommonContants;
import com.yifu.cloud.plus.v1.business.util.BusinessResultErrorMsg;
import com.yifu.cloud.plus.v1.business.vo.vacation.TVacationInfoVO;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TBusinessEmployeeExtendInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* @description: 假勤信息表 service实现层
* @author: wangweiguo
* @date: 2021-08-20
*/
@AllArgsConstructor
@Service
public class TVacationInfoServiceImpl extends ServiceImpl<TVacationInfoMapper, TVacationInfo>
implements TVacationInfoService {
private final ObjectMapper objectMapper;
private final TVacationMonitorService vacationMonitorService;
private final Lock lock = new ReentrantLock();
private final ArchivesDaprUtil archivesDaprUtil;
private final TBusDeptService busDeptService;
/**
* @description: 分页查询: 条件分页查询
* @param query 查询条件
* @return: R<IPage<TVacationInfoVO>>
* @author: wangweiguo
* @date: 2021-08-24
*/
@Override
public R<IPage<TVacationInfoVO>> getListByPage(TVacationInfoQuery query) {
Page<TVacationInfoVO> page = new Page<>(query.getCurrent(), query.getSize());
page.setOrders(query.getOrders());
page = this.baseMapper.getListByPage(page, query);
return R.ok(page,CommonConstants.SEARCH_SUCCESS);
}
/**
* @description: 查询:根据条件出列表
* @param query 查询条件
* @return: IPage<com.yifu.cloud.v1.hrobusiness.api.vo.vacation.TVacationInfoVO>>
* @author: wangweiguo
* @date: 2021/8/24
*/
@Override
public R<List<TVacationInfoVO>> getList(TVacationInfoQuery query) {
List<TVacationInfoVO> list = this.baseMapper.getListByPage(query);
return R.ok(list,CommonConstants.SEARCH_SUCCESS);
}
/**
* @description: 查询-详情:根据id查询数据
* @param id
* @return: R<TVacationInfoVO>
* @author: wangweiguo
* @date: 2021-08-24
*/
@Override
public R<TVacationInfoVO> getDataById(String id) {
TVacationInfoVO vo = this.baseMapper.getDataById(id);
return R.ok(vo,CommonConstants.SEARCH_SUCCESS);
}
/**
* @description: 销假:单条-根据id更新记录
* @param dto dto
* @return: R<Boolean>
* @author: wangweiguo
* @date: 2021-08-24
*/
@Override
public R<Boolean> vacationEnd(ChangeVacationStatusDTO dto) {
YifuUser user = SecurityUtils.getUser();
if (user == null) {
return R.failed(BusinessResultErrorMsg.USER_NOT_LOGIN);
}
TVacationInfo entity = this.getById(dto.getId());
if (null == entity) {
return R.failed(BusinessResultErrorMsg.VACATION_INFO_NOT_EXIST);
}
if (null != dto.getActuralVacationEndTime() && !dto.getActuralVacationEndTime().isBefore(entity.getVacationEndTime()) && !dto.getActuralVacationEndTime().isEqual(entity.getVacationEndTime())) {
return R.failed(BusinessResultErrorMsg.ACTURAL_START_END_TIME_ERROR);
}
entity.setVacationStatus(CommonConstants.THREE_STRING);
entity.setVacationNote(dto.getVacationNote());
entity.setActuralVacationEndTime(dto.getActuralVacationEndTime());
entity.setUpdateUser(user.getNickname());
entity.setUpdateUserId(Integer.valueOf(user.getId()));
entity.setUpdateTime(LocalDateTime.now());
boolean isSuccess = this.updateById(entity);
return R.ok(isSuccess,CommonConstants.RESULT_DATA_SUCESS);
}
/**
* @description: 导入: 通过json串格式导入假勤信息
* @param jsonStr json字符串数据
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/24
*/
@Override
public R<List<ErrorMessage>> batchImportByJsonStr(String jsonStr) {
YifuUser user = SecurityUtils.getUser();
if (null == user) {
return R.failed(BusinessResultErrorMsg.USER_NOT_LOGIN);
}
List<ErrorMessage> errorMessageList = new ArrayList<>();
List<ImportVacationInfoDTO> list;
try {
list = objectMapper.readValue(jsonStr, new TypeReference<List<ImportVacationInfoDTO>>(){});
} catch (InvalidFormatException e) {
e.printStackTrace();
if (e.getCause().toString().contains("DateTimeParseException")) {
errorMessageList.add(new ErrorMessage(e.getPath().get(0).getIndex() + 2, BusinessResultErrorMsg.JSON_DATE_RESOLVER_ERROR.concat("错误值:" + e.getValue().toString())));
return R.failed(errorMessageList,CommonConstants.UPDATE_DATA_FAIL);
}
errorMessageList.add(new ErrorMessage(e.getPath().get(0).getIndex() + 2, BusinessResultErrorMsg.JSON_RESOLVER_ERROR.concat(e.getCause().toString())));
return R.failed(errorMessageList,CommonConstants.UPDATE_DATA_FAIL);
} catch (Exception e) {
e.printStackTrace();
errorMessageList.add(new ErrorMessage(null, e.getCause().toString()));
return R.failed(errorMessageList,CommonConstants.UPDATE_DATA_FAIL);
}
if (!CollUtil.isEmpty(list)) {
errorMessageList.addAll(Common.commonImportErrorMessage(list));
List<TBusinessEmployeeExtendInfo> employeeExtentList = new ArrayList<>();
List<TBusDept> busDeptList = busDeptService.list();
R<TSettleDomainListVo> sdRes = archivesDaprUtil.getAllExtendList();
if (Common.isNotNull(sdRes) && Common.isNotNull(sdRes.getData())){
employeeExtentList = sdRes.getData().getExtendInfo();
}
if (employeeExtentList.isEmpty()) {
errorMessageList.add(new ErrorMessage(null, BusinessResultErrorMsg.EMPLOYEE_EXTENT_DATA_NOT_EXIST));
return R.failed(errorMessageList,BusinessResultErrorMsg.EMPLOYEE_EXTENT_DATA_NOT_EXIST);
}
if (Common.isEmpty(busDeptList)) {
errorMessageList.add(new ErrorMessage(null, BusinessResultErrorMsg.DEPART_DATA_NOT_EXIST));
return R.failed(errorMessageList,BusinessResultErrorMsg.DEPART_DATA_NOT_EXIST);
}
// 初始化人员拓展信息map和假勤类型map
HashMap<String, TBusinessEmployeeExtendInfo> employeeExtentMap= Common.listToHashMapByKey(employeeExtentList, "businessTelecomNumber");
HashMap<String, TBusDept> busDeptMap= Common.listToHashMapByKey(busDeptList, "name");
HashMap<String, ErrorMessage> errorMessageHashMap = Common.listToHashMapByKey(errorMessageList, "line");
int size = list.size();
Map<String,String> sysMap = new HashMap<>();
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(
CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "HROB_VACATION_TYPE");
if (Common.isNotNull(dicObj)) {
for (Map.Entry<String, String> entry : dicObj.entrySet()) {
sysMap.put(entry.getValue(),entry.getKey());
}
}
if (sysMap.isEmpty()) {
errorMessageList.add(new ErrorMessage(null, BusinessResultErrorMsg.SYS_ITEM_NOT_EXIST));
return R.failed(errorMessageList,BusinessResultErrorMsg.SYS_ITEM_NOT_EXIST);
}
TBusinessEmployeeExtendInfo businessEmployeeExtend;
ErrorMessage errorMessage;
for (int i = 0; i < size; i++) {
int line = i + 2;
TVacationInfo entity = new TVacationInfo();
ImportVacationInfoDTO dto = list.get(i);
businessEmployeeExtend = employeeExtentMap.get(dto.getBusinessTelecomNumber());
if (null == businessEmployeeExtend) {
errorMessageList.add(new ErrorMessage(line, BusinessResultErrorMsg.BUSINESS_TELECOM_NUMBER_NOT_EXIST, CommonConstants.RED));
continue;
}
TBusDept busDept = busDeptMap.get(businessEmployeeExtend.getDepartName());
errorMessage = errorMessageHashMap.get(line + "");
boolean isSave = true;
if (null != errorMessage) {
continue;
}
if (Common.isEmpty(sysMap.get(dto.getVacationType()))) {
errorMessageList.add(new ErrorMessage(line, BusinessResultErrorMsg.VACATION_TYPE_DATA_NOT_EXIST, CommonConstants.RED));
isSave = false;
}
if (StringUtils.equals(businessEmployeeExtend.getBusinessWorkingStatus(), CommonConstants.ONE_STRING)) {
errorMessageList.add(new ErrorMessage(line, BusinessResultErrorMsg.EMPLOYEE_ALREADY_LEAVE, CommonConstants.RED));
isSave = false;
}
if (null == busDept) {
busDept = new TBusDept();
}
if (dto.getVacationEndTime().isBefore(dto.getVacationStartTime())) {
errorMessageList.add(new ErrorMessage(line, BusinessResultErrorMsg.START_END_TIME_ERROR, CommonConstants.RED));
isSave = false;
}
if (!isSave) {
continue;
}
LocalDate vacationEnd = dto.getVacationEndTime();
LocalDate vacationStart = dto.getVacationStartTime();
BeanUtil.copyProperties(dto, entity, CopyOptions.create().setIgnoreNullValue(true).setIgnoreProperties("vacationEndTime", "vacationStartTime"));
entity.setCreateUser(user.getNickname());
entity.setCreateUserId(Integer.valueOf(user.getId()));
entity.setBusinessPost(businessEmployeeExtend.getBusinessPost());
entity.setEmpName(businessEmployeeExtend.getEmpName());
entity.setEmpIdcard(businessEmployeeExtend.getEmpIdcard());
entity.setVacationType(sysMap.get(dto.getVacationType()));
entity.setDepartId(busDept.getId());
entity.setCreateTime(LocalDateTime.now());
entity.setVacationEndTime(vacationEnd.atStartOfDay());
entity.setVacationStartTime(vacationStart.atStartOfDay());
// 对年休假做处理
if(StringUtils.equals(entity.getVacationType(), BusinessCommonContants.YEAR_VACATION_VALUE)) {
String year = String.valueOf(entity.getVacationStartTime().getYear());
try {
lock.lock();
TVacationMonitor monitor = this.vacationMonitorService.getMonitorByEmpIdcardAndYear(entity.getEmpIdcard(), year);
if (null == monitor) {
errorMessageList.add(new ErrorMessage(line, BusinessResultErrorMsg.VACATION_MONITOR_NOT_EXIST));
continue;
}
if (monitor.getNotUsedVacationDuration().compareTo(entity.getVacationDuration()) < 0) {
errorMessageList.add(new ErrorMessage(line, BusinessResultErrorMsg.SURPLUS_VACATION_NOT_ENOUGH));
continue;
}
// 消耗年休假
consumeVacationDuration(entity, monitor, year);
} finally {
lock.unlock();
}
}
boolean saveSuccess = this.save(entity);
if (!saveSuccess) {
runTimeExceptionDiy(BusinessResultErrorMsg.CONSUME_YEAR_VACATION_DURATION_ERROR);
} else {
errorMessageList.add(new ErrorMessage(line, BusinessResultErrorMsg.IMPORT_SUCCESS, CommonConstants.GREEN));
}
}
errorMessageList.sort(Comparator.comparingInt(ErrorMessage::getLineNum));
return R.ok(errorMessageList,CommonConstants.RESULT_DATA_SUCESS);
} else {
return R.failed(errorMessageList,CommonConstants.NO_DATA_TO_HANDLE);
}
}
/**
* 消耗年假
* @param entity 假勤实体
* @param monitor 监控信息
* @param vacationYear 假勤年份
*/
private void consumeVacationDuration(TVacationInfo entity, TVacationMonitor monitor, String vacationYear) {
BigDecimal notUsedVacationDuration = monitor.getNotUsedVacationDuration();
boolean consumeSuccess = this.vacationMonitorService.consumeVacationDuration(entity.getEmpIdcard(), entity.getVacationDuration(), vacationYear);
if (!consumeSuccess) {
runTimeExceptionDiy(BusinessResultErrorMsg.CONSUME_YEAR_VACATION_DURATION_ERROR);
}
entity.setVacationNotUsedDuration(BigDecimalUtils.safeSubtract(notUsedVacationDuration, entity.getVacationDuration()));
}
/**
* @description: 删除-单条:根据id删除记录
* @param id
* @return: R<Boolean>
* @author: wangweiguo
* @date: 2021-08-24
*/
@Transactional
@Override
public R<Boolean> removeDataById(String id) {
TVacationInfo entity = this.getById(id);
if (null == entity) {
return R.failed(BusinessResultErrorMsg.VACATION_INFO_NOT_EXIST);
}
boolean isSuccess = this.removeById(id);
if (isSuccess && StringUtils.equals(BusinessCommonContants.YEAR_VACATION_VALUE, entity.getVacationType())) {
// 释放年休假
String vacationYear = String.valueOf(entity.getVacationStartTime().getYear());
TVacationMonitor monitor = this.vacationMonitorService.getMonitorByEmpIdcardAndYear(entity.getEmpIdcard(), vacationYear);
if (null == monitor) {
return R.failed(BusinessResultErrorMsg.VACATION_MONITOR_NOT_EXIST);
}
boolean releaseSuccess = this.vacationMonitorService.releaseVacationDuration(entity.getEmpIdcard(), entity.getVacationDuration(), String.valueOf(entity.getVacationStartTime().getYear()));
if (!releaseSuccess) {
runTimeExceptionDiy(BusinessResultErrorMsg.RELEASE_VACATION_DURATION_ERROR);
}
}
return R.ok(isSuccess,CommonConstants.RESULT_DATA_SUCESS);
}
/**
* @description: 添加:新增-单条-添加一条记录
* @param dto
* @return: R<TVacationInfo>
* @author: wangweiguo
* @date: 2021-08-24
*/
@Transactional
@Override
public R<TVacationInfo> saveData(AddOrUpdateTVacationInfoDTO dto) {
YifuUser user = SecurityUtils.getUser();
if (user == null) {
return R.failed(BusinessResultErrorMsg.USER_NOT_LOGIN);
}
R<TBusinessEmployeeExtendInfo> businessEmployeeExtendInfoR = archivesDaprUtil.getExtendByBusinessTelecomNumber(dto.getBusinessTelecomNumber());
if (!R.haveData(businessEmployeeExtendInfoR)) {
return R.failed(BusinessResultErrorMsg.EMPLOYEE_EXTENT_DATA_NOT_EXIST);
}
if (R.haveData(businessEmployeeExtendInfoR) && StringUtils.equals(businessEmployeeExtendInfoR.getData().getBusinessWorkingStatus(), CommonConstants.ONE_STRING)) {
return R.failed(BusinessResultErrorMsg.EMPLOYEE_ALREADY_LEAVE);
}
TVacationInfo entity = new TVacationInfo();
BeanUtil.copyProperties(dto, entity);
entity.setCreateUser(user.getNickname());
entity.setCreateUserId(Integer.valueOf(user.getId()));
entity.setCreateTime(LocalDateTime.now());
if (StringUtils.equals(BusinessCommonContants.YEAR_VACATION_VALUE, entity.getVacationType())) {
String vacationYear = String.valueOf(dto.getVacationStartTime().getYear());
try {
lock.lock();
TVacationMonitor monitor = this.vacationMonitorService.getMonitorByEmpIdcardAndYear(dto.getEmpIdcard(), vacationYear);
if (null == monitor) {
return R.failed(BusinessResultErrorMsg.VACATION_MONITOR_NOT_EXIST);
}
// 剩余年假不足本次消耗
if (monitor.getNotUsedVacationDuration().compareTo(dto.getVacationDuration()) < 0) {
return R.failed(BusinessResultErrorMsg.SURPLUS_VACATION_NOT_ENOUGH);
}
// 消耗年休假
consumeVacationDuration(entity, monitor, vacationYear);
} finally {
lock.unlock();
}
}
boolean isSuccess = this.save(entity);
if (!isSuccess) {
runTimeExceptionDiy(BusinessResultErrorMsg.CONSUME_VACATION_DURATION_ERROR);
}
return R.ok(entity,CommonConstants.RESULT_DATA_SUCESS);
}
/**
* @author wangweiguo
* @description 更新假勤信息中的冗余信息
* @date 20:32 2021/8/24
* @param dtoList 更新冗余字段dto集合
* @return com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
**/
@Override
public R<Boolean> updateRedundancyEmployeeFields(List<UpdateVacationRedundancyDTO> dtoList) {
if (!CollUtil.isEmpty(dtoList)) {
dtoList.forEach(v ->
this.lambdaUpdate().eq(TVacationInfo::getEmpIdcard, v.getEmpIdcard())
.set(TVacationInfo::getEmpName, v.getEmpName())
.set(TVacationInfo::getBusinessTelecomNumber, v.getBusinessTelecomNumber())
.set(TVacationInfo::getBusinessPost, v.getBusinessPost())
.set(TVacationInfo::getDepartId, v.getDepartId())
.update()
);
}
return R.ok(null,CommonConstants.RESULT_DATA_SUCESS);
}
/**
* 抛个异常先
* @Author fxj
* @Date 2020-09-09
* @param errorInfo
* @return
**/
public static void runTimeExceptionDiy(String errorInfo) {
throw new CheckedException(errorInfo);
}
}
package com.yifu.cloud.plus.v1.business.service.vacation.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.business.dto.vacation.UpdateVacationRedundancyDTO;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationMonitor;
import com.yifu.cloud.plus.v1.business.mapper.vacation.TVacationMonitorMapper;
import com.yifu.cloud.plus.v1.business.query.vacation.TVacationMonitorQuery;
import com.yifu.cloud.plus.v1.business.service.vacation.TVacationMonitorService;
import com.yifu.cloud.plus.v1.business.util.BusinessResultErrorMsg;
import com.yifu.cloud.plus.v1.business.vo.vacation.TVacationMonitorVO;
import com.yifu.cloud.plus.v1.business.vo.vacation.VacationRuleConfigVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.BusinessEmployeeExtendVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.BigDecimalUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
* @description: 假期监控表 service实现层
* @author: wangweiguo
* @date: 2021-08-13
*/
@Service
@AllArgsConstructor
public class TVacationMonitorServiceImpl extends ServiceImpl<TVacationMonitorMapper, TVacationMonitor>
implements TVacationMonitorService {
// private final RemoteBasiBusinessService remoteBasiBusinessService;
//
// private final TVacationRuleConfigService vacationRuleConfigService;
/**
* @description: 分页查询: 条件分页查询
* @param query 查询条件
* @return: R<IPage<TVacationMonitorVO>>
* @author: wangweiguo
* @date: 2021-08-13
*/
@Override
public R<IPage<TVacationMonitorVO>> getListByPage(TVacationMonitorQuery query) {
Page<TVacationMonitorVO> page = new Page<>(query.getCurrent(), query.getSize());
page.setOrders(query.getOrders());
page = this.baseMapper.getListByPage(page, query);
List<TVacationMonitorVO> voList = page.getRecords();
// 设置vo展示 工龄计算
voList.forEach(v -> v.setWorkingAge(BigDecimalUtils.safeDivide(BigDecimal.valueOf(Duration.between(v.getBusinessEnjoinDate(), LocalDateTime.now()).toDays()), BigDecimal.valueOf(365L), 1)));
return R.ok(page,BusinessResultErrorMsg.SUCCESS);
}
/**
* @description: 导出:根据查询条件导出
* @param query 查询条件
* @return: R<List<TVacationMonitorVO>>
* @author: wangweiguo
* @date: 2021-08-13
*/
@Override
public R<List<TVacationMonitorVO>> exportByParams(TVacationMonitorQuery query) {
List<TVacationMonitorVO> list = this.baseMapper.getList(query);
list.forEach(v -> v.setWorkingAge(BigDecimalUtils.safeDivide(BigDecimal.valueOf(Duration.between(v.getBusinessEnjoinDate(), LocalDateTime.now()).toDays()), BigDecimal.valueOf(365L), 1)));
return R.ok(list,CommonConstants.SEARCH_SUCCESS);
}
/**
* @description: 保存或者更新监控记录
* @param entity
* @return: boolean
* @author: wangweiguo
* @date: 2021/8/16
*/
@Override
public boolean saveOrUpdateData(TVacationMonitor entity) {
beforeSaveInit(entity);
return this.saveOrUpdate(entity);
}
/**
* @description: 批量保存 OR 新增
* @param list
* @return: boolean
* @author: wangweiguo
* @date: 2021/8/16
*/
@Override
public boolean batchSaveOrUpdateData(List<TVacationMonitor> list) {
if (!CollUtil.isEmpty(list)) {
for (TVacationMonitor entity : list) {
beforeSaveInit(entity);
}
return this.saveOrUpdateBatch(list, 200);
}
return false;
}
/**
* @description: 查询-剩余年假:根据身份证号查询剩余年假
* @param idcard
* @return: com.yifu.cloud.v1.common.core.util.R<java.math.BigDecimal>
* @author: wangweiguo
* @date: 2021/8/17
*/
@Override
public R<BigDecimal> getNotUsedVacationDurationByIdCard(String idcard) {
TVacationMonitor vacationMonitor = this.lambdaQuery()
.eq(TVacationMonitor::getEmpIdcard, idcard)
.eq(TVacationMonitor::getVacationYear, String.valueOf(LocalDate.now().getYear()))
.last(CommonConstants.LAST_ONE_SQL)
.one();
if (null != vacationMonitor) {
return R.ok(BigDecimalUtils.safeAdd(vacationMonitor.getNotUsedVacationDuration()),CommonConstants.SEARCH_SUCCESS);
}
return R.ok(null,CommonConstants.SEARCH_SUCCESS);
}
/**
* @description: 定时任务:内部服务调用,每天初始化员工年假信息
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/17
*/
@Override
public R<Boolean> buildMonitorData() {
// R<VacationRuleConfigVO> vacationRuleConfigR = this.vacationRuleConfigService.getVacationRuleConfig();
// if (R.haveData(vacationRuleConfigR) && StringUtils.equals(vacationRuleConfigR.getData().getVacationAutoInit(), CommonConstants.ONE_STRING)) {
// VacationRuleConfigVO ruleConfig = vacationRuleConfigR.getData();
// R<List<BusinessEmployeeExtendVO>> listR = remoteBasiBusinessService.getNotLeaveExtendList(SecurityConstants.FROM_IN);
// if (R.isSuccess(listR) && !CollUtil.isEmpty(listR.getData())) {
// List<BusinessEmployeeExtendVO> list = listR.getData();
// List<TVacationMonitor> collect = list.stream().map(vo -> {
// TVacationMonitor monitor = null;
// if (null != vo.getBusinessEnjoinDate()) {
// String curentYear = String.valueOf(LocalDate.now().getYear());
// monitor = this.lambdaQuery()
// .eq(TVacationMonitor::getVacationYear, curentYear)
// .eq(TVacationMonitor::getEmpIdcard, vo.getEmpIdcard()).last(CommonConstants.LAST_ONE_SQL).one();
// // 计算年假时长
// Integer vacationDuration = this.vacationRuleConfigService.annualLeaveCalculationFormula(vo.getBusinessEnjoinDate());
//
// // 没有年假监控记录并且至少有一天年假,初始化年假监控 && 四舍五入至少有一天年假再发放
// if (monitor == null && vacationDuration >= 1) {
// monitor = buildVacationMonitor(vo, ruleConfig, null);
// return monitor;
// }
// }
// return null;
// }).filter(Objects::nonNull).collect(Collectors.toList());
// boolean isSuccess = this.batchSaveOrUpdateData(collect);
// if (isSuccess) {
// return R.ok(null,CommonConstants.RESULT_DATA_SUCESS);
// } else {
// return R.failed(CommonConstants.RESULT_DATA_SUCESS);
// }
// }
// }
return R.ok(null,CommonConstants.NO_DATA_TO_HANDLE);
}
/**
* @description: 冗余更新:更新监控表中冗余的员工信息,电信工号和岗位
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/23
*/
@Override
public R<Boolean> updateRedundancyEmployeeFields(List<UpdateVacationRedundancyDTO> dtoList) {
if (!CollUtil.isEmpty(dtoList)) {
dtoList.forEach(v ->
this.lambdaUpdate().eq(TVacationMonitor::getEmpIdcard, v.getEmpIdcard())
.set(StringUtils.isNotBlank(v.getBusinessTelecomNumber()), TVacationMonitor::getBusinessTelecomNumber, v.getBusinessTelecomNumber())
.set(StringUtils.isNotBlank(v.getBusinessPost()), TVacationMonitor::getBusinessPost, v.getBusinessPost())
.set(null != v.getDepartId(), TVacationMonitor::getDepartId, v.getDepartId())
.update()
);
}
return R.ok(null,CommonConstants.RESULT_DATA_SUCESS);
}
/**
* @description: 释放假期时长
* @param empIdcard 身份证号
* @param vacationDuration 假期时长
* @param year 年份
* @return: boolean
* @author: wangweiguo
* @date: 2021/8/24
*/
@Override
public boolean releaseVacationDuration(String empIdcard, BigDecimal vacationDuration, String year) {
TVacationMonitor monitor = this.getMonitorByEmpIdcardAndYear(empIdcard, year);
monitor.setNotUsedVacationDuration(BigDecimalUtils.safeAdd(monitor.getNotUsedVacationDuration(), vacationDuration));
return this.saveOrUpdateData(monitor);
}
/**
* @description: 消耗假期时长
* @param empIdcard 身份证号
* @param vacationDuration 假期时长
* @param year 年份
* @return: boolean
* @author: wangweiguo
* @date: 2021/8/24
*/
@Override
public boolean consumeVacationDuration(String empIdcard, BigDecimal vacationDuration, String year) {
TVacationMonitor monitor = this.getMonitorByEmpIdcardAndYear(empIdcard, year);
monitor.setNotUsedVacationDuration(BigDecimalUtils.safeSubtract(monitor.getNotUsedVacationDuration(), vacationDuration));
return this.saveOrUpdateData(monitor);
}
/**
* @description: 根据假勤年份和身份证号查询年假监控信息
* @param empIdcard 身份证号
* @param year 假勤年份
* @return: com.yifu.cloud.v1.hrobusiness.api.entity.vacation.TVacationMonitor
* @author: wangweiguo
* @date: 2021/8/24
*/
@Override
public TVacationMonitor getMonitorByEmpIdcardAndYear(String empIdcard, String year) {
return this.lambdaQuery().eq(TVacationMonitor::getEmpIdcard, empIdcard)
.eq(TVacationMonitor::getVacationYear, year)
.last(CommonConstants.LAST_ONE_SQL)
.one();
}
/**
* @description: 保存前,属性赋值
* @param entity
* @return: void
* @author: wangweiguo
* @date: 2021/8/16
*/
private void beforeSaveInit(TVacationMonitor entity) {
if (null != entity) {
// 根据notUsedVacationDuration字段更新vacationStatus
if (entity.getNotUsedVacationDuration().compareTo(BigDecimal.ZERO) > 0) {
entity.setVacationStatus(CommonConstants.ZERO_STRING);
}
if (entity.getNotUsedVacationDuration().compareTo(BigDecimal.ZERO) == 0) {
entity.setVacationStatus(CommonConstants.ONE_STRING);
}
if (null == entity.getNotUsedVacationDuration()) {
entity.setVacationStatus(null);
}
}
}
/**
* @author wangweiguo
* @description 构建vacationmonitor对象
* @date 21:48 2021/8/17
* @param vo
* @param ruleConfig
* @return com.yifu.cloud.v1.hrobusiness.api.entity.vacation.TVacationMonitor
**/
private TVacationMonitor buildVacationMonitor(BusinessEmployeeExtendVO vo, VacationRuleConfigVO ruleConfig, TVacationMonitor monitor) {
// if (null == monitor) {
// monitor = new TVacationMonitor();
// }
// Integer vacationDuration = this.vacationRuleConfigService.annualLeaveCalculationFormula(vo.getBusinessEnjoinDate());
// monitor.setVacationYear(String.valueOf(LocalDate.now().getYear()));
// monitor.setNotUsedVacationDuration(BigDecimalUtils.safeMultiply(BigDecimal.valueOf(vacationDuration), ruleConfig.getTimeValue()));
// monitor.setVacationDuration(BigDecimalUtils.safeMultiply(BigDecimal.valueOf(vacationDuration), ruleConfig.getTimeValue()));
// monitor.setDepartId(vo.getDepartId());
// monitor.setBusinessEnjoinDate(vo.getBusinessEnjoinDate());
// monitor.setBusinessPost(vo.getBusinessPost());
// monitor.setBusinessTelecomNumber(vo.getBusinessTelecomNumber());
// monitor.setEmpIdcard(vo.getEmpIdcard());
// monitor.setEmpName(vo.getEmpName());
// monitor.setVacationStatus(CommonConstants.ZERO_STRING);
// return monitor;
return null;
}
}
......@@ -37,7 +37,7 @@ public class BusinessResultErrorMsg {
public static final String DEPART_DATA_NOT_EXIST = "部门数据不存在";
public static final String VACATION_TYPE_NOT_EXIST = "假勤类型不存在";
public static final String SYS_ITEM_NOT_EXIST = "获取假勤类型字典值失败";
public static final String BUSINESS_TELECOM_NUMBER_NOT_EXIST = "电信工号不存在";
......
<?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.yifu.cloud.plus.v1.business.mapper.vacation.TVacationInfoMapper">
<resultMap id="TVacationInfoVO" type="com.yifu.cloud.plus.v1.business.vo.vacation.TVacationInfoVO">
<id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="businessTelecomNumber" column="BUSINESS_TELECOM_NUMBER" jdbcType="VARCHAR"/>
<result property="empName" column="EMP_NAME" jdbcType="VARCHAR"/>
<result property="empIdcard" column="EMP_IDCARD" jdbcType="VARCHAR"/>
<result property="departId" column="DEPART_ID" jdbcType="INTEGER"/>
<result property="departName" column="DEPART_NAME" jdbcType="VARCHAR"/>
<result property="vacationStatus" column="VACATION_STATUS" jdbcType="CHAR"/>
<result property="businessPost" column="BUSINESS_POST" jdbcType="VARCHAR"/>
<result property="vacationType" column="VACATION_TYPE" jdbcType="VARCHAR"/>
<result property="vacationReason" column="VACATION_REASON" jdbcType="VARCHAR"/>
<result property="vacationNote" column="VACATION_NOTE" jdbcType="VARCHAR"/>
<result property="vacationStartTime" column="VACATION_START_TIME" jdbcType="TIMESTAMP"/>
<result property="vacationEndTime" column="VACATION_END_TIME" jdbcType="TIMESTAMP"/>
<result property="vacationDuration" column="VACATION_DURATION" jdbcType="DECIMAL"/>
<result property="vacationNotUsedDuration" column="VACATION_NOT_USED_DURATION" jdbcType="DECIMAL"/>
<result property="acturalVacationEndTime" column="ACTURAL_VACATION_END_TIME" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="GetListColumnList">
a.ID,
a.BUSINESS_TELECOM_NUMBER,
(case
when a.VACATION_STATUS <![CDATA[<>]]> '4' then '3'
when now() <![CDATA[<]]> a.VACATION_START_TIME then '0'
when now() <![CDATA[>=]]> a.VACATION_START_TIME and now() <![CDATA[<=]]> a.VACATION_END_TIME then '1'
when now() <![CDATA[>]]> a.VACATION_END_TIME then '2'
else ''
end
) as VACATION_STATUS,
a.EMP_NAME,
a.EMP_IDCARD,
a.DEPART_ID,
a.BUSINESS_POST,
a.VACATION_TYPE,
a.VACATION_START_TIME,
a.VACATION_END_TIME,
a.VACATION_DURATION,
a.VACATION_REASON,
a.VACATION_NOTE,
a.VACATION_NOT_USED_DURATION,
a.ACTURAL_VACATION_END_TIME,
b.NAME as DEPART_NAME
</sql>
<sql id="GetListWhere">
1=1
<if test="query.businessTelecomNumber != null and query.businessTelecomNumber.trim() != ''">
and a.BUSINESS_TELECOM_NUMBER like concat('%',#{query.businessTelecomNumber} ,'%')
</if>
<if test="query.empName != null and query.empName.trim() != ''">
and a.EMP_NAME like concat('%',#{query.empName} ,'%')
</if>
<if test="query.empIdcard != null and query.empIdcard.trim() != ''">
and a.EMP_IDCARD like concat('%',#{query.empIdcard} ,'%')
</if>
<if test="query.businessPost != null and query.businessPost.trim() != ''">
and a.BUSINESS_POST = #{query.businessPost}
</if>
<if test="query.departId != null and query.departId != 1">
AND (b.id = #{query.departId} or b.tree_logo like concat('%-', #{query.departId},'-%'))
</if>
<if test="query.vacationType != null and query.vacationType.trim() != ''">
and a.VACATION_TYPE = #{query.vacationType}
</if>
<if test="query.vacationStartTime != null and query.vacationEndTime != null">
and
(a.VACATION_START_TIME between #{query.vacationStartTime} and #{query.vacationEndTime}
or
a.VACATION_END_TIME between #{query.vacationStartTime} and #{query.vacationEndTime}
)
</if>
<if test="query.vacationStatus != null and query.vacationStatus.trim() != ''">
<!-- 待休 -->
<if test="query.vacationStatus == '0'.toString()">
and now() <![CDATA[<]]> a.VACATION_START_TIME
</if>
<!-- 休假中 -->
<if test="query.vacationStatus == '1'.toString()">
and now() <![CDATA[>=]]> a.VACATION_START_TIME and now() <![CDATA[<=]]> a.VACATION_END_TIME
</if>
<!-- 到期待销假 -->
<if test="query.vacationStatus == '2'.toString()">
and now() <![CDATA[>]]> a.VACATION_END_TIME and a.VACATION_STATUS = '4'
</if>
<!-- 已销假 -->
<if test="query.vacationStatus == '3'.toString()">
and a.VACATION_STATUS <![CDATA[<>]]> '4'
</if>
</if>
</sql>
<select id="getListByPage" resultMap="TVacationInfoVO">
select
<include refid="GetListColumnList"/>
from hr_business.t_vacation_info a
left join hr_business.t_bus_dept b
on a.DEPART_ID = b.id
<where>
<include refid="GetListWhere"/>
</where>
order by a.CREATE_TIME desc
</select>
<select id="getDataById" resultMap="TVacationInfoVO">
select
<include refid="GetListColumnList"/>
from hr_business.t_vacation_info a
left join hr_business.t_bus_dept b
on a.DEPART_ID = b.id
where a.id = #{id}
</select>
</mapper>
<?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.yifu.cloud.plus.v1.business.mapper.vacation.TVacationMonitorMapper">
<resultMap id="Result_TVacationMonitorVO" type="com.yifu.cloud.plus.v1.business.vo.vacation.TVacationMonitorVO">
<result property="vacationYear" column="VACATION_YEAR" jdbcType="VARCHAR"/>
<result property="businessTelecomNumber" column="BUSINESS_TELECOM_NUMBER" jdbcType="VARCHAR"/>
<result property="empIdcard" column="EMP_IDCARD" jdbcType="VARCHAR"/>
<result property="empName" column="EMP_NAME" jdbcType="VARCHAR"/>
<result property="businessPost" column="BUSINESS_POST" jdbcType="VARCHAR"/>
<result property="vacationDuration" column="VACATION_DURATION" jdbcType="DECIMAL"/>
<result property="notUsedVacationDuration" column="NOT_USED_VACATION_DURATION" jdbcType="DECIMAL"/>
<result property="businessEnjoinDate" column="BUSINESS_ENJOIN_DATE" jdbcType="TIMESTAMP"/>
<result property="departCode" column="DEPART_CODE" jdbcType="VARCHAR"/>
<result property="departName" column="DEPART_NAME" jdbcType="VARCHAR"/>
<result property="departId" column="DEPART_ID" jdbcType="INTEGER"/>
</resultMap>
<sql id="Column_TVacationMonitorVO">
a.ID,
a.VACATION_YEAR,
a.BUSINESS_TELECOM_NUMBER,
a.EMP_IDCARD,
a.EMP_NAME,
b.name as DEPART_NAME,
b.id as DEPART_ID,
b.tree_logo as DEPART_CODE,
a.BUSINESS_POST,
a.VACATION_DURATION,
a.NOT_USED_VACATION_DURATION,
a.BUSINESS_ENJOIN_DATE,
a.VACATION_STATUS
</sql>
<sql id="Where_TVacationMonitorQuery">
1=1
<if test="query.businessTelecomNumber != null and query.businessTelecomNumber.trim() != ''">
and a.BUSINESS_TELECOM_NUMBER like concat('%', #{query.businessTelecomNumber}, '%')
</if>
<if test="query.empName != null and query.empName.trim() != ''">
and a.EMP_NAME like concat('%',#{query.empName}, '%')
</if>
<if test="query.empIdcard != null and query.empIdcard.trim() != ''">
and a.EMP_IDCARD like concat('%',#{query.empIdcard} , '%')
</if>
<if test="query.businessPost != null and query.businessPost.trim() != ''">
and a.BUSINESS_POST = #{query.businessPost}
</if>
<if test="query.departId != null and query.departId != 1">
AND (b.id = #{query.departId} or b.tree_logo like concat('%-', #{query.departId},'-%'))
</if>
<if test="query.vacationStatus != null and query.vacationStatus.trim() != ''">
and a.VACATION_STATUS = #{query.vacationStatus}
</if>
<if test="query.vacationYear != null and query.vacationYear.trim() != ''">
and a.VACATION_YEAR = #{query.vacationYear}
</if>
</sql>
<select id="getListByPage" resultMap="Result_TVacationMonitorVO">
select
<include refid="Column_TVacationMonitorVO"/>
from hr_business.t_vacation_monitor a
left join hr_business.t_bus_dept b on a.DEPART_ID = b.id
<where>
<include refid="Where_TVacationMonitorQuery"/>
</where>
order by a.VACATION_YEAR desc
</select>
<select id="getList" resultMap="Result_TVacationMonitorVO">
select
<include refid="Column_TVacationMonitorVO"/>
from hr_business.t_vacation_monitor a
left join hr_business.t_bus_dept b on a.DEPART_ID = b.id
<where>
<include refid="Where_TVacationMonitorQuery"/>
</where>
order by a.VACATION_YEAR desc
</select>
</mapper>
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import cn.hutool.core.collection.CollUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.*;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.RoundingMode;
......@@ -248,7 +253,28 @@ public class Common {
return null;
}
}
public static <T> HashMap<String, T> listToHashMapByKey(List<T> list, String filedKey) {
HashMap<String, T> hashMap = new HashMap<String,T>();
Object key = null;
String[] split = null;
if (null != list) {
if (filedKey.indexOf(CommonConstants.DOWN_LINE_CHAR) > CommonConstants.dingleDigitIntArray[0]) {
split = filedKey.split(CommonConstants.DOWN_LINE_STRING);
for (T t : list) {
key= null;
key = getFieldsValue(t, split, key);
hashMap.put(getStringValByObject(key), t);
}
} else {
for (T t : list) {
key= null;
key = getFieldValueByName(filedKey, t);
hashMap.put(getStringValByObject(key), t);
}
}
}
return hashMap;
}
public static <T> HashMap<String, T> listToHashMapByKey(List<T> list, String keyPreStr, String filedKey) {
HashMap<String, T> hashMap = new HashMap<String,T>();
Object key = null;
......@@ -509,4 +535,121 @@ public class Common {
}
return false;
}
/**
* @description: 通过spring校验注解list中的数据格式, 后续补充剩余注解
* @param list 需要校验的list
* @return: java.util.List<com.yifu.cloud.v1.common.core.util.bean.ErrorMessage>
* @author: wangweiguo
* @date: 2021/8/24
*/
public static List<ErrorMessage> commonImportErrorMessage(List<?> list) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
if (!CollUtil.isEmpty(list)) {
int size = list.size();
for (int i = 0; i < size; i++) {
Object o = list.get(i);
Field[] fields = o.getClass().getDeclaredFields();
for (Field field : fields) {
Annotation[] declaredAnnotations = field.getDeclaredAnnotations();
if (declaredAnnotations.length == 0) {
continue;
}
try {
for (Annotation declaredAnnotation : declaredAnnotations) {
field.setAccessible(true);
Object val = field.get(o);
if (declaredAnnotation instanceof NotBlank) {
// @NotBlank
String s = (String) val;
if (StringUtils.isBlank(s)) {
errorMessageList.add(new ErrorMessage(i + 2, ((NotBlank) declaredAnnotation).message(), CommonConstants.RED));
break;
}
} else if (declaredAnnotation instanceof Length) {
// @Length
if (val instanceof String) {
String s = (String) val;
if (s.length() > ((Length) declaredAnnotation).max()) {
errorMessageList.add(new ErrorMessage(i + 2, ((Length) declaredAnnotation).message(), CommonConstants.RED));
break;
}
if (s.length() < ((Length) declaredAnnotation).min()) {
errorMessageList.add(new ErrorMessage(i + 2, ((Length) declaredAnnotation).message(), CommonConstants.RED));
break;
}
}
} else if (declaredAnnotation instanceof NotNull) {
// @NotNull
if (null == val) {
errorMessageList.add(new ErrorMessage(i + 2, ((NotNull) declaredAnnotation).message(), CommonConstants.RED));
break;
}
} else if(declaredAnnotation instanceof Size) {
// @Size
int curSize = 0;
if (val instanceof String) {
curSize = ((String) val).length();
}
if (val instanceof Collection) {
curSize = ((Collection<?>) val).size();
}
if (val instanceof Map) {
curSize = ((Map<?, ?>) val).size();
}
int min = ((Size) declaredAnnotation).min();
int max = ((Size) declaredAnnotation).max();
if (curSize > max) {
errorMessageList.add(new ErrorMessage(i + 2, ((Size) declaredAnnotation).message(), CommonConstants.RED));
break;
}
if (curSize < min) {
errorMessageList.add(new ErrorMessage(i + 2, ((Size) declaredAnnotation).message(), CommonConstants.RED));
break;
}
} else if (declaredAnnotation instanceof javax.validation.constraints.Pattern) {
// @Pattern
if (val instanceof String) {
if (!((String) val).matches(((javax.validation.constraints.Pattern) declaredAnnotation).regexp())) {
errorMessageList.add(new ErrorMessage(i + 2, ((javax.validation.constraints.Pattern) declaredAnnotation).message(), CommonConstants.RED));
break;
}
}
} else if (declaredAnnotation instanceof Digits) {
int maxIntegerLength = ((Digits) declaredAnnotation).integer();
int maxFractionLength = ((Digits) declaredAnnotation).fraction();
if (val instanceof BigDecimal) {
int integerPartLength = ((BigDecimal) val).precision() - ((BigDecimal) val).scale();
int fractionPartLength = Math.max(((BigDecimal) val).scale(), 0);
if (!( maxIntegerLength >= integerPartLength && maxFractionLength >= fractionPartLength )) {
errorMessageList.add(new ErrorMessage(i + 2, ((Digits) declaredAnnotation).message(), CommonConstants.RED));
break;
}
}
} else if (declaredAnnotation instanceof DecimalMin) {
BigDecimal minValue = BigDecimal.valueOf(Double.parseDouble(((DecimalMin) declaredAnnotation).value()));
if (val instanceof BigDecimal) {
if (minValue.compareTo((BigDecimal) val) >= 0) {
errorMessageList.add(new ErrorMessage(i + 2, ((DecimalMin) declaredAnnotation).message(), CommonConstants.RED));
break;
}
}
} else if (declaredAnnotation instanceof DecimalMax) {
BigDecimal maxValue = BigDecimal.valueOf(Double.parseDouble(((DecimalMax) declaredAnnotation).value()));
if (val instanceof BigDecimal) {
if (maxValue.compareTo((BigDecimal) val) <= 0) {
errorMessageList.add(new ErrorMessage(i + 2, ((DecimalMax) declaredAnnotation).message(), CommonConstants.RED));
break;
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
return errorMessageList;
}
}
......@@ -102,5 +102,26 @@ public class R<T> implements Serializable {
apiResult.setMsg(msg);
return apiResult;
}
/**
* 返回成功状态
* @Author pwang
* @Date 2021-04-22 19:45
* @param
* @return
*@see
**/
public static boolean isSuccess(R r){
return r!=null && CommonConstants.SUCCESS == r.getCode();
}
/**
* 判断date是否有数据
* @Author pwang
* @Date 2021-04-22 19:45
* @param
* @return
*@see
**/
public static boolean haveData(R r){
return isSuccess(r) && null != r.getData();
}
}
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TBusinessEmployeeExtendInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
......@@ -300,7 +301,7 @@ public class ArchivesDaprUtil {
}
/**
* @Author fxj
* @Author huyc
* @Description 校验手机号码重复
* @Date 22:11 2022/8/4
* @Param
......@@ -314,6 +315,36 @@ public class ArchivesDaprUtil {
return res;
}
/**
* @Author huyc
* @Description 获取所有员工拓展表信息
* @Date 22:11 2022/8/4
* @Param
* @return
**/
public R<TSettleDomainListVo> getAllExtendList() {
R<TSettleDomainListVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/customerBusiness/temployeeBusiness/inner/getAllExtendList" , "", TSettleDomainListVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("获取所有员工拓展表信息失败!");
}
return res;
}
/**
* @Author huyc
* @Description 获取所有员工拓展表信息
* @Date 22:11 2022/8/4
* @Param
* @return
**/
public R<TBusinessEmployeeExtendInfo> getExtendByBusinessTelecomNumber(String businessTelecomNumber) {
R<TBusinessEmployeeExtendInfo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/customerBusiness/temployeeBusiness/inner/getExtendByBusinessTelecomNumber" , businessTelecomNumber, TBusinessEmployeeExtendInfo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("根据电工编号查询扩展表信息失败!");
}
return res;
}
/**
* @Author fxj
* @Description 更新项目档案和人员档案的社保公积金状态
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment