Commit a1ec12fc authored by 李灿灿's avatar 李灿灿

Merge branch 'develop' into feature-licancan

parents 9327285d 57f9fff6
......@@ -275,7 +275,8 @@ public class TEmployeeInfo extends BaseEntity {
/**
* 员工合同状态(字典)
*/
@Schema(description = "员工合同状态(字典)0初始状态")
@Schema(description = "员工合同状态(字典)0初始状态 personnel_state")
@ExcelAttribute(name = "员工合同状态", isDataId = true, dataType = ExcelAttributeConstants.PERSONNEL_STATE)
private Integer contractStatus;
/**
......
......@@ -17,6 +17,8 @@
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -341,6 +343,7 @@ public class TEmployeeProject extends BaseEntity {
* 员工合同状态(字典)
*/
@Schema(description = "员工合同状态(字典)0初始状态")
@ExcelAttribute(name = "合同状态", isDataId = true,dataType = ExcelAttributeConstants.PERSONNEL_STATE)
private Integer contractStatus;
}
......@@ -58,7 +58,6 @@ public class EmployeeContractUpdateVO extends RowIndex implements Serializable {
/**
* 合同编号
*/
@NotBlank(message = "合同编号不能为空")
@Length(max = 50, message = "合同编号不能超过50个字符")
@ExcelAttribute(name = "合同编号", maxLength = 50)
@Schema(description = "合同编号", name = "contractNo")
......
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.constants;
public class EmployeeContractConstants {
public static final String NO_CONTRACT_FILE_CABINET = "合同编号、档案柜号不可同时为空";
public static final String NO_INFO = "未找到记录";
public static final String NOT_CREATE_USER = "不是创建人,无法删除";
......
......@@ -223,30 +223,35 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
tEmployeeContractInfo.setIsObsolete(CommonConstants.ZERO_STRING);
tEmployeeContractInfo.setDeleteFlag(CommonConstants.ZERO_INT);
if (Common.isEmpty(tEmployeeContractInfo.getApplyNo())) {
tEmployeeContractInfo.setApplyNo(this.getCode());
tEmployeeContractInfo.setApplyNo(this.getCode(false));
}
}
/**
* @param
* @param isNew true:取数据库最新的
* @Description: 获取 申请编码
* @Author: hgw
* @Date: 2022/6/22 17:52
* @return: java.lang.String
**/
private synchronized String getCode() {
private synchronized String getCode(boolean isNew) {
String nowDay = DateUtil.getThisDay();
int nowNums;
String empCode = null;
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_EMP_CONTRACT_CODE);
if (isNew) {
empCode = baseMapper.getMaxContractCode();
nowNums = Integer.parseInt(empCode) + 1;
} else {
try {
Object nowNumObj = cache.get(nowDay);
int nowNums = 1;
if (Common.isNotNull(nowNumObj)) {
SimpleValueWrapper value = (SimpleValueWrapper) nowNumObj;
nowNums = (Integer) value.get() + 1;
} else {
String empCode = null;
try {
empCode = baseMapper.getMaxContractCode();
nowNums = Integer.parseInt(empCode) + 1;
}
} catch (NumberFormatException e) {
log.error("获取人员合同当日最大编码时出错:" + empCode);
nowNums = 1;
......@@ -307,11 +312,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
// 针对编码再做一次重复性校验
String isCur = baseMapper.getContractByApplyNo(tEmployeeContractInfo.getApplyNo());
if (Common.isNotNull(isCur)) {
String code = this.getCode();
isCur = baseMapper.getContractByApplyNo(tEmployeeContractInfo.getApplyNo());
if (Common.isNotNull(isCur)) {
return R.failed("编码已被占用,请稍后再新增:" + code);
}
String code = this.getCode(true);
tEmployeeContractInfo.setApplyNo(code);
}
baseMapper.insert(tEmployeeContractInfo);
......@@ -414,17 +415,65 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
return R.failed("不是待审核状态!");
}
if (tEmployeeContractInfo.getAuditStatus() == CommonConstants.dingleDigitIntArray[2]) {
//先停用项目内的其他的员工合同
baseMapper.updateInUseStatusById(contractInfo.getEmpId(), contractInfo.getSettleDomain()
, contractInfo.getId(), CommonConstants.ONE_STRING);
// 作废、终止,不变为在用
if (Common.isEmpty(contractInfo.getSituation())
|| (!EmployeeConstants.SITUATION_SIX.equals(contractInfo.getSituation())
&& !EmployeeConstants.SITUATION_SEVEN.equals(contractInfo.getSituation()))) {
tEmployeeContractInfo.setInUse(CommonConstants.ZERO_STRING);
// 更新档案、项目合同状态为(1可用)
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeProject::getDeptId, contractInfo.getSettleDomain())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (tEmployeeProject != null) {
tEmployeeProject.setContractStatus(CommonConstants.ONE_INT);
tEmployeeProjectService.updateById(tEmployeeProject);
}
// 更新档案、项目合同状态为(1在用)
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(tEmployeeContractInfo.getEmpId());
if (tEmployeeInfo != null) {
tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
tEmployeeInfoService.updateById(tEmployeeInfo);
}
} else {
// 作废、终止审核通过:
// 更新项目合同状态为(2不在用),档案状态要判断
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeProject::getDeptId, contractInfo.getSettleDomain())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (tEmployeeProject != null) {
tEmployeeProject.setContractStatus(CommonConstants.TWO_INT);
tEmployeeProjectService.updateById(tEmployeeProject);
}
tEmployeeContractInfo.setAuditTimeLast(LocalDateTime.now());
//先停用项目内的其他的员工合同
baseMapper.updateInUseStatusById(contractInfo.getEmpId(), contractInfo.getSettleDomain()
, contractInfo.getId(), CommonConstants.ONE_STRING);
// 更新档案、项目合同状态为(0无合同 1在用 2不在用)
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(tEmployeeContractInfo.getEmpId());
if (tEmployeeInfo != null) {
// 判断人员有无审核通过的其他合同
TEmployeeContractInfo contractInfoInUse = this.getOne(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_INT)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
if (contractInfoInUse != null) {
tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
} else {
tEmployeeInfo.setContractStatus(CommonConstants.TWO_INT);
}
tEmployeeInfoService.updateById(tEmployeeInfo);
}
}
tEmployeeContractInfo.setAuditTimeLast(LocalDateTime.now());
}
// 不是待提交,记录审核记录
this.setAuditInfo(tEmployeeContractInfo);
......@@ -617,7 +666,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeContractConstants.NO_INFO));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeContractConstants.NO_CONTRACT_FILE_CABINET));
}
} else {
errorMessageList.add(new ErrorMessage(CommonConstants.ZERO_INT, EmployeeContractConstants.NO_INFO));
......
......@@ -170,6 +170,7 @@ public interface CommonConstants {
* @author fxj
*/
int ONE_INT = 1;
int TWO_INT = 2;
/**
* 个位数字(阿里编码规约不允许直接使用‘魔法值’)
......
package com.yifu.cloud.plus.v1.yifu.social.constants;
/**
* @author hgw2
* @description 社保固定文字
* @date 2022/7/19
*/
public class SocialConstants {
// 社保补缴配置有误!
public static final String SOCIAL_SET_ERROR = "社保补缴配置有误!";
}
......@@ -19,7 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary;
......@@ -28,11 +28,9 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
......@@ -147,4 +145,27 @@ public class TForecastLibraryController {
public void export(HttpServletResponse response, @RequestBody TForecastLibrary searchVo) {
tForecastLibraryService.listExport(response, searchVo);
}
/**
* @param payMonths 缴纳月
* @param empIdCard 身份证
* @param settleDomainIds 项目ids
* @Description: 按缴纳月重新生成
* @Author: hgw
* @Date: 2022/7/18 17:12
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
@Operation(summary = "按缴纳月重新生成", description = "按缴纳月重新生成:hasPermission('social_tforecastlibrary_create')")
@SysLog("按缴纳月重新生成")
@PostMapping("/createForecastlibary")
@PreAuthorize("@pms.hasPermission('social_tforecastlibrary_create')")
public R<Boolean> createForecastlibary(@RequestParam String payMonths,
@RequestParam(value = "empIdCard", required = false) String empIdCard,
@RequestParam(value = "settleDomainIds", required = false) String settleDomainIds) {
if (Common.isEmpty(empIdCard) && Common.isEmpty(settleDomainIds)) {
return R.failed("参数有误:身份证或项目ID不可为空!");
}
return tForecastLibraryService.createForecastlibary(payMonths, empIdCard, settleDomainIds);
}
}
......@@ -44,6 +44,16 @@ public interface SysBaseSetInfoMapper extends BaseMapper<SysBaseSetInfo> {
List<SysBaseSetInfo> getAllByEntity(@Param("sysBaseSetInfo")SysBaseSetInfo sysBaseSetInfo);
/**
* 获取基数配置
* @Author fxj
* @Date 2019-10-08
* @param sysBaseSetInfo
* @return
**/
List<SysBaseSetInfo> getSysBaseSetInfoNoPage(@Param("sysBaseSetInfo")SysBaseSetInfo sysBaseSetInfo);
/**
* @Author fxj
* @Description 获取对应户名称的公积金基数信息
......
......@@ -23,6 +23,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 社保公积金查询表
*
......@@ -37,4 +40,21 @@ public interface TSocialFundInfoMapper extends BaseMapper<TSocialFundInfo> {
* @return
*/
IPage<TSocialFundInfo> getTSocialFundInfoPage(Page<TSocialFundInfo> page, @Param("tSocialFundInfo") TSocialFundInfo tSocialFundInfo);
/**
* @Description: 获取可生成预估的社保
* @Author: hgw
* @Date: 2022/7/19 19:09
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo>
**/
List<TSocialFundInfo> getSocialList(@Param("empIdCard") String empIdCard, @Param("settleDomainIds") List<String> settleDomainIds);
/**
* @Description: 获取可生成预估的公积金
* @Author: hgw
* @Date: 2022/7/19 19:09
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo>
**/
List<TSocialFundInfo> getFundList(@Param("empIdCard") String empIdCard, @Param("settleDomainIds") List<String> settleDomainIds);
}
......@@ -20,12 +20,13 @@ package com.yifu.cloud.plus.v1.yifu.social.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.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.TAgentConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
/**
......@@ -46,4 +47,26 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
void listExport(HttpServletResponse response, TForecastLibrary searchVo);
List<TForecastLibrary> noPageDiy(TForecastLibrary searchVo);
/**
* @param payMonths 缴纳月
* @param empIdCard 身份证
* @param settleDomainIds 项目id
* @Description: 按缴纳月重新生成
* @Author: hgw
* @Date: 2022/7/18 17:11
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
R<Boolean> createForecastlibary(String payMonths, String empIdCard, String settleDomainIds);
/**
* @Description: 填充预估实际金额
* @Author: hgw
* @Date: 2020/10/10 16:45
* @return: com.yifu.cloud.v1.hrms.api.entity.TForecastLibrary
**/
TForecastLibrary initForecastLibrary(TForecastLibrary library
, TSocialFundInfo socialInfo, TSocialFundInfo fund, Integer month, boolean isReduceFund
, boolean isReduceSocial, HashMap<String, TAgentConfig> agentConfigMap);
}
package com.yifu.cloud.plus.v1.yifu.social.util;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import java.time.LocalDateTime;
/**
* 公用方法提取
*
* @author fxj
* @date 2019-09-29
**/
@Slf4j
public class ServiceUtil {
private ServiceUtil() {
throw new IllegalStateException("ServiceUtil class");
}
/**
* @Description: 返回字符串对应的int值
* @Author: hgw
* @Date: 2022/7/18 17:29
* @return: int
**/
public static int convertStringToInt(String num1) {
if (Common.isEmpty(num1) || !Common.isNumber(num1)) {
return -1;
}
return Integer.parseInt(num1);
}
/**
* 按派单日期生成生成月份
* @Author fxj
* @Date 2020-03-25
* @param createDate
* @return
**/
public static String initCreateMonth(LocalDateTime createDate, String payMonth){
if (null == createDate || Common.isEmpty(payMonth) || payMonth.length() != 6){
return DateUtil.getYearAndMonth(LocalDateTime.now(), 1);
}
if (createDate.getYear() < Integer.parseInt(payMonth.substring(0,4))){
return payMonth;
}
if (createDate.getYear() > Integer.parseInt(payMonth.substring(0,4))){
return DateUtil.getYearAndMonth(createDate, 1);
}
if (createDate.getYear() == Integer.parseInt(payMonth.substring(0,4))){
if (createDate.getMonthValue() < Integer.parseInt(payMonth.substring(4,6))){
return payMonth;
}
if (createDate.getMonthValue() >= Integer.parseInt(payMonth.substring(4,6))){
return DateUtil.getYearAndMonth(createDate, 1);
}
}
return null;
}
}
......@@ -368,4 +368,15 @@
and a.BASE_TYPE = '1'
</where>
</select>
<!--sysBaseSetInfo不分页查询-->
<select id="getSysBaseSetInfoNoPage" resultMap="sysBaseSetInfoMap">
<include refid="base_column_list"/>
FROM sys_base_set_info a
<where>
1=1
<include refid="sysBaseSetInfo_where"/>
</where>
ORDER BY a.apply_start_date desc
</select>
</mapper>
......@@ -621,4 +621,41 @@
<include refid="tSocialFundInfo_where"/>
</where>
</select>
<!--获取在用社保-->
<select id="getSocialList" resultMap="tSocialFundInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_social_fund_info a
<where>
a.SOCIAL_ADD_STATUS != '4' and a.SOCIAL_REDUCE_STATUS != '2'
<if test="empIdCard != null">
and a.EMP_IDCARD = #{empIdCard}
</if>
<if test="settleDomainIds != null">
AND a.SETTLE_DOMAIN in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
<!--获取在用公积金-->
<select id="getFundList" resultMap="tSocialFundInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_social_fund_info a
<where>
a.FUND_ADD_STATUS != '4' and a.FUND_REDUCE_STATUS != '2'
<if test="empIdCard != null">
and a.EMP_IDCARD = #{empIdCard}
</if>
<if test="settleDomainIds != null">
AND a.SETTLE_DOMAIN in
<foreach item="item" index="index" collection="settleDomainIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</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