Commit 039d7365 authored by huyuchen's avatar huyuchen

假勤管理修改

parent 776608d9
......@@ -177,7 +177,7 @@ public class EmployeeBusinessController {
*/
@Inner
@PostMapping("/inner/updateEmployeeExtendRedundancy")
public Boolean updateEmployeeExtendRedundancy(@RequestBody UpdateEmployeeExtendRedundancyDTO dtoList) {
public Boolean updateEmployeeExtendRedundancy(@RequestBody List<UpdateEmployeeExtendRedundancyDTO> dtoList) {
return this.businessEmployeeExtendInfoService.updateEmployeeExtendRedundancy(dtoList);
}
......@@ -234,8 +234,8 @@ public class EmployeeBusinessController {
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.Map < java.lang.String, com.yifu.cloud.v1.hrms.api.vo.basic.BusinessEmployeeExtendByLeave>>
**/
@Inner
@GetMapping("/inner/getInfoByLeaveMap")
public R<Map<String, BusinessEmployeeExtendByLeave>> getInfoByLeaveMap() {
@PostMapping("/inner/getInfoByLeaveMap")
public Map<String, BusinessEmployeeExtendByLeave> getInfoByLeaveMap() {
return this.businessEmployeeExtendInfoService.getInfoByLeaveMap();
}
......
......@@ -28,7 +28,7 @@ public interface TBusinessEmployeeExtendInfoService extends IService<TBusinessEm
* @author: wangweiguo
* @date: 2021/8/12
*/
Boolean updateEmployeeExtendRedundancy(UpdateEmployeeExtendRedundancyDTO dto);
Boolean updateEmployeeExtendRedundancy(List<UpdateEmployeeExtendRedundancyDTO> dto);
/**
* @description: 根据身份证号查询人员拓展表信息
* @param empIdcard 身份证号
......@@ -84,7 +84,7 @@ public interface TBusinessEmployeeExtendInfoService extends IService<TBusinessEm
* @Date: 2021/8/18 16:45
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.Map < java.lang.String, com.yifu.cloud.v1.hrms.api.vo.basic.BusinessEmployeeExtendByLeave>>
**/
R<Map<String, BusinessEmployeeExtendByLeave>> getInfoByLeaveMap();
Map<String, BusinessEmployeeExtendByLeave> getInfoByLeaveMap();
/**
* b端人员信息编辑拓展信息
......
......@@ -70,16 +70,17 @@ implements TBusinessEmployeeExtendInfoService {
/**
* 更新人员信息冗余字段
* @description: 更新人员信息冗余字段
* @param v
* @param dtoList
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.List<ErrorMessage>>
* @author: wangweiguo
* @date: 2021/8/12
*/
@Override
public Boolean updateEmployeeExtendRedundancy(UpdateEmployeeExtendRedundancyDTO v) {
if (Common.isEmpty(v)) {
public Boolean updateEmployeeExtendRedundancy(List<UpdateEmployeeExtendRedundancyDTO> dtoList) {
if (CollUtil.isEmpty(dtoList)) {
return false;
}
for (UpdateEmployeeExtendRedundancyDTO v : dtoList) {
// 根据部门id更新冗余的部门信息
if (null != v.getDepartId()) {
this.lambdaUpdate()
......@@ -90,7 +91,7 @@ implements TBusinessEmployeeExtendInfoService {
.update();
} else {
if (StringUtils.isBlank(v.getEmpIdcard())) {
return false;
continue;
}
v.setEmployeeTags(formatLabelId(v.getEmployeeTags()));
// 身份证号更新冗余的离职,标签,证件相关信息
......@@ -103,6 +104,7 @@ implements TBusinessEmployeeExtendInfoService {
.set(null != v.getBusinessLeaveDate(), TBusinessEmployeeExtendInfo::getBusinessLeaveDate, v.getBusinessLeaveDate())
.update();
}
}
return true;
}
/**
......@@ -369,7 +371,7 @@ implements TBusinessEmployeeExtendInfoService {
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.Map < java.lang.String, com.yifu.cloud.v1.hrms.api.vo.basic.BusinessEmployeeExtendByLeave>>
**/
@Override
public R<Map<String, BusinessEmployeeExtendByLeave>> getInfoByLeaveMap() {
public Map<String, BusinessEmployeeExtendByLeave> getInfoByLeaveMap() {
List<BusinessEmployeeExtendByLeave> list = this.baseMapper.getInfoByLeaveList();
Map<String, BusinessEmployeeExtendByLeave> leaveMap = new HashMap<>();
if (list != null && !list.isEmpty()) {
......@@ -377,7 +379,7 @@ implements TBusinessEmployeeExtendInfoService {
leaveMap.put(leave.getBusinessTelecomNumber(), leave);
}
}
return new R<>(leaveMap);
return leaveMap;
}
/**
......
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;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 假期监控清零日志表
* @TableName t_vacation_monitor_clear_log
......@@ -19,7 +20,7 @@ public class TVacationMonitorClearLog extends Model<TVacationMonitorClearLog> {
/**
* 主键
*/
@TableId
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
......
package com.yifu.cloud.plus.v1.business.controller.system;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.system.TBusDept;
......@@ -264,7 +265,7 @@ public class TBusDeptController {
dto.setDepartName(tBusDept.getName());
dto.setTreeLogo(tBusDept.getTreeLogo());
dto.setDepartIdVal(tBusDept.getId());
archivesDaprUtil.updateEmployeeExtendRedundancy(dto);
archivesDaprUtil.updateEmployeeExtendRedundancy(CollUtil.newArrayList(dto));
}
return new R<>(isSuccess);
}
......@@ -298,7 +299,7 @@ public class TBusDeptController {
dto.setDepartName(null);
dto.setTreeLogo(null);
dto.setDepartIdVal(null);
archivesDaprUtil.updateEmployeeExtendRedundancy(dto);
archivesDaprUtil.updateEmployeeExtendRedundancy(CollUtil.newArrayList(dto));
}
return new R<>(isSuccess);
}
......
package com.yifu.cloud.plus.v1.business.controller.vacation;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.vacation.TBusLeave;
import com.yifu.cloud.plus.v1.business.service.vacation.TBusLeaveService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.BusinessEmployeeExtendByLeave;
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;
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.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
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 java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* B端离职信息表
*
* @author hgw
* @date 2021-08-17 17:02:47
*/
@RestController
@AllArgsConstructor
@RequestMapping("/tbusleave")
@Tag(name = "B端离职信息表")
public class TBusLeaveController {
private final TBusLeaveService tBusLeaveService;
private final ArchivesDaprUtil daprUtil;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tBusLeave B端离职信息表
* @return
*/
@Operation(summary = "简单分页查询", description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TBusLeave>> getTBusLeavePage(Page<TBusLeave> page, TBusLeave tBusLeave) {
return new R<>(tBusLeaveService.getTBusLeavePage(page, tBusLeave));
}
/**
* 获取list
*
* @param tBusLeave B端离职信息表
* @return
*/
@Operation(summary = "获取list", description = "获取list")
@GetMapping("/getTBusLeaveList")
public R<List<TBusLeave>> getTBusLeaveList(TBusLeave tBusLeave) {
return new R<>(tBusLeaveService.getTBusLeaveList(tBusLeave));
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation(summary = "id查询", description = "id查询")
@GetMapping("/{id}")
public R<TBusLeave> getById(@PathVariable("id") String id) {
return new R<>(tBusLeaveService.getById(id));
}
/**
* 新增记录
*
* @param tBusLeave
* @return R
*/
@Operation(summary = "新增", description = "新增")
@PostMapping
// @PreAuthorize("@pms.hasPermission('yifu-hro-business:tbusleave_add')")
public R<Boolean> save(@RequestBody TBusLeave tBusLeave) {
YifuUser user = SecurityUtils.getUser();
if (user != null && user.getId() != null) {
tBusLeave.setCreateUserId(String.valueOf(user.getId()));
tBusLeave.setCreateTime(LocalDateTime.now());
tBusLeave.setCreateUserName(user.getNickname());
this.updateEmpInfo(tBusLeave);
return new R<>(tBusLeaveService.save(tBusLeave));
} else {
return R.failed("未获取到登录人信息!");
}
}
/**
* @param leave
* @Description: 单个更新人员信息
* @Author: huyc
* @Date: 2023/1/6 11:14
* @return: void
**/
private void updateEmpInfo(TBusLeave leave) {
List<UpdateEmployeeExtendRedundancyDTO> dtoList = new ArrayList<>();
UpdateEmployeeExtendRedundancyDTO dto = new UpdateEmployeeExtendRedundancyDTO();
dto.setEmpIdcard(leave.getIdCard());
dto.setBusinessLeaveDate(leave.getLeaveDate());
dto.setBusinessLeaveReason(leave.getLeaveReason());
dto.setBusinessWorkingStatus(CommonConstants.ONE_STRING);
dtoList.add(dto);
daprUtil.updateEmployeeExtendRedundancy(dtoList);
}
/**
* @param leaveList
* @Description: 批量更新人员信息
* @Author: huyc
* @Date: 2023/1/6 11:14
* @return: void
**/
private void batchUpdateEmpInfo(List<TBusLeave> leaveList) {
if (leaveList != null && !leaveList.isEmpty()) {
List<UpdateEmployeeExtendRedundancyDTO> dtoList = new ArrayList<>();
UpdateEmployeeExtendRedundancyDTO dto;
for (TBusLeave leave : leaveList) {
dto = new UpdateEmployeeExtendRedundancyDTO();
dto.setEmpIdcard(leave.getIdCard());
dto.setBusinessLeaveDate(leave.getLeaveDate());
dto.setBusinessLeaveReason(leave.getLeaveReason());
dto.setBusinessWorkingStatus(CommonConstants.ONE_STRING);
dtoList.add(dto);
}
daprUtil.updateEmployeeExtendRedundancy(dtoList);
}
}
/**
* 导入
*
* @return R
*/
@Operation(summary = "导入", description = "导入")
@PostMapping("/importLeave")
public R<List<ErrorMessage>> importLeave(@RequestBody List<TBusLeave> leaveList) {
if (leaveList == null || leaveList.isEmpty()) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || user.getId() == null) {
return R.failed("未获取到登录人信息!");
}
LocalDateTime nows = LocalDateTime.now();
List<ErrorMessage> errorList = new ArrayList<>();
R<Map<String, BusinessEmployeeExtendByLeave>> dataR = daprUtil.getInfoByLeaveMap();
Map<String, BusinessEmployeeExtendByLeave> empMap;
if (dataR != null && dataR.getData() != null && !dataR.getData().isEmpty()) {
empMap = dataR.getData();
} else {
return R.failed("未获取到基础服务-人员附属信息!");
}
int i = 1;
List<TBusLeave> updateLsit = new ArrayList<>();
for (TBusLeave tBusLeave : leaveList) {
i++;
if (Common.isEmpty(tBusLeave.getLeaveDate()) || Common.isEmpty(tBusLeave.getLeavePostDate())
|| Common.isEmpty(tBusLeave.getLeaveReason()) || tBusLeave.getLeaveReason().length() > 200) {
// 判断并拦截
this.judgeLeave(errorList, i, tBusLeave);
} else {
// 导入
this.saveAndJudge(user, nows, errorList, empMap, i, updateLsit, tBusLeave);
}
}
// 更新人员信息
this.batchUpdateEmpInfo(updateLsit);
return R.ok(errorList,"操作成功");
}
/**
* @param errorList
* @param i
* @param tBusLeave
* @Description: 判断离职原因等
* @Author: hgw
* @Date: 2021/8/24 16:19
* @return: void
**/
private void judgeLeave(List<ErrorMessage> errorList, int i, TBusLeave tBusLeave) {
String error;
if (Common.isEmpty(tBusLeave.getLeaveDate())) {
error = "'" + tBusLeave.getTeleNo() + "'工号无离职日期,无法导入!";
errorList.add(new ErrorMessage(i, error));
}
if (Common.isEmpty(tBusLeave.getLeavePostDate())) {
error = "'" + tBusLeave.getTeleNo() + "'工号无离岗日期,无法导入!";
errorList.add(new ErrorMessage(i, error));
}
if (Common.isEmpty(tBusLeave.getLeaveReason())) {
error = "'" + tBusLeave.getTeleNo() + "'工号无离职原因,无法导入!";
errorList.add(new ErrorMessage(i, error));
}
if (Common.isNotNull(tBusLeave.getLeaveReason()) && tBusLeave.getLeaveReason().length() > 200) {
error = "'" + tBusLeave.getTeleNo() + "'工号离职原因超过200字符,无法导入!";
errorList.add(new ErrorMessage(i, error));
}
}
/**
* @Description: 保存和判断
* @Author: huyc
* @Date: 2023/1/6 11:14
* @return: void
**/
private void saveAndJudge(YifuUser user, LocalDateTime nows, List<ErrorMessage> errorList
, Map<String, BusinessEmployeeExtendByLeave> empMap, int i, List<TBusLeave> updateLsit, TBusLeave tBusLeave) {
BusinessEmployeeExtendByLeave empInfo;
String error;
String userName = user.getNickname();
String userId = String.valueOf(user.getId());
if (Common.isNotNull(tBusLeave.getTeleNo())) {
empInfo = empMap.get(tBusLeave.getTeleNo());
if (empInfo != null) {
if (Common.isNotNull(empInfo.getBusinessWorkingStatus()) && CommonConstants.ONE_STRING.equals(empInfo.getBusinessWorkingStatus())) {
error = "'" + tBusLeave.getTeleNo() + "'工号员工已离职,请核实无误后再操作!";
errorList.add(new ErrorMessage(i, error));
} else {
tBusLeave.setDeptId(empInfo.getDepartId());
tBusLeave.setDeptName(empInfo.getDepartName());
tBusLeave.setDeptTreeLogo(empInfo.getDepartCode());
tBusLeave.setName(empInfo.getEmpName());
tBusLeave.setIdCard(empInfo.getEmpIdcard());
tBusLeave.setPost(empInfo.getBusinessPost());
tBusLeave.setCreateTime(nows);
tBusLeave.setCreateUserId(userId);
tBusLeave.setCreateUserName(userName);
tBusLeaveService.save(tBusLeave);
updateLsit.add(tBusLeave);
error = "导入成功!";
errorList.add(new ErrorMessage(i, error));
}
} else {
error = "电信工号未匹配到人员附属信息:'" + tBusLeave.getTeleNo() + "'";
errorList.add(new ErrorMessage(i, error));
}
} else {
error = "电信工号不可为空!";
errorList.add(new ErrorMessage(i, error));
}
}
/**
* 修改记录
*
* @param tBusLeave
* @return R
*/
@SysLog("修改B端离职信息表")
@Operation(summary = "修改", description = "修改")
@PutMapping
// @PreAuthorize("@pms.hasPermission('yifu-hro-business:tbusleave_edit')")
public R<Boolean> update(@RequestBody TBusLeave tBusLeave) {
this.updateEmpInfo(tBusLeave);
return new R<>(tBusLeaveService.updateById(tBusLeave));
}
/**
* 通过id删除一条记录
*
* @param id
* @return R
*/
@SysLog("假删除B端离职信息表")
@Operation(summary = "假删除", description = "假删除")
@DeleteMapping("/{id}")
// @PreAuthorize("@pms.hasPermission('yifu-hro-business:tbusleave_del')")
public R<Boolean> removeById(@PathVariable String id) {
TBusLeave tBusLeave = new TBusLeave();
tBusLeave.setId(id);
tBusLeave.setDeleteFlag(1);
return new R<>(tBusLeaveService.updateById(tBusLeave));
}
}
package com.yifu.cloud.plus.v1.business.controller.vacation;
import com.yifu.cloud.plus.v1.business.dto.vacation.AddVacationMonitorClearLogDTO;
import com.yifu.cloud.plus.v1.business.service.vacation.TVacationMonitorClearLogService;
import com.yifu.cloud.plus.v1.business.vo.vacation.TVacationMonitorClearLogVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* @description: 假期监控清零日志表 controller
* @author: wangweiguo
* @date: 2021-08-16
*/
@RestController
@AllArgsConstructor
@RequestMapping("/vacationMonitorClearLog")
@Tag(name = "假期监控清零日志表相关api")
public class TVacationMonitorClearLogController {
private final TVacationMonitorClearLogService tVacationMonitorClearLogService;
/**
* @description: 查询-列表: 查询当前年假所有清零记录
* @param vacationMonitorId 年假监控id
* @return: R<List<TVacationMonitorClearLogVO>>
* @author: wangweiguo
* @date: 2021-08-16
*/
@Operation(summary = "查询-列表: 查询当前年假所有清零记录", description = "查询-列表: 查询当前年假所有清零记录")
@GetMapping("/getList")
public R<List<TVacationMonitorClearLogVO>> getList(@RequestParam("vacationMonitorId") @Parameter(description = "年假监控id", required = true) Integer vacationMonitorId) {
return this.tVacationMonitorClearLogService.getList(vacationMonitorId);
}
/**
* @description: 清零说明: 记录年假清零说明
* @param dto
* @return: R<Boolean>
* @author: wangweiguo
* @date: 2021-08-16
*/
@Operation(summary = "清零说明: 记录年假清零说明", description = "清零说明: 记录年假清零说明")
@PostMapping("/clearNote")
public R<Boolean> clearNote(@RequestBody @Valid AddVacationMonitorClearLogDTO dto) {
return this.tVacationMonitorClearLogService.clearNote(dto);
}
}
package com.yifu.cloud.plus.v1.business.mapper.vacation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.vacation.TBusLeave;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* B端离职信息表
*
* @author hgw
* @date 2021-08-17 17:02:47
*/
@Mapper
public interface TBusLeaveMapper extends BaseMapper<TBusLeave> {
/**
* B端离职信息表简单分页查询
*
* @param tBusLeave B端离职信息表
* @return
*/
IPage<TBusLeave> getTBusLeavePage(Page<TBusLeave> page, @Param("tBusLeave") TBusLeave tBusLeave);
List<TBusLeave> getTBusLeaveList(@Param("tBusLeave") TBusLeave tBusLeave);
}
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.TVacationMonitorClearLog;
import org.apache.ibatis.annotations.Mapper;
/**
* @description: 假期监控清零日志表 mapper
* @Entity com.yifu.cloud.v1.hrobusiness.api.entity.vacation.TVacationMonitorClearLog
* @author: wangweiguo
* @date: 2021-08-16
*/
@Mapper
public interface TVacationMonitorClearLogMapper extends BaseMapper<TVacationMonitorClearLog> {
}
package com.yifu.cloud.plus.v1.business.service.vacation;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.business.entity.vacation.TBusLeave;
import java.util.List;
/**
* B端离职信息表
*
* @author hgw
* @date 2021-08-17 17:02:47
*/
public interface TBusLeaveService extends IService<TBusLeave> {
/**
* B端离职信息表简单分页查询
*
* @param tBusLeave B端离职信息表
* @return
*/
IPage<TBusLeave> getTBusLeavePage(Page<TBusLeave> page, TBusLeave tBusLeave);
/**
* @param tBusLeave
* @Description: 获取list
* @Author: hgw
* @Date: 2021/8/18 14:50
* @return: java.util.List<com.yifu.cloud.v1.hrobusiness.api.entity.vacation.TBusLeave>
**/
List<TBusLeave> getTBusLeaveList(TBusLeave tBusLeave);
}
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.AddVacationMonitorClearLogDTO;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationMonitorClearLog;
import com.yifu.cloud.plus.v1.business.vo.vacation.TVacationMonitorClearLogVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.List;
/**
* @description: 假期监控清零日志表 service层
* @author: wangweiguo
* @date: 2021-08-16
*/
public interface TVacationMonitorClearLogService extends IService<TVacationMonitorClearLog> {
/**
* @description: 查询-列表: 查询当前年假所有清零记录
* @param vacationMonitorId 年假监控id
* @return: R<List<TVacationMonitorClearLogVO>>
* @author: wangweiguo
* @date: 2021-08-16
*/
R<List<TVacationMonitorClearLogVO>> getList(Integer vacationMonitorId);
/**
* @description: 清零说明: 记录年假清零说明
* @param dto
* @return: R<Boolean>
* @author: wangweiguo
* @date: 2021-08-16
*/
R<Boolean> clearNote(AddVacationMonitorClearLogDTO dto);
}
package com.yifu.cloud.plus.v1.business.service.vacation.impl;
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.entity.vacation.TBusLeave;
import com.yifu.cloud.plus.v1.business.mapper.vacation.TBusLeaveMapper;
import com.yifu.cloud.plus.v1.business.service.vacation.TBusLeaveService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* B端离职信息表
*
* @author hgw
* @date 2021-08-17 17:02:47
*/
@Service("tBusLeaveService")
public class TBusLeaveServiceImpl extends ServiceImpl<TBusLeaveMapper, TBusLeave> implements TBusLeaveService {
/**
* B端离职信息表简单分页查询
*
* @param tBusLeave B端离职信息表
* @return
*/
@Override
public IPage<TBusLeave> getTBusLeavePage(Page<TBusLeave> page, TBusLeave tBusLeave) {
return baseMapper.getTBusLeavePage(page, tBusLeave);
}
@Override
public List<TBusLeave> getTBusLeaveList(TBusLeave tBusLeave) {
return baseMapper.getTBusLeaveList(tBusLeave);
}
}
package com.yifu.cloud.plus.v1.business.service.vacation.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.business.dto.vacation.AddVacationMonitorClearLogDTO;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationMonitor;
import com.yifu.cloud.plus.v1.business.entity.vacation.TVacationMonitorClearLog;
import com.yifu.cloud.plus.v1.business.mapper.vacation.TVacationMonitorClearLogMapper;
import com.yifu.cloud.plus.v1.business.service.vacation.TVacationMonitorClearLogService;
import com.yifu.cloud.plus.v1.business.service.vacation.TVacationMonitorService;
import com.yifu.cloud.plus.v1.business.vo.vacation.TVacationMonitorClearLogVO;
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 lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
import static com.yifu.cloud.plus.v1.business.util.BusinessResultErrorMsg.*;
/**
* @description: 假期监控清零日志表 service实现层
* @author: wangweiguo
* @date: 2021-08-16
*/
@Service
@AllArgsConstructor
public class TVacationMonitorClearLogServiceImpl extends ServiceImpl<TVacationMonitorClearLogMapper, TVacationMonitorClearLog>
implements TVacationMonitorClearLogService {
private final TVacationMonitorService vacationMonitorService;
/**
* @description: 查询-列表: 查询当前年假所有清零记录
* @param vacationMonitorId 年假监控id
* @return: R<List<TVacationMonitorClearLogVO>>
* @Author: huyc
* @Date: 2023/1/6 11:14
*/
@Override
public R<List<TVacationMonitorClearLogVO>> getList(Integer vacationMonitorId) {
if (vacationMonitorId == null) {
return R.ok(null,VACATION_MONITOR_ID_IS_NOT_NULL);
}
List<TVacationMonitorClearLog> list = this.lambdaQuery()
.eq(TVacationMonitorClearLog::getVacationMonitorId, vacationMonitorId)
.orderByDesc(TVacationMonitorClearLog::getClearTime)
.list();
List<TVacationMonitorClearLogVO> voList = list.stream().map(v -> {
TVacationMonitorClearLogVO vo = new TVacationMonitorClearLogVO();
BeanUtil.copyProperties(v, vo, CopyOptions.create().setIgnoreCase(true));
return vo;
}).collect(Collectors.toList());
return R.ok(voList);
}
/**
* @description: 清零说明: 记录年假清零说明
* @param dto
* @return: R<Boolean>
* @Author: huyc
* @Date: 2023/1/6 11:14
*/
@Override
public R<Boolean> clearNote(AddVacationMonitorClearLogDTO dto) {
YifuUser user = SecurityUtils.getUser();
if (user == null) {
return R.failed(USER_NOT_LOGIN);
}
if (dto.getVacationMonitorId() == null) {
return R.ok(null,VACATION_MONITOR_ID_IS_NOT_NULL);
}
TVacationMonitor vacationMonitor = this.vacationMonitorService.getById(dto.getVacationMonitorId());
if (vacationMonitor == null) {
return R.failed(VACATION_MONITOR_DATA_IS_NOT_EXIST);
}
TVacationMonitorClearLog log = new TVacationMonitorClearLog();
log.setClearNote(dto.getClearNote());
log.setVacationMonitorId(dto.getVacationMonitorId());
log.setVacationYear(vacationMonitor.getVacationYear());
log.setClearDuration(vacationMonitor.getNotUsedVacationDuration());
log.setClearUser(user.getNickname());
log.setClearUserId(Integer.valueOf(user.getId()));
log.setClearTime(LocalDateTime.now());
boolean isSuccess = this.save(log);
return R.ok(isSuccess);
}
}
<?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.TBusLeaveMapper">
<resultMap id="tBusLeaveMap" type="com.yifu.cloud.plus.v1.business.entity.vacation.TBusLeave">
<id property="id" column="id"/>
<result property="teleNo" column="tele_no"/>
<result property="name" column="name"/>
<result property="idCard" column="id_card"/>
<result property="post" column="post"/>
<result property="deptId" column="dept_id"/>
<result property="deptName" column="dept_name"/>
<result property="leaveDate" column="leave_date"/>
<result property="leavePostDate" column="leave_post_date"/>
<result property="leaveReason" column="leave_reason"/>
<result property="createUserId" column="create_user_id"/>
<result property="createUserName" column="create_user_name"/>
<result property="createTime" column="create_time"/>
<result property="deleteFlag" column="delete_flag"/>
<result property="deptTreeLogo" column="dept_tree_logo"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.tele_no,
a.name,
a.id_card,
a.post,
a.dept_id,
a.dept_name,
a.leave_date,
a.leave_post_date,
a.leave_reason,
a.create_user_id,
a.create_user_name,
a.create_time,
a.delete_flag,
a.dept_tree_logo
</sql>
<sql id="tBusLeave_where">
<if test="tBusLeave != null">
<if test="tBusLeave.id != null and tBusLeave.id.trim() != ''">
AND a.id = #{tBusLeave.id}
</if>
<if test="tBusLeave.teleNo != null and tBusLeave.teleNo.trim() != ''">
AND a.tele_no like concat('%', #{tBusLeave.teleNo},'%')
</if>
<if test="tBusLeave.name != null and tBusLeave.name.trim() != ''">
AND a.name like concat('%', #{tBusLeave.name},'%')
</if>
<if test="tBusLeave.idCard != null and tBusLeave.idCard.trim() != ''">
AND a.id_card = #{tBusLeave.idCard}
</if>
<if test="tBusLeave.post != null and tBusLeave.post.trim() != ''">
AND a.post like concat('%', #{tBusLeave.post},'%')
</if>
/* 查找部门树以及底下的数据 */
<if test="tBusLeave.deptId != null and tBusLeave.deptId != 1">
AND (a.dept_id = #{tBusLeave.deptId} or a.dept_tree_logo like concat('%-', #{tBusLeave.deptId},'-%'))
</if>
<if test="tBusLeave.deptName != null and tBusLeave.deptName.trim() != ''">
AND a.dept_name = #{tBusLeave.deptName}
</if>
<if test="tBusLeave.leaveDate != null">
AND a.leave_date = #{tBusLeave.leaveDate}
</if>
<if test="tBusLeave.leavePostDate != null">
AND a.leave_post_date = #{tBusLeave.leavePostDate}
</if>
<if test="tBusLeave.leaveReason != null and tBusLeave.leaveReason.trim() != ''">
AND a.leave_reason = #{tBusLeave.leaveReason}
</if>
<if test="tBusLeave.createUserId != null and tBusLeave.createUserId.trim() != ''">
AND a.create_user_id = #{tBusLeave.createUserId}
</if>
<if test="tBusLeave.createUserName != null and tBusLeave.createUserName.trim() != ''">
AND a.create_user_name = #{tBusLeave.createUserName}
</if>
<if test="tBusLeave.createTime != null">
AND a.create_time = #{tBusLeave.createTime}
</if>
<if test="tBusLeave.deleteFlag != null">
AND a.delete_flag = #{tBusLeave.deleteFlag}
</if>
<if test="tBusLeave.leaveDateStart != null">
AND a.leave_date >= #{tBusLeave.leaveDateStart}
</if>
<if test="tBusLeave.leaveDateEnd != null">
AND a.leave_date <![CDATA[ <= ]]> #{tBusLeave.leaveDateEnd}
</if>
<if test="tBusLeave.leavePostStart != null">
AND a.leave_post_date >= #{tBusLeave.leavePostStart}
</if>
<if test="tBusLeave.leavePostEnd != null">
AND a.leave_post_date <![CDATA[ <= ]]> #{tBusLeave.leavePostEnd}
</if>
<if test="tBusLeave.deptTreeLogo != null and tBusLeave.deptTreeLogo.trim() != '' ">
AND a.dept_tree_logo like concat(#{tBusLeave.deptTreeLogo},'%')
</if>
</if>
</sql>
<!--tBusLeave简单分页查询-->
<select id="getTBusLeavePage" resultMap="tBusLeaveMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_leave a
<where>
a.delete_flag = 0
<include refid="tBusLeave_where"/>
</where>
order by a.create_time desc
</select>
<!--获取list-->
<select id="getTBusLeaveList" resultMap="tBusLeaveMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_leave a
<where>
a.delete_flag = 0
<include refid="tBusLeave_where"/>
</where>
order by a.create_time desc
</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.TVacationMonitorClearLogMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.business.entity.vacation.TVacationMonitorClearLog">
<id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="clearNote" column="CLEAR_NOTE" jdbcType="VARCHAR"/>
<result property="clearDuration" column="CLEAR_DURATION" jdbcType="DECIMAL"/>
<result property="vacationYear" column="VACATION_YEAR" jdbcType="CHAR"/>
<result property="clearUser" column="CLEAR_USER" jdbcType="VARCHAR"/>
<result property="clearUserId" column="CLEAR_USER_ID" jdbcType="INTEGER"/>
<result property="clearTime" column="CLEAR_TIME" jdbcType="TIMESTAMP"/>
<result property="vacationMonitorId" column="VACATION_MONITOR_ID" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
ID,CLEAR_NOTE,CLEAR_DURATION,
VACATION_YEAR,CLEAR_USER,CLEAR_USER_ID,VACATION_MONITOR_ID
CLEAR_TIME
</sql>
</mapper>
......@@ -307,7 +307,7 @@ public class ArchivesDaprUtil {
* @Param
* @return
**/
public R<Boolean> updateEmployeeExtendRedundancy(UpdateEmployeeExtendRedundancyDTO dto) {
public R<Boolean> updateEmployeeExtendRedundancy(List<UpdateEmployeeExtendRedundancyDTO> dto) {
R<Boolean> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/customerBusiness/temployeeBusiness/inner/updateEmployeeExtendRedundancy" , JSON.toJSONString(dto), Boolean.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("更新-对应身份证的冗余信息失败!");
......@@ -345,6 +345,22 @@ public class ArchivesDaprUtil {
return res;
}
/**
* @Author huyc
* @Description 获取所有附属信息
* @Date 22:11 2022/8/4
* @Param
* @return
**/
public R<Map<String, BusinessEmployeeExtendByLeave>> getInfoByLeaveMap() {
R<Map> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/customerBusiness/temployeeBusiness/inner/getInfoByLeaveMap" , "", Map.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("获取所有附属信息失败!");
}
Map<String,BusinessEmployeeExtendByLeave> map = JSON.parseObject(JSON.toJSONString(res.getData()),new TypeReference<HashMap<String,BusinessEmployeeExtendByLeave>>(){});
return R.ok(map);
}
/**
* @Author huyc
* @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