Commit 3921a5f4 authored by hongguangwu's avatar hongguangwu

找回代码

parent 54abfff3
......@@ -162,4 +162,18 @@ public class TCheckIdCardController {
public TCheckIdCard checkIdCardSingle(@RequestBody TCheckIdCard tCheckIdCard) {
return tCheckIdCardService.checkIdCardSingle(tCheckIdCard);
}
/**
* @param checkList
* @Description: 校验姓名身份证
* @Author: hgw
* @Date: 2022-6-27 16:23:37
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Operation(description = "校验薪资姓名身份证")
@SysLog("校验薪资姓名身份证")
@PostMapping("/checkSalaryIdCard")
public R<List<TCheckIdCard>> checkSalaryIdCard(@RequestBody List<TCheckIdCard> checkList) {
return tCheckIdCardService.checkSalaryIdCard(checkList);
}
}
......@@ -34,5 +34,22 @@ public interface TCheckIdCardMapper extends BaseMapper<TCheckIdCard> {
**/
List<TCheckIdCard> getAllList(@Param("tCheckIdCard") TCheckIdCard tCheckIdCard);
/**
* @param idCardList
* @Description: 获取身份证的缓存
* @Author: hgw
* @Date: 2022/7/7 16:00
* @return: java.util.List<com.yifu.cloud.v1.checks.api.entity.TCheckIdCard>
**/
List<TCheckIdCard> getAllListByList(@Param("idCardList") List<String> idCardList);
/**
* @param idCardList
* @Description: 获取正确的身份证的缓存
* @Author: hgw
* @Date: 2022/7/7 16:00
* @return: java.util.List<com.yifu.cloud.v1.checks.api.entity.TCheckIdCard>
**/
List<TCheckIdCard> getTrueListByList(@Param("idCardList") List<String> idCardList);
}
......@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.check.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.check.entity.TCheckLock;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -23,4 +24,6 @@ public interface TCheckLockMapper extends BaseMapper<TCheckLock> {
**/
List<TCheckLock> getAllList();
int getApiNumByMonth(@Param("nowMonth") String nowMonth);
}
......@@ -46,4 +46,6 @@ public interface TCheckIdCardService extends IService<TCheckIdCard> {
R<List<TCheckIdCard>> checkIdCard(List<TCheckIdCard> checkList);
TCheckIdCard checkIdCardSingle(TCheckIdCard tCheckIdCard);
R<List<TCheckIdCard>> checkSalaryIdCard(List<TCheckIdCard> checkList);
}
......@@ -18,4 +18,6 @@ public interface TCheckLockService extends IService<TCheckLock> {
*/
List<TCheckLock> getAllList();
int getApiNumByMonth(String nowMonth);
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCanCheck;
import com.yifu.cloud.plus.v1.check.entity.TCheckApiNum;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.check.entity.TCheckLock;
......@@ -23,6 +24,7 @@ import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -283,4 +285,239 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
}
}
private Map<String, TCheckIdCard> getAllMapByList(List<String> idCardList) {
Map<String, TCheckIdCard> returnMap = new HashMap<>();
if (idCardList != null && !idCardList.isEmpty()) {
List<TCheckIdCard> list = baseMapper.getAllListByList(idCardList);
if (list != null && !list.isEmpty()) {
for (TCheckIdCard c : list) {
returnMap.put(c.getIdCard() + CommonConstants.DOWN_LINE_STRING + c.getName(), c);
}
}
}
return returnMap;
}
private Map<String, TCheckIdCard> getTrueMap(TCheckIdCard tCheckIdCard) {
if (tCheckIdCard == null) {
tCheckIdCard = new TCheckIdCard();
}
tCheckIdCard.setIsTrue(CommonConstants.ONE_INT);
List<TCheckIdCard> list = baseMapper.getAllList(tCheckIdCard);
Map<String, TCheckIdCard> returnMap = new HashMap<>();
if (list != null && !list.isEmpty()) {
for (TCheckIdCard c : list) {
returnMap.put(c.getIdCard(), c);
}
}
return returnMap;
}
private Map<String, TCheckIdCard> getTrueMapByList(List<String> idCardList) {
Map<String, TCheckIdCard> returnMap = new HashMap<>();
if (idCardList != null && !idCardList.isEmpty()) {
List<TCheckIdCard> list = baseMapper.getTrueListByList(idCardList);
if (list != null && !list.isEmpty()) {
for (TCheckIdCard c : list) {
returnMap.put(c.getIdCard(), c);
}
}
}
return returnMap;
}
@Override
public R<List<TCheckIdCard>> checkSalaryIdCard(List<TCheckIdCard> checkList) {
TCanCheck tCanCheck= canCheckService.getById(1);
boolean canCheck = false;
if (tCanCheck != null && tCanCheck.getCanCheck() == 1) {
canCheck = true;
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed("请登录!");
}
String nowMonth = DateUtil.addMonth(0);
TCheckApiNum nowMonthNum = tCheckApiNumService.getById(nowMonth);
int nowApiNum = tCheckLockService.getApiNumByMonth(nowMonth);
if (nowMonthNum == null) {
TCheckApiNum lastMonth = tCheckApiNumService.getById(DateUtil.addMonth(-1));
int canApiNum = 10000;
if (lastMonth != null && lastMonth.getCanApiNum() != null) {
canApiNum = lastMonth.getCanApiNum();
}
nowMonthNum = new TCheckApiNum();
nowMonthNum.setId(nowMonth);
nowMonthNum.setCanApiNum(canApiNum);
nowMonthNum.setApiNum(0);
tCheckApiNumService.save(nowMonthNum);
} else if (nowApiNum >= nowMonthNum.getCanApiNum()) {
return R.failed("当月总条数:" + nowMonthNum.getCanApiNum() + "已到达上限!");
}
if (checkList != null && !checkList.isEmpty()) {
TCheckLock lock = new TCheckLock();
lock.setImportNum(checkList.size());
lock.setApiNum(0);
lock.setCreateMonth(nowMonth);
lock.setCreateTime(LocalDateTime.now());
lock.setCreateUser(user.getId());
lock.setDeleteFlag(0);
lock.setCreateUserName(user.getNickname());
tCheckLockService.save(lock);
int canApiNum = nowMonthNum.getCanApiNum();
List<String> idCardList = new ArrayList<>();
for (TCheckIdCard card: checkList) {
if (card.getIdCard() != null) {
idCardList.add(card.getIdCard());
}
}
// 全部(身份证_姓名)
Map<String, TCheckIdCard> returnMap = this.getAllMapByList(idCardList);
// 正确的身份证
Map<String, TCheckIdCard> trueMap = this.getTrueMapByList(idCardList);
TCheckIdCard nowIdCard;
TCheckIdCard lastCard;
Map<String, TCheckIdCard> idCardMap = new HashMap<>();
String userId = String.valueOf(user.getId());
TCheckLock lockUpdate;
int apiNum = 0;
// 有一个错误,就不传200给前端
boolean isTrue = true;
try {
for (TCheckIdCard c : checkList) {
if (Common.isNotNull(c.getIdCard()) && Common.isNotNull(c.getName())) {
lastCard = idCardMap.get(c.getIdCard());
if (lastCard != null) {
c.setIsTrue(lastCard.getIsTrue());
c.setReason(lastCard.getReason());
} else {
// 校验姓名身份证规则
if (!regIdCard(c.getIdCard())) {
c.setIsTrue(0);
c.setReason("身份证格式有误");
} else if (regEmpName(c.getName())) {
c.setIsTrue(0);
c.setReason("姓名含数字或空格,无法校验");
} else {
nowIdCard = returnMap.get(c.getIdCard() + CommonConstants.DOWN_LINE_STRING + c.getName());
if (nowIdCard != null) {
c.setIsTrue(nowIdCard.getIsTrue());
c.setReason(nowIdCard.getReason());
} else {
// 调用对的身份证信息
nowIdCard = trueMap.get(c.getIdCard());
if (nowIdCard != null) {
if (nowIdCard.getName().equals(c.getName())) {
c.setIsTrue(nowIdCard.getIsTrue());
c.setReason(nowIdCard.getReason());
} else {
c.setIsTrue(CommonConstants.ZERO_INT);
c.setReason("姓名错误!");
}
} else {
// 调用API校验
if (nowApiNum < canApiNum) {
nowApiNum++;
apiNum++;
// 安全调用:
this.doSafetyApi(c, canCheck, userId);
returnMap.put(c.getIdCard() + CommonConstants.DOWN_LINE_STRING + c.getName(), c);
} else {
c.setIsTrue(0);
c.setReason("调用花钱的Api的条数已达上限:" + canApiNum + ",请联系管理员处理!");
}
}
}
}
// 将同身份证的结果存储下来备用,防止撞库
idCardMap.put(c.getIdCard(), c);
}
} else {
c.setIsTrue(0);
c.setReason("姓名身份证不可为空");
}
if (isTrue && c.getIsTrue() == 0) {
isTrue = false;
}
}
} catch (Exception e) {
returnMap.clear();
trueMap.clear();
lockUpdate = new TCheckLock();
lockUpdate.setId(lock.getId());
lockUpdate.setDeleteFlag(CommonConstants.ONE_INT);
lockUpdate.setApiNum(apiNum);
tCheckLockService.updateById(lockUpdate);
throw new RuntimeException(e.getMessage() == null ? "校验身份证导入失败!" : "校验身份证导入失败:" + e.getMessage());
} finally {
returnMap.clear();
trueMap.clear();
lockUpdate = new TCheckLock();
lockUpdate.setId(lock.getId());
lockUpdate.setDeleteFlag(CommonConstants.ONE_INT);
lockUpdate.setDeleteFlag(CommonConstants.ONE_INT);
lockUpdate.setApiNum(apiNum);
tCheckLockService.updateById(lockUpdate);
}
if (isTrue) {
return R.ok();
} else {
return new R<>(CommonConstants.ONE_INT, "身份证姓名校验不通过!", checkList);
}
}
return R.failed("数据为空!");
}
/**
* @Description: 多线程调用api,每次调用前查询一下数据库:
* @Author: hgw
* @Date: 2022/6/27 17:09
* @return: void
**/
private void doSafetyApi(TCheckIdCard c, boolean canCheck, String userId) {
TCheckIdCard check = new TCheckIdCard();
check.setIdCard(c.getIdCard());
Map<String, TCheckIdCard> checkMap = this.getAllMap(check);
if (checkMap == null || checkMap.isEmpty()) {
// 调用对的身份证信息
Map<String, TCheckIdCard> trueMap = this.getTrueMap(check);
check = trueMap.get(c.getIdCard());
if (check != null) {
if (check.getName().equals(c.getName())) {
c.setIsTrue(check.getIsTrue());
c.setReason(check.getReason());
} else {
c.setIsTrue(CommonConstants.ZERO_INT);
c.setReason("姓名错误!");
}
} else {
// 调用花钱的
this.moneyCheck(c, canCheck, userId);
}
} else {
check = checkMap.get(c.getIdCard() + CommonConstants.DOWN_LINE_STRING + c.getName());
if (check != null) {
c.setIsTrue(check.getIsTrue());
c.setReason(check.getReason());
} else {
// 调用花钱的
this.moneyCheck(c, canCheck, userId);
}
}
}
// 调用花钱的
private void moneyCheck(TCheckIdCard c, boolean canCheck, String userId) {
// 调用花钱的
ChecksUtil.checkIdCard(c, canCheck);
c.setCreateUser(userId);
c.setCreateTime(LocalDateTime.now());
c.setType(CommonConstants.ONE_INT);
this.save(c);
}
}
......@@ -22,4 +22,9 @@ public class TCheckLockServiceImpl extends ServiceImpl<TCheckLockMapper, TCheckL
return baseMapper.getAllList();
}
@Override
public int getApiNumByMonth(String nowMonth) {
return baseMapper.getApiNumByMonth(nowMonth);
}
}
......@@ -60,4 +60,26 @@
order by a.CREATE_TIME desc
</select>
<select id="getAllListByList" resultMap="tCheckIdCardMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_check_id_card a
where a.id_card in
<foreach item="item" index="index" collection="idCardList" open="(" separator="," close=")">
#{item}
</foreach>
order by a.CREATE_TIME desc
</select>
<select id="getTrueListByList" resultMap="tCheckIdCardMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_check_id_card a
where a.is_true = 1 and a.id_card in
<foreach item="item" index="index" collection="idCardList" open="(" separator="," close=")">
#{item}
</foreach>
order by a.CREATE_TIME desc
</select>
</mapper>
......@@ -30,4 +30,9 @@
where a.DELETE_FLAG = 0
</select>
<!--获取所有数据-->
<select id="getApiNumByMonth" resultType="java.lang.Integer">
select ifnull(sum(c.API_NUM),0) apiNum from t_check_lock c where c.CREATE_MONTH = #{nowMonth}
</select>
</mapper>
......@@ -19,9 +19,16 @@ 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.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.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TApprovalRecord;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard;
import com.yifu.cloud.plus.v1.yifu.salary.service.TApprovalRecordService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
import io.swagger.v3.oas.annotations.Operation;
......@@ -31,6 +38,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.Date;
/**
......@@ -47,6 +56,7 @@ public class TSalaryStandardController {
private final TSalaryStandardService tSalaryStandardService;
private final TApprovalRecordService auditLogService;
/**
* 简单分页查询
......@@ -141,4 +151,34 @@ public class TSalaryStandardController {
@RequestParam String id) {
return tSalaryStandardService.salaryStandardAudit(auditFlag, AuditRemark, id);
}
/**
* 保存并提交
* @return
*/
@Operation(description = "保存并提交")
@PostMapping("/doSubmit")
public R salaryStandardAudit(@RequestBody TSalaryStandard tSalaryStandard) {
if (tSalaryStandard != null && Common.isNotNull(tSalaryStandard.getId())) {
YifuUser user = SecurityUtils.getUser();
if (user != null) {
TApprovalRecord tApprovalRecord = new TApprovalRecord();
tApprovalRecord.setApprovalResult(CommonConstants.TWO_STRING);
tApprovalRecord.setApprovalOpinion("提交审核");
tApprovalRecord.setSalaryId(tSalaryStandard.getId());
tApprovalRecord.setNodeId("提交审核");
tApprovalRecord.setApprovalMan(user.getId());
tApprovalRecord.setApprovalManName(user.getNickname());
tApprovalRecord.setApprovalTime(DateUtil.getCurrentDateTime());
auditLogService.save(tApprovalRecord);
tSalaryStandard.setSubmitTime(new Date());
tSalaryStandardService.updateById(tSalaryStandard);
return R.ok("提交成功!");
} else {
return R.failed("请登录!");
}
} else {
return R.failed("请传参!");
}
}
}
......@@ -89,7 +89,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
R<String> updateForecastLibaryByDispatchReduce(TSocialFundInfo socialFundInfo, int forecastFlag);
/**
* @Description: 基数变更,同步社保公积金查询、预估库
* @Description: 户调基-基数变更,同步社保公积金查询、预估库
* @Author: hgw
* @Date: 2022/7/26 19:09
* @return: void
......
......@@ -536,18 +536,10 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
TAgentConfig configUnit = getAgentConfig(agentConfigMap, socialInfo, library.getSocialPayMonth(), CommonConstants.ZERO_STRING);
TAgentConfig configPersonal = getAgentConfig(agentConfigMap, socialInfo, library.getSocialPayMonth(), CommonConstants.ONE_STRING);
// 基数配置
SysBaseSetInfo sysBaseSetInfo;
if (isOnly) {
sysBaseSetInfo = socialInfo.getSocialSetInfo();
} else {
sysBaseSetInfo = this.getSysBaseSetInfo(CommonConstants.ZERO_STRING, socialInfo.getSocialHousehold()
, library.getSocialPayMonth(), socialInfo.getSocialProvince(), socialInfo.getSocialCity(), socialInfo.getSocialTown());
}
// 初始化大病:
this.initLibraryBigMoneyBySocial(library, socialInfo, sysBaseSetInfo);
this.initLibraryBigMoneyBySocial(library, socialInfo);
initUnitAndPersonalLibrary(library, socialInfo, sysBaseSetInfo, historyLibrary, isOnly);
initUnitAndPersonalLibrary(library, socialInfo, historyLibrary, isOnly);
if (null != configAll || null != configUnit || null != configPersonal) {
if (null != configPersonal) {
initPersonalLibByConfig(library, configPersonal);
......@@ -681,85 +673,29 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return null;
}
/**
* @param baseType 0.社保 1.公积金
* @param household (社保、公积金)户
* @param payMonth
* @param province
* @param city
* @param town
* @Description: 查找基数配置
* @Author: hgw
* @Date: 2021/1/4 15:58
* @return: com.yifu.cloud.v1.hrms.api.entity.SysBaseSetInfo
**/
private SysBaseSetInfo getSysBaseSetInfo(String baseType, String household, String payMonth, String province, String city, String town) {
// 基数配置
SysBaseSetInfo sysBaseSetInfo = new SysBaseSetInfo();
sysBaseSetInfo.setBaseType(baseType);
sysBaseSetInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
sysBaseSetInfo.setStatus(CommonConstants.ZERO_INT);
sysBaseSetInfo.setDepartId(household);
if (Common.isNotNull(payMonth)
&& payMonth.length() > 5) {
// 社保缴纳月
String payMonthStr = payMonth.substring(0, 4).concat("-").concat(payMonth.substring(4, 6)).concat("-01 00:00:00");
sysBaseSetInfo.setApplyStartDate(DateUtil.stringToDateByPatten(payMonthStr, DateUtil.DATETIME_PATTERN_SECOND));
} else {
sysBaseSetInfo.setApplyStartDate(new Date());
}
sysBaseSetInfo.setProvince(Integer.parseInt(province));
if (city != null) {
sysBaseSetInfo.setCity(Integer.parseInt(city));
} else {
sysBaseSetInfo.setCity(-1);
}
if (town != null) {
sysBaseSetInfo.setTown(Integer.parseInt(town));
} else {
sysBaseSetInfo.setTown(-1);
}
// 查询符合条件的基数列表
List<SysBaseSetInfo> sysBaseSetInfoList = sysBaseSetInfoMapper.getSysBaseSetInfoNoPage(sysBaseSetInfo);
if (sysBaseSetInfoList != null && !sysBaseSetInfoList.isEmpty()) {
sysBaseSetInfo = sysBaseSetInfoList.get(0);
} else {
// 如果没找到配置,取最新的一条:
sysBaseSetInfo.setApplyStartDate(null);
sysBaseSetInfoList = sysBaseSetInfoMapper.getSysBaseSetInfoNoPage(sysBaseSetInfo);
if (sysBaseSetInfoList != null && !sysBaseSetInfoList.isEmpty()) {
sysBaseSetInfo = sysBaseSetInfoList.get(0);
}
}
return sysBaseSetInfo;
}
/**
* @param library 预估库
* @param socialInfo 社保
* @param sysBaseSetInfo 基数配置
* @Description: 从社保获取大病
* @Author: hgw
* @Date: 2020/11/25 15:51
* @return: void
**/
private void initLibraryBigMoneyBySocial(TForecastLibrary library, TSocialFundInfo socialInfo
, SysBaseSetInfo sysBaseSetInfo) {
) {
if (CommonConstants.ONE_STRING.equals(socialInfo.getPaymentType())) {
// 自定义类型大病随基数配置变化:0不随配置 1随配置 2.单位大病随配置 3个人大病随配置
// 2022-7-20 11:46:32 与房工沟通,派单没这个逻辑,所以都是随配置直接计算
// 直接计算单位大病
this.setBigMoneyBySelfForUnit(library, socialInfo, sysBaseSetInfo);
// 直接计算个人大病
this.setBigMoneyBySelfForPerson(library, socialInfo, sysBaseSetInfo);
library.setUnitBitailmentFee(socialInfo.getUnitBigailmentMoney());
library.setPersonalBigailmentFee(socialInfo.getPersonalBigailmentMoney());
// 非自定义,从社保基数配置取信息
} else {
// 大病处理: 0 收取 按派单的社保里的基数和比例来
if (CommonConstants.ZERO_STRING.equals(sysBaseSetInfo.getIsIllness())) {
if (CommonConstants.ZERO_STRING.equals(socialInfo.getIsIllness())) {
// 大病收取方式 0.按年 判断当前月份是否收取大病 按年收大病起缴月份收取一次,非当年的 大病 按实际收取月份收取大病金额
this.setBigMoney(library, socialInfo, sysBaseSetInfo, socialInfo.getPaymentType());
this.setBigMoney(library, socialInfo, socialInfo.getPaymentType());
// 大病处理: 1 不收取
} else {
library.setUnitBitailmentFee(BigDecimal.ZERO);
......@@ -778,13 +714,13 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
* @Date 2020-08-03
**/
private void initUnitAndPersonalLibrary(TForecastLibrary library, TSocialFundInfo socialInfo
, SysBaseSetInfo sysBaseSetInfo, TForecastLibrary historyLibrary, boolean isOnly) {
initLibrayOfPersonal(library, socialInfo, sysBaseSetInfo, historyLibrary, isOnly);
initLibraryOfUnit(library, socialInfo, sysBaseSetInfo, historyLibrary, isOnly);
, TForecastLibrary historyLibrary, boolean isOnly) {
initLibrayOfPersonal(library, socialInfo, historyLibrary, isOnly);
initLibraryOfUnit(library, socialInfo, historyLibrary, isOnly);
}
private void initLibrayOfPersonal(TForecastLibrary library, TSocialFundInfo socialInfo
, SysBaseSetInfo sysBaseSetInfo, TForecastLibrary historyLibrary, boolean isOnly) {
, TForecastLibrary historyLibrary, boolean isOnly) {
// 个人养老基数
BigDecimal personalPersionBase;
// 个人医疗基数
......@@ -808,9 +744,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (socialInfo != null) {
if (Common.isNotNull(socialInfo.getPaymentType()) && !CommonConstants.ONE_STRING.equals(socialInfo.getPaymentType())) {
if (CommonConstants.ZERO_STRING.equals(socialInfo.getPaymentType())) {
baseLimit = sysBaseSetInfo.getLowerLimit();
baseLimit = socialInfo.getLowerLimit();
} else {
baseLimit = sysBaseSetInfo.getUpperLimit();
baseLimit = socialInfo.getUpperLimit();
}
personalPersionBase = baseLimit;
personalMedicalBase = baseLimit;
......@@ -872,7 +808,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
private void initLibraryOfUnit(TForecastLibrary library, TSocialFundInfo socialInfo
, SysBaseSetInfo sysBaseSetInfo, TForecastLibrary historyLibrary, boolean isOnly) {
, TForecastLibrary historyLibrary, boolean isOnly) {
// 单位养老基数
BigDecimal unitPersionBase;
// 单位医疗基数
......@@ -912,9 +848,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
// 需要从基数配置取数据:
if (Common.isNotNull(socialInfo.getPaymentType()) && !CommonConstants.ONE_STRING.equals(socialInfo.getPaymentType())) {
if (CommonConstants.ZERO_STRING.equals(socialInfo.getPaymentType())) {
baseLimit = sysBaseSetInfo.getLowerLimit();
baseLimit = socialInfo.getLowerLimit();
} else {
baseLimit = sysBaseSetInfo.getUpperLimit();
baseLimit = socialInfo.getUpperLimit();
}
unitPersionBase = baseLimit;
unitMedicalBase = baseLimit;
......@@ -1084,66 +1020,25 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
/**
* @param library 预估主表
* @param socialInfo 社保
* @param sysBaseSetInfo 基数配置
* @Description: 直接计算单位大病
* @Author: hgw
* @Date: 2020/12/2 14:31
* @return: void
**/
private void setBigMoneyBySelfForUnit(TForecastLibrary library, TSocialFundInfo socialInfo, SysBaseSetInfo sysBaseSetInfo) {
if (socialInfo.getUnitBigailmentMoney() != null) {
library.setUnitBitailmentFee(socialInfo.getUnitBigailmentMoney());
} else if (socialInfo.getUnitBigailmentCardinal() != null && sysBaseSetInfo.getPayCompanyPro() != null) {
library.setUnitBitailmentFee(BigDecimalUtils.safeMultiply(
socialInfo.getUnitBigailmentCardinal(),
sysBaseSetInfo.getPayCompanyPro(),
CommonConstants.ONE_OF_PERCENT));
}
}
/**
* @param library 预估主表
* @param socialInfo 社保
* @param sysBaseSetInfo 基数配置
* @Description: 直接计算个人大病
* @Author: hgw
* @Date: 2020/12/2 14:31
* @return: void
**/
private void setBigMoneyBySelfForPerson(TForecastLibrary library, TSocialFundInfo socialInfo, SysBaseSetInfo sysBaseSetInfo) {
if (socialInfo.getPersonalBigailmentMoney() != null) {
library.setPersonalBigailmentFee(socialInfo.getPersonalBigailmentMoney());
} else if (socialInfo.getPersonalBigailmentCardinal() != null && sysBaseSetInfo.getPayPersonalPro() != null) {
library.setPersonalBigailmentFee(BigDecimalUtils.safeMultiply(
socialInfo.getPersonalBigailmentCardinal(),
sysBaseSetInfo.getPayPersonalPro(),
CommonConstants.ONE_OF_PERCENT));
}
}
/**
* @param library 预估库
* @param socialInfo 社保
* @param sysBaseSetInfo 基数配置
* @param paymentType 0最低缴纳、1自定义、2最高缴纳
* @Description: 塞大病金额
* @Author: hgw
* @Date: 2020/11/25 15:51
* @return: void
**/
private void setBigMoney(TForecastLibrary library, TSocialFundInfo socialInfo, SysBaseSetInfo sysBaseSetInfo
private void setBigMoney(TForecastLibrary library, TSocialFundInfo socialInfo
, String paymentType) {
if (CommonConstants.ZERO_STRING.equals(sysBaseSetInfo.getCollectType())) {
if ((null != sysBaseSetInfo.getCollectMoth()
&& Integer.parseInt(library.getSocialPayMonth().substring(4, 6)) == sysBaseSetInfo.getCollectMoth()
if (CommonConstants.ZERO_STRING.equals(socialInfo.getCollectType())) {
if ((null != socialInfo.getCollectMoth()
&& Integer.parseInt(library.getSocialPayMonth().substring(4, 6)) == socialInfo.getCollectMoth()
&& Integer.parseInt(library.getSocialPayMonth().substring(0, 4)) != socialInfo.getBigailmentStart().getYear())
|| library.getSocialPayMonth().equals(DateUtil.formatDatePatten(socialInfo.getBigailmentStart(), null))) {
// 大病取值方式:0按定值
library.setUnitBitailmentFee(BigDecimalUtils.isNullToZero(sysBaseSetInfo.getPayCompany()));
library.setPersonalBigailmentFee(BigDecimalUtils.isNullToZero(sysBaseSetInfo.getPayPersonal()));
library.setUnitBitailmentFee(socialInfo.getUnitBigailmentMoney());
library.setPersonalBigailmentFee(socialInfo.getPersonalBigailmentMoney());
//第一次收取费用逻辑:新员工入职是否收费处理逻辑:先按第一次不收取费用 (只针对按年收)
if (library.getSocialPayMonth().equals(DateUtil.formatDatePatten(socialInfo.getBigailmentStart(), null))
&& CommonConstants.ONE_STRING.equals(socialInfo.getIsChargePersonal())) {
......@@ -1152,36 +1047,33 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
//大病收取方式 : 1.按月
} else if (CommonConstants.ONE_STRING.equals(sysBaseSetInfo.getCollectType())) {
} else if (CommonConstants.ONE_STRING.equals(socialInfo.getCollectType())) {
// 存储基数(最低或最高)
BigDecimal baseLimit = sysBaseSetInfo.getLowerLimit();
BigDecimal baseLimit = socialInfo.getLowerLimit();
if (CommonConstants.TWO_STRING.equals(paymentType)) {
baseLimit = sysBaseSetInfo.getUpperLimit();
baseLimit = socialInfo.getUpperLimit();
}
// 大病取值方式:1 按比例 按派单的基数和比例来
if (CommonConstants.ONE_STRING.equals(sysBaseSetInfo.getValueType())) {
if (CommonConstants.ONE_STRING.equals(socialInfo.getValueType())) {
library.setUnitBigailmentBase(baseLimit);
library.setUnitBigailmentPro(sysBaseSetInfo.getPayCompanyPro());
library.setUnitBigailmentPro(socialInfo.getUnitBigailmentPer());
library.setPersonalBigailmentBase(baseLimit);
library.setPersonalBigailmentPro(sysBaseSetInfo.getPayPersonalPro());
library.setPersonalBigailmentFee(BigDecimalUtils.safeMultiply(
baseLimit,
sysBaseSetInfo.getPayPersonalPro(),
CommonConstants.ONE_OF_PERCENT));
library.setUnitBitailmentFee(BigDecimalUtils.safeMultiply(
baseLimit,
sysBaseSetInfo.getPayCompanyPro(),
CommonConstants.ONE_OF_PERCENT));
library.setPersonalBigailmentPro(socialInfo.getPersonalBigailmentPer());
library.setPersonalBigailmentFee(socialInfo.getPersonalBigailmentMoney());
library.setUnitBitailmentFee(socialInfo.getUnitBigailmentMoney());
} else {
// 大病取值方式:0按定值
library.setUnitBitailmentFee(BigDecimalUtils.isNullToZero(sysBaseSetInfo.getPayCompany()));
library.setPersonalBigailmentFee(BigDecimalUtils.isNullToZero(sysBaseSetInfo.getPayPersonal()));
library.setUnitBitailmentFee(socialInfo.getUnitBigailmentMoney());
library.setPersonalBigailmentFee(socialInfo.getPersonalBigailmentMoney());
}
}
}
private void changeFundInfoByBase(TSocialFundInfo socialFund, SysBaseSetInfo socialSet) {
if (Common.isNotNull(socialSet) && socialFund.getUnitFundSum() != null) {
socialFund.setLowerLimitFund(socialSet.getLowerLimit());
socialFund.setUpperLimitFund(socialSet.getUpperLimit());
socialFund.setFundPayPoint(String.valueOf(socialSet.getFundPayPoint()));
if (socialFund.getUnitProvidengCardinal().compareTo(socialSet.getLowerLimit()) < CommonConstants.ZERO_INT) {
socialFund.setUnitProvidengCardinal(socialSet.getLowerLimit());
socialFund.setPersonalProvidentCardinal(socialSet.getLowerLimit());
......@@ -1215,6 +1107,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
social.setIsIllness(socialSet.getIsIllness());
social.setOverpayNumber(socialSet.getOverpayNumber());
social.setValueType(socialSet.getValueType());
social.setLowerLimit(socialSet.getLowerLimit());
social.setUpperLimit(socialSet.getUpperLimit());
// 比例初始化
// 按最低
if (CommonConstants.ZERO_STRING.equals(social.getPaymentType())) {
......
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