Commit 3e72c3a9 authored by 李灿灿's avatar 李灿灿

Merge branch 'develop' into feature-licancan

parents c980ca78 c282dc98
...@@ -64,7 +64,13 @@ public class EmpProjectDispatchVo implements Serializable { ...@@ -64,7 +64,13 @@ public class EmpProjectDispatchVo implements Serializable {
@ExcelAttribute(name = "身份证号",isNotEmpty = true, errorInfo = "身份证号不能为空",maxLength = 20) @ExcelAttribute(name = "身份证号",isNotEmpty = true, errorInfo = "身份证号不能为空",maxLength = 20)
@ExcelProperty(value ="身份证号") @ExcelProperty(value ="身份证号")
private String empIdcard; private String empIdcard;
/**
* 项目编码
*/
@NotNull(message = "项目编码不能为空")
@ExcelProperty(value ="项目编码")
@ExcelAttribute(name = "项目编码",isNotEmpty = true, errorInfo = "项目编码不能为空",maxLength = 20)
private String deptId;
/** /**
* 项目编码 * 项目编码
*/ */
......
...@@ -469,7 +469,8 @@ public class TEmployeeInfoController { ...@@ -469,7 +469,8 @@ public class TEmployeeInfoController {
* @Date: 2022/08/01 18:52 * @Date: 2022/08/01 18:52
**/ **/
@Operation(summary = "通过EMP_ID查询人员档案变更日志", description = "通过EMP_ID查询人员档案变更日志") @Operation(summary = "通过EMP_ID查询人员档案变更日志", description = "通过EMP_ID查询人员档案变更日志")
@GetMapping("/inner/updateEmpInfo") @Inner
@PostMapping("/inner/updateEmpInfo")
public Boolean updateEmpInfo(@RequestBody UpdateEmpVo vo) { public Boolean updateEmpInfo(@RequestBody UpdateEmpVo vo) {
return tEmployeeInfoService.updateEmpInfo(vo); return tEmployeeInfoService.updateEmpInfo(vo);
} }
......
...@@ -32,7 +32,6 @@ import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard; ...@@ -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.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants; 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.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.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*; import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*; import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
...@@ -2094,14 +2093,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -2094,14 +2093,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
**/ **/
@Override @Override
public Boolean updateEmpInfo(UpdateEmpVo vo) { public Boolean updateEmpInfo(UpdateEmpVo vo) {
if (Common.isEmpty(vo)){ if (Common.isNotNull(vo)){
if (Common.isEmpty(vo.getEmpIdCard())){ if (Common.isNotNull(vo.getEmpIdCard())){
TEmployeeInfo employeeInfo = baseMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda() TEmployeeInfo employeeInfo = baseMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING) .eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeInfo::getEmpIdcard,vo.getEmpIdCard()) .eq(TEmployeeInfo::getEmpIdcard,vo.getEmpIdCard())
.eq(TEmployeeInfo::getStatus,CommonConstants.ZERO_INT) .eq(TEmployeeInfo::getStatus,CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(employeeInfo)){ if (Common.isNotNull(employeeInfo)){
employeeInfo.setStatus(CommonConstants.ONE_INT); employeeInfo.setStatus(CommonConstants.ONE_INT);
baseMapper.updateById(employeeInfo); baseMapper.updateById(employeeInfo);
} }
...@@ -2120,11 +2119,13 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -2120,11 +2119,13 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
} }
if (Common.isNotNull(vo.getProjectNo())){ if (Common.isNotNull(vo.getProjectNo())){
TEmployeeProject p = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda() 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::getEmpIdcard,vo.getEmpIdCard())
.eq(TEmployeeProject::getDeptNo,vo.getProjectNo()) .eq(TEmployeeProject::getDeptNo,vo.getProjectNo())
.eq(TEmployeeProject::getStatus,CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(p)){ if (Common.isNotNull(p)){
p.setStatus(CommonConstants.ONE_INT);
tEmployeeProjectService.updateById(p); tEmployeeProjectService.updateById(p);
} }
} }
...@@ -2162,6 +2163,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -2162,6 +2163,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
contract.setFileTown(emp.getFileTown()); contract.setFileTown(emp.getFileTown());
} }
} }
contract.setAuditStatus(CommonConstants.ONE_INT);
contract.setApplyNo(contractServicer.getCode(false)); contract.setApplyNo(contractServicer.getCode(false));
contractServicer.save(contract); contractServicer.save(contract);
contractAdd.setId(contract.getId()); contractAdd.setId(contract.getId());
......
...@@ -181,7 +181,7 @@ public class ArchivesDaprUtil { ...@@ -181,7 +181,7 @@ public class ArchivesDaprUtil {
vo.setContractName(contractName); vo.setContractName(contractName);
R<Boolean> res = HttpDaprUtil.invokeMethodPost( R<Boolean> res = HttpDaprUtil.invokeMethodPost(
daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId() 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)){ if (Common.isEmpty(res)){
return R.failed("更新人员档案、项目档案、合同状态信息失败!"); 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 { ...@@ -56,13 +56,13 @@ public class PersonVo {
private String homeDirectory; private String homeDirectory;
/** /**
* 主键 * 部门名称
*/ */
@Attribute(name = "ou") @Attribute(name = "ou")
private String deptName; private String deptName;
/** /**
* 主键 * 用户密码
*/ */
@Attribute(name = "userPassword") @Attribute(name = "userPassword")
private String password; 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; ...@@ -2,10 +2,12 @@ package com.yifu.cloud.plus.v1.yifu.common.ldap.util;
import com.unboundid.ldap.sdk.*; import com.unboundid.ldap.sdk.*;
import com.unboundid.ldap.sdk.controls.SubentriesRequestControl; 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.entity.PersonVo;
import com.yifu.cloud.plus.v1.yifu.common.ldap.mapper.PersonAttributesMapper; import com.yifu.cloud.plus.v1.yifu.common.ldap.mapper.PersonAttributesMapper;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.ldap.core.LdapTemplate; import org.springframework.ldap.core.LdapTemplate;
import javax.naming.AuthenticationException; import javax.naming.AuthenticationException;
...@@ -23,26 +25,19 @@ import java.util.List; ...@@ -23,26 +25,19 @@ import java.util.List;
import static org.springframework.ldap.query.LdapQueryBuilder.query; import static org.springframework.ldap.query.LdapQueryBuilder.query;
@Log4j2 @Log4j2
@EnableConfigurationProperties(LdapProperties.class)
public class LdapUtil { public class LdapUtil {
@Autowired @Autowired
private LdapTemplate ldapTemplate; private LdapTemplate ldapTemplate;
@Autowired
private LdapProperties ldapProperties;
private static LdapContext ctx = null; private static LdapContext ctx = null;
private static Control[] connCtls = 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> * @return List<SearchResultEntry>
* @author huyc * @author huyc
...@@ -52,8 +47,9 @@ public class LdapUtil { ...@@ -52,8 +47,9 @@ public class LdapUtil {
public List<SearchResultEntry> getAllPersonNamesWithTraditionalWay() { public List<SearchResultEntry> getAllPersonNamesWithTraditionalWay() {
List<SearchResultEntry> result = new ArrayList<SearchResultEntry>(); List<SearchResultEntry> result = new ArrayList<SearchResultEntry>();
try { try {
LDAPConnection connection = new LDAPConnection("192.168.1.65", 389, "cn=admin,dc=worfu,dc=com", "yifu123456!"); LDAPConnection connection = new LDAPConnection(ldapProperties.getUrl(), ldapProperties.getPort(),
SearchRequest searchRequest = new SearchRequest("ou=安徽皖信人力资源管理有限公司,ou=wanxin,dc=worfu,dc=com", SearchScope.SUB, "(objectclass=*)"); ldapProperties.getUserName(), ldapProperties.getPassword());
SearchRequest searchRequest = new SearchRequest(ldapProperties.getBaseDn(), SearchScope.SUB, "(objectclass=*)");
searchRequest.addControl(new SubentriesRequestControl()); searchRequest.addControl(new SubentriesRequestControl());
SearchResult searchResult = connection.search(searchRequest); SearchResult searchResult = connection.search(searchRequest);
for (SearchResultEntry entry : searchResult.getSearchEntries()) { for (SearchResultEntry entry : searchResult.getSearchEntries()) {
...@@ -99,16 +95,17 @@ public class LdapUtil { ...@@ -99,16 +95,17 @@ public class LdapUtil {
return valide; return valide;
} }
public static void getCtx() { public void getCtx() {
if (ctx != null) { if (ctx != null) {
return; return;
} }
Hashtable<String, String> env = new Hashtable<String, String>(); Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); 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_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, PRINCIPAL); env.put(Context.SECURITY_PRINCIPAL, ldapProperties.getUserName());
env.put(Context.SECURITY_CREDENTIALS, PASSWORD); env.put(Context.SECURITY_CREDENTIALS, ldapProperties.getPassword());
try { try {
// 链接ldap // 链接ldap
ctx = new InitialLdapContext(env, connCtls); ctx = new InitialLdapContext(env, connCtls);
...@@ -117,12 +114,12 @@ public class LdapUtil { ...@@ -117,12 +114,12 @@ public class LdapUtil {
} }
} }
public static void closeCtx() throws NamingException { public void closeCtx() throws NamingException {
if (ctx != null) if (ctx != null)
ctx.close(); ctx.close();
} }
public static String getUserDN(String uid) { public String getUserDN(String uid) {
String userDN = ""; String userDN = "";
try { try {
SearchControls constraints = new SearchControls(); SearchControls constraints = new SearchControls();
...@@ -133,7 +130,7 @@ public class LdapUtil { ...@@ -133,7 +130,7 @@ public class LdapUtil {
if (obj instanceof javax.naming.directory.SearchResult) { if (obj instanceof javax.naming.directory.SearchResult) {
javax.naming.directory.SearchResult si = (javax.naming.directory.SearchResult) obj; javax.naming.directory.SearchResult si = (javax.naming.directory.SearchResult) obj;
userDN += si.getName(); userDN += si.getName();
userDN += "," + BASEDN; userDN += "," + ldapProperties.getDn();
} }
} }
} catch (Exception e) { } catch (Exception e) {
......
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 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 { ...@@ -27,13 +27,13 @@ public class MybatisPlusMetaObjectHandler implements MetaObjectHandler {
log.debug("mybatis plus start insert fill ...."); log.debug("mybatis plus start insert fill ....");
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
fillValIfNullByName("createTime", now, metaObject, false); fillValIfNullByName("createTime", now, metaObject, true);
fillValIfNullByName("updateTime", now, metaObject, false); fillValIfNullByName("updateTime", now, metaObject, true);
YifuUser yifuUser = getYifuUser(); YifuUser yifuUser = getYifuUser();
if (Common.isNotNull(yifuUser)){ if (Common.isNotNull(yifuUser)){
fillValIfNullByName("createBy", yifuUser.getId(), metaObject, false); fillValIfNullByName("createBy", yifuUser.getId(), metaObject, true);
fillValIfNullByName("updateBy", yifuUser.getId(), metaObject, false); fillValIfNullByName("updateBy", yifuUser.getId(), metaObject, true);
fillValIfNullByName("createName", yifuUser.getNickname(), metaObject, false); fillValIfNullByName("createName", yifuUser.getNickname(), metaObject, true);
} }
} }
......
package com.yifu.cloud.plus.v1.yifu.insurances.entity; 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 io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data; import lombok.Data;
...@@ -15,8 +17,9 @@ import java.util.Date; ...@@ -15,8 +17,9 @@ import java.util.Date;
@Tag(name = "结算信息作废记录") @Tag(name = "结算信息作废记录")
public class TInsuranceSettleCancel implements Serializable { public class TInsuranceSettleCancel implements Serializable {
/** /**
* * id
*/ */
@TableId(type = IdType.ASSIGN_ID)
private String id; private String id;
/** /**
......
...@@ -237,6 +237,23 @@ public class BigDecimalUtils { ...@@ -237,6 +237,23 @@ public class BigDecimalUtils {
} }
return bigDecimal; 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 数据 并四舍五入保留两位小数 * 对象转为BigDecimal 数据 并四舍五入保留两位小数
* @Author fxj * @Author fxj
......
...@@ -100,9 +100,15 @@ public class InsuredParam implements Serializable { ...@@ -100,9 +100,15 @@ public class InsuredParam implements Serializable {
private Integer isOverdue; private Integer isOverdue;
/** /**
* 派单日期 * 派单开始日期
*/ */
@Schema(description = "派单日期") @Schema(description = "派单开始日期")
private String createTime; private String createStartTime;
/**
* 派单结束日期
*/
@Schema(description = "派单结束日期")
private String createEndTime;
} }
...@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.*; ...@@ -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.mapper.TInsuranceDetailMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.*; 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.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.LocalDateUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil; import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*; import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
...@@ -77,6 +78,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -77,6 +78,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Resource @Resource
private TInsuranceRefundService tInsuranceRefundService; private TInsuranceRefundService tInsuranceRefundService;
@Resource
private TInsuranceSettleCancelService tInsuranceSettleCancelService;
/***********************商险办理********************************/ /***********************商险办理********************************/
/** /**
...@@ -2717,72 +2722,81 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2717,72 +2722,81 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.set(TInsuranceDetail :: getSettleType,success.getNewSettleType()) .set(TInsuranceDetail :: getSettleType,success.getNewSettleType())
.set(TInsuranceDetail :: getUpdateBy,user.getId()) .set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now()); .set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
String insuranceDetailId = success.getId();
//如果旧项目为合并结算,且新项目也是合并结算,则计算新的预估保费,作废旧的预估保费 //结算信息id
if(CommonConstants.ZERO_INT == oldSettleType && CommonConstants.ZERO_INT == newSettleType){ String defaultSettleId = success.getDefaultSettleId();
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium()); //实际保费
//如果存在则更新,不存在则新建 BigDecimal actualPremium = success.getActualPremium();
if (StringUtils.isNotBlank(success.getDefaultSettleId())){ //如果变更前为单独结算
TInsuranceSettle tInsuranceSettle = tInsuranceSettleService.getById(success.getDefaultSettleId()); if(CommonConstants.ONE_INT == oldSettleType){
//登记了保单保费
tInsuranceSettle.setId(success.getDefaultSettleId()); if (!BigDecimalUtils.isNullOrZero(actualPremium)){
tInsuranceSettle.setSettleType(success.getNewSettleType()); //变更后为单独结算
tInsuranceSettle.setInsDetailId(success.getId()); if(CommonConstants.ONE_INT == newSettleType){
tInsuranceSettle.setEstimatePremium(success.getEstimatePremium()); update(updateWrapper);
tInsuranceSettle.setUpdateTime(LocalDateTime.now()); //作废旧的数据,生成作废结算信息记录
tInsuranceSettleService.updateById(tInsuranceSettle); TInsuranceSettleCancel cancel = new TInsuranceSettleCancel();
}else{ cancel.setDeptNo(success.getOldDeptNo());
TInsuranceSettle tInsuranceSettle = new TInsuranceSettle(); cancel.setInsDetailId(success.getId());
tInsuranceSettle.setInsDetailId(success.getId()); cancel.setSettleId(defaultSettleId);
tInsuranceSettle.setSettleType(success.getNewSettleType()); cancel.setCreateUesr(user.getId());
tInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING); cancel.setCreateTime(LocalDateTime.now());
tInsuranceSettle.setEstimatePremium(success.getEstimatePremium()); tInsuranceSettleCancelService.save(cancel);
tInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT); //推送EKP // TODO: 2022/8/2
tInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT); //新增新的结算数据
tInsuranceSettle.setCreateTime(LocalDateTime.now()); TInsuranceSettle newInsuranceSettle = new TInsuranceSettle();
tInsuranceSettleService.save(tInsuranceSettle); newInsuranceSettle.setInsDetailId(insuranceDetailId);
//将结算id赋值给保单信息 newInsuranceSettle.setSettleType(newSettleType);
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,tInsuranceSettle.getId()); 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());
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//推送EKP // TODO: 2022/8/2
} }
//如果旧项目为预估,且新的项目为单独结算,则作废旧的预估保费,更新项目信息
if(CommonConstants.ZERO_INT == oldSettleType && CommonConstants.ONE_INT == newSettleType){
//更新旧的结算信息
if (StringUtils.isNotBlank(success.getDefaultSettleId())){
TInsuranceSettle tInsuranceSettle = tInsuranceSettleService.getById(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());
tInsuranceSettleCancel.setDeptNo(success.getOldDeptNo());
tInsuranceSettleCancel.setIsCancelPush(CommonConstants.ZERO_INT);
tInsuranceSettleCancel.setCreateUesr(user.getId());
tInsuranceSettleCancel.setCreateTime(LocalDateTime.now());
}else{
//更新预估保费
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,new BigDecimal("0"));
} }
//未登记保单保费
if(BigDecimalUtils.isNullOrZero(actualPremium)){
//变更后为单独结算
if (CommonConstants.ONE_INT == newSettleType){
//变更项目且不做处理
update(updateWrapper);
} }
//如果旧项目为单独结算,且新项目为合并结算,则计算预估保费,作废旧的预估保费 //变更后为合并结算
if(CommonConstants.ONE_INT == oldSettleType && CommonConstants.ZERO_INT == newSettleType){ if (CommonConstants.ZERO_INT == newSettleType){
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium()); //生成预估结算信息
//更新旧的结算信息
if (StringUtils.isNotBlank(success.getDefaultSettleId())){
TInsuranceSettle tInsuranceSettle = tInsuranceSettleService.getById(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 tInsuranceSettle = new TInsuranceSettle(); TInsuranceSettle tInsuranceSettle = new TInsuranceSettle();
tInsuranceSettle.setInsDetailId(success.getId()); tInsuranceSettle.setInsDetailId(success.getId());
tInsuranceSettle.setSettleType(success.getNewSettleType()); tInsuranceSettle.setSettleType(success.getNewSettleType());
...@@ -2792,15 +2806,118 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2792,15 +2806,118 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT); tInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
tInsuranceSettle.setCreateTime(LocalDateTime.now()); tInsuranceSettle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(tInsuranceSettle); tInsuranceSettleService.save(tInsuranceSettle);
//更新保单信息 //将结算id赋值给保单信息,并新增预估费用
updateWrapper.set(TInsuranceDetail::getDefaultSettleId,tInsuranceSettle.getId()); updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium());
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,tInsuranceSettle.getId());
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);
}
//变更为合并结算
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());
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//推送新的结算信息 // TODO: 2022/8/2
} }
} }
//如果旧项目为单独结算,且新项目也是单独结算,则更新项目编码,并发送至ekp
if(CommonConstants.ONE_INT == oldSettleType && CommonConstants.ONE_INT == newSettleType){
//updateWrapper.set(TInsuranceDetail ::getEstimatePremium,success.getEstimatePremium());
} }
update(updateWrapper);
TInsuranceOperate insuranceOperate = new TInsuranceOperate(); TInsuranceOperate insuranceOperate = new TInsuranceOperate();
insuranceOperate.setInsuranceDetailId(success.getId()); insuranceOperate.setInsuranceDetailId(success.getId());
insuranceOperate.setCreateBy(user.getId()); insuranceOperate.setCreateBy(user.getId());
...@@ -3582,7 +3699,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -3582,7 +3699,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (StringUtils.isNotBlank(defaultSettleId)){ if (StringUtils.isNotBlank(defaultSettleId)){
//查询结算状态 //查询结算状态
LambdaQueryWrapper<TInsuranceSettle> insuranceSettleQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TInsuranceSettle> insuranceSettleQuery = new LambdaQueryWrapper<>();
insuranceSettleQuery.eq(TInsuranceSettle :: getInsDetailId,insuranceDetail.getId()); insuranceSettleQuery.eq(TInsuranceSettle :: getId,defaultSettleId);
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getOne(insuranceSettleQuery); TInsuranceSettle insuranceSettle = tInsuranceSettleService.getOne(insuranceSettleQuery);
//当前结算状态为结算中时,不能变更结算项目 //当前结算状态为结算中时,不能变更结算项目
if (CommonConstants.TWO_STRING.equals(insuranceSettle.getSettleHandleStatus())){ if (CommonConstants.TWO_STRING.equals(insuranceSettle.getSettleHandleStatus())){
...@@ -3633,6 +3750,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -3633,6 +3750,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
param.setOldSettleType(insuranceDetail.getSettleType()); param.setOldSettleType(insuranceDetail.getSettleType());
param.setDefaultSettleId(insuranceDetail.getDefaultSettleId()); param.setDefaultSettleId(insuranceDetail.getDefaultSettleId());
param.setActualPremium(insuranceDetail.getActualPremium());
param.setId(insuranceDetail.getId()); param.setId(insuranceDetail.getId());
successList.add(param); successList.add(param);
} }
......
...@@ -334,8 +334,11 @@ ...@@ -334,8 +334,11 @@
<if test="param.isOverdue != null"> <if test="param.isOverdue != null">
and detail.IS_OVERDUE = #{param.isOverdue} and detail.IS_OVERDUE = #{param.isOverdue}
</if> </if>
<if test="param.createTime != null and param.createTime.trim() != ''"> <if test="param.createStartTime != null and param.createStartTime.trim() != ''">
AND detail.CREATE_TIME = concat(#{param.createTime}, ' 00:00:00') 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> </if>
ORDER BY detail.CREATE_TIME DESC ORDER BY detail.CREATE_TIME DESC
</select> </select>
...@@ -412,8 +415,11 @@ ...@@ -412,8 +415,11 @@
<if test="param.isOverdue != null "> <if test="param.isOverdue != null ">
and detail.IS_OVERDUE = #{param.isOverdue} and detail.IS_OVERDUE = #{param.isOverdue}
</if> </if>
<if test="param.createTime != null and param.createTime.trim() != ''"> <if test="param.createStartTime != null and param.createStartTime.trim() != ''">
AND detail.CREATE_TIME = concat(#{param.createTime}, ' 00:00:00') 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> </if>
ORDER BY detail.CREATE_TIME DESC ORDER BY detail.CREATE_TIME DESC
</select> </select>
...@@ -572,6 +578,9 @@ ...@@ -572,6 +578,9 @@
<if test="param.insuranceTypeName != null and param.insuranceTypeName.trim() != ''"> <if test="param.insuranceTypeName != null and param.insuranceTypeName.trim() != ''">
and detail.INSURANCE_TYPE_NAME like concat('%',replace(replace(#{param.insuranceTypeName},'_','\_'),'%','\%'),'%') and detail.INSURANCE_TYPE_NAME like concat('%',replace(replace(#{param.insuranceTypeName},'_','\_'),'%','\%'),'%')
</if> </if>
<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
and detail.INSURANCE_COMPANY_NAME = #{param.insuranceCompanyName}
</if>
ORDER BY refund.CREATE_TIME DESC ORDER BY refund.CREATE_TIME DESC
</select> </select>
<!-- 减员办理列表不分页查询--> <!-- 减员办理列表不分页查询-->
...@@ -742,6 +751,9 @@ ...@@ -742,6 +751,9 @@
<if test="param.insuranceTypeName != null and param.insuranceTypeName.trim() != ''"> <if test="param.insuranceTypeName != null and param.insuranceTypeName.trim() != ''">
and detail.INSURANCE_TYPE_NAME like concat('%',replace(replace(#{param.insuranceTypeName},'_','\_'),'%','\%'),'%') and detail.INSURANCE_TYPE_NAME like concat('%',replace(replace(#{param.insuranceTypeName},'_','\_'),'%','\%'),'%')
</if> </if>
<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
and detail.INSURANCE_COMPANY_NAME = #{param.insuranceCompanyName}
</if>
ORDER BY detail.CREATE_TIME DESC ORDER BY detail.CREATE_TIME DESC
</select> </select>
<!-- 减员办理--> <!-- 减员办理-->
......
...@@ -404,5 +404,19 @@ public class TProvidentFund extends BaseEntity { ...@@ -404,5 +404,19 @@ public class TProvidentFund extends BaseEntity {
@Schema(description = "电信编号" ) @Schema(description = "电信编号" )
@ExcelProperty("电信编号" ) @ExcelProperty("电信编号" )
private String telecomNumber; 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 { ...@@ -747,6 +747,20 @@ public class TSocialInfo extends BaseEntity {
@Schema(description = "大病办理状态:0待办理1办理成功2办理失败3已派减" ) @Schema(description = "大病办理状态:0待办理1办理成功2办理失败3已派减" )
@ExcelProperty("大病办理状态:0待办理1办理成功2办理失败3已派减" ) @ExcelProperty("大病办理状态:0待办理1办理成功2办理失败3已派减" )
private String bigailmentHandle; 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 ...@@ -998,6 +998,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
fund.setOverpayNumber(fundSet.getOverpayNumber()); fund.setOverpayNumber(fundSet.getOverpayNumber());
fund.setFundBaseSetId(fundSet.getId()); fund.setFundBaseSetId(fundSet.getId());
fund.setPayPolicy(fundSet.getPayPolicy()); fund.setPayPolicy(fundSet.getPayPolicy());
fund.setLowerLimit(fundSet.getLowerLimit());
fund.setUpperLimit(fundSet.getUpperLimit());
if (Common.isNotNull(fundSet.getProvince())){ if (Common.isNotNull(fundSet.getProvince())){
fund.setFundProvince(Integer.toString(fundSet.getProvince())); fund.setFundProvince(Integer.toString(fundSet.getProvince()));
} }
...@@ -1140,6 +1142,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -1140,6 +1142,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
social.setOverpayNumber(socialSet.getOverpayNumber()); social.setOverpayNumber(socialSet.getOverpayNumber());
social.setValueType(socialSet.getValueType()); social.setValueType(socialSet.getValueType());
social.setPayPolicy(socialSet.getPayPolicy()); social.setPayPolicy(socialSet.getPayPolicy());
social.setLowerLimit(socialSet.getLowerLimit());
social.setUpperLimit(socialSet.getUpperLimit());
// 比例初始化 // 比例初始化
social.setPersonalPensionPer(socialSet.getPersonalPersionPro()); social.setPersonalPensionPer(socialSet.getPersonalPersionPro());
social.setPersonalMedicalPer(socialSet.getPersonalMedicalPro()); social.setPersonalMedicalPer(socialSet.getPersonalMedicalPro());
...@@ -1380,6 +1384,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -1380,6 +1384,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
project.setUnitId(setInfoVo.getCustomerId()); project.setUnitId(setInfoVo.getCustomerId());
project.setUnitName(setInfoVo.getCustomerName()); project.setUnitName(setInfoVo.getCustomerName());
project.setUnitNo(setInfoVo.getCustomerCode()); project.setUnitNo(setInfoVo.getCustomerCode());
project.setDeptId(setInfoVo.getId());
} }
projects.put(excel.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+excel.getSettleDomainCode(),project); projects.put(excel.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+excel.getSettleDomainCode(),project);
} }
...@@ -1562,8 +1567,12 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -1562,8 +1567,12 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (Common.isEmpty(empVo.getContractName()) && validContractInfo(errorMessageList,excel,empVo)){ if (Common.isEmpty(empVo.getContractName()) && validContractInfo(errorMessageList,excel,empVo)){
return true; return true;
} }
if (Common.isNotNull(empVo.getEmpNatrue())){
excel.setEmpType(empVo.getEmpNatrue()); excel.setEmpType(empVo.getEmpNatrue());
}
if (Common.isNotNull(empVo.getEmpPhone())){
excel.setEmpMobile(empVo.getEmpPhone()); excel.setEmpMobile(empVo.getEmpPhone());
}
excel.setFileProvince(Common.isNotNullToStr(empVo.getFileProvince())); excel.setFileProvince(Common.isNotNullToStr(empVo.getFileProvince()));
excel.setFileCity(Common.isNotNullToStr(empVo.getFileCity())); excel.setFileCity(Common.isNotNullToStr(empVo.getFileCity()));
excel.setFileTown(Common.isNotNullToStr(empVo.getFileTown())); excel.setFileTown(Common.isNotNullToStr(empVo.getFileTown()));
...@@ -1601,15 +1610,19 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -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))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_CONTRACT_NOT_EMPTY)));
return true; 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.getPensionStart())
|| Common.isEmpty(excel.getPaymentType())
)) { )) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_NOT_EMPTY))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_NOT_EMPTY)));
return true; 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))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_DIY_NOT_EMPTY)));
return true; return true;
...@@ -1657,9 +1670,13 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -1657,9 +1670,13 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 各个社保基数和日期空 默认养老日期和基数 // 各个社保基数和日期空 默认养老日期和基数
initExcelBaseAndDate(excel); 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())){ if (Common.isNotNull(excel.getProvidentHousehold())){
...@@ -1779,32 +1796,38 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -1779,32 +1796,38 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
} }
private boolean validSocialStartDate(List<ErrorMessage> errorMessageList, TDispatchImportVo excel, SysBaseSetInfo socialSet) { 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())){ socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true; 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())){ socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true; 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())){ socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true; 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())){ socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true; 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())){ socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true; 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())){ socialSet.getCanOverpay(), socialSet.getOverpayNumber(), socialSet.getHaveThisMonth())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_START_IS_ERROR)));
return true; return true;
...@@ -2136,6 +2159,11 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -2136,6 +2159,11 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
detailVo.setEmployee(res.getData()); 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; return detailVo;
} }
...@@ -2218,8 +2246,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -2218,8 +2246,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 待办理 // 待办理
sf.setSocialAddStatus(CommonConstants.ONE_STRING); sf.setSocialAddStatus(CommonConstants.ONE_STRING);
sf.setSocialStatus(CommonConstants.ONE_STRING); sf.setSocialStatus(CommonConstants.ONE_STRING);
// 要更新 人员档案 项目档案 合同的状态信息
archivesDaprUtil.updateEmpInfo(dis.getEmpIdcard(),dis.getSettleDomainCode(),dis.getContractName());
//派增审核不通过 需要处理预估数据 //派增审核不通过 需要处理预估数据
} else if (CommonConstants.ONE_INT == flag.intValue()) { } else if (CommonConstants.ONE_INT == flag.intValue()) {
socialInfo.setDeleteFlag(CommonConstants.ONE_STRING); socialInfo.setDeleteFlag(CommonConstants.ONE_STRING);
...@@ -2333,6 +2359,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -2333,6 +2359,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dis.setStatus(CommonConstants.THREE_STRING); dis.setStatus(CommonConstants.THREE_STRING);
auditInfo.setAuditStatus(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); auditInfoMapper.insert(auditInfo);
dis.setAuditUser(user.getId()); dis.setAuditUser(user.getId());
...@@ -2658,8 +2692,11 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -2658,8 +2692,11 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (Common.isNotNull(auditInfo)) { if (Common.isNotNull(auditInfo)) {
//派增判断 //派增判断
if (CommonConstants.ZERO_STRING.equals(dis.getType())) { if (CommonConstants.ZERO_STRING.equals(dis.getType())) {
if ((CommonConstants.ONE_STRING.equals(dis.getSocialHandleStatus()) if (Common.isNotNull(dis.getSocialHandleStatus())
|| CommonConstants.TWO_STRING.equals(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.ONE_STRING.equals(dis.getFundHandleStatus())
|| CommonConstants.TWO_STRING.equals(dis.getFundHandleStatus())))) { || CommonConstants.TWO_STRING.equals(dis.getFundHandleStatus())))) {
//办理成功 //办理成功
...@@ -2672,7 +2709,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -2672,7 +2709,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dis.setStatus(CommonConstants.FOUR_STRING); dis.setStatus(CommonConstants.FOUR_STRING);
} }
if ((CommonConstants.ONE_STRING.equals(dis.getSocialHandleStatus()) 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())) { && Common.isEmpty(dis.getFundHandleStatus())) {
//办理成功 //办理成功
dis.setStatus(CommonConstants.FOUR_STRING); dis.setStatus(CommonConstants.FOUR_STRING);
......
...@@ -1143,14 +1143,14 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1143,14 +1143,14 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (socialFund.getUnitProvidengCardinal().compareTo(socialSet.getLowerLimit()) < CommonConstants.ZERO_INT) { if (socialFund.getUnitProvidengCardinal().compareTo(socialSet.getLowerLimit()) < CommonConstants.ZERO_INT) {
socialFund.setUnitProvidengCardinal(socialSet.getLowerLimit()); socialFund.setUnitProvidengCardinal(socialSet.getLowerLimit());
socialFund.setPersonalProvidentCardinal(socialSet.getLowerLimit()); socialFund.setPersonalProvidentCardinal(socialSet.getLowerLimit());
} else if (socialFund.getUnitPensionCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT) { } else if (socialFund.getUnitProvidengCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT) {
socialFund.setUnitProvidengCardinal(socialSet.getUpperLimit()); socialFund.setUnitProvidengCardinal(socialSet.getUpperLimit());
socialFund.setPersonalProvidentCardinal(socialSet.getUpperLimit()); socialFund.setPersonalProvidentCardinal(socialSet.getUpperLimit());
} }
//单边小数点处理逻辑 //单边小数点处理逻辑
if (Common.isNotNull(socialSet.getFundPayPoint())) { if (Common.isNotNull(socialSet.getFundPayPoint())) {
socialFund.setUnitFundSum(Common.formatMoneyForFund(BigDecimalUtils.safeMultiply(socialFund.getUnitProvidengCardinal(), socialFund.getUnitProvidentPer(), BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())), Integer.valueOf(socialFund.getFundPayPoint()))); socialFund.setUnitFundSum(Common.formatMoneyForFund(BigDecimalUtils.safeMultiply(socialFund.getUnitProvidengCardinal(), socialFund.getUnitProvidentPer(), BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())), Integer.parseInt(socialFund.getFundPayPoint())));
socialFund.setPersonalFundSum(Common.formatMoneyForFund(BigDecimalUtils.safeMultiply(socialFund.getPersonalProvidentCardinal(), socialFund.getPersonalProvidentPer(), BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())), Integer.valueOf(socialFund.getFundPayPoint()))); socialFund.setPersonalFundSum(Common.formatMoneyForFund(BigDecimalUtils.safeMultiply(socialFund.getPersonalProvidentCardinal(), socialFund.getPersonalProvidentPer(), BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())), Integer.parseInt(socialFund.getFundPayPoint())));
} }
} }
} }
......
...@@ -30,7 +30,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; ...@@ -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.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils; 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.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.concurrent.threadpool.YFSocialImportThreadPoolExecutor;
import com.yifu.cloud.plus.v1.yifu.social.constants.PaymentConstants; import com.yifu.cloud.plus.v1.yifu.social.constants.PaymentConstants;
import com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants; import com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants;
...@@ -369,13 +368,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -369,13 +368,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} else { } else {
redisUtil.set(key, user.getId(), 1800L); 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)) { if (CollUtil.isNotEmpty(list)) {
int taskSize = list.size() / partSize + CommonConstants.ONE_INT; int taskSize = list.size() / partSize + CommonConstants.ONE_INT;
...@@ -383,7 +375,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -383,7 +375,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (taskSize > residualCapacity) { if (taskSize > residualCapacity) {
errorMessageList.add(new ErrorMessage(-1, MsgUtils.getMessage(ErrorCodes.SOCIALINFO_LIST_NUM_LARGE))); errorMessageList.add(new ErrorMessage(-1, MsgUtils.getMessage(ErrorCodes.SOCIALINFO_LIST_NUM_LARGE)));
} }
} else { }else {
// -----------------------------生成paymentInfoMap本段开始-------------------------------- // -----------------------------生成paymentInfoMap本段开始--------------------------------
//已存在的档案数据 //已存在的档案数据
List<String> monthList = Common.listObjectToStrList(list, ExcelAttributeConstants.SOCIAL_PAY_MONTH).stream().distinct().collect(Collectors.toList()); 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 ...@@ -490,22 +482,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// -----------------------------线程池处理list,批量保存社保信息开始-------------------------------- // -----------------------------线程池处理list,批量保存社保信息开始--------------------------------
List<TPaymentInfoVo> tempList = new ArrayList<>(); List<TPaymentInfoVo> tempList = new ArrayList<>();
AtomicInteger atomicLine = new AtomicInteger(CommonConstants.ZERO_INT); AtomicInteger atomicLine = new AtomicInteger(CommonConstants.ZERO_INT);
List<CompletableFuture<List<TPaymentInfoImportLog>>> completableFutureList = new ArrayList<>();
try { try {
// 1.list.size()不足partSize,直接执行 // 1.list.size()不足partSize,直接执行
if (list.size() < partSize) { if (list.size() < partSize) {
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() -> CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2, executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap, paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
CommonConstants.ONE_INT), yfSocialImportThreadPoolExecutor) CommonConstants.ONE_INT, errorMessageList), yfSocialImportThreadPoolExecutor);
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
} }
// 2.list.size()大于partSize,循环分批执行 // 2.list.size()大于partSize,循环分批执行
...@@ -513,19 +497,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -513,19 +497,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (partSize <= list.size()) { if (partSize <= list.size()) {
// 处理第一个0位元素 // 处理第一个0位元素
final List<TPaymentInfoVo> finalList = list.subList(0, 1); final List<TPaymentInfoVo> finalList = list.subList(0, 1);
CompletableFuture<List<TPaymentInfoImportLog>> oneCompletableFuture = CompletableFuture.supplyAsync(() -> CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2, executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap, paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
CommonConstants.ONE_INT), yfSocialImportThreadPoolExecutor) CommonConstants.ONE_INT, errorMessageList), yfSocialImportThreadPoolExecutor);
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
lastIdx = 1; lastIdx = 1;
completableFutureList.add(oneCompletableFuture);
for (int i = 1; i < list.size(); i++) { for (int i = 1; i < list.size(); i++) {
// partSize数量的list为一个执行单元 // partSize数量的list为一个执行单元
tempList.add(list.get(i)); tempList.add(list.get(i));
...@@ -533,19 +510,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -533,19 +510,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
lastIdx = i; lastIdx = i;
List<TPaymentInfoVo> finalTempList = tempList; List<TPaymentInfoVo> finalTempList = tempList;
final int idx = i - partSize + 2; final int idx = i - partSize + 2;
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() -> CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2, executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap, paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
idx), yfSocialImportThreadPoolExecutor) idx, errorMessageList), yfSocialImportThreadPoolExecutor);
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
//todo
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
tempList = new ArrayList<>(); tempList = new ArrayList<>();
} }
} }
...@@ -567,40 +536,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -567,40 +536,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentInfoVo> finalTempList = tempList; List<TPaymentInfoVo> finalTempList = tempList;
int finalLastIdx = lastIdx + 1; int finalLastIdx = lastIdx + 1;
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() -> CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2, executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap, paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
finalLastIdx), yfSocialImportThreadPoolExecutor) finalLastIdx, errorMessageList), yfSocialImportThreadPoolExecutor);
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
} }
// 阻塞当前线程,等待所有的线程执行完毕
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; String importSuccessKey = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_WAIT_EXPORT;
redisUtil.set(importSuccessKey, random, 1800L); redisUtil.set(importSuccessKey, random, 1800L);
} catch (Exception e) { } catch (Exception e) {
log.error("社保缴费库数据批量导入异常:" + e); log.error("社保缴费库数据批量导入异常:" + e);
redisUtil.remove(key); redisUtil.remove(key);
errorMessageList.add(new ErrorMessage(-1, "数据批量导入异常:" + e));
// errorMessageHashMap = ServiceUtil.initErrorMessage(
// errorMessageHashMap, new ErrorMessage(-1, "数据批量导入异常:" + e), remotePushService, pushParam);
} finally { } finally {
paymentInfoPensionMap.clear(); paymentInfoPensionMap.clear();
paymentInfoBigMap.clear(); paymentInfoBigMap.clear();
...@@ -612,37 +560,38 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -612,37 +560,38 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// -----------------------------线程池处理list,批量保存社保信息结束-------------------------------- // -----------------------------线程池处理list,批量保存社保信息结束--------------------------------
//最后一个推送 //最后一个推送
log.info("社保批量导入耗时:{}", (System.currentTimeMillis() - start) + ""); 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); redisUtil.remove(key);
} }
} }
} }
private void initListToMap(List<TPaymentInfoVo> list, Map<String, TPaymentInfoVo> listMap) { /**
if (Common.isNotNull(list)) { * 转换缴纳地址为省市县ID
for (TPaymentInfoVo vo : list) { **/
listMap.put(String.valueOf(list.indexOf(vo) + 2), vo); 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) {
private void getIntegerErrorMessageHashMap(YifuUser user, List<ErrorMessage> errorInfo, String key, temp = areaMap2.get(areaArray[2] + CommonConstants.DOWN_LINE_STRING + (null == s.getSocialCity()
String random, Map<String, TPaymentInfoVo> listMap) { ? "null" : s.getSocialCity()));
List<TPaymentInfoImportLog> logList = new ArrayList<>(); if (Common.isNotNull(temp)) {
TPaymentInfoVo vo = null; s.setSocialTown(temp);
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); return s;
redisUtil.remove(key);
} }
/** /**
...@@ -656,9 +605,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -656,9 +605,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
* @description: * @description:
* @author: huyc * @author: huyc
* @date: 2022/7/25 * @date: 2022/7/25
* @return: List<TPaymentInfoImportLog> * @return:
*/ */
private List<TPaymentInfoImportLog> executeImportSocialList(YifuUser user, private List<ErrorMessage> executeImportSocialList(YifuUser user,
AtomicInteger atomicLine, AtomicInteger atomicLine,
String random, String random,
List<TPaymentInfoVo> list, List<TPaymentInfoVo> list,
...@@ -670,9 +619,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -670,9 +619,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
ConcurrentHashMap<String, TPaymentInfo> paymentInfoMedicalMap, ConcurrentHashMap<String, TPaymentInfo> paymentInfoMedicalMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoUnEmpMap, ConcurrentHashMap<String, TPaymentInfo> paymentInfoUnEmpMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoInjuryMap, ConcurrentHashMap<String, TPaymentInfo> paymentInfoInjuryMap,
int idx) { int idx, List<ErrorMessage> errorMessageList) {
int i = idx; int i = idx;
List<TPaymentInfoImportLog> logList = new ArrayList<>();
if (Common.isNotNull(list)) { if (Common.isNotNull(list)) {
TPaymentInfo paymentInfo = null; TPaymentInfo paymentInfo = null;
TSocialInfo socialInfo = null; TSocialInfo socialInfo = null;
...@@ -741,18 +689,15 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -741,18 +689,15 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
//导入校验 //导入校验
if (!Common.isNotNull(infoVo.getSocialPayMonth())) { if (!Common.isNotNull(infoVo.getSocialPayMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保缴纳月份不可为空!"));
, CommonConstants.ERROR_MSG_PRFIX + "社保缴纳月份不可为空!", i, random));
continue; continue;
} }
if (!Common.isNotNull(infoVo.getSocialCreateMonth())) { if (!Common.isNotNull(infoVo.getSocialCreateMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保生成月份不可为空!"));
, CommonConstants.ERROR_MSG_PRFIX + "社保生成月份不可为空!", i, random));
continue; continue;
} }
if (!Common.isNotNull(infoVo.getSocialPayAddr())) { if (!Common.isNotNull(infoVo.getSocialPayAddr())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保缴纳地不可为空!"));
, CommonConstants.ERROR_MSG_PRFIX + "社保缴纳地不可为空!", i, random));
continue; continue;
} }
//无对应员工的社保数据 //无对应员工的社保数据
...@@ -769,13 +714,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -769,13 +714,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
//对身份证与人员姓名的对应关系进行校验 //对身份证与人员姓名的对应关系进行校验
if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) { if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "姓名与身份证信息不一致,请核实后再次尝试!"));
, CommonConstants.ERROR_MSG_PRFIX + "姓名与身份证信息不一致,请核实后再次尝试!", i, random));
continue; continue;
} }
if (socialInfo != null && socialInfo.getSocialStartDate() == null) { if (socialInfo != null && socialInfo.getSocialStartDate() == null) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "的社保起缴日期为空!"));
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpIdcard() + "的社保起缴日期为空!", i, random));
continue; continue;
} }
if (null == socialInfo || (null != socialInfo && !ServiceUtil.checkMothForPaymentImport( if (null == socialInfo || (null != socialInfo && !ServiceUtil.checkMothForPaymentImport(
...@@ -788,8 +731,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -788,8 +731,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
? "null" : infoVo.getSocialTown())); ? "null" : infoVo.getSocialTown()));
//对身份证与人员姓名的对应关系进行校验 //对身份证与人员姓名的对应关系进行校验
if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) { if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() +
, CommonConstants.ERROR_MSG_PRFIX + "姓名与身份证信息不一致,请核实后再次尝试!", i, random)); "姓名与身份证信息不一致,请核实后再次尝试!"));
continue; continue;
} }
if (null != socialInfo && !ServiceUtil.checkMothForPaymentImport(socialInfo.getSocialStartDate() if (null != socialInfo && !ServiceUtil.checkMothForPaymentImport(socialInfo.getSocialStartDate()
...@@ -809,23 +752,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -809,23 +752,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
} }
if (null == socialInfo) { if (null == socialInfo) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() +
, CommonConstants.ERROR_MSG_PRFIX + "无对应员工" + infoVo.getEmpIdcard() "无对应员工" + infoVo.getEmpIdcard() + "的社保数据(请查验社保办理状态|缴纳地|起缴月份|停缴月份)"));
+ "的社保数据(请查验社保办理状态|缴纳地|起缴月份|停缴月份)", i, random));
continue; continue;
} }
//如果导入项目数大于办理成功项目数给提示,少于给进,有问题自行删除后导入 //如果导入项目数大于办理成功项目数给提示,少于给进,有问题自行删除后导入
checkRes = checkRepeatInfo(socialInfo, infoVo); checkRes = checkRepeatInfo(socialInfo, infoVo);
if (null != checkRes) { if (null != checkRes) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), checkRes));
, CommonConstants.ERROR_MSG_PRFIX + checkRes, i, random));
continue; continue;
} }
//查看缴纳月是否为空 //查看缴纳月是否为空
if (!Common.isNotNull(infoVo.getSocialPayMonth())) { if (!Common.isNotNull(infoVo.getSocialPayMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "必填项校验失败:社保缴纳月份不可为空!"));
, CommonConstants.ERROR_MSG_PRFIX + "必填项校验失败:社保缴纳月份不可为空!", i, random));
continue; continue;
} }
...@@ -848,9 +788,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -848,9 +788,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getPersonalPensionMoney())), BigDecimalUtils.safeAdd( BigDecimalUtils.isNullToZero(infoVo.getPersonalPensionMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(paymentInfo.getUnitPensionMoney()), BigDecimalUtils.isNullToZero(paymentInfo.getUnitPensionMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getPersonalPensionMoney()))).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(paymentInfo.getPersonalPensionMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard() + "的养老缴费数据,请勿重复导入!"));
+ "的养老缴费数据,请勿重复导入!", i, random));
continue; continue;
} else { } else {
paymentInfo = null; paymentInfo = null;
...@@ -875,9 +814,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -875,9 +814,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getPersonalUnemploymentMoney())), BigDecimalUtils.safeAdd( BigDecimalUtils.isNullToZero(infoVo.getPersonalUnemploymentMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(paymentInfo.getUnitUnemploymentMoney()), BigDecimalUtils.isNullToZero(paymentInfo.getUnitUnemploymentMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getPersonalUnemploymentMoney()))).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(paymentInfo.getPersonalUnemploymentMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard() + "的失业缴费数据,请勿重复导入!"));
+ "的失业缴费数据,请勿重复导入!", i, random));
continue; continue;
} else { } else {
paymentInfo = null; paymentInfo = null;
...@@ -902,9 +840,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -902,9 +840,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getPersonalMedicalMoney())), BigDecimalUtils.safeAdd( BigDecimalUtils.isNullToZero(infoVo.getPersonalMedicalMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(paymentInfo.getUnitMedicalMoney()), BigDecimalUtils.isNullToZero(paymentInfo.getUnitMedicalMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getPersonalMedicalMoney()))).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(paymentInfo.getPersonalMedicalMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard() + "的医保缴费数据,请勿重复导入!"));
+ "的医保缴费数据,请勿重复导入!", i, random));
continue; continue;
} else { } else {
paymentInfo = null; paymentInfo = null;
...@@ -929,9 +866,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -929,9 +866,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getPersonalBigmailmentMoney())), BigDecimalUtils.safeAdd( BigDecimalUtils.isNullToZero(infoVo.getPersonalBigmailmentMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(paymentInfo.getUnitBigmailmentMoney()), BigDecimalUtils.isNullToZero(paymentInfo.getUnitBigmailmentMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getPersonalBigmailmentMoney()))).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(paymentInfo.getPersonalBigmailmentMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard() + "的医疗救助金缴费数据,请勿重复导入!"));
+ "的医疗救助金缴费数据,请勿重复导入!", i, random));
continue; continue;
} else { } else {
paymentInfo = null; paymentInfo = null;
...@@ -952,9 +888,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -952,9 +888,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//存在社保缴费数据 //存在社保缴费数据
if (null != paymentInfo && BigDecimalUtils.safeMultiply(BigDecimalUtils.isNullToZero(infoVo.getUnitInjuryMoney()), if (null != paymentInfo && BigDecimalUtils.safeMultiply(BigDecimalUtils.isNullToZero(infoVo.getUnitInjuryMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getUnitInjuryMoney())).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(paymentInfo.getUnitInjuryMoney())).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard() + "的单位工伤缴费数据,请勿重复导入!"));
+ "的单位工伤缴费数据,请勿重复导入!", i, random));
continue; continue;
} else { } else {
paymentInfo = null; paymentInfo = null;
...@@ -975,9 +910,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -975,9 +910,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//存在社保缴费数据 //存在社保缴费数据
if (null != paymentInfo && BigDecimalUtils.safeMultiply(BigDecimalUtils.isNullToZero(infoVo.getUnitBirthMoney()), if (null != paymentInfo && BigDecimalUtils.safeMultiply(BigDecimalUtils.isNullToZero(infoVo.getUnitBirthMoney()),
BigDecimalUtils.isNullToZero(paymentInfo.getUnitBirthMoney())).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(paymentInfo.getUnitBirthMoney())).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard() + "的单位生育缴费数据,请勿重复导入!"));
+ "的单位生育缴费数据,请勿重复导入!", i, random));
continue; continue;
} else { } else {
paymentInfo = null; paymentInfo = null;
...@@ -1080,60 +1014,21 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1080,60 +1014,21 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (null != paymentInfo && Common.isNotNull(paymentInfo.getId())) { if (null != paymentInfo && Common.isNotNull(paymentInfo.getId())) {
res = baseMapper.updateById(paymentInfo); res = baseMapper.updateById(paymentInfo);
if (res < 0) { if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() + "_缴费库更新失败!"));
, 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));
continue; continue;
} }
} else { } else {
res = insertAndSTimestamp(paymentInfo); res = insertAndSTimestamp(paymentInfo);
if (res < 0) { if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() + "_缴费库保存失败!"));
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpName() + "_缴费库保存失败!", i, random));
continue; continue;
} }
} }
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.SUCCESS_MSG_PREFIX + "保存成功!", i, random));
} }
itemMap.clear(); itemMap.clear();
cusMap.clear(); cusMap.clear();
} else {
return null;
} }
return logList; return errorMessageList;
}
/**
* 转换缴纳地址为省市县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;
} }
//比对缴纳地是否一致 //比对缴纳地是否一致
...@@ -1245,7 +1140,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1245,7 +1140,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TPaymentHeFeiVo> util1 = new ExcelUtil<>(TPaymentHeFeiVo.class); ExcelUtil<TPaymentHeFeiVo> util1 = new ExcelUtil<>(TPaymentHeFeiVo.class);
;
// 写法2: // 写法2:
// 匿名内部类 不用额外写一个DemoDataListener // 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭 // 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
...@@ -1304,7 +1198,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1304,7 +1198,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TPaymentInfoVo> util1 = new ExcelUtil<>(TPaymentInfoVo.class); ExcelUtil<TPaymentInfoVo> util1 = new ExcelUtil<>(TPaymentInfoVo.class);
;
// 写法2: // 写法2:
// 匿名内部类 不用额外写一个DemoDataListener // 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭 // 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
...@@ -1646,7 +1539,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1646,7 +1539,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
private void importTPaymentSocialHeFei(List<TPaymentHeFeiVo> list, List<ErrorMessage> errorMessageList, private void importTPaymentSocialHeFei(List<TPaymentHeFeiVo> list, List<ErrorMessage> errorMessageList,
String random, YifuUser user, String type) { String random, YifuUser user, String type) {
long start = System.currentTimeMillis();
HashMap<String, String> areaMap = new HashMap<String, String>(); HashMap<String, String> areaMap = new HashMap<String, String>();
HashMap<String, String> areaMap2 = new HashMap<String, String>(); HashMap<String, String> areaMap2 = new HashMap<String, String>();
...@@ -1666,13 +1558,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1666,13 +1558,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// 判断是否有相同的用户在导入社保费用 存在提示稍后重试 // 判断是否有相同的用户在导入社保费用 存在提示稍后重试
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_IMPORT; 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多次循环查询数据库浪费性能 // 将以下代码提取出来,使用paymentInfoMap提升性能,避免list多次循环查询数据库浪费性能
// 导入前做队列空闲判断,防止队列不足出现数据丢失的场景 // 导入前做队列空闲判断,防止队列不足出现数据丢失的场景
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
...@@ -1680,9 +1565,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1680,9 +1565,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
int residualCapacity = yfSocialImportThreadPoolExecutor.getResidualCapacity(); int residualCapacity = yfSocialImportThreadPoolExecutor.getResidualCapacity();
if (taskSize > residualCapacity) { if (taskSize > residualCapacity) {
errorMessageList.add(new ErrorMessage(-1, MsgUtils.getMessage(ErrorCodes.SOCIALINFO_LIST_NUM_LARGE))); errorMessageList.add(new ErrorMessage(-1, MsgUtils.getMessage(ErrorCodes.SOCIALINFO_LIST_NUM_LARGE)));
} } else {
}
// -----------------------------生成paymentInfoMap本段开始-------------------------------- // -----------------------------生成paymentInfoMap本段开始--------------------------------
//已存在的档案数据 //已存在的档案数据
List<String> monthList = Common.listObjectToStrList(list, ExcelAttributeConstants.SOCIAL_PAY_MONTH).stream().distinct().collect(Collectors.toList()); 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 ...@@ -1765,22 +1648,13 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// -----------------------------线程池处理list,批量保存社保信息开始-------------------------------- // -----------------------------线程池处理list,批量保存社保信息开始--------------------------------
List<TPaymentHeFeiVo> tempList = new ArrayList<>(); List<TPaymentHeFeiVo> tempList = new ArrayList<>();
AtomicInteger atomicLine = new AtomicInteger(CommonConstants.ZERO_INT); AtomicInteger atomicLine = new AtomicInteger(CommonConstants.ZERO_INT);
List<CompletableFuture<List<TPaymentInfoImportLog>>> completableFutureList = new ArrayList<>();
try { try {
// 1.list.size()不足partSize,直接执行 // 1.list.size()不足partSize,直接执行
if (list.size() < partSize) { if (list.size() < partSize) {
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture.supplyAsync(() -> executeImportSocialListThree(
-> executeImportSocialListThree(user, atomicLine, random, list, areaMap, areaMap2, user, atomicLine, random, list, areaMap, areaMap2, paymentInfoPensionMap,
paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
paymentInfoInjuryMap, CommonConstants.ONE_INT, type), yfSocialImportThreadPoolExecutor) CommonConstants.ONE_INT, type, errorMessageList), yfSocialImportThreadPoolExecutor);
.whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
//todo
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
} }
// 2.list.size()大于partSize,循环分批执行 // 2.list.size()大于partSize,循环分批执行
...@@ -1788,18 +1662,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1788,18 +1662,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (partSize <= list.size()) { if (partSize <= list.size()) {
// 处理第一个0位元素 // 处理第一个0位元素
final List<TPaymentHeFeiVo> finalList = list.subList(0, 1); final List<TPaymentHeFeiVo> finalList = list.subList(0, 1);
CompletableFuture<List<TPaymentInfoImportLog>> oneCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture.supplyAsync(() -> executeImportSocialListThree(
-> executeImportSocialListThree(user, atomicLine, random, finalList, areaMap, areaMap2, user, atomicLine, random, finalList, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, CommonConstants.ONE_INT, type), yfSocialImportThreadPoolExecutor) paymentInfoInjuryMap, CommonConstants.ONE_INT, type, errorMessageList)
.whenComplete((result, e) -> { , yfSocialImportThreadPoolExecutor);
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
lastIdx = 1; lastIdx = 1;
completableFutureList.add(oneCompletableFuture);
for (int i = 1; i < list.size(); i++) { for (int i = 1; i < list.size(); i++) {
// partSize数量的list为一个执行单元 // partSize数量的list为一个执行单元
tempList.add(list.get(i)); tempList.add(list.get(i));
...@@ -1807,17 +1675,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1807,17 +1675,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
lastIdx = i; lastIdx = i;
final int idx = i - partSize + 2; final int idx = i - partSize + 2;
List<TPaymentHeFeiVo> finalTempList1 = tempList; List<TPaymentHeFeiVo> finalTempList1 = tempList;
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture.supplyAsync(() -> executeImportSocialListThree(user
-> executeImportSocialListThree(user, atomicLine, random, finalTempList1, areaMap, , atomicLine, random, finalTempList1, areaMap,
areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, idx, type), yfSocialImportThreadPoolExecutor) paymentInfoInjuryMap, idx, type, errorMessageList)
.whenComplete((result, e) -> { , yfSocialImportThreadPoolExecutor);
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
tempList = new ArrayList<>(); tempList = new ArrayList<>();
} }
} }
...@@ -1839,37 +1701,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1839,37 +1701,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentHeFeiVo> finalTempList = tempList; List<TPaymentHeFeiVo> finalTempList = tempList;
int finalLastIdx = lastIdx + 1; int finalLastIdx = lastIdx + 1;
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture.supplyAsync(() -> executeImportSocialListThree(
-> executeImportSocialListThree(user, atomicLine, random, finalTempList, areaMap, user, atomicLine, random, finalTempList, areaMap,
areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, finalLastIdx, type), yfSocialImportThreadPoolExecutor) paymentInfoInjuryMap, finalLastIdx, type, errorMessageList)
.whenComplete((result, e) -> { , yfSocialImportThreadPoolExecutor);
if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result);
}
// ServiceUtil.initErrorMessage(atomicLine.get(), remotePushService, pushParam);
});
completableFutureList.add(listCompletableFuture);
} }
// 阻塞当前线程,等待所有的线程执行完毕
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; String importSuccessKey = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_WAIT_EXPORT;
redisUtil.set(importSuccessKey, random, 1800L); redisUtil.set(importSuccessKey, random, 1800L);
} catch (Exception e) { } catch (Exception e) {
log.error("社保缴费库数据批量导入异常:" + e); log.error("社保缴费库数据批量导入异常:" + e);
redisUtil.remove(key); redisUtil.remove(key);
errorMessageList.add(new ErrorMessage(-1, "数据批量导入异常:" + e));
} finally { } finally {
paymentInfoPensionMap.clear(); paymentInfoPensionMap.clear();
paymentInfoBigMap.clear(); paymentInfoBigMap.clear();
...@@ -1878,38 +1722,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1878,38 +1722,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfoInjuryMap.clear(); 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, String random,
List<TPaymentHeFeiVo> list, List<TPaymentHeFeiVo> list,
HashMap<String, String> areaMap, HashMap<String, String> areaMap,
...@@ -1918,10 +1734,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1918,10 +1734,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
ConcurrentHashMap<String, TPaymentInfo> paymentInfoMedicalMap, ConcurrentHashMap<String, TPaymentInfo> paymentInfoMedicalMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoUnEmpMap, ConcurrentHashMap<String, TPaymentInfo> paymentInfoUnEmpMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoInjuryMap, ConcurrentHashMap<String, TPaymentInfo> paymentInfoInjuryMap,
int idx, int idx, String type,List<ErrorMessage> errorMessageList) {
String type) {
int i = idx; int i = idx;
List<TPaymentInfoImportLog> logList = new ArrayList<>();
if (Common.isNotNull(list)) { if (Common.isNotNull(list)) {
TPaymentInfo payExists = null; TPaymentInfo payExists = null;
TSocialInfo socialInfo = null; TSocialInfo socialInfo = null;
...@@ -1989,7 +1803,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1989,7 +1803,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
infoVo.setEmpIdcard(infoVo.getEmpIdcard().replace("x", "X")); infoVo.setEmpIdcard(infoVo.getEmpIdcard().replace("x", "X"));
} }
//导入校验 //导入校验
if (socialThreeCheckBase(random, i, logList, infoVo, type)) { if (socialThreeCheckBase(random, i, errorMessageList, infoVo, type)) {
continue; continue;
} }
//无对应员工的社保数据 //无对应员工的社保数据
...@@ -2005,13 +1819,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2005,13 +1819,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
//对身份证与人员姓名的对应关系进行校验 //对身份证与人员姓名的对应关系进行校验
if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) { if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "姓名与身份证信息不一致,请核实后再次尝试!"));
, CommonConstants.ERROR_MSG_PRFIX + "姓名与身份证信息不一致,请核实后再次尝试!", i, random));
continue;
} }
if (socialInfo != null && socialInfo.getSocialStartDate() == null) { if (socialInfo != null && socialInfo.getSocialStartDate() == null) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "的社保起缴日期为空!"));
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpIdcard() + "的社保起缴日期为空!", i, random));
continue; continue;
} }
if (null == socialInfo || (null != socialInfo && !ServiceUtil.checkMothForPaymentImport( if (null == socialInfo || (null != socialInfo && !ServiceUtil.checkMothForPaymentImport(
...@@ -2023,8 +1834,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2023,8 +1834,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
+ CommonConstants.DOWN_LINE_STRING + (null == infoVo.getSocialTown() ? "null" : infoVo.getSocialTown())); + CommonConstants.DOWN_LINE_STRING + (null == infoVo.getSocialTown() ? "null" : infoVo.getSocialTown()));
//对身份证与人员姓名的对应关系进行校验 //对身份证与人员姓名的对应关系进行校验
if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) { if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "姓名与身份证信息不一致,请核实后再次尝试!"));
, CommonConstants.ERROR_MSG_PRFIX + "姓名与身份证信息不一致,请核实后再次尝试!", i, random));
continue; continue;
} }
if (null != socialInfo && !ServiceUtil.checkMothForPaymentImport(socialInfo.getSocialStartDate() if (null != socialInfo && !ServiceUtil.checkMothForPaymentImport(socialInfo.getSocialStartDate()
...@@ -2044,23 +1854,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2044,23 +1854,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
} }
if (null == socialInfo) { if (null == socialInfo) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "无对应员工" + infoVo.getEmpIdcard() +
, CommonConstants.ERROR_MSG_PRFIX + "无对应员工" + infoVo.getEmpIdcard() + "的社保数据(请查验社保办理状态|缴纳地|起缴月份|停缴月份)"));
"的社保数据(请查验社保办理状态|缴纳地|起缴月份|停缴月份)", i, random));
continue; continue;
} }
//如果导入项目数大于办理成功项目数给提示,少于给进,有问题自行删除后导入 //如果导入项目数大于办理成功项目数给提示,少于给进,有问题自行删除后导入
checkRes = checkRepeatInfoThree(socialInfo, infoVo, type); checkRes = checkRepeatInfoThree(socialInfo, infoVo, type);
if (null != checkRes) { if (null != checkRes) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), checkRes));
, CommonConstants.ERROR_MSG_PRFIX + checkRes, i, random));
continue; continue;
} }
//查看缴纳月是否为空 //查看缴纳月是否为空
if (!Common.isNotNull(infoVo.getSocialPayMonth())) { if (!Common.isNotNull(infoVo.getSocialPayMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "必填项校验失败:社保缴纳月份不可为空!"));
, CommonConstants.ERROR_MSG_PRFIX + "必填项校验失败:社保缴纳月份不可为空!", i, random));
continue; continue;
} }
...@@ -2081,9 +1888,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2081,9 +1888,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getUnitSet())), BigDecimalUtils.safeAdd( BigDecimalUtils.isNullToZero(infoVo.getUnitSet())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(payExists.getUnitPensionMoney()), BigDecimalUtils.isNullToZero(payExists.getUnitPensionMoney()),
BigDecimalUtils.isNullToZero(payExists.getPersonalPensionMoney()))).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(payExists.getPersonalPensionMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard() + "的养老缴费数据,请勿重复导入!"));
+ "的养老缴费数据,请勿重复导入!", i, random));
continue; continue;
} else { } else {
payExists = null; payExists = null;
...@@ -2107,9 +1913,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2107,9 +1913,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getUnitSet())), BigDecimalUtils.safeAdd( BigDecimalUtils.isNullToZero(infoVo.getUnitSet())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(payExists.getUnitUnemploymentMoney()), BigDecimalUtils.isNullToZero(payExists.getUnitUnemploymentMoney()),
BigDecimalUtils.isNullToZero(payExists.getPersonalUnemploymentMoney()))).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(payExists.getPersonalUnemploymentMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard() + "的失业缴费数据,请勿重复导入!"));
+ "的失业缴费数据,请勿重复导入!", i, random));
continue; continue;
} else { } else {
payExists = null; payExists = null;
...@@ -2134,9 +1939,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2134,9 +1939,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getPersonalMedicalMoney())), BigDecimalUtils.safeAdd( BigDecimalUtils.isNullToZero(infoVo.getPersonalMedicalMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(payExists.getUnitMedicalMoney()), BigDecimalUtils.isNullToZero(payExists.getUnitMedicalMoney()),
BigDecimalUtils.isNullToZero(payExists.getPersonalMedicalMoney()))).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(payExists.getPersonalMedicalMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard() + "的医保缴费数据,请勿重复导入!"));
+ "的医保缴费数据,请勿重复导入!", i, random));
continue; continue;
} else { } else {
payExists = null; payExists = null;
...@@ -2160,9 +1964,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2160,9 +1964,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
BigDecimalUtils.isNullToZero(infoVo.getUnitMedicalMoney()), BigDecimalUtils.isNullToZero(infoVo.getUnitMedicalMoney()),
BigDecimalUtils.isNullToZero(infoVo.getPersonalMedicalMoney())), BigDecimalUtils.isNullToZero(infoVo.getPersonalMedicalMoney())),
BigDecimalUtils.isNullToZero(payExists.getUnitInjuryMoney())).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(payExists.getUnitInjuryMoney())).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard() + "的单位工伤缴费数据,请勿重复导入!"));
+ "的单位工伤缴费数据,请勿重复导入!", i, random));
continue; continue;
} else { } else {
payExists = null; payExists = null;
...@@ -2278,58 +2081,44 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2278,58 +2081,44 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (null != payExists && Common.isNotNull(payExists.getId())) { if (null != payExists && Common.isNotNull(payExists.getId())) {
res = baseMapper.updateById(payExists); res = baseMapper.updateById(payExists);
if (res < 0) { if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), 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));
continue; continue;
} }
} else { } else {
res = insertAndSTimestamp(payExists); res = insertAndSTimestamp(payExists);
if (res < 0) { if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "_缴费库保存失败!"));
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpIdcard() + "_缴费库保存失败!", i, random));
continue; continue;
} }
} }
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.SUCCESS_MSG_PREFIX + "保存成功!", i, random));
} }
itemMap.clear(); itemMap.clear();
cusMap.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) { infoVo, String type) {
if (!Common.isNotNull(infoVo.getSocialPayMonth())) { if (!Common.isNotNull(infoVo.getSocialPayMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保缴纳月份不可为空!"));
, CommonConstants.ERROR_MSG_PRFIX + "社保缴纳月份不可为空!", i, random));
return true; return true;
} }
if (!Common.isNotNull(infoVo.getSocialCreateMonth())) { if (!Common.isNotNull(infoVo.getSocialCreateMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保生成月份不可为空!"));
, CommonConstants.ERROR_MSG_PRFIX + "社保生成月份不可为空!", i, random));
return true; return true;
} }
if (!Common.isNotNull(infoVo.getSocialPayAddr())) { if (!Common.isNotNull(infoVo.getSocialPayAddr())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保缴纳地不可为空!"));
, CommonConstants.ERROR_MSG_PRFIX + "社保缴纳地不可为空!", i, random));
return true; return true;
} }
if (CommonConstants.ZERO_STRING.equals(type) && !PaymentConstants.PENSION_RISK.equals(infoVo.getRiskType()) if (CommonConstants.ZERO_STRING.equals(type) && !PaymentConstants.PENSION_RISK.equals(infoVo.getRiskType())
&& !PaymentConstants.UNEMPLOYEEMENT_RISK.equals(infoVo.getRiskType()) && !PaymentConstants.UNEMPLOYEEMENT_RISK.equals(infoVo.getRiskType())
&& !PaymentConstants.INJURY_RISK.equals(infoVo.getRiskType())) { && !PaymentConstants.INJURY_RISK.equals(infoVo.getRiskType())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "无相关险种!"));
, CommonConstants.ERROR_MSG_PRFIX + "无相关险种!", i, random));
return true; return true;
} }
return false; return false;
...@@ -2365,64 +2154,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2365,64 +2154,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
return s; 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 { ...@@ -177,7 +177,6 @@ public class ServiceUtil {
}else if (CommonConstants.ONE_STRING.equals(canOverpay)){ }else if (CommonConstants.ONE_STRING.equals(canOverpay)){
temp = socialStartDate; temp = socialStartDate;
} }
boolean falg= isaBoolean(temp, now);
return (null != temp && (temp.getYear() < now.getYear() || isaBoolean(temp, now))); return (null != temp && (temp.getYear() < now.getYear() || isaBoolean(temp, now)));
} }
private static boolean isaBoolean(LocalDateTime temp, LocalDateTime now) { private static boolean isaBoolean(LocalDateTime temp, LocalDateTime now) {
......
...@@ -74,6 +74,8 @@ ...@@ -74,6 +74,8 @@
<result property="createName" column="CREATE_NAME"/> <result property="createName" column="CREATE_NAME"/>
<result property="updateTime" column="UPDATE_TIME"/> <result property="updateTime" column="UPDATE_TIME"/>
<result property="payPolicy" column="PAY_POLICY"/> <result property="payPolicy" column="PAY_POLICY"/>
<result property="lowerLimit" column="LOWER_LIMIT"/>
<result property="upperLimit" column="UPPER_LIMIT"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.ID, a.ID,
...@@ -125,7 +127,9 @@ ...@@ -125,7 +127,9 @@
a.UPDATE_BY, a.UPDATE_BY,
a.CREATE_NAME, a.CREATE_NAME,
a.UPDATE_TIME, a.UPDATE_TIME,
a.PAY_POLICY a.PAY_POLICY,
a.LOWER_LIMIT,
a.UPPER_LIMIT
</sql> </sql>
<sql id="tProvidentFund_where"> <sql id="tProvidentFund_where">
<if test="tProvidentFund != null"> <if test="tProvidentFund != null">
......
...@@ -265,9 +265,9 @@ ...@@ -265,9 +265,9 @@
a.EMP_IDCARD, a.EMP_IDCARD,
a.EMP_TYPE, a.EMP_TYPE,
a.SETTLE_DOMAIN, a.SETTLE_DOMAIN,
a.SETTLE_DOMAIN_CODE, concat(ifnull(a.SETTLE_DOMAIN_CODE,""),if(a.SETTLE_DOMAIN_CODE is null or a.SETTLE_DOMAIN_CODE_FUND is null,"",","),ifnull(a.SETTLE_DOMAIN_CODE_FUND,"")) SETTLE_DOMAIN_CODE,
a.SETTLE_DOMAIN_NAME, concat(ifnull(a.SETTLE_DOMAIN_NAME,""),if(a.SETTLE_DOMAIN_NAME is null or a.SETTLE_DOMAIN_NAME_FUND is null,"",","),ifnull(a.SETTLE_DOMAIN_NAME_FUND,"")) SETTLE_DOMAIN_NAME,
a.UNIT_NAME, concat(ifnull(a.UNIT_NAME,""),if(a.UNIT_NAME is null or a.UNIT_NAME_FUND is null,"",","),ifnull(a.UNIT_NAME_FUND,"")) UNIT_NAME,
a.UNIT_ID, a.UNIT_ID,
a.SETTLE_DOMAIN_FUND, a.SETTLE_DOMAIN_FUND,
a.SETTLE_DOMAIN_CODE_FUND, a.SETTLE_DOMAIN_CODE_FUND,
...@@ -418,10 +418,10 @@ ...@@ -418,10 +418,10 @@
AND a.SETTLE_DOMAIN = #{tSocialFundInfo.settleDomain} AND a.SETTLE_DOMAIN = #{tSocialFundInfo.settleDomain}
</if> </if>
<if test="tSocialFundInfo.settleDomainName != null and tSocialFundInfo.settleDomainName.trim() != ''"> <if test="tSocialFundInfo.settleDomainName != null and tSocialFundInfo.settleDomainName.trim() != ''">
AND a.SETTLE_DOMAIN_NAME = #{tSocialFundInfo.settleDomainName} AND (a.SETTLE_DOMAIN_NAME = #{tSocialFundInfo.settleDomainName} or a.SETTLE_DOMAIN_NAME_FUND = #{tSocialFundInfo.settleDomainName})
</if> </if>
<if test="tSocialFundInfo.unitName != null and tSocialFundInfo.unitName.trim() != ''"> <if test="tSocialFundInfo.unitName != null and tSocialFundInfo.unitName.trim() != ''">
AND a.UNIT_NAME = #{tSocialFundInfo.unitName} AND (a.UNIT_NAME = #{tSocialFundInfo.unitName} or a.UNIT_NAME_FUND = #{tSocialFundInfo.unitName})
</if> </if>
<if test="tSocialFundInfo.unitId != null and tSocialFundInfo.unitId.trim() != ''"> <if test="tSocialFundInfo.unitId != null and tSocialFundInfo.unitId.trim() != ''">
AND a.UNIT_ID = #{tSocialFundInfo.unitId} AND a.UNIT_ID = #{tSocialFundInfo.unitId}
...@@ -790,8 +790,9 @@ ...@@ -790,8 +790,9 @@
a.EMP_IDCARD, a.EMP_IDCARD,
a.EMP_TYPE, a.EMP_TYPE,
d.EMP_MOBILE, d.EMP_MOBILE,
a.UNIT_NAME, concat(ifnull(a.SETTLE_DOMAIN_CODE,""),if(a.SETTLE_DOMAIN_CODE is null or a.SETTLE_DOMAIN_CODE_FUND is null,"",","),ifnull(a.SETTLE_DOMAIN_CODE_FUND,"")) SETTLE_DOMAIN_CODE,
a.SETTLE_DOMAIN_NAME, concat(ifnull(a.SETTLE_DOMAIN_NAME,""),if(a.SETTLE_DOMAIN_NAME is null or a.SETTLE_DOMAIN_NAME_FUND is null,"",","),ifnull(a.SETTLE_DOMAIN_NAME_FUND,"")) SETTLE_DOMAIN_NAME,
concat(ifnull(a.UNIT_NAME,""),if(a.UNIT_NAME is null or a.UNIT_NAME_FUND is null,"",","),ifnull(a.UNIT_NAME_FUND,"")) UNIT_NAME,
d.ID_CARD_PROVINCE, d.ID_CARD_PROVINCE,
d.ID_CARD_CITY, d.ID_CARD_CITY,
d.ID_CARD_TOWN, d.ID_CARD_TOWN,
......
...@@ -121,6 +121,8 @@ ...@@ -121,6 +121,8 @@
<result property="createName" column="CREATE_NAME"/> <result property="createName" column="CREATE_NAME"/>
<result property="updateTime" column="UPDATE_TIME"/> <result property="updateTime" column="UPDATE_TIME"/>
<result property="payPolicy" column="PAY_POLICY"/> <result property="payPolicy" column="PAY_POLICY"/>
<result property="lowerLimit" column="LOWER_LIMIT"/>
<result property="upperLimit" column="UPPER_LIMIT"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.ID, a.ID,
...@@ -221,7 +223,9 @@ ...@@ -221,7 +223,9 @@
a.UPDATE_BY, a.UPDATE_BY,
a.CREATE_NAME, a.CREATE_NAME,
a.UPDATE_TIME, a.UPDATE_TIME,
a.PAY_POLICY a.PAY_POLICY,
a.LOWER_LIMIT,
a.UPPER_LIMIT
</sql> </sql>
<sql id="tSocialInfo_where"> <sql id="tSocialInfo_where">
<if test="tSocialInfo != null"> <if test="tSocialInfo != null">
......
...@@ -26,13 +26,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -26,13 +26,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.unboundid.ldap.sdk.SearchResultEntry; 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.SysDept;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDeptRelation; 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.SysDeptMapper;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysUserMapper; 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.SysDeptRelationService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptService; 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.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; 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.ldap.util.LdapUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
...@@ -44,7 +42,6 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -44,7 +42,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* <p> * <p>
...@@ -214,6 +211,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -214,6 +211,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
SysDept insertSysDept = new SysDept(); SysDept insertSysDept = new SysDept();
insertSysDept.setName(deptName); insertSysDept.setName(deptName);
insertSysDept.setParentId(0L); insertSysDept.setParentId(0L);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
insertSysDept.setDeptDn(dn); insertSysDept.setDeptDn(dn);
this.save(insertSysDept); this.save(insertSysDept);
} else { } else {
...@@ -231,6 +231,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -231,6 +231,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
insertSysDept.setName(deptName); insertSysDept.setName(deptName);
insertSysDept.setParentId(sysDept.getDeptId()); insertSysDept.setParentId(sysDept.getDeptId());
insertSysDept.setDeptDn(dn); insertSysDept.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
this.save(insertSysDept); this.save(insertSysDept);
} }
} else { } else {
......
...@@ -424,7 +424,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -424,7 +424,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
if (null != list) { if (null != list) {
List<SysUser> listUser = this.list(Wrappers.<SysUser>query().lambda().eq(SysUser::getDelFlag, CommonConstants.STATUS_NORMAL)); 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()); 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> updateList = new ArrayList<>();
List<PersonVo> insertList = new ArrayList<>(); List<PersonVo> insertList = new ArrayList<>();
for (PersonVo personVo : list) { for (PersonVo personVo : list) {
...@@ -469,6 +468,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -469,6 +468,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
insertSysDept.setName(deptName); insertSysDept.setName(deptName);
insertSysDept.setParentId(0L); insertSysDept.setParentId(0L);
insertSysDept.setDeptDn(dn); insertSysDept.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
sysDeptMapper.insert(insertSysDept); sysDeptMapper.insert(insertSysDept);
} else { } else {
sysDept.setName(deptName); sysDept.setName(deptName);
...@@ -484,6 +486,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -484,6 +486,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
insertSysDept.setName(deptName); insertSysDept.setName(deptName);
insertSysDept.setParentId(sysDept.getDeptId()); insertSysDept.setParentId(sysDept.getDeptId());
insertSysDept.setDeptDn(dn); insertSysDept.setDeptDn(dn);
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
}
sysDeptMapper.insert(insertSysDept); sysDeptMapper.insert(insertSysDept);
} }
} else { } else {
......
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
<insert id="batchInsertUser" parameterType="java.util.List"> <insert id="batchInsertUser" parameterType="java.util.List">
insert into sys_user insert into sys_user
(user_id,username,phone,email,password,nickname,create_time) (user_id,username,phone,email,password,nickname,deptId,create_time)
VALUES VALUES
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( (
...@@ -220,6 +220,7 @@ ...@@ -220,6 +220,7 @@
#{item.email,jdbcType=VARCHAR}, #{item.email,jdbcType=VARCHAR},
#{item.password,jdbcType=VARCHAR}, #{item.password,jdbcType=VARCHAR},
#{item.personName,jdbcType=VARCHAR}, #{item.personName,jdbcType=VARCHAR},
#{item.deptId,jdbcType=VARCHAR},
now() now()
) )
</foreach> </foreach>
...@@ -256,6 +257,13 @@ ...@@ -256,6 +257,13 @@
</if> </if>
</foreach> </foreach>
</trim> </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,"> <trim prefix="update_time =case" suffix="end,">
<foreach collection="list" item="i" index="index"> <foreach collection="list" item="i" index="index">
when username=#{i.uid} then now() 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