重新入职接口
This commit is contained in:
parent
4e3a045a42
commit
071ca3c40a
@ -3,6 +3,7 @@ package com.evo.common.controller;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.evo.attendance.domain.RzAttendance;
|
||||
import com.evo.attendance.domain.RzAttendanceDetail;
|
||||
import com.evo.attendance.processor.KqUtils;
|
||||
import com.evo.attendance.service.IRzAttendanceService;
|
||||
import com.evo.attendance.service.IRzAttendanceStatisticalService;
|
||||
import com.evo.attendance.service.RzAttendanceDetailService;
|
||||
@ -10,6 +11,8 @@ import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.utils.Collections;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.personnelMatters.domain.RzOverTime;
|
||||
import com.evo.personnelMatters.domain.RzOverTimeDetail;
|
||||
import com.evo.personnelMatters.mapper.RzOverTimeDetailMapper;
|
||||
import com.evo.personnelMatters.mapper.RzOverTimeMapper;
|
||||
import com.evo.restaurant.service.IRzRestaurantStatisticsService;
|
||||
@ -23,6 +26,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@ -190,44 +197,84 @@ public class TestController {
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String dids = "41676," +
|
||||
"41677," +
|
||||
"41715," +
|
||||
"41824," +
|
||||
"41747," +
|
||||
"41748," +
|
||||
"41703," +
|
||||
"42086," +
|
||||
"41801," +
|
||||
"41817," +
|
||||
"41674," +
|
||||
"41680," +
|
||||
"41772," +
|
||||
"41774," +
|
||||
"41820," +
|
||||
"41822," +
|
||||
"41711," +
|
||||
"41830," +
|
||||
"41684," +
|
||||
"42023," +
|
||||
"41821," +
|
||||
"41840," +
|
||||
"41754," +
|
||||
"41962," +
|
||||
"41688," +
|
||||
"41951";
|
||||
StringBuilder d = new StringBuilder("");
|
||||
for (int i = 0; i < Collections.asList(dids.split(",")).size(); i++) {
|
||||
if(i%2 > 0){
|
||||
d.append("'"+dids.split(",")[i]+"'").append(",");
|
||||
}
|
||||
}
|
||||
System.out.println(d.toString());
|
||||
|
||||
@PostMapping("/jb")
|
||||
public AjaxResult jb() throws Exception{
|
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(new File("D:\\andy\\文档\\考勤\\7月8号加班数据清洗.txt")));
|
||||
String line = reader.readLine();
|
||||
while (line != null) {
|
||||
String[] info = line.split("-");
|
||||
RzAttendanceDetail detail = rzAttendanceDetailService.getOne(new LambdaQueryWrapper<RzAttendanceDetail>()
|
||||
.eq(RzAttendanceDetail::getDelFlag, Constants.DELETE_FLAG_0)
|
||||
.eq(RzAttendanceDetail::getName, info[0])
|
||||
.eq(RzAttendanceDetail::getButtonType,"下班卡")
|
||||
.apply(" DATE_FORMAT(date_time,'%Y%m%d') = DATE_FORMAT({0},'%Y%m%d') ", "2025-07-08"));
|
||||
|
||||
RzAttendance attendance= rzAttendanceService.getOne(new LambdaQueryWrapper<RzAttendance>()
|
||||
.eq(RzAttendance::getDelFlag, Constants.DELETE_FLAG_0)
|
||||
.eq(RzAttendance::getName, info[0])
|
||||
.eq(RzAttendance::getAttendanceDate, "2025-07-08")
|
||||
);
|
||||
System.out.println(info[0]);
|
||||
SysStaff sysStaff = sysStaffService.getById(detail.getStaffId());
|
||||
RzOverTime rzOverTime = rzOverTimeMapper.selectRzOverTimeByNameAndMonth(sysStaff.getUserId(),detail.getDateTime());
|
||||
if(rzOverTime == null){
|
||||
rzOverTime = new RzOverTime();
|
||||
rzOverTime.setUserId(sysStaff.getUserId());
|
||||
rzOverTime.setOverHours(new BigDecimal("0.0"));
|
||||
rzOverTime.setDeptId(sysStaff.getDeptId());
|
||||
rzOverTime.setName(sysStaff.getName());
|
||||
rzOverTime.setOverTimeMonth(detail.getDateTime());
|
||||
rzOverTimeMapper.insert(rzOverTime);
|
||||
}
|
||||
|
||||
detail = rzAttendanceDetailService.addDetail(attendance, "加班卡", detail.getEquipmentCode(), com.evo.common.utils.DateUtils.addSeconds(detail.getDateTime(), 10), "数据清洗");
|
||||
RzOverTimeDetail rzOverTimeDetail = new RzOverTimeDetail();
|
||||
rzOverTimeDetail.setOverTimeId(rzOverTime.getId());
|
||||
rzOverTimeDetail.setOverTimeStart(detail.getDateTime());
|
||||
rzOverTimeDetail.setName(sysStaff.getName());
|
||||
rzOverTimeDetail.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
rzOverTimeDetail.setCreateBy("admin");
|
||||
rzOverTimeDetail.setCreateTime(com.evo.common.utils.DateUtils.getNowDate());
|
||||
|
||||
detail = rzAttendanceDetailService.addDetail(attendance, "下班卡", detail.getEquipmentCode(), com.evo.common.utils.DateUtils.addMinutes(detail.getDateTime(), new BigDecimal(info[1]).multiply(new BigDecimal(60)).add(new BigDecimal(30)).intValue()), "数据清洗");
|
||||
rzOverTimeDetail.setOverTimeEnd(detail.getDateTime());
|
||||
rzOverTimeDetailMapper.insert(rzOverTimeDetail);
|
||||
KqUtils.calculateOverTimeHours(rzOverTimeDetail, sysStaff.getUserId(), sysStaff.getTimeClock());
|
||||
rzOverTimeDetailMapper.updateRzOverTimeDetail(rzOverTimeDetail);
|
||||
//加班修改统计
|
||||
rzOverTime.setOverHours(rzOverTime.getOverHours().add(rzOverTimeDetail.getOverTimeHours()));
|
||||
rzOverTimeMapper.updateRzOverTime(rzOverTime);
|
||||
line = reader.readLine();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(new File("D:\\andy\\文档\\考勤\\岗位任职部门信息.txt")));
|
||||
String line = reader.readLine();
|
||||
while (line != null) {
|
||||
String[] configData = line.split("_");
|
||||
System.out.println("update sys_dict_data set dict_value='"+line+"' where dict_value='"+configData[0]+"';\n");
|
||||
line = reader.readLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -25,6 +25,8 @@ import java.util.stream.Collectors;
|
||||
public class SysStaffExcelFieldHandlerAdapter implements ExcelFieldHandlerAdapter {
|
||||
@Override
|
||||
public List<String> buildExcel() {
|
||||
return SpringUtils.getBean(RzSubsidyInfoMapper.class).selectList(new LambdaQueryWrapper<RzSubsidyInfo>().eq(RzSubsidyInfo::getDelFlag, Constants.DELETE_FLAG_0)).stream().map(RzSubsidyInfo::getName).collect(Collectors.toList());
|
||||
List<String> titles = SpringUtils.getBean(RzSubsidyInfoMapper.class).selectList(new LambdaQueryWrapper<RzSubsidyInfo>().eq(RzSubsidyInfo::getDelFlag, Constants.DELETE_FLAG_0)).stream().map(RzSubsidyInfo::getName).collect(Collectors.toList());
|
||||
titles.add("学历补助");
|
||||
return titles;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,24 +1,23 @@
|
||||
package com.evo.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.evo.attendance.domain.vo.RzSalaryVo;
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
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.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.common.utils.poi.ExcelUtil;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 员工管理Controller
|
||||
*
|
||||
@ -53,8 +52,6 @@ public class SysStaffController extends BaseController
|
||||
public void export(HttpServletResponse response, SysStaff sysStaff)
|
||||
{
|
||||
sysStaffService.exportInfo(response, sysStaff);
|
||||
// ExcelUtil<SysStaff> util = new ExcelUtil<SysStaff>(SysStaff.class);
|
||||
// util.exportExcel(response, list, "员工管理数据");
|
||||
}
|
||||
/**
|
||||
* 导出员工详情
|
||||
@ -63,11 +60,7 @@ public class SysStaffController extends BaseController
|
||||
@PostMapping("/exportDetail")
|
||||
public void exportDetail(HttpServletResponse response, SysStaff sysStaff)
|
||||
{
|
||||
|
||||
sysStaffService.exportInfo(response, sysStaff);
|
||||
// List<SysStaffVo> list = sysStaffService.selectSysStaffDetailList(sysStaff);
|
||||
// ExcelUtil<SysStaffVo> util = new ExcelUtil<SysStaffVo>(SysStaffVo.class);
|
||||
// util.exportExcel(response, list, "员工详情数据");
|
||||
}
|
||||
/**
|
||||
* 获取员工管理详细信息
|
||||
@ -177,4 +170,16 @@ public class SysStaffController extends BaseController
|
||||
List<RzSalaryVo> attendanceList = util.importExcel(file.getInputStream());
|
||||
return success(sysStaffService.importSalesCommissions(attendanceList));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 离职员工重新入职
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:staff:reEmployment')")
|
||||
@Log(title = "员工管理-离职员工重新入职", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/reEmployment/{userId}")
|
||||
public AjaxResult reEmployment(@PathVariable Long userId) throws Exception
|
||||
{
|
||||
return sysStaffService.reEmployment(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,6 +101,13 @@ public interface ISysStaffService extends IService<SysStaff>
|
||||
SysStaff selectByDepId(Long deptId);
|
||||
|
||||
AjaxResult importSalesCommissions(List<RzSalaryVo> attendanceList);
|
||||
/***
|
||||
* 重新入职
|
||||
* @param userId 重新入职员工Id
|
||||
*/
|
||||
AjaxResult reEmployment(Long userId);
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* 数据导出
|
||||
|
||||
@ -13,7 +13,6 @@ import com.evo.common.core.domain.entity.SysDictData;
|
||||
import com.evo.common.utils.*;
|
||||
import com.evo.common.utils.Collections;
|
||||
import com.evo.common.utils.bean.BeanUtils;
|
||||
import com.evo.common.utils.poi.ExcelUtil;
|
||||
import com.evo.common.utils.poi.ExcelUtil1;
|
||||
import com.evo.equipment.service.IEqSnDetailService;
|
||||
import com.evo.kingdeeUtils.KingdeeRequestUtils;
|
||||
@ -43,7 +42,8 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@ -159,8 +159,9 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
//处理考勤机相关信息
|
||||
initCheckDevice(sysStaff);
|
||||
//新增员工信息到金蝶
|
||||
KingdeeRequestUtils.employeeSave(Collections.asMap("FName", sysStaff.getName(), "FStaffNumber", sysStaff.getCode(), "FNumber", sysStaff.getJobCode().split("_")[0]));
|
||||
|
||||
if(StringUtils.isNotEmpty(sysStaff.getJobCode())){
|
||||
KingdeeRequestUtils.employeeSave(Collections.asMap("FName", sysStaff.getName(), "FStaffNumber", sysStaff.getCode(), "FNumber", sysStaff.getJobCode().split("_")[0]));
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ -249,8 +250,16 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
//根据员工ID查询原来的数据信息
|
||||
SysStaff old_staff = getBaseMapper().selectSysStaffByUserId(sysStaff.getUserId());
|
||||
//检查是否修改岗位
|
||||
if(!old_staff.getJobCode().equals(sysStaff.getJobCode())) {
|
||||
KingdeeRequestUtils.updateJobInfo(Collections.asMap("NeedUpDateFields","\"FDept\",\"FPosition\"", "FNumber", sysStaff.getCode(), "FDept_FNumber", sysStaff.getJobCode().split("_")[1], "FPosition_FNumber", sysStaff.getJobCode().split("_")[0]));
|
||||
if(StringUtils.isEmpty(old_staff.getJobCode()) && StringUtils.isNotEmpty(sysStaff.getJobCode()) ||
|
||||
StringUtils.isNotEmpty(old_staff.getJobCode()) && StringUtils.isEmpty(sysStaff.getJobCode()) ||
|
||||
StringUtils.isNotEmpty(old_staff.getJobCode()) && StringUtils.isNotEmpty(sysStaff.getJobCode()) && !old_staff.getJobCode().equals(sysStaff.getJobCode())) {
|
||||
String deptNum = "";
|
||||
String positionNum = "";
|
||||
if(StringUtils.isNotEmpty(sysStaff.getJobCode())){
|
||||
deptNum = sysStaff.getJobCode().split("_")[1];
|
||||
positionNum = sysStaff.getJobCode().split("_")[0];
|
||||
}
|
||||
KingdeeRequestUtils.updateJobInfo(Collections.asMap("NeedUpDateFields","FDept,FPosition", "FNumber", sysStaff.getCode(), "FDept_FNumber", deptNum, "FPosition_FNumber", positionNum));
|
||||
}
|
||||
//判断员工更换公司
|
||||
if(!old_staff.getCompanyName().equals(sysStaff.getCompanyName())) {
|
||||
@ -722,6 +731,24 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult reEmployment(Long userId) {
|
||||
try {
|
||||
SysStaff sysStaff = getBaseMapper().selectById(userId);
|
||||
sysStaff.setStatus(Constants.JOB_STATIS_1);
|
||||
getBaseMapper().updateSysStaff(sysStaff);
|
||||
//打卡统计,打卡详情
|
||||
rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null);
|
||||
//处理餐饮信息
|
||||
rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, DateUtils.getNowDate());
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
return AjaxResult.error("重新入职失败"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportInfo(HttpServletResponse response, SysStaff sysStaff) {
|
||||
List<SysStaffVo> res_list = new ArrayList<SysStaffVo>();
|
||||
@ -730,7 +757,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
List<Long> userIds = yg_list.stream().map(SysStaff::getUserId).collect(Collectors.toList());
|
||||
Map<Long, SysStaffDetail> detailMap = sysStaffDetailMapper.selectList(new LambdaQueryWrapper<SysStaffDetail>().eq(SysStaffDetail::getDelFlag, Constants.DELETE_FLAG_0).in(SysStaffDetail::getStaffId,userIds)).stream().collect(Collectors.toMap(SysStaffDetail::getStaffId, v->v));
|
||||
List<RzSubsidyInfo> subsidyList = rzSubsidyInfoMapper.selectList(new LambdaQueryWrapper<RzSubsidyInfo>());
|
||||
Map<Long, String> subsidyMap = rzSubsidyInfoMapper.selectList(new LambdaQueryWrapper<RzSubsidyInfo>()).stream().collect(Collectors.toMap(RzSubsidyInfo::getId, RzSubsidyInfo::getName));
|
||||
|
||||
for (SysStaff staff : yg_list) {
|
||||
SysStaffVo sysStaffVo = new SysStaffVo();
|
||||
@ -738,29 +764,10 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
//根据员工信息查询详情信息
|
||||
SysStaffDetail sysStaffDetail = SubsidyCalculationUtils.subsidyCalculation(staff,detailMap.get(staff.getUserId()), subsidyList);
|
||||
BeanUtils.copyProperties(sysStaffDetail,sysStaffVo);
|
||||
// StringBuilder subsidyInfo = new StringBuilder("");
|
||||
// for (String key : sysStaffDetail.getExtendeds().keySet()){
|
||||
// subsidyInfo.append(key).append("-").append(sysStaffDetail.getExtendeds().get(key)).append("元,");
|
||||
// }
|
||||
// sysStaffVo.setSubsidyInfo(subsidyInfo.toString());
|
||||
sysStaffVo.setSubsidyMap(sysStaffDetail.getExtendeds());
|
||||
res_list.add(sysStaffVo);
|
||||
}
|
||||
ExcelUtil1<SysStaffVo> util = new ExcelUtil1<SysStaffVo>(SysStaffVo.class);
|
||||
util.exportExcel(response, res_list, "员工信息");
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(new File("D:\\andy\\文档\\考勤\\岗位任职部门信息.txt")));
|
||||
String line = reader.readLine();
|
||||
while (line != null) {
|
||||
String[] configData = line.split("_");
|
||||
System.out.println("update sys_dict_data set dict_value='"+line+"' where dict_value='"+configData[0]+"';\n");
|
||||
line = reader.readLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user