调整更换公司问题
This commit is contained in:
parent
e75014aaa7
commit
61848a4a82
@ -35,7 +35,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
@ -96,9 +95,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
public List<SysStaff> selectSysStaffList(SysStaff sysStaff)
|
||||
{
|
||||
List<SysStaff> res_list = getBaseMapper().selectSysStaffList(sysStaff);
|
||||
// for (SysStaff staff : res_list) {
|
||||
// staff.setDeptName(deptMapper.selectDeptById(staff.getDeptId()).getDeptName());
|
||||
// }
|
||||
return res_list;
|
||||
}
|
||||
/**
|
||||
@ -204,30 +200,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建餐饮统计
|
||||
* @param sysStaff
|
||||
*/
|
||||
// private void createRestaurantStatistics(SysStaff sysStaff){
|
||||
// RzRestaurantStatistics rzRestaurantStatistics = rzRestaurantStatisticsMapper.selectRzRestaurantStatisticsByUserIdAndDate(sysStaff.getUserId(),DateUtils.getNowDate());
|
||||
// if(StringUtils.isNotNull(rzRestaurantStatistics)){
|
||||
// rzRestaurantStatistics.setCompanyName(sysStaff.getCompanyName());
|
||||
// rzRestaurantStatistics.setDeptId(sysStaff.getDeptId());
|
||||
// rzRestaurantStatistics.setName(sysStaff.getName());
|
||||
// rzRestaurantStatisticsMapper.updateRzRestaurantStatistics(rzRestaurantStatistics);
|
||||
// return;
|
||||
// }
|
||||
// rzRestaurantStatistics = new RzRestaurantStatistics();
|
||||
// rzRestaurantStatistics.setName(sysStaff.getName());
|
||||
// rzRestaurantStatistics.setCompanyName(sysStaff.getCompanyName());
|
||||
// rzRestaurantStatistics.setDeptId(sysStaff.getDeptId());
|
||||
// rzRestaurantStatistics.setStaffId(sysStaff.getUserId());
|
||||
// rzRestaurantStatistics.setMonth(DateUtils.getNowDate());
|
||||
// rzRestaurantStatistics.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
// rzRestaurantStatistics.setCreateBy(SecurityUtils.getUsername());
|
||||
// rzRestaurantStatistics.setCreateTime(DateUtils.getNowDate());
|
||||
// rzRestaurantStatisticsMapper.insertRzRestaurantStatistics(rzRestaurantStatistics);
|
||||
// }
|
||||
/**
|
||||
* 修改员工管理
|
||||
*
|
||||
@ -254,17 +226,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
//判断转正日期
|
||||
/*if(StringUtils.isNotNull(sysStaff.getRegularDate())){
|
||||
//离职时间小于当前,说明离职了
|
||||
if(sysStaff.getRegularDate().getTime() < DateUtils.getNowDate().getTime()){
|
||||
sysStaff.setStatus("1");
|
||||
int i = getBaseMapper().updateSysStaff(sysStaff);
|
||||
if(i < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//根据省份证确定性别和年龄
|
||||
Long year = Long.parseLong(sysStaff.getIdCard().substring(6,10));
|
||||
Long age = Long.parseLong(new SimpleDateFormat("yyyy").format(new Date())) - year;
|
||||
@ -278,16 +239,13 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
SysStaff old_staff = getBaseMapper().selectSysStaffByUserId(sysStaff.getUserId());
|
||||
//判断员工更换公司
|
||||
if(!old_staff.getCompanyName().equals(sysStaff.getCompanyName())) {
|
||||
sysStaff.setCode(getCodeByCompanyName(sysStaff.getCompanyName()));
|
||||
SysStaffDetail sysStaffDetail = sysStaffDetailMapper.selectSysStaffDetailByStaffId(sysStaff.getUserId());
|
||||
sysStaffDetail.setSpecialDeduction(DataUtils.DEFAULT_VALUE);
|
||||
sysStaffDetail.setTotalWages(DataUtils.DEFAULT_VALUE);
|
||||
sysStaffDetail.setAggregatePersonalIncomeTax(DataUtils.DEFAULT_VALUE);
|
||||
sysStaffDetailMapper.updateById(sysStaffDetail);
|
||||
}
|
||||
|
||||
// //处理新公司数据
|
||||
//// createNewStaff(sysStaff);
|
||||
// }else {
|
||||
//如果是部门负责人, 修改部门领导信息
|
||||
if("是".equals(sysStaff.getIsLeader())){
|
||||
//根据部门ID查询部门信息
|
||||
@ -308,8 +266,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
if(i < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
//修改员工详情
|
||||
// createStaffDetail(sysStaff);
|
||||
//修改考勤统计
|
||||
rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null);
|
||||
//餐饮统计
|
||||
@ -319,33 +275,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
// }
|
||||
return AjaxResult.success();
|
||||
}
|
||||
/**
|
||||
* 更换新公司的处理,创建新员工
|
||||
*/
|
||||
private void createNewStaff(SysStaff sysStaff){
|
||||
//根据身份证查询员工是否已经入职过现在的公司
|
||||
SysStaff param_staff = getBaseMapper().queryysStaffByIdCardAndDeptId(sysStaff.getIdCard(),sysStaff.getDeptId());
|
||||
if(StringUtils.isNotNull(param_staff)){
|
||||
param_staff.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
param_staff.setUpdateBy(SecurityUtils.getUsername());
|
||||
param_staff.setUpdateTime(DateUtils.getNowDate());
|
||||
getBaseMapper().updateSysStaff(param_staff);
|
||||
return;
|
||||
}
|
||||
sysStaff.setCode(getCodeByCompanyName(sysStaff.getCompanyName()));
|
||||
sysStaff.setCreateBy(SecurityUtils.getUsername());
|
||||
sysStaff.setCreateTime(DateUtils.getNowDate());
|
||||
sysStaff.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
//清除原来的ID
|
||||
sysStaff.setUserId(null);
|
||||
getBaseMapper().insertSysStaff(sysStaff);
|
||||
//添加员工详情
|
||||
createStaffDetail(sysStaff);
|
||||
//修改考勤统计
|
||||
rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null);
|
||||
//餐饮统计
|
||||
rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, DateUtils.getNowDate());
|
||||
}
|
||||
/**
|
||||
* 删除员工管理信息
|
||||
*
|
||||
@ -399,38 +328,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
} catch (IOException e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
// InputStream is = null;
|
||||
// FileOutputStream fos = null;
|
||||
// BufferedOutputStream bos = null;
|
||||
// try {
|
||||
// is = filePath.getInputStream();
|
||||
// byte[] bytes = new byte[is.available()];
|
||||
// is.read(bytes);
|
||||
// File file = new File(com.evo.equipment.constant.Constants.STAFF_FUND_ADDRESS + originalFilename);
|
||||
// fos = new FileOutputStream(file);
|
||||
// bos = new BufferedOutputStream(fos);
|
||||
// bos.write(bytes);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// } finally {
|
||||
// try {
|
||||
// if (is != null) {
|
||||
// is.close();
|
||||
// }
|
||||
// if (bos != null) {
|
||||
// bos.flush();
|
||||
// bos.close();
|
||||
// }
|
||||
// if (fos != null) {
|
||||
// fos.close();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// //写入数据库
|
||||
// writeStaffInformation(originalFilename);
|
||||
// return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
@ -453,7 +350,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
SysStaff sysStaff = null;
|
||||
SysStaffDetail staffDetail = null;
|
||||
//存储缴纳公积金人员信息
|
||||
// List<SysStaffDetail> de_list = new ArrayList<SysStaffDetail>();
|
||||
for(int p=4;p< rowNumbers;p++){
|
||||
Row row = sheet.getRow(p);
|
||||
if(StringUtils.isEmpty(row.getCell(1).getStringCellValue()) && (sheet.getRow(p+1)==null || StringUtils.isEmpty(sheet.getRow(p+1).getCell(1).getStringCellValue()))){
|
||||
@ -506,31 +402,7 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
staffDetail.setCountInsurance(BigDecimal.valueOf(row.getCell(31).getNumericCellValue()));
|
||||
}
|
||||
sysStaffDetailMapper.updateSysStaffDetail(staffDetail);
|
||||
// de_list.add(staffDetail);
|
||||
}
|
||||
// //查询公司员工
|
||||
// List<SysStaffDetail> s_list = sysStaffDetailMapper.resetSocialSecurity();
|
||||
// //修改没有公积金的员工
|
||||
// for(SysStaffDetail sysStaffDetail : s_list){
|
||||
// int flag = 0; //标识五险一金的员工 0,不存在
|
||||
// for (SysStaffDetail detail : de_list) {
|
||||
// if(sysStaffDetail.getStaffId() == detail.getStaffId()){
|
||||
// flag = 1;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if(flag == 0){
|
||||
//// sysStaffDetail.setEndowmentInsurance(new BigDecimal("0.00")); //养老
|
||||
// sysStaffDetail.setMedicalInsurance(new BigDecimal("0.00")); //医疗
|
||||
// sysStaffDetail.setUnemploymentInsurance(new BigDecimal("0.00")); //失业
|
||||
// sysStaffDetail.setEmploymentInjuryInsurance(new BigDecimal("0.00")); //工伤
|
||||
// sysStaffDetail.setMaternityInsurance(new BigDecimal("0.00")); //生育
|
||||
// sysStaffDetail.setAccumulationFund(new BigDecimal("0.00")); //公积金
|
||||
// sysStaffDetail.setDeductions(new BigDecimal("0.00"));
|
||||
// sysStaffDetail.setCountInsurance(new BigDecimal("0.00"));
|
||||
// sysStaffDetailMapper.updateSysStaffDetail(sysStaffDetail);
|
||||
// }
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
@ -548,113 +420,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 把公积金写入系统
|
||||
* @param originalFilename
|
||||
* @return
|
||||
*/
|
||||
private AjaxResult writeStaffInformation(String originalFilename){
|
||||
//在指定位置读取文件
|
||||
Workbook wb = null;
|
||||
Sheet sheet = null;
|
||||
try {
|
||||
File files = new File(com.evo.equipment.constant.Constants.STAFF_FUND_ADDRESS + originalFilename);
|
||||
if(null == files){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
wb = WorkbookFactory.create(files);
|
||||
sheet = wb.getSheetAt(0);
|
||||
//得到行数
|
||||
int rowNumbers = sheet.getLastRowNum();
|
||||
SysStaff sysStaff = null;
|
||||
SysStaffDetail staffDetail = null;
|
||||
//存储缴纳公积金人员信息
|
||||
List<SysStaffDetail> de_list = new ArrayList<SysStaffDetail>();
|
||||
for(int p=4;p< rowNumbers;p++){
|
||||
Row row = sheet.getRow(p);
|
||||
//身份证号为空,处理下一条数据
|
||||
if(StringUtils.isEmpty(row.getCell(2).getStringCellValue())){
|
||||
continue;
|
||||
}
|
||||
//根据身份证号查询员工
|
||||
sysStaff = getBaseMapper().queryysStaffByIdCard(row.getCell(2).getStringCellValue());
|
||||
//没有此员工继续下一条
|
||||
if(StringUtils.isNull(sysStaff)){
|
||||
continue;
|
||||
}
|
||||
staffDetail = sysStaffDetailMapper.selectSysStaffDetailByStaffId(sysStaff.getUserId());
|
||||
if(StringUtils.isNotNull(row.getCell(5).getNumericCellValue())){
|
||||
BigDecimal big = BigDecimal.valueOf(row.getCell(5).getNumericCellValue());
|
||||
if(StringUtils.isNotNull(row.getCell(7).getNumericCellValue())){
|
||||
big = big.add(BigDecimal.valueOf(row.getCell(7).getNumericCellValue()));
|
||||
}
|
||||
staffDetail.setEndowmentInsurance(big); //养老
|
||||
}
|
||||
if(StringUtils.isNotNull(row.getCell(10).getNumericCellValue())){
|
||||
BigDecimal big = BigDecimal.valueOf(row.getCell(10).getNumericCellValue());
|
||||
if(StringUtils.isNotNull(row.getCell(12).getNumericCellValue())){
|
||||
big = big.add(BigDecimal.valueOf(row.getCell(12).getNumericCellValue()));
|
||||
}
|
||||
staffDetail.setUnemploymentInsurance(big); //失业
|
||||
}
|
||||
if(StringUtils.isNotNull(row.getCell(15).getNumericCellValue())){
|
||||
BigDecimal big = BigDecimal.valueOf(row.getCell(15).getNumericCellValue());
|
||||
if(StringUtils.isNotNull(row.getCell(18).getNumericCellValue())){
|
||||
big = big.add(BigDecimal.valueOf(row.getCell(18).getNumericCellValue()));
|
||||
}
|
||||
staffDetail.setMedicalInsurance(big); //医疗
|
||||
}
|
||||
if(StringUtils.isNotNull(row.getCell(25).getNumericCellValue())){
|
||||
BigDecimal big = BigDecimal.valueOf(row.getCell(25).getNumericCellValue());
|
||||
if(StringUtils.isNotNull(row.getCell(27).getNumericCellValue())){
|
||||
big = big.add(BigDecimal.valueOf(row.getCell(27).getNumericCellValue()));
|
||||
}
|
||||
staffDetail.setAccumulationFund(big); //公积金
|
||||
}
|
||||
//公司缴纳保险总和
|
||||
if(StringUtils.isNotNull(row.getCell(31).getNumericCellValue())){
|
||||
staffDetail.setCountInsurance(BigDecimal.valueOf(row.getCell(31).getNumericCellValue()));
|
||||
}
|
||||
sysStaffDetailMapper.updateSysStaffDetail(staffDetail);
|
||||
de_list.add(staffDetail);
|
||||
}
|
||||
//查询公司员工
|
||||
List<SysStaffDetail> s_list = sysStaffDetailMapper.selectSysStaffDetailList(null);
|
||||
//修改没有公积金的员工
|
||||
for(SysStaffDetail sysStaffDetail : s_list){
|
||||
int flag = 0; //标识五险一金的员工 0,不存在
|
||||
for (SysStaffDetail detail : de_list) {
|
||||
if(sysStaffDetail.getStaffId() == detail.getStaffId()){
|
||||
flag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(flag == 0){
|
||||
sysStaffDetail.setEndowmentInsurance(new BigDecimal("0.00")); //养老
|
||||
sysStaffDetail.setMedicalInsurance(new BigDecimal("0.00")); //医疗
|
||||
sysStaffDetail.setUnemploymentInsurance(new BigDecimal("0.00")); //失业
|
||||
sysStaffDetail.setEmploymentInjuryInsurance(new BigDecimal("0.00")); //工伤
|
||||
sysStaffDetail.setMaternityInsurance(new BigDecimal("0.00")); //生育
|
||||
sysStaffDetail.setAccumulationFund(new BigDecimal("0.00")); //公积金
|
||||
sysStaffDetail.setDeductions(new BigDecimal("0.00"));
|
||||
sysStaffDetail.setCountInsurance(new BigDecimal("0.00"));
|
||||
sysStaffDetailMapper.updateSysStaffDetail(sysStaffDetail);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try{
|
||||
if(wb != null){
|
||||
wb.close();
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
/**
|
||||
* 查询所有的在职员工信息
|
||||
* @return
|
||||
@ -787,48 +552,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
if(i < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
//获取三餐数据
|
||||
//判断员工的住宿和工资类型填写餐补费用,住宿,早,午,晚:2,3,3
|
||||
// if("是".equals(sysStaff.getZsFlag())){
|
||||
// for (SysDictData sysDictData : cy_list) {
|
||||
// if("个人早餐".equals(sysDictData.getDictLabel())){
|
||||
// sysStaffDetail.setBreakfastExpend(new BigDecimal(sysDictData.getDictValue()));
|
||||
// }
|
||||
// if("个人午餐".equals(sysDictData.getDictLabel())){
|
||||
// sysStaffDetail.setLunchExpend(new BigDecimal(sysDictData.getDictValue()));
|
||||
// }
|
||||
// if("个人晚餐".equals(sysDictData.getDictLabel())){
|
||||
// sysStaffDetail.setSupperExpend(new BigDecimal(sysDictData.getDictValue()));
|
||||
// }
|
||||
// }
|
||||
// }else {
|
||||
// //非住宿,月工资
|
||||
// if(StringUtils.isNotNull(sysStaffDetail.getBasicSalary())){
|
||||
// for (SysDictData sysDictData : cy_list) {
|
||||
// if("早餐消费".equals(sysDictData.getDictLabel())){
|
||||
// sysStaffDetail.setBreakfastExpend(new BigDecimal(sysDictData.getDictValue()));
|
||||
// }
|
||||
// if("个人午餐".equals(sysDictData.getDictLabel())){
|
||||
// sysStaffDetail.setLunchExpend(new BigDecimal(sysDictData.getDictValue()));
|
||||
// }
|
||||
// if("个人晚餐".equals(sysDictData.getDictLabel())){
|
||||
// sysStaffDetail.setSupperExpend(new BigDecimal(sysDictData.getDictValue()));
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// for (SysDictData sysDictData : cy_list) {
|
||||
// if("早餐消费".equals(sysDictData.getDictLabel())){
|
||||
// sysStaffDetail.setBreakfastExpend(new BigDecimal(sysDictData.getDictValue()));
|
||||
// }
|
||||
// if("个人午餐".equals(sysDictData.getDictLabel())){
|
||||
// sysStaffDetail.setLunchExpend(new BigDecimal(sysDictData.getDictValue()));
|
||||
// }
|
||||
// if("晚餐消费".equals(sysDictData.getDictLabel())){
|
||||
// sysStaffDetail.setSupperExpend(new BigDecimal(sysDictData.getDictValue()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
sysStaffDetail.setStaffId(sysStaff.getUserId());
|
||||
sysStaffDetail.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
sysStaffDetail.setCreateTime(DateUtils.getNowDate());
|
||||
@ -930,42 +653,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
return getBaseMapper().queryysStaffByDeptId(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动计算工龄
|
||||
*/
|
||||
// @Override
|
||||
// public void calculationOfSeniority(){
|
||||
// //获取在职员工数据
|
||||
// List<SysStaff> params_list = getBaseMapper().selectSysStaffListAll();
|
||||
// //当前日期减去一个月计算工龄,计算工资比实际工龄延后一个月
|
||||
// Calendar calendar = Calendar.getInstance();
|
||||
// calendar.add(Calendar.MONTH, -1);
|
||||
// SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM");
|
||||
// SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// try{
|
||||
// String str = sdfm.format(calendar.getTime());
|
||||
// Date date = sdfd.parse(str + "-01");
|
||||
// for (SysStaff sysStaff : params_list) {
|
||||
// //获取入职日期,计算入职日期到当前时间差
|
||||
// int years = date.getYear() - sysStaff.getEmploymentDate().getYear();
|
||||
// int months = date.getMonth() - sysStaff.getEmploymentDate().getMonth();
|
||||
// int days = date.getDate() - sysStaff.getEmploymentDate().getDate();
|
||||
// //判断月份和日期
|
||||
// if (months < 0 || (months == 0 && days < 0)) {
|
||||
// years -= 1;
|
||||
// }
|
||||
// if(years > 0){
|
||||
// sysStaff.setSeniority(Long.valueOf(years));
|
||||
// }else{
|
||||
// sysStaff.setSeniority(0l);
|
||||
// }
|
||||
// getBaseMapper().updateSysStaff(sysStaff);
|
||||
// }
|
||||
// }catch(Exception e){
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public SysStaff selectSysStaffByName(String employeeName) {
|
||||
LambdaQueryWrapper<SysStaff> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user