Commit f063f031 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/develop' into develop

parents ea857298 5ac1d4bc
......@@ -64,7 +64,13 @@ public class EmpProjectDispatchVo implements Serializable {
@ExcelAttribute(name = "身份证号",isNotEmpty = true, errorInfo = "身份证号不能为空",maxLength = 20)
@ExcelProperty(value ="身份证号")
private String empIdcard;
/**
* 项目编码
*/
@NotNull(message = "项目编码不能为空")
@ExcelProperty(value ="项目编码")
@ExcelAttribute(name = "项目编码",isNotEmpty = true, errorInfo = "项目编码不能为空",maxLength = 20)
private String deptId;
/**
* 项目编码
*/
......
......@@ -469,7 +469,8 @@ public class TEmployeeInfoController {
* @Date: 2022/08/01 18:52
**/
@Operation(summary = "通过EMP_ID查询人员档案变更日志", description = "通过EMP_ID查询人员档案变更日志")
@GetMapping("/inner/updateEmpInfo")
@Inner
@PostMapping("/inner/updateEmpInfo")
public Boolean updateEmpInfo(@RequestBody UpdateEmpVo vo) {
return tEmployeeInfoService.updateEmpInfo(vo);
}
......
......@@ -32,7 +32,6 @@ import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
......@@ -2094,14 +2093,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
**/
@Override
public Boolean updateEmpInfo(UpdateEmpVo vo) {
if (Common.isEmpty(vo)){
if (Common.isEmpty(vo.getEmpIdCard())){
if (Common.isNotNull(vo)){
if (Common.isNotNull(vo.getEmpIdCard())){
TEmployeeInfo employeeInfo = baseMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeInfo::getEmpIdcard,vo.getEmpIdCard())
.eq(TEmployeeInfo::getStatus,CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(employeeInfo)){
if (Common.isNotNull(employeeInfo)){
employeeInfo.setStatus(CommonConstants.ONE_INT);
baseMapper.updateById(employeeInfo);
}
......@@ -2120,11 +2119,13 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
if (Common.isNotNull(vo.getProjectNo())){
TEmployeeProject p = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.ONE_STRING)
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getEmpIdcard,vo.getEmpIdCard())
.eq(TEmployeeProject::getDeptNo,vo.getProjectNo())
.eq(TEmployeeProject::getStatus,CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(p)){
p.setStatus(CommonConstants.ONE_INT);
tEmployeeProjectService.updateById(p);
}
}
......@@ -2162,6 +2163,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
contract.setFileTown(emp.getFileTown());
}
}
contract.setAuditStatus(CommonConstants.ONE_INT);
contract.setApplyNo(contractServicer.getCode(false));
contractServicer.save(contract);
contractAdd.setId(contract.getId());
......
......@@ -181,7 +181,7 @@ public class ArchivesDaprUtil {
vo.setContractName(contractName);
R<Boolean> res = HttpDaprUtil.invokeMethodPost(
daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId()
,"/temployeeinfo/inner/updateEmpInfo" , JSON.toJSONString(vo), UpdateEmpVo.class, SecurityConstants.FROM_IN);
,"/temployeeinfo/inner/updateEmpInfo" , JSON.toJSONString(vo), Boolean.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("更新人员档案、项目档案、合同状态信息失败!");
}
......
package com.yifu.cloud.plus.v1.yifu.common.ldap.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Data
@Component
@PropertySource("classpath:ldapConfig.properties")
@ConfigurationProperties(value = "ldap", ignoreInvalidFields = false)
public class LdapProperties {
String url;
String dn;
String password;
Integer port;
String userName;
String baseDn;
}
......@@ -56,13 +56,13 @@ public class PersonVo {
private String homeDirectory;
/**
* 主键
* 部门名称
*/
@Attribute(name = "ou")
private String deptName;
/**
* 主键
* 用户密码
*/
@Attribute(name = "userPassword")
private String password;
......
package com.yifu.cloud.plus.v1.yifu.common.ldap.util;
import javax.naming.AuthenticationException;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.Control;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.LdapContext;
import java.util.Hashtable;
/**
* 用户登陆认证,LDAP跨域认证,通过LDAP对用户进行更新
*
*/
public class LdapCheck {
private static LdapContext ctx = null;
private static Control[] connCtls = null;
/**** 定义LDAP的基本连接信息 ******/
// LDAP的连接地址(ldap://ip:port/)port默认为389
private static String URL = "192.168.1.65";
//port
private static String port = "389";
// LDAP的根DN
private static String BASEDN = "dc=worfu,dc=com";
// LDAP的连接账号(身份认证管理平台添加的应用账号,应用账号格式:uid=?,ou=?,dc=????)
private static String PRINCIPAL = "cn=admin,dc=worfu,dc=com";
// LDAP的连接账号的密码(身份认证管理平台添加的应用账号的密码)
private static String PASSWORD = "yifu123456!";
// 校验用户名密码的方法
public static boolean authenticate(String usr, String pwd) {
boolean valide = false;
if (pwd == null || pwd == "")
return false;
if (ctx == null) {
getCtx();
}
String userDN = getUserDN(usr);
if ("".equals(userDN) || userDN == null) {
return false;
}
try {
ctx.addToEnvironment(Context.SECURITY_PRINCIPAL, userDN);
ctx.addToEnvironment(Context.SECURITY_CREDENTIALS, pwd);
ctx.reconnect(connCtls);
valide = true;
closeCtx();
} catch (AuthenticationException e) {
System.out.println(userDN + " is not authenticated");
System.out.println(e.toString());
valide = false;
} catch (NamingException e) {
System.out.println(userDN + " is not authenticated");
valide = false;
}
return valide;
}
public static void getCtx() {
if (ctx != null) {
return;
}
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, URL + ":" + port + BASEDN);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, PRINCIPAL);
env.put(Context.SECURITY_CREDENTIALS, PASSWORD);
try {
// 链接ldap
ctx = new InitialLdapContext(env, connCtls);
} catch (AuthenticationException e) {
System.out.println("Authentication faild: " + e.toString());
} catch (Exception e) {
System.out.println("Something wrong while authenticating: " + e.toString());
}
}
public static void closeCtx() {
try {
if (ctx != null)
ctx.close();
} catch (NamingException ex) {
}
}
public static String getUserDN(String uid) {
String userDN = "";
try {
SearchControls constraints = new SearchControls();
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration<?> en = ctx.search("", "uid=" + uid, constraints);
if (en == null) {
System.out.println("Have no NamingEnumeration.");
}
if (!en.hasMoreElements()) {
System.out.println("Have no element.");
}
while (en != null && en.hasMoreElements()) {
Object obj = en.nextElement();
if (obj instanceof SearchResult) {
SearchResult si = (SearchResult) obj;
userDN += si.getName();
userDN += "," + BASEDN;
} else {
System.out.println(obj);
}
System.out.println();
}
} catch (Exception e) {
System.out.println("Exception in search():" + e);
}
return userDN;
}
}
\ No newline at end of file
......@@ -2,10 +2,12 @@ package com.yifu.cloud.plus.v1.yifu.common.ldap.util;
import com.unboundid.ldap.sdk.*;
import com.unboundid.ldap.sdk.controls.SubentriesRequestControl;
import com.yifu.cloud.plus.v1.yifu.common.ldap.config.LdapProperties;
import com.yifu.cloud.plus.v1.yifu.common.ldap.entity.PersonVo;
import com.yifu.cloud.plus.v1.yifu.common.ldap.mapper.PersonAttributesMapper;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.ldap.core.LdapTemplate;
import javax.naming.AuthenticationException;
......@@ -23,26 +25,19 @@ import java.util.List;
import static org.springframework.ldap.query.LdapQueryBuilder.query;
@Log4j2
@EnableConfigurationProperties(LdapProperties.class)
public class LdapUtil {
@Autowired
private LdapTemplate ldapTemplate;
@Autowired
private LdapProperties ldapProperties;
private static LdapContext ctx = null;
private static Control[] connCtls = null;
/**** 定义LDAP的基本连接信息 ******/
// LDAP的连接地址(ldap://ip:port/)port默认为389
private static String URL = "ldap://192.168.1.65:389/";
// LDAP的根DN
private static String BASEDN = "dc=worfu,dc=com";
// LDAP的连接账号(身份认证管理平台添加的应用账号,应用账号格式:uid=?,ou=?,dc=????)
private static String PRINCIPAL = "cn=admin,dc=worfu,dc=com";
// LDAP的连接账号的密码(身份认证管理平台添加的应用账号的密码)
private static String PASSWORD = "yifu123456!";
/**
* @return List<SearchResultEntry>
* @author huyc
......@@ -52,8 +47,9 @@ public class LdapUtil {
public List<SearchResultEntry> getAllPersonNamesWithTraditionalWay() {
List<SearchResultEntry> result = new ArrayList<SearchResultEntry>();
try {
LDAPConnection connection = new LDAPConnection("192.168.1.65", 389, "cn=admin,dc=worfu,dc=com", "yifu123456!");
SearchRequest searchRequest = new SearchRequest("ou=安徽皖信人力资源管理有限公司,ou=wanxin,dc=worfu,dc=com", SearchScope.SUB, "(objectclass=*)");
LDAPConnection connection = new LDAPConnection(ldapProperties.getUrl(), ldapProperties.getPort(),
ldapProperties.getUserName(), ldapProperties.getPassword());
SearchRequest searchRequest = new SearchRequest(ldapProperties.getBaseDn(), SearchScope.SUB, "(objectclass=*)");
searchRequest.addControl(new SubentriesRequestControl());
SearchResult searchResult = connection.search(searchRequest);
for (SearchResultEntry entry : searchResult.getSearchEntries()) {
......@@ -99,16 +95,17 @@ public class LdapUtil {
return valide;
}
public static void getCtx() {
public void getCtx() {
if (ctx != null) {
return;
}
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, URL + BASEDN);
env.put(Context.PROVIDER_URL, "ldap://" + ldapProperties.getUrl() + ":" + ldapProperties.getPort() +
"/" + ldapProperties.getDn());
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, PRINCIPAL);
env.put(Context.SECURITY_CREDENTIALS, PASSWORD);
env.put(Context.SECURITY_PRINCIPAL, ldapProperties.getUserName());
env.put(Context.SECURITY_CREDENTIALS, ldapProperties.getPassword());
try {
// 链接ldap
ctx = new InitialLdapContext(env, connCtls);
......@@ -117,12 +114,12 @@ public class LdapUtil {
}
}
public static void closeCtx() throws NamingException {
public void closeCtx() throws NamingException {
if (ctx != null)
ctx.close();
}
public static String getUserDN(String uid) {
public String getUserDN(String uid) {
String userDN = "";
try {
SearchControls constraints = new SearchControls();
......@@ -133,7 +130,7 @@ public class LdapUtil {
if (obj instanceof javax.naming.directory.SearchResult) {
javax.naming.directory.SearchResult si = (javax.naming.directory.SearchResult) obj;
userDN += si.getName();
userDN += "," + BASEDN;
userDN += "," + ldapProperties.getDn();
}
}
} catch (Exception e) {
......
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.yifu.common.ldap.config.LdapAutoConfigue\
com.yifu.cloud.plus.v1.yifu.common.ldap.util.LdapUtil\
ldap.url=192.168.1.65
ldap.port=389
ldap.userName=cn=admin,dc=worfu,dc=com
ldap.password=yifu123456!
ldap.dn=dc=worfu,dc=com
ldap.baseDn=ou=\u5B89\u5FBD\u7696\u4FE1\u4EBA\u529B\u8D44\u6E90\u7BA1\u7406\u6709\u9650\u516C\u53F8,ou=wanxin,dc=worfu,dc=com
\ No newline at end of file
......@@ -27,13 +27,13 @@ public class MybatisPlusMetaObjectHandler implements MetaObjectHandler {
log.debug("mybatis plus start insert fill ....");
LocalDateTime now = LocalDateTime.now();
fillValIfNullByName("createTime", now, metaObject, false);
fillValIfNullByName("updateTime", now, metaObject, false);
fillValIfNullByName("createTime", now, metaObject, true);
fillValIfNullByName("updateTime", now, metaObject, true);
YifuUser yifuUser = getYifuUser();
if (Common.isNotNull(yifuUser)){
fillValIfNullByName("createBy", yifuUser.getId(), metaObject, false);
fillValIfNullByName("updateBy", yifuUser.getId(), metaObject, false);
fillValIfNullByName("createName", yifuUser.getNickname(), metaObject, false);
fillValIfNullByName("createBy", yifuUser.getId(), metaObject, true);
fillValIfNullByName("updateBy", yifuUser.getId(), metaObject, true);
fillValIfNullByName("createName", yifuUser.getNickname(), metaObject, true);
}
}
......
package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
......@@ -14,8 +17,9 @@ import java.util.Date;
@Tag(name = "结算信息作废记录")
public class TInsuranceSettleCancel implements Serializable {
/**
*
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
......@@ -37,21 +41,15 @@ public class TInsuranceSettleCancel implements Serializable {
* 项目名称
*/
private String deptName;
/**
* 订单编号
*/
private String orderNo;
/**
* 推送标识 1成功 0失败
* 推送标识 未推送,1成功 0失败
*/
private Integer isCancelPush;
/**
* 创建时间
*/
private Date createTime;
private LocalDateTime createTime;
/**
* 操作人
......
......@@ -237,6 +237,23 @@ public class BigDecimalUtils {
}
return bigDecimal;
}
/**
* null 默认 为 0
* @Author zhaji
* @Date 2022-08-02
* @param bigDecimal
* @return
**/
public static Boolean isNullOrZero(BigDecimal bigDecimal){
if (null == bigDecimal){
return true;
}
if (bigDecimal.compareTo(BigDecimal.ZERO) == 0){
return true;
}
return false;
}
/**
* 对象转为BigDecimal 数据 并四舍五入保留两位小数
* @Author fxj
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -86,4 +87,11 @@ public class InsuranceReplaceParam implements Serializable {
@Schema(description = "错误信息")
private String errorMessage;
/***********************************以下字段由系统算出,前端不用传,是为了方便入库***********************************/
/**
* 结算类型 (1、单独结算 2、合并结算-和工资一起结算)
*/
@JsonIgnore
private Integer settleType;
}
......@@ -100,9 +100,15 @@ public class InsuredParam implements Serializable {
private Integer isOverdue;
/**
* 派单日期
* 派单开始日期
*/
@Schema(description = "派单日期")
private String createTime;
@Schema(description = "派单开始日期")
private String createStartTime;
/**
* 派单结束日期
*/
@Schema(description = "派单结束日期")
private String createEndTime;
}
......@@ -327,8 +327,8 @@ public class TInsuranceDetailController {
* @return {@link R<IPage< RefundExportListVo >>}
*/
@Operation(summary = "减员办理列表分页查询", description = "减员办理列表分页查询")
@PostMapping("/getInsuranceRefundHandlingPageList")
public R<IPage<RefundExportListVo>> getInsuranceRefundHandlingPageList(Page<InsuranceRefundHandlingParam> page, @RequestBody InsuranceRefundHandlingParam param) {
@GetMapping("/getInsuranceRefundHandlingPageList")
public R<IPage<RefundExportListVo>> getInsuranceRefundHandlingPageList(Page<InsuranceRefundHandlingParam> page,InsuranceRefundHandlingParam param) {
return R.ok(tInsuranceDetailService.getInsuranceRefundHandlingPageList(page,param));
}
......
......@@ -152,7 +152,7 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
TInsuranceRefundDetail selectRefundDetail(@Param("param") TInsuranceRefundDetail refundDetail);
/**
* TODO
* 根据ID导出减员办理列表
*
* @author zhaji
* @param idList
......@@ -161,7 +161,7 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
List<RefundExportListVo> getRefundExportListBySelect(@Param("idList")List<String> idList);
/**
* TODO
* 导出减员办理列表
*
* @author zhaji
* @param param
......
......@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.*;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceDetailMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.*;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BeanCopyUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BigDecimalUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.LocalDateUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
......@@ -77,6 +78,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Resource
private TInsuranceRefundService tInsuranceRefundService;
@Resource
private TInsuranceSettleCancelService tInsuranceSettleCancelService;
/***********************商险办理********************************/
/**
......@@ -312,14 +317,22 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
newDetail.setEmpName(success.getReplaceEmpName());
newDetail.setEmpIdcardNo(success.getReplaceEmpIdcardNo());
newDetail.setDeptNo(success.getReplaceDeptNo());
//替换项目的结算方式
newDetail.setSettleType(success.getSettleType());
newDetail.setPost(success.getPost());
//其他状态置为空
newDetail.setIsOverdue(null);
newDetail.setIsUse(null);
newDetail.setIsEffect(null);
newDetail.setReduceHandleStatus(null);
//创建时间是新数据插入时间
newDetail.setCreateTime(LocalDateTime.now());
newDetail.setCreateBy(user.getId());
newDetail.setCreateName(user.getNickname());
//替换不参与结算
newDetail.setDefaultSettleId(null);
newDetail.setActualPremium(null);
newDetail.setEstimatePremium(null);
Boolean insert = this.save(newDetail);
//替换记录
if (insert){
......@@ -1813,6 +1826,16 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
//结算类型,根据项目编码获取,并冗余到明细记录中
String settleType = projectSetInfoVo.getInsuranceSettleType();
if (StringUtils.isEmpty(settleType)){
param.setErrorMessage(InsurancesConstants.PROJECT_NOT_FIND_SETTLE_TYPE);
listResult.add(param);
continue;
}else {
param.setSettleType(Integer.parseInt(settleType));
}
}
}
}
......@@ -2616,19 +2639,82 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.set(TInsuranceDetail :: getSettleType,success.getNewSettleType())
.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
TInsuranceSettle tInsuranceSettle = new TInsuranceSettle();
//如果旧项目为合并结算,且新项目也是合并结算,则计算新的预估保费,作废旧的预估保费
if(CommonConstants.ZERO_INT == oldSettleType && CommonConstants.ZERO_INT == newSettleType){
String insuranceDetailId = success.getId();
//结算信息id
String defaultSettleId = success.getDefaultSettleId();
//实际保费
BigDecimal actualPremium = success.getActualPremium();
//如果变更前为单独结算
if(CommonConstants.ONE_INT == oldSettleType){
//登记了保单保费
if (!BigDecimalUtils.isNullOrZero(actualPremium)){
//变更后为单独结算
if(CommonConstants.ONE_INT == newSettleType){
update(updateWrapper);
//作废旧的数据,生成作废结算信息记录
TInsuranceSettleCancel cancel = new TInsuranceSettleCancel();
cancel.setDeptNo(success.getOldDeptNo());
cancel.setInsDetailId(success.getId());
cancel.setSettleId(defaultSettleId);
cancel.setCreateUesr(user.getId());
cancel.setCreateTime(LocalDateTime.now());
tInsuranceSettleCancelService.save(cancel);
//推送EKP // TODO: 2022/8/2
//新增新的结算数据
TInsuranceSettle newInsuranceSettle = new TInsuranceSettle();
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
newInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
newInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
newInsuranceSettle.setCreateTime(LocalDateTime.now());
newInsuranceSettle.setActualPremium(success.getActualPremium());
tInsuranceSettleService.save(newInsuranceSettle);
//赋值新的预估费用和新的结算信息
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
}
//变更后为合并结算
if(CommonConstants.ZERO_INT == newSettleType){
//作废旧的数据,生成作废结算信息记录
TInsuranceSettleCancel cancel = new TInsuranceSettleCancel();
cancel.setDeptNo(success.getOldDeptNo());
cancel.setInsDetailId(success.getId());
cancel.setSettleId(defaultSettleId);
cancel.setCreateUesr(user.getId());
cancel.setCreateTime(LocalDateTime.now());
tInsuranceSettleCancelService.save(cancel);
//推送EKP // TODO: 2022/8/2
//新增新的结算信息
TInsuranceSettle newInsuranceSettle = new TInsuranceSettle();
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
newInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
newInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
newInsuranceSettle.setCreateTime(LocalDateTime.now());
newInsuranceSettle.setActualPremium(success.getActualPremium());
newInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
//生成新的结算信息
tInsuranceSettleService.save(newInsuranceSettle);
//赋值新的预估费用和新的结算信息
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium());
//如果存在则更新,不存在则新建
if (StringUtils.isNotBlank(success.getDefaultSettleId())){
tInsuranceSettle.setId(success.getDefaultSettleId());
tInsuranceSettle.setSettleType(success.getNewSettleType());
tInsuranceSettle.setInsDetailId(success.getId());
tInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
tInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(tInsuranceSettle);
}else{
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//推送EKP // TODO: 2022/8/2
}
}
//未登记保单保费
if(BigDecimalUtils.isNullOrZero(actualPremium)){
//变更后为单独结算
if (CommonConstants.ONE_INT == newSettleType){
//变更项目且不做处理
update(updateWrapper);
}
//变更后为合并结算
if (CommonConstants.ZERO_INT == newSettleType){
//生成预估结算信息
TInsuranceSettle tInsuranceSettle = new TInsuranceSettle();
tInsuranceSettle.setInsDetailId(success.getId());
tInsuranceSettle.setSettleType(success.getNewSettleType());
tInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
......@@ -2637,60 +2723,118 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
tInsuranceSettle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(tInsuranceSettle);
//将结算id赋值给保单信息
//将结算id赋值给保单信息,并新增预估费用
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium());
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,tInsuranceSettle.getId());
}
}
//如果旧项目为预估,且新的项目为单独结算,则作废旧的预估保费,更新项目信息
if(CommonConstants.ZERO_INT == oldSettleType && CommonConstants.ONE_INT == newSettleType){
//更新旧的结算信息
if (StringUtils.isNotBlank(success.getDefaultSettleId())){
tInsuranceSettle.setId(success.getDefaultSettleId());
tInsuranceSettle.setSettleType(success.getNewSettleType());
tInsuranceSettle.setInsDetailId(success.getId());
tInsuranceSettle.setEstimatePremium(new BigDecimal("0"));
tInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(tInsuranceSettle);
//生成一条作废数据并推送至EKP
TInsuranceSettleCancel tInsuranceSettleCancel = new TInsuranceSettleCancel();
tInsuranceSettleCancel.setInsDetailId(success.getId());
tInsuranceSettleCancel.setSettleId(success.getDefaultSettleId());
update(updateWrapper);
//推送结算信息至EKP // TODO: 2022/8/2
}
}
}
//变更前为合并结算
if(CommonConstants.ZERO_INT == oldSettleType){
//如果已经登记保费
if (!BigDecimalUtils.isNullOrZero(actualPremium)){
//变更为单独结算
if (CommonConstants.ONE_INT == newSettleType){
//作废旧的结算信息
TInsuranceSettleCancel cancel = new TInsuranceSettleCancel();
cancel.setDeptNo(success.getOldDeptNo());
cancel.setInsDetailId(success.getId());
cancel.setSettleId(defaultSettleId);
cancel.setCreateUesr(user.getId());
cancel.setCreateTime(LocalDateTime.now());
tInsuranceSettleCancelService.save(cancel);
//新增新的结算信息
TInsuranceSettle newInsuranceSettle = new TInsuranceSettle();
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
newInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
newInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
newInsuranceSettle.setCreateTime(LocalDateTime.now());
newInsuranceSettle.setActualPremium(success.getActualPremium());
tInsuranceSettleService.save(newInsuranceSettle);
//更新预估费用为0.00
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,new BigDecimal("0.00"));
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//推送新的结算信息
}
//变更为合并结算
if (CommonConstants.ZERO_INT == newSettleType){
//作废旧的结算信息
TInsuranceSettleCancel cancel = new TInsuranceSettleCancel();
cancel.setDeptNo(success.getOldDeptNo());
cancel.setInsDetailId(success.getId());
cancel.setSettleId(defaultSettleId);
cancel.setCreateUesr(user.getId());
cancel.setCreateTime(LocalDateTime.now());
tInsuranceSettleCancelService.save(cancel);
//新增新的结算信息
TInsuranceSettle newInsuranceSettle = new TInsuranceSettle();
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
newInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
newInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
newInsuranceSettle.setCreateTime(LocalDateTime.now());
newInsuranceSettle.setActualPremium(success.getActualPremium());
tInsuranceSettleService.save(newInsuranceSettle);
//更新预估费用为新的预估费用
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium());
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//推送新的结算信息 // TODO: 2022/8/2
}
}
//如果没有登记保费
if (BigDecimalUtils.isNullOrZero(actualPremium)){
//变更为单独结算
if (CommonConstants.ONE_INT == newSettleType){
//作废旧的结算信息
TInsuranceSettleCancel cancel = new TInsuranceSettleCancel();
cancel.setDeptNo(success.getOldDeptNo());
cancel.setInsDetailId(success.getId());
cancel.setSettleId(defaultSettleId);
cancel.setCreateUesr(user.getId());
cancel.setCreateTime(LocalDateTime.now());
tInsuranceSettleCancelService.save(cancel);
//推送至EKP // TODO: 2022/8/2
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,new BigDecimal("0.00"));
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,null);
update(updateWrapper);
}else{
//更新预估保费
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,new BigDecimal("0"));
}
}
//如果旧项目为单独结算,且新项目为合并结算,则计算预估保费,作废旧的预估保费
if(CommonConstants.ONE_INT == oldSettleType && CommonConstants.ZERO_INT == newSettleType){
//变更为合并结算
if (CommonConstants.ZERO_INT == newSettleType){
//作废旧的结算信息
TInsuranceSettleCancel cancel = new TInsuranceSettleCancel();
cancel.setDeptNo(success.getOldDeptNo());
cancel.setInsDetailId(success.getId());
cancel.setSettleId(defaultSettleId);
cancel.setCreateUesr(user.getId());
cancel.setCreateTime(LocalDateTime.now());
tInsuranceSettleCancelService.save(cancel);
//推送至EKP // TODO: 2022/8/2
TInsuranceSettle newInsuranceSettle = new TInsuranceSettle();
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
newInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
newInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
newInsuranceSettle.setCreateTime(LocalDateTime.now());
newInsuranceSettle.setActualPremium(success.getActualPremium());
tInsuranceSettleService.save(newInsuranceSettle);
//更新预估费用为新的预估费用
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium());
//更新旧的结算信息
if (StringUtils.isNotBlank(success.getDefaultSettleId())){
tInsuranceSettle.setId(success.getDefaultSettleId());
tInsuranceSettle.setSettleType(success.getNewSettleType());
tInsuranceSettle.setInsDetailId(success.getId());
tInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
tInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(tInsuranceSettle);
//推送EKP
}else{
tInsuranceSettle.setInsDetailId(success.getId());
tInsuranceSettle.setSettleType(success.getNewSettleType());
tInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
tInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
tInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
tInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
tInsuranceSettle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(tInsuranceSettle);
//更新保单信息
updateWrapper.set(TInsuranceDetail::getDefaultSettleId,tInsuranceSettle.getId());
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//推送新的结算信息 // TODO: 2022/8/2
}
}
//如果旧项目为单独结算,且新项目也是单独结算,则更新单独结算信息
if(CommonConstants.ONE_INT == oldSettleType && CommonConstants.ONE_INT == newSettleType){
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium());
}
update(updateWrapper);
TInsuranceOperate insuranceOperate = new TInsuranceOperate();
insuranceOperate.setInsuranceDetailId(success.getId());
insuranceOperate.setCreateBy(user.getId());
......@@ -2704,8 +2848,29 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<DeptChangeCheckParam> errorList = stringListMap.get("errorList");
return R.ok(errorList,"导入成功");
}
/**
* 发送变更通知至EKP
* 发送变更结算月至EKP
*
* @author zhaji
* @param successList
* @return void
*/
private void updateMonth2EKP(List<DeptChangeCheckParam> successList) {
for (DeptChangeCheckParam param : successList) {
String newDeptNo = param.getNewDeptNo();
String oldDeptNo = param.getOldDeptNo();
Integer newSettleType = param.getNewSettleType();
Integer oldSettleType = param.getOldSettleType();
String defaultSettleId = param.getDefaultSettleId();
if (StringUtils.isNotBlank(defaultSettleId) && CommonConstants.ZERO_INT == newSettleType){
}
}
}
/**
* 发送变更项目至EKP
*
* @author zhaji
* @param successList
......@@ -2724,6 +2889,19 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
/**
* 发送作废信息至EKP
*
* @author zhaji
* @param cancelList 作废信息列表
* @return void
*/
private void pushSettleCancel2EKP(List<TInsuranceSettleCancel> cancelList) {
for (TInsuranceSettleCancel param : cancelList) {
}
}
/**
* 根据保险公司名称查询保单明细
*
......@@ -3438,7 +3616,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (StringUtils.isNotBlank(defaultSettleId)){
//查询结算状态
LambdaQueryWrapper<TInsuranceSettle> insuranceSettleQuery = new LambdaQueryWrapper<>();
insuranceSettleQuery.eq(TInsuranceSettle :: getInsDetailId,insuranceDetail.getId());
insuranceSettleQuery.eq(TInsuranceSettle :: getId,defaultSettleId);
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getOne(insuranceSettleQuery);
//当前结算状态为结算中时,不能变更结算项目
if (CommonConstants.TWO_STRING.equals(insuranceSettle.getSettleHandleStatus())){
......@@ -3469,7 +3647,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setEstimatePremium(estimatePremium);
}
}
//如果
//去重
for (int j =0 ;j< deptChangeCheckList.size();j++) {
DeptChangeCheckParam CheckParam = deptChangeCheckList.get(j);
if(CheckParam.getEmpName().equals(param.getEmpName())
......@@ -3489,6 +3667,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
param.setOldSettleType(insuranceDetail.getSettleType());
param.setDefaultSettleId(insuranceDetail.getDefaultSettleId());
param.setActualPremium(insuranceDetail.getActualPremium());
param.setId(insuranceDetail.getId());
successList.add(param);
}
......
......@@ -334,8 +334,11 @@
<if test="param.isOverdue != null">
and detail.IS_OVERDUE = #{param.isOverdue}
</if>
<if test="param.createTime != null and param.createTime.trim() != ''">
AND detail.CREATE_TIME = concat(#{param.createTime}, ' 00:00:00')
<if test="param.createStartTime != null and param.createStartTime.trim() != ''">
AND detail.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.createStartTime}, ' 00:00:00')
</if>
<if test="param.createEndTime != null and param.createEndTime.trim() != ''">
AND detail.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.createEndTime}, ' 23:59:59')
</if>
ORDER BY detail.CREATE_TIME DESC
</select>
......@@ -412,8 +415,11 @@
<if test="param.isOverdue != null ">
and detail.IS_OVERDUE = #{param.isOverdue}
</if>
<if test="param.createTime != null and param.createTime.trim() != ''">
AND detail.CREATE_TIME = concat(#{param.createTime}, ' 00:00:00')
<if test="param.createStartTime != null and param.createStartTime.trim() != ''">
AND detail.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.createStartTime}, ' 00:00:00')
</if>
<if test="param.createEndTime != null and param.createEndTime.trim() != ''">
AND detail.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.createEndTime}, ' 23:59:59')
</if>
ORDER BY detail.CREATE_TIME DESC
</select>
......@@ -564,16 +570,16 @@
and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.deptNo != null and param.deptNo.trim() != ''">
and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
and detail.DEPT_NO = #{param.deptNo}
</if>
<if test="param.reduceHandleStatus != null">
and detail.REDUCE_HANDLE_STATUS = #{param.reduceHandleStatus}
</if>
<if test="param.isOverdue != null">
and detail.IS_OVERDUE like concat('%',replace(replace(#{param.isOverdue},'_','\_'),'%','\%'),'%')
<if test="param.insuranceTypeName != null and param.insuranceTypeName.trim() != ''">
and detail.INSURANCE_TYPE_NAME like concat('%',replace(replace(#{param.insuranceTypeName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.isUse != null">
and detail.IS_USE like concat('%',replace(replace(#{param.isUse},'_','\_'),'%','\%'),'%')
<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
and detail.INSURANCE_COMPANY_NAME = #{param.insuranceCompanyName}
</if>
ORDER BY refund.CREATE_TIME DESC
</select>
......@@ -672,7 +678,7 @@
and detail.POLICY_NO = #{param.policyNo}
</if>
</select>
<!-- 已投保列表分页查询-->
<!-- 根据ID导出减员办理列表-->
<select id="getRefundExportListBySelect" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.RefundExportListVo">
select
detail.id as id,
......@@ -705,7 +711,7 @@
</foreach>
ORDER BY detail.CREATE_TIME DESC
</select>
<!-- 已投保列表分页查询-->
<!-- 根据查询参数导出减员办理列表-->
<select id="getRefundExportList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.RefundExportListVo">
select
detail.id as id,
......@@ -740,14 +746,17 @@
and detail.EMP_IDCARD_NO like concat('%',replace(replace(#{param.empIdcardNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.deptNo != null and param.deptNo.trim() != ''">
and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
and detail.DEPT_NO = #{param.deptNo}
</if>
<if test="param.insuranceTypeName != null and param.insuranceTypeName.trim() != ''">
and detail.INSURANCE_TYPE_NAME like concat('%',replace(replace(#{param.insuranceTypeName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
and detail.INSURANCE_COMPANY_NAME like concat('%',replace(replace(#{param.insuranceCompanyName},'_','\_'),'%','\%'),'%')
and detail.INSURANCE_COMPANY_NAME = #{param.insuranceCompanyName}
</if>
ORDER BY detail.CREATE_TIME DESC
</select>
<!-- 已投保列表分页查询-->
<!-- 减员办理-->
<update id="updateInsuranceRefund">
update
t_insurance_detail detail
......@@ -762,7 +771,7 @@
</foreach>
</update>
<!--getInsuranceListByIdCard-->
<!--根据身份证查询商险信息-->
<select id="getInsuranceListByIdCard" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListByIdCardVo">
SELECT
<include refid="Base_Column_List"/>
......
......@@ -10,7 +10,6 @@
<result property="settleId" column="SETTLE_ID" jdbcType="VARCHAR"/>
<result property="deptNo" column="DEPT_NO" jdbcType="VARCHAR"/>
<result property="deptName" column="DEPT_NAME" jdbcType="VARCHAR"/>
<result property="orderNo" column="ORDER_NO" jdbcType="VARCHAR"/>
<result property="isCancelPush" column="IS_CANCEL_PUSH" jdbcType="TINYINT"/>
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
<result property="createUesr" column="CREATE_UESR" jdbcType="VARCHAR"/>
......@@ -18,7 +17,7 @@
<sql id="Base_Column_List">
ID,INS_DETAIL_ID,SETTLE_ID,
DEPT_NO,DEPT_NAME,ORDER_NO,
DEPT_NO,DEPT_NAME,
IS_CANCEL_PUSH,CREATE_TIME,CREATE_UESR
</sql>
</mapper>
......@@ -404,5 +404,19 @@ public class TProvidentFund extends BaseEntity {
@Schema(description = "电信编号" )
@ExcelProperty("电信编号" )
private String telecomNumber;
/**
* 基数上限(社保或公积金)
*/
@ExcelAttribute(name = "基数上限(社保或公积金)")
@Schema(description = "基数上限(社保或公积金)")
@ExcelProperty("基数上限(社保或公积金)")
private BigDecimal upperLimit;
/**
* 基数下限(社保或公积金)
*/
@ExcelAttribute(name = "基数下限(社保或公积金)")
@Schema(description = "基数下限(社保或公积金)")
@ExcelProperty("基数下限(社保或公积金)")
private BigDecimal lowerLimit;
}
......@@ -747,6 +747,20 @@ public class TSocialInfo extends BaseEntity {
@Schema(description = "大病办理状态:0待办理1办理成功2办理失败3已派减" )
@ExcelProperty("大病办理状态:0待办理1办理成功2办理失败3已派减" )
private String bigailmentHandle;
/**
* 基数上限(社保或公积金)
*/
@ExcelAttribute(name = "基数上限(社保或公积金)")
@Schema(description = "基数上限(社保或公积金)")
@ExcelProperty("基数上限(社保或公积金)")
private BigDecimal upperLimit;
/**
* 基数下限(社保或公积金)
*/
@ExcelAttribute(name = "基数下限(社保或公积金)")
@Schema(description = "基数下限(社保或公积金)")
@ExcelProperty("基数下限(社保或公积金)")
private BigDecimal lowerLimit;
}
......@@ -998,6 +998,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
fund.setOverpayNumber(fundSet.getOverpayNumber());
fund.setFundBaseSetId(fundSet.getId());
fund.setPayPolicy(fundSet.getPayPolicy());
fund.setLowerLimit(fundSet.getLowerLimit());
fund.setUpperLimit(fundSet.getUpperLimit());
if (Common.isNotNull(fundSet.getProvince())){
fund.setFundProvince(Integer.toString(fundSet.getProvince()));
}
......@@ -1140,6 +1142,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
social.setOverpayNumber(socialSet.getOverpayNumber());
social.setValueType(socialSet.getValueType());
social.setPayPolicy(socialSet.getPayPolicy());
social.setLowerLimit(socialSet.getLowerLimit());
social.setUpperLimit(socialSet.getUpperLimit());
// 比例初始化
social.setPersonalPensionPer(socialSet.getPersonalPersionPro());
social.setPersonalMedicalPer(socialSet.getPersonalMedicalPro());
......@@ -1380,6 +1384,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
project.setUnitId(setInfoVo.getCustomerId());
project.setUnitName(setInfoVo.getCustomerName());
project.setUnitNo(setInfoVo.getCustomerCode());
project.setDeptId(setInfoVo.getId());
}
projects.put(excel.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+excel.getSettleDomainCode(),project);
}
......@@ -1562,8 +1567,12 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (Common.isEmpty(empVo.getContractName()) && validContractInfo(errorMessageList,excel,empVo)){
return true;
}
if (Common.isNotNull(empVo.getEmpNatrue())){
excel.setEmpType(empVo.getEmpNatrue());
}
if (Common.isNotNull(empVo.getEmpPhone())){
excel.setEmpMobile(empVo.getEmpPhone());
}
excel.setFileProvince(Common.isNotNullToStr(empVo.getFileProvince()));
excel.setFileCity(Common.isNotNullToStr(empVo.getFileCity()));
excel.setFileTown(Common.isNotNullToStr(empVo.getFileTown()));
......@@ -1601,15 +1610,19 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_CONTRACT_NOT_EMPTY)));
return true;
}
if (Common.isNotNull(excel.getSocialHousehold()) && (
Common.isEmpty(excel.getRecordBase())
// 非自定义的 基数 起缴日期不可空
if (Common.isNotNull(excel.getSocialHousehold())
&& !CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& (Common.isEmpty(excel.getRecordBase())
|| Common.isEmpty(excel.getPensionStart())
|| Common.isEmpty(excel.getPaymentType())
)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_NOT_EMPTY)));
return true;
}
if (CommonConstants.ONE_STRING.equals(excel.getPaymentType()) && Common.isEmpty(excel.getPensionCardinal())
// 兼职工伤 的起缴日期不可为空
if (CommonConstants.ONE_STRING.equals(excel.getPaymentType())
&& Common.isEmpty(excel.getPensionCardinal())
&& Common.isEmpty(excel.getWorkInjuryCardinal())
){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_DIY_NOT_EMPTY)));
return true;
......@@ -1657,9 +1670,13 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 各个社保基数和日期空 默认养老日期和基数
initExcelBaseAndDate(excel);
// 校验各项起缴日期 查看是否符合社保补缴政策
if (validSocialStartDate(errorMessageList, excel, socialSet)) return true;
if (validSocialStartDate(errorMessageList, excel, socialSet)){
return true;
}
//校验各项基数
if (validSocialBaseInfo(errorMessageList, excel, empVo, socialSet)) return true;
if (validSocialBaseInfo(errorMessageList, excel, empVo, socialSet)){
return true;
}
}
// 校验公积金上下限和起缴日期
if (Common.isNotNull(excel.getProvidentHousehold())){
......@@ -1779,32 +1796,38 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
private boolean validSocialStartDate(List<ErrorMessage> errorMessageList, TDispatchImportVo excel, SysBaseSetInfo socialSet) {
if (ServiceUtil.checkDispatchDate(LocalDateTimeUtils.convertDateToLDT(excel.getPensionStart()),
if (Common.isNotNull(excel.getPensionStart())
&& 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()),
if (Common.isNotNull(excel.getMedicalStart())
&& 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()),
if (Common.isNotNull(excel.getUnemployStart())
&& 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()),
if (Common.isNotNull(excel.getWorkInjuryStart())
&& 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()),
if (Common.isNotNull(excel.getBirthStart())
&& 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()),
if (Common.isNotNull(excel.getBigailmentStart())
&& 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;
......@@ -2136,6 +2159,11 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
detailVo.setEmployee(res.getData());
}
}
detailVo.setAudits(auditInfoMapper.selectList(Wrappers.<TAuditInfo>query().lambda()
.eq(TAuditInfo::getEmpIdcard,dispatch.getEmpIdcard())
.and(obj->obj.eq(TAuditInfo::getDispatchInfoId,dispatch.getId())
.or().eq(TAuditInfo::getSocialId,dispatch.getId())
.or().eq(TAuditInfo::getProvidentId,dispatch.getId()))));
}
return detailVo;
}
......@@ -2218,8 +2246,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 待办理
sf.setSocialAddStatus(CommonConstants.ONE_STRING);
sf.setSocialStatus(CommonConstants.ONE_STRING);
// 要更新 人员档案 项目档案 合同的状态信息
archivesDaprUtil.updateEmpInfo(dis.getEmpIdcard(),dis.getSettleDomainCode(),dis.getContractName());
//派增审核不通过 需要处理预估数据
} else if (CommonConstants.ONE_INT == flag.intValue()) {
socialInfo.setDeleteFlag(CommonConstants.ONE_STRING);
......@@ -2333,6 +2359,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dis.setStatus(CommonConstants.THREE_STRING);
auditInfo.setAuditStatus(CommonConstants.THREE_STRING);
}
// 派增审核通过 要更新 人员档案 项目档案 合同的状态信息
if (CommonConstants.dingleDigitStrArray[0].equals(dis.getType())
&& CommonConstants.ZERO_INT == flag.intValue()){
R<Boolean> res = archivesDaprUtil.updateEmpInfo(dis.getEmpIdcard(),dis.getSettleDomainCode(),dis.getContractName());
if (Common.isEmpty(res) || CommonConstants.SUCCESS != res.getCode()){
ServiceUtil.runTimeExceptionDiy("更新人员档案、项目档案、合同状态异常:" + (Common.isNotNull(res)?res.getMsg():CommonConstants.EMPTY_STRING));
}
}
//新增审核记录信息
auditInfoMapper.insert(auditInfo);
dis.setAuditUser(user.getId());
......@@ -2658,8 +2692,11 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (Common.isNotNull(auditInfo)) {
//派增判断
if (CommonConstants.ZERO_STRING.equals(dis.getType())) {
if ((CommonConstants.ONE_STRING.equals(dis.getSocialHandleStatus())
|| CommonConstants.TWO_STRING.equals(dis.getSocialHandleStatus()))
if (Common.isNotNull(dis.getSocialHandleStatus())
&& Common.isNotNull(dis.getFundHandleStatus())
&& (CommonConstants.ONE_STRING.equals(dis.getSocialHandleStatus())
|| CommonConstants.TWO_STRING.equals(dis.getSocialHandleStatus())
|| CommonConstants.THREE_STRING.equals(dis.getSocialHandleStatus()))
&& ((CommonConstants.ONE_STRING.equals(dis.getFundHandleStatus())
|| CommonConstants.TWO_STRING.equals(dis.getFundHandleStatus())))) {
//办理成功
......@@ -2672,7 +2709,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dis.setStatus(CommonConstants.FOUR_STRING);
}
if ((CommonConstants.ONE_STRING.equals(dis.getSocialHandleStatus())
|| CommonConstants.TWO_STRING.equals(dis.getSocialHandleStatus()))
|| CommonConstants.TWO_STRING.equals(dis.getSocialHandleStatus())
|| CommonConstants.THREE_STRING.equals(dis.getSocialHandleStatus()))
&& Common.isEmpty(dis.getFundHandleStatus())) {
//办理成功
dis.setStatus(CommonConstants.FOUR_STRING);
......
......@@ -30,7 +30,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.Dept;
import com.yifu.cloud.plus.v1.yifu.social.concurrent.threadpool.YFSocialImportThreadPoolExecutor;
import com.yifu.cloud.plus.v1.yifu.social.constants.PaymentConstants;
import com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants;
......@@ -369,13 +368,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} else {
redisUtil.set(key, user.getId(), 1800L);
Map<String, TPaymentInfoVo> listMap = new HashMap<>();
initListToMap(list, listMap);
// 把初步校验的内容返回给前端
if (Common.isNotNull(errorMessageList)) {
getIntegerErrorMessageHashMap(user, errorMessageList, key, random, listMap);
}
// 导入前做队列空闲判断,防止队列不足出现数据丢失的场景
if (CollUtil.isNotEmpty(list)) {
int taskSize = list.size() / partSize + CommonConstants.ONE_INT;
......@@ -383,7 +375,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (taskSize > residualCapacity) {
errorMessageList.add(new ErrorMessage(-1, MsgUtils.getMessage(ErrorCodes.SOCIALINFO_LIST_NUM_LARGE)));
}
} else {
}else {
// -----------------------------生成paymentInfoMap本段开始--------------------------------
//已存在的档案数据
List<String> monthList = Common.listObjectToStrList(list, ExcelAttributeConstants.SOCIAL_PAY_MONTH).stream().distinct().collect(Collectors.toList());
......@@ -490,22 +482,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// -----------------------------线程池处理list,批量保存社保信息开始--------------------------------
List<TPaymentInfoVo> tempList = new ArrayList<>();
AtomicInteger atomicLine = new AtomicInteger(CommonConstants.ZERO_INT);
List<CompletableFuture<List<TPaymentInfoImportLog>>> completableFutureList = new ArrayList<>();
try {
// 1.list.size()不足partSize,直接执行
if (list.size() < partSize) {
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() ->
CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
CommonConstants.ONE_INT), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
CommonConstants.ONE_INT, errorMessageList), yfSocialImportThreadPoolExecutor);
}
// 2.list.size()大于partSize,循环分批执行
......@@ -513,19 +497,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (partSize <= list.size()) {
// 处理第一个0位元素
final List<TPaymentInfoVo> finalList = list.subList(0, 1);
CompletableFuture<List<TPaymentInfoImportLog>> oneCompletableFuture = CompletableFuture.supplyAsync(() ->
CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
CommonConstants.ONE_INT), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
CommonConstants.ONE_INT, errorMessageList), yfSocialImportThreadPoolExecutor);
lastIdx = 1;
completableFutureList.add(oneCompletableFuture);
for (int i = 1; i < list.size(); i++) {
// partSize数量的list为一个执行单元
tempList.add(list.get(i));
......@@ -533,19 +510,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
lastIdx = i;
List<TPaymentInfoVo> finalTempList = tempList;
final int idx = i - partSize + 2;
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() ->
CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
idx), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
//todo
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
idx, errorMessageList), yfSocialImportThreadPoolExecutor);
tempList = new ArrayList<>();
}
}
......@@ -567,40 +536,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentInfoVo> finalTempList = tempList;
int finalLastIdx = lastIdx + 1;
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() ->
CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
finalLastIdx), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
finalLastIdx, errorMessageList), yfSocialImportThreadPoolExecutor);
}
// 阻塞当前线程,等待所有的线程执行完毕
boolean computeFlag;
do {
computeFlag = false;
for (CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture : completableFutureList) {
if (!listCompletableFuture.isDone()) {
computeFlag = true;
}
}
} while (computeFlag);
String importSuccessKey = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_WAIT_EXPORT;
redisUtil.set(importSuccessKey, random, 1800L);
} catch (Exception e) {
log.error("社保缴费库数据批量导入异常:" + e);
redisUtil.remove(key);
errorMessageList.add(new ErrorMessage(-1, "数据批量导入异常:" + e));
// errorMessageHashMap = ServiceUtil.initErrorMessage(
// errorMessageHashMap, new ErrorMessage(-1, "数据批量导入异常:" + e), remotePushService, pushParam);
} finally {
paymentInfoPensionMap.clear();
paymentInfoBigMap.clear();
......@@ -612,37 +560,38 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// -----------------------------线程池处理list,批量保存社保信息结束--------------------------------
//最后一个推送
log.info("社保批量导入耗时:{}", (System.currentTimeMillis() - start) + "");
// pushParam.setTips(null == errorMessageHashMap.get(list.size()) ? "导入完成!" :
// errorMessageHashMap.get(list.size()).getMessage());
// ServiceUtil.initErrorMessage(list.size(), remotePushService, pushParam);
redisUtil.remove(key);
}
}
}
private void initListToMap(List<TPaymentInfoVo> list, Map<String, TPaymentInfoVo> listMap) {
if (Common.isNotNull(list)) {
for (TPaymentInfoVo vo : list) {
listMap.put(String.valueOf(list.indexOf(vo) + 2), vo);
/**
* 转换缴纳地址为省市县ID
**/
private TPaymentInfoVo initAddress(String[] areaArray, HashMap<String, String> areaMap2, TPaymentInfoVo s) {
if (null == areaArray || null == areaMap2 || null == s) {
return s;
}
String temp = null;
if (areaArray.length >= CommonConstants.TWO_INT) {
temp = areaMap2.get(areaArray[0] + CommonConstants.DOWN_LINE_STRING + "null");
if (Common.isNotNull(temp)) {
s.setSocialProvince(temp);
}
temp = areaMap2.get(areaArray[1] + CommonConstants.DOWN_LINE_STRING + (null == s.getSocialProvince()
? "null" : s.getSocialProvince()));
if (Common.isNotNull(temp)) {
s.setSocialCity(temp);
}
private void getIntegerErrorMessageHashMap(YifuUser user, List<ErrorMessage> errorInfo, String key,
String random, Map<String, TPaymentInfoVo> listMap) {
List<TPaymentInfoImportLog> logList = new ArrayList<>();
TPaymentInfoVo vo = null;
for (ErrorMessage error : errorInfo) {
vo = listMap.get(error.getLineNum().toString());
logList.add(new TPaymentInfoImportLog(null, null == vo ? "" : vo.getEmpName(),
null == vo ? "" : vo.getEmpIdcard(), error.getMessage(), vo.getRowIndex(), random));
if (areaArray.length >= CommonConstants.THREE_INT) {
temp = areaMap2.get(areaArray[2] + CommonConstants.DOWN_LINE_STRING + (null == s.getSocialCity()
? "null" : s.getSocialCity()));
if (Common.isNotNull(temp)) {
s.setSocialTown(temp);
}
if (Common.isNotNull(logList)) {
this.tPaymentInfoImportLogService.saveBatch(logList);
}
redisUtil.set(user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_WAIT_EXPORT
, random, 1800L);
redisUtil.remove(key);
}
return s;
}
/**
......@@ -656,9 +605,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
* @description:
* @author: huyc
* @date: 2022/7/25
* @return: List<TPaymentInfoImportLog>
* @return:
*/
private List<TPaymentInfoImportLog> executeImportSocialList(YifuUser user,
private List<ErrorMessage> executeImportSocialList(YifuUser user,
AtomicInteger atomicLine,
String random,
List<TPaymentInfoVo> list,
......@@ -670,9 +619,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
ConcurrentHashMap<String, TPaymentInfo> paymentInfoMedicalMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoUnEmpMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoInjuryMap,
int idx) {
int idx, List<ErrorMessage> errorMessageList) {
int i = idx;
List<TPaymentInfoImportLog> logList = new ArrayList<>();
if (Common.isNotNull(list)) {
TPaymentInfo paymentInfo = null;
TSocialInfo socialInfo = null;
......@@ -741,18 +689,15 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
//导入校验
if (!Common.isNotNull(infoVo.getSocialPayMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "社保缴纳月份不可为空!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保缴纳月份不可为空!"));
continue;
}
if (!Common.isNotNull(infoVo.getSocialCreateMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "社保生成月份不可为空!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保生成月份不可为空!"));
continue;
}
if (!Common.isNotNull(infoVo.getSocialPayAddr())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "社保缴纳地不可为空!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保缴纳地不可为空!"));
continue;
}
//无对应员工的社保数据
......@@ -769,13 +714,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
//对身份证与人员姓名的对应关系进行校验
if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "姓名与身份证信息不一致,请核实后再次尝试!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "姓名与身份证信息不一致,请核实后再次尝试!"));
continue;
}
if (socialInfo != null && socialInfo.getSocialStartDate() == null) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpIdcard() + "的社保起缴日期为空!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "的社保起缴日期为空!"));
continue;
}
if (null == socialInfo || (null != socialInfo && !ServiceUtil.checkMothForPaymentImport(
......@@ -788,8 +731,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
? "null" : infoVo.getSocialTown()));
//对身份证与人员姓名的对应关系进行校验
if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "姓名与身份证信息不一致,请核实后再次尝试!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() +
"姓名与身份证信息不一致,请核实后再次尝试!"));
continue;
}
if (null != socialInfo && !ServiceUtil.checkMothForPaymentImport(socialInfo.getSocialStartDate()
......@@ -809,23 +752,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
if (null == socialInfo) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "无对应员工" + infoVo.getEmpIdcard()
+ "的社保数据(请查验社保办理状态|缴纳地|起缴月份|停缴月份)", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() +
"无对应员工" + infoVo.getEmpIdcard() + "的社保数据(请查验社保办理状态|缴纳地|起缴月份|停缴月份)"));
continue;
}
//如果导入项目数大于办理成功项目数给提示,少于给进,有问题自行删除后导入
checkRes = checkRepeatInfo(socialInfo, infoVo);
if (null != checkRes) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + checkRes, i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), checkRes));
continue;
}
//查看缴纳月是否为空
if (!Common.isNotNull(infoVo.getSocialPayMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "必填项校验失败:社保缴纳月份不可为空!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "必填项校验失败:社保缴纳月份不可为空!"));
continue;
}
......@@ -848,9 +788,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getPersonalPensionMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(paymentInfo.getUnitPensionMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getPersonalPensionMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的养老缴费数据,请勿重复导入!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的养老缴费数据,请勿重复导入!"));
continue;
} else {
paymentInfo = null;
......@@ -875,9 +814,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getPersonalUnemploymentMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(paymentInfo.getUnitUnemploymentMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getPersonalUnemploymentMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的失业缴费数据,请勿重复导入!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的失业缴费数据,请勿重复导入!"));
continue;
} else {
paymentInfo = null;
......@@ -902,9 +840,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getPersonalMedicalMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(paymentInfo.getUnitMedicalMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getPersonalMedicalMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的医保缴费数据,请勿重复导入!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的医保缴费数据,请勿重复导入!"));
continue;
} else {
paymentInfo = null;
......@@ -929,9 +866,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getPersonalBigmailmentMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(paymentInfo.getUnitBigmailmentMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getPersonalBigmailmentMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的医疗救助金缴费数据,请勿重复导入!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的医疗救助金缴费数据,请勿重复导入!"));
continue;
} else {
paymentInfo = null;
......@@ -952,9 +888,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//存在社保缴费数据
if (null != paymentInfo && BigDecimalUtils.safeMultiply(BigDecimalUtils.isNullToZero(infoVo.getUnitInjuryMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getUnitInjuryMoney())).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的单位工伤缴费数据,请勿重复导入!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的单位工伤缴费数据,请勿重复导入!"));
continue;
} else {
paymentInfo = null;
......@@ -975,9 +910,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//存在社保缴费数据
if (null != paymentInfo && BigDecimalUtils.safeMultiply(BigDecimalUtils.isNullToZero(infoVo.getUnitBirthMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getUnitBirthMoney())).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的单位生育缴费数据,请勿重复导入!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的单位生育缴费数据,请勿重复导入!"));
continue;
} else {
paymentInfo = null;
......@@ -1080,60 +1014,21 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (null != paymentInfo && Common.isNotNull(paymentInfo.getId())) {
res = baseMapper.updateById(paymentInfo);
if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpName() + "_缴费库更新失败!", i, random));
continue;
} else {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpName() + "_缴费库更新成功!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() + "_缴费库更新失败!"));
continue;
}
} else {
res = insertAndSTimestamp(paymentInfo);
if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpName() + "_缴费库保存失败!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() + "_缴费库保存失败!"));
continue;
}
}
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.SUCCESS_MSG_PREFIX + "保存成功!", i, random));
}
itemMap.clear();
cusMap.clear();
} else {
return null;
}
return logList;
}
/**
* 转换缴纳地址为省市县ID
**/
private TPaymentInfoVo initAddress(String[] areaArray, HashMap<String, String> areaMap2, TPaymentInfoVo s) {
if (null == areaArray || null == areaMap2 || null == s) {
return s;
}
String temp = null;
if (areaArray.length >= CommonConstants.TWO_INT) {
temp = areaMap2.get(areaArray[0] + CommonConstants.DOWN_LINE_STRING + "null");
if (Common.isNotNull(temp)) {
s.setSocialProvince(temp);
}
temp = areaMap2.get(areaArray[1] + CommonConstants.DOWN_LINE_STRING + (null == s.getSocialProvince()
? "null" : s.getSocialProvince()));
if (Common.isNotNull(temp)) {
s.setSocialCity(temp);
}
if (areaArray.length >= CommonConstants.THREE_INT) {
temp = areaMap2.get(areaArray[2] + CommonConstants.DOWN_LINE_STRING + (null == s.getSocialCity()
? "null" : s.getSocialCity()));
if (Common.isNotNull(temp)) {
s.setSocialTown(temp);
}
}
}
return s;
return errorMessageList;
}
//比对缴纳地是否一致
......@@ -1245,7 +1140,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
YifuUser user = SecurityUtils.getUser();
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TPaymentHeFeiVo> util1 = new ExcelUtil<>(TPaymentHeFeiVo.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
......@@ -1304,7 +1198,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
YifuUser user = SecurityUtils.getUser();
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TPaymentInfoVo> util1 = new ExcelUtil<>(TPaymentInfoVo.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
......@@ -1646,7 +1539,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
private void importTPaymentSocialHeFei(List<TPaymentHeFeiVo> list, List<ErrorMessage> errorMessageList,
String random, YifuUser user, String type) {
long start = System.currentTimeMillis();
HashMap<String, String> areaMap = new HashMap<String, String>();
HashMap<String, String> areaMap2 = new HashMap<String, String>();
......@@ -1666,13 +1558,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// 判断是否有相同的用户在导入社保费用 存在提示稍后重试
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_IMPORT;
Map<String, TPaymentHeFeiVo> listMap = new HashMap<>();
initListToMapThree(list, listMap);
// 把初步校验的内容返回给前端
if (Common.isNotNull(errorMessageList)) {
getErrorMessageHashMapThree(user, random, errorMessageList, key, listMap);
}
// 将以下代码提取出来,使用paymentInfoMap提升性能,避免list多次循环查询数据库浪费性能
// 导入前做队列空闲判断,防止队列不足出现数据丢失的场景
if (CollUtil.isNotEmpty(list)) {
......@@ -1680,9 +1565,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
int residualCapacity = yfSocialImportThreadPoolExecutor.getResidualCapacity();
if (taskSize > residualCapacity) {
errorMessageList.add(new ErrorMessage(-1, MsgUtils.getMessage(ErrorCodes.SOCIALINFO_LIST_NUM_LARGE)));
}
}
} else {
// -----------------------------生成paymentInfoMap本段开始--------------------------------
//已存在的档案数据
List<String> monthList = Common.listObjectToStrList(list, ExcelAttributeConstants.SOCIAL_PAY_MONTH).stream().distinct().collect(Collectors.toList());
......@@ -1765,22 +1648,13 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// -----------------------------线程池处理list,批量保存社保信息开始--------------------------------
List<TPaymentHeFeiVo> tempList = new ArrayList<>();
AtomicInteger atomicLine = new AtomicInteger(CommonConstants.ZERO_INT);
List<CompletableFuture<List<TPaymentInfoImportLog>>> completableFutureList = new ArrayList<>();
try {
// 1.list.size()不足partSize,直接执行
if (list.size() < partSize) {
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, CommonConstants.ONE_INT, type), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
//todo
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
CompletableFuture.supplyAsync(() -> executeImportSocialListThree(
user, atomicLine, random, list, areaMap, areaMap2, paymentInfoPensionMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
CommonConstants.ONE_INT, type, errorMessageList), yfSocialImportThreadPoolExecutor);
}
// 2.list.size()大于partSize,循环分批执行
......@@ -1788,18 +1662,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (partSize <= list.size()) {
// 处理第一个0位元素
final List<TPaymentHeFeiVo> finalList = list.subList(0, 1);
CompletableFuture<List<TPaymentInfoImportLog>> oneCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalList, areaMap, areaMap2,
CompletableFuture.supplyAsync(() -> executeImportSocialListThree(
user, atomicLine, random, finalList, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, CommonConstants.ONE_INT, type), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
paymentInfoInjuryMap, CommonConstants.ONE_INT, type, errorMessageList)
, yfSocialImportThreadPoolExecutor);
lastIdx = 1;
completableFutureList.add(oneCompletableFuture);
for (int i = 1; i < list.size(); i++) {
// partSize数量的list为一个执行单元
tempList.add(list.get(i));
......@@ -1807,17 +1675,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
lastIdx = i;
final int idx = i - partSize + 2;
List<TPaymentHeFeiVo> finalTempList1 = tempList;
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalTempList1, areaMap,
CompletableFuture.supplyAsync(() -> executeImportSocialListThree(user
, atomicLine, random, finalTempList1, areaMap,
areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, idx, type), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
paymentInfoInjuryMap, idx, type, errorMessageList)
, yfSocialImportThreadPoolExecutor);
tempList = new ArrayList<>();
}
}
......@@ -1839,37 +1701,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentHeFeiVo> finalTempList = tempList;
int finalLastIdx = lastIdx + 1;
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalTempList, areaMap,
CompletableFuture.supplyAsync(() -> executeImportSocialListThree(
user, atomicLine, random, finalTempList, areaMap,
areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, finalLastIdx, type), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
paymentInfoInjuryMap, finalLastIdx, type, errorMessageList)
, yfSocialImportThreadPoolExecutor);
}
// 阻塞当前线程,等待所有的线程执行完毕
boolean computeFlag;
do {
computeFlag = false;
for (CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture : completableFutureList) {
if (!listCompletableFuture.isDone()) {
computeFlag = true;
}
}
} while (computeFlag);
String importSuccessKey = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_WAIT_EXPORT;
redisUtil.set(importSuccessKey, random, 1800L);
} catch (Exception e) {
log.error("社保缴费库数据批量导入异常:" + e);
redisUtil.remove(key);
errorMessageList.add(new ErrorMessage(-1, "数据批量导入异常:" + e));
} finally {
paymentInfoPensionMap.clear();
paymentInfoBigMap.clear();
......@@ -1878,38 +1722,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfoInjuryMap.clear();
}
}
private void initListToMapThree(List<TPaymentHeFeiVo> list, Map<String, TPaymentHeFeiVo> listMap) {
if (Common.isNotNull(list)) {
for (TPaymentHeFeiVo vo : list) {
listMap.put(String.valueOf(list.indexOf(vo) + 2), vo);
}
}
}
/*
* 保存初步校验
* */
private void getErrorMessageHashMapThree(YifuUser user,
String random,
List<ErrorMessage> errorInfo,
String key, Map<String, TPaymentHeFeiVo> listMap) {
List<TPaymentInfoImportLog> logList = new ArrayList<>();
TPaymentHeFeiVo vo = null;
for (ErrorMessage error : errorInfo) {
vo = listMap.get(error.getLineNum().toString());
logList.add(new TPaymentInfoImportLog(null, null == vo ? "" : vo.getEmpName(),
null == vo ? "" : vo.getEmpIdcard(), error.getMessage(), vo.getRowIndex(), random));
}
if (Common.isNotNull(logList)) {
this.tPaymentInfoImportLogService.saveBatch(logList);
}
redisUtil.set(user.getId() + CommonConstants.DOWN_LINE_STRING +
CommonConstants.PAYMENT_SOCIAL_WAIT_EXPORT, random, 1800L);
redisUtil.remove(key);
}
private List<TPaymentInfoImportLog> executeImportSocialListThree(YifuUser user, AtomicInteger atomicLine,
private List<ErrorMessage> executeImportSocialListThree(YifuUser user, AtomicInteger atomicLine,
String random,
List<TPaymentHeFeiVo> list,
HashMap<String, String> areaMap,
......@@ -1918,10 +1734,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
ConcurrentHashMap<String, TPaymentInfo> paymentInfoMedicalMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoUnEmpMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoInjuryMap,
int idx,
String type) {
int idx, String type,List<ErrorMessage> errorMessageList) {
int i = idx;
List<TPaymentInfoImportLog> logList = new ArrayList<>();
if (Common.isNotNull(list)) {
TPaymentInfo payExists = null;
TSocialInfo socialInfo = null;
......@@ -1989,7 +1803,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
infoVo.setEmpIdcard(infoVo.getEmpIdcard().replace("x", "X"));
}
//导入校验
if (socialThreeCheckBase(random, i, logList, infoVo, type)) {
if (socialThreeCheckBase(random, i, errorMessageList, infoVo, type)) {
continue;
}
//无对应员工的社保数据
......@@ -2005,13 +1819,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
//对身份证与人员姓名的对应关系进行校验
if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "姓名与身份证信息不一致,请核实后再次尝试!", i, random));
continue;
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "姓名与身份证信息不一致,请核实后再次尝试!"));
}
if (socialInfo != null && socialInfo.getSocialStartDate() == null) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpIdcard() + "的社保起缴日期为空!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "的社保起缴日期为空!"));
continue;
}
if (null == socialInfo || (null != socialInfo && !ServiceUtil.checkMothForPaymentImport(
......@@ -2023,8 +1834,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
+ CommonConstants.DOWN_LINE_STRING + (null == infoVo.getSocialTown() ? "null" : infoVo.getSocialTown()));
//对身份证与人员姓名的对应关系进行校验
if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "姓名与身份证信息不一致,请核实后再次尝试!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "姓名与身份证信息不一致,请核实后再次尝试!"));
continue;
}
if (null != socialInfo && !ServiceUtil.checkMothForPaymentImport(socialInfo.getSocialStartDate()
......@@ -2044,23 +1854,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
if (null == socialInfo) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "无对应员工" + infoVo.getEmpIdcard() +
"的社保数据(请查验社保办理状态|缴纳地|起缴月份|停缴月份)", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "无对应员工" + infoVo.getEmpIdcard() +
"的社保数据(请查验社保办理状态|缴纳地|起缴月份|停缴月份)"));
continue;
}
//如果导入项目数大于办理成功项目数给提示,少于给进,有问题自行删除后导入
checkRes = checkRepeatInfoThree(socialInfo, infoVo, type);
if (null != checkRes) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + checkRes, i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), checkRes));
continue;
}
//查看缴纳月是否为空
if (!Common.isNotNull(infoVo.getSocialPayMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "必填项校验失败:社保缴纳月份不可为空!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "必填项校验失败:社保缴纳月份不可为空!"));
continue;
}
......@@ -2081,9 +1888,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getUnitSet())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(payExists.getUnitPensionMoney()),
BigDecimalUtils.isNullToZero(payExists.getPersonalPensionMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的养老缴费数据,请勿重复导入!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的养老缴费数据,请勿重复导入!"));
continue;
} else {
payExists = null;
......@@ -2107,9 +1913,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getUnitSet())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(payExists.getUnitUnemploymentMoney()),
BigDecimalUtils.isNullToZero(payExists.getPersonalUnemploymentMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的失业缴费数据,请勿重复导入!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的失业缴费数据,请勿重复导入!"));
continue;
} else {
payExists = null;
......@@ -2134,9 +1939,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getPersonalMedicalMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(payExists.getUnitMedicalMoney()),
BigDecimalUtils.isNullToZero(payExists.getPersonalMedicalMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的医保缴费数据,请勿重复导入!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的医保缴费数据,请勿重复导入!"));
continue;
} else {
payExists = null;
......@@ -2160,9 +1964,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getUnitMedicalMoney()),
BigDecimalUtils.isNullToZero(infoVo.getPersonalMedicalMoney())),
BigDecimalUtils.isNullToZero(payExists.getUnitInjuryMoney())).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的单位工伤缴费数据,请勿重复导入!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的单位工伤缴费数据,请勿重复导入!"));
continue;
} else {
payExists = null;
......@@ -2278,58 +2081,44 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (null != payExists && Common.isNotNull(payExists.getId())) {
res = baseMapper.updateById(payExists);
if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpIdcard() + "_缴费库更新失败!", i, random));
continue;
} else {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.SUCCESS_MSG_PREFIX + infoVo.getEmpIdcard() + "_缴费库更新成功!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "_缴费库更新失败!"));
continue;
}
} else {
res = insertAndSTimestamp(payExists);
if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpIdcard() + "_缴费库保存失败!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "_缴费库保存失败!"));
continue;
}
}
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.SUCCESS_MSG_PREFIX + "保存成功!", i, random));
}
itemMap.clear();
cusMap.clear();
} else {
return null;
}
return logList;
return errorMessageList;
}
/**
* 导入校验
**/
private boolean socialThreeCheckBase(String random, int i, List<TPaymentInfoImportLog> logList, TPaymentHeFeiVo
private boolean socialThreeCheckBase(String random, int i, List<ErrorMessage> errorMessageList, TPaymentHeFeiVo
infoVo, String type) {
if (!Common.isNotNull(infoVo.getSocialPayMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "社保缴纳月份不可为空!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保缴纳月份不可为空!"));
return true;
}
if (!Common.isNotNull(infoVo.getSocialCreateMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "社保生成月份不可为空!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保生成月份不可为空!"));
return true;
}
if (!Common.isNotNull(infoVo.getSocialPayAddr())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "社保缴纳地不可为空!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保缴纳地不可为空!"));
return true;
}
if (CommonConstants.ZERO_STRING.equals(type) && !PaymentConstants.PENSION_RISK.equals(infoVo.getRiskType())
&& !PaymentConstants.UNEMPLOYEEMENT_RISK.equals(infoVo.getRiskType())
&& !PaymentConstants.INJURY_RISK.equals(infoVo.getRiskType())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "无相关险种!", i, random));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "无相关险种!"));
return true;
}
return false;
......@@ -2365,64 +2154,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
return s;
}
/**
* 检验每个险种是否可以导入
*
* @param random String
* @param i int
* @param logList List<TPaymentInfoImportLog>
* @param payExists TPaymentInfoVo
* @param infoVo TPaymentHeFeiVo
* @param type String
* @return
* @Author huyc
* @Date 2022-07-27
**/
private boolean checkImportInfo(String random, int i, List<TPaymentInfoImportLog> logList, TPaymentInfoVo
payExists
, TPaymentHeFeiVo infoVo, String type) {
boolean flag;
if (CommonConstants.ZERO_STRING.equals(type)) {
// 对应养老险种已经存在金额 不合并
flag = BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(payExists.getUnitPensionMoney())
, BigDecimalUtils.isNullToZero(payExists.getPersonalPensionMoney())).compareTo(BigDecimal.ZERO) == 0;
if (PaymentConstants.PENSION_RISK.equals(infoVo.getRiskType()) && !flag) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "对应员工身份证" + infoVo.getEmpIdcard()
+ "养老数据已存在,请勿重复导入!", i, random));
return true;
}
// 对应失业险种已经存在金额 不合并
flag = BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(payExists.getUnitUnemploymentMoney())
, BigDecimalUtils.isNullToZero(payExists.getPersonalUnemploymentMoney())).compareTo(BigDecimal.ZERO) == 0;
if (PaymentConstants.UNEMPLOYEEMENT_RISK.equals(infoVo.getRiskType()) && !flag) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "对应员工身份证" + infoVo.getEmpIdcard()
+ "失业数据已存在,请勿重复导入!", i, random));
return true;
}
// 对应工伤险种已经存在金额 不合并
flag = BigDecimalUtils.isNullToZero(payExists.getUnitInjuryMoney()).compareTo(BigDecimal.ZERO) == 0;
if (PaymentConstants.INJURY_RISK.equals(infoVo.getRiskType()) && !flag) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "对应员工身份证" + infoVo.getEmpIdcard()
+ "工伤数据已存在,请勿重复导入!", i, random));
return true;
}
}
if (CommonConstants.ONE_STRING.equals(type)) {
flag = BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(payExists.getUnitMedicalMoney())
, BigDecimalUtils.isNullToZero(payExists.getPersonalMedicalMoney())).compareTo(BigDecimal.ZERO) == 0;
if (!flag) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "对应员工身份证" + infoVo.getEmpIdcard()
+ "医疗数据已存在,请勿重复导入!", i, random));
return true;
}
}
return false;
}
/**
* 验证部分办理失败的导入是否有超出部分的数据导入
*
......
......@@ -177,7 +177,6 @@ public class ServiceUtil {
}else if (CommonConstants.ONE_STRING.equals(canOverpay)){
temp = socialStartDate;
}
boolean falg= isaBoolean(temp, now);
return (null != temp && (temp.getYear() < now.getYear() || isaBoolean(temp, now)));
}
private static boolean isaBoolean(LocalDateTime temp, LocalDateTime now) {
......
......@@ -74,6 +74,8 @@
<result property="createName" column="CREATE_NAME"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="payPolicy" column="PAY_POLICY"/>
<result property="lowerLimit" column="LOWER_LIMIT"/>
<result property="upperLimit" column="UPPER_LIMIT"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -125,7 +127,9 @@
a.UPDATE_BY,
a.CREATE_NAME,
a.UPDATE_TIME,
a.PAY_POLICY
a.PAY_POLICY,
a.LOWER_LIMIT,
a.UPPER_LIMIT
</sql>
<sql id="tProvidentFund_where">
<if test="tProvidentFund != null">
......
......@@ -121,6 +121,8 @@
<result property="createName" column="CREATE_NAME"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="payPolicy" column="PAY_POLICY"/>
<result property="lowerLimit" column="LOWER_LIMIT"/>
<result property="upperLimit" column="UPPER_LIMIT"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -221,7 +223,9 @@
a.UPDATE_BY,
a.CREATE_NAME,
a.UPDATE_TIME,
a.PAY_POLICY
a.PAY_POLICY,
a.LOWER_LIMIT,
a.UPPER_LIMIT
</sql>
<sql id="tSocialInfo_where">
<if test="tSocialInfo != null">
......
......@@ -26,13 +26,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.unboundid.ldap.sdk.SearchResultEntry;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDeptRelation;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDeptMapper;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysUserMapper;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptRelationService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysUserService;
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.R;
import com.yifu.cloud.plus.v1.yifu.common.ldap.util.LdapUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
......@@ -44,7 +42,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* <p>
......@@ -214,6 +211,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
SysDept insertSysDept = new SysDept();
insertSysDept.setName(deptName);
insertSysDept.setParentId(0L);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
insertSysDept.setDeptDn(dn);
this.save(insertSysDept);
} else {
......@@ -231,6 +231,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
insertSysDept.setName(deptName);
insertSysDept.setParentId(sysDept.getDeptId());
insertSysDept.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
this.save(insertSysDept);
}
} else {
......
......@@ -424,7 +424,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
if (null != list) {
List<SysUser> listUser = this.list(Wrappers.<SysUser>query().lambda().eq(SysUser::getDelFlag, CommonConstants.STATUS_NORMAL));
List<String> list1 = listUser.stream().map(SysUser::getUsername).collect(Collectors.toList());
Map<String, String> map = listUser.stream().collect(HashMap::new, (m, v) -> m.put(v.getUsername(), v.getUserId()), HashMap::putAll);
List<PersonVo> updateList = new ArrayList<>();
List<PersonVo> insertList = new ArrayList<>();
for (PersonVo personVo : list) {
......@@ -469,6 +468,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
insertSysDept.setName(deptName);
insertSysDept.setParentId(0L);
insertSysDept.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
sysDeptMapper.insert(insertSysDept);
} else {
sysDept.setName(deptName);
......@@ -484,6 +486,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
insertSysDept.setName(deptName);
insertSysDept.setParentId(sysDept.getDeptId());
insertSysDept.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
sysDeptMapper.insert(insertSysDept);
}
} else {
......
......@@ -210,7 +210,7 @@
<insert id="batchInsertUser" parameterType="java.util.List">
insert into sys_user
(user_id,username,phone,email,password,nickname,create_time)
(user_id,username,phone,email,password,nickname,deptId,create_time)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
......@@ -220,6 +220,7 @@
#{item.email,jdbcType=VARCHAR},
#{item.password,jdbcType=VARCHAR},
#{item.personName,jdbcType=VARCHAR},
#{item.deptId,jdbcType=VARCHAR},
now()
)
</foreach>
......@@ -256,6 +257,13 @@
</if>
</foreach>
</trim>
<trim prefix="deptId =case" suffix="end," >
<foreach collection="list" item="i" index="index">
<if test="i.deptId!=null">
when username=#{i.uid} then #{i.deptId}
</if>
</foreach>
</trim>
<trim prefix="update_time =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when username=#{i.uid} then now()
......
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