实现了姓名不能重复包括在职离职员工,还实现了请假, 餐饮, 考勤的部门修改及时生效。
This commit is contained in:
parent
39fee88bdd
commit
74d8266b37
@ -175,17 +175,17 @@ public class RzAttendanceStatisticalServiceImpl extends ServiceImpl<RzAttendance
|
||||
if(!rzAttendanceStatistical.getName().equals(sysStaff.getName())){
|
||||
//修改部门和姓名
|
||||
rzAttendanceStatistical.setName(sysStaff.getName());
|
||||
if(rzAttendanceStatistical.getDeptId() == null){
|
||||
//if(rzAttendanceStatistical.getDeptId() == null){
|
||||
rzAttendanceStatistical.setDeptId(sysStaff.getDeptId());
|
||||
}
|
||||
//}
|
||||
getBaseMapper().updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
//查询考勤详情修改
|
||||
List<RzAttendance> kq_list = rzAttendanceMapper.queryMonthAttendanceByStaffId(sysStaff.getUserId(),new Date());
|
||||
//循环修改信息
|
||||
for (RzAttendance rzAttendance : kq_list) {
|
||||
if(rzAttendanceStatistical.getDeptId() == null){
|
||||
//if(rzAttendanceStatistical.getDeptId() == null){
|
||||
rzAttendance.setDeptId(sysStaff.getDeptId());
|
||||
}
|
||||
//}
|
||||
rzAttendance.setName(sysStaff.getName());
|
||||
rzAttendanceMapper.updateRzAttendance(rzAttendance);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evo.common.config.Global;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.domain.entity.RzUpload;
|
||||
@ -26,6 +27,7 @@ import com.evo.system.domain.SysStaff;
|
||||
import com.evo.system.mapper.SysStaffMapper;
|
||||
import com.evo.system.service.RzUploadService;
|
||||
import com.evo.system.service.impl.SysDeptServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
@ -45,6 +47,7 @@ import java.util.stream.Collectors;
|
||||
* @author chenyj
|
||||
* @date 2024-08-07
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDetail> implements IEqSnDetailService
|
||||
{
|
||||
@ -206,6 +209,10 @@ public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDet
|
||||
|
||||
@Override
|
||||
public Boolean sendPhoto(List<String> snList, List<Map<String, String>> userPhotoList) {
|
||||
if(!"druid".equals(Global.newInstance().getActive())){
|
||||
log.info("非生产环境, 无需下发照片");
|
||||
return true;
|
||||
}
|
||||
//检查设备是否在链接状态
|
||||
Map<String, Session> sessionMap = checkSession(snList);
|
||||
|
||||
@ -238,6 +245,7 @@ public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDet
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//发送数据的类型
|
||||
StaffDto cau = new StaffDto();
|
||||
//该接口固定为to_device,发送给设备用于识别对应哪个指令
|
||||
|
||||
@ -57,4 +57,6 @@ public interface RzLeaveMapper extends BaseMapper<RzLeave>
|
||||
* @return
|
||||
*/
|
||||
public RzLeave queryRzLeaveByUserId(@Param("userId") Long userId);
|
||||
|
||||
public int updateDeptIdByStaffId(@Param("deptId") Long deptId, @Param("userId") Long userId);
|
||||
}
|
||||
|
||||
@ -244,9 +244,9 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl<RzRestaurantS
|
||||
private void create(Long staffId, Long deptId, String name, Date date){
|
||||
RzRestaurantStatistics rzRestaurantStatistics = getBaseMapper().selectRzRestaurantStatisticsByUserIdAndDate(staffId,date);
|
||||
if(StringUtils.isNotNull(rzRestaurantStatistics)){
|
||||
if(rzRestaurantStatistics.getDeptId() == null){
|
||||
//if(rzRestaurantStatistics.getDeptId() == null){
|
||||
rzRestaurantStatistics.setDeptId(deptId);
|
||||
}
|
||||
//}
|
||||
rzRestaurantStatistics.setName(name);
|
||||
getBaseMapper().updateRzRestaurantStatistics(rzRestaurantStatistics);
|
||||
return;
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
package com.evo.system.controller;
|
||||
|
||||
import com.evo.system.domain.vo.StaffNameDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import javax.annotation.Resource;
|
||||
import com.evo.system.service.ISysStaffService;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.evo.attendance.domain.vo.RzSalaryVo;
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.annotation.RepeatSubmit;
|
||||
@ -10,15 +15,14 @@ import com.evo.common.enums.BusinessType;
|
||||
import com.evo.common.utils.poi.ExcelUtil;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
import com.evo.system.domain.vo.SysStaffVo;
|
||||
import com.evo.system.service.ISysStaffService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
|
||||
/**
|
||||
* 员工管理Controller
|
||||
@ -33,6 +37,12 @@ public class SysStaffController extends BaseController
|
||||
@Resource
|
||||
private ISysStaffService sysStaffService;
|
||||
|
||||
@PostMapping("/checkName")
|
||||
public AjaxResult checkStaffName(@RequestBody StaffNameDTO dto) {
|
||||
boolean repeat = sysStaffService.checkNameRepeat(dto.getId(), dto.getName());
|
||||
return AjaxResult.success(repeat);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询员工管理列表
|
||||
*/
|
||||
|
||||
@ -9,7 +9,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
import com.evo.system.domain.vo.StaffNameDTO;
|
||||
/**
|
||||
* 员工管理Service接口
|
||||
*
|
||||
@ -24,6 +24,13 @@ public interface ISysStaffService extends IService<SysStaff>
|
||||
* @param userId 员工管理主键
|
||||
* @return 员工管理
|
||||
*/
|
||||
/**
|
||||
* 校验员工名称是否重复
|
||||
* @param id 员工主键ID,新增时传null
|
||||
* @param name 员工姓名
|
||||
* @return true 名称重复,false 名称可用
|
||||
*/
|
||||
boolean checkNameRepeat(Long id, String name);
|
||||
public SysStaff selectSysStaffByUserId(Long userId);
|
||||
/**
|
||||
* 查询员工管理列表
|
||||
@ -137,4 +144,11 @@ public interface ISysStaffService extends IService<SysStaff>
|
||||
public void sysStaffLeaveByDingUserId(String dingUserId);
|
||||
|
||||
AjaxResult getDingUserId(String userName);
|
||||
/**
|
||||
* 校验员工姓名是否重复(包含在职、离职全部员工,全局唯一)
|
||||
* @param userId 当前员工主键,新增传null,编辑传员工userId
|
||||
* @param name 待校验姓名
|
||||
* @return true=存在重名;false=无重名
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@ import com.evo.finance.service.IRzSalaryDetailService;
|
||||
import com.evo.kingdeeUtils.KingdeeRequestUtils;
|
||||
import com.evo.kingdeeUtils.kenum.KingdeeParamsEnum;
|
||||
import com.evo.personnelMatters.domain.RzSubsidyInfo;
|
||||
import com.evo.personnelMatters.mapper.RzLeaveMapper;
|
||||
import com.evo.personnelMatters.mapper.RzSubsidyInfoMapper;
|
||||
import com.evo.restaurant.service.IRzRestaurantStatisticsService;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
@ -90,6 +91,18 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
private RzSubsidyInfoMapper rzSubsidyInfoMapper;
|
||||
@Resource
|
||||
IRzSalaryDetailService rzSalaryDetailService;
|
||||
@Resource
|
||||
private RzLeaveMapper rzLeaveMapper;
|
||||
@Override
|
||||
public boolean checkNameRepeat(Long userId, String name) {
|
||||
LambdaQueryWrapper<SysStaff> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysStaff::getName, name.trim());
|
||||
// 编辑时排除自身员工
|
||||
if(userId != null){
|
||||
wrapper.ne(SysStaff::getUserId, userId);
|
||||
}
|
||||
return this.count(wrapper) > 0;
|
||||
}
|
||||
/**
|
||||
* 查询员工管理
|
||||
*
|
||||
@ -131,6 +144,10 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
@Transactional
|
||||
public AjaxResult insertSysStaff(SysStaff sysStaff)
|
||||
{
|
||||
boolean repeat = checkNameRepeat(null, sysStaff.getName());
|
||||
if(repeat){
|
||||
return AjaxResult.error("姓名【"+sysStaff.getName()+"】已存在,所有员工(含离职)不可重名");
|
||||
}
|
||||
//根据省份证号查询是否已经录入
|
||||
SysStaff p_staff = getBaseMapper().queryysStaffByIdCard(sysStaff.getIdCard());
|
||||
if(StringUtils.isNotNull(p_staff)){
|
||||
@ -359,7 +376,10 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
@Transactional
|
||||
public AjaxResult updateSysStaff(SysStaff sysStaff)
|
||||
{
|
||||
|
||||
boolean repeat = checkNameRepeat(sysStaff.getUserId(), sysStaff.getName());
|
||||
if(repeat){
|
||||
return AjaxResult.error("姓名【"+sysStaff.getName()+"】已存在,所有员工(含离职)不可重名");
|
||||
}
|
||||
if(StringUtils.isNotEmpty(sysStaff.getSource()) && sysStaff.getSource().equals(Constants.SOURCE_DING) && StringUtils.isEmpty(sysStaff.getSex())){
|
||||
//根据省份证确定性别和年龄
|
||||
sysStaff.setAge(Long.parseLong(new SimpleDateFormat("yyyy").format(new Date())) - Long.parseLong(sysStaff.getIdCard().substring(6,10)));
|
||||
@ -465,6 +485,11 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
sysStaffDetail.setTotalWages(DataUtils.DEFAULT_VALUE);
|
||||
sysStaffDetail.setAggregatePersonalIncomeTax(DataUtils.DEFAULT_VALUE);
|
||||
sysStaffDetailMapper.updateById(sysStaffDetail);
|
||||
}
|
||||
//判断是否修改部门
|
||||
if(!old_staff.getDeptId().equals(sysStaff.getDeptId())) {
|
||||
//请假数据处理
|
||||
rzLeaveMapper.updateDeptIdByStaffId(sysStaff.getDeptId(), sysStaff.getUserId());
|
||||
}
|
||||
//如果是部门负责人, 修改部门领导信息
|
||||
if("是".equals(sysStaff.getIsLeader())){
|
||||
@ -491,6 +516,7 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, DateUtils.getNowDate());
|
||||
//处理考勤机相关信息
|
||||
initCheckDevice(sysStaff);
|
||||
|
||||
// }
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ spring:
|
||||
# 热部署开关
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
host: 192.168.5.232
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
|
||||
@ -121,5 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where del_flag = '0' and user_id = #{userId} order by create_time desc limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateDeptIdByStaffId" >
|
||||
update rz_leave set dept_id=#{deptId} where user_id = #{userId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user