Commit cbbb465d authored by fangxinjiang's avatar fangxinjiang

社保公积金批量新增

parent c1b4fdb2
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import io.swagger.v3.oas.annotations.media.Schema;
......@@ -123,6 +124,7 @@ public class EmpContractDispatchVo implements Serializable {
*/
@NotBlank(message = "起始日期不能为空")
@DateTimeFormat("yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@ExcelAttribute(name = "起始日期", isDate = true)
@Schema(description = "起始日期", name = "contractStart")
private Date contractStart;
......@@ -131,6 +133,7 @@ public class EmpContractDispatchVo implements Serializable {
*/
@ExcelAttribute(name = "截止日期", needExport = true, isDate = true)
@DateTimeFormat("yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@Schema(description = "截止日期", name = "contractEnd")
private Date contractEnd;
......
......@@ -35,7 +35,7 @@ public class EmpProjectDispatchVo implements Serializable {
*/
@Schema(description ="员工编码")
@Size(max = 20, message = "员工编码不可超过20位")
private String empNo;
private String empCode;
/**
* 员工类型(字典值,0外包1派遣2代理)
*/
......@@ -90,4 +90,11 @@ public class EmpProjectDispatchVo implements Serializable {
@ExcelProperty(value ="就职岗位")
@ExcelAttribute(name = "就职岗位",isNotEmpty = true, errorInfo = "就职岗位不能为空",maxLength = 20)
private String post;
/**
* 员工编码
*/
@Schema(description ="员工编码")
@Size(max = 20, message = "员工编码不可超过20位")
private String empNo;
}
......@@ -187,4 +187,7 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
TEmployeeProject getByEmpIdAndDeptId(String empId, String deptId);
R<Map<String, String>> getProjectByIdCard(String empIdCard);
//获取员工编码
String getEmpNo(String deptNo);
}
......@@ -2079,14 +2079,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
// 新增项目档案不需要返回ID
saveProject(empAddsMap, projectsMap);
// 新增合同
saveContract(empAddsMap, contractsMap);
saveContract(projectsMap, contractsMap);
addVo.setProjectsMap(projectsMap);
addVo.setEmpAddsMap(empAddsMap);
addVo.setContractsMap(contractsMap);
return addVo;
}
private void saveContract(Map<String, EmpAddDispatchVo> empAddsMap, Map<String, EmpContractDispatchVo> contractsMap) {
private void saveContract(Map<String, EmpProjectDispatchVo> projectsMap, Map<String, EmpContractDispatchVo> contractsMap) {
if (Common.isNotNull(contractsMap)) {
EmpContractDispatchVo contractAdd;
TEmployeeContractInfo contract;
......@@ -2096,19 +2096,19 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isNotNull(contractAdd)) {
contract = new TEmployeeContractInfo();
BeanUtil.copyProperties(contractAdd, contract);
if (Common.isEmpty(contract.getEmpId()) && Common.isNotNull(empAddsMap)) {
EmpAddDispatchVo emp = empAddsMap.get(contract.getEmpIdcard());
if (Common.isNotNull(emp)) {
contract.setEmpId(emp.getId());
contract.setEmpNo(emp.getEmpCode());
if (Common.isEmpty(contract.getEmpId()) && Common.isNotNull(projectsMap)) {
EmpProjectDispatchVo project = projectsMap.get(contract.getEmpIdcard());
if (Common.isNotNull(project)) {
contract.setEmpId(project.getId());
contract.setEmpNo(project.getEmpNo());
}
contractMapper.insert(contract);
contractAdd.setId(contract.getId());
contractsMap.put(contractAdd.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + contractAdd.getDeptNo(), contractAdd);
}
contractMapper.insert(contract);
contractAdd.setId(contract.getId());
contractsMap.put(contractAdd.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + contractAdd.getDeptNo(), contractAdd);
}
} catch (Exception e) {
log.error(contractAdd.getEmpIdcard() + CommonConstants.COLON_STRING + "派单新增合同失败");
log.error(contractAdd.getEmpIdcard() + CommonConstants.COLON_STRING + "派单新增合同失败",e);
}
}
}
......@@ -2131,7 +2131,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
empAddsMap.put(empAdd.getEmpIdcard(), empAdd);
}
} catch (Exception e) {
log.error(empAdd.getEmpIdcard() + CommonConstants.COLON_STRING + "派单新增档案失败");
log.error(empAdd.getEmpIdcard() + CommonConstants.COLON_STRING + "派单新增档案失败",e);
}
}
}
......@@ -2156,12 +2156,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
project.setEmpId(emp.getId());
}
}
project.setEmpNo(tEmployeeProjectService.getEmpNo(project.getDeptNo()));
tEmployeeProjectService.save(project);
projectAdd.setId(project.getId());
projectAdd.setEmpNo(project.getEmpNo());
projectsMap.put(project.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + project.getDeptNo(), projectAdd);
}
} catch (Exception e) {
log.error(projectAdd.getEmpIdcard() + CommonConstants.COLON_STRING + "派单新增项目档案失败");
log.error(projectAdd.getEmpIdcard() + CommonConstants.COLON_STRING + "派单新增项目档案失败",e);
}
}
}
......
......@@ -1388,6 +1388,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
//获取员工编码
@Override
public String getEmpNo(String deptNo) {
String str = "";
String EmpNo = baseMapper.findEmployeeMaxOnlyNoByDepId(deptNo);
......
......@@ -375,6 +375,8 @@ public interface CommonConstants {
public static final int SIXTEEN_INT = 16;
public static final String FIFTEEN = "15";
public static final String NINETEEN = "19";
public static final String NINE_STRING = "9";
String EIGHT_STRING = "8";
//百分之一 1/100
public static final BigDecimal ONE_OF_PERCENT = new BigDecimal("0.01");
......@@ -382,4 +384,7 @@ public interface CommonConstants {
// 1/2
public static final BigDecimal HALF_OF_ONE = new BigDecimal("0.5");
public static final BigDecimal TWO_BIG = new BigDecimal("2");
String SIX_STRING = "6";
String SEVEN_STRING = "7";
}
......@@ -341,10 +341,8 @@ public interface ErrorCodes {
*/
String EMP_DISPATCH_FUND_NOT_EMPTY = "emp.dispatch.fund.not.empty";
/**
* 新增异常:存在派增待审核|待办理|办理成功但未派减办理成功的社保数据
* 新增异常:已存在社保数据
*/
String EMP_DISPATCH_SOCIAL_EXISTING = "emp.dispatch.social.existing";
/**
......@@ -394,4 +392,8 @@ public interface ErrorCodes {
* 新增异常:派单新增项目档案失败,请重试
*/
String EMP_DISPATCH_ADD_PROJECT_ERROR="emp.dispatch.add.project.error";
/**
* 新增异常:已存在公积金数据
*/
String EMP_DISPATCH_FUND_EXISTING = "emp.dispatch.fund.existing";
}
......@@ -115,7 +115,7 @@ emp.dispatch.social.not.empty=\u6D3E\u5355\u5458\u5DE5\u793E\u4FDD\u76F8\u5173\u
emp.dispatch.fund.not.empty=\u6D3E\u5355\u5458\u5DE5\u516C\u79EF\u91D1\u76F8\u5173\u4FE1\u606F\u4E0D\u53EF\u4E3A\u7A7A
emp.dispatch.social.existing=\u65B0\u589E\u5F02\u5E38\uFF1A\u5B58\u5728\u6D3E\u589E\u5F85\u5BA1\u6838|\u5F85\u529E\u7406|\u529E\u7406\u6210\u529F\u4F46\u672A\u6D3E\u51CF\u529E\u7406\u6210\u529F\u7684\u793E\u4FDD\u6570\u636E
emp.dispatch.social.existing=\u65B0\u589E\u5F02\u5E38\uFF1A\u5DF2\u5B58\u5728\u793E\u4FDD\u6570\u636E
emp.dispatch.social.injury.existing=\u65B0\u589E\u5F02\u5E38\uFF1A\u5B58\u5728\u529E\u7406\u6210\u529F\u672A\u6D3E\u51CF\u7684\u5DE5\u4F24\u793E\u4FDD\u6570\u636E
......@@ -139,6 +139,8 @@ emp.dispatch.add.contract.error=\u65B0\u589E\u5F02\u5E38\uFF1A\u6D3E\u5355\u65B0
emp.dispatch.add.project.error=\u65B0\u589E\u5F02\u5E38\uFF1A\u6D3E\u5355\u65B0\u589E\u9879\u76EE\u6863\u6848\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5
emp.dispatch.fund.existing=\u65B0\u589E\u5F02\u5E38\uFF1A\u5DF2\u5B58\u5728\u516C\u79EF\u91D1\u6570\u636E
......
package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
......@@ -10,9 +10,11 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import lombok.extern.log4j.Log4j2;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -48,18 +50,13 @@ public class ArchivesDaprUtil {
* @Param
* @return
**/
public R<Map> getDispatchEmpVo(DispatchCheckVo checkVo){
public R<Map<String, DispatchEmpVo>> getDispatchEmpVo(DispatchCheckVo checkVo){
R<Map> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/temployeeinfo/getDispatchEmpVo" , JSON.toJSONString(checkVo), Map.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("获取档案派单信息失败!");
}
R<String> test = HttpDaprUtil.invokeMethodObject(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/temployeeinfo/getDispatchEmpVo" , JSON.toJSONString(checkVo), String.class, SecurityConstants.FROM_IN);
//Map<String,DispatchEmpVo> map = JSON.parseArray()
if (Common.isEmpty(res)){
return R.failed("获取档案派单信息失败!");
}
return res;
Map<String,DispatchEmpVo> map = JSON.parseObject(JSON.toJSONString(res.getData()),new TypeReference<HashMap<String,DispatchEmpVo>>(){});
return R.ok(map);
}
/**
* @Author fxj
......
......@@ -120,35 +120,6 @@ public class HttpDaprUtil {
return R.failed("获取信息失败!");
}
}
public static <T> R<T> invokeMethodObject(String appUrl,
String appId,
String method,
Object param,
Class cs,
@RequestHeader(SecurityConstants.FROM) String from){
// 实例化 RestTemplate
initResTemplate();
// 初始化请求URL
initUrl(appUrl, appId, method, "");
ResponseEntity<String> res;
HttpHeaders headers = new HttpHeaders();
headers.add(SecurityConstants.FROM, from);
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("Authorization", null);
HttpEntity<String> entity = new HttpEntity(param, headers);
try {
res = restTemplate.postForEntity(URI.create(stringBuffer.toString()),entity, cs);
} catch (Exception e) {
log.error("日志保存异常:",e);
return R.failed("获取信息失败:" + e.getMessage());
}
if (null != res && CommonConstants.SUCCESS == res.getStatusCodeValue()) {
return (R<T>) R.ok(res.getBody());
} else {
return R.failed("获取信息失败!");
}
}
private static void initResTemplate() {
if (null == restTemplate) {
......
......@@ -961,4 +961,28 @@ public class TSocialFundInfo extends BaseEntity {
@ExcelAttribute(name = "个人公积金金额")
@ExcelProperty("个人公积金金额")
private BigDecimal personalFundSum;
/**
* 社保状态:派增(0待审核、1待办理、2办理中 3办理成功、4部分办理失败 5 办理失败)、派减(6待审核 7待办理 8办理成功 9 办理失败)
*/
@ExcelAttribute(name = "社保状态", maxLength = 1)
@Schema(description = "社保状态:派增(0待审核、1待办理、2办理中 3办理成功、4部分办理失败 5 办理失败)、派减(6待审核 7待办理 8办理成功 9 办理失败)" )
@ExcelProperty("社保派增状态" )
private String socialStatus;
/**
* 公积金状态:派增(0待审核、1待办理、3办理成功、4办理失败)、派减(5待审核 6待办理 7 办理成功 8 办理失败)
*/
@Length(max = 1, message = "公积金状态 不能超过1个字符" )
@ExcelAttribute(name = "公积金状态", maxLength = 1)
@Schema(description = "公积金状态:派增(0待审核、1待办理、3办理成功、4办理失败)、派减(5待审核 6待办理 7 办理成功 8 办理失败)" )
@ExcelProperty("公积金状态" )
private String fundStatus;
/**
* 派单ID (实时更新)
*/
@ExcelAttribute(name = "派单ID", maxLength = 32)
@Schema(description = "派单ID" )
@ExcelProperty("派单ID" )
private String dispatchId;
}
......@@ -437,4 +437,12 @@ public class TDispatchImportVo extends RowIndex implements Serializable {
@ExcelIgnore
private String customerCode;
/**
* 派单ID (实时更新)
*/
@ExcelIgnore
@Schema(description = "派单ID" )
@ExcelProperty("派单ID" )
private String dispatchId;
}
......@@ -154,4 +154,19 @@ public class TDispatchInfoController {
public void export(HttpServletResponse response, @RequestBody TDispatchInfoSearchVo searchVo) {
tDispatchInfoService.listExport(response,searchVo);
}
/**
* 派单信息记录表 批量导入-派减
*
* @author fxj
* @date 2022-07-15 11:38:05
**/
@SneakyThrows
@Operation(description = "派单信息记录表 批量导入-派减 hasPermission('demo_tdispatchinfo-batch-reduce')")
@SysLog("派单信息记录表 批量导入-派减")
@PostMapping("/importListReduce")
//@PreAuthorize("@pms.hasPermission('demo_tdispatchinfo-batch-reduce')")
public R<List<ErrorMessage>> importListReduce(@RequestBody MultipartFile file){
return tDispatchInfoService.importDiy(file.getInputStream());
}
}
......@@ -308,7 +308,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
socialFund = getSocialFund(socialFundMap,excel);
setInfoVo = getSetInfoVo(projectVoMap,excel);
// 数据合法情况
if (validImport(errorMessageList, excel,setInfoVo)) {
if (validImport(errorMessageList, excel,setInfoVo,socialFundMap)) {
excelVOTemp.put(excel.getEmpIdcard(),excel.getEmpIdcard());
continue;
}
......@@ -337,9 +337,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 初始化新增信息:档案、项目档案、员工合同
initAddInfo(empAddsMap, contractsMap, projectsMap, empVo, excel);
// 新增社保
initSocialAddInfo(socialsMap, empVo, socialSet, excel);
initSocialAddInfo(socialsMap, empVo, socialSet, excel,socialFundMap);
// 新增公积金
if (initFundAddInfo(errorMessageList, fundsMap, empVo, fundSet, excel)){
if (initFundAddInfo(errorMessageList, fundsMap, empVo, fundSet, excel,socialFundMap)){
excelVOTemp.put(excel.getEmpIdcard(),excel.getEmpIdcard());
continue;
}
......@@ -395,7 +395,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
TDispatchImportVo excel;
DispatchEmpVo empVo;
EmpContractDispatchVo contract;
EmpProjectDispatchVo project;
EmpProjectDispatchVo project = null;
EmpAddDispatchVo emp = null;
TSocialInfo social = null;
TProvidentFund fund = null;
......@@ -451,12 +451,23 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 插入派单信息
if (Common.isNotNull(dispatchMap)){
dispatch = dispatchMap.get(excel.getEmpIdcard());
if (Common.isNotNull(dispatch)){
if (Common.isNotNull(social)){
dispatch.setSocialId(social.getId());
}
if (Common.isNotNull(fund)){
dispatch.setFundId(fund.getId());
}
}
insertDispatch(emp, dispatch);
}
// 插入或更新社保公积金查询信息 大病在封装社保的时候已经算了 大病技术和金额了
if (Common.isNotNull(socialFundAddMap)){
socialFund = socialFundAddMap.get(excel.getEmpIdcard());
initSocialFundAndInsert(emp, social, fund, socialFund);
if (Common.isNotNull(socialFund) && Common.isNotNull(dispatch)){
socialFund.setDispatchId(dispatch.getId());
}
initSocialFundAndInsert(emp, social, fund, socialFund,project);
}
}catch (Exception e){
log.error("派单新增异常:", e);
......@@ -465,9 +476,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS));
// 清理map list 等数据
empAddsMap.clear();
contractsMap.clear();
projectsMap.clear();
Common.clear(empAddsMap);
Common.clear(contractsMap);
Common.clear(projectsMap);
}
}
......@@ -477,37 +488,52 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
private void insertSocial(EmpAddDispatchVo emp, TSocialInfo social) {
if (Common.isNotNull(emp) && Common.isNotNull(social)){
social.setEmpNo(emp.getEmpCode());
social.setEmpId(emp.getEmpIdcard());
if (Common.isNotNull(social)){
if (Common.isNotNull(emp)){
social.setEmpNo(emp.getEmpCode());
social.setEmpId(emp.getId());
}
socialMapper.insert(social);
}
}
private void insertFund(EmpAddDispatchVo emp, TProvidentFund fund) {
if (Common.isNotNull(emp) && Common.isNotNull(fund)){
fund.setEmpNo(emp.getEmpCode());
fund.setEmpId(emp.getId());
if (Common.isNotNull(fund)){
if (Common.isNotNull(emp)){
fund.setEmpNo(emp.getEmpCode());
fund.setEmpId(emp.getId());
}
fundMapper.insert(fund);
}
}
private void insertDispatch(EmpAddDispatchVo emp, TDispatchInfo dispatch) {
if (Common.isNotNull(emp) && Common.isNotNull(dispatch)){
dispatch.setEmpNo(emp.getEmpCode());
dispatch.setEmpId(emp.getId());
dispatch.setSettleDomainCode(emp.getDeptNo());
dispatch.setSettleDomain(emp.getDeptId());
dispatch.setSettleDomainName(emp.getDeptName());
if (Common.isNotNull(dispatch)){
if (Common.isNotNull(emp)){
dispatch.setEmpNo(emp.getEmpCode());
dispatch.setEmpId(emp.getId());
dispatch.setSettleDomainCode(emp.getDeptNo());
dispatch.setSettleDomain(emp.getDeptId());
dispatch.setSettleDomainName(emp.getDeptName());
}
baseMapper.insert(dispatch);
}
}
private void initSocialFundAndInsert(EmpAddDispatchVo emp, TSocialInfo social, TProvidentFund fund, TSocialFundInfo socialFund) {
private void initSocialFundAndInsert(EmpAddDispatchVo emp,
TSocialInfo social,
TProvidentFund fund,
TSocialFundInfo socialFund,
EmpProjectDispatchVo project) {
if (Common.isNotNull(socialFund)){
if (Common.isNotNull(project)){
socialFund.setEmpNo(project.getEmpCode());
}
if (Common.isNotNull(emp)){
socialFund.setEmpNo(emp.getEmpCode());
socialFund.setEmpId(emp.getId());
socialFund.setEmpName(emp.getEmpName());
socialFund.setEmpIdcard(emp.getEmpIdcard());
socialFund.setEmpType(emp.getEmpNatrue());
}
if (Common.isNotNull(social)){
socialFund.setSocialStartDate(social.getSocialStartDate());
......@@ -595,6 +621,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
, socialFund.getPersonalUnemploymentMoney()));
}
if (Common.isNotNull(fund)){
socialFund.setFundId(fund.getId());
socialFund.setUnitProvidengCardinal(fund.getUnitProvidengCardinal());
socialFund.setUnitProvidentPer(fund.getUnitProvidentPer());
socialFund.setPersonalProvidentCardinal(fund.getPersonalProvidentCardinal());
......@@ -620,6 +647,11 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
socialFund.setPersonalFundSum(Common.formatMoneyForFund(BigDecimalUtils.safeMultiply(fund.getPersonalProvidentCardinal(), fund.getPersonalProvidentPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())),Integer.valueOf(fund.getFundPayPoint())));
}
}
if (Common.isNotNull(socialFund.getId())){
socialFundMapper.updateById(socialFund);
}else {
socialFundMapper.insert(socialFund);
}
}
}
......@@ -630,51 +662,62 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
ProjectSetInfoVo setInfoVo,
TSocialFundInfo socialFund,
TDispatchImportVo excel) {
if (Common.isNotNull(socialFund)){
if (Common.isEmpty(socialFund)){
socialFund = new TSocialFundInfo();
socialFund.setEmpNo(empVo.getEmpCode());
socialFund.setEmpName(empVo.getEmpName());
socialFund.setEmpIdcard(empVo.getEmpIdcard());
socialFund.setEmpId(empVo.getId());
socialFund.setEmpType(excel.getEmpType());
// 按社保公积金户判断具体封装那些信息,如果社保或公积金新增失败,后面就不会去更新或插入社保公积金查询了
if (Common.isNotNull(setInfoVo)){
if (Common.isNotNull(excel.getSocialHousehold())){
socialFund.setSettleDomain(setInfoVo.getId());
socialFund.setSettleDomainName(setInfoVo.getDepartName());
socialFund.setSettleDomainCode(setInfoVo.getDepartNo());
socialFund.setUnitName(setInfoVo.getCustomerName());
socialFund.setUnitIdFund(setInfoVo.getCustomerId());
if (Common.isNotNull(socialSet)){
socialFund.setSocialHousehold(socialSet.getId());
socialFund.setSocialHouseholdName(socialSet.getDepartName());
socialFund.setSocialProvince(Common.isNotNullToStr(socialSet.getProvince()));
socialFund.setSocialCity(Common.isNotNullToStr(socialSet.getCity()));
socialFund.setSocialTown(Common.isNotNullToStr(socialSet.getTown()));
socialFund.setLowerLimit(socialSet.getLowerLimit());
socialFund.setUpperLimit(socialSet.getUpperLimit());
socialFund.setPayPolicy(socialSet.getPayPolicy());
}
if (Common.isNotNull(empVo)){
socialFund.setEmpNo(empVo.getEmpCode());
socialFund.setEmpName(empVo.getEmpName());
socialFund.setEmpIdcard(empVo.getEmpIdcard());
socialFund.setEmpId(empVo.getId());
socialFund.setEmpType(excel.getEmpType());
}
}
// 按社保公积金户判断具体封装那些信息,如果社保或公积金新增失败,后面就不会去更新或插入社保公积金查询了
if (Common.isNotNull(setInfoVo)){
if (Common.isNotNull(excel.getSocialHousehold())){
socialFund.setSettleDomain(setInfoVo.getId());
socialFund.setSettleDomainName(setInfoVo.getDepartName());
socialFund.setSettleDomainCode(setInfoVo.getDepartNo());
socialFund.setSettleDomainFund(setInfoVo.getId());
socialFund.setSettleDomainNameFund(setInfoVo.getDepartName());
socialFund.setSettleDomainCodeFund(setInfoVo.getDepartNo());
socialFund.setUnitName(setInfoVo.getCustomerName());
socialFund.setUnitId(setInfoVo.getCustomerId());
socialFund.setUnitIdFund(setInfoVo.getCustomerId());
socialFund.setUnitNameFund(setInfoVo.getCustomerName());
socialFund.setSocialStatus(CommonConstants.ZERO_STRING);
socialFund.setSocialStartDate(excel.getPensionStart());
if (Common.isNotNull(socialSet)){
socialFund.setSocialHousehold(socialSet.getId());
socialFund.setSocialHouseholdName(socialSet.getDepartName());
socialFund.setSocialProvince(Common.isNotNullToStr(socialSet.getProvince()));
socialFund.setSocialCity(Common.isNotNullToStr(socialSet.getCity()));
socialFund.setSocialTown(Common.isNotNullToStr(socialSet.getTown()));
socialFund.setLowerLimit(socialSet.getLowerLimit());
socialFund.setUpperLimit(socialSet.getUpperLimit());
socialFund.setPayPolicy(socialSet.getPayPolicy());
}
if (Common.isNotNull(excel.getProvidentHousehold())){
socialFund.setSettleDomain(setInfoVo.getId());
socialFund.setSettleDomainName(setInfoVo.getDepartName());
socialFund.setSettleDomainCode(setInfoVo.getDepartNo());
socialFund.setUnitName(setInfoVo.getCustomerName());
socialFund.setUnitIdFund(setInfoVo.getCustomerId());
if (Common.isNotNull(fundSet)){
socialFund.setProvidentHousehold(fundSet.getId());
socialFund.setProvidentHouseholdName(fundSet.getDepartName());
socialFund.setFundProvince(Common.isNotNullToStr(fundSet.getProvince()));
socialFund.setFundCity(Common.isNotNullToStr(fundSet.getCity()));
socialFund.setFundTown(Common.isNotNullToStr(fundSet.getTown()));
socialFund.setLowerLimitFund(fundSet.getLowerLimit());
socialFund.setUpperLimitFund(fundSet.getUpperLimit());
socialFund.setPayPolicyFund(fundSet.getPayPolicy());
}
}
if (Common.isNotNull(excel.getProvidentHousehold())){
socialFund.setSettleDomain(setInfoVo.getId());
socialFund.setSettleDomainName(setInfoVo.getDepartName());
socialFund.setSettleDomainCode(setInfoVo.getDepartNo());
socialFund.setUnitName(setInfoVo.getCustomerName());
socialFund.setUnitIdFund(setInfoVo.getCustomerId());
socialFund.setFundStatus(CommonConstants.ZERO_STRING);
if (Common.isNotNull(fundSet)){
socialFund.setProvidentHousehold(fundSet.getId());
socialFund.setProvidentHouseholdName(fundSet.getDepartName());
socialFund.setFundProvince(Common.isNotNullToStr(fundSet.getProvince()));
socialFund.setFundCity(Common.isNotNullToStr(fundSet.getCity()));
socialFund.setFundTown(Common.isNotNullToStr(fundSet.getTown()));
socialFund.setLowerLimitFund(fundSet.getLowerLimit());
socialFund.setUpperLimitFund(fundSet.getUpperLimit());
socialFund.setPayPolicyFund(fundSet.getPayPolicy());
socialFund.setProvidentStart(excel.getProvidentStart());
}
}
}
socialFundAddMap.put(excel.getEmpIdcard(), socialFund);
}
......@@ -695,6 +738,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
TDispatchImportVo excel) {
TDispatchInfo dispatch;
dispatch = new TDispatchInfo();
dispatch.setContractSubName(excel.getContractSubName());
dispatch.setContractName(excel.getContractName());
dispatch.setEmpIdcard(excel.getEmpIdcard());
dispatch.setEmpName(excel.getEmpName());
dispatch.setEmpNational(excel.getEmpNational());
......@@ -752,7 +797,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private boolean initFundAddInfo(List<ErrorMessage> errorMessageList,
Map<String, TProvidentFund> funds,
DispatchEmpVo empVo, SysBaseSetInfo fundSet,
TDispatchImportVo excel) {
TDispatchImportVo excel, Map<String, TSocialFundInfo> socialFundMap) {
TProvidentFund fund;
if (Common.isNotNull(excel.getProvidentHousehold())){
fund = new TProvidentFund();
......@@ -763,8 +808,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
fund.setSettleDomain(excel.getSettleDomainId());
if (Common.isNotNull(empVo)){
fund.setEmpId(empVo.getId());
fund.setEmpNo(empVo.getEmpCode());
}
fund.setEmpIdcard(excel.getEmpIdcard());
fund.setEmpName(excel.getEmpName());
fund.setTrustRemark(excel.getTrustRemark());
fund.setUnitProvidengCardinal(excel.getProvidentPer());
fund.setPersonalProvidentPer(excel.getProvidentPer());
......@@ -772,6 +819,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
fund.setPersonalProvidentCardinal(excel.getProvidentCardinal());
fund.setProvidentStart(excel.getProvidentStart());
if (Common.isNotNull(fundSet)){
fund.setProvidentHousehold(fundSet.getId());
if (!checkFundPer(fundSet.getFundProList(), excel)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_FUND_PERCENT_NOT_EXIST)));
return true;
......@@ -788,7 +836,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (Common.isNotNull(fundSet.getTown())){
fund.setFundTown(Integer.toString(fundSet.getTown()));
}
fund.setFundPayPoint(fundSet.getPayPolicy());
fund.setFundPayPoint(Common.isNotNullToStr(fundSet.getFundPayPoint()));
fund.setHaveThisMonth(fundSet.getHaveThisMonth());
}
funds.put(excel.getEmpIdcard(),fund);
......@@ -840,18 +888,26 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
private void initSocialAddInfo(Map<String, TSocialInfo> socials, DispatchEmpVo empVo, SysBaseSetInfo socialSet, TDispatchImportVo excel) {
private void initSocialAddInfo(Map<String, TSocialInfo> socials,
DispatchEmpVo empVo,
SysBaseSetInfo socialSet,
TDispatchImportVo excel,
Map<String, TSocialFundInfo> socialFundMap) {
TSocialInfo social;
if (Common.isNotNull(excel.getSocialHousehold())) {
social = new TSocialInfo();
social.setAuditStatus(CommonConstants.ZERO_STRING);
social.setHandleStatus(CommonConstants.ZERO_STRING);
social.setDeleteFlag(CommonConstants.ZERO_STRING);
social.setSocialStartDate(excel.getPensionStart());
// 封装单位信息 结算信息
social.setBelongUnit(excel.getCustomerId());
social.setSettleDomain(excel.getSettleDomainId());
if (Common.isNotNull(empVo)){
social.setEmpId(empVo.getId());
social.setEmpName(empVo.getEmpName());
social.setEmpIdcard(empVo.getEmpIdcard());
social.setEmpNo(empVo.getEmpCode());
}
social.setEmpIdcard(excel.getEmpIdcard());
social.setBigailmentHandle(CommonConstants.ZERO_STRING);
......@@ -974,10 +1030,66 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
}
// 处理部分办理失败的情况
initHandleStatus(excel, socialFundMap, social);
socials.put(excel.getEmpIdcard(),social);
}
}
private void initHandleStatus(TDispatchImportVo excel, Map<String, TSocialFundInfo> socialFundMap, TSocialInfo social) {
TSocialFundInfo socialFund;
if (Common.isNotNull(socialFundMap)) {
socialFund = socialFundMap.get(excel.getEmpIdcard());
if (Common.isNotNull(socialFund)){
if (CommonConstants.ONE_STRING.equals(socialFund.getPensionHandle())){
social.setPensionHandle(socialFund.getPensionHandle());
}else {
socialFund.setUnitPensionCardinal(social.getUnitPensionCardinal());
socialFund.setUnitPensionPer(social.getUnitPensionPer());
socialFund.setPersonalPensionCardinal(social.getPersonalPensionCardinal());
socialFund.setPersonalPensionPer(social.getPersonalPensionPer());
}
if (CommonConstants.ONE_STRING.equals(socialFund.getMedicalHandle())){
social.setMedicalHandle(socialFund.getMedicalHandle());
}else {
socialFund.setUnitMedicalCardinal(social.getUnitMedicalCardinal());
socialFund.setUnitMedicalPer(social.getUnitMedicalPer());
socialFund.setPersonalMedicalCardinal(social.getUnitMedicalCardinal());
socialFund.setPersonalMedicalPer(social.getUnitMedicalPer());
}
if (CommonConstants.ONE_STRING.equals(socialFund.getUnemployHandle())){
social.setUnemployHandle(socialFund.getUnemployHandle());
}else {
socialFund.setUnitUnemploymentCardinal(social.getUnitUnemploymentCardinal());
socialFund.setUnitUnemploymentPer(social.getUnitUnemploymentPer());
socialFund.setPersonalUnemploymentCardinal(social.getUnitUnemploymentCardinal());
socialFund.setPersonalUnemploymentPer(social.getUnitUnemploymentPer());
}
if (CommonConstants.ONE_STRING.equals(socialFund.getWorkInjuryHandle())){
social.setWorkInjuryHandle(socialFund.getWorkInjuryHandle());
}else {
socialFund.setUnitWorkInjuryCardinal(social.getUnitWorkInjuryCardinal());
socialFund.setPersonalWorkInjuryCardinal(social.getUnitWorkInjuryCardinal());
}
if (CommonConstants.ONE_STRING.equals(socialFund.getBirthHandle())){
social.setBirthHandle(socialFund.getBirthHandle());
}else {
socialFund.setUnitBirthCardinal(social.getUnitBirthCardinal());
socialFund.setUnitBirthPer(social.getUnitBirthPer());
}
if (CommonConstants.ONE_STRING.equals(socialFund.getBigailmentHandle())){
social.setBigailmentHandle(socialFund.getBigailmentHandle());
}else {
socialFund.setUnitBigailmentCardinal(social.getUnitBigailmentCardinal());
socialFund.setUnitBigailmentPer(social.getUnitBigailmentPer());
socialFund.setPersonalBigailmentCardinal(social.getUnitBigailmentCardinal());
socialFund.setPersonalBigailmentPer(social.getUnitBigailmentPer());
}
}
socialFundMap.put(excel.getEmpIdcard(),socialFund);
}
}
private BigDecimal ifNull(BigDecimal old,BigDecimal last){
if (Common.isEmpty(old)){
return last;
......@@ -1060,7 +1172,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
project.setWorkingHours(excel.getWorkingHours());
if (Common.isNotNull(empVo)) {
project.setEmpId(empVo.getId());
project.setEmpNo(empVo.getEmpCode());
project.setEmpCode(empVo.getEmpCode());
}
projects.put(excel.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+excel.getSettleDomainCode(),project);
}
......@@ -1096,7 +1208,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
empAdds.put(excel.getEmpIdcard(),emp);
}
private boolean validDdispatchStatus(List<ErrorMessage> errorMessageList, Map<String, TSocialFundInfo> socialFundMap, TDispatchImportVo excel) {
private boolean validDdispatchStatus(List<ErrorMessage> errorMessageList, Map<String, TSocialFundInfo> socialFundMap,
TDispatchImportVo excel) {
TSocialFundInfo sf;
if (Common.isNotNull(socialFundMap)) {
sf = socialFundMap.get(excel.getEmpIdcard());
......@@ -1148,7 +1261,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (Common.isNotNull(list)) {
Map<String, TSocialFundInfo> map = new HashMap<>();
for (TSocialFundInfo info:list){
map.put(info.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+info.getSettleDomainCode(),info);
map.put(info.getEmpIdcard(),info);
}
return map;
}
......@@ -1179,7 +1292,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
DispatchCheckVo checkVo = new DispatchCheckVo();
checkVo.setCodes(CollUtil.distinct(codes));
checkVo.setIdCards(CollUtil.distinct(idcards));
R<Map> res = archivesDaprUtil.getDispatchEmpVo(checkVo);
R<Map<String,DispatchEmpVo>> res = archivesDaprUtil.getDispatchEmpVo(checkVo);
if (Common.isNotNull(res) && Common.isNotNull(res.getData())) {
empVoMap = res.getData();
}
......@@ -1189,7 +1302,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private boolean validImport(List<ErrorMessage> errorMessageList,
TDispatchImportVo excel,
ProjectSetInfoVo setInfoVo) {
ProjectSetInfoVo setInfoVo,
Map<String, TSocialFundInfo> socialFundMap) {
if (Common.isEmpty(setInfoVo)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_PROJECT_NOT_FOUND)));
return true;
......@@ -1229,6 +1343,33 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_FUND_NOT_EMPTY)));
return true;
}
TSocialFundInfo socialFund = null;
if (Common.isNotNull(socialFundMap)){
socialFund = socialFundMap.get(excel.getEmpIdcard());
if (Common.isNotNull(socialFund)){
// 社保状态:派增(0待审核、1待办理、2办理中 3办理成功、4部分办理失败 5 办理失败)、派减(6待审核 7待办理 8办理成功 9 办理失败)
if (Common.isNotNull(excel.getSocialHousehold())
&& (Common.isEmpty(socialFund.getSocialStatus())
|| CommonConstants.SIX_STRING.equals(socialFund.getSocialStatus())
|| CommonConstants.SEVEN_STRING.equals(socialFund.getSocialStatus())
|| CommonConstants.NINE_STRING.equals(socialFund.getSocialStatus())
|| CommonConstants.FIVE_STRING.equals(socialFund.getSocialStatus()))
){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_EXISTING)));
return true;
}
// 公积金状态:派增(0待审核、1待办理、3办理成功、4办理失败)、派减(5待审核 6待办理 7 办理成功 8 办理失败)
if (Common.isNotNull(excel.getProvidentHousehold())
&& (CommonConstants.FIVE_STRING.equals(socialFund.getFundStatus())
&& CommonConstants.SIX_STRING.equals(socialFund.getFundStatus())
&& CommonConstants.EIGHT_STRING.equals(socialFund.getFundStatus())
&& CommonConstants.FOUR_STRING.equals(socialFund.getFundStatus()))){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_FUND_EXISTING)));
return true;
}
}
}
return false;
}
......
......@@ -152,7 +152,9 @@
<result property="personalSocialSum" column="PERSONAL_SOCIAL_SUM"/>
<result property="unitInterestFee" column="UNIT_INTEREST_FEE"/>
<result property="personalInterestFee" column="PERSONAL_INTEREST_FEE"/>
<result property="socialStatus" column="SOCIAL_STATUS"/>
<result property="fundStatus" column="FUND_STATUS"/>
<result property="dispatchId" column="DISPATCH_ID"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -280,7 +282,10 @@
a.UNIT_SOCIAL_SUM,
a.PERSONAL_SOCIAL_SUM,
a.UNIT_INTEREST_FEE,
a.PERSONAL_INTEREST_FEE
a.PERSONAL_INTEREST_FEE,
a.SOCIAL_STATUS,
a.FUND_STATUS,
a.DISPATCH_ID
</sql>
<sql id="tSocialFundInfo_where">
<if test="tSocialFundInfo != null">
......
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