Commit 8bcdbbb8 authored by huyuchen's avatar huyuchen

假勤管理修改

parent 3986e920
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TBusinessEmployeeExtendInfo;
import lombok.Data;
import java.util.List;
@Data
public class TBusinessDataListVo {
private List<TBusinessEmployeeExtendInfo> extendInfo;
private List<BusinessEmployeeExtendVO> extendVO;
}
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;
......@@ -19,8 +18,6 @@ public class TSettleDomainListVo {
private Map<String,TSettleDomain> mapVO;
private List<TBusinessEmployeeExtendInfo> extendInfo;
/**
* 合同主体IDS
*/
......
......@@ -4,11 +4,12 @@ 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.TBusinessDataListVo;
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.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......@@ -192,20 +193,20 @@ public class EmployeeBusinessController {
// }
// return this.businessEmployeeExtendInfoService.getListByIdcartList(idcardList);
// }
//
// /**
// * 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
// * @description: 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
// * @return: com.yifu.cloud.v1.common.core.util.R<java.util.List<com.yifu.cloud.v1.hrms.api.vo.basic.BusinessEmployeeExtendVO>>
// * @author: wangweiguo
// * @date: 2021/8/17
// */
// @Inner
// @GetMapping("/inner/getNotLeaveExtendList")
// public R<List<BusinessEmployeeExtendVO>> getNotLeaveExtendList() {
// return this.businessEmployeeExtendInfoService.getNotLeaveExtendList();
// }
//
/**
* 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
* @description: 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List<com.yifu.cloud.v1.hrms.api.vo.basic.BusinessEmployeeExtendVO>>
* @author: wangweiguo
* @date: 2021/8/17
*/
@Inner
@PostMapping("/inner/getNotLeaveExtendList")
public TBusinessDataListVo getNotLeaveExtendList() {
return this.businessEmployeeExtendInfoService.getNotLeaveExtendList();
}
/**
* 查询-列表:内部服务调用,获取所有员工拓展表信息
* @description: 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
......@@ -215,8 +216,8 @@ public class EmployeeBusinessController {
*/
@Inner
@PostMapping("/inner/getAllExtendList")
public TSettleDomainListVo getAllExtendList() {
TSettleDomainListVo vo = new TSettleDomainListVo();
public TBusinessDataListVo getAllExtendList() {
TBusinessDataListVo vo = new TBusinessDataListVo();
List<TBusinessEmployeeExtendInfo> list = this.businessEmployeeExtendInfoService.list();
vo.setExtendInfo(list);
return vo;
......@@ -230,12 +231,11 @@ public class EmployeeBusinessController {
*/
@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);
public TBusinessEmployeeExtendInfo getExtendByBusinessTelecomNumber(@RequestBody String businessTelecomNumber) {
return this.businessEmployeeExtendInfoService.lambdaQuery()
.eq(TBusinessEmployeeExtendInfo::getBusinessTelecomNumber, businessTelecomNumber)
.last(CommonConstants.LAST_ONE_SQL)
.one();
}
// /**
......@@ -386,17 +386,17 @@ public class EmployeeBusinessController {
// return new R<>(tEmployeeContractInfoService.getOtherContractBusinessInfo(empId,contractId));
// }
//
// /**
// * @param businessTelecomNumber
// * @Description: 根据电信编号,获取附属信息
// * @Author: hgw
// * @Date: 2021/8/18 17:06
// * @return: com.yifu.cloud.v1.common.core.util.R<com.yifu.cloud.v1.hrms.api.entity.basic.TBusinessEmployeeExtendInfo>
// **/
// @ApiOperation(value = "根据电信编号,获取附属信息")
// @GetMapping("/getByBusinessTelecomNumber")
// public R<TBusinessEmployeeExtendInfo> getByBusinessTelecomNumber(@RequestParam String businessTelecomNumber) {
// return new R<>(businessEmployeeExtendInfoService.getByBusinessTelecomNumber(businessTelecomNumber));
// }
/**
* @param businessTelecomNumber
* @Description: 根据电信编号,获取附属信息
* @Author: hgw
* @Date: 2021/8/18 17:06
* @return: com.yifu.cloud.v1.common.core.util.R<com.yifu.cloud.v1.hrms.api.entity.basic.TBusinessEmployeeExtendInfo>
**/
@Operation(description = "根据电信编号,获取附属信息")
@PostMapping("/getByBusinessTelecomNumber")
public R<TBusinessEmployeeExtendInfo> getByBusinessTelecomNumber(@RequestParam String businessTelecomNumber) {
return new R<>(businessEmployeeExtendInfoService.getByBusinessTelecomNumber(businessTelecomNumber));
}
}
......@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TBusinessEmployeeExtendInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TBusinessDataListVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.UpdateEmployeeExtendRedundancyDTO;
/**
......@@ -21,14 +22,14 @@ public interface TBusinessEmployeeExtendInfoService extends IService<TBusinessEm
// */
// TBusinessEmployeeExtendInfo getByEmpIdCard(String empIdcard);
//
// /**
// * @param businessTelecomNumber
// * @Description: 根据工号返回附属信息
// * @Author: hgw
// * @Date: 2021/8/18 17:03
// * @return: com.yifu.cloud.v1.hrms.api.entity.basic.TBusinessEmployeeExtendInfo
// **/
// TBusinessEmployeeExtendInfo getByBusinessTelecomNumber(String businessTelecomNumber);
/**
* @param businessTelecomNumber
* @Description: 根据工号返回附属信息
* @Author: hgw
* @Date: 2021/8/18 17:03
* @return: com.yifu.cloud.v1.hrms.api.entity.basic.TBusinessEmployeeExtendInfo
**/
TBusinessEmployeeExtendInfo getByBusinessTelecomNumber(String businessTelecomNumber);
//
// /**
// * 根据jsonStr批量更新人员信息拓展表信息
......@@ -61,14 +62,14 @@ public interface TBusinessEmployeeExtendInfoService extends IService<TBusinessEm
// */
// R<List<TBusinessEmployeeExtendInfo>> getListByIdcartList(List<String> idcardList);
//
// /**
// * 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
// * @description: 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
// * @return: com.yifu.cloud.v1.common.core.util.R<java.util.List<com.yifu.cloud.v1.hrms.api.vo.basic.BusinessEmployeeExtendVO>>
// * @author: wangweiguo
// * @date: 2021/8/17
// */
// R<List<BusinessEmployeeExtendVO>> getNotLeaveExtendList();
/**
* 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
* @description: 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List<com.yifu.cloud.v1.hrms.api.vo.basic.BusinessEmployeeExtendVO>>
* @author: wangweiguo
* @date: 2021/8/17
*/
TBusinessDataListVo getNotLeaveExtendList();
//
// /**
// * @param
......
......@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TBusinessEmployeeExtendInfo;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TBusinessEmployeeExtendInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TBusinessEmployeeExtendInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.BusinessEmployeeExtendVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TBusinessDataListVo;
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.Common;
......@@ -41,20 +43,20 @@ implements TBusinessEmployeeExtendInfoService {
// return null;
// }
//
// /**
// * @param businessTelecomNumber
// * @Description: 根据电信工号获取详情
// * @Author: hgw
// * @Date: 2021/8/18 17:04
// * @return: com.yifu.cloud.v1.hrms.api.entity.basic.TBusinessEmployeeExtendInfo
// **/
// @Override
// public TBusinessEmployeeExtendInfo getByBusinessTelecomNumber(String businessTelecomNumber) {
// if (StringUtils.isNotBlank(businessTelecomNumber)) {
// return this.lambdaQuery().eq(TBusinessEmployeeExtendInfo::getBusinessTelecomNumber, businessTelecomNumber).last(CommonConstants.SQL_LIMIT_ONE).one();
// }
// return null;
// }
/**
* @param businessTelecomNumber
* @Description: 根据电信工号获取详情
* @Author: hgw
* @Date: 2021/8/18 17:04
* @return: com.yifu.cloud.v1.hrms.api.entity.basic.TBusinessEmployeeExtendInfo
**/
@Override
public TBusinessEmployeeExtendInfo getByBusinessTelecomNumber(String businessTelecomNumber) {
if (StringUtils.isNotBlank(businessTelecomNumber)) {
return this.lambdaQuery().eq(TBusinessEmployeeExtendInfo::getBusinessTelecomNumber, businessTelecomNumber).last(CommonConstants.LAST_ONE_SQL).one();
}
return null;
}
//
// /**
// * 根据jsonStr批量更新人员信息拓展表信息
......@@ -280,18 +282,20 @@ implements TBusinessEmployeeExtendInfoService {
// return R.success(CommonConstants.SEARCH_SUCCESS, list);
// }
//
// /**
// * 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
// * @description: 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
// * @return: com.yifu.cloud.v1.common.core.util.R<java.util.List<com.yifu.cloud.v1.hrms.api.vo.basic.BusinessEmployeeExtendVO>>
// * @author: wangweiguo
// * @date: 2021/8/17
// */
// @Override
// public R<List<BusinessEmployeeExtendVO>> getNotLeaveExtendList() {
// List<BusinessEmployeeExtendVO> list = this.baseMapper.getNotLeaveExtendList();
// return R.success(CommonConstants.SEARCH_SUCCESS, list);
// }
/**
* 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
* @description: 查询-列表:内部服务调用,获取所有非离职员工拓展表信息
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List<com.yifu.cloud.v1.hrms.api.vo.basic.BusinessEmployeeExtendVO>>
* @author: wangweiguo
* @date: 2021/8/17
*/
@Override
public TBusinessDataListVo getNotLeaveExtendList() {
List<BusinessEmployeeExtendVO> list = this.baseMapper.getNotLeaveExtendList();
TBusinessDataListVo vo = new TBusinessDataListVo();
vo.setExtendVO(list);
return vo;
}
//
// /**
// * @param
......
package com.yifu.cloud.plus.v1.business.entity.vacation;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -19,7 +20,7 @@ public class TVacationInfo implements Serializable {
/**
* 主键
*/
@TableId
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
......
package com.yifu.cloud.plus.v1.business.controller.vacation;
import com.yifu.cloud.plus.v1.business.dto.vacation.AddOrSaveVacationRuleDTO;
import com.yifu.cloud.plus.v1.business.service.vacation.TVacationRuleConfigService;
import com.yifu.cloud.plus.v1.business.util.BusinessResultErrorMsg;
import com.yifu.cloud.plus.v1.business.vo.vacation.VacationRuleConfigVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* @description: 假期配置controller
* @author: wangweiguo
* @date: 2021/8/13
*/
@AllArgsConstructor
@RequestMapping("/vacationRule")
@RestController
@Tag(name = "假期配置表")
public class TVacationRuleConfigController {
private final TVacationRuleConfigService tVacationRuleConfigService;
/**
* @description: 获取年假配置规则
* @return: com.yifu.cloud.v1.common.core.util.R<com.yifu.cloud.v1.hrobusiness.api.vo.vacation.VacationRuleConfigVO>
* @author: wangweiguo
* @date: 2021/8/13
*/
@Operation(summary = "获取年假配置规则", description = "获取年假配置规则")
@GetMapping("/getVacationRuleConfig")
public R<VacationRuleConfigVO> getVacationRuleConfig() {
YifuUser user = SecurityUtils.getUser();
if (null == user) {
R.failed(BusinessResultErrorMsg.USER_NOT_LOGIN);
}
return this.tVacationRuleConfigService.getVacationRuleConfig();
}
/**
* @description:
* @param dto
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/13
*/
@Operation(summary = "新增或保存假期配置规则", description = "新增或保存假期配置规则")
@PostMapping("/addOrSave")
public R<Boolean> addOrSave(@Valid @RequestBody AddOrSaveVacationRuleDTO dto) {
YifuUser user = SecurityUtils.getUser();
if (null == user) {
R.failed(BusinessResultErrorMsg.USER_NOT_LOGIN);
}
return this.tVacationRuleConfigService.addOrSave(user, dto);
}
}
package com.yifu.cloud.plus.v1.business.mapper.vacation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationRuleConfig;
import org.apache.ibatis.annotations.Mapper;
/**
* @description: 假期配置表mapper
* @Entity generator.domain.TVacationRuleConfig
* @author: wangweiguo
* @date: 2021/8/13
*/
@Mapper
public interface TVacationRuleConfigMapper extends BaseMapper<TVacationRuleConfig> {
}
package com.yifu.cloud.plus.v1.business.service.vacation;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.business.dto.vacation.AddOrSaveVacationRuleDTO;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationRuleConfig;
import com.yifu.cloud.plus.v1.business.vo.vacation.VacationRuleConfigVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import java.time.LocalDateTime;
/**
* @description: 假期配置 service
* @author: wangweiguo
* @date: 2021/8/13
*/
public interface TVacationRuleConfigService extends IService<TVacationRuleConfig> {
/**
* @description: 获取年假配置规则
* @return: com.yifu.cloud.v1.common.core.util.R<com.yifu.cloud.v1.hrobusiness.api.vo.vacation.VacationRuleConfigVO>
* @author: wangweiguo
* @date: 2021/8/13
*/
R<VacationRuleConfigVO> getVacationRuleConfig();
/**
* @description:
* @param user
* @param dto
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/13
*/
R<Boolean> addOrSave(YifuUser user, AddOrSaveVacationRuleDTO dto);
/**
* @description: 根据入职时间返回年假天数
* @param enjoinDate 入职时间
* @return: java.lang.Integer 年假天数
* @author: wangweiguo
* @date: 2021/8/13
*/
Integer annualLeaveCalculationFormula(LocalDateTime enjoinDate);
}
......@@ -26,7 +26,7 @@ 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.archives.vo.TBusinessDataListVo;
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;
......@@ -170,7 +170,7 @@ implements TVacationInfoService {
errorMessageList.addAll(Common.commonImportErrorMessage(list));
List<TBusinessEmployeeExtendInfo> employeeExtentList = new ArrayList<>();
List<TBusDept> busDeptList = busDeptService.list();
R<TSettleDomainListVo> sdRes = archivesDaprUtil.getAllExtendList();
R<TBusinessDataListVo> sdRes = archivesDaprUtil.getAllExtendList();
if (Common.isNotNull(sdRes) && Common.isNotNull(sdRes.getData())){
employeeExtentList = sdRes.getData().getExtendInfo();
}
......
......@@ -9,15 +9,19 @@ 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.service.vacation.TVacationRuleConfigService;
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.archives.vo.TBusinessDataListVo;
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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import io.micrometer.core.instrument.util.StringUtils;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
......@@ -25,6 +29,8 @@ import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @description: 假期监控表 service实现层
......@@ -36,9 +42,9 @@ import java.util.List;
public class TVacationMonitorServiceImpl extends ServiceImpl<TVacationMonitorMapper, TVacationMonitor>
implements TVacationMonitorService {
// private final RemoteBasiBusinessService remoteBasiBusinessService;
//
// private final TVacationRuleConfigService vacationRuleConfigService;
private final TVacationRuleConfigService vacationRuleConfigService;
private ArchivesDaprUtil archivesDaprUtil;
/**
* @description: 分页查询: 条件分页查询
......@@ -55,7 +61,7 @@ implements TVacationMonitorService {
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);
return R.ok(page, BusinessResultErrorMsg.SUCCESS);
}
/**
......@@ -69,7 +75,7 @@ implements TVacationMonitorService {
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);
return R.ok(list, CommonConstants.SEARCH_SUCCESS);
}
/**
......@@ -131,38 +137,38 @@ implements TVacationMonitorService {
*/
@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);
// }
// }
// }
R<VacationRuleConfigVO> vacationRuleConfigR = this.vacationRuleConfigService.getVacationRuleConfig();
if (R.haveData(vacationRuleConfigR) && CommonConstants.ONE_STRING.equals(vacationRuleConfigR.getData().getVacationAutoInit())) {
VacationRuleConfigVO ruleConfig = vacationRuleConfigR.getData();
R<TBusinessDataListVo> listR = archivesDaprUtil.getNotLeaveExtendList();
if (R.isSuccess(listR) && Common.isNotNull(listR.getData()) && Common.isNotNull(listR.getData().getExtendVO())) {
List<BusinessEmployeeExtendVO> list = listR.getData().getExtendVO();
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);
}
......@@ -265,22 +271,21 @@ implements TVacationMonitorService {
* @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;
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;
}
}
......
package com.yifu.cloud.plus.v1.business.service.vacation.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.business.dto.vacation.AddOrSaveVacationRuleDTO;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationRuleConfig;
import com.yifu.cloud.plus.v1.business.mapper.vacation.TVacationRuleConfigMapper;
import com.yifu.cloud.plus.v1.business.service.vacation.TVacationRuleConfigService;
import com.yifu.cloud.plus.v1.business.vo.vacation.VacationRuleConfigVO;
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 com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
/**
* @description: 假期配置 service实现层
* @author: wangweiguo
* @date: 2021/8/13
*/
@Service
public class TVacationRuleConfigServiceImpl extends ServiceImpl<TVacationRuleConfigMapper, TVacationRuleConfig>
implements TVacationRuleConfigService {
public static final Integer YEAR = 365;
/**
* @description: 获取年假配置规则
* @return: com.yifu.cloud.v1.common.core.util.R<com.yifu.cloud.v1.hrobusiness.api.vo.vacation.VacationRuleConfigVO>
* @author: wangweiguo
* @date: 2021/8/13
*/
@Override
public R<VacationRuleConfigVO> getVacationRuleConfig() {
TVacationRuleConfig tVacationRuleConfig = this.lambdaQuery()
.eq(TVacationRuleConfig::getType, CommonConstants.ONE_STRING).last(CommonConstants.LAST_ONE_SQL).one();
VacationRuleConfigVO vo = new VacationRuleConfigVO();
vo = TVacationRuleConfig.entityConvertToObj(vo, tVacationRuleConfig);
return R.ok(vo,"查询成功");
}
/**
* @description:
* @param user
* @param dto
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/13
*/
@Override
public R<Boolean> addOrSave(YifuUser user, AddOrSaveVacationRuleDTO dto) {
TVacationRuleConfig tVacationRuleConfig = TVacationRuleConfig.objConvertToEntity(dto);
TVacationRuleConfig entity = this.lambdaQuery().eq(TVacationRuleConfig::getType, tVacationRuleConfig.getType()).one();
if (null == entity) {
// 新增
tVacationRuleConfig.setCreateTime(LocalDateTime.now());
tVacationRuleConfig.setCreateUserId(String.valueOf(user.getId()));
} else {
// 更新
if (null == tVacationRuleConfig.getId()) {
return R.failed("数据校验失败:更新状态下id不能为空");
}
tVacationRuleConfig.setUpdateTime(LocalDateTime.now());
tVacationRuleConfig.setUpdateUserId(String.valueOf(user.getId()));
}
boolean isSuccess = this.saveOrUpdate(tVacationRuleConfig);
if (isSuccess) {
return R.ok(true,"操作成功");
}
return R.failed(false,"操作失败");
}
/**
* @description: 根据入职时间返回年假天数
* @param enjoinDate 入职时间
* @return: java.lang.Integer 年假天数
* @author: wangweiguo
* @date: 2021/8/13
*/
@Override
public Integer annualLeaveCalculationFormula(LocalDateTime enjoinDate) {
LocalDateTime now = LocalDateTime.now();
// 当前距离入职天数
long offsetDays = Duration.between(enjoinDate, now).toDays();
// 入职满一年的时间
LocalDateTime enjoinOnYear = enjoinDate.plus(YEAR, ChronoUnit.DAYS);
LocalDateTime oneYear = enjoinDate.plus(YEAR, ChronoUnit.DAYS).with(TemporalAdjusters.lastDayOfYear());
LocalDateTime tenYear = enjoinDate.plus(10L * YEAR, ChronoUnit.DAYS).with(TemporalAdjusters.lastDayOfYear());
LocalDateTime twentyYear = enjoinDate.plus(20L * YEAR, ChronoUnit.DAYS).with(TemporalAdjusters.lastDayOfYear());
// 入职满一年距离下次1月1日
long lastDay = Duration.between(enjoinOnYear, oneYear).toDays();
if (offsetDays>= YEAR && now.isBefore(oneYear)) {
// 入职=1年,年假天数=(年末-当前日期)/365天*休假天数5,四舍五入,立即发放
return BigDecimalUtils.safeMultiply(5, BigDecimalUtils.safeDivide(lastDay, YEAR, BigDecimal.ZERO, 4)).setScale(0, RoundingMode.HALF_UP).intValue();
} else if (now.isAfter(oneYear) && now.isBefore(tenYear)) {
// 入职年限>1年<10年,当年度已发放休假天数的,次年发放:年假天数5天
return 5;
} else if ((now.isAfter(tenYear) || now.isEqual(tenYear)) && now.isBefore(twentyYear)){
// 入职年限≥10年<20年,当年度已发放休假天数的,次年发放:年假天数10天
return 10;
} else if (now.isEqual(twentyYear) || now.isAfter(twentyYear)) {
// 大于等于20 发放15天
return 15;
} else {
return 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.yifu.cloud.plus.v1.business.mapper.vacation.TVacationRuleConfigMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.business.entity.vacation.TVacationRuleConfig">
<id property="id" column="ID" jdbcType="INTEGER"/>
<result property="type" column="TYPE" jdbcType="CHAR"/>
<result property="vacationAutoInit" column="VACATION_AUTO_INIT" jdbcType="CHAR"/>
<result property="vacationInitDate" column="VACATION_INIT_DATE" jdbcType="DATE"/>
<result property="timeScale" column="TIME_SCALE" jdbcType="CHAR"/>
<result property="timeValue" column="TIME_VALUE" jdbcType="DECIMAL"/>
</resultMap>
<sql id="Base_Column_List">
ID,TYPE,VACATION_AUTO_INIT,
VACATION_INIT_DATE,TIME_SCALE,TIME_VALUE
</sql>
</mapper>
......@@ -322,8 +322,8 @@ public class ArchivesDaprUtil {
* @Param
* @return
**/
public R<TSettleDomainListVo> getAllExtendList() {
R<TSettleDomainListVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/customerBusiness/temployeeBusiness/inner/getAllExtendList" , "", TSettleDomainListVo.class, SecurityConstants.FROM_IN);
public R<TBusinessDataListVo> getAllExtendList() {
R<TBusinessDataListVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/customerBusiness/temployeeBusiness/inner/getAllExtendList" , "", TBusinessDataListVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("获取所有员工拓展表信息失败!");
}
......@@ -345,6 +345,21 @@ public class ArchivesDaprUtil {
return res;
}
/**
* @Author huyc
* @Description 获取所有非离职员工拓展表信息
* @Date 22:11 2022/8/4
* @Param
* @return
**/
public R<TBusinessDataListVo> getNotLeaveExtendList() {
R<TBusinessDataListVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/customerBusiness/temployeeBusiness/inner/getNotLeaveExtendList" , "", TBusinessEmployeeExtendInfo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("获取所有非离职员工拓展表信息失败!");
}
return res;
}
/**
* @Author fxj
* @Description 更新项目档案和人员档案的社保公积金状态
......
package com.yifu.cloud.plus.v1.job.compont; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprBusinessProperties;import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;import lombok.extern.slf4j.Slf4j;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.context.properties.EnableConfigurationProperties;import org.springframework.stereotype.Component; /** * @author wangweiguo * @description hrob端微服务定时任务 * @date 22:31 2021/8/17 **/@Component(value = "businessTask")@Slf4j@EnableConfigurationProperties(DaprBusinessProperties.class)public class BusinessTask { @Autowired private DaprBusinessProperties daprBusinessProperties;// // /** // * @author wangweiguo // * @description 每天初始化年假信息 // * @date 22:35 2021/8/17 // * @return void // **/ // public void buildMonitorData() { // remoteVacationMonitorService.buildMonitorData(SecurityConstants.FROM_IN); // } // /** // * @author fxj // * @description 每天更新证件状态 // * @date 2021-08-23 // * @return void // **/ // public void updateCertStatusTask() { // log.info("------------扫描定时任务开始:定时更新B端证据状态信息开始------------"); // remoteBusinessService.updateCertStatusTask(SecurityConstants.FROM_IN); // log.info("------------扫描定时任务开始:定时更新B端证据状态信息结束------------"); // } /** * @Description: 发送短信定时任务 * @Author: hgw * @Date: 2021/8/25 9:35 * @return: void **/ public void doBatchSendBusSms(){ log.info("------------发送短信定时任务-开始------------"); HttpDaprUtil.invokeMethodPost(daprBusinessProperties.getAppUrl(), daprBusinessProperties.getAppId(), "/tbuswarning/inner/doBatchSendBusSms", "", Object.class, SecurityConstants.FROM_IN); log.info("------------发送短信定时任务-结束------------"); } /** * @Description: 短信状态更新定时任务 * @Author: hgw * @Date: 2021/8/25 9:35 * @return: void **/ public void doUpdateSendBusSmsStatus(){ log.info("------------短信状态更新定时任务-开始------------"); HttpDaprUtil.invokeMethodPost(daprBusinessProperties.getAppUrl(), daprBusinessProperties.getAppId(), "/tbuswarning/inner/doUpdateSendBusSmsStatus", "", Object.class, SecurityConstants.FROM_IN); log.info("------------短信状态更新定时任务-结束------------"); } }
\ No newline at end of file
package com.yifu.cloud.plus.v1.job.compont; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprBusinessProperties;import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;import lombok.extern.slf4j.Slf4j;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.context.properties.EnableConfigurationProperties;import org.springframework.stereotype.Component; /** * @author wangweiguo * @description hrob端微服务定时任务 * @date 22:31 2021/8/17 **/@Component(value = "businessTask")@Slf4j@EnableConfigurationProperties(DaprBusinessProperties.class)public class BusinessTask { @Autowired private DaprBusinessProperties daprBusinessProperties; /** * @Description: 发送短信定时任务 * @Author: huyc * @Date: 2023/1/5 9:35 * @return: void **/ public void buildMonitorData(){ log.info("------------初始化年假信息定时任务-开始------------"); HttpDaprUtil.invokeMethodPost(daprBusinessProperties.getAppUrl(), daprBusinessProperties.getAppId(), "/vacationMonitor/inner/buildMonitorDataForCurrentYear", "", Object.class, SecurityConstants.FROM_IN); log.info("------------初始化年假信息定时任务-结束------------"); } // /** // * @author fxj // * @description 每天更新证件状态 // * @date 2021-08-23 // * @return void // **/ // public void updateCertStatusTask() { // log.info("------------扫描定时任务开始:定时更新B端证据状态信息开始------------"); // remoteBusinessService.updateCertStatusTask(SecurityConstants.FROM_IN); // log.info("------------扫描定时任务开始:定时更新B端证据状态信息结束------------"); // } /** * @Description: 发送短信定时任务 * @Author: hgw * @Date: 2021/8/25 9:35 * @return: void **/ public void doBatchSendBusSms(){ log.info("------------发送短信定时任务-开始------------"); HttpDaprUtil.invokeMethodPost(daprBusinessProperties.getAppUrl(), daprBusinessProperties.getAppId(), "/tbuswarning/inner/doBatchSendBusSms", "", Object.class, SecurityConstants.FROM_IN); log.info("------------发送短信定时任务-结束------------"); } /** * @Description: 短信状态更新定时任务 * @Author: hgw * @Date: 2021/8/25 9:35 * @return: void **/ public void doUpdateSendBusSmsStatus(){ log.info("------------短信状态更新定时任务-开始------------"); HttpDaprUtil.invokeMethodPost(daprBusinessProperties.getAppUrl(), daprBusinessProperties.getAppId(), "/tbuswarning/inner/doUpdateSendBusSmsStatus", "", Object.class, SecurityConstants.FROM_IN); log.info("------------短信状态更新定时任务-结束------------"); } }
\ No newline at end of file
......
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