Commit 753db303 authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent 1779533d
......@@ -17,6 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.archives.entity;
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 com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
......@@ -64,13 +65,13 @@ public class TEmpChangeInfo extends BaseEntity {
/**
* 原结算主体
*/
@Schema(description ="原结算主体")
@Schema(description ="原项目名称")
private String oldSettle;
/**
* 新结算主体
*/
@Schema(description ="新结算主体")
@Schema(description ="新项目名称")
private String newSettle;
/**
......@@ -91,4 +92,24 @@ public class TEmpChangeInfo extends BaseEntity {
@Schema(description ="划转起始月")
private String changeStartMonth;
/**
* 结算主体id
*/
@Schema(description ="结算主体id")
@TableField(exist = false)
private String departId;
/**
* 客户id
*/
@Schema(description ="客户id")
@TableField(exist = false)
private String customerId;
/**
* 身份证号码
*/
@Schema(description ="身份证号码")
private String empIdcard;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 档案划转日志表
*
* @author huyc
* @date 2022-06-22
*/
@Data
@ColumnWidth(30)
public class TEmpChangeInfoVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 员工姓名
*/
@NotNull(message = "员工姓名不可为空")
@ExcelProperty(value ="员工姓名")
private String empName;
/**
* 身份证号
*/
@NotNull(message = "身份证号不可为空")
@ExcelProperty(value ="身份证号")
private String empIdcard;
/**
* 原项目编码
*/
@ExcelProperty(value ="原项目编码")
private String oldSettleCode;
/**
* 新项目编码
*/
@ExcelProperty(value ="新项目编码")
private String newSettleCode;
/**
* 已产生未结算费用 0:划转 1:不划转
*/
@ExcelProperty(value ="已产生未结算费用")
private String unsettleDeal;
/**
* 划转起始月
*/
@ExcelProperty(value ="划转起始月")
private String changeStartMonth;
}
......@@ -19,16 +19,31 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpChangeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.service.TCustomerInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpChangeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpChangeInfoVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 档案划转日志表
......@@ -44,6 +59,10 @@ public class TEmpChangeInfoController {
private final TEmpChangeInfoService tEmpChangeInfoService;
private final TCustomerInfoService tCustomerInfoService;
private final TSettleDomainService tSettleDomainService;
/**
* 分页查询
* @param page 分页对象
......@@ -109,4 +128,65 @@ public class TEmpChangeInfoController {
return R.ok(tEmpChangeInfoService.removeById(id));
}
/**
* 获取所有项目名称
* @return R
* @Author huyc
* @Date 2022-06-22
*/
@Operation(summary = "获取所有项目名称", description = "获取所有项目名称")
@SysLog("获取所有项目名称" )
@GetMapping("/getAllDept" )
public R<Map<String,Object>> getAllDept() {
List<TSettleDomain> list = tSettleDomainService.list(Wrappers.<TSettleDomain>query().lambda().eq(TSettleDomain::getDeleteFlag, CommonConstants.STATUS_NORMAL));
Map<String,Object> map = new HashMap<>();
map = list.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v.getDepartName()), HashMap::putAll);
return R.ok(map);
}
/**
* 获取所有单位名称
* @return R
* @Author huyc
* @Date 2022-06-22
*/
@Operation(summary = "获取所有单位名称", description = "获取所有单位名称")
@SysLog("获取所有单位名称" )
@GetMapping("/getAllUint" )
public R<Map<String,Object>> getAllUint() {
List<TCustomerInfo> list = tCustomerInfoService.list(Wrappers.<TCustomerInfo>query().lambda().eq(TCustomerInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
Map<String,Object> map = new HashMap<>();
map = list.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v.getCustomerName()), HashMap::putAll);
return R.ok(map);
}
/**
* 员工档案划转
* @return R
* @Author huyc
* @Date 2022-06-22
*/
@Operation(summary = "员工档案划转", description = "员工档案划转")
@SysLog("员工档案划转" )
@PostMapping("/empProArcChange" )
@PreAuthorize("@pms.hasPermission('archives_tempchangeinfo_change')")
public R empProArcChange(@RequestBody TEmpChangeInfo tEmpChangeInfo) {
return tEmpChangeInfoService.changeEmpProArc(tEmpChangeInfo);
}
/**
* 批量划转员工档案
* @return R
* @Author huyc
* @Date 2022-06-22
*/
@Operation(summary = "批量划转员工档案", description = "批量划转员工档案")
@SysLog("批量划转员工档案" )
@PostMapping("/batchChangeArc" )
@PreAuthorize("@pms.hasPermission('archives_tempchangeinfo_batchchange')")
public R<List<ErrorMessage>> batchChangeArc(@RequestExcel List<TEmpChangeInfoVO> excelVOList, BindingResult bindingResult) {
return tEmpChangeInfoService.batchChangeArc(excelVOList,bindingResult);
}
}
......@@ -214,7 +214,7 @@ public class TEmployeeProjectController {
@Operation(summary = "通过id批量删除项目档案", description = "通过id批量删除项目档案")
@SysLog("通过id批量删除项目档案" )
@PostMapping("/{ids}" )
// @PreAuthorize("@pms.hasPermission('archives_temployeeproject_batchdel')" )
@PreAuthorize("@pms.hasPermission('archives_temployeeproject_batchdel')" )
public R<List<ErrorMessage>> removeByIds(@RequestParam String ids) {
return tEmployeeProjectService.batchRemoveByIds(ids);
}
......
......@@ -18,7 +18,13 @@
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpChangeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpChangeInfoVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
import java.util.List;
/**
* 档案划转日志表
......@@ -28,4 +34,18 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpChangeInfo;
*/
public interface TEmpChangeInfoService extends IService<TEmpChangeInfo> {
/**
* @Author huyc
* @Description 档案划转
* @Date 2022/6/22
**/
R changeEmpProArc(TEmpChangeInfo tEmpChangeInfo);
/**
* @Author huyc
* @Description 批量化转员工档案
* @Date 2022/6/22
**/
R<List<ErrorMessage>> batchChangeArc(List<TEmpChangeInfoVO> excelVOList, BindingResult bindingResult);
}
......@@ -16,11 +16,25 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpChangeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpChangeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpChangeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpChangeInfoVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult;
import java.util.*;
/**
* 档案划转日志表
......@@ -31,4 +45,69 @@ import org.springframework.stereotype.Service;
@Service
public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper, TEmpChangeInfo> implements TEmpChangeInfoService {
private TEmployeeProjectService tEmployeeProjectService;
/**
* @Author huyc
* @Description 档案划转
* @Date 2022/6/22
**/
@Override
public R changeEmpProArc(TEmpChangeInfo tEmpChangeInfo) {
//待划转员工已在目标结算主体下不可划转
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmpChangeInfo.getEmpIdcard()).eq(TEmployeeProject::getDeptId,tEmpChangeInfo.getDepartId())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tEmployeeProject)) {
return R.failed("待划转员工已在目标项目下不可划转");
}
//TODO
//划转+已产生未结算金额划转,并且选择了划转月份
//社保公积金派单处需要直接修改为最新的项目
//社保预估库、缴费库、对比库、代理差额库,需要同步修改未结算(并且满足这个条件:数据 生成月≥此处划转起始月)的数据,已结算数据不变更;
//保存档案划转记录
this.save(tEmpChangeInfo);
return R.ok();
}
@Override
public R<List<ErrorMessage>> batchChangeArc(List<TEmpChangeInfoVO> excelVOList, BindingResult bindingResult) {
// 通用校验获取失败的数据
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
Map<Long,ErrorMessage> errorMsgMap = new HashMap<>();
if (Common.isNotNull(errorMessageList)){
errorMessageList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(),errorMessage));
}
Set<String> errorMsg;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
if (Common.isNotNull(errorMsgMap.get(i+2))){
continue;
}
errorMsg = new HashSet<>();
TEmpChangeInfoVO excel = excelVOList.get(i);
//待划转员工已在目标结算主体下不可划转
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard()).eq(TEmployeeProject::getDeptNo,excel.getNewSettleCode())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tEmployeeProject)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.CHECKS_CHANGE_EMP_PROJECT, excel.getNewSettleCode()));
}
// 数据合法情况
if (CollUtil.isEmpty(errorMsg)) {
} else {
// 数据不合法
errorMessageList.add(new ErrorMessage((long) (i + 2), errorMsg));
}
}
if (CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList);
}
return R.ok();
}
}
......@@ -425,7 +425,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
delProject.setDeleteFlag(CommonConstants.ONE_STRING);
baseMapper.updateById(delProject);
}else {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_FAMILY_NAME_EXISTING));
errorMsg.add(MsgUtils.getMessage(ErrorCodes.CHECKS_PROJECT_DELETE_ERROR));
errorList.add(new ErrorMessage((long) i, errorMsg));
}
} catch (Exception e) {
......
......@@ -26,6 +26,7 @@
<resultMap id="tEmpChangeInfoMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpChangeInfo">
<id property="id" column="ID"/>
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="oldDept" column="OLD_DEPT"/>
<result property="newDept" column="NEW_DEPT"/>
<result property="oldSettle" column="OLD_SETTLE"/>
......
......@@ -230,4 +230,8 @@ public interface ErrorCodes {
* 已存在对应身份证的证书信息
*/
String ARCHIVES_EMP_CERTIFICATE_NAME_EXISTING = "archives.emp.certificate.name.existing";
/**
* 待划转员工已在目标项目下不可划转
*/
String CHECKS_CHANGE_EMP_PROJECT = "checks.change.emp.project";
}
......@@ -61,7 +61,9 @@ checks.reduce.project.error=\u5B58\u5728\u5DF2\u51CF\u9879\u7684\u9879\u76EE\uFF
checks.emp.exit.error=\u4EBA\u5458\u4E0D\u5728\u8BE5\u9879\u76EE\uFF0C\u65E0\u6CD5\u66F4\u65B0
checks.project.delete.error=\u9879\u76EE\u6863\u6848\u72B6\u6001\u4E3A\u5DF2\u5BA1\u6838\uFF0C\u7981\u6B62\u5220\u9664
archives.emp.certificate.name.existing=ARCHIVES_EMP_CERTIFICATE_NAME_EXISTING
archives.emp.certificate.name.existing=\u5DF2\u5B58\u5728\u5BF9\u5E94\u8EAB\u4EFD\u8BC1\u7684\u8BC1\u4E66\u4FE1\u606F
checks.change.emp.project=\u5F85\u5212\u8F6C\u5458\u5DE5\u5DF2\u5728\u76EE\u6807\u9879\u76EE\u4E0B\u4E0D\u53EF\u5212\u8F6C
......
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