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

Merge branch 'develop' into feature-licancan

parents 409d7277 6033028b
......@@ -448,4 +448,12 @@ public interface ErrorCodes {
* 派增异常: 社保各项起缴日不一致,委托备注必填
*/
String EMP_DISPATCH_SOCIAL_DATE_LIMIT_ERROR = "emp.dispatch.social.date.limit.error";
/**
* 派增异常: 社保各项起缴月份需为可补缴月份,请确认后操作!
*/
String EMP_DISPATCH_SOCIAL_START_IS_ERROR = "emp.dispatch.social.start.is.error";
/**
* 派增异常: 公积金起缴月份需为可补缴月份,请确认后操作!
*/
String EMP_DISPATCH_FUND_DATE_LIMIT_ERROR = "emp.dispatch.fund.start.is.error";
}
......@@ -167,6 +167,10 @@ emp.dispatch.social.base.limit.error=\u6D3E\u589E\u5F02\u5E38\uFF1A \u793E\u4FDD
emp.dispatch.social.date.limit.error=\u6D3E\u589E\u5F02\u5E38\uFF1A \u793E\u4FDD\u5404\u9879\u8D77\u7F34\u65E5\u4E0D\u4E00\u81F4\uFF0C\u59D4\u6258\u5907\u6CE8\u5FC5\u586B
emp.dispatch.social.start.is.error=\u6D3E\u589E\u5F02\u5E38\uFF1A \u793E\u4FDD\u5404\u9879\u8D77\u7F34\u6708\u4EFD\u9700\u4E3A\u53EF\u8865\u7F34\u6708\u4EFD\uFF0C\u8BF7\u786E\u8BA4\u540E\u64CD\u4F5C\uFF01
emp.dispatch.fund.start.is.error=\u6D3E\u589E\u5F02\u5E38\uFF1A \u516C\u79EF\u91D1\u8D77\u7F34\u6708\u4EFD\u9700\u4E3A\u53EF\u8865\u7F34\u6708\u4EFD\uFF0C\u8BF7\u786E\u8BA4\u540E\u64CD\u4F5C\uFF01
......
......@@ -148,22 +148,6 @@ public class TPaymentInfo extends BaseEntity {
@ExcelProperty("锁定状态 0 未锁定 1 锁定")
private String lockStatus;
/**
* 社保结算状态 0: 未结算 1: 待结算 2: 已结算
*/
@ExcelAttribute(name = "社保结算状态 0: 未结算 1: 待结算 2: 已结算" )
@Schema(description ="社保结算状态 0: 未结算 1: 待结算 2: 已结算")
@ExcelProperty("社保结算状态 0: 未结算 1: 待结算 2: 已结算")
private String socialSettlementFlag;
/**
* 公积金结算状态
*/
@ExcelAttribute(name = "公积金结算状态" )
@Schema(description ="公积金结算状态")
@ExcelProperty("公积金结算状态")
private String fundSettlementFlag;
/**
* 总合计
*/
......@@ -316,22 +300,6 @@ public class TPaymentInfo extends BaseEntity {
@ExcelProperty("公积金核准表ID")
private String fundSettlementId;
/**
* 工资社保结算状态 0: 未结算 1: 已结算
*/
@ExcelAttribute(name = "工资社保结算状态 0: 未结算 1: 已结算" )
@Schema(description ="工资社保结算状态 0: 未结算 1: 已结算")
@ExcelProperty("工资社保结算状态 0: 未结算 1: 已结算")
private String salarySocialFlag;
/**
* 工资公积金结算状态 0: 未结算 1: 已结算
*/
@ExcelAttribute(name = "工资公积金结算状态 0: 未结算 1: 已结算" )
@Schema(description ="工资公积金结算状态 0: 未结算 1: 已结算")
@ExcelProperty("工资公积金结算状态 0: 未结算 1: 已结算")
private String salaryFundFlag;
/**
* 就职班组
*/
......@@ -372,6 +340,14 @@ public class TPaymentInfo extends BaseEntity {
@ExcelProperty("财务账单ID")
private String financeBillId;
/**
* 财务账单ID
*/
@ExcelAttribute(name = "推送状态 0已推送 1未推送" )
@Schema(description ="推送状态 0已推送 1未推送")
@ExcelProperty("推送状态 0已推送 1未推送")
private String pushStatus;
/**
* 单位社保补缴利息
*/
......
......@@ -54,7 +54,7 @@ public class TDispatchImportVo extends RowIndex implements Serializable {
* 身份证号
*/
@Length(max = 20, message = "身份证号 不能超过20 个字符" )
@ExcelAttribute(name = "身份证号", maxLength = 20, isNotEmpty = true)
@ExcelAttribute(name = "身份证号", maxLength = 20)
@Schema(description = "身份证号" )
@ExcelProperty("身份证号" )
private String empIdcard;
......@@ -62,7 +62,7 @@ public class TDispatchImportVo extends RowIndex implements Serializable {
* 员工类型
*/
@Length(max = 32, message = "员工类型 不能超过32 个字符" )
@ExcelAttribute(name = "员工类型", maxLength = 32, isDataId = true,dataType = ExcelAttributeConstants.EMP_NATRUE, isNotEmpty = true)
@ExcelAttribute(name = "员工类型", maxLength = 32, isDataId = true,dataType = ExcelAttributeConstants.EMP_NATRUE)
@Schema(description = "员工类型" )
@ExcelProperty("员工类型" )
private String empType;
......@@ -70,7 +70,7 @@ public class TDispatchImportVo extends RowIndex implements Serializable {
* 手机号码
*/
@Length(max = 32, message = "手机号码 不能超过32 个字符" )
@ExcelAttribute(name = "手机号码", maxLength = 32, isNotEmpty = true)
@ExcelAttribute(name = "手机号码", maxLength = 32)
@Schema(description = "手机号码" )
@ExcelProperty("手机号码" )
private String empMobile;
......@@ -123,7 +123,7 @@ public class TDispatchImportVo extends RowIndex implements Serializable {
/**
* 档案-市
*/
@ExcelAttribute(name = "档案-市" ,isArea = true,parentField = "fileProvince", isNotEmpty = true)
@ExcelAttribute(name = "档案-市" ,isArea = true,parentField = "fileProvince")
@Schema(description = "档案-市" )
@ExcelProperty("档案-市" )
private String fileCity;
......
......@@ -40,7 +40,7 @@ public class TPaymentInfoImportLogVo extends RowIndex implements Serializable {
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "主键 不能为空")
@ExcelAttribute(name = "主键", isNotEmpty = true, errorInfo = "主键 不能为空")
@ExcelAttribute(name = "id", isNotEmpty = true, errorInfo = "主键 不能为空")
@Schema(description = "主键")
@ExcelProperty("主键")
private Integer id;
......@@ -48,7 +48,7 @@ public class TPaymentInfoImportLogVo extends RowIndex implements Serializable {
* 姓名
*/
@Length(max = 50, message = "姓名 不能超过50 个字符")
@ExcelAttribute(name = "姓名", maxLength = 50)
@ExcelAttribute(name = "empName", maxLength = 50)
@Schema(description = "姓名")
@ExcelProperty("姓名")
private String empName;
......@@ -56,7 +56,7 @@ public class TPaymentInfoImportLogVo extends RowIndex implements Serializable {
* 身份证号
*/
@Length(max = 32, message = "身份证号 不能超过32 个字符")
@ExcelAttribute(name = "身份证号", maxLength = 32)
@ExcelAttribute(name = "idCard", maxLength = 32)
@Schema(description = "身份证号")
@ExcelProperty("身份证号")
private String idCard;
......@@ -64,14 +64,14 @@ public class TPaymentInfoImportLogVo extends RowIndex implements Serializable {
* 错误信息
*/
@Length(max = 500, message = "错误信息 不能超过500 个字符")
@ExcelAttribute(name = "错误信息", maxLength = 500)
@ExcelAttribute(name = "errMsg", maxLength = 500)
@Schema(description = "错误信息")
@ExcelProperty("错误信息")
private String errMsg;
/**
* 问题行数
*/
@ExcelAttribute(name = "问题行数")
@ExcelAttribute(name = "line")
@Schema(description = "问题行数")
@ExcelProperty("问题行数")
private Integer line;
......@@ -79,7 +79,7 @@ public class TPaymentInfoImportLogVo extends RowIndex implements Serializable {
* 导入标识key
*/
@Length(max = 64, message = "导入标识key 不能超过64 个字符")
@ExcelAttribute(name = "导入标识key", maxLength = 64)
@ExcelAttribute(name = "randomKey", maxLength = 64)
@Schema(description = "导入标识key")
@ExcelProperty("导入标识key")
private String randomKey;
......
......@@ -145,22 +145,6 @@ public class TPaymentInfoVo extends RowIndex implements Serializable {
@Schema(description = "锁定状态 0 未锁定 1 锁定")
@ExcelProperty("锁定状态 0 未锁定 1 锁定")
private String lockStatus;
/**
* 社保结算状态 0: 未结算 1: 待结算 2: 已结算
*/
@Length(max = 1, message = "社保结算状态 0: 未结算 1: 待结算 2: 已结算 不能超过1 个字符")
@ExcelAttribute(name = "社保结算状态 0: 未结算 1: 待结算 2: 已结算", maxLength = 1)
@Schema(description = "社保结算状态 0: 未结算 1: 待结算 2: 已结算")
@ExcelProperty("社保结算状态 0: 未结算 1: 待结算 2: 已结算")
private String socialSettlementFlag;
/**
* 公积金结算状态
*/
@Length(max = 1, message = "公积金结算状态 不能超过1 个字符")
@ExcelAttribute(name = "公积金结算状态", maxLength = 1)
@Schema(description = "公积金结算状态")
@ExcelProperty("公积金结算状态")
private String fundSettlementFlag;
/**
* 总合计
*/
......@@ -308,22 +292,6 @@ public class TPaymentInfoVo extends RowIndex implements Serializable {
@Schema(description = "公积金核准表ID")
@ExcelProperty("公积金核准表ID")
private String fundSettlementId;
/**
* 工资社保结算状态 0: 未结算 1: 已结算
*/
@Length(max = 1, message = "工资社保结算状态 0: 未结算 1: 已结算 不能超过1 个字符")
@ExcelAttribute(name = "工资社保结算状态 0: 未结算 1: 已结算", maxLength = 1)
@Schema(description = "工资社保结算状态 0: 未结算 1: 已结算")
@ExcelProperty("工资社保结算状态 0: 未结算 1: 已结算")
private String salarySocialFlag;
/**
* 工资公积金结算状态 0: 未结算 1: 已结算
*/
@Length(max = 1, message = "工资公积金结算状态 0: 未结算 1: 已结算 不能超过1 个字符")
@ExcelAttribute(name = "工资公积金结算状态 0: 未结算 1: 已结算", maxLength = 1)
@Schema(description = "工资公积金结算状态 0: 未结算 1: 已结算")
@ExcelProperty("工资公积金结算状态 0: 未结算 1: 已结算")
private String salaryFundFlag;
/**
* 就职班组
*/
......
......@@ -7,17 +7,6 @@ package com.yifu.cloud.plus.v1.yifu.social.constants;
**/
public class PaymentConstants {
public static final String saveFailExistsSocialSettlement = "社保数据已生成核准表,无法删除!";
public static final String saveFailExistsSalarySocialSettlement = "社保数据已工资结算,无法删除!";
public static final String saveFailExistsFundSettlement = "公积金数据已生成核准表,无法删除!";
public static final String saveFailExistsSalaryFundSettlement = "公积金数据已工资结算,无法删除!";
public static final String saveFailExistsAgentSettlement = "对应缴费库数据已生成代理类结算单,无法删除!";
public static final String saveFailExistsFinanceBillSettlement = "数据已生成财务账单,无法删除!";
public static final String PENSION_RISK = "养老保险";
public static final String PENSION = "养老";
public static final String UNEMPLOYEEMENT_RISK = "失业保险";
......
......@@ -96,24 +96,21 @@ public class TPaymentInfoController {
@SysLog("通过id删除缴费库" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_del')" )
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tPaymentInfoService.removeById(id));
public R removeById(@PathVariable String id) {
return tPaymentInfoService.removeInFoById(id);
}
/**
* 按类型删除
* @author huyc
* @date 2022-07-22 17:01:22
* @param id
* @param type
* @return
**/
@Operation(summary = "按类型删除", description = "按类型删除:hasPermission('social_tpaymentinfo_del')")
@SysLog("按类型删除缴费库")
@GetMapping("/removeByIdAndType")
* 通过ids删除一条记录
* @param ids
* @return R
*/
@Operation(summary = "通过ids删除缴费库", description = "通过ids删除缴费库:hasPermission('social_tpaymentinfo_del')")
@SysLog("删除缴费库")
@DeleteMapping("/removeBatchByIds")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_del')")
public R<Boolean> removeByIdAndType(@RequestParam String id, @RequestParam String type) {
return tPaymentInfoService.removeByIdAndType(id,type);
public R<Boolean> removeBatchByIds(String ids) {
return tPaymentInfoService.removeAllInfoById(ids);
}
/**
......@@ -177,31 +174,9 @@ public class TPaymentInfoController {
**/
@Operation(description = "导出缴费库 hasPermission('social_tpaymentinfo_export')")
@PostMapping("/export")
// @PreAuthorize("@pms.hasPermission('social_tpaymentinfo_export')")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_export')")
public void export(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) {
tPaymentInfoService.listExport(response,searchVo);
}
/**
* 删除当前登录人当前月的社保或公积金数据
* @param type 0 全部删除 1 删除社保 2 删除公积金 必填
* @param settleDepartId 项目ID 可选
* @param unitId 单位ID 可选
* @param empIdCard 员工身份证 可选
* @param socialHouseId 社保户 可选
* @param fundHouseId 公积金户 可选
* @return R
*/
@Operation(description = "删除(social_tpaymentinfo_del)")
@SysLog("删除缴费库")
@PostMapping("/removeBatchByIdsAndType")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_del')")
public R removeBatchByIdsAndType(@RequestParam(name = "type",required = true) String type,
@RequestParam(name = "settleDepartId",required = false) String settleDepartId,
@RequestParam(name = "unitId",required = false) String unitId,
@RequestParam(name = "empIdCard",required = false) String empIdCard,
@RequestParam(name = "socialHouseId",required = false) String socialHouseId,
@RequestParam(name = "fundHouseId",required = false) String fundHouseId) {
return tPaymentInfoService.removeBatchByIdsAndType(type,settleDepartId,unitId,empIdCard,socialHouseId,fundHouseId);
}
}
......@@ -71,36 +71,32 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
*/
void listExport(HttpServletResponse response, TPaymentInfoSearchVo searchVo);
/**
* 按类型删除
* 删除缴费库数据 包括明细
* @Author huyc
* @Date 2022-07-24
* @param id
* @param type
* @return
**/
R<Boolean> removeByIdAndType(String id, String type);
R removeInFoById(String id);
/**
* 通过ID获取缴费库 及社保、公积金明细
* 删除缴费库数据 包括明细
* @Author huyc
* @Date 2022-07-24
* @param id
* @param ids
* @return
**/
R getAllInfoById(String id);
R<Boolean> removeAllInfoById(String ids);
/**
* 删除当月 当前登录人的 指定类型的缴费库数据
* 通过ID获取缴费库 及社保、公积金明细
* @Author huyc
* @Date 2022-07-27
* @param type
* @param settleDepartId
* @param unitId
* @param empIdCard
* @param socialHouseId
* @param fundHouseId
* @Date 2022-07-24
* @param id
* @return
**/
R removeBatchByIdsAndType(String type, String settleDepartId, String unitId, String empIdCard, String socialHouseId, String fundHouseId);
R getAllInfoById(String id);
}
......@@ -820,6 +820,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dispatch.setFileCity(empVo.getFileCity());
dispatch.setFileTown(empVo.getFileTown());
dispatch.setContractId(empVo.getContractId());
dispatch.setEmpType(empVo.getEmpNatrue());
if (Common.isNotNull(empVo.getIdProvince())){
dispatch.setIdCardProvince(Common.isNotNullToStr(empVo.getIdProvince()));
dispatch.setIdCardCity(Common.isNotNullToStr(empVo.getIdCity()));
......@@ -856,6 +857,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
fund.setProvidentStart(excel.getProvidentStart());
if (Common.isNotNull(fundSet)){
fund.setProvidentHousehold(fundSet.getDepartId());
fund.setProvidentHouseholdName(fundSet.getDepartName());
if (!checkFundPer(fundSet.getFundProList(), excel)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_FUND_PERCENT_NOT_EXIST)));
return true;
......@@ -1361,6 +1363,18 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_EMP_NOT_USED)));
return true;
}
if (Common.isEmpty(empVo.getContractStart()) && Common.isEmpty(excel.getContractStart())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_EMP_NOT_USED)));
return true;
}
excel.setEmpType(empVo.getEmpNatrue());
excel.setEmpMobile(empVo.getEmpPhone());
excel.setFileProvince(Common.isNotNullToStr(empVo.getFileProvince()));
excel.setFileCity(Common.isNotNullToStr(empVo.getFileCity()));
excel.setFileTown(Common.isNotNullToStr(empVo.getFileTown()));
excel.setIdCardProvince(Common.isNotNullToStr(empVo.getIdProvince()));
excel.setIdCardCity(Common.isNotNullToStr(empVo.getIdCity()));
excel.setIdCardTown(Common.isNotNullToStr(empVo.getIdCity()));
}
excel.setSettleDomainId(setInfoVo.getId());
excel.setDepartName(setInfoVo.getDepartName());
......@@ -1434,88 +1448,139 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
if (Common.isNotNull(excel.getSocialHousehold())){
if (Common.isNotNull(socialSet) && CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& (Common.isNotNull(excel.getPensionCardinal())
&& excel.getPensionCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getPensionCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
||(Common.isNotNull(excel.getMedicalCardinal())
&& excel.getMedicalCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getMedicalCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
||(Common.isNotNull(excel.getUnemploymentCardinal())
&& excel.getUnemploymentCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getUnemploymentCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
||(Common.isNotNull(excel.getWorkInjuryCardinal())
&& excel.getWorkInjuryCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getWorkInjuryCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
||(Common.isNotNull(excel.getBirthCardinal())
&& excel.getBirthCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getBirthCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
||(Common.isNotNull(excel.getBigailmentCardinal())
&& excel.getBigailmentCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getBigailmentCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_LIMIT_ERROR)));
// 各个社保基数和日期空 默认养老日期和基数
initExcelBaseAndDate(excel);
// 校验各项起缴日期 查看是否符合社保补缴政策
if (validSocialStartDate(errorMessageList, excel, socialSet)) return true;
//校验各项基数
if (validSocialBaseInfo(errorMessageList, excel, empVo, socialSet)) return true;
}
// 校验公积金上下限和起缴日期
if (Common.isNotNull(excel.getProvidentHousehold())){
if(Common.isNotNull(fundSet)
&& Common.isNotNull(excel.getProvidentCardinal())
&& excel.getProvidentCardinal().compareTo(fundSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getProvidentCardinal().compareTo(fundSet.getLowerLimit())< CommonConstants.ZERO_INT){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_FUND_LIMIT_ERROR)));
return true;
}
if (ServiceUtil.checkDispatchDate(LocalDateTimeUtils.convertDateToLDT(excel.getProvidentStart()),
fundSet.getCanOverpay(),fundSet.getOverpayNumber(),fundSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_FUND_DATE_LIMIT_ERROR)));
return true;
}
// 备案基数和养老基数 养老起缴日期 必填在前面已必填校验,这里不重复校验
if (Common.isEmpty(excel.getRecordBase()) && Common.isEmpty(excel.getSocialHousehold())){
boolean flag = false;
// 各个社保基数和日期空 默认养老日期和基数
initExcelBaseAndDate(excel);
// 自定义 只要有一个不相当同的 日期或基数 就要提示
if (CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& (excel.getPensionCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
|| excel.getMedicalCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
|| excel.getUnemploymentCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
|| excel.getWorkInjuryCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
|| excel.getBirthCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
|| excel.getBigailmentCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_BASE_LIMIT_ERROR)));
return true;
}
Date temp = new Date();
if (Common.isEmpty(empVo)){
temp = excel.getContractStart();
}else if (Common.isNotNull(empVo) && Common.isNotNull(empVo.getContractStart())){
temp = empVo.getContractStart();
}else {
temp = excel.getContractStart();
}
if (CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& (excel.getPensionStart().equals(temp)
|| excel.getMedicalStart().equals(temp)
|| excel.getUnemployStart().equals(temp)
|| excel.getWorkInjuryStart().equals(temp)
|| excel.getBirthStart().equals(temp)
|| excel.getBigailmentStart().equals(temp)
)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_DATE_LIMIT_ERROR)));
return true;
}
// 其他 只用判断对应养老基数和时间 与合同时间 即可
if (!CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& (excel.getPensionStart().equals(temp)
)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_DATE_LIMIT_ERROR)));
return true;
}
if (!CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& excel.getPensionCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_BASE_LIMIT_ERROR)));
return true;
}
}
return false;
}
private boolean validSocialBaseInfo(List<ErrorMessage> errorMessageList, TDispatchImportVo excel, DispatchEmpVo empVo, SysBaseSetInfo socialSet) {
if (Common.isNotNull(socialSet) && CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& (Common.isNotNull(excel.getPensionCardinal())
&& excel.getPensionCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getPensionCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
||(Common.isNotNull(excel.getMedicalCardinal())
&& excel.getMedicalCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getMedicalCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
||(Common.isNotNull(excel.getUnemploymentCardinal())
&& excel.getUnemploymentCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getUnemploymentCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
||(Common.isNotNull(excel.getWorkInjuryCardinal())
&& excel.getWorkInjuryCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getWorkInjuryCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
||(Common.isNotNull(excel.getBirthCardinal())
&& excel.getBirthCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getBirthCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
||(Common.isNotNull(excel.getBigailmentCardinal())
&& excel.getBigailmentCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getBigailmentCardinal().compareTo(socialSet.getLowerLimit())< CommonConstants.ZERO_INT)
){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_LIMIT_ERROR)));
return true;
}
// 备案基数和养老基数 养老起缴日期 必填在前面已必填校验,这里不重复校验
if (Common.isEmpty(excel.getRecordBase()) && Common.isEmpty(excel.getSocialHousehold())){
// 自定义 只要有一个不相当同的 日期或基数 就要提示
if (CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& (excel.getPensionCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
|| excel.getMedicalCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
|| excel.getUnemploymentCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
|| excel.getWorkInjuryCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
|| excel.getBirthCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
|| excel.getBigailmentCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT
)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_BASE_LIMIT_ERROR)));
return true;
}
Date temp = new Date();
if (Common.isEmpty(empVo)){
temp = excel.getContractStart();
}else if (Common.isNotNull(empVo) && Common.isNotNull(empVo.getContractStart())){
temp = empVo.getContractStart();
}else {
temp = excel.getContractStart();
}
if (CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& (excel.getPensionStart().equals(temp)
|| excel.getMedicalStart().equals(temp)
|| excel.getUnemployStart().equals(temp)
|| excel.getWorkInjuryStart().equals(temp)
|| excel.getBirthStart().equals(temp)
|| excel.getBigailmentStart().equals(temp)
)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_DATE_LIMIT_ERROR)));
return true;
}
// 其他 只用判断对应养老基数和时间 与合同时间 即可
if (!CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& (excel.getPensionStart().equals(temp)
)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_DATE_LIMIT_ERROR)));
return true;
}
if (!CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& excel.getPensionCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_BASE_LIMIT_ERROR)));
return true;
}
}
if (Common.isNotNull(excel.getProvidentHousehold())
&& Common.isNotNull(fundSet)
&& Common.isNotNull(excel.getProvidentCardinal())
&& excel.getProvidentCardinal().compareTo(fundSet.getUpperLimit()) > CommonConstants.ZERO_INT
&& excel.getProvidentCardinal().compareTo(fundSet.getLowerLimit())< CommonConstants.ZERO_INT){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_FUND_LIMIT_ERROR)));
return true;
return false;
}
private boolean validSocialStartDate(List<ErrorMessage> errorMessageList, TDispatchImportVo excel, SysBaseSetInfo socialSet) {
if (Common.isNotNull(socialSet) && CommonConstants.ONE_STRING.equals(excel.getPaymentType())){
if (ServiceUtil.checkDispatchDate(LocalDateTimeUtils.convertDateToLDT(excel.getPensionStart()),
socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true;
}
if (ServiceUtil.checkDispatchDate(LocalDateTimeUtils.convertDateToLDT(excel.getMedicalStart()),
socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true;
}
if (ServiceUtil.checkDispatchDate(LocalDateTimeUtils.convertDateToLDT(excel.getUnemployStart()),
socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true;
}
if (ServiceUtil.checkDispatchDate(LocalDateTimeUtils.convertDateToLDT(excel.getWorkInjuryStart()),
socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true;
}
if (ServiceUtil.checkDispatchDate(LocalDateTimeUtils.convertDateToLDT(excel.getBirthStart()),
socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true;
}
if (ServiceUtil.checkDispatchDate(LocalDateTimeUtils.convertDateToLDT(excel.getBigailmentStart()),
socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true;
}
}
return false;
}
......
......@@ -86,7 +86,7 @@ public class TPaymentInfoImportLogServiceImpl extends ServiceImpl<TPaymentInfoIm
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, EmployeeProjectExportVO.class).includeColumnFiledNames(getExportFieldNameDetailByClass(TPaymentInfoImportLogVo.class)).sheet("社保导入日志")
EasyExcel.write(out, TPaymentInfoImportLogVo.class).includeColumnFiledNames(getExportFieldNameDetailByClass(TPaymentInfoImportLogVo.class)).sheet("社保导入日志")
.doWrite(list);
out.flush();
} catch (IOException e) {
......
......@@ -56,14 +56,12 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -184,256 +182,57 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
/**
* 按类型删除 社保或公积金缴费库数据
*
* @param id
* @param type 0 删除社保 1删除公积金
* @return
* @Author huyc
* @Date 2022-07-24
**/
@Override
public R<Boolean> removeByIdAndType(String id, String type) {
public R removeInFoById(String id) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(id) || Common.isEmpty(type)
|| (!CommonConstants.ZERO_STRING.equals(type) && !CommonConstants.ONE_STRING.equals(type))) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
TPaymentInfo info = baseMapper.selectById(id);
R<Boolean> x = removeByIdAndTypeCheck(type, info);
if (x != null) {
return x;
}
if (CommonConstants.ZERO_STRING.equals(type)
&& (CommonConstants.ONE_STRING.equals(info.getSalarySocialFlag())
|| CommonConstants.TWO_STRING.equals(info.getSalarySocialFlag()))) {
return R.failed(PaymentConstants.saveFailExistsSalarySocialSettlement);
TPaymentInfo paymentInfo = baseMapper.selectById(id);
if (!user.getId().equals(paymentInfo.getCreateBy()) && !CommonConstants.ONE_STRING.equals(user.getId())) {
return R.failed("非本人创建的数据禁止删除!");
}
if (CommonConstants.ONE_STRING.equals(type)
&& (CommonConstants.ONE_STRING.equals(info.getSalaryFundFlag())
|| CommonConstants.TWO_STRING.equals(info.getSalaryFundFlag()))) {
return R.failed(PaymentConstants.saveFailExistsSalaryFundSettlement);
if (CommonConstants.ZERO_STRING.equals(paymentInfo.getPushStatus()) &&
!CommonConstants.ONE_STRING.equals(user.getId())) {
return R.failed("已推送至结算平台禁止删除!");
}
// 存在差余额生成
List<String> idList = new ArrayList<>();
idList.add(id);
removeByType(type, info);
baseMapper.deleteById(id);
return R.ok();
}
/**
* 通过ID获取缴费库 及社保、公积金明细
*
* @param id
* @Author huyc
* @Date 2022-07-24
**/
@Override
public R getAllInfoById(String id) {
TPaymentInfoVo vo = baseMapper.getAllInfoById(id);
return R.ok(vo, "查询成功!");
}
@Override
public R removeBatchByIdsAndType(String type, String settleDepartId, String unitId, String empIdCard,
String socialHouseId, String fundHouseId) {
public R<Boolean> removeAllInfoById(String ids) {
YifuUser user = SecurityUtils.getUser();
List<TPaymentInfo> paymentInfoList = null;
TPaymentInfo queryEntity = new TPaymentInfo();
initQueryCondition(user.getId(), settleDepartId, unitId, empIdCard, socialHouseId, fundHouseId, queryEntity,type);
//大于零不可删除
// int socialSettleCount = 0;
// int salarySettleCount = 0;
// socialSettleCount = baseMapper.selectCountForDelete(queryEntity,CommonConstants.ZERO_INT,type);
// if (socialSettleCount > 0) {
// return R.failed(PaymentConstants.paymentSaveFailExistsSettlement);
// }
// salarySettleCount = baseMapper.selectCountForDelete(queryEntity,CommonConstants.ONE_INT,type);
// if (salarySettleCount > 0) {
// return R.failed(PaymentConstants.paymentSaveFailExistsSalarySettlement);
// }
paymentInfoList = baseMapper.selectListForDelete(queryEntity);
if (Common.isEmpty(paymentInfoList)){
if (Common.isEmpty(ids)){
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
// 删除操作开始
deletePaymentByType(type, paymentInfoList);
return R.ok();
}
List<String> idList = Common.initStrToList(ids, CommonConstants.COMMA_STRING);
TPaymentInfo paymentInfo = null;
/**
* 删除社保或公积金校验
*
* @param type
* @param info
* @Author huyc
* @Date 2022-07-24
* @return
**/
private R<Boolean> removeByIdAndTypeCheck(String type, TPaymentInfo info) {
if (null == info) {
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
// 已财务账单结算不可删除
if (Common.isNotNull(info.getFinanceBillId())) {
return R.failed(PaymentConstants.saveFailExistsFinanceBillSettlement);
}
if (CommonConstants.ZERO_STRING.equals(type) && Common.isNotNull(info.getSocialSettlementId())) {
return R.failed(PaymentConstants.saveFailExistsSocialSettlement);
}
if (CommonConstants.ONE_STRING.equals(type) && Common.isNotNull(info.getFundSettlementId())) {
return R.failed(PaymentConstants.saveFailExistsFundSettlement);
}
if (Common.isNotNull(info.getAgentId())) {
return R.failed(PaymentConstants.saveFailExistsAgentSettlement);
}
return null;
}
/**
* 初始化查询条件
* @Author huyc
* @Date 2022-07-27
* @param userId
* @param settleDepartId
* @param unitId
* @param empIdCard
* @param socialHouseId
* @param fundHouseId
* @param queryEntity
* @param type 0 全部删除 1 删除社保 2 删除公积金 必填
* @return
**/
private void initQueryCondition(String userId, String settleDepartId, String unitId, String empIdCard,
String socialHouseId, String fundHouseId, TPaymentInfo queryEntity,String type) {
queryEntity.setCreateBy(userId);
// 公积金删除 以外的情况 都是查社保生成月份删除
if (CommonConstants.ZERO_STRING.equals(type)){
queryEntity.setSocialCreateMonth( DateUtil.getYearAndMonth(LocalDateTime.now(),0));
queryEntity.setProvidentCreateMonth( DateUtil.getYearAndMonth(LocalDateTime.now(),0));
}else if (CommonConstants.ONE_STRING.equals(type)){
queryEntity.setSocialCreateMonth( DateUtil.getYearAndMonth(LocalDateTime.now(),0));
}else if (CommonConstants.TWO_STRING.equals(type)){
queryEntity.setProvidentCreateMonth( DateUtil.getYearAndMonth(LocalDateTime.now(),0));
}
if (Common.isNotNull(settleDepartId)){
queryEntity.setSettleDomainId(settleDepartId);
}
if (Common.isNotNull(unitId)){
queryEntity.setUnitId(unitId);
}
if (Common.isNotNull(empIdCard)){
queryEntity.setEmpIdcard(empIdCard);
}
if (Common.isNotNull(socialHouseId)){
queryEntity.setSocialHousehold(socialHouseId);
}
if (Common.isNotNull(fundHouseId)){
queryEntity.setProvidentHousehold(fundHouseId);
for (String id : idList) {
paymentInfo = baseMapper.selectById(id);
if (null != paymentInfo && Common.isNotNull(paymentInfo.getId())) {
if ((!user.getId().equals(paymentInfo.getCreateBy()) ||
CommonConstants.ZERO_STRING.equals(paymentInfo.getPushStatus()))
&& !CommonConstants.ONE_STRING.equals(user.getId())) {
return R.failed("存在不符合条件的数据(已推送至结算平台或非本人创建),禁止删除!");
}
baseMapper.deleteById(id);
}
}
return R.ok();
}
/**
* 删除社保或公积金
* 通过ID获取缴费库 及社保、公积金明细
*
* @param type
* @param info
* @param id
* @Author huyc
* @Date 2022-07-24
* @return
**/
private void removeByType(String type, TPaymentInfo info) {
// 只删除社保
if (CommonConstants.ZERO_STRING.equals(type) && Common.isNotNull(info.getSocialId())) {
info.setSumAll(BigDecimalUtils.safeAdd(info.getProvidentSum()));
info.setSocialSum(BigDecimal.ZERO);
info.setUnitSocialSum(BigDecimal.ZERO);
info.setSocialSecurityPersonalSum(BigDecimal.ZERO);
info.setSocialHousehold(null);
info.setSocialId(null);
if (Common.isNotNull(info.getFundId())) {
baseMapper.updateDeleteInfo(info);
} else {
baseMapper.deleteById(info.getId());
}
// 只删除公积金
} else if (CommonConstants.ONE_STRING.equals(type) && Common.isNotNull(info.getFundId())) {
info.setSumAll(BigDecimalUtils.safeAdd(info.getSocialSum()));
info.setProvidentSum(BigDecimal.ZERO);
info.setProvidentHousehold(null);
info.setFundId(null);
if (Common.isNotNull(info.getSocialId())) {
baseMapper.updateDeleteInfo(info);
} else {
baseMapper.deleteById(info.getId());
}
}
}
/**
* 按类型删除缴费库数据
* @Author huyc
* @Date 2022-07-27
* @param type
* @param paymentInfoList
* @return
**/
private void deletePaymentByType(String type, List<TPaymentInfo> paymentInfoList) {
for (TPaymentInfo info:paymentInfoList){
// 全部删除
if (CommonConstants.ZERO_STRING.equals(type)){
if (Common.isNotNull(info.getId())){
baseMapper.deleteById(info.getId());
}
// 只删除社保
}else if (CommonConstants.ONE_STRING.equals(type)){
info.setSumAll(BigDecimalUtils.safeAdd(info.getProvidentSum()));
info.setSocialSum(BigDecimal.ZERO);
info.setUnitSocialSum(BigDecimal.ZERO);
info.setSocialSecurityPersonalSum(BigDecimal.ZERO);
info.setSocialHousehold(null);
info.setSocialId(null);
if (Common.isNotNull(info.getFundId())){
baseMapper.updateDeleteInfo(info);
}else {
baseMapper.deleteById(info.getId());
}
// 只删除公积金
}else if (CommonConstants.TWO_STRING.equals(type)){
info.setSumAll(BigDecimalUtils.safeAdd(info.getSocialSum()));
info.setProvidentSum(BigDecimal.ZERO);
info.setProvidentHousehold(null);
info.setFundId(null);
if (Common.isNotNull(info.getSocialId())){
baseMapper.updateDeleteInfo(info);
}else {
baseMapper.deleteById(info.getId());
}
}
}
}
private Long noPageCountDiy(TPaymentInfoSearchVo searchVo) {
LambdaQueryWrapper<TPaymentInfo> wrapper = buildQueryWrapper(searchVo);
if (Common.isNotNull(searchVo.getIdList())) {
wrapper.in(TPaymentInfo::getId, searchVo.getIdList());
}
return baseMapper.selectCount(wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(TPaymentInfoSearchVo entity) {
LambdaQueryWrapper<TPaymentInfo> wrapper = Wrappers.lambdaQuery();
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(TPaymentInfo::getCreateTime, entity.getCreateTimes()[0])
.le(TPaymentInfo::getCreateTime,
entity.getCreateTimes()[1]);
}
if (Common.isNotNull(entity.getCreateName())) {
wrapper.eq(TPaymentInfo::getCreateName, entity.getCreateName());
}
return wrapper;
@Override
public R getAllInfoById(String id) {
TPaymentInfoVo vo = baseMapper.getAllInfoById(id);
return R.ok(vo, "查询成功!");
}
@Override
......@@ -1163,15 +962,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo.setSocialPayAddr(paymentInfo.getSocialPayAddr() + CommonConstants.CENTER_SPLIT_LINE_STRING + temp);
}
}
// 同时设置公积金缴纳地 如果是安徽省公积金不做变更
if (!CommonConstants.ANHUISTRING.equals(paymentInfo.getProvidentPayAddr())) {
paymentInfo.setProvidentPayAddr(paymentInfo.getSocialPayAddr());
}
paymentInfo.setSocialSettlementFlag(CommonConstants.ZERO_STRING);
paymentInfo.setSocialSecurityNo(infoVo.getSocialSecurityNo());
paymentInfo.setSocialCreateMonth(infoVo.getSocialCreateMonth());
// 同时增加公积金生成月
paymentInfo.setProvidentCreateMonth(paymentInfo.getSocialCreateMonth());
paymentInfo.setUnitPensionMoney(infoVo.getUnitPensionMoney());
paymentInfo.setUnitMedicalMoney(infoVo.getUnitMedicalMoney());
paymentInfo.setUnitBirthMoney(null == infoVo.getUnitBirthMoney() ? BigDecimal.ZERO : infoVo.getUnitBirthMoney());
......@@ -1216,7 +1008,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
, paymentInfo.getPersonalAccrual()));
paymentInfo.setSocialSum(BigDecimalUtils.safeAdd(
paymentInfo.getUnitSocialSum(), paymentInfo.getSocialSecurityPersonalSum()));
paymentInfo.setSumAll(BigDecimalUtils.safeAdd(paymentInfo.getSocialSum(), paymentInfo.getProvidentSum()));
paymentInfo.setSumAll(paymentInfo.getSocialSum());
paymentInfo.setUpdateBy(user.getId());
if (null != paymentInfo && Common.isEmpty(paymentInfo.getSocialId())) {
paymentInfo.setSocialId(UUID.randomUUID().toString());
......@@ -1678,53 +1470,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo = null;
}
//安徽省的公积金合并到合肥市的社保缴费库数据中
if (CommonConstants.ANHUISTRING.equals(infoVo.getProvidentPayAddr())) {
paymentInfoListTemp = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.and(obj -> obj
.eq(TPaymentInfo::getSocialPayAddr, CommonConstants.HEFEISTRING)
.or()
.eq(TPaymentInfo::getProvidentPayAddr, CommonConstants.ANHUISTRING))
.eq(TPaymentInfo::getEmpIdcard, infoVo.getEmpIdcard())
.eq(TPaymentInfo::getProvidentPayMonth, infoVo.getProvidentPayMonth().trim())
.eq(TPaymentInfo::getProvidentCreateMonth, infoVo.getProvidentCreateMonth().trim()));
} else {
paymentInfoListTemp = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getSocialPayAddr, infoVo.getProvidentPayAddr())
.eq(TPaymentInfo::getEmpIdcard, infoVo.getEmpIdcard())
.eq(TPaymentInfo::getProvidentPayMonth, infoVo.getProvidentPayMonth().trim())
.eq(TPaymentInfo::getProvidentCreateMonth, infoVo.getProvidentCreateMonth().trim()));
}
if (Common.isNotNull(paymentInfoListTemp)) {
for (TPaymentInfo info : paymentInfoListTemp) {
cTemp = BigDecimalUtils.safeAdd(infoVo.getUnitProvidentSum(), infoVo.getPersonalProvidentSum());
//如果是退费:社保为零 或 社保相等更新
if ((BigDecimalUtils.isNullToZero(info.getSumAll()).compareTo(BigDecimal.ZERO) < 0) &&
cTemp.compareTo(BigDecimal.ZERO) < 0 &&
(BigDecimalUtils.isNullToZero(info.getProvidentSum()).compareTo(BigDecimal.ZERO) == 0
|| cTemp.compareTo(info.getProvidentSum()) == 0)) {
paymentInfo = info;
break;
}
//社保为零 或者社保金额相等是更新 其他新增
if ((BigDecimalUtils.isNullToZero(info.getProvidentSum()).compareTo(BigDecimal.ZERO) == 0
&& BigDecimalUtils.isNullToZero(info.getSumAll()).compareTo(BigDecimal.ZERO) > 0)
|| (BigDecimalUtils.isNullToZero(info.getProvidentSum()).compareTo(BigDecimal.ZERO) > 0
&& cTemp.compareTo(info.getProvidentSum()) == 0)) {
paymentInfo = info;
break;
}
}
}
if (Common.isNotNull(paymentInfo) &&
(CommonConstants.ONE_STRING.equals(paymentInfo.getSalaryFundFlag())
|| CommonConstants.TWO_STRING.equals(paymentInfo.getSalaryFundFlag()))) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "对应员工身份证" +
infoVo.getEmpName() + CommonConstants.DOWN_LINE_STRING + infoVo.getEmpIdcard()
+ "公积金缴费数据已薪资结算,无法更新!"));
continue;
}
if (null == paymentInfo) {
paymentInfo = new TPaymentInfo();
paymentInfo.setLockStatus(CommonConstants.ZERO_STRING);
......@@ -1740,11 +1485,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo.setProvidentPayMonth(infoVo.getProvidentPayMonth());
//同时设置社保缴纳日期方便导入处理
paymentInfo.setSocialPayMonth(infoVo.getProvidentPayMonth());
paymentInfo.setFundSettlementFlag(CommonConstants.ZERO_STRING);
paymentInfo.setFundProvince(fund.getFundProvince());
paymentInfo.setFundCity(fund.getFundCity());
paymentInfo.setFundTown(fund.getFundTown());
paymentInfo.setProvidentHousehold(fund.getProvidentHousehold());
if (null != paymentInfo.getFundProvince()) {
temp = areaMap.get(paymentInfo.getFundProvince());
......@@ -1766,14 +1509,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
+ CommonConstants.CENTER_SPLIT_LINE_STRING + temp);
}
}
if (CommonConstants.ANHUISTRING.equals(paymentInfo.getProvidentPayAddr())) {
paymentInfo.setSocialPayAddr(CommonConstants.HEFEISTRING);
} else {
paymentInfo.setSocialPayAddr(paymentInfo.getProvidentPayAddr());
}
paymentInfo.setProvidentCreateMonth(infoVo.getProvidentCreateMonth());
//同步新增社保生成月份
paymentInfo.setSocialCreateMonth(paymentInfo.getProvidentCreateMonth());
paymentInfo.setUnitProvidentSet(null == infoVo.getUnitProvidentSet() ? BigDecimal.ZERO : infoVo.getUnitProvidentSet());
paymentInfo.setPersonalProidentSet(null == infoVo.getUnitProvidentSet() ? BigDecimal.ZERO : infoVo.getUnitProvidentSet());
paymentInfo.setProvidentPercent(null == infoVo.getProvidentPercent() ? BigDecimal.ZERO : infoVo.getProvidentPercent());
......@@ -1781,7 +1518,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo.setPersonalProvidentSum(null == infoVo.getUnitProvidentSum() ? BigDecimal.ZERO : infoVo.getUnitProvidentSum());
paymentInfo.setUnitProvidentSum(null == infoVo.getUnitProvidentSum() ? BigDecimal.ZERO : infoVo.getUnitProvidentSum());
paymentInfo.setProvidentSum(BigDecimalUtils.safeAdd(paymentInfo.getUnitProvidentSum(), paymentInfo.getPersonalProvidentSum()));
paymentInfo.setSumAll(BigDecimalUtils.safeAdd(paymentInfo.getSocialSum(), paymentInfo.getProvidentSum()));
paymentInfo.setSumAll(paymentInfo.getProvidentSum());
if (null != paymentInfo && Common.isEmpty(paymentInfo.getFundId())) {
paymentInfo.setFundId(UUID.randomUUID().toString());
}
......@@ -2193,16 +1930,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
//存在社保缴费数据
if (Common.isNotNull(payExists)) {
// 已结算 提示, 考虑到退费和正常缴纳的 :1.正交缴纳和退费: 生成月份+缴纳月份不可能一致的无需派单 2.异地缴纳:不同区域缴纳也不用判断
if (CommonConstants.ONE_STRING.equals(payExists.getSalarySocialFlag())
|| CommonConstants.TWO_STRING.equals(payExists.getSalarySocialFlag())
|| CommonConstants.ONE_STRING.equals(payExists.getSocialSettlementFlag())
|| CommonConstants.TWO_STRING.equals(payExists.getSocialSettlementFlag())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "对应员工身份证" + infoVo.getEmpIdcard()
+ "社保已工资或核准表结算!", i, random));
continue;
}
// 校验每种险种是否可以导入
if (checkImportInfo(random, i, logList, payExists, infoVo, type)) {
continue;
......@@ -2221,9 +1948,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
payExists.setUnitId(socialInfo.getBelongUnit());
payExists.setInauguralTeam(socialInfo.getInauguralTeam());
payExists.setTelecomNumber(socialInfo.getTelecomNumber());
payExists.setSalaryFundFlag(CommonConstants.ZERO_STRING);
payExists.setSalarySocialFlag(CommonConstants.ZERO_STRING);
payExists.setSocialSettlementFlag(CommonConstants.ZERO_STRING);
}
payExists.setSocialProvince(socialInfo.getSocialProvince());
payExists.setSocialCity(socialInfo.getSocialCity());
......@@ -2252,15 +1976,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
payExists.setSocialPayAddr(payExists.getSocialPayAddr() + CommonConstants.CENTER_SPLIT_LINE_STRING + temp);
}
}
// 同时设置公积金缴纳地 如果是安徽省公积金不做变更
if (!CommonConstants.ANHUISTRING.equals(payExists.getProvidentPayAddr())) {
payExists.setProvidentPayAddr(payExists.getSocialPayAddr());
}
payExists.setSocialSettlementFlag(CommonConstants.ZERO_STRING);
payExists.setSocialSecurityNo(infoVo.getSocialSecurityNo());
payExists.setSocialCreateMonth(infoVo.getSocialCreateMonth());
// 同时增加公积金生成月
payExists.setProvidentCreateMonth(payExists.getSocialCreateMonth());
if (PaymentConstants.PENSION_RISK.equals(infoVo.getRiskType())) {
payExists.setUnitPensionMoney(infoVo.getUnitMoney());
payExists.setPersonalPensionMoney(infoVo.getPersonalMoney());
......@@ -2320,7 +2037,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
, payExists.getSocialSecurityPersonalSum()));
}
payExists.setSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitSocialSum(), payExists.getSocialSecurityPersonalSum()));
payExists.setSumAll(BigDecimalUtils.safeAdd(payExists.getSocialSum(), payExists.getProvidentSum()));
payExists.setSumAll(payExists.getSocialSum());
if (null != payExists && Common.isEmpty(payExists.getSocialId())) {
payExists.setSocialId(UUID.randomUUID().toString());
}
......@@ -2441,10 +2158,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
to.setUnitSocialSum(from.getUnitSocialSum());
to.setSocialSecurityPersonalSum(from.getSocialSecurityPersonalSum());
to.setProvidentSum(from.getProvidentSum());
to.setSalarySocialFlag(from.getSalarySocialFlag());
to.setSalaryFundFlag(from.getSalaryFundFlag());
to.setSocialSettlementFlag(from.getSocialSettlementFlag());
to.setFundSettlementFlag(from.getFundSettlementFlag());
to.setSocialSettlementId(from.getSocialSettlementId());
to.setFundSettlementId(from.getFundSettlementId());
to.setInauguralTeam(from.getInauguralTeam());
......
......@@ -155,4 +155,31 @@ public class ServiceUtil {
}
return false;
}
/**
* 查看社保公积金起缴日期是否符合补缴逻辑
* @Author fxj
* @Date 2020-09-07
* @param socialStartDate 起缴日期
* @param canOverpay 是否可补缴 0:是,1:否
* @param overpayNumber 补缴期限 整数
* @param haveThisMonth 是否含当月 0:是,1:否 如果无符合条件默认不含当月
* @return 符合 false 不符合 true
**/
public static boolean checkDispatchDate(LocalDateTime socialStartDate,String canOverpay,Integer overpayNumber,String haveThisMonth){
if (null == socialStartDate){
return false;
}
LocalDateTime temp = null;
LocalDateTime now = LocalDateTime.now();
if (CommonConstants.ZERO_STRING.equals(canOverpay)){
temp = socialStartDate.plusMonths(CommonConstants.ZERO_STRING.equals(haveThisMonth)?(long)overpayNumber:(long)(overpayNumber+1));
}else if (CommonConstants.ONE_STRING.equals(canOverpay)){
temp = socialStartDate;
}
return (null != temp && (temp.getYear() < now.getYear() || isaBoolean(temp, now)));
}
private static boolean isaBoolean(LocalDateTime temp, LocalDateTime now) {
return temp.getYear() == now.getYear() && temp.getMonthValue() < now.getMonthValue();
}
}
......@@ -36,8 +36,7 @@
<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
<result property="lockStatus" column="LOCK_STATUS"/>
<result property="socialSettlementFlag" column="SOCIAL_SETTLEMENT_FLAG"/>
<result property="fundSettlementFlag" column="FUND_SETTLEMENT_FLAG"/>
<result property="pushStatus" column="PUSH_STATUS"/>
<result property="sumAll" column="SUM_ALL"/>
<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
......@@ -57,8 +56,6 @@
<result property="providentSum" column="PROVIDENT_SUM"/>
<result property="socialSettlementId" column="SOCIAL_SETTLEMENT_ID"/>
<result property="fundSettlementId" column="FUND_SETTLEMENT_ID"/>
<result property="salarySocialFlag" column="SALARY_SOCIAL_FLAG"/>
<result property="salaryFundFlag" column="SALARY_FUND_FLAG"/>
<result property="inauguralTeam" column="INAUGURAL_TEAM"/>
<result property="telecomNumber" column="TELECOM_NUMBER"/>
<result property="sortTime" column="SORT_TIME"/>
......@@ -120,6 +117,7 @@
a.SOCIAL_PAY_MONTH,
a.SOCIAL_CREATE_MONTH,
a.LOCK_STATUS,
a.PUSH_STATUS,
a.SOCIAL_SETTLEMENT_FLAG,
a.FUND_SETTLEMENT_FLAG,
a.SUM_ALL,
......@@ -310,11 +308,8 @@
<if test="tPaymentInfo.lockStatus != null and tPaymentInfo.lockStatus.trim() != ''">
AND a.LOCK_STATUS = #{tPaymentInfo.lockStatus}
</if>
<if test="tPaymentInfo.socialSettlementFlag != null and tPaymentInfo.socialSettlementFlag.trim() != ''">
AND a.SOCIAL_SETTLEMENT_FLAG = #{tPaymentInfo.socialSettlementFlag}
</if>
<if test="tPaymentInfo.fundSettlementFlag != null and tPaymentInfo.fundSettlementFlag.trim() != ''">
AND a.FUND_SETTLEMENT_FLAG = #{tPaymentInfo.fundSettlementFlag}
<if test="tPaymentInfo.pushStatus != null and tPaymentInfo.pushStatus.trim() != ''">
AND a.PUSH_STATUS = #{tPaymentInfo.pushStatus}
</if>
<if test="tPaymentInfo.sumAll != null">
AND a.SUM_ALL = #{tPaymentInfo.sumAll}
......@@ -383,12 +378,6 @@
<if test="tPaymentInfo.fundSettlementId != null and tPaymentInfo.fundSettlementId.trim() != ''">
AND a.FUND_SETTLEMENT_ID = #{tPaymentInfo.fundSettlementId}
</if>
<if test="tPaymentInfo.salarySocialFlag != null and tPaymentInfo.salarySocialFlag.trim() != ''">
AND a.SALARY_SOCIAL_FLAG = #{tPaymentInfo.salarySocialFlag}
</if>
<if test="tPaymentInfo.salaryFundFlag != null and tPaymentInfo.salaryFundFlag.trim() != ''">
AND a.SALARY_FUND_FLAG = #{tPaymentInfo.salaryFundFlag}
</if>
<if test="tPaymentInfo.inauguralTeam != null and tPaymentInfo.inauguralTeam.trim() != ''">
AND a.INAUGURAL_TEAM = #{tPaymentInfo.inauguralTeam}
</if>
......@@ -578,12 +567,6 @@
<if test="tPaymentInfo.lockStatus != null and tPaymentInfo.lockStatus.trim() != ''">
AND a.LOCK_STATUS = #{tPaymentInfo.lockStatus}
</if>
<if test="tPaymentInfo.socialSettlementFlag != null and tPaymentInfo.socialSettlementFlag.trim() != ''">
AND a.SOCIAL_SETTLEMENT_FLAG = #{tPaymentInfo.socialSettlementFlag}
</if>
<if test="tPaymentInfo.fundSettlementFlag != null and tPaymentInfo.fundSettlementFlag.trim() != ''">
AND a.FUND_SETTLEMENT_FLAG = #{tPaymentInfo.fundSettlementFlag}
</if>
<if test="tPaymentInfo.sumAll != null">
AND a.SUM_ALL = #{tPaymentInfo.sumAll}
</if>
......@@ -651,12 +634,6 @@
<if test="tPaymentInfo.fundSettlementId != null and tPaymentInfo.fundSettlementId.trim() != ''">
AND a.FUND_SETTLEMENT_ID = #{tPaymentInfo.fundSettlementId}
</if>
<if test="tPaymentInfo.salarySocialFlag != null and tPaymentInfo.salarySocialFlag.trim() != ''">
AND a.SALARY_SOCIAL_FLAG = #{tPaymentInfo.salarySocialFlag}
</if>
<if test="tPaymentInfo.salaryFundFlag != null and tPaymentInfo.salaryFundFlag.trim() != ''">
AND a.SALARY_FUND_FLAG = #{tPaymentInfo.salaryFundFlag}
</if>
<if test="tPaymentInfo.inauguralTeam != null and tPaymentInfo.inauguralTeam.trim() != ''">
AND a.INAUGURAL_TEAM = #{tPaymentInfo.inauguralTeam}
</if>
......@@ -814,8 +791,6 @@
<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
<result property="lockStatus" column="LOCK_STATUS"/>
<result property="socialSettlementFlag" column="SOCIAL_SETTLEMENT_FLAG"/>
<result property="fundSettlementFlag" column="FUND_SETTLEMENT_FLAG"/>
<result property="sumAll" column="SUM_ALL"/>
<result property="providentPayMonth" column="PROVIDENT_PAY_MONTH"/>
<result property="providentCreateMonth" column="PROVIDENT_CREATE_MONTH"/>
......@@ -884,9 +859,6 @@
<result property="fundTown" column="FUND_TOWN"/>
<result property="inauguralTeam" column="INAUGURAL_TEAM"/>
<result property="telecomNumber" column="TELECOM_NUMBER"/>
<result property="salarySocialFlag" column="SALARY_SOCIAL_FLAG"/>
<result property="salaryFundFlag" column="SALARY_FUND_FLAG"/>
</resultMap>
<!--tPaymentInfo简单分页查询-->
<select id="getTPaymentInfoPage" resultMap="tPaymentInfoMap">
......
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