Commit 731fbd70 authored by 李灿灿's avatar 李灿灿

Merge branch 'develop' into feature-licancan

parents 2e39369d 957fa46a
......@@ -21,6 +21,12 @@ import java.util.Date;
*/
@Data
public class EmpContractDispatchVo implements Serializable {
/**
* 合同主键ID
*/
@Schema(description = "合同主键ID", name = "empId")
private String id;
/**
* 员工主键
*/
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @Author fxj
* @Date 2022/7/20
* @Description
* @Version 1.0
*/
@Data
public class EmpDispatchAddVo implements Serializable {
/**
* 员工档案
**/
Map<String,EmpAddDispatchVo> empAddsMap;
/**
* 员工合同
**/
Map<String,EmpContractDispatchVo> contractsMap;
/**
* 员工项目档案
**/
Map<String,EmpProjectDispatchVo> projectsMap;
}
......@@ -18,6 +18,12 @@ import java.io.Serializable;
*/
@Data
public class EmpProjectDispatchVo implements Serializable {
/**
* 项目档案ID
*/
@Schema(description ="项目档案ID")
private String id;
/**
* 人员档案主表id
*/
......
......@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.DispatchCheckVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.DispatchEmpVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpDispatchAddVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorMessageVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
......@@ -438,4 +439,19 @@ public class TEmployeeInfoController {
return tEmployeeInfoService.getDispatchEmpVo(checkVo);
}
/**
* @Author fxj
* @Description 新增档案|项目档案|合同信息
* @Date 21:05 2022/7/20
* @Param
* @return
**/
@Operation(description = "新增档案|项目档案|合同信息")
@SysLog("新增档案|项目档案|合同信息")
@Inner
@PostMapping("/addDispatchInfo")
public EmpDispatchAddVo addDispatchInfo(@RequestBody(required = true) EmpDispatchAddVo addVo) {
return tEmployeeInfoService.addDispatchInfo(addVo);
}
}
......@@ -182,4 +182,6 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
void exportLeaveEmployee(TEmployeeInfo employeeVo, HttpServletResponse response);
Map<String,DispatchEmpVo> getDispatchEmpVo(DispatchCheckVo checkVo);
EmpDispatchAddVo addDispatchInfo(EmpDispatchAddVo addVo);
}
......@@ -273,6 +273,7 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
alert.setAlertPerson(contract.getCreateName());
alert.setEmpName(contract.getEmpName());
alert.setEmpId(contract.getEmpId());
alert.setEmpCode(contract.getEmpNo());
alert.setProject(contract.getSubjectDepart());
alert.setProjectNo(contract.getDeptNo());
alert.setEmpIdcard(contract.getEmpIdcard());
......
......@@ -28,13 +28,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation;
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.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
......@@ -88,6 +87,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
private final TEmpEducationService tEmpEducationService;
private final TSettleDomainService tSettleDomainService;
private final TEmployeeContractInfoMapper contractMapper;
@Override
public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql) {
return baseMapper.getPage(page, employeeInfo, sql);
......@@ -354,7 +355,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
project.setLeaveTime(null);
project.setProjectStatus(CommonConstants.ZERO_INT);
tEmployeeProjectService.updateById(project);
projectNum++ ;
projectNum++;
}
}
}
......@@ -2043,16 +2044,127 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
@Override
public Map<String,DispatchEmpVo> getDispatchEmpVo(DispatchCheckVo checkVo) {
public Map<String, DispatchEmpVo> getDispatchEmpVo(DispatchCheckVo checkVo) {
List<DispatchEmpVo> voList = baseMapper.getDispatchEmpVo(checkVo);
if (Common.isNotNull(voList)){
Map<String,DispatchEmpVo> voMap = new HashMap<>();
for (DispatchEmpVo vo:voList){
voMap.put(vo.getEmpIdcard(),vo);
if (Common.isNotNull(voList)) {
Map<String, DispatchEmpVo> voMap = new HashMap<>();
for (DispatchEmpVo vo : voList) {
voMap.put(vo.getEmpIdcard(), vo);
}
return voMap;
}
return null;
}
/**
* @return
* @Author fxj
* @Description 新增派单的档案 项目档案 合同
* @Date 21:51 2022/7/20
* @Param
**/
@Override
public EmpDispatchAddVo addDispatchInfo(EmpDispatchAddVo addVo) {
if (Common.isEmpty(addVo)) {
return new EmpDispatchAddVo();
}
//员工档案
Map<String, EmpAddDispatchVo> empAddsMap = addVo.getEmpAddsMap();
//员工合同
Map<String, EmpContractDispatchVo> contractsMap = addVo.getContractsMap();
//员工项目档案
Map<String, EmpProjectDispatchVo> projectsMap = addVo.getProjectsMap();
// 新增档案
saveEmp(empAddsMap);
// 新增项目档案不需要返回ID
saveProject(empAddsMap, projectsMap);
// 新增合同
saveContract(empAddsMap, contractsMap);
addVo.setProjectsMap(projectsMap);
addVo.setEmpAddsMap(empAddsMap);
addVo.setContractsMap(contractsMap);
return addVo;
}
private void saveContract(Map<String, EmpAddDispatchVo> empAddsMap, Map<String, EmpContractDispatchVo> contractsMap) {
if (Common.isNotNull(contractsMap)) {
EmpContractDispatchVo contractAdd;
TEmployeeContractInfo contract;
for (Map.Entry<String, EmpContractDispatchVo> entry : contractsMap.entrySet()) {
contractAdd = entry.getValue();
try {
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());
}
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 + "派单新增合同失败");
}
}
}
}
private void saveEmp(Map<String, EmpAddDispatchVo> empAddsMap) {
if (Common.isNotNull(empAddsMap)) {
EmpAddDispatchVo empAdd;
TEmployeeInfo employeeInfo;
for (Map.Entry<String, EmpAddDispatchVo> entry : empAddsMap.entrySet()) {
empAdd = entry.getValue();
try {
if (Common.isNotNull(empAdd)) {
employeeInfo = new TEmployeeInfo();
BeanUtil.copyProperties(empAdd, employeeInfo);
employeeInfo.setEmpCode(getCode());
baseMapper.insert(employeeInfo);
empAdd.setId(employeeInfo.getId());
empAddsMap.put(empAdd.getEmpIdcard(), empAdd);
}
} catch (Exception e) {
log.error(empAdd.getEmpIdcard() + CommonConstants.COLON_STRING + "派单新增档案失败");
}
}
}
}
private void saveProject(Map<String, EmpAddDispatchVo> empAddsMap, Map<String, EmpProjectDispatchVo> projectsMap) {
if (Common.isNotNull(projectsMap)) {
EmpProjectDispatchVo projectAdd;
TEmployeeProject project;
EmpAddDispatchVo emp;
for (Map.Entry<String, EmpProjectDispatchVo> entry : projectsMap.entrySet()) {
projectAdd = entry.getValue();
try {
if (Common.isNotNull(projectAdd)) ;
{
project = new TEmployeeProject();
BeanUtil.copyProperties(projectAdd, project);
if (Common.isEmpty(project.getEmpId()) && Common.isNotNull(empAddsMap)) {
emp = empAddsMap.get(project.getEmpIdcard());
if (Common.isNotNull(emp)) {
project.setEmpCode(emp.getEmpCode());
project.setEmpId(emp.getId());
}
}
tEmployeeProjectService.save(project);
projectAdd.setId(project.getId());
projectsMap.put(project.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + project.getDeptNo(), projectAdd);
}
} catch (Exception e) {
log.error(projectAdd.getEmpIdcard() + CommonConstants.COLON_STRING + "派单新增项目档案失败");
}
}
}
}
}
......@@ -378,4 +378,8 @@ public interface ErrorCodes {
* 新增异常:必须派单社保或公积金,不支持单派档案
*/
String EMP_DISPATCH_SOCIAL_AND_FUND_NOT_EMPTY = "emp.dispatch.social.and.fund.not.empty";
/**
* 新增异常:未找到对应项目编码信息
*/
String EMP_DISPATCH_PROJECT_NOT_FOUND = "emp.dispatch.project.not.found";
}
......@@ -133,6 +133,8 @@ emp.dispatch.social.exist=\u65B0\u589E\u5F02\u5E38\uFF1A\u5355\u6B21\u5BFC\u5165
emp.dispatch.social.and.fund.not.empty=\u65B0\u589E\u5F02\u5E38\uFF1A\u5FC5\u987B\u6D3E\u5355\u793E\u4FDD\u6216\u516C\u79EF\u91D1\uFF0C\u4E0D\u652F\u6301\u5355\u6D3E\u6863\u6848
emp.dispatch.project.not.found=\u65B0\u589E\u5F02\u5E38\uFF1A\u672A\u627E\u5230\u5BF9\u5E94\u9879\u76EE\u7F16\u7801\u4FE1\u606F
......
package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.alibaba.fastjson.JSON;
import com.yifu.cloud.plus.v1.yifu.archives.vo.DispatchAddVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.DispatchCheckVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpDispatchAddVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
......@@ -98,4 +100,11 @@ public class ArchivesDaprUtil {
return res;
}
public R<DispatchAddVo> addDispatchInfo(EmpDispatchAddVo addVo) {
R<DispatchAddVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/temployeeinfo/addDispatchInfo" , JSON.toJSONString(addVo), DispatchAddVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("新增档案|项目档案|合同信息失败!");
}
return res;
}
}
......@@ -494,6 +494,12 @@ public class TForecastLibrary extends BaseEntity {
@ExcelAttribute(name = "数据同步:0未同步;1已同步")
@ExcelProperty("数据同步:0未同步;1已同步")
private Integer dataPush;
/**
* 类型:0社保;1公积金
*/
@ExcelAttribute(name = "类型:0社保;1公积金")
@ExcelProperty("类型:0社保;1公积金")
private Integer dataType;
@TableField(exist = false)
private List<String> idList;
......
......@@ -106,6 +106,15 @@ public class TSocialFundInfo extends BaseEntity {
@Schema(description = "结算主体" )
@ExcelProperty("结算主体" )
private String settleDomainName;
/**
* 结算主体编码
*/
@Length(max = 50, message = "结算主体编码不能超过50个字符" )
@ExcelAttribute(name = "结算主体编码", maxLength = 50)
@Schema(description = "结算主体编码" )
@ExcelProperty("结算主体编码" )
private String settleDomainCode;
/**
* unitName
*/
......@@ -117,11 +126,47 @@ public class TSocialFundInfo extends BaseEntity {
/**
* unitId
*/
@Length(max = 32, message = "unitId 不能超过32个字符" )
@ExcelAttribute(name = "unitId", maxLength = 32)
@Schema(description = "unitId" )
@ExcelProperty("unitId" )
private String unitId;
/**
* 结算主体-公积金
*/
@ExcelAttribute(name = "结算主体-公积金", maxLength = 32)
@Schema(description = "结算主体-公积金" )
@ExcelProperty("结算主体-公积金" )
private String settleDomainFund;
/**
* 结算主体-公积金
*/
@ExcelAttribute(name = "结算主体-公积金", maxLength = 50)
@Schema(description = "结算主体-公积金" )
@ExcelProperty("结算主体-公积金" )
private String settleDomainNameFund;
/**
* 结算主体编码-公积金
*/
@ExcelAttribute(name = "结算主体编码-公积金", maxLength = 50)
@Schema(description = "结算主体编码-公积金" )
@ExcelProperty("结算主体编码-公积金" )
private String settleDomainCodeFund;
/**
* 单位名称-公积金
*/
@ExcelAttribute(name = "单位名称-公积金", maxLength = 50)
@Schema(description = "单位名称-公积金" )
@ExcelProperty("单位名称-公积金" )
private String unitNameFund;
/**
* 单位ID
*/
@ExcelAttribute(name = "单位ID", maxLength = 32)
@Schema(description = "单位ID" )
@ExcelProperty("单位ID" )
private String unitIdFund;
/**
* 社保户
*/
......
......@@ -16,6 +16,7 @@
*/
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
......@@ -402,4 +403,39 @@ public class TDispatchImportVo extends RowIndex implements Serializable {
@ExcelProperty("委托备注" )
private String trustRemark;
/**
* 结算主体ID
*/
@Schema(description = "结算主体ID")
@ExcelIgnore
private String settleDomainId;
/**
* 结算主体名称
*/
@Schema(description = "结算主体名称")
@ExcelIgnore
private String departName;
/**
* 所属客户
*/
@Schema(description = "所属客户")
@ExcelIgnore
private String customerId;
/**
* 客户名称
*/
@Schema(description = "客户名称")
@ExcelIgnore
private String customerName;
/**
* 客户编码
*/
@Schema(description = "客户编码")
@ExcelIgnore
private String customerCode;
}
......@@ -77,6 +77,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private final SysBaseSetInfoMapper baseSetMapper;
/**
* 派单信息记录表简单分页查询
*
......@@ -255,6 +256,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private void importTDispatchInfo(List<TDispatchImportVo> excelVOList,
List<ErrorMessage> errorMessageList,
YifuUser user) {
if (Common.isEmpty(excelVOList)){
return;
}
// 个性化校验逻辑
ErrorMessage errorMsg;
List<String> idcards = new ArrayList<>();
......@@ -266,26 +270,28 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
initIdcardAndCode(excelVOList, idcards, codes, socialholds, fundholds);
// 通过身份证和项目编码获取档案&项目档案&最新合同
Map<String, DispatchEmpVo> empVoMap = getDispatchEmpVo(idcards, codes);
// 通过身份证查询社保&公积金&社保公积金查询信息
// 通过身份证查询社保&公积金&社保公积金查询信息: 身份证维度唯一
Map<String, TSocialFundInfo> socialFundMap = getSocialFundMap(idcards);
// 获取结算主体编码数据 以供校验
Map<String, String> settleDomainVo = new HashMap<>();
Map<String, ProjectSetInfoVo> projectVoMap = getProjectVoMap(codes);
// 获取所有社保户和公积金户数据
Map<String, SysBaseSetInfo> socialHoldMap = new HashMap<>();
Map<String, SysBaseSetInfo> fundHoldMap = new HashMap<>();
initHoldInfo(socialholds, fundholds, socialHoldMap, fundHoldMap);
// 员工档案
List<EmpAddDispatchVo> empAdds = new ArrayList<>();
Map<String,EmpAddDispatchVo> empAddsMap = new HashMap<>();
//员工合同
List<EmpContractDispatchVo> contracts = new ArrayList<>();
Map<String,EmpContractDispatchVo> contractsMap = new HashMap<>();
//员工项目档案
List<EmpProjectDispatchVo> projects = new ArrayList<>();
Map<String,EmpProjectDispatchVo> projectsMap = new HashMap<>();
//新增社保
List<TSocialInfo> socials = new ArrayList<>();
Map<String,TSocialInfo> socialsMap = new HashMap<>();
//新增公积金
List<TProvidentFund> funds = new ArrayList<>();
Map<String,TProvidentFund> fundsMap = new HashMap<>();
//新增派单信息
Map<String,TDispatchInfo> dispatchMap = new HashMap<>();
// 新增社保公积金查询
Map<String,TSocialFundInfo> socialFundAddMap = new HashMap<>();
EmpAddDispatchVo emp;
EmpContractDispatchVo contract;
EmpProjectDispatchVo project;
......@@ -296,24 +302,29 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
SysBaseSetInfo socialSet;
SysBaseSetInfo fundSet;
TDispatchInfo dispatch;
ProjectSetInfoVo setInfoVo;
TSocialFundInfo socialFund;
TDispatchImportVo excel;
EmpDispatchAddVo addVo = new EmpDispatchAddVo();
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
socialSet = null;
fundSet = null;
TDispatchImportVo excel = excelVOList.get(i);
excel = excelVOList.get(i);
fundSet = fundHoldMap.get(excel.getProvidentHousehold());
socialSet = socialHoldMap.get(excel.getSocialHousehold());
socialFund = socialFundMap.get(excel.getEmpIdcard());;
setInfoVo = projectVoMap.get(excel.getSettleDomainCode());
// 数据合法情况
if (validImport(errorMessageList, excel, dispatchMap)) {
if (validImport(errorMessageList, excel, dispatchMap,setInfoVo)) {
continue;
}
if (Common.isNotNull(excel.getSocialHousehold())){
socialSet = socialHoldMap.get(excel.getSocialHousehold());
if (Common.isEmpty(socialSet)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_HOLD_NOT_EXIST)));
continue;
}
}
if (Common.isNotNull(excel.getProvidentHousehold())){
fundSet = fundHoldMap.get(excel.getProvidentHousehold());
if (Common.isEmpty(fundSet)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_FUND_HOLD_NOT_EXIST)));
continue;
......@@ -327,22 +338,98 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
empVo = empVoMap.get(excel.getEmpIdcard());
}
// 初始化新增信息:档案、项目档案、员工合同
initAddInfo(empAdds, contracts, projects, empVo, excel);
initAddInfo(empAddsMap, contractsMap, projectsMap, empVo, excel);
// 新增社保
initSocialAddInfo(socials, empVo, socialSet, excel);
initSocialAddInfo(socialsMap, empVo, socialSet, excel);
// 新增公积金
if (initFundAddInfo(errorMessageList, funds, empVo, fundSet, excel)){
if (initFundAddInfo(errorMessageList, fundsMap, empVo, fundSet, excel)){
continue;
}
// 新增派单信息
initDispatchAddInfo(user, dispatchMap, empVo, socialSet, fundSet, excel);
// 变更社保公积金查询
initSocialFundAddInfo(socialFundAddMap, empVo, socialSet, fundSet, setInfoVo, socialFund, excel);
}
addVo.setEmpAddsMap(empAddsMap);
addVo.setContractsMap(contractsMap);
addVo.setProjectsMap(projectsMap);
R<DispatchAddVo> res = archivesDaprUtil.addDispatchInfo(addVo);
for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i);
empVo = empVoMap.get(excel.getEmpIdcard());
// 验证档案是否插入成功
insertExcel(excel);
// 验证项目档案是否插入成功
// 验证合同是否插入成功
// 插入社保信息并封装社保公积金查询信息
// 插入公积金信息并封装社保公积金查询信息
// 插入或更新社保公积金查询信息
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS));
}
}
private void initSocialFundAddInfo(Map<String, TSocialFundInfo> socialFundAddMap,
DispatchEmpVo empVo,
SysBaseSetInfo socialSet,
SysBaseSetInfo fundSet,
ProjectSetInfoVo setInfoVo,
TSocialFundInfo socialFund,
TDispatchImportVo excel) {
if (Common.isNotNull(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()));
}
}
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()));
}
}
}
//TODO
}
socialFundAddMap.put(excel.getEmpIdcard(), socialFund);
}
private Map<String, ProjectSetInfoVo> getProjectVoMap(List<String> codes) {
R<Map> res = archivesDaprUtil.getSetInfoByCodes(codes);
if (Common.isNotNull(res) && Common.isNotNull(res.getData())){
return res.getData();
}
return new HashMap<>();
}
private void initDispatchAddInfo(YifuUser user,
Map<String, TDispatchInfo> dispatchMap,
DispatchEmpVo empVo,
......@@ -374,11 +461,11 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 默认待审核
dispatch.setStatus(CommonConstants.ONE_STRING);
dispatch.setDeleteFlag(CommonConstants.ZERO_STRING);
// 封装结算主体客户信息 TODO
dispatch.setSettleDomainName("");
dispatch.setSettleDomain("");
dispatch.setBelongUnit("");
dispatch.setBelongUnitName("");
// 封装结算主体客户信息
dispatch.setSettleDomainName(excel.getDepartName());
dispatch.setSettleDomain(excel.getSettleDomainId());
dispatch.setBelongUnit(excel.getCustomerId());
dispatch.setBelongUnitName(excel.getCustomerName());
// 封装合同信息 默认取值派单的
dispatch.setContractStart(excel.getContractStart());
dispatch.setContractEnd(excel.getContractEnd());
......@@ -404,15 +491,18 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dispatchMap.put(excel.getEmpIdcard(),dispatch);
}
private boolean initFundAddInfo(List<ErrorMessage> errorMessageList, List<TProvidentFund> funds, DispatchEmpVo empVo, SysBaseSetInfo fundSet, TDispatchImportVo excel) {
private boolean initFundAddInfo(List<ErrorMessage> errorMessageList,
Map<String, TProvidentFund> funds,
DispatchEmpVo empVo, SysBaseSetInfo fundSet,
TDispatchImportVo excel) {
TProvidentFund fund;
if (Common.isNotNull(excel.getProvidentHousehold())){
fund = new TProvidentFund();
fund.setAuditStatus(CommonConstants.ZERO_STRING);
fund.setHandleStatus(CommonConstants.ZERO_STRING);
fund.setDeleteFlag(CommonConstants.ZERO_STRING);
fund.setBelongUnit("");
fund.setSettleDomain("");
fund.setBelongUnit(excel.getCustomerId());
fund.setSettleDomain(excel.getSettleDomainId());
fund.setEmpId(empVo.getId());
fund.setEmpIdcard(excel.getEmpIdcard());
fund.setTrustRemark(excel.getTrustRemark());
......@@ -441,7 +531,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
fund.setFundPayPoint(fundSet.getPayPolicy());
fund.setHaveThisMonth(fundSet.getHaveThisMonth());
}
funds.add(fund);
funds.put(excel.getEmpIdcard(),fund);
}
return false;
}
......@@ -461,7 +551,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return false;
}
private void initAddInfo(List<EmpAddDispatchVo> empAdds, List<EmpContractDispatchVo> contracts, List<EmpProjectDispatchVo> projects, DispatchEmpVo empVo, TDispatchImportVo excel) {
private void initAddInfo(Map<String, EmpAddDispatchVo> empAdds,
Map<String, EmpContractDispatchVo> contracts,
Map<String, EmpProjectDispatchVo> projects,
DispatchEmpVo empVo, TDispatchImportVo excel) {
// 无档案无项目档案无合同无学历
if (Common.isEmpty(empVo) || Common.isEmpty(empVo.getId())) {
// 初始化档案
......@@ -487,16 +580,16 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
private void initSocialAddInfo(List<TSocialInfo> socials, DispatchEmpVo empVo, SysBaseSetInfo socialSet, TDispatchImportVo excel) {
private void initSocialAddInfo(Map<String, TSocialInfo> socials, DispatchEmpVo empVo, SysBaseSetInfo socialSet, TDispatchImportVo excel) {
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);
// TODO 封装单位信息 结算信息
social.setBelongUnit("");
social.setSettleDomain("");
// 封装单位信息 结算信息
social.setBelongUnit(excel.getCustomerId());
social.setSettleDomain(excel.getSettleDomainId());
social.setEmpId(empVo.getId());
social.setEmpIdcard(excel.getEmpIdcard());
social.setBigailmentHandle(CommonConstants.ZERO_STRING);
......@@ -599,7 +692,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
social.setUnitBirthCardinal(socialSet.getUpperLimit());
}
}
socials.add(social);
socials.put(excel.getEmpIdcard(),social);
}
}
......@@ -641,7 +734,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
private void initContractInfo(List<EmpContractDispatchVo> contracts,
private void initContractInfo(Map<String, EmpContractDispatchVo> contracts,
TDispatchImportVo excel,
DispatchEmpVo empVo) {
EmpContractDispatchVo contract;
......@@ -661,10 +754,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
contract.setEmpNo(empVo.getEmpCode());
contract.setEmpType(empVo.getEmpNatrue());
}
contracts.add(contract);
contracts.put(excel.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+excel.getSettleDomainCode(),contract);
}
private void initProjectInfo(List<EmpProjectDispatchVo> projects,
private void initProjectInfo(Map<String, EmpProjectDispatchVo> projects,
TDispatchImportVo excel,
DispatchEmpVo empVo) {
EmpProjectDispatchVo project;
......@@ -680,10 +773,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
project.setEmpId(empVo.getId());
project.setEmpNo(empVo.getEmpCode());
}
projects.add(project);
projects.put(excel.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+excel.getSettleDomainCode(),project);
}
private void initEmpAddInfo(List<EmpAddDispatchVo> empAdds, TDispatchImportVo excel) {
private void initEmpAddInfo(Map<String, EmpAddDispatchVo> empAdds, TDispatchImportVo excel) {
EmpAddDispatchVo emp;
emp = new EmpAddDispatchVo();
emp.setEmpIdcard(excel.getEmpIdcard());
......@@ -706,7 +799,12 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
emp.setProjectNum(CommonConstants.ONE_INT);
emp.setDeptNo(excel.getSettleDomainCode());
emp.setPost(excel.getPost());
empAdds.add(emp);
emp.setDeptId(excel.getSettleDomainId());
emp.setDeptNo(excel.getSettleDomainCode());
emp.setDeptName(excel.getDepartName());
emp.setUnitName(excel.getCustomerName());
emp.setUnitNo(excel.getCustomerCode());
empAdds.put(excel.getEmpIdcard(),emp);
}
private boolean validDdispatchStatus(List<ErrorMessage> errorMessageList, Map<String, TSocialFundInfo> socialFundMap, TDispatchImportVo excel) {
......@@ -756,9 +854,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private Map<String, TSocialFundInfo> getSocialFundMap(List<String> idcards) {
List<TSocialFundInfo> list = socialFundMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda()
.in(TSocialFundInfo::getEmpIdcard, idcards));
.in(TSocialFundInfo::getEmpIdcard, idcards)
.groupBy(TSocialFundInfo::getEmpIdcard));
if (Common.isNotNull(list)) {
return list.stream().collect(Collectors.toMap(k -> k.getEmpIdcard(), k -> k));
Map<String, TSocialFundInfo> map = new HashMap<>();
for (TSocialFundInfo info:list){
map.put(info.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+info.getSettleDomainCode(),info);
}
return map;
}
return null;
}
......@@ -797,7 +900,17 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private boolean validImport(List<ErrorMessage> errorMessageList,
TDispatchImportVo excel,
Map<String, TDispatchInfo> dispatchMap) {
Map<String, TDispatchInfo> dispatchMap,
ProjectSetInfoVo setInfoVo) {
if (Common.isEmpty(setInfoVo)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_PROJECT_NOT_FOUND)));
return true;
}
excel.setSettleDomainId(setInfoVo.getId());
excel.setDepartName(setInfoVo.getDepartName());
excel.setCustomerCode(setInfoVo.getCustomerCode());
excel.setCustomerId(setInfoVo.getCustomerId());
excel.setCustomerName(setInfoVo.getCustomerName());
if (Common.isEmpty(excel.getSocialHousehold()) && Common.isEmpty(excel.getProvidentHousehold())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_AND_FUND_NOT_EMPTY)));
return true;
......
......@@ -191,9 +191,13 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
@Override
public R<Boolean> createForecastlibary(String payMonths, String empIdCard, String settleDomainIds) {
//定义未推送的按条件查询得到的预估数据
List<TForecastLibrary> libraryList = null;
List<TForecastLibrary> librarySocialList = null;
//定义已推送的按条件查询得到的预估数据
List<TForecastLibrary> libraryListTemp = null;
List<TForecastLibrary> librarySocialListTemp = null;
//定义未推送的按条件查询得到的预估数据
List<TForecastLibrary> libraryFundList = null;
//定义已推送的按条件查询得到的预估数据
List<TForecastLibrary> libraryFundListTemp = null;
List<String> settleDomainIdList = Common.initStrToList(settleDomainIds, CommonConstants.COMMA_STRING);
List<String> payMonthList = Common.initStrToList(payMonths, CommonConstants.COMMA_STRING);
if (Common.isEmpty(payMonths) || payMonthList == null) {
......@@ -211,29 +215,50 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
//查询出所有对应条件的预估数、社保数据、公积金数据据用于重新生成
if (Common.isNotNull(empIdCard)) {
libraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
librarySocialList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT));
librarySocialListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.and(obj1 -> obj1.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.or()
.in(TForecastLibrary::getProvidentPayMonth, payMonthList))
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT));
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT));
libraryListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
libraryFundListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.and(obj1 -> obj1.in(TForecastLibrary::getSocialPayMonth, payMonthList).or().in(TForecastLibrary::getProvidentPayMonth, payMonthList))
.ne(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT));
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT));
socialInfoList = socialFundInfoMapper.getSocialList(empIdCard, null);
fundList = socialFundInfoMapper.getFundList(empIdCard, null);
} else {
libraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
librarySocialList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.in(TForecastLibrary::getSettleDomainId, settleDomainIdList)
.and(obj1 -> obj1.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.or()
.in(TForecastLibrary::getProvidentPayMonth, payMonthList))
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT));
libraryListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
librarySocialListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.in(TForecastLibrary::getSettleDomainId, settleDomainIdList)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT));
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.in(TForecastLibrary::getSettleDomainId, settleDomainIdList)
.and(obj1 -> obj1.in(TForecastLibrary::getSocialPayMonth, payMonthList).or().in(TForecastLibrary::getProvidentPayMonth, payMonthList))
.ne(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT));
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT));
libraryFundListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.in(TForecastLibrary::getSettleDomainId, settleDomainIdList)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT));
socialInfoList = socialFundInfoMapper.getSocialList(null, settleDomainIdList);
fundList = socialFundInfoMapper.getFundList(null, settleDomainIdList);
}
......@@ -242,38 +267,42 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return R.failed("无需要重新生成的数据(无数据或数据已结算不可重新生成!)");
}
//先删除然后重新生成
if (Common.isNotNull(libraryList)) {
baseMapper.deleteBatchIds(libraryList);
if (Common.isNotNull(librarySocialList)) {
baseMapper.deleteBatchIds(librarySocialList);
}
if (Common.isNotNull(libraryFundList)) {
baseMapper.deleteBatchIds(libraryFundList);
}
boolean flag;
// 已推送的预估明细Map
HashMap<String, TForecastLibrary> libraryHashMapTemp = new HashMap<>();
HashMap<String, TForecastLibrary> socialPushMap = new HashMap<>();
HashMap<String, TForecastLibrary> fundPushMap = new HashMap<>();
// Map的key
StringBuilder sfMapKey;
StringBuilder initKey;
if (Common.isNotNull(libraryListTemp)) {
String sfMapKey;
if (Common.isNotNull(librarySocialListTemp)) {
TForecastLibrary libraryOld;
for (TForecastLibrary library : libraryListTemp) {
sfMapKey = new StringBuilder(library.getEmpIdcard());
// 获取key
if (Common.isNotNull(library.getSocialProvince())) {
this.getMapKey(sfMapKey, library.getSocialProvince(), library.getSocialCity(), library.getSocialTown());
} else {
this.getMapKey(sfMapKey, library.getFundProvince(), library.getFundCity(), library.getFundTown());
for (TForecastLibrary library : librarySocialListTemp) {
sfMapKey = this.getMapKey(library.getEmpIdcard(), library.getSettleDomainId(), library.getSocialPayMonth(), library.getSocialCreateMonth());
libraryOld = socialPushMap.get(sfMapKey);
if (libraryOld != null) {
this.getChangeAddData(libraryOld, library);
}
sfMapKey.append(CommonConstants.DOWN_LINE_STRING).append(library.getSocialPayMonth());
sfMapKey.append(CommonConstants.DOWN_LINE_STRING).append(library.getSocialCreateMonth());
libraryOld = libraryHashMapTemp.get(sfMapKey.toString());
socialPushMap.put(sfMapKey, library);
}
}
if (Common.isNotNull(libraryFundListTemp)) {
TForecastLibrary libraryOld;
for (TForecastLibrary library : libraryFundListTemp) {
sfMapKey = this.getMapKey(library.getEmpIdcard(), library.getSettleDomainId(), library.getProvidentPayMonth(), library.getProvidentCreateMonth());
libraryOld = fundPushMap.get(sfMapKey);
if (libraryOld != null) {
this.getChangeAddData(libraryOld, library);
}
libraryHashMapTemp.put(sfMapKey.toString(), library);
fundPushMap.put(sfMapKey, library);
}
}
HashMap<String, TForecastLibrary> libraryHashMap = new HashMap<>();
Map<String, TForecastLibrary> saveLibraryMap = new HashMap<>();
TForecastLibrary tForecastLibrary;
// Map的key转String
String mapKeyStr;
String createMonth;
boolean isReduceSocial = false;
boolean isReduceFund = false;
......@@ -282,21 +311,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (Common.isNotNull(socialInfoList)) {
for (TSocialFundInfo tSocialInfo : socialInfoList) {
createMonth = ServiceUtil.initCreateMonth(tSocialInfo.getCreateTime(), payMonth);
sfMapKey = new StringBuilder(tSocialInfo.getEmpIdcard());
// 获取key
this.getMapKey(sfMapKey, tSocialInfo.getSocialProvince(), tSocialInfo.getSocialCity(), tSocialInfo.getSocialTown());
sfMapKey.append(CommonConstants.DOWN_LINE_STRING).append(payMonth);
// 不可调换位置
initKey = new StringBuilder();
initKey.append(sfMapKey);
sfMapKey.append(CommonConstants.DOWN_LINE_STRING).append(createMonth);
mapKeyStr = sfMapKey.toString();
sfMapKey = this.getMapKey(tSocialInfo.getEmpIdcard(), tSocialInfo.getSettleDomain(), payMonth, createMonth);
// 变更:已推送的,计算变更值
tForecastLibrary = libraryHashMapTemp.get(mapKeyStr);
tForecastLibrary = socialPushMap.get(sfMapKey);
if (null != tForecastLibrary) {
this.getChangeReduceData(tSocialInfo, tForecastLibrary);
libraryHashMap.put(sfMapKey.toString(), tForecastLibrary);
}
//起缴月份在要生成的月份前不处理
if (Integer.parseInt(payMonth) < DateUtil.formatDateInt(tSocialInfo.getSocialStartDate())) {
......@@ -307,27 +327,18 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return R.failed("员工" + tSocialInfo.getEmpName() + ":" + tSocialInfo.getEmpIdcard() + SocialConstants.SOCIAL_SET_ERROR);
}
// 初始化社保
initSocialLibary(payMonth, libraryHashMap, tSocialInfo, isReduceFund, agentConfigHashMap, initKey);
initSocialLibary(payMonth, saveLibraryMap, tSocialInfo, isReduceFund, agentConfigHashMap, tForecastLibrary, sfMapKey);
}
}
//封装公积金预估数据
if (Common.isNotNull(fundList)) {
for (TSocialFundInfo providentFund : fundList) {
createMonth = ServiceUtil.initCreateMonth(providentFund.getCreateTime(), payMonth);
sfMapKey = new StringBuilder(providentFund.getEmpIdcard());
// 获取key
this.getMapKey(sfMapKey, providentFund.getFundProvince(), providentFund.getFundCity(), providentFund.getFundTown());
sfMapKey.append(CommonConstants.DOWN_LINE_STRING).append(payMonth);
// 不可调换位置
initKey = new StringBuilder();
initKey.append(sfMapKey);
sfMapKey.append(CommonConstants.DOWN_LINE_STRING).append(createMonth);
mapKeyStr = sfMapKey.toString();
sfMapKey = this.getMapKey(providentFund.getEmpIdcard(), providentFund.getSettleDomain(), payMonth, createMonth);
// 变更:已推送的,计算变更值
tForecastLibrary = libraryHashMapTemp.get(mapKeyStr);
tForecastLibrary = fundPushMap.get(sfMapKey);
if (null != tForecastLibrary) {
this.getChangeReduceData(providentFund, tForecastLibrary);
libraryHashMap.put(sfMapKey.toString(), tForecastLibrary);
}
//起缴月份在要生成的月份后不处理
if (Integer.parseInt(payMonth) < DateUtil.formatDateInt(providentFund.getProvidentStart())) {
......@@ -338,12 +349,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return R.failed("员工" + providentFund.getEmpName() + ":" + providentFund.getEmpIdcard() + SocialConstants.SOCIAL_SET_ERROR);
}
// 初始化公积金
initFundLibary(payMonth, libraryHashMap, providentFund, isReduceSocial, initKey);
initFundLibary(payMonth, saveLibraryMap, providentFund, isReduceSocial, tForecastLibrary, sfMapKey);
}
}
}
boolean isSaveAndUpdate = false;
for (TForecastLibrary library : libraryHashMap.values()) {
for (TForecastLibrary library : saveLibraryMap.values()) {
if (Common.isEmpty(library.getSocialId()) && Common.isEmpty(library.getProvidentId())) {
continue;
}
......@@ -362,6 +373,17 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
private String getMapKey(String empIdcard, String settleDomainId
, String socialPayMonth, String socialCreateMonth) {
StringBuilder sfMapKey;
sfMapKey = new StringBuilder(empIdcard);
// 获取key
sfMapKey.append(CommonConstants.DOWN_LINE_STRING).append(settleDomainId);
sfMapKey.append(CommonConstants.DOWN_LINE_STRING).append(socialPayMonth);
sfMapKey.append(CommonConstants.DOWN_LINE_STRING).append(socialCreateMonth);
return sfMapKey.toString();
}
/**
* @param libraryOld
* @param library
......@@ -460,19 +482,19 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
private void initSocialLibary(String payMonth, HashMap<String, TForecastLibrary> libraryHashMap
, TSocialFundInfo tSocialInfo, boolean isReduceFund, HashMap<String, TAgentConfig> agentConfigMap, StringBuilder mapKeyStr) {
mapKeyStr.append(CommonConstants.DOWN_LINE_STRING).append(ServiceUtil.initCreateMonth(tSocialInfo.getCreateTime(), payMonth));
TForecastLibrary lib = libraryHashMap.get(mapKeyStr.toString());
private void initSocialLibary(String payMonth, Map<String, TForecastLibrary> saveLibraryMap
, TSocialFundInfo tSocialInfo, boolean isReduceFund, HashMap<String, TAgentConfig> agentConfigMap
, TForecastLibrary lib, String sfMapKey) {
if (null == lib) {
lib = new TForecastLibrary();
}
lib.setDataType(CommonConstants.ZERO_INT);
lib.setEmpId(tSocialInfo.getEmpId());
lib.setEmpIdcard(tSocialInfo.getEmpIdcard());
lib.setEmpName(tSocialInfo.getEmpName());
lib.setEmpNo(tSocialInfo.getEmpNo());
lib.setSocialCreateMonth(ServiceUtil.initCreateMonth(tSocialInfo.getCreateTime(), payMonth));
lib.setProvidentCreateMonth(lib.getSocialCreateMonth());
}
lib.setSocialPayMonth(payMonth);
//同时处理公积金日期
lib.setProvidentPayMonth(payMonth);
......@@ -493,7 +515,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
isReduceSocial = false;
}
lib = initForecastLibrary(lib, tSocialInfo, null, monthT, isReduceFund, isReduceSocial, agentConfigMap);
libraryHashMap.put(mapKeyStr.toString(), lib);
saveLibraryMap.put(sfMapKey, lib);
}
/**
......@@ -1112,26 +1134,25 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
* 初始化公积金预估信息
*
* @param payMonth
* @param libraryHashMap
* @param saveLibraryMap
* @param providentFund
* @param isReduceSocial
* @return
* @Author fxj
* @Date 2020-07-21
**/
private void initFundLibary(String payMonth, HashMap<String, TForecastLibrary> libraryHashMap
, TSocialFundInfo providentFund, boolean isReduceSocial, StringBuilder mapKeyStr) {
mapKeyStr.append(CommonConstants.DOWN_LINE_STRING).append(ServiceUtil.initCreateMonth(providentFund.getCreateTime(), payMonth));
TForecastLibrary lib = libraryHashMap.get(mapKeyStr.toString());
if (null == lib) {
private void initFundLibary(String payMonth, Map<String, TForecastLibrary> saveLibraryMap
, TSocialFundInfo providentFund, boolean isReduceSocial, TForecastLibrary lib, String mapKeyStr) {
if (lib == null) {
lib = new TForecastLibrary();
}
lib.setDataType(CommonConstants.ONE_INT);
lib.setEmpId(providentFund.getEmpId());
lib.setEmpIdcard(providentFund.getEmpIdcard());
lib.setEmpName(providentFund.getEmpName());
lib.setEmpNo(providentFund.getEmpNo());
lib.setProvidentCreateMonth(ServiceUtil.initCreateMonth(providentFund.getCreateTime(), payMonth));
lib.setSocialCreateMonth(lib.getProvidentCreateMonth());
}
//同时处理社保日期
lib.setSocialPayMonth(payMonth);
lib.setProvidentPayMonth(payMonth);
......@@ -1161,7 +1182,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
isReduceFund = false;
}
lib = initForecastLibrary(lib, null, providentFund, monthT, isReduceFund, isReduceSocial, null);
libraryHashMap.put(mapKeyStr.toString(), lib);
saveLibraryMap.put(mapKeyStr, lib);
}
}
......@@ -94,6 +94,7 @@
<result property="providentHouseholdName" column="PROVIDENT_HOUSEHOLD_NAME"/>
<result property="providentNo" column="PROVIDENT_NO"/>
<result property="dataPush" column="DATA_PUSH"/>
<result property="dataType" column="DATA_TYPE"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
......@@ -101,10 +102,7 @@
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a
.
ID
,
a.ID,
a.EMP_ID,
a.EMP_NO,
a.EMP_NAME,
......@@ -174,6 +172,7 @@
a.PROVIDENT_HOUSEHOLD_NAME,
a.PROVIDENT_NO,
a.DATA_PUSH,
a.DATA_TYPE,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
......@@ -398,6 +397,9 @@
<if test="tForecastLibrary.dataPush != null">
AND a.DATA_PUSH = #{tForecastLibrary.dataPush}
</if>
<if test="tForecastLibrary.dataType != null">
AND a.DATA_TYPE = #{tForecastLibrary.dataType}
</if>
<if test="tForecastLibrary.createBy != null and tForecastLibrary.createBy.trim() != ''">
AND a.CREATE_BY = #{tForecastLibrary.createBy}
</if>
......
......@@ -31,9 +31,17 @@
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="empType" column="EMP_TYPE"/>
<result property="settleDomain" column="SETTLE_DOMAIN"/>
<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
<result property="unitName" column="UNIT_NAME"/>
<result property="unitId" column="UNIT_ID"/>
<result property="settleDomainFund" column="SETTLE_DOMAIN_FUND"/>
<result property="settleDomainCodeFund" column="SETTLE_DOMAIN_CODE_FUND"/>
<result property="settleDomainNameFund" column="SETTLE_DOMAIN_NAME_FUND"/>
<result property="unitNameFund" column="UNIT_NAME_FUND"/>
<result property="unitIdFund" column="UNIT_ID_FUND"/>
<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
<result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
<result property="socialProvince" column="SOCIAL_PROVINCE"/>
......@@ -145,6 +153,8 @@
<result property="personalSocialSum" column="PERSONAL_SOCIAL_SUM"/>
<result property="unitInterestFee" column="UNIT_INTEREST_FEE"/>
<result property="personalInterestFee" column="PERSONAL_INTEREST_FEE"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -154,9 +164,15 @@
a.EMP_IDCARD,
a.EMP_TYPE,
a.SETTLE_DOMAIN,
a.SETTLE_DOMAIN_CODE,
a.SETTLE_DOMAIN_NAME,
a.UNIT_NAME,
a.UNIT_ID,
a.SETTLE_DOMAIN_FUND,
a.SETTLE_DOMAIN_CODE_FUND,
a.SETTLE_DOMAIN_NAME_FUND,
a.UNIT_NAME_FUND,
a.UNIT_ID_FUND,
a.SOCIAL_HOUSEHOLD,
a.SOCIAL_HOUSEHOLD_NAME,
a.SOCIAL_PROVINCE,
......
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