Commit 9f4fbc5f authored by hongguangwu's avatar hongguangwu

MVP1.6.7-同步薪资人员信息

parent 6222166f
......@@ -452,6 +452,15 @@ public class TPreEmployeeInfo extends BaseEntity {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("计税月份")
private String taxMonth;
/**
* 计税月份是否可编辑:0否;1是(默认是)
*/
@ExcelAttribute(name = "计税月份是否可编辑", maxLength = 1)
@Length(max = 1, message = "计税月份是否可编辑不能超过6个字符")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("计税月份是否可编辑")
private String taxMonthFlag;
/**
* 封面抬头
*/
......
......@@ -40,11 +40,15 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSalaryProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.compress.utils.Lists;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.stereotype.Service;
......@@ -68,6 +72,7 @@ import java.util.*;
@Log4j2
@AllArgsConstructor
@Service
@EnableConfigurationProperties(DaprSalaryProperties.class)
public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreEmpMain> implements TPreEmpMainService {
// 预入职-员工不良记录表
private final TPreEmpBadRecordService tPreEmpBadRecordService;
......@@ -116,6 +121,9 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
// 审核日志
private final TPreEmpMainLogService tPreEmpMainLogService;
// 薪资服务,获取计税月份
private final DaprSalaryProperties salaryProperties;
private final OSSUtil ossUtil;
private static final String ID = "id";
......@@ -924,6 +932,10 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
tPreEmployeeInfo.setCreateBy(user.getId());
tPreEmployeeInfo.setCreateName(user.getNickname());
tPreEmployeeInfo.setCreateTime(LocalDateTime.now());
// 塞计税月份标志
this.setTaxMonthAndFlag(status, tPreEmployeeInfo);
tPreEmployeeInfoService.saveOrUpdate(tPreEmployeeInfo);
}
// 预入职-项目档案表
......@@ -998,6 +1010,28 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
}
}
/**
* @param status 1:保存
* @Description: 获取计税月份和是否可编辑的标志
* @Author: hgw
* @Date: 2024/7/16 16:15
* @return: java.lang.String
**/
private void setTaxMonthAndFlag(String status, TPreEmployeeInfo employeeInfo) {
String taxMonth = DateUtil.getThisMonth();
employeeInfo.setTaxMonthFlag(CommonConstants.ONE_STRING);
if (CommonConstants.ONE_STRING.equals(status)) {
// 去薪资服务获取
R<String> sdr = HttpDaprUtil.invokeMethodPost(salaryProperties.getAppUrl(), salaryProperties.getAppId()
, "/tsalaryemployee/inner/getEmpTaxMonth", employeeInfo.getEmpIdcard(), String.class, SecurityConstants.FROM_IN);
if (sdr != null && sdr.getData() != null && !CommonConstants.ZERO_STRING.equals(sdr.getData())) {
taxMonth = sdr.getData();
employeeInfo.setTaxMonthFlag(CommonConstants.ZERO_STRING);
}
}
employeeInfo.setTaxMonth(taxMonth);
}
private YifuUser getNewYifuUser() {
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
......@@ -1086,7 +1120,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
if (Common.isEmpty(tPreEmployeeProject.getTryPeriod())) {
tPreEmployeeProject.setTryPeriod("");
}
BeanUtil.copyProperties(tPreEmployeeInfo, project, ID);
BeanUtil.copyProperties(tPreEmployeeProject, project, ID);
if (CommonConstants.ONE_INT == project.getProjectStatus()) {
project.setCreateTime(LocalDateTime.now());
project.setDeleteFlag(CommonConstants.STATUS_NORMAL);
......@@ -1113,6 +1147,40 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
if (emp == null) {
return R.failed("新建员工失败!");
}
// 更新或新增薪资人员
if (Common.isNotNull(tPreEmployeeInfo.getBankNo())
&& Common.isNotNull(tPreEmployeeInfo.getTaxMonth())) {
TSalaryEmployee newEmp = new TSalaryEmployee();
newEmp.setFileStatus(CommonConstants.ZERO_STRING);
newEmp.setDeptId(dept.getId());
newEmp.setDeptName(dept.getDepartName());
newEmp.setDeptNo(dept.getDepartNo());
newEmp.setUnitId(dept.getCustomerId());
newEmp.setUnitName(dept.getCustomerName());
newEmp.setUnitNo(dept.getCustomerNo());
newEmp.setCreateBy(String.valueOf(user.getId()));
newEmp.setCreateName(user.getNickname());
newEmp.setCreateTime(LocalDateTime.now());
newEmp.setUpdateBy(String.valueOf(user.getId()));
newEmp.setUpdateTime(LocalDateTime.now());
newEmp.setInvoiceTitle(dept.getInvoiceTitleSalary());
newEmp.setEmpName(tPreEmployeeInfo.getEmpName());
newEmp.setEmpIdcard(tPreEmployeeInfo.getEmpIdcard());
newEmp.setBankProvince(tPreEmployeeInfo.getBankProvince());
newEmp.setBankCity(tPreEmployeeInfo.getBankCity());
newEmp.setBankNo(tPreEmployeeInfo.getBankNo());
newEmp.setTaxMonth(tPreEmployeeInfo.getTaxMonth());
newEmp.setBankName(tPreEmployeeInfo.getBankName());
newEmp.setBankSubName(tPreEmployeeInfo.getBankSubName());
newEmp.setEmpPhone(tPreEmployeeInfo.getEmpPhone());
// 保存薪资人员(含判断是否有发薪)
R<String> sdr = HttpDaprUtil.invokeMethodPost(salaryProperties.getAppUrl(), salaryProperties.getAppId()
, "/tsalaryemployee/inner/savePreNewEmpInfo", newEmp, String.class, SecurityConstants.FROM_IN);
if (sdr == null || Common.isEmpty(sdr.getData())) {
return R.failed("同步薪资人员失败!");
}
}
// 3:其他附属信息
......
......@@ -89,6 +89,7 @@
<result property="contactProvince" column="CONTACT_PROVINCE"/>
<result property="contactCity" column="CONTACT_CITY"/>
<result property="contactTown" column="CONTACT_TOWN"/>
<result property="taxMonthFlag" column="TAX_MONTH_FLAG"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -156,7 +157,8 @@
a.TAX_MONTH,
a.CONTACT_PROVINCE,
a.CONTACT_CITY,
a.CONTACT_TOWN
a.CONTACT_TOWN,
a.TAX_MONTH_FLAG
</sql>
<sql id="tPreEmployeeInfo_where">
<if test="tPreEmployeeInfo != null">
......
......@@ -58,13 +58,13 @@ public class TSalaryEmpModLog extends BaseEntity {
@Schema(description = "content")
private String content;
/**
* 0编辑、1批量更新、2EKP变更银行卡号
* 0编辑、1批量更新、2EKP变更银行卡号;3预入职更新
*/
@ExcelAttribute(name = "0编辑、1批量更新、2EKP变更银行卡号", isNotEmpty = true, errorInfo = "0编辑、1批量更新、2EKP变更银行卡号不能为空", maxLength = 1)
@NotBlank(message = "0编辑、1批量更新、2EKP变更银行卡号不能为空")
@Length(max = 1, message = "0编辑、1批量更新、2EKP变更银行卡号不能超过1个字符")
@ExcelProperty("0编辑、1批量更新、2EKP变更银行卡号")
@Schema(description = "0编辑、1批量更新、2EKP变更银行卡号")
@Schema(description = "0编辑、1批量更新、2EKP变更银行卡号;3预入职更新")
private String type;
/**
......
......@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
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;
......@@ -223,4 +224,30 @@ public class TSalaryEmployeeController {
res.setRosterVos(tSalaryEmployeeService.getSalaryEmpRoster(idCardList));
return res;
}
/**
* @param empIdCard 身份证
* @Description: 根据身份证获取计税月份
* @Author: hgw
* @Date: 2022/8/10 17:01
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo>
**/
@Inner
@PostMapping("/inner/getEmpTaxMonth")
public String getEmpTaxMonth(@RequestBody String empIdCard) {
return tSalaryEmployeeService.getEmpTaxMonth(empIdCard);
}
/**
* @Description: 预入职保存薪资人员
* @Author: hgw
* @Date: 2022/8/10 17:01
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo>
**/
@Inner
@PostMapping("/inner/savePreNewEmpInfo")
public String savePreNewEmpInfo(@RequestBody TSalaryEmployee newEmp) {
return tSalaryEmployeeService.savePreNewEmpInfo(newEmp);
}
}
......@@ -200,4 +200,14 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
List<TSalaryTypeThreeExportEkpVo> getAccountThreeListByApplyNo(String applyNo);
List<TSalaryTypeFourExportEkpVo> getAccountFourListByApplyNo(String applyNo);
/**
* @param empIdCard 身份证
* @Description: C端预入职查询薪资当前年度是否有发薪记录,无则返回0,有则返回数量
* @Author: hgw
* @Date: 2024/7/16 17:01
* @return: java.lang.String
**/
int getAccountIdByIdCard(@Param("empIdCard") String empIdCard);
}
......@@ -20,15 +20,11 @@ package com.yifu.cloud.plus.v1.yifu.salary.service;
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.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmpModLog;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmpModLogSearchVo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
/**
......@@ -38,14 +34,15 @@ import java.util.List;
* @date 2023-10-11 17:48:31
*/
public interface TSalaryEmpModLogService extends IService<TSalaryEmpModLog> {
/**
* 薪资人员档案变更记录简单分页查询
* @param tSalaryEmpModLog 薪资人员档案变更记录
* @return
*/
IPage<TSalaryEmpModLog> getTSalaryEmpModLogPage(Page<TSalaryEmpModLog> page, TSalaryEmpModLogSearchVo tSalaryEmpModLog);
/**
* 薪资人员档案变更记录简单分页查询
*
* @param tSalaryEmpModLog 薪资人员档案变更记录
* @return
*/
IPage<TSalaryEmpModLog> getTSalaryEmpModLogPage(Page<TSalaryEmpModLog> page, TSalaryEmpModLogSearchVo tSalaryEmpModLog);
List<TSalaryEmpModLog> noPageDiy(TSalaryEmpModLogSearchVo searchVo);
List<TSalaryEmpModLog> noPageDiy(TSalaryEmpModLogSearchVo searchVo);
void initModLog(TSalaryEmployee newEntity, TSalaryEmployee oldEntity, String type, String userName, ExcelUtil<TSalaryEmployee> util);
}
......@@ -126,4 +126,15 @@ public interface TSalaryEmployeeService extends IService<TSalaryEmployee> {
R<Boolean> updateByIdDiy(TSalaryEmployee tSalaryEmployee);
/**
* @param empIdCard 身份证
* @Description: C端预入职获取计税月份
* @Author: hgw
* @Date: 2024/7/16 16:11
* @return: java.lang.String
**/
String getEmpTaxMonth(String empIdCard);
String savePreNewEmpInfo(TSalaryEmployee newEmp);
}
......@@ -72,7 +72,7 @@ public class TSalaryEmpModLogServiceImpl extends ServiceImpl<TSalaryEmpModLogMap
* @Author fxj
* @Description 记录变更日志
* @Date 17:59 2023/10/24
* @Param type 0 编辑 1 批量更新 3 EKP 更新
* @Param type 0 编辑 1 批量更新 2 EKP更新 3 预入职更新
* @return
**/
@Override
......
......@@ -47,6 +47,7 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryAccountMapper;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryEmployeeMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TBankSetService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryEmpModLogService;
......@@ -88,6 +89,8 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
@Autowired
private TSalaryEmpModLogService logService;
@Autowired
private TSalaryAccountMapper salaryAccountMapper;
/**
* 薪酬人员表简单分页查询
*
......@@ -1064,4 +1067,62 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
}
return null;
}
/**
* @param empIdCard 身份证
* @Description: C端预入职获取计税月份
* @Author: hgw
* @Date: 2024/7/16 16:11
* @return: java.lang.String
**/
@Override
public String getEmpTaxMonth(String empIdCard) {
// 0表示 未找到薪资记录,C端可编辑
String taxMonth = CommonConstants.ZERO_STRING;
TSalaryEmployee employee = baseMapper.getByEmpIdCard(empIdCard);
if (employee != null && Common.isNotNull(employee.getTaxMonth())) {
// 查找本年度薪资,有则返回薪资人员的计税月份,无则返回空,可编辑
int count = salaryAccountMapper.getAccountIdByIdCard(empIdCard);
if (count > 0) {
taxMonth = employee.getTaxMonth();
}
}
return taxMonth;
}
/**
* @Description: C端预入职获取计税月份
* @Author: hgw
* @Date: 2024/7/16 16:11
* @return: java.lang.String
**/
@Override
public String savePreNewEmpInfo(TSalaryEmployee newEmp) {
// 0表示 未找到薪资记录,C端可编辑
boolean canSaveFlag = true;
TSalaryEmployee employee = baseMapper.getByEmpIdCard(newEmp.getEmpIdcard());
if (employee != null) {
// 查找本年度薪资,有则返回薪资人员的计税月份,无则返回空,可编辑
int count = salaryAccountMapper.getAccountIdByIdCard(newEmp.getEmpIdcard());
if (count > 0) {
canSaveFlag = false;
}
}
if (canSaveFlag) {
if (employee != null) {
// 变更日志 hgw 2024-7-16 18:19:57
logService.initModLog(employee,newEmp,CommonConstants.THREE_STRING,newEmp.getCreateName(), null);
String[] ignoreProperties = new String[]{"id", "createBy", "createName", "createTime"};
BeanUtil.copyProperties(newEmp, employee, ignoreProperties);
this.updateById(employee);
} else {
this.save(newEmp);
}
}
return CommonConstants.SAVE_SUCCESS;
}
}
......@@ -1485,4 +1485,10 @@
where s.APPLY_NO = #{applyNo} and a.DELETE_FLAG = 0
GROUP BY a.id ORDER BY a.ROW_INDEX ASC
</select>
<!-- C端预入职查询薪资当前年度是否有发薪记录,无则返回空,有则返回Id -->
<select id="getAccountIdByIdCard" resultType="java.lang.Integer">
select count(1) from t_salary_account a where a.EMP_IDCARD = #{empIdCard} and a.SETTLEMENT_MONTH like concat(DATE_FORMAT(NOW(), '%Y'), '%')
</select>
</mapper>
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