feat: 一些需求改进
打开档案时增加了部门选择项
处理了合同信息录入时的性别不自动填入问题
合同到期提醒模块发布
| | |
| | | |
| | | @GetMapping("list") |
| | | @PreAuthorize("hasAuthority('empContractinfo:list')") |
| | | public FebsResponse empContractinfoList(QueryRequest request, EmpContractInfo empContractinfo) { |
| | | public FebsResponse getEmpContractList(QueryRequest request, EmpContractInfo empContractinfo) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.empContractinfoService.findEmpContractinfos(request, empContractinfo)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | | @RequestMapping(value = "remind/list", method = RequestMethod.GET) |
| | | @PreAuthorize("hasAuthority('empContractinfo:list')") |
| | | public FebsResponse empRemindContractList(QueryRequest request, EmpContractInfo empContractinfo) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.empContractinfoService.findRemindContractinfos(request, empContractinfo)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "remind/not", method = RequestMethod.POST) |
| | | @PreAuthorize("hasAuthority('empContractinfo:update')") |
| | | public void updateEmpContractRemind(@Valid EmpContractInfo empContractinfo) throws FebsException { |
| | | try { |
| | | this.empContractinfoService.updateEmpContractRemind(empContractinfo); |
| | | } catch (Exception e) { |
| | | String message = "不续签员工合同操作失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | @RequestMapping(value = "remind/continue", method = RequestMethod.POST) |
| | | @PreAuthorize("hasAuthority('empContractinfo:add')") |
| | | public void continueEmpContract(@Valid EmpContractInfo empContractinfo) throws FebsException { |
| | | try { |
| | | this.empContractinfoService.continueEmpContract(empContractinfo); |
| | | } catch (Exception e) { |
| | | String message = "续签员工合同信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @PreAuthorize("hasAuthority('empContractinfo:delete')") |
| | | public void deleteEmpContractinfo(EmpContractInfo empContractinfo) throws FebsException { |
| | |
| | | private String empStatus = ""; |
| | | |
| | | @FieldInfo(name = "sex", type = "varchar", explain = "性别码") |
| | | @TableField("sex") |
| | | // @TableField("sex") |
| | | // @ExcelField(value = "性别", writeConverterExp = "1=男,2=女") |
| | | @TableField(exist = false) |
| | | private String sex = ""; |
| | | |
| | | //@FieldInfo(name = "deptId", type = "bigint", explain = "部门Id") |
| | |
| | | // @Version |
| | | private Integer version = 0; |
| | | |
| | | @TableField("diffDay") |
| | | private Integer diffDay = 0; |
| | | |
| | | @TableField("remindFlag") |
| | | private Integer remindFlag = 0; |
| | | |
| | | @TableField(exist = false) |
| | | private String signingDateStr = ""; |
| | | |
| | | @TableField(exist = false) |
| | | private String endDateStr = ""; |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | private String diffLabel = ""; |
| | | |
| | | |
| | | |
| | |
| | | @ExcelField(value = "部门(护卫点)") |
| | | private String allDeptName = ""; |
| | | |
| | | // @FieldInfo(name = "deptName", type = "bit", explain = "部门(护卫点)") |
| | | @TableField(exist = false) |
| | | private String deptName = ""; |
| | | @TableField("deptName") |
| | | @ExcelField(value = "部门/护卫点") |
| | | private String deptName; |
| | | |
| | | @TableField(exist = false) |
| | | @ExcelField(value = "岗位") |
| | |
| | | @TableField(exist = false) |
| | | private String empIds; |
| | | |
| | | @FieldInfo(name = "deptNames", explain = "关闭档案人员部门名称") |
| | | @TableField(exist = false) |
| | | private String deptNames; |
| | | |
| | | @FieldInfo(name = "entryDates", explain = "关闭档案人员入职日期") |
| | | @TableField(exist = false) |
| | | private String entryDates; |
| | |
| | | @FieldInfo(name = "allDeptName", type = "bit", explain = "部门(护卫点)") |
| | | @TableField(exist = false) |
| | | private String allDeptName = ""; |
| | | |
| | | @TableField(exist = false) |
| | | private String deptName = ""; |
| | | |
| | | @TableField(exist = false) |
| | | private String deptId = ""; |
| | | } |
| | |
| | | @Update("<script> " + |
| | | " UPDATE t_emp_contractinfo SET contractStatus='4',\n" + |
| | | " empStatus='1',\n" + |
| | | " remindFlag=1,\n" + |
| | | " modifyTime = NOW(),\n" + |
| | | " modifier = #{operatorId}, \n" + |
| | | " version = version+1 \n" + |
| | | " WHERE TO_DAYS(t_emp_contractinfo.endDate) = TO_DAYS(NOW()) " + |
| | | "</script>") |
| | | int autoStopContract(@Param("operatorId") String operatorId); |
| | | |
| | | @Update("<script>" + |
| | | " UPDATE t_emp_contractinfo SET diffDay=DATEDIFF(endDate, NOW())\n" + |
| | | " WHERE endDate>=now()" + |
| | | "</script>") |
| | | int updateContractRemindDay(); |
| | | |
| | | @Update("<script>" + |
| | | " UPDATE t_emp_contractinfo SET remindFlag=1\n" + |
| | | " WHERE contractId=#{contractId}" + |
| | | "</script>") |
| | | int updateEmpContractRemind(@Param("contractId") Long contractId); |
| | | } |
| | |
| | | */ |
| | | IPage<EmpContractInfo> findEmpContractinfos(QueryRequest request, EmpContractInfo empContractinfo); |
| | | |
| | | IPage<EmpContractInfo> findRemindContractinfos(QueryRequest request, EmpContractInfo empContractinfo); |
| | | |
| | | /** |
| | | * 查询(所有) |
| | | * |
| | |
| | | void terminateContract(String empIds, String operatorId); |
| | | |
| | | void autoStopContract(String operatorId); |
| | | |
| | | /* |
| | | * |
| | | * 更新合同的到期天数 |
| | | * |
| | | * date 2024-03-09 16:53 |
| | | * @author: luoyibo |
| | | * @param 1 |
| | | * @return void |
| | | */ |
| | | void updateContractRemindDay(); |
| | | |
| | | /* |
| | | * |
| | | * 设置合同不再提醒 |
| | | * |
| | | * date 2024-03-09 22:07 |
| | | * @author: luoyibo |
| | | * @param empContractinfo 合同信息 |
| | | * @return void |
| | | */ |
| | | void updateEmpContractRemind(EmpContractInfo empContractinfo); |
| | | |
| | | /** |
| | | * |
| | | * 提醒合同的续签操作 |
| | | * |
| | | * date 2024-03-09 23:04 |
| | | * @author: luoyibo |
| | | * @param empContractinfo 合同信息 |
| | | * @return void |
| | | */ |
| | | void continueEmpContract(EmpContractInfo empContractinfo); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 增加员工后同步增加入职记录 |
| | | * |
| | | * <p> |
| | | * date 2021-07-30 09:12 |
| | | * @author: luoyibo |
| | | * |
| | | * @param empBaseInfo 员工信息 |
| | | * @param operatorId 操作员Id |
| | | * @param empId 员工Id |
| | | * @return void |
| | | * @author: luoyibo |
| | | */ |
| | | private void addEmpDimissLog(EmpBaseInfo empBaseInfo, String operatorId, Long empId) { |
| | | EmpDimissionLog dimissionLog = new EmpDimissionLog(); |
| | |
| | | dimissionLog.setEntryDate(empBaseInfo.getEntryDate()); |
| | | dimissionLog.setDimissionType("20"); |
| | | dimissionLog.setRemark(empBaseInfo.getRemark()); |
| | | dimissionLog.setDeptName(empBaseInfo.getAllDeptName()); |
| | | dimissionLog.setCreator(operatorId); |
| | | dimissionLog.setModifier(operatorId); |
| | | |
| | |
| | | String operatorId = Optional.of(FebsUtil.getUserId()).orElse("1"); |
| | | String[] str = ids.split(","); |
| | | List<String> list = new ArrayList<>(Arrays.asList(str)); |
| | | // for (int i = 0, j = str.length; i < j; i++) { |
| | | // EmpBaseInfo emp = this.getById(str[i]); |
| | | // addEmpDimissLog(emp, operatorId, Long.valueOf(str[i])); |
| | | // } |
| | | return empBaseInfoMapper.momentToNormal(list, operatorId) > 0; |
| | | } |
| | | |
| | |
| | | public boolean closeEmpArchives(EmpDimissionLog empDimissionLog) { |
| | | String operatorId = Optional.of(FebsUtil.getUserId()).orElse("1"); |
| | | String[] str = empDimissionLog.getEmpIds().split(","); |
| | | String[] empDeptNames = empDimissionLog.getDeptNames().split(","); |
| | | List<String> list = new ArrayList<>(Arrays.asList(str)); |
| | | String[] strDate = empDimissionLog.getEntryDates().split(","); |
| | | |
| | |
| | | dimissionLog.setReporter(empDimissionLog.getReporter()); |
| | | dimissionLog.setCreator(operatorId); |
| | | dimissionLog.setModifier(operatorId); |
| | | dimissionLog.setDeptName(empDeptNames[i]); |
| | | dimissionLogService.save(dimissionLog); |
| | | } |
| | | |
| | |
| | | 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.google.common.collect.Lists; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | public void autoStopContract(String operatorId) { |
| | | empContractinfoMapper.autoStopContract(operatorId); |
| | | } |
| | | |
| | | @Override |
| | | public void updateContractRemindDay() { |
| | | empContractinfoMapper.updateContractRemindDay(); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<EmpContractInfo> findRemindContractinfos(QueryRequest request, EmpContractInfo empContractinfo) { |
| | | int diffDay = Integer.parseInt(redisService.get("contract_remind").toString()); |
| | | List<String> contractStatus = Lists.newArrayList("1","2"); |
| | | QueryWrapper<EmpContractInfo> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("a.DelFlag", empContractinfo.getDelFlag()); |
| | | queryWrapper.eq("a.remindFlag", 0); |
| | | queryWrapper.in("a.contractStatus", contractStatus); |
| | | queryWrapper.between("a.diffDay", 0, diffDay); |
| | | queryWrapper.ge("a.endDate", DateUtil.formatDate(new Date())); |
| | | |
| | | queryWrapper.in("c.dept_Id", remoteDeptService.userRightDepts().split(StringConstant.COMMA)); |
| | | Page<EmpContractInfo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | SortUtil.handlePageSort(request, page, "diffDay", FebsConstant.ORDER_ASC, true); |
| | | IPage<EmpContractInfo> iPage = empContractinfoMapper.selectPageVo(page, queryWrapper); |
| | | List<EmpContractInfo> list = iPage.getRecords(); |
| | | //设置字典数据 |
| | | List<DicItem> dicItems = CastUtil.castList(redisService.get("dicItems"), DicItem.class); |
| | | list.forEach(p -> { |
| | | p.setContractStatusName(dicItems.stream() |
| | | .filter(k -> DicCode.CONTRACTSTATUS.equals(k.getDicCode()) && k.getDicItemCode().equals(p.getContractStatus())) |
| | | .findFirst() |
| | | .map(DicItem::getDicItemName) |
| | | .orElse("新签")); |
| | | }); |
| | | iPage.setRecords(list); |
| | | return iPage; |
| | | } |
| | | |
| | | @Override |
| | | public void updateEmpContractRemind(EmpContractInfo empContractinfo) { |
| | | empContractinfoMapper.updateEmpContractRemind(empContractinfo.getContractId()); |
| | | } |
| | | |
| | | @Override |
| | | public void continueEmpContract(EmpContractInfo empContractinfo) { |
| | | Long contractId = empContractinfo.getContractId(); |
| | | //创建一份新合同信息 |
| | | empContractinfo.setDelFlag(0); |
| | | this.createEmpContractinfo(empContractinfo); |
| | | |
| | | //设置不再提醒 |
| | | empContractinfoMapper.updateEmpContractRemind(contractId); |
| | | } |
| | | } |
| | |
| | | EmpBaseInfo empBaseInfo = empBaseInfoService.getById(empOpenarchives.getEmpId()); |
| | | empBaseInfo.setEntryDate(empOpenarchives.getOpenDate()); |
| | | empBaseInfo.setEntryType(empOpenarchives.getOpenType()); |
| | | empBaseInfo.setDeptId(Long.valueOf(empOpenarchives.getDeptId())); |
| | | empBaseInfo.setDeptName(empOpenarchives.getDeptName()); |
| | | empBaseInfo.setAllDeptName(empOpenarchives.getAllDeptName()); |
| | | empBaseInfo.setEmpStatus("0"); |
| | | empBaseInfo.setDimissionType(""); |
| | | empBaseInfo.setDimissionDate(DateUtil.parse("1900-01-01")); |
| | |
| | | dimissionLog.setRemark(empOpenarchives.getRemark()); |
| | | dimissionLog.setCreator(operatorId); |
| | | dimissionLog.setModifier(operatorId); |
| | | dimissionLog.setDeptName(empOpenarchives.getAllDeptName()); |
| | | |
| | | dimissionLogService.save(dimissionLog); |
| | | } |
| | |
| | | |
| | | List<EmpDimissionAttend> dimissionAttends = iEmpDimissionAttendService.findEmpDimissionattends(queryRequest, empDimissionAttend).getRecords(); |
| | | //入离职记录 |
| | | String[] dimissionLog = { "入职日期", "离职日期", "离职类型", "自离天数", "报备人", "备注"}; |
| | | String[] dimissionLog = { "部门/护卫点", "入职日期", "离职日期", "离职类型", "自离天数", "报备人", "备注"}; |
| | | EmpDimissionLog empDimissionLog=new EmpDimissionLog(); |
| | | empDimissionLog.setEmpId(empBaseInfo.getEmpId()); |
| | | empDimissionLog.setEmpStatus(empBaseInfo.getEmpStatus()); |
| | |
| | | import cc.mrbird.febs.server.hr.service.IEmpBaseInfoService; |
| | | import cc.mrbird.febs.server.hr.service.IEmpContractInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.boot.CommandLineRunner; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.swing.*; |
| | | |
| | | /** |
| | | * name: ScheduledTask |
| | |
| | | public void autoStopContract(){ |
| | | log.info("每天凌晨3点检查到期合同"); |
| | | empContractInfoService.autoStopContract("32"); |
| | | log.info("设置合同间隔的天数"); |
| | | empContractInfoService.updateContractRemindDay(); |
| | | |
| | | } |
| | | @Scheduled(cron = "0 0 4 * * ?") |
| | | public void autoCalculateAge(){ |
| | |
| | | } |
| | | @Override |
| | | public void run(String... args) throws Exception { |
| | | calculateSeniority(); |
| | | autoStopContract(); |
| | | autoCalculateAge(); |
| | | //calculateSeniority(); |
| | | // autoStopContract(); |
| | | //autoCalculateAge(); |
| | | // updateDeptName(); |
| | | //autoStopContract(); |
| | | } |
| | | } |
| | |
| | | int size = records1.size(); |
| | | for (int i = 0; i < size; i++) { |
| | | Map user = records1.get(i); |
| | | dimissionLogtable.addCell(createCell(user.get("deptName")==null?"":user.get("deptName").toString(), textfont)); |
| | | dimissionLogtable.addCell(createCell(user.get("entryDate")==null?"":user.get("entryDate").toString(), textfont)); |
| | | dimissionLogtable.addCell(createCell(user.get("dimissionDate")==null?"":user.get("dimissionDate").toString(), textfont)); |
| | | dimissionLogtable.addCell(createCell(user.get("dimissionType")==null?"":user.get("dimissionType").toString(), textfont)); |
| | |
| | | String userRightDepts = userDataPermissionService.findByUserId(FebsUtil.getUserId()); |
| | | return userRightDepts; |
| | | } |
| | | |
| | | } |
| | |
| | | package cc.mrbird.febs.server.system.controller; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.system.SysConfig; |
| | | import cc.mrbird.febs.server.system.service.ISysConfigService; |
| | | import cc.mrbird.febs.common.core.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.entity.system.SysConfig; |
| | | import cc.mrbird.febs.common.core.exception.FebsException; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.server.system.service.ISysConfigService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * name:SysConfig |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:参数配置表控制器 |
| | |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "set/contract/remind",method = RequestMethod.POST) |
| | | public void setContractRemindToRedis() throws FebsException{ |
| | | sysConfigService.setContractRemindToRedis(); |
| | | } |
| | | } |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * name:SysConfig |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:参数配置表服务接口 |
| | |
| | | void deleteSysConfig(SysConfig sysConfig); |
| | | |
| | | /** |
| | | * |
| | | * 根据Id批量逻辑删除记录 |
| | | * |
| | | * <p> |
| | | * date 2021-01-28 10:48 |
| | | * @author: luoyibo |
| | | * |
| | | * @param ids 待删除Id |
| | | * @return void |
| | | * @author: luoyibo |
| | | */ |
| | | void logicDelSysConfig(String ids); |
| | | |
| | | /** |
| | | * 将合同提前提醒参数设置到redis中 |
| | | * <p> |
| | | * date 2024-03-10 08:12 |
| | | * |
| | | * @param |
| | | * @return java.lang.Void |
| | | * @author: luoyibo |
| | | */ |
| | | Void setContractRemindToRedis(); |
| | | } |
| | | |
| | |
| | | package cc.mrbird.febs.server.system.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.core.constant.ModuleCode; |
| | | import cc.mrbird.febs.common.core.entity.system.Dic; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.entity.system.SysConfig; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.common.core.utils.SequenceUtil; |
| | | import cc.mrbird.febs.common.redis.service.RedisService; |
| | | import cc.mrbird.febs.server.system.mapper.SysConfigMapper; |
| | | import cc.mrbird.febs.server.system.service.ISysConfigService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.common.core.utils.SequenceUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * |
| | | * name:SysConfig |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:参数配置表服务接口实现 |
| | |
| | | private final String operatorId = Optional.ofNullable(FebsUtil.getCurrentUser()) |
| | | .map(u -> u.getUserId().toString()) |
| | | .orElse("1"); |
| | | |
| | | private final RedisService redisService; |
| | | |
| | | @Override |
| | | public IPage<SysConfig> findSysConfigs(QueryRequest request, SysConfig sysConfig) { |
| | | LambdaQueryWrapper<SysConfig> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | sysConfig.setConfigId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | sysConfig.setCreateBy(operatorId); |
| | | this.save(sysConfig); |
| | | |
| | | redisService.set(sysConfig.getConfigKey(), sysConfig.getConfigValue()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | sysConfig.setUpdateTime(new Date()); |
| | | sysConfig.setUpdateBy(operatorId); |
| | | this.saveOrUpdate(sysConfig); |
| | | |
| | | redisService.set(sysConfig.getConfigKey(), sysConfig.getConfigValue()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | // TODO 设置删除条件 |
| | | this.remove(wrapper); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 根据Id批量逻辑删除记录 |
| | | * |
| | | * <p> |
| | | * date 2021-01-28 10:48 |
| | | * @author: luoyibo |
| | | * |
| | | * @param ids 待删除Id |
| | | * @return void |
| | | * @author: luoyibo |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | this.remove(wrapper); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Void setContractRemindToRedis() { |
| | | QueryWrapper<SysConfig> sysConfigQueryWrapper = new QueryWrapper<>(); |
| | | sysConfigQueryWrapper.eq("config_key", "contract_remind"); |
| | | SysConfig sysConfig = sysConfigMapper.selectOne(sysConfigQueryWrapper); |
| | | |
| | | redisService.set("diffDay", sysConfig.getConfigValue()); |
| | | return null; |
| | | } |
| | | } |
| | | |